counter

package
v0.0.0-...-ca736ed Latest Latest
Warning

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

Go to latest
Published: Sep 24, 2020 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Counter

type Counter struct {
	Sections map[string]*Section `json:"sections"`
	File     string              `json:"-"`
	Duration time.Duration       `json:"-"`
}

func NewCounter

func NewCounter(duration time.Duration) *Counter

func (*Counter) AddEntry

func (c *Counter) AddEntry(section *Section, entry *Entry) bool

func (*Counter) GetSection

func (c *Counter) GetSection(username string, repository string) *Section

func (*Counter) GetSectionByKey

func (c *Counter) GetSectionByKey(sectionKey string) *Section

func (*Counter) Increment

func (c *Counter) Increment(section *Section)

func (*Counter) RemoveEntry

func (c *Counter) RemoveEntry(section *Section, hash string)

func (*Counter) RemoveSection

func (c *Counter) RemoveSection(sectionKey string)

func (*Counter) Run

func (c *Counter) Run()

type Entry

type Entry struct {
	Hash      string
	Timestamp time.Time
}

func NewEntry

func NewEntry(hash string) *Entry

type Section

type Section struct {
	XMLName    xml.Name          `xml:"Section" json:"-"`
	Username   string            `json:"username"`
	Repository string            `json:"repository"`
	Total      int64             `json:"total"`
	CreatedAt  time.Time         `json:"created_at"`
	UpdatedAt  time.Time         `json:"updated_at"`
	Entries    map[string]*Entry `xml:"-" json:"-"`
	File       string            `xml:"-" json:"-"`
}

func NewSection

func NewSection(username string, repository string) *Section

func (*Section) AddEntry

func (s *Section) AddEntry(entry *Entry, duration time.Duration) bool

func (*Section) GetKey

func (s *Section) GetKey() string

func (*Section) GetToken

func (s *Section) GetToken() string

func (*Section) Increment

func (s *Section) Increment()

func (*Section) Load

func (s *Section) Load(filename string) error

func (*Section) Save

func (s *Section) Save() error

func (*Section) String

func (s *Section) String() string

Jump to

Keyboard shortcuts

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