postgres

package
v0.0.0-...-187538d Latest Latest
Warning

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

Go to latest
Published: Mar 13, 2024 License: Apache-2.0 Imports: 22 Imported by: 0

Documentation

Overview

Package postgres provides the PostgresSQL storage implementation.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Account

type Account struct {
	AccountID int64     `gorm:"primaryKey"`
	CreatedAt time.Time `gorm:"default:CURRENT_TIMESTAMP"`
	UpdatedAt time.Time `gorm:"default:CURRENT_TIMESTAMP"`
	Status    int16     `gorm:"default:1"`
	Email     string    `gorm:"unique"`
}

Account is the model for the account table.

type GooseLogger

type GooseLogger struct {
	// contains filtered or unexported fields
}

GooseLogger is a logger for goose.

func (*GooseLogger) Fatalf

func (l *GooseLogger) Fatalf(format string, v ...any)

Fatalf logs a fatal error.

func (*GooseLogger) Printf

func (l *GooseLogger) Printf(format string, v ...any)

Printf logs a message.

type PostgresCentralStorage

type PostgresCentralStorage struct {
	// contains filtered or unexported fields
}

PostgresCentralStorage implements the postgres central storage.

func (PostgresCentralStorage) GetAAPCentralStorage

func (s PostgresCentralStorage) GetAAPCentralStorage() (azstorage.AAPCentralStorage, error)

GetAAPCentralStorage returns the AAP central storage.

type PostgresCentralStorageAAP

type PostgresCentralStorageAAP struct {
	// contains filtered or unexported fields
}

PostgresCentralStorageAAP implements the postgres central storage.

func (PostgresCentralStorageAAP) CreateAccount

func (s PostgresCentralStorageAAP) CreateAccount(email string) (*azmodels.Account, error)

CreateAccount creates a new account.

func (PostgresCentralStorageAAP) DeleteAccount

func (s PostgresCentralStorageAAP) DeleteAccount(accountID int64) (*azmodels.Account, error)

DeleteAccount deletes an account.

func (PostgresCentralStorageAAP) GetAllAccounts

func (s PostgresCentralStorageAAP) GetAllAccounts() ([]azmodels.Account, error)

GetAllAccounts returns all accounts.

type PostgresConnection

type PostgresConnection struct {
	// contains filtered or unexported fields
}

PostgresConnection holds the configuration for the server.

func (*PostgresConnection) Connect

func (c *PostgresConnection) Connect(logger *zap.Logger, ctx context.Context) (*gorm.DB, error)

Connect connects to postgres and return a client.

func (*PostgresConnection) Disconnect

func (c *PostgresConnection) Disconnect(logger *zap.Logger, ctx context.Context) error

Disconnect disconnects from postgres.

func (*PostgresConnection) GetStorage

func (c *PostgresConnection) GetStorage() azstorage.StorageKind

GetStorage returns the storage kind.

type PostgresConnectionConfig

type PostgresConnectionConfig struct {
	// contains filtered or unexported fields
}

PostgresConnectionConfig holds the configuration for the server.

func (*PostgresConnectionConfig) AddFlags

func (c *PostgresConnectionConfig) AddFlags(flagSet *flag.FlagSet) error

AddFlags adds flags.

func (*PostgresConnectionConfig) GetConnectionString

func (c *PostgresConnectionConfig) GetConnectionString() (string, error)

GetConnectionString returns the connection string.

func (*PostgresConnectionConfig) GetDatabase

func (c *PostgresConnectionConfig) GetDatabase() string

GetDatabase returns the database.

func (*PostgresConnectionConfig) GetHost

func (c *PostgresConnectionConfig) GetHost() string

GetHost returns the host.

func (*PostgresConnectionConfig) GetPassword

func (c *PostgresConnectionConfig) GetPassword() string

GetPassword returns the password.

func (*PostgresConnectionConfig) GetPort

func (c *PostgresConnectionConfig) GetPort() int

GetPort returns the port.

func (*PostgresConnectionConfig) GetSSLMode

func (c *PostgresConnectionConfig) GetSSLMode() string

GetSSLMode returns the ssl mode.

func (*PostgresConnectionConfig) GetStorage

GetStorage returns the storage kind.

func (*PostgresConnectionConfig) GetUsername

func (c *PostgresConnectionConfig) GetUsername() string

GetUsername returns the username.

func (*PostgresConnectionConfig) InitFromViper

func (c *PostgresConnectionConfig) InitFromViper(v *viper.Viper) error

InitFromViper initializes the configuration from viper.

type PostgresStorageFactory

type PostgresStorageFactory struct {
	// contains filtered or unexported fields
}

PostgresStorageFactory holds the configuration for the server factory.

func NewPostgresStorageFactory

func NewPostgresStorageFactory(storageFctyCfg *PostgresStorageFactoryConfig) (*PostgresStorageFactory, error)

NewPostgresStorageFactory creates a new server factory configuration.

func (*PostgresStorageFactory) CreateCentralStorage

func (f *PostgresStorageFactory) CreateCentralStorage(storageContext *azstorage.StorageContext) (azstorage.CentralStorage, error)

CreateCentralStorage returns the central storage.

func (*PostgresStorageFactory) CreateProximityStorage

func (f *PostgresStorageFactory) CreateProximityStorage(storageContext *azstorage.StorageContext) (azstorage.ProximityStorage, error)

CreateProximityStorage returns the proximity storage.

type PostgresStorageFactoryConfig

type PostgresStorageFactoryConfig struct {
	// contains filtered or unexported fields
}

PostgresStorageFactoryConfig holds the configuration for the server factory.

func NewPostgresStorageFactoryConfig

func NewPostgresStorageFactoryConfig() (*PostgresStorageFactoryConfig, error)

NewPostgresStorageFactoryConfig creates a new server factory configuration.

func (*PostgresStorageFactoryConfig) AddFlags

func (c *PostgresStorageFactoryConfig) AddFlags(flagSet *flag.FlagSet) error

AddFlags adds flags.

func (*PostgresStorageFactoryConfig) InitFromViper

func (c *PostgresStorageFactoryConfig) InitFromViper(v *viper.Viper) error

InitFromViper initializes the configuration from viper.

type PostgresStorageProvisioner

type PostgresStorageProvisioner struct {
	// contains filtered or unexported fields
}

PostgresStorageProvisioner is the storage provisioner for Postgres.

func NewPostgresStorageProvisioner

func NewPostgresStorageProvisioner() (*PostgresStorageProvisioner, error)

NewPostgresStorageProvisioner creates a new PostgresStorageProvisioner.

func (*PostgresStorageProvisioner) AddFlags

func (p *PostgresStorageProvisioner) AddFlags(flagSet *flag.FlagSet) error

AddFlags adds flags.

func (*PostgresStorageProvisioner) Down

Down deprovisions the database.

func (*PostgresStorageProvisioner) InitFromViper

func (p *PostgresStorageProvisioner) InitFromViper(v *viper.Viper) error

InitFromViper initializes the configuration from viper.

func (*PostgresStorageProvisioner) Up

Up provisions the database.

Jump to

Keyboard shortcuts

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