Compare commits

...

2 Commits

Author SHA1 Message Date
09f4cfc59a Migration: From github.com to git.webz.asia 2022-08-25 14:14:07 +02:00
dea7cb49b0 Fixing convert uuid.UUID => uuid.UUID 2020-02-19 21:24:48 +01:00
8 changed files with 15 additions and 11 deletions
README.md
examples
example-1
example-2
example-3
example-4
fields.gofields_test.gogo.mod

View File

@ -1,5 +1,5 @@
[![Go Report Card](https://goreportcard.com/badge/github.com/go-convert/fields)](https://goreportcard.com/report/github.com/go-convert/fields)
[![Actions Status](https://github.com/go-convert/fields/workflows/Go/badge.svg)](https://github.com/go-convert/fields/actions)
[![Go Report Card](https://goreportcard.com/badge/git.webz.asia/go-convert/fields)](https://goreportcard.com/report/git.webz.asia/go-convert/fields)
[![Actions Status](https://git.webz.asia/go-convert/fields/workflows/Go/badge.svg)](https://git.webz.asia/go-convert/fields/actions)
[![Build Status](https://travis-ci.org/go-convert/fields.svg?branch=master)](https://travis-ci.org/go-convert/fields)
[![codecov](https://codecov.io/gh/go-convert/fields/branch/master/graph/badge.svg)](https://codecov.io/gh/go-convert/fields)
@ -15,7 +15,7 @@ import (
"log"
"encoding/json"
"github.com/go-convert/fields"
"git.webz.asia/go-convert/fields"
)
type FromStruct struct {
@ -80,7 +80,7 @@ import (
"log"
"encoding/json"
"github.com/go-convert/fields"
"git.webz.asia/go-convert/fields"
)
type FromStructCustom struct {

View File

@ -25,7 +25,7 @@ import (
"encoding/json"
"log"
"github.com/go-convert/fields"
"git.webz.asia/go-convert/fields"
)
type fromStruct struct {

View File

@ -25,7 +25,7 @@ import (
"encoding/json"
"log"
"github.com/go-convert/fields"
"git.webz.asia/go-convert/fields"
)
type fromStructCustom struct {

View File

@ -25,7 +25,7 @@ import (
"encoding/json"
"log"
"github.com/go-convert/fields"
"git.webz.asia/go-convert/fields"
)
type FromStructBase struct {

View File

@ -25,7 +25,7 @@ import (
"encoding/json"
"log"
"github.com/go-convert/fields"
"git.webz.asia/go-convert/fields"
"github.com/satori/go.uuid"
)

View File

@ -84,7 +84,11 @@ func Сonvert(from interface{}, kind string, to interface{}) {
switch f.Type.String() {
case "uuid.UUID":
mv := fv.Interface().(uuid.UUID)
ft.SetString(mv.String())
if ft.Type().String() == "uuid.UUID" {
ft.Set(fv)
} else {
ft.SetString(mv.String())
}
default:
ft.Set(fv)
}

View File

@ -27,7 +27,7 @@ import (
"github.com/satori/go.uuid"
"github.com/stretchr/testify/assert"
"github.com/go-convert/fields"
"git.webz.asia/go-convert/fields"
)
type FromStruct struct {

2
go.mod
View File

@ -1,4 +1,4 @@
module github.com/go-convert/fields
module git.webz.asia/go-convert/fields
go 1.13