about summary refs log tree commit diff stats
path: root/internal/nix/importable.go
blob: 46d46e33e516fa93d26a3665a92e8e5ab208a686 (plain)
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
package nix

import (
	"encoding/gob"

	"go.alanpearce.eu/searchix/internal/config"
)

type Importable interface {
	BleveType() string
	GetName() string
	GetSource() string
}

func GetKey(i Importable) string {
	return i.BleveType() + "/" + i.GetSource() + "/" + i.GetName()
}

func MakeKey(source *config.Source, id string) string {
	return source.Importer.Singular() + "/" + source.Key + "/" + id
}

func init() {
	gob.Register(Option{})
	gob.Register(Package{})
}