ddl

package
v0.7.1 Latest Latest
Warning

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

Go to latest
Published: Sep 16, 2021 License: MIT Imports: 24 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DB added in v0.3.5

type DB interface {
	Querier
	BeginTxx(ctx context.Context, opts *sql.TxOptions) (Tx, error)
	Close() error
}

DB wraps sqlx.Tx and sqlx.DB https://github.com/jmoiron/sqlx/issues/344#issuecomment-318372779

type Ddl

type Ddl struct {
	Dir     string
	Reverse bool
	Dao     bool
	Pre     string
	Df      string
	Conf    config.DbConfig
}

Ddl is for ddl command

func (Ddl) Exec

func (d Ddl) Exec()

Exec executes the logic for ddl command if Reverse is true, it will generate code from database tables, otherwise it will update database tables from structs defined in domain pkg

type GddDB added in v0.3.5

type GddDB struct {
	*sqlx.DB
}

GddDB wraps sqlx.DB

func (*GddDB) BeginTxx added in v0.3.5

func (g *GddDB) BeginTxx(ctx context.Context, opts *sql.TxOptions) (Tx, error)

BeginTxx begins a transaction

type GddTx added in v0.3.5

type GddTx struct {
	*sqlx.Tx
}

GddTx wraps sqlx.Tx

type Querier added in v0.3.5

type Querier interface {
	NamedExecContext(ctx context.Context, query string, arg interface{}) (sql.Result, error)
	ExecContext(ctx context.Context, query string, args ...interface{}) (sql.Result, error)
	GetContext(ctx context.Context, dest interface{}, query string, args ...interface{}) error
	Rebind(query string) string
	SelectContext(ctx context.Context, dest interface{}, query string, args ...interface{}) error
}

Querier common operations for sqlx.Tx and sqlx.DB

type Tx added in v0.3.5

type Tx interface {
	Querier
	Commit() error
	Rollback() error
}

Tx transaction

Jump to

Keyboard shortcuts

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