-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: generate statement names with format cli-date-time-uuid (#2601)
- Loading branch information
1 parent
5c09612
commit 26f02cc
Showing
3 changed files
with
19 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,16 @@ | ||
package types | ||
|
||
import "github.com/google/uuid" | ||
import ( | ||
"fmt" | ||
"time" | ||
|
||
"github.com/google/uuid" | ||
) | ||
|
||
func GenerateStatementName() string { | ||
return uuid.New().String()[:18] | ||
clientName := "cli" | ||
date := time.Now().Format("2006-01-02") | ||
localTime := time.Now().Format("150405") | ||
id := uuid.New().String() | ||
return fmt.Sprintf("%s-%s-%s-%s", clientName, date, localTime, id) | ||
} |
2 changes: 1 addition & 1 deletion
2
test/fixtures/output/flink/statement/create-no-name-yaml.golden
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
creation_date: 2023-01-01T00:00:00Z | ||
name: [0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4} | ||
name: cli-\d{4}-\d{2}-\d{2}-\d{6}-[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12} | ||
statement: INSERT \* INTO table; | ||
compute_pool: lfcp-123456 | ||
status: PENDING |