improve code comments

This commit is contained in:
kim 2025-01-24 13:30:04 +00:00
parent 5b5cbae476
commit 77a6bd1dd7
3 changed files with 17 additions and 15 deletions

View file

@ -36,42 +36,42 @@ type Application interface {
// DeleteApplicationByClientID deletes the application with corresponding client_id value from the database. // DeleteApplicationByClientID deletes the application with corresponding client_id value from the database.
DeleteApplicationByClientID(ctx context.Context, clientID string) error DeleteApplicationByClientID(ctx context.Context, clientID string) error
// GetClientByID ... // GetClientByID fetches the application client from database with ID.
GetClientByID(ctx context.Context, id string) (*gtsmodel.Client, error) GetClientByID(ctx context.Context, id string) (*gtsmodel.Client, error)
// PutClient ... // PutClient puts the given application client in the database.
PutClient(ctx context.Context, client *gtsmodel.Client) error PutClient(ctx context.Context, client *gtsmodel.Client) error
// DeleteClientByID ... // DeleteClientByID deletes the application client from database with ID.
DeleteClientByID(ctx context.Context, id string) error DeleteClientByID(ctx context.Context, id string) error
// GetAllTokens ... // GetAllTokens fetches all client oauth tokens from database.
GetAllTokens(ctx context.Context) ([]*gtsmodel.Token, error) GetAllTokens(ctx context.Context) ([]*gtsmodel.Token, error)
// GetTokenByID ... // GetTokenByID fetches the client oauth token from database with ID.
GetTokenByID(ctx context.Context, id string) (*gtsmodel.Token, error) GetTokenByID(ctx context.Context, id string) (*gtsmodel.Token, error)
// GetTokenByCode ... // GetTokenByCode fetches the client oauth token from database with code.
GetTokenByCode(ctx context.Context, code string) (*gtsmodel.Token, error) GetTokenByCode(ctx context.Context, code string) (*gtsmodel.Token, error)
// GetTokenByAccess ... // GetTokenByAccess fetches the client oauth token from database with access code.
GetTokenByAccess(ctx context.Context, access string) (*gtsmodel.Token, error) GetTokenByAccess(ctx context.Context, access string) (*gtsmodel.Token, error)
// GetTokenByRefresh ... // GetTokenByRefresh fetches the client oauth token from database with refresh code.
GetTokenByRefresh(ctx context.Context, refresh string) (*gtsmodel.Token, error) GetTokenByRefresh(ctx context.Context, refresh string) (*gtsmodel.Token, error)
// PutToken ... // PutToken puts given client oauth token in the database.
PutToken(ctx context.Context, token *gtsmodel.Token) error PutToken(ctx context.Context, token *gtsmodel.Token) error
// DeleteTokenByID ... // DeleteTokenByID deletes client oauth token from database with ID.
DeleteTokenByID(ctx context.Context, id string) error DeleteTokenByID(ctx context.Context, id string) error
// DeleteTokenByCode ... // DeleteTokenByCode deletes client oauth token from database with code.
DeleteTokenByCode(ctx context.Context, code string) error DeleteTokenByCode(ctx context.Context, code string) error
// DeleteTokenByAccess ... // DeleteTokenByAccess deletes client oauth token from database with access code.
DeleteTokenByAccess(ctx context.Context, access string) error DeleteTokenByAccess(ctx context.Context, access string) error
// DeleteTokenByRefresh ... // DeleteTokenByRefresh deletes client oauth token from database with refresh code.
DeleteTokenByRefresh(ctx context.Context, refresh string) error DeleteTokenByRefresh(ctx context.Context, refresh string) error
} }

View file

@ -19,7 +19,8 @@
import "time" import "time"
// Token is a translation of the gotosocial token with the ExpiresIn fields replaced with ExpiresAt. // Token is a translation of the gotosocial token
// with the ExpiresIn fields replaced with ExpiresAt.
type Token struct { type Token struct {
ID string `bun:"type:CHAR(26),pk,nullzero,notnull,unique"` // id of this item in the database ID string `bun:"type:CHAR(26),pk,nullzero,notnull,unique"` // id of this item in the database
CreatedAt time.Time `bun:"type:timestamptz,nullzero,notnull,default:current_timestamp"` // when was item created CreatedAt time.Time `bun:"type:timestamptz,nullzero,notnull,default:current_timestamp"` // when was item created

View file

@ -39,7 +39,8 @@
"github.com/superseriousbusiness/gotosocial/internal/typeutils" "github.com/superseriousbusiness/gotosocial/internal/typeutils"
) )
// realSender is the production Web Push sender, backed by an HTTP client, DB, and worker pool. // realSender is the production Web Push sender,
// backed by an HTTP client, DB, and worker pool.
type realSender struct { type realSender struct {
httpClient *http.Client httpClient *http.Client
state *state.State state *state.State