models

package
v0.0.0-...-c1f85f1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 31, 2024 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const MaxTweetLen = 280 // characters

Variables

View Source
var ErrTweetTooLong = errors.New("tweets must have less than 280 characters")

Functions

This section is empty.

Types

type Tweet

type Tweet struct {
	UserID    uint      `json:"userId"`
	Timestamp time.Time `json:"timestamp"`
	Content   string    `json:"content"`
}

func NewTweet

func NewTweet(userID uint, timestamp time.Time, content string) (*Tweet, error)

NewTweet creates a tweet.

Returns ErrTweetTooLong if content len is bigger than 280 characters

func (Tweet) MarshalBinary

func (tweet Tweet) MarshalBinary() (data []byte, err error)

Implement encoding.BinaryMarshaler

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL