dao

package
v2.3.0 Latest Latest
Warning

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

Go to latest
Published: Apr 21, 2026 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const (
	USER               = "user"
	ACCOUNT            = "account"
	RESELLER           = "reseller"
	RESELLER_ACCOUNT   = "reseller_account"
	APP                = "app"
	APP_KEY            = "app_key"
	PROVIDER           = "provider"
	MODEL              = "model"
	MODEL_AGENT        = "model_agent"
	KEY                = "key"
	GROUP              = "group"
	NOTICE             = "notice"
	NOTICE_TEMPLATE    = "notice_template"
	DEAL_RECORD        = "deal_record"
	TASK_VIDEO         = "task_video"
	TASK_FILE          = "task_file"
	TASK_BATCH         = "task_batch"
	LOG_TEXT           = "log_text"
	LOG_IMAGE          = "log_image"
	LOG_AUDIO          = "log_audio"
	LOG_VIDEO          = "log_video"
	LOG_FILE           = "log_file"
	LOG_BATCH          = "log_batch"
	LOG_MIDJOURNEY     = "log_midjourney"
	LOG_GENERAL        = "log_general"
	SITE_CONFIG        = "site_config"
	SYS_ADMIN          = "sys_admin"
	SYS_CONFIG         = "sys_config"
	STATISTICS_USER    = "statistics_user"
	STATISTICS_APP     = "statistics_app"
	STATISTICS_APP_KEY = "statistics_app_key"
)

Variables

View Source
var Account = NewAccountDao()
View Source
var App = NewAppDao()
View Source
var AppKey = NewAppKeyDao()
View Source
var DealRecord = NewDealRecordDao()
View Source
var Group = NewGroupDao()
View Source
var Key = NewKeyDao()
View Source
var LogAudio = NewLogAudioDao()
View Source
var LogBatch = NewLogBatchDao()
View Source
var LogFile = NewLogFileDao()
View Source
var LogGeneral = NewLogGeneralDao()
View Source
var LogImage = NewLogImageDao()
View Source
var LogMidjourney = NewLogMidjourneyDao()
View Source
var LogText = NewLogTextDao()
View Source
var LogVideo = NewLogVideoDao()
View Source
var Model = NewModelDao()
View Source
var ModelAgent = NewModelAgentDao()
View Source
var Notice = NewNoticeDao()
View Source
var NoticeTemplate = NewNoticeTemplateDao()
View Source
var Provider = NewProviderDao()
View Source
var Reseller = NewResellerDao()
View Source
var ResellerAccount = NewResellerAccountDao()
View Source
var SiteConfig = NewSiteConfigDao()
View Source
var StatisticsApp = NewStatisticsAppDao()
View Source
var StatisticsAppKey = NewStatisticsAppKeyDao()
View Source
var StatisticsUser = NewStatisticsUserDao()
View Source
var SysAdmin = NewSysAdminDao()
View Source
var SysConfig = NewSysConfigDao()
View Source
var TaskBatch = NewTaskBatchDao()
View Source
var TaskFile = NewTaskFileDao()
View Source
var TaskVideo = NewTaskVideoDao()
View Source
var User = NewUserDao()

Functions

func Aggregate

func Aggregate(ctx context.Context, database, collection string, pipeline []bson.M, result any) error

func AggregateByPage

func AggregateByPage(ctx context.Context, database, collection, countField string, paging *db.Paging, countPipeline, pipeline []bson.M, result any) error

Types

type AccountDao

type AccountDao struct {
	*MongoDB[entity.Account]
}

func NewAccountDao

func NewAccountDao(database ...string) *AccountDao

type AppDao

type AppDao struct {
	*MongoDB[entity.App]
}

func NewAppDao

func NewAppDao(database ...string) *AppDao

func (*AppDao) FindByAppId

func (d *AppDao) FindByAppId(ctx context.Context, appId int) (*entity.App, error)

根据appId查询应用

type AppKeyDao

type AppKeyDao struct {
	*MongoDB[entity.AppKey]
}

func NewAppKeyDao

func NewAppKeyDao(database ...string) *AppKeyDao

type DealRecordDao

type DealRecordDao struct {
	*MongoDB[entity.DealRecord]
}

func NewDealRecordDao

func NewDealRecordDao(database ...string) *DealRecordDao

type FindOptions

type FindOptions struct {
	SortFields    []string // 排序字段
	Index         string   // 查询索引
	IncludeFields []string // 包含字段
	ExcludeFields []string // 排除字段
}

type GroupDao

type GroupDao struct {
	*MongoDB[entity.Group]
}

func NewGroupDao

func NewGroupDao(database ...string) *GroupDao

type IMongoDB

type IMongoDB any

type KeyDao

type KeyDao struct {
	*MongoDB[entity.Key]
}

func NewKeyDao

func NewKeyDao(database ...string) *KeyDao

type LogAudioDao

type LogAudioDao struct {
	*MongoDB[entity.LogAudio]
}

func NewLogAudioDao

func NewLogAudioDao(database ...string) *LogAudioDao

type LogBatchDao

type LogBatchDao struct {
	*MongoDB[entity.LogBatch]
}

func NewLogBatchDao

func NewLogBatchDao(database ...string) *LogBatchDao

type LogFileDao

type LogFileDao struct {
	*MongoDB[entity.LogFile]
}

func NewLogFileDao

func NewLogFileDao(database ...string) *LogFileDao

type LogGeneralDao

type LogGeneralDao struct {
	*MongoDB[entity.LogGeneral]
}

func NewLogGeneralDao

func NewLogGeneralDao(database ...string) *LogGeneralDao

type LogImageDao

type LogImageDao struct {
	*MongoDB[entity.LogImage]
}

func NewLogImageDao

func NewLogImageDao(database ...string) *LogImageDao

type LogMidjourneyDao

type LogMidjourneyDao struct {
	*MongoDB[entity.LogMidjourney]
}

func NewLogMidjourneyDao

func NewLogMidjourneyDao(database ...string) *LogMidjourneyDao

type LogTextDao

type LogTextDao struct {
	*MongoDB[entity.LogText]
}

func NewLogTextDao

func NewLogTextDao(database ...string) *LogTextDao

type LogVideoDao

type LogVideoDao struct {
	*MongoDB[entity.LogVideo]
}

func NewLogVideoDao

func NewLogVideoDao(database ...string) *LogVideoDao

type ModelAgentDao

type ModelAgentDao struct {
	*MongoDB[entity.ModelAgent]
}

func NewModelAgentDao

func NewModelAgentDao(database ...string) *ModelAgentDao

type ModelDao

type ModelDao struct {
	*MongoDB[entity.Model]
}

func NewModelDao

func NewModelDao(database ...string) *ModelDao

type MongoDB

type MongoDB[T IMongoDB] struct {
	*db.MongoDB
}

func NewMongoDB

func NewMongoDB[T IMongoDB](database, collection string) *MongoDB[T]

func (*MongoDB[T]) Aggregate

func (m *MongoDB[T]) Aggregate(ctx context.Context, pipeline []bson.M, result any) error

func (*MongoDB[T]) AggregateByPage

func (m *MongoDB[T]) AggregateByPage(ctx context.Context, countField string, paging *db.Paging, countPipeline, pipeline []bson.M, result any) error

func (*MongoDB[T]) CountDocuments

func (m *MongoDB[T]) CountDocuments(ctx context.Context, filter map[string]any) (int64, error)

func (*MongoDB[T]) DeleteById

func (m *MongoDB[T]) DeleteById(ctx context.Context, id any) (int64, error)

func (*MongoDB[T]) DeleteMany

func (m *MongoDB[T]) DeleteMany(ctx context.Context, filter map[string]any) (int64, error)

func (*MongoDB[T]) DeleteOne

func (m *MongoDB[T]) DeleteOne(ctx context.Context, filter map[string]any) (int64, error)

func (*MongoDB[T]) EstimatedDocumentCount

func (m *MongoDB[T]) EstimatedDocumentCount(ctx context.Context) (int64, error)

func (*MongoDB[T]) Find

func (m *MongoDB[T]) Find(ctx context.Context, filter map[string]any, findOptions ...*FindOptions) ([]*T, error)

func (*MongoDB[T]) FindById

func (m *MongoDB[T]) FindById(ctx context.Context, id any, findOptions ...*FindOptions) (*T, error)

func (*MongoDB[T]) FindByIds

func (m *MongoDB[T]) FindByIds(ctx context.Context, ids any, findOptions ...*FindOptions) ([]*T, error)

func (*MongoDB[T]) FindByPage

func (m *MongoDB[T]) FindByPage(ctx context.Context, paging *db.Paging, filter map[string]any, findOptions ...*FindOptions) ([]*T, error)

func (*MongoDB[T]) FindOne

func (m *MongoDB[T]) FindOne(ctx context.Context, filter map[string]any, findOptions ...*FindOptions) (*T, error)

func (*MongoDB[T]) FindOneAndDelete

func (m *MongoDB[T]) FindOneAndDelete(ctx context.Context, filter map[string]any) (*T, error)

func (*MongoDB[T]) FindOneAndDeleteById

func (m *MongoDB[T]) FindOneAndDeleteById(ctx context.Context, id any) (*T, error)

func (*MongoDB[T]) FindOneAndUpdate

func (m *MongoDB[T]) FindOneAndUpdate(ctx context.Context, filter map[string]any, update any, isUpsert ...bool) (*T, error)

func (*MongoDB[T]) FindOneAndUpdateById

func (m *MongoDB[T]) FindOneAndUpdateById(ctx context.Context, id any, update any, isUpsert ...bool) (*T, error)

func (*MongoDB[T]) Insert

func (m *MongoDB[T]) Insert(ctx context.Context, document any) (string, error)

func (*MongoDB[T]) Inserts

func (m *MongoDB[T]) Inserts(ctx context.Context, documents []any) ([]string, error)

func (*MongoDB[T]) UpdateById

func (m *MongoDB[T]) UpdateById(ctx context.Context, id, update any, isUpsert ...bool) error

func (*MongoDB[T]) UpdateMany

func (m *MongoDB[T]) UpdateMany(ctx context.Context, filter map[string]any, update any, isUpsert ...bool) error

func (*MongoDB[T]) UpdateOne

func (m *MongoDB[T]) UpdateOne(ctx context.Context, filter map[string]any, update any, isUpsert ...bool) error

type NoticeDao

type NoticeDao struct {
	*MongoDB[entity.Notice]
}

func NewNoticeDao

func NewNoticeDao(database ...string) *NoticeDao

type NoticeTemplateDao

type NoticeTemplateDao struct {
	*MongoDB[entity.NoticeTemplate]
}

func NewNoticeTemplateDao

func NewNoticeTemplateDao(database ...string) *NoticeTemplateDao

type ProviderDao

type ProviderDao struct {
	*MongoDB[entity.Provider]
}

func NewProviderDao

func NewProviderDao(database ...string) *ProviderDao

type ResellerAccountDao

type ResellerAccountDao struct {
	*MongoDB[entity.ResellerAccount]
}

func NewResellerAccountDao

func NewResellerAccountDao(database ...string) *ResellerAccountDao

type ResellerDao

type ResellerDao struct {
	*MongoDB[entity.Reseller]
}

func NewResellerDao

func NewResellerDao(database ...string) *ResellerDao

func (*ResellerDao) ChangeAccountById

func (d *ResellerDao) ChangeAccountById(ctx context.Context, id, account string) error

func (*ResellerDao) ChangePasswordByUserId

func (d *ResellerDao) ChangePasswordByUserId(ctx context.Context, userId int, password string) error

func (*ResellerDao) CreateAccount

func (d *ResellerDao) CreateAccount(ctx context.Context, account *do.ResellerAccount) (string, error)

func (*ResellerDao) FindAccount

func (d *ResellerDao) FindAccount(ctx context.Context, account string) (*entity.ResellerAccount, error)

func (*ResellerDao) FindAccountByUserId

func (d *ResellerDao) FindAccountByUserId(ctx context.Context, userId int) (*entity.ResellerAccount, error)

func (*ResellerDao) FindAccountsByUserId

func (d *ResellerDao) FindAccountsByUserId(ctx context.Context, userId int) ([]*entity.ResellerAccount, error)

func (*ResellerDao) FindResellerByAccount

func (d *ResellerDao) FindResellerByAccount(ctx context.Context, account string) (*entity.Reseller, error)

根据账号查询代理商

func (*ResellerDao) FindResellerByUserId

func (d *ResellerDao) FindResellerByUserId(ctx context.Context, userId int) (*entity.Reseller, error)

根据userId查询代理商

func (*ResellerDao) FindResellerListByUserIds

func (d *ResellerDao) FindResellerListByUserIds(ctx context.Context, userIds []int) ([]*entity.Reseller, error)

根据userIds查询代理商列表

func (*ResellerDao) IsAccountExist

func (d *ResellerDao) IsAccountExist(ctx context.Context, account string) bool

判断账号是否存在

func (*ResellerDao) IsEmailExist

func (d *ResellerDao) IsEmailExist(ctx context.Context, email string) bool

判断邮箱是否存在

func (*ResellerDao) IsPhoneExist

func (d *ResellerDao) IsPhoneExist(ctx context.Context, phone string) bool

判断手机号是否存在

type SiteConfigDao

type SiteConfigDao struct {
	*MongoDB[entity.SiteConfig]
}

func NewSiteConfigDao

func NewSiteConfigDao(database ...string) *SiteConfigDao

type StatisticsAppDao

type StatisticsAppDao struct {
	*MongoDB[entity.StatisticsApp]
}

func NewStatisticsAppDao

func NewStatisticsAppDao(database ...string) *StatisticsAppDao

type StatisticsAppKeyDao

type StatisticsAppKeyDao struct {
	*MongoDB[entity.StatisticsAppKey]
}

func NewStatisticsAppKeyDao

func NewStatisticsAppKeyDao(database ...string) *StatisticsAppKeyDao

type StatisticsUserDao

type StatisticsUserDao struct {
	*MongoDB[entity.StatisticsUser]
}

func NewStatisticsUserDao

func NewStatisticsUserDao(database ...string) *StatisticsUserDao

type SysAdminDao

type SysAdminDao struct {
	*MongoDB[entity.SysAdmin]
}

func NewSysAdminDao

func NewSysAdminDao(database ...string) *SysAdminDao

func (*SysAdminDao) ChangePassword

func (d *SysAdminDao) ChangePassword(ctx context.Context, uid string, password string) error

type SysConfigDao

type SysConfigDao struct {
	*MongoDB[entity.SysConfig]
}

func NewSysConfigDao

func NewSysConfigDao(database ...string) *SysConfigDao

type TaskBatchDao

type TaskBatchDao struct {
	*MongoDB[entity.TaskBatch]
}

func NewTaskBatchDao

func NewTaskBatchDao(database ...string) *TaskBatchDao

type TaskFileDao

type TaskFileDao struct {
	*MongoDB[entity.TaskFile]
}

func NewTaskFileDao

func NewTaskFileDao(database ...string) *TaskFileDao

type TaskVideoDao

type TaskVideoDao struct {
	*MongoDB[entity.TaskVideo]
}

func NewTaskVideoDao

func NewTaskVideoDao(database ...string) *TaskVideoDao

type UserDao

type UserDao struct {
	*MongoDB[entity.User]
}

func NewUserDao

func NewUserDao(database ...string) *UserDao

func (*UserDao) ChangeAccountById

func (d *UserDao) ChangeAccountById(ctx context.Context, id, account string) error

func (*UserDao) ChangePasswordByUserId

func (d *UserDao) ChangePasswordByUserId(ctx context.Context, userId int, password string) error

func (*UserDao) CreateAccount

func (d *UserDao) CreateAccount(ctx context.Context, account *do.Account) (string, error)

func (*UserDao) FindAccount

func (d *UserDao) FindAccount(ctx context.Context, account string) (*entity.Account, error)

func (*UserDao) FindAccountByUserId

func (d *UserDao) FindAccountByUserId(ctx context.Context, userId int) (*entity.Account, error)

func (*UserDao) FindAccountsByUserId

func (d *UserDao) FindAccountsByUserId(ctx context.Context, userId int) ([]*entity.Account, error)

func (*UserDao) FindUserByAccount

func (d *UserDao) FindUserByAccount(ctx context.Context, account string) (*entity.User, error)

根据账号查询用户

func (*UserDao) FindUserByUserId

func (d *UserDao) FindUserByUserId(ctx context.Context, userId int) (*entity.User, error)

根据userId查询用户

func (*UserDao) FindUserListByUserIds

func (d *UserDao) FindUserListByUserIds(ctx context.Context, userIds []int) ([]*entity.User, error)

根据userIds查询用户列表

func (*UserDao) IsAccountExist

func (d *UserDao) IsAccountExist(ctx context.Context, account string) bool

判断账号是否存在

func (*UserDao) IsEmailExist

func (d *UserDao) IsEmailExist(ctx context.Context, email string) bool

判断邮箱是否存在

func (*UserDao) IsPhoneExist

func (d *UserDao) IsPhoneExist(ctx context.Context, phone string) bool

判断手机号是否存在

Jump to

Keyboard shortcuts

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