about summary refs log tree commit diff stats
path: root/internal/importer/ingest.go
diff options
context:
space:
mode:
authorAlan Pearce2024-05-16 17:03:55 +0200
committerAlan Pearce2024-05-16 17:03:55 +0200
commitf79f1deb956cd3f5788e7f602d883417badaebbd (patch)
tree0d92735f8af305c376169efe3c4d92cf45c86df2 /internal/importer/ingest.go
parenteb88ab15adaf23a61c783afe76b646855814d38a (diff)
downloadsearchix-f79f1deb956cd3f5788e7f602d883417badaebbd.tar.lz
searchix-f79f1deb956cd3f5788e7f602d883417badaebbd.tar.zst
searchix-f79f1deb956cd3f5788e7f602d883417badaebbd.zip
refactor(importer): move functions to utils file
Diffstat (limited to 'internal/importer/ingest.go')
-rw-r--r--internal/importer/ingest.go50
1 files changed, 0 insertions, 50 deletions
diff --git a/internal/importer/ingest.go b/internal/importer/ingest.go
index f78722a..349b0ac 100644
--- a/internal/importer/ingest.go
+++ b/internal/importer/ingest.go
@@ -2,9 +2,7 @@ package importer
 
 import (
 	"context"
-	"fmt"
 	"log/slog"
-	"net/url"
 	"os"
 	"reflect"
 	"searchix/internal/config"
@@ -36,54 +34,6 @@ type nixOptionJSON struct {
 	Type            string
 }
 
-func ValueTypeToString(valueType jstream.ValueType) string {
-	switch valueType {
-	case jstream.Unknown:
-		return "unknown"
-	case jstream.Null:
-		return "null"
-	case jstream.String:
-		return "string"
-	case jstream.Number:
-		return "number"
-	case jstream.Boolean:
-		return "boolean"
-	case jstream.Array:
-		return "array"
-	case jstream.Object:
-		return "object"
-	}
-
-	return "very strange"
-}
-
-func makeGitHubFileURL(userRepo string, ref string, subPath string) string {
-	if ref == "" {
-		ref = "master"
-	}
-	url, _ := url.JoinPath("https://github.com/", userRepo, "blob", ref, subPath)
-
-	return url
-}
-
-// make configurable?
-var channelRepoMap = map[string]string{
-	"nixpkgs":      "NixOS/nixpkgs",
-	"nix-darwin":   "LnL7/nix-darwin",
-	"home-manager": "nix-community/home-manager",
-}
-
-func MakeChannelLink(channel string, ref string, subPath string) (*options.Link, error) {
-	if channelRepoMap[channel] == "" {
-		return nil, fmt.Errorf("don't know what repository relates to channel <%s>", channel)
-	}
-
-	return &options.Link{
-		Name: fmt.Sprintf("<%s/%s>", channel, subPath),
-		URL:  makeGitHubFileURL(channelRepoMap[channel], ref, subPath),
-	}, nil
-}
-
 func convertNixValue(nj *nixValueJSON) *options.NixValue {
 	if nj == nil {
 		return nil