Documentation
¶
Index ¶
- func CheckName(name string) error
- type AttachedTableResource
- func (atr *AttachedTableResource) Create(data map[string]any) (map[string]any, error)
- func (atr *AttachedTableResource) Delete(where map[string]any) ([]map[string]any, error)
- func (atr *AttachedTableResource) FindMany(opts FindManyOpts) ([]map[string]any, error)
- func (atr *AttachedTableResource) FindUnique(opts FindUniqueOpts) (map[string]any, error)
- func (atr *AttachedTableResource) Modify(where map[string]any, data map[string]any) ([]map[string]any, error)
- type DBInstance
- func (i *DBInstance) Migrate(direcory string) error
- func (i *DBInstance) QueryAsJson(q sqlbuilder.Builder) ([]map[string]any, error)
- func (i *DBInstance) QueryAsJsonRaw(query string, args ...any) ([]map[string]any, error)
- func (i *DBInstance) Transact(callback func(tx *sql.Tx) error) error
- func (i *DBInstance) Use(callback func(conn *sql.Conn) error) error
- type FindManyOpts
- type FindUniqueOpts
- type TableResource
- type TableResourceDynamicField
- type TableResourceProps
- type TableResourceReference
- type TableResourceStaticField
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type AttachedTableResource ¶
type AttachedTableResource struct {
*TableResource
// contains filtered or unexported fields
}
func (*AttachedTableResource) FindMany ¶
func (atr *AttachedTableResource) FindMany(opts FindManyOpts) ([]map[string]any, error)
func (*AttachedTableResource) FindUnique ¶
func (atr *AttachedTableResource) FindUnique(opts FindUniqueOpts) (map[string]any, error)
returns (nil, nil), iff no resource has been found; returns (res, nil) on success and (nil, err) on error
type DBInstance ¶
type DBInstance struct {
// contains filtered or unexported fields
}
func OpenDB ¶
func OpenDB(dsn string) (*DBInstance, error)
func (*DBInstance) Migrate ¶
func (i *DBInstance) Migrate(direcory string) error
func (*DBInstance) QueryAsJson ¶
func (i *DBInstance) QueryAsJson(q sqlbuilder.Builder) ([]map[string]any, error)
func (*DBInstance) QueryAsJsonRaw ¶ added in v0.1.1
type FindManyOpts ¶
type FindUniqueOpts ¶ added in v0.1.1
type TableResource ¶
type TableResource struct {
// contains filtered or unexported fields
}
func NewTableResource ¶
func NewTableResource(props TableResourceProps) (*TableResource, error)
func (*TableResource) Attach ¶
func (tr *TableResource) Attach(db *DBInstance, ctx any) *AttachedTableResource
type TableResourceProps ¶
type TableResourceProps struct {
Name string
TableName string
PrimaryKey []string
CreateOnlyFields []string
ModifiableFields []string
StaticFields map[string]*TableResourceStaticField
DynamicFields map[string]*TableResourceDynamicField
References map[string]*TableResourceReference
FindFilter func(q *sqlbuilder.SelectBuilder, ctx any) error
ModifyFilter func(q *sqlbuilder.UpdateBuilder, ctx any) error
DeleteFilter func(q *sqlbuilder.UpdateBuilder, ctx any) error
}
type TableResourceReference ¶
Click to show internal directories.
Click to hide internal directories.