models

package
v0.0.0-...-1c5bec1 Latest Latest
Warning

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

Go to latest
Published: Nov 30, 2016 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AverageCounter

type AverageCounter struct {
	Date       string  `db:"date"`
	Media      float64 `db:"media"`
	Follows    float64 `db:"follows"`
	FollowedBy float64 `db:"followed_by"`
}

type Counter

type Counter struct {
	Created    time.Time `db:"created" json:"created"`
	Username   string    `db:"username" json:"username"`
	Media      int64     `db:"media" json:"media"`
	Follows    int64     `db:"follows" json:"follows"`
	FollowedBy int64     `db:"followed_by" json:"followed_by"`
}

type CounterObject

type CounterObject struct {
	Date  string  `json:"date"`
	Value float64 `json:"value"`
}

type CountersLastMonthResponse

type CountersLastMonthResponse struct {
	Media      []CounterObject `json:"media"`
	Follows    []CounterObject `json:"follows"`
	FollowedBy []CounterObject `json:"followed_by"`
}

type DB

type DB struct {
	sqlbuilder.Database
}

func NewDB

func NewDB(dbPath string) (*DB, error)

func (*DB) CountersCreate

func (db *DB) CountersCreate(c *Counter) error

func (*DB) CountersFindLast

func (db *DB) CountersFindLast() (*Counter, error)

func (*DB) CountersLastMonth

func (db *DB) CountersLastMonth() ([]*AverageCounter, error)

type Datastore

type Datastore interface {
	CountersCreate(*Counter) error
	CountersFindLast() (*Counter, error)
	CountersLastMonth() ([]*AverageCounter, error)
}

Jump to

Keyboard shortcuts

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