Documentation
¶
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ReadMachineID ¶
func ReadMachineID() []byte
ReadMachineID reads the machine ID from the environment variable or generates a random one.
Types ¶
type ResourceID ¶
type ResourceID string
Example ¶
package main
import (
"fmt"
"github.com/MortalSC/MiniBlog/internal/pkg/rid"
)
func main() {
userID := rid.UserID
idString := userID.String()
fmt.Println(idString)
}
Output: user
const ( // UserID is the resource ID for user UserID ResourceID = "user" // PostID is the resource ID for post PostID ResourceID = "post" )
func (ResourceID) New ¶
func (r ResourceID) New(counter uint64) string
New generates a new resource ID based on the given ID.
func (ResourceID) String ¶
func (r ResourceID) String() string
String returns the string representation of the resource ID.
Click to show internal directories.
Click to hide internal directories.