twitter

package
v0.0.0-...-3eee8ad Latest Latest
Warning

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

Go to latest
Published: Nov 30, 2015 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package twitter ...

Index

Constants

View Source
const DbName = "trm"

DbName is the database name

View Source
const Password = "trm"

Password is password of database

View Source
const UserName = "trm"

UserName is user name of database

Variables

View Source
var Op = Operation{1, 2, 3, 4, 5}

Op is alternative Enum object for Operation

Functions

func DB

func DB() (db gorm.DB, err error)

DB returns gorm.DB.

the reference of gorm.DB is there(https://github.com/jinzhu/gorm#query)

func Reset

func Reset()

Reset tables of database

Types

type Error

type Error struct {
	Op  int    // the failing Operation (Query, Request, Authorization, Parse)
	ID  string // the twitter id
	URL string // the definitive url
	Err error  // the reason the get failed
}

A Error records a failed get of tweet.

func (*Error) Error

func (e *Error) Error() string

type Operation

type Operation struct {
	Query         int
	Request       int
	Authorization int
	NotExisting   int
	Parse         int
}

Operation ...

type Tweet

type Tweet struct {
	ID         int
	Success    int    `sql:"not null"`
	ItemID     string `sql:"not null;index"`
	ReplyTo    string `sql:"index"`
	ScreenName string `sql:"index"`
	Name       string
	Time       string
	Text       string
	Replies    []Tweet
}

Tweet ...

func (*Tweet) Fetch

func (tweet *Tweet) Fetch() (err error)

Fetch tweet by self id

func (*Tweet) Parse

func (tweet *Tweet) Parse(s *goquery.Selection) (err error)

Parse from div.tweet

func (*Tweet) Save

func (tweet *Tweet) Save(db *gorm.DB) (err error)

Save tweet to database

Jump to

Keyboard shortcuts

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