audit

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Oct 15, 2026 License: PostgreSQL Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Annotations = errorlist.New("annotations")

Annotations aggregates annotations as errors

Use `Unwrap() []error` to get annotations. All errors implement `Path() string` method to retrieve annotation context.

View Source
var ReservedKeywords = []string{
	"all",
	"analyse",
	"analyze",
	"and",
	"any",
	"array",
	"as",
	"asc",
	"asymmetric",
	"both",
	"case",
	"cast",
	"check",
	"collate",
	"column",
	"constraint",
	"create",
	"current_catalog",
	"current_date",
	"current_role",
	"current_time",
	"current_timestamp",
	"current_user",
	"default",
	"deferrable",
	"desc",
	"distinct",
	"do",
	"else",
	"end",
	"except",
	"false",
	"fetch",
	"for",
	"foreign",
	"from",
	"grant",
	"group",
	"having",
	"in",
	"initially",
	"intersect",
	"into",
	"lateral",
	"leading",
	"limit",
	"localtime",
	"localtimestamp",
	"not",
	"null",
	"offset",
	"on",
	"only",
	"or",
	"order",
	"placing",
	"primary",
	"references",
	"returning",
	"select",
	"session_user",
	"some",
	"symmetric",
	"system_user",
	"table",
	"then",
	"to",
	"trailing",
	"true",
	"union",
	"unique",
	"user",
	"using",
	"variadic",
	"when",
	"where",
	"window",
	"with",
}

Functions

func AnnotationsMap added in v1.0.0

func AnnotationsMap() map[string][]string

AnnotationsMap builds a map of all annotations.

func Append added in v1.0.0

func Append(wrapped annotater, suffixes ...string) appender

Append suffixes annotations

func Errors added in v1.0.0

func Errors(a annotater, err error)

Errors annotates one or more errors

func Expression

func Expression(o annotater, e string)

Expression eventually audit a SQL snippet

Transpile a simple expression string Returns on empty expression.

func Identifier

func Identifier(o annotater, identifier string)

func Score added in v1.0.0

func Score(keys ...string) float32

func Setup

func Setup(t rewriter)

func Transpile added in v0.15.0

func Transpile(o annotater, root ast.Node)

Transpile a parsed AST.

Annotate transpilation errors.

func TransqlateErr added in v1.0.0

func TransqlateErr(a annotater, err error, annotation string)

TransqlateErr annotates and logs transqlate error.

func Zero added in v1.0.0

func Zero() annotater

Zero returns a void annotater

Types

type Annotable added in v1.0.0

type Annotable struct {
	Score       float32
	Annotations []string
	// For purity, these fields should be in a catalog.Object struct.
	// We keep them here for simplicity of implementation.
	// This way, they can be use for audit logging.
	ObjectDefinition string `json:"objectDefinition"`
	ObjectPath       string `json:"objectPath"`
	ObjectType       string `json:"objectType"`
}

Annotable is the core fields of an annotable database object

func (*Annotable) Annotate added in v1.0.0

func (a *Annotable) Annotate(annotation ...string)

Annotate appends an annotation and increments score

Prefix with empty string to simply increase score without storing annotation.

func (*Annotable) InitAnnotations added in v1.0.0

func (a *Annotable) InitAnnotations(annotations []string)

InitAnnotations initialize annotation and score

Jump to

Keyboard shortcuts

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