mongoUtil

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Dec 29, 2023 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SetTimeFormatter

func SetTimeFormatter(layout string)

SetTimeFormatter - Set time format layout. Default: 2006-01-02T15:04:05.999999-07:00

func SetTimeZone

func SetTimeZone(zone int64)

Types

type JSONDate

type JSONDate time.Time

func (JSONDate) GetBSON

func (d JSONDate) GetBSON() (interface{}, error)

func (JSONDate) MarshalJSON

func (d JSONDate) MarshalJSON() ([]byte, error)

MarshalJSON - Implement method MarshalJSON to output date with in formatted

func (*JSONDate) Scan

func (d *JSONDate) Scan(value interface{}) error

Scan - This method for scanning JSONDate from date data type in sql

func (*JSONDate) UnmarshalJSON

func (d *JSONDate) UnmarshalJSON(data []byte) error

func (*JSONDate) Value

func (d *JSONDate) Value() (driver.Value, error)

Value - This method for mapping JSONDate to date data type in sql

type JSONTime

type JSONTime time.Time

func (*JSONTime) GetBSON

func (t *JSONTime) GetBSON() (interface{}, error)

func (JSONTime) MarshalJSON

func (t JSONTime) MarshalJSON() ([]byte, error)

MarshalJSON - Implement method MarshalJSON to output time with in formatted

func (*JSONTime) Scan

func (t *JSONTime) Scan(value interface{}) error

Scan - This method for scanning JSONTime from datetime data type in sql

func (*JSONTime) SetBSON

func (t *JSONTime) SetBSON(raw bson.RawValue) error

func (*JSONTime) String

func (t *JSONTime) String() string

func (*JSONTime) UnmarshalJSON

func (t *JSONTime) UnmarshalJSON(data []byte) error

func (*JSONTime) Value

func (t *JSONTime) Value() (driver.Value, error)

Value - This method for mapping JSONTime to datetime data type in sql

type MongoModel

type MongoModel struct {
	PK        primitive.ObjectID `json:"id" bson:"_id,omitempty"`
	Status    int                `json:"status" bson:"status,omitempty"`
	CreatedAt *JSONTime          `json:"createdAt" bson:"createdAt,omitempty"`
	UpdatedAt *JSONTime          `json:"updatedAt" bson:"updatedAt,omitempty"`
	DeletedAt *JSONTime          `json:"deletedAt" bson:"deletedAt,omitempty"`
}

func (*MongoModel) PrepareForInsert

func (mg *MongoModel) PrepareForInsert(status int)

Jump to

Keyboard shortcuts

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