add export func reame

添加函数支持
This commit is contained in:
谢小军
2020-01-12 21:41:47 +08:00
parent 3156708f37
commit 2211c3ca5d
19 changed files with 714 additions and 778 deletions

56
doc/func.md Normal file
View File

@@ -0,0 +1,56 @@
# func export readme
- Note: the shortcut function is only an auxiliary function of Gorm. Currently only query function is supported
## Catalog
- [_BaseMgr](#_BaseMgr)
- [_BaseMgr](#_BaseMgr)
- [SetCtx](#SetCtx)
- [GetDB](#GetDB)
- [GetIsRelated](#GetIsRelated)
- [SetIsRelated](#SetIsRelated)
- [Table logic function](#Table-logic-function)
- [Brief description](#Brief-description)
- [Basic types of logic]](#Basic-types-of-logic)
- [Access to existing conditions](#Access-to-existing-conditions)
- [Access to function options](#Access-to-function-options)
- [Single element access](#Single-element-access)
- [Index access](#Index-access)
## _BaseMgr
Basic function. All management types inherit this function. This function provides the underlying common function.
### SetCtx
Set context, which is used to set context. The current function is not enabled
### GetDB
Get gorm.db original link
### GetIsRelated
Get whether to query foreign key Association
### SetIsRelated
Set whether to query foreign key Association
## Table logic function
Table logical function operation about database table related function: use [XXX] to represent logical table structure name
### Brief description
Queries are divided into the following categories
### Basic types of logic
`_[xxx]Mgr` : Logical table type
### Access to existing conditions
`Get/Gets` : Batch get (you can use gormt to get the final result using its preset conditions)
### Access to function options
This function is used to support multiple condition acquisition
`GetByOption/GetByOptions` : Get function option list
`With[xxx]` : Parameter list in function options
### Single element access
`GetFrom[xxx]` : Element acquisition (single case conditional acquisition)
`GetBatchFrom[xxx]` : Batch element acquisition (array acquisition of a single condition)
### Index access
`FetchByPrimaryKey` : Primary key acquisition
`FetchByUnique` : Get by unique index
`FetchBy[xxx]Index` : Composite index fetch (multiple returned)
`FetchBy[xxx]UniqueIndex` : Unique composite index fetch (return one)

54
doc/func_cn.md Normal file
View File

@@ -0,0 +1,54 @@
# 快捷函数功能
- 说明: 快捷函数只是对 gorm 的辅助功能。目前只支持查询功能
## 目录
- [_BaseMgr](#_BaseMgr)
- [_BaseMgr](#_BaseMgr)
- [SetCtx](#SetCtx)
- [GetDB](#GetDB)
- [GetIsRelated](#GetIsRelated)
- [SetIsRelated](#SetIsRelated)
- [表逻辑函数](#表逻辑函数)
- [简要说明](#简要说明)
- [逻辑基础类型]](#逻辑基础类型)
- [已有条件获取方式](#已有条件获取方式)
- [功能选项方式获取](#功能选项方式获取)
- [单元素方式获取](#单元素方式获取)
- [索引方式获取](#索引方式获取)
## _BaseMgr
基础函数。所有管理类型都是继承此函数。此函数提供基础公共函数。
### SetCtx
设置 context ,用于设置上下文。目前功能未启用
### GetDB
获取 gorm.DB 原始链接窜
### GetIsRelated
获取是否查询外键关联
### SetIsRelated
设置是否查询外键关联
## 表逻辑函数
表逻辑函数操作关于数据库表相关功能函数:以下使用[xxx]代表逻辑表结构体名
### 简要说明
查询分为以下几类
### 逻辑基础类型
`_[xxx]Mgr` : 逻辑表类型
### 已有条件获取方式
`Get/Gets` : 批量获取(使用 gormt 预先设置的条件可以使用它来获取最终结果)
### 功能选项方式获取
此功能 用于支持多种条件获取
`GetByOption/GetByOptions` : 功能选项列表获取
`With[xxx]` : 功能选项中的参数列表
### 单元素方式获取
`GetFrom[xxx]` : 元素获取(单个case条件获取)
`GetBatchFrom[xxx]` : 批量元素获取(单个条件的数组获取)
### 索引方式获取
`FetchByPrimaryKey` : 主键获取
`FetchByUnique` : 唯一索引方式获取
`FetchBy[xxx]Index` : 复合索引获取(返回多个)
`FetchBy[xxx]UniqueIndex` : 唯一复合索引获取(返回一个)