Skip to content

Commit

Permalink
Update table.go
Browse files Browse the repository at this point in the history
  • Loading branch information
donnie4w committed Oct 18, 2024
1 parent 584be7b commit b92ca95
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions table.go
Original file line number Diff line number Diff line change
Expand Up @@ -394,6 +394,7 @@ func (t *Table[T]) Update() (sql.Result, error) {
}

if g := t.getDB(false); g != nil {
t.clearExpire()
return g.ExecuteUpdate(t.sql, t.args...)
} else {
return nil, errInit
Expand All @@ -420,6 +421,7 @@ func (t *Table[T]) Insert() (sql.Result, error) {
}

if g := t.getDB(false); g != nil {
t.clearExpire()
return g.ExecuteUpdate(t.sql, t.args...)
} else {
return nil, errInit
Expand Down Expand Up @@ -462,6 +464,7 @@ func (t *Table[T]) ExecBatch() ([]sql.Result, error) {
Logger.Debug("[BATCH]["+t.sql+"]", t.batchArgs)
}
if g := t.getDB(false); g != nil {
t.clearExpire()
return g.ExecuteBatch(t.sql, t.batchArgs)
} else {
return nil, errInit
Expand All @@ -477,12 +480,17 @@ func (t *Table[T]) Delete() (sql.Result, error) {
}

if g := t.getDB(false); g != nil {
t.clearExpire()
return g.ExecuteUpdate(t.sql, t.args...)
} else {
return nil, errInit
}
}

func (t *Table[T]) clearExpire() {
gdaoCache.ClearExpireWrite[T]()
}

var serialize Serialize[map[string]any] = &Serializer{}

func (t *Table[T]) Encode(m map[string]any) ([]byte, error) {
Expand Down

0 comments on commit b92ca95

Please sign in to comment.