accounts

package
v0.0.0-...-83f4045 Latest Latest
Warning

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

Go to latest
Published: Oct 24, 2021 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Run

func Run() error

Run accounts gRPC service.

Types

type Account

type Account interface {
	New() error

	FindAccountByUsername() (*Accounts, error)

	Update() error

	// UpdateUsername Change the username and pass the target username as a parameter.
	UpdateUsername(target string) error

	Delete() error
}

type AccountAuth

type AccountAuth interface {
	// Login to the account and generate token, Return token and custom error message.
	Login() (string, error)
}

AccountAuth The interface for account authorization, including method interfaces for login or developer API permissions.

func NewAuth

func NewAuth(mail string, password string) AccountAuth

type Accounts

type Accounts struct {
	gorm.Model

	Username string `gorm:"primaryKey;type:text;preferredUsername;" validate:"required,min=4,max=16"`
	Mail     string `gorm:"index;type:text;mail;unique" validate:"required,email"`
	Password string `gorm:"type:text;password" validate:"required,min=8,max=100"`

	// When creating an account, first verify the username, email address, and password.
	// After the verification is successful, store the username and key in the actors table,
	// then use the returned ActorID in this field, and then store the data in the accounts table .
	// At this time, the context of creating the user is complete.
	ActorID uint `gorm:"type:bigint;actor_id"`

	// Whether to set as a private account
	IsPrivate  bool   `gorm:"type:boolean;is_private"`
	PrivateKey string `gorm:"type:text;private_key"`
}

func NewAccounts

func NewAccounts(username string, mail string, password string) *Accounts

func NewAccountsName

func NewAccountsName(username string) *Accounts

func NewAcctNameANDActorID

func NewAcctNameANDActorID(username string, id uint) *Accounts

func (*Accounts) Delete

func (a *Accounts) Delete() error

func (*Accounts) FindAccountByUsername

func (a *Accounts) FindAccountByUsername() (*Accounts, error)

func (*Accounts) Login

func (a *Accounts) Login() (string, error)

func (*Accounts) New

func (a *Accounts) New() error

func (*Accounts) Update

func (a *Accounts) Update() error

func (*Accounts) UpdateUsername

func (a *Accounts) UpdateUsername(target string) error

type Actor

type Actor interface {
	// NewActor Create new actors data and add the returned ID to the accounts field.
	NewActor() (*Actors, error)

	AddActor() (*Actors, error)

	// FindByPreferredUsername Find the Actor collection by PreferredUsername.
	FindByPreferredUsername() (*[]Actors, error)

	FindActorByAccountUsername() (*Actors, error)
	FindActorByID() (*Actors, error)
	FindActorByUrl() (*Actors, error)

	Update() error
}

type Actors

type Actors struct {
	gorm.Model

	PreferredUsername string `gorm:"primaryKey;type:text;preferredUsername;"`
	Domain            string `gorm:"index;type:text;domain"`
	Avatar            string `gorm:"type:text;avatar"`
	Name              string `gorm:"type:text;name"`
	Summary           string `gorm:"type:text;summary"`
	Inbox             string `gorm:"type:text;inbox"`
	Url               string `gorm:"index;test;url"`
	PublicKey         string `gorm:"type:text;public_key"`

	// ID returned after completing the registration of the matrix account.
	MatrixID    string `gorm:"type:text;matrix_id;unique"`
	MatrixToken string `gorm:"type:text;matrix_token"`

	// Whether it is a robot or other type of account
	ActorType string `gorm:"type:text;actor_type"`

	// Set whether it is a remote actor.
	IsRemote bool `gorm:"type:boolean;is_remote"`
}

func NewActorID

func NewActorID(id uint) *Actors

func NewActorUrl

func NewActorUrl(url string) *Actors

func NewActors

func NewActors(preferredUsername, password, publicKey string) *Actors

func NewActorsPreferredUsername

func NewActorsPreferredUsername(preferredUsername string) *Actors

func NewAddActor

func NewAddActor(PreferredUsername, Domain, Avatar, Name, Summary, Inbox, Url, PublicKey, MatrixID, ActorType string) *Actors

NewAddActor Add an Actor from remote and set IsRemote to true.

func (*Actors) AddActor

func (a *Actors) AddActor() (*Actors, error)

func (*Actors) FindActorByAccountUsername

func (a *Actors) FindActorByAccountUsername() (*Actors, error)

func (*Actors) FindActorByID

func (a *Actors) FindActorByID() (*Actors, error)

func (*Actors) FindActorByUrl

func (a *Actors) FindActorByUrl() (*Actors, error)

func (*Actors) FindByPreferredUsername

func (a *Actors) FindByPreferredUsername() (*[]Actors, error)

func (*Actors) NewActor

func (a *Actors) NewActor() (*Actors, error)

func (*Actors) Update

func (a *Actors) Update() error

type Follow

type Follow interface {
	New() error

	Remove() error

	FetchFollowers() *[]uint

	FetchFollowing() *[]uint
}

type Follows

type Follows struct {
	gorm.Model

	ActorID  uint `gorm:"primaryKey;bigint;actor_id"`
	TargetID uint `gorm:"primaryKey;bigint;target_id"`
}

func NewFetchByID

func NewFetchByID(id uint) *Follows

func NewFollows

func NewFollows(actorID uint, targetID uint) *Follows

func (*Follows) FetchFollowers

func (f *Follows) FetchFollowers() *[]uint

func (*Follows) FetchFollowing

func (f *Follows) FetchFollowing() *[]uint

func (*Follows) New

func (f *Follows) New() error

func (*Follows) Remove

func (f *Follows) Remove() error

Jump to

Keyboard shortcuts

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