dbaccess

package
v0.11.0 Latest Latest
Warning

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

Go to latest
Published: Nov 25, 2026 License: MIT Imports: 11 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package dbaccess parses and validates the declarative PostgreSQL access contract consumed by the appkit db-access command.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RenderSQL

func RenderSQL(m Manifest) ([]byte, error)

Types

type ColumnGrant

type ColumnGrant struct {
	Schema     string   `yaml:"schema"`
	Table      string   `yaml:"table"`
	Column     string   `yaml:"column"`
	Privileges []string `yaml:"privileges"`
}

type Forbidden

type Forbidden struct {
	RoleAttributes []string `yaml:"roleAttributes,omitempty"`
	Privileges     []string `yaml:"privileges,omitempty"`
	Mutations      []string `yaml:"mutations,omitempty"`
}

type FunctionGrant

type FunctionGrant struct {
	Schema     string   `yaml:"schema"`
	Name       string   `yaml:"name"`
	Arguments  []string `yaml:"arguments,omitempty"`
	Privileges []string `yaml:"privileges"`
}

type Grants

type Grants struct {
	Schemas   map[string][]string `yaml:"schemas,omitempty"`
	Tables    map[string][]string `yaml:"tables,omitempty"`
	Sequences map[string][]string `yaml:"sequences,omitempty"`
	Columns   []ColumnGrant       `yaml:"columns,omitempty"`
	Functions []FunctionGrant     `yaml:"functions,omitempty"`
}

type Manifest

type Manifest struct {
	Version     int                       `yaml:"version"`
	Service     string                    `yaml:"service"`
	Roles       Roles                     `yaml:"roles"`
	Memberships Memberships               `yaml:"memberships,omitempty"`
	Grants      Grants                    `yaml:"grants,omitempty"`
	RLS         map[string]RLSRequirement `yaml:"rls,omitempty"`
	Forbidden   Forbidden                 `yaml:"forbidden,omitempty"`
}

func LoadFile

func LoadFile(path string) (*Manifest, error)

func Parse

func Parse(r io.Reader) (*Manifest, error)

func (Manifest) Validate

func (m Manifest) Validate() error

type Memberships

type Memberships struct {
	Required  []string `yaml:"required,omitempty"`
	Forbidden []string `yaml:"forbidden,omitempty"`
}

type RLSPolicyContract

type RLSPolicyContract struct {
	Name      string   `yaml:"name"`
	Command   string   `yaml:"command"`
	Mode      string   `yaml:"mode"`
	Roles     []string `yaml:"roles"`
	Using     *string  `yaml:"using,omitempty"`
	WithCheck *string  `yaml:"withCheck,omitempty"`
}

type RLSRequirement

type RLSRequirement struct {
	Enabled       bool                `yaml:"enabled"`
	Forced        bool                `yaml:"forced"`
	ExactPolicies bool                `yaml:"exactPolicies"`
	Policies      []RLSPolicyContract `yaml:"policies"`
}

type Role

type Role struct {
	Name       string         `yaml:"name"`
	Managed    bool           `yaml:"managed"`
	Attributes RoleAttributes `yaml:"attributes,omitempty"`
}

type RoleAttributes

type RoleAttributes struct {
	Login      bool `yaml:"login,omitempty"`
	Inherit    bool `yaml:"inherit,omitempty"`
	Superuser  bool `yaml:"superuser,omitempty"`
	BypassRLS  bool `yaml:"bypassRls,omitempty"`
	CreateDB   bool `yaml:"createDb,omitempty"`
	CreateRole bool `yaml:"createRole,omitempty"`
}

type Roles

type Roles struct {
	Login      Role `yaml:"login"`
	Permission Role `yaml:"permission"`
}

Jump to

Keyboard shortcuts

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