本文整理汇总了Golang中github.com/twinj/uuid.UUID.String方法的典型用法代码示例。如果您正苦于以下问题:Golang UUID.String方法的具体用法?Golang UUID.String怎么用?Golang UUID.String使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类github.com/twinj/uuid.UUID
的用法示例。
在下文中一共展示了UUID.String方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: newBatchArchive
// open an archive for writing batch recordings
func (r *Service) newBatchArchive(rid uuid.UUID) (*batchArchive, error) {
rpath := path.Join(r.saveDir, rid.String()+batchEXT)
f, err := os.Create(rpath)
if err != nil {
return nil, err
}
archive := zip.NewWriter(f)
return &batchArchive{f: f, archive: archive}, nil
}
示例2: newStreamWriter
// create new stream writer
func (r *Service) newStreamWriter(rid uuid.UUID) (io.WriteCloser, error) {
rpath := path.Join(r.saveDir, rid.String()+streamEXT)
f, err := os.Create(rpath)
if err != nil {
return nil, fmt.Errorf("failed to save recording: %s", err)
}
gz := gzip.NewWriter(f)
sw := streamWriter{f: f, gz: gz}
return sw, nil
}
示例3: doRecordStream
// Record the stream for a duration
func (r *Service) doRecordStream(rid uuid.UUID, dur time.Duration, dbrps []kapacitor.DBRP, started chan struct{}) error {
e, err := r.TaskMaster.NewFork(rid.String(), dbrps)
if err != nil {
return err
}
sw, err := r.newStreamWriter(rid)
if err != nil {
return err
}
defer sw.Close()
done := make(chan struct{})
go func() {
close(started)
start := time.Time{}
closed := false
for p, ok := e.NextPoint(); ok; p, ok = e.NextPoint() {
if closed {
continue
}
if start.IsZero() {
start = p.Time
}
if p.Time.Sub(start) > dur {
closed = true
close(done)
//continue to read any data already on the edge, but just drop it.
continue
}
kapacitor.WritePointForRecording(sw, p, precision)
}
}()
<-done
e.Abort()
r.TaskMaster.DelFork(rid.String())
return nil
}