module

package
v1.0.10 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 27, 2023 License: Apache-2.0 Imports: 24 Imported by: 1

Documentation

Index

Constants

View Source
const (
	BasicKind   = TypeKind(iota + 1) // 基本类型,oas时不需要ref
	BuiltinKind                      // 内置类型,oas时需要ref,但不需要建component
	IdentKind
	InterfaceKind
	StructKind
	StructFieldKind
	PointerKind
	ArrayKind
	MapKind
	AnyKind
	ParadigmKind
	ParadigmElementKind
	ReferenceKind
)

Variables

View Source
var AnyType = &Type{
	Kind:        AnyKind,
	Path:        "",
	Name:        "",
	Annotations: nil,
	Paradigms:   nil,
	Tags:        nil,
	Elements:    nil,
}

Functions

func GOPATH

func GOPATH() (gopath string, has bool)

func GOROOT

func GOROOT() (goroot string, has bool)

func LatestVersion added in v1.0.0

func LatestVersion(path string) (v string, err error)

func LatestVersionFromProxy added in v1.0.0

func LatestVersionFromProxy(path string) (v string, err error)

func PKG

func PKG() (pkg string)

func RegisterBuiltinType

func RegisterBuiltinType(typ *Type)

Types

type Annotations

type Annotations map[string]string

func ParseAnnotations

func ParseAnnotations(s string) (annotations Annotations, err error)

func (Annotations) Get

func (annotations Annotations) Get(key string) (value string, has bool)

type Component

type Component struct {
	Indent string
}

type Components

type Components []*Component

func (Components) Len

func (components Components) Len() int

func (Components) Less

func (components Components) Less(i, j int) bool

func (Components) Swap

func (components Components) Swap(i, j int)

type DepResult added in v1.0.0

type DepResult struct {
	Version DepVersion `json:"version"`
}

type DepVersion added in v1.0.0

type DepVersion struct {
	Version string `json:"version"`
}

type Function

type Function struct {
	Ident       string
	ConstIdent  string
	ProxyIdent  string
	Annotations map[string]string
	Param       *FunctionField
	Result      *FunctionField
	// contains filtered or unexported fields
}

func (*Function) Authorization

func (f *Function) Authorization() (ok bool)

func (*Function) Barrier

func (f *Function) Barrier() (ok bool)

func (*Function) Deprecated

func (f *Function) Deprecated() (ok bool)

func (*Function) Description

func (f *Function) Description() (description string)

func (*Function) Errors

func (f *Function) Errors() (errs []FunctionError)

func (*Function) FieldImports

func (f *Function) FieldImports() (v Imports)

func (*Function) Handle added in v1.0.3

func (f *Function) Handle(ctx context.Context) (result interface{}, err error)

func (*Function) HostServiceName

func (f *Function) HostServiceName() (name string)

func (*Function) Internal

func (f *Function) Internal() (ok bool)

func (*Function) Name

func (f *Function) Name() (name string)

func (*Function) Parse

func (f *Function) Parse(ctx context.Context) (err error)

func (*Function) Permission

func (f *Function) Permission() (ok bool)

func (*Function) SQL

func (f *Function) SQL() (name string, has bool)

func (*Function) Timeout

func (f *Function) Timeout() (timeout time.Duration, has bool, err error)

func (*Function) Title

func (f *Function) Title() (title string)

func (*Function) Transactional

func (f *Function) Transactional() (has bool)

func (*Function) Validation

func (f *Function) Validation() (title string, ok bool)

type FunctionError

type FunctionError struct {
	Name         string
	Descriptions map[string]string
}

type FunctionField

type FunctionField struct {
	Name string
	Type *Type
}

func (*FunctionField) Paths

func (sf *FunctionField) Paths() (paths []string)

func (*FunctionField) String

func (sf *FunctionField) String() (v string)

type Functions

type Functions []*Function

func (Functions) Len

func (fns Functions) Len() int

func (Functions) Less

func (fns Functions) Less(i, j int) bool

func (Functions) Swap

func (fns Functions) Swap(i, j int)

type Import

type Import struct {
	Path  string
	Alias string
}

func (*Import) Ident

func (i *Import) Ident() (ident string)

func (*Import) Name

func (i *Import) Name() (name string)

type Imports

type Imports map[string]*Import

Imports 一个fn文件一个,所以key不会重复,

func MergeImports

func MergeImports(ss []Imports) (v Imports)

MergeImports 在service里增加fn的imports用

func (Imports) Add

func (s Imports) Add(i *Import)

func (Imports) Find

func (s Imports) Find(ident string) (v *Import, has bool)

func (Imports) Len

func (s Imports) Len() (n int)

func (Imports) Path

func (s Imports) Path(path string) (v *Import, has bool)

type Module

type Module struct {
	Dir      string
	Path     string
	Version  string
	Requires Requires
	Work     *Work
	Replace  *Module
	// contains filtered or unexported fields
}

func New

func New(path string) (v *Module, err error)

func NewWithWork

func NewWithWork(path string, workPath string) (v *Module, err error)

func (*Module) GetType added in v1.0.0

func (mod *Module) GetType(path string, name string) (typ *Type, has bool)

func (*Module) Parse added in v1.0.0

func (mod *Module) Parse(ctx context.Context) (err error)

func (*Module) ParseType

func (mod *Module) ParseType(ctx context.Context, path string, name string) (typ *Type, err error)

func (*Module) Services

func (mod *Module) Services() (services Services, err error)

func (*Module) String

func (mod *Module) String() (s string)

func (*Module) Types added in v1.0.0

func (mod *Module) Types() (types map[string]*Type)

type Requires

type Requires []*Module

func (Requires) Len

func (requires Requires) Len() int

func (Requires) Less

func (requires Requires) Less(i, j int) (ok bool)

func (Requires) Swap

func (requires Requires) Swap(i, j int)

type Service

type Service struct {
	Dir         string
	Path        string
	PathIdent   string
	Name        string
	Internal    bool
	Title       string
	Description string
	Imports     Imports
	Functions   Functions
	Components  Components
	// contains filtered or unexported fields
}

type Services

type Services []*Service

func (Services) Len

func (services Services) Len() int

func (Services) Less

func (services Services) Less(i, j int) bool

func (Services) Swap

func (services Services) Swap(i, j int)

type SourceDirReader

type SourceDirReader struct {
	// contains filtered or unexported fields
}

func (*SourceDirReader) Each

func (reader *SourceDirReader) Each(fn func(file *ast.File, filename string) (err error)) (err error)

func (*SourceDirReader) Find

func (reader *SourceDirReader) Find(matcher func(file *ast.File) (ok bool)) (file *ast.File, err error)

type SourceFile

type SourceFile struct {
	// contains filtered or unexported fields
}

func (*SourceFile) File

func (sf *SourceFile) File() (file *ast.File, err error)

type Sources

type Sources struct {
	// contains filtered or unexported fields
}

func (*Sources) FindFileInDir

func (sources *Sources) FindFileInDir(path string, matcher func(file *ast.File) (ok bool)) (file *ast.File, err error)

func (*Sources) FindTypeSpec

func (sources *Sources) FindTypeSpec(path string, name string) (spec *ast.TypeSpec, imports Imports, genericDoc string, err error)

func (*Sources) ReadDir

func (sources *Sources) ReadDir(path string, fn func(file *ast.File, filename string) (err error)) (err error)

func (*Sources) ReadFile

func (sources *Sources) ReadFile(path string, name string) (file *ast.File, filename string, err error)

type Type

type Type struct {
	Kind            TypeKind
	Path            string
	Name            string
	Annotations     Annotations
	Paradigms       []*TypeParadigm
	Tags            map[string]string
	Elements        []*Type
	ParadigmsPacked *Type
}

func (*Type) Basic

func (typ *Type) Basic() (name string, ok bool)

func (*Type) Copied

func (typ *Type) Copied() (v *Type)

func (*Type) Flats added in v1.0.0

func (typ *Type) Flats() (v map[string]*Type)

func (*Type) GetTopPaths

func (typ *Type) GetTopPaths() (paths []string)

func (*Type) Key

func (typ *Type) Key() (key string)

func (*Type) String

func (typ *Type) String() (v string)

type TypeKind

type TypeKind int

func (TypeKind) String

func (kind TypeKind) String() string

type TypeParadigm

type TypeParadigm struct {
	Name  string
	Types []*Type
}

func (*TypeParadigm) String

func (tp *TypeParadigm) String() (v string)

type TypeScope

type TypeScope struct {
	Path       string
	Mod        *Module
	Imports    Imports
	GenericDoc string
}

type Types

type Types struct {
	// contains filtered or unexported fields
}

type Work

type Work struct {
	Filename string
	Uses     []*Module
	Replaces []*Module
	// contains filtered or unexported fields
}

func (*Work) Parse added in v1.0.0

func (work *Work) Parse() (err error)

func (*Work) Use

func (work *Work) Use(path string) (v *Module, used bool)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL