orm

package
v0.2.4 Latest Latest
Warning

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

Go to latest
Published: Jun 22, 2022 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const Name = "orm"

Variables

This section is empty.

Functions

func ErrNotFound added in v0.2.2

func ErrNotFound(err error) bool

func List

func List() map[string]Factory

func Register

func Register(name string, broker Factory)

Types

type Cfg

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

func DefaultCfg

func DefaultCfg() *Cfg

func (*Cfg) Create added in v0.2.2

func (t *Cfg) Create(log *logging.Logger) *gorm.DB

func (*Cfg) Valid added in v0.2.0

func (t *Cfg) Valid() (err error)

type Client

type Client struct {
	*gorm.DB
}

func (*Client) Close

func (c *Client) Close() error

func (*Client) InitTable added in v0.2.2

func (c *Client) InitTable(tb interface{}) error

func (*Client) Ping added in v0.1.7

func (c *Client) Ping() error

func (*Client) Stats added in v0.2.2

func (c *Client) Stats() (sql.DBStats, error)

func (*Client) Upsert added in v0.2.2

func (c *Client) Upsert(ctx context.Context, dest interface{}, query string, args ...interface{}) error

func (*Client) Vars added in v0.2.4

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

type Factory

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

func Get added in v0.2.0

func Get(name string) Factory

Directories

Path Synopsis
driver

Jump to

Keyboard shortcuts

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