feat usn 类型改成int64
This commit is contained in:
@@ -17,29 +17,35 @@ import (
|
||||
|
||||
func Use(db *gorm.DB, opts ...gen.DOOption) *Query {
|
||||
return &Query{
|
||||
db: db,
|
||||
Category: newCategory(db, opts...),
|
||||
Question: newQuestion(db, opts...),
|
||||
Record: newRecord(db, opts...),
|
||||
db: db,
|
||||
Category: newCategory(db, opts...),
|
||||
PointCard: newPointCard(db, opts...),
|
||||
PointRecord: newPointRecord(db, opts...),
|
||||
Question: newQuestion(db, opts...),
|
||||
Record: newRecord(db, opts...),
|
||||
}
|
||||
}
|
||||
|
||||
type Query struct {
|
||||
db *gorm.DB
|
||||
|
||||
Category category
|
||||
Question question
|
||||
Record record
|
||||
Category category
|
||||
PointCard pointCard
|
||||
PointRecord pointRecord
|
||||
Question question
|
||||
Record record
|
||||
}
|
||||
|
||||
func (q *Query) Available() bool { return q.db != nil }
|
||||
|
||||
func (q *Query) clone(db *gorm.DB) *Query {
|
||||
return &Query{
|
||||
db: db,
|
||||
Category: q.Category.clone(db),
|
||||
Question: q.Question.clone(db),
|
||||
Record: q.Record.clone(db),
|
||||
db: db,
|
||||
Category: q.Category.clone(db),
|
||||
PointCard: q.PointCard.clone(db),
|
||||
PointRecord: q.PointRecord.clone(db),
|
||||
Question: q.Question.clone(db),
|
||||
Record: q.Record.clone(db),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -53,24 +59,30 @@ func (q *Query) WriteDB() *Query {
|
||||
|
||||
func (q *Query) ReplaceDB(db *gorm.DB) *Query {
|
||||
return &Query{
|
||||
db: db,
|
||||
Category: q.Category.replaceDB(db),
|
||||
Question: q.Question.replaceDB(db),
|
||||
Record: q.Record.replaceDB(db),
|
||||
db: db,
|
||||
Category: q.Category.replaceDB(db),
|
||||
PointCard: q.PointCard.replaceDB(db),
|
||||
PointRecord: q.PointRecord.replaceDB(db),
|
||||
Question: q.Question.replaceDB(db),
|
||||
Record: q.Record.replaceDB(db),
|
||||
}
|
||||
}
|
||||
|
||||
type queryCtx struct {
|
||||
Category *categoryDo
|
||||
Question *questionDo
|
||||
Record *recordDo
|
||||
Category *categoryDo
|
||||
PointCard *pointCardDo
|
||||
PointRecord *pointRecordDo
|
||||
Question *questionDo
|
||||
Record *recordDo
|
||||
}
|
||||
|
||||
func (q *Query) WithContext(ctx context.Context) *queryCtx {
|
||||
return &queryCtx{
|
||||
Category: q.Category.WithContext(ctx),
|
||||
Question: q.Question.WithContext(ctx),
|
||||
Record: q.Record.WithContext(ctx),
|
||||
Category: q.Category.WithContext(ctx),
|
||||
PointCard: q.PointCard.WithContext(ctx),
|
||||
PointRecord: q.PointRecord.WithContext(ctx),
|
||||
Question: q.Question.WithContext(ctx),
|
||||
Record: q.Record.WithContext(ctx),
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user