db

package
v0.0.0-...-ac32a2f Latest Latest
Warning

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

Go to latest
Published: Mar 22, 2024 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrFailedToResolveDbConnStr = errors.New("failed to resolve db connection string")
	ErrFailedToConnectToDb      = errors.New("failed to connect to database")
)

Functions

This section is empty.

Types

type DbConfig

type DbConfig struct {
	DbPath string
}

func (*DbConfig) GetDbPath

func (d *DbConfig) GetDbPath() (string, error)

GetDbPath gets the path to sqlite database from the env variable

type SqliteConnection

type SqliteConnection struct {
	// contains filtered or unexported fields
}

func NewSqliteConnection

func NewSqliteConnection(connectionString string) (*SqliteConnection, error)

NewSqliteConnection create a new sqlite connection but it does not connect to it. If connectionString is not provided, then it resolves it from env variables.

func (*SqliteConnection) Open

func (slc *SqliteConnection) Open(cnf gorm.Config) (*gorm.DB, error)

type SqliteRepository

type SqliteRepository[T any] interface {
	*T
	Connection(*SqliteConnection)
	GetConnection() *SqliteConnection
}

type SqliteRepositoryFactory

type SqliteRepositoryFactory[T any, P SqliteRepository[T]] struct {
	// contains filtered or unexported fields
}

func (*SqliteRepositoryFactory[T, P]) Get

func (r *SqliteRepositoryFactory[T, P]) Get() (P, error)

Jump to

Keyboard shortcuts

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