Skip to content

Commit

Permalink
style: adjust code to golangci-lint
Browse files Browse the repository at this point in the history
  • Loading branch information
zhufuyi committed Jan 20, 2025
1 parent 86ded32 commit 1ce4fbf
Showing 1 changed file with 6 additions and 12 deletions.
18 changes: 6 additions & 12 deletions pkg/sql2code/parser/parser.go
Original file line number Diff line number Diff line change
Expand Up @@ -191,8 +191,7 @@ func (d tmplData) isCommonStyle(isEmbed bool) bool {

// ConditionZero type of condition 0, used in dao template code
func (t tmplField) ConditionZero() string {
switch t.DBDriver {
case DBDriverMysql, DBDriverPostgresql, DBDriverTidb:
if t.DBDriver == DBDriverMysql || t.DBDriver == DBDriverPostgresql || t.DBDriver == DBDriverTidb {
if t.rewriterField != nil {
switch t.rewriterField.goType {
case boolTypeName:
Expand All @@ -219,8 +218,7 @@ func (t tmplField) ConditionZero() string {
return ` != false`
}

switch t.DBDriver {
case DBDriverMongodb:
if t.DBDriver == DBDriverMongodb {
if t.GoType == goTypeOID {
return ` != primitive.NilObjectID`
}
Expand All @@ -241,8 +239,7 @@ func (t tmplField) ConditionZero() string {

// GoZero type of 0, used in model to json template code
func (t tmplField) GoZero() string {
switch t.DBDriver {
case DBDriverMysql, DBDriverPostgresql, DBDriverTidb:
if t.DBDriver == DBDriverMysql || t.DBDriver == DBDriverPostgresql || t.DBDriver == DBDriverTidb {
if t.rewriterField != nil {
switch t.rewriterField.goType {
case jsonTypeName, decimalTypeName:
Expand All @@ -267,8 +264,7 @@ func (t tmplField) GoZero() string {
return `= false`
}

switch t.DBDriver {
case DBDriverMongodb:
if t.DBDriver == DBDriverMongodb {
if t.GoType == goTypeOID {
return `= primitive.NilObjectID`
}
Expand All @@ -289,8 +285,7 @@ func (t tmplField) GoZero() string {

// GoTypeZero type of 0, used in service template code, corresponding protobuf type
func (t tmplField) GoTypeZero() string {
switch t.DBDriver {
case DBDriverMysql, DBDriverPostgresql, DBDriverTidb:
if t.DBDriver == DBDriverMysql || t.DBDriver == DBDriverPostgresql || t.DBDriver == DBDriverTidb {
if t.rewriterField != nil {
switch t.rewriterField.goType {
case jsonTypeName:
Expand All @@ -317,8 +312,7 @@ func (t tmplField) GoTypeZero() string {
return `false`
}

switch t.DBDriver {
case DBDriverMongodb:
if t.DBDriver == DBDriverMongodb {
if t.GoType == goTypeOID {
return `primitive.NilObjectID`
}
Expand Down

0 comments on commit 1ce4fbf

Please sign in to comment.