core

package
v0.4.7 Latest Latest
Warning

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

Go to latest
Published: Apr 9, 2024 License: AGPL-3.0 Imports: 15 Imported by: 0

Documentation

Overview

Copyright (C) 2023 Tim Bastin, l3montree UG (haftungsbeschränkt)

This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.

You should have received a copy of the GNU Affero General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.

Index

Constants

This section is empty.

Variables

View Source
var V = validator.New()

Functions

func AccessControlMiddleware

func AccessControlMiddleware(obj accesscontrol.Object, act accesscontrol.Action) echo.MiddlewareFunc

func GetAsset

func GetAsset(c Context) models.Asset

func GetAssetSlug

func GetAssetSlug(c Context) (string, error)

func GetFlawID

func GetFlawID(c Context) (uuid.UUID, error)

func GetParam added in v0.3.0

func GetParam(c Context, param string) string

func GetProject

func GetProject(c Context) models.Project

func GetProjectSlug

func GetProjectSlug(c Context) (string, error)

func GetTenant

func GetTenant(c Context) models.Org

func InitLogger

func InitLogger()

InitLogger initializes the logger with a tint handler. tint is a simple logging library that allows to add colors to the log output. this is obviously not required, but it makes the logs easier to read.

func LoadConfig

func LoadConfig() error

func Ptr added in v0.3.0

func Ptr[T any](t T) *T

func SanitizeParam

func SanitizeParam(s string) string

Types

type AuthSession

type AuthSession interface {
	GetUserID() string
}

func GetSession

func GetSession(ctx Context) AuthSession

type Context

type Context = echo.Context

type DB

type DB = *gorm.DB

func DatabaseFactory

func DatabaseFactory() (DB, error)

type FilterQuery

type FilterQuery struct {
	Field    string
	Value    string
	Operator string
}

func GetFilterQuery

func GetFilterQuery(ctx Context) []FilterQuery

func (FilterQuery) SQL

func (f FilterQuery) SQL() string

type MiddlewareFunc

type MiddlewareFunc = echo.MiddlewareFunc

type PageInfo

type PageInfo struct {
	PageSize int `json:"pageSize"`
	Page     int `json:"page"`
}

func GetPageInfo

func GetPageInfo(ctx Context) PageInfo

func (PageInfo) ApplyOnDB

func (p PageInfo) ApplyOnDB(db DB) DB

type Paged

type Paged[T any] struct {
	PageInfo
	Total int64 `json:"total"`
	Data  []T   `json:"data"`
}

func NewPaged

func NewPaged[T any](pageInfo PageInfo, total int64, data []T) Paged[T]

func (Paged[T]) Map added in v0.3.0

func (p Paged[T]) Map(f func(T) any) Paged[any]

type Server

type Server = *echo.Group

type SortQuery

type SortQuery struct {
	Field    string
	Operator string // asc or desc
}

func GetSortQuery

func GetSortQuery(ctx Context) []SortQuery

func (SortQuery) SQL

func (s SortQuery) SQL() string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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