diff --git a/helpers/api_types/go_swagger/get_user_input.go b/helpers/api_types/go_swagger/get_user_input.go index 4cc1333..06894f4 100644 --- a/helpers/api_types/go_swagger/get_user_input.go +++ b/helpers/api_types/go_swagger/get_user_input.go @@ -36,8 +36,8 @@ func (a APIType) GetInitializeUserInput(params *models.UserInputParams) (*models params.GoModuleName = &goModulePath } - log.Info("Do you want to enable database integration ?") - params.DB = helpers.YesOrNoInput() + log.Info("Do you want to enable database models auto generation ?") + params.DatabaseModels = helpers.YesOrNoInput() return params, nil } diff --git a/helpers/config.go b/helpers/config.go new file mode 100644 index 0000000..420ad40 --- /dev/null +++ b/helpers/config.go @@ -0,0 +1,22 @@ +package helpers + +import ( + "git.home.m-and-m.ovh/mderasse/gouick/helpers/models" +) + +const configFile = ".gouick.yaml" + +// ReadConfig will search the config file in the given path, read it and return a Config object +func ReadConfig(path string) (*models.Config, error) { + return nil, nil +} + +// WriteConfig will write the new or updated config +func WriteConfig(path string, config *models.Config) error { + return nil +} + +// WriteConfigFromUserInputParams +func WriteConfigFromUserInputParams(path string, userInput *models.UserInputParams) error { + return nil +} diff --git a/helpers/constant.go b/helpers/constant.go deleted file mode 100644 index c22464d..0000000 --- a/helpers/constant.go +++ /dev/null @@ -1,4 +0,0 @@ -// Package helpers contains all basic function that might make development easier / avoid code duplication -package helpers - -const configFile = ".gouick.yaml" diff --git a/helpers/models/config.go b/helpers/models/config.go new file mode 100644 index 0000000..1b52fd0 --- /dev/null +++ b/helpers/models/config.go @@ -0,0 +1,19 @@ +package models + +// Config structure represent the main configuration of the project. +type Config struct { + ProjectName string `yaml:"project_name"` + ProjectDescription string `yaml:"project_description"` + ProjectOwner string `yaml:"project_owner"` + Features FeaturesConfig `yaml:"features"` +} + +// FeaturesConfig structure represent the configuration of all possible features. +type FeaturesConfig struct { + DatabaseModels DatabaseModelsConfig `yaml:"database_models"` +} + +// DatabaseModelsConfig structure represent the configuration of the Database Models feature. +type DatabaseModelsConfig struct { + Enabled bool `yaml:"enabled"` +} diff --git a/helpers/models/api_type.go b/helpers/models/user_input_params.go similarity index 91% rename from helpers/models/api_type.go rename to helpers/models/user_input_params.go index 157705d..a19f70c 100644 --- a/helpers/models/api_type.go +++ b/helpers/models/user_input_params.go @@ -2,7 +2,7 @@ package models // UserInputParams is a struct containing all fields that can be useful for project generation. type UserInputParams struct { - DB bool + DatabaseModels bool GoModuleName *string ProjectDescription string ProjectDirectory string