Documentation
¶
Overview ¶
Package searchgen provides the the ability to generate a search resolver
Index ¶
- Variables
- type Object
- type Options
- func WithEntGeneratedPackage(entPackage string) Options
- func WithGraphQLImport(graphqlImport string) Options
- func WithIDFields(fields []string) Options
- func WithIncludeAdminSearch(include bool) Options
- func WithModelPackage(modelPackage string) Options
- func WithRulePackage(pkg string) Options
- func WithSchemaPath(path string) Options
- type SearchPlugin
- type SearchResolverBuild
Constants ¶
This section is empty.
Variables ¶
var SearchDirective = entgql.NewDirective("search")
Functions ¶
This section is empty.
Types ¶
type Object ¶
type Object struct {
// Name of the object
Name string
// Fields of the object that are searchable
Fields []genhooks.Field
// AdminFields of the object that are searchable
AdminFields []genhooks.Field
}
Object is a struct to hold the object name for the bulk resolver
type Options ¶ added in v0.4.0
type Options func(*SearchPlugin)
Options is a function to set the options for the plugin
func WithEntGeneratedPackage ¶ added in v0.4.0
WithEntGeneratedPackage sets the ent generated package for the gqlgen model
func WithGraphQLImport ¶ added in v0.13.0
WithGraphQLImport sets the import path for the graphql package
func WithIDFields ¶ added in v0.4.4
WithIDFields sets the fields that are searchable by ID to be used as equal operations instead of like
func WithIncludeAdminSearch ¶ added in v0.12.1
WithIncludeAdminSearch enables the admin search resolver generation
func WithModelPackage ¶ added in v0.4.0
WithModelPackage sets the model package for the gqlgen model
func WithRulePackage ¶ added in v0.4.10
WithRulePackage sets the privacy rule package for the gqlgen model this is used to check for system admins
func WithSchemaPath ¶ added in v0.13.0
WithSchemaPath sets the path to the ent schema
type SearchPlugin ¶
type SearchPlugin struct {
// contains filtered or unexported fields
}
SearchPlugin is a gqlgen plugin to generate search functions
func NewWithOptions ¶ added in v0.4.0
func NewWithOptions(opts ...Options) *SearchPlugin
NewWithOptions returns a new search plugin with the given options
func (SearchPlugin) GenerateCode ¶
func (r SearchPlugin) GenerateCode(data *codegen.Data) error
GenerateCode implements api.CodeGenerator to generate the search resolver and it's helper functions
type SearchResolverBuild ¶
type SearchResolverBuild struct {
// Name of the search type
Name string
// Objects is a list of objects to generate bulk resolvers for
Objects []Object
// EntImport is the ent generated package that holds the generated types
EntImport string
// RuleImport is the package name for the privacy rules
RuleImport string
// ModelImport is the package name for the gqlgen model
ModelImport string
// ModelPackage is the package name for the gqlgen model
ModelPackage string
// GraphQLImport is the import path for the graphql package
GraphQLImport string
// IDFields are the fields that are IDs and should be searched with equals instead of like
IDFields []string
}
SearchResolverBuild is a struct to hold the objects for the bulk resolver