Class ChUser
java.lang.Object
org.pgcodekeeper.core.database.base.schema.AbstractStatement
org.pgcodekeeper.core.database.ch.schema.ChAbstractStatement
org.pgcodekeeper.core.database.ch.schema.ChUser
- All Implemented Interfaces:
IStatement,IHashable
Represents a ClickHouse user account with authentication and authorization settings.
It supports hosts restrictions, role assignments, default database, and grantee configurations.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddDefRole(String defRole) Adds a default role for this user.voidaddExceptRole(String exceptRole) Adds a role to the EXCEPT list for default roles.voidaddExGrantee(String exGrantee) Adds a role to the EXCEPT list for grantees.voidaddGrantee(String grantee) Adds a grantee role for this user.voidAdds a host restriction for this user.appendAlterSQL(IStatement newCondition, SQLScript script) Fill script with object changes and return change typebooleancompare(IStatement obj) This method does not account for nested child PgStatements.voidcomputeHash(Hasher hasher) Computes the hash of the implementing object using the provided hasher.voidgetCreationSQL(SQLScript script) Generates the SQL statements needed to create this database object.Gets the type of this database object.booleanhasHosts()Checks if this user has host restrictions.voidsetDefaultDatabase(String defaultDatabase) voidsetStorageType(String storageType) Methods inherited from class org.pgcodekeeper.core.database.ch.schema.ChAbstractStatement
appendComments, appendOwnerSQL, formatSql, getQuoter, getRenameCommandMethods inherited from class org.pgcodekeeper.core.database.base.schema.AbstractStatement
addDependency, addPrivilege, appendAlterComments, appendPrivileges, canDrop, canDropBeforeCreate, checkComments, clearPrivileges, compareChildren, deepCopy, equals, fillChildrenList, fillDescendantsList, getAuthor, getBareName, getChildren, getComment, getDependencies, getDescendants, getDropSQL, getDropSQL, getLibName, getLocation, getName, getObjectState, getObjectState, getOwner, getParent, getPrivileges, getQualifiedName, getSeparator, getSQL, getTwin, hasChildren, hashCode, isLib, setAuthor, setComment, setLibName, setLocation, setOwner, setParent, shallowCopy, toStringMethods inherited from interface org.pgcodekeeper.core.database.api.schema.IStatement
getDatabase, getQuotedName, getTypeName, isOwned, quote, toObjectReference
-
Constructor Details
-
ChUser
Creates a new ClickHouse user with the specified name.- Parameters:
name- the name of the user
-
-
Method Details
-
getStatementType
Description copied from interface:IStatementGets the type of this database object.- Returns:
- the database object type
-
getCreationSQL
Description copied from interface:IStatementGenerates the SQL statements needed to create this database object. This is an abstract method that must be implemented by subclasses to provide the specific CREATE SQL for each object type.- Parameters:
script- the SQL script to append creation statements to
-
appendAlterSQL
Description copied from interface:IStatementFill script with object changes and return change type- Parameters:
newCondition- new object statescript- script to collect changes- Returns:
- object change type
-
setDefaultDatabase
-
addDefRole
Adds a default role for this user.- Parameters:
defRole- the role name to add as default
-
addExceptRole
Adds a role to the EXCEPT list for default roles.- Parameters:
exceptRole- the role name to exclude from defaults
-
addGrantee
Adds a grantee role for this user.- Parameters:
grantee- the grantee role name to add
-
addExGrantee
Adds a role to the EXCEPT list for grantees.- Parameters:
exGrantee- the grantee role name to exclude
-
hasHosts
public boolean hasHosts()Checks if this user has host restrictions.- Returns:
- true if no host restrictions are defined, false otherwise
-
addHost
Adds a host restriction for this user.- Parameters:
host- the host pattern to add
-
setStorageType
-
computeHash
Description copied from interface:IHashableComputes the hash of the implementing object using the provided hasher. The implementation should call appropriateputmethods on the hasher for all fields that should contribute to the hash value.- Parameters:
hasher- the hasher instance to use for hash computation
-
compare
Description copied from class:AbstractStatementThis method does not account for nested child PgStatements. Shallow version ofAbstractStatement.equals(Object)- Specified by:
comparein interfaceIStatement- Overrides:
comparein classAbstractStatement
-