# README
gofree
符合 golang 风格的 ORM
- 消除链式调用,让 SQL 一目了然
- QueryBuilder 支持 DBA 审查 SQL,即使是非常复杂的SQL
- 接口友好,基于正确的场景设计接
- 接口设计松紧灵活,尽可能的消除
interface{}
的同时保持易用性.
# Packages
No description provided by the author
# Functions
f.And("name","nimo") 接收 ...interface{} 作为参数而不是 map[string]interface{} 是因为会存在这种情况 f.And("age", f.Lt(19), "age", f.Gt(10)).
No description provided by the author
No description provided by the author
No description provided by the author
you can use f.TimeRange, not BetweenTime.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
在 IgnoreEmpty 和 IgnorePattern 的场景下WHERE 语句都是 field = ? 有些场景下可能需要 where field in ? 或者没有 field in ? 此时使用 Ignore 完全自定义控制
使用场景:
f.QB{
Where: f.And(
"id": f.Ignore(len(query.idList) == 0, f.In(query.idList))
),
}
*/.
在查询中有一种常见的场景,当某个请求参数为空时不增加 where。 比如用户搜索姓名, ?name=nimo 时SQL是 WHERE name = ? 。 如果 ?name= (空字符串)则 sql 没有 name = ? gofree 称这种 where 条件为 ignore empty
使用场景:
f.QB{
Where: f.And(
"name": f.IgnoreEmpty(f.Eql, query.Name)
),
}
*/.
No description provided by the author
基于 IgnoreEmpty 的场景下,有些请求并不一定会是空,而是 ?status=all 来表示搜索全部 ?status=done 表示搜索已完成的数据 ,此时使用 IgnorePattern(f.Eql, query.Status, "all")
使用场景:
f.QB{
Where: f.And(
"status": f.IgnorePattern( f.Eql, query.Status, "all")
),
}
*/.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
FindOr(Find(...), Find(...)).
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
# Variables
No description provided by the author
# Structs
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
DataSourceName.User 是个 map[string]stirng 结构 用于生成 dataSourceName 中的 ?charset=utf8&parseTime=True&loc=Local 部分.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
配置项.
No description provided by the author
No description provided by the author
# Interfaces
No description provided by the author
# Type aliases
QueryBuilder Where.
No description provided by the author
No description provided by the author
No description provided by the author