Documentation
¶
Overview ¶
Application scenarios: - Define the distributed transaction contract used by business orchestration flows. - Support SAGA, TCC, XA, and barrier-style transaction coordination behind one abstraction. - Keep DTM client and transaction configuration provider-neutral.
适用场景: - 定义业务编排流程使用的分布式事务契约。 - 在统一抽象下支持 SAGA、TCC、XA 和 barrier 风格的事务协调。 - 保持 DTM client 和事务配置与具体 provider 解耦。
Application scenarios: - Hold the shared transaction models used by distributed transaction implementations. - Standardize transaction inspection, branch configuration, and SAGA step descriptions. - Keep transaction-related DTOs reusable across providers and tooling.
适用场景: - 承载分布式事务实现共享的事务模型。 - 统一事务查询、分支配置和 SAGA 步骤描述。 - 让事务相关 DTO 可在 provider 和工具链之间复用。
Application scenarios: - Define the in-process event contract shared by publishers, subscribers, and event buses. - Standardize event payload, occurrence time, and handler signatures. - Keep event-driven integration points framework-neutral.
适用场景: - 定义发布者、订阅者和事件总线共享的进程内事件契约。 - 统一事件载荷、发生时间和处理器签名。 - 保持事件驱动集成点与具体实现解耦。
Application scenarios: - Define the message queue contract shared by asynchronous integration features. - Standardize publish, subscribe, delayed delivery, priority, and consumer semantics. - Provide one reusable config and option model across MQ backends.
适用场景: - 定义异步集成功能共享的消息队列契约。 - 统一发布、订阅、延迟投递、优先级和消费语义。 - 为不同 MQ 后端提供统一的配置和选项模型。
Application scenarios: - Define the outbox contract used for reliable event/message delivery. - Standardize pending, sent, failed, and retrying message lifecycle states. - Keep outbox storage, sender, and processing abstractions provider-neutral.
适用场景: - 定义可靠消息投递使用的 outbox 契约。 - 统一 pending、sent、failed 和 retrying 的消息生命周期状态。 - 保持 outbox 存储、发送器和处理流程与具体 provider 解耦。
Application scenarios: - Define the proto generation contract used by code generation and route/service export flows. - Support generating proto definitions from proto files, services, and route declarations. - Provide one shared config and option model for generator implementations.
适用场景: - 定义代码生成和路由/服务导出流程使用的 proto 生成契约。 - 支持从 proto 文件、服务定义和路由声明生成 proto。 - 为生成器实现提供统一配置与选项模型。
Application scenarios: - Hold the shared AST-like models used during proto generation. - Standardize service, method, type, field, enum, route, and import descriptions. - Keep generator implementations and tooling aligned on one reusable model layer.
适用场景: - 承载 proto 生成过程中共享的类 AST 模型。 - 统一 service、method、type、field、enum、route 和 import 描述。 - 让生成器实现与工具链共享同一层可复用模型。
Application scenarios: - Define the SSH integration contract used by deployment, ops, or remote execution features. - Keep SSH client/session access provider-neutral while allowing native-client escape hatches. - Standardize host-level SSH client lookup and command execution semantics.
适用场景: - 定义部署、运维或远程执行功能使用的 SSH 集成契约。 - 保持 SSH client/session 访问与具体 provider 解耦,同时保留 native client 下探能力。 - 统一按主机名获取 SSH client 与执行命令的语义。
Index ¶
- Constants
- type BarrierHandler
- type BranchOptions
- type ClientGenOptions
- type DTMClient
- type DTMConfig
- type EnumValue
- type Event
- type EventBus
- type EventHandler
- type EventPublisher
- type EventSubscriber
- type FieldDef
- type HTTPRule
- type ImportDef
- type Message
- type MessageHandler
- type MessagePublisher
- type MessageQueue
- type MessageQueueConfig
- type MessageSubscriber
- type MethodDef
- type NativeMQClientProvider
- type NativePublisherProvider
- type NativeSSHClient
- type NativeSubscriberProvider
- type Outbox
- type OutboxConfig
- type OutboxMessage
- type OutboxSender
- type OutboxStatus
- type OutboxStore
- type ProtoGenOptions
- type ProtoGenerator
- type ProtoGeneratorConfig
- type PublishConfig
- type PublishOption
- type RouteDef
- type RouteToProtoOptions
- type SAGABuilder
- type SAGAStep
- type SAGATransaction
- type SSHClient
- type SSHService
- type SSHSession
- type ServiceDef
- type ServiceGenOptions
- type ServiceToProtoOptions
- type TCCBuilder
- type TransactionInfo
- type TransactionStep
- type TypeDef
- type UnsubscribeFunc
- type ValidationRule
- type XABuilder
Constants ¶
const ( MessageQueueKey = "framework.message_queue" MessagePublisherKey = "framework.message_publisher" MessageSubscriberKey = "framework.message_subscriber" )
const DTMKey = "framework.dtm"
DTMKey is the container key for the distributed transaction capability.
DTMKey 是分布式事务能力的容器键。
const EventKey = "framework.event"
EventKey is the container key for the event bus capability.
EventKey 是事件总线能力的容器键。
const OutboxKey = "framework.outbox"
OutboxKey is the container key for the outbox capability.
OutboxKey 是 outbox 能力的容器键。
const ProtoGeneratorKey = "framework.proto.generator"
ProtoGeneratorKey is the container key for the proto generator capability.
ProtoGeneratorKey 是 proto generator 能力的容器键。
const SSHKey = "framework.ssh"
SSHKey is the container key for the SSH capability.
SSHKey 是 SSH 能力的容器键。
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BarrierHandler ¶
BarrierHandler defines the transaction barrier execution contract.
BarrierHandler 定义事务屏障执行契约。
type BranchOptions ¶
BranchOptions describes branch-level retry and timeout settings.
BranchOptions 描述分支级重试和超时设置。
type ClientGenOptions ¶
type ClientGenOptions struct {
// ProtoFile is the path to the proto file to parse.
// ProtoFile 是要解析的 proto 文件路径。
ProtoFile string
// OutputFile is the path to write the generated Go client wrapper.
// OutputFile 是写入生成的 Go 客户端 wrapper 的路径。
OutputFile string
// PackageName is the Go package name for the generated file.
// PackageName 是生成文件的 Go package 名。
PackageName string
// ImportPaths are additional import paths for proto resolution.
// ImportPaths 是 proto 解析的额外 import 路径。
ImportPaths []string
// ServiceName specifies which service to generate client for.
// Empty means generate for all services in the proto file.
// ServiceName 指定要生成客户端的服务。
// 空表示为 proto 文件中的所有服务生成。
ServiceName string
// ClientPrefix is the prefix for generated client struct names.
// Default is service name without "Service" suffix.
// ClientPrefix 是生成的客户端 struct 名前缀。
// 默认是去掉 "Service" 后缀的服务名。
ClientPrefix string
// UseGovernance indicates whether to inject governance middleware comments.
// UseGovernance 表示是否注入治理中间件注释。
UseGovernance bool
}
ClientGenOptions describes typed RPC client wrapper generation options.
ClientGenOptions 描述类型化 RPC 客户端 wrapper 生成的选项。
type DTMClient ¶
type DTMClient interface {
SAGA(name string) SAGABuilder
TCC(name string) TCCBuilder
XA(name string) XABuilder
Barrier(transType, gid string) BarrierHandler
Query(ctx context.Context, gid string) (*TransactionInfo, error)
}
DTMClient defines the distributed transaction client contract.
DTMClient 定义分布式事务客户端契约。
type DTMConfig ¶
type DTMConfig struct {
Enabled bool
Endpoint string
Timeout int
RetryCount int
RetryInterval int
CallbackPort int
CallbackAddress string
}
DTMConfig describes distributed transaction runtime configuration.
DTMConfig 描述分布式事务运行时配置。
type EventBus ¶
type EventBus interface {
EventSubscriber
EventPublisher
}
EventBus combines publishing and subscription capabilities.
EventBus 组合发布和订阅能力。
type EventPublisher ¶
type EventPublisher interface {
Publish(ctx context.Context, event Event) error
PublishAsync(ctx context.Context, event Event) error
}
EventPublisher defines the event publishing contract.
EventPublisher 定义事件发布契约。
type EventSubscriber ¶
type EventSubscriber interface {
Subscribe(eventName string, handler EventHandler)
}
EventSubscriber defines the event subscription contract.
EventSubscriber 定义事件订阅契约。
type FieldDef ¶
type FieldDef struct {
Name string
JSONName string
ProtoName string
Type *TypeDef
Tag string
Remark string
Comments []string
ProtoNumber int
ValidationRules []ValidationRule
DefaultValue string
IsOptional bool
}
FieldDef describes one field definition.
FieldDef 描述一个字段定义。
type HTTPRule ¶
type HTTPRule struct {
Method string
Path string
Body string
ResponseBody string
AdditionalBindings []*HTTPRule
}
HTTPRule describes one HTTP binding rule.
HTTPRule 描述一条 HTTP 绑定规则。
type Message ¶
type Message struct {
ID string
Topic string
Queue string
Body []byte
Headers map[string]string
Timestamp time.Time
Delay time.Duration
Priority int
RetryCount int
MaxRetry int
}
Message describes one queue message.
Message 描述一条队列消息。
type MessagePublisher ¶
type MessagePublisher interface {
Publish(ctx context.Context, topic string, message []byte, options ...PublishOption) error
PublishWithDelay(ctx context.Context, topic string, message []byte, delay time.Duration) error
PublishWithPriority(ctx context.Context, topic string, message []byte, priority int) error
Send(ctx context.Context, queue string, message []byte, options ...PublishOption) error
}
MessagePublisher defines the outbound message publishing contract.
MessagePublisher 定义出站消息发布契约。
type MessageQueue ¶
type MessageQueue interface {
Publisher() MessagePublisher
Subscriber() MessageSubscriber
Close() error
}
MessageQueue combines publisher and subscriber capabilities.
MessageQueue 组合消息发布与订阅能力。
type MessageQueueConfig ¶
type MessageQueueConfig struct {
Type string
// Redis configuration
RedisAddr string
RedisPassword string
RedisDB int
// Kafka configuration (using IBM/sarama SDK)
KafkaBrokers []string
KafkaGroupID string
KafkaClientID string
KafkaVersion string // e.g., "2.8.0"
KafkaCompression string // "none", "gzip", "snappy", "lz4", "zstd"
KafkaPartitioner string // "hash", "random", "round-robin"
KafkaRequiredACKs int // 0=NoResponse, 1=Leader, -1=All
KafkaMaxMessageBytes int
KafkaFlushFrequency time.Duration
KafkaEnableTLS bool
KafkaTLSCertFile string
KafkaTLSKeyFile string
KafkaTLSCACertFile string
// RabbitMQ configuration (using amqp091-go SDK)
RabbitMQURL string // "amqp://guest:guest@localhost:5672/"
RabbitMQVHost string
RabbitMQExchange string
RabbitMQExchangeType string // "direct", "fanout", "topic", "headers"
RabbitMQQueuePrefix string
RabbitMQPrefetch int
RabbitMQEnableTLS bool
// RocketMQ configuration (using apache/rocketmq-client-go SDK)
RocketMQNamesrvAddr string // "localhost:9876"
RocketMQGroupName string
RocketMQInstanceName string
RocketMQRetryTimes int
RocketMQEnableTLS bool
// Common configuration
MaxRetry int
RetryDelay time.Duration
Timeout time.Duration
ConsumerBuffer int
}
MessageQueueConfig describes message queue runtime configuration.
MessageQueueConfig 描述消息队列运行时配置。
type MessageSubscriber ¶
type MessageSubscriber interface {
Subscribe(ctx context.Context, topic string, handler MessageHandler) (UnsubscribeFunc, error)
SubscribeWithGroup(ctx context.Context, topic string, group string, handler MessageHandler) (UnsubscribeFunc, error)
Consume(ctx context.Context, queue string, handler MessageHandler) error
Unsubscribe() error
}
MessageSubscriber defines the inbound message consumption contract.
MessageSubscriber 定义入站消息消费契约。
type MethodDef ¶
type MethodDef struct {
Name string
RequestType *TypeDef
ResponseType *TypeDef
Comments []string
HTTPRule *HTTPRule
RequestStream bool
ResponseStream bool
}
MethodDef describes one service method definition.
MethodDef 描述一个服务方法定义。
type NativeMQClientProvider ¶
type NativeMQClientProvider interface {
// NativeMQClient returns the underlying MQ client instance.
// The concrete type depends on the implementation:
// - redis: *redis.Client
// - kafka: sarama.Client
// - rabbitmq: *amqp.Connection
// - rocketmq: rocketmq.Producer or rocketmq.Consumer
//
// NativeMQClient 返回底层 MQ 客户端实例。
// 具体类型取决于实现。
NativeMQClient() any
}
NativeMQClientProvider is an optional interface that MessageQueue implementations can satisfy to expose the underlying native MQ client for advanced usage. This allows "MQ-first" users to access native SDK capabilities while staying within the framework's governance boundary.
NativeMQClientProvider 是 MessageQueue 实现可满足的可选接口, 用于暴露底层原生 MQ 客户端供高级使用。 这允许"MQ-first"用户访问原生 SDK 能力,同时保持在框架的治理边界内。
type NativePublisherProvider ¶
type NativePublisherProvider interface {
// NativePublisher returns the underlying native publisher.
// The concrete type depends on the implementation:
// - redis: *redis.Client
// - kafka: sarama.SyncProducer or sarama.AsyncProducer
// - rabbitmq: *amqp.Channel
// - rocketmq: rocketmq.Producer
NativePublisher() any
}
NativePublisherProvider is an optional interface for accessing the underlying native publisher client.
NativePublisherProvider 是访问底层原生发布者客户端的可选接口。
type NativeSSHClient ¶
NativeSSHClient exposes the underlying native ssh.Client when available.
NativeSSHClient 在可用时暴露底层原生 ssh.Client。
type NativeSubscriberProvider ¶
type NativeSubscriberProvider interface {
// NativeSubscriber returns the underlying native subscriber.
// The concrete type depends on the implementation:
// - redis: *redis.PubSub
// - kafka: sarama.ConsumerGroup
// - rabbitmq: *amqp.Channel
// - rocketmq: rocketmq.PushConsumer or rocketmq.PullConsumer
NativeSubscriber() any
}
NativeSubscriberProvider is an optional interface for accessing the underlying native subscriber client.
NativeSubscriberProvider 是访问底层原生订阅者客户端的可选接口。
type Outbox ¶
type Outbox interface {
Emit(ctx context.Context, topic string, payload interface{}) error
EmitSync(ctx context.Context, topic string, payload interface{}) error
Process(ctx context.Context) error
}
Outbox defines the reliable message emit/process contract.
Outbox 定义可靠消息发射/处理契约。
type OutboxConfig ¶
OutboxConfig describes outbox runtime configuration.
OutboxConfig 描述 outbox 运行时配置。
type OutboxMessage ¶
type OutboxMessage struct {
ID string
Topic string
Payload interface{}
Status OutboxStatus
RetryCount int
CreatedAt time.Time
SentAt *time.Time
Error string
}
OutboxMessage describes one stored outbox message.
OutboxMessage 描述一条已存储的 outbox 消息。
type OutboxSender ¶
type OutboxSender interface {
Send(ctx context.Context, msg *OutboxMessage) error
}
OutboxSender defines the send contract for one outbox message.
OutboxSender 定义单条 outbox 消息的发送契约。
type OutboxStatus ¶
type OutboxStatus string
OutboxStatus describes the lifecycle status of one outbox message.
OutboxStatus 描述 outbox 消息的生命周期状态。
const ( OutboxStatusPending OutboxStatus = "pending" OutboxStatusSent OutboxStatus = "sent" OutboxStatusFailed OutboxStatus = "failed" OutboxStatusRetrying OutboxStatus = "retrying" )
type OutboxStore ¶
type OutboxStore interface {
Save(ctx context.Context, msg *OutboxMessage) error
GetPending(ctx context.Context, limit int) ([]*OutboxMessage, error)
MarkSent(ctx context.Context, id string) error
MarkFailed(ctx context.Context, id string, err error) error
}
OutboxStore defines the storage contract for outbox messages.
OutboxStore 定义 outbox 消息存储契约。
type ProtoGenOptions ¶
type ProtoGenOptions struct {
ProtoFiles []string
ProtoDir string
OutputDir string
IncludeHTTP bool
Plugins []string
ImportPaths []string
GoOpt string
GoGrpcOpt string
GatewayOpt string
CustomPlugins map[string]string
JavaPackage string
CsharpNamespace string
}
ProtoGenOptions describes generation from proto files.
ProtoGenOptions 描述从 proto 文件生成时的选项。
type ProtoGenerator ¶
type ProtoGenerator interface {
GenFromProto(ctx context.Context, opts ProtoGenOptions) error
GenFromService(ctx context.Context, opts ServiceToProtoOptions) error
GenFromRoute(ctx context.Context, opts RouteToProtoOptions) error
// GenClient generates typed RPC client wrapper from proto file.
// The generated wrapper provides type-safe method calls using the framework's RPCClient.
//
// GenClient 从 proto 文件生成类型化 RPC 客户端 wrapper。
// 生成的 wrapper 使用框架的 RPCClient 提供类型安全的方法调用。
GenClient(ctx context.Context, opts ClientGenOptions) error
// GenService generates HTTP handler, gRPC service skeleton and route registration from proto file.
// Enables proto-first workflow: proto → service implementation skeleton.
//
// GenService 从 proto 文件生成 HTTP handler、gRPC service skeleton 和路由注册。
// 支持闭环 proto-first 工作流:proto → 服务实现骨架。
GenService(ctx context.Context, opts ServiceGenOptions) error
}
ProtoGenerator defines the proto generation contract.
ProtoGenerator 定义 proto 生成契约。
type ProtoGeneratorConfig ¶
type ProtoGeneratorConfig struct {
Enabled bool
Strategy string
DefaultProtoDir string
DefaultOutputDir string
IncludeHTTPAnnotation bool
ThirdPartyPaths []string
}
ProtoGeneratorConfig describes proto generation runtime configuration.
ProtoGeneratorConfig 描述 proto 生成运行时配置。
type PublishConfig ¶
type PublishConfig struct {
Delay time.Duration
Priority int
Headers map[string]string
MaxRetry int
TTL time.Duration
}
PublishConfig describes message publishing options.
PublishConfig 描述消息发布选项。
type PublishOption ¶
type PublishOption func(*PublishConfig)
PublishOption mutates publish config.
PublishOption 用于修改发布配置。
func WithDelay ¶
func WithDelay(delay time.Duration) PublishOption
WithDelay sets message publish delay.
WithDelay 设置消息发布延迟。
func WithHeaders ¶
func WithHeaders(headers map[string]string) PublishOption
WithHeaders sets custom message headers.
WithHeaders 设置自定义消息头。
func WithMaxRetry ¶
func WithMaxRetry(maxRetry int) PublishOption
WithMaxRetry sets the message retry limit.
WithMaxRetry 设置消息最大重试次数。
func WithPriority ¶
func WithPriority(priority int) PublishOption
WithPriority sets message priority.
WithPriority 设置消息优先级。
func WithTTL ¶
func WithTTL(ttl time.Duration) PublishOption
WithTTL sets the message time-to-live.
WithTTL 设置消息生存时间。
type RouteDef ¶
type RouteDef struct {
Method string
Path string
HandlerName string
RequestType *TypeDef
ResponseType *TypeDef
Comments []string
HandlerFile string
}
RouteDef describes one route-to-proto mapping definition.
RouteDef 描述一条路由到 proto 的映射定义。
type RouteToProtoOptions ¶
type RouteToProtoOptions struct {
RouteFile string
HandlerFile string
OutputPath string
Package string
GoPackage string
ServiceName string
BasePath string
ImportPaths []string
}
RouteToProtoOptions describes generation from route declarations.
RouteToProtoOptions 描述从路由声明生成 proto 的选项。
type SAGABuilder ¶
type SAGABuilder interface {
Add(action string, compensate string, payload any) SAGABuilder
AddBranch(action string, compensate string, payload any, opts BranchOptions) SAGABuilder
Submit(ctx context.Context) error
Build() (*SAGATransaction, error)
}
SAGABuilder defines the SAGA transaction builder contract.
SAGABuilder 定义 SAGA 事务构建器契约。
type SAGAStep ¶
type SAGAStep struct {
Action string
Compensate string
Payload any
RetryCount int
RetryInterval int
Timeout int
}
SAGAStep describes one SAGA branch step.
SAGAStep 描述一个 SAGA 分支步骤。
type SAGATransaction ¶
SAGATransaction describes a built SAGA transaction.
SAGATransaction 描述一份构建好的 SAGA 事务。
type SSHClient ¶
type SSHClient interface {
NewSession() (SSHSession, error)
Close() error
}
SSHClient defines the SSH client contract.
SSHClient 定义 SSH 客户端契约。
type SSHService ¶
SSHService defines the SSH capability exposed by the framework.
SSHService 定义框架对外暴露的 SSH 能力。
type SSHSession ¶
type SSHSession interface {
CombinedOutput(cmd string) ([]byte, error)
Run(cmd string) error
Close() error
}
SSHSession defines the SSH session contract.
SSHSession 定义 SSH 会话契约。
type ServiceGenOptions ¶
type ServiceGenOptions struct {
// ProtoFile is the path to the proto file to parse.
// ProtoFile 是要解析的 proto 文件路径。
ProtoFile string
// OutputDir is the root directory for generated files.
// Generated files will be placed under: OutputDir/handler/, OutputDir/service/, OutputDir/routes/.
// OutputDir 是生成文件的根目录。
// 生成的文件将放在:OutputDir/handler/、OutputDir/service/、OutputDir/routes/ 下。
OutputDir string
// PackageName is the Go package name for handler/service files.
// PackageName 是 handler/service 文件的 Go package 名。
PackageName string
// Module is the Go module path (e.g., "example.com/myproject").
// Used for import paths in generated code.
// Module 是 Go module 路径(如 "example.com/myproject")。
// 用于生成代码中的 import 路径。
Module string
// ServiceName specifies which service to generate for.
// Empty means generate for all services in the proto file.
// ServiceName 指定要生成哪个服务的骨架。
// 空表示为 proto 文件中的所有服务生成。
ServiceName string
// IncludeHTTP indicates whether to generate HTTP handler skeleton.
// IncludeHTTP 是否生成 HTTP handler 骨架。
IncludeHTTP bool
// IncludeGRPC indicates whether to generate gRPC service skeleton.
// IncludeGRPC 是否生成 gRPC service 骨架。
IncludeGRPC bool
// RegisterRoutes indicates whether to generate route registration code.
// RegisterRoutes 是否生成路由注册代码。
RegisterRoutes bool
// ImportPaths are additional import paths for proto resolution.
// ImportPaths 是 proto 解析的额外 import 路径。
ImportPaths []string
}
ServiceGenOptions describes service skeleton generation from proto files. Supports proto-first workflow: proto → HTTP handler + gRPC service + route registration.
ServiceGenOptions 描述从 proto 文件生成服务骨架的选项。 支持 proto-first 工作流:proto → HTTP handler + gRPC service + 路由注册。
type ServiceToProtoOptions ¶
type ServiceToProtoOptions struct {
ServicePath string
OutputPath string
Package string
GoPackage string
ServiceName string
IncludeHTTP bool
HTTPAnnotations map[string]HTTPRule
ImportPaths []string
IncludeValidation bool
}
ServiceToProtoOptions describes generation from service definitions.
ServiceToProtoOptions 描述从服务定义生成 proto 的选项。
type TCCBuilder ¶
type TCCBuilder interface {
Add(try string, confirm string, cancel string, payload any) TCCBuilder
Submit(ctx context.Context) error
}
TCCBuilder defines the TCC transaction builder contract.
TCCBuilder 定义 TCC 事务构建器契约。
type TransactionInfo ¶
type TransactionInfo struct {
GID string
Status string
TransactionType string
CreateTime int64
UpdateTime int64
Steps []TransactionStep
}
TransactionInfo describes one distributed transaction snapshot.
TransactionInfo 描述一份分布式事务快照。
type TransactionStep ¶
TransactionStep describes one branch or step in a transaction.
TransactionStep 描述事务中的一个分支或步骤。
type TypeDef ¶
type TypeDef struct {
Name string
Package string
IsPointer bool
IsSlice bool
IsMap bool
MapKey *TypeDef
MapValue *TypeDef
Fields []FieldDef
Comments []string
IsEnum bool
EnumValues []EnumValue
}
TypeDef describes one type definition used in proto generation.
TypeDef 描述 proto 生成过程中使用的类型定义。
type UnsubscribeFunc ¶
type UnsubscribeFunc func() error
UnsubscribeFunc cancels one subscription.
UnsubscribeFunc 用于取消一条订阅。
type ValidationRule ¶
ValidationRule describes one generated validation rule.
ValidationRule 描述一条生成出的校验规则。