Skip to content

Commit

Permalink
新增:强制走索引支持
Browse files Browse the repository at this point in the history
  • Loading branch information
steden committed Jul 7, 2024
1 parent 4cb7a2a commit 4dd5026
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions tableSet.go
Original file line number Diff line number Diff line change
Expand Up @@ -273,13 +273,17 @@ func (receiver *TableSet[Table]) Omit(columns ...string) *TableSet[Table] {
}

// ForceIndex 强制使用索引
func (receiver *TableSet[Table]) ForceIndex(idxName string) {
receiver.forceIndexName = idxName
func (receiver *TableSet[Table]) ForceIndex(idxName string) *TableSet[Table] {
session := receiver.getOrCreateSession()
session.forceIndexName = idxName
return session
}

// UseIndex 推荐使用索引
func (receiver *TableSet[Table]) UseIndex(idxName string) {
receiver.useIndexName = idxName
func (receiver *TableSet[Table]) UseIndex(idxName string) *TableSet[Table] {
session := receiver.getOrCreateSession()
session.useIndexName = idxName
return session
}

// Where 条件
Expand Down

0 comments on commit 4dd5026

Please sign in to comment.