ent

command module
v0.0.0-...-5bc32a5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 3, 2023 License: GPL-3.0 Imports: 20 Imported by: 0

README

ent

学习如何使用ent库

模板创建

# 在ent目录下创建一个模板专用文件夹
cd ent && mkdir template && cd template
# 这个模板主要用于分页查询处理,如果有其他需要,请自定义模板
touch  pagination.tmpl

公共参数设计

# 在ent目录下创建一个公共参数专用文件夹
cd ent && mkdir mixins && cd mixins

枚举值参数设计

# 在ent目录下创建一个枚举值参数专用文件夹
cd ent && mkdir property && cd property

表设计生成

# 表原始model生成
go run -mod=mod entgo.io/ent/cmd/ent init User

自动生成代码


# 生成代码,使用 template , 添加了 Page 模板实现简便的分页查询
# sql/upsert 支持upsert
# sql/execquery 支持自定义sql 语句
go run -mod=mod entgo.io/ent/cmd/ent generate --feature privacy,entql,sql/upsert,sql/execquery --template glob="./ent/template/*.tmpl" ./ent/schema

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
ent

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL