bar

package module
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Mar 18, 2026 License: MIT Imports: 3 Imported by: 0

README

bar

Bun Active Record

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ContextWithDB

func ContextWithDB(ctx context.Context, db bun.IDB) context.Context

func DBFromContext

func DBFromContext(ctx context.Context) bun.IDB

func RunInTx added in v0.2.0

func RunInTx(ctx context.Context, opts *sql.TxOptions, fn func(context.Context) error) error

Types

type Model

type Model[T any] struct {
	// contains filtered or unexported fields
}

func ModelFor

func ModelFor[T any]() Model[T]

func (Model[T]) All

func (m Model[T]) All(ctx context.Context) (models []T, err error)

func (Model[T]) Create

func (m Model[T]) Create(ctx context.Context, values ...Values) (*T, error)

func (Model[T]) Delete

func (m Model[T]) Delete(ctx context.Context) error

func (Model[T]) First

func (m Model[T]) First(ctx context.Context) (*T, error)

func (Model[T]) Limit

func (m Model[T]) Limit(n int) Model[T]

func (Model[T]) Update

func (m Model[T]) Update(ctx context.Context, values ...Values) (*T, error)

func (Model[T]) Where

func (m Model[T]) Where(values Values) Model[T]

type Values

type Values map[string]any

func (Values) InsertQuery

func (values Values) InsertQuery(iq *bun.InsertQuery) *bun.InsertQuery

func (Values) QueryBuilder

func (values Values) QueryBuilder(qb bun.QueryBuilder) bun.QueryBuilder

func (Values) UpdateQuery

func (values Values) UpdateQuery(uq *bun.UpdateQuery) *bun.UpdateQuery

Jump to

Keyboard shortcuts

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