Documentation
¶
Index ¶
- type DataModelField
- func (e *DataModelField[T]) AllowBlank() bool
- func (e *DataModelField[T]) AllowEdit() bool
- func (e *DataModelField[T]) AllowNull() bool
- func (e *DataModelField[T]) AnnotateValue(v any) error
- func (e *DataModelField[T]) Attrs() map[string]any
- func (e *DataModelField[T]) ColumnName() string
- func (e *DataModelField[T]) FormField() fields.Field
- func (e *DataModelField[T]) GetDefault() interface{}
- func (e *DataModelField[T]) GetValue() interface{}
- func (e *DataModelField[T]) HelpText() string
- func (e *DataModelField[T]) Instance() attrs.Definer
- func (e *DataModelField[T]) IsPrimary() bool
- func (e *DataModelField[T]) Label() string
- func (f *DataModelField[T]) Name() string
- func (e *DataModelField[T]) Rel() attrs.Relation
- func (e *DataModelField[T]) Scan(src interface{}) error
- func (e *DataModelField[T]) SetValue(v interface{}, _ bool) error
- func (e *DataModelField[T]) Tag(string) string
- func (e *DataModelField[T]) ToString() string
- func (e *DataModelField[T]) Type() reflect.Type
- func (e *DataModelField[T]) Validate() error
- func (e *DataModelField[T]) Value() (driver.Value, error)
- type ExpressionField
- type ForeignKeyField
- type ForeignKeyReverseField
- type ManyToManyField
- type MultipleRelation
- func (m *MultipleRelation) Add(obj Relation) error
- func (m *MultipleRelation) All() []Relation
- func (m *MultipleRelation) Clear() error
- func (m *MultipleRelation) Get(pkOrObj any) (Relation, bool)
- func (m *MultipleRelation) Remove(obj attrs.Definer) error
- func (m *MultipleRelation) Set(objs []Relation) error
- type MultipleRelationField
- type OneToOneField
- type OneToOneReverseField
- type Relation
- type RelationField
- func (r *RelationField[T]) Attrs() map[string]any
- func (r *RelationField[T]) ColumnName() string
- func (m *RelationField[T]) ForSelectAll() bool
- func (r *RelationField[T]) GetTargetField() attrs.FieldDefinition
- func (r *RelationField[T]) IsReverse() bool
- func (m *RelationField[T]) Name() string
- func (r *RelationField[T]) Rel() attrs.Relation
- func (r *RelationField[T]) RelatedName() string
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DataModelField ¶
type DataModelField[T any] struct { // model is the model that this field belongs to Model any // dataModel is the model that contains the data for this field // // it should be embedded in the attrs.Definer type which this virtual field is for DataModel any // contains filtered or unexported fields }
func NewDataModelField ¶
func NewDataModelField[T any](forModel any, dst any, name string) *DataModelField[T]
func (*DataModelField[T]) AllowBlank ¶
func (e *DataModelField[T]) AllowBlank() bool
func (*DataModelField[T]) AllowEdit ¶
func (e *DataModelField[T]) AllowEdit() bool
func (*DataModelField[T]) AllowNull ¶
func (e *DataModelField[T]) AllowNull() bool
func (*DataModelField[T]) AnnotateValue ¶
func (e *DataModelField[T]) AnnotateValue(v any) error
func (*DataModelField[T]) Attrs ¶
func (e *DataModelField[T]) Attrs() map[string]any
func (*DataModelField[T]) ColumnName ¶
func (e *DataModelField[T]) ColumnName() string
no real column, special case for virtual fields
func (*DataModelField[T]) FormField ¶
func (e *DataModelField[T]) FormField() fields.Field
func (*DataModelField[T]) GetDefault ¶
func (e *DataModelField[T]) GetDefault() interface{}
func (*DataModelField[T]) GetValue ¶
func (e *DataModelField[T]) GetValue() interface{}
func (*DataModelField[T]) HelpText ¶
func (e *DataModelField[T]) HelpText() string
func (*DataModelField[T]) Instance ¶
func (e *DataModelField[T]) Instance() attrs.Definer
func (*DataModelField[T]) IsPrimary ¶
func (e *DataModelField[T]) IsPrimary() bool
func (*DataModelField[T]) Label ¶
func (e *DataModelField[T]) Label() string
func (*DataModelField[T]) Name ¶
func (f *DataModelField[T]) Name() string
func (*DataModelField[T]) Rel ¶
func (e *DataModelField[T]) Rel() attrs.Relation
func (*DataModelField[T]) Scan ¶
func (e *DataModelField[T]) Scan(src interface{}) error
func (*DataModelField[T]) SetValue ¶
func (e *DataModelField[T]) SetValue(v interface{}, _ bool) error
func (*DataModelField[T]) Tag ¶
func (e *DataModelField[T]) Tag(string) string
func (*DataModelField[T]) ToString ¶
func (e *DataModelField[T]) ToString() string
func (*DataModelField[T]) Type ¶
func (e *DataModelField[T]) Type() reflect.Type
func (*DataModelField[T]) Validate ¶
func (e *DataModelField[T]) Validate() error
type ExpressionField ¶
type ExpressionField[T any] struct { *DataModelField[T] // contains filtered or unexported fields }
func NewVirtualField ¶
func NewVirtualField[T any](forModel attrs.Definer, dst any, name string, expr expr.Expression) *ExpressionField[T]
func (*ExpressionField[T]) Alias ¶
func (f *ExpressionField[T]) Alias() string
func (*ExpressionField[T]) SQL ¶
func (f *ExpressionField[T]) SQL(inf *expr.ExpressionInfo) (string, []any)
type ForeignKeyField ¶
type ForeignKeyField[T any] struct { *RelationField[T] }
type ForeignKeyReverseField ¶
type ForeignKeyReverseField[T any] struct { *RelationField[T] }
type ManyToManyField ¶
type ManyToManyField[T any] struct { *RelationField[T] }
type MultipleRelation ¶
type MultipleRelation struct {
// contains filtered or unexported fields
}
func (*MultipleRelation) Add ¶
func (m *MultipleRelation) Add(obj Relation) error
func (*MultipleRelation) All ¶
func (m *MultipleRelation) All() []Relation
func (*MultipleRelation) Clear ¶
func (m *MultipleRelation) Clear() error
func (*MultipleRelation) Set ¶
func (m *MultipleRelation) Set(objs []Relation) error
type MultipleRelationField ¶
type MultipleRelationField struct { *RelationField[[]attrs.Definer] // contains filtered or unexported fields }
func NewMultipleRelatedField ¶
func (*MultipleRelationField) GetValue ¶
func (f *MultipleRelationField) GetValue() any
func (*MultipleRelationField) Objects ¶
func (f *MultipleRelationField) Objects() *MultipleRelation
type OneToOneField ¶
type OneToOneField[T any] struct { *RelationField[T] }
type OneToOneReverseField ¶
type OneToOneReverseField[T any] struct { *RelationField[T] }
type RelationField ¶
type RelationField[T any] struct { *DataModelField[T] // contains filtered or unexported fields }
func NewRelatedField ¶
func (*RelationField[T]) Attrs ¶
func (r *RelationField[T]) Attrs() map[string]any
func (*RelationField[T]) ColumnName ¶
func (r *RelationField[T]) ColumnName() string
func (*RelationField[T]) ForSelectAll ¶
func (m *RelationField[T]) ForSelectAll() bool
func (*RelationField[T]) GetTargetField ¶
func (r *RelationField[T]) GetTargetField() attrs.FieldDefinition
func (*RelationField[T]) IsReverse ¶
func (r *RelationField[T]) IsReverse() bool
func (*RelationField[T]) Name ¶
func (m *RelationField[T]) Name() string
func (*RelationField[T]) Rel ¶
func (r *RelationField[T]) Rel() attrs.Relation
func (*RelationField[T]) RelatedName ¶
func (r *RelationField[T]) RelatedName() string
Click to show internal directories.
Click to hide internal directories.