mirror of
https://gitee.com/johng/gf.git
synced 2024-12-04 05:07:44 +08:00
29 lines
688 B
Go
29 lines
688 B
Go
// Copyright GoFrame Author(https://goframe.org). All Rights Reserved.
|
|
//
|
|
// This Source Code Form is subject to the terms of the MIT License.
|
|
// If a copy of the MIT was not distributed with this file,
|
|
// You can obtain one at https://github.com/gogf/gf.
|
|
|
|
package garray_test
|
|
|
|
import (
|
|
"fmt"
|
|
"github.com/gogf/gf/container/garray"
|
|
"github.com/gogf/gf/frame/g"
|
|
)
|
|
|
|
func ExampleStrArray_Walk() {
|
|
var array garray.StrArray
|
|
tables := g.SliceStr{"user", "user_detail"}
|
|
prefix := "gf_"
|
|
array.Append(tables...)
|
|
// Add prefix for given table names.
|
|
array.Walk(func(value string) string {
|
|
return prefix + value
|
|
})
|
|
fmt.Println(array.Slice())
|
|
|
|
// Output:
|
|
// [gf_user gf_user_detail]
|
|
}
|