35 lines
785 B
Go
35 lines
785 B
Go
package model
|
|
|
|
import (
|
|
"lyra/internal/cache"
|
|
"time"
|
|
|
|
"github.com/jmoiron/sqlx"
|
|
)
|
|
|
|
type Link struct {
|
|
ID int64 `db:"id"`
|
|
CategoryID int64 `db:"category_id"`
|
|
Title string `db:"title"`
|
|
Description string `db:"description"`
|
|
URL string `db:"url"`
|
|
Icon *string `db:"icon"`
|
|
Keywords []string `db:"keywords"`
|
|
Sort int `db:"sort"`
|
|
Pinned bool `db:"pinned"`
|
|
PinnedSort *int `db:"pinned_sort"`
|
|
CreatedAt time.Time `db:"created_at"`
|
|
UpdatedAt time.Time `db:"updated_at"`
|
|
}
|
|
|
|
type LinkModel interface {
|
|
}
|
|
type defaultLinkModel struct {
|
|
db *sqlx.DB
|
|
cache *cache.Cache
|
|
}
|
|
|
|
func NewLinkModel(db *sqlx.DB, cache *cache.Cache) CategoryModel {
|
|
return &defaultCategoryModel{db: db, cache: cache}
|
|
}
|