MCPcopy
hub / github.com/gin-gonic/gin / convertTo

Function convertTo

binding/form_mapping_test.go:677–690  ·  view source on GitHub ↗
(s string)

Source from the content-addressed store, hash-verified

675}
676
677func convertTo(s string) (objectID, error) {
678 var nilObjectID objectID
679 if len(s) != 24 {
680 return nilObjectID, errors.New("invalid format")
681 }
682
683 var oid [12]byte
684 _, err := hex.Decode(oid[:], []byte(s))
685 if err != nil {
686 return nilObjectID, err
687 }
688
689 return oid, nil
690}
691
692func TestMappingCustomArrayUri(t *testing.T) {
693 var s struct {

Calls 1

DecodeMethod · 0.65

Tested by

no test coverage detected