backend

package
v0.5.4 Latest Latest
Warning

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

Go to latest
Published: Oct 20, 2023 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Column

type Column struct {
	Name     string `json:"name"`     // Column name
	TypeName string `json:"typeName"` // Column type
}

Column definition of a query result.

type QueryResult

type QueryResult struct {
	Columns []Column `json:"columns"` // Column definitions of the query result
	Rows    []Row    `json:"rows"`    // The result rows
}

Result of a database query.

type Row

type Row []any

Row of a database query result.

type SimpleSQLClient added in v0.5.0

type SimpleSQLClient interface {
	// Execute runs a query that does not return rows, e.g. INSERT or UPDATE.
	Execute(query string, args ...any) (sql.Result, error)

	// Query runs a query that returns rows, typically a SELECT.
	Query(query string, args ...any) (*QueryResult, error)
}

SimpleSQLClient allows extensions to execute statements and queries against the database.

func NewSqlClient

func NewSqlClient(ctx context.Context, tx *sql.Tx) SimpleSQLClient

NewSqlClient creates a new SimpleSQLClient.

type SimpleSqlClientMock added in v0.5.0

type SimpleSqlClientMock struct {
	mock.Mock
}

func CreateSimpleSqlClientMock added in v0.5.2

func CreateSimpleSqlClientMock() *SimpleSqlClientMock

func (*SimpleSqlClientMock) Execute added in v0.5.0

func (mock *SimpleSqlClientMock) Execute(query string, args ...any) (sql.Result, error)

func (*SimpleSqlClientMock) Query added in v0.5.0

func (mock *SimpleSqlClientMock) Query(query string, args ...any) (*QueryResult, error)

func (*SimpleSqlClientMock) SimulateExecuteError added in v0.5.0

func (mock *SimpleSqlClientMock) SimulateExecuteError(err error, query string, args ...any)

func (*SimpleSqlClientMock) SimulateExecuteSuccess added in v0.5.0

func (mock *SimpleSqlClientMock) SimulateExecuteSuccess(query string, args ...any)

func (*SimpleSqlClientMock) SimulateQueryError added in v0.5.0

func (mock *SimpleSqlClientMock) SimulateQueryError(err error, query string, args ...any)

func (*SimpleSqlClientMock) SimulateQuerySuccess added in v0.5.0

func (mock *SimpleSqlClientMock) SimulateQuerySuccess(result *QueryResult, query string, args ...any)

Jump to

Keyboard shortcuts

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