fix: issues
This commit is contained in:
277
backend/database/fields/user_oauths.gen.go
Normal file
277
backend/database/fields/user_oauths.gen.go
Normal file
@@ -0,0 +1,277 @@
|
||||
// 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 (
|
||||
// AuthChannelWeChat is a AuthChannel of type WeChat.
|
||||
AuthChannelWeChat AuthChannel = iota + 1
|
||||
// AuthChannelWeiBo is a AuthChannel of type WeiBo.
|
||||
AuthChannelWeiBo
|
||||
// AuthChannelQQ is a AuthChannel of type QQ.
|
||||
AuthChannelQQ
|
||||
// AuthChannelGithub is a AuthChannel of type Github.
|
||||
AuthChannelGithub
|
||||
// AuthChannelGoogle is a AuthChannel of type Google.
|
||||
AuthChannelGoogle
|
||||
// AuthChannelFacebook is a AuthChannel of type Facebook.
|
||||
AuthChannelFacebook
|
||||
// AuthChannelTwitter is a AuthChannel of type Twitter.
|
||||
AuthChannelTwitter
|
||||
// AuthChannelLinkedIn is a AuthChannel of type LinkedIn.
|
||||
AuthChannelLinkedIn
|
||||
// AuthChannelApple is a AuthChannel of type Apple.
|
||||
AuthChannelApple
|
||||
)
|
||||
|
||||
var ErrInvalidAuthChannel = fmt.Errorf("not a valid AuthChannel, try [%s]", strings.Join(_AuthChannelNames, ", "))
|
||||
|
||||
const _AuthChannelName = "WeChatWeiBoQQGithubGoogleFacebookTwitterLinkedInApple"
|
||||
|
||||
var _AuthChannelNames = []string{
|
||||
_AuthChannelName[0:6],
|
||||
_AuthChannelName[6:11],
|
||||
_AuthChannelName[11:13],
|
||||
_AuthChannelName[13:19],
|
||||
_AuthChannelName[19:25],
|
||||
_AuthChannelName[25:33],
|
||||
_AuthChannelName[33:40],
|
||||
_AuthChannelName[40:48],
|
||||
_AuthChannelName[48:53],
|
||||
}
|
||||
|
||||
// AuthChannelNames returns a list of possible string values of AuthChannel.
|
||||
func AuthChannelNames() []string {
|
||||
tmp := make([]string, len(_AuthChannelNames))
|
||||
copy(tmp, _AuthChannelNames)
|
||||
return tmp
|
||||
}
|
||||
|
||||
// AuthChannelValues returns a list of the values for AuthChannel
|
||||
func AuthChannelValues() []AuthChannel {
|
||||
return []AuthChannel{
|
||||
AuthChannelWeChat,
|
||||
AuthChannelWeiBo,
|
||||
AuthChannelQQ,
|
||||
AuthChannelGithub,
|
||||
AuthChannelGoogle,
|
||||
AuthChannelFacebook,
|
||||
AuthChannelTwitter,
|
||||
AuthChannelLinkedIn,
|
||||
AuthChannelApple,
|
||||
}
|
||||
}
|
||||
|
||||
var _AuthChannelMap = map[AuthChannel]string{
|
||||
AuthChannelWeChat: _AuthChannelName[0:6],
|
||||
AuthChannelWeiBo: _AuthChannelName[6:11],
|
||||
AuthChannelQQ: _AuthChannelName[11:13],
|
||||
AuthChannelGithub: _AuthChannelName[13:19],
|
||||
AuthChannelGoogle: _AuthChannelName[19:25],
|
||||
AuthChannelFacebook: _AuthChannelName[25:33],
|
||||
AuthChannelTwitter: _AuthChannelName[33:40],
|
||||
AuthChannelLinkedIn: _AuthChannelName[40:48],
|
||||
AuthChannelApple: _AuthChannelName[48:53],
|
||||
}
|
||||
|
||||
// String implements the Stringer interface.
|
||||
func (x AuthChannel) String() string {
|
||||
if str, ok := _AuthChannelMap[x]; ok {
|
||||
return str
|
||||
}
|
||||
return fmt.Sprintf("AuthChannel(%d)", x)
|
||||
}
|
||||
|
||||
// IsValid provides a quick way to determine if the typed value is
|
||||
// part of the allowed enumerated values
|
||||
func (x AuthChannel) IsValid() bool {
|
||||
_, ok := _AuthChannelMap[x]
|
||||
return ok
|
||||
}
|
||||
|
||||
var _AuthChannelValue = map[string]AuthChannel{
|
||||
_AuthChannelName[0:6]: AuthChannelWeChat,
|
||||
_AuthChannelName[6:11]: AuthChannelWeiBo,
|
||||
_AuthChannelName[11:13]: AuthChannelQQ,
|
||||
_AuthChannelName[13:19]: AuthChannelGithub,
|
||||
_AuthChannelName[19:25]: AuthChannelGoogle,
|
||||
_AuthChannelName[25:33]: AuthChannelFacebook,
|
||||
_AuthChannelName[33:40]: AuthChannelTwitter,
|
||||
_AuthChannelName[40:48]: AuthChannelLinkedIn,
|
||||
_AuthChannelName[48:53]: AuthChannelApple,
|
||||
}
|
||||
|
||||
// ParseAuthChannel attempts to convert a string to a AuthChannel.
|
||||
func ParseAuthChannel(name string) (AuthChannel, error) {
|
||||
if x, ok := _AuthChannelValue[name]; ok {
|
||||
return x, nil
|
||||
}
|
||||
return AuthChannel(0), fmt.Errorf("%s is %w", name, ErrInvalidAuthChannel)
|
||||
}
|
||||
|
||||
var errAuthChannelNilPtr = errors.New("value pointer is nil") // one per type for package clashes
|
||||
|
||||
// Scan implements the Scanner interface.
|
||||
func (x *AuthChannel) Scan(value interface{}) (err error) {
|
||||
if value == nil {
|
||||
*x = AuthChannel(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 = AuthChannel(v)
|
||||
case string:
|
||||
*x, err = ParseAuthChannel(v)
|
||||
if err != nil {
|
||||
// try parsing the integer value as a string
|
||||
if val, verr := strconv.Atoi(v); verr == nil {
|
||||
*x, err = AuthChannel(val), nil
|
||||
}
|
||||
}
|
||||
case []byte:
|
||||
*x, err = ParseAuthChannel(string(v))
|
||||
if err != nil {
|
||||
// try parsing the integer value as a string
|
||||
if val, verr := strconv.Atoi(string(v)); verr == nil {
|
||||
*x, err = AuthChannel(val), nil
|
||||
}
|
||||
}
|
||||
case AuthChannel:
|
||||
*x = v
|
||||
case int:
|
||||
*x = AuthChannel(v)
|
||||
case *AuthChannel:
|
||||
if v == nil {
|
||||
return errAuthChannelNilPtr
|
||||
}
|
||||
*x = *v
|
||||
case uint:
|
||||
*x = AuthChannel(v)
|
||||
case uint64:
|
||||
*x = AuthChannel(v)
|
||||
case *int:
|
||||
if v == nil {
|
||||
return errAuthChannelNilPtr
|
||||
}
|
||||
*x = AuthChannel(*v)
|
||||
case *int64:
|
||||
if v == nil {
|
||||
return errAuthChannelNilPtr
|
||||
}
|
||||
*x = AuthChannel(*v)
|
||||
case float64: // json marshals everything as a float64 if it's a number
|
||||
*x = AuthChannel(v)
|
||||
case *float64: // json marshals everything as a float64 if it's a number
|
||||
if v == nil {
|
||||
return errAuthChannelNilPtr
|
||||
}
|
||||
*x = AuthChannel(*v)
|
||||
case *uint:
|
||||
if v == nil {
|
||||
return errAuthChannelNilPtr
|
||||
}
|
||||
*x = AuthChannel(*v)
|
||||
case *uint64:
|
||||
if v == nil {
|
||||
return errAuthChannelNilPtr
|
||||
}
|
||||
*x = AuthChannel(*v)
|
||||
case *string:
|
||||
if v == nil {
|
||||
return errAuthChannelNilPtr
|
||||
}
|
||||
*x, err = ParseAuthChannel(*v)
|
||||
if err != nil {
|
||||
// try parsing the integer value as a string
|
||||
if val, verr := strconv.Atoi(*v); verr == nil {
|
||||
*x, err = AuthChannel(val), nil
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
// Value implements the driver Valuer interface.
|
||||
func (x AuthChannel) Value() (driver.Value, error) {
|
||||
return int64(x), nil
|
||||
}
|
||||
|
||||
// Set implements the Golang flag.Value interface func.
|
||||
func (x *AuthChannel) Set(val string) error {
|
||||
v, err := ParseAuthChannel(val)
|
||||
*x = v
|
||||
return err
|
||||
}
|
||||
|
||||
// Get implements the Golang flag.Getter interface func.
|
||||
func (x *AuthChannel) Get() interface{} {
|
||||
return *x
|
||||
}
|
||||
|
||||
// Type implements the github.com/spf13/pFlag Value interface.
|
||||
func (x *AuthChannel) Type() string {
|
||||
return "AuthChannel"
|
||||
}
|
||||
|
||||
type NullAuthChannel struct {
|
||||
AuthChannel AuthChannel
|
||||
Valid bool
|
||||
}
|
||||
|
||||
func NewNullAuthChannel(val interface{}) (x NullAuthChannel) {
|
||||
x.Scan(val) // yes, we ignore this error, it will just be an invalid value.
|
||||
return
|
||||
}
|
||||
|
||||
// Scan implements the Scanner interface.
|
||||
func (x *NullAuthChannel) Scan(value interface{}) (err error) {
|
||||
if value == nil {
|
||||
x.AuthChannel, x.Valid = AuthChannel(0), false
|
||||
return
|
||||
}
|
||||
|
||||
err = x.AuthChannel.Scan(value)
|
||||
x.Valid = (err == nil)
|
||||
return
|
||||
}
|
||||
|
||||
// Value implements the driver Valuer interface.
|
||||
func (x NullAuthChannel) Value() (driver.Value, error) {
|
||||
if !x.Valid {
|
||||
return nil, nil
|
||||
}
|
||||
// driver.Value accepts int64 for int values.
|
||||
return int64(x.AuthChannel), nil
|
||||
}
|
||||
|
||||
type NullAuthChannelStr struct {
|
||||
NullAuthChannel
|
||||
}
|
||||
|
||||
func NewNullAuthChannelStr(val interface{}) (x NullAuthChannelStr) {
|
||||
x.Scan(val) // yes, we ignore this error, it will just be an invalid value.
|
||||
return
|
||||
}
|
||||
|
||||
// Value implements the driver Valuer interface.
|
||||
func (x NullAuthChannelStr) Value() (driver.Value, error) {
|
||||
if !x.Valid {
|
||||
return nil, nil
|
||||
}
|
||||
return x.AuthChannel.String(), nil
|
||||
}
|
||||
Reference in New Issue
Block a user