Skip to content

Latest commit

 

History

History
39 lines (29 loc) · 675 Bytes

README.md

File metadata and controls

39 lines (29 loc) · 675 Bytes

upstruct GoDoc

upstruct is an utility package to update a golang struct with another one

Install

go get github.com/hackirby/upstruct

Example

import "github.com/hackirby/upstruct"

type User struct {
    Username string
    Password string
}

type UserPatch struct {
    Username string
    Password string
}

var user = User{
    Username: "user",
    Password: "password",
}

var userPatch = UserPatch{
    Username: "newuser",
    Password: "newpassword",
}

func main() {
    upstruct.Update(&user, userPatch)
}