models

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Feb 9, 2026 License: MIT Imports: 0 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AuthRequest added in v0.0.15

type AuthRequest struct {
	Username string `json:"username" required:"true" description:"Username for authentication"`
	Password string `json:"password" required:"true" description:"Password for authentication"`
}

type AuthResponse added in v0.0.15

type AuthResponse struct {
	Token     string   `json:"token,omitempty"`
	ExpiresAt int64    `json:"expires,omitempty"`
	User      UserInfo `json:"user,omitempty"`
}

type Book

type Book struct {
	Id       int    `json:"id"`
	Name     string `json:"name" form:"name"  max:"50" required:"true" description:"Book name"`
	Price    int    `json:"price" form:"price" query:"price" yaml:"price" required:"true" description:"Book price"`
	Year     int    `json:"year" form:"year" query:"year" yaml:"year" deprecated:"true" description:"Publication year"`
	Quantity int    `json:"quantity" form:"quantity" query:"quantity" yaml:"quantity" hidden:"true" description:"Available quantity"`
}

type BookRequest added in v0.1.3

type BookRequest struct {
	Authorization string `header:"Authorization"`
	Body          Book   `json:"body"`
}

type BookResponse added in v0.1.1

type BookResponse struct {
	RequestId string `header:"X-Request-Id"`
	Status    int    `json:"status"`
	Body      Book   `json:"body"`
}

type BookUpdateRequest added in v0.1.1

type BookUpdateRequest struct {
	ID   int `path:"id"`
	Body struct {
		Name  string `json:"name"  minLength:"5" maxLength:"50" required:"true" description:"Book name"`
		Price int    `json:"price" min:"5" required:"true" description:"Book price"`
	} `json:"body"`
}

type BooksResponse added in v0.1.3

type BooksResponse = ResponseDto[[]Book]

type ErrorResponseDto added in v0.1.3

type ErrorResponseDto struct {
	Success bool `json:"success"`
	Status  int  `json:"status"`
	Details any  `json:"details"`
}

type Response

type Response struct {
	Success bool   `json:"success"`
	Message string `json:"message"`
	Data    Book   `json:"data"`
}

type ResponseBase added in v0.1.3

type ResponseBase struct {
	Success bool   `json:"success"`
	Message string `json:"message"`
	Details any    `json:"details,omitempty"`
}

type ResponseDto added in v0.1.3

type ResponseDto[T any] struct {
	*ResponseBase
	Data T `json:"data,omitempty"`
}

func ErrorResponse

func ErrorResponse(message string, err error) ResponseDto[any]

func SuccessResponse added in v0.1.3

func SuccessResponse[T any](message string, data T) ResponseDto[T]

type UserInfo added in v0.0.15

type UserInfo struct {
	Name  string `json:"name"`
	Email string `json:"email"`
	Role  string `json:"role"`
}

Jump to

Keyboard shortcuts

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