model

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Jun 30, 2019 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

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

func LoadConfig

func LoadConfig() (c Config, err error)

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

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

func (*Model) Object

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

func (*Model) Objects

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

type Object

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

func (*Object) Columns

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

func (*Object) HasRelationships

func (o *Object) HasRelationships() bool

func (*Object) LowerName

func (o *Object) LowerName() string

func (*Object) Name

func (o *Object) Name() string

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 ObjectColumn

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

func (*ObjectColumn) FilterMapping

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

func (*ObjectColumn) GoType

func (o *ObjectColumn) GoType() string

func (*ObjectColumn) GoTypeWithPointer

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

func (*ObjectColumn) IsCreatable

func (o *ObjectColumn) IsCreatable() bool

func (*ObjectColumn) IsOptional

func (o *ObjectColumn) IsOptional() bool

func (*ObjectColumn) IsSearchable

func (o *ObjectColumn) IsSearchable() bool

func (*ObjectColumn) IsUpdatable

func (o *ObjectColumn) IsUpdatable() bool

func (*ObjectColumn) MethodName

func (o *ObjectColumn) MethodName() string

func (*ObjectColumn) ModelTags

func (o *ObjectColumn) ModelTags() string

func (*ObjectColumn) Name

func (o *ObjectColumn) Name() string

func (*ObjectColumn) TargetType

func (o *ObjectColumn) TargetType() string

type ObjectRelationship

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

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