db

package
v0.2.8 Latest Latest
Warning

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

Go to latest
Published: Nov 21, 2025 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New(cfg Config) (*gorm.DB, error)

Types

type Config

type Config struct {
	DBName     string     `json:"name" mapstructure:"name"`
	MySQL      ConnConfig `json:"mysql" mapstructure:"mysql"`
	PostgreSQL ConnConfig `json:"postgres" mapstructure:"postgres"`
	TiDB       ConnConfig `json:"tidb" mapstructure:"tidb"`
	OceanBase  ConnConfig `json:"oceanbase" mapstructure:"oceanbase"`
}

type ConnConfig

type ConnConfig struct {
	Address      string `json:"address" mapstructure:"address"`
	User         string `json:"user" mapstructure:"user"`
	Password     string `json:"password" mapstructure:"password"`
	Database     string `json:"database" mapstructure:"database"`
	MaxOpenConns int    `json:"max_open_conns" mapstructure:"max_open_conns"`
	MaxIdleConns int    `json:"max_idle_conns" mapstructure:"max_idle_conns"`
	LogMode      bool   `json:"log_mode" mapstructure:"log_mode"`
}

Jump to

Keyboard shortcuts

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