MCPcopy Create free account
hub / github.com/Permify/permify / Postgres

Struct Postgres

pkg/database/postgres/postgres.go:22–52  ·  view source on GitHub ↗

Postgres - Structure for Postresql instance

Source from the content-addressed store, hash-verified

20
21// Postgres - Structure for Postresql instance
22type Postgres struct {
23 ReadPool *pgxpool.Pool
24 WritePool *pgxpool.Pool
25
26 Builder squirrel.StatementBuilderType
27 // options
28 // maxDataPerWrite sets the maximum amount of data per write operation to the database
29 maxDataPerWrite int
30 // maxRetries defines the maximum number of retries for database operations in case of failure
31 maxRetries int
32 // watchBufferSize specifies the buffer size for database watch operations, impacting how many changes can be queued
33 watchBufferSize int
34 // maxConnectionLifeTime determines the maximum lifetime of a connection in the pool
35 maxConnectionLifeTime time.Duration
36 // maxConnectionIdleTime determines the maximum time a connection can remain idle before being closed
37 maxConnectionIdleTime time.Duration
38 // maxConnections is the maximum number of connections in the pool (maps to pgxpool MaxConns)
39 maxConnections int
40 // maxIdleConnections is deprecated: Use MinConnections instead. Kept for backward compatibility (maps to MinConnections if MinConnections is not set).
41 maxIdleConnections int
42 // minConnections is the minimum number of connections in the pool (maps to pgxpool MinConns)
43 minConnections int
44 // minIdleConnections is the minimum number of idle connections in the pool (maps to pgxpool MinIdleConns)
45 minIdleConnections int
46 // healthCheckPeriod is the period between health checks on idle connections
47 healthCheckPeriod time.Duration
48 // maxConnectionLifetimeJitter is jitter added to MaxConnLifetime to prevent all connections from expiring at once
49 maxConnectionLifetimeJitter time.Duration
50 // connectTimeout is the maximum time to wait when establishing a new connection
51 connectTimeout time.Duration
52}
53
54// New -
55func New(uri string, opts ...Option) (*Postgres, error) {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected