rest/plugins/sharding/types.go

46 lines
651 B
Go
Raw Normal View History

2024-12-11 17:29:01 +08:00
package sharding
import (
"context"
sqlparserX "github.com/uole/sqlparser"
)
const (
TypeDatetime = "datetime"
TypeHash = "hash"
)
const (
DateTypeYear = iota + 5
DateTypeMonth
DateTypeWeek
DateTypeDay
)
const (
sceneCreate = "create"
sceneUpdate = "update"
sceneDelete = "delete"
)
const (
stmtCountKeyword = "count"
)
type (
Rule struct {
Type string `json:"type"`
Args int `json:"args"`
}
Model interface {
ShardingRule() Rule
ShardingTable(scene string) string
ShardingTables(scope *Scope) []string
}
SelectBuilder interface {
BuildSelect(ctx context.Context, expr sqlparserX.SelectExprs) []string
}
)