client

package
v0.0.27 Latest Latest
Warning

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

Go to latest
Published: Nov 16, 2021 License: GPL-3.0 Imports: 2 Imported by: 0

Documentation

Overview

Package client provides resources for data persistence and retrieval.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Add

type Add interface {
	Encoder
	To(collection string) Add
	Item(value map[string]interface{}) Add
	Query(query Query) Add
	Execute(ctx context.Context) (int, error)
}

Add represents a command to add items to the collection

type Client

type Client interface {
	Connect() error
	Query() Query
	Add() Add
	Update() Update
	Remove() Remove
	Transaction(ctx context.Context) (Transaction, error)
}

Client represents a client for operating on a database.

type Encoder

type Encoder interface {
	Statement() (string, []interface{}, error)
}

Encoder represents a statement encoder

type Query

type Query interface {
	Encoder
	Secondary() Query
	From(collection string) Query
	Complement(collection string, args ...interface{}) Query
	Filter(filter interface{}) Query
	Order(by string) Query
	First(first int) Query
	After(key string, value *time.Time) Query
	Transform(transform func(string) string) Query
	Fields(fields ...interface{}) Query
	Field(key string, args ...interface{}) Query
	Execute(ctx context.Context, dst interface{}) error
}

Query represents a query builder

type Remove

type Remove interface {
	Encoder
	From(collection string) Remove
	Filter(filter interface{}) Remove
	Order(by string) Remove
	After(key string, value *time.Time) Remove
	Execute(ctx context.Context) (int, error)
}

Remove represents a command to remove items from the collection

type Transaction

type Transaction interface {
	Execute(statement Encoder) (int, error)
	Commit() error
	Rollback() error
}

Transaction represents a database transaction.

type Update

type Update interface {
	Encoder
	In(collection string) Update
	Item(value map[string]interface{}) Update
	Filter(filter interface{}) Update
	Execute(ctx context.Context) (int, error)
}

Update represents a command to update items in the collection

Jump to

Keyboard shortcuts

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