comments
This commit is contained in:
@ -145,6 +145,9 @@ type Account struct {
|
|||||||
SuspensionOrigin int
|
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 {
|
type Field struct {
|
||||||
Name string
|
Name string
|
||||||
Value string
|
Value string
|
||||||
|
|||||||
@ -20,6 +20,7 @@ package model
|
|||||||
|
|
||||||
import "time"
|
import "time"
|
||||||
|
|
||||||
|
// Follow represents one account following another, and the metadata around that follow.
|
||||||
type Follow struct {
|
type Follow struct {
|
||||||
// id of this follow in the database
|
// id of this follow in the database
|
||||||
ID string `pg:"type:uuid,default:gen_random_uuid(),pk,notnull,unique"`
|
ID string `pg:"type:uuid,default:gen_random_uuid(),pk,notnull,unique"`
|
||||||
|
|||||||
@ -28,11 +28,15 @@ import (
|
|||||||
"github.com/gotosocial/gotosocial/internal/router"
|
"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 {
|
type Gotosocial interface {
|
||||||
Start(context.Context) error
|
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) {
|
func New(db db.DB, cache cache.Cache, apiRouter router.Router, federationAPI pub.FederatingActor, config *config.Config) (Gotosocial, error) {
|
||||||
return &gotosocial{
|
return &gotosocial{
|
||||||
db: db,
|
db: db,
|
||||||
@ -43,6 +47,7 @@ func New(db db.DB, cache cache.Cache, apiRouter router.Router, federationAPI pub
|
|||||||
}, nil
|
}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// gotosocial fulfils the gotosocial interface.
|
||||||
type gotosocial struct {
|
type gotosocial struct {
|
||||||
db db.DB
|
db db.DB
|
||||||
cache cache.Cache
|
cache cache.Cache
|
||||||
@ -51,10 +56,10 @@ type gotosocial struct {
|
|||||||
config *config.Config
|
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 {
|
func (gts *gotosocial) Start(ctx context.Context) error {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (gts *gotosocial) Stop(ctx context.Context) error {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|||||||
Reference in New Issue
Block a user