Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrPkgNotFound = errors.New("pkg not found") ErrPkgMod = errors.New("pkg has no module information") ErrNoGoFilesFound = errors.New("pkg has no Go files") ErrMethodFormat = errors.New("invalid method format. Expected: Method(MethodReq) MethodRes") ErrMethodObjParse = errors.New("cannot parse object for method") ErrObjNotStruct = errors.New("object is not a struct") ErrObjNotFound = errors.New("object not found") ErrFieldUnexported = errors.New("filed is unexported") ErrFieldIsStruct = errors.New("filed cannot not be struct") )
Functions ¶
Types ¶
type Definition ¶
type Definition struct { Package string `json:"package"` Imports map[string]string `json:"imports"` Services []Service `json:"services"` Objects []Object `json:"objects"` }
Definition will map the contents of service/def dir to an interfaces
func Generate ¶
func Generate(pkgName, defPath string) (*Definition, error)
func (*Definition) MetadataLookup ¶
func (d *Definition) MetadataLookup(keyPath, key string) *MetadataValueDesc
func (*Definition) ObjectLookup ¶
func (d *Definition) ObjectLookup(name string) (*Object, error)
func (*Definition) ToJSON ¶
func (d *Definition) ToJSON() string
type Field ¶
type Field struct { Name string `json:"name"` NameCamelLowerCase string `json:"nameCamelLowerCase"` Type FieldType `json:"type"` OmitEmpty bool `json:"omitEmpty"` Tag string `json:"tag"` ParsedTags map[string]FieldTag `json:"parsedTags"` Comment string `json:"comment"` Metadata Metadata `json:"metadata"` }
type FieldType ¶
type FieldType struct { TypeID string `json:"typeId"` TypeName string `json:"typeName"` ObjName string `json:"objName"` ObjNameToLowerCamelCase string `json:"objNameToLowerCamelCase"` Package string `json:"package"` IsCollection bool `json:"isCollection"` IsObject bool `json:"isObject"` JSType string `json:"jsType"` TSType string `json:"tsType"` Length int `json:"len"` }
type MetaKeyResult ¶
type MetaKeyResult struct { Exists bool Result interface{} }
type Metadata ¶
type Metadata map[string]MetadataValueDesc
func (Metadata) Get ¶
func (m Metadata) Get(key string) *MetadataValueDesc
type MetadataValueDesc ¶
type MetadataValueDesc struct { Value interface{} `json:"value"` Description string `json:"description,omitempty"` }
Click to show internal directories.
Click to hide internal directories.