feat: add users page
This commit is contained in:
241
backend/database/fields/users.gen.go
Normal file
241
backend/database/fields/users.gen.go
Normal file
@@ -0,0 +1,241 @@
|
||||
// Code generated by go-enum DO NOT EDIT.
|
||||
// Version: -
|
||||
// Revision: -
|
||||
// Build Date: -
|
||||
// Built By: -
|
||||
|
||||
package fields
|
||||
|
||||
import (
|
||||
"database/sql/driver"
|
||||
"errors"
|
||||
"fmt"
|
||||
"strconv"
|
||||
"strings"
|
||||
)
|
||||
|
||||
const (
|
||||
// UserStatusOk is a UserStatus of type Ok.
|
||||
UserStatusOk UserStatus = iota
|
||||
// UserStatusBanned is a UserStatus of type Banned.
|
||||
UserStatusBanned
|
||||
// UserStatusBlocked is a UserStatus of type Blocked.
|
||||
UserStatusBlocked
|
||||
)
|
||||
|
||||
var ErrInvalidUserStatus = fmt.Errorf("not a valid UserStatus, try [%s]", strings.Join(_UserStatusNames, ", "))
|
||||
|
||||
const _UserStatusName = "okbannedblocked"
|
||||
|
||||
var _UserStatusNames = []string{
|
||||
_UserStatusName[0:2],
|
||||
_UserStatusName[2:8],
|
||||
_UserStatusName[8:15],
|
||||
}
|
||||
|
||||
// UserStatusNames returns a list of possible string values of UserStatus.
|
||||
func UserStatusNames() []string {
|
||||
tmp := make([]string, len(_UserStatusNames))
|
||||
copy(tmp, _UserStatusNames)
|
||||
return tmp
|
||||
}
|
||||
|
||||
// UserStatusValues returns a list of the values for UserStatus
|
||||
func UserStatusValues() []UserStatus {
|
||||
return []UserStatus{
|
||||
UserStatusOk,
|
||||
UserStatusBanned,
|
||||
UserStatusBlocked,
|
||||
}
|
||||
}
|
||||
|
||||
var _UserStatusMap = map[UserStatus]string{
|
||||
UserStatusOk: _UserStatusName[0:2],
|
||||
UserStatusBanned: _UserStatusName[2:8],
|
||||
UserStatusBlocked: _UserStatusName[8:15],
|
||||
}
|
||||
|
||||
// String implements the Stringer interface.
|
||||
func (x UserStatus) String() string {
|
||||
if str, ok := _UserStatusMap[x]; ok {
|
||||
return str
|
||||
}
|
||||
return fmt.Sprintf("UserStatus(%d)", x)
|
||||
}
|
||||
|
||||
// IsValid provides a quick way to determine if the typed value is
|
||||
// part of the allowed enumerated values
|
||||
func (x UserStatus) IsValid() bool {
|
||||
_, ok := _UserStatusMap[x]
|
||||
return ok
|
||||
}
|
||||
|
||||
var _UserStatusValue = map[string]UserStatus{
|
||||
_UserStatusName[0:2]: UserStatusOk,
|
||||
_UserStatusName[2:8]: UserStatusBanned,
|
||||
_UserStatusName[8:15]: UserStatusBlocked,
|
||||
}
|
||||
|
||||
// ParseUserStatus attempts to convert a string to a UserStatus.
|
||||
func ParseUserStatus(name string) (UserStatus, error) {
|
||||
if x, ok := _UserStatusValue[name]; ok {
|
||||
return x, nil
|
||||
}
|
||||
return UserStatus(0), fmt.Errorf("%s is %w", name, ErrInvalidUserStatus)
|
||||
}
|
||||
|
||||
var errUserStatusNilPtr = errors.New("value pointer is nil") // one per type for package clashes
|
||||
|
||||
// Scan implements the Scanner interface.
|
||||
func (x *UserStatus) Scan(value interface{}) (err error) {
|
||||
if value == nil {
|
||||
*x = UserStatus(0)
|
||||
return
|
||||
}
|
||||
|
||||
// A wider range of scannable types.
|
||||
// driver.Value values at the top of the list for expediency
|
||||
switch v := value.(type) {
|
||||
case int64:
|
||||
*x = UserStatus(v)
|
||||
case string:
|
||||
*x, err = ParseUserStatus(v)
|
||||
if err != nil {
|
||||
// try parsing the integer value as a string
|
||||
if val, verr := strconv.Atoi(v); verr == nil {
|
||||
*x, err = UserStatus(val), nil
|
||||
}
|
||||
}
|
||||
case []byte:
|
||||
*x, err = ParseUserStatus(string(v))
|
||||
if err != nil {
|
||||
// try parsing the integer value as a string
|
||||
if val, verr := strconv.Atoi(string(v)); verr == nil {
|
||||
*x, err = UserStatus(val), nil
|
||||
}
|
||||
}
|
||||
case UserStatus:
|
||||
*x = v
|
||||
case int:
|
||||
*x = UserStatus(v)
|
||||
case *UserStatus:
|
||||
if v == nil {
|
||||
return errUserStatusNilPtr
|
||||
}
|
||||
*x = *v
|
||||
case uint:
|
||||
*x = UserStatus(v)
|
||||
case uint64:
|
||||
*x = UserStatus(v)
|
||||
case *int:
|
||||
if v == nil {
|
||||
return errUserStatusNilPtr
|
||||
}
|
||||
*x = UserStatus(*v)
|
||||
case *int64:
|
||||
if v == nil {
|
||||
return errUserStatusNilPtr
|
||||
}
|
||||
*x = UserStatus(*v)
|
||||
case float64: // json marshals everything as a float64 if it's a number
|
||||
*x = UserStatus(v)
|
||||
case *float64: // json marshals everything as a float64 if it's a number
|
||||
if v == nil {
|
||||
return errUserStatusNilPtr
|
||||
}
|
||||
*x = UserStatus(*v)
|
||||
case *uint:
|
||||
if v == nil {
|
||||
return errUserStatusNilPtr
|
||||
}
|
||||
*x = UserStatus(*v)
|
||||
case *uint64:
|
||||
if v == nil {
|
||||
return errUserStatusNilPtr
|
||||
}
|
||||
*x = UserStatus(*v)
|
||||
case *string:
|
||||
if v == nil {
|
||||
return errUserStatusNilPtr
|
||||
}
|
||||
*x, err = ParseUserStatus(*v)
|
||||
if err != nil {
|
||||
// try parsing the integer value as a string
|
||||
if val, verr := strconv.Atoi(*v); verr == nil {
|
||||
*x, err = UserStatus(val), nil
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
// Value implements the driver Valuer interface.
|
||||
func (x UserStatus) Value() (driver.Value, error) {
|
||||
return int64(x), nil
|
||||
}
|
||||
|
||||
// Set implements the Golang flag.Value interface func.
|
||||
func (x *UserStatus) Set(val string) error {
|
||||
v, err := ParseUserStatus(val)
|
||||
*x = v
|
||||
return err
|
||||
}
|
||||
|
||||
// Get implements the Golang flag.Getter interface func.
|
||||
func (x *UserStatus) Get() interface{} {
|
||||
return *x
|
||||
}
|
||||
|
||||
// Type implements the github.com/spf13/pFlag Value interface.
|
||||
func (x *UserStatus) Type() string {
|
||||
return "UserStatus"
|
||||
}
|
||||
|
||||
type NullUserStatus struct {
|
||||
UserStatus UserStatus
|
||||
Valid bool
|
||||
}
|
||||
|
||||
func NewNullUserStatus(val interface{}) (x NullUserStatus) {
|
||||
x.Scan(val) // yes, we ignore this error, it will just be an invalid value.
|
||||
return
|
||||
}
|
||||
|
||||
// Scan implements the Scanner interface.
|
||||
func (x *NullUserStatus) Scan(value interface{}) (err error) {
|
||||
if value == nil {
|
||||
x.UserStatus, x.Valid = UserStatus(0), false
|
||||
return
|
||||
}
|
||||
|
||||
err = x.UserStatus.Scan(value)
|
||||
x.Valid = (err == nil)
|
||||
return
|
||||
}
|
||||
|
||||
// Value implements the driver Valuer interface.
|
||||
func (x NullUserStatus) Value() (driver.Value, error) {
|
||||
if !x.Valid {
|
||||
return nil, nil
|
||||
}
|
||||
// driver.Value accepts int64 for int values.
|
||||
return int64(x.UserStatus), nil
|
||||
}
|
||||
|
||||
type NullUserStatusStr struct {
|
||||
NullUserStatus
|
||||
}
|
||||
|
||||
func NewNullUserStatusStr(val interface{}) (x NullUserStatusStr) {
|
||||
x.Scan(val) // yes, we ignore this error, it will just be an invalid value.
|
||||
return
|
||||
}
|
||||
|
||||
// Value implements the driver Valuer interface.
|
||||
func (x NullUserStatusStr) Value() (driver.Value, error) {
|
||||
if !x.Valid {
|
||||
return nil, nil
|
||||
}
|
||||
return x.UserStatus.String(), nil
|
||||
}
|
||||
Reference in New Issue
Block a user