model

package
v0.0.0-...-23d68a7 Latest Latest
Warning

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

Go to latest
Published: May 5, 2020 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetPixivImage

func GetPixivImage(ctx context.Context, url string) ([]byte, string, error)

GetPixivImage 获取 Pixiv 的图片

func HTTPCall

func HTTPCall(ctx context.Context, method string, url string, headers map[string]string,
	body io.Reader) (*http.Response, error)

HTTPCall HTTP请求封装

Types

type Illust

type Illust struct {
	ID        int    `bson:"_id" json:"id"`
	IllustID  int    `bson:"illust_id" json:"illust_id"`
	Title     string `bson:"title" json:"title"`
	Type      string `bson:"type" json:"type"`
	ImageUrls struct {
		SquareMedium string `bson:"square_medium" json:"square_medium"`
		Medium       string `bson:"medium" json:"medium"`
		Large        string `bson:"large" json:"large"`
	} `bson:"image_urls" json:"image_urls"`
	Caption string `bson:"caption" json:"caption"`
	User    User   `bson:"user" json:"user"`
	Tags    []struct {
		Name           string      `bson:"name" json:"name"`
		TranslatedName interface{} `bson:"translated_name" json:"translated_name"`
	} `bson:"tags" json:"tags"`
	CreateDate     time.Time `bson:"create_date" json:"create_date"`
	PageCount      int       `bson:"page_count" json:"page_count"`
	Width          int       `bson:"width" json:"width"`
	Height         int       `bson:"height" json:"height"`
	MetaSinglePage struct {
		OriginalImageURL string `bson:"original_image_url" json:"original_image_url"`
	} `bson:"meta_single_page" json:"meta_single_page"`
	TotalView      int `bson:"total_view" json:"total_view"`
	TotalBookmarks int `bson:"total_bookmarks" json:"total_bookmarks"`
	UserID         int `bson:"user_id" json:"user_id"`
	TotalComments  int `bson:"total_comments" json:"total_comments"`
	CreateDateTs   int `bson:"create_date_ts" json:"create_date_ts"`

	// 生成字段,替换成本地地址方便展示
	OriginalURL string `json:"original_url"`
	SquareURL   string `json:"square_url"`
}

Illust Illust

func GetIllust

func GetIllust(illustID int) (*Illust, error)

GetIllust get one illust by ID

func GetIllusts

func GetIllusts(page, size int, sortFields []string) ([]*Illust, error)

GetIllusts get all illusts

type User

type User struct {
	ID               int    `bson:"id" json:"id"`
	Name             string `bson:"name" json:"name"`
	Account          string `bson:"account" json:"account"`
	ProfileImageUrls struct {
		Medium string `bson:"medium" json:"medium"`
	} `bson:"profile_image_urls" json:"profile_image_urls"`
}

User User

Jump to

Keyboard shortcuts

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