Skip to main content

internal/infra/pg/schema.go

internal/infra/pg · 46 lines · 5 declarations · source

This file carries the package documentation, rendered on the package page.

Declarations

type Schema

type Schema string

Schema is a validated SQL identifier. Validation prevents identifier injection and accidental truncation; it is not an authorization boundary. A role granted multiple schemas can read them. Project predicates enforce the authorized scope set inside the instance memory namespace.

source

const maxIdentifierLength

const maxIdentifierLength = 63

PostgreSQL's NAMEDATALEN - 1. A longer name is silently truncated and can select the wrong namespace.

source

func NewSchema

func NewSchema(name string) (Schema, error)

NewSchema validates a database namespace.

source

method Schema.String

func (s Schema) String() string

source

method Schema.SQL

func (s Schema) SQL(template string) string

SQL renders a statement template for this namespace.

source