Documentation
¶
Overview ¶
Package db owns cs-plane's Postgres connection and complete state-operation boundary. The DSN's search_path names the one schema cs-plane owns, so it can share a server and database with other services. A cached handle plus a state-directory file lock serialize read-modify-write cycles across processes; callers may nest a transaction inside that cycle when database changes must coordinate with protected files, and read single statements unlocked. Feature packages own every table and query. Schema DDL runs only in an empty schema; an existing one is accepted by its format marker or rejected.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DecodePayload ¶
DecodePayload reads a JSON payload column and refuses one whose identity does not match its row.
func IsConstraint ¶
IsConstraint reports whether err is an integrity-constraint violation such as a duplicate key.
Types ¶
type DB ¶
type DB struct {
// contains filtered or unexported fields
}
func Open ¶
Open returns the shared handle for dsn, creating the schema's tables only when it holds none yet. lockDir holds the file lock that serializes state cycles across cs-plane processes.