gateway

package
v0.0.0-...-ed41251 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 13, 2025 License: MIT Imports: 32 Imported by: 5

Documentation

Index

Constants

View Source
const MySQLErDupEntry = 1062
View Source
const MySQLErNoReferencedRow2 = 1452
View Source
const SQLiteConstraintPrimaryKey = 1555
View Source
const SQLiteConstraintUnique = 2067

Variables

This section is empty.

Functions

func ComparePasswords

func ComparePasswords(hashedPassword string, plainPassword string) bool

func ConvertDuplicatedError

func ConvertDuplicatedError(err error, newErr error) error

func ConvertRelationError

func ConvertRelationError(err error, _ error) error

func HashPassword

func HashPassword(password string) (string, error)

func MetricsServerProcess

func MetricsServerProcess(ctx context.Context, port int, gracefulShutdownTimeSec int) error

func MigrateDB

func MigrateDB(db *gorm.DB, driverName string, sourceDriver source.Driver, getDatabaseDriver func(sqlDB *sql.DB) (database.Driver, error)) error

func MigrateMySQLDB

func MigrateMySQLDB(db *gorm.DB, sqlFS fs.FS) error

func MigratePostgresDB

func MigratePostgresDB(db *gorm.DB, sqlFS fs.FS) error

func MigrateSQLite3DB

func MigrateSQLite3DB(db *gorm.DB, sqlFS fs.FS) error

func NewNonTransactionManagerT

func NewNonTransactionManagerT[RF any](rf RF) (service.TransactionManagerT[RF], error)

func NewTransactionManagerT

func NewTransactionManagerT[RF any](db *gorm.DB, rff func(ctx context.Context, db *gorm.DB) (RF, error)) (service.TransactionManagerT[RF], error)

func OpenMySQL

func OpenMySQL(cfg *MySQLConfig, logLevel slog.Level, appName string) (*gorm.DB, error)

func OpenMySQLWithDSN

func OpenMySQLWithDSN(dsn string, logLevel slog.Level, appName string) (*gorm.DB, error)

func OpenPostgres

func OpenPostgres(cfg *PostgresConfig, logLevel slog.Level, appName string) (*gorm.DB, error)

func OpenSQLite3

func OpenSQLite3(cfg *SQLite3Config, logLevel slog.Level, appName string) (*gorm.DB, error)

func SignalWatchProcess

func SignalWatchProcess(ctx context.Context) error

Types

type DialectMySQL

type DialectMySQL struct {
}

func (*DialectMySQL) BoolDefaultValue

func (d *DialectMySQL) BoolDefaultValue() string

func (*DialectMySQL) Name

func (d *DialectMySQL) Name() string

type DialectPostgres

type DialectPostgres struct {
}

func (*DialectPostgres) BoolDefaultValue

func (d *DialectPostgres) BoolDefaultValue() string

func (*DialectPostgres) Name

func (d *DialectPostgres) Name() string

type DialectRDBMS

type DialectRDBMS interface {
	Name() string
	BoolDefaultValue() string
}

func InitMySQL

func InitMySQL(ctx context.Context, cfg *MySQLConfig, migration bool, logLevel slog.Level, fs fs.FS, appName string) (DialectRDBMS, *gorm.DB, *sql.DB, error)

func InitPostgres

func InitPostgres(ctx context.Context, cfg *PostgresConfig, migration bool, logLevel slog.Level, fs fs.FS, appName string) (DialectRDBMS, *gorm.DB, *sql.DB, error)

func InitSqlite3

func InitSqlite3(ctx context.Context, cfg *SQLite3Config, migration bool, logLevel slog.Level, fs fs.FS, appName string) (DialectRDBMS, *gorm.DB, *sql.DB, error)

type DialectSQLite3

type DialectSQLite3 struct {
}

func (*DialectSQLite3) BoolDefaultValue

func (d *DialectSQLite3) BoolDefaultValue() string

func (*DialectSQLite3) Name

func (d *DialectSQLite3) Name() string

type MySQLConfig

type MySQLConfig struct {
	Username string `yaml:"username" validate:"required"`
	Password string `yaml:"password" validate:"required"`
	Host     string `yaml:"host" validate:"required"`
	Port     int    `yaml:"port" validate:"required"`
	Database string `yaml:"database" validate:"required"`
}

type PostgresConfig

type PostgresConfig struct {
	Username string `yaml:"username" validate:"required"`
	Password string `yaml:"password" validate:"required"`
	Host     string `yaml:"host" validate:"required"`
	Port     int    `yaml:"port" validate:"required"`
	Database string `yaml:"database" validate:"required"`
}

type SQLite3Config

type SQLite3Config struct {
	File string `yaml:"file" validate:"required"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL