mon

package module
v0.0.0-...-5031c71 Latest Latest
Warning

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

Go to latest
Published: Jul 2, 2021 License: Apache-2.0 Imports: 14 Imported by: 0

README

mon-go

Go starter pack and reusable packages

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func InitiateLog

func InitiateLog(level string)

func NewConfig

func NewConfig(folderPath string, config interface{})

NewConfig sets config using yaml format

Types

type Echo

type Echo struct {
	App *echo.Echo
}

func (*Echo) GetApp

func (e *Echo) GetApp() *echo.Echo

func (*Echo) Start

func (e *Echo) Start(addr string)

type Hasura

type Hasura struct {
	GraphqlURL string
	Secret     string
	Query      string

	ResponseKey   string
	ResponseModel interface{}
}

func (*Hasura) Exec

func (h *Hasura) Exec(variables interface{}, headers map[string]string) error

func (*Hasura) SetResponseKey

func (h *Hasura) SetResponseKey(key string) IHasura

func (*Hasura) SetResponseModel

func (h *Hasura) SetResponseModel(model interface{}) IHasura

type HasuraResponseSchema

type HasuraResponseSchema struct {
	Data   interface{} `json:"data,omitempty"`
	Errors interface{} `json:"errors,omitempty"`
}

type IEcho

type IEcho interface {
	// GetApp returns echo.Echo object
	GetApp() *echo.Echo

	// Start starts the application server
	Start(addr string)
}

func NewEcho

func NewEcho() IEcho

type IHasura

type IHasura interface {
	// SetResponseKey sets response key
	// e.g. in hasura return data.user then response key is "user"
	SetResponseKey(key string) IHasura

	// SetResponseModel sets response model/schema
	// Struct with json tag
	SetResponseModel(model interface{}) IHasura

	// Exec returns nil if calling graphql API returns success
	Exec(variables interface{}, headers map[string]string) error
}

func NewHasura

func NewHasura(graphqlURL string, secret string, filepath string) (IHasura, error)

NewHasura initiates hasura client object @params filepath set the .gql file

type IJwt

type IJwt interface {
	// Encrypt returns encrypted json web token
	Encrypt(data jwt.MapClaims) (string, error)

	// Decrypt returns map-claim after successfully parses and validate json web token
	// based on secret and signing method
	Decrypt(token string) (jwt.MapClaims, error)
}

func NewJwt

func NewJwt(secret string, signingMethod string) IJwt

type ILog

type ILog interface {
	SetMessage(msg string) ILog
	SetError(err error) ILog

	Info()
	Debug()
	Error(err error) error
}

func NewLog

func NewLog(filename string, method string, data interface{}) ILog

type Jwt

type Jwt struct {
	Secret        string
	SigningMethod string
}

func (*Jwt) Decrypt

func (j *Jwt) Decrypt(tokenStr string) (jwt.MapClaims, error)

func (*Jwt) Encrypt

func (j *Jwt) Encrypt(data jwt.MapClaims) (string, error)

Jump to

Keyboard shortcuts

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