fix imports
This commit is contained in:
parent
308bc4280c
commit
3ef5039bef
15 changed files with 30 additions and 66 deletions
|
|
@ -1,35 +0,0 @@
|
||||||
package h
|
|
||||||
|
|
||||||
import (
|
|
||||||
"fmt"
|
|
||||||
"github.com/gofiber/fiber/v2"
|
|
||||||
"mhtml/database"
|
|
||||||
)
|
|
||||||
|
|
||||||
func SessionSet(ctx *fiber.Ctx, key string, value string) error {
|
|
||||||
sessionId := getSessionId(ctx)
|
|
||||||
if sessionId == "" {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
return database.HSet(fmt.Sprintf("session:%s", sessionId), key, value)
|
|
||||||
}
|
|
||||||
|
|
||||||
func SessionIncr(ctx *fiber.Ctx, key string) int64 {
|
|
||||||
sessionId := getSessionId(ctx)
|
|
||||||
if sessionId == "" {
|
|
||||||
return 0
|
|
||||||
}
|
|
||||||
return database.HIncr(fmt.Sprintf("session:%s", sessionId), key)
|
|
||||||
}
|
|
||||||
|
|
||||||
func SessionGet[T any](ctx *fiber.Ctx, key string) *T {
|
|
||||||
sessionId := getSessionId(ctx)
|
|
||||||
if sessionId == "" {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
return database.HGet[T](fmt.Sprintf("session:%s", sessionId), key)
|
|
||||||
}
|
|
||||||
|
|
||||||
func getSessionId(ctx *fiber.Ctx) string {
|
|
||||||
return ctx.Cookies("mhtml-session")
|
|
||||||
}
|
|
||||||
|
|
@ -4,7 +4,7 @@ import (
|
||||||
"errors"
|
"errors"
|
||||||
"github.com/gofiber/fiber/v2"
|
"github.com/gofiber/fiber/v2"
|
||||||
"github.com/google/uuid"
|
"github.com/google/uuid"
|
||||||
"mhtml/database"
|
"github.com/maddalax/mhtml/starter-template/database"
|
||||||
"time"
|
"time"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@ package news
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"mhtml/httpjson"
|
"github.com/maddalax/mhtml/framework/util/httpjson"
|
||||||
"sync"
|
"sync"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,10 @@
|
||||||
// Package pages THIS FILE IS GENERATED. DO NOT EDIT.
|
// Package pages THIS FILE IS GENERATED. DO NOT EDIT.
|
||||||
package pages
|
package pages
|
||||||
|
|
||||||
import "github.com/gofiber/fiber/v2"
|
import (
|
||||||
import "mhtml/h"
|
"github.com/gofiber/fiber/v2"
|
||||||
|
"github.com/maddalax/mhtml/framework/h"
|
||||||
|
)
|
||||||
|
|
||||||
func RegisterPages(f *fiber.App) {
|
func RegisterPages(f *fiber.App) {
|
||||||
f.Get("/", func(ctx *fiber.Ctx) error {
|
f.Get("/", func(ctx *fiber.Ctx) error {
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@ package pages
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"github.com/gofiber/fiber/v2"
|
"github.com/gofiber/fiber/v2"
|
||||||
"mhtml/h"
|
"github.com/maddalax/mhtml/framework/h"
|
||||||
"os"
|
"os"
|
||||||
"time"
|
"time"
|
||||||
)
|
)
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@ package pages
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"github.com/gofiber/fiber/v2"
|
"github.com/gofiber/fiber/v2"
|
||||||
"mhtml/h"
|
"github.com/maddalax/mhtml/framework/h"
|
||||||
)
|
)
|
||||||
|
|
||||||
func Test(ctx *fiber.Ctx) *h.Page {
|
func Test(ctx *fiber.Ctx) *h.Page {
|
||||||
|
|
|
||||||
|
|
@ -2,9 +2,9 @@ package pages
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/gofiber/fiber/v2"
|
"github.com/gofiber/fiber/v2"
|
||||||
"mhtml/h"
|
"github.com/maddalax/mhtml/framework/h"
|
||||||
"mhtml/pages/base"
|
"github.com/maddalax/mhtml/starter-template/pages/base"
|
||||||
"mhtml/partials"
|
"github.com/maddalax/mhtml/starter-template/partials"
|
||||||
)
|
)
|
||||||
|
|
||||||
func ListPage(ctx *fiber.Ctx) *h.Page {
|
func ListPage(ctx *fiber.Ctx) *h.Page {
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,6 @@
|
||||||
package partials
|
package partials
|
||||||
|
|
||||||
import (
|
import "github.com/maddalax/mhtml/framework/h"
|
||||||
"mhtml/h"
|
|
||||||
"mhtml/ui"
|
|
||||||
)
|
|
||||||
|
|
||||||
func OpenSheetButton(open bool, children ...h.Renderable) h.Renderable {
|
func OpenSheetButton(open bool, children ...h.Renderable) h.Renderable {
|
||||||
if open {
|
if open {
|
||||||
|
|
|
||||||
|
|
@ -1,11 +1,13 @@
|
||||||
// Package partials THIS FILE IS GENERATED. DO NOT EDIT.
|
// Package partials THIS FILE IS GENERATED. DO NOT EDIT.
|
||||||
package load
|
package load
|
||||||
|
|
||||||
import "mhtml/h"
|
import (
|
||||||
import "github.com/gofiber/fiber/v2"
|
"github.com/gofiber/fiber/v2"
|
||||||
import "mhtml/partials"
|
"github.com/maddalax/mhtml/framework/h"
|
||||||
import "mhtml/partials/patient"
|
"github.com/maddalax/mhtml/starter-template/partials"
|
||||||
import "mhtml/partials/sheet"
|
"github.com/maddalax/mhtml/starter-template/partials/patient"
|
||||||
|
"github.com/maddalax/mhtml/starter-template/partials/sheet"
|
||||||
|
)
|
||||||
|
|
||||||
func GetPartialFromContext(ctx *fiber.Ctx) *h.Partial {
|
func GetPartialFromContext(ctx *fiber.Ctx) *h.Partial {
|
||||||
path := ctx.Path()
|
path := ctx.Path()
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@ package load
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/gofiber/fiber/v2"
|
"github.com/gofiber/fiber/v2"
|
||||||
"mhtml/h"
|
"github.com/maddalax/mhtml/framework/h"
|
||||||
)
|
)
|
||||||
|
|
||||||
func RegisterPartials(f *fiber.App) {
|
func RegisterPartials(f *fiber.App) {
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
package partials
|
package partials
|
||||||
|
|
||||||
import "mhtml/h"
|
import "github.com/maddalax/mhtml/framework/h"
|
||||||
|
|
||||||
type Link struct {
|
type Link struct {
|
||||||
Name string
|
Name string
|
||||||
|
|
|
||||||
|
|
@ -3,9 +3,8 @@ package partials
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"github.com/gofiber/fiber/v2"
|
"github.com/gofiber/fiber/v2"
|
||||||
"mhtml/h"
|
"github.com/maddalax/mhtml/framework/h"
|
||||||
"mhtml/news"
|
"github.com/maddalax/mhtml/starter-template/news"
|
||||||
"mhtml/ui"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
func NewsSheet(ctx *fiber.Ctx) *h.Partial {
|
func NewsSheet(ctx *fiber.Ctx) *h.Partial {
|
||||||
|
|
|
||||||
|
|
@ -2,9 +2,9 @@ package patient
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/gofiber/fiber/v2"
|
"github.com/gofiber/fiber/v2"
|
||||||
"mhtml/features/patient"
|
"github.com/maddalax/mhtml/framework/h"
|
||||||
"mhtml/h"
|
"github.com/maddalax/mhtml/starter-template/features/patient"
|
||||||
"mhtml/partials/sheet"
|
"github.com/maddalax/mhtml/starter-template/partials/sheet"
|
||||||
)
|
)
|
||||||
|
|
||||||
func Create(ctx *fiber.Ctx) *h.Partial {
|
func Create(ctx *fiber.Ctx) *h.Partial {
|
||||||
|
|
|
||||||
|
|
@ -2,10 +2,9 @@ package patient
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/gofiber/fiber/v2"
|
"github.com/gofiber/fiber/v2"
|
||||||
"mhtml/features/patient"
|
"github.com/maddalax/mhtml/framework/h"
|
||||||
"mhtml/h"
|
"github.com/maddalax/mhtml/starter-template/features/patient"
|
||||||
"mhtml/partials/sheet"
|
"github.com/maddalax/mhtml/starter-template/partials/sheet"
|
||||||
"mhtml/ui"
|
|
||||||
"strings"
|
"strings"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@ package sheet
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"github.com/gofiber/fiber/v2"
|
"github.com/gofiber/fiber/v2"
|
||||||
"mhtml/h"
|
"github.com/maddalax/mhtml/framework/h"
|
||||||
)
|
)
|
||||||
|
|
||||||
type Props struct {
|
type Props struct {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue