本文整理匯總了Golang中github.com/favclip/smg/smgutils.Unix函數的典型用法代碼示例。如果您正苦於以下問題:Golang Unix函數的具體用法?Golang Unix怎麽用?Golang Unix使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了Unix函數的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: Searchfy
// Searchfy converts *Inventory to *InventorySearch.
func (src *Inventory) Searchfy() (*InventorySearch, error) {
if src == nil {
return nil, nil
}
dest := &InventorySearch{}
dest.src = src
var err error
var b []byte
dest.ID = strconv.FormatInt(src.ID, 10)
dest.ProductName = src.ProductName
dest.Description = src.Description
dest.DescriptionUnigram, err = smgutils.UnigramForSearch(src.Description)
if err != nil {
return nil, err
}
dest.DescriptionBigram, err = smgutils.BigramForSearch(src.Description)
if err != nil {
return nil, err
}
dest.Stock = float64(src.Stock)
dest.Price = strconv.Itoa(src.Price)
dest.Barcode = strconv.FormatInt(src.Barcode, 10)
b, err = json.Marshal(src.AdminNames)
if err != nil {
return nil, err
}
if str := string(b); str != "" && str != "\"\"" {
dest.AdminNames = str
}
b, err = json.Marshal(src.Shops)
if err != nil {
return nil, err
}
if str := string(b); str != "" && str != "\"\"" {
dest.Shops = str
}
dest.CreatedAt = src.CreatedAt
dest.UpdatedAtUnixTime = float64(smgutils.Unix(src.UpdatedAt))
dest.UpdatedAt = src.UpdatedAt
return dest, nil
}
示例2: UnixTimeEqual
// UnixTimeEqual add query operand.
func (p *SampleSearchUnixTimePropertyInfo) UnixTimeEqual(value time.Time) *SampleSearchBuilder {
p.b.currentOp.Children = append(p.b.currentOp.Children, &smgutils.Op{FieldName: p.Name + "UnixTime", Type: smgutils.Eq, Value: smgutils.Unix(value)})
return p.b
}
示例3: UnixTimeLessThan
// UnixTimeLessThan add query operand.
func (p *InventorySearchUnixTimePropertyInfo) UnixTimeLessThan(value time.Time) *InventorySearchBuilder {
p.b.currentOp.Children = append(p.b.currentOp.Children, &smgutils.Op{FieldName: p.Name + "UnixTime", Type: smgutils.Lt, Value: smgutils.Unix(value)})
return p.b
}