Documentation ¶
Index ¶
- Variables
- type Attribute
- type BinaryType
- type BitType
- type BoolType
- type EnumType
- type Field
- type FieldBuilder
- func (fb *FieldBuilder) Alias(alias string) *FieldBuilder
- func (fb *FieldBuilder) Attrs(attrs ...Attribute) *FieldBuilder
- func (fb *FieldBuilder) AutoIncrement(autoIncrement bool) *FieldBuilder
- func (fb *FieldBuilder) Build() *Field
- func (fb *FieldBuilder) Comment(comment string) *FieldBuilder
- func (fb *FieldBuilder) Default(d sql.NullString) *FieldBuilder
- func (fb *FieldBuilder) Filterable(filterable bool) *FieldBuilder
- func (fb *FieldBuilder) ForeignKey(foreignKey bool) *FieldBuilder
- func (fb *FieldBuilder) Index(index bool) *FieldBuilder
- func (fb *FieldBuilder) Nullable(nullable bool) *FieldBuilder
- func (fb *FieldBuilder) OnUpdate(onUpdate bool) *FieldBuilder
- func (fb *FieldBuilder) Ops(ops []Op) *FieldBuilder
- func (fb *FieldBuilder) Optional(optional bool) *FieldBuilder
- func (fb *FieldBuilder) PrimaryKey(primaryKey bool) *FieldBuilder
- func (fb *FieldBuilder) Rel(rel *Relation) *FieldBuilder
- func (fb *FieldBuilder) Remote(remote bool) *FieldBuilder
- func (fb *FieldBuilder) Sensitive(sensitive bool) *FieldBuilder
- func (fb *FieldBuilder) Sortable(sortable bool) *FieldBuilder
- func (fb *FieldBuilder) Table(table *Table) *FieldBuilder
- func (fb *FieldBuilder) Tag(tag string) *FieldBuilder
- func (fb *FieldBuilder) Type(t Type) *FieldBuilder
- func (fb *FieldBuilder) Unique(unique bool) *FieldBuilder
- type FloatType
- type IntegerType
- type JSONType
- type JoinTable
- type ObjectType
- type Op
- type RelType
- type Relation
- type Schema
- type SpatialType
- type StringType
- type Table
- func (t *Table) AddFields(fields ...*Field)
- func (t *Table) AutoIncrement() bool
- func (t *Table) Fields() []*Field
- func (t *Table) FilterFields() []*Field
- func (t *Table) GetField(name string) *Field
- func (t *Table) HasFilterField() bool
- func (t *Table) HasParent() bool
- func (t *Table) HasRelations() bool
- func (t *Table) RemoveField(name string)
- func (t *Table) SortedFields() []*Field
- type TimeType
- type Type
- type UUIDType
Constants ¶
This section is empty.
Variables ¶
Functions ¶
This section is empty.
Types ¶
type BinaryType ¶
func (*BinaryType) GetName ¶ added in v0.1.2
func (b *BinaryType) GetName() string
func (*BinaryType) Kind ¶
func (*BinaryType) Kind() string
func (*BinaryType) ProtobufKind ¶
func (*BinaryType) ProtobufKind() string
type BitType ¶
func (*BitType) ProtobufKind ¶
type EnumType ¶
func (*EnumType) ProtobufKind ¶
type Field ¶
type Field struct { Name string `json:"name,omitempty"` Type Type `json:"type,omitempty"` Nullable bool `json:"nullable,omitempty"` Optional bool `json:"optional,omitempty"` Sensitive bool `json:"sensitive,omitempty"` Tag string `json:"tag,omitempty"` Comment string `json:"comment,omitempty"` Default sql.NullString `json:"default,omitempty"` Order int `json:"order,omitempty"` Alias string `json:"alias,omitempty"` Sortable bool `json:"sortable,omitempty"` Filterable bool `json:"filterable,omitempty"` ForeignKey bool `json:"foreignKey,omitempty"` PrimaryKey bool `json:"primaryKey,omitempty"` Index bool `json:"index,omitempty"` Unique bool `json:"unique,omitempty"` AutoIncrement bool `json:"autoIncrement,omitempty"` OnUpdate bool `json:"onUpdate,omitempty"` Remote bool `json:"remote,omitempty"` Rel *Relation `json:"rel,omitempty"` Ops []Op `json:"ops,omitempty"` Table *Table `json:"table,omitempty"` Attrs []Attribute `json:"attrs,omitempty"` }
Field represents a Field definition.
func (*Field) RelBelongsTo ¶
RelBelongsTo returns true if the relation is belongsto
func (*Field) RelHasMany ¶
RelMany returns true if the relation is many
func (*Field) RelManyToMany ¶
RelManyToMany returns true if the relation is many to many
type FieldBuilder ¶ added in v0.1.2
type FieldBuilder struct {
// contains filtered or unexported fields
}
FieldBuilder represents a field builder.
func Builder ¶ added in v0.1.2
func Builder(name string) *FieldBuilder
func (*FieldBuilder) Alias ¶ added in v0.1.2
func (fb *FieldBuilder) Alias(alias string) *FieldBuilder
func (*FieldBuilder) Attrs ¶ added in v0.1.2
func (fb *FieldBuilder) Attrs(attrs ...Attribute) *FieldBuilder
func (*FieldBuilder) AutoIncrement ¶ added in v0.1.2
func (fb *FieldBuilder) AutoIncrement(autoIncrement bool) *FieldBuilder
func (*FieldBuilder) Build ¶ added in v0.1.2
func (fb *FieldBuilder) Build() *Field
func (*FieldBuilder) Comment ¶ added in v0.1.2
func (fb *FieldBuilder) Comment(comment string) *FieldBuilder
func (*FieldBuilder) Default ¶ added in v0.1.4
func (fb *FieldBuilder) Default(d sql.NullString) *FieldBuilder
func (*FieldBuilder) Filterable ¶ added in v0.1.2
func (fb *FieldBuilder) Filterable(filterable bool) *FieldBuilder
func (*FieldBuilder) ForeignKey ¶ added in v0.1.2
func (fb *FieldBuilder) ForeignKey(foreignKey bool) *FieldBuilder
func (*FieldBuilder) Index ¶ added in v0.1.2
func (fb *FieldBuilder) Index(index bool) *FieldBuilder
func (*FieldBuilder) Nullable ¶ added in v0.1.2
func (fb *FieldBuilder) Nullable(nullable bool) *FieldBuilder
func (*FieldBuilder) OnUpdate ¶ added in v0.1.2
func (fb *FieldBuilder) OnUpdate(onUpdate bool) *FieldBuilder
func (*FieldBuilder) Ops ¶ added in v0.1.2
func (fb *FieldBuilder) Ops(ops []Op) *FieldBuilder
func (*FieldBuilder) Optional ¶ added in v0.1.2
func (fb *FieldBuilder) Optional(optional bool) *FieldBuilder
func (*FieldBuilder) PrimaryKey ¶ added in v0.1.2
func (fb *FieldBuilder) PrimaryKey(primaryKey bool) *FieldBuilder
func (*FieldBuilder) Rel ¶ added in v0.1.2
func (fb *FieldBuilder) Rel(rel *Relation) *FieldBuilder
func (*FieldBuilder) Remote ¶ added in v0.1.2
func (fb *FieldBuilder) Remote(remote bool) *FieldBuilder
func (*FieldBuilder) Sensitive ¶ added in v0.1.2
func (fb *FieldBuilder) Sensitive(sensitive bool) *FieldBuilder
func (*FieldBuilder) Sortable ¶ added in v0.1.2
func (fb *FieldBuilder) Sortable(sortable bool) *FieldBuilder
func (*FieldBuilder) Table ¶ added in v0.1.2
func (fb *FieldBuilder) Table(table *Table) *FieldBuilder
func (*FieldBuilder) Tag ¶ added in v0.1.2
func (fb *FieldBuilder) Tag(tag string) *FieldBuilder
func (*FieldBuilder) Type ¶ added in v0.1.2
func (fb *FieldBuilder) Type(t Type) *FieldBuilder
func (*FieldBuilder) Unique ¶ added in v0.1.2
func (fb *FieldBuilder) Unique(unique bool) *FieldBuilder
type FloatType ¶
func (*FloatType) ProtobufKind ¶
type IntegerType ¶
func (*IntegerType) GetName ¶ added in v0.1.2
func (i *IntegerType) GetName() string
func (*IntegerType) Kind ¶
func (i *IntegerType) Kind() string
func (*IntegerType) ProtobufKind ¶
func (i *IntegerType) ProtobufKind() string
type ObjectType ¶
func (*ObjectType) GetName ¶ added in v0.1.2
func (o *ObjectType) GetName() string
func (*ObjectType) Kind ¶
func (o *ObjectType) Kind() string
func (*ObjectType) ProtobufKind ¶
func (o *ObjectType) ProtobufKind() string
type Relation ¶
type Relation struct { Type RelType `json:"type,omitempty"` Field *Field `json:"field,omitempty"` RefTable *Table `json:"ref_table,omitempty"` RefField *Field `json:"ref_field,omitempty"` JoinTable *JoinTable `json:"join_table,omitempty"` Inverse bool `json:"inverse,omitempty"` Attrs []Attribute `json:"attrs,omitempty"` }
Relation represents a Relation definition.
type Schema ¶
Schema represents an schema definition.
func (*Schema) RemoveTable ¶
RemoveTable removes the table with the given name.
type SpatialType ¶
type SpatialType struct {
Name string
}
func (*SpatialType) GetName ¶ added in v0.1.2
func (s *SpatialType) GetName() string
func (*SpatialType) Kind ¶
func (s *SpatialType) Kind() string
func (*SpatialType) ProtobufKind ¶
func (s *SpatialType) ProtobufKind() string
type StringType ¶
func (*StringType) GetName ¶ added in v0.1.2
func (s *StringType) GetName() string
func (*StringType) Kind ¶
func (*StringType) Kind() string
func (*StringType) ProtobufKind ¶
func (*StringType) ProtobufKind() string
type Table ¶
type Table struct { Name string Comment string ID *Field Attrs []Attribute IsJoinTable bool JoinTable *JoinTable Schema *Schema // contains filtered or unexported fields }
Table represents a table definition.
func (*Table) AutoIncrement ¶ added in v0.1.2
AutoIncrement returns true if the table has a auto increment primaryKey.
func (*Table) FilterFields ¶
FilterFields returns the fields that is filterable.
func (*Table) HasFilterField ¶
HasFilterField returns true if any field is filterable
func (*Table) HasRelations ¶ added in v0.1.2
HasRelations returns true if the table has a relation table.
func (*Table) RemoveField ¶
RemoveField removes the field with the given name.