Description
This package is meant to make copying of structs to/from others structs a bit easier.
Nested structures, embedded types, pointers, sql null types are supported.
Package for fast copying structs of different types alternatives and similar packages
Based on the "Utilities" category.
Alternatively, view Package for fast copying structs of different types alternatives based on common mentions on social networks and blogs.
-
ngrok
Introspected tunnels to localhost. -
hub
wrap git commands with additional functionality to interact with github from the terminal. -
fzf
A command-line fuzzy finder written in Go -
go-torch
Stochastic flame graph profiler for Go programs. -
ctop
Top-like interface (e.g. htop) for container metrics. -
wuzz
Interactive cli tool for HTTP inspection. -
excelize
Golang library for reading and writing Microsoft Excel (XLSX) files. -
goreleaser
Deliver Go binaries as fast and easily as possible -
GJSON
Get a JSON value with one line of code. -
peco
Simplistic interactive filtering tool. -
usql
usql is a universal command-line interface for SQL databases. -
xlsx
Library to simplify reading the XML format used by recent version of Microsoft Excel in Go programs. -
godropbox
Common libraries for writing Go services/applications from Dropbox. -
resty
Simple HTTP and REST client for Go inspired by Ruby rest-client. -
godotenv
A Go port of Ruby's dotenv library (Loads environment variables from .env.) -
hystrix-go
Implements Hystrix patterns of programmer-defined fallbacks aka circuit breaker. -
gorequest
Simplified HTTP client with rich features for Go. -
goreporter
A Golang tool that does static analysis, unit testing, code review and generate code quality report. -
minify
Fast minifiers for HTML, CSS, JS, XML, JSON and SVG file formats. -
panicparse
Groups similar goroutines and colorizes stack dump. -
gojson
Automatically generate Go (golang) struct definitions from example JSON. -
go-funk
A modern Go utility library which provides helpers (map, find, contains, filter, chunk, reverse, ...) -
mc
Minio Client provides minimal tools to work with Amazon S3 compatible cloud storage and filesystems. -
grequests
An elegant and simple net/http wrapper that follows Python's requests library -
mergo
A helper to merge structs and maps in Golang. Useful for configuration default values, avoiding messy if-statements. -
mole
cli app to easily create ssh tunnels. -
filetype
Small package to infer the file type checking the magic numbers signature. -
sling
Go HTTP requests builder for API clients. -
spinner
Go package to easily provide a terminal spinner with options. -
boilr
A blazingly fast CLI tool for creating projects from boilerplate templates. -
coop
Cheat sheet for some of the common concurrent flows in Go. -
go-underscore
A useful collection of helpfully functional Go collection utilities. -
circuitbreaker
Circuit Breakers in Go -
beaver
Beaver is a real-time messaging server. With beaver you can easily build scalable in-app notifications, realtime graphs, multiplayer games, chat applications, geotracking and more in web applications and mobile apps. -
jump
Jump helps you navigate faster by learning your habits. -
JobRunner
Smart and featureful cron job scheduler with job queuing and live monitoring built in. -
gentleman
Full-featured plugin-driven HTTP client library. -
git-time-metric
Simple, seamless, lightweight time tracking for Git -
goreq
Minimal and simple request library for Go language. -
immortal
A *nix cross-platform (OS agnostic) supervisor -
csvtk
Another cross-platform, efficient, practical and pretty CSV/TSV toolkit -
pester
Go HTTP client calls with retries, backoff, and concurrency. -
godaemon
Utility to write daemons. -
htcat
Parallel and Pipelined HTTP GET Utility -
httpcontrol
Package httpcontrol allows for HTTP transport level control around timeouts and retries. -
mimetype
Detect mimetypes by looking at content
Get performance insights in less than 4 minutes
Do you think we are missing an alternative of Package for fast copying structs of different types or a related project?
Popular Comparisons
README
Package for fast copying structs of different types
This package is meant to make copying of structs to/from others structs a bit easier.
Nested structures, embedded types, pointers, sql null types are supported.
Installation
go get -u github.com/gotidy/copy
Example
type Person struct {
Name string
MiddleName *string
Surname string
}
type User struct {
Person
Email string
Age int8
Married bool
}
type Employee struct {
Name string
MiddleName string
Surname string
Email string
Age int
}
src := User{
Person: Person{
Name: "John",
MiddleName: nil,
Surname: "Smith",
},
Email: "[email protected]",
Age: 33,
Married: false,
}
dst := Employee{}
copiers := copy.New() // New("json")
copiers.Copy(&dst, &src)
// Or more fast use case is to create the type specific copier.
copier := copiers.Get(&Employee{}, &User{}) // Created once for a pair of types.
copier.Copy(&dst, &src)
Benchmark
Benchmarks source code can be found here
go test -bench=. -benchmem ./...
goos: darwin
goarch: amd64
pkg: github.com/gotidy/copy-bench
BenchmarkManualCopy-12 177310519 6.92 ns/op 0 B/op 0 allocs/op
BenchmarkCopiers-12 13476417 84.1 ns/op 0 B/op 0 allocs/op
BenchmarkCopier-12 40226689 27.5 ns/op 0 B/op 0 allocs/op
BenchmarkJinzhuCopier-12 407480 2711 ns/op 2480 B/op 34 allocs/op
BenchmarkDeepcopier-12 262836 4346 ns/op 4032 B/op 73 allocs/op
PASS
ok github.com/gotidy/copy-bench 6.922s
See the documentation for more information.
License
*Note that all licence references and agreements mentioned in the Package for fast copying structs of different types README section above
are relevant to that project's source code only.