Documentation
¶
Index ¶
- Variables
- func AnnotationsMap() map[string][]string
- func Append(wrapped annotater, suffixes ...string) appender
- func Errors(a annotater, err error)
- func Expression(o annotater, e string)
- func Identifier(o annotater, identifier string)
- func Score(keys ...string) float32
- func Setup(t rewriter)
- func Transpile(o annotater, root ast.Node)
- func TransqlateErr(a annotater, err error, annotation string)
- func Zero() annotater
- type Annotable
Constants ¶
This section is empty.
Variables ¶
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.
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
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 TransqlateErr ¶ added in v1.0.0
TransqlateErr annotates and logs transqlate error.
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
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
InitAnnotations initialize annotation and score