♻️ Refactor backup service complete.
Some checks failed
CodeQL Advanced / Analyze (go) (push) Has been cancelled
CodeQL Advanced / Analyze (actions) (push) Has been cancelled
CodeQL Advanced / Analyze (c-cpp) (push) Has been cancelled
CodeQL Advanced / Analyze (javascript-typescript) (push) Has been cancelled
CodeQL Advanced / Analyze (python) (push) Has been cancelled
CodeQL Advanced / Analyze (rust) (push) Has been cancelled

This commit is contained in:
2025-12-16 23:20:40 +08:00
parent 1ab934cee9
commit 8fce8bdca4
29 changed files with 467 additions and 1171 deletions

View File

@@ -17,7 +17,7 @@ type Document struct {
// ID of the ent.
ID int `json:"id,omitempty"`
// UUID for cross-device sync (UUIDv7)
UUID string `json:"uuid"`
UUID *string `json:"uuid"`
// creation time
CreatedAt string `json:"created_at"`
// update time
@@ -69,7 +69,8 @@ func (_m *Document) assignValues(columns []string, values []any) error {
if value, ok := values[i].(*sql.NullString); !ok {
return fmt.Errorf("unexpected type %T for field uuid", values[i])
} else if value.Valid {
_m.UUID = value.String
_m.UUID = new(string)
*_m.UUID = value.String
}
case document.FieldCreatedAt:
if value, ok := values[i].(*sql.NullString); !ok {
@@ -144,8 +145,10 @@ func (_m *Document) String() string {
var builder strings.Builder
builder.WriteString("Document(")
builder.WriteString(fmt.Sprintf("id=%v, ", _m.ID))
builder.WriteString("uuid=")
builder.WriteString(_m.UUID)
if v := _m.UUID; v != nil {
builder.WriteString("uuid=")
builder.WriteString(*v)
}
builder.WriteString(", ")
builder.WriteString("created_at=")
builder.WriteString(_m.CreatedAt)

View File

@@ -225,7 +225,7 @@ func (_c *DocumentCreate) createSpec() (*Document, *sqlgraph.CreateSpec) {
)
if value, ok := _c.mutation.UUID(); ok {
_spec.SetField(document.FieldUUID, field.TypeString, value)
_node.UUID = value
_node.UUID = &value
}
if value, ok := _c.mutation.CreatedAt(); ok {
_spec.SetField(document.FieldCreatedAt, field.TypeString, value)

View File

@@ -18,7 +18,7 @@ type Extension struct {
// ID of the ent.
ID int `json:"id,omitempty"`
// UUID for cross-device sync (UUIDv7)
UUID string `json:"uuid"`
UUID *string `json:"uuid"`
// creation time
CreatedAt string `json:"created_at"`
// update time
@@ -72,7 +72,8 @@ func (_m *Extension) assignValues(columns []string, values []any) error {
if value, ok := values[i].(*sql.NullString); !ok {
return fmt.Errorf("unexpected type %T for field uuid", values[i])
} else if value.Valid {
_m.UUID = value.String
_m.UUID = new(string)
*_m.UUID = value.String
}
case extension.FieldCreatedAt:
if value, ok := values[i].(*sql.NullString); !ok {
@@ -149,8 +150,10 @@ func (_m *Extension) String() string {
var builder strings.Builder
builder.WriteString("Extension(")
builder.WriteString(fmt.Sprintf("id=%v, ", _m.ID))
builder.WriteString("uuid=")
builder.WriteString(_m.UUID)
if v := _m.UUID; v != nil {
builder.WriteString("uuid=")
builder.WriteString(*v)
}
builder.WriteString(", ")
builder.WriteString("created_at=")
builder.WriteString(_m.CreatedAt)

View File

@@ -213,7 +213,7 @@ func (_c *ExtensionCreate) createSpec() (*Extension, *sqlgraph.CreateSpec) {
)
if value, ok := _c.mutation.UUID(); ok {
_spec.SetField(extension.FieldUUID, field.TypeString, value)
_node.UUID = value
_node.UUID = &value
}
if value, ok := _c.mutation.CreatedAt(); ok {
_spec.SetField(extension.FieldCreatedAt, field.TypeString, value)

View File

@@ -17,7 +17,7 @@ type KeyBinding struct {
// ID of the ent.
ID int `json:"id,omitempty"`
// UUID for cross-device sync (UUIDv7)
UUID string `json:"uuid"`
UUID *string `json:"uuid"`
// creation time
CreatedAt string `json:"created_at"`
// update time
@@ -71,7 +71,8 @@ func (_m *KeyBinding) assignValues(columns []string, values []any) error {
if value, ok := values[i].(*sql.NullString); !ok {
return fmt.Errorf("unexpected type %T for field uuid", values[i])
} else if value.Valid {
_m.UUID = value.String
_m.UUID = new(string)
*_m.UUID = value.String
}
case keybinding.FieldCreatedAt:
if value, ok := values[i].(*sql.NullString); !ok {
@@ -152,8 +153,10 @@ func (_m *KeyBinding) String() string {
var builder strings.Builder
builder.WriteString("KeyBinding(")
builder.WriteString(fmt.Sprintf("id=%v, ", _m.ID))
builder.WriteString("uuid=")
builder.WriteString(_m.UUID)
if v := _m.UUID; v != nil {
builder.WriteString("uuid=")
builder.WriteString(*v)
}
builder.WriteString(", ")
builder.WriteString("created_at=")
builder.WriteString(_m.CreatedAt)

View File

@@ -240,7 +240,7 @@ func (_c *KeyBindingCreate) createSpec() (*KeyBinding, *sqlgraph.CreateSpec) {
)
if value, ok := _c.mutation.UUID(); ok {
_spec.SetField(keybinding.FieldUUID, field.TypeString, value)
_node.UUID = value
_node.UUID = &value
}
if value, ok := _c.mutation.CreatedAt(); ok {
_spec.SetField(keybinding.FieldCreatedAt, field.TypeString, value)

View File

@@ -166,7 +166,7 @@ func (m *DocumentMutation) UUID() (r string, exists bool) {
// OldUUID returns the old "uuid" field's value of the Document entity.
// If the Document object wasn't provided to the builder, the object is fetched from the database.
// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
func (m *DocumentMutation) OldUUID(ctx context.Context) (v string, err error) {
func (m *DocumentMutation) OldUUID(ctx context.Context) (v *string, err error) {
if !m.op.Is(OpUpdateOne) {
return v, errors.New("OldUUID is only allowed on UpdateOne operations")
}
@@ -876,7 +876,7 @@ func (m *ExtensionMutation) UUID() (r string, exists bool) {
// OldUUID returns the old "uuid" field's value of the Extension entity.
// If the Extension object wasn't provided to the builder, the object is fetched from the database.
// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
func (m *ExtensionMutation) OldUUID(ctx context.Context) (v string, err error) {
func (m *ExtensionMutation) OldUUID(ctx context.Context) (v *string, err error) {
if !m.op.Is(OpUpdateOne) {
return v, errors.New("OldUUID is only allowed on UpdateOne operations")
}
@@ -1587,7 +1587,7 @@ func (m *KeyBindingMutation) UUID() (r string, exists bool) {
// OldUUID returns the old "uuid" field's value of the KeyBinding entity.
// If the KeyBinding object wasn't provided to the builder, the object is fetched from the database.
// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
func (m *KeyBindingMutation) OldUUID(ctx context.Context) (v string, err error) {
func (m *KeyBindingMutation) OldUUID(ctx context.Context) (v *string, err error) {
if !m.op.Is(OpUpdateOne) {
return v, errors.New("OldUUID is only allowed on UpdateOne operations")
}
@@ -2350,7 +2350,7 @@ func (m *ThemeMutation) UUID() (r string, exists bool) {
// OldUUID returns the old "uuid" field's value of the Theme entity.
// If the Theme object wasn't provided to the builder, the object is fetched from the database.
// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
func (m *ThemeMutation) OldUUID(ctx context.Context) (v string, err error) {
func (m *ThemeMutation) OldUUID(ctx context.Context) (v *string, err error) {
if !m.op.Is(OpUpdateOne) {
return v, errors.New("OldUUID is only allowed on UpdateOne operations")
}

View File

@@ -18,7 +18,7 @@ type Theme struct {
// ID of the ent.
ID int `json:"id,omitempty"`
// UUID for cross-device sync (UUIDv7)
UUID string `json:"uuid"`
UUID *string `json:"uuid"`
// creation time
CreatedAt string `json:"created_at"`
// update time
@@ -70,7 +70,8 @@ func (_m *Theme) assignValues(columns []string, values []any) error {
if value, ok := values[i].(*sql.NullString); !ok {
return fmt.Errorf("unexpected type %T for field uuid", values[i])
} else if value.Valid {
_m.UUID = value.String
_m.UUID = new(string)
*_m.UUID = value.String
}
case theme.FieldCreatedAt:
if value, ok := values[i].(*sql.NullString); !ok {
@@ -147,8 +148,10 @@ func (_m *Theme) String() string {
var builder strings.Builder
builder.WriteString("Theme(")
builder.WriteString(fmt.Sprintf("id=%v, ", _m.ID))
builder.WriteString("uuid=")
builder.WriteString(_m.UUID)
if v := _m.UUID; v != nil {
builder.WriteString("uuid=")
builder.WriteString(*v)
}
builder.WriteString(", ")
builder.WriteString("created_at=")
builder.WriteString(_m.CreatedAt)

View File

@@ -206,7 +206,7 @@ func (_c *ThemeCreate) createSpec() (*Theme, *sqlgraph.CreateSpec) {
)
if value, ok := _c.mutation.UUID(); ok {
_spec.SetField(theme.FieldUUID, field.TypeString, value)
_node.UUID = value
_node.UUID = &value
}
if value, ok := _c.mutation.CreatedAt(); ok {
_spec.SetField(theme.FieldCreatedAt, field.TypeString, value)