go.mod update priv git url

This commit is contained in:
Piotr Biernat 2024-05-30 17:01:18 +02:00
parent c454307d56
commit 081e1edd24
6 changed files with 45 additions and 6 deletions

View File

@ -3,7 +3,7 @@ package api
import ( import (
"fmt" "fmt"
def "git.pbiernat.dev/egommerce/api-entities/http" def "git.pbiernat.io/egommerce/api-entities/http"
"github.com/go-redis/redis/v8" "github.com/go-redis/redis/v8"
) )

View File

@ -3,7 +3,7 @@ package api
import ( import (
"fmt" "fmt"
def "git.pbiernat.dev/egommerce/api-entities/http" def "git.pbiernat.io/egommerce/api-entities/http"
"github.com/go-redis/redis/v8" "github.com/go-redis/redis/v8"
) )

View File

@ -1,6 +1,7 @@
package config package config
import ( import (
"fmt"
"os" "os"
"github.com/joho/godotenv" "github.com/joho/godotenv"
@ -15,7 +16,7 @@ func init() {
func GetEnv(name string, defVal string) string { func GetEnv(name string, defVal string) string {
env := os.Getenv(name) env := os.Getenv(name)
if env == "" { if env == "" {
return defVal fmt.Panicln("Missing " + name + " env variable")
} }
return env return env

View File

@ -6,7 +6,7 @@ import (
"strconv" "strconv"
"time" "time"
"git.pbiernat.dev/egommerce/go-api-pkg/config" "git.pbiernat.io/egommerce/go-api-pkg/config"
consul "github.com/hashicorp/consul/api" consul "github.com/hashicorp/consul/api"
"github.com/hashicorp/consul/connect" "github.com/hashicorp/consul/connect"
) )

4
go.mod
View File

@ -1,9 +1,9 @@
module git.pbiernat.dev/egommerce/go-api-pkg module git.pbiernat.io/egommerce/go-api-pkg
go 1.18 go 1.18
require ( require (
git.pbiernat.dev/egommerce/api-entities v0.0.26 git.pbiernat.io/egommerce/api-entities v0.0.26
github.com/fluent/fluent-logger-golang v1.9.0 github.com/fluent/fluent-logger-golang v1.9.0
github.com/go-redis/redis/v8 v8.11.5 github.com/go-redis/redis/v8 v8.11.5
github.com/hashicorp/consul v1.16.0 github.com/hashicorp/consul v1.16.0

38
redis/cache.go Normal file
View File

@ -0,0 +1,38 @@
package redis
// import (
// "context"
// "strconv"
// "time"
// "github.com/go-redis/redis/v8"
// )
// func NewCache(host string, port int, password string) *redis.Client {
// redis := redis.NewClient(&redis.Options{
// Addr: host + ":" + strconv.Itoa(port),
// Password: password,
// DB: 0,
// })
// defer redis.Close()
// return redis
// }
// func Get(ctx context.Context, key string) (float64, error) {
// // ctx := context.Background() // FIXME
// price, err := s.cache.Get(ctx, key).Float64()
// if err != nil {
// s.log.Log("cache read error(key not exists): %#v", err)
// return 0, err
// }
// return price, nil
// }
// func Set(ctx context.Context, key string, value any, exp time.Duration) error {
// // ctx := context.Background() // FIXME
// s.cache.Set(ctx, key, value, exp)
// return nil
// }