genent

package
v0.0.0-...-d2e6534 Latest Latest
Warning

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

Go to latest
Published: Oct 28, 2024 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func HashField

func HashField(name string, unique bool) ent.Field

HashField is a wrapper around field.String returning an immutable non-empty string with length of 64.

func LogFn

func LogFn(logger *slog.Logger) func(...any)

LogFn returns an Ent-compatible logging wrapper function for slog..

func TimeDefaultNow

func TimeDefaultNow() func() time.Time

TimeDefaultNow returns a function which executes time.Now exactly once.

Types

type CommitRollbacker

type CommitRollbacker interface {
	Commit() error
	Rollback() error
}

type Tx

type Tx[T CommitRollbacker] struct {
	// contains filtered or unexported fields
}

func WrapTx

func WrapTx[T CommitRollbacker](v T) *Tx[T]

func (*Tx[T]) Commit

func (t *Tx[T]) Commit() error

func (*Tx[T]) Rollback

func (t *Tx[T]) Rollback() error

func (*Tx[T]) Unwrap

func (t *Tx[T]) Unwrap() T

Jump to

Keyboard shortcuts

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