all repos — searchix @ v0.4.4

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

internal/nix/option.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
37
38
39
40
41
42
43
44
45
46
47
48
package nix

import (
	"time"

	"alin.ovh/searchix/internal/config"
	"alin.ovh/searchix/internal/nixdocs"
)

type Docs struct {
	Plain    string           `json:",omitempty"`
	Markdown nixdocs.Markdown `json:",omitempty"`
}

type Link struct {
	Name string
	URL  string
}

type Option struct {
	Name            string
	Source          string
	Declarations    []Link
	Default         *Docs `json:",omitempty"`
	Description     nixdocs.Markdown
	Example         *Docs `json:",omitempty"`
	Loc             []string
	Parents         string
	RelatedPackages nixdocs.Markdown `json:",omitempty"`
	Type            string
	ImportedAt      time.Time
}

func (Option) BleveType() string {
	return config.Options.Singular()
}

func (Option) ImporterType() string {
	return config.Options.String()
}

func (p Option) GetName() string {
	return p.Name
}

func (p Option) GetSource() string {
	return p.Source
}