parsers

package
v0.0.0-...-247d41d Latest Latest
Warning

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

Go to latest
Published: Dec 4, 2022 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const ATTR_FULL = 1
View Source
const ATTR_KEY = 2
View Source
const ATTR_VALUE = 3

Variables

This section is empty.

Functions

func ApplyToMessage

func ApplyToMessage(input string, message *Message)

func NewUUID

func NewUUID() string

func RegisterAttrParser

func RegisterAttrParser(p AttrParser)

func RegisterParser

func RegisterParser(parser MessageParser)

func UpdateMessage

func UpdateMessage(input string, message *Message)

Types

type Attr

type Attr struct {
	Slug        string
	ScreenName  string
	Type        string
	DateValue   time.Time
	IntValue    int64
	FloatValue  float64
	StringValue string
	BoolValue   bool
}

type AttrParser

type AttrParser interface {
	GetSlug() string
	GetAlias() []string
	Parse(value string) Attr
}

type AttrsParser

type AttrsParser struct{}

func (AttrsParser) Parse

func (p AttrsParser) Parse(m *Message, rm *ReplacementManager) error

type DueAttrParser

type DueAttrParser struct{}

func (*DueAttrParser) GetAlias

func (d *DueAttrParser) GetAlias() []string

func (*DueAttrParser) GetSlug

func (d *DueAttrParser) GetSlug() string

func (*DueAttrParser) Parse

func (d *DueAttrParser) Parse(value string) Attr

type HoursAttrParser

type HoursAttrParser struct{}

func (*HoursAttrParser) GetAlias

func (h *HoursAttrParser) GetAlias() []string

func (*HoursAttrParser) GetSlug

func (h *HoursAttrParser) GetSlug() string

func (*HoursAttrParser) Parse

func (h *HoursAttrParser) Parse(value string) Attr

type Message

type Message struct {
	ID           string
	Original     string
	HTML         string
	Archived     bool
	RelatedUsers []string
	Tags         []string
	Attributes   []Attr
	URLs         []string
}

func NewMessage

func NewMessage(input string) Message

type MessageParser

type MessageParser interface {
	Parse(m *Message, repl *ReplacementManager) error
}

func GetRegisteredParsers

func GetRegisteredParsers() []MessageParser

type QuoteAttrParser

type QuoteAttrParser struct{}

func (*QuoteAttrParser) GetAlias

func (h *QuoteAttrParser) GetAlias() []string

func (*QuoteAttrParser) GetSlug

func (q *QuoteAttrParser) GetSlug() string

func (*QuoteAttrParser) Parse

func (h *QuoteAttrParser) Parse(value string) Attr

type ReplacementManager

type ReplacementManager map[string]string

func (ReplacementManager) Add

func (rm ReplacementManager) Add(key string, value string)

type TagsParser

type TagsParser struct{}

func (TagsParser) Parse

func (t TagsParser) Parse(m *Message, rm *ReplacementManager) error

type URLsParser

type URLsParser struct{}

func (URLsParser) Parse

func (u URLsParser) Parse(m *Message, rm *ReplacementManager) error

type UsersParser

type UsersParser struct{}

func (UsersParser) Parse

func (u UsersParser) Parse(m *Message, rm *ReplacementManager) error

Jump to

Keyboard shortcuts

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