Adding upstream version 3.10.8.
Signed-off-by: Daniel Baumann <daniel@debian.org>
This commit is contained in:
parent
37e9b6d587
commit
03bfe4079e
356 changed files with 28857 additions and 0 deletions
36
id/id.go
Normal file
36
id/id.go
Normal file
|
@ -0,0 +1,36 @@
|
|||
// Copyright twenty-panda <twenty-panda@posteo.com>
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
package id
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"code.forgejo.org/f3/gof3/v3/util"
|
||||
)
|
||||
|
||||
type NodeID interface {
|
||||
String() string
|
||||
Int() int
|
||||
Int64() int64
|
||||
}
|
||||
|
||||
var NilID = NewNodeID("")
|
||||
|
||||
type nodeID string
|
||||
|
||||
func NewNodeID[T any](id T) NodeID {
|
||||
return nodeID(fmt.Sprintf("%v", id))
|
||||
}
|
||||
|
||||
func (o nodeID) String() string {
|
||||
return string(o)
|
||||
}
|
||||
|
||||
func (o nodeID) Int() int {
|
||||
return int(o.Int64())
|
||||
}
|
||||
|
||||
func (o nodeID) Int64() int64 {
|
||||
return util.ParseInt(string(o))
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue