diff --git a/internal/db/model/account.go b/internal/db/model/account.go index 130347c65..2954e386a 100644 --- a/internal/db/model/account.go +++ b/internal/db/model/account.go @@ -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 diff --git a/internal/db/model/follow.go b/internal/db/model/follow.go index 4c67b605f..b47da835b 100644 --- a/internal/db/model/follow.go +++ b/internal/db/model/follow.go @@ -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"` diff --git a/internal/gotosocial/gotosocial.go b/internal/gotosocial/gotosocial.go index d9fb29527..8fffe24e2 100644 --- a/internal/gotosocial/gotosocial.go +++ b/internal/gotosocial/gotosocial.go @@ -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 -}