upstruct

package module
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Sep 20, 2023 License: GPL-3.0 Imports: 2 Imported by: 0

README

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)
}

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Update

func Update(target any, update any) error

Types

This section is empty.

Jump to

Keyboard shortcuts

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