models

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Aug 15, 2022 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SendErrorResponse

func SendErrorResponse(c *gin.Context, status int, message string)

func SendResponseData

func SendResponseData(c *gin.Context, data gin.H)

Types

type EnvConfig

type EnvConfig struct {
	ServerPort                 string `mapstructure:"SERVER_PORT"`
	ServerAddr                 string `mapstructure:"SERVER_ADDR"`
	MongodbUri                 string `mapstructure:"MONGO_URI"`
	MongodbDatabase            string `mapstructure:"MONGO_DATABASE"`
	UseRedis                   bool   `mapstructure:"USE_REDIS"`
	RedisDefaultAddr           string `mapstructure:"REDIS_DEFAULT_ADDR"`
	JWTSecretKey               string `mapstructure:"JWT_SECRET"`
	JWTAccessExpirationMinutes int    `mapstructure:"JWT_ACCESS_EXPIRATION_MINUTES"`
	JWTRefreshExpirationDays   int    `mapstructure:"JWT_REFRESH_EXPIRATION_DAYS"`
	Mode                       string `mapstructure:"MODE"`
}

func (*EnvConfig) Validate

func (config *EnvConfig) Validate() error

type LoginRequest

type LoginRequest struct {
	Email    string `json:"email"`
	Password string `json:"password"`
}

func (LoginRequest) Validate

func (a LoginRequest) Validate() error

type NoteRequest

type NoteRequest struct {
	Title   string `json:"title"`
	Content string `json:"content"`
}

func (NoteRequest) Validate

func (a NoteRequest) Validate() error

type RefreshRequest

type RefreshRequest struct {
	Token string `json:"token"`
}

func (RefreshRequest) Validate

func (a RefreshRequest) Validate() error

type RegisterRequest

type RegisterRequest struct {
	Name     string `json:"name"`
	Email    string `json:"email"`
	Password string `json:"password"`
}

func (RegisterRequest) Validate

func (a RegisterRequest) Validate() error

type Response

type Response struct {
	StatusCode int            `json:"-"`
	Success    bool           `json:"success"`
	Message    string         `json:"message,omitempty"`
	Data       map[string]any `json:"data,omitempty"`
}

Response Base response

func (*Response) SendResponse

func (response *Response) SendResponse(c *gin.Context)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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