MCPcopy Create free account
hub / github.com/devaccuracy/ledgerforge / getDefaultValue

Function getDefaultValue

internal/search/search.go:507–522  ·  view source on GitHub ↗

getDefaultValue returns the default value for a given field type in Typesense.

(fieldType string)

Source from the content-addressed store, hash-verified

505
506// getDefaultValue returns the default value for a given field type in Typesense.
507func getDefaultValue(fieldType string) interface{} {
508 switch fieldType {
509 case "string":
510 return ""
511 case "int32", "int64":
512 return int64(0)
513 case "float":
514 return float64(0)
515 case "bool":
516 return false
517 case "string[]":
518 return []string{}
519 default:
520 return nil
521 }
522}
523
524// getLedgerSchema returns the schema for the "ledgers" collection.
525func getLedgerSchema() *api.CollectionSchema {

Callers 2

ensureSchemaFieldsMethod · 0.85
TestGetDefaultValueFunction · 0.85

Calls

no outgoing calls

Tested by 1

TestGetDefaultValueFunction · 0.68