mon

package module
v0.0.0-...-3ff86dc Latest Latest
Warning

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

Go to latest
Published: Jun 29, 2021 License: Apache-2.0 Imports: 9 Imported by: 0

README

mon

Go starter pack and reusable packages

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewConfig

func NewConfig(folderPath string, config interface{})

NewConfig sets config using yaml format

Types

type Hasura

type Hasura struct {
	GraphqlURL string
	Secret     string
	Query      string
}

func (*Hasura) Exec

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

func (*Hasura) ReadGqlFile

func (h *Hasura) ReadGqlFile(filepath string) error

type IHasura

type IHasura interface {
	// ReadGqlFile sets grapqhl query by reading .gql or .graphql file
	ReadGqlFile(filepath string) error

	// Exec returns nil if calling graphql API returns success
	// and it will set the response in the response object
	Exec(variables interface{}, response interface{}, headers map[string]string) error
}

func NewHasura

func NewHasura(graphqlURL string, secret string) IHasura

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 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