postgres

package
v0.0.0-...-fe4519f Latest Latest
Warning

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

Go to latest
Published: Apr 7, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package postgres provides PostgreSQL implementation of the storage interface

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type PostgresStorage

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

PostgresStorage implements the storage.Storage interface using PostgreSQL

func New

func New(cfg *storage.Config) (*PostgresStorage, error)

New creates a new PostgreSQL storage instance

func (*PostgresStorage) BeginTx

BeginTx starts a new transaction

func (*PostgresStorage) Close

func (s *PostgresStorage) Close() error

Close closes the database connection pool

func (*PostgresStorage) CountCertificates

func (s *PostgresStorage) CountCertificates(ctx context.Context, certType string) (int, error)

func (*PostgresStorage) CountConnections

func (s *PostgresStorage) CountConnections(ctx context.Context) (int, error)

func (*PostgresStorage) CountUsers

func (s *PostgresStorage) CountUsers(ctx context.Context) (int, error)

func (*PostgresStorage) CreateCertificate

func (s *PostgresStorage) CreateCertificate(ctx context.Context, cert *storage.Certificate) error

Certificate operations

func (*PostgresStorage) CreateConnection

func (s *PostgresStorage) CreateConnection(ctx context.Context, conn *storage.Connection) error

Connection operations

func (*PostgresStorage) CreateUser

func (s *PostgresStorage) CreateUser(ctx context.Context, user *storage.User) error

User operations

func (*PostgresStorage) DeleteConnection

func (s *PostgresStorage) DeleteConnection(ctx context.Context, id string) error

func (*PostgresStorage) DeleteUser

func (s *PostgresStorage) DeleteUser(ctx context.Context, id string) error

func (*PostgresStorage) GetCertificate

func (s *PostgresStorage) GetCertificate(ctx context.Context, id string) (*storage.Certificate, error)

func (*PostgresStorage) GetCertificateBySerial

func (s *PostgresStorage) GetCertificateBySerial(ctx context.Context, serial string) (*storage.Certificate, error)

func (*PostgresStorage) GetConnection

func (s *PostgresStorage) GetConnection(ctx context.Context, id string) (*storage.Connection, error)

func (*PostgresStorage) GetUser

func (s *PostgresStorage) GetUser(ctx context.Context, id string) (*storage.User, error)

func (*PostgresStorage) GetUserByUsername

func (s *PostgresStorage) GetUserByUsername(ctx context.Context, username string) (*storage.User, error)

func (*PostgresStorage) ListCertificates

func (s *PostgresStorage) ListCertificates(ctx context.Context, certType string, offset, limit int) ([]*storage.Certificate, error)

func (*PostgresStorage) ListConnections

func (s *PostgresStorage) ListConnections(ctx context.Context, offset, limit int) ([]*storage.Connection, error)

func (*PostgresStorage) ListUsers

func (s *PostgresStorage) ListUsers(ctx context.Context, offset, limit int) ([]*storage.User, error)

func (*PostgresStorage) RevokeCertificate

func (s *PostgresStorage) RevokeCertificate(ctx context.Context, id, reason string) error

func (*PostgresStorage) UpdateCertificate

func (s *PostgresStorage) UpdateCertificate(ctx context.Context, cert *storage.Certificate) error

func (*PostgresStorage) UpdateConnection

func (s *PostgresStorage) UpdateConnection(ctx context.Context, conn *storage.Connection) error

func (*PostgresStorage) UpdateConnectionStats

func (s *PostgresStorage) UpdateConnectionStats(ctx context.Context, id string, bytesIn, bytesOut int64) error

func (*PostgresStorage) UpdateUser

func (s *PostgresStorage) UpdateUser(ctx context.Context, user *storage.User) error

type PostgresTransaction

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

PostgresTransaction implements the storage.Transaction interface

func (*PostgresTransaction) BeginTx

BeginTx starts a new nested transaction

func (*PostgresTransaction) Commit

func (t *PostgresTransaction) Commit() error

func (*PostgresTransaction) CountCertificates

func (t *PostgresTransaction) CountCertificates(ctx context.Context, certType string) (int, error)

CountCertificates returns the number of certificates of the specified type

func (*PostgresTransaction) CountConnections

func (t *PostgresTransaction) CountConnections(ctx context.Context) (int, error)

CountConnections returns the total number of connections

func (*PostgresTransaction) CountUsers

func (t *PostgresTransaction) CountUsers(ctx context.Context) (int, error)

CountUsers returns the total number of users

func (*PostgresTransaction) CreateCertificate

func (t *PostgresTransaction) CreateCertificate(ctx context.Context, cert *storage.Certificate) error

CreateCertificate creates a new certificate

func (*PostgresTransaction) CreateConnection

func (t *PostgresTransaction) CreateConnection(ctx context.Context, conn *storage.Connection) error

CreateConnection creates a new connection

func (*PostgresTransaction) CreateUser

func (t *PostgresTransaction) CreateUser(ctx context.Context, user *storage.User) error

CreateUser creates a new user

func (*PostgresTransaction) DeleteConnection

func (t *PostgresTransaction) DeleteConnection(ctx context.Context, id string) error

DeleteConnection deletes a connection by ID

func (*PostgresTransaction) DeleteUser

func (t *PostgresTransaction) DeleteUser(ctx context.Context, id string) error

DeleteUser deletes a user by ID

func (*PostgresTransaction) GetCertificate

func (t *PostgresTransaction) GetCertificate(ctx context.Context, id string) (*storage.Certificate, error)

GetCertificate retrieves a certificate by ID

func (*PostgresTransaction) GetCertificateBySerial

func (t *PostgresTransaction) GetCertificateBySerial(ctx context.Context, serial string) (*storage.Certificate, error)

GetCertificateBySerial retrieves a certificate by serial number

func (*PostgresTransaction) GetConnection

func (t *PostgresTransaction) GetConnection(ctx context.Context, id string) (*storage.Connection, error)

GetConnection retrieves a connection by ID

func (*PostgresTransaction) GetUser

func (t *PostgresTransaction) GetUser(ctx context.Context, id string) (*storage.User, error)

GetUser retrieves a user by ID

func (*PostgresTransaction) GetUserByUsername

func (t *PostgresTransaction) GetUserByUsername(ctx context.Context, username string) (*storage.User, error)

GetUserByUsername retrieves a user by username

func (*PostgresTransaction) ListCertificates

func (t *PostgresTransaction) ListCertificates(ctx context.Context, certType string, offset, limit int) ([]*storage.Certificate, error)

ListCertificates retrieves a list of certificates with pagination

func (*PostgresTransaction) ListConnections

func (t *PostgresTransaction) ListConnections(ctx context.Context, offset, limit int) ([]*storage.Connection, error)

ListConnections retrieves a list of connections with pagination

func (*PostgresTransaction) ListUsers

func (t *PostgresTransaction) ListUsers(ctx context.Context, offset, limit int) ([]*storage.User, error)

ListUsers retrieves a list of users with pagination

func (*PostgresTransaction) RevokeCertificate

func (t *PostgresTransaction) RevokeCertificate(ctx context.Context, id, reason string) error

RevokeCertificate revokes a certificate

func (*PostgresTransaction) Rollback

func (t *PostgresTransaction) Rollback() error

func (*PostgresTransaction) UpdateCertificate

func (t *PostgresTransaction) UpdateCertificate(ctx context.Context, cert *storage.Certificate) error

UpdateCertificate updates an existing certificate

func (*PostgresTransaction) UpdateConnection

func (t *PostgresTransaction) UpdateConnection(ctx context.Context, conn *storage.Connection) error

UpdateConnection updates an existing connection

func (*PostgresTransaction) UpdateConnectionStats

func (t *PostgresTransaction) UpdateConnectionStats(ctx context.Context, id string, bytesIn, bytesOut int64) error

UpdateConnectionStats updates connection statistics

func (*PostgresTransaction) UpdateUser

func (t *PostgresTransaction) UpdateUser(ctx context.Context, user *storage.User) error

UpdateUser updates an existing user

Jump to

Keyboard shortcuts

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