Skip to content

Commit

Permalink
Struct cp (#5)
Browse files Browse the repository at this point in the history
* update readme

* mv ti structcp
  • Loading branch information
qicz authored Jun 6, 2023
1 parent 8ff514f commit 96290f9
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions reflect/convert.go → structcp/align.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
* limitations under the License.
*/

package reflect
package structcp

import (
"reflect"
Expand All @@ -27,7 +27,7 @@ const (
AlignToTag = "alignTo"
)

func Convert(target any, source any) {
func Align(target any, source any) {
sourceValueOf := reflect.ValueOf(source)
targetValueOf := reflect.ValueOf(target).Elem()

Expand Down
4 changes: 2 additions & 2 deletions reflect/convert_test.go → structcp/align_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
* limitations under the License.
*/

package reflect
package structcp

import (
"reflect"
Expand Down Expand Up @@ -74,7 +74,7 @@ func Test(t *testing.T) {
for _, test := range tests {
t.Run(test.name, func(t *testing.T) {
logging.Logger.Infof("case name %s", test.name)
Convert(&test.target, test.source)
Align(&test.target, test.source)
if test.align {
sourceValueOf := reflect.ValueOf(test.source)
targetValueOf := reflect.ValueOf(&test.target).Elem()
Expand Down

0 comments on commit 96290f9

Please sign in to comment.