Documentation ¶
Index ¶
- Constants
- type Client
- func (c *Client) GetServerInfo(ctx context.Context) (*ServerModel, error)
- func (c *Client) GetUser(ctx context.Context, user string, host string) (*User, error)
- func (c *Client) IsVersion8() bool
- func (c *Client) ListColumnGrants(ctx context.Context, user string, host string) ([]*ColumnGrant, error)
- func (c *Client) ListColumns(ctx context.Context, parentResourceID *v2.ResourceId, pager *Pager) ([]*ColumnModel, string, error)
- func (c *Client) ListDatabaseGrants(ctx context.Context, user string, host string) ([]*DatabaseGrant, error)
- func (c *Client) ListDatabases(ctx context.Context, pager *Pager) ([]*DbModel, string, error)
- func (c *Client) ListGlobalGrants(ctx context.Context, user string, host string) ([]*GlobalGrant, error)
- func (c *Client) ListProxyGrants(ctx context.Context, user string, host string) ([]*ProxyGrant, error)
- func (c *Client) ListRoleGrants(ctx context.Context, user string, host string) ([]*RoleGrant, error)
- func (c *Client) ListRoutines(ctx context.Context, parentResourceID *v2.ResourceId, pager *Pager) ([]*RoutineModel, string, error)
- func (c *Client) ListTableGrants(ctx context.Context, user string, host string) ([]*TableGrant, error)
- func (c *Client) ListTables(ctx context.Context, parentResourceID *v2.ResourceId, pager *Pager) ([]*TableModel, string, error)
- func (c *Client) ListUsers(ctx context.Context, userType string, pager *Pager, collapseUsers bool) ([]*User, string, error)
- func (c *Client) ValidateConnection(ctx context.Context) error
- type ColumnGrant
- type ColumnModel
- type DatabaseGrant
- type DbModel
- type GlobalGrant
- type Pager
- type ProxyGrant
- type RoleGrant
- type RoutineModel
- type ServerModel
- type TableGrant
- type TableModel
- type User
Constants ¶
const ( MaxPageSize = 100 MinPageSize = 10 )
const ( UserType = "user" RoleType = "role" )
const ColumnType = "column"
const DatabaseType = "database"
const RoutineType = "routine"
const ServerType = "server"
const TableType = "table"
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func (*Client) GetServerInfo ¶
func (c *Client) GetServerInfo(ctx context.Context) (*ServerModel, error)
func (*Client) GetUser ¶
GetUser returns a single user@host row and its perms Grants required:
GRANT SELECT (Host, User, Select_priv, Insert_priv, Update_priv, Delete_priv, Create_priv, Drop_priv, Reload_priv, References_priv, Index_priv, Alter_priv, Show_db_priv, Super_priv, Create_tmp_table_priv, Lock_tables_priv, Execute_priv, Repl_slave_priv, Repl_client_priv, Create_view_priv, Show_view_priv, Create_routine_priv, Alter_routine_priv, Create_user_priv, Event_priv, Trigger_priv, Create_tablespace_priv, Create_role_priv, Drop_role_priv, File_priv,, Grant_priv, authentication_string) ON mysql.user TO user@host;
func (*Client) IsVersion8 ¶
func (*Client) ListColumnGrants ¶
func (c *Client) ListColumnGrants(ctx context.Context, user string, host string) ([]*ColumnGrant, error)
ListColumnGrants returns a single user@host row and its perms Grants required:
GRANT SELECT (Host, User, Db, Column_name, Column_priv, Table_name) ON mysql.columns_priv TO user@host;
func (*Client) ListColumns ¶
func (c *Client) ListColumns(ctx context.Context, parentResourceID *v2.ResourceId, pager *Pager) ([]*ColumnModel, string, error)
ListColumns scans the server for all columns associated with the parent table.
func (*Client) ListDatabaseGrants ¶
func (c *Client) ListDatabaseGrants(ctx context.Context, user string, host string) ([]*DatabaseGrant, error)
ListDatabaseGrants returns a single user@host row and its perms Grants required:
GRANT SELECT (Host, User, Db, Select_priv, Insert_priv, Update_priv, Delete_priv, Create_priv, Drop_priv, Grant_priv, References_priv, Index_priv, Alter_priv, Create_tmp_table_priv, Lock_tables_priv, Execute_priv, Create_view_priv, Show_view_priv, Create_routine_priv, Alter_routine_priv, Event_priv, Trigger_priv) ON mysql.db TO user@host;
func (*Client) ListDatabases ¶
ListDatabases scans and returns all the databases.
func (*Client) ListGlobalGrants ¶
func (c *Client) ListGlobalGrants(ctx context.Context, user string, host string) ([]*GlobalGrant, error)
ListGlobalGrants returns the set of grants from the mysql.global_grants Required MySQL grant for connector:
GRANT SELECT (USER, HOST, PRIV, WITH_GRANT_OPTION) ON mysql.global_grants TO user@host;
func (*Client) ListProxyGrants ¶
func (c *Client) ListProxyGrants(ctx context.Context, user string, host string) ([]*ProxyGrant, error)
ListProxyGrants returns a single user@host row and its perms Grants required:
GRANT SELECT (Host, User, Db, Column_name, Column_priv, Table_name) ON mysql.columns_priv TO user@host;
func (*Client) ListRoleGrants ¶
func (c *Client) ListRoleGrants(ctx context.Context, user string, host string) ([]*RoleGrant, error)
ListRoleGrants returns a single user@host row and its role edges Grants required:
GRANT SELECT (FROM_HOST, FROM_USER, TO_HOST, TO_USER, WITH_ADMIN_OPTION) ON mysql.role_edges TO user@host;
func (*Client) ListRoutines ¶
func (c *Client) ListRoutines(ctx context.Context, parentResourceID *v2.ResourceId, pager *Pager) ([]*RoutineModel, string, error)
ListRoutines scans and returns all the routines associated with the parent database.
func (*Client) ListTableGrants ¶
func (c *Client) ListTableGrants(ctx context.Context, user string, host string) ([]*TableGrant, error)
ListTableGrants returns a single user@host row and its perms Grants required:
GRANT SELECT (Host, User, Db, Table_priv, Table_name) ON mysql.tables_priv TO user@host;
func (*Client) ListTables ¶
func (c *Client) ListTables(ctx context.Context, parentResourceID *v2.ResourceId, pager *Pager) ([]*TableModel, string, error)
ListTables scans and returns all the tables for the parent database.
type ColumnGrant ¶
type ColumnGrant struct { Id string `db:"-"` User string `db:"User"` Host string `db:"Host"` Database string `db:"Db"` Table string `db:"Table_name"` Column string `db:"Column_name"` Privs string `db:"Column_priv"` }
func (*ColumnGrant) GetPrivs ¶
func (u *ColumnGrant) GetPrivs(ctx context.Context) map[string]struct{}
GetPrivs parses the columns grant data from mysql.
func (*ColumnGrant) TableID ¶
func (u *ColumnGrant) TableID() string