linstrom/ap/util.go

20 lines
389 B
Go
Raw Normal View History

2024-08-28 15:20:38 +00:00
package ap
import "strings"
type InvalidFullHandleError struct {
Raw string
}
func (i InvalidFullHandleError) Error() string {
return "Invalid full handle"
}
func SplitFullHandle(full string) (string, string, error) {
splits := strings.Split(strings.TrimPrefix(full, "@"), "@")
if len(splits) != 2 {
return "", "", InvalidFullHandleError{}
}
return splits[0], splits[1], nil
}