resolverutils

package
v0.0.0-...-26e87fa Latest Latest
Warning

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

Go to latest
Published: May 30, 2026 License: BSD-2-Clause Imports: 16 Imported by: 0

Documentation

Overview

Package resolverutils provides utility functions for GraphQL resolvers, including functions to convert GraphQL filters into query strings for database queries.

Index

Constants

This section is empty.

Variables

View Source
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,
			)
		},
	)
)
View Source
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 GetCursor

func GetCursor(c *int) int64

func GetCursorFP

func GetCursorFP(cursor *int) int64

func GetFilter

func GetFilter(f *string) string

func GetLimit

func GetLimit(l *int) int64

func GetLimitFP

func GetLimitFP(limit *int) int64

func GetOntology

func GetOntology(onto string) string

func PlasmidFilterToQuery

func PlasmidFilterToQuery(filter *models.PlasmidListFilter) (string, error)

func StrainFilterToQuery

func StrainFilterToQuery(filter *models.StrainListFilter) (string, error)

func StrainFilterToQueryFP

func StrainFilterToQueryFP(filter *models.StrainListFilter) IOE.IOEither[error, string]

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.

Jump to

Keyboard shortcuts

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