Git Product home page Git Product logo

goquent's People

Contributors

lucasres avatar virtual4087 avatar

Watchers

 avatar

Forkers

virtual4087

goquent's Issues

Add delete clause

We want a delete clause

method should be given the name of the table to be deleted

sintaxe of code will like this:

q, args, _ := goquent.New(goquent.MYSQL).Delete("table").Where(&goquent.C{"id", "=", 1}).Build()

// DELETE FROM users WHERE id = ?

Create a From Instruction

Description

this object of lib is create a query builder sql with sintax most near of sql real sintax. Now we have a select instruction and need a from instruction for that we make a select base command

select * from table

Can create a signature for From method

From(t string) {
    ...
}

Add ` in columns

We have a some reserved words in sql that probabily have same name of columns in real database. Like for example key.

So we need add ` in name of column when ToSQL() was called.

We need something like `key` and not key

We need a insert method

The lib should be can handle with insert instruction

The insert method shoul be like:

func Insert() *QueryBuilder

func Into(t string, c ...string) &QueryBuilder

func Values(values ...V)

goquent.New().Insert().Into("table", "col1", "col2", "col3").Values(&goquent.V{"a","b", "c"}, &goquent.V{"a","b", "c"})

We need a create parameter suport

Description

Is very comum that devs handle create conditional logic with more that one value like this (... AND ... AND ...). So we need a similar function in lib

Method signature

We have a goquent.P{} that is a slice of goquent.C{} and that conditional is grouped with (... AND ...)

example in code:

Where(
  goquent.P{
    goquent.C{"status", "=", "actived", "OR"}, 
    goquent.C{"name", "LIKE", "%actived%"},
  },
  goquent.C{"email", "LIKE", "%@email.com%"},
)

this need generate this sql

WHERE (status = ? OR name LIKE ?) AND email = ?

dont forgive of args

Make a group by clasure

Description

We need a group by and like a sql

can method signature like this:

GroupBy(cols ...string)

Method can recived columns

Add update clasure

Description

The method of update should be like:

Update(table string)
Set(sets ...*goquent.S)

Set method will should create a SET clause and recevi a S struct, this struct should like C. The first args is a column name and the second args is a value to set

Make a doc for project

description

Not matter the that you make if dont have a good documentation nobody will use it. SO we want a documentation for use this lib

Make a Where clausure

Description

We need a where clause for where sql.

The method signature can be like this:

Where(col string, op OperationType, val interface{})

The OperationType is a like enum with And, Or, In, Between

Add dialect configure

Depending on the SGBD we have a different way of building SQL, it's very important that lib can handle different SGBD for now we can handle mysql and add more later

the dialect must be set in constructor method

q := goquent.New(goquent.MYSQL)

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.