Documentation
¶
Index ¶
- Constants
- Variables
- func DeleteModel(c context.Context, m attrs.Definer) (deleted bool, err error)
- func SaveModel(c context.Context, m attrs.Definer) (saved bool, err error)
- type Backend
- type BaseBackend
- type BaseQuerier
- type ContextDeleter
- type ContextSaver
- type Deleter
- type Email
- type Model
- type ModelFunc
- type Orderer
- type Registry
- type Saver
Constants ¶
View Source
const ( MODEL_SAVE_HOOK = "django.Model.Save" MODEL_DELETE_HOOK = "django.Model.Delete" )
Variables ¶
View Source
var ( ErrDefault = errs.Error( "default ordering is invalid", ) ErrEmpty = errs.Error( "ordering field cannot be empty", ) ErrFormat = errs.Error( "ordering field must be in the format <field> <ASC|DESC> or <field>", ) )
View Source
var (
ErrBackendNotFound = errors.New("backend not found")
)
Functions ¶
func DeleteModel ¶ added in v1.7.0
Types ¶
type BaseBackend ¶
type BaseBackend[T any] struct { CreateTableQuery string CreateTableFn func(*sql.DB) error NewQuerier func(*sql.DB) (T, error) PreparedQuerier func(ctx context.Context, d *sql.DB) (T, error) }
func (*BaseBackend[T]) CreateTable ¶
func (b *BaseBackend[T]) CreateTable(db *sql.DB) error
func (*BaseBackend[T]) NewQuerySet ¶
func (b *BaseBackend[T]) NewQuerySet(db *sql.DB) (T, error)
type BaseQuerier ¶
type ContextDeleter ¶ added in v1.7.0
type ContextSaver ¶ added in v1.7.0
type Email ¶ added in v1.7.0
func (*Email) ScanAttribute ¶ added in v1.7.0
type Model ¶
type Model interface { attrs.Definer ContextSaver ContextDeleter }
type Orderer ¶ added in v1.7.0
type Orderer struct { TableName string Quote string Fields []string Validate func(string) bool Default string }
A struct for creating a valid SQL ordering string which should be compatible with most databases.
The ordering field is a list of strings which can be prefixed with a minus sign (-) to indicate descending order. ¶
The ordering field is validated with the Validate function, which should return true if the field is valid for use in said database.
The default field is used if no ordering fields are provided, and is validated with the Validate function as well, it can also be prefixed with a minus sign (-) to indicate descending order.
Click to show internal directories.
Click to hide internal directories.