Commit 8b87f621 authored by Bess严根旺's avatar Bess严根旺

替换脚手架

parent c39268f9

Too many changes to show.

To preserve performance only 1000 of 1000+ files are displayed.

APP_NAME=doc-service
APP_ENV=test
GIN_MODE=release
ALIBABA_CLOUD_ACCESS_KEY_ID="LTAI5tFsFNAoCngNdX9g4CMW"
ALIBABA_CLOUD_ACCESS_KEY_SECRET="otz3kkD0s3SWhVitKP2cqiZdCkTCJd"
ALIBABA_CLOUD_ACCESS_KEY_URL="imm.cn-shenzhen.aliyuncs.com"
ALIBABA_CLOUD_BUCKET="test-bucket-v1"
/log/*
\ No newline at end of file
log
server
.idea
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<module type="WEB_MODULE" version="4">
<component name="Go" enabled="true" />
<component name="NewModuleRootManager">
<content url="file://$MODULE_DIR$" />
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>
\ No newline at end of file
......@@ -2,7 +2,7 @@
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/.idea/doc-service.iml" filepath="$PROJECT_DIR$/.idea/doc-service.iml" />
<module fileurl="file://$PROJECT_DIR$/.idea/convert-server.iml" filepath="$PROJECT_DIR$/.idea/convert-server.iml" />
</modules>
</component>
</project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="" vcs="Git" />
</component>
</project>
\ No newline at end of file
// Package boot 专门用来初始化模块
package boot
// todo... add your entity runtime
// example:
// import (
// _ "your-project/domain/entity/your-entity/runtime"
// )
package log
import (
"github.com/pkg/errors"
"io"
"os"
"path"
"sync"
"time"
)
type dailyFileWriter struct {
// 日志文件名称
fileName string
// 上一次写入日期
lastYearDay int
// 输出文件
outputFile *os.File
// 文件交换锁
fileSwitchLock *sync.Mutex
}
// Write 输出日志
func (w *dailyFileWriter) Write(byteArray []byte) (n int, err error) {
if nil == byteArray ||
len(byteArray) <= 0 {
return 0, nil
}
outputFile, err := w.getOutputFile()
if nil != err {
return 0, err
}
_, _ = os.Stderr.Write(byteArray)
_, _ = outputFile.Write(byteArray)
return len(byteArray), nil
}
// 获取输出文件
// 每天创建一个新得日志文件
func (w *dailyFileWriter) getOutputFile() (io.Writer, error) {
yearDay := time.Now().YearDay()
if w.lastYearDay == yearDay &&
nil != w.outputFile {
return w.outputFile, nil
}
w.fileSwitchLock.Lock()
defer w.fileSwitchLock.Unlock()
if w.lastYearDay == yearDay &&
nil != w.outputFile {
return w.outputFile, nil
}
w.lastYearDay = yearDay
// 先建立日志目录
err := os.MkdirAll(path.Dir(w.fileName), os.ModePerm)
if nil != err {
return nil, err
}
// 定义日志文件名称 = 日志文件名 . 日期后缀
newDailyFile := w.fileName + "." + time.Now().Format("20060102")
outputFile, err := os.OpenFile(
newDailyFile,
os.O_CREATE|os.O_APPEND|os.O_WRONLY,
0644, // rw-r--r--
)
if nil != err || nil == outputFile {
return nil, errors.Errorf("打开文件 %s 失败, err = %v", newDailyFile, err)
}
if nil != w.outputFile {
// 关闭原来的文件
_ = w.outputFile.Close()
}
w.outputFile = outputFile
return outputFile, nil
}
package log
import (
"fmt"
"log"
"sync"
)
var writer *dailyFileWriter
var infoLogger, errorLogger *log.Logger
// Config 配置日志
func Config(outputFileName string) {
if len(outputFileName) <= 0 {
panic("输出文件名为空")
}
writer = &dailyFileWriter{
fileName: outputFileName,
lastYearDay: -1,
fileSwitchLock: &sync.Mutex{},
}
infoLogger = log.New(
writer, "[ INFO ] ",
log.Ltime|log.Lmicroseconds|log.Lshortfile,
)
errorLogger = log.New(
writer, "[ ERROR ] ",
log.Ltime|log.Lmicroseconds|log.Lshortfile,
)
}
// Info 输出消息日志
func Info(format string, valArray ...interface{}) {
_ = infoLogger.Output(
2,
fmt.Sprintf(format, valArray...),
)
}
// Error 输出错误日志
func Error(format string, valArray ...interface{}) {
_ = errorLogger.Output(
2,
fmt.Sprintf(format, valArray...),
)
}
app_name = doc-service
# possible values: DEBUG, INFO, WARNING, ERROR, FATAL
log_level = DEBUG
[mysql]
ip = "wan-test1-mysql-m1.galaxy-immi.com"
port = 3306
user = "admin"
password = `0HkUEneEon#gQJAa`
database = ServerSiteMicros
[redis]
ip = 192.168.23.12
port = 6379
[AliYun]
host ="imm.cn-shenzhen.aliyuncs.com"
accessId ="LTAI5tFsFNAoCngNdX9g4CMW"
accessKeySecret="otz3kkD0s3SWhVitKP2cqiZdCkTCJd"
bucketPrivate="test-bucket-v1"
bucketPub="test-bucket-v1-pub"
\ No newline at end of file
package controllers
import (
"doc-service/modes/db"
"doc-service/service"
"github.com/gin-contrib/sessions"
"github.com/gin-gonic/gin"
"net/http"
)
type ApiController struct{}
func res(c *gin.Context, code int64, msg string, data interface{}) {
c.JSON(http.StatusOK, gin.H{
"code": code,
"msg": msg,
"data": data,
})
}
func (con ApiController) Index(c *gin.Context) {
session := sessions.Default(c)
session.Options(sessions.Options{
MaxAge: 3600 * 6,
})
session.Set("username", "张三 111")
_ = session.Save()
c.JSON(http.StatusOK, gin.H{
"msg": "我是一个msg",
"t": 1629788418,
})
}
func (con ApiController) Userlist(c *gin.Context) {
c.String(200, "我是一个api接口-Userlist")
}
func (con ApiController) Plist(c *gin.Context) {
c.String(200, "我是一个api接口-Plist")
}
// 发起文件转换
func (con ApiController) Conversion(c *gin.Context) {
ret := make(map[string]interface{}, 0)
ret["errcode"] = 0
ret["errmsg"] = nil
ret["base64"] = nil
req := service.ConversionRequest{}
req.ProjectName = c.PostForm("project_name")
req.SourceType = c.PostForm("source_type")
req.TargetType = c.PostForm("target_type")
req.SourceURI = c.PostForm("source_url")
req.TargetURI = c.PostForm("target_url")
IsPrivate := c.PostForm("is_private")
req.IsPrivate = IsPrivate == "1"
//创建项目
createErr := service.NewConversion().CreateProject()
if createErr != nil {
ret["errmsg"] = createErr.Error()
ret["errcode"] = 100010
res(c, http.StatusOK, "成功", ret)
return
}
//执行转换
result, errs := service.NewConversion().DoConversion(req)
if errs != nil {
ret["errmsg"] = errs.Error()
ret["errcode"] = 100011
}
taskId := result["body"].(map[string]interface{})["TaskId"].(string)
//入库
db.SaveProject(req, taskId)
ret["result"] = result
res(c, http.StatusOK, "成功", ret)
}
// 获取转换结果
func (con ApiController) GetTaskProject(c *gin.Context) {
ret := make(map[string]interface{}, 0)
req := service.GetTaskRequest{}
req.ProjectName = c.Query("project_name")
req.TaskId = c.Query("task_id")
req.TaskType = c.Query("task_type")
req.RequestDefinition = true
ret["ProjectId"] = c.Query("project_id")
if ret["ProjectId"] != "" {
projectData := db.GetProjectById(ret["ProjectId"].(int64))
req.ProjectName = projectData.ProjectName
req.TaskId = projectData.TaskId
req.TaskType = projectData.TargetType
}
result, errs := service.NewConversion().GetTaskProject(req)
if errs != nil {
ret["errmsg"] = errs.Error()
ret["errcode"] = 100011
}
ret["result"] = result
res(c, http.StatusOK, "成功", ret)
return
}
app_name = convert-server
# possible values: DEBUG, INFO, WARNING, ERROR, FATAL
log_level = DEBUG
[mysql]
ip = "wan-test1-mysql-m1.galaxy-immi.com"
port = 3306
user = "admin"
password = `0HkUEneEon#gQJAa`
database = ServerSiteMicros
[redis]
ip = 192.168.23.12
port = 6379
[AliYun]
host ="imm.cn-shenzhen.aliyuncs.com"
accessId ="LTAI5tFsFNAoCngNdX9g4CMW"
accessKeySecret="otz3kkD0s3SWhVitKP2cqiZdCkTCJd"
bucketPrivate="test-bucket-v1"
bucketPub="test-bucket-v1-pub"
\ No newline at end of file
## ent数据库模型目录
\ No newline at end of file
This diff is collapsed.
// Code generated by ent, DO NOT EDIT.
package serversitemicros
import (
"convert-server/domain/entity/serversitemicros/docserverapp"
"fmt"
"strings"
"time"
"entgo.io/ent"
"entgo.io/ent/dialect/sql"
)
// DocServerApp is the model entity for the DocServerApp schema.
type DocServerApp struct {
config `json:"-"`
// ID of the ent.
// 业务id
ID int32 `json:"id,omitempty"`
// 密钥
Application string `json:"application,omitempty"`
// 名称
Name string `json:"name,omitempty"`
// 创建时间
CreatedAt *time.Time `json:"created_at,omitempty"`
selectValues sql.SelectValues
}
// scanValues returns the types for scanning values from sql.Rows.
func (*DocServerApp) scanValues(columns []string) ([]any, error) {
values := make([]any, len(columns))
for i := range columns {
switch columns[i] {
case docserverapp.FieldID:
values[i] = new(sql.NullInt64)
case docserverapp.FieldApplication, docserverapp.FieldName:
values[i] = new(sql.NullString)
case docserverapp.FieldCreatedAt:
values[i] = new(sql.NullTime)
default:
values[i] = new(sql.UnknownType)
}
}
return values, nil
}
// assignValues assigns the values that were returned from sql.Rows (after scanning)
// to the DocServerApp fields.
func (dsa *DocServerApp) assignValues(columns []string, values []any) error {
if m, n := len(values), len(columns); m < n {
return fmt.Errorf("mismatch number of scan values: %d != %d", m, n)
}
for i := range columns {
switch columns[i] {
case docserverapp.FieldID:
value, ok := values[i].(*sql.NullInt64)
if !ok {
return fmt.Errorf("unexpected type %T for field id", value)
}
dsa.ID = int32(value.Int64)
case docserverapp.FieldApplication:
if value, ok := values[i].(*sql.NullString); !ok {
return fmt.Errorf("unexpected type %T for field application", values[i])
} else if value.Valid {
dsa.Application = value.String
}
case docserverapp.FieldName:
if value, ok := values[i].(*sql.NullString); !ok {
return fmt.Errorf("unexpected type %T for field name", values[i])
} else if value.Valid {
dsa.Name = value.String
}
case docserverapp.FieldCreatedAt:
if value, ok := values[i].(*sql.NullTime); !ok {
return fmt.Errorf("unexpected type %T for field created_at", values[i])
} else if value.Valid {
dsa.CreatedAt = new(time.Time)
*dsa.CreatedAt = value.Time
}
default:
dsa.selectValues.Set(columns[i], values[i])
}
}
return nil
}
// Value returns the ent.Value that was dynamically selected and assigned to the DocServerApp.
// This includes values selected through modifiers, order, etc.
func (dsa *DocServerApp) Value(name string) (ent.Value, error) {
return dsa.selectValues.Get(name)
}
// Update returns a builder for updating this DocServerApp.
// Note that you need to call DocServerApp.Unwrap() before calling this method if this DocServerApp
// was returned from a transaction, and the transaction was committed or rolled back.
func (dsa *DocServerApp) Update() *DocServerAppUpdateOne {
return NewDocServerAppClient(dsa.config).UpdateOne(dsa)
}
// Unwrap unwraps the DocServerApp entity that was returned from a transaction after it was closed,
// so that all future queries will be executed through the driver which created the transaction.
func (dsa *DocServerApp) Unwrap() *DocServerApp {
_tx, ok := dsa.config.driver.(*txDriver)
if !ok {
panic("serversitemicros: DocServerApp is not a transactional entity")
}
dsa.config.driver = _tx.drv
return dsa
}
// String implements the fmt.Stringer.
func (dsa *DocServerApp) String() string {
var builder strings.Builder
builder.WriteString("DocServerApp(")
builder.WriteString(fmt.Sprintf("id=%v, ", dsa.ID))
builder.WriteString("application=")
builder.WriteString(dsa.Application)
builder.WriteString(", ")
builder.WriteString("name=")
builder.WriteString(dsa.Name)
builder.WriteString(", ")
if v := dsa.CreatedAt; v != nil {
builder.WriteString("created_at=")
builder.WriteString(v.Format(time.ANSIC))
}
builder.WriteByte(')')
return builder.String()
}
// DocServerApps is a parsable slice of DocServerApp.
type DocServerApps []*DocServerApp
// Code generated by ent, DO NOT EDIT.
package docserverapp
import (
"time"
"entgo.io/ent"
"entgo.io/ent/dialect/sql"
)
const (
// Label holds the string label denoting the docserverapp type in the database.
Label = "doc_server_app"
// FieldID holds the string denoting the id field in the database.
FieldID = "id"
// FieldApplication holds the string denoting the application field in the database.
FieldApplication = "application"
// FieldName holds the string denoting the name field in the database.
FieldName = "name"
// FieldCreatedAt holds the string denoting the created_at field in the database.
FieldCreatedAt = "created_at"
// Table holds the table name of the docserverapp in the database.
Table = "doc_server_app"
)
// Columns holds all SQL columns for docserverapp fields.
var Columns = []string{
FieldID,
FieldApplication,
FieldName,
FieldCreatedAt,
}
// ValidColumn reports if the column name is valid (part of the table columns).
func ValidColumn(column string) bool {
for i := range Columns {
if column == Columns[i] {
return true
}
}
return false
}
// Note that the variables below are initialized by the runtime
// package on the initialization of the application. Therefore,
// it should be imported in the main as follows:
//
// import _ "convert-server/domain/entity/serversitemicros/runtime"
var (
Hooks [2]ent.Hook
// DefaultName holds the default value on creation for the "name" field.
DefaultName string
// UpdateDefaultCreatedAt holds the default value on update for the "created_at" field.
UpdateDefaultCreatedAt func() time.Time
)
// OrderOption defines the ordering options for the DocServerApp queries.
type OrderOption func(*sql.Selector)
// ByID orders the results by the id field.
func ByID(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldID, opts...).ToFunc()
}
// ByApplication orders the results by the application field.
func ByApplication(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldApplication, opts...).ToFunc()
}
// ByName orders the results by the name field.
func ByName(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldName, opts...).ToFunc()
}
// ByCreatedAt orders the results by the created_at field.
func ByCreatedAt(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldCreatedAt, opts...).ToFunc()
}
// Code generated by ent, DO NOT EDIT.
package docserverapp
import (
"convert-server/domain/entity/serversitemicros/predicate"
"time"
"entgo.io/ent/dialect/sql"
)
// ID filters vertices based on their ID field.
func ID(id int32) predicate.DocServerApp {
return predicate.DocServerApp(sql.FieldEQ(FieldID, id))
}
// IDEQ applies the EQ predicate on the ID field.
func IDEQ(id int32) predicate.DocServerApp {
return predicate.DocServerApp(sql.FieldEQ(FieldID, id))
}
// IDNEQ applies the NEQ predicate on the ID field.
func IDNEQ(id int32) predicate.DocServerApp {
return predicate.DocServerApp(sql.FieldNEQ(FieldID, id))
}
// IDIn applies the In predicate on the ID field.
func IDIn(ids ...int32) predicate.DocServerApp {
return predicate.DocServerApp(sql.FieldIn(FieldID, ids...))
}
// IDNotIn applies the NotIn predicate on the ID field.
func IDNotIn(ids ...int32) predicate.DocServerApp {
return predicate.DocServerApp(sql.FieldNotIn(FieldID, ids...))
}
// IDGT applies the GT predicate on the ID field.
func IDGT(id int32) predicate.DocServerApp {
return predicate.DocServerApp(sql.FieldGT(FieldID, id))
}
// IDGTE applies the GTE predicate on the ID field.
func IDGTE(id int32) predicate.DocServerApp {
return predicate.DocServerApp(sql.FieldGTE(FieldID, id))
}
// IDLT applies the LT predicate on the ID field.
func IDLT(id int32) predicate.DocServerApp {
return predicate.DocServerApp(sql.FieldLT(FieldID, id))
}
// IDLTE applies the LTE predicate on the ID field.
func IDLTE(id int32) predicate.DocServerApp {
return predicate.DocServerApp(sql.FieldLTE(FieldID, id))
}
// Application applies equality check predicate on the "application" field. It's identical to ApplicationEQ.
func Application(v string) predicate.DocServerApp {
return predicate.DocServerApp(sql.FieldEQ(FieldApplication, v))
}
// Name applies equality check predicate on the "name" field. It's identical to NameEQ.
func Name(v string) predicate.DocServerApp {
return predicate.DocServerApp(sql.FieldEQ(FieldName, v))
}
// CreatedAt applies equality check predicate on the "created_at" field. It's identical to CreatedAtEQ.
func CreatedAt(v time.Time) predicate.DocServerApp {
return predicate.DocServerApp(sql.FieldEQ(FieldCreatedAt, v))
}
// ApplicationEQ applies the EQ predicate on the "application" field.
func ApplicationEQ(v string) predicate.DocServerApp {
return predicate.DocServerApp(sql.FieldEQ(FieldApplication, v))
}
// ApplicationNEQ applies the NEQ predicate on the "application" field.
func ApplicationNEQ(v string) predicate.DocServerApp {
return predicate.DocServerApp(sql.FieldNEQ(FieldApplication, v))
}
// ApplicationIn applies the In predicate on the "application" field.
func ApplicationIn(vs ...string) predicate.DocServerApp {
return predicate.DocServerApp(sql.FieldIn(FieldApplication, vs...))
}
// ApplicationNotIn applies the NotIn predicate on the "application" field.
func ApplicationNotIn(vs ...string) predicate.DocServerApp {
return predicate.DocServerApp(sql.FieldNotIn(FieldApplication, vs...))
}
// ApplicationGT applies the GT predicate on the "application" field.
func ApplicationGT(v string) predicate.DocServerApp {
return predicate.DocServerApp(sql.FieldGT(FieldApplication, v))
}
// ApplicationGTE applies the GTE predicate on the "application" field.
func ApplicationGTE(v string) predicate.DocServerApp {
return predicate.DocServerApp(sql.FieldGTE(FieldApplication, v))
}
// ApplicationLT applies the LT predicate on the "application" field.
func ApplicationLT(v string) predicate.DocServerApp {
return predicate.DocServerApp(sql.FieldLT(FieldApplication, v))
}
// ApplicationLTE applies the LTE predicate on the "application" field.
func ApplicationLTE(v string) predicate.DocServerApp {
return predicate.DocServerApp(sql.FieldLTE(FieldApplication, v))
}
// ApplicationContains applies the Contains predicate on the "application" field.
func ApplicationContains(v string) predicate.DocServerApp {
return predicate.DocServerApp(sql.FieldContains(FieldApplication, v))
}
// ApplicationHasPrefix applies the HasPrefix predicate on the "application" field.
func ApplicationHasPrefix(v string) predicate.DocServerApp {
return predicate.DocServerApp(sql.FieldHasPrefix(FieldApplication, v))
}
// ApplicationHasSuffix applies the HasSuffix predicate on the "application" field.
func ApplicationHasSuffix(v string) predicate.DocServerApp {
return predicate.DocServerApp(sql.FieldHasSuffix(FieldApplication, v))
}
// ApplicationEqualFold applies the EqualFold predicate on the "application" field.
func ApplicationEqualFold(v string) predicate.DocServerApp {
return predicate.DocServerApp(sql.FieldEqualFold(FieldApplication, v))
}
// ApplicationContainsFold applies the ContainsFold predicate on the "application" field.
func ApplicationContainsFold(v string) predicate.DocServerApp {
return predicate.DocServerApp(sql.FieldContainsFold(FieldApplication, v))
}
// NameEQ applies the EQ predicate on the "name" field.
func NameEQ(v string) predicate.DocServerApp {
return predicate.DocServerApp(sql.FieldEQ(FieldName, v))
}
// NameNEQ applies the NEQ predicate on the "name" field.
func NameNEQ(v string) predicate.DocServerApp {
return predicate.DocServerApp(sql.FieldNEQ(FieldName, v))
}
// NameIn applies the In predicate on the "name" field.
func NameIn(vs ...string) predicate.DocServerApp {
return predicate.DocServerApp(sql.FieldIn(FieldName, vs...))
}
// NameNotIn applies the NotIn predicate on the "name" field.
func NameNotIn(vs ...string) predicate.DocServerApp {
return predicate.DocServerApp(sql.FieldNotIn(FieldName, vs...))
}
// NameGT applies the GT predicate on the "name" field.
func NameGT(v string) predicate.DocServerApp {
return predicate.DocServerApp(sql.FieldGT(FieldName, v))
}
// NameGTE applies the GTE predicate on the "name" field.
func NameGTE(v string) predicate.DocServerApp {
return predicate.DocServerApp(sql.FieldGTE(FieldName, v))
}
// NameLT applies the LT predicate on the "name" field.
func NameLT(v string) predicate.DocServerApp {
return predicate.DocServerApp(sql.FieldLT(FieldName, v))
}
// NameLTE applies the LTE predicate on the "name" field.
func NameLTE(v string) predicate.DocServerApp {
return predicate.DocServerApp(sql.FieldLTE(FieldName, v))
}
// NameContains applies the Contains predicate on the "name" field.
func NameContains(v string) predicate.DocServerApp {
return predicate.DocServerApp(sql.FieldContains(FieldName, v))
}
// NameHasPrefix applies the HasPrefix predicate on the "name" field.
func NameHasPrefix(v string) predicate.DocServerApp {
return predicate.DocServerApp(sql.FieldHasPrefix(FieldName, v))
}
// NameHasSuffix applies the HasSuffix predicate on the "name" field.
func NameHasSuffix(v string) predicate.DocServerApp {
return predicate.DocServerApp(sql.FieldHasSuffix(FieldName, v))
}
// NameEqualFold applies the EqualFold predicate on the "name" field.
func NameEqualFold(v string) predicate.DocServerApp {
return predicate.DocServerApp(sql.FieldEqualFold(FieldName, v))
}
// NameContainsFold applies the ContainsFold predicate on the "name" field.
func NameContainsFold(v string) predicate.DocServerApp {
return predicate.DocServerApp(sql.FieldContainsFold(FieldName, v))
}
// CreatedAtEQ applies the EQ predicate on the "created_at" field.
func CreatedAtEQ(v time.Time) predicate.DocServerApp {
return predicate.DocServerApp(sql.FieldEQ(FieldCreatedAt, v))
}
// CreatedAtNEQ applies the NEQ predicate on the "created_at" field.
func CreatedAtNEQ(v time.Time) predicate.DocServerApp {
return predicate.DocServerApp(sql.FieldNEQ(FieldCreatedAt, v))
}
// CreatedAtIn applies the In predicate on the "created_at" field.
func CreatedAtIn(vs ...time.Time) predicate.DocServerApp {
return predicate.DocServerApp(sql.FieldIn(FieldCreatedAt, vs...))
}
// CreatedAtNotIn applies the NotIn predicate on the "created_at" field.
func CreatedAtNotIn(vs ...time.Time) predicate.DocServerApp {
return predicate.DocServerApp(sql.FieldNotIn(FieldCreatedAt, vs...))
}
// CreatedAtGT applies the GT predicate on the "created_at" field.
func CreatedAtGT(v time.Time) predicate.DocServerApp {
return predicate.DocServerApp(sql.FieldGT(FieldCreatedAt, v))
}
// CreatedAtGTE applies the GTE predicate on the "created_at" field.
func CreatedAtGTE(v time.Time) predicate.DocServerApp {
return predicate.DocServerApp(sql.FieldGTE(FieldCreatedAt, v))
}
// CreatedAtLT applies the LT predicate on the "created_at" field.
func CreatedAtLT(v time.Time) predicate.DocServerApp {
return predicate.DocServerApp(sql.FieldLT(FieldCreatedAt, v))
}
// CreatedAtLTE applies the LTE predicate on the "created_at" field.
func CreatedAtLTE(v time.Time) predicate.DocServerApp {
return predicate.DocServerApp(sql.FieldLTE(FieldCreatedAt, v))
}
// CreatedAtIsNil applies the IsNil predicate on the "created_at" field.
func CreatedAtIsNil() predicate.DocServerApp {
return predicate.DocServerApp(sql.FieldIsNull(FieldCreatedAt))
}
// CreatedAtNotNil applies the NotNil predicate on the "created_at" field.
func CreatedAtNotNil() predicate.DocServerApp {
return predicate.DocServerApp(sql.FieldNotNull(FieldCreatedAt))
}
// And groups predicates with the AND operator between them.
func And(predicates ...predicate.DocServerApp) predicate.DocServerApp {
return predicate.DocServerApp(sql.AndPredicates(predicates...))
}
// Or groups predicates with the OR operator between them.
func Or(predicates ...predicate.DocServerApp) predicate.DocServerApp {
return predicate.DocServerApp(sql.OrPredicates(predicates...))
}
// Not applies the not operator on the given predicate.
func Not(p predicate.DocServerApp) predicate.DocServerApp {
return predicate.DocServerApp(sql.NotPredicates(p))
}
// Code generated by ent, DO NOT EDIT.
package serversitemicros
import (
"context"
"convert-server/domain/entity/serversitemicros/docserverapp"
"errors"
"fmt"
"time"
"entgo.io/ent/dialect/sql/sqlgraph"
"entgo.io/ent/schema/field"
)
// DocServerAppCreate is the builder for creating a DocServerApp entity.
type DocServerAppCreate struct {
config
mutation *DocServerAppMutation
hooks []Hook
}
// SetApplication sets the "application" field.
func (dsac *DocServerAppCreate) SetApplication(s string) *DocServerAppCreate {
dsac.mutation.SetApplication(s)
return dsac
}
// SetName sets the "name" field.
func (dsac *DocServerAppCreate) SetName(s string) *DocServerAppCreate {
dsac.mutation.SetName(s)
return dsac
}
// SetNillableName sets the "name" field if the given value is not nil.
func (dsac *DocServerAppCreate) SetNillableName(s *string) *DocServerAppCreate {
if s != nil {
dsac.SetName(*s)
}
return dsac
}
// SetCreatedAt sets the "created_at" field.
func (dsac *DocServerAppCreate) SetCreatedAt(t time.Time) *DocServerAppCreate {
dsac.mutation.SetCreatedAt(t)
return dsac
}
// SetNillableCreatedAt sets the "created_at" field if the given value is not nil.
func (dsac *DocServerAppCreate) SetNillableCreatedAt(t *time.Time) *DocServerAppCreate {
if t != nil {
dsac.SetCreatedAt(*t)
}
return dsac
}
// SetID sets the "id" field.
func (dsac *DocServerAppCreate) SetID(i int32) *DocServerAppCreate {
dsac.mutation.SetID(i)
return dsac
}
// Mutation returns the DocServerAppMutation object of the builder.
func (dsac *DocServerAppCreate) Mutation() *DocServerAppMutation {
return dsac.mutation
}
// Save creates the DocServerApp in the database.
func (dsac *DocServerAppCreate) Save(ctx context.Context) (*DocServerApp, error) {
if err := dsac.defaults(); err != nil {
return nil, err
}
return withHooks(ctx, dsac.sqlSave, dsac.mutation, dsac.hooks)
}
// SaveX calls Save and panics if Save returns an error.
func (dsac *DocServerAppCreate) SaveX(ctx context.Context) *DocServerApp {
v, err := dsac.Save(ctx)
if err != nil {
panic(err)
}
return v
}
// Exec executes the query.
func (dsac *DocServerAppCreate) Exec(ctx context.Context) error {
_, err := dsac.Save(ctx)
return err
}
// ExecX is like Exec, but panics if an error occurs.
func (dsac *DocServerAppCreate) ExecX(ctx context.Context) {
if err := dsac.Exec(ctx); err != nil {
panic(err)
}
}
// defaults sets the default values of the builder before save.
func (dsac *DocServerAppCreate) defaults() error {
if _, ok := dsac.mutation.Name(); !ok {
v := docserverapp.DefaultName
dsac.mutation.SetName(v)
}
return nil
}
// check runs all checks and user-defined validators on the builder.
func (dsac *DocServerAppCreate) check() error {
if _, ok := dsac.mutation.Application(); !ok {
return &ValidationError{Name: "application", err: errors.New(`serversitemicros: missing required field "DocServerApp.application"`)}
}
if _, ok := dsac.mutation.Name(); !ok {
return &ValidationError{Name: "name", err: errors.New(`serversitemicros: missing required field "DocServerApp.name"`)}
}
return nil
}
func (dsac *DocServerAppCreate) sqlSave(ctx context.Context) (*DocServerApp, error) {
if err := dsac.check(); err != nil {
return nil, err
}
_node, _spec := dsac.createSpec()
if err := sqlgraph.CreateNode(ctx, dsac.driver, _spec); err != nil {
if sqlgraph.IsConstraintError(err) {
err = &ConstraintError{msg: err.Error(), wrap: err}
}
return nil, err
}
if _spec.ID.Value != _node.ID {
id := _spec.ID.Value.(int64)
_node.ID = int32(id)
}
dsac.mutation.id = &_node.ID
dsac.mutation.done = true
return _node, nil
}
func (dsac *DocServerAppCreate) createSpec() (*DocServerApp, *sqlgraph.CreateSpec) {
var (
_node = &DocServerApp{config: dsac.config}
_spec = sqlgraph.NewCreateSpec(docserverapp.Table, sqlgraph.NewFieldSpec(docserverapp.FieldID, field.TypeInt32))
)
if id, ok := dsac.mutation.ID(); ok {
_node.ID = id
_spec.ID.Value = id
}
if value, ok := dsac.mutation.Application(); ok {
_spec.SetField(docserverapp.FieldApplication, field.TypeString, value)
_node.Application = value
}
if value, ok := dsac.mutation.Name(); ok {
_spec.SetField(docserverapp.FieldName, field.TypeString, value)
_node.Name = value
}
if value, ok := dsac.mutation.CreatedAt(); ok {
_spec.SetField(docserverapp.FieldCreatedAt, field.TypeTime, value)
_node.CreatedAt = &value
}
return _node, _spec
}
// DocServerAppCreateBulk is the builder for creating many DocServerApp entities in bulk.
type DocServerAppCreateBulk struct {
config
err error
builders []*DocServerAppCreate
}
// Save creates the DocServerApp entities in the database.
func (dsacb *DocServerAppCreateBulk) Save(ctx context.Context) ([]*DocServerApp, error) {
if dsacb.err != nil {
return nil, dsacb.err
}
specs := make([]*sqlgraph.CreateSpec, len(dsacb.builders))
nodes := make([]*DocServerApp, len(dsacb.builders))
mutators := make([]Mutator, len(dsacb.builders))
for i := range dsacb.builders {
func(i int, root context.Context) {
builder := dsacb.builders[i]
builder.defaults()
var mut Mutator = MutateFunc(func(ctx context.Context, m Mutation) (Value, error) {
mutation, ok := m.(*DocServerAppMutation)
if !ok {
return nil, fmt.Errorf("unexpected mutation type %T", m)
}
if err := builder.check(); err != nil {
return nil, err
}
builder.mutation = mutation
var err error
nodes[i], specs[i] = builder.createSpec()
if i < len(mutators)-1 {
_, err = mutators[i+1].Mutate(root, dsacb.builders[i+1].mutation)
} else {
spec := &sqlgraph.BatchCreateSpec{Nodes: specs}
// Invoke the actual operation on the latest mutation in the chain.
if err = sqlgraph.BatchCreate(ctx, dsacb.driver, spec); err != nil {
if sqlgraph.IsConstraintError(err) {
err = &ConstraintError{msg: err.Error(), wrap: err}
}
}
}
if err != nil {
return nil, err
}
mutation.id = &nodes[i].ID
if specs[i].ID.Value != nil && nodes[i].ID == 0 {
id := specs[i].ID.Value.(int64)
nodes[i].ID = int32(id)
}
mutation.done = true
return nodes[i], nil
})
for i := len(builder.hooks) - 1; i >= 0; i-- {
mut = builder.hooks[i](mut)
}
mutators[i] = mut
}(i, ctx)
}
if len(mutators) > 0 {
if _, err := mutators[0].Mutate(ctx, dsacb.builders[0].mutation); err != nil {
return nil, err
}
}
return nodes, nil
}
// SaveX is like Save, but panics if an error occurs.
func (dsacb *DocServerAppCreateBulk) SaveX(ctx context.Context) []*DocServerApp {
v, err := dsacb.Save(ctx)
if err != nil {
panic(err)
}
return v
}
// Exec executes the query.
func (dsacb *DocServerAppCreateBulk) Exec(ctx context.Context) error {
_, err := dsacb.Save(ctx)
return err
}
// ExecX is like Exec, but panics if an error occurs.
func (dsacb *DocServerAppCreateBulk) ExecX(ctx context.Context) {
if err := dsacb.Exec(ctx); err != nil {
panic(err)
}
}
// Code generated by ent, DO NOT EDIT.
package serversitemicros
import (
"context"
"convert-server/domain/entity/serversitemicros/docserverapp"
"convert-server/domain/entity/serversitemicros/predicate"
"entgo.io/ent/dialect/sql"
"entgo.io/ent/dialect/sql/sqlgraph"
"entgo.io/ent/schema/field"
)
// DocServerAppDelete is the builder for deleting a DocServerApp entity.
type DocServerAppDelete struct {
config
hooks []Hook
mutation *DocServerAppMutation
}
// Where appends a list predicates to the DocServerAppDelete builder.
func (dsad *DocServerAppDelete) Where(ps ...predicate.DocServerApp) *DocServerAppDelete {
dsad.mutation.Where(ps...)
return dsad
}
// Exec executes the deletion query and returns how many vertices were deleted.
func (dsad *DocServerAppDelete) Exec(ctx context.Context) (int, error) {
return withHooks(ctx, dsad.sqlExec, dsad.mutation, dsad.hooks)
}
// ExecX is like Exec, but panics if an error occurs.
func (dsad *DocServerAppDelete) ExecX(ctx context.Context) int {
n, err := dsad.Exec(ctx)
if err != nil {
panic(err)
}
return n
}
func (dsad *DocServerAppDelete) sqlExec(ctx context.Context) (int, error) {
_spec := sqlgraph.NewDeleteSpec(docserverapp.Table, sqlgraph.NewFieldSpec(docserverapp.FieldID, field.TypeInt32))
if ps := dsad.mutation.predicates; len(ps) > 0 {
_spec.Predicate = func(selector *sql.Selector) {
for i := range ps {
ps[i](selector)
}
}
}
affected, err := sqlgraph.DeleteNodes(ctx, dsad.driver, _spec)
if err != nil && sqlgraph.IsConstraintError(err) {
err = &ConstraintError{msg: err.Error(), wrap: err}
}
dsad.mutation.done = true
return affected, err
}
// DocServerAppDeleteOne is the builder for deleting a single DocServerApp entity.
type DocServerAppDeleteOne struct {
dsad *DocServerAppDelete
}
// Where appends a list predicates to the DocServerAppDelete builder.
func (dsado *DocServerAppDeleteOne) Where(ps ...predicate.DocServerApp) *DocServerAppDeleteOne {
dsado.dsad.mutation.Where(ps...)
return dsado
}
// Exec executes the deletion query.
func (dsado *DocServerAppDeleteOne) Exec(ctx context.Context) error {
n, err := dsado.dsad.Exec(ctx)
switch {
case err != nil:
return err
case n == 0:
return &NotFoundError{docserverapp.Label}
default:
return nil
}
}
// ExecX is like Exec, but panics if an error occurs.
func (dsado *DocServerAppDeleteOne) ExecX(ctx context.Context) {
if err := dsado.Exec(ctx); err != nil {
panic(err)
}
}
This diff is collapsed.
// Code generated by ent, DO NOT EDIT.
package serversitemicros
import (
"context"
"convert-server/domain/entity/serversitemicros/docserverapp"
"convert-server/domain/entity/serversitemicros/predicate"
"errors"
"fmt"
"time"
"entgo.io/ent/dialect/sql"
"entgo.io/ent/dialect/sql/sqlgraph"
"entgo.io/ent/schema/field"
)
// DocServerAppUpdate is the builder for updating DocServerApp entities.
type DocServerAppUpdate struct {
config
hooks []Hook
mutation *DocServerAppMutation
}
// Where appends a list predicates to the DocServerAppUpdate builder.
func (dsau *DocServerAppUpdate) Where(ps ...predicate.DocServerApp) *DocServerAppUpdate {
dsau.mutation.Where(ps...)
return dsau
}
// SetApplication sets the "application" field.
func (dsau *DocServerAppUpdate) SetApplication(s string) *DocServerAppUpdate {
dsau.mutation.SetApplication(s)
return dsau
}
// SetNillableApplication sets the "application" field if the given value is not nil.
func (dsau *DocServerAppUpdate) SetNillableApplication(s *string) *DocServerAppUpdate {
if s != nil {
dsau.SetApplication(*s)
}
return dsau
}
// SetName sets the "name" field.
func (dsau *DocServerAppUpdate) SetName(s string) *DocServerAppUpdate {
dsau.mutation.SetName(s)
return dsau
}
// SetNillableName sets the "name" field if the given value is not nil.
func (dsau *DocServerAppUpdate) SetNillableName(s *string) *DocServerAppUpdate {
if s != nil {
dsau.SetName(*s)
}
return dsau
}
// SetCreatedAt sets the "created_at" field.
func (dsau *DocServerAppUpdate) SetCreatedAt(t time.Time) *DocServerAppUpdate {
dsau.mutation.SetCreatedAt(t)
return dsau
}
// ClearCreatedAt clears the value of the "created_at" field.
func (dsau *DocServerAppUpdate) ClearCreatedAt() *DocServerAppUpdate {
dsau.mutation.ClearCreatedAt()
return dsau
}
// Mutation returns the DocServerAppMutation object of the builder.
func (dsau *DocServerAppUpdate) Mutation() *DocServerAppMutation {
return dsau.mutation
}
// Save executes the query and returns the number of nodes affected by the update operation.
func (dsau *DocServerAppUpdate) Save(ctx context.Context) (int, error) {
if err := dsau.defaults(); err != nil {
return 0, err
}
return withHooks(ctx, dsau.sqlSave, dsau.mutation, dsau.hooks)
}
// SaveX is like Save, but panics if an error occurs.
func (dsau *DocServerAppUpdate) SaveX(ctx context.Context) int {
affected, err := dsau.Save(ctx)
if err != nil {
panic(err)
}
return affected
}
// Exec executes the query.
func (dsau *DocServerAppUpdate) Exec(ctx context.Context) error {
_, err := dsau.Save(ctx)
return err
}
// ExecX is like Exec, but panics if an error occurs.
func (dsau *DocServerAppUpdate) ExecX(ctx context.Context) {
if err := dsau.Exec(ctx); err != nil {
panic(err)
}
}
// defaults sets the default values of the builder before save.
func (dsau *DocServerAppUpdate) defaults() error {
if _, ok := dsau.mutation.CreatedAt(); !ok && !dsau.mutation.CreatedAtCleared() {
if docserverapp.UpdateDefaultCreatedAt == nil {
return fmt.Errorf("serversitemicros: uninitialized docserverapp.UpdateDefaultCreatedAt (forgotten import serversitemicros/runtime?)")
}
v := docserverapp.UpdateDefaultCreatedAt()
dsau.mutation.SetCreatedAt(v)
}
return nil
}
func (dsau *DocServerAppUpdate) sqlSave(ctx context.Context) (n int, err error) {
_spec := sqlgraph.NewUpdateSpec(docserverapp.Table, docserverapp.Columns, sqlgraph.NewFieldSpec(docserverapp.FieldID, field.TypeInt32))
if ps := dsau.mutation.predicates; len(ps) > 0 {
_spec.Predicate = func(selector *sql.Selector) {
for i := range ps {
ps[i](selector)
}
}
}
if value, ok := dsau.mutation.Application(); ok {
_spec.SetField(docserverapp.FieldApplication, field.TypeString, value)
}
if value, ok := dsau.mutation.Name(); ok {
_spec.SetField(docserverapp.FieldName, field.TypeString, value)
}
if value, ok := dsau.mutation.CreatedAt(); ok {
_spec.SetField(docserverapp.FieldCreatedAt, field.TypeTime, value)
}
if dsau.mutation.CreatedAtCleared() {
_spec.ClearField(docserverapp.FieldCreatedAt, field.TypeTime)
}
if n, err = sqlgraph.UpdateNodes(ctx, dsau.driver, _spec); err != nil {
if _, ok := err.(*sqlgraph.NotFoundError); ok {
err = &NotFoundError{docserverapp.Label}
} else if sqlgraph.IsConstraintError(err) {
err = &ConstraintError{msg: err.Error(), wrap: err}
}
return 0, err
}
dsau.mutation.done = true
return n, nil
}
// DocServerAppUpdateOne is the builder for updating a single DocServerApp entity.
type DocServerAppUpdateOne struct {
config
fields []string
hooks []Hook
mutation *DocServerAppMutation
}
// SetApplication sets the "application" field.
func (dsauo *DocServerAppUpdateOne) SetApplication(s string) *DocServerAppUpdateOne {
dsauo.mutation.SetApplication(s)
return dsauo
}
// SetNillableApplication sets the "application" field if the given value is not nil.
func (dsauo *DocServerAppUpdateOne) SetNillableApplication(s *string) *DocServerAppUpdateOne {
if s != nil {
dsauo.SetApplication(*s)
}
return dsauo
}
// SetName sets the "name" field.
func (dsauo *DocServerAppUpdateOne) SetName(s string) *DocServerAppUpdateOne {
dsauo.mutation.SetName(s)
return dsauo
}
// SetNillableName sets the "name" field if the given value is not nil.
func (dsauo *DocServerAppUpdateOne) SetNillableName(s *string) *DocServerAppUpdateOne {
if s != nil {
dsauo.SetName(*s)
}
return dsauo
}
// SetCreatedAt sets the "created_at" field.
func (dsauo *DocServerAppUpdateOne) SetCreatedAt(t time.Time) *DocServerAppUpdateOne {
dsauo.mutation.SetCreatedAt(t)
return dsauo
}
// ClearCreatedAt clears the value of the "created_at" field.
func (dsauo *DocServerAppUpdateOne) ClearCreatedAt() *DocServerAppUpdateOne {
dsauo.mutation.ClearCreatedAt()
return dsauo
}
// Mutation returns the DocServerAppMutation object of the builder.
func (dsauo *DocServerAppUpdateOne) Mutation() *DocServerAppMutation {
return dsauo.mutation
}
// Where appends a list predicates to the DocServerAppUpdate builder.
func (dsauo *DocServerAppUpdateOne) Where(ps ...predicate.DocServerApp) *DocServerAppUpdateOne {
dsauo.mutation.Where(ps...)
return dsauo
}
// Select allows selecting one or more fields (columns) of the returned entity.
// The default is selecting all fields defined in the entity schema.
func (dsauo *DocServerAppUpdateOne) Select(field string, fields ...string) *DocServerAppUpdateOne {
dsauo.fields = append([]string{field}, fields...)
return dsauo
}
// Save executes the query and returns the updated DocServerApp entity.
func (dsauo *DocServerAppUpdateOne) Save(ctx context.Context) (*DocServerApp, error) {
if err := dsauo.defaults(); err != nil {
return nil, err
}
return withHooks(ctx, dsauo.sqlSave, dsauo.mutation, dsauo.hooks)
}
// SaveX is like Save, but panics if an error occurs.
func (dsauo *DocServerAppUpdateOne) SaveX(ctx context.Context) *DocServerApp {
node, err := dsauo.Save(ctx)
if err != nil {
panic(err)
}
return node
}
// Exec executes the query on the entity.
func (dsauo *DocServerAppUpdateOne) Exec(ctx context.Context) error {
_, err := dsauo.Save(ctx)
return err
}
// ExecX is like Exec, but panics if an error occurs.
func (dsauo *DocServerAppUpdateOne) ExecX(ctx context.Context) {
if err := dsauo.Exec(ctx); err != nil {
panic(err)
}
}
// defaults sets the default values of the builder before save.
func (dsauo *DocServerAppUpdateOne) defaults() error {
if _, ok := dsauo.mutation.CreatedAt(); !ok && !dsauo.mutation.CreatedAtCleared() {
if docserverapp.UpdateDefaultCreatedAt == nil {
return fmt.Errorf("serversitemicros: uninitialized docserverapp.UpdateDefaultCreatedAt (forgotten import serversitemicros/runtime?)")
}
v := docserverapp.UpdateDefaultCreatedAt()
dsauo.mutation.SetCreatedAt(v)
}
return nil
}
func (dsauo *DocServerAppUpdateOne) sqlSave(ctx context.Context) (_node *DocServerApp, err error) {
_spec := sqlgraph.NewUpdateSpec(docserverapp.Table, docserverapp.Columns, sqlgraph.NewFieldSpec(docserverapp.FieldID, field.TypeInt32))
id, ok := dsauo.mutation.ID()
if !ok {
return nil, &ValidationError{Name: "id", err: errors.New(`serversitemicros: missing "DocServerApp.id" for update`)}
}
_spec.Node.ID.Value = id
if fields := dsauo.fields; len(fields) > 0 {
_spec.Node.Columns = make([]string, 0, len(fields))
_spec.Node.Columns = append(_spec.Node.Columns, docserverapp.FieldID)
for _, f := range fields {
if !docserverapp.ValidColumn(f) {
return nil, &ValidationError{Name: f, err: fmt.Errorf("serversitemicros: invalid field %q for query", f)}
}
if f != docserverapp.FieldID {
_spec.Node.Columns = append(_spec.Node.Columns, f)
}
}
}
if ps := dsauo.mutation.predicates; len(ps) > 0 {
_spec.Predicate = func(selector *sql.Selector) {
for i := range ps {
ps[i](selector)
}
}
}
if value, ok := dsauo.mutation.Application(); ok {
_spec.SetField(docserverapp.FieldApplication, field.TypeString, value)
}
if value, ok := dsauo.mutation.Name(); ok {
_spec.SetField(docserverapp.FieldName, field.TypeString, value)
}
if value, ok := dsauo.mutation.CreatedAt(); ok {
_spec.SetField(docserverapp.FieldCreatedAt, field.TypeTime, value)
}
if dsauo.mutation.CreatedAtCleared() {
_spec.ClearField(docserverapp.FieldCreatedAt, field.TypeTime)
}
_node = &DocServerApp{config: dsauo.config}
_spec.Assign = _node.assignValues
_spec.ScanValues = _node.scanValues
if err = sqlgraph.UpdateNode(ctx, dsauo.driver, _spec); err != nil {
if _, ok := err.(*sqlgraph.NotFoundError); ok {
err = &NotFoundError{docserverapp.Label}
} else if sqlgraph.IsConstraintError(err) {
err = &ConstraintError{msg: err.Error(), wrap: err}
}
return nil, err
}
dsauo.mutation.done = true
return _node, nil
}
// Code generated by ent, DO NOT EDIT.
package serversitemicros
import (
"convert-server/domain/entity/serversitemicros/docservercallback"
"fmt"
"strings"
"time"
"entgo.io/ent"
"entgo.io/ent/dialect/sql"
)
// DocServerCallback is the model entity for the DocServerCallback schema.
type DocServerCallback struct {
config `json:"-"`
// ID of the ent.
// id
ID int32 `json:"id,omitempty"`
// 创建项目表id
ServerProjectID int32 `json:"server_project_id,omitempty"`
// 业务回调地址
CallbackURL string `json:"callback_url,omitempty"`
// 业务回调参数
CallbackData string `json:"callback_data,omitempty"`
// 业务需要的回调类型,1 回调地址,2 直接改表
CallbackType int8 `json:"callback_type,omitempty"`
// 状态 0 待执行 1 执行成功....
Status int8 `json:"status,omitempty"`
// 执行次数
CurrNum int32 `json:"curr_num,omitempty"`
// CreatedAt holds the value of the "created_at" field.
CreatedAt *time.Time `json:"created_at,omitempty"`
// UpdatedAt holds the value of the "updated_at" field.
UpdatedAt *time.Time `json:"updated_at,omitempty"`
// DeletedAt holds the value of the "deleted_at" field.
DeletedAt *time.Time `json:"deleted_at,omitempty"`
selectValues sql.SelectValues
}
// scanValues returns the types for scanning values from sql.Rows.
func (*DocServerCallback) scanValues(columns []string) ([]any, error) {
values := make([]any, len(columns))
for i := range columns {
switch columns[i] {
case docservercallback.FieldID, docservercallback.FieldServerProjectID, docservercallback.FieldCallbackType, docservercallback.FieldStatus, docservercallback.FieldCurrNum:
values[i] = new(sql.NullInt64)
case docservercallback.FieldCallbackURL, docservercallback.FieldCallbackData:
values[i] = new(sql.NullString)
case docservercallback.FieldCreatedAt, docservercallback.FieldUpdatedAt, docservercallback.FieldDeletedAt:
values[i] = new(sql.NullTime)
default:
values[i] = new(sql.UnknownType)
}
}
return values, nil
}
// assignValues assigns the values that were returned from sql.Rows (after scanning)
// to the DocServerCallback fields.
func (dsc *DocServerCallback) assignValues(columns []string, values []any) error {
if m, n := len(values), len(columns); m < n {
return fmt.Errorf("mismatch number of scan values: %d != %d", m, n)
}
for i := range columns {
switch columns[i] {
case docservercallback.FieldID:
value, ok := values[i].(*sql.NullInt64)
if !ok {
return fmt.Errorf("unexpected type %T for field id", value)
}
dsc.ID = int32(value.Int64)
case docservercallback.FieldServerProjectID:
if value, ok := values[i].(*sql.NullInt64); !ok {
return fmt.Errorf("unexpected type %T for field server_project_id", values[i])
} else if value.Valid {
dsc.ServerProjectID = int32(value.Int64)
}
case docservercallback.FieldCallbackURL:
if value, ok := values[i].(*sql.NullString); !ok {
return fmt.Errorf("unexpected type %T for field callback_url", values[i])
} else if value.Valid {
dsc.CallbackURL = value.String
}
case docservercallback.FieldCallbackData:
if value, ok := values[i].(*sql.NullString); !ok {
return fmt.Errorf("unexpected type %T for field callback_data", values[i])
} else if value.Valid {
dsc.CallbackData = value.String
}
case docservercallback.FieldCallbackType:
if value, ok := values[i].(*sql.NullInt64); !ok {
return fmt.Errorf("unexpected type %T for field callback_type", values[i])
} else if value.Valid {
dsc.CallbackType = int8(value.Int64)
}
case docservercallback.FieldStatus:
if value, ok := values[i].(*sql.NullInt64); !ok {
return fmt.Errorf("unexpected type %T for field status", values[i])
} else if value.Valid {
dsc.Status = int8(value.Int64)
}
case docservercallback.FieldCurrNum:
if value, ok := values[i].(*sql.NullInt64); !ok {
return fmt.Errorf("unexpected type %T for field curr_num", values[i])
} else if value.Valid {
dsc.CurrNum = int32(value.Int64)
}
case docservercallback.FieldCreatedAt:
if value, ok := values[i].(*sql.NullTime); !ok {
return fmt.Errorf("unexpected type %T for field created_at", values[i])
} else if value.Valid {
dsc.CreatedAt = new(time.Time)
*dsc.CreatedAt = value.Time
}
case docservercallback.FieldUpdatedAt:
if value, ok := values[i].(*sql.NullTime); !ok {
return fmt.Errorf("unexpected type %T for field updated_at", values[i])
} else if value.Valid {
dsc.UpdatedAt = new(time.Time)
*dsc.UpdatedAt = value.Time
}
case docservercallback.FieldDeletedAt:
if value, ok := values[i].(*sql.NullTime); !ok {
return fmt.Errorf("unexpected type %T for field deleted_at", values[i])
} else if value.Valid {
dsc.DeletedAt = new(time.Time)
*dsc.DeletedAt = value.Time
}
default:
dsc.selectValues.Set(columns[i], values[i])
}
}
return nil
}
// Value returns the ent.Value that was dynamically selected and assigned to the DocServerCallback.
// This includes values selected through modifiers, order, etc.
func (dsc *DocServerCallback) Value(name string) (ent.Value, error) {
return dsc.selectValues.Get(name)
}
// Update returns a builder for updating this DocServerCallback.
// Note that you need to call DocServerCallback.Unwrap() before calling this method if this DocServerCallback
// was returned from a transaction, and the transaction was committed or rolled back.
func (dsc *DocServerCallback) Update() *DocServerCallbackUpdateOne {
return NewDocServerCallbackClient(dsc.config).UpdateOne(dsc)
}
// Unwrap unwraps the DocServerCallback entity that was returned from a transaction after it was closed,
// so that all future queries will be executed through the driver which created the transaction.
func (dsc *DocServerCallback) Unwrap() *DocServerCallback {
_tx, ok := dsc.config.driver.(*txDriver)
if !ok {
panic("serversitemicros: DocServerCallback is not a transactional entity")
}
dsc.config.driver = _tx.drv
return dsc
}
// String implements the fmt.Stringer.
func (dsc *DocServerCallback) String() string {
var builder strings.Builder
builder.WriteString("DocServerCallback(")
builder.WriteString(fmt.Sprintf("id=%v, ", dsc.ID))
builder.WriteString("server_project_id=")
builder.WriteString(fmt.Sprintf("%v", dsc.ServerProjectID))
builder.WriteString(", ")
builder.WriteString("callback_url=")
builder.WriteString(dsc.CallbackURL)
builder.WriteString(", ")
builder.WriteString("callback_data=")
builder.WriteString(dsc.CallbackData)
builder.WriteString(", ")
builder.WriteString("callback_type=")
builder.WriteString(fmt.Sprintf("%v", dsc.CallbackType))
builder.WriteString(", ")
builder.WriteString("status=")
builder.WriteString(fmt.Sprintf("%v", dsc.Status))
builder.WriteString(", ")
builder.WriteString("curr_num=")
builder.WriteString(fmt.Sprintf("%v", dsc.CurrNum))
builder.WriteString(", ")
if v := dsc.CreatedAt; v != nil {
builder.WriteString("created_at=")
builder.WriteString(v.Format(time.ANSIC))
}
builder.WriteString(", ")
if v := dsc.UpdatedAt; v != nil {
builder.WriteString("updated_at=")
builder.WriteString(v.Format(time.ANSIC))
}
builder.WriteString(", ")
if v := dsc.DeletedAt; v != nil {
builder.WriteString("deleted_at=")
builder.WriteString(v.Format(time.ANSIC))
}
builder.WriteByte(')')
return builder.String()
}
// DocServerCallbacks is a parsable slice of DocServerCallback.
type DocServerCallbacks []*DocServerCallback
// Code generated by ent, DO NOT EDIT.
package docservercallback
import (
"entgo.io/ent"
"entgo.io/ent/dialect/sql"
)
const (
// Label holds the string label denoting the docservercallback type in the database.
Label = "doc_server_callback"
// FieldID holds the string denoting the id field in the database.
FieldID = "id"
// FieldServerProjectID holds the string denoting the server_project_id field in the database.
FieldServerProjectID = "server_project_id"
// FieldCallbackURL holds the string denoting the callback_url field in the database.
FieldCallbackURL = "callback_url"
// FieldCallbackData holds the string denoting the callback_data field in the database.
FieldCallbackData = "callback_data"
// FieldCallbackType holds the string denoting the callback_type field in the database.
FieldCallbackType = "callback_type"
// FieldStatus holds the string denoting the status field in the database.
FieldStatus = "status"
// FieldCurrNum holds the string denoting the curr_num field in the database.
FieldCurrNum = "curr_num"
// FieldCreatedAt holds the string denoting the created_at field in the database.
FieldCreatedAt = "created_at"
// FieldUpdatedAt holds the string denoting the updated_at field in the database.
FieldUpdatedAt = "updated_at"
// FieldDeletedAt holds the string denoting the deleted_at field in the database.
FieldDeletedAt = "deleted_at"
// Table holds the table name of the docservercallback in the database.
Table = "doc_server_callback"
)
// Columns holds all SQL columns for docservercallback fields.
var Columns = []string{
FieldID,
FieldServerProjectID,
FieldCallbackURL,
FieldCallbackData,
FieldCallbackType,
FieldStatus,
FieldCurrNum,
FieldCreatedAt,
FieldUpdatedAt,
FieldDeletedAt,
}
// ValidColumn reports if the column name is valid (part of the table columns).
func ValidColumn(column string) bool {
for i := range Columns {
if column == Columns[i] {
return true
}
}
return false
}
// Note that the variables below are initialized by the runtime
// package on the initialization of the application. Therefore,
// it should be imported in the main as follows:
//
// import _ "convert-server/domain/entity/serversitemicros/runtime"
var (
Hooks [2]ent.Hook
// DefaultServerProjectID holds the default value on creation for the "server_project_id" field.
DefaultServerProjectID int32
// DefaultCallbackURL holds the default value on creation for the "callback_url" field.
DefaultCallbackURL string
// DefaultCallbackData holds the default value on creation for the "callback_data" field.
DefaultCallbackData string
// DefaultCallbackType holds the default value on creation for the "callback_type" field.
DefaultCallbackType int8
// DefaultCurrNum holds the default value on creation for the "curr_num" field.
DefaultCurrNum int32
)
// OrderOption defines the ordering options for the DocServerCallback queries.
type OrderOption func(*sql.Selector)
// ByID orders the results by the id field.
func ByID(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldID, opts...).ToFunc()
}
// ByServerProjectID orders the results by the server_project_id field.
func ByServerProjectID(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldServerProjectID, opts...).ToFunc()
}
// ByCallbackURL orders the results by the callback_url field.
func ByCallbackURL(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldCallbackURL, opts...).ToFunc()
}
// ByCallbackData orders the results by the callback_data field.
func ByCallbackData(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldCallbackData, opts...).ToFunc()
}
// ByCallbackType orders the results by the callback_type field.
func ByCallbackType(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldCallbackType, opts...).ToFunc()
}
// ByStatus orders the results by the status field.
func ByStatus(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldStatus, opts...).ToFunc()
}
// ByCurrNum orders the results by the curr_num field.
func ByCurrNum(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldCurrNum, opts...).ToFunc()
}
// ByCreatedAt orders the results by the created_at field.
func ByCreatedAt(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldCreatedAt, opts...).ToFunc()
}
// ByUpdatedAt orders the results by the updated_at field.
func ByUpdatedAt(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldUpdatedAt, opts...).ToFunc()
}
// ByDeletedAt orders the results by the deleted_at field.
func ByDeletedAt(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldDeletedAt, opts...).ToFunc()
}
This diff is collapsed.
This diff is collapsed.
// Code generated by ent, DO NOT EDIT.
package serversitemicros
import (
"context"
"convert-server/domain/entity/serversitemicros/docservercallback"
"convert-server/domain/entity/serversitemicros/predicate"
"entgo.io/ent/dialect/sql"
"entgo.io/ent/dialect/sql/sqlgraph"
"entgo.io/ent/schema/field"
)
// DocServerCallbackDelete is the builder for deleting a DocServerCallback entity.
type DocServerCallbackDelete struct {
config
hooks []Hook
mutation *DocServerCallbackMutation
}
// Where appends a list predicates to the DocServerCallbackDelete builder.
func (dscd *DocServerCallbackDelete) Where(ps ...predicate.DocServerCallback) *DocServerCallbackDelete {
dscd.mutation.Where(ps...)
return dscd
}
// Exec executes the deletion query and returns how many vertices were deleted.
func (dscd *DocServerCallbackDelete) Exec(ctx context.Context) (int, error) {
return withHooks(ctx, dscd.sqlExec, dscd.mutation, dscd.hooks)
}
// ExecX is like Exec, but panics if an error occurs.
func (dscd *DocServerCallbackDelete) ExecX(ctx context.Context) int {
n, err := dscd.Exec(ctx)
if err != nil {
panic(err)
}
return n
}
func (dscd *DocServerCallbackDelete) sqlExec(ctx context.Context) (int, error) {
_spec := sqlgraph.NewDeleteSpec(docservercallback.Table, sqlgraph.NewFieldSpec(docservercallback.FieldID, field.TypeInt32))
if ps := dscd.mutation.predicates; len(ps) > 0 {
_spec.Predicate = func(selector *sql.Selector) {
for i := range ps {
ps[i](selector)
}
}
}
affected, err := sqlgraph.DeleteNodes(ctx, dscd.driver, _spec)
if err != nil && sqlgraph.IsConstraintError(err) {
err = &ConstraintError{msg: err.Error(), wrap: err}
}
dscd.mutation.done = true
return affected, err
}
// DocServerCallbackDeleteOne is the builder for deleting a single DocServerCallback entity.
type DocServerCallbackDeleteOne struct {
dscd *DocServerCallbackDelete
}
// Where appends a list predicates to the DocServerCallbackDelete builder.
func (dscdo *DocServerCallbackDeleteOne) Where(ps ...predicate.DocServerCallback) *DocServerCallbackDeleteOne {
dscdo.dscd.mutation.Where(ps...)
return dscdo
}
// Exec executes the deletion query.
func (dscdo *DocServerCallbackDeleteOne) Exec(ctx context.Context) error {
n, err := dscdo.dscd.Exec(ctx)
switch {
case err != nil:
return err
case n == 0:
return &NotFoundError{docservercallback.Label}
default:
return nil
}
}
// ExecX is like Exec, but panics if an error occurs.
func (dscdo *DocServerCallbackDeleteOne) ExecX(ctx context.Context) {
if err := dscdo.Exec(ctx); err != nil {
panic(err)
}
}
This diff is collapsed.
This diff is collapsed.
// Code generated by ent, DO NOT EDIT.
package serversitemicros
import (
"convert-server/domain/entity/serversitemicros/docservergetproject"
"fmt"
"strings"
"time"
"entgo.io/ent"
"entgo.io/ent/dialect/sql"
)
// DocServerGetProject is the model entity for the DocServerGetProject schema.
type DocServerGetProject struct {
config `json:"-"`
// ID of the ent.
// id
ID int32 `json:"id,omitempty"`
// 创建项目表id
ServerProjectID int32 `json:"server_project_id,omitempty"`
// 获取项目的次数
CurrNum int32 `json:"curr_num,omitempty"`
// 状态,0 待获取, 1 获取项目成功
Status int8 `json:"status,omitempty"`
// 阿里返回获取项目结果
AliResult *string `json:"ali_result,omitempty"`
// CreatedAt holds the value of the "created_at" field.
CreatedAt *time.Time `json:"created_at,omitempty"`
// UpdatedAt holds the value of the "updated_at" field.
UpdatedAt *time.Time `json:"updated_at,omitempty"`
selectValues sql.SelectValues
}
// scanValues returns the types for scanning values from sql.Rows.
func (*DocServerGetProject) scanValues(columns []string) ([]any, error) {
values := make([]any, len(columns))
for i := range columns {
switch columns[i] {
case docservergetproject.FieldID, docservergetproject.FieldServerProjectID, docservergetproject.FieldCurrNum, docservergetproject.FieldStatus:
values[i] = new(sql.NullInt64)
case docservergetproject.FieldAliResult:
values[i] = new(sql.NullString)
case docservergetproject.FieldCreatedAt, docservergetproject.FieldUpdatedAt:
values[i] = new(sql.NullTime)
default:
values[i] = new(sql.UnknownType)
}
}
return values, nil
}
// assignValues assigns the values that were returned from sql.Rows (after scanning)
// to the DocServerGetProject fields.
func (dsgp *DocServerGetProject) assignValues(columns []string, values []any) error {
if m, n := len(values), len(columns); m < n {
return fmt.Errorf("mismatch number of scan values: %d != %d", m, n)
}
for i := range columns {
switch columns[i] {
case docservergetproject.FieldID:
value, ok := values[i].(*sql.NullInt64)
if !ok {
return fmt.Errorf("unexpected type %T for field id", value)
}
dsgp.ID = int32(value.Int64)
case docservergetproject.FieldServerProjectID:
if value, ok := values[i].(*sql.NullInt64); !ok {
return fmt.Errorf("unexpected type %T for field server_project_id", values[i])
} else if value.Valid {
dsgp.ServerProjectID = int32(value.Int64)
}
case docservergetproject.FieldCurrNum:
if value, ok := values[i].(*sql.NullInt64); !ok {
return fmt.Errorf("unexpected type %T for field curr_num", values[i])
} else if value.Valid {
dsgp.CurrNum = int32(value.Int64)
}
case docservergetproject.FieldStatus:
if value, ok := values[i].(*sql.NullInt64); !ok {
return fmt.Errorf("unexpected type %T for field status", values[i])
} else if value.Valid {
dsgp.Status = int8(value.Int64)
}
case docservergetproject.FieldAliResult:
if value, ok := values[i].(*sql.NullString); !ok {
return fmt.Errorf("unexpected type %T for field ali_result", values[i])
} else if value.Valid {
dsgp.AliResult = new(string)
*dsgp.AliResult = value.String
}
case docservergetproject.FieldCreatedAt:
if value, ok := values[i].(*sql.NullTime); !ok {
return fmt.Errorf("unexpected type %T for field created_at", values[i])
} else if value.Valid {
dsgp.CreatedAt = new(time.Time)
*dsgp.CreatedAt = value.Time
}
case docservergetproject.FieldUpdatedAt:
if value, ok := values[i].(*sql.NullTime); !ok {
return fmt.Errorf("unexpected type %T for field updated_at", values[i])
} else if value.Valid {
dsgp.UpdatedAt = new(time.Time)
*dsgp.UpdatedAt = value.Time
}
default:
dsgp.selectValues.Set(columns[i], values[i])
}
}
return nil
}
// Value returns the ent.Value that was dynamically selected and assigned to the DocServerGetProject.
// This includes values selected through modifiers, order, etc.
func (dsgp *DocServerGetProject) Value(name string) (ent.Value, error) {
return dsgp.selectValues.Get(name)
}
// Update returns a builder for updating this DocServerGetProject.
// Note that you need to call DocServerGetProject.Unwrap() before calling this method if this DocServerGetProject
// was returned from a transaction, and the transaction was committed or rolled back.
func (dsgp *DocServerGetProject) Update() *DocServerGetProjectUpdateOne {
return NewDocServerGetProjectClient(dsgp.config).UpdateOne(dsgp)
}
// Unwrap unwraps the DocServerGetProject entity that was returned from a transaction after it was closed,
// so that all future queries will be executed through the driver which created the transaction.
func (dsgp *DocServerGetProject) Unwrap() *DocServerGetProject {
_tx, ok := dsgp.config.driver.(*txDriver)
if !ok {
panic("serversitemicros: DocServerGetProject is not a transactional entity")
}
dsgp.config.driver = _tx.drv
return dsgp
}
// String implements the fmt.Stringer.
func (dsgp *DocServerGetProject) String() string {
var builder strings.Builder
builder.WriteString("DocServerGetProject(")
builder.WriteString(fmt.Sprintf("id=%v, ", dsgp.ID))
builder.WriteString("server_project_id=")
builder.WriteString(fmt.Sprintf("%v", dsgp.ServerProjectID))
builder.WriteString(", ")
builder.WriteString("curr_num=")
builder.WriteString(fmt.Sprintf("%v", dsgp.CurrNum))
builder.WriteString(", ")
builder.WriteString("status=")
builder.WriteString(fmt.Sprintf("%v", dsgp.Status))
builder.WriteString(", ")
if v := dsgp.AliResult; v != nil {
builder.WriteString("ali_result=")
builder.WriteString(*v)
}
builder.WriteString(", ")
if v := dsgp.CreatedAt; v != nil {
builder.WriteString("created_at=")
builder.WriteString(v.Format(time.ANSIC))
}
builder.WriteString(", ")
if v := dsgp.UpdatedAt; v != nil {
builder.WriteString("updated_at=")
builder.WriteString(v.Format(time.ANSIC))
}
builder.WriteByte(')')
return builder.String()
}
// DocServerGetProjects is a parsable slice of DocServerGetProject.
type DocServerGetProjects []*DocServerGetProject
// Code generated by ent, DO NOT EDIT.
package docservergetproject
import (
"entgo.io/ent/dialect/sql"
)
const (
// Label holds the string label denoting the docservergetproject type in the database.
Label = "doc_server_get_project"
// FieldID holds the string denoting the id field in the database.
FieldID = "id"
// FieldServerProjectID holds the string denoting the server_project_id field in the database.
FieldServerProjectID = "server_project_id"
// FieldCurrNum holds the string denoting the curr_num field in the database.
FieldCurrNum = "curr_num"
// FieldStatus holds the string denoting the status field in the database.
FieldStatus = "status"
// FieldAliResult holds the string denoting the ali_result field in the database.
FieldAliResult = "ali_result"
// FieldCreatedAt holds the string denoting the created_at field in the database.
FieldCreatedAt = "created_at"
// FieldUpdatedAt holds the string denoting the updated_at field in the database.
FieldUpdatedAt = "updated_at"
// Table holds the table name of the docservergetproject in the database.
Table = "doc_server_get_project"
)
// Columns holds all SQL columns for docservergetproject fields.
var Columns = []string{
FieldID,
FieldServerProjectID,
FieldCurrNum,
FieldStatus,
FieldAliResult,
FieldCreatedAt,
FieldUpdatedAt,
}
// ValidColumn reports if the column name is valid (part of the table columns).
func ValidColumn(column string) bool {
for i := range Columns {
if column == Columns[i] {
return true
}
}
return false
}
var (
// DefaultServerProjectID holds the default value on creation for the "server_project_id" field.
DefaultServerProjectID int32
// DefaultCurrNum holds the default value on creation for the "curr_num" field.
DefaultCurrNum int32
// AliResultValidator is a validator for the "ali_result" field. It is called by the builders before save.
AliResultValidator func(string) error
)
// OrderOption defines the ordering options for the DocServerGetProject queries.
type OrderOption func(*sql.Selector)
// ByID orders the results by the id field.
func ByID(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldID, opts...).ToFunc()
}
// ByServerProjectID orders the results by the server_project_id field.
func ByServerProjectID(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldServerProjectID, opts...).ToFunc()
}
// ByCurrNum orders the results by the curr_num field.
func ByCurrNum(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldCurrNum, opts...).ToFunc()
}
// ByStatus orders the results by the status field.
func ByStatus(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldStatus, opts...).ToFunc()
}
// ByAliResult orders the results by the ali_result field.
func ByAliResult(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldAliResult, opts...).ToFunc()
}
// ByCreatedAt orders the results by the created_at field.
func ByCreatedAt(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldCreatedAt, opts...).ToFunc()
}
// ByUpdatedAt orders the results by the updated_at field.
func ByUpdatedAt(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldUpdatedAt, opts...).ToFunc()
}
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
// Code generated by ent, DO NOT EDIT.
package migrate
import (
"context"
"fmt"
"io"
"entgo.io/ent/dialect"
"entgo.io/ent/dialect/sql/schema"
)
var (
// WithGlobalUniqueID sets the universal ids options to the migration.
// If this option is enabled, ent migration will allocate a 1<<32 range
// for the ids of each entity (table).
// Note that this option cannot be applied on tables that already exist.
WithGlobalUniqueID = schema.WithGlobalUniqueID
// WithDropColumn sets the drop column option to the migration.
// If this option is enabled, ent migration will drop old columns
// that were used for both fields and edges. This defaults to false.
WithDropColumn = schema.WithDropColumn
// WithDropIndex sets the drop index option to the migration.
// If this option is enabled, ent migration will drop old indexes
// that were defined in the schema. This defaults to false.
// Note that unique constraints are defined using `UNIQUE INDEX`,
// and therefore, it's recommended to enable this option to get more
// flexibility in the schema changes.
WithDropIndex = schema.WithDropIndex
// WithForeignKeys enables creating foreign-key in schema DDL. This defaults to true.
WithForeignKeys = schema.WithForeignKeys
)
// Schema is the API for creating, migrating and dropping a schema.
type Schema struct {
drv dialect.Driver
}
// NewSchema creates a new schema client.
func NewSchema(drv dialect.Driver) *Schema { return &Schema{drv: drv} }
// Create creates all schema resources.
func (s *Schema) Create(ctx context.Context, opts ...schema.MigrateOption) error {
return Create(ctx, s, Tables, opts...)
}
// Create creates all table resources using the given schema driver.
func Create(ctx context.Context, s *Schema, tables []*schema.Table, opts ...schema.MigrateOption) error {
migrate, err := schema.NewMigrate(s.drv, opts...)
if err != nil {
return fmt.Errorf("ent/migrate: %w", err)
}
return migrate.Create(ctx, tables...)
}
// WriteTo writes the schema changes to w instead of running them against the database.
//
// if err := client.Schema.WriteTo(context.Background(), os.Stdout); err != nil {
// log.Fatal(err)
// }
func (s *Schema) WriteTo(ctx context.Context, w io.Writer, opts ...schema.MigrateOption) error {
return Create(ctx, &Schema{drv: &schema.WriteDriver{Writer: w, Driver: s.drv}}, Tables, opts...)
}
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
// Code generated by ent, DO NOT EDIT.
package serversitemicros
// The schema-stitching logic is generated in convert-server/domain/entity/serversitemicros/runtime/runtime.go
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
package schema
// Edges for all tables
\ No newline at end of file
package schema
// table JSON types
This diff is collapsed.
This diff is collapsed.
## 数据库操作封装目录
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
### Hello 测试
GET {{host}}/hello
\ No newline at end of file
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
[ INFO ] 16:50:19.834939 conversionService.go:156: 创建任务succ:map[body:map[EventId:2DC-1txXfn7Vd3SUkRadFVEsq0o1p9G RequestId:F611CE01-FD79-585C-B3B5-DD44E60A131A TaskId:OfficeConversion-2b3b32a4-033f-4fba-bcb7-191f9df8c551] headers:map[access-control-allow-origin:* access-control-expose-headers:* connection:keep-alive content-length:161 content-type:application/json;charset=utf-8 date:Thu, 15 Aug 2024 08:50:19 GMT etag:15p6OoFh7hHLTpWDrXBZcyg1 keep-alive:timeout=25 x-acs-request-id:F611CE01-FD79-585C-B3B5-DD44E60A131A x-acs-trace-id:7a7b3eef9a4a0f63623e092a5552e601] statusCode:200]
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment