feat: 新增 AgvPoint 点位表及客户端,支持点位编码与接驳台绑定

This commit is contained in:
SunYF
2026-11-03 10:17:49 +08:00
parent fd2f0e2767
commit 2ccf9bb9ca
62 changed files with 5501 additions and 238 deletions
+30 -1
View File
@@ -4,6 +4,8 @@ package ent
import (
"context"
stdsql "database/sql"
"fmt"
"sync"
"entgo.io/ent/dialect"
@@ -12,6 +14,8 @@ import (
// Tx is a transactional client that is created by calling Client.Tx().
type Tx struct {
config
// AgvPoint is the client for interacting with the AgvPoint builders.
AgvPoint *AgvPointClient
// AgvTask is the client for interacting with the AgvTask builders.
AgvTask *AgvTaskClient
// Alert is the client for interacting with the Alert builders.
@@ -219,6 +223,7 @@ func (tx *Tx) Client() *Client {
}
func (tx *Tx) init() {
tx.AgvPoint = NewAgvPointClient(tx.config)
tx.AgvTask = NewAgvTaskClient(tx.config)
tx.Alert = NewAlertClient(tx.config)
tx.AlertRule = NewAlertRuleClient(tx.config)
@@ -266,7 +271,7 @@ func (tx *Tx) init() {
// of them in order to commit or rollback the transaction.
//
// If a closed transaction is embedded in one of the generated entities, and the entity
// applies a query, for example: AgvTask.QueryXXX(), the query will be executed
// applies a query, for example: AgvPoint.QueryXXX(), the query will be executed
// through the driver which created this transaction.
//
// Note that txDriver is not goroutine safe.
@@ -319,3 +324,27 @@ func (tx *txDriver) Query(ctx context.Context, query string, args, v any) error
}
var _ dialect.Driver = (*txDriver)(nil)
// ExecContext allows calling the underlying ExecContext method of the transaction if it is supported by it.
// See, database/sql#Tx.ExecContext for more information.
func (tx *txDriver) ExecContext(ctx context.Context, query string, args ...any) (stdsql.Result, error) {
ex, ok := tx.tx.(interface {
ExecContext(context.Context, string, ...any) (stdsql.Result, error)
})
if !ok {
return nil, fmt.Errorf("Tx.ExecContext is not supported")
}
return ex.ExecContext(ctx, query, args...)
}
// QueryContext allows calling the underlying QueryContext method of the transaction if it is supported by it.
// See, database/sql#Tx.QueryContext for more information.
func (tx *txDriver) QueryContext(ctx context.Context, query string, args ...any) (*stdsql.Rows, error) {
q, ok := tx.tx.(interface {
QueryContext(context.Context, string, ...any) (*stdsql.Rows, error)
})
if !ok {
return nil, fmt.Errorf("Tx.QueryContext is not supported")
}
return q.QueryContext(ctx, query, args...)
}