gconcat

package
v0.0.0-...-4d2b9a0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 19, 2021 License: MIT, MIT Imports: 2 Imported by: 0

README

gconcat.Build

Just a simple lib, to gconcat string in #Go lang

Use

Example Gconcat Build

package main

import (
	"github.com/jeffotoni/gconcat"
)

func main() {
	var ii []interface{}
	ii = append(ii, "jeffotoni")
	ii = append(ii, " ")
	ii = append(ii, "joao")
	ii = append(ii, " ")
	ii = append(ii, 2021)

	var i interface{}
	i  = "jeffotoni"

	println(gconcat.Build(ii))
	println(gconcat.Build(i))
	println(gconcat.Build("jeffotoni", "&", "joao", " ", 20, "/08/"))
	println(gconcat.Build([]string{"2017", " ", "2018", " ", "2020"}))
	println(gconcat.Build([]int{12, 0, 11, 0, 10, 11, 12, 23, 3}))
	println(gconcat.Build(10,9,10,20,30,40,"x", "&", "."))
	println(gconcat.Build("R$ ",23456.33, " R$ ",123.33, " R$ ",19.11))

}

Example on your project

package main

import (
	"log"
	"net/http"

	"github.com/jeffotoni/gconcat"
)

const PORT = ":8282"

func main() {
	mux := http.NewServeMux()
	mux.HandleFunc("/ping",
		func(w http.ResponseWriter, r *http.Request) {
			str := gconcat.Build(
                            []int{1, 2, 3, 4, 5}, " ", 
                            []string{"vamos testar nossa concat!!!"},
                    )
		w.Write([]byte(str))
		})
	    
	server := &http.Server{
		Addr:    PORT,
		Handler: mux,
	}
	println("Start Run: ", PORT)
	log.Fatal(server.ListenAndServe())
}

Install Using go mod in your project
$ go mod init <your-dir>
$ go run main.go
Another possibility would be
$ go get -u github.com/jeffotoni/gconcat
Test Benchmarking
$ go test -bench . -benchmem
goos: linux
goarch: amd64
BenchmarkConcatBuildFast-4       4322348               301 ns/op             150 B/op          5 allocs/op
BenchmarkBuildFast-4             2482591               468 ns/op             160 B/op          6 allocs/op
BenchmarkBuild-4                  469720              2503 ns/op            3238 B/op         27 allocs/op
BenchmarkMarshal-4                293193              4128 ns/op             768 B/op          1 allocs/op
BenchmarkConcatMais-4                  8         133299313 ns/op        1086400464 B/op    10041 allocs/op
PASS
ok      _/home/jeffotoni/gitprojetos/gconcat     6.899s

Creators

Jefferson Otoni, @jeffotoni, github.com/jeffotoni, linkedin.com/in/jeffotoni

João Vitor – @ancogamer, github.com/ancogamer, linkedin.com/in/joão-vitor-astori-saletti

Distributed under the MIT license. See LICENSE for more information.

Contributing

To contribuit is simples, just clone or fork the repository and send to us the pull request

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BoolToStringFast

func BoolToStringFast(a []bool) string

func Build

func Build(strs ...interface{}) string

Concat

func Float32TostringFast

func Float32TostringFast(a []float32) string

func Float64TostringFast

func Float64TostringFast(a []float64) string

func Int16ToStringFast

func Int16ToStringFast(a []int16) string

func Int32ToStringFast

func Int32ToStringFast(a []int32) string

func Int64ToStringFast

func Int64ToStringFast(a []int64) string

func Int8ToStringFast

func Int8ToStringFast(a []int8) string

func IntToStringFast

func IntToStringFast(a []int) string

func IntU16ToStringFast

func IntU16ToStringFast(a []uint16) string

func IntU32ToStringFast

func IntU32ToStringFast(a []uint32) string

func IntU64ToStringFast

func IntU64ToStringFast(a []uint64) string

func IntU8ToStringFast

func IntU8ToStringFast(a []uint8) string

func IntUToStringFast

func IntUToStringFast(a []uint) string

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL