Documentation
¶
Index ¶
Constants ¶
View Source
const ( // Success message code for everything went fine Success Severity = "success" // Info message code if command went fine but there were expected errors Info Severity = "info" // Warn message code if command went fine but there were unexpected errors Warn Severity = "warning" // Error message code if command went wrong Error Severity = "danger" // UserCreated is a message that indicates that a database user has been create sucessfully UserCreated string = "user %s created" // UserAlreadyExists is a message that indicates that the requested database user already exists UserAlreadyExists string = "user %s already exists: %s" // UserNotExists is a message that indicates that a database user could not be find in database UserNotExists string = "user %s does not exists: %s" // UserDropped is a message that indicates that a database user has been successfully been dropped UserDropped string = "user %s has been dropped" // NameMaxLength is a message that will show the restriction for length for database names NameMaxLength string = "database name length has to be equal or less than %d" )
Variables ¶
This section is empty.
Functions ¶
func ParseVersion ¶
ParseVersion will parse the input and return a suitable database. returns 0 if database is not registered.
Types ¶
type Database ¶
type Database interface {
DbAPI
// contains filtered or unexported methods
}
Database is an interface that hold information of the configuration of the database and the API interface
func GetDatabase ¶
GetDatabase is used get the API of the requested database
type DbAPI ¶
type DbAPI interface {
// CreateUser generates a new database user
CreateUser(username string, password string) ([]Message, error)
// DropUser will drop the requested database user
DropUser(username string) ([]Message, error)
// RecreateUser will sequentially call DropUser and CreateUser
RecreateUser(username string, password string) ([]Message, error)
// ListUsers will list all database excluding system internal users
ListUsers() ([]SystemUser, error)
}
DbAPI is the interface every database will implement
type SystemUser ¶
type SystemUser struct {
Username string `json:"username"`
}
SystemUser json struct represents a database user
Click to show internal directories.
Click to hide internal directories.