model

package
v0.0.5 Latest Latest
Warning

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

Go to latest
Published: Sep 24, 2019 License: MIT Imports: 13 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 PrintSchema

func PrintSchema(model Model) (string, error)

PrintSchema

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) 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) HasReadonlyColumns

func (o *Object) HasReadonlyColumns() bool

func (*Object) HasRelationship

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

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) 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) Directive

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

func (*ObjectField) FilterMapping

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

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) IsColumn

func (o *ObjectField) IsColumn() bool

func (*ObjectField) IsCreatable

func (o *ObjectField) IsCreatable() bool

func (*ObjectField) IsEmbedded

func (o *ObjectField) IsEmbedded() bool

func (*ObjectField) IsEnumType

func (o *ObjectField) IsEnumType() bool

func (*ObjectField) IsList

func (o *ObjectField) IsList() bool

func (*ObjectField) IsOptional

func (o *ObjectField) IsOptional() bool

func (*ObjectField) IsReadonlyType

func (o *ObjectField) IsReadonlyType() bool

func (*ObjectField) IsRelationship

func (o *ObjectField) IsRelationship() bool

func (*ObjectField) IsScalarType

func (o *ObjectField) IsScalarType() bool

func (*ObjectField) IsSearchable

func (o *ObjectField) IsSearchable() bool

func (*ObjectField) IsString added in v0.0.3

func (o *ObjectField) IsString() bool

func (*ObjectField) IsUpdatable

func (o *ObjectField) IsUpdatable() bool

func (*ObjectField) IsWritableType

func (o *ObjectField) IsWritableType() bool

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) 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) 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) ReturnType

func (o *ObjectRelationship) ReturnType() string

func (*ObjectRelationship) Target

func (o *ObjectRelationship) Target() *Object

func (*ObjectRelationship) TargetType

func (o *ObjectRelationship) TargetType() string

Jump to

Keyboard shortcuts

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