model

package
v0.0.0-...-4b80146 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 3, 2024 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DB *sql.DB

Functions

func ChangeAccountPassword

func ChangeAccountPassword(username string, oldPassword string, newPassword string) (bool, error)

func ConnectDatabase

func ConnectDatabase(dbPath string) error

func ConvertSqliteTimestamp

func ConvertSqliteTimestamp(t string) string

func CreateRole

func CreateRole(r Role) (bool, error)

func CreateUser

func CreateUser(p ProposedUser) (bool, error)

func DeleteRole

func DeleteRole(roleId int) (bool, error)

func DeleteUser

func DeleteUser(username string) (bool, error)

func GetUserStatus

func GetUserStatus(username string) (string, error)

func SetUserRoleId

func SetUserRoleId(username string, j UserRoleId) (bool, error)

func SetUserStatus

func SetUserStatus(username string, j UserStatus) (bool, error)

Types

type FailureMsg

type FailureMsg struct {
	Error string `json:"error"`
}

type HealthCheck

type HealthCheck struct {
	Db           string `json:"db"`
	DiskSpace    string `json:"diskSpace"`
	DiskWritable string `json:"diskWritable"`
	Health       string `json:"health"`
	Status       int    `json:"status"`
}

type InvalidStatusValue

type InvalidStatusValue struct {
	Err error
}

func (*InvalidStatusValue) Error

func (i *InvalidStatusValue) Error() string

type PasswordChange

type PasswordChange struct {
	OldPassword string `json:"oldPassword"`
	NewPassword string `json:"newPassword"`
}

type PasswordHashMismatch

type PasswordHashMismatch struct {
	Err error
}

func (*PasswordHashMismatch) Error

func (p *PasswordHashMismatch) Error() string

type ProposedUser

type ProposedUser struct {
	Id        int    `json:"Id"`
	UserName  string `json:"userName"`
	FullName  string `json:"fullName"`
	Status    string `json:"status" enum:"enabled,disabled"`
	OrgUnitId int    `json:"orgUnitId"`
	RoleId    int    `json:"roleId"`
	Password  string `json:"password"`
}

type Role

type Role struct {
	Id           int    `json:"Id"`
	RoleName     string `json:"roleName"`
	Description  string `json:"description"`
	CreationDate string `json:"creationDate"`
}

func GetRoleById

func GetRoleById(id int) (Role, error)

func GetRoleByName

func GetRoleByName(roleName string) (Role, error)

func GetRoles

func GetRoles() ([]Role, error)

type RolesList

type RolesList struct {
	Data []Role `json:"data"`
}

type SuccessMsg

type SuccessMsg struct {
	Message string `json:"message"`
}

type User

type User struct {
	Id                      int    `json:"Id"`
	UserName                string `json:"userName"`
	FullName                string `json:"fullName"`
	Status                  string `json:"status"`
	OrgUnitId               int    `json:"orgUnitId"`
	RoleId                  int    `json:"roleId"`
	PasswordHash            string `json:"passwordHash"`
	CreationDate            string `json:"creationDate"`
	LastPasswordChangedDate string `json:"lastPasswordChangedDate"`
}

func GetUserById

func GetUserById(id int) (User, error)

func GetUserByUserName

func GetUserByUserName(username string) (User, error)

func GetUsers

func GetUsers() ([]User, error)

func GetUsersByRoleId

func GetUsersByRoleId(roleId int) ([]User, error)

type UserRoleId

type UserRoleId struct {
	RoleId int `json:"roleId"`
}

type UserRoleIdMsg

type UserRoleIdMsg struct {
	Message    string `json:"message"`
	UserRoleId int    `json:"roleId"`
}

type UserStatus

type UserStatus struct {
	Status string `json:"status" enum:"enabled,disabled"`
}

type UserStatusMsg

type UserStatusMsg struct {
	Message    string `json:"message"`
	UserStatus string `json:"userStatus" enum:"enabled,disabled"`
}

type UsersList

type UsersList struct {
	Data []User `json:"data"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL