Skip to content

Commit

Permalink
Merge pull request #21 from devfeel/develop
Browse files Browse the repository at this point in the history
Refactored the static version implementation
  • Loading branch information
devfeel authored Apr 16, 2022
2 parents 28d634f + be29e9c commit 4a27752
Show file tree
Hide file tree
Showing 9 changed files with 109 additions and 523 deletions.
4 changes: 2 additions & 2 deletions constant.go
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
package mapper

const (
packageVersion = "0.7.6"
packageVersion = "0.7.8"
mapperTagKey = "mapper"
jsonTagKey = "json"
IgnoreTagValue = "-"
nameConnector = "_"
formatTime = "15:04:05"
formatDate = "2006-01-02"
formatDateTime = "2006-01-02 15:04:05"
)
)
2 changes: 1 addition & 1 deletion convert.go
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ func ToInt64(value interface{}) (d int64) {

type argInt []int

// get int by index from int slice
// Get int by index from int slice
func (a argInt) Get(i int, args ...int) (r int) {
if i >= 0 && i < len(a) {
r = a[i]
Expand Down
20 changes: 11 additions & 9 deletions example/typewrapper/main.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package main

import (
"fmt"
"github.com/devfeel/mapper"
"reflect"
"time"
)
Expand All @@ -26,7 +28,7 @@ type decimal struct {
}

type DecimalWrapper struct {
// mapper.BaseTypeWrapper
mapper.BaseTypeWrapper
}

func (w *DecimalWrapper) IsType(value reflect.Value) bool {
Expand All @@ -37,14 +39,14 @@ func (w *DecimalWrapper) IsType(value reflect.Value) bool {
}

func main() {
/*
mapper.UseWrapper(&DecimalWrapper{})
user := &User{Name: "test", Age: 10, Score: decimal{value: 1}, Time: time.Now()}
stu := &Student{}

mapper.AutoMapper(user, stu)
mapper.UseWrapper(&DecimalWrapper{})
user := &User{Name: "test", Age: 10, Score: decimal{value: 1}, Time: time.Now()}
stu := &Student{}

mapper.AutoMapper(user, stu)

fmt.Println(user)
fmt.Println(stu)

fmt.Println(user)
fmt.Println(stu)
*/
}
Loading

0 comments on commit 4a27752

Please sign in to comment.