model

package
v0.2.4 Latest Latest
Warning

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

Go to latest
Published: Oct 16, 2023 License: AGPL-3.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrUrlTooLong  = errors.New("url too long")
	ErrEmptyName   = errors.New("empty name")
	ErrNameTooLong = errors.New("name too long")
	ErrTypeTooLong = errors.New("type too long")

	ErrId = errors.New("id must be greater than 0")

	ErrEmptyIds = errors.New("empty ids")
)
View Source
var (
	ErrEmptyRoomId          = errors.New("empty room id")
	ErrRoomIdTooLong        = errors.New("room id too long")
	ErrRoomIdHasInvalidChar = errors.New("room id has invalid char")

	ErrEmptyPassword   = errors.New("empty password")
	ErrPasswordTooLong = errors.New("password too long")

	ErrEmptyUsername          = errors.New("empty username")
	ErrUsernameTooLong        = errors.New("username too long")
	ErrUsernameHasInvalidChar = errors.New("username has invalid char")
)

Functions

func Decode

func Decode(ctx *gin.Context, decoder Decoder) error

Types

type ApiResp

type ApiResp struct {
	Time  int64  `json:"time"`
	Error string `json:"error,omitempty"`
	Data  any    `json:"data,omitempty"`
}

func NewApiDataResp

func NewApiDataResp(data any) *ApiResp

func NewApiErrorResp

func NewApiErrorResp(err error) *ApiResp

func NewApiErrorStringResp

func NewApiErrorStringResp(err string) *ApiResp

func (*ApiResp) SetDate

func (ar *ApiResp) SetDate(data any)

func (*ApiResp) SetError

func (ar *ApiResp) SetError(err error)

type CreateRoomReq

type CreateRoomReq struct {
	RoomId       string `json:"roomId"`
	Password     string `json:"password"`
	Username     string `json:"username"`
	UserPassword string `json:"userPassword"`
	Hidden       bool   `json:"hidden"`
}

func (*CreateRoomReq) Decode

func (c *CreateRoomReq) Decode(ctx *gin.Context) error

func (*CreateRoomReq) Validate

func (c *CreateRoomReq) Validate() error

type Decoder

type Decoder interface {
	Decode(ctx *gin.Context) error
	Validate() error
}

type EditMovieReq

type EditMovieReq struct {
	IdReq
	PushMovieReq
}

func (*EditMovieReq) Decode

func (e *EditMovieReq) Decode(ctx *gin.Context) error

func (*EditMovieReq) Validate

func (e *EditMovieReq) Validate() error

type IdReq

type IdReq struct {
	Id uint64 `json:"id"`
}

func (*IdReq) Decode

func (i *IdReq) Decode(ctx *gin.Context) error

func (*IdReq) Validate

func (i *IdReq) Validate() error

type IdsReq

type IdsReq struct {
	Ids []uint64 `json:"ids"`
}

func (*IdsReq) Decode

func (i *IdsReq) Decode(ctx *gin.Context) error

func (*IdsReq) Validate

func (i *IdsReq) Validate() error

type LoginRoomReq

type LoginRoomReq struct {
	RoomId       string `json:"roomId"`
	Password     string `json:"password"`
	Username     string `json:"username"`
	UserPassword string `json:"userPassword"`
}

func (*LoginRoomReq) Decode

func (l *LoginRoomReq) Decode(ctx *gin.Context) error

func (*LoginRoomReq) Validate

func (l *LoginRoomReq) Validate() error

type PushMovieReq

type PushMovieReq room.BaseMovieInfo

func (*PushMovieReq) Decode

func (p *PushMovieReq) Decode(ctx *gin.Context) error

func (*PushMovieReq) Validate

func (p *PushMovieReq) Validate() error

type RoomListResp

type RoomListResp struct {
	RoomId       string `json:"roomId"`
	PeopleNum    int64  `json:"peopleNum"`
	NeedPassword bool   `json:"needPassword"`
	Creator      string `json:"creator"`
	CreatedAt    int64  `json:"createdAt"`
}

type SetRoomPasswordReq

type SetRoomPasswordReq struct {
	Password string `json:"password"`
}

func (*SetRoomPasswordReq) Decode

func (s *SetRoomPasswordReq) Decode(ctx *gin.Context) error

func (*SetRoomPasswordReq) Validate

func (s *SetRoomPasswordReq) Validate() error

type SetUserPasswordReq

type SetUserPasswordReq struct {
	Password string `json:"password"`
}

func (*SetUserPasswordReq) Decode

func (s *SetUserPasswordReq) Decode(ctx *gin.Context) error

func (*SetUserPasswordReq) Validate

func (s *SetUserPasswordReq) Validate() error

type SwapMovieReq

type SwapMovieReq struct {
	Id1 uint64 `json:"id1"`
	Id2 uint64 `json:"id2"`
}

func (*SwapMovieReq) Decode

func (s *SwapMovieReq) Decode(ctx *gin.Context) error

func (*SwapMovieReq) Validate

func (s *SwapMovieReq) Validate() error

type UsernameReq

type UsernameReq struct {
	Username string `json:"username"`
}

func (*UsernameReq) Decode

func (u *UsernameReq) Decode(ctx *gin.Context) error

func (*UsernameReq) Validate

func (u *UsernameReq) Validate() error

Jump to

Keyboard shortcuts

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