app

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Mar 6, 2024 License: BSD-3-Clause Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Container

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

Container service container

func NewContainer

func NewContainer(config []gocruddy.CrudConfig) *Container

NewContainer constructor for a new service container

func (*Container) GetCrudConfigs

func (c *Container) GetCrudConfigs() []gocruddy.CrudConfig

GetCrudConfigs returns all crud configurations

func (*Container) GetCrudRepo

func (c *Container) GetCrudRepo() gocruddy.CrudRepository

GetCrudRepo returns the crud repository service

func (*Container) GetDatabase

func (c *Container) GetDatabase() gocruddy.Database

GetDatabase returns the database service

func (*Container) GetLogger

func (c *Container) GetLogger() logging.Logger

GetLogger returns the logging service

type PostUserPayload

type PostUserPayload struct {
	Name string `json:"name"`
}

type PutUserPayload

type PutUserPayload struct {
	PostUserPayload
}

type User

type User struct {
	gorm.Model
	Name string
}

User entity

func (*User) GetID

func (u *User) GetID() uint

GetID return the id of the user

func (*User) Serialize

func (u *User) Serialize() fiber.Map

Serialize an user

type UserCrud

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

UserCrud configuration for user crud operations

func (*UserCrud) CreateDeleteFilter

func (uc *UserCrud) CreateDeleteFilter(ctx *fiber.Ctx) gocruddy.DatabaseFilter

CreateDeleteFilter restrict access for DELETE routes

func (*UserCrud) CreateGetFilter

func (uc *UserCrud) CreateGetFilter(ctx *fiber.Ctx) gocruddy.DatabaseFilter

CreateGetFilter restrict access for GET routes

func (*UserCrud) CreateUpdateFilter

func (uc *UserCrud) CreateUpdateFilter(ctx *fiber.Ctx) gocruddy.DatabaseFilter

CreateUpdateFilter restrict access for POST and PUT routes

func (*UserCrud) GetBasePath

func (uc *UserCrud) GetBasePath() string

GetBasePath return the base path of your crud routes

func (*UserCrud) GetEntityEntry

func (uc *UserCrud) GetEntityEntry() interface{}

GetEntityEntry this database entity is used for this crud

func (*UserCrud) MapPostEntry

func (uc *UserCrud) MapPostEntry(entry interface{}, ctx *fiber.Ctx, tx *storage.Transaction) (mapped gocruddy.Entry, err error)

MapPostEntry maps data from a POST request to a fresh entry instance

func (*UserCrud) MapPutEntry

func (uc *UserCrud) MapPutEntry(entry interface{}, ctx *fiber.Ctx, tx *storage.Transaction) (mapped gocruddy.Entry, err error)

MapPutEntry maps data from a PUT request to a fresh entry instance

func (*UserCrud) SerializeList

func (uc *UserCrud) SerializeList(entries []interface{}, ctx *fiber.Ctx, tx *storage.Transaction) (serialized interface{}, err error)

SerializeList serialize data that is returned by the GET route

func (*UserCrud) UseContainer

func (uc *UserCrud) UseContainer(c gocruddy.Container)

UseContainer register the service container

Jump to

Keyboard shortcuts

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