Documentation ¶
Index ¶
- Variables
- func ClearOldQueries()
- func CloseConnections()
- type AllowSQLValue
- type Connection
- type Grant
- type Headers
- type Permission
- type Permissions
- type Project
- func (p *Project) GetConnInstance(connName, databaseName string) (conn database.Connection, err error)
- func (p *Project) GetConnObject(connName, databaseName string) (connObj connection.Connection, err error)
- func (p *Project) GetRoleMap(roles []string) (rm RoleMap)
- func (p *Project) LoadConnections(force bool) (err error)
- func (p *Project) LoadRoles(force bool) (err error)
- func (p *Project) LoadTokens(force bool) (err error)
- func (p *Project) NewQuery(ctx context.Context) *Query
- func (p *Project) ResolveToken(value string) (token Token, ok bool)
- func (p *Project) SchemaAll(connection, schema string) (table database.Table)
- func (p *Project) TokenAdd(name string, token Token) (err error)
- func (p *Project) TokenGet(name string, token Token) (err error)
- func (p *Project) TokenRemove(name string) (err error)
- func (p *Project) TokenSave() (err error)
- func (p *Project) TokenToggle(name string) (disabled bool, err error)
- type Query
- type QueryStatus
- type Role
- type RoleMap
- type Row
- type Rows
- type Token
- type TokenMap
Constants ¶
This section is empty.
Variables ¶
View Source
var ( AllowAllRoleMap = RoleMap{ "*": Role{ "*": Grant{ AllowRead: []string{"*"}, AllowWrite: []string{"*"}, AllowSQL: AllowSQLAny, }, }, } )
View Source
var DefaultProjectID = "default"
View Source
var Projects = map[string]*Project{}
View Source
var (
// set a build time.
RudderstackURL = ""
)
View Source
var Version = "dev"
Version is the version number
Functions ¶
func ClearOldQueries ¶ added in v0.0.36
func ClearOldQueries()
Types ¶
type AllowSQLValue ¶
type AllowSQLValue string
const ( AllowSQLDisable AllowSQLValue = "disable" AllowSQLAny AllowSQLValue = "any" )
type Connection ¶
type Connection struct { Conn connection.Connection Source string Props map[string]string // to cache vars }
Connection is a connection
func (*Connection) DefaultDB ¶
func (c *Connection) DefaultDB() string
DefaultDB returns the default database
type Grant ¶
type Grant struct { // AllowRead lists the schema/tables that are allowed to be read from AllowRead []string `json:"allow_read" yaml:"allow_read"` // AllowWrite lists the schema/tables that are allowed to be written to AllowWrite []string `json:"allow_write" yaml:"allow_write"` // AllowSQL shows whether a AllowSQL AllowSQLValue `json:"allow_sql" yaml:"allow_sql"` }
func (Grant) GetReadable ¶
func (gt Grant) GetReadable(conn connection.Connection) (tables []database.Table)
func (Grant) GetWritable ¶
func (gt Grant) GetWritable(conn connection.Connection) (tables []database.Table)
type Headers ¶
type Headers []string
type Permission ¶
type Permission string
const ( PermissionNone Permission = "none" PermissionRead Permission = "read" PermissionWrite Permission = "write" PermissionReadWrite Permission = "read_write" )
func (Permission) CanRead ¶
func (p Permission) CanRead() bool
func (Permission) CanWrite ¶
func (p Permission) CanWrite() bool
type Permissions ¶
type Permissions map[string]Permission
Permissions is a map of all objects for one connection
type Project ¶ added in v0.0.53
type Project struct { ID string Directory string Connections map[string]*Connection Queries map[string]*Query Tokens TokenMap TokenValues map[string]Token Roles RoleMap NoRestriction bool EnvFile string TokenFile string RolesFile string // contains filtered or unexported fields }
func DefaultProject ¶ added in v0.0.53
func DefaultProject() (proj *Project)
func LoadProject ¶ added in v0.0.53
func NewProject ¶ added in v0.0.53
func (*Project) GetConnInstance ¶ added in v0.0.53
func (p *Project) GetConnInstance(connName, databaseName string) (conn database.Connection, err error)
func (*Project) GetConnObject ¶ added in v0.0.53
func (p *Project) GetConnObject(connName, databaseName string) (connObj connection.Connection, err error)
func (*Project) GetRoleMap ¶ added in v0.0.53
func (*Project) LoadConnections ¶ added in v0.0.53
func (*Project) LoadTokens ¶ added in v0.0.53
func (*Project) ResolveToken ¶ added in v0.0.53
func (*Project) SchemaAll ¶ added in v0.0.53
SchemaAll returns schema.* notation for all tables in a schema
func (*Project) TokenRemove ¶ added in v0.0.53
type Query ¶
type Query struct { ID string `json:"id" query:"id" gorm:"primaryKey"` Project string `json:"project" query:"project" gorm:"index"` Conn string `json:"conn" query:"conn" gorm:"index"` Database string `json:"database" query:"database" gorm:"index"` Text string `json:"text" query:"text"` Limit int `json:"limit" query:"limit" gorm:"-"` // -1 is unlimited Start int64 `json:"start" query:"start" gorm:"index:idx_start"` End int64 `json:"end" query:"end"` Status QueryStatus `json:"status" query:"status"` Err string `json:"err" query:"err"` Headers Headers `json:"headers" query:"headers" gorm:"headers"` UpdatedDt time.Time `json:"-" gorm:"autoUpdateTime"` Connection database.Connection `json:"-" gorm:"-"` Affected int64 `json:"affected" gorm:"-"` Result *sqlx.Rows `json:"-" gorm:"-"` Stream *iop.Datastream `json:"-" gorm:"-"` Done chan struct{} `json:"-" gorm:"-"` Error error `json:"-" gorm:"-"` Context *g.Context `json:"-" gorm:"-"` IsGenerated bool `json:"-" gorm:"-"` // contains filtered or unexported fields }
Query represents a query
func (*Query) ProcessResult ¶
type QueryStatus ¶
type QueryStatus string
const QueryStatusCancelled QueryStatus = "cancelled"
const QueryStatusCompleted QueryStatus = "completed"
const QueryStatusErrored QueryStatus = "errored"
const QueryStatusFetched QueryStatus = "fetched"
const QueryStatusSubmitted QueryStatus = "submitted"
type Role ¶
Role is a map of Grants per connection each map key is a connection name each map item is a grant entry for that connection
type RoleMap ¶
RoleMap is a map of roles each map key is a role name each map item is a Role entry for that role
func (RoleMap) GetPermissions ¶
func (rm RoleMap) GetPermissions(conn connection.Connection) (perms Permissions)
type Row ¶
type Row []interface{}
type Rows ¶
type Rows [][]interface{}
Click to show internal directories.
Click to hide internal directories.