Skip to content

Commit

Permalink
新增:Copy克隆方法
Browse files Browse the repository at this point in the history
  • Loading branch information
steden committed Apr 15, 2024
1 parent bb41da4 commit 7900ec1
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions list.go
Original file line number Diff line number Diff line change
Expand Up @@ -125,3 +125,9 @@ func (receiver *List[T]) UnmarshalJSON(b []byte) error {
func (receiver *List[T]) GormDataType() string {
return "json"
}

// Copy 克隆出新的集合
func (receiver *List[T]) Copy() List[T] {
arr := *receiver.source
return NewList(arr...)
}

0 comments on commit 7900ec1

Please sign in to comment.