Documentation
¶
Index ¶
- Variables
- func ErrorIsRetryable(err error) bool
- 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 DB
- func ConnectToResource(ctx context.Context, res *resources.Parsed, resourceRef string, ...) (*DB, error)
- func NewDB(instance *postgrespb.DatabaseInstance, conn *pgxpool.Pool, o NewDBOptions) *DB
- func ProvideDatabase(ctx context.Context, db *DatabaseArgs, deps ExtensionDeps) (*DB, error)
- func ProvideDatabaseFromResourceRef(ctx context.Context, ref string, opts NewDBOptions) (*DB, error)
- func (db DB) BeginTxFunc(ctx context.Context, txOptions pgx.TxOptions, callback func(pgx.Tx) error) error
- func (db DB) Exec(ctx context.Context, sql string, arguments ...interface{}) (pgconn.CommandTag, error)
- func (db DB) Query(ctx context.Context, sql string, args ...interface{}) (pgx.Rows, error)
- func (db DB) QueryFunc(ctx context.Context, sql string, args []interface{}, scans []interface{}, ...) (pgconn.CommandTag, 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
- func (db DB) Tracer() trace.Tracer
- 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
- 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 NewDBOptions
- type TransactionError
Constants ¶
This section is empty.
Variables ¶
var ( Package__sfr1nt = &core.Package{ PackageName: "namespacelabs.dev/foundation/universe/db/postgres", } 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 ReturnFromReadWriteTx ¶ added in v0.0.180
Types ¶
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, opts NewDBOptions) (*DB, error)
Connect to a Postgres Database resource.
func NewDB ¶
func NewDB(instance *postgrespb.DatabaseInstance, conn *pgxpool.Pool, o NewDBOptions) *DB
func ProvideDatabase ¶ added in v0.0.115
func ProvideDatabase(ctx context.Context, db *DatabaseArgs, deps ExtensionDeps) (*DB, error)
func ProvideDatabaseFromResourceRef ¶ added in v0.0.291
func (DB) BeginTxFunc ¶
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"` // 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) 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 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 NewDBOptions ¶ added in v0.0.291
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