Documentation ¶
Index ¶
Constants ¶
const ( ProjectName = "kcp" MaskString = "******" )
Variables ¶
Functions ¶
func NewCmdServer ¶
Types ¶
type DatabaseAccessOptions ¶
type DatabaseAccessOptions struct { DBName string `json:"dbName,omitempty" yaml:"dbName,omitempty"` DBUser string `json:"dbUser,omitempty" yaml:"dbUser,omitempty"` DBPassword string `json:"dbPassword,omitempty" yaml:"dbPassword,omitempty"` DBHost string `json:"dbHost,omitempty" yaml:"dbHost,omitempty"` DBPort int `json:"dbPort,omitempty" yaml:"dbPort,omitempty"` }
DatabaseAccessOptions holds the database access layer configurations.
func NewDatabaseAccessOptions ¶
func NewDatabaseAccessOptions() *DatabaseAccessOptions
NewDatabaseAccessOptions returns a DatabaseAccessOptions struct with the default values
func (*DatabaseAccessOptions) AddFlags ¶
func (o *DatabaseAccessOptions) AddFlags(fs *pflag.FlagSet)
AddFlags adds flags related to DB to a specified FlagSet
func (*DatabaseAccessOptions) ApplyTo ¶
func (o *DatabaseAccessOptions) ApplyTo(db **gorm.DB) error
ApplyTo uses the run options to generate and open a db session.
func (*DatabaseAccessOptions) InstallDB ¶
func (o *DatabaseAccessOptions) InstallDB() (*gorm.DB, error)
InstallDB uses the run options to generate and open a db session.
func (*DatabaseAccessOptions) Validate ¶
func (o *DatabaseAccessOptions) Validate() error
Validate checks validation of DatabaseAccessOptions
type DatabaseOptions ¶
type DatabaseOptions struct { DatabaseAccessOptions `json:",inline" yaml:",inline"` // AutoMigrate will attempt to automatically migrate all tables AutoMigrate bool `json:"autoMigrate,omitempty" yaml:"autoMigrate,omitempty"` MigrateFile string `json:"migrateFile,omitempty" yaml:"migrateFile,omitempty"` }
DatabaseOptions is a Database options struct
func NewDatabaseOptions ¶
func NewDatabaseOptions() *DatabaseOptions
NewDatabaseOptions returns a DatabaseOptions instance with the default values
func (*DatabaseOptions) AddFlags ¶
func (o *DatabaseOptions) AddFlags(fs *pflag.FlagSet)
AddFlags adds flags for a specific Option to the specified FlagSet
func (*DatabaseOptions) ApplyTo ¶
func (o *DatabaseOptions) ApplyTo(config *server.Config)
ApplyTo apply database options to the server config
func (DatabaseOptions) MarshalJSON ¶
func (o DatabaseOptions) MarshalJSON() ([]byte, error)
MarshalJSON is custom marshalling function for masking sensitive field values
func (*DatabaseOptions) Validate ¶
func (o *DatabaseOptions) Validate() error
Validate checks DatabaseOptions and return a slice of found error(s)
type ServerOptions ¶
type ServerOptions struct { Mode string Database DatabaseOptions }
func NewServerOptions ¶
func NewServerOptions() *ServerOptions
func (*ServerOptions) AddServerFlags ¶
func (o *ServerOptions) AddServerFlags(cmd *cobra.Command)
func (*ServerOptions) Complete ¶
func (o *ServerOptions) Complete(args []string)
func (*ServerOptions) Run ¶
func (o *ServerOptions) Run() error
func (*ServerOptions) Validate ¶
func (o *ServerOptions) Validate() error