Movatterモバイル変換


[0]ホーム

URL:


Alert GO-2024-3228: Coder vulnerable to post-auth URL redirection to untrusted site ('Open Redirect') in github.com/coder/coder
Notice  The highest tagged major version isv2.

sqltypes

package
v0.27.3Latest Latest
Warning

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

Go to latest
Published: Aug 1, 2023 License:AGPL-3.0Imports:7Imported by:0

Details

Repository

github.com/coder/coder

Links

Documentation

Overview

Package sqltypes contains the types used to convert rego queries into SQL.The rego ast is converted into these types to better control the SQLgeneration. It allows writing the SQL generation for types in an easier toread way.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

funcIsPrimitive

func IsPrimitive(nNode)bool

funcRegoVarPath

func RegoVarPath(path []string, terms []*ast.Term) ([]*ast.Term,error)

RegoVarPath will consume the following terms from the given rego Ref andreturn the remaining terms. If the path does not fully match, an error isreturned. The first term must always be a Var.

Types

typeASTArray

type ASTArray struct {SourceRegoSourceValue  []Node}

func (ASTArray)ContainsSQL

func (aASTArray) ContainsSQL(cfg *SQLGenerator, needleNode) (string,error)

func (ASTArray)MyType

func (aASTArray) MyType()Node

func (ASTArray)SQLString

func (aASTArray) SQLString(cfg *SQLGenerator)string

func (ASTArray)UseAs

func (ASTArray) UseAs()Node

typeAstBoolean

type AstBoolean struct {SourceRegoSourceValuebool}

AstBoolean is a literal true/false value.

func (AstBoolean)EqualsSQLString

func (bAstBoolean) EqualsSQLString(cfg *SQLGenerator, notbool, otherNode) (string,error)

func (AstBoolean)IsBooleanNode

func (AstBoolean) IsBooleanNode()

func (AstBoolean)SQLString

func (bAstBoolean) SQLString(_ *SQLGenerator)string

func (AstBoolean)UseAs

func (AstBoolean) UseAs()Node

typeAstNumber

type AstNumber struct {SourceRegoSource// Value is intentionally vague as to if it's an integer or a float.// This defers that decision to the user. Rego keeps all numbers in this// type. If we were to source the type from something other than Rego,// we might want to make a Float and Int type which keep the original// precision.Valuejson.Number}

func (AstNumber)EqualsSQLString

func (nAstNumber) EqualsSQLString(cfg *SQLGenerator, notbool, otherNode) (string,error)

func (AstNumber)SQLString

func (nAstNumber) SQLString(_ *SQLGenerator)string

func (AstNumber)UseAs

func (AstNumber) UseAs()Node

typeAstString

type AstString struct {SourceRegoSourceValuestring}

func (AstString)EqualsSQLString

func (sAstString) EqualsSQLString(cfg *SQLGenerator, notbool, otherNode) (string,error)

func (AstString)SQLString

func (sAstString) SQLString(_ *SQLGenerator)string

func (AstString)UseAs

func (AstString) UseAs()Node

typeBooleanNode

type BooleanNode interface {NodeIsBooleanNode()}

BooleanNode is a node that returns a true/false when evaluated.

funcAnd

func And(sourceRegoSource, terms ...BooleanNode)BooleanNode

funcBool

func Bool(tbool)BooleanNode

funcBoolParenthesis

func BoolParenthesis(valueBooleanNode)BooleanNode

BoolParenthesis wraps the given boolean node in parens.This is useful for grouping and avoiding ambiguity. This does not work formathematical parenthesis to change order of operations.

funcEquality

func Equality(notEqualsbool, a, bNode)BooleanNode

funcMemberOf

func MemberOf(needle, haystackNode)BooleanNode

funcOr

func Or(sourceRegoSource, terms ...BooleanNode)BooleanNode

typeNode

type Node interface {SQLString(cfg *SQLGenerator)string// UseAs is a helper function to allow a node to be used as a different// Node in operators. For example, a variable is really just a "string", so// having the Equality operator check for "String" or "StringVar" is just// excessive. Instead, we can just have the variable implement this function.UseAs()Node}

funcAlwaysFalseNode

func AlwaysFalseNode(nNode)Node

AlwaysFalseNode is mainly used for unit testing to make a Node immediately.

funcArray

func Array(sourceRegoSource, nodes ...Node) (Node,error)

Array is typed to whatever the first element is. If there is not firstelement, the array element type is invalid.

funcNumber

func Number(sourceRegoSource, vjson.Number)Node

funcString

func String(vstring)Node

typeRegoSource

type RegoSourcestring

typeSQLGenerator

type SQLGenerator struct {// contains filtered or unexported fields}

funcNewSQLGenerator

func NewSQLGenerator() *SQLGenerator

func (*SQLGenerator)AddError

func (g *SQLGenerator) AddError(errerror)

func (*SQLGenerator)Errors

func (g *SQLGenerator) Errors() []error

typeSupportsContainedIn

type SupportsContainedIn interface {ContainedInSQL(cfg *SQLGenerator, otherNode) (string,error)}

SupportsContainedIn is the inverse of SupportsContains. It is implementedfrom the "needle" rather than the haystack.

typeSupportsContains

type SupportsContains interface {ContainsSQL(cfg *SQLGenerator, otherNode) (string,error)}

SupportsContains is an interface that can be implemented by types thatsupport "me.Contains(other)". This is `internal_member2` in the rego.

typeSupportsEquality

type SupportsEquality interface {// EqualsSQLString intentionally returns an error. This is so if// left = right is not supported, we can try right = left.EqualsSQLString(cfg *SQLGenerator, notbool, otherNode) (string,error)}

SupportsEquality is an interface that can be implemented by types thatsupport equality with other types. We defer to other types to implement thisas it is much easier to implement this in the context of the type.

typeVariableConverter

type VariableConverter struct {// contains filtered or unexported fields}

funcNewVariableConverter

func NewVariableConverter() *VariableConverter

func (*VariableConverter)ConvertVariable

func (vc *VariableConverter) ConvertVariable(regoast.Ref) (Node,bool)

func (*VariableConverter)RegisterMatcher

func (vc *VariableConverter) RegisterMatcher(m ...VariableMatcher) *VariableConverter

typeVariableMatcher

type VariableMatcher interface {ConvertVariable(regoast.Ref) (Node,bool)}

funcAlwaysFalse

AlwaysFalse overrides the inner node with a constant "false".

funcStringVarMatcher

func StringVarMatcher(sqlStringstring, regoPath []string)VariableMatcher

Source Files

View all Source files

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f orF : Jump to
y orY : Canonical URL
go.dev uses cookies from Google to deliver and enhance the quality of its services and to analyze traffic.Learn more.

[8]ページ先頭

©2009-2025 Movatter.jp