models

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Feb 7, 2024 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EnsureKeys added in v0.6.0

func EnsureKeys(requiredKeys []string, data map[string]any) error

Types

type IModel

type IModel interface {
	GetCollectionName() string
	GetUnique() string
	Validate(map[string]any) error

	CheckRequired(map[string]any) error
}

type Model

type Model struct {
	IModel
	MongodbConnection string
	DatabaseName      string
}

func (*Model) Delete

func (s *Model) Delete(id string) (bool, error)

func (*Model) Filter

func (s *Model) Filter(data map[string]interface{}) map[string]interface{}

func (*Model) GetAll

func (s *Model) GetAll() (any, error)

func (*Model) GetById

func (s *Model) GetById(id string) (any, error)

func (*Model) Post

func (s *Model) Post(data map[string]any) (bool, string, error)

func (*Model) Put

func (s *Model) Put(id string, data map[string]any) (bool, error)

Jump to

Keyboard shortcuts

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