Skip to content

sharekte/summer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

summer

This is the simply SQL assembler for SELECT,INSERT,UPDATE,DELETE.You can create them from some parameter given, in the meantime it can return parameter values also and save the step to call database funtion on Golang.There are some example as below.

1.Installation
Open terminal and type Golang command go get github.com/sharekte/summer to finish installation

2.Create single SELECT statement without WHERE clause

	package main
	import (
	"fmt"
	"github.com/sharekte/summer"
	)
	func main(){
	    pg :=summer.CreatePGInstance()
	    fmt.Println(pg.NewSelect().ByStandard("PGTable", nil, nil, nil, "Field1", "Field2", "Field3"))
	}

It will return SELECT Field1,Field2,Field3 FROM PGTable

3.Create SELECT statement with WHERE clause

	package main
	import (
	"fmt"
	"github.com/sharekte/summer"
	)
	func main(){
	    pg := summer.CreatePGInstance()
	    cd := pg.NewConditions()
	    cd.Append(map[string]interface{}{"CF1=": 1, "CF2>": 99, "CF3<": 200})
	    fmt.Println(pg.NewSelect().ByConditions("PGTable4Condition", cd, nil, nil, nil))
	}

It will return SELECT * FROM PGTable4Condition WHERE CF1=$1 AND CF2>$2 AND CF3<$3 [1 99 200],you can find the value slice [1,99,200] and put it to Golang database funtions that need to call directly.

Most example you can find in builder_test.go.Please let me know if you find some issue or give suggestion.Call me by mail neo_yan@outlook.com
Enjoy!!!

About

A simply SQL statement assembler

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages