MCPcopy Create free account
hub / github.com/cloudquery/cloudquery / SetDefaults

Method SetDefaults

plugins/destination/postgresql/client/spec/spec.go:91–122  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

89}
90
91func (s *Spec) SetDefaults() {
92 if s.BatchSize <= 0 {
93 s.BatchSize = defaultBatchSize
94 }
95 if s.BatchSizeBytes <= 0 {
96 s.BatchSizeBytes = defaultBatchSizeBytes
97 }
98 if s.BatchTimeout.Duration() <= 0 {
99 s.BatchTimeout = configtype.NewDuration(defaultBatchTimeout)
100 }
101 if s.PgxLogLevel == 0 {
102 s.PgxLogLevel = LogLevel(tracelog.LogLevelError)
103 }
104 if s.PgVectorConfig != nil {
105 for i := range s.PgVectorConfig.Tables {
106 // Ensure MetadataColumns is an empty slice when unset (not nil)
107 if s.PgVectorConfig.Tables[i].MetadataColumns == nil {
108 s.PgVectorConfig.Tables[i].MetadataColumns = []string{}
109 }
110 // Always ensure _cq_id is present in metadata columns
111 s.PgVectorConfig.Tables[i].MetadataColumns = ensureCQIDPresent(s.PgVectorConfig.Tables[i].MetadataColumns)
112 }
113 if s.PgVectorConfig.TextSplitter == nil {
114 s.PgVectorConfig.TextSplitter = &PgVectorTextSplitter{
115 RecursiveText: PgVectorRecursiveText{
116 ChunkSize: 1000,
117 ChunkOverlap: 500,
118 },
119 }
120 }
121 }
122}
123
124func ensureCQIDPresent(metadataColumns []string) []string {
125 if slices.Contains(metadataColumns, CQIDColumn) {

Callers 3

NewFunction · 0.95
ConnectionTesterFunction · 0.95

Calls 2

LogLevelTypeAlias · 0.85
ensureCQIDPresentFunction · 0.85