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

Method ReplacePathVariables

plugins/destination/s3/client/spec/spec.go:267–282  ·  view source on GitHub ↗
(table string, fileIdentifier string, t time.Time, syncID string)

Source from the content-addressed store, hash-verified

265}
266
267func (s *Spec) ReplacePathVariables(table string, fileIdentifier string, t time.Time, syncID string) string {
268 name := strings.ReplaceAll(s.Path, varTable, table)
269 if strings.Contains(name, varFormat) {
270 e := string(s.Format) + s.Compression.Extension()
271 name = strings.ReplaceAll(name, varFormat, e)
272 }
273 name = strings.ReplaceAll(name, varUUID, fileIdentifier)
274 name = strings.ReplaceAll(name, varYear, t.Format("2006"))
275 name = strings.ReplaceAll(name, varMonth, t.Format("01"))
276 name = strings.ReplaceAll(name, varDay, t.Format("02"))
277 name = strings.ReplaceAll(name, varHour, t.Format("15"))
278 name = strings.ReplaceAll(name, varMinute, t.Format("04"))
279 name = strings.ReplaceAll(name, varSyncID, syncID)
280 name = strings.ReplaceAll(name, varTableHyphen, strings.ReplaceAll(table, "_", "-"))
281 return filepath.Clean(name)
282}
283
284func (s *Spec) PathContainsUUID() bool {
285 return strings.Contains(s.Path, varUUID)

Callers 5

TestReplacePathVariablesFunction · 0.45
ReadMethod · 0.45
WriteTableMethod · 0.45
MigrateTableMethod · 0.45
NewFunction · 0.45

Calls

no outgoing calls

Tested by 1

TestReplacePathVariablesFunction · 0.36