conn

package module
v0.4.1 Latest Latest
Warning

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

Go to latest
Published: Oct 7, 2022 License: MIT Imports: 14 Imported by: 1

README

go_connector

Go structure for BendeckDev services

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	Get  requestType = "GET"
	Post requestType = "POST"
)
View Source
var DB *gorm.DB

Functions

func StartDB added in v0.4.1

func StartDB(path string, modules ...[]any)

Start && Migrate Database

Types

type Header struct {
	Name  string
	Value string
}

func (Header) Register

func (h Header) Register(req *http.Request)

type Request

type Request struct {
	Endpoint string
	Type     *requestType
	Headers  []Header
	Body     any
}

func (Request) Make

func (req Request) Make() Response

type Response

type Response struct {
	Data   any            `json:"data,omitempty"`
	Error  *errorResponse `json:"error,omitempty"`
	Status int            `json:"status"`
}

func BuildError

func BuildError(err error, status int) Response

func (*Response) Make

func (res *Response) Make()

func (Response) Send

func (res Response) Send(c echo.Context) error

type Server

type Server struct {
	Server  *echo.Echo
	HTTP2   bool
	LogFile string
	Debug   bool
}

func InitServer

func InitServer() *Server

Start server instance

func (Server) Start

func (s Server) Start()

Run Echo server

Jump to

Keyboard shortcuts

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