MCPcopy
hub / github.com/apache/answer / GetObjectTypeStrByObjectID

Function GetObjectTypeStrByObjectID

pkg/obj/obj.go:30–40  ·  view source on GitHub ↗

GetObjectTypeStrByObjectID get object key by object id

(objectID string)

Source from the content-addressed store, hash-verified

28
29// GetObjectTypeStrByObjectID get object key by object id
30func GetObjectTypeStrByObjectID(objectID string) (objectTypeStr string, err error) {
31 if err := checkObjectID(objectID); err != nil {
32 return "", err
33 }
34 objectTypeNumber := converter.StringToInt(objectID[1:4])
35 objectTypeStr, ok := constant.ObjectTypeNumberMapping[objectTypeNumber]
36 if ok {
37 return objectTypeStr, nil
38 }
39 return "", errors.BadRequest(reason.ObjectNotFound)
40}
41
42// GetObjectTypeNumberByObjectID get object type by object id
43func GetObjectTypeNumberByObjectID(objectID string) (objectTypeNumber int, err error) {

Callers 15

addUniqueIDFunction · 0.92
QuestionInfoRedirectMethod · 0.92
GetObjectTimelineMethod · 0.92
GetInfoMethod · 0.92
RevisionAuditMethod · 0.92
UpdateReportedObjectMethod · 0.92
AddOrUpdateReactionMethod · 0.92
FollowMethod · 0.92

Calls 2

StringToIntFunction · 0.92
checkObjectIDFunction · 0.85

Tested by

no test coverage detected