Categorygithub.com/farseer-go/data
modulepackage
0.14.0
Repository: https://github.com/farseer-go/data.git
Documentation: pkg.go.dev

# README

data 数据库ORM组件

包:"github.com/farseer-go/data"

模块:data.Module

go-version Build

概述

data组件提供数据库ORM操作,将数据库多张表组织到一个上下文中。并使用统一的./farseer.yaml配置

目前orm底层的组件使用的是gorm,data组件主要为了做进一步的封装,使得我们在使用时更加简单易用。

data组件,采用数据库上下文的概念,将多个model组合在一起,方便统一管理。

# Packages

No description provided by the author
No description provided by the author

# Functions

GetContext 获取上下文实例(每次获取都会创建一个实例).
InitContext 数据库上下文初始化 keyName:数据库配置名称 autoCreateTable:true表示自动创建表 同一个上下文生命周期内,共享一个orm client.
NewContext 数据库上下文初始化 keyName:数据库配置名称,对应./farseer.yaml 中的 Database节点 autoCreateTable:true表示自动创建表 同一个上下文生命周期内,共享一个orm client.
No description provided by the author
RegisterContext 注册上下文(临时生命周期).
RegisterInternalContext 注册内部上下文 DataType=mysql,PoolMaxSize=50,PoolMinSize=1,ConnectionString=user:pass@tcp(127.0.0.1:3306)/dbname?charset=utf8mb4&parseTime=True&loc=Local DataType=sqlserver,PoolMaxSize=50,PoolMinSize=1,ConnectionString=sqlserver://user:[email protected]:9930?database=dbname DataType=clickhouse,PoolMaxSize=50,PoolMinSize=1,ConnectionString=tcp://192.168.1.8:9000?database=dbname&username=default&password=&read_timeout=10&write_timeout=20 DataType=postgresql,PoolMaxSize=50,PoolMinSize=1,ConnectionString=host=127.0.0.1 user=user password=123456 dbname=dbname port=9920 sslmode=disable TimeZone=Asia/Shanghai DataType=sqlite,PoolMaxSize=50,PoolMinSize=1,ConnectionString=gorm.db.
ToMap PO实体转map.

# Structs

No description provided by the author
No description provided by the author
DomainSet 比TableSet支持自动绑定领域层的聚合,实现通用的CRUD操作.
No description provided by the author
No description provided by the author
TableSet 数据库表操作.
No description provided by the author

# Interfaces

No description provided by the author
IDbContext 数据库上下文.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
IRepository 通用的仓储接口,实现常用的CURD.