orm

package
v0.2.10-85 Latest Latest
Warning

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

Go to latest
Published: Jan 10, 2024 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const Name = "orm"

Variables

This section is empty.

Functions

func DefaultLoggerCfg

func DefaultLoggerCfg() logger.Config

func List

func List() map[string]Factory

func NewClients

func NewClients(conf map[string]*Config, logs log.Logger) map[string]*Client

func Register

func Register(name string, broker Factory)

Types

type Client

type Client struct {
	*gorm.DB
	TablePrefix string
}

func New

func New(conf *Config, logs log.Logger) *Client

func (*Client) Close

func (c *Client) Close() error

func (*Client) Ping

func (c *Client) Ping() error

func (*Client) Stats

func (c *Client) Stats() (r result.Result[sql.DBStats])

func (*Client) Vars

func (c *Client) Vars() vars.Value

type Config

type Config struct {
	TablePrefix                              string        `yaml:"table_prefix"`
	Driver                                   string        `yaml:"driver"`
	DriverCfg                                config.Node   `yaml:"driver_config"`
	SkipDefaultTransaction                   bool          `yaml:"skip_default_transaction"`
	FullSaveAssociations                     bool          `yaml:"full_save_associations"`
	DryRun                                   bool          `yaml:"dry_run"`
	PrepareStmt                              bool          `yaml:"prepare_stmt"`
	DisableAutomaticPing                     bool          `yaml:"disable_automatic_ping"`
	DisableForeignKeyConstraintWhenMigrating bool          `yaml:"disable_foreign_key_constraint_when_migrating"`
	DisableNestedTransaction                 bool          `yaml:"disable_nested_transaction"`
	AllowGlobalUpdate                        bool          `yaml:"allow_global_update"`
	QueryFields                              bool          `yaml:"query_fields"`
	CreateBatchSize                          int           `yaml:"create_batch_size"`
	MaxConnTime                              time.Duration `yaml:"max_conn_time"`
	MaxConnIdle                              int           `yaml:"max_conn_idle"`
	MaxConnOpen                              int           `yaml:"max_conn_open"`
}

func DefaultCfg

func DefaultCfg() Config

type Factory

type Factory func(cfg config.Node) gorm.Dialector

func Get

func Get(name string) Factory

Directories

Path Synopsis
drivers

Jump to

Keyboard shortcuts

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