model

package
v0.0.0-...-bdf525e Latest Latest
Warning

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

Go to latest
Published: Dec 5, 2023 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Channel

type Channel struct {
	ID        string    `firestore:"id" json:"channelID"`
	CreatedAt time.Time `firestore:"created_at" json:"createdAt"`
	UpdatedAt time.Time `firestore:"updated_at" json:"updatedAt"`

	Name              string    `firestore:"name" json:"name"`
	UserID            string    `firestore:"user_id" json:"userID"`
	UserIDs           []string  `firestore:"user_ids" json:"userIDs"`
	Private           bool      `firestore:"private" json:"private"`
	LastMessageSentAt time.Time `firestore:"last_message_sent_at" json:"lastMessageSentAt"`
}

func (Channel) Type

func (Channel) Type() Type

type Message

type Message struct {
	ID        string    `firestore:"id" json:"messageID"`
	CreatedAt time.Time `firestore:"created_at" json:"createdAt"`
	UpdatedAt time.Time `firestore:"updated_at" json:"updatedAt"`

	UserID    string `firestore:"user_id" json:"userID"`
	ChannelID string `firestore:"channel_id" json:"channelID"`
	Body      string `firestore:"body" json:"body"`
}

func (Message) MarshalJSON

func (m Message) MarshalJSON() ([]byte, error)

func (Message) Type

func (Message) Type() Type

type Type

type Type string
const (
	TypeChannel   Type = "channel"
	WorldChatName      = "World Chat"
)
const TypeMessage Type = "message"
const TypeUser Type = "user"

func (Type) String

func (t Type) String() string

func (Type) Type

func (t Type) Type() Type

type Typer

type Typer interface {
	Type() Type
}

type User

type User struct {
	ID        string    `firestore:"id" json:"userID"`
	CreatedAt time.Time `firestore:"created_at" json:"createdAt"`
	UpdatedAt time.Time `firestore:"updated_at" json:"updatedAt"`

	Screenname     string `firestore:"screenname" json:"screenname"`
	PasswordDigest []byte `firestore:"password_digest" json:"-"`
}

func UserFromContext

func UserFromContext(ctx context.Context) (User, bool)

func (*User) OnContext

func (u *User) OnContext(ctx context.Context) context.Context

func (*User) PasswordMatches

func (u *User) PasswordMatches(password string) (bool, error)

func (User) Type

func (User) Type() Type

func (*User) UpdatePassword

func (u *User) UpdatePassword(password string) error

Jump to

Keyboard shortcuts

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