database

package module
v0.0.0-...-cc6bba2 Latest Latest
Warning

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

Go to latest
Published: Sep 19, 2022 License: MIT Imports: 19 Imported by: 3

README

Database

The database module provides access to Pippin's database schema as well as a redis client.

ent is uses as an ORM, supporting postgres, mysql, and sqlite3 databases.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrLockNotObtained = errors.New("couldn't obtain lock")
View Source
var LockRetryStrategy = redislock.Options{
	RetryStrategy: redislock.LimitRetry(redislock.LinearBackoff(2*time.Second), 3),
}

Retry every 100ms, for up-to 3x

Functions

func GetRedisDB

func GetRedisDB() *redisManager

func NewEntClient

func NewEntClient(connInfo SqlDBConn) (*ent.Client, error)

Types

type MysqlConn

type MysqlConn struct {
	Host     string
	Port     string
	Password string
	User     string
	DBName   string
}

func (*MysqlConn) DSN

func (c *MysqlConn) DSN() string

func (*MysqlConn) Dialect

func (c *MysqlConn) Dialect() string

type PostgresConn

type PostgresConn struct {
	Host     string
	Port     string
	Password string
	User     string
	DBName   string
}

func (*PostgresConn) DSN

func (c *PostgresConn) DSN() string

func (*PostgresConn) Dialect

func (c *PostgresConn) Dialect() string

type SqlDBConn

type SqlDBConn interface {
	DSN() string
	Dialect() string
}

func GetSqlDbConn

func GetSqlDbConn(mock bool) (SqlDBConn, error)

Gets the DB connection information based on environment variables

type SqliteConn

type SqliteConn struct {
	FileName string
	Mode     string
}

func (*SqliteConn) DSN

func (c *SqliteConn) DSN() string

func (*SqliteConn) Dialect

func (c *SqliteConn) Dialect() string

Directories

Path Synopsis
ent

Jump to

Keyboard shortcuts

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