db

package
v1.0.0-dev.12 Latest Latest
Warning

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

Go to latest
Published: Aug 8, 2024 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func OpenSQLite

func OpenSQLite(dbFile string, write bool) (*sql.DB, error)

OpenSQLite opens a pool of SQLite connections. Different settings are appropriate for reading and writing, so this function needs to know what the sql.DB will be used for.

See this comment for more information: https://github.com/mattn/go-sqlite3/issues/1179#issuecomment-1638083995

Types

type Decryptable

type Decryptable struct {
	Data []byte
	// contains filtered or unexported fields
}

func (*Decryptable) Scan

func (d *Decryptable) Scan(src any) error

type Query

type Query struct {
	Encryptor     *krypto.Encryptor
	BlindIndexKey krypto.Key
	// contains filtered or unexported fields
}

Query helps build SQL queries using bind parameters. Use Query to construct parts of a query and use Param to add bind parameters. The final query and parameters can be retrieved using the Get method.

The zero value is ready to use.

func (*Query) DecryptionTarget

func (q *Query) DecryptionTarget() *Decryptable

DecryptionTarget returns a decryptable value that can be used to scan encrypted values.

func (*Query) Get

func (q *Query) Get() (string, []any, error)

Get returns the constructed query and parameter values.

func (*Query) Param

func (q *Query) Param(v any)

Param writes a parameterized part of a query.

func (*Query) ParamBlindIndex

func (q *Query) ParamBlindIndex(d []byte)

ParamBlindIndex writes a parameterized part of a query and adds a blind index of the value to the query. Important Note: The blind indexes will need to be rebuild if the key or argon2 parameters change.

func (*Query) ParamEncrypted

func (q *Query) ParamEncrypted(d []byte)

Param writes a parameterized part of a query and encrypts the value before adding it to the query.

func (*Query) Params

func (q *Query) Params(v ...any)

Params writes multiple parameterized parts of a query seperated by commas.

func (*Query) Unsafe

func (q *Query) Unsafe(s string)

Unsafe writes a non-parameterized part of a query.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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