gql

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Oct 12, 2024 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	FieldCount = "count"
	FieldItems = "items"
)
View Source
const CustomErrorKey string = "custom"

Variables

View Source
var ErrAccessDenied = Error("access denied", WithErrCode("AccessDenied"))

ErrAccessDenied 拒绝访问,无角色或身份

View Source
var ErrDeprecated = Error("deprecated", WithErrCode("Deprecated"))

ErrDeprecated 方法已弃用

View Source
var ErrDisabled = Error("disabled", WithErrCode("Disabled"))

ErrDisabled 已禁用

View Source
var ErrNoPermission = Error("no permission", WithErrCode("NoPermission"))

ErrNoPermission 无权限

View Source
var ErrNotFound = Error("data not found", WithErrCode("NotFound"))

ErrNotFound 数据不存在

View Source
var ErrUnauthorized = Error("unauthorized", WithErrCode("Unauthorized"))

ErrUnauthorized 未授权

Functions

func BatchFunc

func BatchFunc(fn LoaderFunc) dataloader.BatchFunc

func ContainsField

func ContainsField(ctx context.Context, field string) bool

ContainsField 包含字段

func Error

func Error(message string, opts ...ErrOption) *gqlerror.Error

func ErrorPresenter

func ErrorPresenter(logger log.Logger) func(ctx context.Context, err error) *gqlerror.Error

func EveryFields

func EveryFields(ctx context.Context, fields ...string) bool

EveryFields 每个字段都包含

func OffsetLimit

func OffsetLimit(page *int, size *int) (offset int, limit int)

func SomeFields

func SomeFields(ctx context.Context, fields ...string) bool

SomeFields 包含任意字段

func SomeWhere

func SomeWhere(items ...any) bool

func ToAnySlice

func ToAnySlice(keys dataloader.Keys) []any

func ToInts

func ToInts(keys dataloader.Keys) []int

func ToStringKey

func ToStringKey(id any) dataloader.Key

Types

type ErrOption

type ErrOption func(*ErrOptions)

func WithErrCode

func WithErrCode(code string) ErrOption

type ErrOptions

type ErrOptions struct {
	// contains filtered or unexported fields
}

type LoaderFunc

type LoaderFunc func(ctx context.Context, keys dataloader.Keys) (map[dataloader.Key]any, error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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