Documentation
¶
Index ¶
- func IsEmpty(err error) bool
- func NewSqlite(conn *sql.DB, obj any, objType reflect.Type, table string, ...) support.ObjectORM
- type Sqlite
- func (qt *Sqlite) Count(queryParts ...any) (int, error)
- func (qt *Sqlite) Create() error
- func (qt *Sqlite) Delete(queryParts ...any) error
- func (qt *Sqlite) Error() error
- func (qt *Sqlite) Find(queryParts ...any) (any, error)
- func (qt *Sqlite) FindAll(queryParts ...any) ([]any, error)
- func (qt *Sqlite) Save(queryParts ...any) error
- func (qt *Sqlite) Update(queryParts ...any) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Sqlite ¶
type Sqlite struct {
Table string // 表名
Elems []support.Elem // 字段元素列表
// contains filtered or unexported fields
}
Sqlite SQLite 数据库 ORM 实现
func (*Sqlite) Count ¶ added in v1.2.0
Count 统计记录数量 根据提供的查询条件统计匹配的记录数 使用 SQLite 的 "table" 引用表名和 ? 占位符 参数:
- queryParts: 查询条件部分,可以是条件字符串和参数
返回:
- int: 记录数量
- error: 执行错误
func (*Sqlite) Create ¶
Create 插入新记录到数据库 使用 INSERT 语句将数据插入到表中,跳过自增字段 使用 SQLite 的 "table" 引用表名和 ? 占位符 返回:
- error: 执行错误
func (*Sqlite) Delete ¶
Delete 删除数据库记录 根据提供的查询条件删除匹配的记录 使用 SQLite 的 "table" 引用表名和 ? 占位符 参数:
- queryParts: 查询条件部分,可以是条件字符串和参数
返回:
- error: 执行错误
func (*Sqlite) Find ¶
Find 查询单条记录 根据提供的查询条件查询第一条匹配的记录 使用 SQLite 的 "table" 引用表名和 ? 占位符 参数:
- queryParts: 查询条件部分,可以是条件字符串和参数
返回:
- any: 查询结果对象
- error: 执行错误
func (*Sqlite) FindAll ¶
FindAll 查询多条记录 根据提供的查询条件查询所有匹配的记录 使用 SQLite 的 "table" 引用表名和 ? 占位符 参数:
- queryParts: 查询条件部分,可以是条件字符串和参数
返回:
- []any: 查询结果对象列表
- error: 执行错误
Click to show internal directories.
Click to hide internal directories.