Skip to content

Commit

Permalink
优化mapper组件,1万条复杂对象记录降低100ms。
Browse files Browse the repository at this point in the history
  • Loading branch information
steden committed Aug 20, 2024
1 parent 9eabd70 commit e02830f
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions enumerable.go
Original file line number Diff line number Diff line change
Expand Up @@ -806,6 +806,23 @@ func (receiver Enumerable[T]) ToArray() []T {
return *receiver.source
}

// ToArrayAny 转成数组
func (receiver Enumerable[T]) ToArrayAny() []any {
if receiver.lock == nil {
return []any{}
}

receiver.lock.RLock()
defer receiver.lock.RUnlock()

var items []any
for _, item := range *receiver.source {
var itemAny any = item
items = append(items, itemAny)
}
return items
}

// ToPageList 数组分页
func (receiver Enumerable[T]) ToPageList(pageSize int, pageIndex int) PageList[T] {
if receiver.lock == nil {
Expand Down

0 comments on commit e02830f

Please sign in to comment.