mirror of
https://github.com/diamondburned/arikawa.git
synced 2024-10-31 20:14:21 +00:00
39 lines
1.5 KiB
Cheetah
39 lines
1.5 KiB
Cheetah
|
// Code generated by gensnowflake. DO NOT EDIT.
|
||
|
|
||
|
package {{ .Package }}
|
||
|
|
||
|
{{ $dot := "" }}
|
||
|
|
||
|
{{ if .ImportDiscord }}
|
||
|
{{ $dot = "discord." }}
|
||
|
import "github.com/diamondburned/arikawa/v3/discord"
|
||
|
{{ end }}
|
||
|
|
||
|
import "time"
|
||
|
|
||
|
{{ range .Snowflakes }}
|
||
|
|
||
|
// {{ .TypeName }} is the snowflake type for a {{ .TypeName }}.
|
||
|
type {{.TypeName}} {{$dot}}Snowflake
|
||
|
|
||
|
// Null{{.TypeName}} gets encoded into a null. This is used for optional and nullable snowflake fields.
|
||
|
const Null{{.TypeName}} = {{.TypeName}}({{$dot}}NullSnowflake)
|
||
|
|
||
|
func (s {{.TypeName}}) MarshalJSON() ([]byte, error) { return {{$dot}}Snowflake(s).MarshalJSON() }
|
||
|
func (s *{{.TypeName}}) UnmarshalJSON(v []byte) error { return (*{{$dot}}Snowflake)(s).UnmarshalJSON(v) }
|
||
|
|
||
|
// String returns the ID, or nothing if the snowflake isn't valid.
|
||
|
func (s {{.TypeName}}) String() string { return {{$dot}}Snowflake(s).String() }
|
||
|
|
||
|
// IsValid returns whether or not the snowflake is valid.
|
||
|
func (s {{.TypeName}}) IsValid() bool { return {{$dot}}Snowflake(s).IsValid() }
|
||
|
|
||
|
// IsNull returns whether or not the snowflake is null.
|
||
|
func (s {{.TypeName}}) IsNull() bool { return {{$dot}}Snowflake(s).IsNull() }
|
||
|
|
||
|
func (s {{.TypeName}}) Time() time.Time { return {{$dot}}Snowflake(s).Time() }
|
||
|
func (s {{.TypeName}}) Worker() uint8 { return {{$dot}}Snowflake(s).Worker() }
|
||
|
func (s {{.TypeName}}) PID() uint8 { return {{$dot}}Snowflake(s).PID() }
|
||
|
func (s {{.TypeName}}) Increment() uint16 { return {{$dot}}Snowflake(s).Increment() }
|
||
|
{{ end }}
|