configurations

package
v0.0.32 Latest Latest
Warning

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

Go to latest
Published: May 3, 2023 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// SupportedDbTypes represents the supported database_services
	SupportedDbTypes = map[DatabaseType]bool{
		DbTypePostgresql: true,
		DbTypeMySQL:      true,
		DbTypeSQLite:     true,
	}

	// SupportedNullTypes represents the supported types of NULL types
	SupportedNullTypes = map[NullType]bool{
		NullTypeSQL:       true,
		NullTypeNative:    true,
		NullTypePrimitive: true,
	}
)

Functions

func SprintfSupportedDbTypes

func SprintfSupportedDbTypes() string

SprintfSupportedDbTypes returns a slice of strings as names of the supported database_i_o_service types

func SprintfSupportedNullTypes

func SprintfSupportedNullTypes() string

SprintfSupportedNullTypes returns a slice of strings as names of the supported null types

Types

type DatabaseToGoSettings

type DatabaseToGoSettings struct {
	Help bool
	*Settings
}

func CreateNewSettings

func CreateNewSettings() *DatabaseToGoSettings

type DatabaseType

type DatabaseType string

DatabaseType represents a type of a database_i_o_service.

const (
	DbTypePostgresql DatabaseType = "pg"
	DbTypeMySQL      DatabaseType = "mysql"
	DbTypeSQLite     DatabaseType = "sqlite3"
	DbTypeAccess     DatabaseType = "access"
)

func (*DatabaseType) Set

func (db *DatabaseType) Set(s string) error

Set sets the datatype for the custom type for the flag package.

func (DatabaseType) String

func (db DatabaseType) String() string

String is the implementation of the Stringer interface needed for flag.Value interface.

type FileNameFormat

type FileNameFormat string
const (
	FileNameFormatCamelCase FileNameFormat = "c"
	FileNameFormatSnakeCase FileNameFormat = "s"
)

func (*FileNameFormat) Set

func (of *FileNameFormat) Set(s string) error

Set sets the datatype for the custom type for the flag package.

func (FileNameFormat) String

func (of FileNameFormat) String() string

type NullType

type NullType string

NullType represents a null type.

const (
	NullTypeSQL       NullType = "sql"
	NullTypeNative    NullType = "native"
	NullTypePrimitive NullType = "primitive"
)

These null types are supported. The types native and primitive map to the same underlying builtin golang type.

func (*NullType) Set

func (t *NullType) Set(
	s string) error

SetCustomDatatype sets the datatype for the custom type for the flag package.

func (NullType) String

func (t NullType) String() string

String is the implementation of the Stringer interface needed for flag.Value interface.

type OutputFormat

type OutputFormat string

OutputFormat represents a output format option.

const (
	OutputFormatCamelCase OutputFormat = "c"
	OutputFormatOriginal  OutputFormat = "o"
)

These are the output format command line parameter.

func (*OutputFormat) Set

func (of *OutputFormat) Set(
	s string) error

Set sets the datatype for the custom type for the flag package.

func (OutputFormat) String

func (of OutputFormat) String() string

String is the implementation of the Stringer interface needed for flag.Value interface.

type Settings

type Settings struct {
	Verbose  bool
	VVerbose bool
	Force    bool // continue through errors

	DbType DatabaseType

	DbFileName string

	User     string
	Password string
	DbName   string
	Schema   string
	Host     string
	Port     int

	OutputFilePath string
	OutputFormat   OutputFormat

	FileNameFormat FileNameFormat
	PackageName    string
	Prefix         string
	Suffix         string
	Null           NullType

	NoInitialism bool

	TagsNoDb bool

	TagsMastermindStructable       bool
	TagsMastermindStructableOnly   bool
	IsMastermindStructableRecorder bool

	// TODO not implemented yet
	TagsGorm bool
}

Settings stores the supported settings / command line arguments

func (*Settings) IsFileNameFormatSnakeCase

func (settings *Settings) IsFileNameFormatSnakeCase() bool

IsFileNameFormatSnakeCase returns if the type given by the command line args is snake-case format

func (*Settings) IsNullTypeSQL

func (settings *Settings) IsNullTypeSQL() bool

IsNullTypeSQL returns true if the type given by the command line args is of null type SQL

func (*Settings) IsOutputFormatCamelCase

func (settings *Settings) IsOutputFormatCamelCase() bool

IsOutputFormatCamelCase returns if the type given by command line args is of camel-case format.

func (*Settings) ShouldInitialism

func (settings *Settings) ShouldInitialism() bool

ShouldInitialism returns wheather or not if column names should be converted to initialisms.

func (*Settings) Verify

func (settings *Settings) Verify() (err error)

Verify verifies the settings and checks the given output paths

type SettingsFactory

type SettingsFactory struct {
	Verbose  bool
	VVerbose bool
	Force    bool // continue through errors

	DbType DatabaseType

	User   string
	Pswd   string
	DbName string
	Schema string
	Host   string
	Port   int

	OutputFilePath string
	OutputFormat   OutputFormat

	FileNameFormat FileNameFormat
	PackageName    string
	Prefix         string
	Suffix         string
	Null           NullType

	NoInitialism bool

	TagsNoDb bool

	TagsMastermindStructable       bool
	TagsMastermindStructableOnly   bool
	IsMastermindStructableRecorder bool

	// TODO not implemented yet
	TagsGorm bool
}

func (*SettingsFactory) Create

func (settingsFactory *SettingsFactory) Create() *Settings

Jump to

Keyboard shortcuts

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