Skip to content
/ cast Public

A lightweight casting package for Go projects

License

Notifications You must be signed in to change notification settings

golobby/cast

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

66 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

GoDoc CI CodeQL Go Report Card Coverage Status

Cast

GoLobby Cast is a lightweight casting package for Go projects.

Documentation

Required Go Versions

It requires Go v1.16 or newer versions.

Installation

To install this package, run the following command in your project directory.

go get github.com/golobby/cast

Usage Example

The following examples demonstrate how to use the GoLobby Cast package.

val, err := cast.FromString("666", "int32")
// `val` type: int32
// `val` value: 666
val, err := cast.FromString("1", cast.Bool)
// `val` type: bool
// `val` value: true

Supported Types

Currently, the GoLobby Cast supports the following types and related array types:

  • Int (Int8 .. Int64)
  • Uint (Uint8 .. Uint64)
  • Float32 and Float64
  • Bool
  • String

License

GoLobby Cast is released under the MIT License.