models

package
v1.4.1 Latest Latest
Warning

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

Go to latest
Published: Mar 21, 2024 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

View Source
const (
	IllustSearchMapping = `` /* 1003-byte string literal not displayed */
	UserSearchMapping   = `` /* 349-byte string literal not displayed */
)
View Source
const (
	CrawlIllustDetail uint = iota
	CrawlUserDetail
	CrawlUserIllusts
	CrawlRankIllusts
	CrawlUgoiraDetail

	CrawlError
)

Variables

View Source
var (
	ErrorRetrivingFinishedTask = errors.New("error In Retryving Finished Task")
	ErrorIndexExist            = errors.New("error Index Already Existed")
	ErrorItemBanned            = errors.New("error Item Banned")
	ErrorNoResult              = errors.New("error No Result")
	ErrorChannelClosed         = errors.New("channel closed")
	ErrorTimeOut               = errors.New("time Out")
	ErrorArchiveMode           = errors.New("in Archive Mode")

	InternalErrorLoginNeeded = errors.New("login needed")
)

Functions

This section is empty.

Types

type CacheRedisConfig

type CacheRedisConfig struct {
	URI string `yaml:"uri"`
}

type Config

type Config struct {
	Mongodb       MongoDBConfig       `yaml:"mongodb"`
	Rabbitmq      RabbitMQConfig      `yaml:"rabbitmq"`
	Elasticsearch ElasticSearchConfig `yaml:"elasticsearch"`
	Redis         RedisConfig         `yaml:"redis"`
	Neardb        NearDBConfig        `yaml:"neardb"`
	Responser     ResponserConfig     `yaml:"responser"`
	General       GeneralConfig       `yaml:"general"`
	Spider        SpiderConfig        `yaml:"spider"`
}

type CrawlErrorResponse added in v1.3.1

type CrawlErrorResponse struct {
	TaskType uint
	Params   map[string]string
	Message  string
}

type CrawlResponse

type CrawlResponse struct {
	Group    string
	Type     uint
	Response interface{}
}

type CrawlTask

type CrawlTask struct {
	Group      string
	Type       uint
	Params     map[string]string
	RetryCount uint
}

type ElasticSearchConfig

type ElasticSearchConfig struct {
	URI  string `yaml:"uri"`
	User string `yaml:"user"`
	Pass string `yaml:"password"`
}

type ErrorRawResponse added in v1.3.1

type ErrorRawResponse struct {
	Message string `json:"message"`
}

type Filter

type Filter interface {
	Add(string, string) (bool, error)
	Exists(string, string) (bool, error)
}

type GeneralConfig

type GeneralConfig struct {
	SpiderRetry uint   `yaml:"spider-retry"`
	Prometheus  string `yaml:"prometheus-listen"`
	Loki        string `yaml:"loki-uri"`
}

type IDList

type IDList []uint64

type IDWithPos

type IDWithPos struct {
	ID  uint64
	Pos uint
}

type Illust

type Illust struct {
	ID         uint64    `bson:"_id"`
	UpdateTime time.Time `bson:"update_time"`

	Title       string          `bson:"title"`
	AltTitle    string          `bson:"altTitle"`
	Description string          `bson:"description,omitempty"`
	Type        uint            `bson:"type"`
	CreateDate  time.Time       `bson:"createDate"`
	UploadDate  time.Time       `bson:"uploadDate"`
	Sanity      uint            `bson:"sanity"`
	Width       uint            `bson:"width"`
	Height      uint            `bson:"height"`
	PageCount   uint            `bson:"pageCount"`
	Tags        []IllustTag     `bson:"tags"`
	Statistic   IllustStatistic `bson:"statistic"`
	User        uint            `bson:"user"`
	Image       time.Time       `bson:"image"`
	AIType      uint            `bson:"aiType,omitempty"`

	Popularity uint `bson:"popularity"`
	Banned     bool `bson:"banned"`
}

type IllustRaw

type IllustRaw struct {
	ID          uint64          `json:"id,string"`
	Title       string          `json:"title"`
	Description string          `json:"description"`
	IllustType  uint            `json:"illustType"`
	CreateDate  time.Time       `json:"createDate"`
	UploadDate  time.Time       `json:"uploadDate"`
	Restrict    uint            `json:"restrict"`
	XRestrict   uint            `json:"xRestrict"`
	Sl          uint            `json:"sl"`
	Urls        IllustRawUrls   `json:"urls"`
	Tags        IllustRawTagPre `json:"tags"`
	Alt         string          `json:"alt"`
	UserID      uint            `json:"userId,string"`
	AIType      uint            `json:"aiType"`

	Width     uint `json:"width"`
	Height    uint `json:"height"`
	PageCount uint `json:"pageCount"`

	BookmarkCount uint `json:"bookmarkCount"`
	LikeCount     uint `json:"likeCount"`
	CommentCount  uint `json:"commentCount"`
	ViewCount     uint `json:"viewCount"`
}

type IllustRawResponse

type IllustRawResponse struct {
	Error   bool      `json:"error"`
	Message string    `json:"message"`
	Body    IllustRaw `json:"body"`
}

type IllustRawTag

type IllustRawTag struct {
	Tag         string               `json:"tag"`
	Translation IllustRawTranslation `json:"translation"`
}

type IllustRawTagPre

type IllustRawTagPre struct {
	Tags []IllustRawTag `json:"tags"`
}

type IllustRawTranslation

type IllustRawTranslation struct {
	En string `json:"en"`
}

type IllustRawUrls

type IllustRawUrls struct {
	Mini     string `json:"mini"`
	Thumb    string `json:"thumb"`
	Small    string `json:"small"`
	Regular  string `json:"regular"`
	Original string `json:"original"`
}

type IllustResponse

type IllustResponse struct {
	ID          uint64                  `json:"id"`
	Title       string                  `json:"title"`
	AltTitle    string                  `json:"altTitle"`
	Description string                  `json:"description"`
	Type        uint                    `json:"type"`
	CreateDate  string                  `json:"createDate"`
	UploadDate  string                  `json:"uploadDate"`
	Sanity      uint                    `json:"sanity"`
	Width       uint                    `json:"width"`
	Height      uint                    `json:"height"`
	PageCount   uint                    `json:"pageCount"`
	Tags        []IllustTagResponse     `json:"tags"`
	Statistic   IllustStatisticResponse `json:"statistic"`
	User        *UserResponse           `json:"user,omitempty"`
	Image       string                  `json:"image"`
	AIType      uint                    `json:"aiType"`
}

type IllustSearch

type IllustSearch struct {
	Title       string      `json:"title"`
	AltTitle    string      `json:"alt_title,omitempty"`
	Description string      `json:"description,omitempty"`
	Type        uint        `json:"type"`
	CreateDate  time.Time   `json:"create_date"`
	Sanity      uint        `json:"sanity"`
	Popularity  uint        `json:"popularity"`
	User        uint        `json:"user"`
	Tags        []IllustTag `json:"tags"`
}

type IllustStatistic

type IllustStatistic struct {
	Bookmarks uint `bson:"bookmarks" json:"bookmarks"`
	Likes     uint `bson:"likes" json:"likes"`
	Comments  uint `bson:"comments" json:"comments"`
	Views     uint `bson:"views" json:"views"`
}

type IllustStatisticResponse

type IllustStatisticResponse struct {
	Bookmarks uint `json:"bookmarks"`
	Likes     uint `json:"likes"`
	Comments  uint `json:"comments"`
	Views     uint `json:"views"`
}

type IllustTag

type IllustTag struct {
	Name        string `bson:"name" json:"name"`
	Translation string `bson:"translation,omitempty" json:"translation,omitempty"`
}

type IllustTagResponse

type IllustTagResponse struct {
	Name        string `json:"name"`
	Translation string `json:"translation,omitempty"`
}

type IllustsResponse

type IllustsResponse struct {
	Illusts []IllustResponse `json:"illusts"`
	HasNext bool             `json:"has_next"`
}

type IllustsSearchResponse

type IllustsSearchResponse struct {
	Illusts   []IllustResponse `json:"illusts"`
	Scores    []float64        `json:"scores,omitempty"`
	HighLight []*string        `json:"highlight,omitempty"`
	HasNext   bool             `json:"has_next"`
}

type MQMessage

type MQMessage struct {
	Data     []byte
	Tag      uint64
	Priority uint8
}

type MessageQueue

type MessageQueue interface {
	Publish(string, MQMessage) error
	PublishToExchange(string, MQMessage) error
	Consume(string) (<-chan MQMessage, error)
	Ack(uint64) error
	Reject(uint64) error
}

type MessageRedisConfig

type MessageRedisConfig struct {
	URI string `yaml:"uri"`
}

type Modes added in v1.2.22

type Modes int
const (
	NormalMode Modes = iota
	ArchiveMode
)

type MongoDBConfig

type MongoDBConfig struct {
	URI string `yaml:"uri"`
}

type NearDBConfig

type NearDBConfig struct {
	URI string `yaml:"uri"`
}

type RabbitMQConfig

type RabbitMQConfig struct {
	URI string `yaml:"uri"`
}

type Rank

type Rank struct {
	Date    string       `bson:"date"`
	Mode    string       `bson:"mode"`
	Content string       `bson:"content"`
	Illusts []RankIllust `bson:"illusts"`
}

type RankAggregateResult

type RankAggregateResult struct {
	Content Illust `bson:"content"`
}

type RankIllust

type RankIllust struct {
	ID   uint64 `bson:"id"`
	Rank uint   `bson:"rank"`
}

type RankIllustRaw

type RankIllustRaw struct {
	IllustID              uint64 `json:"illust_id"`
	UserID                uint   `json:"user_id"`
	Rank                  uint   `json:"rank"`
	YesRank               uint   `json:"yes_rank"`
	RatingCount           uint   `json:"rating_count"`
	IllustUploadTimestamp uint   `json:"illust_upload_timestamp"`
}

type RankIllustsRawResponse

type RankIllustsRawResponse struct {
	Contents []RankIllustRaw `json:"contents"`
	Mode     string          `json:"mode"`
	Page     int             `json:"page"`
	Date     string          `json:"date"`
	Next     interface{}     `json:"next"`
	Content  string          `json:"content"`
}

type RankIllustsResponseMessage

type RankIllustsResponseMessage struct {
	Mode    string
	Date    string
	Content string
	Page    int
	Next    bool
	Illusts []IDWithPos
}

type RedisConfig

type RedisConfig struct {
	CacheRedis   CacheRedisConfig   `yaml:"cache"`
	MessageRedis MessageRedisConfig `yaml:"message"`
}

type ResponserConfig

type ResponserConfig struct {
	Listen           string `yaml:"listen"`
	Debug            bool   `yaml:"debug"`
	Mode             Modes  `yaml:"mode"`
	EnableForceFetch bool   `yaml:"enable-force-fetch"`
}

type SearchSuggestResponse

type SearchSuggestResponse struct {
	SuggestWords []string `json:"suggest_words"`
}

type SearchSuggestTagsResponse

type SearchSuggestTagsResponse struct {
	SuggestTags []IllustTagResponse `json:"suggest_tags"`
}

type SpiderConfig

type SpiderConfig struct {
	PixivToken      string `yaml:"pixiv-token"`
	CrawlingThreads int    `yaml:"crawling-threads"`
}

type Ugoira

type Ugoira struct {
	ID         uint64    `bson:"_id"`
	UpdateTime time.Time `bson:"update_time"`

	Image    time.Time     `bson:"image"`
	MimeType string        `bson:"mimeType"`
	Frames   []UgoiraFrame `bson:"frames"`
}

type UgoiraFrame

type UgoiraFrame struct {
	File  string `bson:"file"`
	Delay int    `bson:"delay"`
}

type UgoiraFrameRaw

type UgoiraFrameRaw struct {
	File  string `json:"file"`
	Delay int    `json:"delay"`
}

type UgoiraFrameResponse

type UgoiraFrameResponse struct {
	File  string `json:"file"`
	Delay int    `json:"delay"`
}

type UgoiraRaw

type UgoiraRaw struct {
	Src         string           `json:"src"`
	Originalsrc string           `json:"originalSrc"`
	MimeType    string           `json:"mime_type"`
	Frames      []UgoiraFrameRaw `json:"frames"`
}

type UgoiraRawResponse

type UgoiraRawResponse struct {
	Error   bool      `json:"error"`
	Message string    `json:"message"`
	Body    UgoiraRaw `json:"body"`
}

type UgoiraResponse

type UgoiraResponse struct {
	ID       uint64                `json:"id"`
	Image    string                `json:"image"`
	MimeType string                `json:"mime_type"`
	Frames   []UgoiraFrameResponse `json:"frames"`
}

type User

type User struct {
	ID         uint64    `bson:"_id"`
	UpdateTime time.Time `bson:"update_time"`

	Name              string    `bson:"name"`
	Bio               string    `bson:"bio,omitempty"`
	Image             UserImage `bson:"image"`
	IllustsUpdateTime time.Time `bson:"illusts_update_time"`
	IllustsCount      uint      `bson:"illusts_count"`

	Banned bool `bson:"banned"`
}

type UserIllustsRaw

type UserIllustsRaw struct {
	Illusts interface{} `json:"illusts"`
	Manga   interface{} `json:"manga"`
}

type UserIllustsRawResponse

type UserIllustsRawResponse struct {
	Error   bool           `json:"error"`
	Message string         `json:"message"`
	Body    UserIllustsRaw `json:"body"`
}

type UserIllustsResponse

type UserIllustsResponse struct {
	UserID  uint64
	Illusts IDList
}

type UserImage

type UserImage struct {
	Url        string `bson:"url"`
	BigUrl     string `bson:"bigUrl"`
	Background string `bson:"background"`
}

type UserImageResponse

type UserImageResponse struct {
	Url        string `json:"url"`
	BigUrl     string `json:"bigUrl"`
	Background string `json:"background,omitempty"`
}

type UserRaw

type UserRaw struct {
	UserID     uint64            `json:"userId,string"`
	Name       string            `json:"name"`
	Image      string            `json:"image"`
	ImageBig   string            `json:"imageBig"`
	Comment    string            `json:"comment"`
	Background UserRawBackground `json:"background"`
}

type UserRawBackground

type UserRawBackground struct {
	URL string `json:"url"`
}

type UserRawResponse

type UserRawResponse struct {
	Error   bool    `json:"error"`
	Message string  `json:"message"`
	Body    UserRaw `json:"body"`
}

type UserResponse

type UserResponse struct {
	ID    uint64            `json:"id"`
	Name  string            `json:"name"`
	Bio   string            `json:"bio"`
	Image UserImageResponse `json:"image"`
}

type UserSearch

type UserSearch struct {
	Name string `json:"name"`
	Bio  string `json:"bio,omitempty"`
}

type UsersResponse

type UsersResponse struct {
	Users   []UserResponse `json:"users"`
	HasNext bool           `json:"has_next"`
}

type UsersSearchResponse

type UsersSearchResponse struct {
	Users     []UserResponse `json:"users"`
	Scores    []float64      `json:"scores"`
	HighLight []*string      `json:"highlight,omitempty"`
	HasNext   bool           `json:"has_next"`
}

Jump to

Keyboard shortcuts

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