This commit is contained in:
Michael McGuinness
2025-01-06 12:26:28 +00:00
parent 0447ec4c4b
commit c282a052ef
25 changed files with 218 additions and 58 deletions
+11 -2
View File
@@ -27,7 +27,7 @@ func ParseDBType(qType repository.Querytype) (Type, error) {
}
}
func ToDBQueryType(t Type) (repository.NullQuerytype, error) {
func ToDBQueryType(t Type) (repository.Querytype, error) {
var dbType repository.Querytype
switch t {
@@ -36,7 +36,16 @@ func ToDBQueryType(t Type) (repository.NullQuerytype, error) {
case TypeContextFull:
dbType = repository.QuerytypeContextFull
default:
return repository.NullQuerytype{}, fmt.Errorf("invalid database query type")
return repository.QuerytypeContextFull, fmt.Errorf("invalid database query type")
}
return dbType, nil
}
func ToDBNullQueryType(t Type) (repository.NullQuerytype, error) {
dbType, err := ToDBQueryType(t)
if err != nil {
return repository.NullQuerytype{}, err
}
return repository.NullQuerytype{Querytype: dbType, Valid: true}, nil