1 Star 0 Fork 0

DaMeng/Ent

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
entc.go 906 Bytes
一键复制 编辑 原始数据 按行查看 历史
DaMeng 提交于 2024-10-24 16:04 . :tada:fork ent
// Copyright 2019-present Facebook Inc. All rights reserved.
// This source code is licensed under the Apache 2.0 license found
// in the LICENSE file in the root directory of this source tree.
package main
import (
"bytes"
"log"
"os"
"path/filepath"
"gitee.com/damengde/ent/cmd/internal/base"
"gitee.com/damengde/ent/entc/gen"
"github.com/spf13/cobra"
)
func main() {
log.SetFlags(0)
cmd := &cobra.Command{Use: "entc"}
cmd.AddCommand(
base.NewCmd(),
base.DescribeCmd(),
base.GenerateCmd(migrate),
base.InitCmd(),
)
_ = cmd.Execute()
}
func migrate(c *gen.Config) {
var (
target = filepath.Join(c.Target, "generate.go")
oldCmd = []byte("gitee.com/damengde/ent/cmd/entc")
)
buf, err := os.ReadFile(target)
if err != nil || !bytes.Contains(buf, oldCmd) {
return
}
_ = os.WriteFile(target, bytes.ReplaceAll(buf, oldCmd, []byte("gitee.com/damengde/ent/cmd/ent")), 0644)
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/damengde/ent.git
git@gitee.com:damengde/ent.git
damengde
ent
Ent
v0.0.1

搜索帮助