Movatterモバイル変換


[0]ホーム

URL:


regosql

package
v2.23.0Latest Latest
Warning

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

Go to latest
Published: Jun 3, 2025 License:AGPL-3.0Imports:7Imported by:0

Details

Repository

github.com/coder/coder

Links

Documentation

Overview

Package regosql converts rego queries into SQL WHERE clauses. This is sothe rego queries can be used to filter the results of a SQL query.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

funcAuditLogConverteradded inv2.14.0

func AuditLogConverter() *sqltypes.VariableConverter

funcConvertRegoAst

func ConvertRegoAst(cfgConvertConfig, partial *rego.PartialQueries) (sqltypes.BooleanNode,error)

ConvertRegoAst converts partial rego queries into a single SQL whereclause. If the query equates to "true" then the user should have access.

funcDefaultVariableConverter

func DefaultVariableConverter() *sqltypes.VariableConverter

funcNoACLConverter

func NoACLConverter() *sqltypes.VariableConverter

NoACLConverter should be used when the target SQL table does not containgroup or user ACL columns.

funcTemplateConverter

func TemplateConverter() *sqltypes.VariableConverter

funcUserConverter

func UserConverter() *sqltypes.VariableConverter

funcWorkspaceConverteradded inv2.8.0

func WorkspaceConverter() *sqltypes.VariableConverter

Types

typeACLGroupVar

type ACLGroupVar struct {StructSQLstring// input.object.group_acl -> ["input", "object", "group_acl"]StructPath []string// FieldReference handles referencing the subfields, which could be// more variables. We pass one in as the global one might not be correctly// scoped.FieldReferencesqltypes.VariableMatcher// Instance fieldsSourcesqltypes.RegoSourceGroupNodesqltypes.Node}

ACLGroupVar is a variable matcher that handles group_acl and user_acl.The sql type is a jsonb object with the following structure:

"group_acl": { "<group_name>": ["<actions>"]}

This is a custom variable matcher as json objects have arbitrary complexity.

funcACLGroupMatcher

func ACLGroupMatcher(fieldReferencesqltypes.VariableMatcher, structSQLstring, structPath []string)ACLGroupVar

func (ACLGroupVar)ContainsSQL

func (gACLGroupVar) ContainsSQL(cfg *sqltypes.SQLGenerator, othersqltypes.Node) (string,error)

func (ACLGroupVar)ConvertVariable

func (gACLGroupVar) ConvertVariable(regoast.Ref) (sqltypes.Node,bool)

func (ACLGroupVar)SQLString

func (gACLGroupVar) SQLString(cfg *sqltypes.SQLGenerator)string

func (ACLGroupVar)UseAs

func (ACLGroupVar) UseAs()sqltypes.Node

typeConvertConfig

type ConvertConfig struct {// VariableConverter is called each time a var is encountered. This creates// the SQL ast for the variable. Without this, the SQL generator does not// know how to convert rego variables into SQL columns.VariableConvertersqltypes.VariableMatcher}

ConvertConfig is required to generate SQL from the rego queries.

Source Files

View all Source files

Directories

PathSynopsis
Package sqltypes contains the types used to convert rego queries into SQL.
Package sqltypes contains the types used to convert rego queries into SQL.

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