user

package
v0.0.0-...-2b93282 Latest Latest
Warning

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

Go to latest
Published: Jan 24, 2024 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type User

type User struct {
	ID             primitive.ObjectID `json:"id" bson:"_id,omitempty"`
	Username       string             `json:"username" bson:"username"`
	Avatar         string             `json:"avatar" bson:"avatar"`
	UseTwitterAuth bool               `json:"use_twitter_auth" bson:"use_twitter_auth"`
	Twitter        typing.Twitter     `json:"twitter" bson:"twitter"`
	CreatedAt      time.Time          `json:"created_at" bson:"created_at"`
	UpdatedAt      time.Time          `json:"updated_at" bson:"updated_at"`
}

func (*User) Create

func (u *User) Create() error

Create inserts a new user into the database

func (*User) Find

func (u *User) Find() error

Find finds user by id

func (*User) FindByUsername

func (u *User) FindByUsername() error

FindByUsername finds user by username

func (*User) FindSocial

func (u *User) FindSocial(q typing.Social) error

FindUser finds user by social id

func (*User) RefreshTwitterAccessToken

func (u *User) RefreshTwitterAccessToken() error

RefreshTwitterAccessToken refreshes a twitter access token

func (*User) Safe

func (u *User) Safe()

Safe removes sensitive information from user

func (*User) Save

func (u *User) Save() error

Save updates user in database

func (*User) SetDefaultAvatar

func (u *User) SetDefaultAvatar() error

check if a user has an Avatar

Jump to

Keyboard shortcuts

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