internal

package
v0.0.0-...-f52ecc6 Latest Latest
Warning

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

Go to latest
Published: Oct 19, 2023 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// YYYY-MM-DD: 2022-03-23
	YYYYMMDD = "2006-01-02"
	// 24h hh:mm:ss: 14:23:20
	HHMMSS24h = "15:04:05"
)

Variables

This section is empty.

Functions

func GetYaml

func GetYaml(str string) string

func IncludeNote

func IncludeNote(filters map[string]string, note Node, logger *log.Logger) bool

func NewNoteService

func NewNoteService(logger *log.Logger, repo NodeRepository) *noteService

func NewTimeId

func NewTimeId() string

Types

type Filter

type Filter struct {
	Field string
	Value string
}

type Metadata

type Metadata struct {
	Title string
	Tags  string
}

func ExtractMetadata

func ExtractMetadata(content string) (Metadata, error)

func (*Metadata) GetTags

func (m *Metadata) GetTags() []string

func (*Metadata) IncludeTags

func (m *Metadata) IncludeTags(str string) bool

Include tags check that all tags are included in the metadata

type Node

type Node struct {
	Id      int32
	Title   string
	Content string
	Type    NodeType
	// contains filtered or unexported fields
}

func NewNote

func NewNote(title, content string) (Node, error)

type NodeRepository

type NodeRepository interface {
	Save(Node) error
	GetNodes() ([]Node, error)
}

func NewFsRepo

func NewFsRepo(logger *log.Logger, dirRoot string) NodeRepository

func NewSqliteNodeRepo

func NewSqliteNodeRepo(path string) NodeRepository

type NodeType

type NodeType string
const (
	TypeNote NodeType = "note"
)

type NoteService

type NoteService interface {
	New(title, content string) (Node, error)
	ListAll() ([]Node, error)
	ListAllTags() (map[string]int, error)
	GetByTitle(title string) (Node, error)
	Find([]Filter) ([]Node, error)
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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