database

package
v3.2.0 Latest Latest
Warning

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

Go to latest
Published: Nov 27, 2026 License: BSD-3-Clause Imports: 33 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsDuplicateKeyError

func IsDuplicateKeyError(db *gorm.DB, err error) bool

func IsForeignKeyError added in v3.1.0

func IsForeignKeyError(db *gorm.DB, err error) bool

func JSONScan

func JSONScan[T any](dest *T, value any) error

func JSONValue

func JSONValue(isNil bool, value any) (driver.Value, error)

func ParseSQLiteConnectionString

func ParseSQLiteConnectionString(connString string) (string, error)

func SetGormLogger

func SetGormLogger(l logger.Interface)

Types

type BaseModel

type BaseModel struct {
	CreatedAt time.Time  `json:"createdAt" gorm:"column:created_at" sortable:"true"`
	UpdatedAt *time.Time `json:"updatedAt,omitempty" gorm:"column:updated_at"`
	ID        string     `json:"id" gorm:"primaryKey;type:text"`
}

func (*BaseModel) BeforeCreate

func (m *BaseModel) BeforeCreate(_ *gorm.DB) (err error)

func (*BaseModel) BeforeUpdate

func (m *BaseModel) BeforeUpdate(_ *gorm.DB) (err error)

type DB

type DB struct {
	*gorm.DB
	// contains filtered or unexported fields
}

func Initialize

func Initialize(ctx context.Context, databaseURL string, options MigrationOptions) (database *DB, err error)

func (*DB) Close

func (db *DB) Close() error

func (*DB) FindEnvironmentIDByApiKey

func (db *DB) FindEnvironmentIDByApiKey(ctx context.Context, apiKey string) (string, error)

type JSON

type JSON map[string]any

func JSONFromMap added in v3.2.0

func JSONFromMap[M ~map[string]V, V any](input M) JSON

func (*JSON) Scan

func (j *JSON) Scan(value any) error

func (JSON) ToStringMap added in v3.2.0

func (j JSON) ToStringMap() map[string]string

func (JSON) Value

func (j JSON) Value() (driver.Value, error)

type MigrationOptions

type MigrationOptions struct {
	AllowDowngrade bool
	AgentMode      bool
}

type StringSlice

type StringSlice []string

func (*StringSlice) Scan

func (s *StringSlice) Scan(value any) error

func (StringSlice) Value

func (s StringSlice) Value() (driver.Value, error)

Directories

Path Synopsis
Set Dialect to the target database dialect before running migrations.
Set Dialect to the target database dialect before running migrations.

Jump to

Keyboard shortcuts

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