Documentation ¶
Overview ¶
Package unit provides structures and interfaces to deal with different content units
Index ¶
- func Equal(u1, u2 Unit) bool
- func NotEqual(u1, u2 Unit) bool
- func OptionClockMock(t ...time.Time) func(u interface{})
- func OptionClockMockPartial(t ...time.Time) func(u interface{})
- func OptionClockReal() func(u interface{})
- func OptionIDGeneratorMock(s string) func(u interface{})
- func OptionIDGeneratorUUID() func(u interface{})
- func OptionListItem(item Unit) func(u interface{})
- func OptionListMarshalItems(m bool) func(u interface{})
- func OptionTextCodeData(t string) func(u interface{})
- func OptionTextCodeLanguage(l string) func(u interface{})
- func OptionTextMarkdownData(t string) func(u interface{})
- func OptionTextPlainData(t string) func(u interface{})
- func OptionTitle(t string) func(u interface{})
- func OptionTodoItem(data string, done bool) func(u interface{})
- type List
- type TextCode
- type TextMarkdown
- type TextPlain
- type Todo
- type TodoItem
- type Type
- type Unit
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func OptionClockMock ¶
OptionClockMock is an option that sets internal clock for a unit to return mocked values
func OptionClockMockPartial ¶
OptionClockMockPartial is an option that sets internal clock for a unit to return mocked value once
func OptionClockReal ¶
func OptionClockReal() func(u interface{})
OptionClockReal is an option that sets internal clock for a unit to return real time
func OptionIDGeneratorMock ¶
func OptionIDGeneratorMock(s string) func(u interface{})
OptionIDGeneratorMock is an option that sets internal UUID generator for a unit to return same value each time
func OptionIDGeneratorUUID ¶
func OptionIDGeneratorUUID() func(u interface{})
OptionIDGeneratorUUID is an option that sets internal UUID generator for a unit to UUID implementation
func OptionListItem ¶
func OptionListItem(item Unit) func(u interface{})
OptionListItem is an option that adds new item to the list unit
func OptionListMarshalItems ¶
func OptionListMarshalItems(m bool) func(u interface{})
OptionListMarshalItems is an option that sets marshalItems flag for a list unit to the provided value
func OptionTextCodeData ¶
func OptionTextCodeData(t string) func(u interface{})
OptionTextCodeData is an option that sets data for a text code unit to the provided value
func OptionTextCodeLanguage ¶
func OptionTextCodeLanguage(l string) func(u interface{})
OptionTextCodeLanguage is an option that sets language for a text code unit to the provided value
func OptionTextMarkdownData ¶
func OptionTextMarkdownData(t string) func(u interface{})
OptionTextMarkdownData is an option that sets data for a text markdown unit to the provided value
func OptionTextPlainData ¶
func OptionTextPlainData(t string) func(u interface{})
OptionTextPlainData is an option that sets data for a text plain unit to the provided value
func OptionTitle ¶
func OptionTitle(t string) func(u interface{})
OptionTitle is an option that sets title for a unit to the provided value
func OptionTodoItem ¶
OptionTodoItem is an option that adds new todo item to the unit
Types ¶
type List ¶
type List interface { Unit Items() []Unit SetItems(items []Unit) AddItem(item Unit) GetItem(index int) Unit SetItem(index int, item Unit) RemoveItem(index int) SetMarshalItems(m bool) MarshalItems() bool }
List represents unit which contains other units
type TextCode ¶
TextCode represents unit which contains some source code as plain text and it's language
func NewTextCode ¶
func NewTextCode(options ...func(u interface{})) TextCode
NewTextCode creates new TextCode unit with given title, data and language
type TextMarkdown ¶
type TextMarkdown interface { TextPlain }
TextMarkdown represents unit which has some plain markdown content
func NewTextMarkdown ¶
func NewTextMarkdown(options ...func(u interface{})) TextMarkdown
NewTextMarkdown creates new TextMarkdown unit with given title and data
type TextPlain ¶
TextPlain represents unit which has some plain text content
func NewTextPlain ¶
func NewTextPlain(options ...func(u interface{})) TextPlain
NewTextPlain creates new TextPlain unit with given title and data
type Todo ¶
type Todo interface { Unit NewItem() TodoItem Items() []TodoItem SetItems(items []TodoItem) AddItem(item TodoItem) GetItem(index int) TodoItem SetItem(index int, item TodoItem) RemoveItem(index int) }
Todo represents unit which contains todo items
type Type ¶
type Type int
Type represents type enumeration for unit types
const ( // TypeUnit represents type "Unit" for unit TypeUnit Type = 1 + iota // TypeList represents type "List" for unit TypeList // TypeTodo represents type "Todo" for unit TypeTodo // TypeTextPlain represents type "TextPlain" for unit TypeTextPlain // TypeTextMarkdown represents type "TextMarkdown" for unit TypeTextMarkdown // TypeTextCode represents type "TextCode" for unit TypeTextCode )
func TypeFromString ¶
TypeFromString returns type by it's string representation
func (Type) MarshalJSON ¶
MarshalJSON converts type to it's json representation (normally string)
func (*Type) UnmarshalJSON ¶
UnmarshalJSON converts json type representation (normally string) to type object