Documentation
¶
Index ¶
- Variables
- func CloseConnections()
- func GetConnInstance(connName, databaseName string) (conn database.Connection, err error)
- func GetConnObject(connName, databaseName string) (connObj connection.Connection, err error)
- func LoadConnections(force bool) (err error)
- func LoadRoles(force bool) (err error)
- func LoadTokens(force bool) (err error)
- func SchemaAll(connection, schema string) database.Table
- type AllowSQLValue
- type Connection
- type Grant
- type Headers
- type Permission
- type Permissions
- 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 ( // Connections is all connections Connections = map[string]*Connection{} Queries = map[string]*Query{} Tokens = TokenMap{} TokenValues = map[string]Token{} )
View Source
var (
Roles = RoleMap{}
)
View Source
var Version = "dev"
Version is the version number
Functions ¶
func GetConnInstance ¶
func GetConnInstance(connName, databaseName string) (conn database.Connection, err error)
GetConnInstance gets the connection instance
func GetConnObject ¶
func GetConnObject(connName, databaseName string) (connObj connection.Connection, err error)
GetConnInstance gets the connection object
func LoadConnections ¶
func LoadTokens ¶ added in v0.0.4
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"` }
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 Query ¶
type Query struct { ID string `json:"id" query:"id" gorm:"primaryKey"` 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"` Error string `json:"error" query:"error"` Headers Headers `json:"headers" query:"headers" gorm:"headers"` UpdatedDt time.Time `json:"-" gorm:"autoUpdateTime"` Affected int64 `json:"affected" gorm:"-"` Result *sqlx.Rows `json:"-" gorm:"-"` Stream *iop.Datastream `json:"-" gorm:"-"` Done chan struct{} `json:"-" gorm:"-"` Err error `json:"-" gorm:"-"` Context g.Context `json:"-" gorm:"-"` }
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 GetRoleMap ¶ added in v0.0.4
func (RoleMap) GetPermissions ¶
func (rm RoleMap) GetPermissions(connection string) (perms Permissions)
type Row ¶
type Row []interface{}
type Rows ¶
type Rows [][]interface{}
type Token ¶ added in v0.0.4
type Token struct { Token string `json:"token"` Roles []string `json:"roles"` Disabled bool `json:"disabled"` IssuedAt time.Time `json:"issued_at"` }
func ResolveToken ¶ added in v0.0.4
Click to show internal directories.
Click to hide internal directories.