Documentation
¶
Overview ¶
Package postgres provides PostgreSQL implementation of the storage interface
Index ¶
- type PostgresStorage
- func (s *PostgresStorage) BeginTx(ctx context.Context) (storage.Transaction, error)
- func (s *PostgresStorage) Close() error
- func (s *PostgresStorage) CountCertificates(ctx context.Context, certType string) (int, error)
- func (s *PostgresStorage) CountConnections(ctx context.Context) (int, error)
- func (s *PostgresStorage) CountUsers(ctx context.Context) (int, error)
- func (s *PostgresStorage) CreateCertificate(ctx context.Context, cert *storage.Certificate) error
- func (s *PostgresStorage) CreateConnection(ctx context.Context, conn *storage.Connection) error
- func (s *PostgresStorage) CreateUser(ctx context.Context, user *storage.User) error
- func (s *PostgresStorage) DeleteConnection(ctx context.Context, id string) error
- func (s *PostgresStorage) DeleteUser(ctx context.Context, id string) error
- func (s *PostgresStorage) GetCertificate(ctx context.Context, id string) (*storage.Certificate, error)
- func (s *PostgresStorage) GetCertificateBySerial(ctx context.Context, serial string) (*storage.Certificate, error)
- func (s *PostgresStorage) GetConnection(ctx context.Context, id string) (*storage.Connection, error)
- func (s *PostgresStorage) GetUser(ctx context.Context, id string) (*storage.User, error)
- func (s *PostgresStorage) GetUserByUsername(ctx context.Context, username string) (*storage.User, error)
- func (s *PostgresStorage) ListCertificates(ctx context.Context, certType string, offset, limit int) ([]*storage.Certificate, error)
- func (s *PostgresStorage) ListConnections(ctx context.Context, offset, limit int) ([]*storage.Connection, error)
- func (s *PostgresStorage) ListUsers(ctx context.Context, offset, limit int) ([]*storage.User, error)
- func (s *PostgresStorage) RevokeCertificate(ctx context.Context, id, reason string) error
- func (s *PostgresStorage) UpdateCertificate(ctx context.Context, cert *storage.Certificate) error
- func (s *PostgresStorage) UpdateConnection(ctx context.Context, conn *storage.Connection) error
- func (s *PostgresStorage) UpdateConnectionStats(ctx context.Context, id string, bytesIn, bytesOut int64) error
- func (s *PostgresStorage) UpdateUser(ctx context.Context, user *storage.User) error
- type PostgresTransaction
- func (t *PostgresTransaction) BeginTx(ctx context.Context) (storage.Transaction, error)
- func (t *PostgresTransaction) Commit() error
- func (t *PostgresTransaction) CountCertificates(ctx context.Context, certType string) (int, error)
- func (t *PostgresTransaction) CountConnections(ctx context.Context) (int, error)
- func (t *PostgresTransaction) CountUsers(ctx context.Context) (int, error)
- func (t *PostgresTransaction) CreateCertificate(ctx context.Context, cert *storage.Certificate) error
- func (t *PostgresTransaction) CreateConnection(ctx context.Context, conn *storage.Connection) error
- func (t *PostgresTransaction) CreateUser(ctx context.Context, user *storage.User) error
- func (t *PostgresTransaction) DeleteConnection(ctx context.Context, id string) error
- func (t *PostgresTransaction) DeleteUser(ctx context.Context, id string) error
- func (t *PostgresTransaction) GetCertificate(ctx context.Context, id string) (*storage.Certificate, error)
- func (t *PostgresTransaction) GetCertificateBySerial(ctx context.Context, serial string) (*storage.Certificate, error)
- func (t *PostgresTransaction) GetConnection(ctx context.Context, id string) (*storage.Connection, error)
- func (t *PostgresTransaction) GetUser(ctx context.Context, id string) (*storage.User, error)
- func (t *PostgresTransaction) GetUserByUsername(ctx context.Context, username string) (*storage.User, error)
- func (t *PostgresTransaction) ListCertificates(ctx context.Context, certType string, offset, limit int) ([]*storage.Certificate, error)
- func (t *PostgresTransaction) ListConnections(ctx context.Context, offset, limit int) ([]*storage.Connection, error)
- func (t *PostgresTransaction) ListUsers(ctx context.Context, offset, limit int) ([]*storage.User, error)
- func (t *PostgresTransaction) RevokeCertificate(ctx context.Context, id, reason string) error
- func (t *PostgresTransaction) Rollback() error
- func (t *PostgresTransaction) UpdateCertificate(ctx context.Context, cert *storage.Certificate) error
- func (t *PostgresTransaction) UpdateConnection(ctx context.Context, conn *storage.Connection) error
- func (t *PostgresTransaction) UpdateConnectionStats(ctx context.Context, id string, bytesIn, bytesOut int64) error
- func (t *PostgresTransaction) UpdateUser(ctx context.Context, user *storage.User) error
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 ¶
func (s *PostgresStorage) BeginTx(ctx context.Context) (storage.Transaction, error)
BeginTx starts a new transaction
func (*PostgresStorage) Close ¶
func (s *PostgresStorage) Close() error
Close closes the database connection pool
func (*PostgresStorage) CountCertificates ¶
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 ¶
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) GetUserByUsername ¶
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) 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 (*PostgresStorage) UpdateUser ¶
type PostgresTransaction ¶
type PostgresTransaction struct {
// contains filtered or unexported fields
}
PostgresTransaction implements the storage.Transaction interface
func (*PostgresTransaction) BeginTx ¶
func (t *PostgresTransaction) BeginTx(ctx context.Context) (storage.Transaction, error)
BeginTx starts a new nested transaction
func (*PostgresTransaction) Commit ¶
func (t *PostgresTransaction) Commit() error
func (*PostgresTransaction) CountCertificates ¶
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 ¶
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) 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 ¶
UpdateUser updates an existing user