data

package
v0.0.0-...-8fb32ab Latest Latest
Warning

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

Go to latest
Published: Jun 2, 2018 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Handler

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

Handler represents all information stored by the application

func Load

func Load(path string) (*Handler, error)

Load recovers the user data and stats from disk

func (*Handler) Add

func (ud *Handler) Add(id int64, keyword string) error

Add watches a keyword for a given user ID

func (*Handler) Exists

func (ud *Handler) Exists(id int64, keyword string) bool

Exists checks if something is being watched

func (*Handler) Get

func (ud *Handler) Get(id int64) Keywords

Get returns the map of Keywords per user ID

func (*Handler) GetByKeyword

func (ud *Handler) GetByKeyword(keyword string) []int64

GetByKeyword returns a list of user IDs for a given keyword

func (*Handler) GetKeywords

func (ud *Handler) GetKeywords() []string

GetKeywords returns the list of all keywords being searched for

func (*Handler) Increment

func (ud *Handler) Increment(id int64, keyword string) error

Increment bumps the hit counter on a given keyword and user ID

func (*Handler) Remove

func (ud *Handler) Remove(id int64, keyword string) error

Remove no longer watches a keyword for a given user ID

func (*Handler) Sync

func (ud *Handler) Sync()

Sync updates the temporary variables keyMap and keywords

type Interface

type Interface interface {
	Get(int64) Keywords
	GetByKeyword(string) []int64
	GetKeywords() []string
	Sync()
	Add(int64, string) error
	Exists(int64, string) bool
	Remove(int64, string) error
	Increment(int64, string) error
}

Interface is the stats public functions

type Keywords

type Keywords map[string]int

Keywords keeps track of the criteria and number of hits

Jump to

Keyboard shortcuts

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