postgres

package
v0.0.0-...-a4f76d6 Latest Latest
Warning

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

Go to latest
Published: Aug 24, 2025 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package postgres implements the storage interface for PostgreSQL. internal/storage/postgres/client.go

Package postgres implements database migrations for PostgreSQL. internal/storage/postgres/migrations.go

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RunMigrations

func RunMigrations(db *sql.DB) error

RunMigrations applies database migrations for PostgreSQL.

Types

type Client

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

Client implements the Storage interface for PostgreSQL.

func NewClient

func NewClient(dsn string, logger *zap.Logger) *Client

NewClient creates a new PostgreSQL storage client.

func (*Client) Close

func (c *Client) Close() error

Close closes the database connection.

func (*Client) DeleteServer

func (c *Client) DeleteServer(id string) error

DeleteServer deletes a server configuration by ID.

func (*Client) GetServerByID

func (c *Client) GetServerByID(id string) (*models.Server, error)

GetServerByID retrieves a server configuration by ID.

func (*Client) Init

func (c *Client) Init() error

Init initializes the PostgreSQL database connection and runs migrations.

func (*Client) QueryConnections

func (c *Client) QueryConnections(filter interface{}) ([]*models.ConnectionLog, error)

QueryConnections queries connection logs.

func (*Client) QueryRequestLogs

func (c *Client) QueryRequestLogs(filter interface{}) ([]*models.RequestLog, error)

QueryRequestLogs queries request logs.

func (*Client) QueryServers

func (c *Client) QueryServers(filter interface{}) ([]*models.Server, error)

QueryServers queries server configurations.

func (*Client) QueryTraffic

func (c *Client) QueryTraffic(filter interface{}) ([]*models.TrafficStats, error)

QueryTraffic queries traffic statistics.

func (*Client) SaveConnection

func (c *Client) SaveConnection(conn *models.ConnectionLog) error

SaveConnection saves a connection log.

func (*Client) SaveRequestLog

func (c *Client) SaveRequestLog(log *models.RequestLog) error

SaveRequestLog saves a request log.

func (*Client) SaveServer

func (c *Client) SaveServer(server *models.Server) error

SaveServer saves a server configuration.

func (*Client) SaveTraffic

func (c *Client) SaveTraffic(stats *models.TrafficStats) error

SaveTraffic saves traffic statistics.

Jump to

Keyboard shortcuts

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