Documentation
¶
Index ¶
- func New(opts ...Option) *gorm.DB
- type Option
- func WithGormAllowGlobalUpdate(allowGlobalUpdate bool) Option
- func WithGormClauseBuilders(clauseBuilders map[string]clause.ClauseBuilder) Option
- func WithGormConnPool(connPool gorm.ConnPool) Option
- func WithGormCreateBatchSize(createBatchSize int) Option
- func WithGormDefaultContextTimeout(defaultContextTimeout time.Duration) Option
- func WithGormDefaultTransactionTimeout(defaultTransactionTimeout time.Duration) Option
- func WithGormDisableAutomaticPing(disableAutomaticPing bool) Option
- func WithGormDisableForeignKeyConstraintWhenMigrating(disableForeignKeyConstraintWhenMigrating bool) Option
- func WithGormDisableNestedTransaction(disableNestedTransaction bool) Option
- func WithGormDryRun(dryRun bool) Option
- func WithGormFullSaveAssociations(fullSaveAssociations bool) Option
- func WithGormIgnoreRelationshipsWhenMigrating(ignoreRelationshipsWhenMigrating bool) Option
- func WithGormLogger(logger loggerGorm.Interface) Option
- func WithGormNamingStrategy(namingStrategy schema.Namer) Option
- func WithGormNowFunc(nowFunc func() time.Time) Option
- func WithGormPlugins(plugins map[string]gorm.Plugin) Option
- func WithGormPrepareStmt(prepareStmt bool) Option
- func WithGormPrepareStmtMaxSize(prepareStmtMaxSize int) Option
- func WithGormPrepareStmtTTL(prepareStmtTTL time.Duration) Option
- func WithGormPropagateUnscoped(propagateUnscoped bool) Option
- func WithGormQueryFields(queryFields bool) Option
- func WithGormSkipDefaultTransaction(skipDefaultTransaction bool) Option
- func WithGormTranslateError(translateError bool) Option
- func WithPostgresConn(conn gorm.ConnPool) Option
- func WithPostgresDSN(dsn string) Option
- func WithPostgresDriverName(driverName string) Option
- func WithPostgresPreferSimpleProtocol(preferSimpleProtocol bool) Option
- func WithPostgresWithoutQuotingCheck(withoutQuotingCheck bool) Option
- func WithPostgresWithoutReturning(withoutReturning bool) Option
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Option ¶
type Option func(*config)
func WithGormAllowGlobalUpdate ¶ added in v0.2.0
WithGormAllowGlobalUpdate allows updates/deletes without WHERE conditions
func WithGormClauseBuilders ¶ added in v0.2.0
func WithGormClauseBuilders(clauseBuilders map[string]clause.ClauseBuilder) Option
WithGormClauseBuilders sets custom clause builders for SQL generation
func WithGormConnPool ¶ added in v0.2.0
WithGormConnPool sets a custom connection pool for GORM operations
func WithGormCreateBatchSize ¶ added in v0.2.0
WithGormCreateBatchSize sets default batch size for bulk inserts
func WithGormDefaultContextTimeout ¶ added in v0.2.0
WithGormDefaultContextTimeout sets the default timeout for context in DB operations
func WithGormDefaultTransactionTimeout ¶ added in v0.2.0
WithGormDefaultTransactionTimeout sets the default timeout for transactions
func WithGormDisableAutomaticPing ¶ added in v0.2.0
WithGormDisableAutomaticPing disables automatic database ping on initialization
func WithGormDisableForeignKeyConstraintWhenMigrating ¶ added in v0.2.0
func WithGormDisableForeignKeyConstraintWhenMigrating(disableForeignKeyConstraintWhenMigrating bool) Option
WithGormDisableForeignKeyConstraintWhenMigrating disables creating foreign key constraints during migrations
func WithGormDisableNestedTransaction ¶ added in v0.2.0
WithGormDisableNestedTransaction disables nested transactions
func WithGormDryRun ¶ added in v0.2.0
WithGormDryRun enables generating SQL statements without executing them
func WithGormFullSaveAssociations ¶ added in v0.2.0
WithGormFullSaveAssociations enables saving all associations when saving a record
func WithGormIgnoreRelationshipsWhenMigrating ¶ added in v0.2.0
WithGormIgnoreRelationshipsWhenMigrating disables saving relationships when performing migrations
func WithGormLogger ¶ added in v0.2.0
func WithGormLogger(logger loggerGorm.Interface) Option
WithGormLogger sets a custom logger for GORM
func WithGormNamingStrategy ¶ added in v0.2.0
WithGormNamingStrategy sets a custom naming strategy for tables and columns
func WithGormNowFunc ¶ added in v0.2.0
WithGormNowFunc sets a custom function to generate timestamps for new records
func WithGormPlugins ¶ added in v0.2.0
WithGormPlugins sets custom GORM plugins
func WithGormPrepareStmt ¶ added in v0.2.0
WithGormPrepareStmt enables caching prepared statements for faster execution
func WithGormPrepareStmtMaxSize ¶ added in v0.2.0
WithGormPrepareStmtMaxSize sets the maximum size of the prepared statement cache
func WithGormPrepareStmtTTL ¶ added in v0.2.0
WithGormPrepareStmtTTL sets the TTL (time-to-live) for prepared statements in the cache
func WithGormPropagateUnscoped ¶ added in v0.2.0
WithGormPropagateUnscoped propagates Unscoped mode to nested statements
func WithGormQueryFields ¶ added in v0.2.0
WithGormQueryFields enables querying all fields of a table
func WithGormSkipDefaultTransaction ¶ added in v0.2.0
WithGormSkipDefaultTransaction disables automatic transactions for single create/update/delete operations
func WithGormTranslateError ¶ added in v0.2.0
WithGormTranslateError enables translating database errors using Dialector
func WithPostgresConn ¶ added in v0.2.0
WithPostgresConn sets a custom connection pool for Postgres (e.g., *sql.DB or sqlmock)
func WithPostgresDSN ¶ added in v0.2.0
WithPostgresDSN sets the Data Source Name (connection string) for Postgres
func WithPostgresDriverName ¶ added in v0.2.0
WithPostgresDriverName sets the driver name for the Postgres Dialector
func WithPostgresPreferSimpleProtocol ¶ added in v0.2.0
WithPostgresPreferSimpleProtocol enables Postgres simple protocol instead of extended protocol
func WithPostgresWithoutQuotingCheck ¶ added in v0.2.0
WithPostgresWithoutQuotingCheck disables column/table quoting checks
func WithPostgresWithoutReturning ¶ added in v0.2.0
WithPostgresWithoutReturning disables generating RETURNING clause in INSERT/UPDATE/DELETE