-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathtypes.go
More file actions
81 lines (62 loc) · 2.28 KB
/
types.go
File metadata and controls
81 lines (62 loc) · 2.28 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
package codegen
import (
"maps"
"slices"
"github.com/streamingfast/substreams-codegen/loop"
pbconvo "github.com/streamingfast/substreams-codegen/pb/sf/codegen/conversation/v1"
"go.uber.org/zap/zapcore"
)
type AskProjectName struct{}
type InputProjectName struct{ pbconvo.UserInput_TextInput }
type AskChainName struct{}
type MsgInvalidChainName struct{}
type InputChainName struct{ pbconvo.UserInput_Selection }
type InputSourceDownloaded struct{ pbconvo.UserInput_TextInput }
type PackageDownloaded struct{ pbconvo.UserInput_Confirmation }
type AskConfirmCompile struct{}
type InputConfirmCompile struct{ pbconvo.UserInput_Confirmation } // SQL specific
type AskInitialStartBlockType struct{}
type InputAskInitialStartBlockType struct{ pbconvo.UserInput_TextInput }
type AskSubstreamsConsumptionChoice struct{}
type InputSubstreamsConsumptionChoice struct{ pbconvo.UserInput_Selection }
func InputAskInitialStartBlockTypeTextInput() string {
return "At what block do you want to start indexing data?"
}
func InputAskInitialStartBlockTypeRegex() string {
return `^\d+$`
}
func InputAskInitialStartBlockTypeValidation() string {
return "The start block cannot be empty and must be a number"
}
type RunGenerate struct{}
type ReturnGenerate struct {
Err error
ProjectFiles map[string][]byte
}
func (c ReturnGenerate) MarshalLogObject(enc zapcore.ObjectEncoder) error {
enc.AddReflected("files", slices.Collect(maps.Keys(c.ProjectFiles)))
if c.Err != nil {
enc.AddString("error", c.Err.Error())
}
return nil
}
func (c ReturnGenerate) Error(msg *MsgWrap) loop.Cmd {
return loop.Seq(
msg.Messagef("Code generation failed with error: %s", c.Err).Cmd(),
loop.Quit(c.Err),
)
}
type MsgGenerateProgress struct {
Progress int
Logs []string
Continue bool
}
//go:generate go run github.com/abice/go-enum@v0.7.0 -f=$GOFILE --forcelower --names --values --marshal
// SubstreamsSinkChoice represents the type of a Substreams sink choice
// that are possible for a user to select when generating a Substreams package.
//
// Use the lower case versions of the enum when sending it to the user.
// Remain also backward compatible with the previous naming convention.
//
// ENUM(none, source_only, postgres, clickhouse, parquet, golang, rust, javascript, python)
type SubstreamsSinkChoice string