🐛 fix(database.go): use strings.Join to concatenate attributes with a comma separator for better readability and maintainability in AddFakeData function

This commit is contained in:
pluja 2023-10-30 23:33:14 +01:00
parent 40a8331d40
commit c35f8dc307

View File

@ -3,6 +3,7 @@ package database
import ( import (
"context" "context"
"os" "os"
"strings"
_ "github.com/mattn/go-sqlite3" _ "github.com/mattn/go-sqlite3"
"github.com/rs/zerolog/log" "github.com/rs/zerolog/log"
@ -39,7 +40,7 @@ func AddFakeData() {
SetFiat(true). SetFiat(true).
SetCash(true). SetCash(true).
SetType(service.TypeExchange). SetType(service.TypeExchange).
SetAttributes([]string{AttributeNonCustodialWallet, AttributeOpenSource, AttributeNoPersonalInfoNeeded, AttributeP2P}). SetAttributes(strings.Join([]string{AttributeNonCustodialWallet, AttributeOpenSource, AttributeNoPersonalInfoNeeded, AttributeP2P, AttributeAPIAvailable, AttributePartnersMayEnforceKYC, AttributeBlockFundsIfFlagged, AttributeKYCForSomeFeatures}, ",")).
SetTosHighlights(&[]schema.TosHighlight{sampleTosHighlight}). SetTosHighlights(&[]schema.TosHighlight{sampleTosHighlight}).
Save(context.Background()) Save(context.Background())
if err != nil { if err != nil {
@ -64,7 +65,7 @@ func AddFakeData() {
SetFiat(true). SetFiat(true).
SetCash(true). SetCash(true).
SetType(service.TypeExchange). SetType(service.TypeExchange).
SetAttributes([]string{AttributeNonCustodialWallet, AttributeOpenSource, AttributeNoPersonalInfoNeeded, AttributeP2P}). SetAttributes(strings.Join([]string{AttributeNonCustodialWallet, AttributeOpenSource, AttributeNoPersonalInfoNeeded, AttributeP2P}, ",")).
SetTosHighlights(&[]schema.TosHighlight{sampleTosHighlight}). SetTosHighlights(&[]schema.TosHighlight{sampleTosHighlight}).
Save(context.Background()) Save(context.Background())
if err != nil { if err != nil {