model

package
v0.0.0-...-3871cc9 Latest Latest
Warning

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

Go to latest
Published: Jun 14, 2020 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

View Source
const UserSelectField = "id,name,email,phone,address,created_at,updated_at"

UserSelectField represent the default selected column for user model

Variables

This section is empty.

Functions

This section is empty.

Types

type GenericResponse

type GenericResponse struct {
	Status   int      `json:"status"`
	Success  bool     `json:"success"`
	Messages []string `json:"messages"`
}

GenericResponse represent the generic response API

func NewGenericResponse

func NewGenericResponse(stsCd, isError int, messages []string) *GenericResponse

NewGenericResponse will create an object that represent the GenericResponse struct

type PaginationResponse

type PaginationResponse struct {
	Page      int `json:"page"`
	PerPage   int `json:"per_page"`
	TotalPage int `json:"total_page"`
	TotalData int `json:"total_data"`
}

PaginationResponse represent the response API with pagination

func NewPaginationResponse

func NewPaginationResponse(page, perPage, totalPage, totalData int) *PaginationResponse

NewPaginationResponse will create an object that represent the PaginationResponse struct

type UserModel

type UserModel struct {
	ID        string     `json:"id" db:"id"`
	Name      string     `json:"name" db:"name"`
	Email     string     `json:"email" db:"email"`
	Phone     string     `json:"phone" db:"phone"`
	Address   string     `json:"address" db:"address"`
	CreatedAt time.Time  `json:"created_at" db:"created_at"`
	UpdatedAt time.Time  `json:"updated_at" db:"updated_at"`
	DeletedAt *time.Time `json:"-" db:"deleted_at"`
}

UserModel represent the user model

type UserPaginationResponse

type UserPaginationResponse struct {
	*PaginationResponse
	List []*UserModel `json:"list"`
}

UserPaginationResponse represent the user response API with pagination

type UserResponse

type UserResponse struct {
	*GenericResponse
	Data *UserModel `json:"data"`
}

UserResponse represent the generic user response API

type UsersResponse

type UsersResponse struct {
	*GenericResponse
	Data *UserPaginationResponse `json:"data"`
}

UsersResponse represent the generic user response API with pagination

Jump to

Keyboard shortcuts

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