Documentation ¶
Index ¶
- Constants
- Variables
- func CharField(fieldPtr *string, maxLen int) *field
- func DefSchema[T any](userStruct T, fields ...Field) (schema[T], error)
- func EmailField(fieldPtr *string) *field
- func Get[T any](obj T, id int) (T, error)
- func IntField(fieldPtr *int) *field
- func MustDefSchema[T any](userStruct T, fields ...Field) schema[T]
- func MustRegister(schemas ...Schema)
- func RegisterModels(schemas ...Schema) error
- func Save[T any](obj T) error
- func TextField(fieldPtr *string) *field
- func Where[T stndValue](t *T) *condition[T]
- type Condition
- type ErrDb
- type ErrTable
- type Field
- type FieldValidator
- type Query
- type Schema
- type Table
Constants ¶
View Source
const ( DBTYPE = "DATABASE" CONNSTRING = "DBCONNSTRING" )
Variables ¶
View Source
var ( ErrFieldNotAPointer = fmt.Errorf("Field needs to be a pointer") ErrFieldNotInStruct = fmt.Errorf("Field pointer needs to be defined in the struct") )
View Source
var ( ErrWrongSchemaType = fmt.Errorf("Schema can only be created from a pointer to a struct!") ErrFieldNotInit = fmt.Errorf("Field is not initialized in the schema") )
View Source
var ( ErrCantAddress = fmt.Errorf("Can't get address of passed variable") ErrNotPointer = fmt.Errorf("Pass object is not a pointer") ErrNotStruct = fmt.Errorf("Object is not a struct") )
View Source
var (
ErrCantGetName = fmt.Errorf("Can't name for the field")
)
View Source
var ( //error to load env ErrEnvLoad = fmt.Errorf("Error loading .env file. Check if the .env file exists!") )
Functions ¶
func EmailField ¶
func EmailField(fieldPtr *string) *field
func MustDefSchema ¶
func MustRegister ¶
func MustRegister(schemas ...Schema)
func RegisterModels ¶
Types ¶
type FieldValidator ¶
type FieldValidator func() error
Source Files ¶
Click to show internal directories.
Click to hide internal directories.