diff --git a/internal/db/gist.go b/internal/db/gist.go index b9e6675..276dcad 100644 --- a/internal/db/gist.go +++ b/internal/db/gist.go @@ -2,17 +2,17 @@ package db import ( "fmt" - "github.com/alecthomas/chroma/v2" - "github.com/alecthomas/chroma/v2/lexers" - "github.com/dustin/go-humanize" - "github.com/rs/zerolog/log" - "github.com/thomiceli/opengist/internal/index" "os/exec" "path/filepath" "strings" "time" + "github.com/alecthomas/chroma/v2" + "github.com/alecthomas/chroma/v2/lexers" + "github.com/dustin/go-humanize" + "github.com/rs/zerolog/log" "github.com/thomiceli/opengist/internal/git" + "github.com/thomiceli/opengist/internal/index" "gorm.io/gorm" ) @@ -24,6 +24,19 @@ const ( PrivateVisibility ) +func (v Visibility) String() string { + switch v { + case PublicVisibility: + return "public" + case UnlistedVisibility: + return "unlisted" + case PrivateVisibility: + return "private" + default: + return "???" + } +} + func (v Visibility) Next() Visibility { switch v { case PublicVisibility: