genhooks

package
v0.2.2 Latest Latest
Warning

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

Go to latest
Published: Sep 26, 2024 License: Apache-2.0 Imports: 17 Imported by: 1

Documentation

Overview

Package genhooks provides a set of entgo hooks for generating files from the ent schema.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GenQuery

func GenQuery(graphSchemaDir string) gen.Hook

GenQuery generates graphql queries when not specified to be skipped

func GenSchema

func GenSchema(graphSchemaDir string) gen.Hook

GenSchema generates graphql schemas when not specified to be skipped

func GenSearchSchema

func GenSearchSchema(graphSchemaDir, graphQueryDir string) gen.Hook

GenSchema generates graphql schemas when specified to be searchable

func GetSearchableFields

func GetSearchableFields(schemaName string, graph *gen.Graph) (fields []Field, adminFields []Field)

GetSearchableFields returns a list of searchable fields for a schema based on the search annotation all fields will be included in the admin search whereas only fields with the search annotation will be included in the global search

Types

type Field added in v0.1.5

type Field struct {
	// Name of the field
	Name string
	// Type of the field (string, json, etc)
	Type string
	// Path for JSON fields
	Path string
	// DotPath for JSON fields
	DotPath string
}

Field is a struct to hold the field name and type

type Object

type Object struct {
	// Name of the object
	Name string
	// Fields that are searchable for object
	Fields []Field
	// AdminFields are fields that are only searchable by admin
	AdminFields []Field
}

Object is a struct to hold the object name for the search resolver

Jump to

Keyboard shortcuts

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