Documentation
¶
Index ¶
- type Arguments
- type Resolverers
- type Resolvers
- func (r *Resolvers) AllUsers() ([]UserType, error)
- func (r *Resolvers) Create(params graphql.ResolveParams) (*authorization.Tokens, error)
- func (r *Resolvers) Login(params graphql.ResolveParams) (*authorization.Tokens, error)
- func (r *Resolvers) Logout(params graphql.ResolveParams) (interface{}, error)
- func (r *Resolvers) RefreshToken(params graphql.ResolveParams) (*authorization.Tokens, error)
- func (r *Resolvers) Update(params graphql.ResolveParams) (interface{}, error)
- func (r *Resolvers) User(params graphql.ResolveParams) (*UserType, error)
- type Types
- type UserInput
- type UserLogin
- type UserType
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Arguments ¶
type Arguments struct {
Login graphql.FieldConfigArgument
Create graphql.FieldConfigArgument
Update graphql.FieldConfigArgument
RefreshToken graphql.FieldConfigArgument
}
func GetArguments ¶
func GetArguments() Arguments
type Resolverers ¶
type Resolverers interface {
// Returning a list of all users from table users
AllUsers() ([]UserType, error)
// Get information of a single user.
// It takes user_id from access_token
User(params graphql.ResolveParams) (*UserType, error)
// Login action.
// It takes login and password from graphql.ResolveParams, looking for user by login
// from table users, comparing hashed password from db with not hashed password from args.
Login(params graphql.ResolveParams) (*authorization.Tokens, error)
// Registration of new user.
// Taking arguments from graphql.ResolveParams and storing it in table "users".
// Returning access_token and refresh_token for login.
Create(params graphql.ResolveParams) (*authorization.Tokens, error)
// Update user ingormation.
// It takes arguments from graphql.ResolvePrams, authorization key from Context
// Extracts userId from token and stroing new data to users table.
Update(params graphql.ResolveParams) (interface{}, error)
// Action for logout user.
// It takes authorization header key from graphql.ResolvePrams Context and extracting
// values from token. Then deleting token from redis client and returning id of user
Logout(params graphql.ResolveParams) (interface{}, error)
// Refreshing tokens.
// It takes refresh token from request and using authorization.RefreshToken
RefreshToken(params graphql.ResolveParams) (*authorization.Tokens, error)
}
func GetResolvers ¶
func GetResolvers(pgsql *sqlx.DB, client *redis.Client) Resolverers
type Resolvers ¶
func (*Resolvers) Create ¶
func (r *Resolvers) Create(params graphql.ResolveParams) (*authorization.Tokens, error)
func (*Resolvers) Login ¶
func (r *Resolvers) Login(params graphql.ResolveParams) (*authorization.Tokens, error)
func (*Resolvers) Logout ¶
func (r *Resolvers) Logout(params graphql.ResolveParams) (interface{}, error)
func (*Resolvers) RefreshToken ¶
func (r *Resolvers) RefreshToken(params graphql.ResolveParams) (*authorization.Tokens, error)
type Types ¶
type UserInput ¶
type UserInput struct {
First_name string `json:"first_name" db:"first_name"`
Last_name string `json:"last_name" db:"last_name"`
Phone string `json:"phone" db:"phone"`
Email string `json:"email" db:"email"`
Login string `json:"login" db:"login"`
Password string `json:"password" db:"password"`
}
struct for storing users data
type UserType ¶
type UserType struct {
Id int `json:"_id"`
Created_at string `json:"created_at"`
Updated_at string `json:"updated_at"`
First_name string `json:"first_name" db:"first_name"`
Last_name string `json:"last_name" db:"last_name"`
Phone string `json:"phone" db:"phone"`
Email string `json:"email" db:"email"`
Login string `json:"login" db:"login"`
Password string `json:"password" db:"password"`
Last_login string `json:"last_login" db:"last_login"`
Payments []payments.Payment `json:"payments"`
}
inheritance is not working for structs with graphql.ResolverFunc
Click to show internal directories.
Click to hide internal directories.