Documentation ¶
Index ¶
- Constants
- func GetFieldTypeMap(tableID string) (map[int]string, error)
- func GetOptions(ctx context.Context, logger *cliutil.LeveledLogger, input interface{}, ...)
- func HandleError(ctx context.Context, logger *cliutil.LeveledLogger, message string, err error)
- func NewClient(cmd *cobra.Command, cfg GlobalConfig) (ctx context.Context, logger *cliutil.LeveledLogger, qb *qbclient.Client)
- func NewDumpPlugin(ctx context.Context, logger *cliutil.LeveledLogger, transid string, ...) qbclient.Plugin
- func NewGroupOption(tag map[string]string) cliutil.OptionType
- func NewLogger(cmd *cobra.Command, cfg GlobalConfig) (ctx context.Context, logger *cliutil.LeveledLogger, transid xid.ID)
- func NewLoggerPlugin(ctx context.Context, logger *cliutil.LeveledLogger) qbclient.Plugin
- func NewQueryOption(tag map[string]string) cliutil.OptionType
- func NewRecordOption(tag map[string]string) cliutil.OptionType
- func NewSortOption(tag map[string]string) cliutil.OptionType
- func ParseGroupBy(s string) (groupBy []*qbclient.QueryRecordsInputGroupBy, err error)
- func ParseQuery(q string) string
- func ParseSortBy(s string) (sortBy []*qbclient.QueryRecordsInputSortBy, err error)
- func Prompt(label string, validate qbclient.ValidateStringFn) (s string, err error)
- func Render(ctx context.Context, logger *cliutil.LeveledLogger, cmd *cobra.Command, ...)
- func SetFieldTypeMap(qb *qbclient.Client, tableID string) error
- func SetOptionFromArg(cfg *viper.Viper, args []string, idx int, option string)
- type DumpPlugin
- type GlobalConfig
- func (c GlobalConfig) ConfigDir() string
- func (c GlobalConfig) DefaultAppID() string
- func (c GlobalConfig) DefaultFieldID() int
- func (c GlobalConfig) DefaultTableID() string
- func (c GlobalConfig) DumpDirectory() string
- func (c GlobalConfig) JMESPathFilter() string
- func (c GlobalConfig) LogFile() string
- func (c GlobalConfig) LogLevel() string
- func (c GlobalConfig) Profile() string
- func (c GlobalConfig) Quiet() bool
- func (c *GlobalConfig) ReadInConfig() error
- func (c GlobalConfig) RealmHostname() string
- func (c GlobalConfig) SetDefaultAppID(cfg *viper.Viper)
- func (c GlobalConfig) SetDefaultTableID(cfg *viper.Viper)
- func (c GlobalConfig) SetDefaultTableIDAs(cfg *viper.Viper, key string)
- func (c GlobalConfig) TemporaryToken() string
- func (c GlobalConfig) UserToken() string
- func (c *GlobalConfig) Validate() error
- type GroupOption
- type LoggerPlugin
- type QueryOption
- type RecordOption
- type SortOption
Constants ¶
const ( OptionDumpDirectory = "dump-dir" OptionJMESPathFilter = "filter" OptionLogFile = "log-file" OptionLogLevel = "log-level" OptionQuiet = "quiet" )
Option* constants contain CLI options.
const ( OptionAppIDDescription = "unique identifier of an app (required)" OptionFieldIDDescription = "unique identifier (fid) of the field (required)" OptionParentTableIDDescription = "unique identifier (dbid) of the parent table (required)" OptionTableIDDescription = "unique identifier (dbid) of the table (required)" OptionQuietDescription = "suppress output written to stdout" )
Option*Description constants contain common option descriptions.
Variables ¶
This section is empty.
Functions ¶
func GetFieldTypeMap ¶
GetFieldTypeMap returns a mapping of field IDs to Quickbase field type for all the fields in a table.
TODO Caching?
func GetOptions ¶
func GetOptions(ctx context.Context, logger *cliutil.LeveledLogger, input interface{}, cfg *viper.Viper)
GetOptions gets options based on the input and validates them.
func HandleError ¶
HandleError handles an error by logging it and returning a non-zero status. We reserve Fatal errors for internal problems.
func NewClient ¶
func NewClient(cmd *cobra.Command, cfg GlobalConfig) (ctx context.Context, logger *cliutil.LeveledLogger, qb *qbclient.Client)
NewClient returns a new *qbclient.Client.
func NewDumpPlugin ¶
func NewDumpPlugin(ctx context.Context, logger *cliutil.LeveledLogger, transid string, directory string) qbclient.Plugin
NewDumpPlugin returns a DumpPlugin, which implements qbclient.Plugin.
func NewGroupOption ¶
func NewGroupOption(tag map[string]string) cliutil.OptionType
NewGroupOption is a cliutil.OptionTypeFunc that returns a *cliutil.GroupOption.
func NewLogger ¶
func NewLogger(cmd *cobra.Command, cfg GlobalConfig) (ctx context.Context, logger *cliutil.LeveledLogger, transid xid.ID)
NewLogger returns a new *cliutil.LeveledLogger.
func NewLoggerPlugin ¶
NewLoggerPlugin returns a LoggerPlugin, which implements qbclient.Plugin.
func NewQueryOption ¶
func NewQueryOption(tag map[string]string) cliutil.OptionType
NewQueryOption is a cliutil.OptionTypeFunc that returns a *cliutil.QueryOption.
func NewRecordOption ¶
func NewRecordOption(tag map[string]string) cliutil.OptionType
NewRecordOption is a cliutil.OptionTypeFunc that returns a *cliutil.RecordOption.
func NewSortOption ¶
func NewSortOption(tag map[string]string) cliutil.OptionType
NewSortOption is a cliutil.OptionTypeFunc that returns a *cliutil.SortOption.
func ParseGroupBy ¶
func ParseGroupBy(s string) (groupBy []*qbclient.QueryRecordsInputGroupBy, err error)
ParseGroupBy parses the groupBy clause.
func ParseQuery ¶
ParseQuery parses queries. It also detcts and transforms simple queries into Quick Base query syntax.
func ParseSortBy ¶
func ParseSortBy(s string) (sortBy []*qbclient.QueryRecordsInputSortBy, err error)
ParseSortBy parses the sortBy clause.
func Prompt ¶
func Prompt(label string, validate qbclient.ValidateStringFn) (s string, err error)
Prompt prompts a user for input and returns what they typed.
func Render ¶
func Render( ctx context.Context, logger *cliutil.LeveledLogger, cmd *cobra.Command, cfg GlobalConfig, v interface{}, err error, )
Render renders the output in JSON, or writes an error log.
func SetFieldTypeMap ¶
SetFieldTypeMap sets the field type map for a table.
Types ¶
type DumpPlugin ¶
type DumpPlugin struct {
// contains filtered or unexported fields
}
DumpPlugin implements qbclient.Plugin and dumps requests and responses to files in a directory.
func (DumpPlugin) PostResponse ¶
func (p DumpPlugin) PostResponse(resp *http.Response)
PostResponse implements qbclient.Plugin.PostResponse.
func (DumpPlugin) PreRequest ¶
func (p DumpPlugin) PreRequest(req *http.Request)
PreRequest implements qbclient.Plugin.PreRequest.
type GlobalConfig ¶
type GlobalConfig struct {
// contains filtered or unexported fields
}
GlobalConfig contains configuration common to all commands.
func NewGlobalConfig ¶
func NewGlobalConfig(cmd *cobra.Command, cfg *viper.Viper) GlobalConfig
NewGlobalConfig returns a GlobalConfig.
func (GlobalConfig) ConfigDir ¶
func (c GlobalConfig) ConfigDir() string
ConfigDir returns the configuration directory.
func (GlobalConfig) DefaultAppID ¶
func (c GlobalConfig) DefaultAppID() string
DefaultAppID returns the default app ID.
func (GlobalConfig) DefaultFieldID ¶
func (c GlobalConfig) DefaultFieldID() int
DefaultFieldID returns the default field ID.
func (GlobalConfig) DefaultTableID ¶
func (c GlobalConfig) DefaultTableID() string
DefaultTableID returns the default table ID.
func (GlobalConfig) DumpDirectory ¶
func (c GlobalConfig) DumpDirectory() string
DumpDirectory returns the configured dump file directory.
func (GlobalConfig) JMESPathFilter ¶
func (c GlobalConfig) JMESPathFilter() string
JMESPathFilter returns the JMESPath filter.
func (GlobalConfig) LogFile ¶
func (c GlobalConfig) LogFile() string
LogFile returns the configured log file.
func (GlobalConfig) LogLevel ¶
func (c GlobalConfig) LogLevel() string
LogLevel returns the configured log level.
func (GlobalConfig) Profile ¶
func (c GlobalConfig) Profile() string
Profile returns the configured profile.
func (GlobalConfig) Quiet ¶
func (c GlobalConfig) Quiet() bool
Quiet returns whehter to suppress output written to stdout.
func (*GlobalConfig) ReadInConfig ¶
func (c *GlobalConfig) ReadInConfig() error
ReadInConfig reads in the config file.
func (GlobalConfig) RealmHostname ¶
func (c GlobalConfig) RealmHostname() string
RealmHostname returns the configured realm hostname.
func (GlobalConfig) SetDefaultAppID ¶
func (c GlobalConfig) SetDefaultAppID(cfg *viper.Viper)
SetDefaultAppID sets the default app in the command's configuration.
func (GlobalConfig) SetDefaultTableID ¶
func (c GlobalConfig) SetDefaultTableID(cfg *viper.Viper)
SetDefaultTableID sets the default table in the command's configuration.
func (GlobalConfig) SetDefaultTableIDAs ¶
func (c GlobalConfig) SetDefaultTableIDAs(cfg *viper.Viper, key string)
SetDefaultTableIDAs sets the default table in the command's configuration as the key option.
func (GlobalConfig) TemporaryToken ¶
func (c GlobalConfig) TemporaryToken() string
TemporaryToken returns the configured log level.
func (GlobalConfig) UserToken ¶
func (c GlobalConfig) UserToken() string
UserToken returns the configured log level.
func (*GlobalConfig) Validate ¶
func (c *GlobalConfig) Validate() error
Validate reads the configuration file and validates the global configuration options.
type GroupOption ¶
type GroupOption struct {
// contains filtered or unexported fields
}
GroupOption implements Option for string options that contain queries.
type LoggerPlugin ¶
type LoggerPlugin struct {
// contains filtered or unexported fields
}
LoggerPlugin implements qbclient.Plugin and logs requests.
func (LoggerPlugin) PostResponse ¶
func (p LoggerPlugin) PostResponse(resp *http.Response)
PostResponse implements qbclient.Plugin.PostResponse.
func (LoggerPlugin) PreRequest ¶
func (p LoggerPlugin) PreRequest(req *http.Request)
PreRequest implements qbclient.Plugin.PreRequest.
type QueryOption ¶
type QueryOption struct {
// contains filtered or unexported fields
}
QueryOption implements Option for string options that contain queries.
type RecordOption ¶
type RecordOption struct {
// contains filtered or unexported fields
}
RecordOption implements Option for string options that contain record datas.
type SortOption ¶
type SortOption struct {
// contains filtered or unexported fields
}
SortOption implements Option for string options that contain queries.