Versions in this module Expand all Collapse all v1 v1.0.1 Jul 31, 2024 Changes in this version + var ReplicaSourceInfoOps = in_mem_table.ValueOps[*ReplicaSourceInfo] + var RoleEdgeOps = in_mem_table.ValueOps[*RoleEdge] + var UserOps = in_mem_table.ValueOps[*User] + func NewPrivilegedDatabase(grantTables *MySQLDb, db sql.Database) 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 struct + 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 struct + func CreateEmptyMySQLDb() *MySQLDb + func (db *MySQLDb) AddRootAccount() + func (db *MySQLDb) AddSuperUser(ed *Editor, username string, host string, password string) + func (db *MySQLDb) AuthMethod(user, addr string) (string, error) + 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) Negotiate(c *mysql.Conn, user string, addr net.Addr) (mysql.Getter, error) + 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) Salt() ([]byte, error) + 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 interface + Persist func(ctx *sql.Context, data []byte) error + type NoopPersister struct + func (p *NoopPersister) Persist(ctx *sql.Context, data []byte) error + type PlaintextAuthPlugin interface + Authenticate func(db *MySQLDb, user string, userEntry *User, pass string) (bool, error) + type PrivilegeSet struct + func NewPrivilegeSet() PrivilegeSet + func NewPrivilegeSetWithAllPrivileges() PrivilegeSet + func UserRowToPrivSet(ctx *sql.Context, row sql.Row) PrivilegeSet + func (ps *PrivilegeSet) ClearAll() + func (ps *PrivilegeSet) ClearGlobal() + func (ps *PrivilegeSet) UnmarshalJSON(jsonData []byte) error + 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) ClearColumn(dbName string, tblName string, colName string) + func (ps PrivilegeSet) ClearDatabase(dbName string) + 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) + type PrivilegeSetColumn struct + 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 struct + 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 struct + 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 struct + 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 struct + 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 struct + func (pdp PrivilegedDatabaseProvider) AllDatabases(ctx *sql.Context) []sql.Database + func (pdp PrivilegedDatabaseProvider) Database(ctx *sql.Context, name string) (sql.Database, error) + func (pdp PrivilegedDatabaseProvider) HasDatabase(ctx *sql.Context, name string) bool + type Reader struct + 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 struct + ConnectRetryCount uint64 + ConnectRetryInterval uint32 + Host string + Password string + Port uint16 + User string + Uuid string + func LoadReplicaSourceInfo(serialReplicaSourceInfo *serial.ReplicaSourceInfo) *ReplicaSourceInfo + func NewReplicaSourceInfo() *ReplicaSourceInfo + func ReplicaSourceInfoFromRow(ctx *sql.Context, row sql.Row) (*ReplicaSourceInfo, error) + func (r *ReplicaSourceInfo) FromJson(_ *sql.Context, jsonStr string) (*ReplicaSourceInfo, error) + func (r *ReplicaSourceInfo) ToJson(_ *sql.Context) (string, error) + type ReplicaSourceInfoPrimaryKey struct + Channel string + type ReplicaSourceInfoPrimaryKeyer struct + func (ReplicaSourceInfoPrimaryKeyer) GetKey(*ReplicaSourceInfo) any + type RoleEdge struct + FromHost string + FromUser string + ToHost string + ToUser string + WithAdminOption bool + func LoadRoleEdge(serialRoleEdge *serial.RoleEdge) *RoleEdge + func RoleEdgeFromRow(ctx *sql.Context, row sql.Row) (*RoleEdge, error) + func (r *RoleEdge) FromJson(ctx *sql.Context, jsonStr string) (*RoleEdge, error) + func (r *RoleEdge) FromString(quote string) string + func (r *RoleEdge) ToJson(ctx *sql.Context) (string, error) + func (r *RoleEdge) ToString(quote string) string + type RoleEdgeFromKeyer struct + func (RoleEdgeFromKeyer) GetKey(r *RoleEdge) any + type RoleEdgePrimaryKeyer struct + func (RoleEdgePrimaryKeyer) GetKey(r *RoleEdge) any + type RoleEdgeToKeyer struct + func (RoleEdgeToKeyer) GetKey(r *RoleEdge) any + type RoleEdgesFromKey struct + FromHost string + FromUser string + type RoleEdgesPrimaryKey struct + FromHost string + FromUser string + ToHost string + ToUser string + type RoleEdgesToKey struct + ToHost string + ToUser string + type User struct + Attributes *string + Host string + Identity string + IsRole bool + IsSuperUser bool + Locked bool + Password string + PasswordLastChanged time.Time + Plugin string + PrivilegeSet PrivilegeSet + User string + 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) + func (u *User) ToJson(ctx *sql.Context) (string, error) + func (u User) FromJson(ctx *sql.Context, jsonStr string) (*User, error) + func (u User) UserHostToString(quote string) string + type UserFetcher interface + GetUser func(u UserPrimaryKey) (res *User, ok bool) + GetUsersByUsername func(username string) []*User + type UserPrimaryKey struct + Host string + User string + type UserPrimaryKeyer struct + func (UserPrimaryKeyer) GetKey(u *User) any + type UserSecondaryKey struct + User string + type UserSecondaryKeyer struct + func (UserSecondaryKeyer) GetKey(u *User) any