genent

package module
v0.0.0-...-55f479d Latest Latest
Warning

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

Go to latest
Published: Dec 15, 2025 License: MIT Imports: 3 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.

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]

WrapTx wraps *ent.Tx, preventing a rollback once tx was committed.

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