mirror of
https://github.com/casdoor/casdoor.git
synced 2025-07-03 04:10:20 +08:00
refactor: code-optimization (#1885)
* refactor: code-optimization * fix: restoring code style * fix: gofmt
This commit is contained in:
@ -66,13 +66,13 @@ func (db *Database) OnRow(e *canal.RowsEvent) error {
|
||||
for i, row := range e.Rows {
|
||||
for j, item := range row {
|
||||
if i%2 == 0 {
|
||||
if isChar[j] == true {
|
||||
if isChar[j] {
|
||||
oldColumnValue[j] = fmt.Sprintf("%s", item)
|
||||
} else {
|
||||
oldColumnValue[j] = fmt.Sprintf("%d", item)
|
||||
}
|
||||
} else {
|
||||
if isChar[j] == true {
|
||||
if isChar[j] {
|
||||
if item == nil {
|
||||
newColumnValue[j] = nil
|
||||
} else {
|
||||
@ -103,7 +103,7 @@ func (db *Database) OnRow(e *canal.RowsEvent) error {
|
||||
db.engine.Exec("BEGIN")
|
||||
for _, row := range e.Rows {
|
||||
for j, item := range row {
|
||||
if isChar[j] == true {
|
||||
if isChar[j] {
|
||||
oldColumnValue[j] = fmt.Sprintf("%s", item)
|
||||
} else {
|
||||
oldColumnValue[j] = fmt.Sprintf("%d", item)
|
||||
@ -128,7 +128,7 @@ func (db *Database) OnRow(e *canal.RowsEvent) error {
|
||||
db.engine.Exec("BEGIN")
|
||||
for _, row := range e.Rows {
|
||||
for j, item := range row {
|
||||
if isChar[j] == true {
|
||||
if isChar[j] {
|
||||
if item == nil {
|
||||
newColumnValue[j] = nil
|
||||
} else {
|
||||
|
Reference in New Issue
Block a user