func NewValidationTypeFromString(s string) (*ValidationType, error) {
	v := &ValidationType{}

	if !strings.Contains(s, " ") {
		return nil, errIncorrectKeyFormat
	}

	// <type> <data>
	parts := strings.SplitN(s, " ", 2)

	// Check type
	switch strings.ToLower(parts[0]) {
	case TypeDNS:
		v.Type = TypeDNS
	case TypeGPG:
		v.Type = TypeGPG
	case TypeKeyBase:
		v.Type = TypeKeyBase
	default:
		return nil, errIncorrectKeyType
	}

	// Set value
	val := strings.TrimSpace(parts[1])
	if len(val) == 0 {
		return nil, errIncorrectKeyFormat
	}
	v.Value = parts[1]

	return v, nil
}
// NewValidationTypeFromString creates a new validation type from the given string
NewValidationTypeFromString creates a new validation type from the given string
// NewValidationTypeFromString creates a new validation type from the given string
func NewValidationTypeFromString(s string) (*ValidationType, error) {
	v := &ValidationType{}
	if !strings.Contains(s, " ") {
		return nil, errIncorrectKeyFormat
	}
	parts := strings.SplitN(s, " ", 2)
	switch strings.ToLower(parts[0]) {
	case TypeDNS:
		v.Type = TypeDNS
	case TypeGPG:
		v.Type = TypeGPG
	case TypeKeyBase:
		v.Type = TypeKeyBase
	default:
		return nil, errIncorrectKeyType
	}
	val := strings.TrimSpace(parts[1])
	if len(val) == 0 {
		return nil, errIncorrectKeyFormat
	}
	v.Value = parts[1]
	return v, nil
}
func NewValidationTypeFromString ( s string ) ( * ValidationType , error ) { v := & ValidationType { } if ! strings . Contains ( s , " " ) { return nil , errIncorrectKeyFormat } parts := strings . SplitN ( s , " " , 2 ) switch strings . ToLower ( parts [ 0 ] ) { case TypeDNS : v . Type = TypeDNS case TypeGPG : v . Type = TypeGPG case TypeKeyBase : v . Type = TypeKeyBase default : return nil , errIncorrectKeyType } val := strings . TrimSpace ( parts [ 1 ] ) if len ( val ) == 0 { return nil , errIncorrectKeyFormat } v . Value = parts [ 1 ] return v , nil }
NewValidationTypeFromString creates a new validation type from the given string
NewValidationTypeFromString creates a new validation type from the given string
// <type> <data> // Check type // Set value