replace

package module
v1.0.3 Latest Latest
Warning

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

Go to latest
Published: Nov 21, 2021 License: MIT Imports: 1 Imported by: 4

README

vincentinttsh/replace

Build Status codecov Go Report Card GoDoc

replace struct value by another struct

package main

import (
	"fmt"

	"github.com/vincentinttsh/replace"
)

func main() {
	var data1 struct {
		Name     string
		UserName string
		Email    string
		Password string
	}
	data1.Name = "user"
	data1.UserName = "user"
	data1.Email = "user"
	data1.Password = "password"
	var data2 struct {
		Name     *string
		UserName *string
		Email    *string
		Password *string
	}
	value := "newuser"
	data2.Name = &value
	fmt.Println(data1)
	replace.replace(&data1, &data2)
	fmt.Println(data1)
}

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Replace

func Replace(old, new interface{})

Replace replace struct value by another struct

Types

This section is empty.

Jump to

Keyboard shortcuts

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