godd

package module
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Feb 13, 2021 License: MIT Imports: 8 Imported by: 0

README

GoDD : 2 Layered Domain-Driven Design Architecture for Monolith and Microservice for Go Fiber Framework

GoDD is not framework but is architecture pattern and standard for easy communicate in your team. it helpful with api life-cycle pattern function for manage code propose

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AppAPIDocument

func AppAPIDocument() *fiber.App

AppAPIDocument Func

func AppMetricsPrometheus

func AppMetricsPrometheus(mainApp *fiber.App) *fiber.App

AppMetricsPrometheus Func

func MappingStandard

func MappingStandard(code int, dataList interface{}, responsePagination *ResponsePagination) (response ResponseDataList, err *Error)

MappingStandard Func

func MustError

func MustError(err error, str ...string)

MustError Func

Types

type APIHTTP

type APIHTTP struct {
	// contains filtered or unexported fields
}

APIHTTP Struct

func NewAPIHTTP

func NewAPIHTTP() *APIHTTP

NewAPI API

func (*APIHTTP) HandlerLogic

func (api *APIHTTP) HandlerLogic(handler HandlerLogic)

HandlerLogic func

func (*APIHTTP) MappingResponse

func (api *APIHTTP) MappingResponse(handler MappingResponse)

MappingResponse func

func (*APIHTTP) OnPostHandler

func (api *APIHTTP) OnPostHandler(handler OnPostHandler)

OnPostHandler func

func (*APIHTTP) OnPreAuth

func (api *APIHTTP) OnPreAuth(handler Handler)

OnPreAuth func

func (*APIHTTP) OnPreHandler

func (api *APIHTTP) OnPreHandler(handler OnPreHandler)

OnPreHandler func

func (*APIHTTP) OnPreResponse

func (api *APIHTTP) OnPreResponse(handler OnPreResponse)

OnPreResponse func

func (*APIHTTP) ParseRequest

func (api *APIHTTP) ParseRequest(handler ParseRequest)

ParseRequest func

func (*APIHTTP) SendResponse

func (api *APIHTTP) SendResponse(handler SendResponse)

SendResponse func

func (*APIHTTP) SetHandlerByPassLifeCycle

func (api *APIHTTP) SetHandlerByPassLifeCycle(handler fiber.Handler)

SetHandlerByPassLifeCycle API

func (*APIHTTP) SetupHandlerHTTP

func (api *APIHTTP) SetupHandlerHTTP(service interface{}) fiber.Handler

SetupHandlerHTTP API

func (*APIHTTP) ValidateAuth

func (api *APIHTTP) ValidateAuth(handler Handler)

ValidateAuth func

func (*APIHTTP) ValidateHeaders

func (api *APIHTTP) ValidateHeaders(handler Handler)

ValidateHeaders func

func (*APIHTTP) ValidateParams

func (api *APIHTTP) ValidateParams(handler Handler)

ValidateParams func

func (*APIHTTP) ValidateQuery

func (api *APIHTTP) ValidateQuery(handler Handler)

ValidateQuery func

func (*APIHTTP) ValidateRequest

func (api *APIHTTP) ValidateRequest(handler ValidateRequest)

ValidateRequest func

func (*APIHTTP) ValidateResponse

func (api *APIHTTP) ValidateResponse(handler ValidateResponse)

ValidateResponse func

type Context

type Context struct {
	Ctx     *fiber.Ctx
	Service interface{}
	State   map[string]interface{}
}

Context Struct

type Error

type Error struct {
	Code  int // Please Use http.Status
	Error error
}

Error Struct

type Handler

type Handler = func(context *Context) (err *Error)

Handler Type

type HandlerLogic

type HandlerLogic = func(context *Context, requestValidated interface{}) (code int, responseRaw interface{}, responsePagination *ResponsePagination, err *Error)

HandlerLogic Type

type InterfaceClose

type InterfaceClose interface {
	Close() error
}

InterfaceClose for Manage Defer Close

type MappingResponse

type MappingResponse = func(context *Context, code int, responseRaw interface{}, responsePagination *ResponsePagination) (codeOut int, responseMapping interface{}, responsePaginationOut *ResponsePagination, err *Error)

MappingResponse Type

type MappingResponseStandard

type MappingResponseStandard = func(context *Context, code int, responseRaw interface{}, responsePagination *ResponsePagination) (codeOut int, responseMapping interface{}, err *Error)

MappingResponseStandard Type

type MicroService

type MicroService struct {
	// contains filtered or unexported fields
}

MicroService Struct

func NewMicroService

func NewMicroService(app *fiber.App, path string, service interface{}) *MicroService

NewMicroService API

func (*MicroService) Add

func (ms *MicroService) Add(method string, path string, api *APIHTTP)

Add API

func (*MicroService) Delete

func (ms *MicroService) Delete(path string, api *APIHTTP)

Delete API

func (*MicroService) Get

func (ms *MicroService) Get(path string, api *APIHTTP)

Get API

func (*MicroService) Patch

func (ms *MicroService) Patch(path string, api *APIHTTP)

Patch API

func (*MicroService) Post

func (ms *MicroService) Post(path string, api *APIHTTP)

Post API

func (*MicroService) Put

func (ms *MicroService) Put(path string, api *APIHTTP)

Put API

type OnPostHandler

type OnPostHandler = func(context *Context, code int, responseRawIn interface{}, responsePagination *ResponsePagination) (codeOut int, responseRawOut interface{}, responsePaginationOut *ResponsePagination, err *Error)

OnPostHandler Type

type OnPreHandler

type OnPreHandler = func(context *Context, requestValidatedIn interface{}) (requestValidatedOut interface{}, err *Error)

OnPreHandler Type

type OnPreResponse

type OnPreResponse = func(context *Context, code int, requestValidatedIn interface{}) (codeOut int, requestValidatedOut interface{}, err *Error)

OnPreResponse Type

type ParseRequest

type ParseRequest = func(context *Context) (requestMapping interface{}, err *Error)

ParseRequest Type

type Portal

type Portal struct {
	// contains filtered or unexported fields
}

Portal Struct

func NewPortal

func NewPortal() *Portal

NewPortal Func

func (*Portal) AppendApp

func (pt *Portal) AppendApp(app *fiber.App, port string)

AppendApp Func

func (*Portal) AppendInterfaceClose

func (pt *Portal) AppendInterfaceClose(iList ...interface{})

AppendInterfaceClose Func

func (*Portal) StartServer

func (pt *Portal) StartServer()

StartServer Func

type RequestPagination

type RequestPagination struct {
	Page     int `json:"page"      swaggertype:"integer"`
	PageSize int `json:"page_size" swaggertype:"integer"`
}

RequestPagination Struct

type ResponseDataList

type ResponseDataList struct {
	Success            bool                `json:"success"              swaggertype:"boolean"`
	Message            string              `json:"message"              swaggertype:"string"`
	Data               interface{}         `json:"data,omitempty"       swaggertype:"object"`
	ResponsePagination *ResponsePagination `json:"pagination,omitempty" swaggertype:"object"`
	ResponseError      *ResponseError      `json:"error,omitempty"      swaggertype:"object"` // errors don't define JSON marshaling`
}

ResponseDataList for Send Response Message to Encode Response

type ResponseError

type ResponseError struct {
	Message string `json:"message" swaggertype:"string"`
}

ResponseError Struct

type ResponsePagination

type ResponsePagination struct {
	Page       int `json:"page"         swaggertype:"integer"`
	PageSize   int `json:"page_size"    swaggertype:"integer"`
	PageCount  int `json:"page_count"   swaggertype:"integer"`
	ItemCount  int `json:"item_count"   swaggertype:"integer"`
	TotalCount int `json:"total_count"  swaggertype:"integer"`
}

ResponsePagination Struct

type SendResponse

type SendResponse = func(context *Context, code int, requestValidated interface{}) (err *Error)

SendResponse Type

type ValidateRequest

type ValidateRequest = func(context *Context, requestMapping interface{}) (requestValidated interface{}, err *Error)

ValidateRequest Type

type ValidateResponse

type ValidateResponse = func(context *Context, code int, responseMapping interface{}, responsePagination *ResponsePagination) (codeOut int, responseValidated interface{}, responsePaginationOut *ResponsePagination, err *Error)

ValidateResponse Type

Directories

Path Synopsis
example

Jump to

Keyboard shortcuts

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