interceptors

package
v0.7.10 Latest Latest
Warning

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

Go to latest
Published: Aug 14, 2024 License: Apache-2.0 Imports: 22 Imported by: 0

Documentation

Overview

Package interceptors is middleware to alter the graphql query

Index

Constants

This section is empty.

Variables

View Source
var (
	// ExistOperation is the operation type for Exist queries
	ExistOperation = "Exist"
	// IDsOperation is the operation type for IDs queries
	IDsOperation = "IDs"
)
View Source
var (
	// ErrInternalServerError is returned when an internal error occurs.
	ErrInternalServerError = errors.New("internal server error")

	// ErrUnableToRetrieveUserID is returned when the user cannot be retrieved from the context
	ErrUnableToRetrieveUserID = errors.New("unable to retrieve user from context")

	// ErrRetrievingObjects is returned when an error occurs while retrieving objects
	ErrRetrievingObjects = errors.New("error retrieving objects")
)

Functions

func HistoryAccess added in v0.7.7

func HistoryAccess(relation string, orgOwned, userOwed bool) ent.Interceptor

HistoryAccess is a traversal interceptor that checks if the user has the required role for the organization

func InterceptorAPIToken added in v0.5.0

func InterceptorAPIToken() ent.Interceptor

InterceptorAPIToken is middleware to change the api token query

func InterceptorGroup

func InterceptorGroup() ent.Interceptor

InterceptorGroup is middleware to change the Group query

func InterceptorHush added in v0.5.0

func InterceptorHush() ent.Interceptor

InterceptorHush keeps it secret, keeps it safe

func InterceptorOrgMember added in v0.7.6

func InterceptorOrgMember() ent.Interceptor

InterceptorOrgMember is middleware to change the OrgMember query result

func InterceptorOrganization

func InterceptorOrganization() ent.Interceptor

InterceptorOrganization is middleware to change the Organization query

func InterceptorOrganizationSetting added in v0.5.0

func InterceptorOrganizationSetting() ent.Interceptor

InterceptorOrganizationSetting is middleware to change the org setting query

func InterceptorPat added in v0.3.3

func InterceptorPat() ent.Interceptor

InterceptorPat is middleware to change the PAT query

func InterceptorUserSetting added in v0.5.2

func InterceptorUserSetting() ent.Interceptor

func QueryLogger

func QueryLogger(l *zap.SugaredLogger) ent.InterceptFunc

func TraverseOrgMembers added in v0.7.6

func TraverseOrgMembers() ent.Interceptor

TraverseOrgMembers is middleware to change the Org Members query

func TraverseUser added in v0.7.6

func TraverseUser() ent.Interceptor

TraverseUser returns an ent interceptor for user that filters users based on the context of the query

Types

type SkipMode added in v0.5.0

type SkipMode int

SkipMode is a bit flag for the Skip annotation.

const (
	// SkipOnlyQuery skips the interceptor on `Only` queries.
	SkipOnlyQuery SkipMode = 1 << iota
	// SkipAllQuery skips the interceptor on `All` queries.
	SkipAllQuery
	// SkipExistsQuery skips the interceptor on `Exists` queries.
	SkipExistsQuery

	// SkipAll is default mode to skip all.
	SkipAll = SkipOnlyQuery |
		SkipAllQuery |
		SkipExistsQuery
)

Jump to

Keyboard shortcuts

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