Documentation ¶
Index ¶
- Variables
- func Migrate(database *bun.DB, sqlMigrations embed.FS, logger quicklog.Logger) error
- func MustRegisterValidation(customValidator *validator.Validate, name string, ...)
- func OpenDB(dsn string) (*bun.DB, func(), error)
- func RegisterSortDirection(customValidator *validator.Validate)
- func ValidateEnum[T comparable](list ...T) func(fl validator.FieldLevel) bool
- type SortDirection
Constants ¶
This section is empty.
Variables ¶
Functions ¶
func MustRegisterValidation ¶
func OpenDB ¶
OpenDB automatically configures a bun.DB instance with postgresSQL drivers. It returns the database, along with a cleaning function, whose execution can be deferred for a graceful shutdown.
func RegisterSortDirection ¶
func RegisterSortDirection(customValidator *validator.Validate)
RegisterSortDirection registers the SortDirection type with a validator.
func ValidateEnum ¶
func ValidateEnum[T comparable](list ...T) func(fl validator.FieldLevel) bool
ValidateEnum creates a custom validation for go-validator. It checks if the value is part of the enum.
TODO: look for custom errors in v11: https://github.com/go-playground/validator/issues/669
Types ¶
type SortDirection ¶
type SortDirection string
SortDirection controls the direction of the ordering for a particular request. You can use this type with a validator.
const ( SortDirectionNone SortDirection = "" SortDirectionAsc SortDirection = "asc" SortDirectionDesc SortDirection = "desc" )
Click to show internal directories.
Click to hide internal directories.