datacopy

package
v0.0.0-...-d73a121 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 6, 2021 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Copy

func Copy(data1, data2 interface{}) error

Copy copies data from one variable type to another.

for example we might want to copy data from a

map[string]interface{}{
	"username": "wisdommatt",
	"phone": "080838484855",
} type

to a

struct{
	Username string `json:"username"`
	Phone string `json:"phone"`
	Password string `json:"password"`
}{}

it the case above it copies only the username and phone data from the map[string]interface{} type without touching the password.

Note: this function encodes data1 to json and decode the json value of data1 into data2.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL