Skip to content

Instantly share code, notes, and snippets.

View rodrwan's full-sized avatar
🇨🇱
cooking amazing code

Rod Fuenzalida rodrwan

🇨🇱
cooking amazing code
View GitHub Profile
@rodrwan
rodrwan / README.md
Last active December 26, 2020 21:32
Benchmark para funciones de concatenación

goos: darwin
goarch: amd64

Function-CPU threads # b.N used ns per loop memory allocated per loop # memory allocations per loop
BenchmarkConcatWithStrings-8 657294 1808 ns/op 400 B/op 15 allocs/op 
BenchmarkConcatWithBuffer-8 824786 1432 ns/op 320 B/op 12 allocs/op
@rodrwan
rodrwan / main.go
Created December 22, 2020 13:21
Función para concatenar un arreglo de ids usando bytes
package main
import (
"bytes"
"fmt"
)
func main() {
ids := []string{"id 1", "id 2", "id 3", "id 4", "id 5"}
fmt.Println(concatWithBuffer(ids))
@rodrwan
rodrwan / main.go
Last active December 26, 2020 21:25
Función para concatenar un arreglo de ids con strings
package main
import (
"fmt"
"strings"
)
func main() {
ids := []string{"id 1", "id 2", "id 3", "id 4", "id 5"}
// output: [{ id: id 1 },{ id: id 2 },{ id: id 3 },{ id: id 4 },{ id: id 5 }]

Keybase proof

I hereby claim:

  • I am rodrwan on github.
  • I am rodrwan (https://keybase.io/rodrwan) on keybase.
  • I have a public key ASCy32TZXV-XDV9Ip2LmDIZEhLA7RuOZjzmIp2IPZhVAJgo

To claim this, I am signing this object:

package service
import (
mediumexample "github.com/rodrwan/medium-example"
"github.com/rodrwan/medium-example/database"
)
// Users represents a User service that interact with database using Database.
type Users struct {
DBStore *database.Database
package graphql
import (
"context"
mediumexample "github.com/rodrwan/medium-example"
)
// Resolver represent a GraphQL resolver that need to implemente graphql interface.
type Resolver struct {
package postgres
import (
"database/sql"
"errors"
"github.com/Masterminds/squirrel"
"github.com/lib/pq"
mediumexample "github.com/rodrwan/medium-example"
)
package postgres
import (
"database/sql"
"errors"
"time"
"github.com/Masterminds/squirrel"
"github.com/lib/pq"
mediumexample "github.com/rodrwan/medium-example"
package main
import (
"encoding/json"
"flag"
"fmt"
"io"
"log"
"net/http"
"os"
package database
import (
"os"
"github.com/jmoiron/sqlx"
mediumexample "github.com/rodrwan/medium-example"
"github.com/rodrwan/medium-example/database/postgres"
)