feat: implemented many commands
- added register command - added reset command - added users command - added agg command - added feeds command
This commit is contained in:
+13
-3
@@ -1,12 +1,22 @@
|
||||
package state
|
||||
|
||||
import "github.com/StevanFreeborn/gator/internal/config"
|
||||
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(c *config.Config, args []string) *State {
|
||||
return &State{Config: c, Arguments: args}
|
||||
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)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user