mirror of
https://github.com/usememos/memos.git
synced 2025-06-05 22:09:59 +02:00
refactor: remove resource uid
This commit is contained in:
@@ -72,16 +72,13 @@ func ExtractMemoUIDFromName(name string) (string, error) {
|
||||
return id, nil
|
||||
}
|
||||
|
||||
// ExtractResourceIDFromName returns the resource ID from a resource name.
|
||||
func ExtractResourceIDFromName(name string) (int32, error) {
|
||||
// ExtractResourceUIDFromName returns the resource UID from a resource name.
|
||||
func ExtractResourceUIDFromName(name string) (string, error) {
|
||||
tokens, err := GetNameParentTokens(name, ResourceNamePrefix)
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
id, err := util.ConvertStringToInt32(tokens[0])
|
||||
if err != nil {
|
||||
return 0, errors.Errorf("invalid resource ID %q", tokens[0])
|
||||
return "", err
|
||||
}
|
||||
id := tokens[0]
|
||||
return id, nil
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user