all repos — searchix @ f23d67df63defd5f6fe6773789851dd63f3ac829

Search engine for NixOS, nix-darwin, home-manager and NUR users

internal/components/data.go (view raw)

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
package components

import (
	"go.alanpearce.eu/searchix/frontend"
	"go.alanpearce.eu/searchix/internal/config"
	search "go.alanpearce.eu/searchix/internal/index"
	"go.alanpearce.eu/searchix/internal/nix"
)

type TemplateData struct {
	Sources       []*config.Source
	Source        *config.Source
	Query         string
	ExtraHeadHTML string
	Code          int
	Message       string
	Assets        *frontend.AssetCollection
}

type ResultData struct {
	TemplateData
	Query   string
	Results *search.Result
	Prev    string
	Next    string
	All     string
}

func convertMatch[I nix.Importable](m nix.Importable) *I {
	i, ok := m.(I)
	if !ok {
		return nil
	}

	return &i
}