1
0
Fork 0
mirror of https://github.com/diamondburned/arikawa.git synced 2024-11-19 05:12:48 +00:00
arikawa/internal/moreatomic/snowflake.go

18 lines
316 B
Go
Raw Normal View History

package moreatomic
import (
"sync/atomic"
2021-06-02 02:53:19 +00:00
"github.com/diamondburned/arikawa/v3/discord"
)
type Snowflake int64
func (s *Snowflake) Get() discord.Snowflake {
return discord.Snowflake(atomic.LoadInt64((*int64)(s)))
}
func (s *Snowflake) Set(id discord.Snowflake) {
atomic.StoreInt64((*int64)(s), int64(id))
}