Go · 288 bytes Raw Blame History
1 // SPDX-License-Identifier: AGPL-3.0-or-later
2
3 package jobs
4
5 import "fmt"
6
7 func ownerSlugString(v any) (string, error) {
8 switch s := v.(type) {
9 case string:
10 return s, nil
11 case []byte:
12 return string(s), nil
13 default:
14 return "", fmt.Errorf("unexpected owner slug type %T", v)
15 }
16 }
17