idea

package
v0.0.0-...-7b473d3 Latest Latest
Warning

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

Go to latest
Published: Mar 5, 2022 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Last = "last" // last id keyword

	CycleAlive = iota
	CycleConsumed
	CycleZombie

	KindText = iota
	KindImage
	KindAudio
	KindEnText
)

Variables

View Source
var (
	AllAliveKeyword    = "ALL"
	AllConsumedKeyword = "ALL-CONSUMED"
	AllZombieKeyword   = "ALL-ZOMBIE"
)
View Source
var (
	ContainsKeyword     = "CONTAINS"
	ContainsCIKeyword   = "CONTAINS-CI"
	NoContainsKeyword   = "NO-CONTAINS"
	NoContainsCIKeyword = "NO-CONTAINS-CI"
)
View Source
var (
	CreatedDateKeyword   = "DATE"
	CreatedYearKeyword   = "YEAR"
	CreatedDatesKeyword  = "DATES"
	EditedDateKeyword    = "EDIT-DATE"
	EditedDatesKeyword   = "EDIT-DATES"
	ConsumedDateKeyword  = "CONSUMED-DATE"
	ConsumedDatesKeyword = "CONSUMED-DATES"
)
View Source
var (
	IdeasDir, ConfigFile, LastIdFile string
)
View Source
var WithoutKeyword = "WITHOUT"

Functions

func CombineClumpedTags

func CombineClumpedTags(ct1, ct2 string) string

func ConcatAllContentFromTags

func ConcatAllContentFromTags(tags []Tag) (content []byte, found bool)

func GetIdByFilename

func GetIdByFilename(filename string) (id uint32, skip bool)

func GetKind

func GetKind(ext string) (int, error)

func GetLastIDs

func GetLastIDs() []uint32

func GetNextID

func GetNextID() uint32

func IdStr

func IdStr(id uint32) string

func IncrementID

func IncrementID()

func ParseID

func ParseID(idStr string) (uint32, error)

parse the last id, if no error add to the last ids file

func ParseIDNoLogLast

func ParseIDNoLogLast(idStr string) (uint32, error)

func ParseIDOp

func ParseIDOp(idStr string, logLast bool) (uint32, error)

parse the last id, if no error add to the last ids file

func PrependLast

func PrependLast(id uint32)

func TagUsedInNonConsuming

func TagUsedInNonConsuming(tag string) bool

func TodayDate

func TodayDate() time.Time

func ValidateFilenameAsIdea

func ValidateFilenameAsIdea(filename string)

Types

type Idea

type Idea struct {
	Filename    string
	Cycle       int // alive/consumed/zombie
	Id          uint32
	ConsumesIds []uint32 // Id of idea which this idea consumes
	Kind        int      // kind of information
	Ext         string   // file extension, blank is assumed to be text TODO does this include the '.' or not?!
	Created     time.Time
	Edited      time.Time
	Consumed    time.Time
	Tags        []Tag
}

func NewAudioIdea

func NewAudioIdea(consumesIds []uint32, clumpedTags string) Idea

NewAliveIdea creates a new idea object

func NewConsumingTextIdea

func NewConsumingTextIdea(consumesIdea Idea) Idea

NewConsumingTextIdea creates a new idea object

func NewIdea

func NewIdea(consumesIds []uint32, clumpedTags string, extension string) Idea

new idea with an arbitrary extension

func NewIdeaFromFile

func NewIdeaFromFile(clumpedTags string, filepath string) Idea

func NewIdeaFromFilename

func NewIdeaFromFilename(filename string, loglast bool) (idea Idea)

func NewIdeaFromFilepath

func NewIdeaFromFilepath(filepath string, loglast bool) (idea Idea)

func NewNonConsumingAudioIdea

func NewNonConsumingAudioIdea(clumpedTags string) Idea

func NewNonConsumingTextIdea

func NewNonConsumingTextIdea(clumpedTags string) Idea

func NewTextIdea

func NewTextIdea(consumesIds []uint32, clumpedTags string) Idea

NewAliveIdea creates a new idea object

func (*Idea) AddTags

func (idea *Idea) AddTags(tags []Tag)

add the tag on this idea

func (Idea) GetClumpedTags

func (idea Idea) GetClumpedTags() (out string)

get all the tags clumped together

func (Idea) GetContent

func (idea Idea) GetContent() []byte

func (Idea) HasAnyOfTags

func (idea Idea) HasAnyOfTags(tags []Tag) bool

returns true if the idea contains any of the input tags

func (Idea) HasTag

func (idea Idea) HasTag(tag Tag) bool

func (Idea) HasTags

func (idea Idea) HasTags(tags []Tag) bool

returns true if the idea contains all the input tags

func (Idea) IsAudio

func (idea Idea) IsAudio() bool

func (Idea) IsImage

func (idea Idea) IsImage() bool

func (Idea) IsText

func (idea Idea) IsText() bool

func (Idea) Path

func (idea Idea) Path() string

func (Idea) Prefix

func (idea Idea) Prefix() (prefix string)

func (*Idea) RemoveTags

func (idea *Idea) RemoveTags(tagsToRemove []Tag)

remove the tag on this idea

func (*Idea) RenameTag

func (idea *Idea) RenameTag(from, to Tag)

rename the tag on this idea

func (*Idea) SetConsumed

func (idea *Idea) SetConsumed()

rename the tag on this idea

func (*Idea) SetZombie

func (idea *Idea) SetZombie()

rename the tag on this idea

func (*Idea) UpdateFilename

func (idea *Idea) UpdateFilename()

creates the filename based on idea information

type Ideas

type Ideas []Idea

func GetAllIdeas

func GetAllIdeas() (ideas Ideas)

these ideas will be sorted from oldest to newest

func GetAllIdeasNonConsuming

func GetAllIdeasNonConsuming() (ideas Ideas)

func (Ideas) Filenames

func (ideas Ideas) Filenames() []string

func (Ideas) InRange

func (ideas Ideas) InRange(idStart, idEnd uint32) (subset Ideas)

inclusive range

func (Ideas) Paths

func (ideas Ideas) Paths() []string

func (Ideas) UniqueTags

func (ideas Ideas) UniqueTags() []Tag

func (Ideas) WithAnyOfTags

func (ideas Ideas) WithAnyOfTags(tags []Tag) (subset Ideas)

func (Ideas) WithImage

func (ideas Ideas) WithImage() (subset Ideas)

func (Ideas) WithTag

func (ideas Ideas) WithTag(tag Tag) (subset Ideas)

func (Ideas) WithTags

func (ideas Ideas) WithTags(tags []Tag) (subset Ideas)

func (Ideas) WithText

func (ideas Ideas) WithText() (subset Ideas)

type Tag

type Tag interface {
	GetName() string
	GetValue() string
	String() string
	Includes(Idea) bool
}

func MustNewTagReg

func MustNewTagReg(name, value string) Tag

func NewTagAll

func NewTagAll(keyword, _ string) ([]Tag, error)

func NewTagContains

func NewTagContains(keyword, containsWhat string) ([]Tag, error)

func NewTagDates

func NewTagDates(keyword, date string) ([]Tag, error)

can take either a single date or a [date,range]

func NewTagReg

func NewTagReg(name, value string) ([]Tag, error)

NewTagWithValue creates a new Tag with a value

func NewTagWithout

func NewTagWithout(keyword, without string) ([]Tag, error)

func ParseClumpedTags

func ParseClumpedTags(clumpedTags string) []Tag

parse clumped tags seperated by spaces or commas

func ParseFirstTagFromString

func ParseFirstTagFromString(in string) Tag

func ParseStringTags

func ParseStringTags(strTags []string) []Tag

func ParseTagFromString

func ParseTagFromString(in string) []Tag

NOTE all tag types must be registered within this function

type TagAll

type TagAll struct{ TagBase }

------------------------------------------

func (TagAll) Includes

func (t TagAll) Includes(idea Idea) bool

type TagBase

type TagBase struct {
	Name  string
	Value string
}

a tag can be either just a name or a name and a value.

func NewTagBase

func NewTagBase(name, value string) TagBase

NewTagBase creates a new TagBase object

func (TagBase) GetName

func (t TagBase) GetName() string

func (TagBase) GetValue

func (t TagBase) GetValue() string

func (TagBase) String

func (t TagBase) String() string

type TagContains

type TagContains struct {
	TagBase
	DoesNotContain  bool
	CaseInsensitive bool
}

------------------------------------------

func (TagContains) Includes

func (t TagContains) Includes(idea Idea) bool

type TagDates

type TagDates struct {
	TagBase
	// contains filtered or unexported fields
}

------------------------------------------

func (TagDates) Includes

func (t TagDates) Includes(idea Idea) bool

type TagReg

type TagReg struct{ TagBase }

------------------------------------------

func (TagReg) Includes

func (t TagReg) Includes(idea Idea) bool

type TagWithout

type TagWithout struct{ TagBase }

------------------------------------------

func (TagWithout) Includes

func (t TagWithout) Includes(idea Idea) bool

Jump to

Keyboard shortcuts

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