🚧 Refactor backup service

This commit is contained in:
2025-12-14 23:48:52 +08:00
parent cc4c2189dc
commit 67d35626cb
47 changed files with 2184 additions and 489 deletions

View File

@@ -12,6 +12,8 @@ const (
Label = "key_binding"
// FieldID holds the string denoting the id field in the database.
FieldID = "id"
// FieldUUID holds the string denoting the uuid field in the database.
FieldUUID = "uuid"
// 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.
@@ -33,6 +35,7 @@ const (
// Columns holds all SQL columns for keybinding fields.
var Columns = []string{
FieldID,
FieldUUID,
FieldCreatedAt,
FieldUpdatedAt,
FieldDeletedAt,
@@ -60,6 +63,8 @@ func ValidColumn(column string) bool {
var (
Hooks [2]ent.Hook
Interceptors [1]ent.Interceptor
// DefaultUUID holds the default value on creation for the "uuid" field.
DefaultUUID func() string
// DefaultCreatedAt holds the default value on creation for the "created_at" field.
DefaultCreatedAt func() string
// DefaultUpdatedAt holds the default value on creation for the "updated_at" field.
@@ -82,6 +87,11 @@ func ByID(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldID, opts...).ToFunc()
}
// ByUUID orders the results by the uuid field.
func ByUUID(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldUUID, opts...).ToFunc()
}
// ByCreatedAt orders the results by the created_at field.
func ByCreatedAt(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldCreatedAt, opts...).ToFunc()