gateway

package
v0.0.0-...-6bd6f84 Latest Latest
Warning

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

Go to latest
Published: Dec 28, 2024 License: MIT Imports: 32 Imported by: 8

Documentation

Index

Constants

View Source
const MYSQL_ER_DUP_ENTRY = 1062
View Source
const MYSQL_ER_NO_REFERENCED_ROW_2 = 1452
View Source
const SQLITE_CONSTRAINT_PRIMARYKEY = 1555
View Source
const SQLITE_CONSTRAINT_UNIQUE = 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, newErr 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) (*gorm.DB, error)

func OpenPostgres

func OpenPostgres(cfg *PostgresConfig) (*gorm.DB, error)

func OpenSQLite3

func OpenSQLite3(cfg *SQLite3Config) (*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, fs fs.FS) (DialectRDBMS, *gorm.DB, *sql.DB, error)

func InitPostgres

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

func InitSqlite3

func InitSqlite3(ctx context.Context, cfg *SQLite3Config, migration bool, fs fs.FS) (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