dal

package
v1.1.4 Latest Latest
Warning

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

Go to latest
Published: Feb 4, 2024 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	DB     *gorm.DB
	DBType consts.DBType
)
View Source
var (
	Q                   = new(Query)
	Attachment          *attachment
	Category            *category
	Comment             *comment
	CommentBlack        *commentBlack
	FlywaySchemaHistory *flywaySchemaHistory
	Journal             *journal
	Link                *link
	Log                 *log
	Menu                *menu
	Meta                *meta
	Option              *option
	Photo               *photo
	Post                *post
	PostCategory        *postCategory
	PostTag             *postTag
	Tag                 *tag
	ThemeSetting        *themeSetting
	User                *user
)

Functions

func GetDB added in v1.0.3

func GetDB() *gorm.DB

func NewGormDB

func NewGormDB(conf *config.Config, gormLogger logger.Interface) *gorm.DB

func SetCtxQuery added in v1.0.3

func SetCtxQuery(ctx context.Context, q *Query) context.Context

func SetDefault

func SetDefault(db *gorm.DB, opts ...gen.DOOption)

func Transaction

func Transaction(ctx context.Context, fn func(txCtx context.Context) error) error

Types

type Query

type Query struct {
	Attachment          attachment
	Category            category
	Comment             comment
	CommentBlack        commentBlack
	FlywaySchemaHistory flywaySchemaHistory
	Journal             journal
	Link                link
	Log                 log
	Menu                menu
	Meta                meta
	Option              option
	Photo               photo
	Post                post
	PostCategory        postCategory
	PostTag             postTag
	Tag                 tag
	ThemeSetting        themeSetting
	User                user
	// contains filtered or unexported fields
}

func GetQueryByCtx added in v1.0.3

func GetQueryByCtx(ctx context.Context) *Query

func Use

func Use(db *gorm.DB, opts ...gen.DOOption) *Query

func (*Query) Available

func (q *Query) Available() bool

func (*Query) Begin

func (q *Query) Begin(opts ...*sql.TxOptions) *QueryTx

func (*Query) ReadDB

func (q *Query) ReadDB() *Query

func (*Query) ReplaceDB

func (q *Query) ReplaceDB(db *gorm.DB) *Query

func (*Query) Transaction

func (q *Query) Transaction(fc func(tx *Query) error, opts ...*sql.TxOptions) error

func (*Query) WithContext

func (q *Query) WithContext(ctx context.Context) *queryCtx

func (*Query) WriteDB

func (q *Query) WriteDB() *Query

type QueryTx

type QueryTx struct {
	*Query
	Error error
}

func (*QueryTx) Commit

func (q *QueryTx) Commit() error

func (*QueryTx) Rollback

func (q *QueryTx) Rollback() error

func (*QueryTx) RollbackTo

func (q *QueryTx) RollbackTo(name string) error

func (*QueryTx) SavePoint

func (q *QueryTx) SavePoint(name string) error

Jump to

Keyboard shortcuts

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