efaceconv - Code generation tool for high performance conversion from interface{} to immutable type without allocations.

TravisCI GoReportCard GoDoc Coverage Status

efaceconv

High performance conversion from interface{} to immutable types without additional allocations

This is tool for go generate and common lib (ecutils)

Usage:

//go:generate efaceconv
//ec::string:String
//ec:net/http:http.ResponseWriter:ResponseWritter

//ec:<import package name>:<type>:<custom name>

generated function:

func Eface2CustomName(arg interface{}) (*type, bool)

View ./example dir

=== RUN   TestEface2SByte
--- PASS: TestEface2SByte (0.00s)
=== RUN   TestEface2String
--- PASS: TestEface2String (0.00s)
=== RUN   TestEface2SInt
--- PASS: TestEface2SInt (0.00s)
BenchmarkEface2SByte-4          100000000               11.8 ns/op             0 B/op          0 allocs/op
--- BENCH: BenchmarkEface2SByte-4
        efaceconv_generated_test.go:33: &[] true
        efaceconv_generated_test.go:33: &[] true
        efaceconv_generated_test.go:33: &[] true
        efaceconv_generated_test.go:33: &[] true
        efaceconv_generated_test.go:33: &[] true
BenchmarkSByteClassic-4         30000000                50.4 ns/op            32 B/op          1 allocs/op
--- BENCH: BenchmarkSByteClassic-4
        efaceconv_generated_test.go:48: [] true
        efaceconv_generated_test.go:48: [] true
        efaceconv_generated_test.go:48: [] true
        efaceconv_generated_test.go:48: [] true
        efaceconv_generated_test.go:48: [] true
BenchmarkEface2String-4         100000000               11.1 ns/op             0 B/op          0 allocs/op
--- BENCH: BenchmarkEface2String-4
        efaceconv_generated_test.go:76: 0xc42003fee8 true
        efaceconv_generated_test.go:76: 0xc420043ea8 true
        efaceconv_generated_test.go:76: 0xc420043ea8 true
        efaceconv_generated_test.go:76: 0xc420043ea8 true
        efaceconv_generated_test.go:76: 0xc420043ea8 true
BenchmarkStringClassic-4        30000000                45.3 ns/op            16 B/op          1 allocs/op
--- BENCH: BenchmarkStringClassic-4
        efaceconv_generated_test.go:91:  true
        efaceconv_generated_test.go:91:  true
        efaceconv_generated_test.go:91:  true
        efaceconv_generated_test.go:91:  true
        efaceconv_generated_test.go:91:  true
BenchmarkEface2SInt-4           100000000               11.6 ns/op             0 B/op          0 allocs/op
--- BENCH: BenchmarkEface2SInt-4
        efaceconv_generated_test.go:119: &[] true
        efaceconv_generated_test.go:119: &[] true
        efaceconv_generated_test.go:119: &[] true
        efaceconv_generated_test.go:119: &[] true
        efaceconv_generated_test.go:119: &[] true
BenchmarkSIntClassic-4          30000000                50.5 ns/op            32 B/op          1 allocs/op
--- BENCH: BenchmarkSIntClassic-4
        efaceconv_generated_test.go:134: [] true
        efaceconv_generated_test.go:134: [] true
        efaceconv_generated_test.go:134: [] true
        efaceconv_generated_test.go:134: [] true
        efaceconv_generated_test.go:134: [] true
PASS
ok      github.com/t0pep0/efaceconv/example     8.050s
Similar Resources

Go library to interface with NEAR nodes' JSON-RPC interface

StreamingFast Solana library for Go Go library to interface with NEAR nodes' JSON-RPC interface Contributing Issues and PR in this repo related strict

Nov 9, 2021

Hotswap provides a solution for reloading your go code without restarting your server, interrupting or blocking any ongoing procedure.

Hotswap provides a solution for reloading your go code without restarting your server, interrupting or blocking any ongoing procedure.

Hotswap provides a solution for reloading your go code without restarting your server, interrupting or blocking any ongoing procedure. Hotswap is built upon the plugin mechanism.

Jan 5, 2023

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

A data parser lib for Go with pythonic grammar sugar and as concern as possible for high performance

mapinterface - A data parser lib for Go with pythonic grammar sugar and as concern as possible for high performance mapinterface 旨在消灭对map/list解析而产生的层层

Nov 10, 2021

Singlestore event analytics - Evaluation of sortable ID generation schemes

Singlestore event analytics - Evaluation of sortable ID generation schemes

Jan 25, 2022

Go library for HTTP content type negotiation

Content-Type support library for Go This library can be used to parse the value Content-Type header (if one is present) and select an acceptable media

Jul 10, 2022

safe and easy casting from one type to another in Go

cast Easy and safe casting from one type to another in Go Don’t Panic! ... Cast What is Cast? Cast is a library to convert between different go types

Jan 1, 2023

Quickly query a Terraform provider's data type.

Terraform Query Quickly query a Terraform provider's data type. Such as a GitHub repository: ➜ ~ tfq github_repository full_name hashicorp/terraform |

Oct 12, 2021

Optional type using Go 1.18 generics.

go.eth-p.dev/goptional Generic Optional (or Go Optional, if you prefer) goptional is a package that provides an implementation of an Optional[T] monad

Apr 2, 2022
Comments
  • GetKind/GetDataPtr panics if passed argument is a pointer

    GetKind/GetDataPtr panics if passed argument is a pointer

    I propose to add a check that if arg is a pointer then we just convert the pointer to unsafe.Pointer or we take the pointer to convert it otherwise. For now we just need to document it.

Related tags
A Geiger counter for allocations

A Geiger counter for allocations

Dec 12, 2022
Generic Free List implementation to reuse memory and avoid allocations

gofl GOFL provides a Generic Free List implementation for Go. Installation This

Oct 17, 2022
Utilities and immutable collections for functional programming in Golang

Utilities and immutable collections for functional programming in Golang. This is an experimental library to play with the new Generics Feature in Go 1.18.

Sep 1, 2022
Perforator is a tool for recording performance metrics over subregions of a program using the Linux "perf" interface.

Perforator Perforator is a tool for recording performance metrics over subregions of a program (e.g., functions) using the Linux "perf" interface.

Dec 15, 2022
🍕 Enjoy a slice! A utility library for dealing with slices and maps that focuses on type safety and performance.

?? github.com/elliotchance/pie Enjoy a slice! pie is a library of utility functions for common operations on slices and maps. Quick Start FAQ What are

Dec 30, 2022
Slice conversion between primitive types

sliceconv Sliceconv implements conversions to and from string representations of primitive types on entire slices. The package supports types int, flo

Sep 27, 2022
COCO (Color Converter) is a color conversion library for Go.

COCO (Color Converter) for Go COCO (Color Converter) is a color conversion library for Go. Heavily inspired by NPM's color-convert. It converts all wa

Oct 4, 2022
A color manipulation and conversion library for Go. 🌈 ✨

Khroma Khroma is a color manipulation and conversion library for Go. ✨ ?? Example package main import ( "log" "github.com/qbee-org/khroma" ) func

May 30, 2022
Code Generation for Functional Programming, Concurrency and Generics in Golang

goderive goderive derives mundane golang functions that you do not want to maintain and keeps them up to date. It does this by parsing your go code fo

Dec 25, 2022
Code generation tools for Go.

interfaces Code generation tools for Go's interfaces. Tools available in this repository: cmd/interfacer cmd/structer cmd/interfacer Generates an inte

Dec 23, 2022