1
0
Fork 0
mirror of https://github.com/diamondburned/arikawa.git synced 2024-11-20 05:43:21 +00:00

discord: Clarify that IsNull isn't useful

This commit is contained in:
diamondburned 2022-03-15 13:32:05 -07:00
parent 87be6b09c1
commit eec8fcf719
No known key found for this signature in database
GPG key ID: D78C4471CE776659
3 changed files with 38 additions and 19 deletions

View file

@ -87,7 +87,8 @@ func (s Snowflake) IsValid() bool {
return !(int64(s) == 0 || s == NullSnowflake) return !(int64(s) == 0 || s == NullSnowflake)
} }
// IsNull returns whether or not the snowflake is null. // IsNull returns whether or not the snowflake is null. This method is rarely
// ever useful; most people should use IsValid instead.
func (s Snowflake) IsNull() bool { func (s Snowflake) IsNull() bool {
return s == NullSnowflake return s == NullSnowflake
} }

View file

@ -19,7 +19,8 @@ func (s AppID) String() string { return Snowflake(s).String() }
// IsValid returns whether or not the snowflake is valid. // IsValid returns whether or not the snowflake is valid.
func (s AppID) IsValid() bool { return Snowflake(s).IsValid() } func (s AppID) IsValid() bool { return Snowflake(s).IsValid() }
// IsNull returns whether or not the snowflake is null. // IsNull returns whether or not the snowflake is null. This method is rarely
// ever useful; most people should use IsValid instead.
func (s AppID) IsNull() bool { return Snowflake(s).IsNull() } func (s AppID) IsNull() bool { return Snowflake(s).IsNull() }
func (s AppID) Time() time.Time { return Snowflake(s).Time() } func (s AppID) Time() time.Time { return Snowflake(s).Time() }
@ -42,7 +43,8 @@ func (s AttachmentID) String() string { return Snowflake(s).String() }
// IsValid returns whether or not the snowflake is valid. // IsValid returns whether or not the snowflake is valid.
func (s AttachmentID) IsValid() bool { return Snowflake(s).IsValid() } func (s AttachmentID) IsValid() bool { return Snowflake(s).IsValid() }
// IsNull returns whether or not the snowflake is null. // IsNull returns whether or not the snowflake is null. This method is rarely
// ever useful; most people should use IsValid instead.
func (s AttachmentID) IsNull() bool { return Snowflake(s).IsNull() } func (s AttachmentID) IsNull() bool { return Snowflake(s).IsNull() }
func (s AttachmentID) Time() time.Time { return Snowflake(s).Time() } func (s AttachmentID) Time() time.Time { return Snowflake(s).Time() }
@ -65,7 +67,8 @@ func (s AuditLogEntryID) String() string { return Snowflake(s).String() }
// IsValid returns whether or not the snowflake is valid. // IsValid returns whether or not the snowflake is valid.
func (s AuditLogEntryID) IsValid() bool { return Snowflake(s).IsValid() } func (s AuditLogEntryID) IsValid() bool { return Snowflake(s).IsValid() }
// IsNull returns whether or not the snowflake is null. // IsNull returns whether or not the snowflake is null. This method is rarely
// ever useful; most people should use IsValid instead.
func (s AuditLogEntryID) IsNull() bool { return Snowflake(s).IsNull() } func (s AuditLogEntryID) IsNull() bool { return Snowflake(s).IsNull() }
func (s AuditLogEntryID) Time() time.Time { return Snowflake(s).Time() } func (s AuditLogEntryID) Time() time.Time { return Snowflake(s).Time() }
@ -88,7 +91,8 @@ func (s ChannelID) String() string { return Snowflake(s).String() }
// IsValid returns whether or not the snowflake is valid. // IsValid returns whether or not the snowflake is valid.
func (s ChannelID) IsValid() bool { return Snowflake(s).IsValid() } func (s ChannelID) IsValid() bool { return Snowflake(s).IsValid() }
// IsNull returns whether or not the snowflake is null. // IsNull returns whether or not the snowflake is null. This method is rarely
// ever useful; most people should use IsValid instead.
func (s ChannelID) IsNull() bool { return Snowflake(s).IsNull() } func (s ChannelID) IsNull() bool { return Snowflake(s).IsNull() }
func (s ChannelID) Time() time.Time { return Snowflake(s).Time() } func (s ChannelID) Time() time.Time { return Snowflake(s).Time() }
@ -111,7 +115,8 @@ func (s CommandID) String() string { return Snowflake(s).String() }
// IsValid returns whether or not the snowflake is valid. // IsValid returns whether or not the snowflake is valid.
func (s CommandID) IsValid() bool { return Snowflake(s).IsValid() } func (s CommandID) IsValid() bool { return Snowflake(s).IsValid() }
// IsNull returns whether or not the snowflake is null. // IsNull returns whether or not the snowflake is null. This method is rarely
// ever useful; most people should use IsValid instead.
func (s CommandID) IsNull() bool { return Snowflake(s).IsNull() } func (s CommandID) IsNull() bool { return Snowflake(s).IsNull() }
func (s CommandID) Time() time.Time { return Snowflake(s).Time() } func (s CommandID) Time() time.Time { return Snowflake(s).Time() }
@ -134,7 +139,8 @@ func (s EmojiID) String() string { return Snowflake(s).String() }
// IsValid returns whether or not the snowflake is valid. // IsValid returns whether or not the snowflake is valid.
func (s EmojiID) IsValid() bool { return Snowflake(s).IsValid() } func (s EmojiID) IsValid() bool { return Snowflake(s).IsValid() }
// IsNull returns whether or not the snowflake is null. // IsNull returns whether or not the snowflake is null. This method is rarely
// ever useful; most people should use IsValid instead.
func (s EmojiID) IsNull() bool { return Snowflake(s).IsNull() } func (s EmojiID) IsNull() bool { return Snowflake(s).IsNull() }
func (s EmojiID) Time() time.Time { return Snowflake(s).Time() } func (s EmojiID) Time() time.Time { return Snowflake(s).Time() }
@ -157,7 +163,8 @@ func (s GuildID) String() string { return Snowflake(s).String() }
// IsValid returns whether or not the snowflake is valid. // IsValid returns whether or not the snowflake is valid.
func (s GuildID) IsValid() bool { return Snowflake(s).IsValid() } func (s GuildID) IsValid() bool { return Snowflake(s).IsValid() }
// IsNull returns whether or not the snowflake is null. // IsNull returns whether or not the snowflake is null. This method is rarely
// ever useful; most people should use IsValid instead.
func (s GuildID) IsNull() bool { return Snowflake(s).IsNull() } func (s GuildID) IsNull() bool { return Snowflake(s).IsNull() }
func (s GuildID) Time() time.Time { return Snowflake(s).Time() } func (s GuildID) Time() time.Time { return Snowflake(s).Time() }
@ -180,7 +187,8 @@ func (s IntegrationID) String() string { return Snowflake(s).String() }
// IsValid returns whether or not the snowflake is valid. // IsValid returns whether or not the snowflake is valid.
func (s IntegrationID) IsValid() bool { return Snowflake(s).IsValid() } func (s IntegrationID) IsValid() bool { return Snowflake(s).IsValid() }
// IsNull returns whether or not the snowflake is null. // IsNull returns whether or not the snowflake is null. This method is rarely
// ever useful; most people should use IsValid instead.
func (s IntegrationID) IsNull() bool { return Snowflake(s).IsNull() } func (s IntegrationID) IsNull() bool { return Snowflake(s).IsNull() }
func (s IntegrationID) Time() time.Time { return Snowflake(s).Time() } func (s IntegrationID) Time() time.Time { return Snowflake(s).Time() }
@ -203,7 +211,8 @@ func (s InteractionID) String() string { return Snowflake(s).String() }
// IsValid returns whether or not the snowflake is valid. // IsValid returns whether or not the snowflake is valid.
func (s InteractionID) IsValid() bool { return Snowflake(s).IsValid() } func (s InteractionID) IsValid() bool { return Snowflake(s).IsValid() }
// IsNull returns whether or not the snowflake is null. // IsNull returns whether or not the snowflake is null. This method is rarely
// ever useful; most people should use IsValid instead.
func (s InteractionID) IsNull() bool { return Snowflake(s).IsNull() } func (s InteractionID) IsNull() bool { return Snowflake(s).IsNull() }
func (s InteractionID) Time() time.Time { return Snowflake(s).Time() } func (s InteractionID) Time() time.Time { return Snowflake(s).Time() }
@ -226,7 +235,8 @@ func (s MessageID) String() string { return Snowflake(s).String() }
// IsValid returns whether or not the snowflake is valid. // IsValid returns whether or not the snowflake is valid.
func (s MessageID) IsValid() bool { return Snowflake(s).IsValid() } func (s MessageID) IsValid() bool { return Snowflake(s).IsValid() }
// IsNull returns whether or not the snowflake is null. // IsNull returns whether or not the snowflake is null. This method is rarely
// ever useful; most people should use IsValid instead.
func (s MessageID) IsNull() bool { return Snowflake(s).IsNull() } func (s MessageID) IsNull() bool { return Snowflake(s).IsNull() }
func (s MessageID) Time() time.Time { return Snowflake(s).Time() } func (s MessageID) Time() time.Time { return Snowflake(s).Time() }
@ -249,7 +259,8 @@ func (s RoleID) String() string { return Snowflake(s).String() }
// IsValid returns whether or not the snowflake is valid. // IsValid returns whether or not the snowflake is valid.
func (s RoleID) IsValid() bool { return Snowflake(s).IsValid() } func (s RoleID) IsValid() bool { return Snowflake(s).IsValid() }
// IsNull returns whether or not the snowflake is null. // IsNull returns whether or not the snowflake is null. This method is rarely
// ever useful; most people should use IsValid instead.
func (s RoleID) IsNull() bool { return Snowflake(s).IsNull() } func (s RoleID) IsNull() bool { return Snowflake(s).IsNull() }
func (s RoleID) Time() time.Time { return Snowflake(s).Time() } func (s RoleID) Time() time.Time { return Snowflake(s).Time() }
@ -272,7 +283,8 @@ func (s StageID) String() string { return Snowflake(s).String() }
// IsValid returns whether or not the snowflake is valid. // IsValid returns whether or not the snowflake is valid.
func (s StageID) IsValid() bool { return Snowflake(s).IsValid() } func (s StageID) IsValid() bool { return Snowflake(s).IsValid() }
// IsNull returns whether or not the snowflake is null. // IsNull returns whether or not the snowflake is null. This method is rarely
// ever useful; most people should use IsValid instead.
func (s StageID) IsNull() bool { return Snowflake(s).IsNull() } func (s StageID) IsNull() bool { return Snowflake(s).IsNull() }
func (s StageID) Time() time.Time { return Snowflake(s).Time() } func (s StageID) Time() time.Time { return Snowflake(s).Time() }
@ -295,7 +307,8 @@ func (s StickerID) String() string { return Snowflake(s).String() }
// IsValid returns whether or not the snowflake is valid. // IsValid returns whether or not the snowflake is valid.
func (s StickerID) IsValid() bool { return Snowflake(s).IsValid() } func (s StickerID) IsValid() bool { return Snowflake(s).IsValid() }
// IsNull returns whether or not the snowflake is null. // IsNull returns whether or not the snowflake is null. This method is rarely
// ever useful; most people should use IsValid instead.
func (s StickerID) IsNull() bool { return Snowflake(s).IsNull() } func (s StickerID) IsNull() bool { return Snowflake(s).IsNull() }
func (s StickerID) Time() time.Time { return Snowflake(s).Time() } func (s StickerID) Time() time.Time { return Snowflake(s).Time() }
@ -318,7 +331,8 @@ func (s StickerPackID) String() string { return Snowflake(s).String() }
// IsValid returns whether or not the snowflake is valid. // IsValid returns whether or not the snowflake is valid.
func (s StickerPackID) IsValid() bool { return Snowflake(s).IsValid() } func (s StickerPackID) IsValid() bool { return Snowflake(s).IsValid() }
// IsNull returns whether or not the snowflake is null. // IsNull returns whether or not the snowflake is null. This method is rarely
// ever useful; most people should use IsValid instead.
func (s StickerPackID) IsNull() bool { return Snowflake(s).IsNull() } func (s StickerPackID) IsNull() bool { return Snowflake(s).IsNull() }
func (s StickerPackID) Time() time.Time { return Snowflake(s).Time() } func (s StickerPackID) Time() time.Time { return Snowflake(s).Time() }
@ -341,7 +355,8 @@ func (s TeamID) String() string { return Snowflake(s).String() }
// IsValid returns whether or not the snowflake is valid. // IsValid returns whether or not the snowflake is valid.
func (s TeamID) IsValid() bool { return Snowflake(s).IsValid() } func (s TeamID) IsValid() bool { return Snowflake(s).IsValid() }
// IsNull returns whether or not the snowflake is null. // IsNull returns whether or not the snowflake is null. This method is rarely
// ever useful; most people should use IsValid instead.
func (s TeamID) IsNull() bool { return Snowflake(s).IsNull() } func (s TeamID) IsNull() bool { return Snowflake(s).IsNull() }
func (s TeamID) Time() time.Time { return Snowflake(s).Time() } func (s TeamID) Time() time.Time { return Snowflake(s).Time() }
@ -364,7 +379,8 @@ func (s UserID) String() string { return Snowflake(s).String() }
// IsValid returns whether or not the snowflake is valid. // IsValid returns whether or not the snowflake is valid.
func (s UserID) IsValid() bool { return Snowflake(s).IsValid() } func (s UserID) IsValid() bool { return Snowflake(s).IsValid() }
// IsNull returns whether or not the snowflake is null. // IsNull returns whether or not the snowflake is null. This method is rarely
// ever useful; most people should use IsValid instead.
func (s UserID) IsNull() bool { return Snowflake(s).IsNull() } func (s UserID) IsNull() bool { return Snowflake(s).IsNull() }
func (s UserID) Time() time.Time { return Snowflake(s).Time() } func (s UserID) Time() time.Time { return Snowflake(s).Time() }
@ -387,7 +403,8 @@ func (s WebhookID) String() string { return Snowflake(s).String() }
// IsValid returns whether or not the snowflake is valid. // IsValid returns whether or not the snowflake is valid.
func (s WebhookID) IsValid() bool { return Snowflake(s).IsValid() } func (s WebhookID) IsValid() bool { return Snowflake(s).IsValid() }
// IsNull returns whether or not the snowflake is null. // IsNull returns whether or not the snowflake is null. This method is rarely
// ever useful; most people should use IsValid instead.
func (s WebhookID) IsNull() bool { return Snowflake(s).IsNull() } func (s WebhookID) IsNull() bool { return Snowflake(s).IsNull() }
func (s WebhookID) Time() time.Time { return Snowflake(s).Time() } func (s WebhookID) Time() time.Time { return Snowflake(s).Time() }

View file

@ -28,7 +28,8 @@ func (s {{.TypeName}}) String() string { return {{$dot}}Snowflake(s).String() }
// IsValid returns whether or not the snowflake is valid. // IsValid returns whether or not the snowflake is valid.
func (s {{.TypeName}}) IsValid() bool { return {{$dot}}Snowflake(s).IsValid() } func (s {{.TypeName}}) IsValid() bool { return {{$dot}}Snowflake(s).IsValid() }
// IsNull returns whether or not the snowflake is null. // IsNull returns whether or not the snowflake is null. This method is rarely
// ever useful; most people should use IsValid instead.
func (s {{.TypeName}}) IsNull() bool { return {{$dot}}Snowflake(s).IsNull() } func (s {{.TypeName}}) IsNull() bool { return {{$dot}}Snowflake(s).IsNull() }
func (s {{.TypeName}}) Time() time.Time { return {{$dot}}Snowflake(s).Time() } func (s {{.TypeName}}) Time() time.Time { return {{$dot}}Snowflake(s).Time() }