modelo

package
v0.3.2 Latest Latest
Warning

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

Go to latest
Published: Jan 13, 2025 License: MIT Imports: 4 Imported by: 6

Documentation

Index

Constants

View Source
const (
	ID          = "ID"
	UID         = "UID"
	Name        = "NAME"
	Email       = "EMAIL"
	AuthorityId = "AUTHORITY_ID"
)
View Source
const (
	ERROR   = 7
	SUCCESS = 0
)

Variables

This section is empty.

Functions

func Fail

func Fail(data interface{}) []byte

func GetAuthorityId

func GetAuthorityId(value string) (int64, error)

func GetEmail

func GetEmail(value string) (string, error)

func GetName

func GetName(value string) (string, error)

func GetUID

func GetUID(value string) (uuid.UUID, error)

func GetUserID

func GetUserID(value string) (int64, error)

func MustAuthorityId

func MustAuthorityId(value string) int64

func MustEmail

func MustEmail(value string) string

func MustName

func MustName(value string) string

func MustUID

func MustUID(value string) uuid.UUID

func MustUserID

func MustUserID(value string) int64

func NewCodeError

func NewCodeError(code int, msg string) error

func NewDefaultError

func NewDefaultError(msg string) error

func NewError

func NewError(code int, msg string, err error) error

func NewRawError

func NewRawError(code int, err error) error

func Result

func Result(code int, data interface{}, msg string) []byte

func Success

func Success(data interface{}) []byte

func TryAuthorityId

func TryAuthorityId(value string, defaultVal ...int64) int64

func TryEmail

func TryEmail(value string, defaultVal ...string) string

func TryName

func TryName(value string, defaultVal ...string) string

func TryUID

func TryUID(value string) uuid.UUID

func TryUserID

func TryUserID(value string, defaultVal ...int64) int64

Types

type AccessKeyPageSearch

type AccessKeyPageSearch struct {
	//APIConsumerID *int64  ` json:"api_consumer_id" form:"api_consumer_id" query:"api_consumer_id"`
	Subject  string  `json:"subject" form:"subject" query:"subject" binding:"required"`
	Type     *int32  `json:"type" form:"type" query:"type" ` //  0:  用户(admin), 1: 应用
	Nickname *string `json:"nickname" form:"nickname" query:"nickname"`
}

type AccessKeyReq

type AccessKeyReq struct {
	AccessKeyUpdateReq

	Subject          *string `json:"subject"  form:"subject" query:"subject" binding:"required"` // consumer-name(appid) mapping to APIConsumerID
	Type             *int32  `json:"type" form:"type" query:"type" binding:"required"`           //  0:  用户(admin), 1: 应用
	KeyID            *string `json:"key_id" form:"key_id" query:"key_id"`                        // use for Type=0
	EncodedKeySecret *string `json:"key_secret" form:"key_secret" query:"key_secret"`            // use for Type=0
}

type AccessKeyUpdateReq

type AccessKeyUpdateReq struct {
	ID int64 `json:"id" form:"id" query:"id"`

	//APIConsumerID int64   ` json:"api_consumer_id" form:"api_consumer_id" query:"api_consumer_id" binding:"required"`
	Enabled     *bool    `json:"enabled" form:"enabled" query:"enabled" binding:"required"`
	Nickname    *string  `json:"nickname" form:"nickname" query:"nickname"`
	Gender      *string  `json:"gender" form:"gender" query:"gender"`
	Cover       *string  `json:"cover" form:"cover" query:"cover"`
	Phone       *string  `json:"phone" form:"phone" query:"phone"`
	Email       *string  `json:"email" form:"email" query:"email"`
	UrlPatterns []string `json:"urlPatterns" form:"urlPatterns" query:"urlPatterns" binding:"required"`
}

type BaseClaims

type BaseClaims struct {
	//APIConsumerID int64
	ID       int64 // access key record is for kong plugin update
	KeyID    string
	Audience []string // routers join by ,
	Subject  string   // appid
	Value    *string  //需要被签名的内容(JwtUser)

	Type     int32
	Nickname string
	Gender   string
	Cover    string
	Phone    string
	Email    string
}

type CodeError

type CodeError struct {
	Code int    `json:"code"`
	Msg  string `json:"msg"`
	Err  error  `json:"err"`
}

func (*CodeError) Error

func (e *CodeError) Error() string

func (*CodeError) Raw

func (e *CodeError) Raw() error

func (*CodeError) Resp

func (e *CodeError) Resp() *Response

type CustomClaims

type CustomClaims struct {
	BaseClaims
	BufferTime int64
	jwt.RegisteredClaims
}

CustomClaims Custom claims structure

type JwtReq

type JwtReq struct {
	KeyID            string  `json:"access_key" form:"access_key" query:"access_key" binding:"required"`
	EncodedKeySecret string  `json:"security_key" form:"security_key" query:"security_key" binding:"required"`
	Subject          string  `json:"subject"  form:"subject" query:"subject" binding:"required"` // appid
	Value            *string `json:"value"  form:"value" query:"value"`                          //需要被签名的内容
	Captcha          string  `json:"captcha"`                                                    // 验证码
	CaptchaId        string  `json:"captchaId"`                                                  // 验证码ID
}

type JwtUser

type JwtUser struct {
	Id          int64     `json:"id"`
	Uuid        uuid.UUID `json:"uuid"`
	Name        string    `json:"name"`
	Email       string    `json:"email"`
	AuthorityId int64     `json:"authorityId"`
}

func MustUser

func MustUser(value string) *JwtUser

func UserUnMarshal

func UserUnMarshal(value string) (*JwtUser, error)

func (*JwtUser) UserMarshal

func (u *JwtUser) UserMarshal() string

type OneidConf

type OneidConf struct {
	AuthenticationUrl string `` // kong
	/* 139-byte string literal not displayed */
	AccessKeyId     string `mapstructure:"access-key-id" yaml:"access-key-id" json:"access-key-id" form:"access-key-id" query:"access-key-id"` // ak
	AccessKeySecret string ``                                                                                                                  // sk
	/* 133-byte string literal not displayed */
	Subject string `mapstructure:"subject" yaml:"subject" json:"subject" form:"subject" query:"subject"` // consumer name
}

type Response

type Response struct {
	Code int         `json:"code"`
	Data interface{} `json:"data"`
	Msg  string      `json:"msg"`
}

func FailWithDetailed

func FailWithDetailed(data interface{}, message string) *Response

func FailWithError

func FailWithError(data error) *Response

func FailWithMessage

func FailWithMessage(message string) *Response

func Failed

func Failed() *Response

func Ok

func Ok() *Response

func OkWithData

func OkWithData(data interface{}) *Response

func OkWithDetailed

func OkWithDetailed(data interface{}, message string) *Response

func OkWithMessage

func OkWithMessage(message string) *Response

func Res

func Res(code int, data interface{}, msg string) *Response

type SysCaptchaResponse

type SysCaptchaResponse struct {
	CaptchaId     string `json:"captchaId"`
	PicPath       string `json:"picPath"`
	CaptchaLength int    `json:"captchaLength"`
}

Jump to

Keyboard shortcuts

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