Documentation
¶
Index ¶
- func ConnStringFrom(ctx context.Context, cfg *PostgreSqlConfig) string
- func Connect(ctx context.Context, cfg *PostgreSqlConfig) (*pgx.Conn, error)
- func ConnectionString(host string, user string, password string, database string, port ...int) string
- func RemoveNullBytes(data []byte) []byte
- func SanitizeConnectionString(connectionString string) string
- type DedicatedPostgreSQLConnectionProvider
- func (db *DedicatedPostgreSQLConnectionProvider) Acquire(ctx context.Context) (*pgxpool.Conn, error)
- func (db *DedicatedPostgreSQLConnectionProvider) Close(ctx context.Context) error
- func (db *DedicatedPostgreSQLConnectionProvider) Connect(ctx context.Context, connstr string) error
- func (db *DedicatedPostgreSQLConnectionProvider) Return(ctx context.Context, conn *pgxpool.Conn)
- type JsonDataStore
- func (ds *JsonDataStore[T]) Close(ctx context.Context) error
- func (ds *JsonDataStore[T]) Count(ctx context.Context, query *datastore.SimpleQuery) (int, error)
- func (ds *JsonDataStore[T]) CtxGetConnection(ctx context.Context) *pgxpool.Conn
- func (ds *JsonDataStore[T]) CtxSetConnection(ctx context.Context, conn *pgxpool.Conn) context.Context
- func (ds *JsonDataStore[T]) Delete(ctx context.Context, key string) error
- func (ds *JsonDataStore[T]) DeleteAll(ctx context.Context, key []string) error
- func (m *JsonDataStore[T]) DeleteQuery(ctx context.Context, query *datastore.SimpleQuery) ([]string, error)
- func (ds *JsonDataStore[T]) Exists(ctx context.Context, key string) (bool, error)
- func (ds *JsonDataStore[T]) Get(ctx context.Context, key string) (*T, error)
- func (ds *JsonDataStore[T]) GetAll(ctx context.Context) ([]*T, error)
- func (ds *JsonDataStore[T]) GetMetadata(ctx context.Context, key ...string) ([]*datastore.RowMetadata, error)
- func (ds *JsonDataStore[T]) OnCreate(fn func(ctx context.Context, ds datastore.JsonDataStore[T]) error)
- func (ds *JsonDataStore[T]) Open(ctx context.Context, config any) error
- func (ds *JsonDataStore[T]) Query(ctx context.Context, query *datastore.SimpleQuery) ([]*T, error)
- func (ds *JsonDataStore[T]) QueryAndUpdate(ctx context.Context, query *datastore.SimpleQuery, ...) ([]*T, error)
- func (ds *JsonDataStore[T]) QueryAsMap(ctx context.Context, query *datastore.SimpleQuery) ([]map[string]any, error)
- func (ds *JsonDataStore[T]) QueryTable(ctx context.Context, query *datastore.SimpleQuery) ([][]interface{}, error)
- func (ds *JsonDataStore[T]) Save(ctx context.Context, item *T, key string) error
- func (m *JsonDataStore[T]) SaveAll(ctx context.Context, items []*T, key []string) error
- type KeyValueStore
- func (kv *KeyValueStore) Delete(key string) error
- func (kv *KeyValueStore) Get(key string) (string, error)
- func (kv *KeyValueStore) GetAll() (map[string]string, error)
- func (kv *KeyValueStore) GetSecure(key string) (strfmt.Password, error)
- func (kv *KeyValueStore) GetWithPrefix(prefix string) (map[string]string, error)
- func (kv *KeyValueStore) Init(ctx context.Context) error
- func (kv *KeyValueStore) Set(key string, value string) error
- func (kv *KeyValueStore) SetMany(items map[string]string) error
- func (kv *KeyValueStore) SetSecure(key string, value strfmt.Password) error
- type PgLeader
- type PgQueryConverter
- func (qc *PgQueryConverter) Convert(q *datastore.SimpleQuery, table string) string
- func (qc *PgQueryConverter) ConvertASort(c *datastore.SortBy) string
- func (qc *PgQueryConverter) ConvertCondition(c *datastore.SimpleQueryCondition) string
- func (qc *PgQueryConverter) ConvertConditionGroup(cg *datastore.SimpleQueryConditionGroup) string
- func (qc *PgQueryConverter) ConvertDelete(q *datastore.SimpleQuery, table string) string
- func (qc *PgQueryConverter) ConvertSelect(c *datastore.SimpleQuery, table string) string
- func (qc *PgQueryConverter) ConvertSort(sortbys []*datastore.SortBy) string
- func (qc *PgQueryConverter) ToColumnName(name string) string
- type PgxConnection
- type PostgreSqlConfig
- type PostgresqlConnectionProvider
- type SecureKeyValueStore
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ConnStringFrom ¶ added in v0.0.14
func ConnStringFrom(ctx context.Context, cfg *PostgreSqlConfig) string
func ConnectionString ¶ added in v0.0.9
func RemoveNullBytes ¶ added in v0.0.24
Types ¶
type DedicatedPostgreSQLConnectionProvider ¶ added in v0.0.9
type DedicatedPostgreSQLConnectionProvider struct {
// contains filtered or unexported fields
}
func NewDedicatedPostgreSQLConnectionProvider ¶ added in v0.0.9
func NewDedicatedPostgreSQLConnectionProvider(connstr string) *DedicatedPostgreSQLConnectionProvider
func (*DedicatedPostgreSQLConnectionProvider) Acquire ¶ added in v0.0.9
func (db *DedicatedPostgreSQLConnectionProvider) Acquire(ctx context.Context) (*pgxpool.Conn, error)
Acquire A connection
func (*DedicatedPostgreSQLConnectionProvider) Close ¶ added in v0.0.9
func (db *DedicatedPostgreSQLConnectionProvider) Close(ctx context.Context) error
type JsonDataStore ¶ added in v0.0.14
type JsonDataStore[T any] struct { ConnectionKey pgContextKey // contains filtered or unexported fields }
func NewJsonDatastore ¶ added in v0.0.14
func NewJsonDatastore[T any](ctx context.Context, provider PostgresqlConnectionProvider, table string) *JsonDataStore[T]
func (*JsonDataStore[T]) Close ¶ added in v0.0.14
func (ds *JsonDataStore[T]) Close(ctx context.Context) error
Close should be called to cleanly close the datastore
func (*JsonDataStore[T]) Count ¶ added in v0.0.14
func (ds *JsonDataStore[T]) Count(ctx context.Context, query *datastore.SimpleQuery) (int, error)
func (*JsonDataStore[T]) CtxGetConnection ¶ added in v0.0.18
func (ds *JsonDataStore[T]) CtxGetConnection(ctx context.Context) *pgxpool.Conn
func (*JsonDataStore[T]) CtxSetConnection ¶ added in v0.0.18
func (*JsonDataStore[T]) Delete ¶ added in v0.0.14
func (ds *JsonDataStore[T]) Delete(ctx context.Context, key string) error
Deletes an item
func (*JsonDataStore[T]) DeleteAll ¶ added in v0.0.21
func (ds *JsonDataStore[T]) DeleteAll(ctx context.Context, key []string) error
Deletes an item
func (*JsonDataStore[T]) DeleteQuery ¶ added in v0.0.21
func (m *JsonDataStore[T]) DeleteQuery(ctx context.Context, query *datastore.SimpleQuery) ([]string, error)
func (*JsonDataStore[T]) Get ¶ added in v0.0.14
func (ds *JsonDataStore[T]) Get(ctx context.Context, key string) (*T, error)
Get retrieves an item by it's unique id
func (*JsonDataStore[T]) GetAll ¶ added in v0.0.14
func (ds *JsonDataStore[T]) GetAll(ctx context.Context) ([]*T, error)
Gets all the items in the store.
func (*JsonDataStore[T]) GetMetadata ¶ added in v0.0.24
func (ds *JsonDataStore[T]) GetMetadata(ctx context.Context, key ...string) ([]*datastore.RowMetadata, error)
func (*JsonDataStore[T]) OnCreate ¶ added in v0.0.24
func (ds *JsonDataStore[T]) OnCreate(fn func(ctx context.Context, ds datastore.JsonDataStore[T]) error)
DONT USE THIS
func (*JsonDataStore[T]) Open ¶ added in v0.0.14
func (ds *JsonDataStore[T]) Open(ctx context.Context, config any) error
Open will open the datastore for usage. This should only be done once per datastore
func (*JsonDataStore[T]) Query ¶ added in v0.0.14
func (ds *JsonDataStore[T]) Query(ctx context.Context, query *datastore.SimpleQuery) ([]*T, error)
Sends a simple Query
func (*JsonDataStore[T]) QueryAndUpdate ¶ added in v0.0.14
func (ds *JsonDataStore[T]) QueryAndUpdate(ctx context.Context, query *datastore.SimpleQuery, updater func(ctx context.Context, items []*T) ([]*T, error)) ([]*T, error)
func (*JsonDataStore[T]) QueryAsMap ¶ added in v0.0.14
func (ds *JsonDataStore[T]) QueryAsMap(ctx context.Context, query *datastore.SimpleQuery) ([]map[string]any, error)
func (*JsonDataStore[T]) QueryTable ¶ added in v0.0.14
func (ds *JsonDataStore[T]) QueryTable(ctx context.Context, query *datastore.SimpleQuery) ([][]interface{}, error)
type KeyValueStore ¶ added in v0.0.12
type KeyValueStore struct {
// contains filtered or unexported fields
}
func NewKeyValueStore ¶ added in v0.0.12
func NewSecretKeyValueStore ¶ added in v0.0.12
func (*KeyValueStore) Delete ¶ added in v0.0.12
func (kv *KeyValueStore) Delete(key string) error
func (*KeyValueStore) Get ¶ added in v0.0.12
func (kv *KeyValueStore) Get(key string) (string, error)
--- KeyValueStore
func (*KeyValueStore) GetAll ¶ added in v0.0.12
func (kv *KeyValueStore) GetAll() (map[string]string, error)
func (*KeyValueStore) GetSecure ¶ added in v0.0.12
func (kv *KeyValueStore) GetSecure(key string) (strfmt.Password, error)
func (*KeyValueStore) GetWithPrefix ¶ added in v0.0.12
func (kv *KeyValueStore) GetWithPrefix(prefix string) (map[string]string, error)
--- FilteredKeyValueStore
func (*KeyValueStore) Init ¶ added in v0.0.12
func (kv *KeyValueStore) Init(ctx context.Context) error
func (*KeyValueStore) Set ¶ added in v0.0.12
func (kv *KeyValueStore) Set(key string, value string) error
--- WritableKeyValueStore
type PgLeader ¶ added in v0.0.9
type PgLeader struct {
// contains filtered or unexported fields
}
func NewPgLeader ¶ added in v0.0.9
func NewPgLeader() *PgLeader
func (*PgLeader) ConnectPg ¶ added in v0.0.9
func (pgl *PgLeader) ConnectPg(cfg *PostgreSqlConfig) error
func (*PgLeader) ConnectStr ¶ added in v0.0.9
type PgQueryConverter ¶
type PgQueryConverter struct {
}
func (*PgQueryConverter) Convert ¶
func (qc *PgQueryConverter) Convert(q *datastore.SimpleQuery, table string) string
func (*PgQueryConverter) ConvertASort ¶
func (qc *PgQueryConverter) ConvertASort(c *datastore.SortBy) string
func (*PgQueryConverter) ConvertCondition ¶
func (qc *PgQueryConverter) ConvertCondition(c *datastore.SimpleQueryCondition) string
func (*PgQueryConverter) ConvertConditionGroup ¶
func (qc *PgQueryConverter) ConvertConditionGroup(cg *datastore.SimpleQueryConditionGroup) string
func (*PgQueryConverter) ConvertDelete ¶ added in v0.0.21
func (qc *PgQueryConverter) ConvertDelete(q *datastore.SimpleQuery, table string) string
func (*PgQueryConverter) ConvertSelect ¶
func (qc *PgQueryConverter) ConvertSelect(c *datastore.SimpleQuery, table string) string
func (*PgQueryConverter) ConvertSort ¶
func (qc *PgQueryConverter) ConvertSort(sortbys []*datastore.SortBy) string
func (*PgQueryConverter) ToColumnName ¶
func (qc *PgQueryConverter) ToColumnName(name string) string
type PgxConnection ¶ added in v0.0.14
type PgxConnection struct {
// contains filtered or unexported fields
}
type PostgreSqlConfig ¶
type PostgreSqlConfig struct {
Table string
Connection string
User string
Host string
Password string
Database string
Port uint16
}
func CreateDefaultPostgresqlContainer ¶ added in v0.0.9
func CreateDefaultPostgresqlContainer(t *testing.T) *PostgreSqlConfig
func CreatePostgresqlContainer ¶ added in v0.0.9
func CreatePostgresqlContainer(t *testing.T, config *PostgreSqlConfig) *PostgreSqlConfig
func (*PostgreSqlConfig) GetConnectionString ¶
func (cfg *PostgreSqlConfig) GetConnectionString() string
type PostgresqlConnectionProvider ¶ added in v0.0.9
type SecureKeyValueStore ¶ added in v0.0.24
type SecureKeyValueStore struct {
KeyValueStore
}
Click to show internal directories.
Click to hide internal directories.