Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FruitBodyStructLevelValidation ¶
func FruitBodyStructLevelValidation(sl validator.StructLevel)
FruitBodyStructLevelValidation contains FruitBody custom struct level validations.
Types ¶
type Common ¶
type Common struct { ID uint64 `xorm:"pk autoincr index(pk)" json:"id"` IsDeleted *bool `xorm:"default false notnull" json:"-"` IsEnabled *bool `xorm:"default true notnull" json:"-"` CreatedAt *time.Time `xorm:"created notnull" json:"-"` UpdatedAt *time.Time `xorm:"updated notnull" json:"-"` }
Common テーブル共通項目を定義
type ErrorResponse ¶
type ErrorResponse struct {
Errors []*ErrorResponseInner `json:"errors"`
}
ErrorResponse の定義
func NewErrorResponse ¶
func NewErrorResponse(code string, t ErrorType, messages ...interface{}) *ErrorResponse
NewErrorResponse APIエラー時の詳細レスポンスを生成
func (*ErrorResponse) Append ¶
func (res *ErrorResponse) Append(code string, t ErrorType, messages ...interface{})
Append adds an error to ErrorResponse
type ErrorResponseInner ¶
type ErrorResponseInner struct { Code string `json:"code"` Type ErrorType `json:"type"` Messages []string `json:"messages"` }
ErrorResponseInner の定義
type ErrorType ¶
type ErrorType string
ErrorType エラータイプ
const ( // ErrorAuth authentication error ErrorAuth ErrorType = "AuthError" // ErrorUnknown unknown error ErrorUnknown ErrorType = "UnknownError" // ErrorParam parameter error ErrorParam ErrorType = "ParamError" // ErrorNotFound not found error ErrorNotFound ErrorType = "NotFoundError" // ErrorLimitExceeded throttling error ErrorLimitExceeded ErrorType = "LimitExceededError" )
type FruitBody ¶
type FruitBody struct { Name *string `json:"name" binding:"required,min=1"` Price *int `json:"price"` }
FruitBody the main data
type StructValidator ¶
type StructValidator struct {
// contains filtered or unexported fields
}
StructValidator defines validations for models.
func (*StructValidator) Engine ¶
func (v *StructValidator) Engine() interface{}
Engine returns validate engine.
func (*StructValidator) ValidateStruct ¶
func (v *StructValidator) ValidateStruct(obj interface{}) error
ValidateStruct validates struct with tags.
type User ¶
type User struct { Common `xorm:"extends"` Email string `xorm:"VARCHAR(120) notnull index(email)" json:"email"` EmailVerified *bool `xorm:"notnull" json:"email_verified"` LastLoginAt *time.Time `json:"last_login_at"` UserPublicData `xorm:"extends"` }
User ユーザー情報を格納
func (*User) GetPublicData ¶
func (u *User) GetPublicData() *UserPublicData
GetPublicData は公開用のユーザー情報を取得
type UserCreateBody ¶
type UserCreateBody struct { Email string `binding:"email" json:"email" ` UserProfile }
UserCreateBody contains new user data.
type UserProfile ¶
type UserProfile struct { DisplayName *string `json:"display_name"` About *string `json:"about"` AvatarURL *string `json:"avatar_url"` }
UserProfile has user's editable profile data
type UserPublicData ¶
type UserPublicData struct { UserID uint64 `xorm:"-" json:"user_id"` UserProfile `xorm:"extends"` }
UserPublicData has public user data
func (UserPublicData) TableName ¶
func (UserPublicData) TableName() string
TableName represents db table name
Click to show internal directories.
Click to hide internal directories.