object

package
v0.0.0-...-4151d87 Latest Latest
Warning

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

Go to latest
Published: Sep 22, 2021 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TypeImage = 1
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Account

type Account struct {
	ID           AccountID `json:"-"`
	Username     string    `json:"username,omitempty"`
	PasswordHash string    `json:"-" db:"password_hash"`
	DisplayName  *string   `json:"display_name,omitempty" db:"display_name"`
	// URL to the avatar image
	Avatar *string `json:"avatar,omitempty"`
	// URL to the header image
	Header *string `json:"header,omitempty"`
	// Biography of user
	Note     *string   `json:"note,omitempty"`
	CreateAt DateTime  `json:"create_at,omitempty" db:"create_at"`
	DeleteAt *DateTime `json:"-" db:"delete_at"`
}

func (*Account) CheckPassword

func (a *Account) CheckPassword(pass string) bool

Check if given password is match to account's password

func (*Account) SetPassword

func (a *Account) SetPassword(pass string) error

Hash password and set it to account object

type AccountID

type AccountID = int64

type DateTime

type DateTime struct{ time.Time }

Wrapper of time.Time to implement custom method for JSON/DB interface

func (*DateTime) MarshalJSON

func (t *DateTime) MarshalJSON() ([]byte, error)

encoding/json/Marshaler

func (*DateTime) Scan

func (t *DateTime) Scan(value interface{}) error

database/sql/driver/Valuer

func (*DateTime) UnmarshalJSON

func (t *DateTime) UnmarshalJSON(b []byte) error

encoding/json/Unmarshaler

func (DateTime) Value

func (t DateTime) Value() (driver.Value, error)

database/sql/driver/Valuer

type MediaAttachment

type MediaAttachment struct {
	ID          MediaAttachmentID `json:"-"`
	StatusID    StatusID          `json:"id" db:"status_id"`
	Type        int64             `json:"-" db:"type"`
	URL         string            `json:"url,omitempty" db:"url"`
	Description string            `json:"description,omitempty"`
	CreateAt    DateTime          `json:"create_at,omitempty" db:"create_at"`
	DeleteAt    *DateTime         `json:"-" db:"delete_at"`

	MediaType *string `json:"type,omitempty"`
}

func (*MediaAttachment) SetMediaType

func (m *MediaAttachment) SetMediaType()

type MediaAttachmentID

type MediaAttachmentID = int64

type PasswordHash

type PasswordHash = string

type Status

type Status struct {
	ID        StatusID  `json:"id"`
	AccountID AccountID `json:"-" db:"account_id"`
	Content   string    `json:"content"`
	CreateAt  DateTime  `json:"create_at,omitempty" db:"create_at"`
	DeleteAt  *DateTime `json:"-" db:"delete_at"`

	Account         *Account           `json:"account,omitempty"`
	MediaAttachment []*MediaAttachment `json:"media_attachments,omitempty"`
}

type StatusID

type StatusID = int64

Jump to

Keyboard shortcuts

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