client

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Nov 7, 2025 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New(opts ...Option) *gorm.DB

Types

type Option

type Option func(*client)

func WithAllowGlobalUpdate

func WithAllowGlobalUpdate(allowGlobalUpdate bool) Option

func WithApplicationName

func WithApplicationName(applicationName string) Option

func WithClauseBuilders

func WithClauseBuilders(clauseBuilders map[string]clause.ClauseBuilder) Option

func WithConnPool

func WithConnPool(connPool gorm.ConnPool) Option

func WithCreateBatchSize

func WithCreateBatchSize(createBatchSize int) Option

CreateBatchSize default create batch size

func WithDb

func WithDb(db string) Option

func WithDefaultContextTimeout

func WithDefaultContextTimeout(defaultContextTimeout time.Duration) Option

func WithDefaultTransactionTimeout

func WithDefaultTransactionTimeout(defaultTransactionTimeout time.Duration) Option

func WithDisableAutomaticPing

func WithDisableAutomaticPing(disableAutomaticPing bool) Option

func WithDisableForeignKeyConstraintWhenMigrating

func WithDisableForeignKeyConstraintWhenMigrating(disableForeignKeyConstraintWhenMigrating bool) Option

func WithDisableNestedTransaction

func WithDisableNestedTransaction(disableNestedTransaction bool) Option

func WithDryRun

func WithDryRun(dryRun bool) Option

DryRun generate sql without execute

func WithFullSaveAssociations

func WithFullSaveAssociations(fullSaveAssociations bool) Option

FullSaveAssociations full save associations

func WithHost

func WithHost(host string) Option

func WithIgnoreRelationshipsWhenMigrating

func WithIgnoreRelationshipsWhenMigrating(ignoreRelationshipsWhenMigrating bool) Option

func WithLogger

func WithLogger(logger loggerGorm.Interface) Option

func WithNamingStrategy

func WithNamingStrategy(namingStrategy schema.Namer) Option

NamingStrategy tables, columns naming strategy

func WithNowFunc

func WithNowFunc(nowFunc func() time.Time) Option

func WithPassword

func WithPassword(password string) Option

func WithPlugins

func WithPlugins(plugins map[string]gorm.Plugin) Option

func WithPort

func WithPort(port int) Option

func WithPrepareStmt

func WithPrepareStmt(prepareStmt bool) Option

PrepareStmt executes the given query in cached statement

func WithPrepareStmtMaxSize

func WithPrepareStmtMaxSize(prepareStmtMaxSize int) Option

PrepareStmt cache support LRU expired, default maxsize=int64 Max value and ttl=1h

func WithPrepareStmtTTL

func WithPrepareStmtTTL(prepareStmtTTL time.Duration) Option

func WithPropagateUnscoped

func WithPropagateUnscoped(propagateUnscoped bool) Option

PropagateUnscoped propagate Unscoped to every other nested statement

func WithQueryFields

func WithQueryFields(queryFields bool) Option

QueryFields executes the SQL query with all fields of the table

func WithSearchPath

func WithSearchPath(searchPath string) Option

func WithSkipDefaultTransaction

func WithSkipDefaultTransaction(skipDefaultTransaction bool) Option

GORM perform single create, update, delete operations in transactions by default to ensure database data integrity

func WithSsl

func WithSsl(ssl string) Option

func WithTranslateError

func WithTranslateError(translateError bool) Option

TranslateError enabling error translation

func WithUser

func WithUser(user string) Option

Jump to

Keyboard shortcuts

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