model

package
v0.0.0-...-8a06add Latest Latest
Warning

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

Go to latest
Published: Dec 7, 2019 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuildFederatedModel

func BuildFederatedModel(m *Model) error

func EnrichModel

func EnrichModel(m *Model) error

EnrichModel ...

func EnrichModelObjects

func EnrichModelObjects(m *Model) error

EnrichModelObjects ...

func IndexOf

func IndexOf(str []interface{}, data interface{}) int

查找数组并返回下标

func PrintSchema

func PrintSchema(model Model) (string, error)

PrintSchema

func RegexpReplace

func RegexpReplace(str, start string, end string) string

正则截取

func ReplaceAll

func ReplaceAll(data, reg, target string) string

正则替换

func ToLower

func ToLower(str string) string

Types

type Config

type Config struct {
	Package    string `json:"package"`
	Connection *struct {
		MaxIdleConnections *uint   `json:"maxIdleConnections"`
		ConnMaxLifetime    *string `json:"connMaxLifetime"`
		MaxOpenConnections *uint   `json:"maxOpenConnections"`
	} `json:"connection,omitempty"`
}

func LoadConfig

func LoadConfig() (c Config, err error)

func LoadConfigFromPath

func LoadConfigFromPath(p string) (c Config, err error)

func (*Config) ConnMaxLifetime

func (c *Config) ConnMaxLifetime() float64

func (*Config) MaxIdleConnections

func (c *Config) MaxIdleConnections() uint

func (*Config) MaxOpenConnections

func (c *Config) MaxOpenConnections() uint

type FilterMappingItem

type FilterMappingItem struct {
	Suffix      string
	Operator    string
	InputType   ast.Type
	ValueFormat string
}

func (*FilterMappingItem) SuffixCamel

func (f *FilterMappingItem) SuffixCamel() string

func (*FilterMappingItem) WrapValueVariable

func (f *FilterMappingItem) WrapValueVariable(v string) string

type Model

type Model struct {
	Doc *ast.Document
}

func Parse

func Parse(m string) (Model, error)

Parse

func (*Model) HasEnum

func (m *Model) HasEnum(name string) bool

func (*Model) HasFederatedTypes

func (m *Model) HasFederatedTypes() bool

func (*Model) HasObject

func (m *Model) HasObject(name string) bool

func (*Model) HasObjectExtension

func (m *Model) HasObjectExtension(name string) bool

func (*Model) HasScalar

func (m *Model) HasScalar(name string) bool

func (*Model) Object

func (m *Model) Object(name string) Object

func (*Model) ObjectEntities

func (m *Model) ObjectEntities() []Object

func (*Model) ObjectExtension

func (m *Model) ObjectExtension(name string) ObjectExtension

func (*Model) ObjectExtensions

func (m *Model) ObjectExtensions() []ObjectExtension

func (*Model) Objects

func (m *Model) Objects() []Object

func (*Model) RemoveObjectExtension

func (m *Model) RemoveObjectExtension(oe *ObjectExtension)

type Object

type Object struct {
	Def       *ast.ObjectDefinition
	Model     *Model
	Extension *ObjectExtension
}

func (*Object) Column

func (o *Object) Column(name string) *ObjectField

func (*Object) Columns

func (o *Object) Columns() []ObjectField

func (*Object) Directive

func (o *Object) Directive(name string) *ast.Directive

func (*Object) EntityName

func (o *Object) EntityName() string

maiguangyang add 表名

func (*Object) Field

func (o *Object) Field(name string) *ObjectField

func (*Object) Fields

func (o *Object) Fields() []ObjectField

func (*Object) HasAnyRelationships

func (o *Object) HasAnyRelationships() bool

func (*Object) HasColumn

func (o *Object) HasColumn(name string) bool

func (*Object) HasDirective

func (o *Object) HasDirective(name string) bool

func (*Object) HasEmbeddedField

func (o *Object) HasEmbeddedField() bool

func (*Object) HasField

func (o *Object) HasField(name string) bool

func (*Object) HasPreloadableRelationships

func (o *Object) HasPreloadableRelationships() bool

func (*Object) HasReadonlyColumns

func (o *Object) HasReadonlyColumns() bool

func (*Object) HasRelationship

func (o *Object) HasRelationship(name string) bool

func (*Object) Interfaces

func (o *Object) Interfaces() []string

func (*Object) IsExtended

func (o *Object) IsExtended() bool

func (*Object) IsFederatedType

func (o *Object) IsFederatedType() bool

func (*Object) IsToManyColumn

func (o *Object) IsToManyColumn(c ObjectField) bool

func (*Object) LowerName

func (o *Object) LowerName() string

func (*Object) Name

func (o *Object) Name() string

func (*Object) NeedsQueryResolver

func (o *Object) NeedsQueryResolver() bool

func (*Object) PluralName

func (o *Object) PluralName() string

func (*Object) PreloadableRelationships

func (o *Object) PreloadableRelationships() []*ObjectRelationship

func (*Object) Relationship

func (o *Object) Relationship(name string) *ObjectRelationship

func (*Object) Relationships

func (o *Object) Relationships() []*ObjectRelationship

func (*Object) TableName

func (o *Object) TableName() string

type ObjectExtension

type ObjectExtension struct {
	Def    *ast.TypeExtensionDefinition
	Model  *Model
	Object *Object
}

func (*ObjectExtension) ExtendsLocalObject

func (oe *ObjectExtension) ExtendsLocalObject() bool

func (*ObjectExtension) IsFederatedType

func (oe *ObjectExtension) IsFederatedType() bool

type ObjectField

type ObjectField struct {
	Def *ast.FieldDefinition
	Obj *Object
}

func (*ObjectField) Arguments

func (o *ObjectField) Arguments() string

获取Arguments

func (*ObjectField) Columns

func (o *ObjectField) Columns() []ObjectField

func (*ObjectField) Directive

func (o *ObjectField) Directive(name string) *ast.Directive

func (*ObjectField) EntityName

func (o *ObjectField) EntityName() string

表名

func (*ObjectField) Fields

func (o *ObjectField) Fields() string

获取Field

func (*ObjectField) FilterMapping

func (o *ObjectField) FilterMapping() []FilterMappingItem

func (*ObjectField) GetArgValue

func (o *ObjectField) GetArgValue(name string) map[string]map[string]string

maiguangyang new add

func (*ObjectField) GetComment

func (o *ObjectField) GetComment() string

获取字段说明

func (*ObjectField) GetDefault

func (o *ObjectField) GetDefault() string

获取是否默认显示

func (*ObjectField) GetRemark

func (o *ObjectField) GetRemark() string

备注说明字段

func (*ObjectField) GetType

func (o *ObjectField) GetType() string

获取字段说明

func (*ObjectField) GetValidator

func (o *ObjectField) GetValidator() string

获取正则验证

func (*ObjectField) GoType

func (o *ObjectField) GoType() string

func (*ObjectField) GoTypeWithPointer

func (o *ObjectField) GoTypeWithPointer(showPointer bool) string

func (*ObjectField) HasDirective

func (o *ObjectField) HasDirective(name string) bool

func (*ObjectField) HasTargetObject

func (o *ObjectField) HasTargetObject() bool

func (*ObjectField) HasTargetObjectExtension

func (o *ObjectField) HasTargetObjectExtension() bool

func (*ObjectField) HasTargetTypeWithIDField

func (o *ObjectField) HasTargetTypeWithIDField() bool

func (*ObjectField) Inputs

func (o *ObjectField) Inputs() string

获取Input

func (*ObjectField) IsColumn

func (o *ObjectField) IsColumn() bool

func (*ObjectField) IsCreatable

func (o *ObjectField) IsCreatable() bool

func (*ObjectField) IsDel

func (o *ObjectField) IsDel() bool

func (*ObjectField) IsEmbedded

func (o *ObjectField) IsEmbedded() bool

func (*ObjectField) IsEnumType

func (o *ObjectField) IsEnumType() bool

func (*ObjectField) IsIdentifier

func (o *ObjectField) IsIdentifier() bool

func (*ObjectField) IsList

func (o *ObjectField) IsList() bool

func (*ObjectField) IsOptional

func (o *ObjectField) IsOptional() bool

func (*ObjectField) IsPassWord

func (o *ObjectField) IsPassWord() bool

func (*ObjectField) IsReadonlyType

func (o *ObjectField) IsReadonlyType() bool

func (*ObjectField) IsRelationship

func (o *ObjectField) IsRelationship() bool

func (*ObjectField) IsRequired

func (o *ObjectField) IsRequired() bool

func (*ObjectField) IsScalarType

func (o *ObjectField) IsScalarType() bool

func (*ObjectField) IsSearchable

func (o *ObjectField) IsSearchable() bool

func (*ObjectField) IsSortable

func (o *ObjectField) IsSortable() bool

func (*ObjectField) IsState

func (o *ObjectField) IsState() bool

func (*ObjectField) IsString

func (o *ObjectField) IsString() bool

func (*ObjectField) IsUpdatable

func (o *ObjectField) IsUpdatable() bool

func (*ObjectField) IsWritableType

func (o *ObjectField) IsWritableType() bool

func (*ObjectField) LowerName

func (o *ObjectField) LowerName() string

func (*ObjectField) MethodName

func (o *ObjectField) MethodName() string

func (*ObjectField) ModelTags

func (o *ObjectField) ModelTags() string

func (*ObjectField) Name

func (o *ObjectField) Name() string

func (*ObjectField) NeedsQueryResolver

func (o *ObjectField) NeedsQueryResolver() bool

func (*ObjectField) TargetObject

func (o *ObjectField) TargetObject() *Object

func (*ObjectField) TargetObjectExtension

func (o *ObjectField) TargetObjectExtension() *ObjectExtension

func (*ObjectField) TargetType

func (o *ObjectField) TargetType() string

type ObjectRelationship

type ObjectRelationship struct {
	Def *ast.FieldDefinition
	Obj *Object
}

func (*ObjectRelationship) BoolForRelationshipDirectiveAttribute

func (o *ObjectRelationship) BoolForRelationshipDirectiveAttribute(name string) (val bool, ok bool)

func (*ObjectRelationship) ChangesName

func (o *ObjectRelationship) ChangesName() string

func (*ObjectRelationship) ChangesType

func (o *ObjectRelationship) ChangesType() string

func (*ObjectRelationship) GoType

func (o *ObjectRelationship) GoType() string

func (*ObjectRelationship) InverseRelationship

func (o *ObjectRelationship) InverseRelationship() *ObjectRelationship

func (*ObjectRelationship) InverseRelationshipName

func (o *ObjectRelationship) InverseRelationshipName() string

func (*ObjectRelationship) IsMainRelationshipForManyToMany

func (o *ObjectRelationship) IsMainRelationshipForManyToMany() bool

func (*ObjectRelationship) IsManyToMany

func (o *ObjectRelationship) IsManyToMany() bool

func (*ObjectRelationship) IsManyToOne

func (o *ObjectRelationship) IsManyToOne() bool

func (*ObjectRelationship) IsNonNull

func (o *ObjectRelationship) IsNonNull() bool

func (*ObjectRelationship) IsOneToMany

func (o *ObjectRelationship) IsOneToMany() bool

func (*ObjectRelationship) IsSelfReferencing

func (o *ObjectRelationship) IsSelfReferencing() bool

func (*ObjectRelationship) IsToMany

func (o *ObjectRelationship) IsToMany() bool

func (*ObjectRelationship) IsToOne

func (o *ObjectRelationship) IsToOne() bool

func (*ObjectRelationship) JoinString

func (o *ObjectRelationship) JoinString() string

func (*ObjectRelationship) LowerName

func (o *ObjectRelationship) LowerName() string

func (*ObjectRelationship) MainRelationshipForManyToMany

func (o *ObjectRelationship) MainRelationshipForManyToMany() *ObjectRelationship

func (*ObjectRelationship) ManyToManyJoinTable

func (o *ObjectRelationship) ManyToManyJoinTable() string

func (*ObjectRelationship) MethodName

func (o *ObjectRelationship) MethodName() string

func (*ObjectRelationship) ModelTags

func (o *ObjectRelationship) ModelTags() string

func (*ObjectRelationship) Name

func (o *ObjectRelationship) Name() string

func (*ObjectRelationship) Preload

func (o *ObjectRelationship) Preload() bool

func (*ObjectRelationship) ReturnType

func (o *ObjectRelationship) ReturnType() string

func (*ObjectRelationship) StringForRelationshipDirectiveAttribute

func (o *ObjectRelationship) StringForRelationshipDirectiveAttribute(name string) (val string, ok bool)

func (*ObjectRelationship) Target

func (o *ObjectRelationship) Target() *Object

func (*ObjectRelationship) TargetType

func (o *ObjectRelationship) TargetType() string

func (*ObjectRelationship) ValueForRelationshipDirectiveAttribute

func (o *ObjectRelationship) ValueForRelationshipDirectiveAttribute(name string) (val interface{}, ok bool)

type ObjectValid

type ObjectValid struct {
	Def *ast.FieldDefinition
	Obj *Object
}

func (*ObjectValid) GoType

func (o *ObjectValid) GoType() string

func (*ObjectValid) InverseValidatorName

func (o *ObjectValid) InverseValidatorName() string

func (*ObjectValid) MethodName

func (o *ObjectValid) MethodName() string

func (*ObjectValid) ModelTags

func (o *ObjectValid) ModelTags() string

func (*ObjectValid) Name

func (o *ObjectValid) Name() string

func (*ObjectValid) ReturnType

func (o *ObjectValid) ReturnType() string

Jump to

Keyboard shortcuts

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