This commit is contained in:
tsmethurst 2021-03-25 20:08:04 +01:00
parent b3d5587415
commit ea97afd86f
3 changed files with 14 additions and 5 deletions

View File

@ -145,6 +145,9 @@ type Account struct {
SuspensionOrigin int
}
// Field represents a key value field on an account, for things like pronouns, website, etc.
// VerifiedAt is optional, to be used only if Value is a URL to a webpage that contains the
// username of the user.
type Field struct {
Name string
Value string

View File

@ -20,6 +20,7 @@ package model
import "time"
// Follow represents one account following another, and the metadata around that follow.
type Follow struct {
// id of this follow in the database
ID string `pg:"type:uuid,default:gen_random_uuid(),pk,notnull,unique"`

View File

@ -28,11 +28,15 @@ import (
"github.com/gotosocial/gotosocial/internal/router"
)
// Gotosocial is the 'main' function of the gotosocial server, and the place where everything hangs together.
// The logic of stopping and starting the entire server is contained here.
type Gotosocial interface {
Start(context.Context) error
Stop(context.Context) error
}
// New returns a new gotosocial server, initialized with the given configuration.
// An error will be returned the caller if something goes wrong during initialization
// eg., no db or storage connection, port for router already in use, etc.
func New(db db.DB, cache cache.Cache, apiRouter router.Router, federationAPI pub.FederatingActor, config *config.Config) (Gotosocial, error) {
return &gotosocial{
db: db,
@ -43,6 +47,7 @@ func New(db db.DB, cache cache.Cache, apiRouter router.Router, federationAPI pub
}, nil
}
// gotosocial fulfils the gotosocial interface.
type gotosocial struct {
db db.DB
cache cache.Cache
@ -51,10 +56,10 @@ type gotosocial struct {
config *config.Config
}
// Start starts up the gotosocial server. It is a blocking call, so only call it when
// you're absolutely sure you want to start up the server. If something goes wrong
// while starting the server, then an error will be returned. You can treat this function a
// lot like you would treat http.ListenAndServe()
func (gts *gotosocial) Start(ctx context.Context) error {
return nil
}
func (gts *gotosocial) Stop(ctx context.Context) error {
return nil
}