Documentation
¶
Index ¶
- Constants
- Variables
- type Address
- type AttributeKeyValInt
- type Attributes
- type Category
- type ChangePassword
- type CodeInfo
- type Coordinate
- type DefaultProductAttribute
- type Error
- type GlobalInformation
- type Item
- type Items
- type JwtCustomClaims
- type Location
- type LoginInfo
- type Logout
- type MotorCycleSpesification
- type Profile
- type Result
- type SaleAttribute
- type Search
- type Target
- type Uploads
- type User
- func (u *User) AuthFind(id string) (code int, err error)
- func (u *User) ChangePass(id, oldPass, newPass string) (code int, err error)
- func (u *User) CheckPass(pass string) (ok bool, err error)
- func (u *User) ClearPass()
- func (u *User) FindByEmail(email string) (code int, err error)
- func (u *User) FindByID(id string) (code int, err error)
- func (u *User) Insert() (code int, err error)
- func (u *User) New()
- type UserAuth
- type UserBase
- type UserRegister
Constants ¶
const ( ErrDatabase = -1 ErrSystem = -2 ErrDupRows = -3 ErrNotFound = -4 )
Predefined model error codes.
Variables ¶
var ItemFields = []string{
"id",
"link",
"title",
"meta",
"attributes",
"postedAt",
"updatedAt",
"source",
}
ItemFields is a global fields of item
Functions ¶
This section is empty.
Types ¶
type Address ¶
type Address struct { Country string `bson:"country,omitempty" json:"country,omitempty"` State string `bson:"state,omitempty" json:"state,omitempty"` City string `bson:"city,omitempty" json:"city,omitempty"` Coordinate Coordinate `bson:"coordinate,omitempty" json:"coordinate,omitempty"` }
Address is a struct for ...
type AttributeKeyValInt ¶
type AttributeKeyValInt struct { Value float32 `bson:"value,omitempty" json:"value,omitempty"` Denomination string `bson:"denomination,omitempty" json:"denomination,omitempty"` }
AttributeKeyValInt a struct for ...
type Attributes ¶
type Attributes struct { SaleAttribute map[string]interface{} `bson:"saleAttribute,omitempty" json:"saleAttribute,omitempty"` Spesification map[string]interface{} `bson:"spesification,omitempty" json:"spesification,omitempty"` }
Attributes a struct for ...
type Category ¶
type Category struct { ID bson.ObjectId `bson:"_id,omitempty" json:"id,omitempty"` Node int `bson:"node" json:"node"` ParentNode int `bson:"parentNode" json:"parentNode"` Sort int `bson:"sort" json:"sort"` Name string `bson:"name" json:"name"` Keyword string `bson:"keyword" json:"keyword"` MetaTitle string `bson:"metaTitle" json:"metaTitle"` MetaDescription string `bson:"metaDescription" json:"metaDescription"` LanguageCulture string `bson:"languageCulture" json:"languageCulture"` LanguageCultureSort int `bson:"languageCultureSort" json:"languageCultureSort"` Status int `bson:"status" json:"status"` CreatedAt time.Time `bson:"createdAt,omitempty" json:"createdAt,omitempty"` UpdatedAt time.Time `bson:"updatedAt,omitempty" json:"updatedAt,omitempty"` UpdatedBy bson.ObjectId `bson:"updatedBy,omitempty" json:"updatedBy,omitempty"` CreatedBy bson.ObjectId `bson:"createdBy,omitempty" json:"createdBy,omitempty"` }
Category is a struct for ...
type ChangePassword ¶
type ChangePassword struct { ID bson.ObjectId `form:"id" json:"id" validate:"required;Match(/^\\w{24}$/)"` OldPassword string `form:"oldPassword" json:"oldPassword" validate:"Required"` NewPassword string `form:"newPassword" json:"newPassword" validate:"Required"` }
ChangePassword definition.
type CodeInfo ¶
CodeInfo definiton.
func NewErrorInfo ¶
NewErrorInfo return a CodeInfo represents error.
func NewNormalInfo ¶
NewNormalInfo return a CodeInfo represents OK.
type Coordinate ¶
type Coordinate struct { Latitude string `bson:"latitude,omitempty" json:"latitude,omitempty"` Longitude string `bson:"longitude,omitempty" json:"longitude,omitempty"` }
Coordinate is a struct for ...
type DefaultProductAttribute ¶
type DefaultProductAttribute struct { Brand string `bson:"brand,omitempty" json:"brand,omitempty"` Type string `bson:"type,omitempty" json:"type,omitempty"` }
DefaultProductAttribute is a struct for ...
type Error ¶
type Error struct { UserMessage string InternalMessage string StatusCode int Code int MoreInfo string }
Error is a struct for ...
type GlobalInformation ¶
type GlobalInformation struct { ID string `form:"id" validate:"required;Match(/^\\w{24}$/)"` Username string `form:"username" validate:"required;MinSize(6);MaxSize(30)"` Mobile string `form:"mobile" validate:"required;Match(/^\\d{12}/)"` BirthDate string `form:"birthdate" validate:"required;Match(/^\\d{4}-\\d{2}-\\d{2}$/)"` Gender int `form:"gender" validate:"required;Numeric;Range(0,2)"` }
GlobalInformation definition.
type Item ¶
type Item struct { ID bson.ObjectId `bson:"_id,omitempty" json:"id,omitempty"` Link string `bson:"link,omitempty" json:"link,omitempty"` Name string `bson:"name,omitempty" json:"name,omitempty"` Description string `bson:"description,omitempty" json:"description,omitempty"` Images []string `bson:"images,omitempty" json:"images,omitempty"` Attributes interface{} `bson:"attributes,omitempty" json:"attributes,omitempty"` Address Address `bson:"address,omitempty" json:"address,omitempty"` Categories []string `bson:"categories,omitempty" json:"categories,omitempty"` Keywords string `bson:"keywords,omitempty" json:"keywords,omitempty"` User UserBase `bson:"user,omitempty" json:"user,omitempty"` Status int `bson:"status" json:"status"` PostedAt time.Time `bson:"postedAt,omitempty" json:"postedAt,omitempty"` CreatedAt time.Time `bson:"createdAt,omitempty" json:"createdAt,omitempty"` UpdatedAt time.Time `bson:"updatedAt,omitempty" json:"updatedAt,omitempty"` UpdatedBy bson.ObjectId `bson:"updatedBy,omitempty" json:"updatedBy,omitempty"` CreatedBy bson.ObjectId `bson:"createdBy,omitempty" json:"createdBy,omitempty"` }
Item is a struct for ...
func (*Item) GetShortDescription ¶
GetShortDescription is a function for ...
func (*Item) SetAttributes ¶
func (i *Item) SetAttributes(attr interface{})
SetAttributes is a function for ...
type JwtCustomClaims ¶
type JwtCustomClaims struct { /* Name string `json:"name" xml:"name"` Email string `json:"email" xml:"email"` Role string `json:"role" xml:"role"` */ Identity string `json:"identity" xml:"identity"` jwt.StandardClaims }
JwtCustomClaims are custom claims extending default ones.
type Location ¶
type Location struct { ID bson.ObjectId `bson:"_id,omitempty" json:"id,omitempty"` Node int `bson:"node" json:"node"` ParentNode int `bson:"parentNode" json:"parentNode"` Sort int `bson:"sort" json:"sort"` Type string `bson:"type" json:"type"` // Country | State | City | - | Village Name string `bson:"name" json:"name"` Keyword string `bson:"keyword" json:"keyword"` MetaTitle string `bson:"metaTitle" json:"metaTitle"` MetaDescription string `bson:"metaDescription" json:"metaDescription"` InternationalName string `bson:"internationalName" json:"internationalName"` Attributes interface{} `bson:"attributes" json:"attributes"` Status int `bson:"status" json:"status"` CreatedAt time.Time `bson:"createdAt,omitempty" json:"createdAt,omitempty"` UpdatedAt time.Time `bson:"updatedAt,omitempty" json:"updatedAt,omitempty"` UpdatedBy bson.ObjectId `bson:"updatedBy,omitempty" json:"updatedBy,omitempty"` CreatedBy bson.ObjectId `bson:"createdBy,omitempty" json:"createdBy,omitempty"` }
Location is a struct for ...
type Logout ¶
type Logout struct {
ID string `form:"id" json:"id" validate:"required;Match(/^\\w{24}$/)"`
}
Logout defintion.
type MotorCycleSpesification ¶
type MotorCycleSpesification struct { DefaultProductAttribute CreatedAt time.Time `bson:"createdAt,omitempty" json:"createdAt,omitempty"` Fuel string `bson:"fuel,omitempty" json:"fuel,omitempty"` EngineCapacity AttributeKeyValInt `bson:"engineCapacity,omitempty" json:"engineCapacity,omitempty"` // contains filtered or unexported fields }
MotorCycleSpesification a struct for ...
type Profile ¶
type Profile struct { FirstName string `bson:"firstName,omitempty" json:"firstName,omitempty"` LastName string `bson:"lastName,omitempty" json:"lastName,omitempty"` Contacts interface{} `bson:"contacts,omitempty" json:"contacts,omitempty"` PhotoProfile string `bson:"photoProfile,omitempty" json:"photoProfile,omitempty"` }
Profile is a struct for ...
type SaleAttribute ¶
type SaleAttribute struct { Price string `bson:"price,omitempty" json:"price,omitempty"` Currency string `bson:"currency,omitempty" json:"currency,omitempty"` }
SaleAttribute is a struct for ...
type Search ¶
type Search struct { Query string `json:"q" form:"q" query:"q"` Filter map[string]string `json:"filter" form:"filter" query:"filter"` //attributes[...][...], Sort string `json:"sort" form:"sort" query:"sort"` //sort[...][...], Fields string `json:"fields" form:"fields" query:"fields"` //sort[...][...], Paging map[string]int `json:"paging" form:"paging" query:"paging"` //offset=10&limit=5 Algorithm map[string]string `json:"algorithm" form:"algorithm" query:"algorithm"` // tsukamoto }
Search is a struct for ...
type Target ¶
type Target struct { ID bson.ObjectId `bson:"_id,omitempty" json:"id,omitempty"` Domain string `bson:"domain,omitempty" json:"domain,omitempty"` Name string `bson:"name,omitempty" json:"name,omitempty"` Logo string `bson:"logo,omitempty" json:"logo,omitempty"` Type string `bson:"type" json:"type"` // ecommerce | marketplace | news Status int `bson:"status" json:"status"` CreatedAt time.Time `bson:"createdAt,omitempty" json:"createdAt,omitempty"` UpdatedAt time.Time `bson:"updatedAt,omitempty" json:"updatedAt,omitempty"` UpdatedBy bson.ObjectId `bson:"updatedBy,omitempty" json:"updatedBy,omitempty"` CreatedBy bson.ObjectId `bson:"createdBy,omitempty" json:"createdBy,omitempty"` }
Target is a struct for..
type Uploads ¶
type Uploads struct {
ID string `form:"id" json:"id" validate:"required;Match(/^\\w{24}$/)"`
}
Uploads definition.
type User ¶
type User struct { ID bson.ObjectId `bson:"_id,omitempty" json:"id,omitempty"` Role string `bson:"role,omitempty" json:"role,omitempty"` UserName string `bson:"userName,omitempty" json:"userName,omitempty"` Email string `bson:"email,omitempty" json:"email,omitempty"` MobilePhone string `bson:"mobilePhone,omitempty" json:"mobilePhone,omitempty"` Password string `bson:"password,omitempty" json:"password,omitempty"` Salt string `bson:"salt,omitempty" json:"salt,omitempty"` LoginHistory interface{} `bson:"loginHistory,omitempty" json:"loginHistory,omitempty"` History interface{} `bson:"history,omitempty" json:"history,omitempty"` Status int `bson:"status" json:"status"` CreatedAt time.Time `bson:"createdAt,omitempty" json:"createdAt,omitempty"` UpdatedAt time.Time `bson:"updatedAt,omitempty" json:"updatedAt,omitempty"` UpdatedBy bson.ObjectId `bson:"updatedBy,omitempty" json:"updatedBy,omitempty"` CreatedBy bson.ObjectId `bson:"createdBy,omitempty" json:"createdBy,omitempty"` Profile Profile `bson:"profile,omitempty" json:"profile,omitempty"` }
User is a struct for ...
func (*User) ChangePass ¶
ChangePass update password and salt information according to input id.
func (*User) FindByEmail ¶
FindByEmail query a document according to input email.
type UserAuth ¶
type UserAuth struct { AccountID string `json:"accountId" form:"accountId" xml:"accountId" validate:"required,email"` Password string `json:"password" form:"password" xml:"password" validate:"required,min=6"` }
UserAuth is a models ...
func (*UserAuth) UserClaimsIdentity ¶
UserClaimsIdentity is a function...
type UserBase ¶
type UserBase struct { Link string `bson:"link,omitempty" json:"link,omitempty"` Name string `bson:"name,omitempty" json:"name,omitempty"` Contacts interface{} `bson:"contacts,omitempty" json:"contacts,omitempty"` PhotoProfile string `bson:"photoProfile,omitempty" json:"photoProfile,omitempty"` Address Address `bson:"address,omitempty" json:"address,omitempty"` }
UserBase is a struct for ...
type UserRegister ¶
type UserRegister struct { Email string `form:"email" json:"email" validate:"required,email"` UserName string `form:"userName" json:"userName" validate:"required,min=4,max=30"` Password string `form:"password" json:"password" validate:"required,min=6,max=30"` ConfirmPassword string `form:"confirmPassword" json:"confirmPassword" validate:"required,min=6,max=30,eqfield=Password"` }
UserRegister definition.
func (*UserRegister) Save ¶
func (r *UserRegister) Save() (code int, err error)
Save alloc and initialize a user.