Code Monkey home page Code Monkey logo

sqlike's Introduction

Who am I?

package main

import (
    "fmt"
)

var aboutMe = struct{
    Name                          string
    Overview                      string
    Email                         string
    LinkedIn                      string
    Medium                        string
    FavouriteProgrammingLanguages []string
    OpenSources                   []string
}{
    Name: "Lee Sian Loong",
    Overview: `A guy who are very passionate in Frontend Development, Architecture Design and Opensource.`,
    Email: "[email protected]",
    LinkedIn: "https://www.linkedin.com/in/sian-loong-7b4a3037",
    Medium: "https://medium.com/@sianloong90",
    FavouriteProgrammingLanguages: []string{"Go", "TypeScript", "Kotlin"},
    OpenSources: []string{
        "https://github.com/si3nloong/sqlike",
        "https://github.com/ReactiveX/RxGo",
        "https://github.com/si3nloong/webhook",
        "https://github.com/si3nloong/svelte-hook-form",
        "https://github.com/si3nloong/macos_tree_view",
        "https://github.com/wetix/responsive-ui",
    },
}

func main() {
    fmt.Println(aboutMe)
}

Technologies and Tools

Stats

Go         8 hrs 21 mins   ██████████████████████░░░   87.60 %
Smarty     53 mins         ██▒░░░░░░░░░░░░░░░░░░░░░░   09.27 %
YAML       13 mins         ▓░░░░░░░░░░░░░░░░░░░░░░░░   02.36 %
XML        4 mins          ▒░░░░░░░░░░░░░░░░░░░░░░░░   00.74 %
Other      0 secs          ░░░░░░░░░░░░░░░░░░░░░░░░░   00.03 %

sqlike's People

Contributors

dependabot-preview[bot] avatar dependabot[bot] avatar fossabot avatar oskang09 avatar si3nloong avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

sqlike's Issues

Refactor SQL encoder

Currently, the native driver.Valuer doesn't support statement like CURRENT_TIMESTAMP or UUID() on INSERT, UPDATE and DELETE.

The priority of encoding :

  1. reflect.TypeOf (actual data type)
  2. db.SqlValuer
  3. driver.Valuer
  4. reflect.Kind

But reflect.TypeOf will affected pointer data type.

Memory leak

Describe the bug

Database.QueryRow doesn't close, led to a memory leak.

Support OpenTelemetry

Describe the problem
OpenTracing has been deprecated and got replaced by OpenTelemetry.

Pagination API required rework

Screenshots

Screenshot 2021-07-09 at 8 56 13 PM

SQL Driver Detail (please complete the following information):
Version 1.x.x

Possible Changes

  1. when we pass cursor value to Cursor, maybe we should skip the cursor record
  2. We required to +1 to check next recordset is exists

`QueryStatement` quotes the SQL statement

Describe the bug
QueryStatement method quotes the raw SQL statement which causes the DB to unable to execute query since it is a string.

To Reproduce
Steps to reproduce the behavior:

  1. Code to reproduce:
package main

import (
	"context"
	"log"

	_ "github.com/go-sql-driver/mysql"
	"github.com/si3nloong/sqlike/sqlike"
	"github.com/si3nloong/sqlike/sqlike/options"
)

func main() {
	ctx := context.Background()

	client := sqlike.MustConnect(ctx, "mysql", options.Connect().
		SetUsername("root").
		SetPassword("password").
		SetHost("localhost").
		SetPort("3306"))

	db := client.Database("test")

	_, err := db.QueryStmt(ctx, `SELECT * FROM Product`)
	if err != nil {
		log.Println("err=> ", err)
		return
	}

}
  1. Error thrown:
2022/10/16 19:24:53 err=>  Error 1064: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '`SELECT * FROM Product`' at line 1

Expected behavior
QueryStmt should not quote the query params and should execute the SQL statement using query as it is.

Screenshots
image

Redesign `Paginate` API

The current Paginate API is quite frustrating, it's not user-friendly at all, especially when we use it for GraphQL, a lot of boilerplate codes. Suggesting converting it to iteration basic.

Proposed API :

result, err := db.Paginate(ctx, actions.Paginate())
if err != nil {
   panic(err)
}

result.StartCursor()
result.EndCursor()
result.ForEach(func(v T) {})
result.HasNext()
result.HasPrev()
result.Before(ctx, cursor)
result.After(ctx, cursor)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.