Documentation
¶
Index ¶
- type ActionType
- type AssignPermissionToRoleParams
- type AssignRoleToUserParams
- type CreatePermissionParams
- type CreateRoleParams
- type CreateUserParams
- type DBTX
- type GetPermissionByIDRow
- type GetRoleByIDRow
- type GetUserByEmailRow
- type GetUserByIDRow
- type GetUserByUsernameRow
- type ListRolesRow
- type ListUsersRow
- type NullActionType
- type NullResourceType
- type Permission
- type Querier
- type Queries
- func (q *Queries) AssignPermissionToRole(ctx context.Context, arg AssignPermissionToRoleParams) error
- func (q *Queries) AssignRoleToUser(ctx context.Context, arg AssignRoleToUserParams) error
- func (q *Queries) CreatePermission(ctx context.Context, arg CreatePermissionParams) error
- func (q *Queries) CreateRole(ctx context.Context, arg CreateRoleParams) error
- func (q *Queries) CreateUser(ctx context.Context, arg CreateUserParams) (uint32, error)
- func (q *Queries) DeletePermission(ctx context.Context, id uint32) error
- func (q *Queries) DeleteRole(ctx context.Context, id uint32) error
- func (q *Queries) DeleteUser(ctx context.Context, id uint32) error
- func (q *Queries) GetPermissionByID(ctx context.Context, id uint32) (*GetPermissionByIDRow, error)
- func (q *Queries) GetRoleByID(ctx context.Context, id uint32) (*GetRoleByIDRow, error)
- func (q *Queries) GetRolePermissions(ctx context.Context, roleID uint32) ([]*Permission, error)
- func (q *Queries) GetUserByEmail(ctx context.Context, email string) (*GetUserByEmailRow, error)
- func (q *Queries) GetUserByID(ctx context.Context, id uint32) (*GetUserByIDRow, error)
- func (q *Queries) GetUserByUsername(ctx context.Context, username string) (*GetUserByUsernameRow, error)
- func (q *Queries) GetUserRoles(ctx context.Context, userID uint32) ([]*Role, error)
- func (q *Queries) ListRoles(ctx context.Context) ([]*ListRolesRow, error)
- func (q *Queries) ListUsers(ctx context.Context) ([]*ListUsersRow, error)
- func (q *Queries) RemovePermissionFromRole(ctx context.Context, arg RemovePermissionFromRoleParams) error
- func (q *Queries) RemoveRoleFromUser(ctx context.Context, arg RemoveRoleFromUserParams) error
- func (q *Queries) UpdateUserEmail(ctx context.Context, arg UpdateUserEmailParams) error
- func (q *Queries) UpdateUserPassword(ctx context.Context, arg UpdateUserPasswordParams) error
- func (q *Queries) UpdateUsername(ctx context.Context, arg UpdateUsernameParams) error
- func (q *Queries) WithTx(tx pgx.Tx) *Queries
- type RemovePermissionFromRoleParams
- type RemoveRoleFromUserParams
- type ResourceType
- type Role
- type RolePermission
- type UpdateUserEmailParams
- type UpdateUserPasswordParams
- type UpdateUsernameParams
- type User
- type UserRole
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ActionType ¶
type ActionType string
const ( ActionTypeCREATE ActionType = "CREATE" ActionTypeREAD ActionType = "READ" ActionTypeUPDATE ActionType = "UPDATE" ActionTypeDELETE ActionType = "DELETE" ActionTypeLIST ActionType = "LIST" )
func (*ActionType) Scan ¶
func (e *ActionType) Scan(src interface{}) error
func (ActionType) Valid ¶
func (e ActionType) Valid() bool
type AssignRoleToUserParams ¶
type CreatePermissionParams ¶
type CreatePermissionParams struct {
Name string `json:"name"`
Description *string `json:"description"`
Resource ResourceType `json:"resource"`
Action ActionType `json:"action"`
}
type CreateRoleParams ¶
type CreateUserParams ¶
type GetPermissionByIDRow ¶
type GetPermissionByIDRow struct {
Name string `json:"name"`
Description *string `json:"description"`
Resource ResourceType `json:"resource"`
Action ActionType `json:"action"`
}
type GetRoleByIDRow ¶
type GetUserByEmailRow ¶
type GetUserByEmailRow struct {
ID uint32 `json:"id"`
PasswordHash string `json:"passwordHash"`
Username string `json:"username"`
CreatedAt pgtype.Timestamptz `json:"createdAt"`
UpdatedAt pgtype.Timestamptz `json:"updatedAt"`
}
type GetUserByIDRow ¶
type GetUserByIDRow struct {
Username string `json:"username"`
PasswordHash string `json:"passwordHash"`
Email string `json:"email"`
CreatedAt pgtype.Timestamptz `json:"createdAt"`
UpdatedAt pgtype.Timestamptz `json:"updatedAt"`
}
type GetUserByUsernameRow ¶
type GetUserByUsernameRow struct {
ID uint32 `json:"id"`
PasswordHash string `json:"passwordHash"`
Email string `json:"email"`
CreatedAt pgtype.Timestamptz `json:"createdAt"`
UpdatedAt pgtype.Timestamptz `json:"updatedAt"`
}
type ListRolesRow ¶
type ListUsersRow ¶
type ListUsersRow struct {
ID uint32 `json:"id"`
Username string `json:"username"`
Email string `json:"email"`
CreatedAt pgtype.Timestamptz `json:"createdAt"`
UpdatedAt pgtype.Timestamptz `json:"updatedAt"`
}
type NullActionType ¶
type NullActionType struct {
ActionType ActionType `json:"actionType"`
Valid bool `json:"valid"` // Valid is true if ActionType is not NULL
}
func (*NullActionType) Scan ¶
func (ns *NullActionType) Scan(value interface{}) error
Scan implements the Scanner interface.
type NullResourceType ¶
type NullResourceType struct {
ResourceType ResourceType `json:"resourceType"`
Valid bool `json:"valid"` // Valid is true if ResourceType is not NULL
}
func (*NullResourceType) Scan ¶
func (ns *NullResourceType) Scan(value interface{}) error
Scan implements the Scanner interface.
type Permission ¶
type Permission struct {
ID uint32 `json:"id"`
Name string `json:"name"`
Description *string `json:"description"`
Resource ResourceType `json:"resource"`
Action ActionType `json:"action"`
CreatedAt pgtype.Timestamptz `json:"createdAt"`
UpdatedAt pgtype.Timestamptz `json:"updatedAt"`
}
type Querier ¶
type Querier interface {
AssignPermissionToRole(ctx context.Context, arg AssignPermissionToRoleParams) error
AssignRoleToUser(ctx context.Context, arg AssignRoleToUserParams) error
CreatePermission(ctx context.Context, arg CreatePermissionParams) error
CreateRole(ctx context.Context, arg CreateRoleParams) error
CreateUser(ctx context.Context, arg CreateUserParams) (uint32, error)
DeletePermission(ctx context.Context, id uint32) error
DeleteRole(ctx context.Context, id uint32) error
DeleteUser(ctx context.Context, id uint32) error
GetPermissionByID(ctx context.Context, id uint32) (*GetPermissionByIDRow, error)
GetRoleByID(ctx context.Context, id uint32) (*GetRoleByIDRow, error)
GetRolePermissions(ctx context.Context, roleID uint32) ([]*Permission, error)
GetUserByEmail(ctx context.Context, email string) (*GetUserByEmailRow, error)
GetUserByID(ctx context.Context, id uint32) (*GetUserByIDRow, error)
GetUserByUsername(ctx context.Context, username string) (*GetUserByUsernameRow, error)
GetUserRoles(ctx context.Context, userID uint32) ([]*Role, error)
ListRoles(ctx context.Context) ([]*ListRolesRow, error)
ListUsers(ctx context.Context) ([]*ListUsersRow, error)
RemovePermissionFromRole(ctx context.Context, arg RemovePermissionFromRoleParams) error
RemoveRoleFromUser(ctx context.Context, arg RemoveRoleFromUserParams) error
UpdateUserEmail(ctx context.Context, arg UpdateUserEmailParams) error
UpdateUserPassword(ctx context.Context, arg UpdateUserPasswordParams) error
UpdateUsername(ctx context.Context, arg UpdateUsernameParams) error
}
type Queries ¶
type Queries struct {
// contains filtered or unexported fields
}
func (*Queries) AssignPermissionToRole ¶
func (q *Queries) AssignPermissionToRole(ctx context.Context, arg AssignPermissionToRoleParams) error
func (*Queries) AssignRoleToUser ¶
func (q *Queries) AssignRoleToUser(ctx context.Context, arg AssignRoleToUserParams) error
func (*Queries) CreatePermission ¶
func (q *Queries) CreatePermission(ctx context.Context, arg CreatePermissionParams) error
func (*Queries) CreateRole ¶
func (q *Queries) CreateRole(ctx context.Context, arg CreateRoleParams) error
func (*Queries) CreateUser ¶
func (*Queries) DeletePermission ¶
func (*Queries) GetPermissionByID ¶
func (*Queries) GetRoleByID ¶
func (*Queries) GetRolePermissions ¶
func (*Queries) GetUserByEmail ¶
func (*Queries) GetUserByID ¶
func (*Queries) GetUserByUsername ¶
func (*Queries) GetUserRoles ¶
func (*Queries) ListRoles ¶
func (q *Queries) ListRoles(ctx context.Context) ([]*ListRolesRow, error)
func (*Queries) ListUsers ¶
func (q *Queries) ListUsers(ctx context.Context) ([]*ListUsersRow, error)
func (*Queries) RemovePermissionFromRole ¶
func (q *Queries) RemovePermissionFromRole(ctx context.Context, arg RemovePermissionFromRoleParams) error
func (*Queries) RemoveRoleFromUser ¶
func (q *Queries) RemoveRoleFromUser(ctx context.Context, arg RemoveRoleFromUserParams) error
func (*Queries) UpdateUserEmail ¶
func (q *Queries) UpdateUserEmail(ctx context.Context, arg UpdateUserEmailParams) error
func (*Queries) UpdateUserPassword ¶
func (q *Queries) UpdateUserPassword(ctx context.Context, arg UpdateUserPasswordParams) error
func (*Queries) UpdateUsername ¶
func (q *Queries) UpdateUsername(ctx context.Context, arg UpdateUsernameParams) error
type ResourceType ¶
type ResourceType string
const ( ResourceTypeUSER ResourceType = "USER" ResourceTypeROLE ResourceType = "ROLE" ResourceTypePERMISSION ResourceType = "PERMISSION" ResourceTypePRODUCT ResourceType = "PRODUCT" ResourceTypeORDER ResourceType = "ORDER" )
func (*ResourceType) Scan ¶
func (e *ResourceType) Scan(src interface{}) error
func (ResourceType) Valid ¶
func (e ResourceType) Valid() bool
type Role ¶
type Role struct {
ID uint32 `json:"id"`
Name string `json:"name"`
Description *string `json:"description"`
CreatedAt pgtype.Timestamptz `json:"createdAt"`
UpdatedAt pgtype.Timestamptz `json:"updatedAt"`
}
type RolePermission ¶
type UpdateUserEmailParams ¶
type UpdateUsernameParams ¶
type User ¶
type User struct {
ID uint32 `json:"id"`
Username string `json:"username"`
PasswordHash string `json:"passwordHash"`
Email string `json:"email"`
CreatedAt pgtype.Timestamptz `json:"createdAt"`
UpdatedAt pgtype.Timestamptz `json:"updatedAt"`
}
Click to show internal directories.
Click to hide internal directories.