sn

package
v0.0.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 27, 2024 License: MIT Imports: 60 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	Vfs           afero.Fs
	GitMemStorage *memory.Storage
	Repo          *git.Repository
)

Functions

func BasicAuthMiddleware

func BasicAuthMiddleware(next http.Handler) http.Handler

func CloneRepoToVFS

func CloneRepoToVFS(snGitRepo string) (afero.Fs, error)

func CompareFileStates

func CompareFileStates(prev, curr map[string]FileState) []string

CompareFileStates compares the current state with the previous state and returns the changed files

func ConfigPath

func ConfigPath(configKey string, opts ...ConfigPathOptionFn) string

ConfigPath returns the absolute path defined for a configuration key

func ConfigSetup

func ConfigSetup() (afero.Fs, error)

func ConfigStringDefault

func ConfigStringDefault(configLocation string, defaultVal string) string

func CopyMap

func CopyMap(m map[string]interface{}) map[string]interface{}

func DBClose

func DBClose()

func DBConnect

func DBConnect()

func DBLoadRepo

func DBLoadRepo(repoName string)

func DBLoadRepos

func DBLoadRepos()

func DBLoadReposSync

func DBLoadReposSync()

func DBQuery

func DBQuery(query string) (*sql.Rows, error)

func DirExists

func DirExists(dir string) bool

func DirExistsFs

func DirExistsFs(fs afero.Fs, path string) bool

func GetFileStates

func GetFileStates(fs afero.Fs, dir string, filter *regexp.Regexp) (map[string]FileState, error)

GetFileStates returns the current state of the files in the given directory

func GetTemplateFilesFromConfig

func GetTemplateFilesFromConfig(configPath string) []string

func LogMiddleware

func LogMiddleware(next http.Handler) http.Handler

func MaxOf

func MaxOf(vars ...int) int

func MinOf

func MinOf(vars ...int) int

func PrintMap

func PrintMap(data map[string]interface{}, indent string) string

func RegisterPartials

func RegisterPartials()

func RegisterTemplateHelpers

func RegisterTemplateHelpers()

func RenderTemplateFiles

func RenderTemplateFiles(filenames []string, context map[string]interface{}) (string, error)

func RowToMapSlice

func RowToMapSlice(rows *sql.Rows) ([][]string, error)

func StartWatching

func StartWatching(path string, repoName string)

StartWatching starts watching the given directory for changes

func WebserverStart

func WebserverStart()

Types

type Authenticator

type Authenticator struct {
	User         *User
	ID           []byte
	CredentialID []byte
	PublicKey    []byte
	AAGUID       []byte
	SignCount    uint32
}

func (*Authenticator) WebAuthAAGUID

func (a *Authenticator) WebAuthAAGUID() []byte

func (*Authenticator) WebAuthCredentialID

func (a *Authenticator) WebAuthCredentialID() []byte

func (*Authenticator) WebAuthID

func (a *Authenticator) WebAuthID() []byte

func (*Authenticator) WebAuthPublicKey

func (a *Authenticator) WebAuthPublicKey() []byte

func (*Authenticator) WebAuthSignCount

func (a *Authenticator) WebAuthSignCount() uint32

type Author

type Author struct {
	Name  string
	Count int
}

type Category

type Category struct {
	Name  string
	Count int
}

type ConfigPathOptionFn

type ConfigPathOptionFn func(f *ConfigPathOptions)

func MustExist

func MustExist() ConfigPathOptionFn

func OptionallyExist

func OptionallyExist() ConfigPathOptionFn

func WithDefault

func WithDefault(def string) ConfigPathOptionFn

type ConfigPathOptions

type ConfigPathOptions struct {
	HasDefault bool
	Default    string
	MustExist  bool
}

type FileState

type FileState struct {
	Path    string
	ModTime time.Time
}

FileState represents the state of a file

type FileSystem

type FileSystem interface {
	Open(name string) (fs.File, error)
	ReadDir(name string) ([]fs.DirEntry, error)
}

FileSystem is an interface that includes the methods required by both embed.FS and http.FileSystem.

type Item

type Item struct {
	Title       string
	Slug        string
	Repo        string
	Categories  []string
	Authors     []string
	Frontmatter map[string]string
	Date        time.Time
	RawDate     string
	Raw         string
	Html        string
	Source      string
	Id          int64
}

Item is...

type ItemQuery

type ItemQuery struct {
	PerPage     int
	Page        int
	Slug        *string
	Repo        *string
	Category    *string
	Author      *string
	Search      *string
	OrderBy     *string
	Frontmatter map[string]string
}

type ItemResult

type ItemResult struct {
	Items    []Item
	Total    int
	Paginate int
	Pages    int
	Page     int
}

func ItemsFromItemQuery

func ItemsFromItemQuery(qry ItemQuery) ItemResult

func ItemsFromOutvals

func ItemsFromOutvals(outVariableParams map[string]interface{}, context map[string]interface{}) ItemResult

type SpacesConfig

type SpacesConfig struct {
	SpaceName   string
	Endpoint    string
	AccessKeyID string
	SecretKey   string
	Region      string
}

type Storage

type Storage struct {
	// contains filtered or unexported fields
}

func (*Storage) AddAuthenticator

func (s *Storage) AddAuthenticator(user webauthn.User, authenticator webauthn.Authenticator) error

func (*Storage) GetAuthenticator

func (s *Storage) GetAuthenticator(id []byte) (webauthn.Authenticator, error)

func (*Storage) GetAuthenticators

func (s *Storage) GetAuthenticators(user webauthn.User) ([]webauthn.Authenticator, error)

type User

type User struct {
	Name           string                    `json:"name"`
	Authenticators map[string]*Authenticator `json:"-"`
}

func (*User) WebAuthDisplayName

func (u *User) WebAuthDisplayName() string

func (*User) WebAuthID

func (u *User) WebAuthID() []byte

func (*User) WebAuthName

func (u *User) WebAuthName() string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL