model

package
v0.4.5 Latest Latest
Warning

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

Go to latest
Published: Mar 31, 2021 License: MIT Imports: 7 Imported by: 7

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsNotFound

func IsNotFound(err error) bool

func NotFoundError

func NotFoundError(typ string) error

Types

type Bookmark

type Bookmark struct {
	HatenaBookmarkId int                `db:"hatena_bookmark_id"`
	Timestamp        HatenaBookmarkTime `json:"timestamp" db:"timestamp"`
	User             string             `json:"user" db:"user"`
	Tags             Tags               `json:"tags" db:"tags"`
	Comment          string             `json:"comment" db:"comment"`
}

type Example

type Example struct {
	Id              int       `db:"id"`
	Label           LabelType `json:"Label" db:"label"`
	Fv              feature.FeatureVector
	Url             string           `json:"Url" db:"url"`
	FinalUrl        string           `json:"FinalUrl" db:"final_url"`
	Title           string           `json:"Title" db:"title"`
	Description     string           `json:"Description" db:"description"`
	OgDescription   string           `json:"OgDescription" db:"og_description"`
	OgType          string           `json:"OgType" db:"og_type"`
	OgImage         string           `json:"OgImage" db:"og_image"`
	Body            string           `json:"Body" db:"body"`
	Score           float64          `db:"score"`
	IsNew           bool             `db:"is_new"`
	StatusCode      int              `json:"StatusCode" db:"status_code"`
	Favicon         string           `json:"Favicon" db:"favicon"`
	ErrorCount      int              `json:"ErrorCount" db:"error_count"`
	CreatedAt       time.Time        `json:"CreatedAt" db:"created_at"`
	UpdatedAt       time.Time        `json:"UpdatedAt" db:"updated_at"`
	ReferringTweets *ReferringTweets `json:"ReferringTweets"`
	HatenaBookmark  *HatenaBookmark  `json:"HatenaBookmark"`
}

func (*Example) Annotate

func (example *Example) Annotate(label LabelType)

func (*Example) GetFeatureVector

func (example *Example) GetFeatureVector() feature.FeatureVector

func (*Example) GetLabel

func (example *Example) GetLabel() LabelType

func (*Example) IsArticle

func (example *Example) IsArticle() bool

func (*Example) IsLabeled

func (example *Example) IsLabeled() bool

func (*Example) IsTwitterUrl

func (example *Example) IsTwitterUrl() bool

type Examples

type Examples []*Example

func (Examples) Len

func (slice Examples) Len() int

func (Examples) Less

func (slice Examples) Less(i, j int) bool

func (Examples) Swap

func (slice Examples) Swap(i, j int)

type HatenaBookmark

type HatenaBookmark struct {
	Id         int         `db:"id"`
	ExampleId  int         `db:"example_id"`
	Title      string      `json:"title" db:"title"`
	Bookmarks  []*Bookmark `json:"bookmarks"`
	Screenshot string      `json:"screenshot" db:"screenshot"`
	EntryUrl   string      `json:"entry_url" db:"entry_url"`
	Count      int         `json:"count" db:"count"`
	Url        string      `json:"url" db:"url"`
	EId        string      `json:"eid" db:"eid"`
}

func (*HatenaBookmark) MarshalBinary

func (bookmarks *HatenaBookmark) MarshalBinary() ([]byte, error)

func (*HatenaBookmark) UnmarshalBinary

func (bookmarks *HatenaBookmark) UnmarshalBinary(data []byte) error

type HatenaBookmarkTime

type HatenaBookmarkTime struct {
	*time.Time
}

func (HatenaBookmarkTime) MarshalJSON

func (hbt HatenaBookmarkTime) MarshalJSON() ([]byte, error)

func (*HatenaBookmarkTime) Scan

func (hbt *HatenaBookmarkTime) Scan(value interface{}) error

ref: https://qiita.com/roothybrid7/items/52623bedb45ff0c26a8a

func (*HatenaBookmarkTime) UnmarshalJSON

func (hbt *HatenaBookmarkTime) UnmarshalJSON(data []byte) error

ref: https://dev.classmethod.jp/go/struct-json/

func (HatenaBookmarkTime) Value

func (hbt HatenaBookmarkTime) Value() (driver.Value, error)

type LabelType

type LabelType int
const (
	POSITIVE  LabelType = 1
	NEGATIVE  LabelType = -1
	UNLABELED LabelType = 0
)

func (*LabelType) MarshalBinary

func (lt *LabelType) MarshalBinary() ([]byte, error)

func (*LabelType) UnmarshalBinary

func (lt *LabelType) UnmarshalBinary(data []byte) error

type Recommendation

type Recommendation struct {
	RecommendationListType RecommendationListType
	ExampleIds             []int
}

type RecommendationListType

type RecommendationListType int

func GetRecommendationListType

func GetRecommendationListType(listname string) (RecommendationListType, error)

type ReferringTweets

type ReferringTweets struct {
	Count  int      `json:"Count"`
	Tweets []*Tweet `json:"Tweets"`
}

type RelatedExamples added in v0.3.0

type RelatedExamples struct {
	ExampleId         int
	RelatedExampleIds []int
}

type Tags

type Tags []string

func (*Tags) Scan

func (tags *Tags) Scan(value interface{}) error

func (Tags) Value

func (tags Tags) Value() (driver.Value, error)

type Tweet

type Tweet struct {
	Id        int `db:"id"`
	ExampleId int `db:"example_id"`

	CreatedAt     time.Time `json:"CreatedAt" db:"created_at"`
	IdStr         string    `json:"IdStr" db:"id_str"`
	FullText      string    `json:"FullText" db:"full_text"`
	FavoriteCount int       `json:"FavoriteCount" db:"favorite_count"`
	RetweetCount  int       `json:"RetweetCount" db:"retweet_count"`
	Lang          string    `json:"Lang" db:"lang"`

	ScreenName      string    `json:"ScreenName" db:"screen_name"`
	Name            string    `json:"Name" db:"name"`
	ProfileImageUrl string    `json:"ProfileImageUrl" db:"profile_image_url"`
	Label           LabelType `json:"Label" db:"label"`
	Score           float64   `json:"Score" db:"score"`
}

Jump to

Keyboard shortcuts

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