db

package
v0.0.0-...-beffdc0 Latest Latest
Warning

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

Go to latest
Published: Dec 12, 2024 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DBAll

func DBAll[T DBModelID](db *gorm.DB, cb func(T) error) error

func NewLoggerOp

func NewLoggerOp(logger logger.Interface) func(*gorm.Config)

Types

type Config

type Config struct {
	Driver string `json:"driver" yaml:"driver"`
	URL    string `json:"url"    yaml:"url"`
	// contains filtered or unexported fields
}

func (*Config) DB

func (d *Config) DB() *gorm.DB

func (*Config) Open

func (d *Config) Open(ops ...Option) (*gorm.DB, error)

type DBModelID

type DBModelID interface {
	GetID() uint
}

type Model

type Model struct {
	CreatedAt time.Time
	UpdatedAt time.Time
	DeletedAt gorm.DeletedAt `gorm:"index"`

	ID uint `gorm:"primarykey"`
}

func (Model) GetID

func (d Model) GetID() uint

type Option

type Option func(*gorm.Config)

Jump to

Keyboard shortcuts

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