A lightweight casting package for Go projects

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.11 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:

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

License

GoLobby Cast is released under the MIT License.

Owner
GoLobby
GoLobby publishes open source packages with simplicity and fluent APIs in mind for GoLang
GoLobby
Similar Resources

Package ethtool allows control of the Linux ethtool generic netlink interface.

ethtool Package ethtool allows control of the Linux ethtool generic netlink interface.

Dec 14, 2022

Extremely flexible golang deep comparison, extends the go testing package, tests HTTP APIs and provides tests suite

Extremely flexible golang deep comparison, extends the go testing package, tests HTTP APIs and provides tests suite

go-testdeep Extremely flexible golang deep comparison, extends the go testing package. Latest news Synopsis Description Installation Functions Availab

Jan 5, 2023

A well tested and comprehensive Golang statistics library package with no dependencies.

Stats - Golang Statistics Package A well tested and comprehensive Golang statistics library / package / module with no dependencies. If you have any s

Dec 30, 2022

A computational topology package for gophers.

A computational topology package for gophers.

Simplices; simplicial complexes; simplicial chains; chain, cycle, boundary and homology groups; sets of simplices; methods for computing boundaries, Euler characteristics, Euler integrals, and Betti numbers, and more (with even more to come)!

Apr 19, 2021

Go package implementing Bloom filters

Go package implementing Bloom filters

Dec 30, 2022

go-i18n is a Go package and a command that helps you translate Go programs into multiple languages.

go-i18n is a Go package and a command that helps you translate Go programs into multiple languages.

Jan 2, 2023

Go package to generate and manage color palettes & schemes 🎨

Go package to generate and manage color palettes & schemes 🎨

Go package to generate and manage color palettes & schemes

Dec 29, 2022

Goridge is high performance PHP-to-Golang codec library which works over native PHP sockets and Golang net/rpc package.

Goridge is high performance PHP-to-Golang codec library which works over native PHP sockets and Golang net/rpc package.

Goridge is high performance PHP-to-Golang codec library which works over native PHP sockets and Golang net/rpc package. The library allows you to call Go service methods from PHP with a minimal footprint, structures and []byte support.

Dec 28, 2022

Gene parsing package for Axie Infinity

agp Package agp is a gene parsing package for Axie Infinity. The name agp stands for "Axie Gene Parser" which decodes the hex representation of an Axi

Apr 18, 2022
Comments
  • Add consts for supported types

    Add consts for supported types

    Add constants for supported types something like

    const Uint8 = "uint8"
    
    // in user code
    val, err := cast.FromString("666", cast.Uint8)
    

    this will help our users to avoid typos and also increases the discoverability of our library features and supported types since we can rely on auto-complete features from editors and IDEs.

code that I re-use among many Go projects

A bunch of Go packages that I use in multiple projects. An overview of packages: u : utility functions that I use all the time. Very short package nam

Dec 30, 2022
A package for running subprocesses in Go, similar to Python's subprocesses package.

A package for running subprocesses in Go, similar to Python's subprocesses package.

Jul 28, 2022
Utility to restrict which package is allowed to import another package.

go-import-rules Utility to restrict which package is allowed to import another package. This tool will read import-rules.yaml or import-rules.yml in t

Jan 7, 2022
Lightweight, Simple, Quick, Thread-Safe Golang Stack Implementation

stack Lightweight, Simple, Quick, Thread-Safe Golang Stack Implementation Purpose Provide a fast, thread safe, and generic Golang Stack API with minim

May 3, 2022
[Go] Lightweight eventbus with async compatibility for Go

[Go] Lightweight eventbus with async compatibility for Go

Jan 3, 2023
Fast, lightweight and NOT reliable tool for downloading tons of images.

image-download-tool Fast, lightweight and NOT reliable tool for downloading tons of images. How to use Run .exe with --help flag Create json file with

May 12, 2022
🎓 A lightweight, rich and beautiful Go wrapper for JSPaste.

GOPaste GOPaste is a lightweight, rich and beautiful wrapper for JSPaste. JSPaste allows you to upload, get and delete texts rapidly. It's also the li

Nov 15, 2021
Golang source code parsing, usage like reflect package

gotype Golang source code parsing, usage like reflect package English įŽ€äŊ“中文 Usage API Documentation Examples License Pouch is licensed under the MIT Li

Dec 9, 2022
A Go preprocessor for package scoped reflection

pkgreflect - A Go preprocessor for package scoped reflection Problem: Go reflection does not support enumerating types, variables and functions of pac

Dec 13, 2022
reactssr is a package for rendering React applications.

reactssr A Go package to perform Server Side Rendering of React apps. Example usage Given a bundle produced from an additional entrypoint to your appl

Jan 9, 2023