Movatterモバイル変換


[0]ホーム

URL:


regosql

package
v2.26.0Latest Latest
Warning

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

Go to latest
Published: Sep 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

funcConnectionLogConverteradded inv2.25.0

func ConnectionLogConverter() *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

typeACLMappingVaradded inv2.26.0

type ACLMappingVar struct {// SelectSQL is used to `SELECT` the ACL mapping from the table for the// given resource. ie. if the full query might look like `SELECT group_acl// FROM things;` then you would want this to be `"group_acl"`.SelectSQLstring// IndexMatcher handles variable references when indexing into the mapping.// (ie. `input.object.acl_group_list[input.object.org_owner]`). We need one// from the local context because the global one might not be correctly// scoped.IndexMatchersqltypes.VariableMatcher// Used if the action list isn't directly in the ACL entry. For example, in// the `workspaces.group_acl` and `workspaces.user_acl` columns they're stored// under a `"permissions"` key.Subfieldstring// StructPath represents the path of the value in rego// ie. input.object.group_acl -> ["input", "object", "group_acl"]StructPath []string// Instance fieldsSourcesqltypes.RegoSourceGroupNodesqltypes.Node}

ACLMappingVar is a variable matcher that matches ACL map variables to theirSQL storage. Usually the actual backing implementation is a pair of `jsonb`columns named `group_acl` and `user_acl`. Each column contains an object thatlooks like...

```json

{  "<actor_id>": ["<action>", "<action>"]}

```

funcACLMappingMatcheradded inv2.26.0

func ACLMappingMatcher(indexMatchersqltypes.VariableMatcher, selectSQLstring, structPath []string)ACLMappingVar

func (ACLMappingVar)ContainsSQLadded inv2.26.0

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

func (ACLMappingVar)ConvertVariableadded inv2.26.0

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

func (ACLMappingVar)SQLStringadded inv2.26.0

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

func (ACLMappingVar)UseAsadded inv2.26.0

func (ACLMappingVar)UsingSubfieldadded inv2.26.0

func (gACLMappingVar) UsingSubfield(subfieldstring)ACLMappingVar

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