settings

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Oct 12, 2024 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	CommonCallToPtr          = CommonCall{CommonApiConverters, "toPtr", "to_ptr"}
	CommonCallToValue        = CommonCall{CommonApiConverters, "toValue", "to_value"}
	CommonCallProtoToTimePtr = CommonCall{CommonApiConverters, "protoTimestampToTimePtr", "proto_timestamp_to_go_time_ptr"}
	CommonCallTimeToProto    = CommonCall{CommonApiConverters, "timeToProtoTimestamp", "go_time_to_proto_timestamp"}
	CommonCallMapToStruct    = CommonCall{CommonApiConverters, "mapToGrpcStruct", "go_map_to_proto_struct"}
	CommonCallToProtoValue   = CommonCall{CommonApiConverters, "convertToProtobufValue", "go_interface_to_proto_value"}
)

Supported common APIs.

Functions

This section is empty.

Types

type Addons

type Addons struct {
	Path string `toml:"path"`
}

type Common

type Common struct {
	Converters bool                   `toml:"converters" default:"true"`
	Api        map[string]*Dependency `toml:"api"`
}

type CommonApi

type CommonApi string
const (
	CommonApiConverters CommonApi = "converters"
)

func (CommonApi) String

func (c CommonApi) String() string

type CommonCall

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

type Database

type Database struct {
	Kind string `toml:"kind" validate:"oneof=mongo" default:"mongo"`
}

type Dependency

type Dependency struct {
	Import      *Import                `toml:"import"`
	PackageName string                 `toml:"package_name"`
	Calls       map[string]interface{} `toml:"calls"`
}

type Http

type Http struct {
	Framework string `toml:"framework" validate:"oneof=fasthttp" default:"fasthttp"`
}

type Import

type Import struct {
	Name  string `toml:"name"`
	Alias string `toml:"alias"`
}

func (*Import) ModuleName

func (i *Import) ModuleName() string

type Settings

type Settings struct {
	Debug       bool         `toml:"debug"`
	Suffix      *Suffix      `toml:"suffix" default:"{}"`
	Database    *Database    `toml:"database" default:"{}"`
	Http        *Http        `toml:"http" default:"{}"`
	Templates   *Templates   `toml:"templates" default:"{}"`
	Validations *Validations `toml:"validations"`
	Addons      *Addons      `toml:"addons"`
}

func LoadSettings

func LoadSettings(filename string) (*Settings, error)

func (*Settings) GetCommonCall

func (s *Settings) GetCommonCall(apiName CommonApi, call CommonCall) string

func (*Settings) GetValidationCustomRule

func (s *Settings) GetValidationCustomRule(name string) (*ValidationRule, error)

func (*Settings) GetValidationRule

func (s *Settings) GetValidationRule(rule extensions.FieldValidatorRule) (*ValidationRule, error)

func (*Settings) IsSupportedCustomValidationRule

func (s *Settings) IsSupportedCustomValidationRule(ruleName string) error

func (*Settings) Validate

func (s *Settings) Validate() error

type Suffix

type Suffix struct {
	Domain     string `toml:"domain" default:"Domain"`
	Outbound   string `toml:"outbound" default:"Outbound"`
	Wire       string `toml:"wire" default:"Wire"`
	WireInput  string `toml:"wire_input" default:"Request"`
	WireOutput string `toml:"wire_output" default:"Response"`
}

type Templates

type Templates struct {
	Api      bool    `toml:"api" default:"true"`
	Test     bool    `toml:"test" default:"false"`
	TestPath string  `toml:"test_path" default:"test"`
	ApiPath  string  `toml:"api_path" default:"go"`
	Common   *Common `toml:"common" default:"{}"`
}

type ValidationRule

type ValidationRule struct {
	ArgsRequired bool   `toml:"args_required"`
	Name         string `toml:"name"`
}

type Validations

type Validations struct {
	RulePackageImport *Import                    `toml:"rule_package_import"`
	Rule              map[string]*ValidationRule `toml:"rule"`
	Custom            map[string]*ValidationRule `toml:"custom"`
}

Jump to

Keyboard shortcuts

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