models

package
v0.0.0-...-d1f91b8 Latest Latest
Warning

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

Go to latest
Published: Jun 24, 2026 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CloseDB

func CloseDB()

func FetchWallpaper

func FetchWallpaper() goent.FetchFunc

FetchWallpaper creates a FetchFunc for Wallpaper

func SetAutoMigrate

func SetAutoMigrate(auto bool)

Types

type Database

type Database struct {
	PublicSchema `goe:"public;prefix:t_"`
	*goent.DB
}

Database represents the database connection.

func GetDB

func GetDB() *Database

func OpenDB

func OpenDB(cfg drivers.DatabaseConfig) (*Database, error)

type DetailData

type DetailData struct {
	GUID        string `json:"guid"`
	Date        string `json:"date"`
	Title       string `json:"title"`
	Copyright   string `json:"copyright"`
	Headline    string `json:"headline"`
	Description string `json:"description"`
	Filepath    string `json:"filepath"`
}

DetailData represents the data section of the detail API response

type ListResponseData

type ListResponseData struct {
	Page      int            `json:"page"`
	PageCount int            `json:"pageCount"`
	DataCount int            `json:"dataCount"`
	PageSize  int            `json:"pageSize"`
	Data      []WallpaperRaw `json:"data"`
}

ListResponseData represents the data section of the list API response

type PublicSchema

type PublicSchema struct {
	Wallpaper *goent.Table[Wallpaper]
}

PublicSchema contains all table definitions

type Wallpaper

type Wallpaper struct {
	ID          int64   `goe:"pk"`                                // Primary key, auto increment
	GUID        string  `json:"guid" goe:"column:guid"`           // Unique identifier
	Date        string  `json:"date" goe:"unique"`                // Date, unique
	Slug        string  `json:"slug"`                             // Image ID without OHR. prefix and resolution
	Title       string  `json:"title"`                            // Title
	Headline    string  `json:"headline"`                         // Headline
	Copyright   string  `json:"copyright"`                        // Copyright
	Description *string `json:"description"`                      // Description
	ImageDPI    string  `json:"image_dpi" goe:"column:image_dpi"` // Resolution, e.g. "1920x1080"
	FileSize    int64   `json:"file_size" goe:"default:0"`        // File size in KB
}

Wallpaper represents the wallpapers table

func (*Wallpaper) GetID

func (t *Wallpaper) GetID() int64

GetID implements goent.Entity interface

func (*Wallpaper) ScanDest

func (t *Wallpaper) ScanDest() []any

ScanDest returns a slice of pointers to Wallpaper fields for database scanning

func (*Wallpaper) SetID

func (t *Wallpaper) SetID(id int64)

SetID implements goent.Entity interface

func (*Wallpaper) TableName

func (*Wallpaper) TableName() string

TableName returns the database table name

func (*Wallpaper) UpdatePairs

func (t *Wallpaper) UpdatePairs() []goent.Pair

UpdatePairs returns a slice of Pair for updating non-primary key fields

type WallpaperRaw

type WallpaperRaw struct {
	GUID        string `json:"guid"`
	Date        string `json:"date"`
	Title       string `json:"title"`
	Copyright   string `json:"copyright"`
	Headline    string `json:"headline"`
	Filepath    string `json:"filepath"`
	Description string `json:"description"`
}

WallpaperRaw represents the raw data from the API

type WiliiDetailResponse

type WiliiDetailResponse struct {
	Status   int        `json:"status"`
	Success  bool       `json:"success"`
	Msg      string     `json:"msg"`
	Response DetailData `json:"response"`
}

WiliiDetailResponse represents the response from the detail API

type WiliiListResponse

type WiliiListResponse struct {
	Status   int              `json:"status"`
	Success  bool             `json:"success"`
	Msg      string           `json:"msg"`
	Response ListResponseData `json:"response"`
}

WiliiListResponse represents the response from the list API

Jump to

Keyboard shortcuts

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