sqlstorage

package
v0.0.0-...-46baba5 Latest Latest
Warning

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

Go to latest
Published: Apr 30, 2024 License: AGPL-3.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNonMatchingOrderAndStart = errors.New("OrderBy and StartAfter doesn't have the same number of arguments")

Functions

func NewSQliteClient

func NewSQliteClient(cfg *Config) (*sql.DB, error)

func PaginateSelection

func PaginateSelection(query sq.SelectBuilder, cmd *PaginateCmd) sq.SelectBuilder

Types

type Client

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

func (*Client) Exec

func (c *Client) Exec(query string, args ...any) (sql.Result, error)

func (*Client) ExecContext

func (c *Client) ExecContext(ctx context.Context, query string, args ...any) (sql.Result, error)

func (*Client) Query

func (c *Client) Query(query string, args ...any) (*sql.Rows, error)

func (*Client) QueryContext

func (c *Client) QueryContext(ctx context.Context, query string, args ...any) (*sql.Rows, error)

func (*Client) QueryRow

func (c *Client) QueryRow(query string, args ...any) *sql.Row

func (*Client) QueryRowContext

func (c *Client) QueryRowContext(ctx context.Context, query string, args ...any) *sql.Row

type Config

type Config struct {
	Path string `json:"path"`
}

type PaginateCmd

type PaginateCmd struct {
	StartAfter map[string]string
	Limit      int
}

type Querier

type Querier interface {
	Exec(query string, args ...any) (sql.Result, error)
	ExecContext(ctx context.Context, query string, args ...any) (sql.Result, error)
	Query(query string, args ...any) (*sql.Rows, error)
	QueryContext(ctx context.Context, query string, args ...any) (*sql.Rows, error)
	QueryRow(query string, args ...any) *sql.Row
	QueryRowContext(ctx context.Context, query string, args ...any) *sql.Row
}

func Init

func Init(cfg Config) (*sql.DB, Querier, error)

func NewSQLQuerier

func NewSQLQuerier(db *sql.DB) Querier

func NewTestStorage

func NewTestStorage(t *testing.T) Querier

type RowScanner

type RowScanner interface {
	Scan(...interface{}) error
}

RowScanner is the interface that wraps the Scan method.

Scan behaves like database/sql.Row.Scan.

type SQLTime

type SQLTime time.Time

func (*SQLTime) Scan

func (t *SQLTime) Scan(value any) error

func (SQLTime) Time

func (t SQLTime) Time() time.Time

func (SQLTime) Value

func (t SQLTime) Value() (driver.Value, error)

Jump to

Keyboard shortcuts

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