Mercurial > gemma
comparison pkg/imports/modelconvert.go @ 4178:51e90370eced
A few more doc strings to make 'golint' a little bit more happy with the imports package.
author | Sascha L. Teichmann <sascha.teichmann@intevation.de> |
---|---|
date | Mon, 05 Aug 2019 17:45:03 +0200 |
parents | c8ded555c2a8 |
children | 2ac52d89619e |
comparison
equal
deleted
inserted
replaced
4177:8b75ac5e243e | 4178:51e90370eced |
---|---|
29 DMAJobKind: func() interface{} { return new(models.DistanceMarksAshoreImport) }, | 29 DMAJobKind: func() interface{} { return new(models.DistanceMarksAshoreImport) }, |
30 STJobKind: func() interface{} { return new(models.StretchImport) }, | 30 STJobKind: func() interface{} { return new(models.StretchImport) }, |
31 SECJobKind: func() interface{} { return new(models.SectionImport) }, | 31 SECJobKind: func() interface{} { return new(models.SectionImport) }, |
32 } | 32 } |
33 | 33 |
34 // ImportModelForJobKind returns the constructor function to | |
35 // de-serialize an incoming JSON REST represention of an import. | |
34 func ImportModelForJobKind(kind JobKind) func() interface{} { | 36 func ImportModelForJobKind(kind JobKind) func() interface{} { |
35 return kindToImportModel[kind] | 37 return kindToImportModel[kind] |
36 } | 38 } |
37 | 39 |
38 var convertModel = map[JobKind]func(interface{}) interface{}{ | 40 var convertModel = map[JobKind]func(interface{}) interface{}{ |
166 return *s | 168 return *s |
167 } | 169 } |
168 return "" | 170 return "" |
169 } | 171 } |
170 | 172 |
173 // ConvertToInternal converts an external JSON REST represention | |
174 // of an import into the internal one store in the import queue. | |
171 func ConvertToInternal(kind JobKind, src interface{}) interface{} { | 175 func ConvertToInternal(kind JobKind, src interface{}) interface{} { |
172 fn := convertModel[kind] | 176 fn := convertModel[kind] |
173 if fn == nil { | 177 if fn == nil { |
174 return nil | 178 return nil |
175 } | 179 } |