models

package
v0.0.0-...-c52ac50 Latest Latest
Warning

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

Go to latest
Published: Aug 1, 2016 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConnectDb

func ConnectDb(host string) (db *sql.DB, err error)

ConnectDb trys to connect specified host and returns connection.

func NewMessage

func NewMessage(p NewMessageParams) (id int64, err error)

NewMessage inserts a message record and returns last insert id.

func ResetDb

func ResetDb(host string) (res sql.Result, err error)

ResetDb drops all tables and re-creates messages table.

Types

type MessageItem

type MessageItem struct {
	Id        int64
	FromName  string
	ToName    string
	CreatedAt time.Time
	Message   string
}

func FindMessages

func FindMessages() (items []MessageItem, err error)

FindMessages returns Messages slice.

type NewMessageParams

type NewMessageParams struct {
	From, To, Message, CreatedAt string
}

type RankingItem

type RankingItem struct {
	Name  string
	Count int
}

func FindRanking

func FindRanking(ym string) (items []RankingItem, err error)

FindRanking returns ranking slice. Parameter 'ym' should be as `201608`

Jump to

Keyboard shortcuts

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