mirror of
https://github.com/m5stack/StackChan.git
synced 2026-04-27 19:12:40 +00:00
server code 4/27
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
/*
|
||||
SPDX-FileCopyrightText: 2026 M5Stack Technology CO LTD
|
||||
SPDX-License-Identifier: MIT
|
||||
*/
|
||||
|
||||
// =================================================================================
|
||||
// This file is auto-generated by the GoFrame CLI tool. You may modify it as needed.
|
||||
// =================================================================================
|
||||
|
||||
package dao
|
||||
|
||||
import (
|
||||
"stackChan/internal/dao/internal"
|
||||
)
|
||||
|
||||
// appStoreDao is the data access object for the table app_store.
|
||||
// You can define custom methods on it to extend its functionality as needed.
|
||||
type appStoreDao struct {
|
||||
*internal.AppStoreDao
|
||||
}
|
||||
|
||||
var (
|
||||
// AppStore is a globally accessible object for table app_store operations.
|
||||
AppStore = appStoreDao{internal.NewAppStoreDao()}
|
||||
)
|
||||
|
||||
// Add your custom methods and functionality below.
|
||||
@@ -0,0 +1,27 @@
|
||||
/*
|
||||
SPDX-FileCopyrightText: 2026 M5Stack Technology CO LTD
|
||||
SPDX-License-Identifier: MIT
|
||||
*/
|
||||
|
||||
// =================================================================================
|
||||
// This file is auto-generated by the GoFrame CLI tool. You may modify it as needed.
|
||||
// =================================================================================
|
||||
|
||||
package dao
|
||||
|
||||
import (
|
||||
"stackChan/internal/dao/internal"
|
||||
)
|
||||
|
||||
// devicePanoDao is the data access object for the table device_pano.
|
||||
// You can define custom methods on it to extend its functionality as needed.
|
||||
type devicePanoDao struct {
|
||||
*internal.DevicePanoDao
|
||||
}
|
||||
|
||||
var (
|
||||
// DevicePano is a globally accessible object for table device_pano operations.
|
||||
DevicePano = devicePanoDao{internal.NewDevicePanoDao()}
|
||||
)
|
||||
|
||||
// Add your custom methods and functionality below.
|
||||
@@ -0,0 +1,98 @@
|
||||
/*
|
||||
SPDX-FileCopyrightText: 2026 M5Stack Technology CO LTD
|
||||
SPDX-License-Identifier: MIT
|
||||
*/
|
||||
|
||||
// ==========================================================================
|
||||
// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT.
|
||||
// ==========================================================================
|
||||
|
||||
package internal
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/gogf/gf/v2/database/gdb"
|
||||
"github.com/gogf/gf/v2/frame/g"
|
||||
)
|
||||
|
||||
// AppStoreDao is the data access object for the table app_store.
|
||||
type AppStoreDao struct {
|
||||
table string // table is the underlying table name of the DAO.
|
||||
group string // group is the database configuration group name of the current DAO.
|
||||
columns AppStoreColumns // columns contains all the column names of Table for convenient usage.
|
||||
handlers []gdb.ModelHandler // handlers for customized model modification.
|
||||
}
|
||||
|
||||
// AppStoreColumns defines and stores column names for the table app_store.
|
||||
type AppStoreColumns struct {
|
||||
Id string //
|
||||
AppName string // App name
|
||||
AppIconUrl string // App icon URL
|
||||
Description string // App description
|
||||
FirmwareUrl string // Firmware / installation package download URL
|
||||
CreateAt string // Creation time
|
||||
UpdateAt string // Update time
|
||||
IsDeleted string // Is deleted, 0 normal 1 deleted
|
||||
}
|
||||
|
||||
// appStoreColumns holds the columns for the table app_store.
|
||||
var appStoreColumns = AppStoreColumns{
|
||||
Id: "id",
|
||||
AppName: "app_name",
|
||||
AppIconUrl: "app_icon_url",
|
||||
Description: "description",
|
||||
FirmwareUrl: "firmware_url",
|
||||
CreateAt: "create_at",
|
||||
UpdateAt: "update_at",
|
||||
IsDeleted: "is_deleted",
|
||||
}
|
||||
|
||||
// NewAppStoreDao creates and returns a new DAO object for table data access.
|
||||
func NewAppStoreDao(handlers ...gdb.ModelHandler) *AppStoreDao {
|
||||
return &AppStoreDao{
|
||||
group: "default",
|
||||
table: "app_store",
|
||||
columns: appStoreColumns,
|
||||
handlers: handlers,
|
||||
}
|
||||
}
|
||||
|
||||
// DB retrieves and returns the underlying raw database management object of the current DAO.
|
||||
func (dao *AppStoreDao) DB() gdb.DB {
|
||||
return g.DB(dao.group)
|
||||
}
|
||||
|
||||
// Table returns the table name of the current DAO.
|
||||
func (dao *AppStoreDao) Table() string {
|
||||
return dao.table
|
||||
}
|
||||
|
||||
// Columns returns all column names of the current DAO.
|
||||
func (dao *AppStoreDao) Columns() AppStoreColumns {
|
||||
return dao.columns
|
||||
}
|
||||
|
||||
// Group returns the database configuration group name of the current DAO.
|
||||
func (dao *AppStoreDao) Group() string {
|
||||
return dao.group
|
||||
}
|
||||
|
||||
// Ctx creates and returns a Model for the current DAO. It automatically sets the context for the current operation.
|
||||
func (dao *AppStoreDao) Ctx(ctx context.Context) *gdb.Model {
|
||||
model := dao.DB().Model(dao.table)
|
||||
for _, handler := range dao.handlers {
|
||||
model = handler(model)
|
||||
}
|
||||
return model.Safe().Ctx(ctx)
|
||||
}
|
||||
|
||||
// Transaction wraps the transaction logic using function f.
|
||||
// It rolls back the transaction and returns the error if function f returns a non-nil error.
|
||||
// It commits the transaction and returns nil if function f returns nil.
|
||||
//
|
||||
// Note: Do not commit or roll back the transaction in function f,
|
||||
// as it is automatically handled by this function.
|
||||
func (dao *AppStoreDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) {
|
||||
return dao.Ctx(ctx).Transaction(ctx, f)
|
||||
}
|
||||
@@ -1,3 +1,8 @@
|
||||
/*
|
||||
SPDX-FileCopyrightText: 2026 M5Stack Technology CO LTD
|
||||
SPDX-License-Identifier: MIT
|
||||
*/
|
||||
|
||||
// ==========================================================================
|
||||
// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT.
|
||||
// ==========================================================================
|
||||
@@ -21,14 +26,18 @@ type DeviceDao struct {
|
||||
|
||||
// DeviceColumns defines and stores column names for the table device.
|
||||
type DeviceColumns struct {
|
||||
Mac string //
|
||||
Name string //
|
||||
Mac string //
|
||||
Name string //
|
||||
Uid string // Bound user UID
|
||||
BindTime string // Device binding time
|
||||
}
|
||||
|
||||
// deviceColumns holds the columns for the table device.
|
||||
var deviceColumns = DeviceColumns{
|
||||
Mac: "mac",
|
||||
Name: "name",
|
||||
Mac: "mac",
|
||||
Name: "name",
|
||||
Uid: "uid",
|
||||
BindTime: "bind_time",
|
||||
}
|
||||
|
||||
// NewDeviceDao creates and returns a new DAO object for table data access.
|
||||
|
||||
@@ -1,3 +1,8 @@
|
||||
/*
|
||||
SPDX-FileCopyrightText: 2026 M5Stack Technology CO LTD
|
||||
SPDX-License-Identifier: MIT
|
||||
*/
|
||||
|
||||
// ==========================================================================
|
||||
// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT.
|
||||
// ==========================================================================
|
||||
@@ -21,22 +26,24 @@ type DeviceDanceDao struct {
|
||||
|
||||
// DeviceDanceColumns defines and stores column names for the table device_dance.
|
||||
type DeviceDanceColumns struct {
|
||||
Id string //
|
||||
Mac string // 设备MAC地址
|
||||
DanceIndex string // 舞蹈编号,初始为1~3,可扩展
|
||||
DanceData string // MotionData
|
||||
CreatedAt string //
|
||||
UpdatedAt string //
|
||||
Id string //
|
||||
Mac string // Device MAC address
|
||||
DanceName string // Dance name
|
||||
DanceData string // MotionData
|
||||
MusicUrl string // Dance background music URL
|
||||
CreatedAt string //
|
||||
UpdatedAt string //
|
||||
}
|
||||
|
||||
// deviceDanceColumns holds the columns for the table device_dance.
|
||||
var deviceDanceColumns = DeviceDanceColumns{
|
||||
Id: "id",
|
||||
Mac: "mac",
|
||||
DanceIndex: "dance_index",
|
||||
DanceData: "dance_data",
|
||||
CreatedAt: "created_at",
|
||||
UpdatedAt: "updated_at",
|
||||
Id: "id",
|
||||
Mac: "mac",
|
||||
DanceName: "dance_name",
|
||||
DanceData: "dance_data",
|
||||
MusicUrl: "music_url",
|
||||
CreatedAt: "created_at",
|
||||
UpdatedAt: "updated_at",
|
||||
}
|
||||
|
||||
// NewDeviceDanceDao creates and returns a new DAO object for table data access.
|
||||
|
||||
@@ -1,3 +1,8 @@
|
||||
/*
|
||||
SPDX-FileCopyrightText: 2026 M5Stack Technology CO LTD
|
||||
SPDX-License-Identifier: MIT
|
||||
*/
|
||||
|
||||
// ==========================================================================
|
||||
// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT.
|
||||
// ==========================================================================
|
||||
|
||||
@@ -0,0 +1,92 @@
|
||||
/*
|
||||
SPDX-FileCopyrightText: 2026 M5Stack Technology CO LTD
|
||||
SPDX-License-Identifier: MIT
|
||||
*/
|
||||
|
||||
// ==========================================================================
|
||||
// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT.
|
||||
// ==========================================================================
|
||||
|
||||
package internal
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/gogf/gf/v2/database/gdb"
|
||||
"github.com/gogf/gf/v2/frame/g"
|
||||
)
|
||||
|
||||
// DevicePanoDao is the data access object for the table device_pano.
|
||||
type DevicePanoDao struct {
|
||||
table string // table is the underlying table name of the DAO.
|
||||
group string // group is the database configuration group name of the current DAO.
|
||||
columns DevicePanoColumns // columns contains all the column names of Table for convenient usage.
|
||||
handlers []gdb.ModelHandler // handlers for customized model modification.
|
||||
}
|
||||
|
||||
// DevicePanoColumns defines and stores column names for the table device_pano.
|
||||
type DevicePanoColumns struct {
|
||||
Id string //
|
||||
Mac string // Device MAC address
|
||||
PanoUrl string // Panorama URL
|
||||
CreatedAt string // Creation time
|
||||
UpdatedAt string //
|
||||
}
|
||||
|
||||
// devicePanoColumns holds the columns for the table device_pano.
|
||||
var devicePanoColumns = DevicePanoColumns{
|
||||
Id: "id",
|
||||
Mac: "mac",
|
||||
PanoUrl: "pano_url",
|
||||
CreatedAt: "created_at",
|
||||
UpdatedAt: "updated_at",
|
||||
}
|
||||
|
||||
// NewDevicePanoDao creates and returns a new DAO object for table data access.
|
||||
func NewDevicePanoDao(handlers ...gdb.ModelHandler) *DevicePanoDao {
|
||||
return &DevicePanoDao{
|
||||
group: "default",
|
||||
table: "device_pano",
|
||||
columns: devicePanoColumns,
|
||||
handlers: handlers,
|
||||
}
|
||||
}
|
||||
|
||||
// DB retrieves and returns the underlying raw database management object of the current DAO.
|
||||
func (dao *DevicePanoDao) DB() gdb.DB {
|
||||
return g.DB(dao.group)
|
||||
}
|
||||
|
||||
// Table returns the table name of the current DAO.
|
||||
func (dao *DevicePanoDao) Table() string {
|
||||
return dao.table
|
||||
}
|
||||
|
||||
// Columns returns all column names of the current DAO.
|
||||
func (dao *DevicePanoDao) Columns() DevicePanoColumns {
|
||||
return dao.columns
|
||||
}
|
||||
|
||||
// Group returns the database configuration group name of the current DAO.
|
||||
func (dao *DevicePanoDao) Group() string {
|
||||
return dao.group
|
||||
}
|
||||
|
||||
// Ctx creates and returns a Model for the current DAO. It automatically sets the context for the current operation.
|
||||
func (dao *DevicePanoDao) Ctx(ctx context.Context) *gdb.Model {
|
||||
model := dao.DB().Model(dao.table)
|
||||
for _, handler := range dao.handlers {
|
||||
model = handler(model)
|
||||
}
|
||||
return model.Safe().Ctx(ctx)
|
||||
}
|
||||
|
||||
// Transaction wraps the transaction logic using function f.
|
||||
// It rolls back the transaction and returns the error if function f returns a non-nil error.
|
||||
// It commits the transaction and returns nil if function f returns nil.
|
||||
//
|
||||
// Note: Do not commit or roll back the transaction in function f,
|
||||
// as it is automatically handled by this function.
|
||||
func (dao *DevicePanoDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) {
|
||||
return dao.Ctx(ctx).Transaction(ctx, f)
|
||||
}
|
||||
@@ -1,3 +1,8 @@
|
||||
/*
|
||||
SPDX-FileCopyrightText: 2026 M5Stack Technology CO LTD
|
||||
SPDX-License-Identifier: MIT
|
||||
*/
|
||||
|
||||
// ==========================================================================
|
||||
// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT.
|
||||
// ==========================================================================
|
||||
@@ -22,10 +27,10 @@ type DevicePostDao struct {
|
||||
// DevicePostColumns defines and stores column names for the table device_post.
|
||||
type DevicePostColumns struct {
|
||||
Id string //
|
||||
Mac string // 发帖设备MAC
|
||||
ContentText string // 文本内容
|
||||
ContentImage string // 图片URL
|
||||
CreatedAt string // 发帖时间
|
||||
Mac string // Post device MAC
|
||||
ContentText string //
|
||||
ContentImage string // Image URL
|
||||
CreatedAt string // Post time
|
||||
}
|
||||
|
||||
// devicePostColumns holds the columns for the table device_post.
|
||||
|
||||
@@ -1,3 +1,8 @@
|
||||
/*
|
||||
SPDX-FileCopyrightText: 2026 M5Stack Technology CO LTD
|
||||
SPDX-License-Identifier: MIT
|
||||
*/
|
||||
|
||||
// ==========================================================================
|
||||
// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT.
|
||||
// ==========================================================================
|
||||
@@ -22,10 +27,10 @@ type DevicePostCommentDao struct {
|
||||
// DevicePostCommentColumns defines and stores column names for the table device_post_comment.
|
||||
type DevicePostCommentColumns struct {
|
||||
Id string //
|
||||
PostId string // 帖子ID
|
||||
Mac string // 评论设备MAC
|
||||
Content string // 评论内容
|
||||
CreatedAt string // 评论时间
|
||||
PostId string // Post ID
|
||||
Mac string // Comment device MAC
|
||||
Content string //
|
||||
CreatedAt string // Comment time
|
||||
}
|
||||
|
||||
// devicePostCommentColumns holds the columns for the table device_post_comment.
|
||||
|
||||
@@ -1,3 +1,8 @@
|
||||
/*
|
||||
SPDX-FileCopyrightText: 2026 M5Stack Technology CO LTD
|
||||
SPDX-License-Identifier: MIT
|
||||
*/
|
||||
|
||||
// ==========================================================================
|
||||
// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT.
|
||||
// ==========================================================================
|
||||
|
||||
@@ -0,0 +1,108 @@
|
||||
/*
|
||||
SPDX-FileCopyrightText: 2026 M5Stack Technology CO LTD
|
||||
SPDX-License-Identifier: MIT
|
||||
*/
|
||||
|
||||
// ==========================================================================
|
||||
// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT.
|
||||
// ==========================================================================
|
||||
|
||||
package internal
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/gogf/gf/v2/database/gdb"
|
||||
"github.com/gogf/gf/v2/frame/g"
|
||||
)
|
||||
|
||||
// UserDao is the data access object for the table user.
|
||||
type UserDao struct {
|
||||
table string // table is the underlying table name of the DAO.
|
||||
group string // group is the database configuration group name of the current DAO.
|
||||
columns UserColumns // columns contains all the column names of Table for convenient usage.
|
||||
handlers []gdb.ModelHandler // handlers for customized model modification.
|
||||
}
|
||||
|
||||
// UserColumns defines and stores column names for the table user.
|
||||
type UserColumns struct {
|
||||
Uid string // User unique UID (remote platform primary key)
|
||||
Username string // Login username
|
||||
Userslug string // User alias
|
||||
DisplayName string // User display name
|
||||
IconText string // User icon text
|
||||
IconBgColor string // Icon background color
|
||||
EmailConfirmed string // Email verified, 0-no 1-yes
|
||||
JoinDate string // Registration timestamp (milliseconds)
|
||||
LastOnline string // Last online timestamp (milliseconds)
|
||||
UserStatus string // User online status
|
||||
CreateAt string // Local creation time
|
||||
UpdateAt string // Local update time
|
||||
IsDeleted string // Is deleted, 0-normal 1-deleted
|
||||
}
|
||||
|
||||
// userColumns holds the columns for the table user.
|
||||
var userColumns = UserColumns{
|
||||
Uid: "uid",
|
||||
Username: "username",
|
||||
Userslug: "userslug",
|
||||
DisplayName: "display_name",
|
||||
IconText: "icon_text",
|
||||
IconBgColor: "icon_bg_color",
|
||||
EmailConfirmed: "email_confirmed",
|
||||
JoinDate: "join_date",
|
||||
LastOnline: "last_online",
|
||||
UserStatus: "user_status",
|
||||
CreateAt: "create_at",
|
||||
UpdateAt: "update_at",
|
||||
IsDeleted: "is_deleted",
|
||||
}
|
||||
|
||||
// NewUserDao creates and returns a new DAO object for table data access.
|
||||
func NewUserDao(handlers ...gdb.ModelHandler) *UserDao {
|
||||
return &UserDao{
|
||||
group: "default",
|
||||
table: "user",
|
||||
columns: userColumns,
|
||||
handlers: handlers,
|
||||
}
|
||||
}
|
||||
|
||||
// DB retrieves and returns the underlying raw database management object of the current DAO.
|
||||
func (dao *UserDao) DB() gdb.DB {
|
||||
return g.DB(dao.group)
|
||||
}
|
||||
|
||||
// Table returns the table name of the current DAO.
|
||||
func (dao *UserDao) Table() string {
|
||||
return dao.table
|
||||
}
|
||||
|
||||
// Columns returns all column names of the current DAO.
|
||||
func (dao *UserDao) Columns() UserColumns {
|
||||
return dao.columns
|
||||
}
|
||||
|
||||
// Group returns the database configuration group name of the current DAO.
|
||||
func (dao *UserDao) Group() string {
|
||||
return dao.group
|
||||
}
|
||||
|
||||
// Ctx creates and returns a Model for the current DAO. It automatically sets the context for the current operation.
|
||||
func (dao *UserDao) Ctx(ctx context.Context) *gdb.Model {
|
||||
model := dao.DB().Model(dao.table)
|
||||
for _, handler := range dao.handlers {
|
||||
model = handler(model)
|
||||
}
|
||||
return model.Safe().Ctx(ctx)
|
||||
}
|
||||
|
||||
// Transaction wraps the transaction logic using function f.
|
||||
// It rolls back the transaction and returns the error if function f returns a non-nil error.
|
||||
// It commits the transaction and returns nil if function f returns nil.
|
||||
//
|
||||
// Note: Do not commit or roll back the transaction in function f,
|
||||
// as it is automatically handled by this function.
|
||||
func (dao *UserDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) {
|
||||
return dao.Ctx(ctx).Transaction(ctx, f)
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
/*
|
||||
SPDX-FileCopyrightText: 2026 M5Stack Technology CO LTD
|
||||
SPDX-License-Identifier: MIT
|
||||
*/
|
||||
|
||||
// =================================================================================
|
||||
// This file is auto-generated by the GoFrame CLI tool. You may modify it as needed.
|
||||
// =================================================================================
|
||||
|
||||
package dao
|
||||
|
||||
import (
|
||||
"stackChan/internal/dao/internal"
|
||||
)
|
||||
|
||||
// userDao is the data access object for the table user.
|
||||
// You can define custom methods on it to extend its functionality as needed.
|
||||
type userDao struct {
|
||||
*internal.UserDao
|
||||
}
|
||||
|
||||
var (
|
||||
// User is a globally accessible object for table user operations.
|
||||
User = userDao{internal.NewUserDao()}
|
||||
)
|
||||
|
||||
// Add your custom methods and functionality below.
|
||||
Reference in New Issue
Block a user