ex

package
v0.0.0-...-35291d1 Latest Latest
Warning

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

Go to latest
Published: Jan 2, 2025 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Adder

type Adder[M sqlpipe.Model] interface {
	Add(m *M)
}

type Executor

type Executor[M sqlpipe.Model] struct {
	// contains filtered or unexported fields
}

func (*Executor[M]) ApplyStmt

func (e *Executor[M]) ApplyStmt(ctx context.Context, s internal.StmtBuilder[M]) internal.StmtBuilder[M]

func (*Executor[M]) Commit

func (e *Executor[M]) Commit(ctx context.Context) error

func (*Executor[M]) CountTo

func (e *Executor[M]) CountTo(ctx context.Context, x *int64) error

func (*Executor[M]) FindOne

func (e *Executor[M]) FindOne(ctx context.Context) (*M, error)

func (*Executor[M]) Frag

func (e *Executor[M]) Frag(ctx context.Context) iter.Seq2[string, []any]

func (*Executor[M]) From

func (e *Executor[M]) From(src sqlpipe.Source[M]) SourceExecutor[M]

func (*Executor[M]) IsNil

func (e *Executor[M]) IsNil() bool

func (*Executor[M]) Item

func (e *Executor[M]) Item(ctx context.Context) iter.Seq2[*M, error]

func (*Executor[M]) List

func (e *Executor[M]) List(ctx context.Context) ([]*M, error)

func (*Executor[M]) ListTo

func (e *Executor[M]) ListTo(ctx context.Context, listAdder Adder[M]) error

func (*Executor[M]) Pipe

func (e *Executor[M]) Pipe(operators ...sqlpipe.SourceOperator[M]) sqlpipe.Source[M]

func (Executor[M]) PipeE

func (e Executor[M]) PipeE(operators ...sqlpipe.SourceOperator[M]) SourceExecutor[M]

func (*Executor[M]) Range

func (e *Executor[M]) Range(ctx context.Context, fn func(m *M)) error

func (*Executor[M]) Tx

func (e *Executor[M]) Tx(ctx context.Context, do func(ctx context.Context) error) error

type OneToMulti

type OneToMulti[ID comparable, Record any] map[ID][]*Record

func (OneToMulti[ID, Record]) AllRecords

func (m OneToMulti[ID, Record]) AllRecords() iter.Seq[*Record]

func (OneToMulti[ID, Record]) FillWith

func (m OneToMulti[ID, Record]) FillWith(id ID, do func(p *Record))

Depecrated use Records instead

func (OneToMulti[ID, Record]) IsZero

func (m OneToMulti[ID, Record]) IsZero() bool

func (OneToMulti[ID, Record]) Keys

func (m OneToMulti[ID, Record]) Keys() []ID

func (OneToMulti[ID, Record]) Record

func (m OneToMulti[ID, Record]) Record(id ID, r *Record)

func (OneToMulti[ID, Record]) Records

func (m OneToMulti[ID, Record]) Records(id ID) iter.Seq[*Record]

type OneToOne

type OneToOne[ID comparable, Record any] map[ID]*Record

func (OneToOne[ID, Record]) AllRecords

func (m OneToOne[ID, Record]) AllRecords() iter.Seq[*Record]

func (OneToOne[ID, Record]) FillWith

func (m OneToOne[ID, Record]) FillWith(id ID, do func(p *Record))

Depecrated use Records instead

func (OneToOne[ID, Record]) IsZero

func (m OneToOne[ID, Record]) IsZero() bool

func (OneToOne[ID, Record]) Keys

func (m OneToOne[ID, Record]) Keys() []ID

func (OneToOne[ID, Record]) Record

func (m OneToOne[ID, Record]) Record(id ID, r *Record)

func (OneToOne[ID, Record]) Records

func (m OneToOne[ID, Record]) Records(id ID) iter.Seq[*Record]

type RelCache

type RelCache[ID comparable, Record any] interface {
	IsZero() bool

	Record(id ID, r *Record)

	Keys() []ID
	AllRecords() iter.Seq[*Record]

	Records(id ID) iter.Seq[*Record]
}

type SourceExecutor

type SourceExecutor[M sqlpipe.Model] interface {
	sqlpipe.Source[M]

	From(source sqlpipe.Source[M]) SourceExecutor[M]

	PipeE(operators ...sqlpipe.SourceOperator[M]) SourceExecutor[M]

	// just execute
	Commit(ctx context.Context) error

	// execute then iter item
	Item(ctx context.Context) iter.Seq2[*M, error]
	// execute then range
	Range(ctx context.Context, fn func(*M)) error

	// execute then scan as one item
	FindOne(ctx context.Context) (*M, error)
	// execute then list as item list
	List(ctx context.Context) ([]*M, error)
	// execute then list to item adder
	ListTo(ctx context.Context, adder Adder[M]) error
	// execute as count
	CountTo(ctx context.Context, x *int64) error
}

func FromSource

func FromSource[M sqlpipe.Model](src sqlpipe.Source[M]) SourceExecutor[M]

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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