Documentation
¶
Index ¶
- Variables
- func ErrorIsRetryable(err error) bool
- func PgErrCode(err error) string
- func ReturnFromReadWriteTx[T any](ctx context.Context, db *DB, b backoff.BackOff, ...) (T, error)
- func ReturnFromTx[T any](ctx context.Context, db *DB, txoptions pgx.TxOptions, ...) (T, error)
- type ConfigOverrides
- type ConnUri
- type DB
- func ConnectToResource(ctx context.Context, res *resources.Parsed, resourceRef string, ...) (*DB, error)
- func NewDatabaseFromConnectionUri(ctx context.Context, db *postgrespb.DatabaseInstance, connuri string, ...) (*DB, error)
- func NewDatabaseFromConnectionUriWithOverrides(ctx context.Context, db *postgrespb.DatabaseInstance, connuri string, ...) (*DB, error)
- func ProvideDatabase(ctx context.Context, db *DatabaseArgs, deps ExtensionDeps) (*DB, error)
- func (db DB) Close() error
- func (db DB) Exec(ctx context.Context, sql string, arguments ...interface{}) (pgconn.CommandTag, error)
- func (db DB) PgxPool() *pgxpool.Pool
- func (db DB) Query(ctx context.Context, sql string, args ...interface{}) (pgx.Rows, error)
- func (db DB) QueryRow(ctx context.Context, sql string, args ...interface{}) pgx.Row
- func (db DB) SendBatch(ctx context.Context, b *pgx.Batch) pgx.BatchResults
- type Database
- func (*Database) Descriptor() ([]byte, []int)deprecated
- func (x *Database) GetCredentials() *Database_Credentials
- func (x *Database) GetHostedAt() *Database_Endpoint
- func (x *Database) GetName() string
- func (x *Database) GetSchemaFile() *types.Resource
- func (*Database) ProtoMessage()
- func (x *Database) ProtoReflect() protoreflect.Message
- func (x *Database) Reset()
- func (x *Database) String() string
- type DatabaseArgs
- func (*DatabaseArgs) Descriptor() ([]byte, []int)deprecated
- func (x *DatabaseArgs) GetMaxConns() int32
- func (x *DatabaseArgs) GetResourceRef() string
- func (*DatabaseArgs) ProtoMessage()
- func (x *DatabaseArgs) ProtoReflect() protoreflect.Message
- func (x *DatabaseArgs) Reset()
- func (x *DatabaseArgs) String() string
- type DatabaseReferenceArgs
- func (*DatabaseReferenceArgs) Descriptor() ([]byte, []int)deprecated
- func (x *DatabaseReferenceArgs) GetClusterRef() string
- func (x *DatabaseReferenceArgs) GetDatabase() string
- func (*DatabaseReferenceArgs) ProtoMessage()
- func (x *DatabaseReferenceArgs) ProtoReflect() protoreflect.Message
- func (x *DatabaseReferenceArgs) Reset()
- func (x *DatabaseReferenceArgs) String() string
- type Database_Credentials
- func (*Database_Credentials) Descriptor() ([]byte, []int)deprecated
- func (x *Database_Credentials) GetPassword() *Database_Credentials_Secret
- func (x *Database_Credentials) GetUser() *Database_Credentials_Secret
- func (*Database_Credentials) ProtoMessage()
- func (x *Database_Credentials) ProtoReflect() protoreflect.Message
- func (x *Database_Credentials) Reset()
- func (x *Database_Credentials) String() string
- type Database_Credentials_Secret
- func (*Database_Credentials_Secret) Descriptor() ([]byte, []int)deprecated
- func (x *Database_Credentials_Secret) GetFromPath() string
- func (x *Database_Credentials_Secret) GetValue() string
- func (*Database_Credentials_Secret) ProtoMessage()
- func (x *Database_Credentials_Secret) ProtoReflect() protoreflect.Message
- func (x *Database_Credentials_Secret) Reset()
- func (x *Database_Credentials_Secret) String() string
- type Database_Endpoint
- func (*Database_Endpoint) Descriptor() ([]byte, []int)deprecated
- func (x *Database_Endpoint) GetAddress() string
- func (x *Database_Endpoint) GetPort() uint32
- func (*Database_Endpoint) ProtoMessage()
- func (x *Database_Endpoint) ProtoReflect() protoreflect.Message
- func (x *Database_Endpoint) Reset()
- func (x *Database_Endpoint) String() string
- type ExtensionDeps
- type Factory
- type FactoryArgs
- type InstantiatedDatabase
- func (*InstantiatedDatabase) Descriptor() ([]byte, []int)deprecated
- func (x *InstantiatedDatabase) GetCredentials() *InstantiatedDatabase_Credentials
- func (x *InstantiatedDatabase) GetDatabase() []*Database
- func (x *InstantiatedDatabase) GetPackageName() string
- func (*InstantiatedDatabase) ProtoMessage()
- func (x *InstantiatedDatabase) ProtoReflect() protoreflect.Message
- func (x *InstantiatedDatabase) Reset()
- func (x *InstantiatedDatabase) String() string
- type InstantiatedDatabase_Credentials
- func (*InstantiatedDatabase_Credentials) Descriptor() ([]byte, []int)deprecated
- func (x *InstantiatedDatabase_Credentials) GetSecretMountPath() string
- func (x *InstantiatedDatabase_Credentials) GetSecretName() string
- func (x *InstantiatedDatabase_Credentials) GetSecretResourceName() string
- func (*InstantiatedDatabase_Credentials) ProtoMessage()
- func (x *InstantiatedDatabase_Credentials) ProtoReflect() protoreflect.Message
- func (x *InstantiatedDatabase_Credentials) Reset()
- func (x *InstantiatedDatabase_Credentials) String() string
- type InstantiatedDatabases
- func (*InstantiatedDatabases) Descriptor() ([]byte, []int)deprecated
- func (x *InstantiatedDatabases) GetInstantiated() []*InstantiatedDatabase
- func (*InstantiatedDatabases) ProtoMessage()
- func (x *InstantiatedDatabases) ProtoReflect() protoreflect.Message
- func (x *InstantiatedDatabases) Reset()
- func (x *InstantiatedDatabases) String() string
- type TransactionError
Constants ¶
This section is empty.
Variables ¶
var ( Package__sfr1nt = &core.Package{ PackageName: "namespacelabs.dev/foundation/universe/db/postgres", PackageDependencies: []string{"namespacelabs.dev/foundation/std/monitoring/tracing"}, } Provider__sfr1nt = core.Provider{ Package: Package__sfr1nt, Instantiate: makeDeps__sfr1nt, } )
var File_universe_db_postgres_database_proto protoreflect.FileDescriptor
var File_universe_db_postgres_provider_proto protoreflect.FileDescriptor
Functions ¶
func ErrorIsRetryable ¶ added in v0.0.255
func PgErrCode ¶ added in v0.0.355
Returns the error code (to be compared to pgerrcode.* constants).
func ReturnFromReadWriteTx ¶ added in v0.0.180
Types ¶
type ConfigOverrides ¶ added in v0.0.349
type ConnUri ¶ added in v0.0.355
type ConnUri string
Workaround the fact that foundation doesn't know about primitive types.
func ProvideDatabaseReference ¶ added in v0.0.355
func ProvideDatabaseReference(ctx context.Context, args *DatabaseReferenceArgs, deps ExtensionDeps) (ConnUri, error)
type DB ¶
type DB struct {
// contains filtered or unexported fields
}
func ConnectToResource ¶ added in v0.0.114
func ConnectToResource(ctx context.Context, res *resources.Parsed, resourceRef string, tp trace.TracerProvider, overrides *ConfigOverrides) (*DB, error)
Connect to a Postgres Database resource.
func NewDatabaseFromConnectionUri ¶ added in v0.0.336
func NewDatabaseFromConnectionUri(ctx context.Context, db *postgrespb.DatabaseInstance, connuri string, tp trace.TracerProvider) (*DB, error)
func NewDatabaseFromConnectionUriWithOverrides ¶ added in v0.0.349
func NewDatabaseFromConnectionUriWithOverrides(ctx context.Context, db *postgrespb.DatabaseInstance, connuri string, tp trace.TracerProvider, overrides *ConfigOverrides) (*DB, error)
func ProvideDatabase ¶ added in v0.0.115
func ProvideDatabase(ctx context.Context, db *DatabaseArgs, deps ExtensionDeps) (*DB, error)
type Database ¶
type Database struct { Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` SchemaFile *types.Resource `protobuf:"bytes,2,opt,name=schema_file,json=schemaFile,proto3" json:"schema_file,omitempty"` HostedAt *Database_Endpoint `protobuf:"bytes,3,opt,name=hosted_at,json=hostedAt,proto3" json:"hosted_at,omitempty"` Credentials *Database_Credentials `protobuf:"bytes,4,opt,name=credentials,proto3" json:"credentials,omitempty"` // contains filtered or unexported fields }
func (*Database) Descriptor
deprecated
func (*Database) GetCredentials ¶
func (x *Database) GetCredentials() *Database_Credentials
func (*Database) GetHostedAt ¶
func (x *Database) GetHostedAt() *Database_Endpoint
func (*Database) GetSchemaFile ¶
func (*Database) ProtoMessage ¶
func (*Database) ProtoMessage()
func (*Database) ProtoReflect ¶
func (x *Database) ProtoReflect() protoreflect.Message
type DatabaseArgs ¶ added in v0.0.115
type DatabaseArgs struct { ResourceRef string `protobuf:"bytes,3,opt,name=resource_ref,json=resourceRef,proto3" json:"resource_ref,omitempty"` MaxConns int32 `protobuf:"varint,4,opt,name=max_conns,json=maxConns,proto3" json:"max_conns,omitempty"` // Set if > 0. // contains filtered or unexported fields }
func (*DatabaseArgs) Descriptor
deprecated
added in
v0.0.115
func (*DatabaseArgs) Descriptor() ([]byte, []int)
Deprecated: Use DatabaseArgs.ProtoReflect.Descriptor instead.
func (*DatabaseArgs) GetMaxConns ¶ added in v0.0.349
func (x *DatabaseArgs) GetMaxConns() int32
func (*DatabaseArgs) GetResourceRef ¶ added in v0.0.115
func (x *DatabaseArgs) GetResourceRef() string
func (*DatabaseArgs) ProtoMessage ¶ added in v0.0.115
func (*DatabaseArgs) ProtoMessage()
func (*DatabaseArgs) ProtoReflect ¶ added in v0.0.115
func (x *DatabaseArgs) ProtoReflect() protoreflect.Message
func (*DatabaseArgs) Reset ¶ added in v0.0.115
func (x *DatabaseArgs) Reset()
func (*DatabaseArgs) String ¶ added in v0.0.115
func (x *DatabaseArgs) String() string
type DatabaseReferenceArgs ¶ added in v0.0.355
type DatabaseReferenceArgs struct { ClusterRef string `protobuf:"bytes,1,opt,name=cluster_ref,json=clusterRef,proto3" json:"cluster_ref,omitempty"` Database string `protobuf:"bytes,2,opt,name=database,proto3" json:"database,omitempty"` // contains filtered or unexported fields }
func (*DatabaseReferenceArgs) Descriptor
deprecated
added in
v0.0.355
func (*DatabaseReferenceArgs) Descriptor() ([]byte, []int)
Deprecated: Use DatabaseReferenceArgs.ProtoReflect.Descriptor instead.
func (*DatabaseReferenceArgs) GetClusterRef ¶ added in v0.0.355
func (x *DatabaseReferenceArgs) GetClusterRef() string
func (*DatabaseReferenceArgs) GetDatabase ¶ added in v0.0.355
func (x *DatabaseReferenceArgs) GetDatabase() string
func (*DatabaseReferenceArgs) ProtoMessage ¶ added in v0.0.355
func (*DatabaseReferenceArgs) ProtoMessage()
func (*DatabaseReferenceArgs) ProtoReflect ¶ added in v0.0.355
func (x *DatabaseReferenceArgs) ProtoReflect() protoreflect.Message
func (*DatabaseReferenceArgs) Reset ¶ added in v0.0.355
func (x *DatabaseReferenceArgs) Reset()
func (*DatabaseReferenceArgs) String ¶ added in v0.0.355
func (x *DatabaseReferenceArgs) String() string
type Database_Credentials ¶
type Database_Credentials struct { User *Database_Credentials_Secret `protobuf:"bytes,1,opt,name=user,proto3" json:"user,omitempty"` Password *Database_Credentials_Secret `protobuf:"bytes,2,opt,name=password,proto3" json:"password,omitempty"` // contains filtered or unexported fields }
func (*Database_Credentials) Descriptor
deprecated
func (*Database_Credentials) Descriptor() ([]byte, []int)
Deprecated: Use Database_Credentials.ProtoReflect.Descriptor instead.
func (*Database_Credentials) GetPassword ¶
func (x *Database_Credentials) GetPassword() *Database_Credentials_Secret
func (*Database_Credentials) GetUser ¶
func (x *Database_Credentials) GetUser() *Database_Credentials_Secret
func (*Database_Credentials) ProtoMessage ¶
func (*Database_Credentials) ProtoMessage()
func (*Database_Credentials) ProtoReflect ¶
func (x *Database_Credentials) ProtoReflect() protoreflect.Message
func (*Database_Credentials) Reset ¶
func (x *Database_Credentials) Reset()
func (*Database_Credentials) String ¶
func (x *Database_Credentials) String() string
type Database_Credentials_Secret ¶
type Database_Credentials_Secret struct { // Only set one of these fields. Value string `protobuf:"bytes,1,opt,name=value,proto3" json:"value,omitempty"` FromPath string `protobuf:"bytes,2,opt,name=from_path,json=fromPath,proto3" json:"from_path,omitempty"` // contains filtered or unexported fields }
func (*Database_Credentials_Secret) Descriptor
deprecated
func (*Database_Credentials_Secret) Descriptor() ([]byte, []int)
Deprecated: Use Database_Credentials_Secret.ProtoReflect.Descriptor instead.
func (*Database_Credentials_Secret) GetFromPath ¶
func (x *Database_Credentials_Secret) GetFromPath() string
func (*Database_Credentials_Secret) GetValue ¶
func (x *Database_Credentials_Secret) GetValue() string
func (*Database_Credentials_Secret) ProtoMessage ¶
func (*Database_Credentials_Secret) ProtoMessage()
func (*Database_Credentials_Secret) ProtoReflect ¶
func (x *Database_Credentials_Secret) ProtoReflect() protoreflect.Message
func (*Database_Credentials_Secret) Reset ¶
func (x *Database_Credentials_Secret) Reset()
func (*Database_Credentials_Secret) String ¶
func (x *Database_Credentials_Secret) String() string
type Database_Endpoint ¶
type Database_Endpoint struct { Address string `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"` Port uint32 `protobuf:"varint,2,opt,name=port,proto3" json:"port,omitempty"` // contains filtered or unexported fields }
func (*Database_Endpoint) Descriptor
deprecated
func (*Database_Endpoint) Descriptor() ([]byte, []int)
Deprecated: Use Database_Endpoint.ProtoReflect.Descriptor instead.
func (*Database_Endpoint) GetAddress ¶
func (x *Database_Endpoint) GetAddress() string
func (*Database_Endpoint) GetPort ¶
func (x *Database_Endpoint) GetPort() uint32
func (*Database_Endpoint) ProtoMessage ¶
func (*Database_Endpoint) ProtoMessage()
func (*Database_Endpoint) ProtoReflect ¶
func (x *Database_Endpoint) ProtoReflect() protoreflect.Message
func (*Database_Endpoint) Reset ¶
func (x *Database_Endpoint) Reset()
func (*Database_Endpoint) String ¶
func (x *Database_Endpoint) String() string
type ExtensionDeps ¶ added in v0.0.115
type ExtensionDeps struct {
OpenTelemetry tracing.DeferredTracerProvider
}
Dependencies that are instantiated once for the lifetime of the extension.
type Factory ¶ added in v0.0.291
type Factory struct {
// contains filtered or unexported fields
}
func ProvideFactory ¶ added in v0.0.291
func ProvideFactory(ctx context.Context, _ *FactoryArgs, deps ExtensionDeps) (Factory, error)
type FactoryArgs ¶ added in v0.0.291
type FactoryArgs struct {
// contains filtered or unexported fields
}
func (*FactoryArgs) Descriptor
deprecated
added in
v0.0.291
func (*FactoryArgs) Descriptor() ([]byte, []int)
Deprecated: Use FactoryArgs.ProtoReflect.Descriptor instead.
func (*FactoryArgs) ProtoMessage ¶ added in v0.0.291
func (*FactoryArgs) ProtoMessage()
func (*FactoryArgs) ProtoReflect ¶ added in v0.0.291
func (x *FactoryArgs) ProtoReflect() protoreflect.Message
func (*FactoryArgs) Reset ¶ added in v0.0.291
func (x *FactoryArgs) Reset()
func (*FactoryArgs) String ¶ added in v0.0.291
func (x *FactoryArgs) String() string
type InstantiatedDatabase ¶
type InstantiatedDatabase struct { PackageName string `protobuf:"bytes,1,opt,name=package_name,json=packageName,proto3" json:"package_name,omitempty"` Credentials *InstantiatedDatabase_Credentials `protobuf:"bytes,2,opt,name=credentials,proto3" json:"credentials,omitempty"` Database []*Database `protobuf:"bytes,3,rep,name=database,proto3" json:"database,omitempty"` // contains filtered or unexported fields }
This type represents a fully formed database. This is an internal type, used for internal configuration.
func (*InstantiatedDatabase) Descriptor
deprecated
func (*InstantiatedDatabase) Descriptor() ([]byte, []int)
Deprecated: Use InstantiatedDatabase.ProtoReflect.Descriptor instead.
func (*InstantiatedDatabase) GetCredentials ¶
func (x *InstantiatedDatabase) GetCredentials() *InstantiatedDatabase_Credentials
func (*InstantiatedDatabase) GetDatabase ¶
func (x *InstantiatedDatabase) GetDatabase() []*Database
func (*InstantiatedDatabase) GetPackageName ¶
func (x *InstantiatedDatabase) GetPackageName() string
func (*InstantiatedDatabase) ProtoMessage ¶
func (*InstantiatedDatabase) ProtoMessage()
func (*InstantiatedDatabase) ProtoReflect ¶
func (x *InstantiatedDatabase) ProtoReflect() protoreflect.Message
func (*InstantiatedDatabase) Reset ¶
func (x *InstantiatedDatabase) Reset()
func (*InstantiatedDatabase) String ¶
func (x *InstantiatedDatabase) String() string
type InstantiatedDatabase_Credentials ¶
type InstantiatedDatabase_Credentials struct { SecretName string `protobuf:"bytes,1,opt,name=secret_name,json=secretName,proto3" json:"secret_name,omitempty"` SecretMountPath string `protobuf:"bytes,2,opt,name=secret_mount_path,json=secretMountPath,proto3" json:"secret_mount_path,omitempty"` SecretResourceName string `protobuf:"bytes,3,opt,name=secret_resource_name,json=secretResourceName,proto3" json:"secret_resource_name,omitempty"` // contains filtered or unexported fields }
func (*InstantiatedDatabase_Credentials) Descriptor
deprecated
func (*InstantiatedDatabase_Credentials) Descriptor() ([]byte, []int)
Deprecated: Use InstantiatedDatabase_Credentials.ProtoReflect.Descriptor instead.
func (*InstantiatedDatabase_Credentials) GetSecretMountPath ¶
func (x *InstantiatedDatabase_Credentials) GetSecretMountPath() string
func (*InstantiatedDatabase_Credentials) GetSecretName ¶
func (x *InstantiatedDatabase_Credentials) GetSecretName() string
func (*InstantiatedDatabase_Credentials) GetSecretResourceName ¶
func (x *InstantiatedDatabase_Credentials) GetSecretResourceName() string
func (*InstantiatedDatabase_Credentials) ProtoMessage ¶
func (*InstantiatedDatabase_Credentials) ProtoMessage()
func (*InstantiatedDatabase_Credentials) ProtoReflect ¶
func (x *InstantiatedDatabase_Credentials) ProtoReflect() protoreflect.Message
func (*InstantiatedDatabase_Credentials) Reset ¶
func (x *InstantiatedDatabase_Credentials) Reset()
func (*InstantiatedDatabase_Credentials) String ¶
func (x *InstantiatedDatabase_Credentials) String() string
type InstantiatedDatabases ¶
type InstantiatedDatabases struct { Instantiated []*InstantiatedDatabase `protobuf:"bytes,1,rep,name=instantiated,proto3" json:"instantiated,omitempty"` // contains filtered or unexported fields }
func (*InstantiatedDatabases) Descriptor
deprecated
func (*InstantiatedDatabases) Descriptor() ([]byte, []int)
Deprecated: Use InstantiatedDatabases.ProtoReflect.Descriptor instead.
func (*InstantiatedDatabases) GetInstantiated ¶
func (x *InstantiatedDatabases) GetInstantiated() []*InstantiatedDatabase
func (*InstantiatedDatabases) ProtoMessage ¶
func (*InstantiatedDatabases) ProtoMessage()
func (*InstantiatedDatabases) ProtoReflect ¶
func (x *InstantiatedDatabases) ProtoReflect() protoreflect.Message
func (*InstantiatedDatabases) Reset ¶
func (x *InstantiatedDatabases) Reset()
func (*InstantiatedDatabases) String ¶
func (x *InstantiatedDatabases) String() string
type TransactionError ¶ added in v0.0.182
type TransactionError struct {
InternalErr error
}
func (TransactionError) Error ¶ added in v0.0.182
func (p TransactionError) Error() string
func (TransactionError) Unwrap ¶ added in v0.0.182
func (p TransactionError) Unwrap() error