conf

package
v1.4.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 27, 2018 License: MIT Imports: 14 Imported by: 2

Documentation

Index

Constants

View Source
const (
	UsageAccountID      = "Google Adwords account ID"
	UsageAccessToken    = "Google OAuth access token"
	UsageDeveloperToken = "Google OAuth developer token"
	UsageAPIVersion     = "Google Adwords API version"
	UsageQuery          = "Execute AWQL statement"
)

Usage messages.

Variables

This section is empty.

Functions

func NewFlagError

func NewFlagError(text string) error

NewFlagError returns an error of the parse error.

func Usage

func Usage()

Usage prints a usage message documenting all defined command-line flags.

Types

type Context

type Context struct {
	// contains filtered or unexported fields
}

Context represents the program properties.

func New

func New(dir string) *Context

New returns an instance of Credentials. The string dir contains the path of the current workspace.

func (*Context) APIVersion

func (c *Context) APIVersion() string

APIVersion returns the API version.

func (*Context) AccountID

func (c *Context) AccountID() string

AccountID returns the Account ID.

func (*Context) CacheDir

func (c *Context) CacheDir() string

CacheDir returns the path to store cache files.

func (*Context) DatabaseDir

func (c *Context) DatabaseDir() string

DatabaseDir returns the path to the database.

func (*Context) Dsn

func (c *Context) Dsn() string

Dsn outputs the data source name.

func (*Context) ExecuteStmt

func (c *Context) ExecuteStmt() string

ExecuteStmt returns the statement to execute.

func (*Context) HistoryFile

func (c *Context) HistoryFile() string

HistoryFile returns the path to the history file.

func (*Context) Init

func (c *Context) Init() error

Init retrieves and saves the default authenticate information.

func (*Context) IsInteractive

func (c *Context) IsInteractive() bool

IsInteractive returns true if query as passed as flag.

func (*Context) SupportsZeroImpressions

func (c *Context) SupportsZeroImpressions() bool

SupportsZeroImpressions returns true if the support of zero impressions is enable.

func (*Context) UseBatchMode

func (c *Context) UseBatchMode() bool

UseBatchMode returns true if raw mode is required. It will print results using colon as the column separator, with each row on a new line.

func (*Context) UseVerboseMode

func (c *Context) UseVerboseMode() bool

UseVerboseMode returns true if more output about what the program does is required.

func (*Context) WithAutoRehash

func (c *Context) WithAutoRehash() bool

WithAutoRehash returns true if automatic rehashing is enable.

func (*Context) WithCache

func (c *Context) WithCache() bool

WithCache returns true if the cache is enable.

type Credentials

type Credentials struct {
	AccessToken,
	DeveloperToken,
	ClientID,
	ClientSecret,
	RefreshToken string
}

Credentials represents all information required to authenticate to Google API.

func AskCredentials

func AskCredentials() *Credentials

AskCredentials retrieves authenticate properties from console.

func NewCredentials

func NewCredentials() *Credentials

NewCredentials returns an instance of Credentials.

func NewTmpCredentials

func NewTmpCredentials(access, developer string) *Credentials

NewTmpCredentials returns an instance of Credentials with limited time.

func (*Credentials) Get

func (o *Credentials) Get(path string) error

Get returns it in Yaml format in the file to this path.

func (*Credentials) Save

func (o *Credentials) Save(path string) error

Save writes it in Yaml format in the file to this path.

type Flag

type Flag struct {
	AccountID,
	AccessToken,
	APIVersion,
	DeveloperToken,
	Query *string
	Batch,
	ZeroImpressions,
	NoRehash,
	Verbose,
	Caching *bool
}

Flag represents all options passed by the program.

func Parse

func Parse() *Flag

Parse parses the command-line flags from os.Args[1:] It returns an instance of Flag.

func (*Flag) Check

func (o *Flag) Check() error

Check checks all required inputs.

type FlagError

type FlagError struct {
	// contains filtered or unexported fields
}

FlagError represents an error for the command-line tool.

func (*FlagError) Error

func (e *FlagError) Error() string

Error returns the message of the parse error.

type Options

type Options interface {
	AccountID() string
	APIVersion() string
	ExecuteStmt() string
	IsInteractive() bool
	SupportsZeroImpressions() bool
	UseBatchMode() bool
	UseVerboseMode() bool
	WithAutoRehash() bool
	WithCache() bool
}

Options represents all available parameters.

type Settings

type Settings interface {
	Options
	Dsn() string
	CacheDir() string
	DatabaseDir() string
	HistoryFile() string
	Init() error
}

Settings represents all configurable options.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL