zorm, golang lightweight ORM, readygo subproject
Source address: https://gitee.com/chunanyong/zorm
go get gitee.com/chunanyong/zorm
- Based on native SQL statements, it is a streamlining and optimization of springrain .
- Built-in code generator
- The code is streamlined, with a total of about 2000 lines, detailed comments, convenient for customization and modification.
- Support transaction propagation, which is the main reason for the birth of zorm
- 支持mysql,postgresql,oracle,mssql,sqlite
- Support database read and write separation
- The update performance of zorm, gorm, and xorm is equivalent. The read performance of zorm is twice as fast as that of gorm and xorm
- The test case is the document: https://gitee.com/chunanyong/readygo/blob/master/test/testzorm/BaseDao_test.go
Production use reference UserStructService.go
The update content is as follows:
- Increase the paging adaptation of Dameng data
- Improve and adjust code comments
- Add stored procedure and function call examples
//TestProc 13.测试调用存储过程
func TestProc(t *testing.T) {
user := permstruct.UserStruct{}
finder := zorm.NewFinder().Append("call testproc(?) ", "u_10001")
zorm.Query(ctx, finder, &user)
fmt.Println(user)
}
//TestFunc 14.测试调用自定义函数
func TestFunc(t *testing.T) {
userName := ""
finder := zorm.NewFinder().Append("select testfunc(?) ", "u_10001")
zorm.Query(ctx, finder, &userName)
fmt.Println(userName)
}