Documentation ¶
Index ¶
- Constants
- func ConnectionString(host string, user string, password string, database string, port ...int) string
- 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 PgLeader
- type PgQueryConverter
- func (qc *PgQueryConverter) Convert(c *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) ConvertSelect(c *datastore.SimpleQuery, table string) string
- func (qc *PgQueryConverter) ConvertSort(sortbys []*datastore.SortBy) string
- func (qc *PgQueryConverter) ToColumnName(name string) string
- type PostgreSqlConfig
- func ConfigFromEnv(env *cloudy.Environment) (*PostgreSqlConfig, error)
- func ConfigFromMap(m map[string]interface{}) (*PostgreSqlConfig, error)
- func CreateDefaultPostgresqlContainer(t *testing.T) *PostgreSqlConfig
- func CreatePostgresqlContainer(t *testing.T, config *PostgreSqlConfig) *PostgreSqlConfig
- type PostgreSqlJsonDataStore
- func (m *PostgreSqlJsonDataStore[T]) Check(ctx context.Context) error
- func (m *PostgreSqlJsonDataStore[T]) Close(ctx context.Context) error
- func (m *PostgreSqlJsonDataStore[T]) Delete(ctx context.Context, key string) error
- func (m *PostgreSqlJsonDataStore[T]) Exists(ctx context.Context, key string) (bool, error)
- func (m *PostgreSqlJsonDataStore[T]) Get(ctx context.Context, key string) (*T, error)
- func (m *PostgreSqlJsonDataStore[T]) GetAll(ctx context.Context) ([]*T, error)
- func (m *PostgreSqlJsonDataStore[T]) NewConnectionContext(ctx context.Context) (context.Context, error)
- func (m *PostgreSqlJsonDataStore[T]) OnCreate(fn func(ctx context.Context, ds datastore.JsonDataStore[T]) error)
- func (m *PostgreSqlJsonDataStore[T]) Open(ctx context.Context, config interface{}) error
- func (m *PostgreSqlJsonDataStore[T]) Query(ctx context.Context, query *datastore.SimpleQuery) ([]*T, error)
- func (m *PostgreSqlJsonDataStore[T]) ReturnConnectionContext(ctx context.Context)
- func (m *PostgreSqlJsonDataStore[T]) Save(ctx context.Context, item *T, key string) error
- type PostgreSqlJsonDataStoreFactory
- func (c *PostgreSqlJsonDataStoreFactory) Create(cfg interface{}) (datastore.UntypedJsonDataStore, error)
- func (c *PostgreSqlJsonDataStoreFactory) CreateJsonDatastore(ctx context.Context, typename string, prefix string, idField string) datastore.UntypedJsonDataStore
- func (c *PostgreSqlJsonDataStoreFactory) FromEnv(env *cloudy.Environment) (interface{}, error)
- type PostgresqlConnectionProvider
- type UntypedPostgreSqlConfig
- type UntypedPostgreSqlJsonDataStore
- func (m *UntypedPostgreSqlJsonDataStore) Close(ctx context.Context) error
- func (m *UntypedPostgreSqlJsonDataStore) Delete(ctx context.Context, key string) error
- func (m *UntypedPostgreSqlJsonDataStore) Exists(ctx context.Context, key string) (bool, error)
- func (m *UntypedPostgreSqlJsonDataStore) Get(ctx context.Context, key string) ([]byte, error)
- func (m *UntypedPostgreSqlJsonDataStore) GetAll(ctx context.Context) ([][]byte, error)
- func (m *UntypedPostgreSqlJsonDataStore) NewConnectionContext(ctx context.Context) (context.Context, error)
- func (m *UntypedPostgreSqlJsonDataStore) OnCreate(fn func(ctx context.Context, ds datastore.UntypedJsonDataStore) error)
- func (m *UntypedPostgreSqlJsonDataStore) Open(ctx context.Context, config interface{}) error
- func (m *UntypedPostgreSqlJsonDataStore) Query(ctx context.Context, query *datastore.SimpleQuery) ([][]byte, error)
- func (m *UntypedPostgreSqlJsonDataStore) ReturnConnectionContext(ctx context.Context)
- func (m *UntypedPostgreSqlJsonDataStore) Save(ctx context.Context, item []byte, key string) error
Constants ¶
View Source
const PostgresProviderID = "postgresql"
Variables ¶
This section is empty.
Functions ¶
func ConnectionString ¶ added in v0.0.9
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 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(c *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) 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 PostgreSqlConfig ¶
type PostgreSqlConfig struct { Table string Connection string User string Host string Password string Database string Port uint16 }
func ConfigFromEnv ¶
func ConfigFromEnv(env *cloudy.Environment) (*PostgreSqlConfig, error)
func ConfigFromMap ¶
func ConfigFromMap(m map[string]interface{}) (*PostgreSqlConfig, error)
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) ForTable ¶
func (cfg *PostgreSqlConfig) ForTable(table string) *PostgreSqlConfig
func (*PostgreSqlConfig) GetConnectionString ¶
func (cfg *PostgreSqlConfig) GetConnectionString() string
type PostgreSqlJsonDataStore ¶
type PostgreSqlJsonDataStore[T any] struct { // client *pgx.Conn Database string ConnectionKey pgContextKey // contains filtered or unexported fields }
func NewPostgreSqlJsonDataStore ¶
func NewPostgreSqlJsonDataStore[T any](ctx context.Context, config *PostgreSqlConfig) *PostgreSqlJsonDataStore[T]
func (*PostgreSqlJsonDataStore[T]) Check ¶
func (m *PostgreSqlJsonDataStore[T]) Check(ctx context.Context) error
func (*PostgreSqlJsonDataStore[T]) Close ¶
func (m *PostgreSqlJsonDataStore[T]) Close(ctx context.Context) error
func (*PostgreSqlJsonDataStore[T]) Delete ¶
func (m *PostgreSqlJsonDataStore[T]) Delete(ctx context.Context, key string) error
func (*PostgreSqlJsonDataStore[T]) Get ¶
func (m *PostgreSqlJsonDataStore[T]) Get(ctx context.Context, key string) (*T, error)
func (*PostgreSqlJsonDataStore[T]) GetAll ¶
func (m *PostgreSqlJsonDataStore[T]) GetAll(ctx context.Context) ([]*T, error)
func (*PostgreSqlJsonDataStore[T]) NewConnectionContext ¶
func (m *PostgreSqlJsonDataStore[T]) NewConnectionContext(ctx context.Context) (context.Context, error)
For Transactions and long operations with the datastore consider Creating a new context with the connection stored as an attribute This will keep the connection from being returned to the pool If you do this you must explicitly end the connection.
TODO: Determine if this should be safe to call multiple times. If
so then we need a reference counter or something
func (*PostgreSqlJsonDataStore[T]) OnCreate ¶
func (m *PostgreSqlJsonDataStore[T]) OnCreate(fn func(ctx context.Context, ds datastore.JsonDataStore[T]) error)
func (*PostgreSqlJsonDataStore[T]) Open ¶
func (m *PostgreSqlJsonDataStore[T]) Open(ctx context.Context, config interface{}) error
func (*PostgreSqlJsonDataStore[T]) Query ¶
func (m *PostgreSqlJsonDataStore[T]) Query(ctx context.Context, query *datastore.SimpleQuery) ([]*T, error)
func (*PostgreSqlJsonDataStore[T]) ReturnConnectionContext ¶
func (m *PostgreSqlJsonDataStore[T]) ReturnConnectionContext(ctx context.Context)
type PostgreSqlJsonDataStoreFactory ¶ added in v0.0.9
type PostgreSqlJsonDataStoreFactory struct {
PostgreSqlConfig
}
func (*PostgreSqlJsonDataStoreFactory) Create ¶ added in v0.0.9
func (c *PostgreSqlJsonDataStoreFactory) Create(cfg interface{}) (datastore.UntypedJsonDataStore, error)
func (*PostgreSqlJsonDataStoreFactory) CreateJsonDatastore ¶ added in v0.0.9
func (c *PostgreSqlJsonDataStoreFactory) CreateJsonDatastore(ctx context.Context, typename string, prefix string, idField string) datastore.UntypedJsonDataStore
func (*PostgreSqlJsonDataStoreFactory) FromEnv ¶ added in v0.0.9
func (c *PostgreSqlJsonDataStoreFactory) FromEnv(env *cloudy.Environment) (interface{}, error)
type PostgresqlConnectionProvider ¶ added in v0.0.9
type UntypedPostgreSqlConfig ¶
type UntypedPostgreSqlConfig struct {
PostgreSqlConfig
}
type UntypedPostgreSqlJsonDataStore ¶
type UntypedPostgreSqlJsonDataStore struct { ConnectionKey pgContextKey // contains filtered or unexported fields }
func NewUntypedPostgreSqlJsonDataStore ¶
func NewUntypedPostgreSqlJsonDataStore(ctx context.Context, config *UntypedPostgreSqlConfig) *UntypedPostgreSqlJsonDataStore
func NewUntypedPostgreSqlJsonDataStoreWithProvider ¶ added in v0.0.9
func NewUntypedPostgreSqlJsonDataStoreWithProvider(ctx context.Context, table string, provider PostgresqlConnectionProvider) *UntypedPostgreSqlJsonDataStore
func (*UntypedPostgreSqlJsonDataStore) Close ¶
func (m *UntypedPostgreSqlJsonDataStore) Close(ctx context.Context) error
func (*UntypedPostgreSqlJsonDataStore) Delete ¶
func (m *UntypedPostgreSqlJsonDataStore) Delete(ctx context.Context, key string) error
func (*UntypedPostgreSqlJsonDataStore) GetAll ¶
func (m *UntypedPostgreSqlJsonDataStore) GetAll(ctx context.Context) ([][]byte, error)
func (*UntypedPostgreSqlJsonDataStore) NewConnectionContext ¶
func (m *UntypedPostgreSqlJsonDataStore) NewConnectionContext(ctx context.Context) (context.Context, error)
For Transactions and long operations with the datastore consider Creating a new context with the connection stored as an attribute This will keep the connection from being returned to the pool If you do this you must explicitly end the connection.
TODO: Determine if this should be safe to call multiple times. If
so then we need a reference counter or something
SAME
func (*UntypedPostgreSqlJsonDataStore) OnCreate ¶
func (m *UntypedPostgreSqlJsonDataStore) OnCreate(fn func(ctx context.Context, ds datastore.UntypedJsonDataStore) error)
func (*UntypedPostgreSqlJsonDataStore) Open ¶
func (m *UntypedPostgreSqlJsonDataStore) Open(ctx context.Context, config interface{}) error
SAME
func (*UntypedPostgreSqlJsonDataStore) Query ¶
func (m *UntypedPostgreSqlJsonDataStore) Query(ctx context.Context, query *datastore.SimpleQuery) ([][]byte, error)
func (*UntypedPostgreSqlJsonDataStore) ReturnConnectionContext ¶
func (m *UntypedPostgreSqlJsonDataStore) ReturnConnectionContext(ctx context.Context)
Click to show internal directories.
Click to hide internal directories.