- added register command - added reset command - added users command - added agg command - added feeds command
23 lines
520 B
Go
23 lines
520 B
Go
package state
|
|
|
|
import (
|
|
"context"
|
|
|
|
"github.com/StevanFreeborn/gator/internal/config"
|
|
"github.com/StevanFreeborn/gator/internal/database"
|
|
)
|
|
|
|
type State struct {
|
|
Database *database.Queries
|
|
Config *config.Config
|
|
Arguments []string
|
|
}
|
|
|
|
func NewState(d *database.Queries, c *config.Config, args []string) *State {
|
|
return &State{Database: d, Config: c, Arguments: args}
|
|
}
|
|
|
|
func (s *State) GetCurrentUser(ctx context.Context) (database.User, error) {
|
|
return s.Database.GetUserByName(ctx, s.Config.CurrentUserName)
|
|
}
|