datastore

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Oct 8, 2023 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrRecordNotFound = fmt.Errorf("record not found")
)

Functions

func Open added in v0.4.0

func Open(cfg *Config) (*gorm.DB, error)

Types

type Config added in v0.4.0

type Config struct {
	Host     string `env:"DB_HOST,default=localhost"`
	Port     string `env:"DB_PORT,default=5432"`
	User     string `env:"DB_USER,default=postgres"`
	Password string `env:"DB_PASSWORD"`
	Name     string `env:"DB_NAME,default=postgres"`

	Debug bool `env:"DB_DEBUG,default=false"`

	TablePrefix string
}

func NewConfig added in v0.4.0

func NewConfig() (*Config, error)

func (*Config) Dsn added in v0.4.0

func (c *Config) Dsn() string

type Model

type Model struct {
	UUID      uuid.UUID `gorm:"type:uuid;default:gen_random_uuid();primaryKey"`
	CreatedAt time.Time
	UpdatedAt time.Time
	DeletedAt gorm.DeletedAt
}

Model defines fields common for most models.

Jump to

Keyboard shortcuts

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