model

package
v0.0.0-...-485fe8d Latest Latest
Warning

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

Go to latest
Published: Nov 4, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Account

type Account struct {
	bun.BaseModel `bun:"accounts"`

	AccountID int     `bun:",pk,autoincrement" json:"id"`
	PenguinID string  `json:"penguinId"`
	Weight    float64 `json:"weight"`
	// Tags      []string `json:"tags"`
	CreatedAt time.Time `json:"createdAt"`
}

type Activity

type Activity struct {
	bun.BaseModel `bun:"activities"`

	ActivityID int             `bun:",pk,autoincrement" json:"id"`
	StartTime  *time.Time      `json:"startTime"`
	EndTime    *time.Time      `json:"endTime"`
	Name       json.RawMessage `json:"name"`
	Existence  json.RawMessage `json:"existence"`
}

type Bounds

type Bounds struct {
	Upper      int   `json:"upper"`
	Lower      int   `json:"lower"`
	Exceptions []int `json:"exceptions,omitempty"`
}

func (*Bounds) Scan

func (b *Bounds) Scan(src any) error

type CombinedResultForDropMatrix

type CombinedResultForDropMatrix struct {
	StageID         int         `json:"stageId"`
	ItemID          int         `json:"itemId"`
	Times           int         `json:"times"`
	Quantity        int         `json:"quantity"`
	QuantityBuckets map[int]int `json:"quantityBuckets"`
	TimeRange       *TimeRange  `json:"timeRange"`
}

type CombinedResultForDropPattern

type CombinedResultForDropPattern struct {
	StageID   int `json:"stageId"`
	PatternID int `json:"patternId"`
	Times     int `json:"times"`
	Quantity  int `json:"quantity"`
}

type CombinedResultForTrend

type CombinedResultForTrend struct {
	GroupID   int        `json:"groupId"`
	StartTime *time.Time `json:"startTime"`
	EndTime   *time.Time `json:"endTime"`
	StageID   int        `json:"stageId"`
	ItemID    int        `json:"itemId"`
	Times     int        `json:"times"`
	Quantity  int        `json:"quantity"`
}

type DropInfo

type DropInfo struct {
	bun.BaseModel `bun:"drop_infos,alias:di"`

	DropID      int             `bun:",pk,autoincrement" json:"id"`
	Server      string          `json:"server"`
	StageID     int             `json:"stageId"`
	ItemID      null.Int        `json:"itemId" swaggertype:"integer"`
	DropType    string          `json:"dropType"`
	RangeID     int             `json:"rangeId"`
	Accumulable bool            `json:"accumulable"`
	Bounds      *Bounds         `json:"bounds"`
	Extras      json.RawMessage `json:"extras,omitempty"`
}

DropInfo describes the drops of a stage during a time range: of one item, or, without an item, of the stage.

Accumulable tells whether the drops of the item in this time range are carried into the later time ranges of the stage and item. Consecutive accumulable time ranges are counted together; a time range that is not accumulable is counted on its own, without the time ranges before or after it. With A false, B and C true (in chronological order) the latest window is B~C; when the latest time range is not accumulable, it is the latest window by itself. The global and the personal drop matrices use the same rule (see #794 and service.accumulableSegments).

type DropMatrixElement

type DropMatrixElement struct {
	bun.BaseModel `bun:"drop_matrix_elements,alias:dme"`

	ElementID       int         `bun:",pk,autoincrement" json:"id"`
	StageID         int         `json:"stageId"`
	ItemID          int         `json:"itemId"`
	StartTime       *time.Time  `json:"startTime"`
	EndTime         *time.Time  `json:"endTime"`
	DayNum          int         `json:"dayNum"`
	Quantity        int         `json:"quantity"`
	Times           int         `json:"times"`
	QuantityBuckets map[int]int `bun:"type:jsonb" json:"quantityBuckets"`
	Server          string      `json:"server"`
	SourceCategory  string      `json:"sourceCategory"` // sourceCategory can be: "automated", "manual", "all"

	RangeID int `bun:"-" json:"-"`
	// TimeRange field is for those elements whose time range is not saved in DB, but a customized one
	TimeRange *TimeRange `bun:"-" json:"-"`
}

type DropMatrixQueryResult

type DropMatrixQueryResult struct {
	Matrix []*OneDropMatrixElement `json:"matrix"`
}

type DropPattern

type DropPattern struct {
	bun.BaseModel `bun:"drop_patterns,alias:dp"`

	PatternID           int    `bun:",pk,autoincrement" json:"id"`
	Hash                string `json:"hash"`
	OriginalFingerprint string `json:"original_fingerprint"`
}

type DropPatternElement

type DropPatternElement struct {
	bun.BaseModel `bun:"drop_pattern_elements,alias:dpe"`

	ElementID     int `bun:",pk,autoincrement" json:"id"`
	DropPatternID int `json:"dropPatternId"`
	ItemID        int `json:"itemId"`
	Quantity      int `json:"quantity"`
}

type DropPatternElementForExport

type DropPatternElementForExport struct {
	ArkItemID string `json:"itemId"`
	Quantity  int    `json:"quantity"`
}

type DropPatternForExport

type DropPatternForExport struct {
	PatternID           int                            `json:"pattern_id"`
	DropPatternElements []*DropPatternElementForExport `json:"drop_pattern_elements"`
}

type DropReport

type DropReport struct {
	bun.BaseModel `bun:"drop_reports,alias:dr"`

	ReportID    int        `bun:",pk,autoincrement" json:"id"`
	StageID     int        `json:"stageId"`
	PatternID   int        `json:"patternId"`
	Times       int        `json:"times"`
	CreatedAt   *time.Time `json:"createdAt"`
	Reliability int        `json:"reliability"`
	Server      string     `json:"server"`
	AccountID   int        `json:"accountId"`
	SourceName  string     `json:"sourceName"`
	Version     string     `json:"version"`
}

type DropReportExtra

type DropReportExtra struct {
	bun.BaseModel `bun:"drop_report_extras,alias:dre"`

	ReportID int                          `bun:",pk,autoincrement" json:"id"`
	IP       string                       `json:"ip"`
	Metadata *types.ReportRequestMetadata `json:"metadata"`
	MD5      null.String                  `json:"md5" swaggertype:"string"`

	// CreatedAt is the created_at of the report, the partition key of drop_report_extras on the new database of #752
	// (scripts/newdb). Today's database has no such column, so bun neither selects nor inserts it: CreateDropReportExtra
	// writes it when it is set, which the report worker does only with appconfig.ConfigSpec.ReportSchemaV2Enabled.
	// Reads leave it nil.
	CreatedAt *time.Time `bun:"-" json:"-"`
}

type DropReportForExport

type DropReportForExport struct {
	Times      int    `json:"times"`
	PatternID  int    `json:"pattern_id"`
	CreatedAt  int64  `json:"created_at"`
	AccountID  int    `json:"account_id"`
	SourceName string `json:"source_name"`
	Version    string `json:"version"`
}

type DropReportQueryContext

type DropReportQueryContext struct {
	Server             string         `json:"server"`
	StartTime          *time.Time     `json:"startTime"`
	EndTime            *time.Time     `json:"endTime"`
	AccountID          null.Int       `json:"accountId"`
	StageItemFilter    *map[int][]int `json:"stageItemFilter"`
	SourceCategory     string         `json:"sourceCategory"`
	ExcludeNonOneTimes bool           `json:"excludeNonOneTimes"`
	Times              null.Int       `json:"times"`
}

func (*DropReportQueryContext) GetItemIdsSet

func (queryCtx *DropReportQueryContext) GetItemIdsSet(stageId int) map[int]struct{}

func (*DropReportQueryContext) GetStageIds

func (queryCtx *DropReportQueryContext) GetStageIds() []int

func (*DropReportQueryContext) HasItemIds

func (queryCtx *DropReportQueryContext) HasItemIds() bool

type Existence

type Existence struct {
	// CN: 国服 Mainland China Server (maintained by Hypergryph Network Technology Co., Ltd.)
	CN ServerExistence `json:"CN" validate:"required"`
	// US: 美服/国际服 Global Server (maintained by Yostar Limited)
	US ServerExistence `json:"US" validate:"required"`
	// JP: 日服 Japan Server (maintained by Yostar Inc,.)
	JP ServerExistence `json:"JP" validate:"required"`
	// KR: 韩服 Korea Server (maintained by Yostar Limited)
	KR ServerExistence `json:"KR" validate:"required"`
}

type ExportDropReportsAndPatternsResult

type ExportDropReportsAndPatternsResult struct {
	DropReports  []*DropReportForExport  `json:"drop_reports"`
	DropPatterns []*DropPatternForExport `json:"drop_patterns"`
}

type GlobalDropMatrixAggregate

type GlobalDropMatrixAggregate struct {
	Times           null.Int
	Quantity        null.Int
	QuantityBuckets map[int]int
}

GlobalDropMatrixAggregate aggregates the elements of a target in a source category. Times sums times over the distinct (times, day_num) of the elements with times > 0; Quantity and QuantityBuckets sum those with quantity > 0. A part no element counts for is invalid (empty for the buckets).

type GlobalDropMatrixKey

type GlobalDropMatrixKey struct {
	SourceCategory string
	StageID        int
	ItemID         int
}

type GlobalDropMatrixTarget

type GlobalDropMatrixTarget struct {
	StageID   int
	ItemID    int
	TimeRange *TimeRange
}

GlobalDropMatrixTarget is a stage and item of a global drop matrix, with the time range its elements are aggregated over (the elements within it).

type GlobalPatternMatrixAggregates

type GlobalPatternMatrixAggregates struct {
	TimesByStageID      map[int]int
	QuantitiesByStageID map[int]map[int]int
}

GlobalPatternMatrixAggregates aggregates the elements of the targets of a source category: per stage, the times summed over days of the smallest times > 0 of a day, and per stage and pattern, the quantity > 0 summed.

type GlobalPatternMatrixTarget

type GlobalPatternMatrixTarget struct {
	StageID   int
	TimeRange *TimeRange
}

GlobalPatternMatrixTarget is a stage of a global pattern matrix, with the time range its elements are aggregated over (the elements within it).

type I18nOptionalString

type I18nOptionalString struct {
	// ZH: 中文 (zh-CN)
	ZH string `json:"zh"`
	// EN: English (en)
	EN string `json:"en"`
	// JP: 日本語 (ja)
	JA string `json:"ja"`
	// KR: 한국어 (ko)
	KO string `json:"ko"`
}

type I18nString

type I18nString struct {
	// ZH: 中文 (zh-CN)
	ZH string `json:"zh" validate:"required"`
	// EN: English (en)
	EN string `json:"en" validate:"required"`
	// JP: 日本語 (ja)
	JA string `json:"ja" validate:"required"`
	// KR: 한국어 (ko)
	KO string `json:"ko" validate:"required"`
}

type Item

type Item struct {
	bun.BaseModel `bun:"items,alias:it" swaggerignore:"true"`

	// ItemID (penguinItemId) is the numerical ID of the item.
	ItemID int `bun:",pk,autoincrement" json:"penguinItemId"`
	// ArkItemID (itemId) is the previously used, string form ID of the item; in JSON-representation `itemId` is used as key.
	ArkItemID string `json:"itemId"`
	Type      string `json:"type"`
	// Name is a map with language code as key and the name of the item in that language as value.
	Name json.RawMessage `json:"name" swaggertype:"object"`
	// Existence is a map with server code as key and the existence of the item in that server as value.
	Existence json.RawMessage `json:"existence" swaggertype:"object"`
	// SortID is the sort position of the item.
	SortID int `json:"sortId"`
	Rarity int `json:"rarity"`
	// Group is an identifier of what the item actually is. For example, both orirock and orirock cube would have the same group, `orirock`.
	Group null.String `json:"group,omitempty" swaggertype:"string"`
	// Sprite describes the location of the item's sprite on the sprite image, in a form of Y:X.
	Sprite null.String `json:"sprite,omitempty" swaggertype:"string"`
	// Keywords is an arbitrary JSON object containing the keywords of the item, for optimizing the results of the frontend built-in search engine.
	Keywords json.RawMessage `json:"keywords,omitempty" swaggertype:"object"`
}

type ItemTrend

type ItemTrend struct {
	ItemID     int        `json:"itemId"`
	StartTime  *time.Time `json:"startTime"`
	Times      []int      `json:"times"`
	Quantity   []int      `json:"quantity"`
	MinGroupID int        `json:"-"`
	MaxGroupID int        `json:"-"`
}

type Keywords

type Keywords struct {
	// Alias of the item
	Alias I18nOptionalString `json:"alias"`
	// Pronunciation hints of the item
	Pron I18nOptionalString `json:"pron"`
}

type Notice

type Notice struct {
	bun.BaseModel `bun:"notices"`

	NoticeID  int             `bun:",pk,autoincrement" json:"id"`
	Existence json.RawMessage `json:"existence" swaggertype:"object"`
	Severity  null.Int        `json:"severity" swaggertype:"integer"`
	Content   json.RawMessage `json:"content_i18n"`
}

type OneDropMatrixElement

type OneDropMatrixElement struct {
	StageID   int        `json:"stageId"`
	ItemID    int        `json:"itemId"`
	Times     int        `json:"times"`
	Quantity  int        `json:"quantity"`
	StdDev    float64    `json:"stdDev"`
	TimeRange *TimeRange `json:"timeRange"`
}

type OnePatternMatrixElement

type OnePatternMatrixElement struct {
	StageID   int        `json:"stageId"`
	PatternID int        `json:"patternId"`
	TimeRange *TimeRange `json:"timeRange"`
	Times     int        `json:"times"`
	Quantity  int        `json:"quantity"`
}

type PatternMatrixElement

type PatternMatrixElement struct {
	bun.BaseModel `bun:"pattern_matrix_elements,alias:pme"`

	ElementID      int        `bun:",pk,autoincrement" json:"id"`
	StageID        int        `json:"stageId"`
	PatternID      int        `json:"patternId"`
	StartTime      *time.Time `json:"startTime"`
	EndTime        *time.Time `json:"endTime"`
	DayNum         int        `json:"dayNum"`
	Quantity       int        `json:"quantity"`
	Times          int        `json:"times"`
	Server         string     `json:"server"`
	SourceCategory string     `json:"sourceCategory"` // sourceCategory can be: "automated", "manual", "all"

	RangeID int `bun:"-" json:"-"`
}

type PatternMatrixQueryResult

type PatternMatrixQueryResult struct {
	PatternMatrix []*OnePatternMatrixElement `json:"dropPatterns"`
}

type Property

type Property struct {
	bun.BaseModel `bun:"properties"`

	PropertyID int    `bun:",pk,autoincrement" json:"id"`
	Key        string `json:"key"`
	Value      string `json:"value"`
}

type QuantityUniqCountResultForDropMatrix

type QuantityUniqCountResultForDropMatrix struct {
	StageID  int `json:"stageId" bun:"stage_id"`
	ItemID   int `json:"itemId" bun:"item_id"`
	Quantity int `json:"quantity" bun:"quantity"`
	Count    int `json:"count" bun:"count"`
}

type RecognitionDefect

type RecognitionDefect struct {
	bun.BaseModel `bun:"recognition_defects"`

	// DefectID is the primary key for this table; it is generated by client
	DefectID          string          `bun:"defect_id,pk" json:"defectId"`
	CreatedAt         *time.Time      `bun:"created_at,nullzero,default:current_timestamp" json:"createdAt"`
	UpdatedAt         *time.Time      `bun:"updated_at,nullzero" json:"updatedAt"`
	SessionID         string          `bun:"session_id,notnull" json:"sessionId"`
	AccountID         int             `bun:"account_id,nullzero" json:"accountId"`
	ImageURI          string          `bun:"image_uri" json:"imageUrl"`
	RecognitionResult json.RawMessage `bun:"recognition_result,notnull" json:"recognitionResult"`
	Environment       json.RawMessage `bun:"environment,notnull" json:"environment"`
}

type RejectRule

type RejectRule struct {
	bun.BaseModel `bun:"reject_rules"`

	RuleID          int        `bun:",pk,autoincrement" json:"id"`
	CreatedAt       *time.Time `bun:"created_at" json:"created_at"`
	UpdatedAt       *time.Time `bun:"updated_at" json:"updated_at"`
	Status          int        `bun:"status" json:"status"`
	Expr            string     `bun:"expr" json:"expr"`
	WithReliability int        `bun:"with_reliability" json:"with_reliability"`
}

type ServerExistence

type ServerExistence struct {
	Exist     bool `json:"exist" validate:"required" example:"true"`
	StartTime *int `json:"openTime,omitempty" extension:"x-nullable" example:"1634799600000"`
	EndTime   *int `json:"closeTime,omitempty" extension:"x-nullable" example:"1635966000000"`
}

type SiteStatsAggregate

type SiteStatsAggregate struct {
	StageID int `bun:"stage_id"`
	ItemID  int `bun:"item_id"`
	// Times sums times over the distinct (times, day_num) pairs with times > 0; NULL if there is no such pair.
	Times    null.Int `bun:"times"`
	Quantity int      `bun:"quantity"`
}

SiteStatsAggregate is the per stage and item aggregation of drop matrix elements behind the site stats. Aggregates of disjoint day ranges add up (see Add).

func (*SiteStatsAggregate) Add

func (a *SiteStatsAggregate) Add(other *SiteStatsAggregate)

Add accumulates an aggregate of the same stage and item over a disjoint range of days.

type SiteStatsBase

type SiteStatsBase struct {
	BeforeDayNum int
	Generation   int64
	Aggregates   []*SiteStatsAggregate
}

SiteStatsBase holds the site stats aggregates of every day before BeforeDayNum, as of invalidation Generation.

type Snapshot

type Snapshot struct {
	bun.BaseModel `bun:"snapshots"`

	SnapshotID int        `bun:",pk,autoincrement" json:"id"`
	CreatedAt  *time.Time `bun:"created_at" json:"created_at"`
	Key        string     `bun:"key" json:"key"`
	Version    string     `bun:"version" json:"version"`
	Content    string     `bun:"content" json:"content"`
}

type Stage

type Stage struct {
	bun.BaseModel `bun:"stages,alias:st"`

	// StageID (penguinStageId) is the numerical ID of the stage.
	StageID int `bun:",pk,autoincrement" json:"penguinStageId"`
	// ArkStageID (stageId) is the previously used, string form ID of the stage; in JSON-representation `stageId` is used as key.
	ArkStageID string `json:"stageId"`
	// ZoneID is the numerical ID of the zone the stage is in.
	ZoneID int `json:"zoneId"`
	// StageType is the type of the stage, e.g. "MAIN", "SUB", "ACTIVITY" and "DAILY".
	StageType string `json:"stageType"`
	// ExtraProcessType is the type of extra process that is used in the stage, e.g. "GACHABOX".
	ExtraProcessType null.String `json:"extraProcessType" swaggertype:"string"`
	// Code is a map with language code as key and the code of the stage in that language as value.
	Code json.RawMessage `json:"code"`
	// Sanity is the sanity requirement for a full clear of the stage.
	Sanity null.Int `json:"sanity" swaggertype:"integer"`
	// Existence is a map with server code as key and the existence of the item in that server as value.
	Existence json.RawMessage `json:"existence" swaggertype:"object"`
	// MinClearTime is the minimum time (in milliseconds as a duration) it takes to clear the stage, referencing from prts.wiki
	MinClearTime null.Int `json:"minClearTime" swaggertype:"integer"`
}

type StageExtended

type StageExtended struct {
	Stage

	Zone *Zone `bun:"rel:belongs-to,join:zone_id=zone_id" json:"-"`
}

type StageTrend

type StageTrend struct {
	StageID int          `json:"stageId"`
	Results []*ItemTrend `json:"results"`
}

type TimeRange

type TimeRange struct {
	bun.BaseModel `bun:"time_ranges,alias:tr"`

	RangeID   int         `bun:",pk,autoincrement" json:"id"`
	Name      null.String `json:"name,omitempty" swaggertype:"string"`
	StartTime *time.Time  `json:"startTime"`
	EndTime   *time.Time  `json:"endTime"`
	Comment   null.String `json:"comment" swaggertype:"string"`
	Server    string      `json:"server"`
}

func TimeRangeFromString

func TimeRangeFromString(s string) *TimeRange

func (*TimeRange) HumanReadableString

func (tr *TimeRange) HumanReadableString(server string) string

func (*TimeRange) Includes

func (tr *TimeRange) Includes(t time.Time) bool

func (*TimeRange) String

func (tr *TimeRange) String() string

type TotalQuantityResultForDropMatrix

type TotalQuantityResultForDropMatrix struct {
	StageID       int `json:"stageId" bun:"stage_id"`
	ItemID        int `json:"itemId" bun:"item_id"`
	TotalQuantity int `json:"totalQuantity" bun:"total_quantity"`
}

DropMatrix

type TotalQuantityResultForPatternMatrix

type TotalQuantityResultForPatternMatrix struct {
	StageID       int `json:"stageId" bun:"stage_id"`
	PatternID     int `json:"patternId" bun:"pattern_id"`
	TotalQuantity int `json:"totalQuantity" bun:"total_quantity"`
}

DropPattern

type TotalQuantityResultForTrend

type TotalQuantityResultForTrend struct {
	GroupID       int        `json:"groupId" bun:"group_id"`
	IntervalStart *time.Time `json:"intervalStart" bun:"interval_start"`
	IntervalEnd   *time.Time `json:"intervalEnd" bun:"interval_end"`
	StageID       int        `json:"stageId" bun:"stage_id"`
	ItemID        int        `json:"itemId" bun:"item_id"`
	TotalQuantity int        `json:"totalQuantity" bun:"total_quantity"`
}

Trend

type TotalTimesResult

type TotalTimesResult struct {
	StageID    int `json:"stageId" bun:"stage_id"`
	TotalTimes int `json:"totalTimes" bun:"total_times"`
}

type TotalTimesResultForTrend

type TotalTimesResultForTrend struct {
	GroupID       int        `json:"groupId" bun:"group_id"`
	IntervalStart *time.Time `json:"intervalStart" bun:"interval_start"`
	IntervalEnd   *time.Time `json:"intervalEnd" bun:"interval_end"`
	StageID       int        `json:"stageId" bun:"stage_id"`
	TotalTimes    int        `json:"totalTimes" bun:"total_times"`
}

type TrendElement

type TrendElement struct {
	ElementID      int        `json:"id"`
	StageID        int        `json:"stageId"`
	ItemID         int        `json:"itemId"`
	GroupID        int        `json:"groupId"`
	StartTime      *time.Time `json:"startTime"`
	EndTime        *time.Time `json:"endTime"`
	Quantity       int        `json:"quantity"`
	Times          int        `json:"times"`
	Server         string     `json:"server"`
	SourceCategory string     `json:"sourceCategory"` // sourceCategory can be: "automated", "manual", "all"
}

type TrendQueryResult

type TrendQueryResult struct {
	Trends []*StageTrend `json:"trends"`
}

type Zone

type Zone struct {
	bun.BaseModel `bun:"zones,alias:zo"`

	// ZoneID is the numerical ID of the zone.
	ZoneID    int    `bun:",pk,autoincrement" json:"penguinZoneId"`
	ArkZoneID string `json:"zoneId"`
	Index     int    `json:"index"`
	// Category of the zone.
	Category string `json:"category" example:"MAINLINE"`
	// Type of the zone, e.g. "AWAKENING_HOUR" or "VISION_SHATTER". Optional and only occurs when `category` is "MAINLINE".
	Type null.String `json:"type,omitempty" swaggertype:"string" example:"AWAKENING_HOUR"`
	// Name is a map with language code as key and the name of the item in that language as value.
	Name json.RawMessage `json:"name"`
	// Existence is a map with server code as key and the existence of the item in that server as value.
	Existence json.RawMessage `json:"existence" swaggertype:"object"`
	// Background is the path of the background image of the zone, relative to the CDN endpoint.
	Background null.String `json:"background,omitempty" swaggertype:"string"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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