Skip to content

safe and easy casting from one Struct to another in Go

License

Notifications You must be signed in to change notification settings

qwxingzhe/cast2

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

cast

GoDoc Build Status Go Report Card

Easy and safe casting from one struct to another in Go

Don’t Panic! ... Cast

What is Cast?

Cast is a library to convert between different go types in a consistent and easy way.

Cast provides simple functions to easily convert a struct to a another, an struct into a map, etc. Cast does this intelligently when an obvious conversion is possible. It doesn’t make any attempts to guess what you meant, for example you can only convert a string to an int when it is a string representation of an int such as “8”. Cast2 is used to supplement Cast's deficiency in aaa conversion

Why use Cast?

Usage

Example ‘ToMap’:

Example ‘ToMapByTag’:

About

safe and easy casting from one Struct to another in Go

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages