models

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Feb 12, 2020 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const TreeIndent = "   "

Variables

View Source
var DefaulMetadata = []string{
	"Title",
}

DefaultMetadata fields This is appended with configuration values

Functions

This section is empty.

Types

type Bookmark

type Bookmark struct {
	Id          int
	Name        string
	LowerName   string
	Description string
	Content     string
	Project     string
	CreatedAt   time.Time `db:"created_at"`
	UpdatedAt   time.Time `db:"updated_at"`
	Archived    bool

	Tags []string
	//Metadata key-values. Not in order
	Metadata *map[string]string
	//MetadataKeys provides ordered collection of keys
	MetadataKeys *[]string
}

func (*Bookmark) AddMetadata

func (b *Bookmark) AddMetadata(key, value string)

AddMetadata adds single key-value metadata to bookmark If key already exists, override it with new value

func (*Bookmark) AddTag

func (b *Bookmark) AddTag(tag string)

AddTag adds tag to bookmark. No duplicates are removed

func (*Bookmark) AddTags

func (b *Bookmark) AddTags(tags []string)

AddTags adds multiple tags to bookmark. No duplicates are removed

func (*Bookmark) ContentDomain

func (b *Bookmark) ContentDomain() string

Return domain of the content if it is a link

func (*Bookmark) FillDefaultMetadata

func (b *Bookmark) FillDefaultMetadata()

FillDefaultMetadata fills certain defaults as empty fields into metadata. Only apply default metadata if metadata is empty

func (*Bookmark) TagsString

func (b *Bookmark) TagsString(spaces bool) string

TagsString retuns string representation of tags. If spaces flag is set, put comma and space between tags No tags -> "", tags -> "a, b"

type Project

type Project struct {
	Name     string
	Children []*Project
	Parent   *Project
	Count    int
}

func NewProject

func NewProject(name string) *Project

func ParseTrees

func ParseTrees(data []string, counts []int) []*Project

ParseTrees parses array if strings and array of counts into tree of projects Data: e.g. ["project.a", "project.b", "project.a.b.c"] Count: e.g. [10,10,10]

func (*Project) FullName

func (p *Project) FullName() string

func (*Project) PrintChildren

func (p *Project) PrintChildren() string

func (*Project) String

func (p *Project) String() string

String returns string presentation of project. Only print project and its parents: c.string -> a.b.c, a.string -> a

func (*Project) TotalCount

func (p *Project) TotalCount() int

Jump to

Keyboard shortcuts

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