object

package
v0.0.0-...-35e313c Latest Latest
Warning

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

Go to latest
Published: Nov 30, 2020 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CreationError          = "could not create object"
	CreationSuccess        = "created successfully"
	SUCCESS                = "success"
	RetrieveError          = "Could not retrieve the objects"
	ObjectNotFound         = "Object Not found"
	InvalidDataType        = "Invalid data type"
	UnknownFieldNameInData = "Unknown field name"
	UpdateError            = "Error during field update"
	UpdateSuccess          = "Field updated successfully"
)

MESSAGES

View Source
const (
	MongoObjectCollection        = "Objects"
	MongoObjectIDColumn          = "_id"
	MongoObjectContainerIDColumn = "container_id"
	MongoObjectCreatedAtColumn   = "created_at"
	MongoObjectUpdatedAtColumn   = "updated_at"
)

Monngo DB const

Variables

This section is empty.

Functions

func ConvertData

func ConvertData(value interface{}, fieldType string) (interface{}, error)

ConvertData will check data type of the value

Types

type Model

type Model struct {
	DataStore *datastore.DataStore
	Mongo     *mongo.Client
}

Model #

func (Model) ByID

func (m Model) ByID(
	contID container.ID,
	objectID string,
) (map[string]interface{}, string, int, error)

ByID Get the object of the container by its ID

func (Model) Create

func (m Model) Create(
	contID container.ID,
	inputData map[string]interface{},
) (string, string, int, error)

Create new Object

func (Model) Get

func (m Model) Get(
	contID container.ID,
) ([]map[string]interface{}, string, int, error)

Get objects of the container

func (Model) Update

func (m Model) Update(
	contID container.ID,
	objID string,
	inputData map[string]interface{},
) (string, int, error)

Update the fields in the object

Jump to

Keyboard shortcuts

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