loli2

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Feb 1, 2019 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FindUpperRepo

func FindUpperRepo(path string) (repoPath string, ok bool)

FindUpperRepo will detect all upper paths and return the nearest repo path.

func IsComplexNote

func IsComplexNote(path string) bool

IsComplexNote check a path is a complex note.

It would not consider this path may shadowed by some noise dir.

func IsNoise

func IsNoise(path string) bool

IsNoise test the path is a noise in lolinote.

This function doesn't consider it may be shadowed by other noise or attachment directory.

func IsRepo

func IsRepo(path string) bool

IsRepo detect a path is a Repo or not.

func IsSimpleNote

func IsSimpleNote(path string) bool

IsSimpleNote check a path is a simple note.

It would not consider this path may shadowed by some noise or attachment dir.

Types

type ComplexNote

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

ComplexNote is a complex note instance in lolinote.

func (*ComplexNote) ContentPath

func (n *ComplexNote) ContentPath() string

ContentPath return note's content filepath.

func (*ComplexNote) ContentType

func (n *ComplexNote) ContentType() string

ContentType return note's conent type.

func (*ComplexNote) JSON added in v0.1.0

func (n *ComplexNote) JSON() []byte

JSON return the json string of this note.

func (*ComplexNote) MTime

func (n *ComplexNote) MTime() time.Time

MTime return note's modtime.

func (*ComplexNote) Path

func (n *ComplexNote) Path() string

Path return note's entry.

func (*ComplexNote) Title

func (n *ComplexNote) Title() string

Title return note's title.

type Dir

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

Dir represent a lolinote-folder structure in lolinote.

Notice: not all fs-folder was a lolinote-folder. Some fs-folder was the "leaf" structure in lolinote data tree, such as ComplexNote, Noise dir, sub repo, etc.

func (Dir) All

func (d Dir) All() []Entry

All return all elem under this folder with string's order.

func (Dir) Dirs

func (d Dir) Dirs() []Dir

Dirs return all Dir under this folder with string's order.

func (Dir) Path

func (d Dir) Path() string

Path return dir's path.

func (Dir) Walk

func (d Dir) Walk(walkfn func(Entry))

Walk can call the walkfn on all entries in all the sub-tree entries recursively. but not call walkfn on d itself.

type Entry

type Entry interface {
	Path() string
}

Entry is a interface reference to Lolinote fs entry.

type Noise

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

Noise is noise instance in lolinote.

func (Noise) Path

func (n Noise) Path() string

Path return noise's path.

type Note

type Note interface {
	Path() string
	Title() string
	ContentPath() string
	ContentType() string
	MTime() time.Time
	JSON() []byte
}

Note is interface to represent a note in lolinote 2

type Repo

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

Repo represent a Lolinote Repository.

func NewRepo

func NewRepo(path string, create bool) (r Repo, err error)

NewRepo create a new Repo object.

If create is true, create a repo at the (exact) path in filesystem. If create is false, try to find the repo by path in filesystem.

err != nil only when can not return a vaild repo.

func (Repo) Dir

func (r Repo) Dir() Dir

Dir retuen the Dir of this repo's root.

func (*Repo) NotesByMod

func (r *Repo) NotesByMod() *arraylist.List

NotesByMod return a slice contain all sub-notes ordering by modtime (desc).

func (*Repo) NotesByRel

func (r *Repo) NotesByRel(terms []string, textTypes sets.Set) *arraylist.List

NotesByRel return a slice contain all sub-notes ordering by relevance.

func (Repo) Path

func (r Repo) Path() string

Path retuen the path of this repo.

type SimpleNote

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

SimpleNote is a simple note instance in lolinote.

func (SimpleNote) ContentPath

func (n SimpleNote) ContentPath() string

ContentPath return note's content filepath.

func (SimpleNote) ContentType

func (n SimpleNote) ContentType() string

ContentType return note's conent type.

func (*SimpleNote) JSON added in v0.1.0

func (n *SimpleNote) JSON() []byte

JSON return the json string of this note.

func (*SimpleNote) MTime

func (n *SimpleNote) MTime() time.Time

MTime return note's modtime.

func (SimpleNote) Path

func (n SimpleNote) Path() string

Path return note's entry.

func (SimpleNote) Title

func (n SimpleNote) Title() string

Title return note's title.

Directories

Path Synopsis
Package simplerepo offer test simple for loli2 project.
Package simplerepo offer test simple for loli2 project.

Jump to

Keyboard shortcuts

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