Some Golang types based on builtin. Implements interfaces Value / Scan and MarshalJSON / UnmarshalJSON for simple working with database NULL-values and Base64 encoding / decoding.

gotypes

Some simple types based on builtin Golang types that implement interfaces for working with DB (Scan / Value) and JSON (Marshal / Unmarshal).

NullUint

Simplified sql.NullInt64 (but unsigned): not struct, based on builtin uint type.

ni := sql.NullInt64{Int64: 32, Valid: true}
// Corresponds to
nu := gotypes.NullUint(32)

ni := sql.NullInt64{Int64: 0, Valid: true}
// Corresponds to
nu := gotypes.NullUint(0)

ni := sql.NullInt64{Int64: 32, Valid: false}
// Corresponds to
nu := gotypes.NullUint(0)

NullString

Simplified sql.NullString: not struct, based on builtin string type.

ni := sql.NullString{String: "example", Valid: true}
// Corresponds to
nu := gotypes.NullString("example")

ni := sql.NullInt64{String: "", Valid: true}
// Corresponds to
nu := gotypes.NullString("")

ni := sql.NullInt64{String: "example", Valid: false}
// Corresponds to
nu := gotypes.NullString("")

Base64

Type for simply decoding / encoding Base64 in JSON-structs.

type Something struct {
    Base gotypes.Base64 `json:"base"`
}

something := Something{Base: gotypes.Base64("decode me please")}

jsonString, err := json.Marshal(something)
if err != nil {
    return err
}
// Base is Base64 encoded string.
fmt.Println(string(jsonString))
// Output:
// {"base":"ZGVjb2RlIG1lIHBsZWFzZQ=="}

var anything Something
if err := json.Unmarshal(jsonString, &anything); err != nil {
    panic(err)
}
// Base has value decoded from Base64 string.
fmt.Println(string(anything.Base))
// Output:
// decode me please
Similar Resources

Converts go types no matter what

elastic Converts go types no matter what elastic is a simple library that converts any type to another the best way possible. This is useful when the

Dec 9, 2022

Helper functions for the manipulation of slices of all types in Go

go-slices Unlike many other programming languages, Go doesn't provide helper functions for slices in it's core. I felt like this was quite an essentia

Jan 3, 2023

Simple, specialised, and efficient binary marshaling

๐Ÿ”Œ surge Documentation A library for fast binary (un)marshaling. Designed to be used in Byzantine networks, ๐Ÿ”Œ surge never explicitly panics, protects

Oct 4, 2022

A simple Slack message tool for the CLI written in Go

heka A simple Slack message tool for the CLI written in Go Report Bug ยท Request

Jan 16, 2022

Sqlyog-password-decoder - Simple decode passwords from .sycs file (SQLyog export connections file)

Decode password: ./sqlyog-password-decoder -str password -action decode Encode p

Nov 21, 2021

auto-generate capnproto schema from your golang source files. Depends on go-capnproto-1.0 at https://github.com/glycerine/go-capnproto

bambam: auto-generate capnproto schema from your golang source files. Adding capnproto serialization to an existing Go project used to mean writing a

Sep 27, 2022

Golang binary decoder for mapping data into the structure

binstruct Golang binary decoder to structure Install go get -u github.com/ghostiam/binstruct Examples ZIP decoder PNG decoder Use For struct From file

Dec 17, 2022

CBOR RFC 7049 (Go/Golang) - safe & fast with standard API + toarray & keyasint, CBOR tags, float64/32/16, fuzz tested.

CBOR RFC 7049 (Go/Golang) - safe & fast with standard API + toarray & keyasint, CBOR tags, float64/32/16, fuzz tested.

CBOR library in Go fxamacker/cbor is a CBOR encoder & decoder in Go. It has a standard API, CBOR tags, options for duplicate map keys, float64โ†’32โ†’16,

Jan 6, 2023

Fixed width file parser (encoder/decoder) in GO (golang)

Fixed width file parser (encoder/decoder) for GO (golang) This library is using to parse fixed-width table data like: Name Address

Sep 27, 2022
GED - Global-purpose Encoding / Decoding library

GED - Global-purpose Encoding / Decoding library This library lets you use common encoding/decoding schemes and allows you to define custom ones. Use

Nov 28, 2021
Go library for decoding generic map values into native Go structures and vice versa.

mapstructure mapstructure is a Go library for decoding generic map values to structures and vice versa, while providing helpful error handling. This l

Jan 1, 2023
Generate TypeScript interfaces from Go structs/interfaces - useful for JSON RPC

bel Generate TypeScript interfaces from Go structs/interfaces - useful for JSON RPC bel is used in production in https://gitpod.io. Getting started be

Oct 23, 2022
An optimal, byte-aligned, LZ+RLE hybrid encoder, designed to maximize decoding speed on NMOS 6502 and derived CPUs
An optimal, byte-aligned, LZ+RLE hybrid encoder, designed to maximize decoding speed on NMOS 6502 and derived CPUs

TSCrunch TSCrunch is an optimal, byte-aligned, LZ+RLE hybrid encoder, designed to maximize decoding speed on NMOS 6502 and derived CPUs, while keeping

Dec 21, 2022
Asn.1 BER and DER encoding library for golang.

WARNING This repo has been archived! NO further developement will be made in the foreseen future. asn1 -- import "github.com/PromonLogicalis/asn1" Pac

Nov 14, 2022
Fast implementation of base58 encoding on golang.

Fast Implementation of Base58 encoding Fast implementation of base58 encoding in Go. Base algorithm is adapted from https://github.com/trezor/trezor-c

Dec 9, 2022
msgpack.org[Go] MessagePack encoding for Golang

MessagePack encoding for Golang โค๏ธ Uptrace.dev - All-in-one tool to optimize performance and monitor errors & logs Join Discord to ask questions. Docu

Dec 28, 2022
csvutil provides fast and idiomatic mapping between CSV and Go (golang) values.
csvutil provides fast and idiomatic mapping between CSV and Go (golang) values.

csvutil Package csvutil provides fast and idiomatic mapping between CSV and Go (golang) values. This package does not provide a CSV parser itself, it

Jan 6, 2023
A high-performance 100% compatible drop-in replacement of "encoding/json"
A high-performance 100% compatible drop-in replacement of

A high-performance 100% compatible drop-in replacement of "encoding/json" You can also use thrift like JSON using thrift-iterator Benchmark Source cod

Jan 7, 2023
Encode and decode Go (golang) struct types via protocol buffers.

protostructure protostructure is a Go library for encoding and decoding a struct type over the wire. This library is useful when you want to send arbi

Nov 15, 2022