Documentation ¶
Index ¶
- Constants
- Variables
- func BatchFunc(fn LoaderFunc) dataloader.BatchFunc
- func ContainsField(ctx context.Context, field string) bool
- func Error(message string, opts ...ErrOption) *gqlerror.Error
- func ErrorPresenter(logger log.Logger) func(ctx context.Context, err error) *gqlerror.Error
- func EveryFields(ctx context.Context, fields ...string) bool
- func OffsetLimit(page *int, size *int) (offset int, limit int)
- func SomeFields(ctx context.Context, fields ...string) bool
- func SomeWhere(items ...any) bool
- func ToAnySlice(keys dataloader.Keys) []any
- func ToInts(keys dataloader.Keys) []int
- func ToStringKey(id any) dataloader.Key
- type ErrOption
- type ErrOptions
- type LoaderFunc
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 数据不存在
ErrUnauthorized 未授权
Functions ¶
func BatchFunc ¶
func BatchFunc(fn LoaderFunc) dataloader.BatchFunc
func ErrorPresenter ¶
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 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)
Click to show internal directories.
Click to hide internal directories.