internal

package
v0.0.0-...-a0d1ad3 Latest Latest
Warning

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

Go to latest
Published: Nov 25, 2022 License: MIT, Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const (
	AccountsTable = "accounts"
	ActorsTable   = "actors"
)

Variables

This section is empty.

Functions

func Run

func Run() error

Types

type Actor

type Actor interface {
	// IsExist Actor exists or not.
	IsExist() (*Actors, bool)

	// Create Actor.
	Create() (*Actors, error)

	// Get Actor.
	Get() (*Actors, error)

	// GetActorsByPreferredUsername Get Actors by preferred username.
	GetActorsByPreferredUsername() ([]*Actors, error)

	// AddActor Add Actor.
	// Used when saving users from other instances to this instance.
	AddActor() (*Actors, error)

	// GetActorByUsername Get Actor by username.
	GetActorByUsername() (*Actors, error)

	// Edit Actor.
	Edit() error

	// Delete Actor.
	Delete() error
}

type Actors

type Actors struct {
	gorm.Model

	// PreferredUsername is the preferred username for the actor.
	// The username is stored for multiple instances, so it is repeatable.
	PreferredUsername string `gorm:"primaryKey;type:text;preferred_username;"`

	// Domain name of the instance,
	// for example: https://example.com, example.com is the domain name.
	Domain string `gorm:"index;type:text;domain"`

	// Avatar is the URL of the avatar image. it can also be an empty string.
	Avatar string `gorm:"type:text;avatar"`

	// Name is the name of the actor, for example: John Doe.
	Name string `gorm:"type:text;name"`

	// Summary is a description of the actor. It will become a comprehensive description of the actor.
	Summary string `gorm:"type:text;summary"`

	// Inbox is the URL of the actor's inbox,
	// for example: https://halfmemories.com/u/hvturingga/inbox.
	Inbox string `gorm:"type:text;inbox"`

	// Outbox is the URL of the actor's outbox,
	// for example: https://halfmemories.com/u/hvturingga/outbox.
	Address string `gorm:"index;test;address"`

	// PublicKey is the public key of the actor. It is used to verify the signature of the actor.
	PublicKey string `gorm:"type:text;public_key"`

	// ActorType is the type of the actor. It is used to determine the type of the actor.
	ActorType string `gorm:"type:text;actor_type"`

	// IsRemote is a flag indicating whether the actor is a remote actor or not.
	// Remote participants are still stored in the database.
	// Used to indicate whether the actor's account is in the current instance.
	IsRemote bool `gorm:"type:boolean;is_remote"`
}

Actors is a struct that represents a role in the ActivityPub social system.

func NewAccountUsername

func NewAccountUsername(preferredUsername string) *Actors

NewAccountUsername The constructor is used to get an Actor by username.

func NewActorAddress

func NewActorAddress(address string) *Actors

NewActorAddress The constructor is used to get an Actor by address.

func NewActors

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

NewActors The constructor for creating a new Actor.

func NewActorsId

func NewActorsId(id uint) *Actors

NewActorsId Instantiates the constructor of an ActorsId.

func NewActorsIsExist

func NewActorsIsExist(domain, preferredUsername string) *Actors

NewActorsIsExist Determines if the Actor exists in the constructor of the current instance.

func NewAddActors

func NewAddActors(preferredUsername, domain, avatar, name, summary, inbox, address, publicKey, actorType string) *Actors

NewAddActors The constructor is used to add a new Actor.

func NewChannels

func NewChannels(preferredUsername, publicKey, actorType string) *Actors

func NewPreferredUsername

func NewPreferredUsername(preferredUsername string) *Actors

NewPreferredUsername The constructor creates a new PreferredUsername.

func NewPreferredUsernameAndDomain

func NewPreferredUsernameAndDomain(preferredUsername, domain string) *Actors

func (*Actors) AddActor

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

func (*Actors) Create

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

func (*Actors) Delete

func (a *Actors) Delete() error

func (*Actors) Edit

func (a *Actors) Edit() error

func (*Actors) Get

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

func (*Actors) GetActorByAddress

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

func (*Actors) GetActorByUsername

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

func (*Actors) GetActorsByPreferredUsername

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

func (*Actors) IsExist

func (a *Actors) IsExist() (*Actors, bool)

Jump to

Keyboard shortcuts

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