app

package
v1.0.3 Latest Latest
Warning

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

Go to latest
Published: Jul 18, 2024 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const AfterUpdateHook = "AfterUpdate"

Variables

View Source
var DB *gorm.DB
View Source
var FS *embed.FS
View Source
var Flags = KeySet{/* contains filtered or unexported fields */}
View Source
var Hooks = AppHooks{Models: map[string]map[string]*ModelHook{}}
View Source
var Properties = map[string]string{}

Functions

func AddModelHook

func AddModelHook(modelName, hookType string, fn func(*gorm.DB))

func DeleteSession

func DeleteSession(key string)

func PutSession

func PutSession(key string, session *Session)

Types

type AppHooks

type AppHooks struct {
	Models map[string]map[string]*ModelHook
}

type Hook

type Hook[T any] struct {
	Names []string
	Funcs []T
	// contains filtered or unexported fields
}

func (*Hook[T]) Add

func (h *Hook[T]) Add(name string, hook T) *Hook[T]

func (*Hook[T]) After

func (h *Hook[T]) After(name string) *Hook[T]

func (*Hook[T]) Before

func (h *Hook[T]) Before(name string) *Hook[T]

func (*Hook[T]) Index

func (h *Hook[T]) Index() int

func (*Hook[T]) Remove

func (h *Hook[T]) Remove(name string) *Hook[T]

type KeySet

type KeySet struct {
	// contains filtered or unexported fields
}

func (*KeySet) Add

func (s *KeySet) Add(key string)

func (*KeySet) Clear

func (s *KeySet) Clear()

func (*KeySet) Has

func (s *KeySet) Has(key ...string) bool

Has - Checks if all the @{keys} are present

func (*KeySet) HasOne

func (s *KeySet) HasOne(keys ...string) bool

HasOne - Checks if at least one of the @{keys} is present

type ModelHook

type ModelHook struct {
	Hook[func(db *gorm.DB)]
}

func GetModelHook

func GetModelHook(modelName, hookType string) *ModelHook

func (*ModelHook) Run

func (h *ModelHook) Run(db *gorm.DB)

type Session

type Session struct {
	// contains filtered or unexported fields
}

func CreateSession

func CreateSession() *Session

func FindSession

func FindSession(key string) *Session

func GetSession

func GetSession(c *gin.Context) *Session

Functions

func (*Session) Check

func (s *Session) Check(c *gin.Context, permissions ...string) message.Message

func (*Session) CheckOne

func (s *Session) CheckOne(c *gin.Context, permissions ...string) message.Message

func (*Session) Get

func (s *Session) Get(key string) interface{}

func (*Session) Has

func (s *Session) Has(permissions ...string) bool

func (*Session) HasOne

func (s *Session) HasOne(permissions ...string) bool

func (*Session) IsExpired

func (s *Session) IsExpired() bool

func (*Session) RefreshExpiration

func (s *Session) RefreshExpiration()

func (*Session) Set

func (s *Session) Set(key string, value interface{})

func (*Session) SetExpired

func (s *Session) SetExpired()

type SessionModel

type SessionModel struct {
	KEY        string `gorm:"primaryKey"`
	EXPIRES_AT time.Time
	PROPERTIES string `gorm:"type:text"`
}

func (SessionModel) TableName

func (s SessionModel) TableName() string

type Webhook

type Webhook struct {
	ID_WEBHOOK int    `gorm:"primaryKey;type:int"`
	TYPE       string `gorm:"type:nvarchar(20)"`
	CONTEXT    string `gorm:"type:nvarchar(50)"`
	URL        string `gorm:"type:nvarchar(1000)"`
	METHOD     string `gorm:"type:varchar(5)"`
	QUERY_ARGS string `gorm:"type:ntext"`
	BODY       string `gorm:"type:ntext"`
}

func (Webhook) TableName

func (Webhook) TableName() string

Jump to

Keyboard shortcuts

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