database

package
v0.0.0-...-d1147f9 Latest Latest
Warning

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

Go to latest
Published: Jan 25, 2024 License: MIT Imports: 25 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Ping func(context.Context) error

Functions

func Commit

func Commit(tx *ent.Tx, err error) error

Commit will commit the transaction, unless the provided error is non-nil, in which case it will rollback the transaction and return a wrapped error.

func CronGuildEvents

func CronGuildEvents(ctx context.Context) error

func Migrate

func Migrate(ctx context.Context, logger log.Interface)

func NewAuthService

func NewAuthService(db *ent.Client, adminIDs []string) *authService

func NewGuildEventStream

func NewGuildEventStream(
	ctx context.Context,
	inputs predicate.GuildEvent,
	interval,
	oldest time.Duration,
) <-chan *ent.GuildEvent

func Open

func Open(ctx context.Context, logger log.Interface, config models.ConfigDatabase) *ent.Client

Open new postgres connection.

func ParseURL

func ParseURL(config models.ConfigDatabase) (string, error)

func Rollback

func Rollback(tx *ent.Tx, err error) error

Rollback will rollback the transaction and return a wrapped error of the original error.

func RunWithTx

func RunWithTx(ctx context.Context, logger log.Interface, db *ent.Client, fn TxFn) error

Types

type TxFn

type TxFn func(ctx context.Context, logger log.Interface, db *ent.Tx) error

Jump to

Keyboard shortcuts

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