utils

package
v0.0.0-...-f95dc7b Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 27, 2024 License: MIT Imports: 32 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AdoptDog

func AdoptDog(myID string, dogID string) (*types.Dog, error)

func CheckGraphQLContextMyID

func CheckGraphQLContextMyID(p graphql.ResolveParams) error

func GenerateJWTToken

func GenerateJWTToken(uid string) (string, error)

func GetDog

func GetDog(myID string, dogID string) (*types.Dog, error)

func GetTrendingTwitterHashtags

func GetTrendingTwitterHashtags(rdb *redis.Client) ([]types.TwitterHashtag, error)

func GetTwitterHashtag

func GetTwitterHashtag(text string, rdb *redis.Client) (*types.TwitterHashtag, error)

func GetUser

func GetUser(id string) (*types.User, error)

func GetUserByEmail

func GetUserByEmail(email string) (*types.User, error)

func VerifyJWTTokenAndExtractMyID

func VerifyJWTTokenAndExtractMyID(r *http.Request) (string, error)

func VerifyPassword

func VerifyPassword(uid string, password string) (bool, error)

Types

type Config

type Config struct {
	AppEnv                       string
	Port                         string
	GRPCServerHost               string
	GRPCServerPort               string
	OPAHost                      string
	OPAPort                      string
	DgraphHost                   string
	DgraphGRPCPort               string
	RedisHost                    string
	RedisPort                    string
	RedisDB                      string
	RedisPassword                string
	MinIOEndpoint                string
	MinIOAccessKeyID             string
	MinIOSecretAccessKey         string
	TorchServeGRPCHost           string
	TorchServeGRPCPort           string
	OpenCensusAgentHost          string
	OpenCensusAgentPort          string
	JWTSecret                    string
	EnableOpenTelemetryStdoutLog string
}

func GetConfig

func GetConfig() *Config

type CurrentTime

type CurrentTime struct {
	Now string `json:"now"`
}

func GetCurrentTime

func GetCurrentTime() (*CurrentTime, error)

type DebouncedSeed

type DebouncedSeed struct {
	DebouncedSeedNumber int `json:"debouncedSeedNumber"`
}

type Greeting

type Greeting struct {
	Content string `json:"content"`
}

func GetGreeting

func GetGreeting(firstName string, lastName string) (*Greeting, error)

type JWT

type JWT struct {
	JWTToken string `json:"jwtToken"`
}

func SignIn

func SignIn(email string, password string) (*JWT, error)

type JWTTokenContent

type JWTTokenContent struct {
	ID string
}

type Me

type Me struct {
	ID       string   `json:"id"`
	Name     string   `json:"name"`
	Age      int      `json:"age"`
	Email    string   `json:"email"`
	Roles    []string `json:"roles"`
	JWTToken string   `json:"jwtToken"`
}

func GetMe

func GetMe(id string) (*Me, error)

type OPA

type OPA struct {
	Decision bool `json:"decision"`
}

func GetOPADecision

func GetOPADecision(uid string, action string, resource string) (*OPA, error)

type OPAL

type OPAL struct {
	Decision bool `json:"decision"`
}

func GetOPALDecision

func GetOPALDecision(uid string, action string, resource string) (*OPAL, error)

type Prediction

type Prediction map[string]float64

func GetPrediction

func GetPrediction(fileHeader *multipart.FileHeader) (*Prediction, error)

type Seed

type Seed struct {
	SeedNumber int `json:"seedNumber"`
}

func GetDebouncedSeed

func GetDebouncedSeed() (*Seed, error)

func GetSeed

func GetSeed() (*Seed, error)

func SetSeed

func SetSeed(n int) (*Seed, error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL