gqlreq

package
v0.0.1-alpha.8 Latest Latest
Warning

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

Go to latest
Published: Oct 18, 2021 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const HASURA_ADMIN_SECRET_HEADER_NAME = "X-Hasura-Admin-Secret"

Variables

This section is empty.

Functions

func ConfigAdminSecret

func ConfigAdminSecret() string

func ConfigGraphqlURL

func ConfigGraphqlURL() string

func ConfigHasuraAccountHeader

func ConfigHasuraAccountHeader() string

func ConfigHasuraRoleHeader

func ConfigHasuraRoleHeader() string

func ConfigHasuraUserIdHeader

func ConfigHasuraUserIdHeader() string

func InterfaceToJson

func InterfaceToJson(data interface{}) (string, error)

func TimestampToGraphQlTimestamWithTimeszone

func TimestampToGraphQlTimestamWithTimeszone(timestamp int64) string

Types

type Executer

type Executer interface {
	Execute(c context.Context, q string, headers []RequestHeader, vars []RequestVar, setHasuraAdminSecret bool, result interface{}) error
}

type ExecuterImpl

type ExecuterImpl struct {
	Client GraphQlClient
}

func (*ExecuterImpl) Execute

func (s *ExecuterImpl) Execute(c context.Context, q string, headers []RequestHeader, vars []RequestVar, setHasuraAdminSecret bool, result interface{}) error

type ExecuterMock

type ExecuterMock struct {
	mock.Mock
}

func (*ExecuterMock) Execute

func (m *ExecuterMock) Execute(c context.Context, q string, headers []RequestHeader, vars []RequestVar, setHasuraAdminSecret bool, result interface{}) error

type GraphQlClient

type GraphQlClient interface {
	Run(c context.Context, req *graphql.Request, res interface{}) error
}

type HeaderInfo

type HeaderInfo struct {
	AccountId string
	UserId    string
	Role      string
}

type HeaderInfoGetter

type HeaderInfoGetter interface {
	GetHeaderInfo(r *http.Request) (*HeaderInfo, error)
}

type HeaderInfoGetterImpl

type HeaderInfoGetterImpl struct {
}

func (*HeaderInfoGetterImpl) GetHeaderInfo

func (s *HeaderInfoGetterImpl) GetHeaderInfo(r *http.Request) (*HeaderInfo, error)

func (*HeaderInfoGetterImpl) GetSessionInfo

func (s *HeaderInfoGetterImpl) GetSessionInfo(r map[string]interface{}) (*HeaderInfo, error)

type HeaderInfoGetterMock

type HeaderInfoGetterMock struct {
	mock.Mock
}

func (*HeaderInfoGetterMock) GetHeaderInfo

func (m *HeaderInfoGetterMock) GetHeaderInfo(r *http.Request) (*HeaderInfo, error)

type InsertBaseResponse

type InsertBaseResponse struct {
	Returning    []InsertBaseResponseID `json:"returning"`
	AffectedRows int                    `json:"affected_rows"`
}

type InsertBaseResponseID

type InsertBaseResponseID struct {
	ID string `json:"id"`
}

type RequestHeader

type RequestHeader struct {
	Key   string
	Value string
}

type RequestVar

type RequestVar struct {
	Key   string
	Value interface{}
}

type Service

type Service interface {
	Executer
	HeaderInfoGetter
	SessionInfoGetter
}

func NewService

func NewService() Service

func NewServiceMock

func NewServiceMock() Service

type SessionInfoGetter

type SessionInfoGetter interface {
	GetSessionInfo(r map[string]interface{}) (*HeaderInfo, error)
}

type SessionInfoGetterImpl

type SessionInfoGetterImpl struct {
}

type SessionInfoGetterMock

type SessionInfoGetterMock struct {
	mock.Mock
}

func (*SessionInfoGetterMock) GetSessionInfo

func (m *SessionInfoGetterMock) GetSessionInfo(r map[string]interface{}) (*HeaderInfo, error)

Jump to

Keyboard shortcuts

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