postgres

package
v0.0.246 Latest Latest
Warning

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

Go to latest
Published: Jun 15, 2023 License: Apache-2.0 Imports: 26 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	Package__sfr1nt = &core.Package{
		PackageName: "namespacelabs.dev/foundation/universe/db/postgres",
	}

	Provider__sfr1nt = core.Provider{
		Package:     Package__sfr1nt,
		Instantiate: makeDeps__sfr1nt,
	}
)
View Source
var File_universe_db_postgres_database_proto protoreflect.FileDescriptor
View Source
var File_universe_db_postgres_provider_proto protoreflect.FileDescriptor

Functions

func ReturnFromReadWriteTx added in v0.0.180

func ReturnFromReadWriteTx[T any](ctx context.Context, db *DB, b backoff.BackOff, f func(context.Context, pgx.Tx) (T, error)) (T, error)

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, tracer trace.Tracer) (*DB, error)

Connect to a Postgres Database resource.

func NewDB

func NewDB(instance *postgrespb.DatabaseInstance, conn *pgxpool.Pool, tracer trace.Tracer) *DB

func ProvideDatabase added in v0.0.115

func ProvideDatabase(ctx context.Context, db *DatabaseArgs, deps ExtensionDeps) (*DB, error)

func (DB) BeginTxFunc

func (db DB) BeginTxFunc(ctx context.Context, txOptions pgx.TxOptions, callback func(pgx.Tx) error) error

func (DB) Exec

func (db DB) Exec(ctx context.Context, sql string, arguments ...interface{}) (pgconn.CommandTag, error)

func (DB) Query

func (db DB) Query(ctx context.Context, sql string, arguments ...interface{}) (pgx.Rows, error)

func (DB) QueryFunc

func (db DB) QueryFunc(ctx context.Context, sql string, args []interface{}, scans []interface{}, f func(pgx.QueryFuncRow) error) (pgconn.CommandTag, error)

func (DB) QueryRow

func (db DB) QueryRow(ctx context.Context, sql string, args ...interface{}) pgx.Row

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) Descriptor() ([]byte, []int)

Deprecated: Use Database.ProtoReflect.Descriptor instead.

func (*Database) GetCredentials

func (x *Database) GetCredentials() *Database_Credentials

func (*Database) GetHostedAt

func (x *Database) GetHostedAt() *Database_Endpoint

func (*Database) GetName

func (x *Database) GetName() string

func (*Database) GetSchemaFile

func (x *Database) GetSchemaFile() *types.Resource

func (*Database) ProtoMessage

func (*Database) ProtoMessage()

func (*Database) ProtoReflect

func (x *Database) ProtoReflect() protoreflect.Message

func (*Database) Reset

func (x *Database) Reset()

func (*Database) String

func (x *Database) String() string

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 (*Database_Credentials) GetUser

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 (*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 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 (*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 (*InstantiatedDatabase_Credentials) Reset

func (*InstantiatedDatabase_Credentials) 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

Jump to

Keyboard shortcuts

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