本文整理匯總了Golang中datamodel/protobuf.Domain.GetSketches方法的典型用法代碼示例。如果您正苦於以下問題:Golang Domain.GetSketches方法的具體用法?Golang Domain.GetSketches怎麽用?Golang Domain.GetSketches使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類datamodel/protobuf.Domain
的用法示例。
在下文中一共展示了Domain.GetSketches方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: createDomain
func (s *serverStruct) createDomain(ctx context.Context, in *pb.Domain) (*pb.Domain, error) {
info := datamodel.NewEmptyInfo()
info.Name = in.Name
// FIXME: A Domain's info should have an array of properties for each Sketch (or just an array
// of Sketches, like what the proto has). This is just a hack to choose the first Sketch and
// use it's info for now
info.Properties.MaxUniqueItems = in.GetSketches()[0].GetProperties().MaxUniqueItems
info.Properties.Size = in.GetSketches()[0].GetProperties().Size
if info.Properties.Size == nil || *info.Properties.Size == 0 {
var defaultSize int64 = 100
info.Properties.Size = &defaultSize
}
// FIXME: We should be passing a pb.Domain and not a datamodel.Info to manager.CreateDomain
err := s.manager.CreateDomain(info)
if err != nil {
return nil, err
}
return in, nil
}