Versions in this module Expand all Collapse all v1 v1.0.0 Sep 12, 2024 Changes in this version + const DriverPostgres + const DriverSqlite + var DBNotExistRegex *regexp.Regexp + func ApplyPostLoadFlags(db *sql.DB, log logs.Log, dbc DBConfig, flags DBConnectFlags) error + func DropAllTables(log logs.Log, dbc DBConfig) error + func IDListToSQLSet(ids []int64) string + func IsKeyViolation(err error) bool + func IsKeyViolationOnIndex(err error, indexName string) bool + func MakeMigrationFromFunc(log logs.Log, migrationNumber *int, f migration.Migrator) migration.Migrator + func MakeMigrationFromSQL(log logs.Log, migrationNumber *int, sql string) migration.Migrator + func MakeMigrations(log logs.Log, sql []string) []migration.Migrator + func OpenDB(log logs.Log, dbc DBConfig, migrations []migration.Migrator, ...) (*gorm.DB, error) + func PGByteArrayLiteral(b []byte) string + func SQLCleanIDList(raw string) string + func SQLFormatIDArray[T constraints.Integer](ids []T) string + func SanitizeIDList(s string) string + func ScanArray[T any](r *sql.Rows, queryErr error) ([]T, error) + func StringToIDList(s string) []int64 + type DBConfig struct + Database string + Driver string + Host string + Password string + Port int + SSLCert string + SSLKey string + SSLRootCert string + Username string + func MakeSqliteConfig(filename string) DBConfig + func (db *DBConfig) DSN() string + func (db *DBConfig) LogSafeDescription() string + type DBConnectFlags int + const DBConnectFlagSqliteWAL + const DBConnectFlagWaitForDB + const DBConnectFlagWipeDB + type IntTime int64 + func MakeIntTime(v time.Time) IntTime + func MakeIntTimeMilli(unixMilli int64) IntTime + func (i *IntTime) Scan(src any) error + func (i IntTime) Value() (driver.Value, error) + func (t *IntTime) Set(v time.Time) + func (t IntTime) Get() time.Time + func (t IntTime) IsZero() bool + type JSONField struct + Data T + func MakeJSONField[T any](data T) *JSONField[T] + func (j *JSONField[T]) Scan(src any) error + func (j *JSONField[T]) UnmarshalJSON(b []byte) error + func (j JSONField[T]) MarshalJSON() ([]byte, error) + func (j JSONField[T]) Value() (driver.Value, error) + type MilliTime struct + func Milli(t time.Time) MilliTime + func (i *MilliTime) Scan(src any) error + func (i *MilliTime) UnmarshalJSON(b []byte) error + func (i MilliTime) MarshalJSON() ([]byte, error) + func (i MilliTime) Value() (driver.Value, error)