rating

package
v0.0.0-...-a380f54 Latest Latest
Warning

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

Go to latest
Published: Sep 1, 2018 License: BSD-2-Clause Imports: 3 Imported by: 0

Documentation

Overview

Package rating defines types and methods for setting/getting ratings for paths and persisting this data.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Store

type Store interface {
	// Set the rating for the path.
	Set(index.Path, Value) error
	// Get the rating for the path.
	Get(index.Path) Value
}

Store is an interface which defines methods necessary for setting and getting ratings for index paths.

func NewStore

func NewStore(path string) (Store, error)

NewStore creates a basic implementation of a ratings store, using the given path as the source of data. Note: we do not enforce any locking on the underlying file, which is read once to initialise the store, and then overwritten after each call to Set.

type Value

type Value uint

Value is a type which represents a rating value.

const None Value = 0

None is the Value used to mark a path as having no rating.

func (Value) IsValid

func (v Value) IsValid() bool

IsValid returns true if the Value is valid.

Jump to

Keyboard shortcuts

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