database

package
v2.9.0 Latest Latest
Warning

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

Go to latest
Published: Aug 25, 2026 License: BSD-3-Clause Imports: 23 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ParseSQLiteConnectionString added in v2.9.0

func ParseSQLiteConnectionString(connString string) (string, error)

func SetGormLogger

func SetGormLogger(l logger.Interface)

Types

type BaseModel added in v2.8.1

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

func (*BaseModel) BeforeCreate added in v2.8.1

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

func (*BaseModel) BeforeUpdate added in v2.8.1

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

type DB

type DB struct {
	*gorm.DB
}

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)

FindEnvironmentIDByApiKey finds the environment ID that is associated with the given API key. It queries the api_keys table to validate the key and find the associated environment.

func (*DB) SQLDB

func (db *DB) SQLDB() (*sql.DB, error)

type JSON added in v2.8.1

type JSON map[string]any

func (*JSON) Scan added in v2.8.1

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

func (JSON) Value added in v2.8.1

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

type MigrationOptions

type MigrationOptions struct {
	AllowDowngrade bool
}

type StringSlice added in v2.8.1

type StringSlice []string

func (*StringSlice) Scan added in v2.8.1

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

func (StringSlice) Value added in v2.8.1

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

Jump to

Keyboard shortcuts

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