-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathtypes_ids.go
More file actions
73 lines (57 loc) · 1.68 KB
/
types_ids.go
File metadata and controls
73 lines (57 loc) · 1.68 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
package threads
// PostID represents a unique identifier for a post
type PostID string
// String returns the string representation of the PostID
func (id PostID) String() string {
return string(id)
}
// Valid checks if the PostID is not empty
func (id PostID) Valid() bool {
return id != ""
}
// UserID represents a unique identifier for a user
type UserID string
// String returns the string representation of the UserID
func (id UserID) String() string {
return string(id)
}
// Valid checks if the UserID is not empty
func (id UserID) Valid() bool {
return id != ""
}
// ContainerID represents a unique identifier for a media container
type ContainerID string
// String returns the string representation of the ContainerID
func (id ContainerID) String() string {
return string(id)
}
// Valid checks if the ContainerID is not empty
func (id ContainerID) Valid() bool {
return id != ""
}
// LocationID represents a unique identifier for a location
type LocationID string
// String returns the string representation of the LocationID
func (id LocationID) String() string {
return string(id)
}
// Valid checks if the LocationID is not empty
func (id LocationID) Valid() bool {
return id != ""
}
// ConvertToPostID safely converts a string to PostID
func ConvertToPostID(s string) PostID {
return PostID(s)
}
// ConvertToUserID safely converts a string to UserID
func ConvertToUserID(s string) UserID {
return UserID(s)
}
// ConvertToContainerID safely converts a string to ContainerID
func ConvertToContainerID(s string) ContainerID {
return ContainerID(s)
}
// ConvertToLocationID safely converts a string to LocationID
func ConvertToLocationID(s string) LocationID {
return LocationID(s)
}