Documentation
¶
Index ¶
- Constants
- Variables
- func ApplySort(query *gorm.DB, allowedColumns map[string]string, sorts []SortInput, ...) *gorm.DB
- func CreateDB(ctx *context.Context) (*gorm.DB, error)
- func CreateDialectorMysql(ctx *context.Context, cfg config.DbConfig) (gorm.Dialector, error)
- func CreateDialectorSqlite(ctx *context.Context, cfg config.DbConfig) (gorm.Dialector, error)
- type CreateDialectorFn
- type MysqlConfig
- type SortDirection
- type SortInput
- type SqliteConfig
Constants ¶
View Source
const (
DbTypeMysql = "mysql"
)
View Source
const (
DbTypeSqlite = "sqlite"
)
Variables ¶
View Source
var FactoryDialector = map[string]CreateDialectorFn{}
Functions ¶
func ApplySort ¶
func ApplySort(query *gorm.DB, allowedColumns map[string]string, sorts []SortInput, tablePrefix string) *gorm.DB
ApplySort applique les tris à une requête GORM allowedColumns: map[jsonName]dbColumnName tablePrefix: préfixe de table pour les jointures (optionnel, "" si pas de jointure)
func CreateDialectorMysql ¶
Types ¶
type CreateDialectorFn ¶
type MysqlConfig ¶
type MysqlConfig struct {
DSN string `mapstructure:"dsn" validate:"required"`
}
type SortDirection ¶
type SortDirection string
const ( SortASC SortDirection = "ASC" SortDESC SortDirection = "DESC" )
type SortInput ¶
type SortInput struct {
Column string
Direction SortDirection
}
type SqliteConfig ¶
type SqliteConfig struct {
DSN string `mapstructure:"dsn" validate:"required"`
}
Click to show internal directories.
Click to hide internal directories.