Documentation
¶
Index ¶
- func Embed(nameOrScan any, options ...EmbedOptions) func(d attrs.Definer) []attrs.Field
- func ForeignKey[T any](name, columnName string, conf ...*FieldConfig) attrs.UnboundFieldConstructor
- func GenericForeignKey[T attrs.Definer](definer T, name string, cnf *GenericForeignKeyConfig) interface{}
- func ManyToMany[T any](name string, conf ...*FieldConfig) attrs.UnboundFieldConstructor
- func OneToOne[T any](name string, conf ...*FieldConfig) attrs.UnboundFieldConstructor
- type DataModelField
- func (e *DataModelField[T]) AllowBlank() bool
- func (e *DataModelField[T]) AllowDBEdit() bool
- func (e *DataModelField[T]) AllowEdit() bool
- func (e *DataModelField[T]) AllowNull() bool
- func (e *DataModelField[T]) Attrs() map[string]any
- func (f *DataModelField[T]) BindToDefinitions(defs attrs.Definitions)
- func (e *DataModelField[T]) ColumnName() string
- func (f *DataModelField[T]) FieldDefinitions() attrs.Definitions
- 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{}, force bool) error
- func (e *DataModelField[T]) Tag(string) string
- func (e *DataModelField[T]) ToString() string
- func (e *DataModelField[T]) Type() reflect.Type
- func (f *DataModelField[T]) TypeString() string
- func (e *DataModelField[T]) Validate() error
- func (e *DataModelField[T]) Value() (driver.Value, error)
- type DataModelFieldConfig
- type EmbedOptions
- type ExpressionField
- type FieldConfig
- type ForeignKeyField
- type ForeignKeyReverseField
- type GenericForeignKeyConfig
- type GenericForeignKeyField
- type GenericForeignKeyFieldDefiner
- type ManyToManyField
- type OneToOneField
- type OneToOneReverseField
- type RelationField
- func (r *RelationField[T]) AllowDBEdit() bool
- func (r *RelationField[T]) AllowEdit() bool
- func (m *RelationField[T]) AllowNull() bool
- func (r *RelationField[T]) AllowReverseRelation() bool
- func (r *RelationField[T]) Attrs() map[string]any
- func (r *RelationField[T]) CanMigrate() bool
- func (r *RelationField[T]) ColumnName() string
- func (m *RelationField[T]) ForSelectAll() bool
- func (f *RelationField[T]) GenerateTargetClause(qs *queries.QuerySet[attrs.Definer], inter *queries.QuerySetInternals, ...) queries.JoinDef
- func (f *RelationField[T]) GenerateTargetThroughClause(qs *queries.QuerySet[attrs.Definer], inter *queries.QuerySetInternals, ...) (queries.JoinDef, queries.JoinDef)
- func (r *RelationField[T]) GetTargetField() attrs.FieldDefinition
- func (r *RelationField[T]) IsProxy() bool
- 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
- func (r *RelationField[T]) Save(ctx context.Context) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ForeignKey ¶
func ForeignKey[T any](name, columnName string, conf ...*FieldConfig) attrs.UnboundFieldConstructor
func GenericForeignKey ¶
func GenericForeignKey[T attrs.Definer](definer T, name string, cnf *GenericForeignKeyConfig) interface{}
func ManyToMany ¶
func ManyToMany[T any](name string, conf ...*FieldConfig) attrs.UnboundFieldConstructor
func OneToOne ¶
func OneToOne[T any](name string, conf ...*FieldConfig) attrs.UnboundFieldConstructor
Types ¶
type DataModelField ¶
type DataModelField[T any] struct { // model is the model that this field belongs to Model attrs.Definer // contains filtered or unexported fields }
func NewDataModelField ¶
func NewDataModelField[T any](forModel attrs.Definer, dst any, name string, cnf ...DataModelFieldConfig) *DataModelField[T]
func (*DataModelField[T]) AllowBlank ¶
func (e *DataModelField[T]) AllowBlank() bool
func (*DataModelField[T]) AllowDBEdit ¶
func (e *DataModelField[T]) AllowDBEdit() bool
func (*DataModelField[T]) AllowEdit ¶
func (e *DataModelField[T]) AllowEdit() bool
func (*DataModelField[T]) AllowNull ¶
func (e *DataModelField[T]) AllowNull() bool
func (*DataModelField[T]) Attrs ¶
func (e *DataModelField[T]) Attrs() map[string]any
func (*DataModelField[T]) BindToDefinitions ¶
func (f *DataModelField[T]) BindToDefinitions(defs attrs.Definitions)
func (*DataModelField[T]) ColumnName ¶
func (e *DataModelField[T]) ColumnName() string
no real column, special case for virtual fields
func (*DataModelField[T]) FieldDefinitions ¶
func (f *DataModelField[T]) FieldDefinitions() attrs.Definitions
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{}, force 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]) TypeString ¶
func (f *DataModelField[T]) TypeString() string
func (*DataModelField[T]) Validate ¶
func (e *DataModelField[T]) Validate() error
type DataModelFieldConfig ¶
type EmbedOptions ¶
type EmbedOptions struct { // AutoInit indicates whether the pointer to the model should be automatically initialized // If AutoInit is true, the model will be initialized to a new instance // If it is false, the model will be left as nil and no fields will be embedded. AutoInit bool // EmbedFields specifies which fields of the model should be embedded // If EmbedFields is nil, all fields of the model will be embedded. EmbedFields []any }
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 FieldConfig ¶
type ForeignKeyField ¶
type ForeignKeyField[T any] struct { *RelationField[T] }
func NewForeignKeyField ¶
func NewForeignKeyField[T any](forModel attrs.Definer, name string, conf *FieldConfig) *ForeignKeyField[T]
func (*ForeignKeyField[T]) AllowDBEdit ¶
func (e *ForeignKeyField[T]) AllowDBEdit() bool
func (*ForeignKeyField[T]) AllowEdit ¶
func (e *ForeignKeyField[T]) AllowEdit() bool
func (*ForeignKeyField[T]) ForSelectAll ¶
func (m *ForeignKeyField[T]) ForSelectAll() bool
type ForeignKeyReverseField ¶
type ForeignKeyReverseField[T any] struct { *RelationField[T] }
func NewForeignKeyReverseField ¶
func NewForeignKeyReverseField[T any](forModel attrs.Definer, name string, conf *FieldConfig) *ForeignKeyReverseField[T]
type GenericForeignKeyConfig ¶
type GenericForeignKeyField ¶
type GenericForeignKeyField interface { queries.TargetClauseField queries.SaveableDependantField }
type ManyToManyField ¶
type ManyToManyField[T any] struct { *RelationField[T] }
func NewManyToManyField ¶
func NewManyToManyField[T any](forModel attrs.Definer, name string, conf *FieldConfig) *ManyToManyField[T]
type OneToOneField ¶
type OneToOneField[T any] struct { *RelationField[T] }
func NewOneToOneField ¶
func NewOneToOneField[T any](forModel attrs.Definer, name string, conf *FieldConfig) *OneToOneField[T]
type OneToOneReverseField ¶
type OneToOneReverseField[T any] struct { *RelationField[T] }
func NewOneToOneReverseField ¶
func NewOneToOneReverseField[T any](forModel attrs.Definer, name string, conf *FieldConfig) *OneToOneReverseField[T]
type RelationField ¶
type RelationField[T any] struct { *DataModelField[T] // contains filtered or unexported fields }
func NewRelatedField ¶
func NewRelatedField[T any](forModel attrs.Definer, name string, cnf *FieldConfig) *RelationField[T]
func (*RelationField[T]) AllowDBEdit ¶
func (r *RelationField[T]) AllowDBEdit() bool
func (*RelationField[T]) AllowEdit ¶
func (r *RelationField[T]) AllowEdit() bool
func (*RelationField[T]) AllowNull ¶
func (m *RelationField[T]) AllowNull() bool
func (*RelationField[T]) AllowReverseRelation ¶
func (r *RelationField[T]) AllowReverseRelation() bool
func (*RelationField[T]) Attrs ¶
func (r *RelationField[T]) Attrs() map[string]any
func (*RelationField[T]) CanMigrate ¶
func (r *RelationField[T]) CanMigrate() bool
func (*RelationField[T]) ColumnName ¶
func (r *RelationField[T]) ColumnName() string
func (*RelationField[T]) ForSelectAll ¶
func (m *RelationField[T]) ForSelectAll() bool
func (*RelationField[T]) GenerateTargetClause ¶
func (f *RelationField[T]) GenerateTargetClause(qs *queries.QuerySet[attrs.Definer], inter *queries.QuerySetInternals, lhs queries.ClauseTarget, rhs queries.ClauseTarget) queries.JoinDef
func (*RelationField[T]) GenerateTargetThroughClause ¶
func (f *RelationField[T]) GenerateTargetThroughClause(qs *queries.QuerySet[attrs.Definer], inter *queries.QuerySetInternals, lhs queries.ClauseTarget, thru queries.ThroughClauseTarget, rhs queries.ClauseTarget) (queries.JoinDef, queries.JoinDef)
func (*RelationField[T]) GetTargetField ¶
func (r *RelationField[T]) GetTargetField() attrs.FieldDefinition
func (*RelationField[T]) IsProxy ¶
func (r *RelationField[T]) IsProxy() bool
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.