bun

package
v0.4.1 Latest Latest
Warning

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

Go to latest
Published: Sep 14, 2023 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Option

type Option func(*Repo) error

Option is an option setter used to configure creation.

func WithTableCreate

func WithTableCreate() Option

func WithTableReset

func WithTableReset() Option

type Repo

type Repo struct {
	// contains filtered or unexported fields
}

Repo can be an eventhorizon.ReadRepo, eventhorizon.WriteRepo or eventhorizon.ReadWriteRepo for Bun. Acts as a base/abstract for your custom entity implementation.

func NewRepo

func NewRepo(db bun.DB, model interface{}, mapDbEntityToEhEntity func(m interface{}) eh.Entity, mapEhEntityToDbEntity func(e interface{}) interface{}, options ...Option) (*Repo, error)

NewRepo creates a new Repo with a bun.DB handle.

func (Repo) Close

func (r Repo) Close() error

func (Repo) Find

func (r Repo) Find(ctx context.Context, uuid uuid.UUID) (eh.Entity, error)

func (Repo) FindAll

func (r Repo) FindAll(ctx context.Context) ([]eh.Entity, error)

func (Repo) InnerRepo

func (r Repo) InnerRepo(ctx context.Context) eh.ReadRepo

func (Repo) Remove

func (r Repo) Remove(ctx context.Context, id uuid.UUID) error

func (Repo) Save

func (r Repo) Save(ctx context.Context, entity eh.Entity) error

Jump to

Keyboard shortcuts

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