mock

package
v0.0.5 Latest Latest
Warning

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

Go to latest
Published: Aug 21, 2026 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Compiler

type Compiler struct {
	LastQuery  storage.Query
	LastModel  model.Model
	ReturnPlan storage.Plan
	ReturnErr  error
}

Compiler captures the query and returns a predefined plan.

func (*Compiler) Compile

func (m *Compiler) Compile(q storage.Query, model model.Model) (storage.Plan, error)

type Executor

type Executor struct {
	ExecutedQueries []string
	ExecutedArgs    [][]any
	ReturnExecErr   error
	ReturnQueryRow  storage.Scanner
	ReturnQueryRows storage.Rows
	ReturnQueryErr  error
	ReturnCloseErr  error
}

Executor captures execution calls.

func (*Executor) Close

func (m *Executor) Close() error

func (*Executor) Exec

func (m *Executor) Exec(query string, args ...any) error

func (*Executor) Query

func (m *Executor) Query(query string, args ...any) (storage.Rows, error)

func (*Executor) QueryRow

func (m *Executor) QueryRow(query string, args ...any) storage.Scanner

type Model

type Model struct {
	Table    string
	Sch      []model.Field
	Vals     []any
	ValidErr error
}

Model is a mock implementation of the model.Model interface.

func (Model) DecodeFields

func (m Model) DecodeFields(r model.FieldReader)

func (Model) EncodeFields

func (m Model) EncodeFields(w model.FieldWriter)

func (Model) IsNil

func (m Model) IsNil() bool

func (Model) ModelName

func (m Model) ModelName() string

func (Model) Pointers

func (m Model) Pointers() []any

func (Model) Schema

func (m Model) Schema() []model.Field

func (*Model) Validate

func (m *Model) Validate(action byte) error

type Rows

type Rows struct {
	Count      int
	Current    int
	ScanErr    error
	ColumnsVal []string
	ColumnsErr error
	CloseErr   error
	ErrVal     error
}

func (*Rows) Close

func (m *Rows) Close() error

func (*Rows) Columns

func (m *Rows) Columns() ([]string, error)

func (*Rows) Err

func (m *Rows) Err() error

func (*Rows) Next

func (m *Rows) Next() bool

func (*Rows) Scan

func (m *Rows) Scan(dest ...any) error

type Scanner

type Scanner struct {
	ScanErr error
}

func (*Scanner) Scan

func (m *Scanner) Scan(dest ...any) error

type TxBoundExecutor

type TxBoundExecutor struct {
	Executor
	CommitCalled   bool
	RollbackCalled bool
	CommitErr      error
	RollbackErr    error
}

func (*TxBoundExecutor) Commit

func (m *TxBoundExecutor) Commit() error

func (*TxBoundExecutor) Rollback

func (m *TxBoundExecutor) Rollback() error

type TxExecutor

type TxExecutor struct {
	Executor
	Bound      *TxBoundExecutor
	BeginTxErr error
}

TxExecutor records BeginTx calls.

func (*TxExecutor) BeginTx

func (m *TxExecutor) BeginTx() (storage.TxBoundExecutor, error)

Jump to

Keyboard shortcuts

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