Documentation
¶
Overview ¶
Package resolverutils provides utility functions for GraphQL resolvers, including functions to convert GraphQL filters into query strings for database queries.
Index ¶
- Variables
- func BacterialAnnotationFilter() string
- func BuildPlasmidFieldQuery(filter *models.PlasmidListFilter) string
- func GetCursor(c *int) int64
- func GetCursorFP(cursor *int) int64
- func GetFilter(f *string) string
- func GetLimit(l *int) int64
- func GetLimitFP(limit *int) int64
- func GetOntology(onto string) string
- func PlasmidFilterToQuery(filter *models.PlasmidListFilter) (string, error)
- func StrainFilterToQuery(filter *models.StrainListFilter) (string, error)
- func StrainFilterToQueryFP(filter *models.StrainListFilter) IOE.IOEither[error, string]
- func TimeWithPointer(pbt *timestamppb.Timestamp) *time.Time
Constants ¶
This section is empty.
Variables ¶
var ( CheckIDField = E.FromPredicate( isNilID, func(filter *models.PlasmidListFilter) error { return fmt.Errorf( "plasmid list filter %v: id filter is not yet supported in stock query conversion", filter, ) }, ) CheckInStockField = E.FromPredicate( isNilInStock, func(filter *models.PlasmidListFilter) error { return fmt.Errorf( "plasmid list filter %v: in_stock filter is not yet supported in stock query conversion", filter, ) }, ) )
var ( CheckStrainIDField = E.FromPredicate( isNilStrainID, func(f *models.StrainListFilter) error { return fmt.Errorf( "strain list filter %v: id filter is not yet supported", f, ) }, ) CheckStrainInStockField = E.FromPredicate( isNilStrainInStock, func(f *models.StrainListFilter) error { return fmt.Errorf( "strain list filter %v: in_stock filter is not yet supported", f, ) }, ) )
Functions ¶
func BacterialAnnotationFilter ¶
func BacterialAnnotationFilter() string
BacterialAnnotationFilter returns the annotation service filter DSL that matches strains annotated as "bacterial food source" in dicty_strain_characteristics — the sole criterion for bacterial strains.
func BuildPlasmidFieldQuery ¶
func BuildPlasmidFieldQuery(filter *models.PlasmidListFilter) string
func GetCursorFP ¶
func GetLimitFP ¶
func GetOntology ¶
func PlasmidFilterToQuery ¶
func PlasmidFilterToQuery(filter *models.PlasmidListFilter) (string, error)
func StrainFilterToQuery ¶
func StrainFilterToQuery(filter *models.StrainListFilter) (string, error)
func StrainFilterToQueryFP ¶
StrainFilterToQueryFP converts a StrainListFilter to an annotation-service internal query string, validating the filter's fields and returning an error if any are invalid or unsupported. The filter's label and summary fields are converted to regex queries, and the strain type is used to look up the appropriate query string from the strainTypeQueryMap. The filter's id and in_stocking fields are not yet supported and will cause an error if present.
func TimeWithPointer ¶
func TimeWithPointer(pbt *timestamppb.Timestamp) *time.Time
Types ¶
This section is empty.