Documentation
¶
Index ¶
- func Chunks[T any](slice []T, chunkSize int) [][]T
- func ExtractDOI(doi string) string
- func GetDBPath(ctx context.Context) (string, bool)
- func GetRootDir(ctx context.Context) (string, bool)
- func InvertAbstract(abstractInvertedIndex *map[string][]int) string
- func InvertName(name string) string
- func Keep[T any](options ...*T) *T
- func KeepLongestSlice[T any](a, b []T) []T
- func KeepLongestString(a, b string) string
- func Limit[T any](slice []T, n int, compare func(a, b T) int) []T
- func SetDefaultLogger(verbose bool)
- func WithDBPath(ctx context.Context, dbPath string) context.Context
- func WithRootDir(ctx context.Context, rootDir string) context.Context
- func WrapText(text string, limit int) string
- type ContextKey
- type FoldedString
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ExtractDOI ¶
ExtractDOI extracts the DOI from a given DOI string, removing any prefixes.
func GetDBPath ¶ added in v0.3.0
GetDBPath retrieves the SQLite database file path from the context if present.
func GetRootDir ¶
GetRootDir retrieves the root directory from the context if present.
func InvertAbstract ¶
InvertAbstract returns the string representation of an inverted abstract.
func InvertName ¶
InvertName inverts the name from "First Last" to "Last, First".
func Keep ¶
func Keep[T any](options ...*T) *T
Keep returns the first non-nil option from the given list of options.
func KeepLongestSlice ¶
func KeepLongestSlice[T any](a, b []T) []T
KeepLongestSlice returns the longest of two slices
func KeepLongestString ¶
KeepLongestString returns the longest of two strings.
func SetDefaultLogger ¶
func SetDefaultLogger(verbose bool)
SetDefaultLogger configures and registers the default application slog logger using tinted console output.
func WithDBPath ¶ added in v0.3.0
WithDBPath overrides the database path in the context.
func WithRootDir ¶
WithRootDir attaches the root directory and default SQLite DB path to the context.
Types ¶
type ContextKey ¶
type ContextKey string
ContextKey represents context keys used for storing and retrieving configuration values.
type FoldedString ¶
type FoldedString string
FoldedString is a string type that serializes to YAML using folded style (>).
func NewFoldedString ¶
func NewFoldedString(s *string) *FoldedString
NewFoldedString creates a new FoldedString pointer from a string pointer.
func (FoldedString) MarshalYAML ¶
func (f FoldedString) MarshalYAML() (any, error)
MarshalYAML implements the yaml.Marshaler interface using folded style.