db

package
v0.0.0-...-986a728 Latest Latest
Warning

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

Go to latest
Published: Aug 25, 2017 License: MIT Imports: 3 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DBConfig

type DBConfig struct {
	Database     string `yaml:"database"`
	Username     string `yaml:"username"`
	Password     string `yaml:"password"`
	Host         string `yaml:"host"`
	Port         int    `yaml:"port"`
	MaxIdleConns int    `yaml:"max_idle_conns"`
	MaxOpenConns int    `yaml:"max_open_conns"`
}

DBConfig db config

func (*DBConfig) SerialSource

func (cfg *DBConfig) SerialSource() string

func (*DBConfig) Source

func (cfg *DBConfig) Source() string

func (*DBConfig) SourceUTF8

func (cfg *DBConfig) SourceUTF8() string

SourceUTF8 备注旧版本数据库使用UTF8编码,以及时区用UTC 0时区,跟本地时区相差8小时,这里要特别注意

type DBInfo

type DBInfo struct {
	*gorp.DbMap

	DB *sql.DB
}

func (*DBInfo) Begin

func (dbInfo *DBInfo) Begin(trans *Transaction, objects ...TransactionObject) (*Transaction, error)

type MongoDBConfig

type MongoDBConfig struct {
	Address   []string `yaml:"address"`
	Database  string   `yaml:"database"`
	Username  string   `yaml:"username"`
	Password  string   `yaml:"password"`
	PoolLimit int      `yaml:"pool_limit"`
}

MongoDBConfig mongo db config

type Transaction

type Transaction struct {
	*gorp.Transaction
	// contains filtered or unexported fields
}

func (*Transaction) AddObject

func (trans *Transaction) AddObject(o TransactionObject)

func (*Transaction) Commit

func (trans *Transaction) Commit() error

func (*Transaction) Rollback

func (trans *Transaction) Rollback() error

type TransactionObject

type TransactionObject interface {
	SetTransaction(trans *Transaction)
}

Jump to

Keyboard shortcuts

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