todolistsvr

package
v0.0.0-...-fe53453 Latest Latest
Warning

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

Go to latest
Published: Sep 7, 2020 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RegisterTodolistService

func RegisterTodolistService(e *echo.Echo, srv TodolistService)

RegisterTodolistService is used to bind routers

func RegisterTodolistServiceWithPrefix

func RegisterTodolistServiceWithPrefix(e *echo.Echo, srv TodolistService, prefix string)

RegisterTodolistServiceWithPrefix is used to bind routers with custom prefix

Types

type AddError

type AddError struct {
	Req   *AddReq `json:"req"`
	Error string  `json:"error"`
}

AddError

func (*AddError) GetError

func (r *AddError) GetError() string

func (*AddError) GetReq

func (r *AddError) GetReq() *AddReq

type AddReq

type AddReq struct {
	Item *Todo `json:"item"`
}

AddReq

func (*AddReq) GetItem

func (r *AddReq) GetItem() *Todo

type AddResp

type AddResp struct {
	Count int `json:"count"`
}

AddResp

func (*AddResp) GetCount

func (r *AddResp) GetCount() int

type AuthError

type AuthError struct {
	Message string `json:"message"`
}

AuthError

func (*AuthError) GetMessage

func (r *AuthError) GetMessage() string

type BindError

type BindError struct {
	Message string `json:"message"`
}

BindError

func (*BindError) GetMessage

func (r *BindError) GetMessage() string

type CommonError

type CommonError struct {
	GenericError  *GenericError  `json:"genericError"`
	AuthError     *AuthError     `json:"authError"`
	ValidateError *ValidateError `json:"validateError"`
	BindError     *BindError     `json:"bindError"`
}

CommonError

func (*CommonError) Error

func (r *CommonError) Error() string

func (*CommonError) GetAuthError

func (r *CommonError) GetAuthError() *AuthError

func (*CommonError) GetBindError

func (r *CommonError) GetBindError() *BindError

func (*CommonError) GetGenericError

func (r *CommonError) GetGenericError() *GenericError

func (*CommonError) GetValidateError

func (r *CommonError) GetValidateError() *ValidateError

type Empty

type Empty struct {
}

Empty

type FieldError

type FieldError struct {
	FieldName string            `json:"fieldName"`
	ErrorType ValidateErrorType `json:"errorType"`
}

FieldError

func (*FieldError) GetErrorType

func (r *FieldError) GetErrorType() ValidateErrorType

func (*FieldError) GetFieldName

func (r *FieldError) GetFieldName() string

type GenericError

type GenericError struct {
	Message string `json:"message"`
}

GenericError

func (*GenericError) GetMessage

func (r *GenericError) GetMessage() string

type ListResp

type ListResp struct {
	Items []*Todo `json:"items"`
}

ListResp

func (*ListResp) GetItems

func (r *ListResp) GetItems() []*Todo

type Todo

type Todo struct {
	Title string `json:"title"`
}

Todo

func (*Todo) GetTitle

func (r *Todo) GetTitle() string

type TodolistService

type TodolistService interface {
	Add(c echo.Context, req *AddReq) (resp *AddResp, bizError *AddError, err error)

	List(c echo.Context, req *Empty) (resp *ListResp, err error)
}

TodolistService is the interface contains all the controllers

type ValidateError

type ValidateError struct {
	Errors []*FieldError `json:"errors"`
}

ValidateError

func (*ValidateError) GetErrors

func (r *ValidateError) GetErrors() []*FieldError

type ValidateErrorType

type ValidateErrorType int
const (
	INVALID_EMAIL  ValidateErrorType = 0
	FIELD_REQUIRED ValidateErrorType = 1
)

func (ValidateErrorType) Code

func (code ValidateErrorType) Code() int

func (ValidateErrorType) IsFIELD_REQUIRED

func (code ValidateErrorType) IsFIELD_REQUIRED() bool

func (ValidateErrorType) IsINVALID_EMAIL

func (code ValidateErrorType) IsINVALID_EMAIL() bool

func (ValidateErrorType) String

func (code ValidateErrorType) String() string

Jump to

Keyboard shortcuts

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