models

package
v1.2.5 Latest Latest
Warning

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

Go to latest
Published: May 10, 2025 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DB *gorm.DB

Functions

This section is empty.

Types

type Admin

type Admin struct {
	Id       int    `form:"id" json:"id"`
	Username string `form:"username" json:"username"`
	Password string `form:"password" json:"password"`
}

func (*Admin) Login

func (admin *Admin) Login(username, password string) error

Login 管理员登录

type Config

type Config struct {
	App struct {
		Name   string `json:"name"`
		Host   string `json:"host"`
		Port   string `json:"port"`
		Dbtype string `json:"dbtype"` // 新增字段
	} `json:"app"`
	Mysql struct {
		Type      string `json:"type"` // 可删,实际由dbtype决定
		Host      string `json:"host"`
		Port      string `json:"port"`
		User      string `json:"user"`
		Password  string `json:"password"`
		Database  string `json:"database"`
		Charset   string `json:"charset"`
		ParseTime bool   `json:"parseTime"`
		Loc       string `json:"loc"`
	} `json:"mysql"`
	Sqlite struct {
		Type string `json:"type"`
		File string `json:"file"`
	} `json:"sqlite"`
}

Config 结构体用于存储应用程序配置

func LoadConfig

func LoadConfig() (*Config, error)

LoadConfig 函数用于从 config.json 文件加载配置

type Group

type Group struct {
	Id       int       `form:"groupid" json:"groupid"`
	Name     string    `form:"groupname" json:"groupname"`
	Sort     int       `form:"sort" json:"sort"`
	Websites []Website `gorm:"ForeignKey:GroupId"`
}

type Site

type Site struct {
	Id          int
	Sitename    string
	Siteurl     string
	Description string
	Keywords    string
	Aboutweb    string
	Aboutme     string
	Copyright   string
	Count       string
}

func (Site) TableName

func (Site) TableName() string

type Website

type Website struct {
	Id          int    `form:"id" json:"id"`
	Name        string `form:"name" json:"name"`
	GroupId     int    `form:"group_id" json:"group_id"`
	Url         string `form:"url" json:"url"`
	Description string `form:"description" json:"description"`
	CreatedAt   time.Time
	Group       Group `gorm:"ForeignKey:GroupId"`
}

Jump to

Keyboard shortcuts

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