model

package
v0.4.24 Latest Latest
Warning

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

Go to latest
Published: Sep 8, 2022 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

BuildFederatedModel ...

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"`
}

Config ...

func LoadConfig

func LoadConfig() (c Config, err error)

LoadConfig ...

func LoadConfigFromPath

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

LoadConfigFromPath ...

func (*Config) ConnMaxLifetime

func (c *Config) ConnMaxLifetime() float64

ConnMaxLifetime ...

func (*Config) MaxIdleConnections

func (c *Config) MaxIdleConnections() uint

MaxIdleConnections ...

func (*Config) MaxOpenConnections

func (c *Config) MaxOpenConnections() uint

MaxOpenConnections ...

type FilterMappingItem

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

FilterMappingItem ...

func (*FilterMappingItem) SuffixCamel

func (f *FilterMappingItem) SuffixCamel() string

SuffixCamel ...

func (*FilterMappingItem) WrapValueVariable

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

WrapValueVariable ...

type Model

type Model struct {
	Doc *ast.Document
}

Model ...

func Parse

func Parse(m string) (Model, error)

Parse ...

func (*Model) EmbeddedObjects added in v0.2.0

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

EmbeddedObjects ...

func (*Model) HasEnum

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

HasEnum ...

func (*Model) HasFederatedTypes

func (m *Model) HasFederatedTypes() bool

HasFederatedTypes ...

func (*Model) HasObject

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

HasObject ...

func (*Model) HasObjectExtension

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

HasObjectExtension ...

func (*Model) HasScalar

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

HasScalar ...

func (*Model) Object

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

Object ...

func (*Model) ObjectEntities

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

ObjectEntities ...

func (*Model) ObjectExtension

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

ObjectExtension ...

func (*Model) ObjectExtensions

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

ObjectExtensions ...

func (*Model) Objects

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

Objects ...

func (*Model) RemoveObjectExtension

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

RemoveObjectExtension ...

type Object

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

Object ...

func (*Object) AggregationsByField added in v0.4.21

func (o *Object) AggregationsByField() (res map[string]*ObjectFieldAggregation)

AggregationsByField ...

func (*Object) Column

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

Column ...

func (*Object) Columns

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

Columns ...

func (*Object) Directive

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

Directive ...

func (*Object) Field

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

Field ...

func (*Object) Fields

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

Fields ...

func (*Object) HasAggregableColumn added in v0.4.21

func (o *Object) HasAggregableColumn() bool

HasAggregableColumn ...

func (*Object) HasAnyRelationships

func (o *Object) HasAnyRelationships() bool

HasAnyRelationships ...

func (*Object) HasColumn

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

HasColumn ...

func (*Object) HasDirective

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

HasDirective ...

func (*Object) HasEmbeddedField

func (o *Object) HasEmbeddedField() bool

HasEmbeddedField ...

func (*Object) HasField

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

HasField ...

func (*Object) HasPreloadableRelationships added in v0.1.0

func (o *Object) HasPreloadableRelationships() bool

HasPreloadableRelationships ...

func (*Object) HasReadonlyColumns

func (o *Object) HasReadonlyColumns() bool

HasReadonlyColumns ...

func (*Object) HasRelationship

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

HasRelationship ....

func (*Object) Interfaces added in v0.1.8

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

Interfaces ...

func (*Object) IsExtended

func (o *Object) IsExtended() bool

IsExtended ....

func (*Object) IsFederatedType

func (o *Object) IsFederatedType() bool

IsFederatedType ...

func (*Object) IsToManyColumn

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

IsToManyColumn ...

func (*Object) LowerName

func (o *Object) LowerName() string

LowerName ...

func (*Object) Name

func (o *Object) Name() string

Name ...

func (*Object) NeedsQueryResolver

func (o *Object) NeedsQueryResolver() bool

NeedsQueryResolver ....

func (*Object) PluralName

func (o *Object) PluralName() string

PluralName ...

func (*Object) PreloadableRelationships added in v0.1.0

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

PreloadableRelationships ...

func (*Object) Relationship

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

Relationship ...

func (*Object) Relationships

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

Relationships ...

func (*Object) TableName

func (o *Object) TableName() string

TableName ...

type ObjectExtension

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

ObjectExtension ...

func (*ObjectExtension) ExtendsLocalObject

func (oe *ObjectExtension) ExtendsLocalObject() bool

ExtendsLocalObject ...

func (*ObjectExtension) HasAnyNonExternalField added in v0.4.21

func (oe *ObjectExtension) HasAnyNonExternalField() bool

IsExternal ...

func (*ObjectExtension) IsFederatedType

func (oe *ObjectExtension) IsFederatedType() bool

IsFederatedType ...

type ObjectField

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

ObjectField ...

func (*ObjectField) Aggregations added in v0.4.12

func (o *ObjectField) Aggregations() []ObjectFieldAggregation

Aggregations ...

func (*ObjectField) ColumnType added in v0.2.0

func (o *ObjectField) ColumnType() (value string)

ColumnType ...

func (*ObjectField) Directive

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

Directive ...

func (*ObjectField) FilterMapping

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

FilterMapping ...

func (*ObjectField) GoResultType added in v0.2.0

func (o *ObjectField) GoResultType() string

GoResultType ...

func (*ObjectField) GoType

func (o *ObjectField) GoType() string

GoType ...

func (*ObjectField) GoTypeWithPointer

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

GoTypeWithPointer ...

func (*ObjectField) HasDirective

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

HasDirective ...

func (*ObjectField) HasTargetObject

func (o *ObjectField) HasTargetObject() bool

HasTargetObject ...

func (*ObjectField) HasTargetObjectExtension

func (o *ObjectField) HasTargetObjectExtension() bool

HasTargetObjectExtension ...

func (*ObjectField) HasTargetTypeWithIDField

func (o *ObjectField) HasTargetTypeWithIDField() bool

HasTargetTypeWithIDField ...

func (*ObjectField) InputType added in v0.2.0

func (o *ObjectField) InputType() ast.Type

InputType ...

func (*ObjectField) InputTypeName added in v0.2.0

func (o *ObjectField) InputTypeName() string

InputTypeName ...

func (*ObjectField) IsAggregable added in v0.4.21

func (o *ObjectField) IsAggregable() bool

IsAggregable ...

func (*ObjectField) IsColumn

func (o *ObjectField) IsColumn() bool

IsColumn ...

func (*ObjectField) IsCreatable

func (o *ObjectField) IsCreatable() bool

IsCreatable ...

func (*ObjectField) IsEmbedded

func (o *ObjectField) IsEmbedded() bool

IsEmbedded ...

func (*ObjectField) IsEmbeddedColumn added in v0.2.0

func (o *ObjectField) IsEmbeddedColumn() bool

IsEmbeddedColumn ...

func (*ObjectField) IsEnumType

func (o *ObjectField) IsEnumType() bool

IsEnumType ...

func (*ObjectField) IsExternal added in v0.4.21

func (o *ObjectField) IsExternal() bool

IsExternal ...

func (*ObjectField) IsFilterable added in v0.2.0

func (o *ObjectField) IsFilterable() bool

IsFilterable ...

func (*ObjectField) IsIdentifier added in v0.1.10

func (o *ObjectField) IsIdentifier() bool

IsIdentifier ...

func (*ObjectField) IsList

func (o *ObjectField) IsList() bool

IsList ...

func (*ObjectField) IsNumeric added in v0.4.12

func (o *ObjectField) IsNumeric() bool

IsNumeric ...

func (*ObjectField) IsOptional

func (o *ObjectField) IsOptional() bool

IsOptional ...

func (*ObjectField) IsReadonlyType

func (o *ObjectField) IsReadonlyType() bool

IsReadonlyType ..

func (*ObjectField) IsRelationship

func (o *ObjectField) IsRelationship() bool

IsRelationship ...

func (*ObjectField) IsRelationshipIdentifier added in v0.2.0

func (o *ObjectField) IsRelationshipIdentifier() bool

IsRelationshipIdentifier ...

func (*ObjectField) IsScalarType

func (o *ObjectField) IsScalarType() bool

IsScalarType ...

func (*ObjectField) IsSearchable

func (o *ObjectField) IsSearchable() bool

IsSearchable ...

func (*ObjectField) IsSortable added in v0.1.0

func (o *ObjectField) IsSortable() bool

IsSortable ...

func (*ObjectField) IsString added in v0.0.3

func (o *ObjectField) IsString() bool

IsString ...

func (*ObjectField) IsUpdatable

func (o *ObjectField) IsUpdatable() bool

IsUpdatable ...

func (*ObjectField) IsWritableType

func (o *ObjectField) IsWritableType() bool

IsWritableType ...

func (*ObjectField) MethodName

func (o *ObjectField) MethodName() string

MethodName ...

func (*ObjectField) ModelTags

func (o *ObjectField) ModelTags() string

ModelTags ...

func (*ObjectField) Name

func (o *ObjectField) Name() string

Name ...

func (*ObjectField) NeedsQueryResolver

func (o *ObjectField) NeedsQueryResolver() bool

NeedsQueryResolver ...

func (*ObjectField) TargetObject

func (o *ObjectField) TargetObject() *Object

TargetObject ...

func (*ObjectField) TargetObjectExtension

func (o *ObjectField) TargetObjectExtension() *ObjectExtension

TargetObjectExtension ...

func (*ObjectField) TargetType

func (o *ObjectField) TargetType() string

TargetType ...

type ObjectFieldAggregation added in v0.4.12

type ObjectFieldAggregation struct {
	Field string
	Name  string
	Type  ast.Type
}

ObjectFieldAggregation specifies which aggregation functions are supported for given field

func (*ObjectFieldAggregation) FieldName added in v0.4.21

func (a *ObjectFieldAggregation) FieldName() string

FieldName ...

func (*ObjectFieldAggregation) SQLColumn added in v0.4.21

func (a *ObjectFieldAggregation) SQLColumn() string

SQLColumn ...

type ObjectRelationship

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

ObjectRelationship ...

func (*ObjectRelationship) BoolForRelationshipDirectiveAttribute added in v0.1.0

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

BoolForRelationshipDirectiveAttribute ...

func (*ObjectRelationship) ChangesName

func (o *ObjectRelationship) ChangesName() string

ChangesName ...

func (*ObjectRelationship) ChangesType

func (o *ObjectRelationship) ChangesType() string

ChangesType ...

func (*ObjectRelationship) ForeignKeyDestinationColumn added in v0.3.0

func (o *ObjectRelationship) ForeignKeyDestinationColumn() string

ForeignKeyDestinationColumn ...

func (*ObjectRelationship) GoType

func (o *ObjectRelationship) GoType() string

GoType ...

func (*ObjectRelationship) InverseRelationship

func (o *ObjectRelationship) InverseRelationship() *ObjectRelationship

InverseRelationship ...

func (*ObjectRelationship) InverseRelationshipName

func (o *ObjectRelationship) InverseRelationshipName() string

InverseRelationshipName ...

func (*ObjectRelationship) IsMainRelationshipForManyToMany

func (o *ObjectRelationship) IsMainRelationshipForManyToMany() bool

IsMainRelationshipForManyToMany ...

func (*ObjectRelationship) IsManyToMany

func (o *ObjectRelationship) IsManyToMany() bool

IsManyToMany ...

func (*ObjectRelationship) IsManyToOne

func (o *ObjectRelationship) IsManyToOne() bool

IsManyToOne ...

func (*ObjectRelationship) IsNonNull

func (o *ObjectRelationship) IsNonNull() bool

IsNonNull ...

func (*ObjectRelationship) IsOneToMany

func (o *ObjectRelationship) IsOneToMany() bool

IsOneToMany ...

func (*ObjectRelationship) IsSelfReferencing

func (o *ObjectRelationship) IsSelfReferencing() bool

IsSelfReferencing ...

func (*ObjectRelationship) IsToMany

func (o *ObjectRelationship) IsToMany() bool

IsToMany ...

func (*ObjectRelationship) IsToOne

func (o *ObjectRelationship) IsToOne() bool

IsToOne ...

func (*ObjectRelationship) JoinString

func (o *ObjectRelationship) JoinString() string

JoinString ...

func (*ObjectRelationship) MainRelationshipForManyToMany

func (o *ObjectRelationship) MainRelationshipForManyToMany() *ObjectRelationship

MainRelationshipForManyToMany ...

func (*ObjectRelationship) ManyToManyJoinTable

func (o *ObjectRelationship) ManyToManyJoinTable() string

ManyToManyJoinTable ...

func (*ObjectRelationship) ManyToManyObjectName added in v0.3.0

func (o *ObjectRelationship) ManyToManyObjectName() string

ManyToManyObjectName ...

func (*ObjectRelationship) MethodName

func (o *ObjectRelationship) MethodName() string

MethodName ...

func (*ObjectRelationship) ModelTags

func (o *ObjectRelationship) ModelTags() string

ModelTags ...

func (*ObjectRelationship) Name

func (o *ObjectRelationship) Name() string

Name ...

func (*ObjectRelationship) OnDelete added in v0.3.0

func (o *ObjectRelationship) OnDelete(def string) string

OnDelete ...

func (*ObjectRelationship) OnUpdate added in v0.3.0

func (o *ObjectRelationship) OnUpdate(def string) string

OnUpdate ...

func (*ObjectRelationship) Preload added in v0.1.0

func (o *ObjectRelationship) Preload() bool

Preload ...

func (*ObjectRelationship) ReturnType

func (o *ObjectRelationship) ReturnType() string

ReturnType ...

func (*ObjectRelationship) StringForRelationshipDirectiveAttribute added in v0.1.0

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

StringForRelationshipDirectiveAttribute ...

func (*ObjectRelationship) Target

func (o *ObjectRelationship) Target() *Object

Target ...

func (*ObjectRelationship) TargetType

func (o *ObjectRelationship) TargetType() string

TargetType ...

func (*ObjectRelationship) ValueForRelationshipDirectiveAttribute added in v0.1.0

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

ValueForRelationshipDirectiveAttribute ...

Jump to

Keyboard shortcuts

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