Documentation ¶
Index ¶
- Constants
- Variables
- func NewPrivilegedDatabase(grantTables *MySQLDb, db sql.Database, authHandler sql.AuthorizationHandler) sql.Database
- func NewPrivilegedDatabaseProvider(grantTables *MySQLDb, p sql.DatabaseProvider, ...) sql.DatabaseProvider
- func NewReplicaSourceInfoIndexedSetTable(lock, rlock sync.Locker) *in_mem_table.IndexedSetTable[*ReplicaSourceInfo]
- func NewRoleEdgesIndexedSetTable(lock, rlock sync.Locker) *in_mem_table.IndexedSetTable[*RoleEdge]
- func NewUserDBIndexedSetTable(set in_mem_table.IndexedSet[*User], lock, rlock sync.Locker) *in_mem_table.MultiIndexedSetTable[*User]
- func NewUserGlobalGrantsIndexedSetTable(set in_mem_table.IndexedSet[*User], lock, rlock sync.Locker) *in_mem_table.MultiIndexedSetTable[*User]
- func NewUserIndexedSetTable(lock, rlock sync.Locker) (in_mem_table.IndexedSet[*User], *in_mem_table.IndexedSetTable[*User])
- func NewUserProcsIndexedSetTable(set in_mem_table.IndexedSet[*User], lock, rlock sync.Locker) *in_mem_table.MultiIndexedSetTable[*User]
- func NewUserTablesIndexedSetTable(set in_mem_table.IndexedSet[*User], lock, rlock sync.Locker) *in_mem_table.MultiIndexedSetTable[*User]
- func ReplicaSourceInfoEquals(left, right *ReplicaSourceInfo) bool
- func ReplicaSourceInfoToRow(ctx *sql.Context, v *ReplicaSourceInfo) (sql.Row, error)
- func RoleEdgeEquals(left, right *RoleEdge) bool
- func RoleEdgeToRow(ctx *sql.Context, r *RoleEdge) (sql.Row, error)
- func UserEquals(left, right *User) bool
- func UserToDBRows(ctx *sql.Context, u *User) ([]sql.Row, error)
- func UserToGlobalGrantsRows(ctx *sql.Context, user *User) ([]sql.Row, error)
- func UserToProcsPrivRows(ctx *sql.Context, user *User) ([]sql.Row, error)
- func UserToRow(ctx *sql.Context, u *User) (sql.Row, error)
- func UserToTablesRows(ctx *sql.Context, user *User) ([]sql.Row, error)
- type Editor
- func (ed *Editor) Close()
- func (ed *Editor) GetReplicaSourceInfo(k ReplicaSourceInfoPrimaryKey) (res *ReplicaSourceInfo, ok bool)
- func (ed *Editor) GetToUserRoleEdges(key RoleEdgesToKey) []*RoleEdge
- func (ed *Editor) GetUser(u UserPrimaryKey) (res *User, ok bool)
- func (ed *Editor) GetUsersByUsername(username string) []*User
- func (ed *Editor) PutReplicaSourceInfo(rsi *ReplicaSourceInfo)
- func (ed *Editor) PutRoleEdge(re *RoleEdge)
- func (ed *Editor) PutUser(u *User)
- func (ed *Editor) RemoveReplicaSourceInfo(k ReplicaSourceInfoPrimaryKey)
- func (ed *Editor) RemoveRoleEdge(pk RoleEdgesPrimaryKey)
- func (ed *Editor) RemoveRoleEdgesFromKey(key RoleEdgesFromKey)
- func (ed *Editor) RemoveRoleEdgesToKey(key RoleEdgesToKey)
- func (ed *Editor) RemoveUser(pk UserPrimaryKey)
- func (ed *Editor) VisitReplicaSourceInfos(cb func(*ReplicaSourceInfo))
- func (ed *Editor) VisitRoleEdges(cb func(*RoleEdge))
- func (ed *Editor) VisitUsers(cb func(*User))
- type MySQLDb
- func (db *MySQLDb) AddRootAccount()
- func (db *MySQLDb) AddSuperUser(ed *Editor, username string, host string, password string)
- func (as MySQLDb) AuthMethods() []mysql.AuthMethod
- func (db MySQLDb) DefaultAuthMethodDescription() mysql.AuthMethodDescription
- func (db *MySQLDb) Editor() *Editor
- func (db *MySQLDb) Enabled() bool
- func (db *MySQLDb) GetTableInsensitive(_ *sql.Context, tblName string) (sql.Table, bool, error)
- func (db *MySQLDb) GetTableNames(ctx *sql.Context) ([]string, error)
- func (db *MySQLDb) GetUser(fetcher UserFetcher, user string, host string, roleSearch bool) *User
- func (db *MySQLDb) LoadData(ctx *sql.Context, buf []byte) (err error)
- func (db *MySQLDb) LoadPrivilegeData(ctx *sql.Context, users []*User, roleConnections []*RoleEdge) error
- func (db *MySQLDb) Name() string
- func (db *MySQLDb) OverwriteUsersAndGrantData(ctx *sql.Context, ed *Editor, buf []byte) (err error)
- func (db *MySQLDb) Persist(ctx *sql.Context, ed *Editor) error
- func (db *MySQLDb) Reader() *Reader
- func (db *MySQLDb) RoutineAdminCheck(ctx *sql.Context, operations ...sql.PrivilegedOperation) bool
- func (db *MySQLDb) SetEnabled(v bool)
- func (db *MySQLDb) SetPersister(persister MySQLDbPersistence)
- func (db *MySQLDb) SetPlugins(plugins map[string]PlaintextAuthPlugin)
- func (db *MySQLDb) UserActivePrivilegeSet(ctx *sql.Context) PrivilegeSet
- func (db *MySQLDb) UserHasPrivileges(ctx *sql.Context, operations ...sql.PrivilegedOperation) bool
- func (db *MySQLDb) ValidateHash(salt []byte, user string, authResponse []byte, addr net.Addr) (mysql.Getter, error)
- func (db *MySQLDb) VerifyPlugin(plugin string) error
- type MySQLDbPersistence
- type NoopPersister
- type PlaintextAuthPlugin
- type PrivilegeSet
- func (ps PrivilegeSet) AddColumn(dbName string, tblName string, colName string, privileges ...sql.PrivilegeType)
- func (ps PrivilegeSet) AddDatabase(dbName string, privileges ...sql.PrivilegeType)
- func (ps PrivilegeSet) AddGlobalDynamic(withGrantOption bool, privileges ...string)
- func (ps PrivilegeSet) AddGlobalStatic(privileges ...sql.PrivilegeType)
- func (ps PrivilegeSet) AddRoutine(dbName string, procName string, isProc bool, privileges ...sql.PrivilegeType)
- func (ps PrivilegeSet) AddTable(dbName string, tblName string, privileges ...sql.PrivilegeType)
- func (ps *PrivilegeSet) ClearAll()
- func (ps PrivilegeSet) ClearColumn(dbName string, tblName string, colName string)
- func (ps PrivilegeSet) ClearDatabase(dbName string)
- func (ps *PrivilegeSet) ClearGlobal()
- func (ps PrivilegeSet) ClearRoutine(dbName string, procName string, isProc bool)
- func (ps PrivilegeSet) ClearTable(dbName string, tblName string)
- func (ps PrivilegeSet) Copy() PrivilegeSet
- func (ps PrivilegeSet) Count() int
- func (ps PrivilegeSet) Database(dbName string) sql.PrivilegeSetDatabase
- func (ps PrivilegeSet) Equals(otherPrivSet sql.PrivilegeSet) bool
- func (ps PrivilegeSet) GetDatabases() []sql.PrivilegeSetDatabase
- func (ps PrivilegeSet) GlobalCount() int
- func (ps PrivilegeSet) Has(privileges ...sql.PrivilegeType) bool
- func (ps PrivilegeSet) HasDynamic(privileges ...string) bool
- func (ps PrivilegeSet) HasPrivileges() bool
- func (ps PrivilegeSet) MarshalJSON() ([]byte, error)
- func (ps PrivilegeSet) RemoveColumn(dbName string, tblName string, colName string, privileges ...sql.PrivilegeType)
- func (ps PrivilegeSet) RemoveDatabase(dbName string, privileges ...sql.PrivilegeType)
- func (ps PrivilegeSet) RemoveGlobalDynamic(privileges ...string)
- func (ps PrivilegeSet) RemoveGlobalStatic(privileges ...sql.PrivilegeType)
- func (ps PrivilegeSet) RemoveRoutine(dbName string, procName string, isProc bool, privileges ...sql.PrivilegeType)
- func (ps PrivilegeSet) RemoveTable(dbName string, tblName string, privileges ...sql.PrivilegeType)
- func (ps PrivilegeSet) ToSlice() []sql.PrivilegeType
- func (ps PrivilegeSet) ToSliceDynamic(withGrantOption bool) []string
- func (ps PrivilegeSet) UnionWith(other PrivilegeSet)
- func (ps *PrivilegeSet) UnmarshalJSON(jsonData []byte) error
- type PrivilegeSetColumn
- func (ps PrivilegeSetColumn) Count() int
- func (ps PrivilegeSetColumn) Equals(otherPsc sql.PrivilegeSetColumn) bool
- func (ps PrivilegeSetColumn) Has(privileges ...sql.PrivilegeType) bool
- func (ps PrivilegeSetColumn) HasPrivileges() bool
- func (ps PrivilegeSetColumn) Name() string
- func (ps PrivilegeSetColumn) ToSlice() []sql.PrivilegeType
- type PrivilegeSetDatabase
- func (ps PrivilegeSetDatabase) Count() int
- func (ps PrivilegeSetDatabase) Equals(otherPsd sql.PrivilegeSetDatabase) bool
- func (ps PrivilegeSetDatabase) GetRoutines() []sql.PrivilegeSetRoutine
- func (ps PrivilegeSetDatabase) GetTables() []sql.PrivilegeSetTable
- func (ps PrivilegeSetDatabase) Has(privileges ...sql.PrivilegeType) bool
- func (ps PrivilegeSetDatabase) HasPrivileges() bool
- func (ps PrivilegeSetDatabase) Name() string
- func (ps PrivilegeSetDatabase) Routine(routineName string, isProc bool) sql.PrivilegeSetRoutine
- func (ps PrivilegeSetDatabase) Table(tblName string) sql.PrivilegeSetTable
- func (ps PrivilegeSetDatabase) ToSlice() []sql.PrivilegeType
- type PrivilegeSetRoutine
- func (ps PrivilegeSetRoutine) Count() int
- func (ps PrivilegeSetRoutine) Equals(otherPs sql.PrivilegeSetRoutine) bool
- func (ps PrivilegeSetRoutine) Has(privileges ...sql.PrivilegeType) bool
- func (ps PrivilegeSetRoutine) HasPrivileges() bool
- func (ps PrivilegeSetRoutine) RoutineName() string
- func (ps PrivilegeSetRoutine) RoutineType() string
- func (ps PrivilegeSetRoutine) ToSlice() []sql.PrivilegeType
- type PrivilegeSetTable
- func (ps PrivilegeSetTable) Column(colName string) sql.PrivilegeSetColumn
- func (ps PrivilegeSetTable) Count() int
- func (ps PrivilegeSetTable) Equals(otherPst sql.PrivilegeSetTable) bool
- func (ps PrivilegeSetTable) GetColumns() []sql.PrivilegeSetColumn
- func (ps PrivilegeSetTable) Has(privileges ...sql.PrivilegeType) bool
- func (ps PrivilegeSetTable) HasPrivileges() bool
- func (ps PrivilegeSetTable) Name() string
- func (ps PrivilegeSetTable) ToSlice() []sql.PrivilegeType
- type PrivilegedDatabase
- func (pdb PrivilegedDatabase) AllViews(ctx *sql.Context) ([]sql.ViewDefinition, error)
- func (pdb PrivilegedDatabase) CopyTableData(ctx *sql.Context, sourceTable string, destinationTable string) (uint64, error)
- func (pdb PrivilegedDatabase) CreateFulltextTableNames(ctx *sql.Context, parentTable string, parentIndexName string) (fulltext.IndexTableNames, error)
- func (pdb PrivilegedDatabase) CreateTable(ctx *sql.Context, name string, schema sql.PrimaryKeySchema, ...) error
- func (pdb PrivilegedDatabase) CreateTrigger(ctx *sql.Context, definition sql.TriggerDefinition) error
- func (pdb PrivilegedDatabase) CreateView(ctx *sql.Context, name string, selectStatement, createViewStmt string) error
- func (pdb PrivilegedDatabase) DropEvent(ctx *sql.Context, name string) error
- func (pdb PrivilegedDatabase) DropStoredProcedure(ctx *sql.Context, name string) error
- func (pdb PrivilegedDatabase) DropTable(ctx *sql.Context, name string) error
- func (pdb PrivilegedDatabase) DropTrigger(ctx *sql.Context, name string) error
- func (pdb PrivilegedDatabase) DropView(ctx *sql.Context, name string) error
- func (pdb PrivilegedDatabase) GetAllTemporaryTables(ctx *sql.Context) ([]sql.Table, error)
- func (pdb PrivilegedDatabase) GetCollation(ctx *sql.Context) sql.CollationID
- func (pdb PrivilegedDatabase) GetEvent(ctx *sql.Context, name string) (sql.EventDefinition, bool, error)
- func (pdb PrivilegedDatabase) GetEvents(ctx *sql.Context) ([]sql.EventDefinition, interface{}, error)
- func (pdb PrivilegedDatabase) GetStoredProcedure(ctx *sql.Context, name string) (sql.StoredProcedureDetails, bool, error)
- func (pdb PrivilegedDatabase) GetStoredProcedures(ctx *sql.Context) ([]sql.StoredProcedureDetails, error)
- func (pdb PrivilegedDatabase) GetTableInsensitive(ctx *sql.Context, tblName string) (sql.Table, bool, error)
- func (pdb PrivilegedDatabase) GetTableInsensitiveAsOf(ctx *sql.Context, tblName string, asOf interface{}) (sql.Table, bool, error)
- func (pdb PrivilegedDatabase) GetTableNames(ctx *sql.Context) ([]string, error)
- func (pdb PrivilegedDatabase) GetTableNamesAsOf(ctx *sql.Context, asOf interface{}) ([]string, error)
- func (pdb PrivilegedDatabase) GetTriggers(ctx *sql.Context) ([]sql.TriggerDefinition, error)
- func (pdb PrivilegedDatabase) GetViewDefinition(ctx *sql.Context, viewName string) (sql.ViewDefinition, bool, error)
- func (pdb PrivilegedDatabase) IsReadOnly() bool
- func (pdb PrivilegedDatabase) Name() string
- func (pdb PrivilegedDatabase) NeedsToReloadEvents(ctx *sql.Context, token interface{}) (bool, error)
- func (pdb PrivilegedDatabase) RenameTable(ctx *sql.Context, oldName, newName string) error
- func (pdb PrivilegedDatabase) SaveEvent(ctx *sql.Context, ed sql.EventDefinition) (bool, error)
- func (pdb PrivilegedDatabase) SaveStoredProcedure(ctx *sql.Context, spd sql.StoredProcedureDetails) error
- func (pdb PrivilegedDatabase) SetCollation(ctx *sql.Context, collation sql.CollationID) error
- func (pdb PrivilegedDatabase) Unwrap() sql.Database
- func (pdb PrivilegedDatabase) UpdateEvent(ctx *sql.Context, originalName string, ed sql.EventDefinition) (bool, error)
- func (pdb PrivilegedDatabase) UpdateLastExecuted(ctx *sql.Context, eventName string, lastExecuted time.Time) error
- type PrivilegedDatabaseProvider
- type Reader
- func (r *Reader) Close()
- func (r *Reader) GetReplicaSourceInfo(k ReplicaSourceInfoPrimaryKey) (res *ReplicaSourceInfo, ok bool)
- func (r *Reader) GetToUserRoleEdges(key RoleEdgesToKey) []*RoleEdge
- func (r *Reader) GetUser(u UserPrimaryKey) (res *User, ok bool)
- func (r *Reader) GetUsersByUsername(username string) []*User
- func (r *Reader) VisitReplicaSourceInfos(cb func(*ReplicaSourceInfo))
- func (r *Reader) VisitRoleEdges(cb func(*RoleEdge))
- func (r *Reader) VisitUsers(cb func(*User))
- type ReplicaSourceInfo
- type ReplicaSourceInfoPrimaryKey
- type ReplicaSourceInfoPrimaryKeyer
- type RoleEdge
- type RoleEdgeFromKeyer
- type RoleEdgePrimaryKeyer
- type RoleEdgeToKeyer
- type RoleEdgesFromKey
- type RoleEdgesPrimaryKey
- type RoleEdgesToKey
- type User
- func LoadUser(serialUser *serial.User) *User
- func UserAddDBRow(ctx *sql.Context, row sql.Row, user *User) (*User, error)
- func UserAddGlobalGrantsRow(ctx *sql.Context, row sql.Row, user *User) (*User, error)
- func UserAddProcsPrivRow(ctx *sql.Context, row sql.Row, user *User) (*User, error)
- func UserAddTablesRow(ctx *sql.Context, row sql.Row, user *User) (*User, error)
- func UserCopy(u *User) *User
- func UserFromDBRow(ctx *sql.Context, row sql.Row) (*User, error)
- func UserFromGlobalGrantsRow(ctx *sql.Context, row sql.Row) (*User, error)
- func UserFromProcsPrivRow(ctx *sql.Context, row sql.Row) (*User, error)
- func UserFromRow(ctx *sql.Context, row sql.Row) (*User, error)
- func UserFromTablesRow(ctx *sql.Context, row sql.Row) (*User, error)
- func UserRemoveDBRow(ctx *sql.Context, row sql.Row, user *User) (*User, error)
- func UserRemoveGlobalGrantsRow(ctx *sql.Context, row sql.Row, user *User) (*User, error)
- func UserRemoveProcsPrivRow(ctx *sql.Context, row sql.Row, user *User) (*User, error)
- func UserRemoveTablesRow(ctx *sql.Context, row sql.Row, user *User) (*User, error)
- func UserUpdateWithRow(ctx *sql.Context, row sql.Row, u *User) (*User, error)
- type UserFetcher
- type UserPrimaryKey
- type UserPrimaryKeyer
- type UserSecondaryKey
- type UserSecondaryKeyer
Constants ¶
const DefaultAuthMethod = mysql.MysqlNativePassword
DefaultAuthMethod specifies the MySQL auth protocol (e.g. mysql_native_password, caching_sha2_password) that is used by default. When the auth server advertises what auth protocol it prefers, as part of the auth handshake, it is controlled by this constant. When a new user is created, if no auth plugin is specified, this auth method will be used.
Variables ¶
var ReplicaSourceInfoOps = in_mem_table.ValueOps[*ReplicaSourceInfo]{ ToRow: ReplicaSourceInfoToRow, FromRow: ReplicaSourceInfoFromRow, UpdateWithRow: func(ctx *sql.Context, row sql.Row, e *ReplicaSourceInfo) (*ReplicaSourceInfo, error) { return ReplicaSourceInfoFromRow(ctx, row) }, }
var RoleEdgeOps = in_mem_table.ValueOps[*RoleEdge]{ ToRow: RoleEdgeToRow, FromRow: RoleEdgeFromRow, UpdateWithRow: func(ctx *sql.Context, row sql.Row, e *RoleEdge) (*RoleEdge, error) { return RoleEdgeFromRow(ctx, row) }, }
var UserOps = in_mem_table.ValueOps[*User]{ ToRow: UserToRow, FromRow: UserFromRow, UpdateWithRow: UserUpdateWithRow, }
Functions ¶
func NewPrivilegedDatabase ¶
func NewPrivilegedDatabase(grantTables *MySQLDb, db sql.Database, authHandler sql.AuthorizationHandler) sql.Database
NewPrivilegedDatabase returns a new PrivilegedDatabase.
func NewPrivilegedDatabaseProvider ¶
func NewPrivilegedDatabaseProvider(grantTables *MySQLDb, p sql.DatabaseProvider, authHandler sql.AuthorizationHandler) sql.DatabaseProvider
NewPrivilegedDatabaseProvider returns a new PrivilegedDatabaseProvider. As a sql.DatabaseProvider may be added to an analyzer when Grant Tables are disabled (and Grant Tables may be enabled or disabled at any time), a new PrivilegedDatabaseProvider is returned whenever the sql.DatabaseProvider is needed (as long as Grant Tables are enabled) rather than wrapping a sql.DatabaseProvider when it is provided to the analyzer.
func NewReplicaSourceInfoIndexedSetTable ¶ added in v0.17.0
func NewReplicaSourceInfoIndexedSetTable(lock, rlock sync.Locker) *in_mem_table.IndexedSetTable[*ReplicaSourceInfo]
func NewRoleEdgesIndexedSetTable ¶ added in v0.17.0
func NewRoleEdgesIndexedSetTable(lock, rlock sync.Locker) *in_mem_table.IndexedSetTable[*RoleEdge]
func NewUserDBIndexedSetTable ¶ added in v0.17.0
func NewUserDBIndexedSetTable(set in_mem_table.IndexedSet[*User], lock, rlock sync.Locker) *in_mem_table.MultiIndexedSetTable[*User]
func NewUserGlobalGrantsIndexedSetTable ¶ added in v0.17.0
func NewUserGlobalGrantsIndexedSetTable(set in_mem_table.IndexedSet[*User], lock, rlock sync.Locker) *in_mem_table.MultiIndexedSetTable[*User]
func NewUserIndexedSetTable ¶ added in v0.17.0
func NewUserIndexedSetTable(lock, rlock sync.Locker) (in_mem_table.IndexedSet[*User], *in_mem_table.IndexedSetTable[*User])
func NewUserProcsIndexedSetTable ¶ added in v0.18.0
func NewUserProcsIndexedSetTable(set in_mem_table.IndexedSet[*User], lock, rlock sync.Locker) *in_mem_table.MultiIndexedSetTable[*User]
func NewUserTablesIndexedSetTable ¶ added in v0.17.0
func NewUserTablesIndexedSetTable(set in_mem_table.IndexedSet[*User], lock, rlock sync.Locker) *in_mem_table.MultiIndexedSetTable[*User]
func ReplicaSourceInfoEquals ¶ added in v0.17.0
func ReplicaSourceInfoEquals(left, right *ReplicaSourceInfo) bool
func ReplicaSourceInfoToRow ¶ added in v0.17.0
func RoleEdgeEquals ¶ added in v0.17.0
func RoleEdgeToRow ¶ added in v0.17.0
func UserEquals ¶ added in v0.17.0
func UserToDBRows ¶ added in v0.17.0
func UserToGlobalGrantsRows ¶ added in v0.17.0
func UserToProcsPrivRows ¶ added in v0.18.0
Types ¶
type Editor ¶ added in v0.17.0
type Editor struct {
// contains filtered or unexported fields
}
func (*Editor) GetReplicaSourceInfo ¶ added in v0.17.0
func (ed *Editor) GetReplicaSourceInfo(k ReplicaSourceInfoPrimaryKey) (res *ReplicaSourceInfo, ok bool)
func (*Editor) GetToUserRoleEdges ¶ added in v0.17.0
func (ed *Editor) GetToUserRoleEdges(key RoleEdgesToKey) []*RoleEdge
func (*Editor) GetUser ¶ added in v0.17.0
func (ed *Editor) GetUser(u UserPrimaryKey) (res *User, ok bool)
func (*Editor) GetUsersByUsername ¶ added in v0.17.0
func (*Editor) PutReplicaSourceInfo ¶ added in v0.17.0
func (ed *Editor) PutReplicaSourceInfo(rsi *ReplicaSourceInfo)
func (*Editor) PutRoleEdge ¶ added in v0.17.0
func (*Editor) RemoveReplicaSourceInfo ¶ added in v0.17.0
func (ed *Editor) RemoveReplicaSourceInfo(k ReplicaSourceInfoPrimaryKey)
func (*Editor) RemoveRoleEdge ¶ added in v0.17.0
func (ed *Editor) RemoveRoleEdge(pk RoleEdgesPrimaryKey)
func (*Editor) RemoveRoleEdgesFromKey ¶ added in v0.17.0
func (ed *Editor) RemoveRoleEdgesFromKey(key RoleEdgesFromKey)
func (*Editor) RemoveRoleEdgesToKey ¶ added in v0.17.0
func (ed *Editor) RemoveRoleEdgesToKey(key RoleEdgesToKey)
func (*Editor) RemoveUser ¶ added in v0.17.0
func (ed *Editor) RemoveUser(pk UserPrimaryKey)
func (*Editor) VisitReplicaSourceInfos ¶ added in v0.17.0
func (ed *Editor) VisitReplicaSourceInfos(cb func(*ReplicaSourceInfo))
func (*Editor) VisitRoleEdges ¶ added in v0.17.0
func (*Editor) VisitUsers ¶ added in v0.17.0
type MySQLDb ¶
type MySQLDb struct {
// contains filtered or unexported fields
}
MySQLDb are the collection of tables that are in the MySQL database
func CreateEmptyMySQLDb ¶
func CreateEmptyMySQLDb() *MySQLDb
CreateEmptyMySQLDb returns a collection of MySQL Tables that do not contain any data.
func (*MySQLDb) AddRootAccount ¶
func (db *MySQLDb) AddRootAccount()
AddRootAccount adds the root account to the list of accounts.
func (*MySQLDb) AddSuperUser ¶
AddSuperUser adds the given username and password to the list of accounts. This is a temporary function, which is meant to replace the "auth.New..." functions while the remaining functions are added.
func (MySQLDb) AuthMethods ¶ added in v0.19.0
func (as MySQLDb) AuthMethods() []mysql.AuthMethod
AuthMethods implements the mysql.AuthServer interface.
func (MySQLDb) DefaultAuthMethodDescription ¶ added in v0.19.0
func (db MySQLDb) DefaultAuthMethodDescription() mysql.AuthMethodDescription
DefaultAuthMethodDescription implements the mysql.AuthServer interface.
func (*MySQLDb) GetTableInsensitive ¶
GetTableInsensitive implements the interface sql.Database.
func (*MySQLDb) GetTableNames ¶
GetTableNames implements the interface sql.Database.
func (*MySQLDb) GetUser ¶
GetUser returns a user matching the given user and host if it exists. Due to the slight difference between users and roles, roleSearch changes whether the search matches against user or role rules.
func (*MySQLDb) LoadData ¶
LoadData adds the given data to the MySQL Tables. It does not remove any current data, but will overwrite any pre-existing data.
func (*MySQLDb) LoadPrivilegeData ¶
func (db *MySQLDb) LoadPrivilegeData(ctx *sql.Context, users []*User, roleConnections []*RoleEdge) error
LoadPrivilegeData adds the given data to the MySQL Tables. It does not remove any current data, but will overwrite any pre-existing data. This has been deprecated in favor of LoadData.
func (*MySQLDb) OverwriteUsersAndGrantData ¶ added in v0.17.0
OverwriteUsersAndGrantData replaces the users and grant data served by this MySQL DB instance with the data which is present in the provided byte buffer, which is a persisted copy of a MySQLDb created with `Persist`. In contrast to LoadData, it *does* remove current data in the database.
This interface is appropriate for replication, when a replica needs to be brought up to date with a primary server.
This method does not support the legacy JSON serialization of users and grant data. In contrast to most methods which operate with persisted users and grants in *MySQLDb, this method _does_ restore persisted super users.
func (*MySQLDb) Persist ¶
Persist passes along all changes to the integrator.
This takes an Editor, instead of a Reader, since presumably we have just done a write. In any case, it's nice to not ACK a write until it is persisted, and the write lock which the Editor takes can help with not making these changes visible until it is persisted as well.
func (*MySQLDb) RoutineAdminCheck ¶ added in v0.18.0
RoutineAdminCheck fetches the User from the context, and specifically evaluates, the permission check assuming the operation is for a stored procedure or function. This allows us to have more fine grain control over permissions for stored procedures (many of which are critical to Dolt). This method specifically checks exists for the use of AdminOnly procedures which require more fine-grained access control. For procedures which are not AdminOnly, then |UserHasPrivileges| should be used instead.
func (*MySQLDb) SetEnabled ¶ added in v0.17.0
func (*MySQLDb) SetPersister ¶
func (db *MySQLDb) SetPersister(persister MySQLDbPersistence)
SetPersister sets the custom persister to be used when the MySQL Db tables have been updated and need to be persisted.
func (*MySQLDb) SetPlugins ¶ added in v0.14.0
func (db *MySQLDb) SetPlugins(plugins map[string]PlaintextAuthPlugin)
func (*MySQLDb) UserActivePrivilegeSet ¶
func (db *MySQLDb) UserActivePrivilegeSet(ctx *sql.Context) PrivilegeSet
UserActivePrivilegeSet fetches the User, and returns their entire active privilege set. This takes into account the active roles, which are set in the context, therefore the user is also pulled from the context.
func (*MySQLDb) UserHasPrivileges ¶
UserHasPrivileges fetches the User, and returns whether they have the desired privileges necessary to perform the privileged operation(s). This takes into account the active roles, which are set in the context, therefore both the user and the active roles are pulled from the context. This method is sufficient for all MySQL behaviors. The one exception, currently, is for stored procedures and functions, which have a more fine-grained permission due to Dolt's use of the AdminOnly flag in procedure definitions.
This functions implements the global/database/table|routine hierarchy of permissions. If a user has Execute permissions on the database, then they implicitly have that same permission on all tables and routines in that database. This is how all MySQL permissions work.
func (*MySQLDb) ValidateHash ¶
func (db *MySQLDb) ValidateHash(salt []byte, user string, authResponse []byte, addr net.Addr) (mysql.Getter, error)
ValidateHash was previously used as part of authentication, but is no longer used by the Vitess authentication logic. This method is still used by the sql util class in Dolt to authenticate a user connecting to a local Dolt sql-server by running a "dolt sql" command. TODO: The dolt sql utils.go code should be refactored to use a different API, so that we can delete this method.
func (*MySQLDb) VerifyPlugin ¶ added in v0.14.0
type MySQLDbPersistence ¶
MySQLDbPersistence is used to determine the behavior of how certain tables in MySQLDb will be persisted.
type NoopPersister ¶
type NoopPersister struct{}
NoopPersister is used when nothing in mysql db should be persisted
type PlaintextAuthPlugin ¶ added in v0.14.0
type PrivilegeSet ¶
type PrivilegeSet struct {
// contains filtered or unexported fields
}
PrivilegeSet is a set containing privileges. Due to the nested sets potentially returning empty sets, this also acts as the singular location to modify all nested sets.
func NewPrivilegeSet ¶
func NewPrivilegeSet() PrivilegeSet
NewPrivilegeSet returns a new PrivilegeSet.
func NewPrivilegeSetWithAllPrivileges ¶ added in v0.15.0
func NewPrivilegeSetWithAllPrivileges() PrivilegeSet
NewPrivilegeSetWithAllPrivileges returns a new PrivilegeSet with every global static privilege added.
func UserRowToPrivSet ¶ added in v0.17.0
func UserRowToPrivSet(ctx *sql.Context, row sql.Row) PrivilegeSet
func (PrivilegeSet) AddColumn ¶
func (ps PrivilegeSet) AddColumn(dbName string, tblName string, colName string, privileges ...sql.PrivilegeType)
AddColumn adds the given column privilege(s).
func (PrivilegeSet) AddDatabase ¶
func (ps PrivilegeSet) AddDatabase(dbName string, privileges ...sql.PrivilegeType)
AddDatabase adds the given database privilege(s).
func (PrivilegeSet) AddGlobalDynamic ¶
func (ps PrivilegeSet) AddGlobalDynamic(withGrantOption bool, privileges ...string)
AddGlobalDynamic adds the given global dynamic privilege(s).
func (PrivilegeSet) AddGlobalStatic ¶
func (ps PrivilegeSet) AddGlobalStatic(privileges ...sql.PrivilegeType)
AddGlobalStatic adds the given global static privilege(s).
func (PrivilegeSet) AddRoutine ¶ added in v0.18.0
func (ps PrivilegeSet) AddRoutine(dbName string, procName string, isProc bool, privileges ...sql.PrivilegeType)
func (PrivilegeSet) AddTable ¶
func (ps PrivilegeSet) AddTable(dbName string, tblName string, privileges ...sql.PrivilegeType)
AddTable adds the given table privilege(s).
func (PrivilegeSet) ClearColumn ¶
func (ps PrivilegeSet) ClearColumn(dbName string, tblName string, colName string)
ClearColumn removes all privileges for the given column.
func (PrivilegeSet) ClearDatabase ¶
func (ps PrivilegeSet) ClearDatabase(dbName string)
ClearDatabase removes all privileges for the given database.
func (*PrivilegeSet) ClearGlobal ¶
func (ps *PrivilegeSet) ClearGlobal()
ClearGlobal removes all global privileges.
func (PrivilegeSet) ClearRoutine ¶ added in v0.18.0
func (ps PrivilegeSet) ClearRoutine(dbName string, procName string, isProc bool)
func (PrivilegeSet) ClearTable ¶
func (ps PrivilegeSet) ClearTable(dbName string, tblName string)
ClearTable removes all privileges for the given table.
func (PrivilegeSet) Copy ¶
func (ps PrivilegeSet) Copy() PrivilegeSet
Copy returns a duplicate of the calling PrivilegeSet.
func (PrivilegeSet) Count ¶ added in v0.15.0
func (ps PrivilegeSet) Count() int
Count returns the number of global static privileges, while not including global dynamic privileges.
func (PrivilegeSet) Database ¶
func (ps PrivilegeSet) Database(dbName string) sql.PrivilegeSetDatabase
Database returns the set of privileges for the given database. Returns an empty set if the database does not exist.
func (PrivilegeSet) Equals ¶
func (ps PrivilegeSet) Equals(otherPrivSet sql.PrivilegeSet) bool
Equals returns whether the given set of privileges is equivalent to the calling set.
func (PrivilegeSet) GetDatabases ¶
func (ps PrivilegeSet) GetDatabases() []sql.PrivilegeSetDatabase
GetDatabases returns all databases.
func (PrivilegeSet) GlobalCount ¶
func (ps PrivilegeSet) GlobalCount() int
GlobalCount returns the combined number of global static and global dynamic privileges.
func (PrivilegeSet) Has ¶
func (ps PrivilegeSet) Has(privileges ...sql.PrivilegeType) bool
Has returns whether the given global static privilege(s) exists.
func (PrivilegeSet) HasDynamic ¶ added in v0.15.0
func (ps PrivilegeSet) HasDynamic(privileges ...string) bool
HasDynamic returns whether the given global dynamic privilege(s) exists.
func (PrivilegeSet) HasPrivileges ¶
func (ps PrivilegeSet) HasPrivileges() bool
HasPrivileges returns whether this PrivilegeSet has any privileges at any level.
func (PrivilegeSet) MarshalJSON ¶
func (ps PrivilegeSet) MarshalJSON() ([]byte, error)
MarshalJSON implements the interface json.Marshaler. This is deprecated functionality, as serialization has been replaced by flatbuffers.
func (PrivilegeSet) RemoveColumn ¶
func (ps PrivilegeSet) RemoveColumn(dbName string, tblName string, colName string, privileges ...sql.PrivilegeType)
RemoveColumn removes the given column privilege(s).
func (PrivilegeSet) RemoveDatabase ¶
func (ps PrivilegeSet) RemoveDatabase(dbName string, privileges ...sql.PrivilegeType)
RemoveDatabase removes the given database privilege(s).
func (PrivilegeSet) RemoveGlobalDynamic ¶
func (ps PrivilegeSet) RemoveGlobalDynamic(privileges ...string)
RemoveGlobalDynamic removes the given global dynamic privilege(s).
func (PrivilegeSet) RemoveGlobalStatic ¶
func (ps PrivilegeSet) RemoveGlobalStatic(privileges ...sql.PrivilegeType)
RemoveGlobalStatic removes the given global static privilege(s).
func (PrivilegeSet) RemoveRoutine ¶ added in v0.18.0
func (ps PrivilegeSet) RemoveRoutine(dbName string, procName string, isProc bool, privileges ...sql.PrivilegeType)
func (PrivilegeSet) RemoveTable ¶
func (ps PrivilegeSet) RemoveTable(dbName string, tblName string, privileges ...sql.PrivilegeType)
RemoveTable removes the given table privilege(s).
func (PrivilegeSet) ToSlice ¶
func (ps PrivilegeSet) ToSlice() []sql.PrivilegeType
ToSlice returns all of the global static privileges contained as a sorted slice.
func (PrivilegeSet) ToSliceDynamic ¶ added in v0.15.0
func (ps PrivilegeSet) ToSliceDynamic(withGrantOption bool) []string
ToSliceDynamic returns all of the global dynamic privileges that match the given "WITH GRANT OPTION". Privileges will be uppercase.
func (PrivilegeSet) UnionWith ¶
func (ps PrivilegeSet) UnionWith(other PrivilegeSet)
UnionWith merges the given set of privileges to the calling set of privileges.
func (*PrivilegeSet) UnmarshalJSON ¶
func (ps *PrivilegeSet) UnmarshalJSON(jsonData []byte) error
UnmarshalJSON implements the interface json.Unmarshaler. This is deprecated functionality, as serialization has been replaced by flatbuffers.
type PrivilegeSetColumn ¶
type PrivilegeSetColumn struct {
// contains filtered or unexported fields
}
PrivilegeSetColumn is a set containing column privileges.
func (PrivilegeSetColumn) Count ¶
func (ps PrivilegeSetColumn) Count() int
Count returns the number of column privileges.
func (PrivilegeSetColumn) Equals ¶
func (ps PrivilegeSetColumn) Equals(otherPsc sql.PrivilegeSetColumn) bool
Equals returns whether the given set of privileges is equivalent to the calling set.
func (PrivilegeSetColumn) Has ¶
func (ps PrivilegeSetColumn) Has(privileges ...sql.PrivilegeType) bool
Has returns whether the given column privilege(s) exists.
func (PrivilegeSetColumn) HasPrivileges ¶ added in v0.18.0
func (ps PrivilegeSetColumn) HasPrivileges() bool
HasPrivileges returns whether this column has any privileges.
func (PrivilegeSetColumn) Name ¶
func (ps PrivilegeSetColumn) Name() string
Name returns the name of the column that this privilege set belongs to.
func (PrivilegeSetColumn) ToSlice ¶
func (ps PrivilegeSetColumn) ToSlice() []sql.PrivilegeType
ToSlice returns all of the column privileges contained as a sorted slice.
type PrivilegeSetDatabase ¶
type PrivilegeSetDatabase struct {
// contains filtered or unexported fields
}
PrivilegeSetDatabase is a set containing database-level privileges.
func (PrivilegeSetDatabase) Count ¶
func (ps PrivilegeSetDatabase) Count() int
Count returns the number of database privileges.
func (PrivilegeSetDatabase) Equals ¶
func (ps PrivilegeSetDatabase) Equals(otherPsd sql.PrivilegeSetDatabase) bool
Equals returns whether the given set of privileges is equivalent to the calling set.
func (PrivilegeSetDatabase) GetRoutines ¶ added in v0.18.0
func (ps PrivilegeSetDatabase) GetRoutines() []sql.PrivilegeSetRoutine
GetRoutines returns all routines.
func (PrivilegeSetDatabase) GetTables ¶
func (ps PrivilegeSetDatabase) GetTables() []sql.PrivilegeSetTable
GetTables returns all tables.
func (PrivilegeSetDatabase) Has ¶
func (ps PrivilegeSetDatabase) Has(privileges ...sql.PrivilegeType) bool
Has returns whether the given database privilege(s) exists.
func (PrivilegeSetDatabase) HasPrivileges ¶
func (ps PrivilegeSetDatabase) HasPrivileges() bool
HasPrivileges returns whether this database has either database-level privileges, or privileges on a table or column contained within this database.
func (PrivilegeSetDatabase) Name ¶
func (ps PrivilegeSetDatabase) Name() string
Name returns the name of the database that this privilege set belongs to.
func (PrivilegeSetDatabase) Routine ¶ added in v0.18.0
func (ps PrivilegeSetDatabase) Routine(routineName string, isProc bool) sql.PrivilegeSetRoutine
Routine returns the set of privileges for the given procedure or function
func (PrivilegeSetDatabase) Table ¶
func (ps PrivilegeSetDatabase) Table(tblName string) sql.PrivilegeSetTable
Table returns the set of privileges for the given table. Returns an empty set if the table does not exist.
func (PrivilegeSetDatabase) ToSlice ¶
func (ps PrivilegeSetDatabase) ToSlice() []sql.PrivilegeType
ToSlice returns all of the database privileges contained as a sorted slice.
type PrivilegeSetRoutine ¶ added in v0.18.0
type PrivilegeSetRoutine struct {
// contains filtered or unexported fields
}
func (PrivilegeSetRoutine) Count ¶ added in v0.18.0
func (ps PrivilegeSetRoutine) Count() int
Count returns the number of routine privileges.
func (PrivilegeSetRoutine) Equals ¶ added in v0.18.0
func (ps PrivilegeSetRoutine) Equals(otherPs sql.PrivilegeSetRoutine) bool
Equals returns whether the given set of privileges is equivalent to the calling set.
func (PrivilegeSetRoutine) Has ¶ added in v0.18.0
func (ps PrivilegeSetRoutine) Has(privileges ...sql.PrivilegeType) bool
Has returns whether the given column privilege(s) exists.
func (PrivilegeSetRoutine) HasPrivileges ¶ added in v0.18.0
func (ps PrivilegeSetRoutine) HasPrivileges() bool
HasPrivileges returns whether this routine has any privileges.
func (PrivilegeSetRoutine) RoutineName ¶ added in v0.18.0
func (ps PrivilegeSetRoutine) RoutineName() string
RoutineName returns the name of the routine that this privilege set belongs to.
func (PrivilegeSetRoutine) RoutineType ¶ added in v0.18.0
func (ps PrivilegeSetRoutine) RoutineType() string
RoutineType returns the type of routine this is (PROCEDURE or FUNCTION).
func (PrivilegeSetRoutine) ToSlice ¶ added in v0.18.0
func (ps PrivilegeSetRoutine) ToSlice() []sql.PrivilegeType
ToSlice returns all of the privileges contained as a sorted slice.
type PrivilegeSetTable ¶
type PrivilegeSetTable struct {
// contains filtered or unexported fields
}
PrivilegeSetTable is a set containing table-level privileges.
func (PrivilegeSetTable) Column ¶
func (ps PrivilegeSetTable) Column(colName string) sql.PrivilegeSetColumn
Column returns the set of privileges for the given column. Returns an empty set if the column does not exist.
func (PrivilegeSetTable) Count ¶
func (ps PrivilegeSetTable) Count() int
Count returns the number of table privileges.
func (PrivilegeSetTable) Equals ¶
func (ps PrivilegeSetTable) Equals(otherPst sql.PrivilegeSetTable) bool
Equals returns whether the given set of privileges is equivalent to the calling set.
func (PrivilegeSetTable) GetColumns ¶
func (ps PrivilegeSetTable) GetColumns() []sql.PrivilegeSetColumn
GetColumns returns all columns.
func (PrivilegeSetTable) Has ¶
func (ps PrivilegeSetTable) Has(privileges ...sql.PrivilegeType) bool
Has returns whether the given table privilege(s) exists.
func (PrivilegeSetTable) HasPrivileges ¶
func (ps PrivilegeSetTable) HasPrivileges() bool
HasPrivileges returns whether this table has either table-level privileges, or privileges on a column contained within this table.
func (PrivilegeSetTable) Name ¶
func (ps PrivilegeSetTable) Name() string
Name returns the name of the table that this privilege set belongs to.
func (PrivilegeSetTable) ToSlice ¶
func (ps PrivilegeSetTable) ToSlice() []sql.PrivilegeType
ToSlice returns all of the table privileges contained as a sorted slice.
type PrivilegedDatabase ¶
type PrivilegedDatabase struct {
// contains filtered or unexported fields
}
PrivilegedDatabase is a wrapper around a normal sql.Database that takes a context's client's privileges into consideration when returning a sql.Table.
func (PrivilegedDatabase) AllViews ¶ added in v0.16.0
func (pdb PrivilegedDatabase) AllViews(ctx *sql.Context) ([]sql.ViewDefinition, error)
AllViews implements sql.ViewDatabase
func (PrivilegedDatabase) CopyTableData ¶
func (pdb PrivilegedDatabase) CopyTableData(ctx *sql.Context, sourceTable string, destinationTable string) (uint64, error)
CopyTableData implements the interface sql.TableCopierDatabase.
func (PrivilegedDatabase) CreateFulltextTableNames ¶ added in v0.17.0
func (pdb PrivilegedDatabase) CreateFulltextTableNames(ctx *sql.Context, parentTable string, parentIndexName string) (fulltext.IndexTableNames, error)
CreateFulltextTableNames implements the interface fulltext.Database.
func (PrivilegedDatabase) CreateTable ¶
func (pdb PrivilegedDatabase) CreateTable(ctx *sql.Context, name string, schema sql.PrimaryKeySchema, collation sql.CollationID, comment string) error
CreateTable implements the interface sql.TableCreator.
func (PrivilegedDatabase) CreateTrigger ¶
func (pdb PrivilegedDatabase) CreateTrigger(ctx *sql.Context, definition sql.TriggerDefinition) error
CreateTrigger implements the interface sql.TriggerDatabase.
func (PrivilegedDatabase) CreateView ¶ added in v0.16.0
func (pdb PrivilegedDatabase) CreateView(ctx *sql.Context, name string, selectStatement, createViewStmt string) error
CreateView implements sql.ViewDatabase
func (PrivilegedDatabase) DropEvent ¶ added in v0.15.0
func (pdb PrivilegedDatabase) DropEvent(ctx *sql.Context, name string) error
DropEvent implements sql.EventDatabase
func (PrivilegedDatabase) DropStoredProcedure ¶
func (pdb PrivilegedDatabase) DropStoredProcedure(ctx *sql.Context, name string) error
DropStoredProcedure implements the interface sql.StoredProcedureDatabase.
func (PrivilegedDatabase) DropTable ¶
func (pdb PrivilegedDatabase) DropTable(ctx *sql.Context, name string) error
DropTable implements the interface sql.TableDropper.
func (PrivilegedDatabase) DropTrigger ¶
func (pdb PrivilegedDatabase) DropTrigger(ctx *sql.Context, name string) error
DropTrigger implements the interface sql.TriggerDatabase.
func (PrivilegedDatabase) DropView ¶ added in v0.16.0
func (pdb PrivilegedDatabase) DropView(ctx *sql.Context, name string) error
DropView implements sql.ViewDatabase
func (PrivilegedDatabase) GetAllTemporaryTables ¶
GetAllTemporaryTables implements the interface sql.TemporaryTableDatabase.
func (PrivilegedDatabase) GetCollation ¶ added in v0.14.0
func (pdb PrivilegedDatabase) GetCollation(ctx *sql.Context) sql.CollationID
GetCollation implements the interface sql.CollatedDatabase.
func (PrivilegedDatabase) GetEvent ¶ added in v0.15.0
func (pdb PrivilegedDatabase) GetEvent(ctx *sql.Context, name string) (sql.EventDefinition, bool, error)
GetEvent implements sql.EventDatabase
func (PrivilegedDatabase) GetEvents ¶ added in v0.15.0
func (pdb PrivilegedDatabase) GetEvents(ctx *sql.Context) ([]sql.EventDefinition, interface{}, error)
GetEvents implements sql.EventDatabase
func (PrivilegedDatabase) GetStoredProcedure ¶ added in v0.15.0
func (pdb PrivilegedDatabase) GetStoredProcedure(ctx *sql.Context, name string) (sql.StoredProcedureDetails, bool, error)
GetStoredProcedure implements the interface sql.StoredProcedureDatabase.
func (PrivilegedDatabase) GetStoredProcedures ¶
func (pdb PrivilegedDatabase) GetStoredProcedures(ctx *sql.Context) ([]sql.StoredProcedureDetails, error)
GetStoredProcedures implements the interface sql.StoredProcedureDatabase.
func (PrivilegedDatabase) GetTableInsensitive ¶
func (pdb PrivilegedDatabase) GetTableInsensitive(ctx *sql.Context, tblName string) (sql.Table, bool, error)
GetTableInsensitive implements the interface sql.Database.
func (PrivilegedDatabase) GetTableInsensitiveAsOf ¶
func (pdb PrivilegedDatabase) GetTableInsensitiveAsOf(ctx *sql.Context, tblName string, asOf interface{}) (sql.Table, bool, error)
GetTableInsensitiveAsOf returns a new sql.VersionedDatabase.
func (PrivilegedDatabase) GetTableNames ¶
func (pdb PrivilegedDatabase) GetTableNames(ctx *sql.Context) ([]string, error)
GetTableNames implements the interface sql.Database.
func (PrivilegedDatabase) GetTableNamesAsOf ¶
func (pdb PrivilegedDatabase) GetTableNamesAsOf(ctx *sql.Context, asOf interface{}) ([]string, error)
GetTableNamesAsOf returns a new sql.VersionedDatabase.
func (PrivilegedDatabase) GetTriggers ¶
func (pdb PrivilegedDatabase) GetTriggers(ctx *sql.Context) ([]sql.TriggerDefinition, error)
GetTriggers implements the interface sql.TriggerDatabase.
func (PrivilegedDatabase) GetViewDefinition ¶ added in v0.16.0
func (pdb PrivilegedDatabase) GetViewDefinition(ctx *sql.Context, viewName string) (sql.ViewDefinition, bool, error)
GetViewDefinition implements sql.ViewDatabase
func (PrivilegedDatabase) IsReadOnly ¶
func (pdb PrivilegedDatabase) IsReadOnly() bool
IsReadOnly implements the interface sql.ReadOnlyDatabase.
func (PrivilegedDatabase) Name ¶
func (pdb PrivilegedDatabase) Name() string
Name implements the interface sql.Database.
func (PrivilegedDatabase) NeedsToReloadEvents ¶ added in v0.18.0
func (pdb PrivilegedDatabase) NeedsToReloadEvents(ctx *sql.Context, token interface{}) (bool, error)
NeedsToReloadEvents implements sql.EventDatabase
func (PrivilegedDatabase) RenameTable ¶
func (pdb PrivilegedDatabase) RenameTable(ctx *sql.Context, oldName, newName string) error
RenameTable implements the interface sql.TableRenamer.
func (PrivilegedDatabase) SaveEvent ¶ added in v0.15.0
func (pdb PrivilegedDatabase) SaveEvent(ctx *sql.Context, ed sql.EventDefinition) (bool, error)
SaveEvent implements sql.EventDatabase
func (PrivilegedDatabase) SaveStoredProcedure ¶
func (pdb PrivilegedDatabase) SaveStoredProcedure(ctx *sql.Context, spd sql.StoredProcedureDetails) error
SaveStoredProcedure implements the interface sql.StoredProcedureDatabase.
func (PrivilegedDatabase) SetCollation ¶ added in v0.14.0
func (pdb PrivilegedDatabase) SetCollation(ctx *sql.Context, collation sql.CollationID) error
SetCollation implements the interface sql.CollatedDatabase.
func (PrivilegedDatabase) Unwrap ¶
func (pdb PrivilegedDatabase) Unwrap() sql.Database
Unwrap returns the wrapped sql.Database.
func (PrivilegedDatabase) UpdateEvent ¶ added in v0.15.0
func (pdb PrivilegedDatabase) UpdateEvent(ctx *sql.Context, originalName string, ed sql.EventDefinition) (bool, error)
UpdateEvent implements sql.EventDatabase
func (PrivilegedDatabase) UpdateLastExecuted ¶ added in v0.18.0
type PrivilegedDatabaseProvider ¶
type PrivilegedDatabaseProvider struct {
// contains filtered or unexported fields
}
PrivilegedDatabaseProvider is a wrapper around a normal sql.DatabaseProvider that takes a context's client's privileges into consideration when returning a sql.Database. In addition, any returned databases are wrapped with PrivilegedDatabase.
func (PrivilegedDatabaseProvider) AllDatabases ¶
func (pdp PrivilegedDatabaseProvider) AllDatabases(ctx *sql.Context) []sql.Database
AllDatabases implements the interface sql.DatabaseProvider.
func (PrivilegedDatabaseProvider) Database ¶
Database implements the interface sql.DatabaseProvider.
func (PrivilegedDatabaseProvider) HasDatabase ¶
func (pdp PrivilegedDatabaseProvider) HasDatabase(ctx *sql.Context, name string) bool
HasDatabase implements the interface sql.DatabaseProvider.
type Reader ¶ added in v0.17.0
type Reader struct {
// contains filtered or unexported fields
}
func (*Reader) GetReplicaSourceInfo ¶ added in v0.17.0
func (r *Reader) GetReplicaSourceInfo(k ReplicaSourceInfoPrimaryKey) (res *ReplicaSourceInfo, ok bool)
func (*Reader) GetToUserRoleEdges ¶ added in v0.17.0
func (r *Reader) GetToUserRoleEdges(key RoleEdgesToKey) []*RoleEdge
func (*Reader) GetUser ¶ added in v0.17.0
func (r *Reader) GetUser(u UserPrimaryKey) (res *User, ok bool)
func (*Reader) GetUsersByUsername ¶ added in v0.17.0
func (*Reader) VisitReplicaSourceInfos ¶ added in v0.17.0
func (r *Reader) VisitReplicaSourceInfos(cb func(*ReplicaSourceInfo))
func (*Reader) VisitRoleEdges ¶ added in v0.17.0
func (*Reader) VisitUsers ¶ added in v0.17.0
type ReplicaSourceInfo ¶ added in v0.15.0
type ReplicaSourceInfo struct { Host string User string Password string Port uint16 Uuid string ConnectRetryInterval uint32 ConnectRetryCount uint64 }
ReplicaSourceInfo represents the binlog replication metadata persisted in the mysql database. For more details, see: https://dev.mysql.com/doc/refman/8.0/en/replica-logs-status.html
func LoadReplicaSourceInfo ¶ added in v0.15.0
func LoadReplicaSourceInfo(serialReplicaSourceInfo *serial.ReplicaSourceInfo) *ReplicaSourceInfo
func NewReplicaSourceInfo ¶ added in v0.15.0
func NewReplicaSourceInfo() *ReplicaSourceInfo
NewReplicaSourceInfo constructs a new ReplicaSourceInfo instance, with defaults applied.
func ReplicaSourceInfoFromRow ¶ added in v0.17.0
func (*ReplicaSourceInfo) FromJson ¶ added in v0.15.0
func (r *ReplicaSourceInfo) FromJson(_ *sql.Context, jsonStr string) (*ReplicaSourceInfo, error)
FromJson implements the interface in_mem_table.Entry.
type ReplicaSourceInfoPrimaryKey ¶ added in v0.15.0
type ReplicaSourceInfoPrimaryKey struct {
Channel string
}
type ReplicaSourceInfoPrimaryKeyer ¶ added in v0.17.0
type ReplicaSourceInfoPrimaryKeyer struct{}
func (ReplicaSourceInfoPrimaryKeyer) GetKey ¶ added in v0.17.0
func (ReplicaSourceInfoPrimaryKeyer) GetKey(*ReplicaSourceInfo) any
type RoleEdge ¶
type RoleEdge struct { FromHost string FromUser string ToHost string ToUser string WithAdminOption bool }
RoleEdge represents a role to user mapping from the roles_edges Grant Table.
func LoadRoleEdge ¶
func RoleEdgeFromRow ¶ added in v0.17.0
func (*RoleEdge) FromString ¶
FromString returns the "FROM" user as a formatted string using the quotes given. Using the default root account with the backtick as the quote, root@localhost would become `root`@`localhost`. Different quotes are used in different places in MySQL. In addition, if the quote is used in a section as part of the name, it is escaped by doubling the quote (which also mimics MySQL behavior).
func (*RoleEdge) ToString ¶
ToString returns the "TO" user as a formatted string using the quotes given. Using the default root account with the backtick as the quote, root@localhost would become `root`@`localhost`. Different quotes are used in different places in MySQL. In addition, if the quote is used in a section as part of the name, it is escaped by doubling the quote (which also mimics MySQL behavior).
type RoleEdgeFromKeyer ¶ added in v0.17.0
type RoleEdgeFromKeyer struct{}
func (RoleEdgeFromKeyer) GetKey ¶ added in v0.17.0
func (RoleEdgeFromKeyer) GetKey(r *RoleEdge) any
type RoleEdgePrimaryKeyer ¶ added in v0.17.0
type RoleEdgePrimaryKeyer struct{}
func (RoleEdgePrimaryKeyer) GetKey ¶ added in v0.17.0
func (RoleEdgePrimaryKeyer) GetKey(r *RoleEdge) any
type RoleEdgeToKeyer ¶ added in v0.17.0
type RoleEdgeToKeyer struct{}
func (RoleEdgeToKeyer) GetKey ¶ added in v0.17.0
func (RoleEdgeToKeyer) GetKey(r *RoleEdge) any
type RoleEdgesFromKey ¶
RoleEdgesFromKey is a secondary key that represents the "from" columns on the "role_edges" Grant Table.
type RoleEdgesPrimaryKey ¶
RoleEdgesPrimaryKey is a key that represents the primary key for the "role_edges" Grant Table.
type RoleEdgesToKey ¶
RoleEdgesToKey is a secondary key that represents the "to" columns on the "role_edges" Grant Table.
type User ¶
type User struct { User string Host string PrivilegeSet PrivilegeSet Plugin string AuthString string PasswordLastChanged time.Time Locked bool Attributes *string Identity string IsSuperUser bool // IsRole is an additional field that states whether the User represents a role or user. In MySQL this must be a // hidden column, therefore it's represented here as an additional field. IsRole bool }
User represents a user from the user Grant Table.
func UserAddDBRow ¶ added in v0.17.0
func UserAddGlobalGrantsRow ¶ added in v0.17.0
func UserAddProcsPrivRow ¶ added in v0.18.0
func UserAddTablesRow ¶ added in v0.17.0
func UserFromDBRow ¶ added in v0.17.0
func UserFromGlobalGrantsRow ¶ added in v0.17.0
func UserFromProcsPrivRow ¶ added in v0.18.0
func UserFromTablesRow ¶ added in v0.17.0
func UserRemoveDBRow ¶ added in v0.17.0
func UserRemoveGlobalGrantsRow ¶ added in v0.17.0
func UserRemoveProcsPrivRow ¶ added in v0.18.0
func UserRemoveTablesRow ¶ added in v0.17.0
func UserUpdateWithRow ¶ added in v0.17.0
func (User) UserHostToString ¶
UserHostToString returns the user and host as a formatted string using the quotes given. Using the default root account with the backtick as the quote, root@localhost would become `root`@`localhost`. Different quotes are used in different places in MySQL. In addition, if the quote is used in a section as part of the name, it is escaped by doubling the quote (which also mimics MySQL behavior).
type UserFetcher ¶ added in v0.17.0
type UserFetcher interface { GetUser(u UserPrimaryKey) (res *User, ok bool) GetUsersByUsername(username string) []*User }
type UserPrimaryKey ¶
UserPrimaryKey is a key that represents the primary key for the "user" Grant Table.
type UserPrimaryKeyer ¶ added in v0.17.0
type UserPrimaryKeyer struct{}
func (UserPrimaryKeyer) GetKey ¶ added in v0.17.0
func (UserPrimaryKeyer) GetKey(u *User) any
type UserSecondaryKey ¶
type UserSecondaryKey struct {
User string
}
UserSecondaryKey is a key that represents the secondary key for the "user" Grant Table, which contains only usernames.
type UserSecondaryKeyer ¶ added in v0.17.0
type UserSecondaryKeyer struct{}
func (UserSecondaryKeyer) GetKey ¶ added in v0.17.0
func (UserSecondaryKeyer) GetKey(u *User) any
Source Files ¶
- auth.go
- db_table.go
- global_grants_table.go
- help_tables.go
- mysql_db.go
- mysql_db_load.go
- mysql_db_serialize.go
- mysql_table.go
- privilege_set.go
- privilege_set_json.go
- privileged_database_provider.go
- procs_priv.go
- replica_source_info.go
- replica_source_info_table.go
- role_edge.go
- role_edges_table.go
- tables_priv.go
- user.go
- user_table.go