match

package
v0.22.1 Latest Latest
Warning

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

Go to latest
Published: Sep 2, 2026 License: MIT Imports: 2 Imported by: 0

Documentation

Overview

Package match implements SQL LIKE-style pattern matching for the Go filtering paths, so they return the same rows as the SQLite index paths.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CanonicalSpecies added in v0.22.0

func CanonicalSpecies(species string) string

CanonicalSpecies removes the GTDB alphabetic suffix from each whitespace word of a species name and collapses runs of whitespace to a single space, so a GTDB-suffixed name and the NCBI name a user types reduce to the same string. "Enterococcus_A faecium" and "Enterococcus faecium" both yield "Enterococcus faecium".

func Like

func Like(value, pattern string) bool

Like reports whether value matches pattern. % matches any sequence of characters, every other character including _ is literal, and matching is case-insensitive.

func SpeciesMatches added in v0.22.0

func SpeciesMatches(query, stored string) bool

SpeciesMatches reports whether a user-supplied species or genus query matches a stored GTDB name, case-insensitively. The GTDB suffix is stripped from the stored value only: an NCBI-style query ("Enterococcus faecium") matches every GTDB clade ("Enterococcus_A faecium", "Enterococcus_B faecium"), while a query that carries an explicit suffix ("Enterococcus_A faecium") still selects only that clade.

func ToSQLLike

func ToSQLLike(pattern string) string

ToSQLLike converts a pattern into the SQL LIKE equivalent of Like: lowercased for case-insensitive comparison against a lowercased column, % left as the wildcard, and _ escaped so it matches itself. The resulting pattern requires ESCAPE '\' on the LIKE clause.

Types

This section is empty.

Jump to

Keyboard shortcuts

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