data

package
Version: v0.0.0-...-8430c91 Latest Latest
Warning

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

Go to latest
Published: Sep 23, 2015 License: MIT Imports: 5 Imported by: 7

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func InitDatabase

func InitDatabase(dialect string, args ...interface{}) (err error)

Types

type Check

type Check struct {
	Id        int64
	URL       string `gorm:"column:url"`
	Status    int    // status code of last result
	Success   bool   // success status of last result
	UserId    int64
	CreatedAt time.Time
	UpdatedAt time.Time
}

func Checks

func Checks() (checks []Check, err error)

func ChecksByURL

func ChecksByURL(url string) (checks []Check, err error)

func FindCheck

func FindCheck(id int64) (check Check, err error)

func (*Check) AddResult

func (c *Check) AddResult(r *Result) error

func (*Check) Create

func (c *Check) Create() error

func (*Check) Delete

func (c *Check) Delete() (err error)

func (*Check) Results

func (c *Check) Results() (results []Result, err error)

func (*Check) User

func (c *Check) User() (user User, err error)

type Result

type Result struct {
	Id        int64
	CreatedAt time.Time
	Status    int
	Success   bool
	IP        string `gorm:"column:ip"`
	Country   string
	CheckId   int64

	URL         string `sql:"-"`
	CountryName string `sql:"-"`
}

func (*Result) AfterFind

func (r *Result) AfterFind()

type User

type User struct {
	Id          int64
	CreatedAt   time.Time
	Name        string
	Email       string
	GitHubId    int64  `gorm:"column:github_id"`
	GitHubLogin string `gorm:"column:github_login"`
	OAuthToken  string `gorm:"column:oauth_token"`
}

func FindUser

func FindUser(id int64) (user User, err error)

func (*User) Check

func (u *User) Check(id int64) (check Check, err error)

func (*User) Checks

func (u *User) Checks() (checks []Check, err error)

func (*User) ChecksCount

func (u *User) ChecksCount() (count int, err error)

func (*User) UpdateOrCreate

func (u *User) UpdateOrCreate() error

Source Files

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL