mirror of
https://github.com/m5stack/StackChan.git
synced 2026-04-27 19:12:40 +00:00
server code
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"
|
||||
)
|
||||
|
||||
// deviceDao is the data access object for the table device.
|
||||
// You can define custom methods on it to extend its functionality as needed.
|
||||
type deviceDao struct {
|
||||
*internal.DeviceDao
|
||||
}
|
||||
|
||||
var (
|
||||
// Device is a globally accessible object for table device operations.
|
||||
Device = deviceDao{internal.NewDeviceDao()}
|
||||
)
|
||||
|
||||
// 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"
|
||||
)
|
||||
|
||||
// deviceDanceDao is the data access object for the table device_dance.
|
||||
// You can define custom methods on it to extend its functionality as needed.
|
||||
type deviceDanceDao struct {
|
||||
*internal.DeviceDanceDao
|
||||
}
|
||||
|
||||
var (
|
||||
// DeviceDance is a globally accessible object for table device_dance operations.
|
||||
DeviceDance = deviceDanceDao{internal.NewDeviceDanceDao()}
|
||||
)
|
||||
|
||||
// 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"
|
||||
)
|
||||
|
||||
// deviceFriendDao is the data access object for the table device_friend.
|
||||
// You can define custom methods on it to extend its functionality as needed.
|
||||
type deviceFriendDao struct {
|
||||
*internal.DeviceFriendDao
|
||||
}
|
||||
|
||||
var (
|
||||
// DeviceFriend is a globally accessible object for table device_friend operations.
|
||||
DeviceFriend = deviceFriendDao{internal.NewDeviceFriendDao()}
|
||||
)
|
||||
|
||||
// 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"
|
||||
)
|
||||
|
||||
// devicePostDao is the data access object for the table device_post.
|
||||
// You can define custom methods on it to extend its functionality as needed.
|
||||
type devicePostDao struct {
|
||||
*internal.DevicePostDao
|
||||
}
|
||||
|
||||
var (
|
||||
// DevicePost is a globally accessible object for table device_post operations.
|
||||
DevicePost = devicePostDao{internal.NewDevicePostDao()}
|
||||
)
|
||||
|
||||
// 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"
|
||||
)
|
||||
|
||||
// devicePostCommentDao is the data access object for the table device_post_comment.
|
||||
// You can define custom methods on it to extend its functionality as needed.
|
||||
type devicePostCommentDao struct {
|
||||
*internal.DevicePostCommentDao
|
||||
}
|
||||
|
||||
var (
|
||||
// DevicePostComment is a globally accessible object for table device_post_comment operations.
|
||||
DevicePostComment = devicePostCommentDao{internal.NewDevicePostCommentDao()}
|
||||
)
|
||||
|
||||
// Add your custom methods and functionality below.
|
||||
@@ -0,0 +1,81 @@
|
||||
// ==========================================================================
|
||||
// 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"
|
||||
)
|
||||
|
||||
// DeviceDao is the data access object for the table device.
|
||||
type DeviceDao 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 DeviceColumns // columns contains all the column names of Table for convenient usage.
|
||||
handlers []gdb.ModelHandler // handlers for customized model modification.
|
||||
}
|
||||
|
||||
// DeviceColumns defines and stores column names for the table device.
|
||||
type DeviceColumns struct {
|
||||
Mac string //
|
||||
Name string //
|
||||
}
|
||||
|
||||
// deviceColumns holds the columns for the table device.
|
||||
var deviceColumns = DeviceColumns{
|
||||
Mac: "mac",
|
||||
Name: "name",
|
||||
}
|
||||
|
||||
// NewDeviceDao creates and returns a new DAO object for table data access.
|
||||
func NewDeviceDao(handlers ...gdb.ModelHandler) *DeviceDao {
|
||||
return &DeviceDao{
|
||||
group: "default",
|
||||
table: "device",
|
||||
columns: deviceColumns,
|
||||
handlers: handlers,
|
||||
}
|
||||
}
|
||||
|
||||
// DB retrieves and returns the underlying raw database management object of the current DAO.
|
||||
func (dao *DeviceDao) DB() gdb.DB {
|
||||
return g.DB(dao.group)
|
||||
}
|
||||
|
||||
// Table returns the table name of the current DAO.
|
||||
func (dao *DeviceDao) Table() string {
|
||||
return dao.table
|
||||
}
|
||||
|
||||
// Columns returns all column names of the current DAO.
|
||||
func (dao *DeviceDao) Columns() DeviceColumns {
|
||||
return dao.columns
|
||||
}
|
||||
|
||||
// Group returns the database configuration group name of the current DAO.
|
||||
func (dao *DeviceDao) 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 *DeviceDao) 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 *DeviceDao) 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,89 @@
|
||||
// ==========================================================================
|
||||
// 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"
|
||||
)
|
||||
|
||||
// DeviceDanceDao is the data access object for the table device_dance.
|
||||
type DeviceDanceDao 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 DeviceDanceColumns // columns contains all the column names of Table for convenient usage.
|
||||
handlers []gdb.ModelHandler // handlers for customized model modification.
|
||||
}
|
||||
|
||||
// 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 //
|
||||
}
|
||||
|
||||
// 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",
|
||||
}
|
||||
|
||||
// NewDeviceDanceDao creates and returns a new DAO object for table data access.
|
||||
func NewDeviceDanceDao(handlers ...gdb.ModelHandler) *DeviceDanceDao {
|
||||
return &DeviceDanceDao{
|
||||
group: "default",
|
||||
table: "device_dance",
|
||||
columns: deviceDanceColumns,
|
||||
handlers: handlers,
|
||||
}
|
||||
}
|
||||
|
||||
// DB retrieves and returns the underlying raw database management object of the current DAO.
|
||||
func (dao *DeviceDanceDao) DB() gdb.DB {
|
||||
return g.DB(dao.group)
|
||||
}
|
||||
|
||||
// Table returns the table name of the current DAO.
|
||||
func (dao *DeviceDanceDao) Table() string {
|
||||
return dao.table
|
||||
}
|
||||
|
||||
// Columns returns all column names of the current DAO.
|
||||
func (dao *DeviceDanceDao) Columns() DeviceDanceColumns {
|
||||
return dao.columns
|
||||
}
|
||||
|
||||
// Group returns the database configuration group name of the current DAO.
|
||||
func (dao *DeviceDanceDao) 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 *DeviceDanceDao) 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 *DeviceDanceDao) 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,81 @@
|
||||
// ==========================================================================
|
||||
// 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"
|
||||
)
|
||||
|
||||
// DeviceFriendDao is the data access object for the table device_friend.
|
||||
type DeviceFriendDao 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 DeviceFriendColumns // columns contains all the column names of Table for convenient usage.
|
||||
handlers []gdb.ModelHandler // handlers for customized model modification.
|
||||
}
|
||||
|
||||
// DeviceFriendColumns defines and stores column names for the table device_friend.
|
||||
type DeviceFriendColumns struct {
|
||||
MacA string //
|
||||
MacB string //
|
||||
}
|
||||
|
||||
// deviceFriendColumns holds the columns for the table device_friend.
|
||||
var deviceFriendColumns = DeviceFriendColumns{
|
||||
MacA: "mac_a",
|
||||
MacB: "mac_b",
|
||||
}
|
||||
|
||||
// NewDeviceFriendDao creates and returns a new DAO object for table data access.
|
||||
func NewDeviceFriendDao(handlers ...gdb.ModelHandler) *DeviceFriendDao {
|
||||
return &DeviceFriendDao{
|
||||
group: "default",
|
||||
table: "device_friend",
|
||||
columns: deviceFriendColumns,
|
||||
handlers: handlers,
|
||||
}
|
||||
}
|
||||
|
||||
// DB retrieves and returns the underlying raw database management object of the current DAO.
|
||||
func (dao *DeviceFriendDao) DB() gdb.DB {
|
||||
return g.DB(dao.group)
|
||||
}
|
||||
|
||||
// Table returns the table name of the current DAO.
|
||||
func (dao *DeviceFriendDao) Table() string {
|
||||
return dao.table
|
||||
}
|
||||
|
||||
// Columns returns all column names of the current DAO.
|
||||
func (dao *DeviceFriendDao) Columns() DeviceFriendColumns {
|
||||
return dao.columns
|
||||
}
|
||||
|
||||
// Group returns the database configuration group name of the current DAO.
|
||||
func (dao *DeviceFriendDao) 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 *DeviceFriendDao) 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 *DeviceFriendDao) 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,87 @@
|
||||
// ==========================================================================
|
||||
// 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"
|
||||
)
|
||||
|
||||
// DevicePostDao is the data access object for the table device_post.
|
||||
type DevicePostDao 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 DevicePostColumns // columns contains all the column names of Table for convenient usage.
|
||||
handlers []gdb.ModelHandler // handlers for customized model modification.
|
||||
}
|
||||
|
||||
// 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 // 发帖时间
|
||||
}
|
||||
|
||||
// devicePostColumns holds the columns for the table device_post.
|
||||
var devicePostColumns = DevicePostColumns{
|
||||
Id: "id",
|
||||
Mac: "mac",
|
||||
ContentText: "content_text",
|
||||
ContentImage: "content_image",
|
||||
CreatedAt: "created_at",
|
||||
}
|
||||
|
||||
// NewDevicePostDao creates and returns a new DAO object for table data access.
|
||||
func NewDevicePostDao(handlers ...gdb.ModelHandler) *DevicePostDao {
|
||||
return &DevicePostDao{
|
||||
group: "default",
|
||||
table: "device_post",
|
||||
columns: devicePostColumns,
|
||||
handlers: handlers,
|
||||
}
|
||||
}
|
||||
|
||||
// DB retrieves and returns the underlying raw database management object of the current DAO.
|
||||
func (dao *DevicePostDao) DB() gdb.DB {
|
||||
return g.DB(dao.group)
|
||||
}
|
||||
|
||||
// Table returns the table name of the current DAO.
|
||||
func (dao *DevicePostDao) Table() string {
|
||||
return dao.table
|
||||
}
|
||||
|
||||
// Columns returns all column names of the current DAO.
|
||||
func (dao *DevicePostDao) Columns() DevicePostColumns {
|
||||
return dao.columns
|
||||
}
|
||||
|
||||
// Group returns the database configuration group name of the current DAO.
|
||||
func (dao *DevicePostDao) 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 *DevicePostDao) 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 *DevicePostDao) 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,87 @@
|
||||
// ==========================================================================
|
||||
// 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"
|
||||
)
|
||||
|
||||
// DevicePostCommentDao is the data access object for the table device_post_comment.
|
||||
type DevicePostCommentDao 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 DevicePostCommentColumns // columns contains all the column names of Table for convenient usage.
|
||||
handlers []gdb.ModelHandler // handlers for customized model modification.
|
||||
}
|
||||
|
||||
// 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 // 评论时间
|
||||
}
|
||||
|
||||
// devicePostCommentColumns holds the columns for the table device_post_comment.
|
||||
var devicePostCommentColumns = DevicePostCommentColumns{
|
||||
Id: "id",
|
||||
PostId: "post_id",
|
||||
Mac: "mac",
|
||||
Content: "content",
|
||||
CreatedAt: "created_at",
|
||||
}
|
||||
|
||||
// NewDevicePostCommentDao creates and returns a new DAO object for table data access.
|
||||
func NewDevicePostCommentDao(handlers ...gdb.ModelHandler) *DevicePostCommentDao {
|
||||
return &DevicePostCommentDao{
|
||||
group: "default",
|
||||
table: "device_post_comment",
|
||||
columns: devicePostCommentColumns,
|
||||
handlers: handlers,
|
||||
}
|
||||
}
|
||||
|
||||
// DB retrieves and returns the underlying raw database management object of the current DAO.
|
||||
func (dao *DevicePostCommentDao) DB() gdb.DB {
|
||||
return g.DB(dao.group)
|
||||
}
|
||||
|
||||
// Table returns the table name of the current DAO.
|
||||
func (dao *DevicePostCommentDao) Table() string {
|
||||
return dao.table
|
||||
}
|
||||
|
||||
// Columns returns all column names of the current DAO.
|
||||
func (dao *DevicePostCommentDao) Columns() DevicePostCommentColumns {
|
||||
return dao.columns
|
||||
}
|
||||
|
||||
// Group returns the database configuration group name of the current DAO.
|
||||
func (dao *DevicePostCommentDao) 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 *DevicePostCommentDao) 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 *DevicePostCommentDao) 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,81 @@
|
||||
// ==========================================================================
|
||||
// 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"
|
||||
)
|
||||
|
||||
// SqliteSequenceDao is the data access object for the table sqlite_sequence.
|
||||
type SqliteSequenceDao 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 SqliteSequenceColumns // columns contains all the column names of Table for convenient usage.
|
||||
handlers []gdb.ModelHandler // handlers for customized model modification.
|
||||
}
|
||||
|
||||
// SqliteSequenceColumns defines and stores column names for the table sqlite_sequence.
|
||||
type SqliteSequenceColumns struct {
|
||||
Name string //
|
||||
Seq string //
|
||||
}
|
||||
|
||||
// sqliteSequenceColumns holds the columns for the table sqlite_sequence.
|
||||
var sqliteSequenceColumns = SqliteSequenceColumns{
|
||||
Name: "name",
|
||||
Seq: "seq",
|
||||
}
|
||||
|
||||
// NewSqliteSequenceDao creates and returns a new DAO object for table data access.
|
||||
func NewSqliteSequenceDao(handlers ...gdb.ModelHandler) *SqliteSequenceDao {
|
||||
return &SqliteSequenceDao{
|
||||
group: "default",
|
||||
table: "sqlite_sequence",
|
||||
columns: sqliteSequenceColumns,
|
||||
handlers: handlers,
|
||||
}
|
||||
}
|
||||
|
||||
// DB retrieves and returns the underlying raw database management object of the current DAO.
|
||||
func (dao *SqliteSequenceDao) DB() gdb.DB {
|
||||
return g.DB(dao.group)
|
||||
}
|
||||
|
||||
// Table returns the table name of the current DAO.
|
||||
func (dao *SqliteSequenceDao) Table() string {
|
||||
return dao.table
|
||||
}
|
||||
|
||||
// Columns returns all column names of the current DAO.
|
||||
func (dao *SqliteSequenceDao) Columns() SqliteSequenceColumns {
|
||||
return dao.columns
|
||||
}
|
||||
|
||||
// Group returns the database configuration group name of the current DAO.
|
||||
func (dao *SqliteSequenceDao) 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 *SqliteSequenceDao) 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 *SqliteSequenceDao) 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"
|
||||
)
|
||||
|
||||
// sqliteSequenceDao is the data access object for the table sqlite_sequence.
|
||||
// You can define custom methods on it to extend its functionality as needed.
|
||||
type sqliteSequenceDao struct {
|
||||
*internal.SqliteSequenceDao
|
||||
}
|
||||
|
||||
var (
|
||||
// SqliteSequence is a globally accessible object for table sqlite_sequence operations.
|
||||
SqliteSequence = sqliteSequenceDao{internal.NewSqliteSequenceDao()}
|
||||
)
|
||||
|
||||
// Add your custom methods and functionality below.
|
||||
Reference in New Issue
Block a user