query
stringlengths
7
3.85k
document
stringlengths
11
430k
metadata
dict
negatives
sequencelengths
0
101
negative_scores
sequencelengths
0
101
document_score
stringlengths
3
10
document_rank
stringclasses
102 values
shrinkIfNeeded shrinks the deque if it has too many unused space.
func (d *Deque[T]) shrinkIfNeeded() { if int(float64(d.segUsed()*2)*1.2) < cap(d.segs) { newCapacity := cap(d.segs) / 2 seg := make([]*Segment[T], newCapacity) for i := 0; i < d.segUsed(); i++ { seg[i] = d.segs[(d.begin+i)%cap(d.segs)] } u := d.segUsed() d.begin = 0 d.end = u d.segs = seg } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (q *Deque) ShrinkToFit() {\n\tq.Resize(q.Size())\n}", "func (q *queue) Shrink() {\n\t// TODO: implement me\n}", "func (q *Queue) Shrink() {\n\tif q.GetIthLength(q.mq.popIndex) == 0 && q.mq.pushIndex > 0 {\n\t\tq.mq.notifier = q.mq.notifier[q.mq.popIndex+1:]\n\t\tq.mq.total--\n\t\tq.mq.pushIndex--\n\t\t// log.Printf(\"After shrink new mq %+v\", q.mq)\n\t\tlogger.Log.Error(\"WorkerQueue Stats\", zap.Any(\"popindex\", q.mq.popIndex), zap.Any(\"queueSize\", len(q.mq.notifier[q.mq.popIndex])), zap.Any(\"totalChannelList\", q.mq.total))\n\t}\n}", "func (list *ArrayList) shrink() {\n\tif SHRINK_FACTOR == 0.0 {\n\t\treturn\n\t}\n\tcurrentCapacity := cap(list.elements)\n\tif list.size <= int(float32(currentCapacity)*SHRINK_FACTOR) {\n\t\t//调整容量为实际大小\n\t\tlist.refresh(list.size)\n\t}\n\n}", "func shrinkSubListIfNeeded(sl []*subState) []*subState {\n\tlsl := len(sl)\n\tcsl := cap(sl)\n\t// Don't bother if list not too big\n\tif csl <= 8 {\n\t\treturn sl\n\t}\n\tpFree := float32(csl-lsl) / float32(csl)\n\tif pFree > 0.50 {\n\t\treturn append([]*subState(nil), sl...)\n\t}\n\treturn sl\n}", "func (q *Queue) reduceSize() {\n\tif q.length < len(q.contents)/4 {\n\t\tq.reSize(len(q.contents) / 2)\n\t}\n}", "func (c *DirentCache) maybeShrink() {\n\tfor c.maxSize > 0 && c.currentSize > c.maxSize {\n\t\tc.remove(c.list.Back())\n\t}\n}", "func (q *PriorityQueue) resize() {\n\tnewBuf := make([]interface{}, q.count<<1)\n\n\tif q.tail > q.head {\n\t\tcopy(newBuf, q.buf[q.head:q.tail])\n\t} else {\n\t\tn := copy(newBuf, q.buf[q.head:])\n\t\tcopy(newBuf[n:], q.buf[:q.tail])\n\t}\n\n\tq.head = 0\n\tq.tail = q.count\n\tq.buf = newBuf\n}", "func (i *Inbox[M]) Shrink(limit int) {\n\tif len(i.InboxItems) < limit {\n\t\treturn\n\t}\n\n\ti.InboxItems = i.InboxItems[:limit]\n}", "func (b *Buddy) ShrinkSpace() {\n\trbTreeOfFreeBlocks := &b.rbTreesOfFreeBlocks[numberOfFreeBlockLists-1]\n\n\tfor {\n\t\tblock := int64(b.spaceSize - MaxBlockSize)\n\n\t\tif !rbTreeOfFreeBlocks.DeleteKey(block) {\n\t\t\treturn\n\t\t}\n\n\t\tb.spaceSize -= MaxBlockSize\n\t\tb.blockAllocationBitmap.Shrink()\n\t}\n}", "func (q *Queue) expandSize() {\n\tif q.end == len(q.contents)-1 {\n\t\tq.reSize(len(q.contents) * 2)\n\t}\n}", "func (c *RingBuffer) resize(minSize int) (int, error) {\n\t// first figure out how big it should be\n\tquarters := 8\n\tif len(c.buf) > 8192 {\n\t\tquarters = 5\n\t}\n\tnewSize := len(c.buf) * quarters / 4\n\tif minSize > newSize {\n\t\tnewSize = minSize\n\t}\n\tnewbuf := make([]byte, newSize)\n\t_, err := c.peek(newbuf)\n\tif err != nil {\n\t\t// we didn't change anything\n\t\treturn len(c.buf), err\n\t}\n\t// we now have a new, bigger buffer with all the contents in it\n\tc.buf = newbuf\n\tc.index = 0\n\treturn len(c.buf), nil\n}", "func (q *Deque) Resize(newCap int) {\n\tif newCap != cap(q.values) {\n\t\tnewValues := make([]interface{}, newCap, newCap)\n\t\tvar j int = 0\n\t\tfor i := q.front; j < q.size && j < newCap; i, j = (i+1)%cap(q.values), j+1 {\n\t\t\tnewValues[j] = q.values[i]\n\t\t}\n\t\tq.values = newValues\n\t\tq.front = 0\n\t\tq.back = j\n\t}\n}", "func (hpack *HPACK) shrink(add int) {\n\tfor {\n\t\thpack.tableSize = hpack.DynamicSize() + add\n\t\tif hpack.tableSize <= hpack.maxTableSize {\n\t\t\tbreak\n\t\t}\n\t\tn := len(hpack.dynamic) - 1\n\t\tif n == -1 {\n\t\t\tbreak // TODO: panic()?\n\t\t}\n\t\t// release the header field\n\t\tReleaseHeaderField(hpack.dynamic[n])\n\t\t// shrinking slice\n\t\thpack.dynamic = hpack.dynamic[:n]\n\t}\n}", "func (s *nodeSet) resize(capacity int) {\n\tfor len(s.itemMap) > capacity {\n\t\tdelete(s.itemMap, removeTail(s.head, s.tail).val)\n\t}\n\ts.capacity = capacity\n}", "func (c *lruCache) resize() {\n\tif c.maxItems <= 0 { // no size limit\n\t\treturn\n\t}\n\tdrop := len(c.items) - c.maxItems\n\tfor i := 0; i < drop; i++ {\n\t\titem := c.tail.prev\n\t\titem.prev.next = c.tail\n\t\tc.tail.prev = item.prev\n\t\tdelete(c.items, item.key)\n\t}\n}", "func (c *lruCache) resize() {\n\tif c.maxItems <= 0 { // no size limit\n\t\treturn\n\t}\n\tdrop := len(c.items) - c.maxItems\n\tfor i := 0; i < drop; i++ {\n\t\titem := c.tail.prev\n\t\titem.prev.next = c.tail\n\t\tc.tail.prev = item.prev\n\t\tdelete(c.items, item.Key)\n\t}\n}", "func (m *metricFlinkJvmMemoryNonheapUsed) updateCapacity() {\n\tif m.data.Sum().DataPoints().Len() > m.capacity {\n\t\tm.capacity = m.data.Sum().DataPoints().Len()\n\t}\n}", "func (m *metricMysqlBufferPoolPageFlushes) updateCapacity() {\n\tif m.data.Sum().DataPoints().Len() > m.capacity {\n\t\tm.capacity = m.data.Sum().DataPoints().Len()\n\t}\n}", "func (m *metricFlinkJvmMemoryNonheapCommitted) updateCapacity() {\n\tif m.data.Sum().DataPoints().Len() > m.capacity {\n\t\tm.capacity = m.data.Sum().DataPoints().Len()\n\t}\n}", "func (m *metricFlinkJvmMemoryHeapUsed) updateCapacity() {\n\tif m.data.Sum().DataPoints().Len() > m.capacity {\n\t\tm.capacity = m.data.Sum().DataPoints().Len()\n\t}\n}", "func (m *metricFlinkJvmMemoryHeapCommitted) updateCapacity() {\n\tif m.data.Sum().DataPoints().Len() > m.capacity {\n\t\tm.capacity = m.data.Sum().DataPoints().Len()\n\t}\n}", "func (q *Queue) reSize(size int) {\n\tnewSlice := make([]interface{}, size)\n\n\tcopy(newSlice, q.contents[q.start:q.end+1])\n\n\tq.contents = newSlice\n\tq.start = 0\n\tq.end = q.length - 1\n}", "func (m *metricFlinkJvmMemoryNonheapMax) updateCapacity() {\n\tif m.data.Sum().DataPoints().Len() > m.capacity {\n\t\tm.capacity = m.data.Sum().DataPoints().Len()\n\t}\n}", "func (this *Hash) Shrink() {\n\tif this == nil {\n\t\treturn\n\t}\n\n\tif this.lock {\n\t\tthis.mu.Lock()\n\t\tdefer this.mu.Unlock()\n\t}\n\n\tthis.loose.shrink()\n\tthis.compact.shrink(this.loose.a)\n}", "func (m *metricFlinkJvmMemoryHeapMax) updateCapacity() {\n\tif m.data.Sum().DataPoints().Len() > m.capacity {\n\t\tm.capacity = m.data.Sum().DataPoints().Len()\n\t}\n}", "func (s *Stream) Shrink() {\n\ts.recvLock.Lock()\n\tif s.recvBuf != nil && s.recvBuf.Len() == 0 {\n\t\ts.recvBuf = nil\n\t}\n\ts.recvLock.Unlock()\n}", "func (tv *TextView) ResizeIfNeeded(nwSz image.Point) bool {\n\tif nwSz == tv.LinesSize {\n\t\treturn false\n\t}\n\t// fmt.Printf(\"%v needs resize: %v\\n\", tv.Nm, nwSz)\n\ttv.LinesSize = nwSz\n\tdiff := tv.SetSize()\n\tif !diff {\n\t\t// fmt.Printf(\"%v resize no setsize: %v\\n\", tv.Nm, nwSz)\n\t\treturn false\n\t}\n\tly := tv.ParentLayout()\n\tif ly != nil {\n\t\ttv.SetFlag(int(TextViewInReLayout))\n\t\tly.GatherSizes() // can't call Size2D b/c that resets layout\n\t\tly.Layout2DTree()\n\t\ttv.SetFlag(int(TextViewRenderScrolls))\n\t\ttv.ClearFlag(int(TextViewInReLayout))\n\t\t// fmt.Printf(\"resized: %v\\n\", tv.LayData.AllocSize)\n\t}\n\treturn true\n}", "func (m *metricFlinkJobLastCheckpointSize) updateCapacity() {\n\tif m.data.Sum().DataPoints().Len() > m.capacity {\n\t\tm.capacity = m.data.Sum().DataPoints().Len()\n\t}\n}", "func (cache *Cache) ResizeCond(capacity int) bool {\n\tcache.mu.Lock()\n\tdefer cache.mu.Unlock()\n\n\tcurrent := len(cache.entries)\n\n\tif current >= capacity*3/4 && current < capacity*2 {\n\t\treturn false\n\t}\n\n\tif capacity < current {\n\t\tif int(cache.tail) > capacity {\n\t\t\t// this would invalidate too many indices\n\t\t\treturn false\n\t\t}\n\t}\n\n\tcache.resize(capacity)\n\treturn true\n}", "func (m *metricMysqlBufferPoolLimit) updateCapacity() {\n\tif m.data.Sum().DataPoints().Len() > m.capacity {\n\t\tm.capacity = m.data.Sum().DataPoints().Len()\n\t}\n}", "func (m *metricFlinkJvmMemoryDirectUsed) updateCapacity() {\n\tif m.data.Sum().DataPoints().Len() > m.capacity {\n\t\tm.capacity = m.data.Sum().DataPoints().Len()\n\t}\n}", "func (m *metricActiveDirectoryDsSecurityDescriptorPropagationsEventQueued) updateCapacity() {\n\tif m.data.Sum().DataPoints().Len() > m.capacity {\n\t\tm.capacity = m.data.Sum().DataPoints().Len()\n\t}\n}", "func (m *metricMysqlBufferPoolPages) updateCapacity() {\n\tif m.data.Sum().DataPoints().Len() > m.capacity {\n\t\tm.capacity = m.data.Sum().DataPoints().Len()\n\t}\n}", "func (this *SrsMessageQueue) Shrink() {\n\tvar videoSH *rtmp.SrsRtmpMessage\n\tvar audioSH *rtmp.SrsRtmpMessage\n\tfor i := 0; i < len(this.msgs); i++ {\n\t\t//todo check is raw data?\n\t\tif this.msgs[i].GetHeader().IsVideo() && flvcodec.VideoIsSequenceHeader(this.msgs[i].GetPayload()) {\n\t\t\tvideoSH = this.msgs[i]\n\t\t}\n\n\t\tif this.msgs[i].GetHeader().IsAudio() && flvcodec.AudioIsSequenceHeader(this.msgs[i].GetPayload()) {\n\t\t\taudioSH = this.msgs[i]\n\t\t}\n\t}\n\t//clear\n\tthis.msgs = this.msgs[0:0]\n\n\tthis.avStartTime = this.avEndTime\n\tif videoSH != nil {\n\t\tvideoSH.GetHeader().SetTimestamp(this.avEndTime)\n\t\tthis.msgs = append(this.msgs, videoSH)\n\t}\n\n\tif audioSH != nil {\n\t\taudioSH.GetHeader().SetTimestamp(this.avEndTime)\n\t\tthis.msgs = append(this.msgs, audioSH)\n\t}\n}", "func (m *metricMysqlBufferPoolDataPages) updateCapacity() {\n\tif m.data.Sum().DataPoints().Len() > m.capacity {\n\t\tm.capacity = m.data.Sum().DataPoints().Len()\n\t}\n}", "func (m *metricMysqlBufferPoolUsage) updateCapacity() {\n\tif m.data.Sum().DataPoints().Len() > m.capacity {\n\t\tm.capacity = m.data.Sum().DataPoints().Len()\n\t}\n}", "func speedtest1_shrink_memory(tls *libc.TLS) { /* speedtest1.c:456:6: */\n\tif g.bMemShrink != 0 {\n\t\tsqlite3.Xsqlite3_db_release_memory(tls, g.db)\n\t}\n}", "func (m *metricFlinkMemoryManagedUsed) updateCapacity() {\n\tif m.data.Sum().DataPoints().Len() > m.capacity {\n\t\tm.capacity = m.data.Sum().DataPoints().Len()\n\t}\n}", "func (this *FeedableBuffer) Minimize() {\n\tthis.Data = this.Data[:this.minByteCount]\n}", "func (m *metricFlinkJobCheckpointInProgress) updateCapacity() {\n\tif m.data.Sum().DataPoints().Len() > m.capacity {\n\t\tm.capacity = m.data.Sum().DataPoints().Len()\n\t}\n}", "func (this *FeedableBuffer) Maximize() {\n\tthis.ExpandTo(this.maxByteCount)\n}", "func (h *Hash) Shrink() {\n\th.loose.shrink()\n\th.compact.shrink(h.loose.a)\n}", "func (_this *StreamingReadBuffer) RefillIfNecessary(startOffset, position int) (positionOffset int) {\n\tif !_this.isEOF && _this.unreadByteCount(position) < _this.minFreeBytes {\n\t\treturn _this.Refill(startOffset)\n\t}\n\treturn 0\n}", "func (k *Kuzzle) cleanQueue() {\n\tnow := time.Now()\n\tnow = now.Add(-k.queueTTL * time.Millisecond)\n\n\t// Clean queue of timed out query\n\tif k.queueTTL > 0 {\n\t\tvar query *types.QueryObject\n\t\tfor _, query = range k.offlineQueue {\n\t\t\tif query.Timestamp.Before(now) {\n\t\t\t\tk.offlineQueue = k.offlineQueue[1:]\n\t\t\t} else {\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t}\n\n\tif k.queueMaxSize > 0 && len(k.offlineQueue) > k.queueMaxSize {\n\t\tfor len(k.offlineQueue) > k.queueMaxSize {\n\t\t\teventListener := k.eventListeners[event.OfflineQueuePop]\n\t\t\tfor c := range eventListener {\n\t\t\t\tjson, _ := json.Marshal(k.offlineQueue[0])\n\t\t\t\tc <- json\n\t\t\t}\n\n\t\t\teventListener = k.eventListenersOnce[event.OfflineQueuePop]\n\t\t\tfor c := range eventListener {\n\t\t\t\tjson, _ := json.Marshal(k.offlineQueue[0])\n\t\t\t\tc <- json\n\t\t\t\tdelete(k.eventListenersOnce[event.OfflineQueuePop], c)\n\t\t\t}\n\n\t\t\tk.offlineQueue = k.offlineQueue[1:]\n\t\t}\n\t}\n}", "func (m *metricFlinkOperatorWatermarkOutput) updateCapacity() {\n\tif m.data.Sum().DataPoints().Len() > m.capacity {\n\t\tm.capacity = m.data.Sum().DataPoints().Len()\n\t}\n}", "func (f *frontier) Dequeue() {\n\tf.lk.Lock()\n\tdefer f.lk.Unlock()\n\tif len(f.nbs) == 0 {\n\t\treturn\n\t}\n\tf.nbs = f.nbs[1:]\n}", "func (m *metricRedisMemoryFragmentationRatio) updateCapacity() {\n\tif m.data.Gauge().DataPoints().Len() > m.capacity {\n\t\tm.capacity = m.data.Gauge().DataPoints().Len()\n\t}\n}", "func (m *metricActiveDirectoryDsNotificationQueued) updateCapacity() {\n\tif m.data.Sum().DataPoints().Len() > m.capacity {\n\t\tm.capacity = m.data.Sum().DataPoints().Len()\n\t}\n}", "func (m *metricFlinkJvmMemoryMetaspaceUsed) updateCapacity() {\n\tif m.data.Sum().DataPoints().Len() > m.capacity {\n\t\tm.capacity = m.data.Sum().DataPoints().Len()\n\t}\n}", "func (bb *ByteSliceBuffer) Resize(size uint64) (newbuffer *ByteSliceBuffer, ok bool) {\n\tfill := bb.Buffer.Fill()\n\tif fill > size {\n\t\treturn bb, false\n\t}\n\tbd := &ByteSliceBuffer{\n\t\tBuffer: New(size, fill),\n\t\tdata: make([][]byte, size),\n\t}\n\tfb, fe, ss, sb, se := bb.Buffer.CutPoints()\n\tcopy(bd.data, bb.data[fb:fe])\n\tcopy(bd.data[ss:], bb.data[sb:se])\n\treturn bd, true\n}", "func (m *metricFlinkJvmMemoryMappedUsed) updateCapacity() {\n\tif m.data.Sum().DataPoints().Len() > m.capacity {\n\t\tm.capacity = m.data.Sum().DataPoints().Len()\n\t}\n}", "func (m *metricAerospikeNamespaceMemoryFree) updateCapacity() {\n\tif m.data.Gauge().DataPoints().Len() > m.capacity {\n\t\tm.capacity = m.data.Gauge().DataPoints().Len()\n\t}\n}", "func (m *metricFlinkJvmMemoryMetaspaceCommitted) updateCapacity() {\n\tif m.data.Sum().DataPoints().Len() > m.capacity {\n\t\tm.capacity = m.data.Sum().DataPoints().Len()\n\t}\n}", "func (m *metricFlinkJvmGcCollectionsTime) updateCapacity() {\n\tif m.data.Sum().DataPoints().Len() > m.capacity {\n\t\tm.capacity = m.data.Sum().DataPoints().Len()\n\t}\n}", "func ResizeUnsafe(bufptr *[]byte, len int) {\n\tminCap := len + bytesPerVec\n\tif minCap <= cap(*bufptr) {\n\t\tgunsafe.ExtendBytes(bufptr, len)\n\t\treturn\n\t}\n\tdst := make([]byte, len, RoundUpPow2(minCap+(minCap/8), bytesPerVec))\n\tcopy(dst, *bufptr)\n\t*bufptr = dst\n}", "func (m *metricFlinkJobLastCheckpointTime) updateCapacity() {\n\tif m.data.Gauge().DataPoints().Len() > m.capacity {\n\t\tm.capacity = m.data.Gauge().DataPoints().Len()\n\t}\n}", "func (m *metricMysqlBufferPoolOperations) updateCapacity() {\n\tif m.data.Sum().DataPoints().Len() > m.capacity {\n\t\tm.capacity = m.data.Sum().DataPoints().Len()\n\t}\n}", "func (m *metricRedisKeyspaceMisses) updateCapacity() {\n\tif m.data.Sum().DataPoints().Len() > m.capacity {\n\t\tm.capacity = m.data.Sum().DataPoints().Len()\n\t}\n}", "func (cq *cQT) resize(sz uint32) {\n\tb := make([]T, 0, sz)\n\tsi, ei := cq.s&cq.m, cq.e&cq.m\n\tif si < ei {\n\t\tb = append(b, cq.b[si:ei]...)\n\t} else {\n\t\tb = append(b, cq.b[si:]...)\n\t\tb = append(b, cq.b[:ei]...)\n\t}\n\tcq.b = b[:sz]\n\tcq.s, cq.e = 0, cq.e-cq.s\n\tcq.sz = sz\n\tcq.m = sz - 1\n}", "func (m *metricAerospikeNodeMemoryFree) updateCapacity() {\n\tif m.data.Gauge().DataPoints().Len() > m.capacity {\n\t\tm.capacity = m.data.Gauge().DataPoints().Len()\n\t}\n}", "func (m *metricFlinkJvmMemoryMetaspaceMax) updateCapacity() {\n\tif m.data.Sum().DataPoints().Len() > m.capacity {\n\t\tm.capacity = m.data.Sum().DataPoints().Len()\n\t}\n}", "func (b *Buffer) ResizeNoShrink(newSize int) {\n\tb.resize(newSize, false)\n}", "func (q *Queue) DeQueue() (interface{}, bool) {\n\tq.lock.Lock()\n\tdefer q.lock.Unlock()\n\n\tif q.closed && q.items.Len() == 0 {\n\t\treturn nil, false\n\t}\n\n\tfor !q.closed && q.items.Len() == 0 {\n\t\tq.cond.Wait()\n\t}\n\n\tif q.closed && q.items.Len() == 0 {\n\t\treturn nil, false\n\t}\n\n\thi := heap.Pop(&q.items).(*heapItem)\n\titem := hi.value\n\tq.vt += hi.size * q.inv_wsum\n\thi.fi.size -= hi.size\n\tq.size -= hi.size\n\tif hi.fi.size == 0 && hi.fi.pendSize == 0 {\n\t\t// The flow is empty (i.e. inactive), delete it\n\t\tdelete(q.flows, hi.key)\n\t\tq.wsum += uint64(hi.fi.weight)\n\t\tq.inv_wsum = scaledOne / uint64(q.wsum)\n\t\tputFlowInfo(hi.fi)\n\t\tputHeapItem(hi)\n\t} else {\n\t\thi.fi.cond.Signal()\n\t\tputHeapItem(hi)\n\t}\n\n\tif !q.closed {\n\t\t// While there is room in the queue move items from the overflow to the main heap.\n\t\tfor q.next_ohi != nil && q.size+q.next_ohi.hi.size <= q.maxQueueSize {\n\t\t\tq.size += q.next_ohi.hi.size\n\t\t\theap.Push(&q.items, q.next_ohi.hi)\n\t\t\tq.next_ohi.wg.Done()\n\t\t\tif q.overflow.Len() > 0 {\n\t\t\t\tq.next_ohi = heap.Pop(&q.overflow).(*overflowHeapItem)\n\t\t\t} else {\n\t\t\t\tq.next_ohi = nil\n\t\t\t}\n\t\t}\n\t}\n\n\treturn item, true\n}", "func (m *metricFlinkJvmGcCollectionsCount) updateCapacity() {\n\tif m.data.Sum().DataPoints().Len() > m.capacity {\n\t\tm.capacity = m.data.Sum().DataPoints().Len()\n\t}\n}", "func (ms Float64Slice) EnsureCapacity(newCap int) {\n\toldCap := cap(*ms.getOrig())\n\tif newCap <= oldCap {\n\t\treturn\n\t}\n\n\tnewOrig := make([]float64, len(*ms.getOrig()), newCap)\n\tcopy(newOrig, *ms.getOrig())\n\t*ms.getOrig() = newOrig\n}", "func (m *metricRedisConnectionsRejected) updateCapacity() {\n\tif m.data.Sum().DataPoints().Len() > m.capacity {\n\t\tm.capacity = m.data.Sum().DataPoints().Len()\n\t}\n}", "func (q *queue) checkDataSize() error {\n\tif q.dataPageFct.Size()+q.indexPageFct.Size() > q.dataSizeLimit {\n\t\treturn ErrExceedingTotalSizeLimit\n\t}\n\treturn nil\n}", "func (m *metricRedisMemoryRss) updateCapacity() {\n\tif m.data.Gauge().DataPoints().Len() > m.capacity {\n\t\tm.capacity = m.data.Gauge().DataPoints().Len()\n\t}\n}", "func (arr *ArrayList) resize(newCapacity uint32) {\n if newCapacity < MIN_CAPACITY {\n newCapacity = MIN_CAPACITY\n }\n if (newCapacity > arr.capacity) {\n var newData []ItemType = make([]ItemType, newCapacity)\n copy(newData, arr.data)\n arr.data = newData\n arr.capacity = newCapacity\n } else if newCapacity < arr.capacity {\n arr.data = arr.data[:newCapacity]\n arr.capacity = newCapacity\n }\n}", "func (m *metricFlinkJobCheckpointCount) updateCapacity() {\n\tif m.data.Sum().DataPoints().Len() > m.capacity {\n\t\tm.capacity = m.data.Sum().DataPoints().Len()\n\t}\n}", "func (itr *Iterator) AdvanceIfNeeded(minval uint64) {\n\tif itr.index < 0 {\n\t\treturn\n\t}\n\tfor itr.Val() < minval {\n\t\tif itr.HasNext() {\n\t\t\titr.Next()\n\t\t} else {\n\t\t\tbreak\n\t\t}\n\t}\n}", "func tryReserveSpace(ctx *downloaderContext, status *types.DownloaderStatus,\n\tkb uint64) (bool, string) {\n\terrStr := \"\"\n\tif status.ReservedSpace != 0 {\n\t\tlog.Errorf(\"%s, space is already reserved\\n\", status.Name)\n\t\treturn true, errStr\n\t}\n\n\tctx.globalStatusLock.Lock()\n\tif kb >= ctx.globalStatus.RemainingSpace {\n\t\tctx.globalStatusLock.Unlock()\n\t\terrStr = fmt.Sprintf(\"Would exceed remaining space. ObjectSize: %d, RemainingSpace: %d\\n\",\n\t\t\tkb, ctx.globalStatus.RemainingSpace)\n\t\treturn false, errStr\n\t}\n\tctx.globalStatus.ReservedSpace += kb\n\tupdateRemainingSpace(ctx)\n\tctx.globalStatusLock.Unlock()\n\n\tpublishGlobalStatus(ctx)\n\tstatus.ReservedSpace = kb\n\treturn true, errStr\n}", "func reallocLen(need int) (newLen int) {\n\tif need <= minBufSize {\n\t\treturn minBufSize\n\t}\n\treturn 1 << uint(bits.Len(uint(need)))\n}", "func (m *metricBigipNodeDataTransmitted) updateCapacity() {\n\tif m.data.Sum().DataPoints().Len() > m.capacity {\n\t\tm.capacity = m.data.Sum().DataPoints().Len()\n\t}\n}", "func (dm *depositManager) deQueue() {\n\tdm.pendingHeights = dm.pendingHeights[1:]\n}", "func (m *metricRedisMemoryUsed) updateCapacity() {\n\tif m.data.Gauge().DataPoints().Len() > m.capacity {\n\t\tm.capacity = m.data.Gauge().DataPoints().Len()\n\t}\n}", "func (h *MaxHeap) resize(newCapacity int) error {\n\tif newCapacity <= h.capacity {\n\t\treturn errors.Errorf(\"New capacity %d is not larger than current capacity %d\", newCapacity, h.capacity)\n\t}\n\tnewData := make([]string, newCapacity, newCapacity)\n\tfor i := 0; i < len(h.data); i++ {\n\t\tnewData[i] = h.data[i]\n\t}\n\th.capacity = newCapacity\n\th.data = newData\n\treturn nil\n}", "func (m *metricAerospikeNamespaceMemoryUsage) updateCapacity() {\n\tif m.data.Sum().DataPoints().Len() > m.capacity {\n\t\tm.capacity = m.data.Sum().DataPoints().Len()\n\t}\n}", "func (b *BoundAccount) Shrink(ctx context.Context, delta int64) {\n\n\tb.used -= delta\n\tb.reserved += delta\n\tif b.reserved > b.mon.poolAllocationSize {\n\t\tb.mon.releaseBytes(ctx, b.reserved-b.mon.poolAllocationSize)\n\t\tb.reserved = b.mon.poolAllocationSize\n\t}\n}", "func (this *MyCircularDeque) IsFull() bool {\n\treturn this.Cap == this.Size\n}", "func (c *TwoQueueCache[K, V]) ensureSpace(recentEvict bool) {\n\t// If we have space, nothing to do\n\trecentLen := c.recent.Len()\n\tfreqLen := c.frequent.Len()\n\tif recentLen+freqLen < c.size {\n\t\treturn\n\t}\n\n\t// If the recent buffer is larger than\n\t// the target, evict from there\n\tif recentLen > 0 && (recentLen > c.recentSize || (recentLen == c.recentSize && !recentEvict)) {\n\t\tk, _, _ := c.recent.RemoveOldest()\n\t\tc.recentEvict.Add(k, struct{}{})\n\t\treturn\n\t}\n\n\t// Remove from the frequent list otherwise\n\tc.frequent.RemoveOldest()\n}", "func (q *BytesQueue) canInsertAfterTail(need int) bool {\n\tif q.full {\n\t\treturn false\n\t}\n\tif q.tail >= q.head {\n\t\treturn q.capacity-q.tail >= need\n\t}\n\t// 1. there is exactly need bytes between head and tail, so we do not need\n\t// to reserve extra space for a potential empty entry when realloc this queue\n\t// 2. still have unused space between tail and head, then we must reserve\n\t// at least headerEntrySize bytes so we can put an empty entry\n\treturn q.head-q.tail == need || q.head-q.tail >= need+minimumHeaderSize\n}", "func (this *DatastoreOperations) CompactIfNeeded(state *DatastoreState, minSize int64, minGrowthRatio float64, minUnusedSizeRatio float64) (bool, error) {\n\t// Store the start time of the operation\n\tstartTime := MonoUnixTimeMilli()\n\n\t// Get the current size of the index\n\tcurrentSize := state.Size()\n\n\t// Continue only if current size is at least the minimum size to perform compaction checks\n\tif currentSize < minSize {\n\t\treturn false, nil\n\t}\n\n\t// Continue only if file size has grown a sufficient amount since last check\n\tif float64(currentSize) < float64(state.HeadEntryValue.LastCompactionCheckSize)*minGrowthRatio {\n\t\treturn false, nil\n\t}\n\n\t// Create a key index and add all entries to it\n\tkeyIndex := NewDatastoreKeyIndex()\n\terr := keyIndex.AddFromEntryStream(NewPrefetchingReaderAt(state.File), 0, currentSize)\n\tif err != nil {\n\t\treturn false, err\n\t}\n\n\t// Get compacted size and calculate unused size\n\tcompactedSize := keyIndex.GetCompactedSize()\n\tunusedSize := currentSize - compactedSize\n\n\t// If the compacted size is below the threshold for a file rewrite\n\tif float64(unusedSize)/float64(currentSize) < minUnusedSizeRatio {\n\t\t// Update in-place and persist the updated head entry\n\t\terr = state.UpdateHeadEntry(&HeadEntryValue{\n\t\t\tVersion: this.State.HeadEntryValue.Version,\n\t\t\tLastCompactionTime: this.State.HeadEntryValue.LastCompactionTime,\n\t\t\tLastCompactionCheckTime: MonoUnixTimeMicro(),\n\t\t\tLastCompactionCheckSize: currentSize,\n\t\t\tLastCompactionCheckUnusedSize: unusedSize,\n\t\t})\n\n\t\t// Return with any error that occurred, or nil\n\t\treturn false, err\n\t}\n\n\t// Create a timestamp for the compacted datastore head entry\n\tcompactionTimestamp := MonoUnixTimeMicro()\n\n\t// Create a new head entry that preserves the original creation time\n\tcompactedDatastoreHeadEntry := CreateSerializedHeadEntry(&HeadEntryValue{\n\t\tVersion: DatastoreVersion,\n\t\tLastCompactionTime: compactionTimestamp,\n\t\tLastCompactionCheckTime: compactionTimestamp,\n\t\tLastCompactionCheckSize: compactedSize,\n\t\tLastCompactionCheckUnusedSize: 0,\n\t}, state.CreationTime)\n\n\t// Create a reader for the compacted datastore\n\tcompactedDatastoreReader := io.MultiReader(\n\t\tbytes.NewReader(compactedDatastoreHeadEntry),\n\t\tkeyIndex.CreateReaderForCompactedRanges(state.File, HeadEntrySize))\n\n\t// Rewrite the file with the compacted ranges\n\terr = CreateOrRewriteFileSafe(this.FilePath, compactedDatastoreReader)\n\n\t// If an error occurred while rewriting the file\n\tif err != nil {\n\t\t// Return the error\n\t\treturn false, err\n\t}\n\n\t// Reload the datastore\n\tnewState, err := this.Load()\n\n\t// If an error occurred while loading the rewritten file\n\tif err != nil {\n\t\t// Return the error\n\t\treturn false, err\n\t}\n\n\t// Atomically replace the current state object with the new state object\n\tthis.ReplaceState(newState)\n\n\t// Log message\n\tthis.ParentServer.Logf(1, \"Compacted datastore '%s' from %d to %d bytes in %dms\", this.Name, currentSize, compactedSize, MonoUnixTimeMilli()-startTime)\n\n\t// Return without error\n\treturn true, nil\n}", "func (n LogNode) Shrinking() bool {\n\treturn len(n.foldedCols) > 1\n}", "func (w *worker) dequeue(scq *sizeClassQueue) {\n\tif len(w.lastInvocations) == 0 {\n\t\t// Worker has never run an operation before. The worker\n\t\t// was only queued as part of the size class queue\n\t\t// itself.\n\t\tscq.idleSynchronizingWorkers.dequeue(w.listIndices[0])\n\t} else {\n\t\t// Worker has run an operation before. The worker was\n\t\t// queued as part of one or more invocations.\n\t\tfor idx, i := range w.lastInvocations {\n\t\t\ti.idleSynchronizingWorkers.dequeue(w.listIndices[idx])\n\t\t\theapRemoveOrFix(\n\t\t\t\t&scq.idleSynchronizingWorkersInvocations,\n\t\t\t\ti.idleSynchronizingWorkersInvocationsIndex,\n\t\t\t\tlen(i.idleSynchronizingWorkers))\n\t\t}\n\t}\n\tw.wakeup = nil\n\tw.listIndices = w.listIndices[:0]\n}", "func (mm *BytesMonitor) adjustBudget(ctx context.Context) {\n\t// NB: mm.mu Already locked by releaseBytes().\n\tmargin := mm.poolAllocationSize * int64(maxAllocatedButUnusedBlocks)\n\n\tneededBytes := mm.mu.curAllocated\n\tif neededBytes <= mm.reserved.used {\n\t\tneededBytes = 0\n\t} else {\n\t\tneededBytes = mm.roundSize(neededBytes - mm.reserved.used)\n\t}\n\tif neededBytes <= mm.mu.curBudget.used-margin {\n\t\tmm.mu.curBudget.Shrink(ctx, mm.mu.curBudget.used-neededBytes)\n\t}\n}", "func (m *metricRedisMemoryPeak) updateCapacity() {\n\tif m.data.Gauge().DataPoints().Len() > m.capacity {\n\t\tm.capacity = m.data.Gauge().DataPoints().Len()\n\t}\n}", "func (m *metricSshcheckSftpDuration) updateCapacity() {\n\tif m.data.Gauge().DataPoints().Len() > m.capacity {\n\t\tm.capacity = m.data.Gauge().DataPoints().Len()\n\t}\n}", "func (m *metricRedisClientsMaxInputBuffer) updateCapacity() {\n\tif m.data.Gauge().DataPoints().Len() > m.capacity {\n\t\tm.capacity = m.data.Gauge().DataPoints().Len()\n\t}\n}", "func (m *metricSshcheckDuration) updateCapacity() {\n\tif m.data.Gauge().DataPoints().Len() > m.capacity {\n\t\tm.capacity = m.data.Gauge().DataPoints().Len()\n\t}\n}", "func (f *fileScorer) trimQueue() {\n\tfor {\n\t\te := f.queue.Back()\n\t\tif e == nil {\n\t\t\treturn\n\t\t}\n\t\tv := e.Value.(queuedFile)\n\t\tif f.queuedBytes-v.size < f.saveBytes {\n\t\t\treturn\n\t\t}\n\t\tf.queue.Remove(e)\n\t\tf.queuedBytes -= v.size\n\t}\n}", "func (w *worker) maybeDequeue(scq *sizeClassQueue) {\n\tif w.wakeup != nil {\n\t\tw.dequeue(scq)\n\t}\n}", "func (m *metricFlinkJvmMemoryDirectTotalCapacity) updateCapacity() {\n\tif m.data.Sum().DataPoints().Len() > m.capacity {\n\t\tm.capacity = m.data.Sum().DataPoints().Len()\n\t}\n}", "func (m *metricMysqlDoubleWrites) updateCapacity() {\n\tif m.data.Sum().DataPoints().Len() > m.capacity {\n\t\tm.capacity = m.data.Sum().DataPoints().Len()\n\t}\n}", "func ensureLenAndDeref(dst interface{}, n int) interface{} {\n\t// De-reference pointer.\n\tval := reflect.ValueOf(dst).Elem()\n\tif val.Len() >= n {\n\t\treturn val.Slice(0, n).Interface()\n\t}\n\t// Not big enough, re-allocate.\n\tval.Set(reflect.MakeSlice(val.Type(), n, n))\n\treturn val.Interface()\n}", "func (m *metricAerospikeNamespaceDiskAvailable) updateCapacity() {\n\tif m.data.Gauge().DataPoints().Len() > m.capacity {\n\t\tm.capacity = m.data.Gauge().DataPoints().Len()\n\t}\n}", "func (w *Writer) checkLength(length int) {\n\tif len(w.buffer) < w.index+length {\n\t\t// resize...\n\t\tvar tmp = make([]byte, len(w.buffer)+DEFAULT_BUFFER_SIZE)\n\t\tcopy(tmp[:len(w.buffer)], w.buffer)\n\t\tw.buffer = tmp\n\n\t\t// recursion\n\t\tw.checkLength(length)\n\t}\n}", "func (m *metricFlinkMemoryManagedTotal) updateCapacity() {\n\tif m.data.Sum().DataPoints().Len() > m.capacity {\n\t\tm.capacity = m.data.Sum().DataPoints().Len()\n\t}\n}", "func (q *Queue) Grow() {\n\tif q.GetLength() == q.GetCapacity() {\n\t\ttemp := make(chan JobChan, q.queueSize)\n\t\tq.mq.notifier = append(q.mq.notifier, temp)\n\t\tclose(q.mq.notifier[q.mq.pushIndex])\n\t\tq.mq.total++\n\t\tq.mq.pushIndex++\n\t\t// log.Printf(\"After grow new mq %+v\", q.mq)\n\t\tlogger.Log.Error(\"WorkerQueue Stats\", zap.Any(\"pushindex\", q.mq.pushIndex), zap.Any(\"queueSize\", len(q.mq.notifier[q.mq.pushIndex-1])), zap.Any(\"totalChannelList\", q.mq.total))\n\t}\n\n}" ]
[ "0.7139896", "0.66500854", "0.6411221", "0.6002417", "0.5977093", "0.5969946", "0.5852529", "0.5801778", "0.57913065", "0.57144654", "0.55891544", "0.5507603", "0.54847175", "0.5450638", "0.5434355", "0.54138315", "0.5409475", "0.53926706", "0.538491", "0.53378546", "0.5333772", "0.5295669", "0.52821326", "0.5216841", "0.5205207", "0.5204488", "0.5201922", "0.5181023", "0.51777935", "0.5164698", "0.51231337", "0.5119549", "0.50586444", "0.5054281", "0.5053499", "0.50475925", "0.5046502", "0.50371224", "0.50364614", "0.50259805", "0.502543", "0.5022028", "0.5018171", "0.50123745", "0.5008829", "0.49970052", "0.49929816", "0.4981013", "0.497913", "0.49784788", "0.49758956", "0.4971921", "0.4966613", "0.49439958", "0.49360245", "0.49165627", "0.49160364", "0.48944107", "0.4888644", "0.48872715", "0.48793814", "0.48735636", "0.4859687", "0.48583707", "0.484848", "0.48421714", "0.48364052", "0.48348573", "0.48339233", "0.48314452", "0.4826488", "0.4823326", "0.48164666", "0.4808506", "0.48013392", "0.48011646", "0.47981226", "0.47889808", "0.4784993", "0.4778804", "0.47522274", "0.4747503", "0.47395572", "0.473156", "0.4730521", "0.4725359", "0.47191155", "0.47165468", "0.47041848", "0.47021577", "0.4696811", "0.46960986", "0.46944657", "0.46821305", "0.46801522", "0.46800497", "0.46748427", "0.46715635", "0.46611822", "0.46541396" ]
0.79729205
0
String returns a string representation of the deque
func (d *Deque[T]) String() string { str := "[" for i := 0; i < d.Size(); i++ { if str != "[" { str += " " } str += fmt.Sprintf("%v", d.At(i)) } str += "]" return str }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (d Deque) String() string {\n\tresult := \"\"\n\tsep := \" \"\n\tfor curr := d.back; curr != nil; curr = curr.next {\n\t\tif curr.next == nil {\n\t\t\tsep = \"\"\n\t\t}\n\t\tresult += fmt.Sprintf(\"%v%v\", curr.data, sep)\n\t}\n\treturn result\n}", "func(q *Queue) String() string {\n\tvar buffer bytes.Buffer\n\tif q.IsEmpty() {\n\t\tbuffer.WriteString(\"queue is nil\")\n\t}\n\tbuffer.WriteString(\"front [\")\n\tfor i:=0;i<q.Size();i++ {\n\t\tbuffer.WriteString(fmt.Sprint(q.arr[i]))\n\t\tif i != q.Size()-1{\n\t\t\tbuffer.WriteString(\" \")\n\t\t}\n\t}\n\tbuffer.WriteString(\"] back\")\n\treturn buffer.String()\n}", "func (b *linkedQueue) String() string {\n\tret := \"[\"\n\tfor e := b.first; e != nil; e = e.next {\n\t\tret+= fmt.Sprintf(\"%v \", e.value)\n\t}\n\treturn strings.TrimSpace(ret) + \"]\"\n}", "func (q *CircularQueue) String() string {\n\tif q.head == q.tail {\n\t\treturn \"empty queue\"\n\t}\n\tresult := \"head<-\"\n\ti := q.head\n\tfor true {\n\t\tresult += fmt.Sprintf(\"<-%+v\", q.q[i])\n\t\ti = (i + 1) % q.capacity\n\t\tif i == q.tail {\n\t\t\tbreak\n\t\t}\n\t}\n\tresult += \"<-tail\"\n\treturn result\n}", "func (q *CircleQueue) ToString() string {\n\tresult := \"\"\n\ti := q.head\n\tfor i != q.tail {\n\t\tresult += fmt.Sprintf(\"%v\", q.data[i])\n\t\tif i != q.tail {\n\t\t\tresult += \", \"\n\t\t}\n\t\ti = (i + 1) % q.capacity\n\t}\n\treturn result\n}", "func (q *ArrayQueue) ToString() string {\n\tresult := \"\"\n\tfor i := q.head; i < q.tail; i++ {\n\t\tresult += fmt.Sprintf(\"%v\", q.data[i])\n\t\tif i < q.tail-1 {\n\t\t\tresult += \", \"\n\t\t}\n\t}\n\treturn result\n}", "func (dq *Dqueue) String() string {\n\treturn dq.dqueue.String()\n}", "func (q *LinkedListQueue) ToString() string {\n\tresult := \"\"\n\tcur := q.head\n\tfor cur != nil {\n\t\tresult += fmt.Sprintf(\"%v\", cur.value)\n\t\tif cur.next != nil {\n\t\t\tresult += \", \"\n\t\t}\n\t\tcur = cur.next\n\t}\n\treturn result\n}", "func (h *Queue) String() string {\n\tvar b strings.Builder\n\n\tduplicate := NewHeapQueue()\n\tduplicate.slice = append(duplicate.slice, h.slice...)\n\n\tfor val, err := duplicate.PopFirst(); err == nil; val, err = duplicate.PopFirst() {\n\t\tfmt.Fprintf(&b, \" %d\", val.Distance)\n\t}\n\n\treturn fmt.Sprintf(\"tasks.Heap:%s\", b.String())\n}", "func (list *LinkedList[T]) String() string {\n\tlist.key.RLock()\n\tdefer list.key.RUnlock()\n\n\tbuilder := bytes.NewBufferString(\"[\")\n\tcurrent := list.first\n\tfor i := 0; i < 15 && current != nil; i++ {\n\t\tbuilder.WriteString(fmt.Sprintf(\"%v \", current.payload))\n\t\tcurrent = current.next\n\t}\n\tif current == nil || current.next == nil {\n\t\tbuilder.Truncate(builder.Len() - 1)\n\t} else {\n\t\tbuilder.WriteString(\"...\")\n\t}\n\tbuilder.WriteRune(']')\n\treturn builder.String()\n}", "func (list *ArrayList[T]) String() string {\n\treturn fmt.Sprint(list.elems)\n}", "func (s Queue) String() string {\n\treturn awsutil.Prettify(s)\n}", "func (pq *PriorityQueue) String() string {\n\treturn fmt.Sprintf(\"PriorityQueue(%d)\", pq.list.Len())\n}", "func (q *UnsafeQueue64) String() string {\n\treturn fmt.Sprintf(\"Queue{capacity: %v, capMod: %v, putPos: %v, getPos: %v}\",\n\t\tq.capacity, q.capMod, q.getPos, q.getPos)\n}", "func (d deck) toString() string {\n\treturn strings.Join([]string(d), \",\") //[]string(d) deck to slice of string conversion and then join all strings into a single string\n}", "func (d deck) toString() string {\n\t//d deck to slice of string []string(d)\n\t//now the slice of string into a single string comma separated [\"a\",\"b\"]->(\"a,b\")\n\treturn strings.Join([]string(d), \",\")\n}", "func (d deck) toString () string{\n\n\t// convert deck -> string[] -> string (comma separated)\n\treturn strings.Join([]string (d), \",\")\n\n}", "func (q *UnsafeQueue16) String() string {\n\treturn fmt.Sprintf(\"Queue{capacity: %v, capMod: %v, putPos: %v, getPos: %v}\",\n\t\tq.capacity, q.capMod, q.getPos, q.getPos)\n}", "func (d deck) toString() string {\n\treturn strings.Join([]string(d), delimiterChar)\n}", "func (this *LinkedList) String() string {\n\treturn fmt.Sprint(this.ToSlice())\n}", "func (d deck) toString() string {\n\treturn strings.Join([]string(d), \",\")\n\n}", "func (d deck) toString() string {\n\treturn strings.Join([]string(d), \",\")\n}", "func (d deck) toString() string {\n\treturn strings.Join([]string(d), \",\")\n}", "func (d deck) toString() string {\n\treturn strings.Join([]string(d), \",\")\n}", "func (d deck) toString() string {\n\treturn strings.Join([]string(d), \",\")\n}", "func (d deck) toString() string {\n\treturn strings.Join([]string(d), \",\")\n}", "func (d deck) toString() string {\n\treturn strings.Join([]string(d), \",\")\n}", "func (d deck) toString () string {\n\treturn strings.Join([]string(d), \",\")\n}", "func (s QueueReference) String() string {\n\treturn awsutil.Prettify(s)\n}", "func (s SequencerData) String() string {\n\treturn fmt.Sprintf(\"%T len %v\", s, s.Len())\n}", "func (n *Node) String() string {\n\tbuf := bytes.NewBuffer(nil)\n\tcn := n\n\n\tfor {\n\t\tif cn.next == nil {\n\t\t\tbreak\n\t\t}\n\t\tif buf.Len() != 0 {\n\t\t\tfmt.Fprint(buf, \",\")\n\t\t} else {\n\t\t\tfmt.Fprint(buf, \"[\")\n\n\t\t}\n\t\tfmt.Fprintf(buf, \"%v\", cn.next.data)\n\t\tcn = cn.next\n\t}\n\tfmt.Fprint(buf, \"]\")\n\n\treturn buf.String()\n}", "func (bs ByteSlice) String() string {\n\treturn hex.EncodeToString([]byte(bs))\n}", "func (mb *MutableBag) String() string {\n\tif len(mb.values) == 0 {\n\t\treturn mb.parent.String()\n\t}\n\n\tbuf := &bytes.Buffer{}\n\tbuf.WriteString(mb.parent.String())\n\tbuf.WriteString(\"---\\n\")\n\n\tkeys := make([]string, 0, len(mb.values))\n\tfor key := range mb.values {\n\t\tkeys = append(keys, key)\n\t}\n\tsort.Strings(keys)\n\n\tfor _, key := range keys {\n\t\tfmt.Fprintf(buf, \"%-30s: %v\\n\", key, mb.values[key])\n\t}\n\treturn buf.String()\n}", "func (d deck) toString() string {\n\treturn strings.Join(d, \",\") // this will return a string seprated by comma\n}", "func (h *Heap) String() string {\n\tvar b strings.Builder\n\n\tduplicate := NewHeapQueue()\n\tduplicate.slice = append(duplicate.slice, h.slice...)\n\n\tfor val := duplicate.PopFirst(); val != nil; val = duplicate.PopFirst() {\n\t\tfmt.Fprintf(&b, \" %d\", val.Distance)\n\t}\n\n\treturn fmt.Sprintf(\"tasks.Heap:%s\", b.String())\n}", "func (q *T) String() string {\n\tq.mutex.Lock()\n\tdefer q.mutex.Unlock()\n\ts := \"q{\"\n\tfor _, w := range q.writers {\n\t\ts += fmt.Sprintf(\"Writer{id: %d, size: %d, released: %d}, \", w.id, w.size, w.released)\n\t}\n\ts += \"}\"\n\treturn s\n}", "func (h *Heap) String() string {\n\tvar sb strings.Builder\n\tsb.WriteString(\"[\")\n\n\tvar nodesInLayer, newLineIdx int = 1, 0\n\tfor i, el := range h.heap {\n\t\tsb.WriteString(strconv.Itoa(el))\n\t\tif i == len(h.heap)-1 {\n\t\t\tbreak\n\t\t}\n\n\t\tif i == newLineIdx {\n\t\t\tsb.WriteRune('\\n')\n\t\t\tnodesInLayer *= 2\n\t\t\tnewLineIdx += nodesInLayer\n\t\t\tcontinue\n\t\t}\n\n\t\tsb.WriteRune(' ')\n\t}\n\n\tsb.WriteString(\"]\")\n\treturn sb.String()\n}", "func (s TagQueueOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "func (c *jsiiProxy_CfnQueue) ToString() *string {\n\tvar returns *string\n\n\t_jsii_.Invoke(\n\t\tc,\n\t\t\"toString\",\n\t\tnil, // no parameters\n\t\t&returns,\n\t)\n\n\treturn returns\n}", "func (c Collection) String() string {\n\tif c == nil {\n\t\treturn \"\"\n\t}\n\n\tvalues := make([]string, 0, len(c))\n\tfor elem := range c {\n\t\tvalues = append(values, elem)\n\t}\n\n\tsort.Strings(values)\n\n\treturn strings.Join(values, \",\")\n}", "func (c *FIFO) dump() {\n\te := c.q.Front()\n\tfmt.Printf(\"|\")\n\tfor i := 0; i < c.size; i++ {\n\t\tvar val T\n\t\tval = \" \"\n\t\tif e != nil {\n\t\t\tval = e.Value\n\t\t\te = e.Next()\n\t\t}\n\t\tfmt.Printf(\" %v |\", val)\n\t}\n\tfmt.Println()\n}", "func (v ByteVec) String() string { return string([]byte(v)) }", "func (d deck) toString() string {\n\t//strings is a package with function Join, which takes 2 arguments; we are joining the multiple strings w a comma to build one string\n\treturn strings.Join([]string(d), \",\")\n}", "func (s QueueInfo) String() string {\n\treturn awsutil.Prettify(s)\n}", "func (g *ItemGraph) String() {\n\tg.Lock.RLock()\n\ts := \"\"\n\tfor i := 0; i < len(g.Nodes); i++ {\n\t\ts += g.Nodes[i].String() + \" -> \"\n\t\tnear := g.Edges[*g.Nodes[i]]\n\t\tfor j := 0; j < len(near); j++ {\n\t\t\ts += near[j].String() + \" \"\n\t\t}\n\t\ts += \"\\n\"\n\t}\n\t// fmt.Println(s)\n\t// log.Printf(s)\n\tg.Lock.RUnlock()\n}", "func (l *List) String() string {\n\tif l == nil {\n\t\treturn \"nil\"\n\t}\n\tb := bytes.NewBuffer(nil)\n\tb.WriteString(\"[\")\n\ty := l\n\tfor {\n\t\tb.WriteString(fmt.Sprintf(\"%v\", y.val))\n\t\tif !y.End() {\n\t\t\tb.WriteString(\", \")\n\t\t} else {\n\t\t\tbreak\n\t\t}\n\t\ty = y.next\n\t}\n\tb.WriteString(\"]\")\n\n\treturn b.String()\n}", "func (lst List) String() string {\n\titems := \"\"\n\tnode := lst.head\n\tcounter := Number(0)\n\tfor node != nil {\n\t\tif counter < lst.Len()-1 {\n\t\t\titems += fmt.Sprintf(\"%s \", node.value)\n\t\t} else {\n\t\t\titems += fmt.Sprint(node.value)\n\t\t}\n\t\tcounter++\n\t\tnode = node.next\n\t}\n\treturn fmt.Sprintf(\"(%s)\", items)\n}", "func (tri *Triangle) String() string {\n\tstr := \"[\"\n\te := tri.Qe\n\tcomma := \"\"\n\tfor {\n\t\tstr += comma + fmt.Sprintf(\"%v\", e.Orig())\n\t\tcomma = \",\"\n\t\te = e.RPrev()\n\t\tif e.Orig().Equals(tri.Qe.Orig()) {\n\t\t\tbreak\n\t\t}\n\t}\n\tstr = str + \"]\"\n\treturn str\n}", "func (s *sliceStorage) String() string {\n\tresult := \"\\n\"\n\tfor i, entry := range s.entries {\n\t\tresult += fmt.Sprintf(\"%d: %2d %2d %2d %2d %2d %2d \\n\", i, entry[0], entry[1], entry[2], entry[3], entry[4], entry[5])\n\t}\n\tresult += \"\\n\"\n\n\treturn result\n}", "func (this *List) String() string {\n\tes := make([]string, len(this.GetElems()))\n\tfor i, v := range this.GetElems() {\n\t\tes[i] = v.String()\n\t}\n\treturn this.Before.String() + listTypeToString(this.Type) + this.OpenCurly.String() + strings.Join(es, \"\") + this.CloseCurly.String()\n}", "func (set *SetThreadSafe) String() string {\n\tstr := \"HashSet\\n\"\n\tItems := []string{}\n\tset.Items.Range(func(k, v interface{}) bool {\n\t\tItems = append(Items, fmt.Sprintf(\"%v\", k))\n\t\treturn true\n\t})\n\tstr += strings.Join(Items, \", \")\n\treturn str\n}", "func (v DataSlice) String() string { return StringSlice(\", \", \"[\", \"]\", v.Slice()...) }", "func (tree *BTree) String() string {\n\treturn fmt.Sprintf(\"%v\", tree.ToSlice())\n}", "func (s *DynamicStack) String() string {\n\ts.lock.RLock()\n\tdefer s.lock.RUnlock()\n\tvar b bytes.Buffer\n\tfor _, e := range s.data {\n\t\tb.WriteString(fmt.Sprintf(\"%v \", e))\n\t}\n\treturn b.String()\n}", "func (l *List) String() string {\n\tvar b strings.Builder\n\tb.WriteByte('[')\n\tb.WriteString(strconv.Itoa(l.Len))\n\tb.Write([]byte{']', ' ', '{'})\n\tfor curr := l.head; curr != nil; curr = curr.next {\n\t\tfmt.Fprint(&b, curr.Val)\n\t\tb.WriteByte(',')\n\t}\n\tb.WriteByte('}')\n\treturn b.String()\n}", "func (s ListDeadLetterSourceQueuesOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "func (d *Deck) String() string {\n\tvar s string\n\tfor _, v := range d.Cards {\n\t\ts += fmt.Sprintf(\"%v \", v)\n\t}\n\treturn s\n}", "func (s RoutingProfileQueueReference) String() string {\n\treturn awsutil.Prettify(s)\n}", "func (sm Slice) String() string {\n\treturn fmt.Sprint([]interface{}(sm))\n}", "func (s DescribeQueueOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "func (l *SinglyLinkedList) String() string {\n\tvar buffer bytes.Buffer\n\tbuffer.WriteString(\"[\")\n\n\tif l.size != 0 && l.head.next != nil {\n\t\tfor node := l.head.next; node != nil; node = node.next {\n\t\t\tswitch v := node.Value.(type) {\n\t\t\tcase string:\n\t\t\t\tbuffer.WriteString(v)\n\t\t\tcase int:\n\t\t\t\tbuffer.WriteString(strconv.Itoa(v))\n\t\t\tcase float32:\n\t\t\tcase float64:\n\t\t\t\tbuffer.WriteString(fmt.Sprintf(\"%.2f\", v))\n\t\t\tdefault:\n\t\t\t\tfmt.Println(\"Node's value isn't a string, int nor a float\")\n\t\t\t}\n\n\t\t\tif node.next != nil {\n\t\t\t\tbuffer.WriteString(\", \")\n\t\t\t}\n\t\t}\n\t}\n\n\tbuffer.WriteString(\"]\")\n\treturn buffer.String()\n}", "func (c *compress) String() string {\n\treturn fmt.Sprint(*c)\n}", "func (s *chunkSelectiveAck) String() string {\n\tres := fmt.Sprintf(\"SACK cumTsnAck=%d arwnd=%d dupTsn=%d\",\n\t\ts.cumulativeTSNAck,\n\t\ts.advertisedReceiverWindowCredit,\n\t\ts.duplicateTSN)\n\n\tfor _, gap := range s.gapAckBlocks {\n\t\tres = fmt.Sprintf(\"%s\\n gap ack: %s\", res, gap)\n\t}\n\n\treturn res\n}", "func (s *Set) String() string {\n\treturn fmt.Sprintf(\"[%v]\", s.Slice())\n}", "func (s QueueSummary) String() string {\n\treturn awsutil.Prettify(s)\n}", "func (d *DAG) String() string {\n\tresult := fmt.Sprintf(\"DAG Vertices: %d - Edges: %d\\n\", d.GetOrder(), d.GetSize())\n\tresult += \"Vertices:\\n\"\n\td.muDAG.RLock()\n\tfor k := range d.vertices {\n\t\tresult += fmt.Sprintf(\" %v\\n\", k)\n\t}\n\tresult += \"Edges:\\n\"\n\tfor v, children := range d.outboundEdge {\n\t\tfor child := range children {\n\t\t\tresult += fmt.Sprintf(\" %v -> %v\\n\", v, child)\n\t\t}\n\t}\n\td.muDAG.RUnlock()\n\treturn result\n}", "func (a *Array) String() string {\n\tvar out bytes.Buffer\n\n\tout.WriteString(\"[\")\n\n\telems := []string{}\n\n\tfor _, elem := range a.Elements {\n\t\telems = append(elems, elem.String())\n\t}\n\n\tout.WriteString(strings.Join(elems, \", \"))\n\tout.WriteString(\"]\")\n\n\treturn out.String()\n}", "func (c *Capture) String() string {\n\tbuf := &bytes.Buffer{}\n\tfor i, c := range c.children {\n\t\tbuf.WriteString(c.String())\n\t\tif i != len(c.children)-1 {\n\t\t\tbuf.WriteString(\", \")\n\t\t}\n\t}\n\treturn fmt.Sprintf(\"{%d, [%s]}\", c.id, buf.String())\n}", "func (s ListDeadLetterSourceQueuesInput) String() string {\n\treturn awsutil.Prettify(s)\n}", "func (this *HashSet) String() string {\n\treturn fmt.Sprint(this.ToSlice())\n}", "func (l *List) String() string {\n\twords := make([]string, 0, 3*l.Len())\n\tfor e := l.Front(); e != nil; e = e.Next() {\n\t\twords = append(words, fmt.Sprint(e.Value))\n\t}\n\treturn \"(\" + strings.Join(words, \" \") + \")\"\n}", "func (s AwsSqsQueueDetails) String() string {\n\treturn awsutil.Prettify(s)\n}", "func (sc *SelectedCollectors) String() string {\n\tcollectorSlice := make([]string, 0, len(*sc))\n\tfor collectorName := range *sc {\n\t\tcollectorSlice = append(collectorSlice, collectorName)\n\t}\n\tsort.Strings(collectorSlice)\n\treturn fmt.Sprint(collectorSlice)\n}", "func (r *CasSet) String() string {\n\treturn fmt.Sprintf(\"[%v, %v, %v, %v, %v, %v]\", r.key, r.old, r.new, r.pass, r.expire, r.result)\n}", "func (l *List) String() string {\n\tvar s = \"\"\n\tfor curr := l.lastElement; ; curr = curr.Prev {\n\t\ts = fmt.Sprintf(\"%v\", curr.Value) + s\n\t\tif curr.Prev == nil {\n\t\t\treturn s\n\t\t}\n\t}\n}", "func (s *SequenceItemValue) String() string {\n\t// TODO: consider adding more sophisticated formatting\n\treturn fmt.Sprintf(\"%+v\", s.elements)\n}", "func (s DeleteQueueOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "func (s DeleteQueueOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "func (e *SetExpr) String() string {\n\tvar b bytes.Buffer\n\tb.WriteByte('{')\n\ti := 0\n\tfor _, expr := range e.elements {\n\t\tif i > 0 {\n\t\t\tb.WriteString(\", \")\n\t\t}\n\t\tb.WriteString(expr.String())\n\t\ti++\n\t}\n\tb.WriteByte('}')\n\treturn b.String()\n}", "func (q *UniqueQueue) Dump() string {\n\tq.mu.Lock()\n\tdefer q.mu.Unlock()\n\n\td := &dump{\n\t\tClosed: q.doneChanClosed,\n\t\tHead: q.head,\n\t\tTail: q.tail,\n\t\tMaxDepth: q.maxDepth,\n\t\tQueue: make([]string, 0, len(q.queue)),\n\t\tQueuedSet: make(map[string]interface{}, len(q.queuedSet)),\n\t}\n\n\tfor _, entry := range q.queue {\n\t\td.Queue = append(d.Queue, entry.key)\n\t}\n\tfor _, entry := range q.queuedSet {\n\t\td.QueuedSet[entry.key] = entry.val\n\t}\n\n\tout, err := jsonMarshalDumpHook(d)\n\tif err != nil {\n\t\treturn \"\"\n\t}\n\treturn string(out)\n}", "func (s UntagQueueOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "func (o *Predictor) String() string {\n o.Queues = []Addressableentityref{{}} \n \n \n \n \n\n j, _ := json.Marshal(o)\n str, _ := strconv.Unquote(strings.Replace(strconv.Quote(string(j)), `\\\\u`, `\\u`, -1))\n\n return str\n}", "func (rl RoarList) String() string {\n var result string\n for i, r := range roarList.Data() {\n result += fmt.Sprintf(\"[%d]: %v\\n\", i, r)\n }\n return result\n}", "func (sll *SingleLinkedList) String() string {\n\t// Result string\n\tvar s string\n\n\t// First node\n\tn := sll.first\n\n\t// Loop through list\n\tfor {\n\t\t// Empty list\n\t\tif n == nil {\n\t\t\tbreak\n\t\t}\n\n\t\tif s == \"\" {\n\t\t\t// Prints first element\n\t\t\ts = fmt.Sprintf(\"%v\", n.value)\n\t\t} else {\n\t\t\t// Add more elements\n\t\t\ts = fmt.Sprintf(\"%v %v\", s, n.value)\n\t\t}\n\n\t\t// Next node\n\t\tn = n.next\n\t}\n\n\t// Add surrounding brackets\n\treturn fmt.Sprintf(\"[%v]\", s)\n}", "func (s PurgeQueueOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "func (s CreateQueueOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "func (s CreateQueueOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "func (s *Set) String() string {\n\treturn strings.Join(s.Slice(), \",\")\n}", "func (s *Serial) String() string {\n\tvar ss []string\n\tfor _, t := range s.inner {\n\t\tss = append(ss, t.String())\n\t}\n\treturn strings.Join(ss, \"\\n\")\n}", "func (list MyLinkedList) String() string {\n\tvals := []string{}\n\tp := list.head\n\tfor nil != p {\n\t\tvals = append(vals, fmt.Sprintf(\"%d\", p.val))\n\t\tp = p.next\n\t}\n\treturn strings.Join(vals, \", \")\n}", "func (q Quests) String() string {\n\tjc, _ := json.Marshal(q)\n\treturn string(jc)\n}", "func (a *ArrayBytes) String() string {\n\tx := a.a\n\tformattedBytes := make([]string, len(x))\n\tfor i, v := range x {\n\t\tformattedBytes[i] = v.String()\n\t}\n\treturn strings.Join(formattedBytes, \",\")\n}", "func (this *Codec) serialize(root *TreeNode) string {\n\n\tif root == nil {\n\t\treturn \"\"\n\t}\n\n\tqueue := []*TreeNode{root}\n\tc := []string{strconv.Itoa(root.Val)}\n\n\tfor len(queue) > 0 {\n\t\tl := len(queue)\n\t\tfor i := 0; i < l; i++ {\n\t\t\tif queue[i].Left != nil {\n\t\t\t\tqueue = append(queue, queue[i].Left)\n\t\t\t}\n\t\t\tif queue[i].Right != nil {\n\t\t\t\tqueue = append(queue, queue[i].Right)\n\t\t\t}\n\t\t\tadd(&c, queue[i].Left)\n\t\t\tadd(&c, queue[i].Right)\n\t\t}\n\t\tqueue = queue[l:]\n\t}\n\n\tres := strings.Join(c, \",\")\n\treturn res\n}", "func (u KBSet) String() string {\n\treturn fmt.Sprintf(\"%v\", u.kbSlice)\n}", "func (o *Waitlistposition) String() string {\n \n \n \n \n\n j, _ := json.Marshal(o)\n str, _ := strconv.Unquote(strings.Replace(strconv.Quote(string(j)), `\\\\u`, `\\u`, -1))\n\n return str\n}", "func (jArray *A) String() string {\n\treturn _string(jArray)\n}", "func (e Bytes) String() string {\n\treturn fmt.Sprintf(\"%v\", e)\n}", "func (u *Upstreams) String() string {\n\tif u == nil {\n\t\treturn \"<nil>\"\n\t}\n\treturn strings.Join(*u, \", \")\n}", "func (na *NArray) String() string {\n\n\treturn na.Sprint(func(na *NArray, k int) bool {\n\t\treturn true\n\t})\n}", "func (s TagQueueInput) String() string {\n\treturn awsutil.Prettify(s)\n}" ]
[ "0.83679867", "0.7835951", "0.7582512", "0.7550078", "0.73121464", "0.7042873", "0.7040279", "0.7021187", "0.6910233", "0.6807367", "0.66461295", "0.6597686", "0.6595496", "0.6593491", "0.64653754", "0.6444515", "0.64161813", "0.6413585", "0.64094263", "0.63918644", "0.63633037", "0.6360074", "0.6360074", "0.6360074", "0.6360074", "0.6360074", "0.6360074", "0.63229525", "0.6301738", "0.62593853", "0.6218523", "0.621817", "0.62156236", "0.61872137", "0.6162166", "0.61604327", "0.615586", "0.6143194", "0.61210746", "0.61182374", "0.61129004", "0.61110115", "0.60787493", "0.60773295", "0.6063025", "0.6063001", "0.6055922", "0.60506666", "0.60401434", "0.60245734", "0.60203135", "0.60184056", "0.60110235", "0.5997502", "0.5982556", "0.5970695", "0.5961077", "0.59580487", "0.5941576", "0.59294915", "0.59277195", "0.5923768", "0.59155554", "0.5893935", "0.58933765", "0.588733", "0.58849245", "0.58746994", "0.5873186", "0.58581007", "0.5855008", "0.58450353", "0.5844776", "0.5842777", "0.5831784", "0.58205837", "0.58193046", "0.58181864", "0.58139354", "0.58123606", "0.58091843", "0.5806965", "0.58062243", "0.58033943", "0.5802786", "0.5796674", "0.5796674", "0.5789298", "0.5779364", "0.5772599", "0.5770046", "0.57566637", "0.57504934", "0.57491046", "0.57484865", "0.57462674", "0.5730183", "0.57234335", "0.57201076", "0.5707247" ]
0.8594732
0
Begin returns an iterator of the deque with the first position
func (d *Deque[T]) Begin() *DequeIterator[T] { return d.First() }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (q *Deque) Begin() common.Iterator {\n\titr := new(DequeIterator)\n\titr.index = 0\n\titr.direction = FORWARD\n\titr.deque = q\n\treturn itr\n}", "func (iterator *Iterator) Begin() {\n\titerator.iterator.Begin()\n}", "func (this *MultiMap) Begin() KvIterator {\n\treturn this.First()\n}", "func (this *Map) Begin() KvIterator {\n\treturn this.First()\n}", "func (d *Deque[T]) First() *DequeIterator[T] {\n\treturn d.IterAt(0)\n}", "func (t *RbTree[K, V]) Begin() *Node[K, V] {\n\treturn t.First()\n}", "func (q *Deque) Rbegin() common.Iterator {\n\titr := new(DequeIterator)\n\titr.index = q.Size() - 1\n\titr.direction = BACKWARD\n\titr.deque = q\n\treturn itr\n}", "func first(b *ringBuf) iterator {\n\treturn iterator(b.head)\n}", "func (it *Iterator) SeekToFirst() {\n\tit.listIter.SeekToFirst()\n}", "func (w *WaterMark) Begin(index uint64) {\n\tw.lastIndex.Store(index)\n\tw.markCh <- mark{index: index, done: false}\n}", "func (d *Deque[T]) IterAt(pos int) *DequeIterator[T] {\n\treturn &DequeIterator[T]{dq: d, position: pos}\n}", "func (it *Iterator) SeekFirst() {\n\tit.iter.SeekFirst()\n\tit.skipUnwanted()\n}", "func (r *InMemorySourceReader) Begin() {\n\tr.iStack.PushBack(r.i)\n}", "func (rbt *RBTree) RBegin() RBTreeReverseIterator {\n\trbt.init()\n\treturn RBTreeReverseIterator(rbtreeBeginIterator(reverse(rbt)))\n}", "func (un Decoder) Begin(se xml.StartElement) error {\n\t// allow decoding to begin at any element in the token stream,\n\t// as long as we have a non-nil cursor\n\tif un.Node == nil {\n\t\treturn errors.New(\"error decoding YANG data: node cursor is nil\")\n\t}\n\treturn nil\n}", "func (itr *DequeIterator) Next() common.Iterator {\n\tswitch itr.direction {\n\tcase BACKWARD:\n\t\treturn itr.moveToPrev()\n\tcase FORWARD:\n\t\treturn itr.moveToNext()\n\t}\n\n\treturn itr\n}", "func (i *ArrayConcreteIterator) First() {\n i.current_index_ = 0\n}", "func (s *stack) Begin(value *Structure) error {\n\titem := &stackItem{value: value, prev: s.last}\n\ts.last = item\n\treturn nil\n}", "func (s *SkipList) SeekToFirst() Iterator {\n\tif s.length == 0 {\n\t\treturn nil\n\t}\n\n\tcurrent := s.header.next()\n\treturn &iter{\n\t\tcurrent: current,\n\t\tkey: current.key,\n\t\tvalue: current.value,\n\t\tlist: s,\n\t}\n}", "func (e Expr) Begin() uint16 { return e.Pos.Begin }", "func (it *MockIndexTree) Iterator(start, end []byte) Iterator {\n\titer := &ForwardIter{start: start, end: end}\n\tif bytes.Compare(start, end) >= 0 {\n\t\titer.err = io.EOF\n\t\treturn iter\n\t}\n\titer.enumerator, _ = it.bt.Seek(start)\n\titer.Next() //fill key, value, err\n\treturn iter\n}", "func (c *Cursor) First() {\n\tc.pos = c.start\n}", "func (it *Skip_Iterator) SeekToFirst() {\n\tit.list.mu.RLock()\n\tdefer it.list.mu.RUnlock()\n\n\tit.node = it.list.head.getNext(0)\n}", "func (v *Value) Begin() *Value {\n\tcVal := C.zj_Begin(v.V)\n\tif cVal == nil {\n\t\treturn nil\n\t}\n\tval := Value{V: cVal}\n\treturn &val\n}", "func (iter *radixIterator) First() {\n\tresIter, err := iter.miTxn.Get(nil)\n\tif err != nil {\n\t\titer.err = err\n\t\treturn\n\t}\n\titer.resIter = resIter\n\titer.isReverser = false\n\titer.Next()\n}", "func (root *mTreap) start(mask, match treapIterType) treapIter {\n\tf := treapFilter(mask, match)\n\treturn treapIter{f, root.treap.findMinimal(f)}\n}", "func (iter *SliceIterator) Prev() iterator.ConstBidIterator {\n\tif iter.position >= 0 {\n\t\titer.position--\n\t}\n\treturn iter\n}", "func (iter *SliceIterator) Next() iterator.ConstIterator {\n\tif iter.position < iter.s.Len() {\n\t\titer.position++\n\t}\n\treturn iter\n}", "func (hm HashMap) StartIter() (iter hashMapIter) {\n\titer = hashMapIter{&hm, 0, hm.data[0].Front()}\n\titer.findNext()\n\treturn\n}", "func (t *RbTree[K, V]) IterFirst() *RbTreeIterator[K, V] {\n\treturn NewIterator(t.First())\n}", "func (f *Footer) StartIterator(startKeyIncl, endKeyExcl []byte,\n\titeratorOptions IteratorOptions) (Iterator, error) {\n\t_, ss := f.segmentLocs()\n\tif ss == nil {\n\t\tf.DecRef()\n\t\treturn nil, nil\n\t}\n\n\titer, err := ss.StartIterator(startKeyIncl, endKeyExcl, iteratorOptions)\n\tif err != nil || iter == nil {\n\t\tf.DecRef()\n\t\treturn nil, err\n\t}\n\n\tinitCloser, ok := iter.(InitCloser)\n\tif !ok || initCloser == nil {\n\t\titer.Close()\n\t\tf.DecRef()\n\t\treturn nil, ErrUnexpected\n\t}\n\n\terr = initCloser.InitCloser(f)\n\tif err != nil {\n\t\titer.Close()\n\t\tf.DecRef()\n\t\treturn nil, err\n\t}\n\n\treturn iter, nil\n}", "func (d *Deque[T]) Front() T {\n\treturn d.firstSegment().front()\n}", "func (db *TriasDB) Iterator(start, end []byte) Iterator {\n\treturn db.MakeIterator(start, end, false)\n}", "func (this *MultiMap) First() KvIterator {\n\treturn &MapIterator{node: this.tree.First()}\n}", "func (c *index) SeekFirst(r kv.Retriever) (iter table.IndexIterator, err error) {\n\tupperBound := c.prefix.PrefixNext()\n\tit, err := r.Iter(c.prefix, upperBound)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &indexIter{it: it, idx: c, prefix: c.prefix}, nil\n}", "func (mcq *MyCircularQueue) Front() int {\n\tif mcq.length == 0 {\n\t\treturn -1\n\t}\n\treturn mcq.dummyHead.Next.Val\n}", "func (t *RbTree[K, V]) RBegin() *Node[K, V] {\n\treturn t.Last()\n}", "func (this ActivityStreamsImageProperty) Begin() vocab.ActivityStreamsImagePropertyIterator {\n\tif this.Empty() {\n\t\treturn nil\n\t} else {\n\t\treturn this.properties[0]\n\t}\n}", "func (tx *dbTxn) Iterator(start, end []byte) (db.Iterator, error) {\n\tif tx.btree == nil {\n\t\treturn nil, db.ErrTransactionClosed\n\t}\n\tif (start != nil && len(start) == 0) || (end != nil && len(end) == 0) {\n\t\treturn nil, db.ErrKeyEmpty\n\t}\n\treturn newMemDBIterator(tx, start, end, false), nil\n}", "func (this *MyCircularQueue) Front() int {\n if this.IsEmpty() {\n return -1\n }\n return this.Items[this.HeadIndex]\n}", "func (this *Map) First() KvIterator {\n\treturn &MapIterator{node: this.tree.First()}\n}", "func (iter *SkipListIterator) First() {\n\tif iter.cursor != nil {\n\t\tC.skiplist_release_node(iter.cursor)\n\t}\n\titer.cursor = C.skiplist_begin(iter.sl.csl)\n}", "func (w *Window) Iterator(offset int, count int) Iterator {\n\treturn Iterator{\n\t\tcount: count,\n\t\tcur: &w.window[offset],\n\t}\n}", "func (i *ImageBuf) XBegin() int {\n\tret := int(C.ImageBuf_xbegin(i.ptr))\n\truntime.KeepAlive(i)\n\treturn ret\n}", "func (this *MyCircularDeque) GetFront() int {\n if this.IsEmpty() {\n return -1\n }\n return this.data[this.head]\n}", "func LexBegin(lexer *goblex.Lexer) goblex.LexFn {\n\n\tif lexer.CaptureUntil(true, atSymbol) {\n\t\tlexer.SkipCurrentToken(true)\n\t\treturn lexAtSymbol\n\t}\n\n\treturn nil\n}", "func (tl *TransactionList) Begin() {\n\ttmp := Transaction{\n\t\tstorage: make(map[string]string),\n\t\tdeleted: make(map[string]empty),\n\t\tnext: tl.head,\n\t}\n\n\ttl.head = &tmp\n}", "func (q *Deque) End() common.Iterator {\n\treturn q.endItr\n}", "func (c *QData) Begin() *QData {\n\tnewc := c.clone()\n\ttx, err := newc.db.Begin()\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\tnewc.tx = tx\n\tnewc.preparedStmt = &sync.Map{}\n\n\treturn newc\n}", "func (d *DB) Iterator(start Bytes, end Bytes) (ret *Iterator) {\n\tif len(start) == 0 {\n\t\tstart = nil\n\t}\n\tif len(end) == 0 {\n\t\tend = nil\n\t}\n\tvar iopt opt.ReadOptions\n\tiopt.DontFillCache = true\n\tit := d.db.NewIterator(&util.Range{Start: start, Limit: end}, &iopt)\n\treturn NewIterator(it, FORWARD)\n}", "func StartFromBeginningFilter() Filter {\n\treturn Param(\"fromEarliest\", \"true\")\n}", "func nextStart(p *xml.Decoder) (elem xml.StartElement, err error) {\n\tfor {\n\t\tvar t xml.Token\n\t\tt, err = p.Token()\n\t\tif err != nil {\n\t\t\treturn\n\t\t}\n\t\tswitch t := t.(type) {\n\t\tcase xml.StartElement:\n\t\t\telem = t\n\t\t\treturn\n\t\t}\n\t}\n\tpanic(\"unreachable\")\n}", "func (r *Record) Start() int {\n\treturn r.Pos\n}", "func (iter *radixIterator) Seek(key []byte) {\n\tresIter, err := iter.miTxn.LowerBound(key)\n\tif err != nil {\n\t\titer.err = err\n\t\treturn\n\t}\n\titer.resIter = resIter\n\titer.isReverser = false\n\titer.Next()\n}", "func (mci *XMCacheIterator) First() bool {\n\tif mci.err != nil {\n\t\treturn false\n\t} else if mci.dir == dirReleased {\n\t\tmci.err = iterator.ErrIterReleased\n\t\treturn false\n\t}\n\tif mci.setMciKeys(0, setTypeFirst) && mci.setMciKeys(1, setTypeFirst) && mci.setMciKeys(2, setTypeFirst) {\n\t\tmci.dir = dirSOI\n\t\treturn mci.next()\n\t}\n\treturn false\n}", "func (iterator *Iterator) First() bool {\n\treturn iterator.iterator.First()\n}", "func (db *MemoryCache) NewIteratorWithStart(start []byte) Iterator {\n\tdb.lock.RLock()\n\tdefer db.lock.RUnlock()\n\n\tvar (\n\t\tst = string(start)\n\t\tkeys = make([]string, 0, len(db.db))\n\t\tvalues = make([][]byte, 0, len(db.db))\n\t)\n\t// Collect the keys from the memory database corresponding to the given start\n\tfor key := range db.db {\n\t\tif key >= st {\n\t\t\tkeys = append(keys, key)\n\t\t}\n\t}\n\t// Sort the items and retrieve the associated values\n\tsort.Strings(keys)\n\tfor _, key := range keys {\n\t\tvalues = append(values, db.db[key])\n\t}\n\treturn &iterator{\n\t\tkeys: keys,\n\t\tvalues: values,\n\t}\n}", "func (this *MyCircularDeque) GetFront() int {\n\tif this.IsEmpty() {\n\t\treturn -1\n\t}\n\treturn this.First.Next.Data\n}", "func (i *Iterator) First() bool {\n\treturn i.i.First()\n}", "func (c *Conn) begin(packet []byte) (data []byte) {\n\tdata = packet\n\tif len(c.in) > 0 {\n\t\tc.in = append(c.in, data...)\n\t\tdata = c.in\n\t}\n\treturn data\n}", "func (s *Set) Iterator() Iterator {\n\treturn s.skiplist.Iterator()\n}", "func nextStart(p *xml.Decoder) (xml.StartElement, error) {\n\tfor {\n\t\tt, err := p.Token()\n\t\tif err == io.EOF {\n\t\t\treturn xml.StartElement{}, nil\n\t\t}\n\t\tif err != nil {\n\t\t\treturn xml.StartElement{}, fmt.Errorf(\"nextStart %s\", err)\n\t\t}\n\t\tswitch t := t.(type) {\n\t\tcase xml.StartElement:\n\t\t\treturn t, nil\n\t\t}\n\t}\n\tpanic(\"unreachable\")\n}", "func (it *Iterator) Prev() {\n\tit.listIter.Prev()\n}", "func (iter *RbTreeIterator) Next() iterator.ConstIterator {\n\tif iter.IsValid() {\n\t\titer.node = iter.node.Next()\n\t}\n\treturn iter\n}", "func (w *WaterMark) BeginMany(indices []uint64) {\n\tw.lastIndex.Store(indices[len(indices)-1])\n\tw.markCh <- mark{index: 0, indices: indices, done: false}\n}", "func (q *ItemQueue) Front() *Item {\n\tq.lock.RLock()\n\tdefer q.lock.RUnlock()\n\titem := q.items[0]\n\treturn &item\n}", "func (s *Scatter) Begin(src, dest *Vec, add, forward bool) error {\n\tvar iora C.InsertMode = C.INSERT_VALUES\n\tif add {\n\t\tiora = C.ADD_VALUES\n\t}\n\tvar mode C.ScatterMode = C.SCATTER_FORWARD\n\tif !forward {\n\t\tmode = C.SCATTER_REVERSE\n\t}\n\tperr := C.VecScatterBegin(s.s, src.v, dest.v, iora, mode)\n\tif perr != 0 {\n\t\treturn errors.New(\"Error starting scatter\")\n\t}\n\treturn nil\n}", "func (is *InputStream) Begin(packet []byte) (data []byte) {\n\tdata = packet\n\tif len(is.b) > 0 {\n\t\tis.b = append(is.b, data...)\n\t\tdata = is.b\n\t}\n\treturn data\n}", "func (is *InputStream) Begin(packet []byte) (data []byte) {\n\tdata = packet\n\tif len(is.b) > 0 {\n\t\tis.b = append(is.b, data...)\n\t\tdata = is.b\n\t}\n\treturn data\n}", "func (this *MyCircularQueue) Front() int {\n\tif this.IsEmpty() {\n\t\treturn -1\n\t}\n\treturn this.items[this.front]\n}", "func (i *LevelIterator) First() *FileMetadata {\n\tif i.empty() {\n\t\treturn nil\n\t}\n\tif i.start != nil {\n\t\ti.iter = i.start.clone()\n\t} else {\n\t\ti.iter.first()\n\t}\n\tif !i.iter.valid() {\n\t\treturn nil\n\t}\n\treturn i.skipFilteredForward(i.iter.cur())\n}", "func (op *ListSharedAccessOp) StartPosition(val int) *ListSharedAccessOp {\n\tif op != nil {\n\t\top.QueryOpts.Set(\"start_position\", fmt.Sprintf(\"%d\", val))\n\t}\n\treturn op\n}", "func (is *InputStream) Begin(packet []byte) (data []byte) {\n\tif len(is.b) > 0 {\n\t\tis.b = append(is.b, packet...)\n\t\tdata = is.b\n\t} else {\n\t\tdata = packet\n\t}\n\n\treturn data\n}", "func (d *Deque[T]) PushFront(value T) {\n\td.firstAvailableSegment().pushFront(value)\n\td.size++\n\tif d.segUsed() >= len(d.segs) {\n\t\td.expand()\n\t}\n}", "func (o *ordering) front() *entry {\n\te := o.ordered[0]\n\tif e.prev != nil {\n\t\tlog.Panicf(\"unexpected first entry: %v\", e)\n\t}\n\t// The first entry is always a logical position, which should not be indexed.\n\te, _ = e.nextIndexed()\n\treturn e\n}", "func (dq *Dqueue) Front() (value interface{}, ok bool) {\n\tvalue, ok = dq.dqueue.Get(0)\n\treturn\n}", "func (it *Iterator) Seek(bs []byte) {\n\titm := it.snap.db.newItem(bs, false)\n\tit.iter.Seek(unsafe.Pointer(itm))\n\tit.skipUnwanted()\n}", "func (c *Connection) nextStart() (xml.StartElement, error) {\n\tfor {\n\t\tt, err := c.decoder.Token()\n\t\tif err != nil || t == nil {\n\t\t\treturn xml.StartElement{}, err\n\t\t}\n\t\tswitch t := t.(type) {\n\t\tcase xml.StartElement:\n\t\t\treturn t, nil\n\t\t}\n\t}\n}", "func (d *Deque) Front() (*interface{}, bool) {\n\tif d.Empty() {\n\t\treturn nil, false\n\t}\n\treturn &d.front.data, true\n}", "func First(i frameless.Iterator, e frameless.Entity) (err error) {\n\n\tdefer func() {\n\t\tcErr := i.Close()\n\n\t\tif err == nil && cErr != nil {\n\t\t\terr = cErr\n\t\t}\n\t}()\n\n\tif !i.Next() {\n\t\treturn ErrNoNextElement\n\t}\n\n\tif err := i.Decode(e); err != nil {\n\t\treturn err\n\t}\n\n\treturn i.Err()\n}", "func (k *KVAdapter) NewIterator(prefix, start []byte) ethdb.Iterator {\n\tit := &iterator{\n\t\tnext: make(chan struct{}),\n\t\titems: make(chan keyvalue, 1),\n\t\terrCh: make(chan error, 1),\n\t}\n\tinited := false\n\tgo func() {\n\t\t_, ok := <-it.next\n\t\tif !ok {\n\t\t\treturn\n\t\t}\n\t\tit.errCh <- k.kv.IterateSorted(kv.Key(prefix), func(key kv.Key, value []byte) bool {\n\t\t\tif start != nil && !inited && key < kv.Key(prefix)+kv.Key(start) {\n\t\t\t\treturn true\n\t\t\t}\n\t\t\tinited = true\n\t\t\tit.items <- keyvalue{key: []byte(key), value: value}\n\t\t\t_, ok := <-it.next\n\t\t\treturn ok\n\t\t})\n\t\tclose(it.items)\n\t}()\n\treturn it\n}", "func (s *StringQueue) Front() *string {\n\ts.lock.RLock()\n\titem := s.items[0]\n\ts.lock.RUnlock()\n\treturn &item\n}", "func (this *MyCircularDeque1) GetFront() int {\n\treturn this.head.Next.Val\n}", "func (this *MyCircularDeque) GetFront() int {\n\tif this.IsEmpty() {\n\t\treturn -1\n\t}\n\n\tthis.mutex.RLock()\n\tdefer this.mutex.RUnlock()\n\treturn this.data[this.front]\n\n}", "func (list *SkipList) Front() *Element {\n\treturn list.next[0]\n}", "func (d *MyCircularDeque) InsertFront(value int) bool {\n\treturn d.Insert(value, 0)\n}", "func (this *MyCircularQueue) Front() int {\n\tif this.Count == 0 {\n\t\treturn -1\n\t}\n\treturn this.Queue[this.Head]\n}", "func (q *wantConnQueue) peekFront() *wantConn {\n\tif q.headPos < len(q.head) {\n\t\treturn q.head[q.headPos]\n\t}\n\tif len(q.tail) > 0 {\n\t\treturn q.tail[0]\n\t}\n\treturn nil\n}", "func (db *FlatDatabase) NewIterator(prefix []byte, start []byte) *FlatIterator {\n\tdb.lock.Lock()\n\tdefer db.lock.Unlock()\n\n\tif db.iterating {\n\t\treturn nil\n\t}\n\tdb.iterating = true\n\tdb.data.Seek(0, 0)\n\tdb.index.Seek(0, 0)\n\tdb.offset = 0\n\tdb.buff = db.buff[:0]\n\treturn &FlatIterator{db: db}\n}", "func (e *Engine) MustBegin(writable bool) tsdb.Tx {\n\ttx, err := e.Begin(writable)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn tx\n}", "func (q Query) Prepend(item Record) Query {\n\treturn Query{\n\t\tIterate: func() Iterator {\n\t\t\tnext := q.Iterate()\n\t\t\tprepended := false\n\n\t\t\treturn func(ctx Context) (Record, error) {\n\t\t\t\tif prepended {\n\t\t\t\t\treturn next(ctx)\n\t\t\t\t}\n\n\t\t\t\tprepended = true\n\t\t\t\treturn item, nil\n\t\t\t}\n\t\t},\n\t}\n}", "func (s *ItemQueue) Front() *Item {\n\ts.lock.RLock()\n\tdefer s.lock.RUnlock()\n\titem := s.items[0]\n\treturn &item\n}", "func (d *MyCircularDeque) GetFront() int {\n\tif d.IsEmpty() {\n\t\treturn -1\n\t}\n\treturn d.Val[0]\n}", "func (i *ImageBuf) ZBegin() int {\n\tret := int(C.ImageBuf_zbegin(i.ptr))\n\truntime.KeepAlive(i)\n\treturn ret\n}", "func (i *Iterator) Seek(key []byte) {\n\tif len(i.prefix) > 0 {\n\t\tif bytes.Compare(key, i.prefix) < 0 {\n\t\t\ti.iterator.Seek(i.prefix)\n\t\t\treturn\n\t\t}\n\t} else if len(i.start) > 0 {\n\t\tif bytes.Compare(key, i.start) < 0 {\n\t\t\ti.iterator.Seek(i.start)\n\t\t\treturn\n\t\t}\n\t}\n\n\ti.iterator.Seek(key)\n}", "func (it *CursorIterator) Next() (*firestorepb.Cursor, error) {\n\tvar item *firestorepb.Cursor\n\tif err := it.nextFunc(); err != nil {\n\t\treturn item, err\n\t}\n\titem = it.items[0]\n\tit.items = it.items[1:]\n\treturn item, nil\n}", "func (q *queue) Front() (interface{}, error) {\n\tif q.Empty() {\n\t\treturn nil, errors.New(\"error: can not get element from empty queue\")\n\t}\n\treturn q.items[q.head].Data, nil\n}", "func (it *emptyIterator) Seek(t int64) chunkenc.ValueType { return chunkenc.ValNone }", "func (t *Tailer) StartFromBeginning() error {\n\treturn t.Start(0, io.SeekStart)\n}", "func (me *XsdGoPkgHasElems_Begin) Walk() (err error) {\r\n\tif fn := WalkHandlers.XsdGoPkgHasElems_Begin; me != nil {\r\n\t\tif fn != nil {\r\n\t\t\tif err = fn(me, true); xsdt.OnWalkError(&err, &WalkErrors, WalkContinueOnError, WalkOnError) {\r\n\t\t\t\treturn\r\n\t\t\t}\r\n\t\t}\r\n\t\tif fn != nil {\r\n\t\t\tif err = fn(me, false); xsdt.OnWalkError(&err, &WalkErrors, WalkContinueOnError, WalkOnError) {\r\n\t\t\t\treturn\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\treturn\r\n}" ]
[ "0.82398665", "0.74092484", "0.7073113", "0.7048321", "0.67305326", "0.64770746", "0.6436968", "0.6338629", "0.6207571", "0.61709076", "0.6150435", "0.61480105", "0.6075069", "0.602914", "0.6015714", "0.6007998", "0.60071397", "0.60050714", "0.5990212", "0.592349", "0.58640736", "0.58219856", "0.57988924", "0.57588834", "0.5728899", "0.57245797", "0.5679454", "0.5662097", "0.56408155", "0.5616863", "0.5570075", "0.5558978", "0.5543379", "0.5539371", "0.5530397", "0.5520475", "0.55009305", "0.54889065", "0.5475997", "0.5468134", "0.5442505", "0.5439879", "0.5435696", "0.5435695", "0.54145354", "0.54108644", "0.5407578", "0.539826", "0.5393176", "0.5393036", "0.5353028", "0.5347195", "0.5338258", "0.5280285", "0.5269163", "0.5268333", "0.526285", "0.5256711", "0.52488655", "0.5232058", "0.5223452", "0.52209336", "0.52189326", "0.52102727", "0.5209536", "0.51972264", "0.51880985", "0.5187367", "0.5187367", "0.51871616", "0.5183751", "0.5171897", "0.5168136", "0.5167842", "0.51673937", "0.51643276", "0.5162004", "0.51585037", "0.5148361", "0.51473004", "0.51434475", "0.5136018", "0.5133461", "0.5132786", "0.5124951", "0.512089", "0.5118761", "0.51165503", "0.5106611", "0.5103724", "0.5100252", "0.50996745", "0.5093058", "0.5091785", "0.5076414", "0.50717026", "0.5071257", "0.5062941", "0.5060619", "0.50518453" ]
0.82144165
1
End returns an iterator of the deque with the position d.Size()
func (d *Deque[T]) End() *DequeIterator[T] { return d.IterAt(d.Size()) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (q *Deque) End() common.Iterator {\n\treturn q.endItr\n}", "func (d *Deque[T]) Last() *DequeIterator[T] {\n\treturn d.IterAt(d.Size() - 1)\n}", "func (q *Deque) Rend() common.Iterator {\n\treturn q.endItr\n}", "func (iterator *Iterator) End() {\n\titerator.iterator.End()\n}", "func (itr *DequeIterator) Next() common.Iterator {\n\tswitch itr.direction {\n\tcase BACKWARD:\n\t\treturn itr.moveToPrev()\n\tcase FORWARD:\n\t\treturn itr.moveToNext()\n\t}\n\n\treturn itr\n}", "func (q *Deque) Rbegin() common.Iterator {\n\titr := new(DequeIterator)\n\titr.index = q.Size() - 1\n\titr.direction = BACKWARD\n\titr.deque = q\n\treturn itr\n}", "func (r Range) End() int64 {\n\treturn r.Pos + r.Size\n}", "func (e *ObservableEditableBuffer) End() OffsetTuple {\n\treturn e.f.End()\n}", "func (d *Deque) size() int {\n\treturn d.count\n}", "func (d *Deque[T]) Begin() *DequeIterator[T] {\n\treturn d.First()\n}", "func (d *Deque[T]) IterAt(pos int) *DequeIterator[T] {\n\treturn &DequeIterator[T]{dq: d, position: pos}\n}", "func (*inMemoryAllocator) End() int64 {\n\t// It doesn't matter.\n\treturn 0\n}", "func (c Chain) End() *big.Int {\n\treturn c[len(c)-1]\n}", "func (d *Deque[T]) Size() int {\n\treturn d.size\n}", "func (f *Field) End() int64", "func (q *Deque) Size() int {\n\treturn q.size\n}", "func (it *Iterator) SeekToLast() {\n\tit.listIter.SeekToLast()\n}", "func (Q *Deque) Size() int {\n\treturn Q.size\n}", "func (r *Record) End() int {\n\tif r.Flags&Unmapped != 0 || len(r.Cigar) == 0 {\n\t\treturn r.Pos + 1\n\t}\n\tpos := r.Pos\n\tend := pos\n\tfor _, co := range r.Cigar {\n\t\tpos += co.Len() * co.Type().Consumes().Reference\n\t\tend = max(end, pos)\n\t}\n\treturn end\n}", "func (e Expr) End() uint16 { return e.Pos.End }", "func (d *Deque) Size() int {\n\tif d == nil {\n\t\treturn 0\n\t}\n\treturn d.size\n}", "func (s *Series) End() int64 {\n\tif s.Len() == 0 {\n\t\treturn -1\n\t}\n\treturn s.Start() + int64(s.Step()*(s.Len()-1))\n}", "func (sl *Slice) ElemFromEnd(idx int) Ki {\n\treturn (*sl)[len(*sl)-1-idx]\n}", "func (r Range) End() uint64 {\n\treturn r.Offset + r.Length\n}", "func (r *baseNsRange) End() int { return r.end }", "func (p Partition) end() PartitionDimension {\n\tif p.Size == 0 {\n\t\t// a size of 0 means \"fill available\", just return the start as the end for those.\n\t\treturn p.Start\n\t}\n\treturn p.Start + p.Size - 1\n}", "func (s *ForStmt) End() source.Pos {\n\treturn s.Body.End()\n}", "func (i *Iterator) Last() bool {\n\treturn i.i.Last()\n}", "func (t *RbTree[K, V]) IterLast() *RbTreeIterator[K, V] {\n\treturn NewIterator(t.Last())\n}", "func (un Decoder) End(err error) error {\n\tif err == io.EOF {\n\t\tif un.Node.Parent() == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn io.ErrUnexpectedEOF\n\t}\n\treturn err\n}", "func (root *mTreap) end(mask, match treapIterType) treapIter {\n\tf := treapFilter(mask, match)\n\treturn treapIter{f, root.treap.findMaximal(f)}\n}", "func (d *Dropping) Size() int {\n\treturn d.next\n}", "func (d *Deque) Length() uint {\n\treturn d.length\n}", "func (n *IdentList) End() source.Pos {\n\tif n.RParen.IsValid() {\n\t\treturn n.RParen + 1\n\t}\n\n\tif l := len(n.List); l > 0 {\n\t\treturn n.List[l-1].End()\n\t}\n\n\treturn source.NoPos\n}", "func (d *Deque) Size() int {\n\tif d.IsEmpty() {\n\t\treturn 0\n\t}\n\tsize := 0\n\tif d.head != nil {\n\t\tsize++\n\t}\n\tif d.tail != nil {\n\t\tsize++\n\t}\n\tif d.child != nil {\n\t\tsize += d.child.Size()\n\t}\n\treturn size\n}", "func (cll *CircularLinkedList) DeleteEnd() int {\n\tif !(cll.CheckIfEmpty()) {\n\t\thead := cll.Start\n\t\tdeletedEle := head.Data\n\t\tif cll.Len == 1 {\n\t\t\t// delete from beginning\n\t\t\tdeletedEle = cll.DeleteBeginning()\n\t\t\treturn deletedEle\n\t\t}\n\t\t//traverse till end\n\t\tfor {\n\t\t\tif head.Next.Next == cll.Start {\n\t\t\t\tdeletedEle = head.Next.Data\n\t\t\t\tbreak\n\t\t\t}\n\t\t\thead = head.Next\n\t\t}\n\t\t// update last element's next pointer\n\t\thead.Next = cll.Start\n\t\tcll.Len--\n\t\treturn deletedEle\n\t}\n\treturn -1\n}", "func (cur *cursor) invalidateAtEnd() {\n\tcur.idx = int(cur.nd.count)\n}", "func (q *Deque) Begin() common.Iterator {\n\titr := new(DequeIterator)\n\titr.index = 0\n\titr.direction = FORWARD\n\titr.deque = q\n\treturn itr\n}", "func (tm *Term) End() error {\n\ttm.RowOff = 0\n\ttm.RowSt = tm.MaxRows - tm.RowsPer\n\treturn tm.Draw()\n}", "func (iterator *Iterator) Last() bool {\n\treturn iterator.iterator.Last()\n}", "func (it *KeyAccess_Iterator) SeekToLast() {\n\tit.list.mu.RLock()\n\tdefer it.list.mu.RUnlock()\n\n\tit.node = it.list.findlast()\n\tif it.node == it.list.head {\n\t\tit.node = nil\n\t}\n}", "func (s *SkipList) SeekToLast() Iterator {\n\tcurrent := s.footer\n\tif current == nil {\n\t\treturn nil\n\t}\n\n\treturn &iter{\n\t\tcurrent: current,\n\t\tkey: current.key,\n\t\tvalue: current.value,\n\t\tlist: s,\n\t}\n}", "func (iter *SliceIterator) Next() iterator.ConstIterator {\n\tif iter.position < iter.s.Len() {\n\t\titer.position++\n\t}\n\treturn iter\n}", "func (fm *FieldModelOrder) GetEnd(fbeBegin int) {\n fm.buffer.Unshift(fbeBegin)\n}", "func (i *ImageBuf) ZEnd() int {\n\tret := int(C.ImageBuf_zend(i.ptr))\n\truntime.KeepAlive(i)\n\treturn ret\n}", "func (s *Stream) ListEnd() error {\n\tif len(s.stack) == 0 {\n\t\treturn errNotInList\n\t}\n\ttos := s.stack[len(s.stack)-1]\n\tif tos.pos != tos.size {\n\t\treturn errNotAtEOL\n\t}\n\ts.stack = s.stack[:len(s.stack)-1] // pop out information from the stack\n\tif len(s.stack) > 0 {\n\t\ts.stack[len(s.stack)-1].pos += tos.size\n\t}\n\ts.kind = -1\n\ts.size = 0\n\treturn nil\n}", "func last(b *ringBuf) iterator {\n\treturn iterator((b.head + b.len - 1) % len(b.buf))\n}", "func (bs buckets) End() time.Time {\n\tif len(bs) == 0 {\n\t\treturn time.Time{}\n\t}\n\treturn bs[len(bs)-1].End\n}", "func (o TableRangePartitioningRangePtrOutput) End() pulumi.IntPtrOutput {\n\treturn o.ApplyT(func(v *TableRangePartitioningRange) *int {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn &v.End\n\t}).(pulumi.IntPtrOutput)\n}", "func (this *Map) Last() KvIterator {\n\treturn &MapIterator{node: this.tree.Last()}\n}", "func (gb *GeneratorBuilder) End(end int) *GeneratorBuilder {\n\tgb.end = end\n\treturn gb\n}", "func (e *Enumerator) Next() (k []byte, v []byte, err error) {\n\tif err = e.err; err != nil {\n\t\treturn\n\t}\n\tif e.ver != e.t.ver {\n\t\tf, hit := e.t.Seek(e.k)\n\t\tif !e.hit && hit {\n\t\t\tif err = f.next(); err != nil {\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t\t*e = *f\n\t\tf.Close()\n\t}\n\tif e.q == nil {\n\t\te.err, err = io.EOF, io.EOF\n\t\treturn\n\t}\n\tif e.i >= e.q.c {\n\t\tif err = e.next(); err != nil {\n\t\t\treturn\n\t\t}\n\t}\n\ti := e.q.d[e.i]\n\tk, v = i.k, i.v\n\te.k, e.hit = k, false\n\te.next()\n\treturn\n}", "func (d *Deque) Size() int {\n\tif d.rightIdx > d.leftIdx {\n\t\treturn (d.rightIdx-d.leftIdx)*blockSize - d.leftOff + d.rightOff\n\t} else if d.rightIdx < d.leftIdx {\n\t\treturn (len(d.blocks)-d.leftIdx+d.rightIdx)*blockSize - d.leftOff + d.rightOff\n\t} else {\n\t\treturn d.rightOff - d.leftOff\n\t}\n}", "func (r MemRegion) End() uint64 {\n\treturn r.base + r.size\n}", "func (this *MultiMap) Last() KvIterator {\n\treturn &MapIterator{node: this.tree.Last()}\n}", "func (iter *radixIterator) Last() {\n\tresIter, err := iter.miTxn.GetReverse(nil)\n\tif err != nil {\n\t\titer.err = err\n\t\treturn\n\t}\n\titer.resIter = resIter\n\titer.isReverser = true\n\titer.Prev()\n}", "func (q *Queue) Tail() uint64 { return q.tail }", "func (b *Buffer) End() Loc {\n\treturn Loc{utf8.RuneCount(b.lines[b.NumLines-1].data), b.NumLines - 1}\n}", "func (this *MyCircularDeque) DeleteLast() bool {\n\tif this.IsEmpty() {\n\t\treturn false\n\t}\n\tthis.end = (len(this.data) + this.end - 1) % len(this.data)\n\treturn true\n}", "func (p Partition) End() uint32 {\n\treturn p.Start + p.Length() - 1\n}", "func (pb *PageBuffer) End() bool {\n return pb.is_end\n}", "func (l *List) End() bool {\n\treturn l.next == nil\n}", "func (this *TrieNode) GetEnd() bool {\n\treturn this.isEnd\n}", "func (ll *Doubly[T]) DelAtEnd() (T, bool) {\n\t// no item\n\tif ll.Head.Prev == nil {\n\t\tvar r T\n\t\treturn r, false\n\t}\n\n\tn := ll.Head.Prev\n\tval := n.Val\n\tll.Remove(n)\n\treturn val, true\n}", "func (w *Writer) End()", "func (f genHelperDecoder) DecReadArrayEnd() { f.d.arrayEnd() }", "func (c *ReadgroupsetsCoveragebucketsListCall) End(end int64) *ReadgroupsetsCoveragebucketsListCall {\n\tc.urlParams_.Set(\"end\", fmt.Sprint(end))\n\treturn c\n}", "func (it *emptyIterator) Next() chunkenc.ValueType { return chunkenc.ValNone }", "func (e StartElement) End() EndElement {\n\treturn EndElement{e.Name}\n}", "func (b *Vector) EndVector(vectorNumElems int) VField {\n\t// we already made space for this, so write without PrependUint32\n\tb.placeUOffsetT(UOffsetT(vectorNumElems))\n\tb.nested = false\n\treturn b\n}", "func (cur *cursor) hasNext() bool {\n\treturn cur.idx < int(cur.nd.count)-1\n}", "func (i *LevelIterator) Last() *FileMetadata {\n\tif i.empty() {\n\t\treturn nil\n\t}\n\tif i.end != nil {\n\t\ti.iter = i.end.clone()\n\t} else {\n\t\ti.iter.last()\n\t}\n\tif !i.iter.valid() {\n\t\treturn nil\n\t}\n\treturn i.skipFilteredBackward(i.iter.cur())\n}", "func (f *Flex) End(dims Dimens) FlexChild {\n\tif f.mode <= modeBegun {\n\t\tpanic(\"End called without an active child\")\n\t}\n\tf.macro.Stop()\n\tsz := axisMain(f.Axis, dims.Size)\n\tf.size += sz\n\tif f.mode == modeRigid {\n\t\tf.rigidSize += sz\n\t}\n\tf.mode = modeBegun\n\tif c := axisCross(f.Axis, dims.Size); c > f.maxCross {\n\t\tf.maxCross = c\n\t}\n\tif b := dims.Baseline; b > f.maxBaseline {\n\t\tf.maxBaseline = b\n\t}\n\treturn FlexChild{f.macro, dims}\n}", "func (q *Queue) Dequeue() interface{} {\n\tif q.length == 0 {\n\t\treturn nil\n\t}\n\tn := q.start\n\tif q.length == 1 {\n\t\tq.start = nil\n\t\tq.end = nil\n\t} else {\n\t\tq.start = q.start.next\n\t}\n\tq.length--\n\treturn n.value\n}", "func (q *Queue) Dequeue() interface{} {\n\tvar first, last, firstnext *queueitem\n\tfor {\n\t\tfirst = loadqitem(&q.head)\n\t\tlast = loadqitem(&q.tail)\n\t\tfirstnext = loadqitem(&first.next)\n\t\tif first == loadqitem(&q.head) { // are head, tail and next consistent?\n\t\t\tif first == last { // is queue empty?\n\t\t\t\tif firstnext == nil { // queue is empty, couldn't dequeue\n\t\t\t\t\treturn nil\n\t\t\t\t}\n\t\t\t\tcasqitem(&q.tail, last, firstnext) // tail is falling behind, try to advance it\n\t\t\t} else { // read value before cas, otherwise another dequeue might free the next node\n\t\t\t\tv := firstnext.v\n\t\t\t\tif casqitem(&q.head, first, firstnext) { // try to swing head to the next node\n\t\t\t\t\tatomic.AddUint64(&q.len, ^uint64(0))\n\t\t\t\t\treturn v // queue was not empty and dequeue finished.\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}", "func (s *ExportStmt) End() source.Pos {\n\treturn s.Result.End()\n}", "func (dq *Dqueue) Size() int {\n\treturn dq.dqueue.Size()\n}", "func (q *Queue) Dequeue() interface{} {\n\tif q.length == 0 {\n\t\treturn nil\n\t}\n\n\tn := q.start\n\tif q.length != 1 {\n\t\tq.start = q.start.next\n\t} else {\n\t\tq.start = nil\n\t\tq.end = nil\n\t}\n\n\tq.length--\n\treturn n.value\n}", "func (D DiskIterator) Next() (string, error) {\n\n\tof, ind := D.readHeader()\n\tif of < 0 || ind > D.recordInx || ind < 0 {\n\t\treturn \"\", errors.New(\"errore nella lettura del heder\")\n\t}\n\tlen := D.actualOfset - of\n\tD.actualOfset = of\n\tD.recordInx = ind\n\tcnt, err := D.readN(int(len))\n\tif err != nil {\n\t\treturn \"\", errors.New(\"errore nella lettura del record\")\n\t}\n\n\treturn string(cnt), nil\n}", "func (cur *cursor) atNodeEnd() bool {\n\tlastKeyIdx := int(cur.nd.count) - 1\n\treturn cur.idx == lastKeyIdx\n}", "func (self *TextIter) IsEnd() bool {\n\tb := C.gtk_text_iter_is_end(&self.object)\n\treturn gobject.GoBool(unsafe.Pointer(&b))\n}", "func (it *Skip_Iterator) SeekToLast() {\n\tit.list.mu.RLock()\n\tdefer it.list.mu.RUnlock()\n\n\tit.node = it.list.findlast()\n\tif it.node == it.list.head {\n\t\tit.node = nil\n\t}\n}", "func (this *Queue) Dequeue() interface{} {\r\n\tif this.length == 0 {\r\n\t\treturn nil\r\n\t}\r\n\tn := this.start\r\n\tif this.length == 1 {\r\n\t\tthis.start = nil\r\n\t\tthis.end = nil\r\n\t} else {\r\n\t\tthis.start = this.start.next\r\n\t}\r\n\tthis.length--\r\n\treturn n.value\r\n}", "func (q *RingQueue) Dequeue() interface{} {\n\tif q.IsEmpty() {\n\t\treturn nil\n\t}\n\n\te := q.data[q.front]\n\tq.front = (q.front + 1) % q.size\n\treturn e\n}", "func (iter *CouchDBMockStateRangeQueryIterator) Next() (*queryresult.KV, error) {\n\tif iter.Closed == true {\n\t\treturn nil, errors.New(\"MockStateRangeQueryIterator.Next() called after Close()\")\n\t}\n\n\tif iter.HasNext() == false {\n\t\treturn nil, errors.New(\"MockStateRangeQueryIterator.Next() called when it does not HaveNext()\")\n\t}\n\tret := &iter.QueryResults[iter.CurrentIndex]\n\titer.CurrentIndex++\n\treturn ret, nil\n\t//\treturn nil, errors.New(\"MockStateRangeQueryIterator.Next() went past end of range\")\n}", "func (c *ReferencesBasesListCall) End(end int64) *ReferencesBasesListCall {\n\tc.urlParams_.Set(\"end\", fmt.Sprint(end))\n\treturn c\n}", "func (it *MockIndexTree) ReverseIterator(start, end []byte) Iterator {\n\titer := &BackwardIter{start: start, end: end}\n\tif bytes.Compare(start, end) >= 0 {\n\t\titer.err = io.EOF\n\t\treturn iter\n\t}\n\tvar ok bool\n\titer.enumerator, ok = it.bt.Seek(end)\n\tif ok { // [start, end) end is exclusive\n\t\titer.enumerator.Prev()\n\t}\n\titer.Next() //fill key, value, err\n\treturn iter\n}", "func (it *insertIterator) remaining() int {\n\treturn len(it.chain) - it.index\n}", "func (sl *Slice) ElemFromEndTry(idx int) (Ki, error) {\n\treturn sl.ElemTry(len(*sl) - 1 - idx)\n}", "func (n *Name) End() Pos {\n\treturn n.Start + Pos(len(n.Value))\n}", "func (f * LinkedList) delLast() (*Element) {\n\t// will return deleted element\n\tif (f.length == 0){\n\t\treturn nil\n\t} else {\n\t\ttmp := f.end\n\t\tcurrentElmt := f.end.prev\n\t\tf.end = currentElmt\n\t\tf.end.next = nil\n\t\tf.length--\n\t\treturn tmp\n\t}\n}", "func (m *NoGrowMap) iteratorPos() int {\n\treturn m.Size - len(m.Iterator)\n}", "func (itr *SortedEditItr) ReachedEOF() bool {\n\treturn itr.leftItr.ReachedEOF() && itr.rightItr.ReachedEOF()\n}", "func (this ActivityStreamsImageProperty) End() vocab.ActivityStreamsImagePropertyIterator {\n\treturn nil\n}", "func (d *Deque[T]) Clear() {\n\td.EraseRange(0, d.size)\n}", "func (it *subIterator) Next() Item {\n\tif it.iterator.state == pastRear {\n\t\treturn nil\n\t}\n\n\titem := it.iterator.Next()\n\n\tif item != nil && it.toKey.Less(item) {\n\t\tit.iterator.state = pastRear\n\t\treturn nil\n\t}\n\n\treturn item\n}", "func (it *EtherDeltaDepositIterator) Close() error {\n\tit.sub.Unsubscribe()\n\treturn nil\n}", "func (l *Location) End() uint64 {\n\treturn l.end\n}", "func (o TableRangePartitioningRangeOutput) End() pulumi.IntOutput {\n\treturn o.ApplyT(func(v TableRangePartitioningRange) int { return v.End }).(pulumi.IntOutput)\n}", "func (it *NZIter) Done() bool {\n\treturn it.n >= it.g.N()\n}" ]
[ "0.7996522", "0.6891391", "0.6834904", "0.67651355", "0.6211304", "0.5999666", "0.5966846", "0.5941908", "0.591513", "0.5906865", "0.58283925", "0.5793505", "0.5780784", "0.5779588", "0.57639235", "0.5707974", "0.56977427", "0.56969374", "0.5686384", "0.5656719", "0.5621995", "0.5611296", "0.5587854", "0.55832607", "0.5564621", "0.5526364", "0.54374236", "0.54300547", "0.5422518", "0.5407611", "0.54047656", "0.5396051", "0.5367435", "0.53632414", "0.5359534", "0.53505224", "0.5345065", "0.5337522", "0.53315115", "0.5307443", "0.5301679", "0.5300178", "0.52917445", "0.5282908", "0.525781", "0.5237097", "0.5236878", "0.5226315", "0.52151686", "0.52145934", "0.521139", "0.5191608", "0.5184681", "0.5179569", "0.517077", "0.5157458", "0.5146691", "0.5146243", "0.5131668", "0.5128987", "0.5110172", "0.51037234", "0.50945765", "0.5084996", "0.50682336", "0.50644", "0.5051507", "0.50493354", "0.5042564", "0.50409454", "0.50325036", "0.50273865", "0.5014566", "0.5014167", "0.50116944", "0.5010176", "0.50093424", "0.50062376", "0.5000337", "0.49970287", "0.49763831", "0.49645707", "0.49597687", "0.49550202", "0.49537838", "0.49416113", "0.49377543", "0.49333245", "0.49328214", "0.49246162", "0.4922547", "0.49185812", "0.4902614", "0.49010655", "0.48993802", "0.4896058", "0.48927012", "0.48838502", "0.48752266", "0.48750177" ]
0.8394369
0
First returns an iterator of the deque with the first position
func (d *Deque[T]) First() *DequeIterator[T] { return d.IterAt(0) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func first(b *ringBuf) iterator {\n\treturn iterator(b.head)\n}", "func (d *Deque[T]) Begin() *DequeIterator[T] {\n\treturn d.First()\n}", "func (i *ArrayConcreteIterator) First() {\n i.current_index_ = 0\n}", "func (d *Deque) First() Value {\n\tf, _, _ := d.Split()\n\treturn f\n}", "func (it *Iterator) SeekToFirst() {\n\tit.listIter.SeekToFirst()\n}", "func (it *Iterator) SeekFirst() {\n\tit.iter.SeekFirst()\n\tit.skipUnwanted()\n}", "func (iter *radixIterator) First() {\n\tresIter, err := iter.miTxn.Get(nil)\n\tif err != nil {\n\t\titer.err = err\n\t\treturn\n\t}\n\titer.resIter = resIter\n\titer.isReverser = false\n\titer.Next()\n}", "func (i *Iterator) First() bool {\n\treturn i.i.First()\n}", "func (q *Queue) First() *list.Element {\n\n\treturn q.orders.Front()\n}", "func (iterator *Iterator) First() bool {\n\treturn iterator.iterator.First()\n}", "func (s Sequence) First() interface{} {\n\tvar result interface{}\n\ts.Find(func(el El)bool{\n\t\tresult = el\n\t\treturn true\n\t})\n\treturn result\n}", "func (s *SkipList) SeekToFirst() Iterator {\n\tif s.length == 0 {\n\t\treturn nil\n\t}\n\n\tcurrent := s.header.next()\n\treturn &iter{\n\t\tcurrent: current,\n\t\tkey: current.key,\n\t\tvalue: current.value,\n\t\tlist: s,\n\t}\n}", "func (d *Deque[T]) Front() T {\n\treturn d.firstSegment().front()\n}", "func (a Slice[T]) First() *T {\n\treturn a.At(0)\n}", "func First(i frameless.Iterator, e frameless.Entity) (err error) {\n\n\tdefer func() {\n\t\tcErr := i.Close()\n\n\t\tif err == nil && cErr != nil {\n\t\t\terr = cErr\n\t\t}\n\t}()\n\n\tif !i.Next() {\n\t\treturn ErrNoNextElement\n\t}\n\n\tif err := i.Decode(e); err != nil {\n\t\treturn err\n\t}\n\n\treturn i.Err()\n}", "func (this *MultiMap) First() KvIterator {\n\treturn &MapIterator{node: this.tree.First()}\n}", "func (iter *PermutationIterator) First() []interface{} {\n\titer.Reset()\n\treturn iter.Next()\n}", "func (c *Cursor) First() {\n\tc.pos = c.start\n}", "func (l *List) First() *El {\n\treturn l.zero.Next()\n}", "func (mci *XMCacheIterator) First() bool {\n\tif mci.err != nil {\n\t\treturn false\n\t} else if mci.dir == dirReleased {\n\t\tmci.err = iterator.ErrIterReleased\n\t\treturn false\n\t}\n\tif mci.setMciKeys(0, setTypeFirst) && mci.setMciKeys(1, setTypeFirst) && mci.setMciKeys(2, setTypeFirst) {\n\t\tmci.dir = dirSOI\n\t\treturn mci.next()\n\t}\n\treturn false\n}", "func (this *Map) First() KvIterator {\n\treturn &MapIterator{node: this.tree.First()}\n}", "func (i *LevelIterator) First() *FileMetadata {\n\tif i.empty() {\n\t\treturn nil\n\t}\n\tif i.start != nil {\n\t\ti.iter = i.start.clone()\n\t} else {\n\t\ti.iter.first()\n\t}\n\tif !i.iter.valid() {\n\t\treturn nil\n\t}\n\treturn i.skipFilteredForward(i.iter.cur())\n}", "func (e *ElementQueue) First() string {\n\te.lock.Lock()\n\titem := e.elements[0]\n\te.lock.Unlock()\n\n\treturn item\n\n}", "func (iter *SkipListIterator) First() {\n\tif iter.cursor != nil {\n\t\tC.skiplist_release_node(iter.cursor)\n\t}\n\titer.cursor = C.skiplist_begin(iter.sl.csl)\n}", "func (it *insertIterator) first() *types.Block {\n\treturn it.chain[0]\n}", "func (it *Skip_Iterator) SeekToFirst() {\n\tit.list.mu.RLock()\n\tdefer it.list.mu.RUnlock()\n\n\tit.node = it.list.head.getNext(0)\n}", "func (s Stream) First() (r Record, err error) {\n\terr = s.Iterate(func(rec Record) error {\n\t\tr = rec\n\t\treturn ErrStreamClosed\n\t})\n\n\tif err == ErrStreamClosed {\n\t\terr = nil\n\t}\n\n\treturn\n}", "func (t *RbTree[K, V]) IterFirst() *RbTreeIterator[K, V] {\n\treturn NewIterator(t.First())\n}", "func First(seq Seq) interface{} {\n\tif seq == nil {\n\t\treturn nil\n\t}\n\treturn seq.First()\n}", "func (itr *DequeIterator) Next() common.Iterator {\n\tswitch itr.direction {\n\tcase BACKWARD:\n\t\treturn itr.moveToPrev()\n\tcase FORWARD:\n\t\treturn itr.moveToNext()\n\t}\n\n\treturn itr\n}", "func (q Query) First(ctx Context) (Record, bool, error) {\n\titem, err := q.Iterate()(ctx)\n\tif err != nil {\n\t\tif IsNoRows(err) {\n\t\t\treturn Record{}, false, nil\n\t\t}\n\t\treturn Record{}, false, err\n\t}\n\treturn item, true, nil\n}", "func (iter *dbCacheIterator) First() bool {\n\t// Seek to the first key in both the database and cache iterators and\n\t// choose the iterator that is both valid and has the smaller key.\n\titer.dbIter.First()\n\titer.cacheIter.First()\n\treturn iter.chooseIterator(true)\n}", "func (c *index) SeekFirst(r kv.Retriever) (iter table.IndexIterator, err error) {\n\tupperBound := c.prefix.PrefixNext()\n\tit, err := r.Iter(c.prefix, upperBound)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &indexIter{it: it, idx: c, prefix: c.prefix}, nil\n}", "func (q *Deque) Begin() common.Iterator {\n\titr := new(DequeIterator)\n\titr.index = 0\n\titr.direction = FORWARD\n\titr.deque = q\n\treturn itr\n}", "func (q *Deque) Front() interface{} {\n\tif !q.Empty() {\n\t\treturn q.values[q.front]\n\t}\n\treturn nil\n}", "func (group *Group) First() Node {\n\treturn group.items[0]\n}", "func (d *Deque) Front() (*interface{}, bool) {\n\tif d.Empty() {\n\t\treturn nil, false\n\t}\n\treturn &d.front.data, true\n}", "func (this *MyCircularDeque) GetFront() int {\n if this.IsEmpty() {\n return -1\n }\n return this.data[this.head]\n}", "func (biq *BankItemQuery) First(ctx context.Context) (*BankItem, error) {\n\tbis, err := biq.Limit(1).All(ctx)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif len(bis) == 0 {\n\t\treturn nil, &ErrNotFound{bankitem.Label}\n\t}\n\treturn bis[0], nil\n}", "func (eb *EBlock) GetFirst(c *Client) error {\n\tfor ; !eb.IsFirst(); *eb = eb.Prev() {\n\t\tif err := eb.Get(c); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\treturn nil\n}", "func (o *ordering) front() *entry {\n\te := o.ordered[0]\n\tif e.prev != nil {\n\t\tlog.Panicf(\"unexpected first entry: %v\", e)\n\t}\n\t// The first entry is always a logical position, which should not be indexed.\n\te, _ = e.nextIndexed()\n\treturn e\n}", "func (this *MyCircularDeque) GetFront() int {\n\tif this.IsEmpty() {\n\t\treturn -1\n\t}\n\treturn this.First.Next.Data\n}", "func (i *blockIter) First() (*InternalKey, base.LazyValue) {\n\tif invariants.Enabled && i.isDataInvalidated() {\n\t\tpanic(errors.AssertionFailedf(\"invalidated blockIter used\"))\n\t}\n\n\ti.offset = 0\n\tif !i.valid() {\n\t\treturn nil, base.LazyValue{}\n\t}\n\ti.clearCache()\n\ti.readEntry()\n\thiddenPoint := i.decodeInternalKey(i.key)\n\tif hiddenPoint {\n\t\treturn i.Next()\n\t}\n\tif !i.lazyValueHandling.hasValuePrefix ||\n\t\tbase.TrailerKind(i.ikey.Trailer) != InternalKeyKindSet {\n\t\ti.lazyValue = base.MakeInPlaceValue(i.val)\n\t} else if i.lazyValueHandling.vbr == nil || !isValueHandle(valuePrefix(i.val[0])) {\n\t\ti.lazyValue = base.MakeInPlaceValue(i.val[1:])\n\t} else {\n\t\ti.lazyValue = i.lazyValueHandling.vbr.getLazyValueForPrefixAndValueHandle(i.val)\n\t}\n\treturn &i.ikey, i.lazyValue\n}", "func (t *Token) First() *Token {\n\ttmp := t\n\tfor tmp.Prev != nil {\n\t\ttmp = tmp.Prev\n\t}\n\treturn tmp\n}", "func (Q *Deque) RemoveFirst() (interface{}, error) {\n\tif Q.size == 0 {\n\t\treturn nil, errors.New(\"Queue is empty\")\n\t}\n\tcurrentVal := Q.front.val\n\tnextNode := Q.front.next\n\tQ.front = nextNode\n\treturn currentVal, nil\n}", "func (list *SkipList) Front() *Element {\n\treturn list.next[0]\n}", "func (d *MyCircularDeque) GetFront() int {\n\tif d.IsEmpty() {\n\t\treturn -1\n\t}\n\treturn d.Val[0]\n}", "func (q *SliceQueue) Front() interface{} {\n\tif q.IsEmpty() {\n\t\treturn nil\n\t}\n\n\treturn q.Data[0]\n}", "func (this *MyCircularDeque) GetFront() int {\n\tif this.IsEmpty() {\n\t\treturn -1\n\t}\n\n\tthis.mutex.RLock()\n\tdefer this.mutex.RUnlock()\n\treturn this.data[this.front]\n\n}", "func (s *ItemScroller) First() int {\n\n\treturn s.first\n}", "func (q *queue) Front() (interface{}, error) {\n\tif q.Empty() {\n\t\treturn nil, errors.New(\"error: can not get element from empty queue\")\n\t}\n\treturn q.items[q.head].Data, nil\n}", "func (q *ItemQueue) Front() *Item {\n\tq.lock.RLock()\n\tdefer q.lock.RUnlock()\n\titem := q.items[0]\n\treturn &item\n}", "func First(data interface{}) (interface{}, error) {\n\tvar err error\n\n\tresult := func(err *error) interface{} {\n\t\tdefer catch(err)\n\n\t\tif !isNonNilData(err, \"data\", data) {\n\t\t\treturn nil\n\t\t}\n\n\t\tdataValue, _, _, dataValueLen := inspectData(data)\n\n\t\tif !isSlice(err, \"data\", dataValue) {\n\t\t\treturn nil\n\t\t}\n\n\t\tif dataValueLen == 0 {\n\t\t\treturn nil\n\t\t}\n\n\t\treturn dataValue.Index(0).Interface()\n\t}(&err)\n\n\treturn result, err\n}", "func (dq *Dqueue) Front() (value interface{}, ok bool) {\n\tvalue, ok = dq.dqueue.Get(0)\n\treturn\n}", "func (l *List) First() *Item {\r\n\treturn l.first\r\n}", "func (l *List) First() interface{} {\n\tif l.len != 0 {\n\t\treturn l.head.Value()\n\t}\n\treturn nil\n}", "func (it *subIterator) Next() Item {\n\tif it.iterator.state == pastRear {\n\t\treturn nil\n\t}\n\n\titem := it.iterator.Next()\n\n\tif item != nil && it.toKey.Less(item) {\n\t\tit.iterator.state = pastRear\n\t\treturn nil\n\t}\n\n\treturn item\n}", "func (q *wantConnQueue) peekFront() *wantConn {\n\tif q.headPos < len(q.head) {\n\t\treturn q.head[q.headPos]\n\t}\n\tif len(q.tail) > 0 {\n\t\treturn q.tail[0]\n\t}\n\treturn nil\n}", "func (mcq *MyCircularQueue) Front() int {\n\tif mcq.length == 0 {\n\t\treturn -1\n\t}\n\treturn mcq.dummyHead.Next.Val\n}", "func (l *List) First() interface{} {\n\tif l.len == 0 {\n\t\treturn 0\n\t}\n\treturn l.firstElement.Value\n}", "func (d *Deque[T]) PopFront() T {\n\tif d.size == 0 {\n\t\tpanic(\"deque is empty\")\n\t}\n\ts := d.segs[d.begin]\n\tv := s.popFront()\n\tif s.size() == 0 {\n\t\td.putToPool(s)\n\t\td.segs[d.begin] = nil\n\t\td.begin = d.nextIndex(d.begin)\n\t}\n\td.size--\n\td.shrinkIfNeeded()\n\treturn v\n}", "func (c StringArrayCollection) First(cbs ...CB) interface{} {\n\tif len(cbs) > 0 {\n\t\tfor key, value := range c.value {\n\t\t\tif cbs[0](key, value) {\n\t\t\t\treturn value\n\t\t\t}\n\t\t}\n\t\treturn nil\n\t} else {\n\t\tif len(c.value) > 0 {\n\t\t\treturn c.value[0]\n\t\t} else {\n\t\t\treturn nil\n\t\t}\n\t}\n}", "func (this *MyCircularDeque) GetFront() int {\n\tif this.IsEmpty() {\n\t\treturn -1\n\t}\n\n\treturn this.data[this.front]\n}", "func (s *StringQueue) Front() *string {\n\ts.lock.RLock()\n\titem := s.items[0]\n\ts.lock.RUnlock()\n\treturn &item\n}", "func (me Tokens) First(matches func(*Token) bool) *Token {\n\tif len(me) == 0 {\n\t\treturn nil\n\t}\n\tif matches != nil {\n\t\tfor i := range me {\n\t\t\tif t := &me[i]; matches(t) {\n\t\t\t\treturn t\n\t\t\t}\n\t\t}\n\t\treturn nil\n\t}\n\treturn &me[0]\n}", "func (n *Node) First() *Node {\n\tfor n.previous != nil {\n\t\tn = n.previous\n\t}\n\treturn n\n}", "func (b *Builder) First() MessageFilter {\n\tif len(b.chain) == 0 {\n\t\treturn nil\n\t}\n\n\treturn b.chain[0]\n}", "func (this *MyCircularQueue) Front() int {\n if this.IsEmpty() {\n return -1\n }\n return this.Items[this.HeadIndex]\n}", "func (this *MyCircularQueue) Front() int {\n\tif this.IsEmpty() {\n\t\treturn -1\n\t}\n\treturn this.items[this.front]\n}", "func (this *MyCircularDeque) GetFront() int {\n\tif this.len <= 0 {\n\t\treturn -1\n\t}\n\n\tn := this.l.Front().Value.(int)\n\treturn n\n}", "func (d *Deque[T]) IterAt(pos int) *DequeIterator[T] {\n\treturn &DequeIterator[T]{dq: d, position: pos}\n}", "func (this *MyCircularDeque) GetFront() int {\n\tif this.len == 0 {\n\t\treturn -1\n\t}\n\treturn this.queue[this.head]\n}", "func (s EncryptedChatDiscardedArray) First() (v EncryptedChatDiscarded, ok bool) {\n\tif len(s) < 1 {\n\t\treturn\n\t}\n\treturn s[0], true\n}", "func (this *MyCircularDeque1) GetFront() int {\n\treturn this.head.Next.Val\n}", "func (s *ItemQueue) Front() *Item {\n\ts.lock.RLock()\n\tdefer s.lock.RUnlock()\n\titem := s.items[0]\n\treturn &item\n}", "func (O ObjectCollection) First() (int, error) {\n\tvar exists C.int\n\tvar idx C.int32_t\n\tif C.dpiObject_getFirstIndex(O.dpiObject, &idx, &exists) == C.DPI_FAILURE {\n\t\treturn 0, errors.Errorf(\"first: %w\", O.getError())\n\t}\n\tif exists == 1 {\n\t\treturn int(idx), nil\n\t}\n\treturn 0, ErrNotExist\n}", "func (this *MyCircularDeque) GetFront() int {\n\tif this.length == 0 {\n\t\treturn -1\n\t}\n\treturn this.head.next.val\n}", "func (l *idList) Front() *idElement {\n\tif l.len == 0 {\n\t\treturn nil\n\t}\n\treturn l.root.next\n}", "func (l LinkedGeoLoop) First() *LinkedGeoCoord {\n\tcFirst := l.v.first\n\tif uintptr(unsafe.Pointer(cFirst)) == 0 {\n\t\treturn nil\n\t}\n\tcoord := geoCoordFromC(cFirst.vertex)\n\tfirst := &LinkedGeoCoord{\n\t\tVertex: coord,\n\t\tv: cFirst,\n\t}\n\treturn first\n\n}", "func (l *TwoList) PeekFront() *Element {\n\treturn l.seekFront(false)\n}", "func (q *taskQueue) First() interface{} {\n\treturn q.tasks[0]\n}", "func (this *MyCircularDeque) GetFront() int {\n\tif this.IsEmpty() {\n\t\treturn -1\n\t}\n\treturn this.head.value\n}", "func (l LinkedGeoPolygon) First() *LinkedGeoLoop {\n\tfirst := l.v.first\n\tif uintptr(unsafe.Pointer(first)) == 0 {\n\t\treturn nil\n\t}\n\treturn &LinkedGeoLoop{v: first}\n}", "func (g *Group) GetFirstElem(operand Operand) *list.Element {\n\tif operand == OperandAny {\n\t\treturn g.Equivalents.Front()\n\t}\n\treturn g.FirstExpr[operand]\n}", "func (d *Deque) removeFirst() string {\n\t// println(\"removeFirst\")\n\tif d.isEmpty() {\n\t\treturn \"\"\n\t}\n\td.count--\n\tnode := d.first\n\td.first = node.next\n\t// If this empties the list, set last to nil as well\n\tif d.first == nil {\n\t\td.last = nil\n\t}\n\treturn node.item\n}", "func (b *Buffer) ReadFirst(data []byte) (n int, next Cursor, err error) {\n\tb.mu.RLock()\n\tdefer b.mu.RUnlock()\n\treturn b.readOffset(data, b.first)\n}", "func (l *ListType) First() Value {\n\tif l.Empty() {\n\t\treturn emptyListError()\n\t}\n\n\treturn l.first\n}", "func (a *ArrayList) First() interface{} {\n\treturn a.elements[0]\n}", "func (Q *Deque) AddFirst(val interface{}) {\n\tnode := &Node{\n\t\tval: val,\n\t}\n\tif Q.front == nil {\n\t\tQ.front = node\n\t\tQ.back = node\n\t} else {\n\t\tcurrentNode := Q.front\n\t\tQ.front = node\n\t\tQ.front.next = currentNode\n\t}\n\tQ.size++\n}", "func (q *Queue) Front() interface{} {\n\treturn q.data[q.head]\n}", "func (this *MyCircularQueue) Front() int {\n\tif this.Count == 0 {\n\t\treturn -1\n\t}\n\treturn this.Queue[this.Head]\n}", "func (l *List) Front() *Elem { return l.front }", "func (iter *SliceIterator) Next() iterator.ConstIterator {\n\tif iter.position < iter.s.Len() {\n\t\titer.position++\n\t}\n\treturn iter\n}", "func (p *SliceOfMap) First() (elem *Object) {\n\treturn p.At(0)\n}", "func (l *sampleList) Front() *Sample { return l.head }", "func (s *EncryptedChatDiscardedArray) PopFirst() (v EncryptedChatDiscarded, ok bool) {\n\tif s == nil || len(*s) < 1 {\n\t\treturn\n\t}\n\n\ta := *s\n\tv = a[0]\n\n\t// Delete by index from SliceTricks.\n\tcopy(a[0:], a[1:])\n\tvar zero EncryptedChatDiscarded\n\ta[len(a)-1] = zero\n\ta = a[:len(a)-1]\n\t*s = a\n\n\treturn v, true\n}", "func (this *Map) Begin() KvIterator {\n\treturn this.First()\n}", "func (c *testCapture) First() SingleCapture {\n\treturn c.Capture(0)\n}", "func (l List) First() interface{} {\n\tn := l.Head\n\treturn n.Data\n}", "func (i *ObjectIterator) IsFirst() bool {\n\treturn i.position == 0\n}" ]
[ "0.76048857", "0.7295957", "0.7266155", "0.7236091", "0.72281426", "0.7140008", "0.70792204", "0.69799185", "0.69382066", "0.69054586", "0.68987405", "0.6879563", "0.68766457", "0.6864194", "0.6860115", "0.68302244", "0.6774027", "0.67625624", "0.6748579", "0.67354333", "0.6727167", "0.6659572", "0.66492945", "0.6625738", "0.662171", "0.65927446", "0.6585038", "0.6577865", "0.65625185", "0.64577496", "0.64574456", "0.63904995", "0.6390036", "0.6378599", "0.6378548", "0.6368818", "0.6342609", "0.6327789", "0.63250554", "0.6314259", "0.6312353", "0.62988764", "0.62548876", "0.62319505", "0.6225809", "0.6200334", "0.61827725", "0.617534", "0.6165237", "0.615803", "0.61494756", "0.6144827", "0.6144194", "0.61326456", "0.6122952", "0.61223173", "0.6120786", "0.61160994", "0.611249", "0.6111854", "0.6106234", "0.6104478", "0.6102853", "0.6097699", "0.60946715", "0.6094134", "0.6073707", "0.60706675", "0.60704666", "0.606991", "0.6069611", "0.6046543", "0.60460156", "0.60363734", "0.6032079", "0.6008878", "0.5992733", "0.5985854", "0.5977981", "0.59743667", "0.5969644", "0.59388435", "0.59384793", "0.5918341", "0.591348", "0.59049755", "0.5897225", "0.5893074", "0.587724", "0.58768797", "0.5875807", "0.5873576", "0.5855164", "0.584165", "0.5839901", "0.58278424", "0.5819422", "0.5808304", "0.58074856", "0.5803548" ]
0.85791147
0
Last returns an iterator of the deque with the last position
func (d *Deque[T]) Last() *DequeIterator[T] { return d.IterAt(d.Size() - 1) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (d *Deque[T]) End() *DequeIterator[T] {\n\treturn d.IterAt(d.Size())\n}", "func last(b *ringBuf) iterator {\n\treturn iterator((b.head + b.len - 1) % len(b.buf))\n}", "func (iter *radixIterator) Last() {\n\tresIter, err := iter.miTxn.GetReverse(nil)\n\tif err != nil {\n\t\titer.err = err\n\t\treturn\n\t}\n\titer.resIter = resIter\n\titer.isReverser = true\n\titer.Prev()\n}", "func (q *Deque) End() common.Iterator {\n\treturn q.endItr\n}", "func (this *MultiMap) Last() KvIterator {\n\treturn &MapIterator{node: this.tree.Last()}\n}", "func (it *Iterator) SeekToLast() {\n\tit.listIter.SeekToLast()\n}", "func (i *Iterator) Last() bool {\n\treturn i.i.Last()\n}", "func (this *Map) Last() KvIterator {\n\treturn &MapIterator{node: this.tree.Last()}\n}", "func (iterator *Iterator) Last() bool {\n\treturn iterator.iterator.Last()\n}", "func (a Slice[T]) Last() *T {\n\treturn a.At(len(a) - 1)\n}", "func (t *RbTree[K, V]) IterLast() *RbTreeIterator[K, V] {\n\treturn NewIterator(t.Last())\n}", "func (it *KeyAccess_Iterator) SeekToLast() {\n\tit.list.mu.RLock()\n\tdefer it.list.mu.RUnlock()\n\n\tit.node = it.list.findlast()\n\tif it.node == it.list.head {\n\t\tit.node = nil\n\t}\n}", "func (i *LevelIterator) Last() *FileMetadata {\n\tif i.empty() {\n\t\treturn nil\n\t}\n\tif i.end != nil {\n\t\ti.iter = i.end.clone()\n\t} else {\n\t\ti.iter.last()\n\t}\n\tif !i.iter.valid() {\n\t\treturn nil\n\t}\n\treturn i.skipFilteredBackward(i.iter.cur())\n}", "func (c *Cursor) Last() {\n\tc.pos = c.end - 1\n}", "func (s *SkipList) SeekToLast() Iterator {\n\tcurrent := s.footer\n\tif current == nil {\n\t\treturn nil\n\t}\n\n\treturn &iter{\n\t\tcurrent: current,\n\t\tkey: current.key,\n\t\tvalue: current.value,\n\t\tlist: s,\n\t}\n}", "func (iter *SkipListIterator) Last() {\n\tif iter.cursor != nil {\n\t\tC.skiplist_release_node(iter.cursor)\n\t}\n\titer.cursor = C.skiplist_end(iter.sl.csl)\n}", "func Last(collection interface{}) interface{} {\n\ttypeOfCollection := reflect.TypeOf(collection)\n\tif typeOfCollection.Kind() != reflect.Array && typeOfCollection.Kind() != reflect.Slice {\n\t\tpanic(\"collection should be array or slice\")\n\t}\n\tvalueOfCollection := reflect.ValueOf(collection)\n\n\treturn valueOfCollection.Index(valueOfCollection.Len() - 1).Interface()\n}", "func (q *Deque) Rend() common.Iterator {\n\treturn q.endItr\n}", "func (t *Token) Last() *Token {\n\ttmp := t\n\tfor tmp.Next != nil {\n\t\ttmp = tmp.Next\n\t}\n\treturn tmp\n}", "func (d *Deque[T]) Back() T {\n\treturn d.lastSegment().back()\n}", "func (it *Skip_Iterator) SeekToLast() {\n\tit.list.mu.RLock()\n\tdefer it.list.mu.RUnlock()\n\n\tit.node = it.list.findlast()\n\tif it.node == it.list.head {\n\t\tit.node = nil\n\t}\n}", "func (l *List) Last() interface{} {\n\tif l.len == 0 {\n\t\treturn 0\n\t}\n\treturn l.lastElement.Value\n}", "func (l *List) Last() interface{} {\n\tif l.len != 0 {\n\t\treturn l.tail.Value()\n\t}\n\treturn nil\n}", "func (q Query) Last(ctx Context) (r Record, exists bool, err error) {\n\tnext := q.Iterate()\n\n\tfor {\n\t\titem, e := next(ctx)\n\t\tif e != nil {\n\t\t\tif IsNoRows(e) {\n\t\t\t\tbreak\n\t\t\t}\n\n\t\t\terr = e\n\t\t\treturn\n\t\t}\n\n\t\tr = item\n\t\texists = true\n\t\terr = nil\n\t}\n\treturn\n}", "func (l *List) Last() *Item {\r\n\treturn l.last\r\n}", "func (s *Stack[T]) Last() (T, bool) {\n\tif s.IsEmpty() {\n\t\treturn *new(T), false\n\t}\n\treturn (*s)[(len(*s) - 1)], true\n}", "func (l List) Last() interface{} {\n\tn := l.Head\n\tfor n.Next != nil {\n\t\tn = n.Next\n\t}\n\treturn n.Data\n}", "func (s EncryptedChatDiscardedArray) Last() (v EncryptedChatDiscarded, ok bool) {\n\tif len(s) < 1 {\n\t\treturn\n\t}\n\treturn s[len(s)-1], true\n}", "func Last(data interface{}) (interface{}, error) {\n\tvar err error\n\n\tresult := func(err *error) interface{} {\n\t\tdefer catch(err)\n\n\t\tif !isNonNilData(err, \"data\", data) {\n\t\t\treturn nil\n\t\t}\n\n\t\tdataValue, _, _, dataValueLen := inspectData(data)\n\n\t\tif !isSlice(err, \"data\", dataValue) {\n\t\t\treturn nil\n\t\t}\n\n\t\tif dataValueLen == 0 {\n\t\t\treturn nil\n\t\t}\n\n\t\treturn dataValue.Index(dataValueLen - 1).Interface()\n\t}(&err)\n\n\treturn result, err\n}", "func (q *Deque) Back() interface{} {\n\tif !q.Empty() {\n\t\treturn q.values[q.back-1]\n\t}\n\treturn nil\n}", "func (p *SliceOfMap) Last() (elem *Object) {\n\treturn p.At(-1)\n}", "func (itr *DequeIterator) Next() common.Iterator {\n\tswitch itr.direction {\n\tcase BACKWARD:\n\t\treturn itr.moveToPrev()\n\tcase FORWARD:\n\t\treturn itr.moveToNext()\n\t}\n\n\treturn itr\n}", "func (iter *dbCacheIterator) Last() bool {\n\t// Seek to the last key in both the database and cache iterators and\n\t// choose the iterator that is both valid and has the larger key.\n\titer.dbIter.Last()\n\titer.cacheIter.Last()\n\treturn iter.chooseIterator(false)\n}", "func (v IntVec) Last() int {\n\treturn v[len(v)-1]\n}", "func (v Data) Last() PicData {\n\treturn v[len(v)-1]\n}", "func (dq *Dqueue) Back() (value interface{}, ok bool) {\n\tvalue, ok = dq.dqueue.Get(dq.Size() - 1)\n\treturn\n}", "func (p *IntVector) Last() int\t{ return p.Vector.Last().(int) }", "func (l *List) GetLast(v interface{} /* val */) *El {\n\tcur := l.search(v, false, false)\n\n\tif cur == &l.zero || l.less(cur.val, v) {\n\t\treturn nil\n\t}\n\n\treturn cur\n}", "func (h *History) Last() *Entry {\n\treturn &(*h)[len(*h)-1]\n}", "func (me Tokens) Last(matches func(*Token) bool) *Token {\n\tif len(me) == 0 {\n\t\treturn nil\n\t}\n\tif matches != nil {\n\t\tfor i := len(me) - 1; i >= 0; i-- {\n\t\t\tif t := &me[i]; matches(t) {\n\t\t\t\treturn t\n\t\t\t}\n\t\t}\n\t\treturn nil\n\t}\n\treturn &me[len(me)-1]\n}", "func (s EmojiListArray) Last() (v EmojiList, ok bool) {\n\tif len(s) < 1 {\n\t\treturn\n\t}\n\treturn s[len(s)-1], true\n}", "func (n *Node) Last() *Node {\n\tfor n.next != nil {\n\t\tn = n.next\n\t}\n\treturn n\n}", "func (q *Deque) Rbegin() common.Iterator {\n\titr := new(DequeIterator)\n\titr.index = q.Size() - 1\n\titr.direction = BACKWARD\n\titr.deque = q\n\treturn itr\n}", "func (b *BadgerStore) LastIndex() (uint64, error) {\n\treturn b.firstIndex(true)\n}", "func (b *BadgerStore) LastIndex() (uint64, error) {\n\treturn b.firstIndex(true)\n}", "func (d *Data) Last(bucket string, count int) ([]Item, error) {\n\tvar items []Item\n\terr := d.DB.View(func(tx *bolt.Tx) error {\n\t\tb := tx.Bucket([]byte(bucket))\n\t\tc := b.Cursor()\n\n\t\tfetched := 0\n\t\tfor k, v := c.Last(); k != nil && fetched < count; k, v = c.Prev() {\n\t\t\titems = append([]Item{Item{\n\t\t\t\tKey: string(k),\n\t\t\t\tValue: v,\n\t\t\t}}, items...)\n\t\t\tfetched++\n\t\t}\n\n\t\treturn nil\n\t})\n\treturn items, err\n}", "func (l LinkedGeoPolygon) Last() *LinkedGeoLoop {\n\tlast := l.v.last\n\tif uintptr(unsafe.Pointer(last)) == 0 {\n\t\treturn nil\n\t}\n\treturn &LinkedGeoLoop{v: last}\n}", "func (s EncryptedChatEmptyArray) Last() (v EncryptedChatEmpty, ok bool) {\n\tif len(s) < 1 {\n\t\treturn\n\t}\n\treturn s[len(s)-1], true\n}", "func (c StringArrayCollection) Last(cbs ...CB) interface{} {\n\tif len(cbs) > 0 {\n\t\tvar last interface{}\n\t\tfor key, value := range c.value {\n\t\t\tif cbs[0](key, value) {\n\t\t\t\tlast = value\n\t\t\t}\n\t\t}\n\t\treturn last\n\t} else {\n\t\tif len(c.value) > 0 {\n\t\t\treturn c.value[len(c.value)-1]\n\t\t} else {\n\t\t\treturn nil\n\t\t}\n\t}\n}", "func (O ObjectCollection) Last() (int, error) {\n\tvar exists C.int\n\tvar idx C.int32_t\n\tif C.dpiObject_getLastIndex(O.dpiObject, &idx, &exists) == C.DPI_FAILURE {\n\t\treturn 0, errors.Errorf(\"last: %w\", O.getError())\n\t}\n\tif exists == 1 {\n\t\treturn int(idx), nil\n\t}\n\treturn 0, ErrNotExist\n}", "func (ns Nodes) Last() Nodes {\n\tl := len(ns)\n\tif l < 2 {\n\t\treturn ns\n\t}\n\treturn Nodes{ns[l-1]}\n}", "func (l *List) Last() *Node {\n\treturn l.tail\n}", "func (l *List) Last() *Node {\n\treturn l.tail\n}", "func (l LinkedGeoLoop) Last() *LinkedGeoCoord {\n\tcLast := l.v.last\n\tif uintptr(unsafe.Pointer(cLast)) == 0 {\n\t\treturn nil\n\t}\n\n\tcoord := geoCoordFromC(cLast.vertex)\n\tlast := &LinkedGeoCoord{\n\t\tVertex: coord,\n\t\tv: cLast,\n\t}\n\treturn last\n}", "func (s MessagesFavedStickersArray) Last() (v MessagesFavedStickers, ok bool) {\n\tif len(s) < 1 {\n\t\treturn\n\t}\n\treturn s[len(s)-1], true\n}", "func last(input interface{}) interface{} {\n\tif input == nil {\n\t\treturn nil\n\t}\n\tarr := reflect.ValueOf(input)\n\tif arr.Len() == 0 {\n\t\treturn nil\n\t}\n\treturn arr.Index(arr.Len() - 1).Interface()\n}", "func (Q *Deque) RemoveLast() (interface{}, error) {\n\tif Q.size == 0 {\n\t\treturn nil, errors.New(\"Queue is empty\")\n\t}\n\treturnVal := Q.back.val\n\tcurrentNode := Q.front\n\tfor currentNode.next.next != nil {\n\t\tcurrentNode = currentNode.next\n\t}\n\tQ.back = currentNode\n\tQ.back.next = nil\n\treturn returnVal, nil\n}", "func (t *StringSlice) Last() string {\n\tvar ret string\n\tif len(t.items) > 0 {\n\t\tret = t.items[len(t.items)-1]\n\t}\n\treturn ret\n}", "func (l *List) Last() *string {\n\tif l == nil || len(*l) == 0 {\n\t\treturn nil\n\t}\n\treturn &(*l)[len(*l)-1]\n}", "func (f * LinkedList) delLast() (*Element) {\n\t// will return deleted element\n\tif (f.length == 0){\n\t\treturn nil\n\t} else {\n\t\ttmp := f.end\n\t\tcurrentElmt := f.end.prev\n\t\tf.end = currentElmt\n\t\tf.end.next = nil\n\t\tf.length--\n\t\treturn tmp\n\t}\n}", "func (k *Key) LastTok() KeyTok {\n\treturn k.toks[len(k.toks)-1]\n}", "func (dl *DelegatorList) lastIndex() uint64 {\n\t// negative count?\n\tif dl.count < 0 {\n\t\tif dl.cursor > 0 {\n\t\t\treturn dl.cursor\n\t\t}\n\t\treturn 0\n\t}\n\n\t// adjust for the list position\n\tval := dl.cursor + uint64(dl.count)\n\tif val > uint64(len(dl.list)) {\n\t\tval = uint64(len(dl.list))\n\t}\n\n\treturn val\n}", "func (ms *MemoryStorage) LastIndex() (uint64, error) {\n\tms.Lock()\n\tdefer ms.Unlock()\n\treturn ms.lastIndex(), nil\n}", "func (d *MyCircularDeque) InsertLast(value int) bool {\n\treturn d.Insert(value, 1)\n}", "func (sr *Stackers) Last() (Connector, error) {\n\tvar r Connector\n\tsr.ro.Lock()\n\t{\n\t\tl := len(sr.stacks)\n\t\tif l > 0 {\n\t\t\tr = sr.stacks[l-1]\n\t\t}\n\t}\n\tsr.ro.Unlock()\n\n\tif r == nil {\n\t\treturn nil, ErrEmptyStack\n\t}\n\n\treturn r, nil\n}", "func (o *Option) Last() *Option { \n if o == nil { return nil }\n for o.isNotLast { o = o.next }\n return o\n}", "func (i *blockIter) Last() (*InternalKey, base.LazyValue) {\n\tif invariants.Enabled && i.isDataInvalidated() {\n\t\tpanic(errors.AssertionFailedf(\"invalidated blockIter used\"))\n\t}\n\n\t// Seek forward from the last restart point.\n\ti.offset = decodeRestart(i.data[i.restarts+4*(i.numRestarts-1):])\n\tif !i.valid() {\n\t\treturn nil, base.LazyValue{}\n\t}\n\n\ti.readEntry()\n\ti.clearCache()\n\n\tfor i.nextOffset < i.restarts {\n\t\ti.cacheEntry()\n\t\ti.offset = i.nextOffset\n\t\ti.readEntry()\n\t}\n\n\thiddenPoint := i.decodeInternalKey(i.key)\n\tif hiddenPoint {\n\t\treturn i.Prev()\n\t}\n\tif !i.lazyValueHandling.hasValuePrefix ||\n\t\tbase.TrailerKind(i.ikey.Trailer) != InternalKeyKindSet {\n\t\ti.lazyValue = base.MakeInPlaceValue(i.val)\n\t} else if i.lazyValueHandling.vbr == nil || !isValueHandle(valuePrefix(i.val[0])) {\n\t\ti.lazyValue = base.MakeInPlaceValue(i.val[1:])\n\t} else {\n\t\ti.lazyValue = i.lazyValueHandling.vbr.getLazyValueForPrefixAndValueHandle(i.val)\n\t}\n\treturn &i.ikey, i.lazyValue\n}", "func (as appendStrategy) last() error {\n\treturn as.lastErr\n}", "func Last(arr interface{}) interface{} {\n\tvalue := redirectValue(reflect.ValueOf(arr))\n\tvalueType := value.Type()\n\n\tkind := value.Kind()\n\n\tif kind == reflect.Array || kind == reflect.Slice {\n\t\tif value.Len() == 0 {\n\t\t\treturn nil\n\t\t}\n\n\t\treturn value.Index(value.Len() - 1).Interface()\n\t}\n\n\tpanic(fmt.Sprintf(\"Type %s is not supported by Last\", valueType.String()))\n}", "func Last(d db.DB) (*db.Entry, error) {\n\titr, err := d.Query(db.Query{})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer itr.Close()\n\tif entry, err := itr.Next(); err == io.EOF {\n\t\treturn nil, errors.New(\"db is empty\")\n\t} else {\n\t\treturn entry, err\n\t}\n}", "func (iterator *Iterator) End() {\n\titerator.iterator.End()\n}", "func (s EmojiListClassArray) Last() (v EmojiListClass, ok bool) {\n\tif len(s) < 1 {\n\t\treturn\n\t}\n\treturn s[len(s)-1], true\n}", "func (l *List) Last() *Node {\n\treturn l.last\n}", "func (l *List) Last() *Node {\n\treturn l.last\n}", "func (s EncryptedChatArray) Last() (v EncryptedChat, ok bool) {\n\tif len(s) < 1 {\n\t\treturn\n\t}\n\treturn s[len(s)-1], true\n}", "func (q *Queue) Tail() uint64 { return q.tail }", "func (head *Node) Last() *Node {\n\tif head == nil {\n\t\treturn nil\n\t}\n\t// iterate till last node\n\tfor head.Next != nil {\n\t\thead = head.Next\n\t}\n\treturn head\n}", "func (d *Deque) Back() (*interface{}, bool) {\n\tif d.Empty() {\n\t\treturn nil, false\n\t}\n\treturn &d.back.data, true\n}", "func (d *Deque) removeLast() string {\n\tif d.isEmpty() {\n\t\treturn \"\"\n\t}\n\td.count--\n\tnode := d.last\n\td.first = node.next\n\treturn node.item\n}", "func (w *WaterMark) LastIndex() uint64 {\n\treturn w.lastIndex.Load()\n}", "func (l *LexInner) Last() rune {\n\tif l.Len() == 0 {\n\t\treturn Eof\n\t}\n\tr, _ := utf8.DecodeLastRuneInString(l.Get())\n\treturn r\n}", "func (bc *Blockchain) lastBlock() *Block {\n\treturn bc.chain[len(bc.chain)-1]\n}", "func (s MessagesFavedStickersClassArray) Last() (v MessagesFavedStickersClass, ok bool) {\n\tif len(s) < 1 {\n\t\treturn\n\t}\n\treturn s[len(s)-1], true\n}", "func (this *MyCircularDeque) DeleteLast() bool {\n\tif this.IsEmpty() {\n\t\treturn false\n\t}\n\tthis.end = (len(this.data) + this.end - 1) % len(this.data)\n\treturn true\n}", "func (Q *Deque) AddLast(val interface{}) {\n\tnode := &Node{\n\t\tval: val,\n\t}\n\tif Q.back == nil {\n\t\tQ.front = node\n\t\tQ.back = node\n\t} else {\n\t\t//First point the nex of the last element to the node\n\t\t// The new last element will be pointing to the back\n\t\tQ.back.next = node\n\t\tQ.back = Q.back.next\n\t}\n\tQ.size++\n}", "func (enum Enum) Last() (int, string) {\n\tn := len(enum.items)\n\treturn n - 1, enum.items[n-1].value\n}", "func (p *SliceOfMap) DropLast() ISlice {\n\treturn p.Drop(-1, -1)\n}", "func (d *Deque[T]) PopBack() T {\n\tif d.size == 0 {\n\t\tpanic(\"deque is empty\")\n\t}\n\tseg := d.preIndex(d.end)\n\ts := d.segs[seg]\n\tv := s.popBack()\n\n\tif s.size() == 0 {\n\t\td.putToPool(s)\n\t\td.segs[seg] = nil\n\t\td.end = seg\n\t}\n\n\td.size--\n\td.shrinkIfNeeded()\n\treturn v\n}", "func Last(obj interface{}) interface{} {\n\ttypeOfObj := reflect.TypeOf(obj)\n\tvalueOfObj := reflect.ValueOf(obj)\n\tif typeOfObj.Kind() != reflect.Array && typeOfObj.Kind() != reflect.Slice {\n\t\tpanic(\"make sure obj is array or slice\")\n\t}\n\tif valueOfObj.Len() == 0 {\n\t\tpanic(\"make sure obj is array not empty\")\n\t}\n\n\treturn valueOfObj.Index(valueOfObj.Len() - 1).Interface()\n}", "func (s EncryptedChatWaitingArray) Last() (v EncryptedChatWaiting, ok bool) {\n\tif len(s) < 1 {\n\t\treturn\n\t}\n\treturn s[len(s)-1], true\n}", "func (s EncryptedChatClassArray) Last() (v EncryptedChatClass, ok bool) {\n\tif len(s) < 1 {\n\t\treturn\n\t}\n\treturn s[len(s)-1], true\n}", "func (c *cursor) Last(ctx context.Context) (*chain.Beacon, error) {\n\tselect {\n\tcase <-ctx.Done():\n\t\treturn nil, ctx.Err()\n\tdefault:\n\t}\n\n\tconst query = `\n\tSELECT\n\t\tround,\n\t\tsignature\n\tFROM\n\t\tbeacon_details\n\tWHERE\n\t\tbeacon_id = :id\n\tORDER BY\n\t\tround DESC\n\tLIMIT 1`\n\n\tdata := struct {\n\t\tID int `db:\"id\"`\n\t}{\n\t\tID: c.store.beaconID,\n\t}\n\n\tret, err := c.store.getBeacon(ctx, true, query, data)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\terr = c.seekPosition(ctx, ret.Round)\n\treturn ret, err\n}", "func (s SecurePlainDataClassArray) Last() (v SecurePlainDataClass, ok bool) {\n\tif len(s) < 1 {\n\t\treturn\n\t}\n\treturn s[len(s)-1], true\n}", "func (this *MyCircularDeque) InsertLast(value int) bool {\n\tif this.IsFull() {\n\t\treturn false\n\t}\n\n\tthis.data[this.end] = value\n\tthis.end = (this.end + 1) % len(this.data)\n\treturn true\n}", "func Last(input interface{}, data map[string]interface{}) interface{} {\n\tvalue := reflect.ValueOf(input)\n\tkind := value.Kind()\n\n\tif kind != reflect.Array && kind != reflect.Slice {\n\t\treturn input\n\t}\n\tlen := value.Len()\n\tif len == 0 {\n\t\treturn input\n\t}\n\treturn value.Index(len - 1).Interface()\n}", "func (r *radNode) getLast() *radNode {\n\tn := r.desc\n\tif n == nil {\n\t\treturn nil\n\t}\n\tif n.sis == nil {\n\t\treturn n\n\t}\n\tkey := string(n.prefix)\n\tfor d := n.sis; d != nil; d = d.sis {\n\t\tk := string(d.prefix)\n\t\tif k > key {\n\t\t\tn = d\n\t\t\tkey = k\n\t\t}\n\t}\n\treturn n\n}", "func (d *MyCircularDeque) DeleteLast() bool {\n\treturn d.Delete(1)\n}", "func (l *SinglyLinkedList) Last() *Node {\n\tif l.size == 0 {\n\t\treturn nil\n\t}\n\n\treturn l.last\n}", "func (dq *Dqueue) PopBack() (value interface{}, ok bool) {\n\tvalue, ok = dq.dqueue.Get(dq.Size() - 1)\n\tdq.dqueue.Remove(dq.Size() - 1)\n\treturn\n}", "func (q *Deque) PopBack() {\n\tif !q.Empty() {\n\t\tq.back--\n\t\tq.size--\n\t}\n}" ]
[ "0.73889446", "0.73520863", "0.72440827", "0.71636087", "0.7075435", "0.70495015", "0.70082504", "0.690439", "0.6894261", "0.68445814", "0.6808763", "0.68054265", "0.67383736", "0.6700968", "0.6625754", "0.6516626", "0.6513098", "0.64480716", "0.64277995", "0.6416602", "0.6414185", "0.63791746", "0.63726777", "0.63623774", "0.6295953", "0.6281543", "0.6250626", "0.62421775", "0.6229291", "0.6228162", "0.62236094", "0.6204408", "0.61953515", "0.6161537", "0.6156814", "0.6154732", "0.6131632", "0.6116582", "0.61126244", "0.6111101", "0.6097144", "0.6069854", "0.60631037", "0.60539705", "0.60539705", "0.6050456", "0.6044805", "0.604297", "0.60411733", "0.6028101", "0.60209066", "0.6001665", "0.6001665", "0.599484", "0.59872466", "0.59467626", "0.5946348", "0.59395415", "0.593345", "0.5928711", "0.59242576", "0.5918802", "0.5897773", "0.58935106", "0.58809996", "0.5879306", "0.5868441", "0.58608097", "0.5854186", "0.58533925", "0.5849338", "0.5846542", "0.5838917", "0.5838917", "0.58346593", "0.582569", "0.58109844", "0.57969475", "0.5793469", "0.57927066", "0.5769504", "0.5767664", "0.575373", "0.5748382", "0.5748043", "0.57399195", "0.5738443", "0.5731204", "0.57291776", "0.57232827", "0.57192075", "0.57094884", "0.5706956", "0.57056284", "0.5700252", "0.5675459", "0.5673794", "0.5673279", "0.56711775", "0.5664428" ]
0.86026084
0
IterAt returns an iterator of the deque with the position pos
func (d *Deque[T]) IterAt(pos int) *DequeIterator[T] { return &DequeIterator[T]{dq: d, position: pos} }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (iter *SliceIterator) IteratorAt(position int) iterator.RandomAccessIterator {\n\treturn &SliceIterator{s: iter.s, position: position}\n}", "func (v *TextView) GetIterAtPosition(x, y int) (*TextIter, int) {\n\tvar iter C.GtkTextIter\n\tvar trailing C.gint\n\tC.gtk_text_view_get_iter_at_position(v.native(), &iter, &trailing, C.gint(x), C.gint(y))\n\treturn (*TextIter)(&iter), int(trailing)\n}", "func (q *Deque) At(idx int) interface{} {\n\tif idx >= len(q.values) {\n\t\treturn nil\n\t}\n\tactualIdx := idx\n\tif q.front != 0 {\n\t\tactualIdx = (idx + q.front) % cap(q.values)\n\t}\n\treturn q.values[actualIdx]\n}", "func (c *cur) meetPos(itPos journal.IteratorPosition) {\n\tif itPos == cUnkownIteratorPos || len(c.its) == 1 {\n\t\treturn\n\t}\n\n\tfor i := 0; i < len(c.its) && !c.it.End(); i++ {\n\t\tc.it.Get(nil)\n\t\tif c.getCurIteratorPosition() == itPos {\n\t\t\treturn\n\t\t}\n\t\tc.it.Next()\n\t}\n}", "func (d *Deque[T]) At(pos int) T {\n\tif pos < 0 || pos >= d.Size() {\n\t\tpanic(\"out off range\")\n\t}\n\tseg, pos := d.pos(pos)\n\treturn d.segmentAt(seg).at(pos)\n}", "func (itr *DequeIterator) Next() common.Iterator {\n\tswitch itr.direction {\n\tcase BACKWARD:\n\t\treturn itr.moveToPrev()\n\tcase FORWARD:\n\t\treturn itr.moveToNext()\n\t}\n\n\treturn itr\n}", "func (w *Window) Iterator(offset int, count int) Iterator {\n\treturn Iterator{\n\t\tcount: count,\n\t\tcur: &w.window[offset],\n\t}\n}", "func (q Deque) At(i int) E {\r\n\tif i < len(q.l) {\r\n\t\treturn q.l[len(q.l)-1-i]\r\n\t}\r\n\treturn q.r[i-len(q.l)]\r\n}", "func (q Deque) At(i int) D {\r\n\tif i < len(q.l) {\r\n\t\treturn q.l[len(q.l)-1-i]\r\n\t}\r\n\treturn q.r[i-len(q.l)]\r\n}", "func (q Deque) At(i int) D {\r\n\tif i < len(q.l) {\r\n\t\treturn q.l[len(q.l)-1-i]\r\n\t}\r\n\treturn q.r[i-len(q.l)]\r\n}", "func (iter *Iterator) Position() uint64 { return iter.impl.Value() }", "func (q *Deque) Begin() common.Iterator {\n\titr := new(DequeIterator)\n\titr.index = 0\n\titr.direction = FORWARD\n\titr.deque = q\n\treturn itr\n}", "func (itr *LimitIterator) Seek(rowID, columnID uint64) { itr.itr.Seek(rowID, columnID) }", "func (iter *SliceIterator) Position() int {\n\treturn iter.position\n}", "func (m *NoGrowMap) iteratorPos() int {\n\treturn m.Size - len(m.Iterator)\n}", "func (iter *SliceIterator) Next() iterator.ConstIterator {\n\tif iter.position < iter.s.Len() {\n\t\titer.position++\n\t}\n\treturn iter\n}", "func (it *Iterator) Seek(bs []byte) {\n\titm := it.snap.db.newItem(bs, false)\n\tit.iter.Seek(unsafe.Pointer(itm))\n\tit.skipUnwanted()\n}", "func (f *finder) At(ctx context.Context, at int64, _ uint64) (ch swarm.Chunk, current, next feeds.Index, err error) {\n\tfor i := uint64(0); ; i++ {\n\t\tu, err := f.getter.Get(ctx, &index{i})\n\t\tif err != nil {\n\t\t\tif !errors.Is(err, storage.ErrNotFound) {\n\t\t\t\treturn nil, nil, nil, err\n\t\t\t}\n\t\t\tif i > 0 {\n\t\t\t\tcurrent = &index{i - 1}\n\t\t\t}\n\t\t\treturn ch, current, &index{i}, nil\n\t\t}\n\t\tts, err := feeds.UpdatedAt(u)\n\t\tif err != nil {\n\t\t\treturn nil, nil, nil, err\n\t\t}\n\t\t// if index is later than the `at` target index, then return previous chunk and index\n\t\tif ts > uint64(at) {\n\t\t\treturn ch, &index{i - 1}, &index{i}, nil\n\t\t}\n\t\tch = u\n\t}\n}", "func (f *finder) At(ctx context.Context, at, after int64) (ch swarm.Chunk, current, next feeds.Index, err error) {\n\tfor i := uint64(0); ; i++ {\n\t\tu, err := f.getter.Get(ctx, &index{i})\n\t\tif err != nil {\n\t\t\tif !errors.Is(err, storage.ErrNotFound) {\n\t\t\t\treturn nil, nil, nil, err\n\t\t\t}\n\t\t\treturn ch, &index{i - 1}, &index{i}, nil\n\t\t}\n\t\tts, err := feeds.UpdatedAt(u)\n\t\tif err != nil {\n\t\t\treturn nil, nil, nil, err\n\t\t}\n\t\tif ts > uint64(at) {\n\t\t\treturn ch, &index{i}, nil, nil\n\t\t}\n\t\tch = u\n\t}\n}", "func (it *MockIndexTree) Iterator(start, end []byte) Iterator {\n\titer := &ForwardIter{start: start, end: end}\n\tif bytes.Compare(start, end) >= 0 {\n\t\titer.err = io.EOF\n\t\treturn iter\n\t}\n\titer.enumerator, _ = it.bt.Seek(start)\n\titer.Next() //fill key, value, err\n\treturn iter\n}", "func (d *Deque[T]) Begin() *DequeIterator[T] {\n\treturn d.First()\n}", "func (it *Iterator) Seek(target interface{}) {\n\tit.listIter.Seek(target)\n}", "func (iter *Iterator) SetPosition(pos uint64) { iter.impl.SetValue(pos) }", "func (it iterator) index(b *ringBuf) uint64 {\n\treturn b.buf[it].Index\n}", "func (c *index) Seek(sc *stmtctx.StatementContext, r kv.Retriever, indexedValues []types.Datum) (iter table.IndexIterator, hit bool, err error) {\n\tkey, _, err := c.GenIndexKey(sc, indexedValues, 0, nil)\n\tif err != nil {\n\t\treturn nil, false, err\n\t}\n\n\tupperBound := c.prefix.PrefixNext()\n\tit, err := r.Iter(key, upperBound)\n\tif err != nil {\n\t\treturn nil, false, err\n\t}\n\t// check if hit\n\thit = false\n\tif it.Valid() && it.Key().Cmp(key) == 0 {\n\t\thit = true\n\t}\n\treturn &indexIter{it: it, idx: c, prefix: c.prefix}, hit, nil\n}", "func (i *Iter) Pos() int {\n\treturn i.p\n}", "func (it *KeyAccess_Iterator) Seek(target interface{}) {\n\tit.list.mu.RLock()\n\tdefer it.list.mu.RUnlock()\n\n\tit.node, _ = it.list.findGreaterOrEqual(target)\n}", "func (cur *sequenceCursor) iter(cb cursorIterCallback) {\n\tfor cur.valid() && !cb(cur.getItem(cur.idx)) {\n\t\tcur.advance()\n\t}\n}", "func (v *TextView) GetIterAtLocation(x, y int) *TextIter {\n\tvar iter C.GtkTextIter\n\tC.gtk_text_view_get_iter_at_location(v.native(), &iter, C.gint(x), C.gint(y))\n\treturn (*TextIter)(&iter)\n}", "func (iter *Iterator) Index() uint64 { return iter.impl.Index() }", "func (q *memQueue) Iter(fn func(int, []byte) bool) error {\n\tq.mu.Lock()\n\tdefer q.mu.Unlock()\n\n\tfor i, item := range q.q {\n\t\tif fn(i, item) {\n\t\t\tbreak\n\t\t}\n\t}\n\n\treturn nil\n}", "func (itr *SliceIterator) Seek(bseek, pseek uint64) {\n\tfor i := 0; i < itr.n; i++ {\n\t\trowID := itr.rowIDs[i]\n\t\tcolumnID := itr.columnIDs[i]\n\n\t\tif (bseek == rowID && pseek <= columnID) || bseek < rowID {\n\t\t\titr.i = i\n\t\t\treturn\n\t\t}\n\t}\n\n\t// Seek to the end of the slice if all values are less than seek pair.\n\titr.i = itr.n\n}", "func (c *Client) Iter(topic string, position int64) <-chan Event {\n\tch := make(chan Event)\n\tgo func() {\n\t\tclient := NewStreamerClient(c.conn)\n\t\tctx := addTokenToContext(context.Background(), c.Token)\n\t\tstream, err := client.GetStream(ctx, &Topic{Name: topic, Position: position})\n\t\tif err != nil {\n\t\t\treturn\n\t\t}\n\t\tfor {\n\t\t\tevent, err := stream.Recv()\n\t\t\tif err != nil {\n\t\t\t\tbreak\n\t\t\t}\n\t\t\tch <- *event\n\t\t}\n\t}()\n\treturn ch\n}", "func (ki *Iterator) At() frames.Frame {\n\treturn ki.currFrame\n}", "func (i *CollectionIterator) Seek(id string) {\n\ti.badgerIter.Seek(i.c.buildDBKey(id))\n}", "func (s *SkipList) Seek(key interface{}) Iterator {\n\tcurrent := s.getPath(s.header, nil, key)\n\tif current == nil {\n\t\treturn nil\n\t}\n\n\treturn &iter{\n\t\tcurrent: current,\n\t\tkey: current.key,\n\t\tvalue: current.value,\n\t\tlist: s,\n\t}\n}", "func (buf *ListBuffer) Incr(idx BufferIndex) BufferIndex {\n\tif idx == NilIndex {\n\t\treturn NilIndex\n\t} \n\treturn buf.Buffer[idx].Next\n}", "func (q *memQueue) position(datum []byte) (pos int, err error) {\n\tfor pos, candidate := range q.q {\n\t\tif bytes.Equal(candidate, datum) {\n\t\t\treturn pos, nil\n\t\t}\n\t}\n\n\treturn -1, nil\n}", "func newCursorAtIndex(seq sequence, idx uint64) *sequenceCursor {\n\tvar cur *sequenceCursor\n\tfor {\n\t\tcur = newSequenceCursor(cur, seq, 0)\n\t\tidx = idx - advanceCursorToOffset(cur, idx)\n\t\tcs := cur.getChildSequence()\n\t\tif cs == nil {\n\t\t\tbreak\n\t\t}\n\t\tseq = cs\n\t}\n\td.PanicIfTrue(cur == nil)\n\treturn cur\n}", "func (it *emptyIterator) Seek(t int64) chunkenc.ValueType { return chunkenc.ValNone }", "func (iter *radixIterator) Seek(key []byte) {\n\tresIter, err := iter.miTxn.LowerBound(key)\n\tif err != nil {\n\t\titer.err = err\n\t\treturn\n\t}\n\titer.resIter = resIter\n\titer.isReverser = false\n\titer.Next()\n}", "func (seq *Sequence) At(i int) Node { return seq.Nodes[i] }", "func (s *Iterator) Iterator() engine.Iterator {\n\treturn s.i\n}", "func (q *Deque) Rbegin() common.Iterator {\n\titr := new(DequeIterator)\n\titr.index = q.Size() - 1\n\titr.direction = BACKWARD\n\titr.deque = q\n\treturn itr\n}", "func (q *Deque) End() common.Iterator {\n\treturn q.endItr\n}", "func (e Department) Iterator(s ent.Storage) ent.EntIterator { return s.IterateEnts(&e) }", "func (it *Skip_Iterator) Seek(target interface{}) {\n\tit.list.mu.RLock()\n\tdefer it.list.mu.RUnlock()\n\n\tit.node, _ = it.list.findGreaterOrEqual(target)\n}", "func (it *emptyIterator) At() (int64, float64) { return 0, 0 }", "func Seek[K ~[]byte, O Ordering[K]](ctx context.Context, cur *cursor, key K, order O) (err error) {\n\tinBounds := true\n\tif cur.parent != nil {\n\t\tinBounds = inBounds && order.Compare(key, K(cur.firstKey())) >= 0\n\t\tinBounds = inBounds && order.Compare(key, K(cur.lastKey())) <= 0\n\t}\n\n\tif !inBounds {\n\t\t// |item| is outside the bounds of |cur.nd|, search up the tree\n\t\terr = Seek(ctx, cur.parent, key, order)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\t// stay in bounds for internal nodes\n\t\tcur.parent.keepInBounds()\n\n\t\tcur.nd, err = fetchChild(ctx, cur.nrw, cur.parent.currentRef())\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tcur.idx = searchForKey(key, order)(cur.nd)\n\n\treturn\n}", "func (t *Tensor) ItemAt(pos ...int) *Tensor {\n\tif !t.idx.Validate(pos) {\n\t\tpanic(errorc.New(\"invalid position %v for %v\", pos, t.idx))\n\t}\n\n\treturn &Tensor{\n\t\tidx: t.idx.Scalar(pos),\n\t\tbuf: t.buf,\n\t}\n}", "func PositionGTE(v int) predicate.QueueItem {\n\treturn predicate.QueueItem(func(s *sql.Selector) {\n\t\ts.Where(sql.GTE(s.C(FieldPosition), v))\n\t})\n}", "func (sl *Slice) ElemFromEnd(idx int) Ki {\n\treturn (*sl)[len(*sl)-1-idx]\n}", "func (d *Deque[T]) EraseAt(pos int) {\n\tif pos < 0 || pos >= d.size {\n\t\treturn\n\t}\n\tseg, pos := d.pos(pos)\n\td.segmentAt(seg).eraseAt(pos)\n\tif seg < d.size-seg-1 {\n\t\tfor i := seg; i > 0; i-- {\n\t\t\tcur := d.segmentAt(i)\n\t\t\tpre := d.segmentAt(i - 1)\n\t\t\tcur.pushFront(pre.popBack())\n\t\t}\n\t\tif d.firstSegment().empty() {\n\t\t\td.putToPool(d.firstSegment())\n\t\t\td.segs[d.begin] = nil\n\t\t\td.begin = d.nextIndex(d.begin)\n\t\t\td.shrinkIfNeeded()\n\t\t}\n\t} else {\n\t\tfor i := seg; i < d.segUsed()-1; i++ {\n\t\t\tcur := d.segmentAt(i)\n\t\t\tnext := d.segmentAt(i + 1)\n\t\t\tcur.pushBack(next.popFront())\n\t\t}\n\t\tif d.lastSegment().empty() {\n\t\t\td.putToPool(d.lastSegment())\n\t\t\td.segs[d.preIndex(d.end)] = nil\n\t\t\td.end = d.preIndex(d.end)\n\t\t\td.shrinkIfNeeded()\n\t\t}\n\t}\n\td.size--\n}", "func (i *IndexReader) Seek(key []byte) (*IndexIterator, error) {\n\tcksum := checksum(key)\n\ttbuf := make([]byte, 12)\n\n\toffset, nslots, err := i.seekBucket(cksum.Bucket(), tbuf)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\titer := &IndexIterator{\n\t\tsrc: i.file,\n\t\tcksum: cksum,\n\t\toffset: offset,\n\t\tnslots: nslots,\n\t\ttbuf: tbuf,\n\t}\n\tif nslots > 0 {\n\t\titer.cursor = cksum.Slot() % nslots\n\t}\n\treturn iter, nil\n}", "func (db *TriasDB) Iterator(start, end []byte) Iterator {\n\treturn db.MakeIterator(start, end, false)\n}", "func (d *BoltDatabase) Seek(bucket []byte, prefix string, callback callBack) error {\n\treturn d.db.View(func(tx *bolt.Tx) error {\n\t\tc := tx.Bucket(bucket).Cursor()\n\t\tbytePrefix := []byte(prefix)\n\t\tfor k, v := c.Seek(bytePrefix); k != nil && bytes.HasPrefix(k, bytePrefix); k, v = c.Next() {\n\t\t\tcallback(k, v)\n\t\t}\n\t\treturn nil\n\t})\n}", "func (d *Deque[T]) Set(pos int, val T) error {\n\tif pos < 0 || pos >= d.size {\n\t\treturn ErrOutOfRange\n\t}\n\tseg, pos := d.pos(pos)\n\td.segmentAt(seg).set(pos, val)\n\treturn nil\n}", "func (m *MergeIterator) Seek(key []byte) error {\n\tfor i := range m.itrs {\n\t\terr := m.itrs[i].Seek(key)\n\t\tif err != nil && err != ErrIteratorDone {\n\t\t\treturn err\n\t\t}\n\t}\n\tm.updateMatches()\n\tif m.lowK == nil {\n\t\treturn ErrIteratorDone\n\t}\n\treturn nil\n}", "func (i *OrderedItems) Iter() <-chan OrderedItem {\n\tch := make(chan OrderedItem)\n\tgo func() {\n\t\tdefer close(ch)\n\t\tfor index, key := range i.KeySlice {\n\t\t\tval, ok := i.OrderedItems[key]\n\t\t\tif ok {\n\t\t\t\tch <- OrderedItem{index, key, val}\n\t\t\t}\n\t\t}\n\t}()\n\treturn ch\n}", "func (c *Collection) GetIterator() *CollectionIterator {\n\titer := c.getIterator(false)\n\titer.badgerIter.Seek(iter.colPrefix)\n\treturn iter\n}", "func (s SliceIter) Peek() interface{} {\n\tval := reflect.ValueOf(s.slice)\n\treturn val.Index(0).Interface()\n}", "func (d *Deque[T]) End() *DequeIterator[T] {\n\treturn d.IterAt(d.Size())\n}", "func (s *SinglyLinkedList) GetAtPos(index int) *Node {\n currentNode := s.front\n count := 0\n for count < index && currentNode != nil && currentNode.next != nil {\n currentNode = currentNode.next\n count++\n }\n\n if count == index {\n return currentNode\n } else {\n return nil\n }\n}", "func (r *Rope) Index(at int) rune {\n\ts := skiplist{r: r}\n\tvar k *knot\n\tvar offset int\n\tvar err error\n\n\tif k, offset, _, err = s.find(at); err != nil {\n\t\treturn -1\n\t}\n\tif offset == BucketSize {\n\t\tchar, _ := utf8.DecodeRune(k.nexts[0].data[0:])\n\t\treturn char\n\t}\n\tchar, _ := utf8.DecodeRune(k.data[offset:])\n\treturn char\n}", "func (s *Scanner) pos() Pos {\n\treturn s.bufpos[s.bufi]\n}", "func (this *Tuple) Index(item interface{}, start int) int {\n\tfor i := start; i < this.Len(); i++ {\n\t\tif TupleElemEq(this.Get(i), item) {\n\t\t\treturn i\n\t\t}\n\t}\n\treturn -1\n}", "func (q *UniqueQueue) inc(idx int) int {\n\treturn (idx + 1) % (q.maxDepth + 1)\n}", "func (l *DcmList) Seek(pos E_ListPos) *DcmObject {\n\tswitch pos {\n\tcase ELP_first:\n\t\tl.currentNode = l.firstNode\n\tcase ELP_last:\n\t\tl.currentNode = l.lastNode\n\tcase ELP_prev:\n\t\tif l.Valid() {\n\t\t\tl.currentNode = l.currentNode.prevNode\n\t\t}\n\tcase ELP_next:\n\t\tif l.Valid() {\n\t\t\tl.currentNode = l.currentNode.nextNode\n\t\t}\n\n\t}\n\tif l.Valid() {\n\t\treturn l.currentNode.Value()\n\t} else {\n\t\treturn nil\n\t}\n}", "func (d *DB) Iterator(start Bytes, end Bytes) (ret *Iterator) {\n\tif len(start) == 0 {\n\t\tstart = nil\n\t}\n\tif len(end) == 0 {\n\t\tend = nil\n\t}\n\tvar iopt opt.ReadOptions\n\tiopt.DontFillCache = true\n\tit := d.db.NewIterator(&util.Range{Start: start, Limit: end}, &iopt)\n\treturn NewIterator(it, FORWARD)\n}", "func (l *DcmList) Seek_to(absolute_position uint32) *DcmObject {\n\tvar tmppos uint32\n\tif absolute_position < l.cardinality {\n\t\ttmppos = absolute_position\n\t} else {\n\t\ttmppos = l.cardinality\n\t}\n\tl.Seek(ELP_first)\n\n\tfor i := uint32(0); i < tmppos; i++ {\n\t\tl.Seek(ELP_next)\n\t}\n\treturn l.Get(ELP_atpos)\n}", "func (itr *DequeIterator) Value() interface{} {\n\treturn itr.deque.At(itr.index)\n}", "func (s *Iterator) Seek(key engine.MVCCKey) {\n\ts.err = s.spans.CheckAllowed(SpanReadOnly, roachpb.Span{Key: key.Key})\n\tif s.err == nil {\n\t\ts.invalid = false\n\t}\n\ts.i.Seek(key)\n}", "func (d *Dtrie) Iterator(stop <-chan struct{}) <-chan Entry {\n\treturn iterate(d.root, stop)\n}", "func (r Range) iterate(fn func(*buffer.View)) {\n\tr.pk.buf.SubApply(r.offset, r.length, fn)\n}", "func (c *indexIter) Next() (val []types.Datum, h int64, err error) {\n\tif !c.it.Valid() {\n\t\treturn nil, 0, errors.Trace(io.EOF)\n\t}\n\tif !c.it.Key().HasPrefix(c.prefix) {\n\t\treturn nil, 0, errors.Trace(io.EOF)\n\t}\n\t// get indexedValues\n\tbuf := c.it.Key()[len(c.prefix):]\n\tvv, err := codec.Decode(buf, len(c.idx.idxInfo.Columns))\n\tif err != nil {\n\t\treturn nil, 0, err\n\t}\n\tif len(vv) > len(c.idx.idxInfo.Columns) {\n\t\th = vv[len(vv)-1].GetInt64()\n\t\tval = vv[0 : len(vv)-1]\n\t} else {\n\t\t// If the index is unique and the value isn't nil, the handle is in value.\n\t\th, err = DecodeHandle(c.it.Value())\n\t\tif err != nil {\n\t\t\treturn nil, 0, err\n\t\t}\n\t\tval = vv\n\t}\n\t// update new iter to next\n\terr = c.it.Next()\n\tif err != nil {\n\t\treturn nil, 0, err\n\t}\n\treturn\n}", "func (nl *nodeList) at(i int) *Node {\n\tif i > len(nl.elements) - 1 || i < 0 {\n\t\treturn nil\n\t}\n\n\treturn nl.elements[i]\n}", "func Position(v int) predicate.QueueItem {\n\treturn predicate.QueueItem(func(s *sql.Selector) {\n\t\ts.Where(sql.EQ(s.C(FieldPosition), v))\n\t})\n}", "func (tx *dbTxn) Iterator(start, end []byte) (db.Iterator, error) {\n\tif tx.btree == nil {\n\t\treturn nil, db.ErrTransactionClosed\n\t}\n\tif (start != nil && len(start) == 0) || (end != nil && len(end) == 0) {\n\t\treturn nil, db.ErrKeyEmpty\n\t}\n\treturn newMemDBIterator(tx, start, end, false), nil\n}", "func (itr *BufIterator) Seek(rowID, columnID uint64) {\n\titr.buf.full = false\n\titr.itr.Seek(rowID, columnID)\n}", "func (r *Root) ForEachAt(ctx context.Context, start uint64, cb func(uint64, *cbg.Deferred) error) error {\n\treturn r.node.forEachAt(ctx, r.store, r.bitWidth, r.height, start, 0, cb)\n}", "func (b *BamAt) Query(chrom string, start int, end int) (*bam.Iterator, error) {\n\tif chrom == \"\" { // stdin\n\t\treturn bam.NewIterator(b.Reader, nil)\n\t}\n\tref := b.Refs[chrom]\n\tif end <= 0 {\n\t\tend = ref.Len() - 1\n\t}\n\tchunks, err := b.idx.Chunks(ref, start, end)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn bam.NewIterator(b.Reader, chunks)\n}", "func (iter *SkipListIterator) Seek(key []byte) {\n\tif iter.cursor != nil {\n\t\tC.skiplist_release_node(iter.cursor)\n\t}\n\tcKey := byteToChar(key)\n\titer.cursor = C.kv_skiplist_find_ge(iter.sl.csl, cKey, C.size_t(len(key)))\n}", "func (list elemlist) At(index int) interface{} {\n\tvar foundItem interface{}\n\n\tif index < len(list.elements) {\n\t\tfoundItem = list.elements[index]\n\t}\n\n\treturn foundItem\n}", "func (iter *SliceIterator) Prev() iterator.ConstBidIterator {\n\tif iter.position >= 0 {\n\t\titer.position--\n\t}\n\treturn iter\n}", "func (p *pipeline) ContextAt(position int) HandlerContext {\n\n\tif -1 == position || position >= p.size {\n\t\treturn nil\n\t}\n\n\tcurNode := p.head\n\tfor i := 0; i < position; i++ {\n\t\tcurNode = curNode.next\n\t}\n\n\treturn curNode\n}", "func (iter *dbCacheIterator) Seek(key []byte) bool {\n\t// Seek to the provided key in both the database and cache iterators\n\t// then choose the iterator that is both valid and has the larger key.\n\titer.dbIter.Seek(key)\n\titer.cacheIter.Seek(key)\n\treturn iter.chooseIterator(true)\n}", "func (bb *ByteSliceBuffer) GetPos(pos uint64) ([]byte, bool) {\n\tif n, ok := bb.Buffer.TransPos(pos); ok {\n\t\treturn bb.data[n], true\n\t}\n\treturn nil, false\n}", "func (hq HtmlQ) Index(idx int) HtmlQ {\n\tif len(hq.nodes) <= idx {\n\t\treturn HtmlQ{nodes: nil}\n\t}\n\n\treturn HtmlQ{nodes: []*html.Node{hq.nodes[idx]}}\n}", "func (d *descendantQuery) position() int {\n\treturn d.posit\n}", "func (f *asyncFinder) At(ctx context.Context, at int64, after uint64) (ch swarm.Chunk, cur, next feeds.Index, err error) {\n\t// first lookup update at the 0 index\n\t// TODO: consider receive after as uint\n\tch, err = f.get(ctx, at, after)\n\tif err != nil {\n\t\treturn nil, nil, nil, err\n\t}\n\tif ch == nil {\n\t\treturn nil, nil, &index{after}, nil\n\t}\n\t// if chunk exists construct an initial interval with base=0\n\tc := make(chan *result)\n\ti := newInterval(0)\n\ti.found = &result{ch, nil, 0, 0}\n\n\tquit := make(chan struct{})\n\tdefer close(quit)\n\n\t// launch concurrent request at doubling intervals\n\tgo f.at(ctx, at, 0, i, c, quit)\n\tfor r := range c {\n\t\t// collect the results into the interval\n\t\ti = r.interval\n\t\tif r.chunk == nil {\n\t\t\tif i.notFound < r.level {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\ti.notFound = r.level - 1\n\t\t} else {\n\t\t\tif i.found.level > r.level {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\t// if a chunk is found on the max level, and this is already a subinterval\n\t\t\t// then found.index+1 is already known to be not found\n\t\t\tif i.level == r.level && r.level < DefaultLevels {\n\t\t\t\treturn r.chunk, &index{r.index}, &index{r.index + 1}, nil\n\t\t\t}\n\t\t\ti.found = r\n\t\t}\n\t\t// below applies even if i.latest==ceilingLevel in which case we just continue with\n\t\t// DefaultLevel lookaheads\n\t\tif i.found.level == i.notFound {\n\t\t\tif i.found.level == 0 {\n\t\t\t\treturn i.found.chunk, &index{i.found.index}, &index{i.found.index + 1}, nil\n\t\t\t}\n\t\t\tgo f.at(ctx, at, 0, i.next(), c, quit)\n\t\t}\n\t\t// inconsistent feed, retry\n\t\tif i.notFound < i.found.level {\n\t\t\tgo f.at(ctx, at, i.found.level, i.retry(), c, quit)\n\t\t}\n\t}\n\treturn nil, nil, nil, nil\n}", "func (s Scanner) peekAt(i int) byte {\n\tif s.reachedEnd() {\n\t\treturn '\\000'\n\t}\n\n\treturn s.source[s.current]\n}", "func (da *DataFrame) GetPos(j int) interface{} {\n\tif da.done {\n\t\treturn nil\n\t}\n\n\treturn da.data[j][da.chunk-1]\n}", "func (it *InvertingUintSliceIterator) Next() uint {\n\tif it.cur < 0 {\n\t\tpanic(\"iterator next: pointer out of range\")\n\t}\n\n\titem := it.slice[it.cur]\n\tit.cur--\n\treturn item\n}", "func (it *Iterator) SeekToFirst() {\n\tit.listIter.SeekToFirst()\n}", "func (itr *RoaringIterator) Seek(bseek, pseek uint64) {\n\titr.itr.Seek((bseek * SliceWidth) + pseek)\n}", "func exprAtPos(pos token.Pos, args []ast.Expr) int {\n\tfor i, expr := range args {\n\t\tif expr.Pos() <= pos && pos <= expr.End() {\n\t\t\treturn i\n\t\t}\n\t}\n\treturn len(args)\n}", "func (da *cedar) get(key []byte, from, pos int) *int {\n\tfor ; pos < len(key); pos++ {\n\t\tif value := da.Array[from].Value; value >= 0 && value != ValueLimit {\n\t\t\tto := da.follow(from, 0)\n\t\t\tda.Array[to].Value = value\n\t\t}\n\t\tfrom = da.follow(from, key[pos])\n\t}\n\tto := from\n\tif da.Array[from].Value < 0 {\n\t\tto = da.follow(from, 0)\n\t}\n\treturn &da.Array[to].Value\n}", "func (c *Cursor) Seek(seek []byte) (key, value []byte) {\n\tfor c.index = 0; c.index < len(c.items); c.index++ {\n\t\tif bytes.Compare(c.items[c.index].Key, seek) == -1 { // skip keys less than seek\n\t\t\tcontinue\n\t\t}\n\t\treturn c.items[c.index].Key, c.items[c.index].Value\n\t}\n\treturn nil, nil\n}", "func (cs *ConcurrentSlice) Iter() <-chan ConcurrentSliceItem {\n\tc := make(chan ConcurrentSliceItem)\n\tf := func() {\n\t\tcs.RLock()\n\t\tdefer cs.RUnlock()\n\t\tfor index, value := range cs.items {\n\t\t\tc <- ConcurrentSliceItem{index, value}\n\t\t}\n\t\tclose(c)\n\t}\n\tgo f()\n\n\treturn c\n}", "func (e *Enumerator) Next() (k []byte, v []byte, err error) {\n\tif err = e.err; err != nil {\n\t\treturn\n\t}\n\tif e.ver != e.t.ver {\n\t\tf, hit := e.t.Seek(e.k)\n\t\tif !e.hit && hit {\n\t\t\tif err = f.next(); err != nil {\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t\t*e = *f\n\t\tf.Close()\n\t}\n\tif e.q == nil {\n\t\te.err, err = io.EOF, io.EOF\n\t\treturn\n\t}\n\tif e.i >= e.q.c {\n\t\tif err = e.next(); err != nil {\n\t\t\treturn\n\t\t}\n\t}\n\ti := e.q.d[e.i]\n\tk, v = i.k, i.v\n\te.k, e.hit = k, false\n\te.next()\n\treturn\n}" ]
[ "0.64778525", "0.61315703", "0.6080677", "0.60114574", "0.5973995", "0.5951619", "0.58561814", "0.58078206", "0.57975596", "0.57975596", "0.57024676", "0.5682234", "0.56215674", "0.5594864", "0.55873626", "0.55696017", "0.5565471", "0.5454233", "0.542222", "0.5413355", "0.5396551", "0.53814965", "0.5343927", "0.5339677", "0.5323553", "0.53203475", "0.5320209", "0.5299409", "0.5287337", "0.5260653", "0.5238308", "0.5181387", "0.51789594", "0.5145671", "0.5129329", "0.5119878", "0.5110841", "0.5105013", "0.50802946", "0.5075788", "0.50708646", "0.5053847", "0.5027141", "0.50093734", "0.5000125", "0.49597654", "0.495753", "0.4935888", "0.49296412", "0.49281543", "0.49252775", "0.49176827", "0.49071857", "0.49016038", "0.48995185", "0.4898156", "0.48685592", "0.48675612", "0.48665163", "0.48640576", "0.48637894", "0.48530212", "0.48418", "0.48339394", "0.48220852", "0.48149565", "0.4807773", "0.47999766", "0.47960302", "0.47929725", "0.47905585", "0.47843745", "0.47752398", "0.47718954", "0.4764587", "0.47567284", "0.4749312", "0.47472683", "0.47452977", "0.47433797", "0.47397733", "0.4731637", "0.4730298", "0.47274712", "0.47269094", "0.47254112", "0.4720711", "0.47150224", "0.471374", "0.47054875", "0.46990997", "0.46949986", "0.46925864", "0.46909976", "0.46884897", "0.46806377", "0.46787637", "0.46673673", "0.4662219", "0.46600094" ]
0.85092175
0
Schemas is a function that returns a slice of string that contains the create sql syntax
func Schemas() []string { return []string{ ` CREATE TABLE IF NOT EXISTS users ( id bigint NOT NULL AUTO_INCREMENT, username varchar(16), email varchar(151), password varchar(255), user_type varchar(255), created_at bigint, updated_at bigint, deleted_at bigint, PRIMARY KEY (id) );`, ` CREATE TABLE IF NOT EXISTS posts ( id bigint NOT NULL AUTO_INCREMENT, creator_id bigint, post_title text, post_body text, created_at bigint, updated_at bigint, deleted_at bigint, PRIMARY KEY (id), FOREIGN KEY (creator_id) REFERENCES users(id) );`, } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func createTableSchema(cols []string, colTypes []*sql.ColumnType) string {\n\tvar (\n\t\tfields = make([]string, len(cols))\n\t\ttyp = \"\"\n\t)\n\tfor i := 0; i < len(cols); i++ {\n\t\tswitch colTypes[i].DatabaseTypeName() {\n\t\tcase \"INT2\", \"INT4\", \"INT8\", // Postgres\n\t\t\t\"TINYINT\", \"SMALLINT\", \"INT\", \"MEDIUMINT\", \"BIGINT\": // MySQL\n\t\t\ttyp = \"INTEGER\"\n\t\tcase \"FLOAT4\", \"FLOAT8\", // Postgres\n\t\t\t\"DECIMAL\", \"FLOAT\", \"DOUBLE\", \"NUMERIC\": // MySQL\n\t\t\ttyp = \"REAL\"\n\t\tdefault:\n\t\t\ttyp = \"TEXT\"\n\t\t}\n\n\t\tif nullable, ok := colTypes[i].Nullable(); ok && !nullable {\n\t\t\ttyp += \" NOT NULL\"\n\t\t}\n\n\t\tfields[i] = \"`\" + cols[i] + \"`\" + \" \" + typ\n\t}\n\n\treturn \"DROP TABLE IF EXISTS `%s`; CREATE TABLE IF NOT EXISTS `%s` (\" + strings.Join(fields, \",\") + \");\"\n}", "func createSchema(connection *sql.DB) error {\n\t_, err := connection.Exec(SCHEMA)\n\n\treturn err\n}", "func (ps *pgSchema) Statement() string {\n\treturn fmt.Sprintf(\"\"+\n\t\t\"--\\n\"+\n\t\t\"-- Schema structure for %s\\n\"+\n\t\t\"--\\n\"+\n\t\t\"CREATE SCHEMA %s;\\n\\n\", ps.name, ps.name)\n}", "func (p *Person) GetSchema() string {\n\treturn `CREATE TABLE person (\n\t\t\t\t\t\t\t\t\t\tfirst_name text,\n\t\t\t\t\t\t\t\t\t\tlast_name text,\n\t\t\t\t\t\t\t\t\t\tsex bool\n\t\t\t\t\t\t\t);`\n}", "func schema(filename string, db *sql.DB) error {\n\tlog.Println(*dir + \"/\" + filename)\n\n\tout, err := exec.Command(\"mdb-schema\", *dir+\"/\"+filename, \"sqlite\").Output()\n\tif err != nil {\n\n\t\tlog.Print(\"Could not execute the command mdb-schema: \", err)\n\n\t\treturn err\n\n\t}\n\tqueries := strings.Split(string(out), \";\")\n\n\tfor _, query := range queries {\n\n\t\t_, err := db.Exec(query + \";\")\n\n\t\tif err != nil {\n\t\t\tlog.Printf(\"Could not execute the query transaction: %v\", err)\n\t\t\treturn err\n\n\t\t}\n\n\t}\n\n\treturn nil\n\n}", "func (s *Schema) CreateStatement() string {\n\tvar charSet, collate string\n\tif s.CharSet != \"\" {\n\t\tcharSet = fmt.Sprintf(\" CHARACTER SET %s\", s.CharSet)\n\t}\n\tif s.Collation != \"\" {\n\t\tcollate = fmt.Sprintf(\" COLLATE %s\", s.Collation)\n\t}\n\treturn fmt.Sprintf(\"CREATE DATABASE %s%s%s\", EscapeIdentifier(s.Name), charSet, collate)\n}", "func (db *DB) CreateSchema() error {\n\tfor _, schema := range schemas {\n\t\tsql, err := data.Asset(schema)\n\t\tif err != nil {\n\t\t\treturn errors.Wrapf(err, \"get schema error: %v\", schema)\n\t\t}\n\t\t_, err = db.Exec(fmt.Sprintf(\"%s\", sql))\n\t\tif err != nil {\n\t\t\treturn errors.Wrapf(err, \"exec schema error: %s\", sql)\n\t\t}\n\t}\n\treturn nil\n}", "func CreateSchemas() error {\n\tdb := GetConnect()\n\tdefer db.Close()\n\tfor _, model := range []interface{}{\n\t\t(*Userr)(nil),\n\t\t(*Character)(nil),\n\t\t(*Race)(nil),\n\t\t(*Advantage)(nil),\n\t\t(*Disadvantage)(nil),\n\t\t(*Expertise)(nil),\n\t\t(*Spell)(nil),\n\t\t(*History)(nil),\n\t\t(*Report)(nil),\n\t\t(*CharacterAdvantage)(nil),\n\t\t(*CharacterDisadvantage)(nil),\n\t\t(*CharacterExpertise)(nil),\n\t\t(*CharacterSpell)(nil),\n\t\t(*RaceAdvantage)(nil),\n\t\t(*RaceDisadvantage)(nil),\n\t\t(*RaceExpertise)(nil),\n\t\t(*Rpg)(nil),\n\t} {\n\t\terr := db.CreateTable(model, &orm.CreateTableOptions{\n\t\t\tTemp: false,\n\t\t\tFKConstraints: true,\n\t\t})\n\t\tif err != nil {\n\t\t\tfmt.Println(err)\n\t\t\treturn err\n\t\t}\n\t}\n\n\trpg := []interface{}{\n\t\t&Rpg{ID: 1, Style: \"3D&T\"},\n\t}\n\n\tfor _, v := range rpg {\n\t\terr := db.Insert(v)\n\t\tif err != nil {\n\t\t\tfmt.Println(err)\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn nil\n}", "func (sb *SchemaBuilder) Create() string {\n\tq := strings.Builder{}\n\tq.WriteString(`CREATE`)\n\n\tif sb.transient {\n\t\tq.WriteString(` TRANSIENT`)\n\t}\n\n\tq.WriteString(fmt.Sprintf(` SCHEMA %v`, sb.QualifiedName()))\n\n\tif sb.managedAccess {\n\t\tq.WriteString(` WITH MANAGED ACCESS`)\n\t}\n\n\tif sb.setDataRetentionDays {\n\t\tq.WriteString(fmt.Sprintf(` DATA_RETENTION_TIME_IN_DAYS = %d`, sb.dataRetentionDays))\n\t}\n\n\tif sb.comment != \"\" {\n\t\tq.WriteString(fmt.Sprintf(` COMMENT = '%v'`, EscapeString(sb.comment)))\n\t}\n\n\treturn q.String()\n}", "func (b MysqlBackend) CreateSchema(db *sql.DB) {\n\tstatement, _ := db.Prepare(`\nCREATE TABLE IF NOT EXISTS users (\n\tid INTEGER AUTO_INCREMENT PRIMARY KEY,\n\tname VARCHAR(64) NOT NULL,\n\tunixid INTEGER NOT NULL,\n\tprimarygroup INTEGER NOT NULL,\n\tothergroups VARCHAR(1024) DEFAULT '',\n\tgivenname VARCHAR(64) DEFAULT '',\n\tsn VARCHAR(64) DEFAULT '',\n\tmail VARCHAR(254) DEFAULT '',\n\tloginshell VARCHAR(64) DEFAULT '',\n\thomedirectory VARCHAR(64) DEFAULT '',\n\tdisabled SMALLINT DEFAULT 0,\n\tpasssha256 VARCHAR(64) DEFAULT '',\n\totpsecret VARCHAR(64) DEFAULT '',\n\tyubikey VARCHAR(128) DEFAULT '')\n`)\n\tstatement.Exec()\n\tstatement, _ = db.Prepare(\"CREATE UNIQUE INDEX idx_user_name on users(name)\")\n\tstatement.Exec()\n\tstatement, _ = db.Prepare(\"CREATE TABLE IF NOT EXISTS groups (id INTEGER AUTO_INCREMENT PRIMARY KEY, name VARCHAR(64) NOT NULL, unixid INTEGER NOT NULL)\")\n\tstatement.Exec()\n\tstatement, _ = db.Prepare(\"CREATE UNIQUE INDEX idx_group_name on groups(name)\")\n\tstatement.Exec()\n\tstatement, _ = db.Prepare(\"CREATE TABLE IF NOT EXISTS includegroups (id INTEGER AUTO_INCREMENT PRIMARY KEY, parentgroupid INTEGER NOT NULL, includegroupid INTEGER NOT NULL)\")\n\tstatement.Exec()\n}", "func (ts *STableSpec) CreateSQLs() []string {\n\treturn ts.Database().backend.GetCreateSQLs(ts)\n}", "func Schema() string {\n\n\t/**\n\tDROP DATABASE users;\n\tDROP DATABASE token;\n\t*/\n\treturn `\n\n\tCREATE TABLE IF NOT EXISTS users (\n\t\tid SERIAL UNIQUE,\n\t\tusername text,\n\t\temail text UNIQUE,\n\t\tpassword text,\n\t\tsecureLevel text DEFAULT 'user',\n\t\tpathfile text,\n\t\tcreated_at TIMESTAMP NOT NULL DEFAULT CURRENT_DATE\n\t\tupdated_at TIMESTAMP NOT NULL DEFAULT CURRENT_DATE\n\t);\n\n\tCREATE TABLE IF NOT EXISTS token (\n\t\ttoken text NOT NULL PRIMARY KEY,\n\t\tis_revoked bool DEFAULT FALSE,\n\t\tuser_id INTEGER REFERENCES users(id) NOT NULL,\n\t\tcreated_at TIMESTAMP NOT NULL DEFAULT CURRENT_DATE\n\t\tupdated_at TIMESTAMP NOT NULL DEFAULT CURRENT_DATE\n\t);\n\n\tCREATE TABLE IF NOT EXISTS notification (\n\t\ttokenNotification text NOT NULL PRIMARY KEY,\n\t\tuser_id INTEGER REFERENCES users(id) NOT NULL,\n\t\tcreated_at TIMESTAMP NOT NULL DEFAULT CURRENT_DATE\n\t\tupdated_at TIMESTAMP NOT NULL DEFAULT CURRENT_DATE\n\t);\n\n\tCREATE TABLE IF NOT EXISTS dataNotification (\n\t\tid SERIAL UNIQUE,\n\t\tuser_id INTEGER REFERENCES users(id) NOT NULL,\n\t\ttitle text,\n\t\tbody text,\n\t\tcreated_at TIMESTAMP NOT NULL DEFAULT CURRENT_DATE\n\t\tupdated_at TIMESTAMP NOT NULL DEFAULT CURRENT_DATE\n\t);\n\n\tCREATE TABLE IF NOT EXISTS email (\n\t\tid SERIAL UNIQUE,\n\t\tuser_id INTEGER REFERENCES users(id) NOT NULL,\n\t\tto text,\n\t\tmsg text,\n\t\tcreated_at TIMESTAMP NOT NULL DEFAULT CURRENT_DATE\n\t\tupdated_at TIMESTAMP NOT NULL DEFAULT CURRENT_DATE\n\t);\n\n\tCREATE TABLE IF NOT EXISTS dataHistory (\n\t\tid SERIAL UNIQUE,\n\t\ttotalUserCount INTEGER DEFAULT 0,\n\t\tuserCount INTEGER DEFAULT 0,\n\t\tnotificationCount INTEGER DEFAULT 0,\n\t\temailCount INTEGER DEFAULT 0,\n\t\tcreated_at TIMESTAMP NOT NULL DEFAULT CURRENT_DATE\n\t\tupdated_at TIMESTAMP NOT NULL DEFAULT CURRENT_DATE\n\t);\n\n\t`\n\n}", "func generateInsert(s Schema) (string, error) {\n\t// form variable parts of statement\n\tabbrev := s.Name[0:1]\n\tattributes := s.Columns[0].Name\n\tsqlParameters := \"$1\"\n\tparameters := fmt.Sprintf(\n\t\t\"%s.%s,\\n\",\n\t\tabbrev,\n\t\tfmt.Sprintf(s.Columns[0].DataType.fn, s.Columns[0].Attr),\n\t)\n\tfor i, c := range s.Columns[1:] {\n\t\tattributes += fmt.Sprintf(\", %s\", c.Name)\n\t\t// offset 1 for sql, another 1 for starting on the 2nd elem\n\t\tsqlParameters += fmt.Sprintf(\", $%d\", i+2)\n\t\tparameters += fmt.Sprintf(c.DataType.fn, fmt.Sprintf(\"%s.%s\", abbrev, c.Attr)) + \",\\n\"\n\t}\n\n\treturn gofmt(`\nfunc (%s %s) Insert (db *sql.DB) error {\n\tquery := \"INSERT INTO %s (%s) VALUES (%s)\"\n\t_, err := db.Exec(\n\t\tquery,\n\t\t%s\n\t)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"Failed to insert %s, %%#v, => %%s\", %s, err.Error())\n\t}\n\treturn nil\n}`, abbrev, s.Name, s.Name, attributes, sqlParameters, parameters, s.Name, abbrev)\n}", "func (table *Table) getCreateSyntax() string {\n\tquery := fmt.Sprintf(\"CREATE TABLE IF NOT EXISTS %s(\", table.Name)\n\tcolCount := len(table.Cols)\n\tfor i, col := range table.Cols {\n\t\tquery += col.String()\n\t\tif col == table.PrimaryKeyCol {\n\t\t\tquery += \" PRIMARY KEY\"\n\t\t}\n\t\tif i < colCount-1 {\n\t\t\tquery += commaSpace\n\t\t}\n\t}\n\treturn query\n}", "func NewSchema(drv dialect.Driver) *Schema { return &Schema{drv: drv} }", "func (m *PostgreSQLProvider) Schema(schema string, names ...string) (*Schema, error) {\n\tschema = m.nameOf(schema)\n\n\tquery := &bytes.Buffer{}\n\tquery.WriteString(\"SELECT column_name, data_type, udt_name, is_nullable = 'YES' AS is_nullable, \")\n\tquery.WriteString(\"CASE WHEN numeric_precision IS NULL THEN 0 ELSE numeric_precision END, \")\n\tquery.WriteString(\"CASE WHEN numeric_scale IS NULL THEN 0 ELSE numeric_scale END, \")\n\tquery.WriteString(\"CASE WHEN character_maximum_length IS NULL THEN 0 ELSE character_maximum_length END \")\n\tquery.WriteString(\"FROM information_schema.columns \")\n\tquery.WriteString(\"WHERE table_schema = $1 AND table_name = $2 \")\n\tquery.WriteString(\"ORDER BY table_schema, table_name, ordinal_position\")\n\n\ttables := []Table{}\n\tfor _, name := range names {\n\t\tprimaryKey, err := m.primaryKey(schema, name)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\ttable := Table{\n\t\t\tName: name,\n\t\t\tDriver: \"postgresql\",\n\t\t}\n\n\t\trows, err := m.DB.Query(query.String(), schema, name)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tfor rows.Next() {\n\t\t\tcolumn := Column{}\n\n\t\t\tfields := []interface{}{\n\t\t\t\t&column.Name,\n\t\t\t\t&column.Type.Name,\n\t\t\t\t&column.Type.Underlying,\n\t\t\t\t&column.Type.IsNullable,\n\t\t\t\t&column.Type.Precision,\n\t\t\t\t&column.Type.PrecisionScale,\n\t\t\t\t&column.Type.CharMaxLength,\n\t\t\t}\n\n\t\t\t_ = rows.Scan(fields...)\n\n\t\t\tcolumn.Type.IsPrimaryKey = contains(primaryKey, column.Name)\n\t\t\tcolumn.ScanType = m.translate(&column.Type)\n\t\t\ttable.Columns = append(table.Columns, column)\n\t\t}\n\n\t\ttables = append(tables, table)\n\t}\n\n\tif len(tables) == 0 {\n\t\treturn nil, fmt.Errorf(\"No tables found\")\n\t}\n\n\tschemaDef := &Schema{\n\t\tName: schema,\n\t\tDriver: \"postgresql\",\n\t\tTables: tables,\n\t\tIsDefault: schema == \"public\",\n\t}\n\n\treturn schemaDef, nil\n}", "func createSQL(admin Admin) (string, []interface{}){\n\t\n}", "func QuoteSchema(schema string) string {\n\treturn QuoteIdentifier(schema)\n}", "func Schemas(nodes []sql.Node) sql.Schema {\n\tvar schema sql.Schema\n\tfor _, n := range nodes {\n\t\tschema = append(schema, n.Schema()...)\n\t}\n\treturn schema\n}", "func (dao UserDao) CreateSchema() string {\n\tstmt := dao.createSchemaStatement()\n\n\treturn fmt.Sprintf(stmt, dao.Table, dao.createDOIColumns(), dao.createSchemaColumns())\n}", "func (per *PersistStringer) DeclareSqlPackageDefs() string {\n\tprinter := &Printer{}\n\tprinter.P(\"type SqlClientGetter func() (*sql.DB, error)\\n\")\n\tprinter.PA([]string{\n\t\t\"func NewSqlClientGetter(cli *sql.DB) SqlClientGetter {\\n\",\n\t\t\"return func() (*sql.DB, error) {\\n return cli, nil \\n}\\n}\\n\",\n\t})\n\tprinter.P(\"type Scanable interface{\\nScan(dest ...interface{}) error\\n}\\n\")\n\tprinter.PA([]string{\n\t\t\"type Runable interface{\\n\",\n\t\t\"Query(string, ...interface{}) (*sql.Rows, error)\\n\",\n\t\t\"QueryRow(string, ...interface{}) *sql.Row\\n\",\n\t\t\"Exec(string, ...interface{}) (sql.Result, error)\\n}\\n\",\n\t})\n\tprinter.PA([]string{\n\t\t\"type Result struct {\\n\",\n\t\t\"result sql.Result\\n\",\n\t\t\"row *sql.Row\\n\",\n\t\t\"rows *sql.Rows\\n\",\n\t\t\"err error\\n\",\n\t\t\"}\\n\",\n\t\t\"func newResultFromSqlResult(r sql.Result) *Result {\\n\",\n\t\t\"return &Result{result: r}\\n\",\n\t\t\"}\\n\",\n\t\t\"func newResultFromRow(r *sql.Row) *Result {\\n\",\n\t\t\"return &Result{row: r}\\n\",\n\t\t\"}\\n\",\n\t\t\"func newResultFromRows(r *sql.Rows) *Result {\\n\",\n\t\t\"return &Result{rows: r}\\n\",\n\t\t\"}\\n\",\n\t\t\"func newResultFromErr(err error) *Result {\\n\",\n\t\t\"return &Result{err: err}\\n\",\n\t\t\"}\\n\",\n\t\t\"func (r *Result) Do(fun func(Scanable) error) error {\\n\",\n\t\t\"if r.err != nil {\\n\",\n\t\t\"return r.err\\n\",\n\t\t\"}\\n\",\n\t\t\"if r.row != nil {\\n\",\n\t\t\"if err := fun(r.row); err != nil {\\n\",\n\t\t\"return err\\n\",\n\t\t\"}\\n\",\n\t\t\"}\\n\",\n\t\t\"if r.rows != nil {\\n\",\n\t\t\"defer r.rows.Close()\\n\",\n\t\t\"for r.rows.Next() {\\n\",\n\t\t\"if err := fun(r.rows); err != nil {\\n\",\n\t\t\"return err\\n\",\n\t\t\"}\\n\",\n\t\t\"}\\n\",\n\t\t\"}\\n\",\n\t\t\"return nil\\n\",\n\t\t\"}\\n\",\n\t\t\"// returns sql.ErrNoRows if it did not scan into dest\\n\",\n\t\t\"func (r *Result) Scan(dest ...interface{}) error {\\n\",\n\t\t\"if r.result != nil {\\n return sql.ErrNoRows\\n}\",\n\t\t\"else if r.row != nil {\\n return r.row.Scan(dest...)\\n}\",\n\t\t\"else if r.rows != nil {\\n\",\n\t\t\"err := r.rows.Scan(dest...)\\n\",\n\t\t\"if r.rows.Next() {\\n r.rows.Close()\\n}\\n\",\n\t\t\"return err\\n\",\n\t\t\"}\\n\",\n\t\t\"return sql.ErrNoRows\\n\",\n\t\t\"}\\n\",\n\t\t\"func (r *Result) Err() error {\\n\",\n\t\t\"return r.err\\n\",\n\t\t\"}\\n\",\n\t})\n\treturn printer.String()\n}", "func createSchema() graphql.Schema {\n\tschema, err := graphql.NewSchema(graphql.SchemaConfig{\n\t\tQuery: createQuery(),\n\t})\n\tif err != nil {\n\t\tlog.Println(\"Error creating Schema\")\n\t\tpanic(err)\n\t}\n\treturn schema\n}", "func GetSchemas(w http.ResponseWriter, r *http.Request) {\n\trequestWhere, values, err := config.PrestConf.Adapter.WhereByRequest(r, 1)\n\tif err != nil {\n\t\thttp.Error(w, err.Error(), http.StatusBadRequest)\n\t\treturn\n\t}\n\n\tsqlSchemas, hasCount := config.PrestConf.Adapter.SchemaClause(r)\n\n\tif requestWhere != \"\" {\n\t\tsqlSchemas = fmt.Sprint(sqlSchemas, \" WHERE \", requestWhere)\n\t}\n\n\tdistinct, err := config.PrestConf.Adapter.DistinctClause(r)\n\tif err != nil {\n\t\thttp.Error(w, err.Error(), http.StatusBadRequest)\n\t\treturn\n\t}\n\tif distinct != \"\" {\n\t\tsqlSchemas = strings.Replace(sqlSchemas, \"SELECT\", distinct, 1)\n\t}\n\n\torder, err := config.PrestConf.Adapter.OrderByRequest(r)\n\tif err != nil {\n\t\thttp.Error(w, err.Error(), http.StatusBadRequest)\n\t\treturn\n\t}\n\torder = config.PrestConf.Adapter.SchemaOrderBy(order, hasCount)\n\n\tpage, err := config.PrestConf.Adapter.PaginateIfPossible(r)\n\tif err != nil {\n\t\thttp.Error(w, err.Error(), http.StatusBadRequest)\n\t\treturn\n\t}\n\n\tsqlSchemas = fmt.Sprint(sqlSchemas, order, \" \", page)\n\tsc := config.PrestConf.Adapter.Query(sqlSchemas, values...)\n\tif sc.Err() != nil {\n\t\thttp.Error(w, sc.Err().Error(), http.StatusBadRequest)\n\t\treturn\n\t}\n\t//nolint\n\tw.Write(sc.Bytes())\n}", "func QuoteSchema(schema string, table string) string {\n\treturn fmt.Sprintf(\"`%s`.`%s`\", EscapeName(schema), EscapeName(table))\n}", "func CreateSchema(ctx context.Context, db Execer, schema string) (err error) {\n\tfor try := 0; try < 5; try++ {\n\t\t_, err = db.ExecContext(ctx, `CREATE SCHEMA IF NOT EXISTS `+QuoteSchema(schema)+`;`)\n\n\t\t// Postgres `CREATE SCHEMA IF NOT EXISTS` may return \"duplicate key value violates unique constraint\".\n\t\t// In that case, we will retry rather than doing anything more complicated.\n\t\t//\n\t\t// See more in: https://stackoverflow.com/a/29908840/192220\n\t\tif pgerrcode.IsConstraintViolation(err) {\n\t\t\tcontinue\n\t\t}\n\t\treturn err\n\t}\n\n\treturn err\n}", "func (*ShowDatabases) Schema() sql.Schema {\n\treturn sql.Schema{{\n\t\tName: \"database\",\n\t\tType: sql.Text,\n\t\tNullable: false,\n\t}}\n}", "func InitSchema(tx *sql.Tx) error {\n\tfor _, obj := range allSQL {\n\t\tif _, err := tx.Exec(obj.CreateSQL()); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\treturn nil\n}", "func (svc *ServiceDefinition) createSchemas() *brokerapi.ServiceSchemas {\n\treturn &brokerapi.ServiceSchemas{\n\t\tInstance: brokerapi.ServiceInstanceSchema{\n\t\t\tCreate: brokerapi.Schema{\n\t\t\t\tParameters: createJsonSchema(svc.ProvisionInputVariables),\n\t\t\t},\n\t\t},\n\t\tBinding: brokerapi.ServiceBindingSchema{\n\t\t\tCreate: brokerapi.Schema{\n\t\t\t\tParameters: createJsonSchema(svc.BindInputVariables),\n\t\t\t},\n\t\t},\n\t}\n}", "func getTableNamesPattern() string {\n rval := \"\"\n idx := 0\n for k, _ := range tableNames {\n if ( idx > 0 ){\n rval += \"|\"\n }\n rval += k\n idx++\n }\n \n return rval\n}", "func (base *DatabaseImplementation) CreateSchema(schema string) error {\n\t_, err := base.DB.Exec(base.mq.CreateSchemaSQL(schema))\n\treturn err\n}", "func (t *tableSchema) Statement() string {\n\ts := fmt.Sprintf(\"\"+\n\t\t\"--\\n\"+\n\t\t\"-- Table structure for %s.%s\\n\"+\n\t\t\"--\\n\"+\n\t\t\"CREATE TABLE %s.%s (\\n\",\n\t\tt.schemaName, t.name, t.schemaName, t.name)\n\tvar cols []string\n\tfor _, v := range t.columns {\n\t\tcols = append(cols, \" \"+v.Statement())\n\t}\n\ts += strings.Join(cols, \",\\n\")\n\ts += \"\\n);\\n\\n\"\n\n\t// Add constraints such as primary key, unique, or checks.\n\tfor _, constraint := range t.constraints {\n\t\ts += fmt.Sprintf(\"%s\\n\", constraint.Statement())\n\t}\n\ts += \"\\n\"\n\treturn s\n}", "func createSchema(db *pg.DB) error {\n\tvar u *Execution\n\tvar s *LoadStatus\n\tmodels := []interface{}{\n\t\tu,\n\t\ts,\n\t}\n\n\tfor _, model := range models {\n\t\terr := db.Model(model).CreateTable(&orm.CreateTableOptions{\n\t\t\tTemp: false,\n\t\t})\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\treturn nil\n}", "func (it *ColumnDefinition) SqlString() string {\n\tvar buffer bytes.Buffer\n\n\tbuffer.WriteString(\"CREATE TABLE \")\n\tbuffer.WriteString(it.TableName)\n\tbuffer.WriteString(\"(\")\n\n\tfor k, v := range it.Columns {\n\t\tlastElement := k == len(it.Columns)-1\n\t\tbuffer.WriteString(v.Statement(!lastElement))\n\t}\n\n\tbuffer.WriteString(\");\")\n\treturn buffer.String()\n}", "func dmsaSql(d *Database, ddlOperator string, ddlOperand string, patterns interface{}) (sqlStrings []string, err error) {\n\n\tvar stmts []string\n\n\tstmts, err = rawDmsaSql(d, ddlOperator, ddlOperand)\n\tif err != nil {\n\t\treturn\n\t}\n\n\tvar entityToTableMap map[string]string\n\tvar pattern *regexp.Regexp // Regexp pattern containing capture expression for the table name in the *creation* SQL, e.g. \" ON (\\w+)\"\n\n\tswitch pat := patterns.(type) {\n\tcase mapPatternsType:\n\t\t// The entity-name-to-table-name mapping is assumed to implicitly occur in the creation SQL, i.e. \"ddl\"\n\t\tif entityToTableMap, err = dmsaSqlMap(d, \"ddl\", ddlOperand, pat); err != nil {\n\t\t\treturn\n\t\t}\n\t\tpattern = regexp.MustCompile(pat.entityDrop)\n\tcase normalPatternsType:\n\t\tpattern = regexp.MustCompile(pat.table)\n\t}\n\n\tfor _, stmt := range stmts {\n\t\tstmt = strings.TrimSpace(stmt)\n\t\tshouldInclude := false // Whether to include this SQL statement\n\t\tvar table string\n\t\tif strings.Contains(stmt, \"version_history\") {\n\t\t\tshouldInclude = true\n\t\t} else {\n\t\t\tvar submatches []string\n\t\t\tsubmatches = pattern.FindStringSubmatch(stmt)\n\t\t\tif submatches != nil {\n\t\t\t\tif entityToTableMap != nil {\n\t\t\t\t\tvar ok bool\n\t\t\t\t\tif table, ok = entityToTableMap[submatches[1]]; !ok {\n\t\t\t\t\t\terr = fmt.Errorf(\"Failed to look up table name for entity `%s` in SQL `%s`\", submatches[1], stmt)\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\ttable = submatches[1]\n\t\t\t\t}\n\t\t\t\tif d.includeTables != nil {\n\t\t\t\t\tif d.includeTables.MatchString(table) {\n\t\t\t\t\t\tshouldInclude = true\n\t\t\t\t\t}\n\t\t\t\t} else if d.excludeTables != nil {\n\t\t\t\t\tif !d.excludeTables.MatchString(table) {\n\t\t\t\t\t\tshouldInclude = true\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tif shouldInclude {\n\t\t\tsqlStrings = append(sqlStrings, stmt)\n\t\t}\n\t} // end for all SQL statements\n\treturn\n}", "func generateCreateSQL(projectPath string) error {\n\n\t// Set up a Create-Database migration, which comes first\n\tname := filepath.Base(projectPath)\n\td := ConfigDevelopment[\"db\"]\n\tu := ConfigDevelopment[\"db_user\"]\n\tp := ConfigDevelopment[\"db_pass\"]\n\tsql := fmt.Sprintf(\"/* Setup database for %s */\\nCREATE USER \\\"%s\\\" WITH PASSWORD '%s';\\nCREATE DATABASE \\\"%s\\\" WITH OWNER \\\"%s\\\";\", name, u, p, d, u)\n\n\t// Generate a migration to create db with today's date\n\tfile := migrationPath(projectPath, createDatabaseMigrationName)\n\terr := ioutil.WriteFile(file, []byte(sql), 0744)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// If we have a Create-Tables file, copy it out to a new migration with today's date\n\tcreateTablesPath := filepath.Join(projectPath, \"db\", \"migrate\", createTablesMigrationName+\".sql.tmpl\")\n\tif fileExists(createTablesPath) {\n\t\tsql, err := ioutil.ReadFile(createTablesPath)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\t// Now vivify the template, for now we just replace one key\n\t\tsqlString := reifyString(string(sql))\n\n\t\tfile = migrationPath(projectPath, createTablesMigrationName)\n\t\terr = ioutil.WriteFile(file, []byte(sqlString), 0744)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\t// Remove the old file\n\t\tos.Remove(createTablesPath)\n\n\t} else {\n\t\tlog.Printf(\"Error: No Tables found at:%s\", createTablesPath)\n\t}\n\n\treturn nil\n}", "func setupDB(db *sql.DB) error {\n\tsqlScript, err := ioutil.ReadFile(\"dbSchema.sql\")\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tstatements := strings.Split(string(sqlScript), \";\")\n\tif len(statements) > 0 {\n\t\tstatements = statements[:len(statements)-1]\n\t}\n\n\tfor _, statement := range statements {\n\t\t_, err = db.Exec(statement)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\treturn nil\n}", "func (c *CreateTable) Schema() sql.Schema { return nil }", "func (m *SQLiteProvider) Schema(schema string, names ...string) (*Schema, error) {\n\ttables := []Table{}\n\n\tfor _, name := range names {\n\t\ttable := Table{\n\t\t\tName: name,\n\t\t\tDriver: \"sqlite\",\n\t\t}\n\n\t\tquery := fmt.Sprintf(\"pragma table_info(%s)\", name)\n\t\trows, err := m.DB.Query(query)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tfor rows.Next() {\n\t\t\tcolumn := Column{}\n\t\t\tinfo := sqliteInf{}\n\n\t\t\tfields := []interface{}{\n\t\t\t\t&info.CID,\n\t\t\t\t&column.Name,\n\t\t\t\t&info.Type,\n\t\t\t\t&info.NotNullable,\n\t\t\t\t&info.DefaultValue,\n\t\t\t\t&info.PK,\n\t\t\t}\n\n\t\t\t_ = rows.Scan(fields...)\n\n\t\t\tcolumn.Type = m.create(&info)\n\t\t\tcolumn.ScanType = translate(&column.Type)\n\n\t\t\ttable.Columns = append(table.Columns, column)\n\t\t}\n\n\t\ttables = append(tables, table)\n\t}\n\n\tif len(tables) == 0 {\n\t\treturn nil, fmt.Errorf(\"No tables found\")\n\t}\n\n\tschemaDef := &Schema{\n\t\tName: \"default\",\n\t\tDriver: \"sqlite\",\n\t\tTables: tables,\n\t\tIsDefault: true,\n\t}\n\n\treturn schemaDef, nil\n}", "func Schema() error {\n\t_, err := Db.Exec(schema)\n\treturn err\n}", "func (in *Database) createSchema() (*memdb.MemDB, error) {\n\tschema := &memdb.DBSchema{\n\t\tTables: map[string]*memdb.TableSchema{\n\t\t\t\"container\": {\n\t\t\t\tName: \"container\",\n\t\t\t\tIndexes: map[string]*memdb.IndexSchema{\n\t\t\t\t\t\"id\": {\n\t\t\t\t\t\tName: \"id\",\n\t\t\t\t\t\tUnique: true,\n\t\t\t\t\t\tIndexer: &memdb.StringFieldIndex{Field: \"ID\"},\n\t\t\t\t\t},\n\t\t\t\t\t\"shortid\": {\n\t\t\t\t\t\tName: \"shortid\",\n\t\t\t\t\t\tUnique: true,\n\t\t\t\t\t\tIndexer: &memdb.StringFieldIndex{Field: \"ShortID\"},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t\t\"exec\": {\n\t\t\t\tName: \"exec\",\n\t\t\t\tIndexes: map[string]*memdb.IndexSchema{\n\t\t\t\t\t\"id\": {\n\t\t\t\t\t\tName: \"id\",\n\t\t\t\t\t\tUnique: true,\n\t\t\t\t\t\tIndexer: &memdb.StringFieldIndex{Field: \"ID\"},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t\t\"network\": {\n\t\t\t\tName: \"network\",\n\t\t\t\tIndexes: map[string]*memdb.IndexSchema{\n\t\t\t\t\t\"id\": {\n\t\t\t\t\t\tName: \"id\",\n\t\t\t\t\t\tUnique: true,\n\t\t\t\t\t\tIndexer: &memdb.StringFieldIndex{Field: \"ID\"},\n\t\t\t\t\t},\n\t\t\t\t\t\"shortid\": {\n\t\t\t\t\t\tName: \"shortid\",\n\t\t\t\t\t\tUnique: true,\n\t\t\t\t\t\tIndexer: &memdb.StringFieldIndex{Field: \"ShortID\"},\n\t\t\t\t\t},\n\t\t\t\t\t\"name\": {\n\t\t\t\t\t\tName: \"name\",\n\t\t\t\t\t\tUnique: true,\n\t\t\t\t\t\tIndexer: &memdb.StringFieldIndex{Field: \"Name\"},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t\t\"image\": {\n\t\t\t\tName: \"image\",\n\t\t\t\tIndexes: map[string]*memdb.IndexSchema{\n\t\t\t\t\t\"id\": {\n\t\t\t\t\t\tName: \"id\",\n\t\t\t\t\t\tUnique: true,\n\t\t\t\t\t\tIndexer: &memdb.StringFieldIndex{Field: \"ID\"},\n\t\t\t\t\t},\n\t\t\t\t\t\"shortid\": {\n\t\t\t\t\t\tName: \"shortid\",\n\t\t\t\t\t\tUnique: true,\n\t\t\t\t\t\tIndexer: &memdb.StringFieldIndex{Field: \"ShortID\"},\n\t\t\t\t\t},\n\t\t\t\t\t\"name\": {\n\t\t\t\t\t\tName: \"name\",\n\t\t\t\t\t\tUnique: true,\n\t\t\t\t\t\tIndexer: &memdb.StringFieldIndex{Field: \"Name\"},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t}\n\treturn memdb.NewMemDB(schema)\n}", "func (m *MySQLCluster) LoadSchemas(t *testing.T, sql1, sql2 []string) (schema1, schema2 string) {\n\tt.Helper()\n\tts := time.Now().UnixNano()\n\tschema1 = fmt.Sprintf(\"schema1_%d\", ts)\n\tschema2 = fmt.Sprintf(\"schema2_%d\", ts)\n\n\t_, err := m.s1.Exec(\"CREATE DATABASE \" + schema1)\n\tif err != nil {\n\t\tlog.Panic(err)\n\t}\n\t_, err = m.s1.Exec(\"USE \" + schema1)\n\tif err != nil {\n\t\tlog.Panic(err)\n\t}\n\n\tfor _, sql := range sql1 {\n\t\t_, err = m.s1.Exec(sql)\n\t\tif err != nil {\n\t\t\tlog.Panic(err)\n\t\t}\n\t}\n\n\t_, err = m.s2.Exec(\"CREATE DATABASE \" + schema2)\n\tif err != nil {\n\t\tlog.Panic(err)\n\t}\n\t_, err = m.s2.Exec(\"USE \" + schema2)\n\tif err != nil {\n\t\tlog.Panic(err)\n\t}\n\n\tfor _, sql := range sql2 {\n\t\t_, err = m.s2.Exec(sql)\n\t\tif err != nil {\n\t\t\tlog.Panic(err)\n\t\t}\n\t}\n\n\treturn\n}", "func (t Transform) Schema() string {\n\treturn `\n CREATE TABLE IF NOT EXISTS transforms (\n id INT NOT NULL AUTO_INCREMENT PRIMARY KEY,\n archive_id INT NOT NULL,\n type VARCHAR(255) NOT NULL, -- the name of a Go struct\n marshaled_json TEXT NOT NULL, -- the Go struct marshaled\n created_at DATETIME NOT NULL,\n updated_at DATETIME NOT NULL\n );`\n}", "func (dbi *DBInstance) CreateSchema() error {\n\n\t// check if peers table exists\n\tv, err := dbi.GetIntValue(SELECT_WORDS_TABLE)\n\tif err == nil && v > 0 {\n\t\tfmt.Println(\"Words table detected skipping schema installation\")\n\t\treturn nil\n\t} else {\n\t\tfmt.Println(\"Words table not found starting schema installation\")\n\t}\n\n\t// create tables\n\t_, err = dbi.SQLSession.Exec(CREATE_WORDS_TABLE)\n\tif err != nil {\n\t\treturn err\n\t}\n\t_, err = dbi.SQLSession.Exec(CREATE_PEERS_TABLE)\n\tif err != nil {\n\t\treturn err\n\t}\n\t_, err = dbi.SQLSession.Exec(CREATE_SUBJECTS_TABLE)\n\tif err != nil {\n\t\treturn err\n\t}\n\t_, err = dbi.SQLSession.Exec(CREATE_USERS_TABLE)\n\tif err != nil {\n\t\treturn err\n\t}\n\t_, err = dbi.SQLSession.Exec(CREAT_SESSIONS_TABLE)\n\tif err != nil {\n\t\treturn err\n\t}\n\t// insert words\n\t_, err = dbi.SQLSession.Exec(INSERT_WORDS)\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "func (s *ShowCreateDatabase) Schema() sql.Schema {\n\treturn showCreateDatabaseSchema\n}", "func (stmt *Statement) Schema() string {\n\tif stmt.ObjectQualifier != \"\" {\n\t\treturn stmt.ObjectQualifier\n\t}\n\treturn stmt.DefaultDatabase\n}", "func BackupSchemas(metadataFile *utils.FileWithByteCount) {\n\tgplog.Verbose(\"Writing CREATE SCHEMA statements to metadata file\")\n\tschemas := GetAllUserSchemas(connectionPool)\n\tobjectCounts[\"Schemas\"] = len(schemas)\n\tschemaMetadata := GetMetadataForObjectType(connectionPool, TYPE_SCHEMA)\n\tPrintCreateSchemaStatements(metadataFile, globalTOC, schemas, schemaMetadata)\n}", "func (seq *sequencePgSchema) Statement() string {\n\ts := fmt.Sprintf(\"\"+\n\t\t\"--\\n\"+\n\t\t\"-- Sequence structure for %s.%s\\n\"+\n\t\t\"--\\n\"+\n\t\t\"CREATE SEQUENCE %s.%s\\n\"+\n\t\t\" AS %s\\n\"+\n\t\t\" START WITH %s\\n\"+\n\t\t\" INCREMENT BY %s\\n\",\n\t\tseq.schemaName, seq.name, seq.schemaName, seq.name, seq.dataType, seq.startValue, seq.increment)\n\tif seq.minimumValue == \"\" {\n\t\ts += fmt.Sprintf(\" MINVALUE %s\\n\", seq.minimumValue)\n\t} else {\n\t\ts += fmt.Sprintf(\" NO MINVALUE\\n\")\n\t}\n\tif seq.maximumValue == \"\" {\n\t\ts += fmt.Sprintf(\" MAXVALUE %s\\n\", seq.maximumValue)\n\t} else {\n\t\ts += fmt.Sprintf(\" NO MAXVALUE\\n\")\n\t}\n\ts += fmt.Sprintf(\" CACHE %s\", seq.cache)\n\tswitch seq.cycleOption {\n\tcase \"YES\":\n\t\ts += \"\\n CYCLE;\\n\"\n\tcase \"NO\":\n\t\ts += \";\\n\"\n\t}\n\ts += \"\\n\"\n\treturn s\n}", "func createSchemaAndItems(ctx sessionctx.Context, f *zip.File) error {\n\tr, err := f.Open()\n\tif err != nil {\n\t\treturn errors.AddStack(err)\n\t}\n\t//nolint: errcheck\n\tdefer r.Close()\n\tbuf := new(bytes.Buffer)\n\t_, err = buf.ReadFrom(r)\n\tif err != nil {\n\t\treturn errors.AddStack(err)\n\t}\n\toriginText := buf.String()\n\tindex1 := strings.Index(originText, \";\")\n\tcreateDatabaseSQL := originText[:index1+1]\n\tindex2 := strings.Index(originText[index1+1:], \";\")\n\tuseDatabaseSQL := originText[index1+1:][:index2+1]\n\tcreateTableSQL := originText[index1+1:][index2+1:]\n\tc := context.Background()\n\t// create database if not exists\n\t_, err = ctx.(sqlexec.SQLExecutor).Execute(c, createDatabaseSQL)\n\tlogutil.BgLogger().Debug(\"plan replayer: skip error\", zap.Error(err))\n\t// use database\n\t_, err = ctx.(sqlexec.SQLExecutor).Execute(c, useDatabaseSQL)\n\tif err != nil {\n\t\treturn err\n\t}\n\t// create table or view\n\t_, err = ctx.(sqlexec.SQLExecutor).Execute(c, createTableSQL)\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "func newSchema(DSN, schema string) *tengo.Schema {\n\ti, err := tengo.NewInstance(\"mysql\", DSN)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\ts, err := i.Schema(schema)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\treturn s\n}", "func rawDmsaSql(d *Database, ddlOperator string, ddlOperand string) (sqlStrings []string, err error) {\n\n\turl := joinUrlPath(d.DmsaUrl, fmt.Sprintf(\"/%s/%s/%s/postgresql/%s/\", d.Model, d.ModelVersion, ddlOperator, ddlOperand))\n\tresponse, err := http.Get(url)\n\tif err != nil {\n\t\treturn sqlStrings, fmt.Errorf(\"Error getting %v: %v\", url, err)\n\t}\n\tif response.StatusCode != 200 {\n\t\treturn sqlStrings, fmt.Errorf(\"Data-models-sqlalchemy web service (%v) returned error: %v\", url, http.StatusText(response.StatusCode))\n\t}\n\tbody, err := ioutil.ReadAll(response.Body)\n\tif err != nil {\n\t\treturn sqlStrings, fmt.Errorf(\"Error reading body from %v: %v\", url, err)\n\t}\n\tbodyString := string(body)\n\n\tstmts := strings.Split(bodyString, \";\")\n\n\tfor _, stmt := range stmts {\n\t\tif strings.Contains(stmt, \"version_history\") {\n\t\t\tif strings.Contains(stmt, \"CREATE TABLE\") {\n\t\t\t\t// Kludge to work around a data-models-sqlalchemy problem; kludge will be benign even after the problem is fixed.\n\t\t\t\tstmt = strings.Replace(stmt, \"dms_version VARCHAR(16)\", \"dms_version VARCHAR(50)\", 1)\n\t\t\t}\n\t\t}\n\t\tsqlStrings = append(sqlStrings, stmt)\n\t} // end for all SQL statements\n\treturn\n}", "func (m *MySQLProvider) Schema(schema string, names ...string) (*Schema, error) {\n\tvar (\n\t\terr error\n\t\tdatabase string\n\t)\n\n\tif database, err = m.database(); err != nil {\n\t\treturn nil, err\n\t}\n\n\tif schema == \"\" {\n\t\tschema = database\n\t}\n\n\tquery := &bytes.Buffer{}\n\tquery.WriteString(\"SELECT column_name, data_type, REPLACE(column_type, ' unsigned', ''), is_nullable = 'YES' AS is_nullable, \")\n\tquery.WriteString(\"INSTR(column_type, 'unsigned') > 0 AS is_unsigned, \")\n\tquery.WriteString(\"CASE WHEN numeric_precision IS NULL THEN 0 ELSE numeric_precision END, \")\n\tquery.WriteString(\"CASE WHEN numeric_scale IS NULL THEN 0 ELSE numeric_scale END, \")\n\tquery.WriteString(\"CASE WHEN character_maximum_length IS NULL THEN 0 ELSE character_maximum_length END \")\n\tquery.WriteString(\"FROM information_schema.columns \")\n\tquery.WriteString(\"WHERE table_schema = ? AND table_name = ? \")\n\tquery.WriteString(\"ORDER BY table_schema, table_name, ordinal_position\")\n\n\ttables := []Table{}\n\tfor _, name := range names {\n\t\ttable := Table{\n\t\t\tName: name,\n\t\t\tDriver: \"mysql\",\n\t\t}\n\n\t\tprimaryKey, err := m.primaryKey(schema, name)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\trows, err := m.DB.Query(query.String(), schema, name)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tfor rows.Next() {\n\t\t\tcolumn := Column{}\n\n\t\t\tfields := []interface{}{\n\t\t\t\t&column.Name,\n\t\t\t\t&column.Type.Name,\n\t\t\t\t&column.Type.Underlying,\n\t\t\t\t&column.Type.IsNullable,\n\t\t\t\t&column.Type.IsUnsigned,\n\t\t\t\t&column.Type.Precision,\n\t\t\t\t&column.Type.PrecisionScale,\n\t\t\t\t&column.Type.CharMaxLength,\n\t\t\t}\n\n\t\t\t_ = rows.Scan(fields...)\n\n\t\t\tcolumn.Type.IsPrimaryKey = contains(primaryKey, column.Name)\n\t\t\tcolumn.ScanType = translate(&column.Type)\n\t\t\ttable.Columns = append(table.Columns, column)\n\t\t}\n\n\t\ttables = append(tables, table)\n\t}\n\n\tif len(tables) == 0 {\n\t\treturn nil, fmt.Errorf(\"No tables found\")\n\t}\n\n\tschemaDef := &Schema{\n\t\tName: schema,\n\t\tDriver: \"mysql\",\n\t\tTables: tables,\n\t\tIsDefault: schema == database,\n\t}\n\n\treturn schemaDef, nil\n}", "func makeSchema(ex SessionExecutor, msg CommonMessage) (rep CommonReply) {\n\tmainTableTmpl := ex.getQuery(makeMainTableOp)\n\tnodeTableTmpl := ex.getQuery(makeNodeTableOp)\n\tentityTableTmpl := ex.getQuery(makeEntityTableOp)\n\n\tif _, err := ex.Exec(fmt.Sprintf(mainTableTmpl, msg.GetMainTable())); err != nil {\n\t\treturn newReply(errors.Wrap(err, \"makeSchema maintable\"))\n\t}\n\tdbLogger.Infof(\"created table:%s\", msg.GetMainTable())\n\n\tif _, err := ex.Exec(fmt.Sprintf(nodeTableTmpl, msg.GetNodeTable())); err != nil {\n\t\treturn newReply(errors.Wrap(err, \"makeSchema nodeTable\"))\n\t}\n\tdbLogger.Infof(\"created table:%s\", msg.GetNodeTable())\n\n\tif _, err := ex.Exec(fmt.Sprintf(entityTableTmpl, msg.GetEntityTable())); err != nil {\n\t\treturn newReply(errors.Wrap(err, \"makeSchema entityTable\"))\n\t}\n\tdbLogger.Infof(\"created table:%s\", msg.GetEntityTable())\n\n\treturn newReply(nil)\n}", "func NewSchema() *Schema {\n\treturn &Schema{\n\t\ttables: make(map[string]([]*sqlparser.ColumnDefinition)),\n\t}\n}", "func initFunctionSqlTemplate() *template.Template {\n\tsql := `\n SELECT n.nspname AS schema_name\n , {{if eq $.DbSchema \"*\" }}n.nspname || '.' || {{end}}p.proname AS compare_name\n , p.proname AS function_name\n , p.oid::regprocedure AS fancy\n , t.typname AS return_type\n , pg_get_functiondef(p.oid) AS definition\n FROM pg_proc AS p\n JOIN pg_type t ON (p.prorettype = t.oid)\n JOIN pg_namespace n ON (n.oid = p.pronamespace)\n JOIN pg_language l ON (p.prolang = l.oid AND l.lanname IN ('c','plpgsql', 'sql'))\n WHERE true\n\t{{if eq $.DbSchema \"*\" }}\n AND n.nspname NOT LIKE 'pg_%' \n AND n.nspname <> 'information_schema' \n {{else}}\n AND n.nspname = '{{$.DbSchema}}'\n {{end}};\n\t`\n\tt := template.New(\"FunctionSqlTmpl\")\n\ttemplate.Must(t.Parse(sql))\n\treturn t\n}", "func NewSchema(m ...interface{}) *Schema {\n\tif len(m) > 0 {\n\t\tsche := &Schema{}\n\t\tstack := toMiddleware(m)\n\t\tfor _, s := range stack {\n\t\t\t*sche = append(*sche, s)\n\t\t}\n\t\treturn sche\n\t}\n\treturn nil\n}", "func TokenSchema() string {\n\treturn `CREATE TABLE TOKEN(\n\t\tAUTH VARCHAR(64),\n\t\tMASTER VARCHAR(260),\n\t\tAUTH_TIMESTAMP DATETIME\n\t)\n\t`\n}", "func CreateSchema(connDetail ConnectionDetails, schemaName string) error {\n\n\tvar db *sql.DB\n\tvar err error\n\n\tif db, err = connect(connDetail); err != nil {\n\t\treturn err\n\t}\n\tdefer db.Close()\n\n\t_, err = db.Exec(fmt.Sprintf(\"CREATE SCHEMA IF NOT EXISTS %s;\", schemaName))\n\treturn err\n}", "func (d *Describe) Schema() sql.Schema {\n\treturn sql.Schema{{\n\t\tName: \"name\",\n\t\tType: VarChar25000,\n\t}, {\n\t\tName: \"type\",\n\t\tType: VarChar25000,\n\t}}\n}", "func resetSchema(db *Database) error {\n\t_, err := db.DB.Exec(fmt.Sprintf(`DROP SCHEMA %s CASCADE`, PGSchema))\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t_, err = db.DB.Exec(fmt.Sprintf(`CREATE SCHEMA %s`, PGSchema))\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func copySchema(ctx context.Context, db *sql.DB, targetSchema, sampleSchema string, noSampleTables map[string]struct{}) error {\n\trows, err := db.Query(fmt.Sprintf(\"SHOW FULL TABLES FROM %s;\", targetSchema))\n\tif err != nil {\n\t\treturn fmt.Errorf(\"show tables: %w\", err)\n\t}\n\ttx, err := db.BeginTx(ctx, nil)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"rollback err: %s, %w\", tx.Rollback(), err)\n\t}\n\t_, err = tx.Exec(fmt.Sprintf(\"CREATE DATABASE %s;\", sampleSchema))\n\tif err != nil {\n\t\treturn fmt.Errorf(\"rollback err: %s, create db: %w\", tx.Rollback(), err)\n\t}\n\t// we create the views after creating the tables\n\tviews := []string{}\n\tfor rows.Next() {\n\t\tvar tableName, tableType string\n\t\terr = rows.Scan(&tableName, &tableType)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tswitch tableType {\n\t\tcase \"VIEW\":\n\t\t\tviews = append(views, tableName)\n\t\tcase \"BASE TABLE\":\n\t\t\t_, err = tx.Exec(fmt.Sprintf(\"CREATE TABLE %s.%s LIKE %s.%s;\", sampleSchema, tableName, targetSchema, tableName))\n\t\t\tif err != nil {\n\t\t\t\treturn fmt.Errorf(\"create table %s: %w\", tableName, err)\n\t\t\t}\n\t\t\tif _, exists := noSampleTables[tableName]; exists {\n\t\t\t\t_, err = tx.Exec(fmt.Sprintf(\"INSERT INTO %s.%s SELECT * FROM %s.%s;\", sampleSchema, tableName, targetSchema, tableName))\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn fmt.Errorf(\"create table %s: %w\", tableName, err)\n\t\t\t\t}\n\t\t\t}\n\t\tdefault:\n\t\t\treturn fmt.Errorf(\"unknown table type %s\", tableType)\n\t\t}\n\t}\n\tfor _, viewName := range views {\n\t\trows, err := db.Query(fmt.Sprintf(\"SELECT view_definition FROM information_schema.views WHERE table_schema = '%s' AND table_name = '%s';\", targetSchema, viewName))\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"show view definition err: %w\", err)\n\t\t}\n\t\tif !rows.Next() {\n\t\t\treturn fmt.Errorf(\"could not find view definition: %s\", viewName)\n\t\t}\n\t\tvar definition string\n\t\terr = rows.Scan(&definition)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\t_, err = db.ExecContext(ctx, definition)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\treturn tx.Commit()\n}", "func conformCockroachDB(schema string) []string {\n\tPrintName(\"conformCockroachDB\")\n\tif len(schema) == 0 {\n\t\tlog.Panic(\"No database selected\")\n\t}\n\tvar xDrop = `\n\tdrop table IF EXISTS ` + schema + `.rveg_null;\n\tdrop view if EXISTS ` + schema + `.rveg_is_null;\n\tdrop view if EXISTS ` + schema + `.rveg_primary_keys;\n\tdrop view if EXISTS ` + schema + `.rveg_table;\n\n\tdrop table IF EXISTS ` + schema + `.rveg;\n\tdrop table if EXISTS ` + schema + `.rveg_unique;\n\n\t`\n\tvar x = `\n\tCREATE TABLE ` + schema + `.rveg (\n\tcolumn_name string,\n\t column_type string,\n\t column_default string,\n\t udt_name string,\n\t \"unique\" bool,\n\t track_id int not null,\n\t id INT NOT NULL PRIMARY KEY DEFAULT unique_rowid()\n\t);\n\tCREATE TABLE ` + schema + `.rveg_null (\n\tCOLUMN_NAME string,\n\t is_null string(3),\n\t track_id int not null,\n\t id INT NOT NULL PRIMARY KEY DEFAULT unique_rowid()\n\t);\n\tCREATE TABLE ` + schema + `.rveg_unique (\n\t \"table_schema\" string,\n\t \"table_name\" string,\n\t \"column_name\" string,\n\t \"unique\" bool,\n\t count_id int not null,\n\t id INT NOT NULL PRIMARY KEY DEFAULT unique_rowid()\n\t);\n\n\n\tCREATE VIEW ` + schema + `.rveg_table\n\tAS\n\tSELECT t.table_catalog, t.table_schema, t.table_name, t.table_type, t.version, row_number() OVER (ORDER by t.table_name) as track\n\tFROM information_schema.tables as t\n\tWHERE t.table_name not ilike 'rveg%' and t.table_type = 'BASE TABLE' ;\n\n\tINSERT INTO ` + schema + `.rveg (column_name, column_type, column_default, udt_name, track_id)\n\tselect c.column_name as column_name, c.data_type as column_type, c.column_default as column_default, c.data_type as udt_name, tbl.track as track_id\n\tFROM information_schema.columns as c, ` + schema + `.rveg_table as tbl\n\twhere c.table_name = tbl.table_name and c.table_schema = tbl.table_schema\n\t;\n\tINSERT INTO ` + schema + `.rveg_unique (\"unique\" , table_name, column_name, count_id, table_schema )\n\tselect e.non_unique, e.table_name, e.column_name, row_number() OVER (ORDER by e.table_name) as count_id, e.table_schema\n\tfrom information_schema.statistics as e\n\tWhere e.non_unique = false AND e.table_name not ilike 'rveg%';\n\n\tINSERT INTO ` + schema + `.rveg_null ( is_null, column_name, track_id )\n\tselect c.is_nullable, c.column_name, t.track\n\tfrom information_schema.columns as c, ` + schema + `.rveg_table as t\n\tWhere c.is_nullable = 'YES' AND c.table_name not ilike 'rveg%'\n\t\t AND t.TABLE_schema = c.table_schema\n\t\t AND t.TABLE_NAME = c.table_name\n\t;\n\tUPDATE ` + schema + `.rveg as rt\n\tSET column_default = ' '\n\tWHERE rt.column_default is null;\n\n\tUPDATE ` + schema + `.rveg\n\tSET \"unique\" = FALSE\n\t`\n\tvar x1 = `\n\tCREATE VIEW ` + schema + `.rveg_is_null\n\tAS\n\tselect c.is_nullable, c.column_name, t.table_name, t.table_schema\n\tfrom information_schema.columns as c, ` + schema + `.rveg_table as t\n\tWhere c.table_name not ilike 'rveg%'\n\t\t AND t.TABLE_schema = c.table_schema\n\t\t AND t.TABLE_NAME = c.table_name\n\t;\n\tCREATE VIEW ` + schema + `.rveg_primary_keys\n\tAS\n\tselect k.constraint_name, k.table_catalog, k.table_name, k.column_name, k.ordinal_position, k.table_schema\n\tfrom information_schema.key_column_usage as k\n\tWHERE k.constraint_name ilike '%primary%'\n\t\t or k.constraint_name ilike '%pkey%'\n\t;\n\n\n\t`\n\txSQL := make([]string, 3)\n\txSQL[0] = xDrop\n\txSQL[1] = x\n\txSQL[2] = x1\n\n\treturn xSQL\n}", "func (table *Table) createQuery() string {\n\treturn table.getCreateSyntax() + table.getUniqueSyntax() + table.getReferenceSyntax() + \")\"\n}", "func UpdateSchemaSQL(schema *Schema, conn Conn) (string, error) {\n\tvar sql, tmp string\n\tvar err error\n\tif HasSchema(schema.Name, conn) == false {\n\t\t// log.Fatal(\"create schema:\", schema.Name)\n\t\ttmp := conn.CreateSchemaSQL(schema.Name)\n\t\tif len(sql) > 0 {\n\t\t\tsql += \"\\n\"\n\t\t}\n\t\tsql += tmp\n\t}\n\tSortTablesByForeignKey(schema.Tables)\n\tfor _, tbl := range schema.Tables {\n\t\ttmp, err = UpdateTableSQL(&tbl, conn, false)\n\t\tif err != nil {\n\t\t\treturn \"\", err\n\t\t}\n\t\tif len(tmp) > 0 {\n\t\t\tsql += \"\\n\" + tmp\n\t\t}\n\t}\n\treturn sql, nil\n}", "func (s *CreateDatabaseStatement) String() string {\n\tvar buf bytes.Buffer\n\tbuf.WriteString(\"CREATE DATABASE\")\n\tif s.IfNotExists.IsValid() {\n\t\tbuf.WriteString(\" IF NOT EXISTS\")\n\t}\n\tbuf.WriteString(\" \")\n\tbuf.WriteString(s.Name.String())\n\n\tif s.With.IsValid() {\n\t\tbuf.WriteString(\" WITH\")\n\t\tfor _, opt := range s.Options {\n\t\t\tbuf.WriteString(\" \")\n\t\t\tbuf.WriteString(opt.String())\n\t\t}\n\t}\n\n\treturn buf.String()\n}", "func SchemaCreate(w http.ResponseWriter, r *http.Request) {\n\n\t// Add content type header to the response\n\tcontentType := \"application/json\"\n\tcharset := \"utf-8\"\n\tw.Header().Add(\"Content-Type\", fmt.Sprintf(\"%s; charset=%s\", contentType, charset))\n\n\t// Get url path variables\n\turlVars := mux.Vars(r)\n\tschemaName := urlVars[\"schema\"]\n\n\t// Grab context references\n\trefStr := gorillaContext.Get(r, \"str\").(stores.Store)\n\n\t// Get project UUID First to use as reference\n\tprojectUUID := gorillaContext.Get(r, \"auth_project_uuid\").(string)\n\n\tschemaUUID := uuid.NewV4().String()\n\n\tschema := schemas.Schema{}\n\n\terr := json.NewDecoder(r.Body).Decode(&schema)\n\tif err != nil {\n\t\terr := APIErrorInvalidArgument(\"Schema\")\n\t\trespondErr(w, err)\n\t\treturn\n\t}\n\n\tschema, err = schemas.Create(projectUUID, schemaUUID, schemaName, schema.Type, schema.RawSchema, refStr)\n\tif err != nil {\n\t\tif err.Error() == \"exists\" {\n\t\t\terr := APIErrorConflict(\"Schema\")\n\t\t\trespondErr(w, err)\n\t\t\treturn\n\n\t\t}\n\n\t\tif err.Error() == \"unsupported\" {\n\t\t\terr := APIErrorInvalidData(schemas.UnsupportedSchemaError)\n\t\t\trespondErr(w, err)\n\t\t\treturn\n\n\t\t}\n\n\t\terr := APIErrorInvalidData(err.Error())\n\t\trespondErr(w, err)\n\t\treturn\n\t}\n\n\toutput, _ := json.MarshalIndent(schema, \"\", \" \")\n\trespondOK(w, output)\n}", "func MergeSchema() string {\n\tbuf := bytes.Buffer{}\n\tfor _, name := range AssetNames() {\n\t\tb := MustAsset(name)\n\t\tbuf.Write(b)\n\t\tif len(b) > 0 && b[len(b)-1] != '\\n' {\n\t\t\tbuf.WriteByte('\\n')\n\t\t}\n\t}\n\n\treturn buf.String()\n}", "func (t *TableDefinition) generateSqlTable(srid int) error {\n\tst := &t.sqlTable\n\tst.Name = t.Name\n\n\t// Our 2 mandatory columns at the start\n\tst.Columns = append(st.Columns, SqlColumn{\n\t\tName: \"id\",\n\t\tType: \"SERIAL\",\n\t\tFlags: \"NOT NULL PRIMARY KEY\",\n\t\tSynthetic: true,\n\t\tPrimaryKey: true,\n\t})\n\tst.Columns = append(st.Columns, SqlColumn{\n\t\tName: \"osm_id\",\n\t\tType: \"BIGINT\",\n\t\tFlags: \"NOT NULL\",\n\t\tSynthetic: true,\n\t})\n\n\tfor _, c := range t.Columns {\n\t\tcol := SqlColumn{}\n\t\teq := strings.Index(c, \"=\")\n\t\tif eq > -1 {\n\t\t\tcol.Expression = strings.TrimSpace(c[eq+1:])\n\t\t\tc = c[:eq]\n\t\t}\n\n\t\teq = strings.Index(c, \" \")\n\t\tif eq > -1 {\n\t\t\tcol.Type = strings.TrimSpace(c[eq+1:])\n\t\t\tc = c[:eq]\n\t\t}\n\n\t\tcol.Name = strings.TrimSpace(c)\n\t\tif col.Type == \"\" {\n\t\t\tcol.Type = \"TEXT\"\n\t\t} else {\n\t\t\tcol.Type = strings.ToUpper(col.Type)\n\t\t}\n\n\t\tst.Columns = append(st.Columns, col)\n\t}\n\n\t// Finally the geometry\n\tvar geom string\n\tvar expr string\n\tswitch t.Type {\n\tcase \"polygon\":\n\t\tgeom = fmt.Sprintf(\"geometry(MultiPolygon, %d)\", srid)\n\t\texpr = fmt.Sprintf(\"st_multi(way)::geometry(MultiPolygon, %d)\", srid)\n\tcase \"line\":\n\t\tgeom = fmt.Sprintf(\"geometry(MultiLinestring, %d)\", srid)\n\t\texpr = fmt.Sprintf(\"st_multi(way)::geometry(MultiLinestring, %d)\", srid)\n\tcase \"point\":\n\t\tgeom = fmt.Sprintf(\"geometry(MultiPoint, %d)\", srid)\n\t\texpr = fmt.Sprintf(\"st_multi(way)::geometry(MultiPoint, %d)\", srid)\n\tcase \"\":\n\t\treturn fmt.Errorf(\"Table %s has no type defined\", t.Name)\n\tdefault:\n\t\treturn fmt.Errorf(\"Table %s has unsupported type %s\", t.Name, t.Type)\n\t}\n\tst.Columns = append(st.Columns, SqlColumn{\n\t\tName: \"geom\",\n\t\tType: geom,\n\t\tExpression: expr,\n\t\tFlags: \"NOT NULL\",\n\t\tSynthetic: true,\n\t})\n\n\treturn nil\n}", "func (drv *Driver) DumpSchema(db *sql.DB) ([]byte, error) {\n\tpath := ConnectionString(drv.databaseURL)\n\tschema, err := dbutil.RunCommand(\"sqlite3\", path, \".schema --nosys\")\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tmigrations, err := drv.schemaMigrationsDump(db)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tschema = append(schema, migrations...)\n\treturn dbutil.TrimLeadingSQLComments(schema)\n}", "func NewSchema(init ...*Schema) *Schema {\n\tvar o *Schema\n\tif len(init) == 1 {\n\t\to = init[0]\n\t} else {\n\t\to = new(Schema)\n\t}\n\treturn o\n}", "func addSchemaPrefix(schemaName, query string) string {\n\tprefixedQuery := query\n\tfor _, re := range schemaPrefixRegexps {\n\t\tprefixedQuery = re.ReplaceAllString(prefixedQuery, fmt.Sprintf(\"${1}%s.${2}${3}\", schemaName))\n\t}\n\treturn prefixedQuery\n}", "func initSchema(ctx context.Context, db *sqlx.DB, log *log.Logger, isUnittest bool) func(*sqlx.DB) error {\n\tf := func(db *sqlx.DB) error {\n\t\treturn nil\n\t}\n\n\treturn f\n}", "func GetSchema() string {\n\treturn fmt.Sprintf(`\n\tschema {\n\t\tquery: Query\n\t\tmutation: Mutation\n\t}\n\t%s\n\t%s\n\t%s\n\t%s\n`, typeDefs, inputs, queries, mutations)\n}", "func NewSchema(db *sqlx.DB) *graphql.Schema {\n\tresolver := Resolver{\n\t\tdb: db,\n\t}\n\treturn graphql.MustParseSchema(schema, &resolver)\n}", "func insertSQLFormat(db *sql.DB) string {\n\tconst insertSQLFormatMySQL = \"INSERT IGNORE INTO watt (stamp, watt) VALUES ('%s',%d)\"\n\tconst insertSQLFormatSQLITE = \"INSERT OR IGNORE INTO watt (stamp, watt) VALUES ('%s',%d)\"\n\n\tdriverName := reflect.ValueOf(db.Driver()).Type().String()\n\t// log.Printf(\"db.Driver.Name: %s\\n\", driverName)\n\tswitch driverName {\n\tcase \"*mysql.MySQLDriver\":\n\t\treturn insertSQLFormatMySQL\n\tcase \"*sqlite3.SQLiteDriver\":\n\t\treturn insertSQLFormatSQLITE\n\tdefault:\n\t\tlog.Fatalf(\"Could not create insert statement for unknown driver: %s\", driverName)\n\t\treturn \"\"\n\t}\n\n}", "func getDatabaseStmt(dbName string) string {\n\treturn fmt.Sprintf(\"\"+\n\t\t\"--\\n\"+\n\t\t\"-- PostgreSQL database structure for %s\\n\"+\n\t\t\"--\\n\\n\",\n\t\tdbName)\n}", "func (w *windowTransformation2) createSchema(cols []flux.ColMeta) []flux.ColMeta {\n\tncols := len(cols)\n\tif execute.ColIdx(w.startCol, cols) < 0 {\n\t\tncols++\n\t}\n\tif execute.ColIdx(w.stopCol, cols) < 0 {\n\t\tncols++\n\t}\n\n\tnewCols := make([]flux.ColMeta, 0, ncols)\n\tfor _, col := range cols {\n\t\tif col.Label == w.startCol || col.Label == w.stopCol {\n\t\t\tcol.Type = flux.TTime\n\t\t}\n\t\tnewCols = append(newCols, col)\n\t}\n\n\tif execute.ColIdx(w.startCol, newCols) < 0 {\n\t\tnewCols = append(newCols, flux.ColMeta{\n\t\t\tLabel: w.startCol,\n\t\t\tType: flux.TTime,\n\t\t})\n\t}\n\n\tif execute.ColIdx(w.stopCol, newCols) < 0 {\n\t\tnewCols = append(newCols, flux.ColMeta{\n\t\t\tLabel: w.stopCol,\n\t\t\tType: flux.TTime,\n\t\t})\n\t}\n\treturn newCols\n}", "func PrintDbScheme(w io.Writer) {\n\tfmt.Fprintf(w, \"/** Auto-generated dbscheme; do not edit. */\\n\\n\")\n\tfor _, snippet := range defaultSnippets {\n\t\tfmt.Fprintf(w, \"%s\\n\", snippet)\n\t}\n\tfor _, table := range tables {\n\t\tfmt.Fprintf(w, \"%s\\n\\n\", table.String())\n\t}\n\tfor _, tp := range types {\n\t\tdef := tp.def()\n\t\tif def != \"\" {\n\t\t\tfmt.Fprintf(w, \"%s\\n\\n\", def)\n\t\t}\n\t}\n}", "func (t *TableSchema) schema() (string, error) {\n\tswitch t.Driver {\n\tcase DriverMysql:\n\t\treturn t.schemaMysql()\n\tcase DriverSQLite, DriverSQLite3:\n\t\treturn t.schemaSQLite()\n\tdefault:\n\t\treturn \"\", fmt.Errorf(\"not support driver: %s\", t.Driver)\n\t}\n}", "func (p Postgres) Schema() string {\n\tif p.schema != \"\" {\n\t\treturn p.schema\n\t}\n\treturn getDefaultValue(p, \"schema\")\n}", "func (t *TableSchema) CreateSQL() string {\n\tschemaSQL, err := t.schema()\n\tif err != nil {\n\t\treturn \"\"\n\t}\n\n\tquery := fmt.Sprintf(tableCreateSQLTpl, t.Name, schemaSQL)\n\treturn query\n}", "func (t eventTriggerSchema) Statement() string {\n\ts := fmt.Sprintf(\"\"+\n\t\t\"--\\n\"+\n\t\t\"-- Event trigger structure for %s\\n\"+\n\t\t\"--\\n\",\n\t\tt.name)\n\ts += fmt.Sprintf(\"CREATE EVENT TRIGGER %s ON %s\", t.name, t.event)\n\tif t.tags != \"\" {\n\t\ts += fmt.Sprintf(\"\\n WHEN TAG IN (%s)\", t.tags)\n\t}\n\ts += fmt.Sprintf(\"\\n EXECUTE FUNCTION %s();\\n\", t.funcName)\n\n\tif t.enabled != \"O\" {\n\t\ts += fmt.Sprintf(\"ALTER EVENT TRIGGER %s \", t.name)\n\t\tswitch t.enabled {\n\t\tcase \"D\":\n\t\t\ts += \"DISABLE;\\n\"\n\t\tcase \"A\":\n\t\t\ts += \"ENABLE ALWAYS;\\n\"\n\t\tcase \"R\":\n\t\t\ts += \"ENABLE REPLICA;\\n\"\n\t\tdefault:\n\t\t\ts += \"ENABLE;\\n\"\n\t\t}\n\t}\n\ts += \"\\n\"\n\treturn s\n}", "func CreateSchema(conn FConnR) Schema {\n\treturn Schema{\n\t\tconnection: conn,\n\t}\n}", "func (sb *SchemaBuilder) Show() string {\n\tq := strings.Builder{}\n\n\tq.WriteString(fmt.Sprintf(`SHOW SCHEMAS LIKE '%v'`, sb.name))\n\n\tif sb.db != \"\" {\n\t\tq.WriteString(fmt.Sprintf(` IN DATABASE \"%v\"`, sb.db))\n\t}\n\n\treturn q.String()\n}", "func BuildStatements(args []sql.NamedArg) string {\n\tvar statements []string\n\tfor _, arg := range args {\n\t\tstatements = append(statements, fmt.Sprintf(\"%s=?\", arg.Name))\n\t}\n\treturn strings.Join(statements, \",\")\n}", "func newResultSetSchema(colNamesAndTypes ...interface{}) schema.Schema {\n\n\tif len(colNamesAndTypes)%2 != 0 {\n\t\tpanic(\"Non-even number of inputs passed to newResultSetSchema\")\n\t}\n\n\tcols := make([]schema.Column, len(colNamesAndTypes)/2)\n\tfor i := 0; i < len(colNamesAndTypes); i += 2 {\n\t\tname := colNamesAndTypes[i].(string)\n\t\tnomsKind := colNamesAndTypes[i+1].(types.NomsKind)\n\t\tcols[i/2] = schema.NewColumn(name, uint64(i/2), nomsKind, false)\n\t}\n\n\tcollection, err := schema.NewColCollection(cols...)\n\tif err != nil {\n\t\tpanic(\"unexpected error \" + err.Error())\n\t}\n\treturn schema.UnkeyedSchemaFromCols(collection)\n}", "func generateCreateTable(tbl table.Table) (operation SQLOperation) {\n\tvar builder StatementBuilder\n\n\toperation.Op = table.Add\n\toperation.Name = tbl.Name\n\n\t// tableTemplate := \"CREATE TABLE `%s` (%s%s) ENGINE=%s%s DEFAULT CHARSET=%s;\"\n\n\t// Setup Statement\n\tbuilder.Add(\"CREATE TABLE\")\n\tbuilder.AddQuote(tbl.Name)\n\n\tcolumns := []string{}\n\tisAutoInc := false\n\n\tfor _, col := range tbl.Columns {\n\t\tcolumns = append(columns, col.ToSQL())\n\t\tif col.AutoInc {\n\t\t\tisAutoInc = true\n\t\t}\n\t}\n\n\tindexes := []string{}\n\n\tif tbl.PrimaryIndex.IsValid() {\n\t\tindexes = append(indexes, tbl.PrimaryIndex.ToSQL())\n\t}\n\n\tfor _, ind := range tbl.SecondaryIndexes {\n\t\tif ind.IsValid() {\n\t\t\tindexes = append(indexes, ind.ToSQL())\n\t\t}\n\t}\n\n\tstrIndexes := \"\"\n\tif len(indexes) > 0 {\n\t\tstrIndexes = \", \" + strings.Join(indexes, \",\")\n\t}\n\n\t// Add Columns and Indexes\n\tbuilder.Add(fmt.Sprintf(\"(%s%s)\", strings.Join(columns, \",\"), strIndexes))\n\n\t// Add Table Options\n\tbuilder.AddFormat(\"ENGINE=%s\", tbl.Engine)\n\n\t// If AUTO_INCREMENT is being used and it has a non-zero value\n\tif isAutoInc && tbl.AutoInc > 0 {\n\t\tbuilder.AddFormat(\"AUTO_INCREMENT=%d\", tbl.AutoInc)\n\t}\n\n\tbuilder.AddFormat(\"DEFAULT CHARSET=%s\", tbl.CharSet)\n\n\tif len(tbl.RowFormat) > 0 {\n\t\tbuilder.AddFormat(\"ROW_FORMAT=%s\", tbl.RowFormat)\n\t}\n\n\tif len(tbl.Collation) > 0 {\n\t\tbuilder.AddFormat(\"COLLATE=%s\", tbl.Collation)\n\t}\n\toperation.Statement = builder.Format()\n\toperation.Metadata = tbl.Metadata\n\treturn operation\n}", "func Schema(schema string) VitessOption {\n\tif schema == \"\" {\n\t\tlog.Fatal(\"BUG: provided schema must not be empty\")\n\t}\n\n\ttempSchemaDir := \"\"\n\treturn VitessOption{\n\t\tbeforeRun: func(hdl *Handle) error {\n\t\t\tif hdl.db.DbName() == \"\" {\n\t\t\t\treturn fmt.Errorf(\"Schema option requires a previously passed MySQLOnly option\")\n\t\t\t}\n\t\t\tif hdl.db.SchemaDir != \"\" {\n\t\t\t\treturn fmt.Errorf(\"Schema option would overwrite directory set by another option (%v)\", hdl.db.SchemaDir)\n\t\t\t}\n\n\t\t\tvar err error\n\t\t\ttempSchemaDir, err = ioutil.TempDir(\"\", \"vt\")\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tksDir := path.Join(tempSchemaDir, hdl.db.DbName())\n\t\t\terr = os.Mkdir(ksDir, os.ModeDir|0775)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tfileName := path.Join(ksDir, \"schema.sql\")\n\t\t\terr = ioutil.WriteFile(fileName, []byte(schema), 0666)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\thdl.db.SchemaDir = tempSchemaDir\n\t\t\treturn nil\n\t\t},\n\t\tafterRun: func() {\n\t\t\tif tempSchemaDir != \"\" {\n\t\t\t\tos.RemoveAll(tempSchemaDir)\n\t\t\t}\n\t\t},\n\t}\n}", "func validateSchema(db *sql.DB) error {\n\tdriver, err := postgres.WithInstance(db, &postgres.Config{})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// whether we are running a test database or a production (which is in the cloud)\n\t// will use different files to start the db\n\tenvironment, _ := os.LookupEnv(\"ENVIRONMENT\")\n\tvar migrationPath string\n\t// Runs when we use docker (this runs in the cloud either on the dev side or productin side)\n\tmigrationPath = \"file://database/migrations\"\n\tif environment == \"production\" || environment == \"dev\" {\n\t\tfmt.Println(\"Using dev migrations\")\n\t\tmigrationPath = \"file://database/migrations\"\n\t} else {\n\t\t// This runs when we run our tests (this is run in the docker test files)\n\t\tfmt.Println(\"Using test migrations\")\n\t\tmigrationPath = \"file://database/test-migrations\"\n\t}\n\tm, err := migrate.NewWithDatabaseInstance(\n\t\t// for production\n\t\tmigrationPath,\n\n\t\t\"postgres\", driver)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\terr = m.Up()\n\tif err != nil && err != migrate.ErrNoChange {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func (node *ShowDatabases) Format(buf *bytes.Buffer, f FmtFlags) {\n\tbuf.WriteString(\"SHOW DATABASES\")\n}", "func (g *GroupBy) Schema() sql.Schema {\n\tvar s = make(sql.Schema, len(g.SelectedExprs))\n\tfor i, e := range g.SelectedExprs {\n\t\tvar name string\n\t\tif n, ok := e.(sql.Nameable); ok {\n\t\t\tname = n.Name()\n\t\t} else {\n\t\t\tname = e.String()\n\t\t}\n\n\t\tvar table string\n\t\tif t, ok := e.(sql.Tableable); ok {\n\t\t\ttable = t.Table()\n\t\t}\n\n\t\ts[i] = &sql.Column{\n\t\t\tName: name,\n\t\t\tType: e.Type(),\n\t\t\tNullable: e.IsNullable(),\n\t\t\tSource: table,\n\t\t}\n\t}\n\n\treturn s\n}", "func GenerateIdempotentDDLs(mode GeneratorMode, desiredSQL string, currentSQL string) ([]string, error) {\n\t// TODO: invalidate duplicated tables, columns\n\tdesiredDDLs, err := parseDDLs(mode, desiredSQL)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tcurrentDDLs, err := parseDDLs(mode, currentSQL)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\ttables, err := convertDDLsToTables(currentDDLs)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tgenerator := Generator{\n\t\tmode: mode,\n\t\tdesiredTables: []*Table{},\n\t\tcurrentTables: tables,\n\t}\n\treturn generator.generateDDLs(desiredDDLs)\n}", "func TestInitSchemaWithMigrations(t *testing.T) {\n\tforEachDatabase(t, func(db *sqlx.DB) {\n\t\tm := New(db, DefaultOptions, migrations)\n\t\tm.InitSchema(func(tx *sqlx.DB) error {\n\t\t\tq := `CREATE TABLE \"people\" (\"id\" serial,\"created_at\" timestamp with time zone,\"updated_at\" timestamp with time zone,\"deleted_at\" timestamp with time zone,\"name\" text , PRIMARY KEY (\"id\"))`\n\t\t\t_, err := tx.Exec(q)\n\t\t\treturn err\n\t\t})\n\n\t\tassert.NoError(t, m.Migrate())\n\t\tassert.True(t, m.hasTable(\"people\"))\n\t\tassert.False(t, m.hasTable(\"pets\"))\n\t\tassert.Equal(t, 3, tableCount(t, db, \"migrations\"))\n\t})\n}", "func SyncSchemas() {\n\t// initialize omadb in K8s \n\tm, err := migrate.New(\n\t\t\"file://platform/initialize/sql\",\n\t\t\"postgres://admin:admin123@postgres:5432/omadb?sslmode=disable\")\n\tif err != nil {\n\t\tlog.Fatalf(\"Unable to start db schema migrator %v\", err)\n\t}\n\tif err := m.Up(); err != nil {\n\t\tif err.Error() == \"no change\" {\n\t\t\tlog.Println(\"schema_migrations version problem\")\n\t\t} else {\n\t\t\tlog.Fatalf(\"Unable to migrate up to the latest database schema %v\", err)\n\t\t}\n\t}\n}", "func (dp *Dumper) getPgSchemas() ([]pgSchema, error) {\n\tvar schemas []pgSchema\n\trows, err := dp.conn.DB.Query(\"SELECT schema_name, schema_owner FROM information_schema.schemata;\")\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer rows.Close()\n\n\tfor rows.Next() {\n\t\tvar schema pgSchema\n\t\tif err := rows.Scan(&schema.name, &schema.schemaOwner); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tschema.name = quoteIdentifier(schema.name)\n\t\tif ok := pgSystemSchema(schema.name); ok {\n\t\t\tcontinue\n\t\t}\n\t\tschemas = append(schemas, schema)\n\t}\n\treturn schemas, nil\n}", "func migrateSchemas(ctx context.Context, db *core_database.DatabaseConn, log *zap.Logger, models ...interface{}) error {\n\tvar engine *gorm.DB\n\tif db == nil {\n\t\treturn service_errors.ErrInvalidInputArguments\n\t}\n\n\tif engine = db.Engine; engine == nil {\n\t\treturn errors.New(\"invalid gorm database engine object\")\n\t}\n\n\tif len(models) > 0 {\n\t\tif err := engine.AutoMigrate(models...); err != nil {\n\t\t\t// TODO: emit metric\n\t\t\tlog.Error(err.Error())\n\t\t\treturn err\n\t\t}\n\n\t\tlog.Info(\"successfully migrated database schemas\")\n\t}\n\n\treturn nil\n}", "func Pattern(query string) []byte {\n\ttokenizer := sqlparser.NewStringTokenizer(query)\n\tbuf := bytes.Buffer{}\n\tl := make([]byte, 4)\n\tfor {\n\t\ttyp, val := tokenizer.Scan()\n\t\tswitch typ {\n\t\tcase sqlparser.ID: //table, database, variable & ... names\n\t\t\tbuf.Write(val)\n\t\tcase 0: //End of query\n\t\t\treturn buf.Bytes()\n\t\tdefault:\n\t\t\tbinary.BigEndian.PutUint32(l, uint32(typ))\n\t\t\tbuf.Write(l)\n\t\t}\n\t}\n}", "func (ds *DiffScript) GenerateSQL() string {\n\tswitch ds.Compare {\n\tcase INSERT:\n\t\tswitch ds.Type {\n\t\tcase FUNCTION, PROCEDURE, TRIGGER:\n\t\t\treturn ds.Script + RoutineDelimeter\n\t\tdefault:\n\t\t\treturn ds.Script + \";\"\n\t\t}\n\tcase UPDATE:\n\t\tswitch ds.Type {\n\t\tcase VIEW:\n\t\t\treturn strings.Replace(ds.Script, \"CREATE\", \"CREATE OR REPLACE\", -1) + \";\"\n\t\tcase FUNCTION, PROCEDURE, TRIGGER:\n\t\t\treturn fmt.Sprintf(\"%s%s\\n%s%s\", ds.generateDropSQL(), RoutineDelimeter, ds.Script, RoutineDelimeter)\n\t\t}\n\tcase DELETE:\n\t\tswitch ds.Type {\n\t\tcase FUNCTION, PROCEDURE, TRIGGER:\n\t\t\treturn ds.generateDropSQL() + RoutineDelimeter\n\t\tdefault:\n\t\t\treturn ds.generateDropSQL() + \";\"\n\t\t}\n\t}\n\tlog.Fatal(\"invalid compare type or compare\", ds.Compare, ds.Type)\n\treturn \"\"\n}", "func NewSchema(ts *prompb.TimeSeries) *Schema {\n\treturn &Schema{\n\t\tTableName: getTimeSeriesTableName(ts),\n\t\tLabelNames: getLabelNames(ts),\n\t}\n}", "func NewSchema(dal *Dal, name string) *Schema {\n\n\ts := new(Schema)\n\ts.Name = name\n\ts.Tables = map[string]*Table{}\n\ts.Aliases = map[string]string{}\n\ts.Dal = dal\n\treturn s\n}", "func (g *Generator) generateDDLs(desiredDDLs []DDL) ([]string, error) {\n\tddls := []string{}\n\n\t// Incrementally examine desiredDDLs\n\tfor _, ddl := range desiredDDLs {\n\t\tswitch desired := ddl.(type) {\n\t\tcase *CreateTable:\n\t\t\tif currentTable := findTableByName(g.currentTables, desired.table.name); currentTable != nil {\n\t\t\t\t// Table already exists, guess required DDLs.\n\t\t\t\ttableDDLs, err := g.generateDDLsForCreateTable(*currentTable, *desired)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn ddls, err\n\t\t\t\t}\n\t\t\t\tddls = append(ddls, tableDDLs...)\n\t\t\t\tmergeTable(currentTable, desired.table)\n\t\t\t} else {\n\t\t\t\t// Table not found, create table.\n\t\t\t\tddls = append(ddls, desired.statement)\n\t\t\t\ttable := desired.table // copy table\n\t\t\t\tg.currentTables = append(g.currentTables, &table)\n\t\t\t}\n\t\t\ttable := desired.table // copy table\n\t\t\tg.desiredTables = append(g.desiredTables, &table)\n\t\tcase *CreateIndex:\n\t\t\tindexDDLs, err := g.generateDDLsForCreateIndex(desired.tableName, desired.index, \"CREATE INDEX\", ddl.Statement())\n\t\t\tif err != nil {\n\t\t\t\treturn ddls, err\n\t\t\t}\n\t\t\tddls = append(ddls, indexDDLs...)\n\t\tcase *AddIndex:\n\t\t\tindexDDLs, err := g.generateDDLsForCreateIndex(desired.tableName, desired.index, \"ALTER TABLE\", ddl.Statement())\n\t\t\tif err != nil {\n\t\t\t\treturn ddls, err\n\t\t\t}\n\t\t\tddls = append(ddls, indexDDLs...)\n\t\tdefault:\n\t\t\treturn nil, fmt.Errorf(\"unexpected ddl type in generateDDLs: %v\", desired)\n\t\t}\n\t}\n\n\t// Clean up obsoleted tables, indexes, columns\n\tfor _, currentTable := range g.currentTables {\n\t\tdesiredTable := findTableByName(g.desiredTables, currentTable.name)\n\t\tif desiredTable == nil {\n\t\t\t// Obsoleted table found. Drop table.\n\t\t\tddls = append(ddls, fmt.Sprintf(\"DROP TABLE %s\", g.escapeSQLName(currentTable.name)))\n\t\t\tg.currentTables = removeTableByName(g.currentTables, currentTable.name)\n\t\t\tcontinue\n\t\t}\n\n\t\t// Table is expected to exist. Drop foreign keys prior to index deletion\n\t\tfor _, foreignKey := range currentTable.foreignKeys {\n\t\t\tif containsString(convertForeignKeysToConstraintNames(desiredTable.foreignKeys), foreignKey.constraintName) {\n\t\t\t\tcontinue // Foreign key is expected to exist.\n\t\t\t}\n\n\t\t\tvar ddl string\n\t\t\tif g.mode == GeneratorModePostgres {\n\t\t\t\tddl = fmt.Sprintf(\"ALTER TABLE %s DROP CONSTRAINT %s\", currentTable.name, foreignKey.constraintName)\n\t\t\t} else {\n\t\t\t\tddl = fmt.Sprintf(\"ALTER TABLE %s DROP FOREIGN KEY %s\", currentTable.name, foreignKey.constraintName)\n\t\t\t}\n\t\t\tddls = append(ddls, ddl)\n\t\t\t// TODO: simulate to remove foreign key from `currentTable.foreignKeys`?\n\t\t}\n\n\t\t// Check indexes\n\t\tfor _, index := range currentTable.indexes {\n\t\t\tif containsString(convertIndexesToIndexNames(desiredTable.indexes), index.name) ||\n\t\t\t\tcontainsString(convertForeignKeysToIndexNames(desiredTable.foreignKeys), index.name) {\n\t\t\t\tcontinue // Index is expected to exist.\n\t\t\t}\n\n\t\t\t// Index is obsoleted. Check and drop index as needed.\n\t\t\tindexDDLs, err := g.generateDDLsForAbsentIndex(index, *currentTable, *desiredTable)\n\t\t\tif err != nil {\n\t\t\t\treturn ddls, err\n\t\t\t}\n\t\t\tddls = append(ddls, indexDDLs...)\n\t\t\t// TODO: simulate to remove index from `currentTable.indexes`?\n\t\t}\n\n\t\t// Check columns.\n\t\tfor _, column := range currentTable.columns {\n\t\t\tif containsString(convertColumnsToColumnNames(desiredTable.columns), column.name) {\n\t\t\t\tcontinue // Column is expected to exist.\n\t\t\t}\n\n\t\t\t// Column is obsoleted. Drop column.\n\t\t\tddl := fmt.Sprintf(\"ALTER TABLE %s DROP COLUMN %s\", desiredTable.name, column.name) // TODO: escape\n\t\t\tddls = append(ddls, ddl)\n\t\t\t// TODO: simulate to remove column from `currentTable.columns`?\n\t\t}\n\t}\n\n\treturn ddls, nil\n}" ]
[ "0.6908054", "0.6606466", "0.6260087", "0.61642176", "0.6143249", "0.60985523", "0.5964357", "0.5963818", "0.5937056", "0.58818525", "0.58597445", "0.58491164", "0.58351886", "0.5816747", "0.57962525", "0.5755745", "0.5718836", "0.57138056", "0.56828296", "0.5675849", "0.5671784", "0.56438994", "0.5638699", "0.56082875", "0.5602006", "0.5587461", "0.5575779", "0.5568534", "0.5539323", "0.55245817", "0.55191547", "0.5512749", "0.55051106", "0.54973006", "0.5482436", "0.5465168", "0.545022", "0.5435759", "0.5417091", "0.54013515", "0.5399477", "0.53952724", "0.5395099", "0.5380653", "0.53595126", "0.53423774", "0.5339983", "0.53345054", "0.5325396", "0.53133655", "0.5308617", "0.52970356", "0.52934754", "0.5290819", "0.52821934", "0.5261397", "0.52558625", "0.5251657", "0.52370495", "0.52349865", "0.5218961", "0.5217134", "0.5216678", "0.5211781", "0.5184158", "0.5183436", "0.51833975", "0.517716", "0.5172668", "0.5168378", "0.5145316", "0.5129978", "0.5124686", "0.5124635", "0.51187897", "0.5108294", "0.50956315", "0.50951385", "0.5084195", "0.5080179", "0.5061932", "0.50473475", "0.5042564", "0.50416195", "0.5034447", "0.5029237", "0.5025967", "0.5022054", "0.50189006", "0.5016715", "0.50103736", "0.50072217", "0.4997555", "0.499655", "0.49861714", "0.4981675", "0.49781582", "0.49731517", "0.49722955", "0.49700624" ]
0.70060974
0
Find computes the latest trigger based on CQ+1 and CQ+2 votes. CQ+2 a.k.a. Full Run takes priority of CQ+1 a.k.a Dry Run, even if CQ+1 vote is newer. Among several equal votes, the earliest is selected as the triggering CQ vote. If the applicable ConfigGroup specifies additional modes AND user who voted on the triggering CQ vote also voted on the additional label, then the additional mode is selected instead of standard Dry/Full Run. Returns nil if CL is not triggered.
func Find(ci *gerritpb.ChangeInfo, cg *cfgpb.ConfigGroup) *run.Trigger { if ci.GetStatus() != gerritpb.ChangeStatus_NEW { return nil } li := ci.GetLabels()[CQLabelName] if li == nil { return nil } curRevision := ci.GetCurrentRevision() // Check if there was a previous attempt that got canceled by means of a // comment. Normally, CQDaemon would remove appropriate label, but in case // of ACLs misconfiguration preventing CQDaemon from removing votes on // behalf of users, CQDaemon will abort attempt by posting a special comment. var prevAttemptTs time.Time for _, msg := range ci.GetMessages() { if bd, ok := botdata.Parse(msg); ok { if bd.Action == botdata.Cancel && bd.Revision == curRevision && bd.TriggeredAt.After(prevAttemptTs) { prevAttemptTs = bd.TriggeredAt } } } largest := int32(0) var earliest time.Time var ret *run.Trigger for _, ai := range li.GetAll() { val := ai.GetValue() switch { case val <= 0: continue case val < largest: continue case val >= 2: // Clamp down vote value for compatibility with CQDaemon. val = 2 } switch t := ai.GetDate().AsTime(); { case !prevAttemptTs.Before(t): continue case val > largest: largest = val earliest = t case earliest.Before(t): continue case earliest.After(t): earliest = t default: // Equal timestamps shouldn't really ever happen. continue } ret = &run.Trigger{ Mode: string(voteToMode[val]), GerritAccountId: ai.GetUser().GetAccountId(), Time: ai.GetDate(), Email: ai.GetUser().GetEmail(), } } if ret == nil { return nil } for _, mode := range cg.GetAdditionalModes() { if applyAdditionalMode(ci, mode, ret) { // first one wins break } } // Gerrit may copy CQ vote(s) to next patchset in some project configurations. // In such cases, CQ vote timestamp will be *before* new patchset creation, // and yet *this* CQ attempt started only when new patchset was created. // So, attempt start is the latest of timestamps (CQ vote, this patchset // creation). revisionTs := ci.Revisions[curRevision].GetCreated() if ret.GetTime().AsTime().Before(revisionTs.AsTime()) { ret.Time = revisionTs } return ret }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (p *Paygen) FindLatest() (*Delta, error) {\n\tif len(p.Deltas) == 0 {\n\t\treturn nil, errors.New(\"emtpy input\")\n\t}\n\n\tvar latest *Delta\n\tmajorMax, minorMax, patchMax := 0, 0, 0\n\n\tfor _, delta := range p.Deltas {\n\t\tnewer := false\n\t\tmajor, minor, patch, err := version(delta.ChromeOSVersion)\n\t\tif err != nil {\n\t\t\tcontinue // There are deltas without ChromeOS Version.\n\t\t}\n\n\t\tif major > majorMax {\n\t\t\tnewer = true\n\t\t} else if major == majorMax {\n\t\t\tif minor > minorMax {\n\t\t\t\tnewer = true\n\t\t\t} else if minor == minorMax && patch > patchMax {\n\t\t\t\tnewer = true\n\t\t\t}\n\t\t}\n\n\t\tif newer {\n\t\t\tmajorMax, minorMax, patchMax = major, minor, patch\n\t\t\tlatest = &delta\n\t\t}\n\t}\n\n\tif latest == nil {\n\t\treturn nil, errors.New(\"none of the deltas contained ChromeOS Version\")\n\t}\n\n\treturn latest, nil\n}", "func (lp *logPoller) LatestLogByEventSigWithConfs(eventSig common.Hash, address common.Address, confs int, qopts ...pg.QOpt) (*Log, error) {\n\treturn lp.orm.SelectLatestLogEventSigWithConfs(eventSig, address, confs, qopts...)\n}", "func (plugin *recommended) Handle(req *comm.Request) error {\n\tbranch := defaultBranch\n\tif len(req.Arguments) > 2 {\n\t\tbranch = req.Arguments[2]\n\t}\n\n\tjRecommended := RecommendedJSON{}\n\t{\n\t\turl := plugin.config.URLs.BaseCatURL + plugin.config.URLs.BaseRecommendedURL\n\t\tparams := DefaultRecommendedParams()\n\t\tparams[\"branch__name\"] = branch\n\n\t\tp := params.AsUrlValues()\n\t\ts := napping.Session{}\n\t\tr, err := s.Get(url, &p, &jRecommended, nil)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif r.Status() != 200 {\n\t\t\treturn fmt.Errorf(\"expect response status code 200. Actual %d %s\", r.Status(), params)\n\t\t}\n\t\tif len(jRecommended.Objects) == 0 {\n\t\t\treturn fmt.Errorf(\"recommended change list for %s not found\", params[\"branch__name\"])\n\t\t}\n\t\tif len(jRecommended.Objects) > 1 {\n\t\t\treturn fmt.Errorf(\"expected one object. Actual %d %s\", len(jRecommended.Objects), params)\n\t\t}\n\t}\n\n\t// CAT URL:\n\t// http://cat.eng.vmware.com/api/v2.0/build/<id>/?format=json\n\tjCurrBuild := CurrBuildJSON{}\n\t{\n\t\turl := plugin.config.URLs.BaseCatURL + jRecommended.Objects[0].CurrBuild\n\t\tparams := DefaultCurrBuildParams()\n\n\t\tp := params.AsUrlValues()\n\t\ts := napping.Session{}\n\t\tr, err := s.Get(url, &p, &jCurrBuild, nil)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif r.Status() != 200 {\n\t\t\treturn fmt.Errorf(\"expect response status code 200. Actual %d\\n\", r.Status())\n\t\t}\n\t}\n\n\tt := comm.Mention(req.User)\n\tt += fmt.Sprintf(\"recommended changeset for *%s* \", branch)\n\tt += fmt.Sprintf(\"is *%s*\", comm.P4WebBranchURL(branch, jCurrBuild.Changeset))\n\n\tiop := &comm.Interop{\n\t\tRequest: req,\n\t\tResponse: &comm.Response{\n\t\t\tChannel: req.Channel,\n\t\t\tText: t,\n\t\t\tParameters: comm.DefaultMessageParameters()}}\n\tcomm.SB.ChanResponse <- iop.Response\n\tcomm.SB.ChanPersist <- iop\n\n\treturn nil\n}", "func (a *Archive) UpdateCandidate(v *version.Version) *Release {\n\tvar ref *Release\n\tif v.Enterprise {\n\t\tref = a.ent\n\t} else {\n\t\tref = a.team\n\t}\n\n\tif ref != nil && ref.Version.GT(*v.Version) {\n\t\treturn ref\n\t}\n\treturn nil\n}", "func (e *Election) Condorcet() int {\n\tmax := 0\n\timax := 0\n\te.R = e.Rank()\n\tfor i, v := range e.R {\n\t\tif v > max {\n\t\t\timax = i\n\t\t\tmax = v\n\t\t}\n\t}\n\n\tf := false\n\tfor _, v := range e.R {\n\t\tif v == max {\n\t\t\tif f {\n\t\t\t\treturn -1\n\t\t\t}\n\t\t\tf = true\n\t\t}\n\t}\n\n\treturn imax\n}", "func (lp *logPoller) findBlockAfterLCA(ctx context.Context, current *evmtypes.Head) (*evmtypes.Head, error) {\n\t// Current is where the mismatch starts.\n\t// Check its parent to see if its the same as ours saved.\n\tparent, err := lp.ec.HeadByHash(ctx, current.ParentHash)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tblockAfterLCA := *current\n\treorgStart := parent.Number\n\t// We expect reorgs up to the block after (current - finalityDepth),\n\t// since the block at (current - finalityDepth) is finalized.\n\t// We loop via parent instead of current so current always holds the LCA+1.\n\t// If the parent block number becomes < the first finalized block our reorg is too deep.\n\tfor parent.Number >= (reorgStart - lp.finalityDepth) {\n\t\tourParentBlockHash, err := lp.orm.SelectBlockByNumber(parent.Number, pg.WithParentCtx(ctx))\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tif parent.Hash == ourParentBlockHash.BlockHash {\n\t\t\t// If we do have the blockhash, return blockAfterLCA\n\t\t\treturn &blockAfterLCA, nil\n\t\t}\n\t\t// Otherwise get a new parent and update blockAfterLCA.\n\t\tblockAfterLCA = *parent\n\t\tparent, err = lp.ec.HeadByHash(ctx, parent.ParentHash)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\tlp.lggr.Criticalw(\"Reorg greater than finality depth detected\", \"max reorg depth\", lp.finalityDepth-1)\n\trerr := errors.New(\"Reorg greater than finality depth\")\n\tlp.SvcErrBuffer.Append(rerr)\n\treturn nil, rerr\n}", "func configsFind(db *gorm.DB, scope scope) (*Config, error) {\n\tvar config Config\n\tscope = composedScope{order(\"created_at desc\"), scope}\n\treturn &config, first(db, scope, &config)\n}", "func LatestFixed(as []osv.Affected) string {\n\tv := \"\"\n\tfor _, a := range as {\n\t\tfor _, r := range a.Ranges {\n\t\t\tif r.Type == osv.TypeSemver {\n\t\t\t\tfor _, e := range r.Events {\n\t\t\t\t\tif e.Fixed != \"\" && (v == \"\" ||\n\t\t\t\t\t\tsemver.Compare(isem.CanonicalizeSemverPrefix(e.Fixed), isem.CanonicalizeSemverPrefix(v)) > 0) {\n\t\t\t\t\t\tv = e.Fixed\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\treturn v\n}", "func Poll(\n\tctx context.Context,\n\tstopc chan struct{},\n\tlg *zap.Logger,\n\tlogWriter io.Writer,\n\teksAPI eksiface.EKSAPI,\n\tclusterName string,\n\tprofileName string,\n\tdesiredStatus string,\n\tinitialWait time.Duration,\n\tpollInterval time.Duration,\n) <-chan FargateProfileStatus {\n\n\tnow := time.Now()\n\tsp := spinner.New(logWriter, \"Waiting for Fargate profile status \"+desiredStatus)\n\n\tlg.Info(\"polling fargate profile\",\n\t\tzap.String(\"cluster-name\", clusterName),\n\t\tzap.String(\"profile-name\", profileName),\n\t\tzap.String(\"desired-status\", desiredStatus),\n\t\tzap.String(\"initial-wait\", initialWait.String()),\n\t\tzap.String(\"poll-interval\", pollInterval.String()),\n\t\tzap.String(\"ctx-time-left\", ctxutil.TimeLeftTillDeadline(ctx)),\n\t)\n\n\tch := make(chan FargateProfileStatus, 10)\n\tgo func() {\n\t\t// very first poll should be no-wait\n\t\t// in case stack has already reached desired status\n\t\t// wait from second interation\n\t\twaitDur := time.Duration(0)\n\n\t\tfirst := true\n\t\tfor ctx.Err() == nil {\n\t\t\tselect {\n\t\t\tcase <-ctx.Done():\n\t\t\t\tlg.Warn(\"wait aborted, ctx done\", zap.Error(ctx.Err()))\n\t\t\t\tch <- FargateProfileStatus{FargateProfile: nil, Error: ctx.Err()}\n\t\t\t\tclose(ch)\n\t\t\t\treturn\n\n\t\t\tcase <-stopc:\n\t\t\t\tlg.Warn(\"wait stopped, stopc closed\", zap.Error(ctx.Err()))\n\t\t\t\tch <- FargateProfileStatus{FargateProfile: nil, Error: errors.New(\"wait stopped\")}\n\t\t\t\tclose(ch)\n\t\t\t\treturn\n\n\t\t\tcase <-time.After(waitDur):\n\t\t\t\t// very first poll should be no-wait\n\t\t\t\t// in case stack has already reached desired status\n\t\t\t\t// wait from second interation\n\t\t\t\tif waitDur == time.Duration(0) {\n\t\t\t\t\twaitDur = pollInterval\n\t\t\t\t}\n\t\t\t}\n\n\t\t\toutput, err := eksAPI.DescribeFargateProfile(&eks.DescribeFargateProfileInput{\n\t\t\t\tClusterName: aws.String(clusterName),\n\t\t\t\tFargateProfileName: aws.String(profileName),\n\t\t\t})\n\t\t\tif err != nil {\n\t\t\t\tif IsProfileDeleted(err) {\n\t\t\t\t\tif desiredStatus == FargateProfileStatusDELETEDORNOTEXIST {\n\t\t\t\t\t\tlg.Info(\"fargate profile is already deleted as desired; exiting\", zap.Error(err))\n\t\t\t\t\t\tch <- FargateProfileStatus{FargateProfile: nil, Error: nil}\n\t\t\t\t\t\tclose(ch)\n\t\t\t\t\t\treturn\n\t\t\t\t\t}\n\t\t\t\t\tlg.Warn(\"fargate profile does not exist\", zap.Error(err))\n\t\t\t\t\tch <- FargateProfileStatus{FargateProfile: nil, Error: err}\n\t\t\t\t\tclose(ch)\n\t\t\t\t\treturn\n\t\t\t\t}\n\n\t\t\t\tlg.Warn(\"describe fargate profile failed; retrying\", zap.Error(err))\n\t\t\t\tch <- FargateProfileStatus{FargateProfile: nil, Error: err}\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tif output.FargateProfile == nil {\n\t\t\t\tlg.Warn(\"expected non-nil fargate profile; retrying\")\n\t\t\t\tch <- FargateProfileStatus{FargateProfile: nil, Error: fmt.Errorf(\"unexpected empty response %+v\", output.GoString())}\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tfargateProfile := output.FargateProfile\n\t\t\tcurrentStatus := aws.StringValue(fargateProfile.Status)\n\t\t\tlg.Info(\"poll\",\n\t\t\t\tzap.String(\"cluster-name\", clusterName),\n\t\t\t\tzap.String(\"fargate-name\", profileName),\n\t\t\t\tzap.String(\"status\", currentStatus),\n\t\t\t\tzap.String(\"started\", humanize.RelTime(now, time.Now(), \"ago\", \"from now\")),\n\t\t\t\tzap.String(\"ctx-time-left\", ctxutil.TimeLeftTillDeadline(ctx)),\n\t\t\t)\n\t\t\tswitch currentStatus {\n\t\t\tcase desiredStatus:\n\t\t\t\tch <- FargateProfileStatus{FargateProfile: fargateProfile, Error: nil}\n\t\t\t\tlg.Info(\"desired fargate profile status; done\", zap.String(\"status\", currentStatus))\n\t\t\t\tclose(ch)\n\t\t\t\treturn\n\n\t\t\tcase eks.FargateProfileStatusCreateFailed,\n\t\t\t\teks.FargateProfileStatusDeleteFailed:\n\t\t\t\tlg.Warn(\"unexpected fargate profile status; failed\", zap.String(\"status\", currentStatus))\n\t\t\t\tch <- FargateProfileStatus{FargateProfile: fargateProfile, Error: fmt.Errorf(\"unexpected fargate status %q\", currentStatus)}\n\t\t\t\tclose(ch)\n\t\t\t\treturn\n\n\t\t\tdefault:\n\t\t\t\tch <- FargateProfileStatus{FargateProfile: fargateProfile, Error: nil}\n\t\t\t}\n\n\t\t\tif first {\n\t\t\t\tlg.Info(\"sleeping\", zap.Duration(\"initial-wait\", initialWait))\n\t\t\t\tsp.Restart()\n\t\t\t\tselect {\n\t\t\t\tcase <-ctx.Done():\n\t\t\t\t\tsp.Stop()\n\t\t\t\t\tlg.Warn(\"wait aborted, ctx done\", zap.Error(ctx.Err()))\n\t\t\t\t\tch <- FargateProfileStatus{FargateProfile: nil, Error: ctx.Err()}\n\t\t\t\t\tclose(ch)\n\t\t\t\t\treturn\n\t\t\t\tcase <-stopc:\n\t\t\t\t\tsp.Stop()\n\t\t\t\t\tlg.Warn(\"wait stopped, stopc closed\", zap.Error(ctx.Err()))\n\t\t\t\t\tch <- FargateProfileStatus{FargateProfile: nil, Error: errors.New(\"wait stopped\")}\n\t\t\t\t\tclose(ch)\n\t\t\t\t\treturn\n\t\t\t\tcase <-time.After(initialWait):\n\t\t\t\t\tsp.Stop()\n\t\t\t\t}\n\t\t\t\tfirst = false\n\t\t\t}\n\t\t}\n\n\t\tlg.Warn(\"wait aborted, ctx done\", zap.Error(ctx.Err()))\n\t\tch <- FargateProfileStatus{FargateProfile: nil, Error: ctx.Err()}\n\t\tclose(ch)\n\t\treturn\n\t}()\n\treturn ch\n}", "func (p *Plugin) Find(ctx context.Context, droneRequest *config.Request) (*drone.Config, error) {\n\tsomeUuid := uuid.New()\n\tlogrus.Infof(\"%s %s/%s started\", someUuid, droneRequest.Repo.Namespace, droneRequest.Repo.Name)\n\tdefer logrus.Infof(\"%s finished\", someUuid)\n\n\t// connect to scm\n\tclient, err := p.NewScmClient(ctx, someUuid, droneRequest.Repo)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treq := request{\n\t\tRequest: droneRequest,\n\t\tUUID: someUuid,\n\t\tClient: client,\n\t}\n\n\t// make sure this plugin is enabled for the requested repo slug\n\tif ok := p.allowlisted(&req); !ok {\n\t\t// do the default behavior by returning nil, nil\n\t\treturn nil, nil\n\t}\n\n\t// avoid running for jsonnet or starlark configurations\n\tif !strings.HasSuffix(droneRequest.Repo.Config, \".yaml\") && !strings.HasSuffix(droneRequest.Repo.Config, \".yml\") {\n\t\treturn nil, nil\n\t}\n\n\t// load the considerFile entries, if configured for considerFile\n\tif req.ConsiderData, err = p.newConsiderDataFromRequest(ctx, &req); err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn p.getConfig(ctx, &req)\n}", "func (impl *Impl) OnCLUpdated(ctx context.Context, rs *state.RunState, clids common.CLIDs) (*Result, error) {\n\tswitch status := rs.Run.Status; {\n\tcase status == run.Status_STATUS_UNSPECIFIED:\n\t\terr := errors.Reason(\"CRITICAL: Received CLUpdated events but Run is in unspecified status\").Err()\n\t\tcommon.LogError(ctx, err)\n\t\tpanic(err)\n\tcase status == run.Status_SUBMITTING:\n\t\t// Don't consume the events so that the RM executing the submission will\n\t\t// be able to read the CLUpdated events and take necessary actions after\n\t\t// submission completes. For example, a new PS is uploaded for one of\n\t\t// the unsubmitted CLs and cause the run submission to fail. RM should\n\t\t// cancel this Run instead of retrying.\n\t\treturn &Result{State: rs, PreserveEvents: true}, nil\n\tcase run.IsEnded(status):\n\t\t// Run is ended, update on CL shouldn't change the Run state.\n\t\treturn &Result{State: rs}, nil\n\t}\n\tclids.Dedupe()\n\n\tvar cls []*changelist.CL\n\tvar runCLs []*run.RunCL\n\teg, ectx := errgroup.WithContext(ctx)\n\teg.Go(func() (err error) {\n\t\tcls, err = changelist.LoadCLs(ectx, clids)\n\t\treturn err\n\t})\n\teg.Go(func() (err error) {\n\t\trunCLs, err = run.LoadRunCLs(ectx, rs.Run.ID, clids)\n\t\treturn err\n\t})\n\tif err := eg.Wait(); err != nil {\n\t\treturn nil, err\n\t}\n\n\tcg, err := rs.LoadConfigGroup(ctx)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tfor i := range clids {\n\t\tswitch cl, runCL := cls[i], runCLs[i]; {\n\t\tcase cl.Snapshot.GetPatchset() > runCL.Detail.GetPatchset():\n\t\t\t// New PS discovered.\n\t\t\treturn impl.Cancel(ctx, rs)\n\t\tcase trigger.Find(cl.Snapshot.GetGerrit().GetInfo(), cg.Content) == nil:\n\t\t\t// Trigger has been removed.\n\t\t\treturn impl.Cancel(ctx, rs)\n\n\t\tdefault:\n\t\t\t// TODO(crbug/1202270): handle some or all cases of changing trigger,\n\t\t\t// e.g. changing mode OR changing user.\n\t\t}\n\t}\n\treturn &Result{State: rs}, nil\n}", "func (m *matcher) getBest(want ...Tag) (got *haveTag, orig language.Tag, c Confidence) {\n\tbest := bestMatch{}\n\tfor i, ww := range want {\n\t\tw := ww.tag()\n\t\tvar max language.Tag\n\t\t// Check for exact match first.\n\t\th := m.index[w.LangID]\n\t\tif w.LangID != 0 {\n\t\t\tif h == nil {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\t// Base language is defined.\n\t\t\tmax, _ = canonicalize(Legacy|Deprecated|Macro, w)\n\t\t\t// A region that is added through canonicalization is stronger than\n\t\t\t// a maximized region: set it in the original (e.g. mo -> ro-MD).\n\t\t\tif w.RegionID != max.RegionID {\n\t\t\t\tw.RegionID = max.RegionID\n\t\t\t}\n\t\t\t// TODO: should we do the same for scripts?\n\t\t\t// See test case: en, sr, nl ; sh ; sr\n\t\t\tmax, _ = max.Maximize()\n\t\t} else {\n\t\t\t// Base language is not defined.\n\t\t\tif h != nil {\n\t\t\t\tfor i := range h.haveTags {\n\t\t\t\t\thave := h.haveTags[i]\n\t\t\t\t\tif equalsRest(have.tag, w) {\n\t\t\t\t\t\treturn have, w, Exact\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tif w.ScriptID == 0 && w.RegionID == 0 {\n\t\t\t\t// We skip all tags matching und for approximate matching, including\n\t\t\t\t// private tags.\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tmax, _ = w.Maximize()\n\t\t\tif h = m.index[max.LangID]; h == nil {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t}\n\t\tpin := true\n\t\tfor _, t := range want[i+1:] {\n\t\t\tif w.LangID == t.lang() {\n\t\t\t\tpin = false\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t\t// Check for match based on maximized tag.\n\t\tfor i := range h.haveTags {\n\t\t\thave := h.haveTags[i]\n\t\t\tbest.update(have, w, max.ScriptID, max.RegionID, pin)\n\t\t\tif best.conf == Exact {\n\t\t\t\tfor have.nextMax != 0 {\n\t\t\t\t\thave = h.haveTags[have.nextMax]\n\t\t\t\t\tbest.update(have, w, max.ScriptID, max.RegionID, pin)\n\t\t\t\t}\n\t\t\t\treturn best.have, best.want, best.conf\n\t\t\t}\n\t\t}\n\t}\n\tif best.conf <= No {\n\t\tif len(want) != 0 {\n\t\t\treturn nil, want[0].tag(), No\n\t\t}\n\t\treturn nil, language.Tag{}, No\n\t}\n\treturn best.have, best.want, best.conf\n}", "func (f *lightFetcher) findBestRequest() (bestHash common.Hash, bestAmount uint64, bestTd *big.Int, bestSyncing bool) {\n\tbestTd = f.maxConfirmedTd\n\tbestSyncing = false\n\n\tfor p, fp := range f.peers {\n\t\tfor hash, n := range fp.nodeByHash {\n\t\t\tif f.checkKnownNode(p, n) || n.requested {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\t// if ulc mode is disabled, isTrustedHash returns true\n\t\t\tamount := f.requestAmount(p, n)\n\t\t\tif (bestTd == nil || n.td.Cmp(bestTd) > 0 || amount < bestAmount) && (f.isTrustedHash(hash) || f.maxConfirmedTd.Int64() == 0) {\n\t\t\t\tbestHash = hash\n\t\t\t\tbestTd = n.td\n\t\t\t\tbestAmount = amount\n\t\t\t\tbestSyncing = fp.bestConfirmed == nil || fp.root == nil || !f.checkKnownNode(p, fp.root)\n\t\t\t}\n\t\t}\n\t}\n\treturn\n}", "func FenceMatch(hookName string, sw *scanWriter, fence *liveFenceSwitches, details *commandDetailsT) []string {\n\tjshookName := jsonString(hookName)\n\tjstime := jsonString(details.timestamp.Format(tmfmt))\n\tglob := fence.glob\n\tif details.command == \"drop\" {\n\t\treturn []string{`{\"cmd\":\"drop\",\"hook\":` + jshookName + `,\"time\":` + jstime + `}`}\n\t}\n\tmatch := true\n\tif glob != \"\" && glob != \"*\" {\n\t\tmatch, _ = globMatch(glob, details.id)\n\t}\n\tif !match {\n\t\treturn nil\n\t}\n\n\tsw.mu.Lock()\n\tnofields := sw.nofields\n\tsw.mu.Unlock()\n\n\tif details.obj == nil || (details.command == \"fset\" && nofields) {\n\t\treturn nil\n\t}\n\tmatch = false\n\tdetect := \"outside\"\n\tif fence != nil {\n\t\tmatch1 := fenceMatchObject(fence, details.oldObj)\n\t\tmatch2 := fenceMatchObject(fence, details.obj)\n\t\tif match1 && match2 {\n\t\t\tmatch = true\n\t\t\tdetect = \"inside\"\n\t\t} else if match1 && !match2 {\n\t\t\tmatch = true\n\t\t\tdetect = \"exit\"\n\t\t} else if !match1 && match2 {\n\t\t\tmatch = true\n\t\t\tdetect = \"enter\"\n\t\t\tif details.command == \"fset\" {\n\t\t\t\tdetect = \"inside\"\n\t\t\t}\n\t\t} else {\n\t\t\tif details.command != \"fset\" {\n\t\t\t\t// Maybe the old object and new object create a line that crosses the fence.\n\t\t\t\t// Must detect for that possibility.\n\t\t\t\tif details.oldObj != nil {\n\t\t\t\t\tls := geojson.LineString{\n\t\t\t\t\t\tCoordinates: []geojson.Position{\n\t\t\t\t\t\t\tdetails.oldObj.CalculatedPoint(),\n\t\t\t\t\t\t\tdetails.obj.CalculatedPoint(),\n\t\t\t\t\t\t},\n\t\t\t\t\t}\n\t\t\t\t\ttemp := false\n\t\t\t\t\tif fence.cmd == \"within\" {\n\t\t\t\t\t\t// because we are testing if the line croses the area we need to use\n\t\t\t\t\t\t// \"intersects\" instead of \"within\".\n\t\t\t\t\t\tfence.cmd = \"intersects\"\n\t\t\t\t\t\ttemp = true\n\t\t\t\t\t}\n\t\t\t\t\tif fenceMatchObject(fence, ls) {\n\t\t\t\t\t\t//match = true\n\t\t\t\t\t\tdetect = \"cross\"\n\t\t\t\t\t}\n\t\t\t\t\tif temp {\n\t\t\t\t\t\tfence.cmd = \"within\"\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\tif details.command == \"del\" {\n\t\treturn []string{`{\"command\":\"del\",\"hook\":` + jshookName + `,\"id\":` + jsonString(details.id) + `,\"time\":` + jstime + `}`}\n\t}\n\tif details.fmap == nil {\n\t\treturn nil\n\t}\n\tsw.mu.Lock()\n\tsw.fmap = details.fmap\n\tsw.fullFields = true\n\tsw.msg.OutputType = server.JSON\n\tsw.writeObject(details.id, details.obj, details.fields, true)\n\tif sw.wr.Len() == 0 {\n\t\tsw.mu.Unlock()\n\t\treturn nil\n\t}\n\tres := sw.wr.String()\n\tresb := make([]byte, len(res))\n\tcopy(resb, res)\n\tres = string(resb)\n\tsw.wr.Reset()\n\tif sw.output == outputIDs {\n\t\tres = `{\"id\":` + res + `}`\n\t}\n\tsw.mu.Unlock()\n\n\tif strings.HasPrefix(res, \",\") {\n\t\tres = res[1:]\n\t}\n\n\tjskey := jsonString(details.key)\n\tores := res\n\tmsgs := make([]string, 0, 2)\n\tif fence.detect == nil || fence.detect[detect] {\n\t\tif strings.HasPrefix(ores, \"{\") {\n\t\t\tres = `{\"command\":\"` + details.command + `\",\"detect\":\"` + detect + `\",\"hook\":` + jshookName + `,\"key\":` + jskey + `,\"time\":` + jstime + `,` + ores[1:]\n\t\t}\n\t\tmsgs = append(msgs, res)\n\t}\n\tswitch detect {\n\tcase \"enter\":\n\t\tif fence.detect == nil || fence.detect[\"inside\"] {\n\t\t\tmsgs = append(msgs, `{\"command\":\"`+details.command+`\",\"detect\":\"inside\",\"hook\":`+jshookName+`,\"key\":`+jskey+`,\"time\":`+jstime+`,`+ores[1:])\n\t\t}\n\tcase \"exit\", \"cross\":\n\t\tif fence.detect == nil || fence.detect[\"outside\"] {\n\t\t\tmsgs = append(msgs, `{\"command\":\"`+details.command+`\",\"detect\":\"outside\",\"hook\":`+jshookName+`,\"key\":`+jskey+`,\"time\":`+jstime+`,`+ores[1:])\n\t\t}\n\t}\n\treturn msgs\n}", "func Poll(t int) Option {\n\treturn func(c *Config) Option {\n\t\tprevious := c.Poll\n\t\tc.Poll = t\n\t\treturn Poll(previous)\n\t}\n}", "func (e *hcEventsObserver) applyWithConfidence(ctx context.Context, height abi.ChainEpoch) {\n\tbyOrigH, ok := e.confQueue[height]\n\tif !ok {\n\t\treturn // no triggers at this height\n\t}\n\n\tfor origH, events := range byOrigH {\n\t\tfor _, event := range events {\n\t\t\tif event.called {\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\ttrigger := e.triggers[event.trigger]\n\t\t\tif trigger.disabled {\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tmore, err := trigger.handle(ctx, event.data, event.prevTipset, event.tipset, height)\n\t\t\tif err != nil {\n\t\t\t\tlog.Errorf(\"chain trigger (@H %d, triggered @ %d) failed: %s\", origH, height, err)\n\t\t\t\tcontinue // don't revert failed calls\n\t\t\t}\n\n\t\t\tevent.called = true\n\n\t\t\ttouts, ok := e.timeouts[trigger.timeout]\n\t\t\tif ok {\n\t\t\t\ttouts[event.trigger]++\n\t\t\t}\n\n\t\t\ttrigger.disabled = !more\n\t\t}\n\t}\n}", "func FindNewestDefinition(familyPrefix string) (*ecs.TaskDefinition, error) {\n\tsvc := assertECS()\n\tresult, err := svc.ListTaskDefinitions(&ecs.ListTaskDefinitionsInput{\n\t\tFamilyPrefix: aws.String(familyPrefix),\n\t\tSort: aws.String(\"DESC\"),\n\t\tMaxResults: aws.Int64(1),\n\t})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif len(result.TaskDefinitionArns) == 0 {\n\t\treturn nil, fmt.Errorf(\"could not find any task definitions for family %s\", familyPrefix)\n\t}\n\ttaskResult, err := svc.DescribeTaskDefinition(&ecs.DescribeTaskDefinitionInput{TaskDefinition: result.TaskDefinitionArns[0]})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn taskResult.TaskDefinition, nil\n}", "func LookupConfig(kvs config.KVS) (cfg Config, err error) {\n\tif err = config.CheckValidKeys(config.CallhomeSubSys, kvs, DefaultKVS); err != nil {\n\t\treturn cfg, err\n\t}\n\n\tcfg.Enable = env.Get(config.EnvMinIOCallhomeEnable,\n\t\tkvs.GetWithDefault(Enable, DefaultKVS)) == config.EnableOn\n\tcfg.Frequency, err = time.ParseDuration(env.Get(config.EnvMinIOCallhomeFrequency,\n\t\tkvs.GetWithDefault(Frequency, DefaultKVS)))\n\treturn cfg, err\n}", "func GetLatestMainBuild(ctx context.Context, bucket *storage.BucketHandle, path string) (string, error) {\n\tif bucket == nil {\n\t\treturn \"\", ErrorNilBucket\n\t}\n\n\tquery := &storage.Query{\n\t\tPrefix: path,\n\t}\n\terr := query.SetAttrSelection([]string{\"Name\", \"Generation\"})\n\tif err != nil {\n\t\treturn \"\", fmt.Errorf(\"failed to set attribute selector, err: %q\", err)\n\t}\n\tit := bucket.Objects(ctx, query)\n\n\tvar files []string\n\tvar oldGeneration int64\n\tfor {\n\t\tattrs, err := it.Next()\n\t\tif errors.Is(err, iterator.Done) {\n\t\t\tbreak\n\t\t}\n\t\tif err != nil {\n\t\t\treturn \"\", fmt.Errorf(\"failed to iterate through bucket, err: %w\", err)\n\t\t}\n\t\tif attrs.Generation >= oldGeneration {\n\t\t\tfiles = append([]string{attrs.Name}, files...)\n\t\t\toldGeneration = attrs.Generation\n\t\t} else {\n\t\t\tfiles = append(files, attrs.Name)\n\t\t}\n\t}\n\n\tvar latestVersion string\n\tfor i := 0; i < len(files); i++ {\n\t\tcaptureVersion := regexp.MustCompile(`(\\d+\\.\\d+\\.\\d+-\\d+pre)`)\n\t\tif captureVersion.MatchString(files[i]) {\n\t\t\tlatestVersion = captureVersion.FindString(files[i])\n\t\t\tbreak\n\t\t}\n\t}\n\n\treturn latestVersion, nil\n}", "func (bq *ByzQ) ReadQF(replies []*Value) (*Value, bool) {\n\tif len(replies) <= bq.q {\n\t\t// not enough replies yet; need at least bq.q=(n+2f)/2 replies\n\t\treturn nil, false\n\t}\n\t// filter out highest val that appears at least f times\n\tsame := make(map[Content]int)\n\thighest := defaultVal\n\tfor _, reply := range replies {\n\t\tsame[*reply.C]++\n\t\t// select reply with highest timestamp if it has more than f replies\n\t\tif same[*reply.C] > bq.f && reply.C.Timestamp > highest.C.Timestamp {\n\t\t\thighest = *reply\n\t\t}\n\t}\n\t// returns the reply with the highest timestamp, or if no quorum for\n\t// the same timestamp-value pair has been found, the defaultVal is returned.\n\treturn &highest, true\n}", "func (r *Raft) candidate() int {\n\t//myId := r.Myconfig.Id\n\t//fmt.Println(\"Election started!I am\", myId)\n\n\t//reset the votes else it will reflect the votes received in last term\n\tr.resetVotes()\n\n\t//--start election timer for election-time out time, so when responses stop coming it must restart the election\n\n\twaitTime := 10\n\t//fmt.Println(\"ELection timeout is\", waitTime)\n\tElectionTimer := r.StartTimer(ElectionTimeout, waitTime)\n\t//This loop is for election process which keeps on going until a leader is elected\n\tfor {\n\t\tr.currentTerm = r.currentTerm + 1 //increment current term\n\t\t//fmt.Println(\"I am candidate\", r.Myconfig.Id, \"and current term is now:\", r.currentTerm)\n\n\t\tr.votedFor = r.Myconfig.Id //vote for self\n\t\tr.WriteCVToDisk() //write Current term and votedFor to disk\n\t\tr.f_specific[r.Myconfig.Id].vote = true\n\n\t\t//fmt.Println(\"before calling prepRV\")\n\t\treqVoteObj := r.prepRequestVote() //prepare request vote obj\n\t\t//fmt.Println(\"after calling prepRV\")\n\t\tr.sendToAll(reqVoteObj) //send requests for vote to all servers\n\t\t//this loop for reading responses from all servers\n\t\tfor {\n\t\t\treq := r.receive()\n\t\t\tswitch req.(type) {\n\t\t\tcase RequestVoteResponse: //got the vote response\n\t\t\t\tresponse := req.(RequestVoteResponse) //explicit typecasting so that fields of struct can be used\n\t\t\t\t//fmt.Println(\"Got the vote\", response.voteGranted)\n\t\t\t\tif response.voteGranted {\n\t\t\t\t\t//\t\t\t\t\ttemp := r.f_specific[response.id] //NOT ABLE TO DO THIS--WHY??--WORK THIS WAY\n\t\t\t\t\t//\t\t\t\t\ttemp.vote = true\n\n\t\t\t\t\tr.f_specific[response.id].vote = true\n\t\t\t\t\t//r.voteCount = r.voteCount + 1\n\t\t\t\t}\n\t\t\t\tvoteCount := r.countVotes()\n\t\t\t\t//fmt.Println(\"I am:\", r.Myconfig.Id, \"Votecount is\", voteCount)\n\t\t\t\tif voteCount >= majority {\n\t\t\t\t\t//fmt.Println(\"Votecount is majority, I am new leader\", r.Myconfig.Id)\n\t\t\t\t\tElectionTimer.Stop()\n\t\t\t\t\tr.LeaderConfig.Id = r.Myconfig.Id //update leader details\n\t\t\t\t\treturn leader //become the leader\n\t\t\t\t}\n\n\t\t\tcase AppendEntriesReq: //received an AE request instead of votes, i.e. some other leader has been elected\n\t\t\t\trequest := req.(AppendEntriesReq)\n\t\t\t\t//Can be clubbed with serviceAppendEntriesReq with few additions!--SEE LATER\n\n\t\t\t\t//fmt.Println(\"I am \", r.Myconfig.Id, \"candidate,got AE_Req from\", request.leaderId, \"terms my,leader are\", r.currentTerm, request.term)\n\t\t\t\twaitTime_secs := secs * time.Duration(waitTime)\n\t\t\t\tappEntriesResponse := AppendEntriesResponse{}\n\t\t\t\tappEntriesResponse.followerId = r.Myconfig.Id\n\t\t\t\tappEntriesResponse.success = false //false by default, in case of heartbeat or invalid leader\n\t\t\t\tif request.term >= r.currentTerm { //valid leader\n\t\t\t\t\tr.LeaderConfig.Id = request.leaderId //update leader info\n\t\t\t\t\tElectionTimer.Reset(waitTime_secs) //reset the timer\n\t\t\t\t\tvar myLastIndexTerm int\n\t\t\t\t\tif len(r.myLog) == 0 {\n\t\t\t\t\t\tmyLastIndexTerm = -1\n\n\t\t\t\t\t} else {\n\t\t\t\t\t\tmyLastIndexTerm = r.myLog[r.myMetaData.lastLogIndex].Term\n\t\t\t\t\t}\n\t\t\t\t\tif request.leaderLastLogIndex == r.myMetaData.lastLogIndex && request.term == myLastIndexTerm { //this is heartbeat from a valid leader\n\t\t\t\t\t\tappEntriesResponse.success = true\n\t\t\t\t\t}\n\t\t\t\t\tsend(request.leaderId, appEntriesResponse)\n\t\t\t\t\treturn follower\n\t\t\t\t} else {\n\t\t\t\t\t//check if log is same\n\t\t\t\t\t//fmt.Println(\"In candidate, AE_Req-else\")\n\t\t\t\t\tsend(request.leaderId, appEntriesResponse)\n\t\t\t\t}\n\t\t\tcase int:\n\t\t\t\twaitTime_secs := secs * time.Duration(waitTime)\n\t\t\t\tElectionTimer.Reset(waitTime_secs)\n\t\t\t\tbreak //come out of inner loop i.e. restart the election process\n\t\t\t\t//default: if something else comes, then ideally it should ignore that and again wait for correct type of response on channel\n\t\t\t\t//it does this, in the present code structure\n\t\t\t}\n\t\t}\n\t}\n}", "func DetectFn(ctx *gcp.Context) (gcp.DetectResult, error) {\n\tif devmode.Enabled(ctx) {\n\t\treturn gcp.OptOut(\"development mode enabled\"), nil\n\t}\n\n\tif clearSource, ok := os.LookupEnv(env.ClearSource); ok {\n\t\tclear, err := strconv.ParseBool(clearSource)\n\t\tif err != nil {\n\t\t\treturn nil, gcp.UserErrorf(\"parsing %q: %v\", env.ClearSource, err)\n\t\t}\n\n\t\tif clear {\n\t\t\t// It is up to the buildpack to determine if clear source has any effect\n\t\t\t// and if it should opt in, e.g. Java only opts in for Gradle/Maven builds.\n\t\t\treturn nil, nil\n\t\t}\n\t}\n\treturn gcp.OptOutEnvNotSet(env.ClearSource), nil\n}", "func (c *Variable) Latest(ctx context.Context) (Snapshot, error) {\n\thaveGood := c.haveGood()\n\tif !haveGood {\n\t\tselect {\n\t\tcase <-c.haveGoodCh:\n\t\t\thaveGood = true\n\t\tcase <-ctx.Done():\n\t\t\t// We don't return ctx.Err().\n\t\t}\n\t}\n\tc.mu.RLock()\n\tdefer c.mu.RUnlock()\n\tif haveGood && c.lastErr != ErrClosed {\n\t\treturn c.lastGood, nil\n\t}\n\treturn Snapshot{}, c.lastErr\n}", "func (m *bestMatch) update(have *haveTag, tag language.Tag, maxScript language.Script, maxRegion language.Region, pin bool) {\n\t// Bail if the maximum attainable confidence is below that of the current best match.\n\tc := have.conf\n\tif c < m.conf {\n\t\treturn\n\t}\n\t// Don't change the language once we already have found an exact match.\n\tif m.pinLanguage && tag.LangID != m.want.LangID {\n\t\treturn\n\t}\n\t// Pin the region group if we are comparing tags for the same language.\n\tif tag.LangID == m.want.LangID && m.sameRegionGroup {\n\t\t_, sameGroup := regionGroupDist(m.pinnedRegion, have.maxRegion, have.maxScript, m.want.LangID)\n\t\tif !sameGroup {\n\t\t\treturn\n\t\t}\n\t}\n\tif c == Exact && have.maxScript == maxScript {\n\t\t// If there is another language and then another entry of this language,\n\t\t// don't pin anything, otherwise pin the language.\n\t\tm.pinLanguage = pin\n\t}\n\tif equalsRest(have.tag, tag) {\n\t} else if have.maxScript != maxScript {\n\t\t// There is usually very little comprehension between different scripts.\n\t\t// In a few cases there may still be Low comprehension. This possibility\n\t\t// is pre-computed and stored in have.altScript.\n\t\tif Low < m.conf || have.altScript != maxScript {\n\t\t\treturn\n\t\t}\n\t\tc = Low\n\t} else if have.maxRegion != maxRegion {\n\t\tif High < c {\n\t\t\t// There is usually a small difference between languages across regions.\n\t\t\tc = High\n\t\t}\n\t}\n\n\t// We store the results of the computations of the tie-breaker rules along\n\t// with the best match. There is no need to do the checks once we determine\n\t// we have a winner, but we do still need to do the tie-breaker computations.\n\t// We use \"beaten\" to keep track if we still need to do the checks.\n\tbeaten := false // true if the new pair defeats the current one.\n\tif c != m.conf {\n\t\tif c < m.conf {\n\t\t\treturn\n\t\t}\n\t\tbeaten = true\n\t}\n\n\t// Tie-breaker rules:\n\t// We prefer if the pre-maximized language was specified and identical.\n\torigLang := have.tag.LangID == tag.LangID && tag.LangID != 0\n\tif !beaten && m.origLang != origLang {\n\t\tif m.origLang {\n\t\t\treturn\n\t\t}\n\t\tbeaten = true\n\t}\n\n\t// We prefer if the pre-maximized region was specified and identical.\n\torigReg := have.tag.RegionID == tag.RegionID && tag.RegionID != 0\n\tif !beaten && m.origReg != origReg {\n\t\tif m.origReg {\n\t\t\treturn\n\t\t}\n\t\tbeaten = true\n\t}\n\n\tregGroupDist, sameGroup := regionGroupDist(have.maxRegion, maxRegion, maxScript, tag.LangID)\n\tif !beaten && m.regGroupDist != regGroupDist {\n\t\tif regGroupDist > m.regGroupDist {\n\t\t\treturn\n\t\t}\n\t\tbeaten = true\n\t}\n\n\tparadigmReg := isParadigmLocale(tag.LangID, have.maxRegion)\n\tif !beaten && m.paradigmReg != paradigmReg {\n\t\tif !paradigmReg {\n\t\t\treturn\n\t\t}\n\t\tbeaten = true\n\t}\n\n\t// Next we prefer if the pre-maximized script was specified and identical.\n\torigScript := have.tag.ScriptID == tag.ScriptID && tag.ScriptID != 0\n\tif !beaten && m.origScript != origScript {\n\t\tif m.origScript {\n\t\t\treturn\n\t\t}\n\t\tbeaten = true\n\t}\n\n\t// Update m to the newly found best match.\n\tif beaten {\n\t\tm.have = have\n\t\tm.want = tag\n\t\tm.conf = c\n\t\tm.pinnedRegion = maxRegion\n\t\tm.sameRegionGroup = sameGroup\n\t\tm.origLang = origLang\n\t\tm.origReg = origReg\n\t\tm.paradigmReg = paradigmReg\n\t\tm.origScript = origScript\n\t\tm.regGroupDist = regGroupDist\n\t}\n}", "func (c *Client) WaitAndGetDC(name string, desiredRevision int64, timeout time.Duration, waitCond func(*appsv1.DeploymentConfig, int64) bool) (*appsv1.DeploymentConfig, error) {\n\n\tw, err := c.appsClient.DeploymentConfigs(c.Namespace).Watch(context.TODO(), metav1.ListOptions{\n\t\tFieldSelector: fmt.Sprintf(\"metadata.name=%s\", name),\n\t})\n\tdefer w.Stop()\n\n\tif err != nil {\n\t\treturn nil, errors.Wrapf(err, \"unable to watch dc\")\n\t}\n\n\ttimeoutChannel := time.After(timeout)\n\t// Keep trying until we're timed out or got a result or got an error\n\tfor {\n\t\tselect {\n\n\t\t// Timout after X amount of seconds\n\t\tcase <-timeoutChannel:\n\t\t\treturn nil, errors.New(\"Timed out waiting for annotation to update\")\n\n\t\t// Each loop we check the result\n\t\tcase val, ok := <-w.ResultChan():\n\n\t\t\tif !ok {\n\t\t\t\tbreak\n\t\t\t}\n\t\t\tif e, ok := val.Object.(*appsv1.DeploymentConfig); ok {\n\t\t\t\tfor _, cond := range e.Status.Conditions {\n\t\t\t\t\t// using this just for debugging message, so ignoring error on purpose\n\t\t\t\t\tjsonCond, _ := json.Marshal(cond)\n\t\t\t\t\tklog.V(3).Infof(\"DeploymentConfig Condition: %s\", string(jsonCond))\n\t\t\t\t}\n\t\t\t\t// If the annotation has been updated, let's exit\n\t\t\t\tif waitCond(e, desiredRevision) {\n\t\t\t\t\treturn e, nil\n\t\t\t\t}\n\n\t\t\t}\n\t\t}\n\t}\n}", "func (d DB) findRulesConfigs(filter squirrel.Sqlizer) (map[string]userconfig.VersionedRulesConfig, error) {\n\trows, err := d.Select(\"id\", \"owner_id\", \"config ->> 'rules_files'\", \"config ->> 'rule_format_version'\", \"deleted_at\").\n\t\tOptions(\"DISTINCT ON (owner_id)\").\n\t\tFrom(\"configs\").\n\t\tWhere(filter).\n\t\t// `->>` gets a JSON object field as text. When a config row exists\n\t\t// and alertmanager config is provided but ruler config has not yet\n\t\t// been, the 'rules_files' key will have an empty JSON object as its\n\t\t// value. This is (probably) the most efficient way to test for a\n\t\t// non-empty `rules_files` key.\n\t\t//\n\t\t// This whole situation is way too complicated. See\n\t\t// https://github.com/cortexproject/cortex/issues/619 for the whole\n\t\t// story, and our plans to improve it.\n\t\tWhere(\"config ->> 'rules_files' <> '{}'\").\n\t\tOrderBy(\"owner_id, id DESC\").\n\t\tQuery()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer rows.Close()\n\tcfgs := map[string]userconfig.VersionedRulesConfig{}\n\tfor rows.Next() {\n\t\tvar cfg userconfig.VersionedRulesConfig\n\t\tvar userID string\n\t\tvar cfgBytes []byte\n\t\tvar rfvBytes []byte\n\t\tvar deletedAt pq.NullTime\n\t\terr = rows.Scan(&cfg.ID, &userID, &cfgBytes, &rfvBytes, &deletedAt)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\terr = json.Unmarshal(cfgBytes, &cfg.Config.Files)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\t// Legacy configs don't have a rule format version, in which case this will\n\t\t// be a zero-length (but non-nil) slice.\n\t\tif len(rfvBytes) > 0 {\n\t\t\terr = json.Unmarshal([]byte(`\"`+string(rfvBytes)+`\"`), &cfg.Config.FormatVersion)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t}\n\t\tcfg.DeletedAt = deletedAt.Time\n\t\tcfgs[userID] = cfg\n\t}\n\n\t// Check for any errors encountered.\n\terr = rows.Err()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn cfgs, nil\n}", "func FindStockCvtermG(stockCvtermID int, selectCols ...string) (*StockCvterm, error) {\n\treturn FindStockCvterm(boil.GetDB(), stockCvtermID, selectCols...)\n}", "func (m *TriggerAndScopeBasedConditions) GetTrigger()(WorkflowExecutionTriggerable) {\n val, err := m.GetBackingStore().Get(\"trigger\")\n if err != nil {\n panic(err)\n }\n if val != nil {\n return val.(WorkflowExecutionTriggerable)\n }\n return nil\n}", "func (rf *Raft) RequestVote(args *RequestVoteArgs, reply *RequestVoteReply) {\n DPrintf(\"%d: %d recieve RequestVote from %d:%d\\n\", rf.currentTerm, rf.me, args.Term, args.Candidate)\n // Your code here (2A, 2B).\n rf.mu.Lock()\n defer rf.mu.Unlock()\n if args.Term < rf.currentTerm {\n \n reply.VoteGranted = false\n reply.Term = rf.currentTerm\n DPrintf(\"%d: %d recieve voteRequest from %d:%d %v\\n\", rf.currentTerm, rf.me, args.Term, args.Candidate, reply.VoteGranted)\n return\n }\n\n if args.Term > rf.currentTerm {\n rf.votedFor = -1\n rf.currentTerm = args.Term\n }\n\n if rf.votedFor == -1 || rf.votedFor == args.Candidate {\n // election restriction\n if args.LastLogTerm < rf.log[len(rf.log) - 1].Term ||\n (args.LastLogTerm == rf.log[len(rf.log) - 1].Term &&\n args.LastLogIndex < len(rf.log) - 1) {\n rf.votedFor = -1\n reply.VoteGranted = false\n DPrintf(\"%d: %d recieve voteRequest from %d:%d %v\\n\", rf.currentTerm, rf.me, args.Term, args.Candidate, reply.VoteGranted)\n return\n }\n\n \n if rf.state == FOLLOWER {\n rf.heartbeat <- true\n }\n rf.state = FOLLOWER\n rf.resetTimeout()\n rf.votedFor = args.Candidate\n\n \n reply.VoteGranted = true\n reply.Term = args.Term\n DPrintf(\"%d: %d recieve voteRequest from %d:%d %v\\n\", rf.currentTerm, rf.me, args.Term, args.Candidate, reply.VoteGranted)\n return\n }\n reply.VoteGranted = false\n reply.Term = args.Term\n DPrintf(\"%d: %d recieve voteRequest from %d:%d %v\\n\", rf.currentTerm, rf.me, args.Term, args.Candidate, reply.VoteGranted)\n}", "func (m *ShardMaster) Query(version int) (*Configuration, error) {\n\t//fmt.Printf(\"receive a Query RPC, %v\\n\", req.ConfVersion)\n\tm.shardConfLock.RLock()\n\tdefer m.shardConfLock.RUnlock()\n\n\tif version == -1 { /*asking for latest configuration*/\n\t\treturn m.shardConfs[m.latest],nil\n\t} else if version >= 0 && version <= m.latest {\n\t\treturn m.shardConfs[version],nil\n\t} else {\n\t\treturn nil, errors.New(\"conf version not valid\")\n\t}\n}", "func (a API) GetBestBlockChk() (isNew bool) {\n\tselect {\n\tcase o := <-a.Ch.(chan GetBestBlockRes):\n\t\tif o.Err != nil {\n\t\t\ta.Result = o.Err\n\t\t} else {\n\t\t\ta.Result = o.Res\n\t\t}\n\t\tisNew = true\n\tdefault:\n\t}\n\treturn\n}", "func (r *Raft) runCandidate() {\n\t// Start vote for us, and set a timeout\n\tvoteCh := r.electSelf()\n\telectionTimeout := randomTimeout(r.conf.ElectionTimeout, 2*r.conf.ElectionTimeout)\n\n\t// Tally the votes, need a simple majority\n\tgrantedVotes := 0\n\tquorum := r.quorumSize()\n\tr.logD.Printf(\"Cluster size: %d, votes needed: %d\", len(r.peers)+1, quorum)\n\n\ttransition := false\n\tfor !transition {\n\t\tselect {\n\t\tcase rpc := <-r.rpcCh:\n\t\t\tswitch cmd := rpc.Command.(type) {\n\t\t\tcase *AppendEntriesRequest:\n\t\t\t\ttransition = r.appendEntries(rpc, cmd)\n\t\t\tcase *RequestVoteRequest:\n\t\t\t\ttransition = r.requestVote(rpc, cmd)\n\t\t\tdefault:\n\t\t\t\tr.logE.Printf(\"Candidate state, got unexpected command: %#v\",\n\t\t\t\t\trpc.Command)\n\t\t\t\trpc.Respond(nil, fmt.Errorf(\"unexpected command\"))\n\t\t\t}\n\n\t\t// Got response from peers on voting request\n\t\tcase vote := <-voteCh:\n\t\t\t// Check if the term is greater than ours, bail\n\t\t\tif vote.Term > r.getCurrentTerm() {\n\t\t\t\tr.logD.Printf(\"Newer term discovered\")\n\t\t\t\tr.setState(Follower)\n\t\t\t\tif err := r.setCurrentTerm(vote.Term); err != nil {\n\t\t\t\t\tr.logE.Printf(\"Failed to update current term: %w\", err)\n\t\t\t\t}\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\t// Check if the vote is granted\n\t\t\tif vote.Granted {\n\t\t\t\tgrantedVotes++\n\t\t\t\tr.logD.Printf(\"Vote granted. Tally: %d\", grantedVotes)\n\t\t\t}\n\n\t\t\t// Check if we've become the leader\n\t\t\tif grantedVotes >= quorum {\n\t\t\t\tr.logD.Printf(\"Election won. Tally: %d\", grantedVotes)\n\t\t\t\tr.setState(Leader)\n\t\t\t\treturn\n\t\t\t}\n\t\tcase a := <-r.applyCh:\n\t\t\t// Reject any operations since we are not the leader\n\t\t\ta.response = ErrNotLeader\n\t\t\ta.Response()\n\n\t\tcase <-electionTimeout:\n\t\t\t// Election failed! Restart the election. We simply return,\n\t\t\t// which will kick us back into runCandidate\n\t\t\tr.logW.Printf(\"Election timeout reached, restarting election\")\n\t\t\treturn\n\n\t\tcase <-r.shutdownCh:\n\t\t\treturn\n\t\t}\n\t}\n}", "func (_AggregatorV2V3Interface *AggregatorV2V3InterfaceSession) LatestAnswer() (*big.Int, error) {\n\treturn _AggregatorV2V3Interface.Contract.LatestAnswer(&_AggregatorV2V3Interface.CallOpts)\n}", "func (q *PollVoteQuery) FindByChosenOption(v string) *PollVoteQuery {\n\treturn q.Where(kallax.Eq(Schema.PollVote.ChosenOption, v))\n}", "func (p *ApprovalPoll) Evaluate() ([]string, []CScore, error) {\n\tif p.candidates == nil || p.ballots == nil {\n\t\treturn []string{}, []CScore{}, errors.New(\"no candidates or no ballots\")\n\t}\n\twinners, ranks := p.getWinners()\n\treturn winners, ranks, nil\n}", "func FindStockCvterm(exec boil.Executor, stockCvtermID int, selectCols ...string) (*StockCvterm, error) {\n\tstockCvtermObj := &StockCvterm{}\n\n\tsel := \"*\"\n\tif len(selectCols) > 0 {\n\t\tsel = strings.Join(strmangle.IdentQuoteSlice(dialect.LQ, dialect.RQ, selectCols), \",\")\n\t}\n\tquery := fmt.Sprintf(\n\t\t\"select %s from \\\"stock_cvterm\\\" where \\\"stock_cvterm_id\\\"=$1\", sel,\n\t)\n\n\tq := queries.Raw(exec, query, stockCvtermID)\n\n\terr := q.Bind(stockCvtermObj)\n\tif err != nil {\n\t\tif errors.Cause(err) == sql.ErrNoRows {\n\t\t\treturn nil, sql.ErrNoRows\n\t\t}\n\t\treturn nil, errors.Wrap(err, \"chado: unable to select from stock_cvterm\")\n\t}\n\n\treturn stockCvtermObj, nil\n}", "func (g *Gerrit) Poll(ctx context.Context) {\n\treq, err := http.NewRequest(\"GET\", gerritURL, nil)\n\tif err != nil {\n\t\tg.logf(\"failed to build GET request to %q: %v\\n\", gerritURL, err)\n\t\treturn\n\t}\n\treq.Header.Add(\"User-Agent\", \"Gophers Slack bot\")\n\treq = req.WithContext(ctx)\n\n\tresp, err := g.http.Do(req)\n\tif err != nil {\n\t\tg.logf(\"failed to get data from Gerrit: %v\\n\", err)\n\t\treturn\n\t}\n\tdefer resp.Body.Close()\n\n\tif resp.StatusCode != http.StatusOK {\n\t\tg.logf(\"got non-200 code: %d from gerrit api\", resp.StatusCode)\n\t\treturn\n\t}\n\n\tbody, err := ioutil.ReadAll(resp.Body)\n\tif err != nil {\n\t\tg.logf(\"reading body: %v\", err)\n\t\treturn\n\t}\n\t// Gerrit prefixes responses with `)]}'`\n\t// https://gerrit-review.googlesource.com/Documentation/rest-api.html#output\n\tbody = bytes.TrimPrefix(body, []byte(\")]}'\"))\n\n\tvar cls []GerritCL\n\terr = json.Unmarshal(body, &cls)\n\tif err != nil {\n\t\tg.logf(\"unmarshaling response: %v\\n\", err)\n\t\treturn\n\t}\n\n\t// The change output is sorted by the last update time, most recently updated to oldest updated.\n\t// https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#list-changes\n\tfor i, cl := range cls {\n\t\tif cl.Number == g.lastID {\n\t\t\tcls = cls[:i]\n\t\t\tbreak\n\t\t}\n\t}\n\n\tfor i := len(cls) - 1; i >= 0; i-- {\n\t\tcl := cls[i]\n\n\t\texists, err := g.store.Exists(ctx, cl.Number)\n\t\tif err != nil {\n\t\t\tg.logf(\"checking whether CL shown: %v\", err)\n\t\t\tcontinue\n\t\t}\n\t\tif exists {\n\t\t\tcontinue\n\t\t}\n\n\t\terr = g.store.Put(ctx, cl.Number, storedCL{\n\t\t\tURL: cl.Link(),\n\t\t\tMessage: cl.Message(),\n\t\t\tCrawledAt: time.Now(),\n\t\t})\n\t\tif err != nil {\n\t\t\tg.logf(\"saving CL to datastore: %v\", err)\n\t\t\treturn\n\t\t}\n\n\t\tif !g.notify(cl) {\n\t\t\treturn\n\t\t}\n\n\t\tg.lastID = cl.Number\n\t}\n}", "func (_AggregatorV2V3Interface *AggregatorV2V3InterfaceCallerSession) LatestAnswer() (*big.Int, error) {\n\treturn _AggregatorV2V3Interface.Contract.LatestAnswer(&_AggregatorV2V3Interface.CallOpts)\n}", "func chooseConditional(n *spec.Node, jobArgs map[string]interface{}) (string, error) {\n\t// Node is a conditional, check the value of the \"if\" jobArg\n\tval, ok := jobArgs[*n.If]\n\tif !ok {\n\t\treturn \"\", fmt.Errorf(\"'if' not provided for conditional node\")\n\t}\n\tvalstring, ok := val.(string)\n\tif !ok {\n\t\treturn \"\", fmt.Errorf(\"'if' arg '%s' is not a string\", *n.If)\n\t}\n\t// Based on value of \"if\" jobArg, retrieve sequence to execute\n\tseqName, ok := n.Eq[valstring]\n\tif !ok {\n\t\t// check if default sequence specified\n\t\tseqName, ok = n.Eq[\"default\"]\n\t\tif !ok {\n\t\t\tvalues := make([]string, 0, len(n.Eq))\n\t\t\tfor k := range n.Eq {\n\t\t\t\tvalues = append(values, k)\n\t\t\t}\n\t\t\tsort.Strings(values)\n\t\t\treturn \"\", fmt.Errorf(\"'if: %s' value '%s' does not match any options: %s\", *n.If, valstring, strings.Join(values, \", \"))\n\t\t}\n\t}\n\n\treturn seqName, nil\n}", "func (d *Detector) GetPreferred() (Collector, string, error) {\n\t// Detection rounds finished, exit fast\n\tif d.candidates == nil {\n\t\tif d.preferredCollector == nil {\n\t\t\treturn nil, \"\", ErrPermaFail\n\t\t}\n\t\treturn d.preferredCollector, d.preferredName, nil\n\t}\n\n\t// Retry all remaining candidates\n\tdetected, remaining := retryCandidates(d.candidates)\n\td.candidates = remaining\n\n\t// Add newly detected detected\n\tfor name, c := range detected {\n\t\td.detected[name] = c\n\t}\n\n\t// Pick preferred collector among detected ones\n\tpreferred := rankCollectors(d.detected, d.preferredName)\n\tif preferred != d.preferredName {\n\t\tlog.Infof(\"Using collector %s\", preferred)\n\t\td.preferredName = preferred\n\t\td.preferredCollector = d.detected[preferred]\n\t}\n\n\t// Stop detection when all candidates are tested\n\t// return a PermaFail error if nothing was detected\n\tif len(remaining) == 0 {\n\t\td.candidates = nil\n\t\td.detected = nil\n\t\tif d.preferredCollector == nil {\n\t\t\treturn nil, \"\", ErrPermaFail\n\t\t}\n\t}\n\n\tif d.preferredCollector == nil {\n\t\treturn nil, \"\", ErrNothingYet\n\t}\n\treturn d.preferredCollector, d.preferredName, nil\n}", "func (r *Raft) CallElection(){\n\t\n\tr.CurrentTerm+=1 // increase the current term by 1 to avoid conflict\n\tVoteAckcount:=1 // Number of vote received, initialised to 1 as own vote fo candiate is positive\n\tr.IsLeader = 0 // Set the state of server as candiate\n\tvar VoteCount =make (chan int,(len(r.ClusterConfigV.Servers)-1))\n\t//fmt.Println(\"Sending vote requests for:\",r.Id)\n\t\n\tfor _,server := range r.ClusterConfigV.Servers {\t\t\t\n\t\t\t\tif server.Id != r.Id{\n\t\t\t\t\tgo r.sendVoteRequestRpc(server,VoteCount) \t\t\t\t\t\n\t\t\t\t}}\n\n\tfor i:=0;i< len(r.ClusterConfigV.Servers)-1;i++ {\n\t\t\t\t\tVoteAckcount = VoteAckcount+ <- VoteCount \n\t\t\t\t\t// if Candiate gets majoirty, declare candiate as Leader and send immediae heartbeat to followers declaring\n\t\t\t\t\t// election of new leader\n\t\t\t\tif VoteAckcount > (len(r.ClusterConfigV.Servers)/2) && r.IsLeader == 0 { \n\t\t\t\t\tlog.Println(\"New leader is:\",r.Id)\n\t\t\t\t\tr.IsLeader=1\n\t\t\t\t\tr.LeaderId=r.Id\n\t\t\t\t\traft.SendImmediateHeartBit <- 1\n\t\t\t\t\tbreak\n\t\t\t\t\t}\n\t\t\t\t}\t\t\n\t\tif r.IsLeader==1{\n\t\t\t// initlised next index to lastlog index, and match index to 0 fro all servers\n\t\tfor _,server := range r.ClusterConfigV.Servers {\n\t\t\t\tr.NextIndex[server.Id]=len(r.Log)\n\t\t\t\tr.MatchIndex[server.Id]=0\n\t\t\t\tr.ResetTimer()\n\t\t\t}\n\t\t}else{ \n\t\t\t// Is candidate fails to get elected, fall back to follower state and reset timer for reelection \n\t\t\tr.IsLeader=2\n\t\t\tr.ResetTimer()\n\t\t}\n}", "func loadLatestOptions(dir string) (*grocksdb.Options, *grocksdb.Options, error) {\n\tlatestOpts, err := grocksdb.LoadLatestOptions(dir, grocksdb.NewDefaultEnv(), true, grocksdb.NewLRUCache(blockCacheSize))\n\tif err != nil && strings.HasPrefix(err.Error(), \"NotFound: \") {\n\t\treturn newDefaultOptions(), newDefaultOptions(), nil\n\t}\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\n\tcfNames := latestOpts.ColumnFamilyNames()\n\tcfOpts := latestOpts.ColumnFamilyOpts()\n\t// db should have only one column family named default\n\tok := len(cfNames) == 1 && cfNames[0] == defaultColumnFamilyName\n\tif !ok {\n\t\treturn nil, nil, ErrUnexpectedConfiguration\n\t}\n\n\t// return db and cf opts\n\treturn latestOpts.Options(), &cfOpts[0], nil\n}", "func FindVoteG(id int, selectCols ...string) (*Vote, error) {\n\treturn FindVote(boil.GetDB(), id, selectCols...)\n}", "func (p *DatabaseAccountsClientFailoverPriorityChangePoller) Poll(ctx context.Context) (*http.Response, error) {\n\treturn p.pt.Poll(ctx)\n}", "func (s *speaker) CallJudgeElection(monitoring shared.MonitorResult, turnsInPower int, allIslands []shared.ClientID) shared.ElectionSettings {\n\t// example implementation calls an election if monitoring was performed and the result was negative\n\t// or if the number of turnsInPower exceeds 3\n\tvar electionsettings = shared.ElectionSettings{\n\t\tVotingMethod: shared.BordaCount,\n\t\tIslandsToVote: allIslands,\n\t\tHoldElection: false,\n\t}\n\t//there are more important things to do\n\tif s.getSpeakerBudget() < s.getHigherPriorityActionsCost(\"AppointNextJudge\") {\n\t\treturn electionsettings\n\t}\n\tif (monitoring.Performed && !monitoring.Result) || turnsInPower >= 2 {\n\t\telectionsettings.HoldElection = true\n\t}\n\treturn electionsettings\n}", "func (r *Repository) FindSemverTag(c *semver.Constraints) (*plumbing.Reference, error) {\n\t// Check if Repository is nil to avoid a panic if this function is called\n\t// before repo has been cloned\n\tif r.Repository == nil {\n\t\treturn nil, errors.New(\"Repository is nil\")\n\t}\n\n\ttagsIter, err := r.Tags()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tcoll := semverref.Collection{}\n\n\tif err := tagsIter.ForEach(func(t *plumbing.Reference) error {\n\t\tv, err := semver.NewVersion(t.Name().Short())\n\t\tif err != nil {\n\t\t\treturn nil // Ignore errors and thus tags that aren't parsable as a semver\n\t\t}\n\n\t\t// No way to a priori find the length of tagsIter so append to the collection.\n\t\tcoll = append(coll, semverref.SemverRef{Ver: v, Ref: t})\n\t\treturn nil\n\t}); err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn coll.HighestMatch(c)\n}", "func findLatch(I *flow.Interval) (*cfg.Node, bool) {\n\tvar latch *cfg.Node\n\t// Find greatest enclosing back edge (if any).\n\tpredNodes := I.To(I.Head.ID())\n\tfor predNodes.Next() {\n\t\tpred := predNodes.Node()\n\t\tif I.Node(pred.ID()) == nil {\n\t\t\tcontinue\n\t\t}\n\t\tp, h := node(pred), node(I.Head)\n\t\tif !isBackEdge(p, h) {\n\t\t\tcontinue\n\t\t}\n\t\tif latch == nil {\n\t\t\tlatch = p\n\t\t} else if p.RevPost > latch.RevPost {\n\t\t\tlatch = p\n\t\t}\n\t}\n\treturn latch, latch != nil\n}", "func (s *Strategy) Criteria() conf.Criteria {\n\treturn s.c\n}", "func (p *DatabaseAccountsFailoverPriorityChangePoller) Poll(ctx context.Context) (*http.Response, error) {\n\treturn p.pt.Poll(ctx)\n}", "func New(conf *config.ReplicaConfig) *LBBFTCore {\n\tlogger.SetPrefix(fmt.Sprintf(\"hs(id %d): \", conf.ID))\n\n\tctx, cancel := context.WithCancel(context.Background())\n\n\tlbbft := &LBBFTCore{\n\t\t// from hotstuff\n\t\tConfig: conf,\n\t\tcancel: cancel,\n\t\tSigCache: data.NewSignatureCache(conf),\n\t\tcmdCache: data.NewCommandSet(),\n\t\tExec: make(chan []data.Command, 1),\n\n\t\t// from pbft\n\t\tID: uint32(conf.ID),\n\t\tView: 1,\n\t\tApply: 0,\n\t\tcps: make(map[int]*CheckPoint),\n\t\tWaterLow: 0,\n\t\tWaterHigh: 2 * checkpointDiv,\n\t\tF: uint32(len(conf.Replicas)-1) / 3,\n\t\tN: uint32(len(conf.Replicas)),\n\t\tmonitor: false,\n\t\tChange: nil,\n\t\tChanging: false,\n\t\tstate: make([]interface{}, 1),\n\t\tvcs: make(map[uint32][]*ViewChangeArgs),\n\t\tlastcp: 0,\n\n\t\tLastPreparedID: data.EntryID{V: 0, N: 0},\n\t\tViewChangeChan: make(chan struct{}, 1),\n\t\tVoteFor: make(map[uint32]uint32),\n\t}\n\n\tlbbft.InitLog()\n\n\tlbbft.waitEntry = sync.NewCond(&lbbft.LogMut)\n\n\tlbbft.Q = (lbbft.F+lbbft.N)/2 + 1\n\tlbbft.Leader = 1\n\tlbbft.IsLeader = (lbbft.Leader == lbbft.ID)\n\n\t// Put an initial stable checkpoint\n\tcp := lbbft.getCheckPoint(-1)\n\tcp.Stable = true\n\tcp.State = lbbft.state\n\n\tgo lbbft.proposeConstantly(ctx)\n\n\treturn lbbft\n}", "func (rf *Raft) RequestVote(args *RequestVoteArgs, reply *RequestVoteReply) {\n\n\t//defer rf.updateAppliedLock()\n\t//Your code here (2A, 2B).\n\tisALeader := rf.role == Leader\n\n\tif rf.updateTermLock(args.Term) && isALeader {\n\t\t//DPrintf(\"[DEBUG] Server %d from %d to Follower {requestVote : Term higher}\", rf.me, Leader)\n\t}\n\treply.VoteCranted = false\n\tvar votedFor interface{}\n\t//var isLeader bool\n\tvar candidateID, currentTerm, candidateTerm, currentLastLogIndex, candidateLastLogIndex, currentLastLogTerm, candidateLastLogTerm int\n\n\tcandidateID = args.CandidateID\n\tcandidateTerm = args.Term\n\tcandidateLastLogIndex = args.LastLogIndex\n\tcandidateLastLogTerm = args.LastLogTerm\n\n\trf.mu.Lock()\n\n\treply.Term = rf.currentTerm\n\tcurrentTerm = rf.currentTerm\n\tcurrentLastLogIndex = len(rf.logs) - 1 //TODO: fix the length corner case\n\tcurrentLastLogTerm = rf.logs[len(rf.logs)-1].Term\n\tvotedFor = rf.votedFor\n\tisFollower := rf.role == Follower\n\trf.mu.Unlock()\n\t//case 0 => I'm leader, so you must stop election\n\tif !isFollower {\n\t\tDPrintf(\"[DEBUG] Case0 I [%d] is Candidate than %d\", rf.me, args.CandidateID)\n\t\treturn\n\t}\n\n\t//case 1 => the candidate is not suit to be voted\n\tif currentTerm > candidateTerm {\n\t\tDPrintf(\"[DEBUG] Case1 Follower %d > Candidate %d \", rf.me, args.CandidateID)\n\t\treturn\n\t}\n\n\t//case 2 => the candidate's log is not lastest than the follwer\n\tif currentLastLogTerm > candidateLastLogTerm || (currentLastLogTerm == candidateLastLogTerm && currentLastLogIndex > candidateLastLogIndex) {\n\t\tDPrintf(\"[DEBUG] Case2 don't my[%d] newer than can[%d]\", rf.me, args.CandidateID)\n\t\treturn\n\t}\n\trf.mu.Lock()\n\t//case3 => I have voted and is not you\n\tif votedFor != nil && votedFor != candidateID {\n\t\trf.mu.Unlock()\n\t\treturn\n\t}\n\n\t//now I will vote you\n\n\tvar notFollower bool\n\trf.votedFor = candidateID\n\tif rf.role != Follower {\n\t\tnotFollower = true\n\t}\n\tDPrintf(\"[Vote] Server[%d] vote to Can[%d]\", rf.me, args.CandidateID)\n\trf.role = Follower\n\treply.VoteCranted = true\n\trf.mu.Unlock()\n\trf.persist()\n\tif notFollower {\n\t\trf.msgChan <- RecivedVoteRequest\n\t} else {\n\t\trf.msgChan <- RecivedVoteRequest\n\t}\n\n\treturn\n}", "func (a *Api) Candidates(includeStakes bool) ([]*CandidateResult, error) {\n\treturn a.CandidatesAtHeight(LatestBlockHeight, includeStakes)\n}", "func (g GlobalCfg) getMatchingCfg(log logging.SimpleLogging, repoID string) (planReqs []string, applyReqs []string, importReqs []string, workflow Workflow, allowedOverrides []string, allowCustomWorkflows bool, deleteSourceBranchOnMerge bool, repoLocking bool, policyCheck bool) {\n\ttoLog := make(map[string]string)\n\ttraceF := func(repoIdx int, repoID string, key string, val interface{}) string {\n\t\tfrom := \"default server config\"\n\t\tif repoIdx > 0 {\n\t\t\tfrom = fmt.Sprintf(\"repos[%d], id: %s\", repoIdx, repoID)\n\t\t}\n\t\tvar valStr string\n\t\tswitch v := val.(type) {\n\t\tcase string:\n\t\t\tvalStr = fmt.Sprintf(\"%q\", v)\n\t\tcase []string:\n\t\t\tvalStr = fmt.Sprintf(\"[%s]\", strings.Join(v, \",\"))\n\t\tcase bool:\n\t\t\tvalStr = fmt.Sprintf(\"%t\", v)\n\t\tdefault:\n\t\t\tvalStr = \"this is a bug\"\n\t\t}\n\n\t\treturn fmt.Sprintf(\"setting %s: %s from %s\", key, valStr, from)\n\t}\n\n\tfor _, key := range []string{PlanRequirementsKey, ApplyRequirementsKey, ImportRequirementsKey, WorkflowKey, AllowedOverridesKey, AllowCustomWorkflowsKey, DeleteSourceBranchOnMergeKey, RepoLockingKey, PolicyCheckKey} {\n\t\tfor i, repo := range g.Repos {\n\t\t\tif repo.IDMatches(repoID) {\n\t\t\t\tswitch key {\n\t\t\t\tcase PlanRequirementsKey:\n\t\t\t\t\tif repo.PlanRequirements != nil {\n\t\t\t\t\t\ttoLog[PlanRequirementsKey] = traceF(i, repo.IDString(), PlanRequirementsKey, repo.PlanRequirements)\n\t\t\t\t\t\tplanReqs = repo.PlanRequirements\n\t\t\t\t\t}\n\t\t\t\tcase ApplyRequirementsKey:\n\t\t\t\t\tif repo.ApplyRequirements != nil {\n\t\t\t\t\t\ttoLog[ApplyRequirementsKey] = traceF(i, repo.IDString(), ApplyRequirementsKey, repo.ApplyRequirements)\n\t\t\t\t\t\tapplyReqs = repo.ApplyRequirements\n\t\t\t\t\t}\n\t\t\t\tcase ImportRequirementsKey:\n\t\t\t\t\tif repo.ImportRequirements != nil {\n\t\t\t\t\t\ttoLog[ImportRequirementsKey] = traceF(i, repo.IDString(), ImportRequirementsKey, repo.ImportRequirements)\n\t\t\t\t\t\timportReqs = repo.ImportRequirements\n\t\t\t\t\t}\n\t\t\t\tcase WorkflowKey:\n\t\t\t\t\tif repo.Workflow != nil {\n\t\t\t\t\t\ttoLog[WorkflowKey] = traceF(i, repo.IDString(), WorkflowKey, repo.Workflow.Name)\n\t\t\t\t\t\tworkflow = *repo.Workflow\n\t\t\t\t\t}\n\t\t\t\tcase AllowedOverridesKey:\n\t\t\t\t\tif repo.AllowedOverrides != nil {\n\t\t\t\t\t\ttoLog[AllowedOverridesKey] = traceF(i, repo.IDString(), AllowedOverridesKey, repo.AllowedOverrides)\n\t\t\t\t\t\tallowedOverrides = repo.AllowedOverrides\n\t\t\t\t\t}\n\t\t\t\tcase AllowCustomWorkflowsKey:\n\t\t\t\t\tif repo.AllowCustomWorkflows != nil {\n\t\t\t\t\t\ttoLog[AllowCustomWorkflowsKey] = traceF(i, repo.IDString(), AllowCustomWorkflowsKey, *repo.AllowCustomWorkflows)\n\t\t\t\t\t\tallowCustomWorkflows = *repo.AllowCustomWorkflows\n\t\t\t\t\t}\n\t\t\t\tcase DeleteSourceBranchOnMergeKey:\n\t\t\t\t\tif repo.DeleteSourceBranchOnMerge != nil {\n\t\t\t\t\t\ttoLog[DeleteSourceBranchOnMergeKey] = traceF(i, repo.IDString(), DeleteSourceBranchOnMergeKey, *repo.DeleteSourceBranchOnMerge)\n\t\t\t\t\t\tdeleteSourceBranchOnMerge = *repo.DeleteSourceBranchOnMerge\n\t\t\t\t\t}\n\t\t\t\tcase RepoLockingKey:\n\t\t\t\t\tif repo.RepoLocking != nil {\n\t\t\t\t\t\ttoLog[RepoLockingKey] = traceF(i, repo.IDString(), RepoLockingKey, *repo.RepoLocking)\n\t\t\t\t\t\trepoLocking = *repo.RepoLocking\n\t\t\t\t\t}\n\t\t\t\tcase PolicyCheckKey:\n\t\t\t\t\tif repo.PolicyCheck != nil {\n\t\t\t\t\t\ttoLog[PolicyCheckKey] = traceF(i, repo.IDString(), PolicyCheckKey, *repo.PolicyCheck)\n\t\t\t\t\t\tpolicyCheck = *repo.PolicyCheck\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\tfor _, l := range toLog {\n\t\tlog.Debug(l)\n\t}\n\treturn\n}", "func (p *SQLResourcesClientCreateUpdateSQLTriggerPoller) Poll(ctx context.Context) (*http.Response, error) {\n\treturn p.pt.Poll(ctx)\n}", "func (cc *CenterConfig) Find() error {\n\tdb := cc.getDb()\n\treturn db.Read(cc)\n}", "func FindStockCvtermP(exec boil.Executor, stockCvtermID int, selectCols ...string) *StockCvterm {\n\tretobj, err := FindStockCvterm(exec, stockCvtermID, selectCols...)\n\tif err != nil {\n\t\tpanic(boil.WrapErr(err))\n\t}\n\n\treturn retobj\n}", "func (op *UpdateKmsConfigOperation) Poll(ctx context.Context, opts ...gax.CallOption) (*netapppb.KmsConfig, error) {\n\topts = append([]gax.CallOption{gax.WithPath(op.pollPath)}, opts...)\n\tvar resp netapppb.KmsConfig\n\tif err := op.lro.Poll(ctx, &resp, opts...); err != nil {\n\t\treturn nil, err\n\t}\n\tif !op.Done() {\n\t\treturn nil, nil\n\t}\n\treturn &resp, nil\n}", "func (eng *Engine) search(depth, estimated int32) int32 {\n\t// this method only implements aspiration windows\n\t//\n\t// the gradual widening algorithm is the one used by RobboLito\n\t// and Stockfish and it is explained here:\n\t// http://www.talkchess.com/forum/viewtopic.php?topic_view=threads&p=499768&t=46624\n\tγ, δ := estimated, int32(initialAspirationWindow)\n\tα, β := max(γ-δ, -InfinityScore), min(γ+δ, InfinityScore)\n\tscore := estimated\n\n\tif depth < 4 {\n\t\t// disable aspiration window for very low search depths\n\t\tα, β = -InfinityScore, +InfinityScore\n\t}\n\n\tfor !eng.stopped {\n\t\t// at root a non-null move is required, cannot prune based on null-move\n\t\tscore = eng.searchTree(α, β, depth)\n\t\tif score <= α {\n\t\t\tα = max(α-δ, -InfinityScore)\n\t\t\tδ += δ / 2\n\t\t} else if score >= β {\n\t\t\tβ = min(β+δ, InfinityScore)\n\t\t\tδ += δ / 2\n\t\t} else {\n\t\t\treturn score\n\t\t}\n\t}\n\n\treturn score\n}", "func (eth *Backend) poll(ctx context.Context) {\n\tbest := &eth.bestHash\n\tsend := func(reorg bool, err error) {\n\t\tif err != nil {\n\t\t\teth.log.Error(err)\n\t\t}\n\t\teth.blockChansMtx.RLock()\n\t\tfor c := range eth.blockChans {\n\t\t\tselect {\n\t\t\tcase c <- &asset.BlockUpdate{\n\t\t\t\tReorg: reorg,\n\t\t\t\tErr: err,\n\t\t\t}:\n\t\t\tdefault:\n\t\t\t\teth.log.Error(\"failed to send block update on blocking channel\")\n\t\t\t}\n\t\t}\n\t\teth.blockChansMtx.RUnlock()\n\t}\n\tbhdr, err := eth.node.bestHeader(ctx)\n\tif err != nil {\n\t\tsend(false, fmt.Errorf(\"error getting best block header from geth: %w\", err))\n\t\treturn\n\t}\n\tif bhdr.Hash() == best.hash {\n\t\t// Same hash, nothing to do.\n\t\treturn\n\t}\n\tupdate := func(reorg bool, fastBlocks bool) {\n\t\thash := bhdr.Hash()\n\t\theight := bhdr.Number.Uint64()\n\t\tstr := fmt.Sprintf(\"Tip change from %s (%d) to %s (%d).\",\n\t\t\tbest.hash, best.height, hash, height)\n\t\tswitch {\n\t\tcase reorg:\n\t\t\tstr += \" Detected reorg.\"\n\t\tcase fastBlocks:\n\t\t\tstr += \" Fast blocks.\"\n\t\t}\n\t\teth.log.Debug(str)\n\t\tbest.hash = hash\n\t\tbest.height = height\n\t}\n\tif bhdr.ParentHash == best.hash {\n\t\t// Sequential hash, report a block update.\n\t\tupdate(false, false)\n\t\tsend(false, nil)\n\t\treturn\n\t}\n\t// Either a block was skipped or a reorg happened. We can only detect\n\t// the reorg if our last best header's hash has changed. Otherwise,\n\t// assume no reorg and report the new block change.\n\t//\n\t// headerByHeight will only return mainchain headers.\n\thdr, err := eth.node.headerByHeight(ctx, best.height)\n\tif err != nil {\n\t\tsend(false, fmt.Errorf(\"error getting block header from geth: %w\", err))\n\t\treturn\n\t}\n\tif hdr.Hash() == best.hash {\n\t\t// Our recorded hash is still on main chain so there is no reorg\n\t\t// that we know of. The chain has advanced more than one block.\n\t\tupdate(false, true)\n\t\tsend(false, nil)\n\t\treturn\n\t}\n\t// The block for our recorded hash was forked off and the chain had a\n\t// reorganization.\n\tupdate(true, false)\n\tsend(true, nil)\n}", "func (c Chain) findVote(v Vote) string {\n\tblockToCheck := c.CurrentBlock\n\n\tfor {\n\t\tfor _, voteToCheck := range blockToCheck.Votes {\n\t\t\tif voteToCheck == v {\n\t\t\t\treturn blockToCheck.Hash()\n\t\t\t}\n\t\t}\n\t\tif blockToCheck.Parent == seedParent {\n\t\t\treturn \"\"\n\t\t}\n\t\tblockToCheck = c.Blocks[blockToCheck.Parent]\n\t}\n}", "func FindStockCvtermGP(stockCvtermID int, selectCols ...string) *StockCvterm {\n\tretobj, err := FindStockCvterm(boil.GetDB(), stockCvtermID, selectCols...)\n\tif err != nil {\n\t\tpanic(boil.WrapErr(err))\n\t}\n\n\treturn retobj\n}", "func (p *SQLResourcesCreateUpdateSQLTriggerPoller) Poll(ctx context.Context) (*http.Response, error) {\n\treturn p.pt.Poll(ctx)\n}", "func (d *OrderedDaemon) waitGroupForLastPriority() *sync.WaitGroup {\n\td.lock.Lock()\n\tdefer d.lock.Unlock()\n\n\tif len(d.shutdownOrderWorker) == 0 {\n\t\treturn nil\n\t}\n\t// find lowest shutdown priority\n\tlowestShutdownPriorityWorker := d.workers[d.shutdownOrderWorker[len(d.shutdownOrderWorker)-1]]\n\t// return waitGroup for lowest priority\n\treturn d.wgPerSameShutdownOrder[lowestShutdownPriorityWorker.shutdownOrder]\n}", "func findMode(root *TreeNode) []int {\n\tres, max, cur, counter = []int{}, 1, 0, 0\n\tinorder(root)\n\treturn res\n}", "func (r *Raft) candidate(timeout int) int {\n\twaitTime := timeout //added for passing timeout from outside--In SingleServerBinary\n\tresendTime := 5 //should be much smaller than waitTime\n\tElectionTimer := r.StartTimer(ElectionTimeout, waitTime)\n\t//This loop is for election process which keeps on going until a leader is elected\n\tfor {\n\t\t//reset the Votes else it will reflect the Votes received in last Term\n\t\tr.resetVotes()\n\t\tr.myCV.CurrentTerm += 1 //increment current Term\n\t\tr.myCV.VotedFor = r.Myconfig.Id //Vote for self\n\t\tr.WriteCVToDisk() //write Current Term and VotedFor to disk\n\t\tr.f_specific[r.Myconfig.Id].Vote = true //vote true\n\t\treqVoteObj := r.prepRequestVote() //prepare request Vote obj\n\t\tr.sendToAll(reqVoteObj) //send requests for Vote to all servers\n\t\tResendVoteTimer := r.StartTimer(ResendVoteTimeOut, resendTime)\n\t\tfor { //this loop for reading responses from all servers\n\t\t\treq := r.receive()\n\t\t\tswitch req.(type) {\n\t\t\tcase ClientAppendReq: ///candidate must also respond as false just like follower\n\t\t\t\trequest := req.(ClientAppendReq) //explicit typecasting\n\t\t\t\tresponse := ClientAppendResponse{}\n\t\t\t\tlogItem := LogItem{r.CurrentLogEntryCnt, false, request.Data} //lsn is count started from 0\n\t\t\t\tr.CurrentLogEntryCnt += 1\n\t\t\t\tresponse.LogEntry = logItem\n\t\t\t\tr.CommitCh <- &response.LogEntry\n\t\t\tcase RequestVoteResponse: //got the Vote response\n\t\t\t\tresponse := req.(RequestVoteResponse) //explicit typecasting so that fields of struct can be used\n\t\t\t\tif response.VoteGranted {\n\t\t\t\t\tr.f_specific[response.Id].Vote = true\n\t\t\t\t}\n\t\t\t\tVoteCount := r.countVotes()\n\t\t\t\tif VoteCount >= majority {\n\t\t\t\t\tResendVoteTimer.Stop()\n\t\t\t\t\tElectionTimer.Stop()\n\t\t\t\t\tr.LeaderConfig.Id = r.Myconfig.Id //update leader details\n\t\t\t\t\treturn leader //become the leader\n\t\t\t\t}\n\n\t\t\tcase AppendEntriesReq: //received an AE request instead of Votes, i.e. some other leader has been elected\n\t\t\t\trequest := req.(AppendEntriesReq)\n\t\t\t\tretVal := r.serviceAppendEntriesReq(request, nil, 0, candidate)\n\t\t\t\tif retVal == follower {\n\t\t\t\t\tResendVoteTimer.Stop()\n\t\t\t\t\tElectionTimer.Stop()\n\t\t\t\t\treturn follower\n\t\t\t\t}\n\n\t\t\tcase RequestVote:\n\t\t\t\trequest := req.(RequestVote)\n\t\t\t\t//==Can be shared with service request vote with additinal param of caller(candidate or follower)\n\t\t\t\tresponse := RequestVoteResponse{} //prep response object,for responding back to requester\n\t\t\t\tcandidateId := request.CandidateId\n\t\t\t\tresponse.Id = r.Myconfig.Id\n\t\t\t\tif r.isDeservingCandidate(request) {\n\t\t\t\t\tresponse.VoteGranted = true\n\t\t\t\t\tr.myCV.VotedFor = candidateId\n\t\t\t\t\tr.myCV.CurrentTerm = request.Term\n\t\t\t\t\tif request.Term > r.myCV.CurrentTerm { //write to disk only when value has changed\n\t\t\t\t\t\tr.WriteCVToDisk()\n\t\t\t\t\t}\n\t\t\t\t\tResendVoteTimer.Stop()\n\t\t\t\t\tElectionTimer.Stop()\n\t\t\t\t\treturn follower\n\t\t\t\t} else {\n\t\t\t\t\tresponse.VoteGranted = false\n\t\t\t\t}\n\t\t\t\tresponse.Term = r.myCV.CurrentTerm\n\t\t\t\tr.send(candidateId, response)\n\n\t\t\tcase int:\n\t\t\t\ttimeout := req.(int)\n\t\t\t\tif timeout == ResendVoteTimeOut {\n\t\t\t\t\trT := msecs * time.Duration(resendTime)\n\t\t\t\t\tResendVoteTimer.Reset(rT)\n\t\t\t\t\treqVoteObj := r.prepRequestVote() //prepare request Vote agn and send to all, ones rcvg the vote agn will vote true agn so won't matter and countVotes func counts no.of true entries\n\t\t\t\t\tr.sendToAll(reqVoteObj)\n\t\t\t\t} else if timeout == ElectionTimeout {\n\t\t\t\t\twaitTime_msecs := msecs * time.Duration(waitTime)\n\t\t\t\t\tElectionTimer.Reset(waitTime_msecs)\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}", "func (c *Reconciler) ReconcileKind(ctx context.Context, cfg *v1.Configuration) pkgreconciler.Event {\n\tlogger := logging.FromContext(ctx)\n\n\t// ignore changes triggered by continuous-delivery itself\n\tif cfg.Namespace == KCDNamespace && cfg.Name == KCDName {\n\t\treturn nil\n\t}\n\n\t// retrieve information about latest ready and created Revisions\n\t// do nothing if latest created Revision is not ready\n\tlatestReady := cfg.Status.LatestReadyRevisionName\n\tlatestCreated := cfg.Status.LatestCreatedRevisionName\n\tif latestReady != latestCreated {\n\t\treturn nil\n\t}\n\n\t// find the Route object\n\tr, err := c.routeLister.Routes(cfg.Namespace).Get(cfg.Name)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// determine if the current routing status includes the latest Revision\n\t// if yes, do nothing; if not, rewrite routing spec\n\troute := r.DeepCopy()\n\tfor idx := range route.Status.Traffic {\n\t\tif route.Status.Traffic[idx].RevisionName == latestReady {\n\t\t\treturn nil\n\t\t}\n\t}\n\tif len(route.Status.Traffic) >= 2 {\n\t\tlogger.Info(\"Unsupported use case: current implementation only supports 2 Revisions at once\")\n\t\treturn nil\n\t} else {\n\t\troute = modifyRouteSpec(route, latestReady)\n\t}\n\n\t// push the changed Route from Go memory to K8s\n\troute, err = c.client.ServingV1().Routes(cfg.Namespace).Update(route)\n\treturn err\n}", "func WaitForConfigLatestRevision(clients *Clients, names ResourceNames) (string, error) {\n\tvar revisionName string\n\terr := WaitForConfigurationState(clients.ServingClient, names.Config, func(c *v1alpha1.Configuration) (bool, error) {\n\t\tif c.Status.LatestCreatedRevisionName != names.Revision {\n\t\t\trevisionName = c.Status.LatestCreatedRevisionName\n\t\t\treturn true, nil\n\t\t}\n\t\treturn false, nil\n\t}, \"ConfigurationUpdatedWithRevision\")\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\terr = WaitForConfigurationState(clients.ServingClient, names.Config, func(c *v1alpha1.Configuration) (bool, error) {\n\t\treturn (c.Status.LatestReadyRevisionName == revisionName), nil\n\t}, \"ConfigurationReadyWithRevision\")\n\n\treturn revisionName, err\n}", "func (rf *Raft) RequestVote(args *RequestVoteArgs, reply *RequestVoteReply) {\n\t// Your code here (2A, 2B).\n\trf.mu.Lock()\n\tdefer rf.mu.Unlock()\n\tcurrentTerm := rf.currentTerm\n\tif args == nil {\n\t\tDPrintf(\"Peer-%d received a null vote request.\", rf.me)\n\t\treturn\n\t}\n\tcandidateTerm := args.Term\n\tcandidateId := args.Candidate\n\tDPrintf(\"Peer-%d received a vote request %v from peer-%d.\", rf.me, *args, candidateId)\n\tif candidateTerm < currentTerm {\n\t\tDPrintf(\"Peer-%d's term=%d > candidate's term=%d.\\n\", rf.me, currentTerm, candidateTerm)\n\t\treply.Term = currentTerm\n\t\treply.VoteGrant = false\n\t\treturn\n\t} else if candidateTerm == currentTerm {\n\t\tif rf.voteFor != -1 && rf.voteFor != candidateId {\n\t\t\tDPrintf(\"Peer-%d has grant to peer-%d before this request from peer-%d.\", rf.me, rf.voteFor, candidateId)\n\t\t\treply.Term = currentTerm\n\t\t\treply.VoteGrant = false\n\t\t\treturn\n\t\t}\n\t\tDPrintf(\"Peer-%d's term=%d == candidate's term=%d, to check index.\\n\", rf.me, currentTerm, candidateTerm)\n\t} else {\n\t\tDPrintf(\"Peer-%d's term=%d < candidate's term=%d.\\n\", rf.me, currentTerm, candidateTerm)\n\t\t// begin to update status\n\t\trf.currentTerm = candidateTerm // find larger term, up to date\n\t\trf.transitionState(NewTerm) // transition to Follower.\n\t\tgo func() {\n\t\t\trf.eventChan <- NewTerm // tell the electionService to change state.\n\t\t}()\n\t}\n\t// check whose log is up-to-date\n\tcandiLastLogIndex := args.LastLogIndex\n\tcandiLastLogTerm := args.LastLogTerm\n\tlocalLastLogIndex := len(rf.log) - 1\n\tlocalLastLogTerm := -1\n\tif localLastLogIndex >= 0 {\n\t\tlocalLastLogTerm = rf.log[localLastLogIndex].Term\n\t}\n\t// check term first, if term is the same, then check the index.\n\tDPrintf(\"Peer-%d try to check last entry, loacl: index=%d;term=%d, candi: index=%d,term=%d.\", rf.me, localLastLogIndex, localLastLogTerm, candiLastLogIndex, candiLastLogTerm)\n\tif localLastLogTerm > candiLastLogTerm {\n\t\treply.Term = rf.currentTerm\n\t\treply.VoteGrant = false\n\t\treturn\n\t} else if localLastLogTerm == candiLastLogTerm {\n\t\tif localLastLogIndex > candiLastLogIndex {\n\t\t\treply.Term = rf.currentTerm\n\t\t\treply.VoteGrant = false\n\t\t\treturn\n\t\t}\n\t} else {\n\t}\n\t// heartbeat.\n\tgo func() {\n\t\trf.eventChan <- HeartBeat\n\t}()\n\t// local log are up-to-date, grant\n\t// before grant to candidate, we should reset ourselves state.\n\trf.transitionState(NewLeader)\n\trf.voteFor = candidateId\n\treply.Term = rf.currentTerm\n\treply.VoteGrant = true\n\tDPrintf(\"Peer-%d grant to peer-%d.\", rf.me, candidateId)\n\trf.persist()\n\treturn\n}", "func (c *Command) Find(name string) *Command {\n\tfor _, cc := range c.commands {\n\t\tif cc.match(name) {\n\t\t\treturn cc\n\t\t}\n\t}\n\n\treturn nil\n}", "func (db *MongoDB) GetLatest(days int) ([]Fixer, error) {\n\tfixers := []Fixer{}\n\n\terr := Session.DB(db.DatabaseName).C(db.ExchangeCollectionName).Find(bson.M{}).Sort(\"date\", \"1\").Limit(days).All(&fixers)\n\tif err != nil {\n\t\treturn fixers, err\n\t}\n\n\treturn fixers, nil\n}", "func GuessConfigVersion(doc *tomledit.Document) string {\n\thasDisableWS := doc.First(\"rpc\", \"experimental-disable-websocket\") != nil\n\thasUseLegacy := doc.First(\"p2p\", \"use-legacy\") != nil // v0.35 only\n\tif hasDisableWS && !hasUseLegacy {\n\t\treturn v36\n\t}\n\n\thasBlockSync := transform.FindTable(doc, \"blocksync\") != nil // add: v0.35\n\thasStateSync := transform.FindTable(doc, \"statesync\") != nil // add: v0.34\n\tif hasBlockSync && hasStateSync {\n\t\treturn v35\n\t} else if hasStateSync {\n\t\treturn v34\n\t}\n\n\thasIndexKeys := doc.First(\"tx_index\", \"index_keys\") != nil // add: v0.33\n\thasIndexTags := doc.First(\"tx_index\", \"index_tags\") != nil // rem: v0.33\n\tif hasIndexKeys && !hasIndexTags {\n\t\treturn v33\n\t}\n\n\thasFastSync := transform.FindTable(doc, \"fastsync\") != nil // add: v0.32\n\tif hasIndexTags && hasFastSync {\n\t\treturn v32\n\t}\n\n\t// Something older, probably.\n\treturn vUnknown\n}", "func (q cargoQueue) findNextCandidate(target, curr int) (int, bool) {\n\tif curr < 0 {\n\t\tcurr = 0\n\t}\n\tfor ; curr < len(q); curr++ {\n\t\tif q[curr].area <= target {\n\t\t\treturn curr, true\n\t\t}\n\t}\n\treturn 0, false\n}", "func (c *Conn) find(commandName string, args []interface{}) *Cmd {\n\tfor _, cmd := range c.commands {\n\t\tif match(commandName, args, cmd) {\n\t\t\treturn cmd\n\t\t}\n\t}\n\treturn nil\n}", "func (p *PollAnswerVoters) GetChosen() (value bool) {\n\tif p == nil {\n\t\treturn\n\t}\n\treturn p.Flags.Has(0)\n}", "func (m attachmentUpdateStrategies) GetOrDefault(\n\tapiGroup string,\n\tkind string,\n) v1alpha1.ChildUpdateMethod {\n\t// get the strategy\n\tstrategy := m.get(apiGroup, kind)\n\tif strategy == nil || strategy.Method == \"\" {\n\t\t// defaults to ChildUpdateOnDelete strategy\n\t\treturn v1alpha1.ChildUpdateOnDelete\n\t}\n\treturn strategy.Method\n}", "func (r *RuleMatcher) FindMatch(cfgString string) string {\n\tif match, ok := r.rules[cfgString]; ok {\n\t\treturn match\n\t}\n\n\tchunk := cfgToChunk(cfgString)\n\tfor i := 0; i < 4; i++ {\n\t\tchunk = flipChunk(chunk)\n\t\tflippedCfg := chunkToCfgString(chunk)\n\t\tif match, ok := r.rules[flippedCfg]; ok {\n\t\t\tr.AddRule(cfgString, match)\n\t\t\treturn match\n\t\t}\n\n\t\tchunk = transposeChunk(chunk)\n\t\ttransposed := chunkToCfgString(chunk)\n\t\tif match, ok := r.rules[transposed]; ok {\n\t\t\tr.AddRule(cfgString, match)\n\t\t\treturn match\n\t\t}\n\t}\n\tpanic(\"No match found\")\n}", "func (t *tester) findChanges(ctx context.Context) ([]*gerrit.ChangeInfo, error) {\n\treturn t.gerrit.QueryChanges(\n\t\tctx,\n\t\tfmt.Sprintf(\"project:%s status:open label:Run-TryBot+1 -label:TryBot-Result-1 -label:TryBot-Result+1\", t.repo),\n\t\tgerrit.QueryChangesOpt{Fields: []string{\"CURRENT_REVISION\"}},\n\t)\n}", "func (w *pollWorker) compareVote(vote1, vote2 VoteMsg) common.CompareResult {\n\n\t// Vote with the larger epoch always is larger\n\tresult := common.CompareEpoch(vote1.GetEpoch(), vote2.GetEpoch())\n\n\tif result == common.MORE_RECENT {\n\t\treturn common.GREATER\n\t}\n\n\tif result == common.LESS_RECENT {\n\t\treturn common.LESSER\n\t}\n\n\t// If a candidate has a larger logged txid, it means the candidate\n\t// has processed more proposals. This vote is larger.\n\tif vote1.GetCndLoggedTxnId() > vote2.GetCndLoggedTxnId() {\n\t\treturn common.GREATER\n\t}\n\n\tif vote1.GetCndLoggedTxnId() < vote2.GetCndLoggedTxnId() {\n\t\treturn common.LESSER\n\t}\n\n\t// This candidate has the same number of proposals in his committed log as\n\t// the other one. But if a candidate has a larger committed txid,\n\t// it means this candidate also has processed more commit messages from the\n\t// previous leader. This vote is larger.\n\tif vote1.GetCndCommittedTxnId() > vote2.GetCndCommittedTxnId() {\n\t\treturn common.GREATER\n\t}\n\n\tif vote1.GetCndCommittedTxnId() < vote2.GetCndCommittedTxnId() {\n\t\treturn common.LESSER\n\t}\n\n\t// All else is equal (e.g. during inital system startup -- repository is emtpy),\n\t// use the ip address.\n\tif vote1.GetCndId() > vote2.GetCndId() {\n\t\treturn common.GREATER\n\t}\n\n\tif vote1.GetCndId() < vote2.GetCndId() {\n\t\treturn common.LESSER\n\t}\n\n\treturn common.EQUAL\n}", "func (s *PollOptionStore) FindOne(q *PollOptionQuery) (*PollOption, error) {\n\tq.Limit(1)\n\tq.Offset(0)\n\trs, err := s.Find(q)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tif !rs.Next() {\n\t\treturn nil, kallax.ErrNotFound\n\t}\n\n\trecord, err := rs.Get()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tif err := rs.Close(); err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn record, nil\n}", "func d6pickBranch(rect *d6rectT, node *d6nodeT) int {\n\tvar firstTime bool = true\n\tvar increase float64\n\tvar bestIncr float64 = -1\n\tvar area float64\n\tvar bestArea float64\n\tvar best int\n\tvar tempRect d6rectT\n\n\tfor index := 0; index < node.count; index++ {\n\t\tcurRect := &node.branch[index].rect\n\t\tarea = d6calcRectVolume(curRect)\n\t\ttempRect = d6combineRect(rect, curRect)\n\t\tincrease = d6calcRectVolume(&tempRect) - area\n\t\tif (increase < bestIncr) || firstTime {\n\t\t\tbest = index\n\t\t\tbestArea = area\n\t\t\tbestIncr = increase\n\t\t\tfirstTime = false\n\t\t} else if (increase == bestIncr) && (area < bestArea) {\n\t\t\tbest = index\n\t\t\tbestArea = area\n\t\t\tbestIncr = increase\n\t\t}\n\t}\n\treturn best\n}", "func (k Querier) LatestCheckpoint(c context.Context, req *types.QueryLatestCheckpointRequest) (*types.QueryLatestCheckpointResponse, error) {\n\tif req == nil {\n\t\treturn nil, status.Error(codes.InvalidArgument, \"empty request\")\n\t}\n\tctx := sdk.UnwrapSDKContext(c)\n\tackCount := k.GetACKCount(ctx)\n\tif ackCount == 0 {\n\t\treturn nil, status.Error(codes.NotFound, \"No ack count found\")\n\t}\n\n\t// Last checkpoint key\n\tk.Logger(ctx).Debug(\"ACK Count fetched\", \"ackCount\", ackCount)\n\tlastCheckpointKey := ackCount\n\tk.Logger(ctx).Debug(\"Last checkpoint key generated\", \"lastCheckpointKey\", lastCheckpointKey)\n\n\tres, err := k.GetCheckpointByNumber(ctx, lastCheckpointKey)\n\tif err != nil {\n\t\treturn nil, types.ErrNoCheckpointFound\n\t}\n\n\treturn &types.QueryLatestCheckpointResponse{\n\t\tLatestCheckpoint: &res,\n\t}, nil\n}", "func (*AlertingCondition_Spec_Trigger) Descriptor() ([]byte, []int) {\n\treturn edgelq_monitoring_proto_v3_alerting_condition_proto_rawDescGZIP(), []int{0, 0, 1}\n}", "func (s *BaseSpeaker) CallJudgeElection(monitoring shared.MonitorResult, turnsInPower int, allIslands []shared.ClientID) shared.ElectionSettings {\n\t// example implementation calls an election if monitoring was performed and the result was negative\n\t// or if the number of turnsInPower exceeds 3\n\tvar electionsettings = shared.ElectionSettings{\n\t\tVotingMethod: shared.BordaCount,\n\t\tIslandsToVote: allIslands,\n\t\tHoldElection: false,\n\t}\n\tif monitoring.Performed && !monitoring.Result {\n\t\telectionsettings.HoldElection = true\n\t}\n\tif turnsInPower >= 2 {\n\t\telectionsettings.HoldElection = true\n\t}\n\treturn electionsettings\n}", "func bestBuilder(infos []os.FileInfo) *builder {\n\tbestBuilder := math.MaxInt32\n\n\t// Run each Builders' detection on every files\n\tfor _, f := range infos {\n\t\tfor i, b := range builders {\n\t\t\tif b.canBuild(f) && i < bestBuilder {\n\t\t\t\t// Remember the best builder we found\n\t\t\t\tbestBuilder = i\n\t\t\t}\n\t\t}\n\t}\n\n\tif bestBuilder != math.MaxInt32 {\n\t\t// builder found\n\t\treturn &builders[bestBuilder]\n\t}\n\n\treturn nil\n}", "func (d *mongoDriver) getNextQuery() bson.M {\n\tlockTimeout := d.LockTimeout()\n\tnow := time.Now()\n\tqd := bson.M{\n\t\t\"$or\": []bson.M{\n\t\t\td.getPendingQuery(bson.M{}),\n\t\t\td.getInProgQuery(\n\t\t\t\tbson.M{\"status.mod_ts\": bson.M{\"$lte\": now.Add(-lockTimeout)}},\n\t\t\t),\n\t\t},\n\t}\n\n\td.modifyQueryForGroup(qd)\n\n\tvar timeLimits []bson.M\n\tif d.opts.CheckWaitUntil {\n\t\tcheckWaitUntil := bson.M{\"$or\": []bson.M{\n\t\t\t{\"time_info.wait_until\": bson.M{\"$lte\": now}},\n\t\t\t{\"time_info.wait_until\": bson.M{\"$exists\": false}},\n\t\t}}\n\t\ttimeLimits = append(timeLimits, checkWaitUntil)\n\t}\n\n\tif d.opts.CheckDispatchBy {\n\t\tcheckDispatchBy := bson.M{\"$or\": []bson.M{\n\t\t\t{\"time_info.dispatch_by\": bson.M{\"$gt\": now}},\n\t\t\t{\"time_info.dispatch_by\": bson.M{\"$exists\": false}},\n\t\t\t// TODO (EVG-XXX): remove zero value case after 90 day TTL\n\t\t\t// (2022-01-01) since the field will be omitted.\n\t\t\t{\"time_info.dispatch_by\": time.Time{}},\n\t\t}}\n\t\ttimeLimits = append(timeLimits, checkDispatchBy)\n\t}\n\n\tif len(timeLimits) > 0 {\n\t\tqd = bson.M{\"$and\": append(timeLimits, qd)}\n\t}\n\n\treturn qd\n}", "func (rm *resourceManager) sdkFind(\n\tctx context.Context,\n\tr *resource,\n) (latest *resource, err error) {\n\trlog := ackrtlog.FromContext(ctx)\n\texit := rlog.Trace(\"rm.sdkFind\")\n\tdefer exit(err)\n\t// If any required fields in the input shape are missing, AWS resource is\n\t// not created yet. Return NotFound here to indicate to callers that the\n\t// resource isn't yet created.\n\tif rm.requiredFieldsMissingFromReadOneInput(r) {\n\t\treturn nil, ackerr.NotFound\n\t}\n\n\tinput, err := rm.newDescribeRequestPayload(r)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar resp *svcsdk.DescribeModelBiasJobDefinitionOutput\n\tresp, err = rm.sdkapi.DescribeModelBiasJobDefinitionWithContext(ctx, input)\n\trm.metrics.RecordAPICall(\"READ_ONE\", \"DescribeModelBiasJobDefinition\", err)\n\tif err != nil {\n\t\tif awsErr, ok := ackerr.AWSError(err); ok && awsErr.Code() == \"ResourceNotFound\" {\n\t\t\treturn nil, ackerr.NotFound\n\t\t}\n\t\treturn nil, err\n\t}\n\n\t// Merge in the information we read from the API call above to the copy of\n\t// the original Kubernetes object we passed to the function\n\tko := r.ko.DeepCopy()\n\n\tif ko.Status.ACKResourceMetadata == nil {\n\t\tko.Status.ACKResourceMetadata = &ackv1alpha1.ResourceMetadata{}\n\t}\n\tif resp.JobDefinitionArn != nil {\n\t\tarn := ackv1alpha1.AWSResourceName(*resp.JobDefinitionArn)\n\t\tko.Status.ACKResourceMetadata.ARN = &arn\n\t}\n\tif resp.JobDefinitionName != nil {\n\t\tko.Spec.JobDefinitionName = resp.JobDefinitionName\n\t} else {\n\t\tko.Spec.JobDefinitionName = nil\n\t}\n\tif resp.JobResources != nil {\n\t\tf3 := &svcapitypes.MonitoringResources{}\n\t\tif resp.JobResources.ClusterConfig != nil {\n\t\t\tf3f0 := &svcapitypes.MonitoringClusterConfig{}\n\t\t\tif resp.JobResources.ClusterConfig.InstanceCount != nil {\n\t\t\t\tf3f0.InstanceCount = resp.JobResources.ClusterConfig.InstanceCount\n\t\t\t}\n\t\t\tif resp.JobResources.ClusterConfig.InstanceType != nil {\n\t\t\t\tf3f0.InstanceType = resp.JobResources.ClusterConfig.InstanceType\n\t\t\t}\n\t\t\tif resp.JobResources.ClusterConfig.VolumeKmsKeyId != nil {\n\t\t\t\tf3f0.VolumeKMSKeyID = resp.JobResources.ClusterConfig.VolumeKmsKeyId\n\t\t\t}\n\t\t\tif resp.JobResources.ClusterConfig.VolumeSizeInGB != nil {\n\t\t\t\tf3f0.VolumeSizeInGB = resp.JobResources.ClusterConfig.VolumeSizeInGB\n\t\t\t}\n\t\t\tf3.ClusterConfig = f3f0\n\t\t}\n\t\tko.Spec.JobResources = f3\n\t} else {\n\t\tko.Spec.JobResources = nil\n\t}\n\tif resp.ModelBiasAppSpecification != nil {\n\t\tf4 := &svcapitypes.ModelBiasAppSpecification{}\n\t\tif resp.ModelBiasAppSpecification.ConfigUri != nil {\n\t\t\tf4.ConfigURI = resp.ModelBiasAppSpecification.ConfigUri\n\t\t}\n\t\tif resp.ModelBiasAppSpecification.Environment != nil {\n\t\t\tf4f1 := map[string]*string{}\n\t\t\tfor f4f1key, f4f1valiter := range resp.ModelBiasAppSpecification.Environment {\n\t\t\t\tvar f4f1val string\n\t\t\t\tf4f1val = *f4f1valiter\n\t\t\t\tf4f1[f4f1key] = &f4f1val\n\t\t\t}\n\t\t\tf4.Environment = f4f1\n\t\t}\n\t\tif resp.ModelBiasAppSpecification.ImageUri != nil {\n\t\t\tf4.ImageURI = resp.ModelBiasAppSpecification.ImageUri\n\t\t}\n\t\tko.Spec.ModelBiasAppSpecification = f4\n\t} else {\n\t\tko.Spec.ModelBiasAppSpecification = nil\n\t}\n\tif resp.ModelBiasBaselineConfig != nil {\n\t\tf5 := &svcapitypes.ModelBiasBaselineConfig{}\n\t\tif resp.ModelBiasBaselineConfig.BaseliningJobName != nil {\n\t\t\tf5.BaseliningJobName = resp.ModelBiasBaselineConfig.BaseliningJobName\n\t\t}\n\t\tif resp.ModelBiasBaselineConfig.ConstraintsResource != nil {\n\t\t\tf5f1 := &svcapitypes.MonitoringConstraintsResource{}\n\t\t\tif resp.ModelBiasBaselineConfig.ConstraintsResource.S3Uri != nil {\n\t\t\t\tf5f1.S3URI = resp.ModelBiasBaselineConfig.ConstraintsResource.S3Uri\n\t\t\t}\n\t\t\tf5.ConstraintsResource = f5f1\n\t\t}\n\t\tko.Spec.ModelBiasBaselineConfig = f5\n\t} else {\n\t\tko.Spec.ModelBiasBaselineConfig = nil\n\t}\n\tif resp.ModelBiasJobInput != nil {\n\t\tf6 := &svcapitypes.ModelBiasJobInput{}\n\t\tif resp.ModelBiasJobInput.EndpointInput != nil {\n\t\t\tf6f0 := &svcapitypes.EndpointInput{}\n\t\t\tif resp.ModelBiasJobInput.EndpointInput.EndTimeOffset != nil {\n\t\t\t\tf6f0.EndTimeOffset = resp.ModelBiasJobInput.EndpointInput.EndTimeOffset\n\t\t\t}\n\t\t\tif resp.ModelBiasJobInput.EndpointInput.EndpointName != nil {\n\t\t\t\tf6f0.EndpointName = resp.ModelBiasJobInput.EndpointInput.EndpointName\n\t\t\t}\n\t\t\tif resp.ModelBiasJobInput.EndpointInput.FeaturesAttribute != nil {\n\t\t\t\tf6f0.FeaturesAttribute = resp.ModelBiasJobInput.EndpointInput.FeaturesAttribute\n\t\t\t}\n\t\t\tif resp.ModelBiasJobInput.EndpointInput.InferenceAttribute != nil {\n\t\t\t\tf6f0.InferenceAttribute = resp.ModelBiasJobInput.EndpointInput.InferenceAttribute\n\t\t\t}\n\t\t\tif resp.ModelBiasJobInput.EndpointInput.LocalPath != nil {\n\t\t\t\tf6f0.LocalPath = resp.ModelBiasJobInput.EndpointInput.LocalPath\n\t\t\t}\n\t\t\tif resp.ModelBiasJobInput.EndpointInput.ProbabilityAttribute != nil {\n\t\t\t\tf6f0.ProbabilityAttribute = resp.ModelBiasJobInput.EndpointInput.ProbabilityAttribute\n\t\t\t}\n\t\t\tif resp.ModelBiasJobInput.EndpointInput.ProbabilityThresholdAttribute != nil {\n\t\t\t\tf6f0.ProbabilityThresholdAttribute = resp.ModelBiasJobInput.EndpointInput.ProbabilityThresholdAttribute\n\t\t\t}\n\t\t\tif resp.ModelBiasJobInput.EndpointInput.S3DataDistributionType != nil {\n\t\t\t\tf6f0.S3DataDistributionType = resp.ModelBiasJobInput.EndpointInput.S3DataDistributionType\n\t\t\t}\n\t\t\tif resp.ModelBiasJobInput.EndpointInput.S3InputMode != nil {\n\t\t\t\tf6f0.S3InputMode = resp.ModelBiasJobInput.EndpointInput.S3InputMode\n\t\t\t}\n\t\t\tif resp.ModelBiasJobInput.EndpointInput.StartTimeOffset != nil {\n\t\t\t\tf6f0.StartTimeOffset = resp.ModelBiasJobInput.EndpointInput.StartTimeOffset\n\t\t\t}\n\t\t\tf6.EndpointInput = f6f0\n\t\t}\n\t\tif resp.ModelBiasJobInput.GroundTruthS3Input != nil {\n\t\t\tf6f1 := &svcapitypes.MonitoringGroundTruthS3Input{}\n\t\t\tif resp.ModelBiasJobInput.GroundTruthS3Input.S3Uri != nil {\n\t\t\t\tf6f1.S3URI = resp.ModelBiasJobInput.GroundTruthS3Input.S3Uri\n\t\t\t}\n\t\t\tf6.GroundTruthS3Input = f6f1\n\t\t}\n\t\tko.Spec.ModelBiasJobInput = f6\n\t} else {\n\t\tko.Spec.ModelBiasJobInput = nil\n\t}\n\tif resp.ModelBiasJobOutputConfig != nil {\n\t\tf7 := &svcapitypes.MonitoringOutputConfig{}\n\t\tif resp.ModelBiasJobOutputConfig.KmsKeyId != nil {\n\t\t\tf7.KMSKeyID = resp.ModelBiasJobOutputConfig.KmsKeyId\n\t\t}\n\t\tif resp.ModelBiasJobOutputConfig.MonitoringOutputs != nil {\n\t\t\tf7f1 := []*svcapitypes.MonitoringOutput{}\n\t\t\tfor _, f7f1iter := range resp.ModelBiasJobOutputConfig.MonitoringOutputs {\n\t\t\t\tf7f1elem := &svcapitypes.MonitoringOutput{}\n\t\t\t\tif f7f1iter.S3Output != nil {\n\t\t\t\t\tf7f1elemf0 := &svcapitypes.MonitoringS3Output{}\n\t\t\t\t\tif f7f1iter.S3Output.LocalPath != nil {\n\t\t\t\t\t\tf7f1elemf0.LocalPath = f7f1iter.S3Output.LocalPath\n\t\t\t\t\t}\n\t\t\t\t\tif f7f1iter.S3Output.S3UploadMode != nil {\n\t\t\t\t\t\tf7f1elemf0.S3UploadMode = f7f1iter.S3Output.S3UploadMode\n\t\t\t\t\t}\n\t\t\t\t\tif f7f1iter.S3Output.S3Uri != nil {\n\t\t\t\t\t\tf7f1elemf0.S3URI = f7f1iter.S3Output.S3Uri\n\t\t\t\t\t}\n\t\t\t\t\tf7f1elem.S3Output = f7f1elemf0\n\t\t\t\t}\n\t\t\t\tf7f1 = append(f7f1, f7f1elem)\n\t\t\t}\n\t\t\tf7.MonitoringOutputs = f7f1\n\t\t}\n\t\tko.Spec.ModelBiasJobOutputConfig = f7\n\t} else {\n\t\tko.Spec.ModelBiasJobOutputConfig = nil\n\t}\n\tif resp.NetworkConfig != nil {\n\t\tf8 := &svcapitypes.MonitoringNetworkConfig{}\n\t\tif resp.NetworkConfig.EnableInterContainerTrafficEncryption != nil {\n\t\t\tf8.EnableInterContainerTrafficEncryption = resp.NetworkConfig.EnableInterContainerTrafficEncryption\n\t\t}\n\t\tif resp.NetworkConfig.EnableNetworkIsolation != nil {\n\t\t\tf8.EnableNetworkIsolation = resp.NetworkConfig.EnableNetworkIsolation\n\t\t}\n\t\tif resp.NetworkConfig.VpcConfig != nil {\n\t\t\tf8f2 := &svcapitypes.VPCConfig{}\n\t\t\tif resp.NetworkConfig.VpcConfig.SecurityGroupIds != nil {\n\t\t\t\tf8f2f0 := []*string{}\n\t\t\t\tfor _, f8f2f0iter := range resp.NetworkConfig.VpcConfig.SecurityGroupIds {\n\t\t\t\t\tvar f8f2f0elem string\n\t\t\t\t\tf8f2f0elem = *f8f2f0iter\n\t\t\t\t\tf8f2f0 = append(f8f2f0, &f8f2f0elem)\n\t\t\t\t}\n\t\t\t\tf8f2.SecurityGroupIDs = f8f2f0\n\t\t\t}\n\t\t\tif resp.NetworkConfig.VpcConfig.Subnets != nil {\n\t\t\t\tf8f2f1 := []*string{}\n\t\t\t\tfor _, f8f2f1iter := range resp.NetworkConfig.VpcConfig.Subnets {\n\t\t\t\t\tvar f8f2f1elem string\n\t\t\t\t\tf8f2f1elem = *f8f2f1iter\n\t\t\t\t\tf8f2f1 = append(f8f2f1, &f8f2f1elem)\n\t\t\t\t}\n\t\t\t\tf8f2.Subnets = f8f2f1\n\t\t\t}\n\t\t\tf8.VPCConfig = f8f2\n\t\t}\n\t\tko.Spec.NetworkConfig = f8\n\t} else {\n\t\tko.Spec.NetworkConfig = nil\n\t}\n\tif resp.RoleArn != nil {\n\t\tko.Spec.RoleARN = resp.RoleArn\n\t} else {\n\t\tko.Spec.RoleARN = nil\n\t}\n\tif resp.StoppingCondition != nil {\n\t\tf10 := &svcapitypes.MonitoringStoppingCondition{}\n\t\tif resp.StoppingCondition.MaxRuntimeInSeconds != nil {\n\t\t\tf10.MaxRuntimeInSeconds = resp.StoppingCondition.MaxRuntimeInSeconds\n\t\t}\n\t\tko.Spec.StoppingCondition = f10\n\t} else {\n\t\tko.Spec.StoppingCondition = nil\n\t}\n\n\trm.setStatusDefaults(ko)\n\treturn &resource{ko}, nil\n}", "func (c *Easee) waitForDynamicChargerCurrent(targetCurrent float64) error {\n\t// check any updates received meanwhile\n\tc.mux.Lock()\n\tif c.dynamicChargerCurrent == targetCurrent {\n\t\tc.mux.Unlock()\n\t\treturn nil\n\t}\n\tc.mux.Unlock()\n\n\ttimer := time.NewTimer(c.Client.Timeout)\n\tfor {\n\t\tselect {\n\t\tcase obs := <-c.obsC:\n\t\t\tif obs.ID != easee.DYNAMIC_CHARGER_CURRENT {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tvalue, err := obs.TypedValue()\n\t\t\tif err != nil {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif value.(float64) == targetCurrent {\n\t\t\t\treturn nil\n\t\t\t}\n\t\tcase <-timer.C: // time is up, bail after one final check\n\t\t\tc.mux.Lock()\n\t\t\tdefer c.mux.Unlock()\n\t\t\tif c.dynamicChargerCurrent == targetCurrent {\n\t\t\t\treturn nil\n\t\t\t}\n\t\t\treturn api.ErrTimeout\n\t\t}\n\t}\n}", "func (cpu *Mos6502) beq() uint8 {\n\tif cpu.GetStatusFlag(Z) == 1 {\n\t\tcpu.branch()\n\t}\n\treturn 0\n}", "func FindVote(ctx context.Context, exec boil.ContextExecutor, hash string, selectCols ...string) (*Vote, error) {\n\tvoteObj := &Vote{}\n\n\tsel := \"*\"\n\tif len(selectCols) > 0 {\n\t\tsel = strings.Join(strmangle.IdentQuoteSlice(dialect.LQ, dialect.RQ, selectCols), \",\")\n\t}\n\tquery := fmt.Sprintf(\n\t\t\"select %s from \\\"vote\\\" where \\\"hash\\\"=$1\", sel,\n\t)\n\n\tq := queries.Raw(query, hash)\n\n\terr := q.Bind(ctx, exec, voteObj)\n\tif err != nil {\n\t\tif errors.Cause(err) == sql.ErrNoRows {\n\t\t\treturn nil, sql.ErrNoRows\n\t\t}\n\t\treturn nil, errors.Wrap(err, \"models: unable to select from vote\")\n\t}\n\n\treturn voteObj, nil\n}", "func FindVoteGP(id int, selectCols ...string) *Vote {\n\tretobj, err := FindVote(boil.GetDB(), id, selectCols...)\n\tif err != nil {\n\t\tpanic(boil.WrapErr(err))\n\t}\n\n\treturn retobj\n}", "func (eng *Engine) searchMultiPV(depth, estimated int32) (int32, []Move) {\n\ttype pv struct {\n\t\tscore int32\n\t\tmoves []Move\n\t}\n\n\tmultiPV := eng.Options.MultiPV\n\tsearchMultiPV := (eng.Options.HandicapLevel+4)/5 + 1\n\tif multiPV < searchMultiPV {\n\t\tmultiPV = searchMultiPV\n\t}\n\n\tpvs := make([]pv, 0, multiPV)\n\teng.ignoreRootMoves = eng.ignoreRootMoves[:0]\n\tfor p := 0; p < multiPV; p++ {\n\t\tif eng.UseAB {\n\t\t\t// search using naive alphabeta\n\t\t\testimated = eng.searchAB(depth, estimated)\n\t\t} else {\n\t\t\testimated = eng.search(depth, estimated)\n\t\t}\n\t\tif eng.stopped {\n\t\t\tbreak // if eng has been stopped then this is not a legit pv\n\t\t}\n\n\t\tvar moves []Move\n\t\tif eng.UseAB {\n\t\t\t// get pev from naive alphabeta's pv table\n\t\t\tmoves = eng.pvTableAB.Get(eng.Position)\n\t\t} else {\n\t\t\tmoves = eng.pvTable.Get(eng.Position)\n\t\t}\n\t\thasPV := len(moves) != 0 && !eng.isIgnoredRootMove(moves[0])\n\t\tif p == 0 || hasPV { // at depth 0 we might not get a PV\n\t\t\tpvs = append(pvs, pv{estimated, moves})\n\t\t}\n\t\tif !hasPV {\n\t\t\tbreak\n\t\t}\n\t\t// if there is PV ignore the first move for the next PVs\n\t\teng.ignoreRootMoves = append(eng.ignoreRootMoves, moves[0])\n\t}\n\n\t// sort PVs by score\n\tif len(pvs) == 0 {\n\t\treturn 0, nil\n\t}\n\tfor i := range pvs {\n\t\tfor j := i; j >= 0; j-- {\n\t\t\tif j == 0 || pvs[j-1].score > pvs[i].score {\n\t\t\t\ttmp := pvs[i]\n\t\t\t\tcopy(pvs[j+1:i+1], pvs[j:i])\n\t\t\t\tpvs[j] = tmp\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t}\n\n\tfor i := range pvs {\n\t\teng.Log.PrintPV(eng.Stats, i+1, pvs[i].score, pvs[i].moves)\n\t}\n\n\t// for best play return the PV with highest score\n\tif eng.Options.HandicapLevel == 0 || len(pvs) <= 1 {\n\t\treturn pvs[0].score, pvs[0].moves\n\t}\n\n\t// PVs are sorted by score. Pick one PV at random\n\t// and if the score is not too far off, return it\n\ts := int32(eng.Options.HandicapLevel)\n\td := s*s/2 + s*10 + 5\n\tn := rand.Intn(len(pvs))\n\tfor pvs[n].score+d < pvs[0].score {\n\t\tn--\n\t}\n\treturn pvs[n].score, pvs[n].moves\n}", "func (q qspec) FetchQF(in *proto.BlockHash, replies map[uint32]*proto.Block) (*proto.Block, bool) {\n\tvar h hotstuff.Hash\n\tcopy(h[:], in.GetHash())\n\tfor _, b := range replies {\n\t\tblock := proto.BlockFromProto(b)\n\t\tif h == block.Hash() {\n\t\t\treturn b, true\n\t\t}\n\t}\n\treturn nil, false\n}", "func (impl *Impl) Poke(ctx context.Context, rs *state.RunState) (*Result, error) {\n\tif shouldCheckTree(ctx, rs.Run.Status, rs.Run.Submission) {\n\t\trs = rs.ShallowCopy()\n\t\tswitch open, err := rs.CheckTree(ctx, impl.TreeClient); {\n\t\tcase err != nil:\n\t\t\treturn nil, err\n\t\tcase !open:\n\t\t\tif err := impl.RM.PokeAfter(ctx, rs.Run.ID, treeCheckInterval); err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\tdefault:\n\t\t\treturn impl.OnReadyForSubmission(ctx, rs)\n\t\t}\n\t}\n\n\tif shouldRefreshCLs(ctx, rs) {\n\t\tswitch cls, err := changelist.LoadCLs(ctx, rs.Run.CLs); {\n\t\tcase err != nil:\n\t\t\treturn nil, err\n\t\tdefault:\n\t\t\tif err := impl.CLUpdater.ScheduleBatch(ctx, rs.Run.ID.LUCIProject(), cls); err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t\trs = rs.ShallowCopy()\n\t\t\trs.Run.LatestCLsRefresh = datastore.RoundTime(clock.Now(ctx).UTC())\n\t\t}\n\t}\n\treturn &Result{State: rs}, nil\n}", "func LookupConfig(kvs config.KVS) (cfg Config, err error) {\n\tif err = config.CheckValidKeys(config.APISubSys, kvs, DefaultKVS); err != nil {\n\t\treturn cfg, err\n\t}\n\n\t// Check environment variables parameters\n\trequestsMax, err := strconv.Atoi(env.Get(EnvAPIRequestsMax, kvs.Get(apiRequestsMax)))\n\tif err != nil {\n\t\treturn cfg, err\n\t}\n\n\tif requestsMax < 0 {\n\t\treturn cfg, errors.New(\"invalid API max requests value\")\n\t}\n\n\trequestsDeadline, err := time.ParseDuration(env.Get(EnvAPIRequestsDeadline, kvs.Get(apiRequestsDeadline)))\n\tif err != nil {\n\t\treturn cfg, err\n\t}\n\n\treadyDeadline, err := time.ParseDuration(env.Get(EnvAPIReadyDeadline, kvs.Get(apiReadyDeadline)))\n\tif err != nil {\n\t\treturn cfg, err\n\t}\n\n\tcorsAllowOrigin := strings.Split(env.Get(EnvAPICorsAllowOrigin, kvs.Get(apiCorsAllowOrigin)), \",\")\n\treturn Config{\n\t\tAPIRequestsMax: requestsMax,\n\t\tAPIRequestsDeadline: requestsDeadline,\n\t\tAPIReadyDeadline: readyDeadline,\n\t\tAPICorsAllowOrigin: corsAllowOrigin,\n\t}, nil\n}", "func (g *memoGroup) lookupBestExpr(required physicalPropsID) *bestExpr {\n\tindex, ok := g.bestExprsMap[required]\n\tif !ok {\n\t\treturn nil\n\t}\n\treturn &g.bestExprs[index]\n}", "func findNearestElevator(currentFloor int, selectedList []*Elevator, c *Column) *Elevator {\n\tvar bestElevator *Elevator = selectedList[0]\n\tvar bestDistance float64 = math.Abs(float64(selectedList[0].floor - currentFloor)) //math.Abs() returns the absolute value of a number (always positive).\n\tfor _, elevator := range selectedList {\n\t\tif math.Abs(float64(elevator.floor-currentFloor)) < bestDistance {\n\t\t\tbestElevator = elevator\n\t\t}\n\t}\n\tfmt.Printf(\"elevator%s%d | Floor: %d | Status: %s\\n\", string(c.name), bestElevator.id, bestElevator.floor, bestElevator.status)\n\tfmt.Println()\n\tfmt.Println(\"\\n-----------------------------------------------------\")\n\tfmt.Printf(\" > > >> >>> ELEVATOR %v%d WAS CALLED <<< << < <\\n\", string(c.name), bestElevator.id)\n\tfmt.Println(\"-----------------------------------------------------\\n\")\n\n\treturn bestElevator\n}", "func WithDetection(c Config) heartbeat.HandleOption {\n\treturn func(next heartbeat.Handle) heartbeat.Handle {\n\t\treturn func(hh []heartbeat.Heartbeat) ([]heartbeat.Result, error) {\n\t\t\tfor n, h := range hh {\n\t\t\t\tif h.EntityType != heartbeat.FileType {\n\t\t\t\t\tproject := firstNonEmptyString(c.Override, c.Alternative)\n\t\t\t\t\thh[n].Project = &project\n\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\n\t\t\t\tproject, branch := Detect(h.Entity, c.MapPatterns)\n\n\t\t\t\tif project == \"\" {\n\t\t\t\t\tproject = c.Override\n\t\t\t\t}\n\n\t\t\t\tif project == \"\" || branch == \"\" {\n\t\t\t\t\tproject, branch = DetectWithRevControl(h.Entity, c.SubmodulePatterns, project, branch)\n\t\t\t\t\tif c.ShouldObfuscateProject {\n\t\t\t\t\t\tproject = \"\"\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\thh[n].Branch = &branch\n\t\t\t\thh[n].Project = &project\n\t\t\t}\n\n\t\t\treturn next(hh)\n\t\t}\n\t}\n}", "func (_AggregatorV2V3Interface *AggregatorV2V3InterfaceCaller) LatestAnswer(opts *bind.CallOpts) (*big.Int, error) {\n\tvar out []interface{}\n\terr := _AggregatorV2V3Interface.contract.Call(opts, &out, \"latestAnswer\")\n\n\tif err != nil {\n\t\treturn *new(*big.Int), err\n\t}\n\n\tout0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int)\n\n\treturn out0, err\n\n}", "func (r *Retriever) MostRecentCollectionConfigBelow(blockNum uint64, chaincodeName string) (*ledger.CollectionConfigInfo, error) {\n\tcompositeKV, err := r.dbHandle.mostRecentEntryBelow(blockNum, collectionConfigNamespace, constructCollectionConfigKey(chaincodeName))\n\tif err != nil || compositeKV == nil {\n\t\treturn nil, err\n\t}\n\treturn compositeKVToCollectionConfig(compositeKV)\n}", "func getMostlyPrioriesConfigKey(option map[string]interface{}) interface{} {\n\t// Parse arguments\n\tif value, ok := option[\"arg\"]; ok {\n\t\tif option[\"type\"] == \"int\" {\n\t\t\treturn *(value.(*int))\n\n\t\t} else if option[\"type\"] == \"bool\" {\n\t\t\treturn *(value.(*bool))\n\n\t\t} else if option[\"type\"] == \"string_array\" {\n\t\t\ttmp := []string{}\n\t\t\tfor _, item := range *(value.(*StringArrayFlag)) {\n\t\t\t\ttmp = append(tmp, item)\n\t\t\t}\n\t\t\treturn tmp\n\n\t\t} else if option[\"type\"] == \"rule_array\" {\n\t\t\trules := []RuleConfig{}\n\t\t\tfor _, item := range *(value.(*StringArrayFlag)) {\n\t\t\t\trule := RuleConfig{}\n\t\t\t\terr := json.Unmarshal([]byte(item), &rule)\n\n\t\t\t\tif err != nil {\n\t\t\t\t\tlog.Panic(map[string]string{\n\t\t\t\t\t\t\"log_level\": \"panic\",\n\t\t\t\t\t\t\"error\": \"Rule unmarshal failed\",\n\t\t\t\t\t\t\"for_rule\": item,\n\t\t\t\t\t\t\"details\": err.Error(),\n\t\t\t\t\t})\n\t\t\t\t}\n\n\t\t\t\tif !rule.HasValidType() {\n\t\t\t\t\tlog.Panic(map[string]string{\n\t\t\t\t\t\t\"log_level\": \"panic\",\n\t\t\t\t\t\t\"error\": \"Rule type invalid\",\n\t\t\t\t\t\t\"invalid_type\": rule.Type,\n\t\t\t\t\t})\n\t\t\t\t}\n\t\t\t\trules = append(rules, rule)\n\t\t\t}\n\t\t\treturn rules\n\n\t\t} else if option[\"type\"] == \"string\" {\n\t\t\treturn *(value.(*string))\n\t\t}\n\n\t\t// Parse config file\n\t} else if value, ok := option[\"file\"]; ok {\n\t\tif option[\"type\"] == \"int\" {\n\t\t\treturn value.(int)\n\n\t\t} else if option[\"type\"] == \"bool\" {\n\t\t\treturn value.(bool)\n\n\t\t} else if option[\"type\"] == \"string_array\" {\n\t\t\treturn InterfaceToStringSlice(value)\n\n\t\t} else if option[\"type\"] == \"rule_array\" {\n\t\t\trules := []RuleConfig{}\n\t\t\tfor _, v := range value.([]interface{}) {\n\t\t\t\trule := RuleConfig{}\n\t\t\t\trule.FromMap(v.(map[interface{}]interface{}))\n\t\t\t\trules = append(rules, rule)\n\n\t\t\t\tif !rule.HasValidType() {\n\t\t\t\t\tlog.Panic(map[string]string{\n\t\t\t\t\t\t\"log_level\": \"panic\",\n\t\t\t\t\t\t\"error\": \"Rule type invalid\",\n\t\t\t\t\t\t\"invalid_type\": rule.Type,\n\t\t\t\t\t})\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn rules\n\n\t\t} else if option[\"type\"] == \"string\" {\n\t\t\treturn value.(string)\n\t\t}\n\n\t\t// Parse environment\n\t} else if value, ok := option[\"env\"]; ok {\n\t\tif option[\"type\"] == \"int\" {\n\t\t\ti, _ := strconv.Atoi(value.(string))\n\t\t\treturn i\n\n\t\t} else if option[\"type\"] == \"bool\" {\n\t\t\treturn value.(string) == \"true\"\n\n\t\t} else if option[\"type\"] == \"string_array\" {\n\t\t\treturn strings.Split(value.(string), \",\")\n\n\t\t} else if option[\"type\"] == \"rule_array\" {\n\t\t\trules := []RuleConfig{}\n\t\t\terr := json.Unmarshal([]byte(value.(string)), &rules)\n\n\t\t\tif err != nil {\n\t\t\t\tlog.Panic(map[string]string{\n\t\t\t\t\t\"log_level\": \"panic\",\n\t\t\t\t\t\"error\": \"Rules unmarshal failed\",\n\t\t\t\t\t\"for_rule\": value.(string),\n\t\t\t\t\t\"details\": err.Error(),\n\t\t\t\t})\n\t\t\t}\n\n\t\t\tfor _, rule := range rules {\n\t\t\t\tif !rule.HasValidType() {\n\t\t\t\t\tlog.Panic(map[string]string{\n\t\t\t\t\t\t\"log_level\": \"panic\",\n\t\t\t\t\t\t\"error\": \"Rule type invalid\",\n\t\t\t\t\t\t\"invalid_type\": rule.Type,\n\t\t\t\t\t})\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn rules\n\n\t\t} else if option[\"type\"] == \"string\" {\n\t\t\treturn value.(string)\n\t\t}\n\t}\n\n\t// Send back default\n\tif option[\"type\"] == \"string_array\" {\n\t\ttmp := []string{}\n\t\tfor _, item := range *(option[\"default\"].(*StringArrayFlag)) {\n\t\t\ttmp = append(tmp, item)\n\t\t}\n\t\treturn tmp\n\t}\n\n\tif option[\"type\"] == \"rule_array\" {\n\t\treturn []RuleConfig{}\n\t}\n\n\treturn option[\"default\"]\n}" ]
[ "0.43156856", "0.42946184", "0.4268113", "0.4264278", "0.41369024", "0.41065213", "0.41024894", "0.40928957", "0.40846074", "0.40578192", "0.40408635", "0.4038469", "0.40289915", "0.39849836", "0.39510697", "0.38877916", "0.38724548", "0.38631967", "0.3840825", "0.38356435", "0.38337126", "0.38330576", "0.38166672", "0.37982506", "0.37819633", "0.3778422", "0.37766385", "0.37659642", "0.37622496", "0.37459764", "0.37446237", "0.37423927", "0.37232992", "0.37232766", "0.37198836", "0.3718187", "0.370842", "0.37072894", "0.37047333", "0.37042516", "0.36947095", "0.36934757", "0.36905155", "0.36741316", "0.3667986", "0.3666044", "0.36644697", "0.36547178", "0.3653038", "0.36522436", "0.36508495", "0.3646628", "0.3645618", "0.36417302", "0.36334717", "0.36292115", "0.36279657", "0.36274713", "0.3627174", "0.36237267", "0.36191005", "0.36130756", "0.36114797", "0.36084095", "0.36027467", "0.35996607", "0.35957587", "0.35907412", "0.35903332", "0.35856327", "0.3584647", "0.35832804", "0.35789898", "0.3577638", "0.35768932", "0.35723993", "0.35656685", "0.35621402", "0.35564315", "0.35521185", "0.35502315", "0.35442197", "0.35423777", "0.35421467", "0.3541557", "0.3540114", "0.35348484", "0.3530838", "0.35278875", "0.3527035", "0.35225248", "0.3520336", "0.35200348", "0.3519657", "0.35187447", "0.35175115", "0.3517029", "0.3516399", "0.3514309", "0.35136572" ]
0.7021728
0
DoTopological will process the graph in topological order and call onDiscover with each step.
func (graph *Graph) DoTopological(onDiscover VertexWalkFunc) error { walker := &topologicalWalker{ vertices: list.New(), } graph.DepthFirstWalk(walker) // Process elements in reverse order of finishing time for elem := walker.vertices.Front(); elem != nil; elem = elem.Next() { if err := onDiscover(elem.Value); err != nil { return err } } return nil }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (client *IstioDiscoveryClient) doDiscover() ([]*proto.FlowDTO, error) {\n\tvar flows []*proto.FlowDTO\n\tmetrics := client.metricHandler.GetMetrics()\n\tfor _, m := range metrics {\n\t\t// We simulate the destination port\n\t\tflow, err := builder.NewFlowDTOBuilder().\n\t\t\tSource(m.src).\n\t\t\tDestination(m.dst, DEFAULT_DESTINATION_PORT).\n\t\t\tProtocol(builder.TCP).\n\t\t\tReceived(m.rx).\n\t\t\tTransmitted(m.tx).\n\t\t\tFlowAmount((m.amount / float64(m.duration)) / KBPS).Create()\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tflows = append(flows, flow)\n\t}\n\treturn flows, nil\n}", "func Topological(any *Node, fn func(*Node)) {\n\tvisited := map[*Node]bool{}\n\tgetVisitGraph(any, visited)\n\tfor node, v := range visited {\n\t\tif !v {\n\t\t\tdfs(node, visited, fn)\n\t\t}\n\t}\n}", "func (gph *Graph) TopologicalSort() {\n\tfmt.Print(\"Topological order of given graph is : \")\n\tvar count = gph.count\n\tstk := stack.New()\n\tvisited := make([]bool, count)\n\n\tfor i := 0; i < count; i++ {\n\t\tif visited[i] == false {\n\t\t\tvisited[i] = true\n\t\t\tgph.TopologicalSortDFS(i, visited, stk)\n\t\t}\n\t}\n\tfor stk.Len() != 0 {\n\t\tfmt.Print(stk.Pop().(int), \" \")\n\t}\n\tfmt.Println()\n}", "func (gph *Graph) TopologicalSort() {\n\tfmt.Print(\"Topological order of the given graph is: \")\n\tcount := gph.count\n\tstk := new(Stack)\n\tvisited := make([]bool, count)\n\n\tfor i := 0; i < count; i++ {\n\t\tif !visited[i] {\n\t\t\tvisited[i] = true\n\t\t\tgph.TopologicalSortDFS(i, visited, stk)\n\t\t}\n\t}\n\tfor stk.Len() != 0 {\n\t\tfmt.Print(stk.Pop().(int), \" \")\n\t}\n\tfmt.Println()\n}", "func (g *directedGraph) topologicalSort() ([]string, error) {\n\tsorted := make([]string, 0, len(g.nodes))\n\trootNodes := make([]string, 0, len(g.nodes))\n\n\tfor _, n := range g.nodes {\n\t\tif g.incomingNodes[n] == 0 {\n\t\t\trootNodes = append(rootNodes, n)\n\t\t}\n\t}\n\n\tfor len(rootNodes) > 0 {\n\t\tvar current string\n\t\tcurrent, rootNodes = rootNodes[0], rootNodes[1:]\n\t\tsorted = append(sorted, current)\n\n\t\toutgoingNodes := make([]string, len(g.outgoingNodes[current]))\n\t\tfor outgoingNode, i := range g.outgoingNodes[current] {\n\t\t\toutgoingNodes[i-1] = outgoingNode\n\t\t}\n\n\t\tfor _, outgoingNode := range outgoingNodes {\n\t\t\tg.unsafeRemoveEdge(current, outgoingNode)\n\n\t\t\tif g.incomingNodes[outgoingNode] == 0 {\n\t\t\t\trootNodes = append(rootNodes, outgoingNode)\n\t\t\t}\n\t\t}\n\t}\n\n\toutgoingCount := 0\n\tfor _, v := range g.incomingNodes {\n\t\toutgoingCount += v\n\t}\n\n\tif outgoingCount > 0 {\n\t\treturn nil, errors.New(\"cycle detected in graph\")\n\t}\n\n\treturn sorted, nil\n}", "func (t *Task) Traverse(cb func(*Task)) {\n\tfor _, c := range t.SubTasks() {\n\t\tcb(c)\n\t\tc.Traverse(cb)\n\t}\n}", "func topoSort(graph objectGraph) []types.Object {\n\tvar order []types.Object\n\tvisited := map[types.Object]bool{}\n\tvar visit func(o types.Object)\n\tvisit = func(o types.Object) {\n\t\tif visited[o] {\n\t\t\treturn\n\t\t}\n\t\tvisited[o] = true\n\t\tfor _, n := range graph[o] {\n\t\t\tvisit(n)\n\t\t}\n\t\torder = append(order, o)\n\t}\n\tfor o := range graph {\n\t\tvisit(o)\n\t}\n\treturn order\n}", "func (g StepGraph) TopologicalSort() (OrderedStepList, []error) {\n\tvar ret OrderedStepList\n\tvar satisfied []StepLink\n\tif err := iterateDAG(g, nil, sets.New[string](), func(*StepNode) {}); err != nil {\n\t\treturn nil, err\n\t}\n\tseen := make(map[Step]struct{})\n\tfor len(g) > 0 {\n\t\tvar changed bool\n\t\tvar waiting []*StepNode\n\t\tfor _, node := range g {\n\t\t\tfor _, child := range node.Children {\n\t\t\t\tif _, ok := seen[child.Step]; !ok {\n\t\t\t\t\twaiting = append(waiting, child)\n\t\t\t\t}\n\t\t\t}\n\t\t\tif _, ok := seen[node.Step]; ok {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif !HasAllLinks(node.Step.Requires(), satisfied) {\n\t\t\t\twaiting = append(waiting, node)\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tsatisfied = append(satisfied, node.Step.Creates()...)\n\t\t\tret = append(ret, node)\n\t\t\tseen[node.Step] = struct{}{}\n\t\t\tchanged = true\n\t\t}\n\t\tif !changed && len(waiting) > 0 {\n\t\t\terrMessages := sets.Set[string]{}\n\t\t\tfor _, node := range waiting {\n\t\t\t\tmissing := sets.Set[string]{}\n\t\t\t\tfor _, link := range node.Step.Requires() {\n\t\t\t\t\tif !HasAllLinks([]StepLink{link}, satisfied) {\n\t\t\t\t\t\tif msg := link.UnsatisfiableError(); msg != \"\" {\n\t\t\t\t\t\t\tmissing.Insert(msg)\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tmissing.Insert(fmt.Sprintf(\"<%#v>\", link))\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t// De-Duplicate errors\n\t\t\t\terrMessages.Insert(fmt.Sprintf(\"step %s is missing dependencies: %s\", node.Step.Name(), strings.Join(sets.List(missing), \", \")))\n\t\t\t}\n\t\t\tret := make([]error, 0, errMessages.Len()+1)\n\t\t\tret = append(ret, errors.New(\"steps are missing dependencies\"))\n\t\t\tfor _, message := range sets.List(errMessages) {\n\t\t\t\tret = append(ret, errors.New(message))\n\t\t\t}\n\t\t\treturn nil, ret\n\t\t}\n\t\tg = waiting\n\t}\n\treturn ret, nil\n}", "func (f *Graph) TopoWalk(visit func(*Node)) {\n\tvisited := make(map[*Node]struct{})\n\n\tvar topovisit func(n *Node)\n\ttopovisit = func(n *Node) {\n\t\tif _, ok := visited[n]; ok {\n\t\t\treturn\n\t\t}\n\n\t\tvisited[n] = struct{}{}\n\t\tfor _, c := range n.Imports {\n\t\t\ttopovisit(c.Node)\n\t\t}\n\n\t\tvisit(n)\n\t}\n\n\tfor _, n := range f.Entries {\n\t\ttopovisit(n)\n\t}\n}", "func iterateDAG(graph StepGraph, path []string, inPath sets.Set[string], f func(*StepNode)) (ret []error) {\n\tfor _, node := range graph {\n\t\tname := node.Step.Name()\n\t\tif inPath.Has(name) {\n\t\t\tret = append(ret, fmt.Errorf(\"cycle in graph: %s -> %s\", strings.Join(path, \" -> \"), name))\n\t\t\tcontinue\n\t\t}\n\t\tinPath.Insert(name)\n\t\tret = append(ret, iterateDAG(node.Children, append(path, name), inPath, f)...)\n\t\tinPath.Delete(name)\n\t\tf(node)\n\t}\n\treturn ret\n}", "func (recursor StepRecursor) VisitDo(step *DoStep) error {\n\tfor _, sub := range step.Steps {\n\t\terr := sub.Config.Visit(recursor)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn nil\n}", "func (n *Node) DFS(fn func(shard *dynamodbstreams.Shard) bool) {\n\tif n == nil {\n\t\treturn\n\t}\n\n\tif n.Shard != nil {\n\t\tif ok := fn(n.Shard); !ok {\n\t\t\treturn\n\t\t}\n\t}\n\n\tfor _, child := range n.Children {\n\t\tchild.DFS(fn)\n\t}\n}", "func runGenerals(m int, generals []bool, commOrder bool) []bool {\n\tvar wg sync.WaitGroup\n\tn := len(generals)\n\twg.Add(n)\n\n\t// Create channels used to communicate between lieutenants.\n\tchannels := []chan bool{}\n\tfor range generals {\n\t\tchannels = append(channels, make(chan bool, n))\n\t}\n\n\t//Create channels used to communicate between commander and lieutenants.\n\tcommChannels := []chan bool{}\n\tfor range generals {\n\t\tcommChannels = append(commChannels, make(chan bool, n))\n\t}\n\n\t// This stores the final command at each node by the end of the algorithm.\n\tcommands := make([]bool, n)\n\n\tfor i, loyal := range generals {\n\t\tif i == 0 {\n\t\t\t// Get the commander to send out initial commands.\n\t\t\tgo commander(n, m, i, loyal, commOrder, commChannels, &wg)\n\t\t} else {\n\t\t\t// Create a goroutine for each lieutenant.\n\t\t\tgo lieutenant(n, m, i, loyal, commChannels, channels, commands, &wg)\n\t\t}\n\t}\n\twg.Wait()\n\treturn commands\n}", "func main() {\n graph := createGraph()\n graph.addEdge(1, 2)\n graph.addEdge(2, 3)\n graph.addEdge(2, 4)\n graph.addEdge(3, 4)\n graph.addEdge(1, 5)\n graph.addEdge(5, 6)\n graph.addEdge(5, 7)\n\n visited := make(set)\n\n dfs(graph, 1, visited, func(node int) {\n fmt.Print(node, \" \")\n })\n}", "func (graphS Graph) traverse(f *os.File, vertex *dag.Vertex, done *[]*dag.Vertex, fname string) error {\n graph := graphS.g\n\n var err error\n // Check if we are in done[]; if we are, we don't need to do anything\n if sliceContains(*done, vertex) {\n return nil\n }\n\n // We set this here to avoid loops\n *done = append(*done, vertex)\n\n // Loop over children\n children, err := graph.Successors(vertex)\n if err != nil {\n return fmt.Errorf(\"Unable to get children of %s with %w\", vertex.ID, err)\n }\n\n for _, child := range children {\n // Add the line to the DOT\n _, err = f.WriteString(fmt.Sprintf(\"\\\"%s\\\" -> \\\"%s\\\"\\n\", vertex.ID, child.ID))\n if err != nil {\n return fmt.Errorf(\"Unable to write to %s with %w\", fname, err)\n }\n // Recurse to children\n err = graphS.traverse(f, child, done, fname)\n if err != nil {\n return err\n }\n }\n\n return nil\n}", "func dfs(node string, visited map[string]int, symphony *Symphony, path []string) (bool, []string) {\n\tif visited[node] == 1 {\n\t\treturn true, path // cyclic dependent\n\t}\n\tif visited[node] == 2 {\n\t\treturn false, path\n\t}\n\t// 1 = temporarily visited\n\tvisited[node] = 1\n\tpath = append(path, node)\n\tdeps := symphony.tasks[node].Deps\n\tfor _, dep := range deps {\n\t\tif cyclic, path := dfs(dep, visited, symphony, path); cyclic {\n\t\t\treturn true, path\n\t\t}\n\t}\n\t// 2 = permanently visited\n\tvisited[node] = 2\n\n\treturn false, path\n}", "func (s *defaultSearcher) dfs(args searchArgs) {\n\toutEdges := args.nodeToOutEdges[args.root]\n\tif args.statusMap[args.root] == onstack {\n\t\tlog.Warn(\"The input call graph contains a cycle. This can't be represented in a \" +\n\t\t\t\"flame graph, so this path will be ignored. For your record, the ignored path \" +\n\t\t\t\"is:\\n\" + strings.TrimSpace(s.pathStringer.pathAsString(args.path, args.nameToNodes)))\n\t\treturn\n\t}\n\tif len(outEdges) == 0 {\n\t\targs.buffer.WriteString(s.pathStringer.pathAsString(args.path, args.nameToNodes))\n\t\targs.statusMap[args.root] = discovered\n\t\treturn\n\t}\n\targs.statusMap[args.root] = onstack\n\tfor _, edge := range outEdges {\n\t\ts.dfs(searchArgs{\n\t\t\troot: edge.Dst,\n\t\t\tpath: append(args.path, *edge),\n\t\t\tnodeToOutEdges: args.nodeToOutEdges,\n\t\t\tnameToNodes: args.nameToNodes,\n\t\t\tbuffer: args.buffer,\n\t\t\tstatusMap: args.statusMap,\n\t\t})\n\t}\n\targs.statusMap[args.root] = discovered\n}", "func TestNoTopo(t *testing.T) {\n\tkdlog.InitLogs()\n\n\tkubePod := &kubev1.Pod{\n\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\tName: \"Pod0\",\n\t\t\tAnnotations: map[string]string{\n\t\t\t\t\"ABCD\": \"EFGH\",\n\t\t\t},\n\t\t},\n\t\tSpec: kubev1.PodSpec{\n\t\t\tContainers: []kubev1.Container{\n\t\t\t\t{\n\t\t\t\t\tName: \"Cont0\",\n\t\t\t\t\tResources: kubev1.ResourceRequirements{\n\t\t\t\t\t\tRequests: kubev1.ResourceList{\n\t\t\t\t\t\t\tkubev1.ResourceName(gpuplugintypes.ResourceGPU): *resource.NewQuantity(4, resource.DecimalSI),\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t}\n\tnodeInfo0 := &kubev1.Node{\n\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\tName: \"Node0\",\n\t\t},\n\t\tStatus: kubev1.NodeStatus{\n\t\t\tCapacity: kubev1.ResourceList{\n\t\t\t\tkubev1.ResourceName(gpuplugintypes.ResourceGPU): *resource.NewQuantity(4, resource.DecimalSI),\n\t\t\t},\n\t\t\tAllocatable: kubev1.ResourceList{\n\t\t\t\tkubev1.ResourceName(gpuplugintypes.ResourceGPU): *resource.NewQuantity(4, resource.DecimalSI),\n\t\t\t},\n\t\t},\n\t}\n\tnodeInfo1 := &kubev1.Node{\n\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\tName: \"Node1\",\n\t\t},\n\t\tStatus: kubev1.NodeStatus{\n\t\t\tCapacity: kubev1.ResourceList{\n\t\t\t\tkubev1.ResourceName(gpuplugintypes.ResourceGPU): *resource.NewQuantity(8, resource.DecimalSI),\n\t\t\t},\n\t\t\tAllocatable: kubev1.ResourceList{\n\t\t\t\tkubev1.ResourceName(gpuplugintypes.ResourceGPU): *resource.NewQuantity(8, resource.DecimalSI),\n\t\t\t},\n\t\t},\n\t}\n\tnodeInfo2 := &kubev1.Node{\n\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\tName: \"Node2\",\n\t\t},\n\t\tStatus: kubev1.NodeStatus{\n\t\t\tCapacity: kubev1.ResourceList{\n\t\t\t\tkubev1.ResourceName(gpuplugintypes.ResourceGPU): *resource.NewQuantity(0, resource.DecimalSI),\n\t\t\t},\n\t\t\tAllocatable: kubev1.ResourceList{\n\t\t\t\tkubev1.ResourceName(gpuplugintypes.ResourceGPU): *resource.NewQuantity(0, resource.DecimalSI),\n\t\t\t},\n\t\t},\n\t}\n\tnodeInfo3 := &kubev1.Node{\n\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\tName: \"Node3\",\n\t\t},\n\t\tStatus: kubev1.NodeStatus{},\n\t}\n\tnodeInfo4 := &kubev1.Node{\n\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\tName: \"Node4\",\n\t\t},\n\t\tStatus: kubev1.NodeStatus{\n\t\t\tCapacity: kubev1.ResourceList{\n\t\t\t\tkubev1.ResourceName(gpuplugintypes.ResourceGPU): *resource.NewQuantity(8, resource.DecimalSI),\n\t\t\t},\n\t\t\tAllocatable: kubev1.ResourceList{\n\t\t\t\tkubev1.ResourceName(gpuplugintypes.ResourceGPU): *resource.NewQuantity(8, resource.DecimalSI),\n\t\t\t},\n\t\t},\n\t}\n\n\tds := DeviceScheduler\n\tds.RemoveAll()\n\tdev := &gpuschedulerplugin.NvidiaGPUScheduler{}\n\tds.AddDevice(dev)\n\n\tn0, _ := kubeinterface.KubeNodeToNodeInfo(nodeInfo0, nil)\n\tn1, _ := kubeinterface.KubeNodeToNodeInfo(nodeInfo1, nil)\n\tn2, _ := kubeinterface.KubeNodeToNodeInfo(nodeInfo2, nil)\n\tn3, _ := kubeinterface.KubeNodeToNodeInfo(nodeInfo3, nil)\n\tn4, _ := kubeinterface.KubeNodeToNodeInfo(nodeInfo4, nil)\n\tds.AddNode(nodeInfo0.ObjectMeta.Name, n0)\n\tds.AddNode(nodeInfo1.ObjectMeta.Name, n1)\n\tds.AddNode(nodeInfo2.ObjectMeta.Name, n2)\n\tds.AddNode(nodeInfo3.ObjectMeta.Name, n3)\n\tfmt.Printf(\"NodeLocationMap:\\n%+v\\n\", gpuschedulerplugin.NodeLocationMap)\n\tfmt.Printf(\"NodeCacheMap:\\n%+v\\n\", gpuschedulerplugin.NodeCacheMap)\n\tds.AddNode(nodeInfo4.ObjectMeta.Name, n4)\n\tfmt.Printf(\"NodeLocationMap:\\n%+v\\n\", gpuschedulerplugin.NodeLocationMap)\n\tfmt.Printf(\"NodeCacheMap:\\n%+v\\n\", gpuschedulerplugin.NodeCacheMap)\n\tfmt.Printf(\"Node: %+v\\n\", n0)\n\tfmt.Printf(\"Node: %+v\\n\", n1)\n\tmodReq := gpuschedulerplugin.TranslateGPUResources(n0.KubeAlloc[gpuplugintypes.ResourceGPU], types.ResourceList{\n\t\ttypes.DeviceGroupPrefix + \"/gpugrp1/A/gpugrp0/B/gpu/GPU0/cards\": int64(1),\n\t}, n0.Allocatable)\n\tif !reflect.DeepEqual(modReq, n0.Allocatable) {\n\t\tt.Errorf(\"Alloc not same, expect: %v, have: %v\", n0.Allocatable, modReq)\n\t}\n\tn0.Allocatable = modReq\n\t//fmt.Printf(\"Node: %+v\\n\", n0)\n\n\tp0, _ := kubeinterface.KubePodInfoToPodInfo(kubePod, false)\n\tfmt.Printf(\"Pod: %+v\\n\", p0)\n\n\tfits, failures, score := ds.PodFitsResources(p0, n0, false)\n\tfmt.Printf(\"Fit: %v Failures: %v Score: %v\\n\", fits, failures, score)\n\n\tfits, failures, score = ds.PodFitsResources(p0, n1, false)\n\tfmt.Printf(\"Fit: %v Failures: %v Score: %v\\n\", fits, failures, score)\n\n\tfits, failures, score = ds.PodFitsResources(p0, n2, false)\n\tfmt.Printf(\"Fit: %v Failures: %v Score: %v\\n\", fits, failures, score)\n\n\tfits, failures, score = ds.PodFitsResources(p0, n3, false)\n\tfmt.Printf(\"Fit: %v Failures: %v Score: %v\\n\", fits, failures, score)\n\n\tfmt.Printf(\"Scores: %+v\\n\", ds.score)\n\n\tpri0 := ds.PodPriority(p0, n0)\n\tfmt.Printf(\"PodPriority0: %v\\n\", pri0)\n\n\tpri1 := ds.PodPriority(p0, n1)\n\tfmt.Printf(\"PodPriority1: %v\\n\", pri1)\n\n\tds.RemoveNode(\"Node1\")\n\tfmt.Printf(\"NodeLocationMap:\\n%+v\\n\", gpuschedulerplugin.NodeLocationMap)\n\tfmt.Printf(\"NodeCacheMap:\\n%+v\\n\", gpuschedulerplugin.NodeCacheMap)\n\tds.RemoveNode(\"Node4\")\n\tfmt.Printf(\"NodeLocationMap:\\n%+v\\n\", gpuschedulerplugin.NodeLocationMap)\n\tfmt.Printf(\"NodeCacheMap:\\n%+v\\n\", gpuschedulerplugin.NodeCacheMap)\n\n\tkdlog.FlushLogs()\n}", "func importOrder(deps map[string][]string) ([]string, error) {\n\t// add all nodes and edges\n\tvar remainingNodes = map[string]struct{}{}\n\tvar graph = map[edge]struct{}{}\n\tfor to, froms := range deps {\n\t\tremainingNodes[to] = struct{}{}\n\t\tfor _, from := range froms {\n\t\t\tremainingNodes[from] = struct{}{}\n\t\t\tgraph[edge{from: from, to: to}] = struct{}{}\n\t\t}\n\t}\n\n\t// find initial nodes without any dependencies\n\tsorted := findAndRemoveNodesWithoutDependencies(remainingNodes, graph)\n\tfor i := 0; i < len(sorted); i++ {\n\t\tnode := sorted[i]\n\t\tremoveEdgesFrom(node, graph)\n\t\tsorted = append(sorted, findAndRemoveNodesWithoutDependencies(remainingNodes, graph)...)\n\t}\n\tif len(remainingNodes) > 0 {\n\t\treturn nil, fmt.Errorf(\"cycle: remaining nodes: %#v, remaining edges: %#v\", remainingNodes, graph)\n\t}\n\t//for _, n := range sorted {\n\t//\tfmt.Println(\"topological order\", n)\n\t//}\n\treturn sorted, nil\n}", "func Order(configs map[string]Config) ([]Config, error) {\n\tsize := len(configs)\n\n\tnodes := make([]string, 0)\n\t// we don't know number or dependencies, so initial size is 0\n\tedges := make([]edge, 0)\n\tfor _, config := range configs {\n\t\tnodes = append(nodes, config.FullName())\n\t\tdeps := config.findAllDependencies(configs)\n\t\tfor _, dep := range deps {\n\t\t\tedges = append(edges, edge{\n\t\t\t\tfrom: dep.FullName(),\n\t\t\t\tto: config.FullName(),\n\t\t\t})\n\t\t}\n\t}\n\n\tgraph, err := newDirectedGraph(nodes, edges)\n\tif err != nil {\n\t\tlog.Printf(\"error creating dependecy grahp: %v\", err)\n\t\treturn nil, err\n\t}\n\n\tsorted, err := graph.topologicalSort()\n\tif err != nil {\n\t\tlog.Printf(\"error ordering configs: %v\", err)\n\t\treturn nil, err\n\t}\n\tres := make([]Config, size)\n\tfor i, name := range sorted {\n\t\tres[i] = configs[name]\n\t}\n\treturn res, nil\n}", "func (p *Protocol) Discover(opts ...IteratorOption) []noise.ID {\n\treturn p.Find(p.node.ID().ID, opts...)\n}", "func (g *VisibleRunnerGroups) Traverse(f func(RunnerGroup) (bool, error)) error {\n\tfor _, rg := range g.sortedGroups {\n\t\tok, err := f(rg)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tif ok {\n\t\t\treturn nil\n\t\t}\n\t}\n\n\treturn nil\n}", "func (e *Eval) Do(ctx context.Context) error {\n\tdefer func() {\n\t\tif e.DotWriter != nil && e.flowgraph != nil {\n\t\t\tb, err := dot.Marshal(e.flowgraph, fmt.Sprintf(\"reflow flowgraph %v\", e.EvalConfig.RunID.ID()), \"\", \"\")\n\t\t\tif err != nil {\n\t\t\t\te.Log.Debugf(\"err dot marshal: %v\", err)\n\t\t\t\treturn\n\t\t\t}\n\t\t\t_, err = e.DotWriter.Write(b)\n\t\t\tif err != nil {\n\t\t\t\te.Log.Debugf(\"err writing dot file: %v\", err)\n\t\t\t}\n\t\t}\n\t}()\n\te.Log.Printf(\"evaluating with configuration: %s\", e.EvalConfig)\n\te.begin = time.Now()\n\tdefer func() {\n\t\te.totalTime = time.Since(e.begin)\n\t}()\n\tctx, cancel := context.WithCancel(ctx)\n\tdefer cancel()\n\te.ticker = time.NewTicker(10 * time.Second)\n\tdefer e.ticker.Stop()\n\n\troot := e.root\n\te.roots.Push(root)\n\te.printDeps(root, false)\n\n\tvar (\n\t\ttodo FlowVisitor\n\t\ttasks []*sched.Task // The set of tasks to be submitted after this iteration.\n\t\tflows []*Flow // The set of flows corresponding to the tasks to be submitted after this iteration.\n\t)\n\tfor root.State != Done {\n\t\tif root.Digest().IsZero() {\n\t\t\tpanic(\"invalid flow, zero digest: \" + root.DebugString())\n\t\t}\n\n\t\t// This is the meat of the evaluation: we gather Flows that are\n\t\t// ready (until steady state), and then execute this batch. At the\n\t\t// end of each iteration, we wait for one task to complete, and\n\t\t// gather any new Flows that have become ready.\n\n\t\tnroots := len(e.roots.q)\n\t\ttodo.Reset()\n\t\tvisited := make(flowOnce)\n\t\tfor e.roots.Walk() {\n\t\t\te.todo(e.roots.Flow, visited, &todo)\n\t\t}\n\t\te.roots.Reset()\n\t\te.Trace.Debugf(\"todo %d from %d roots\", len(todo.q), nroots)\n\n\t\t// LookupFlows consists of all the flows that need to be looked in the cache in this round of flow scheduling.\n\t\tvar lookupFlows []*Flow\n\tdequeue:\n\t\tfor todo.Walk() {\n\t\t\tf := todo.Flow\n\t\t\te.printDeps(f, true)\n\t\t\tif e.pending.Pending(f) {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif f.Op == Exec {\n\t\t\t\tif f.Resources[\"mem\"] < minExecMemory {\n\t\t\t\t\tf.Resources[\"mem\"] = minExecMemory\n\t\t\t\t}\n\t\t\t\tif f.Resources[\"cpu\"] < minExecCPU {\n\t\t\t\t\tf.Resources[\"cpu\"] = minExecCPU\n\t\t\t\t}\n\t\t\t}\n\t\t\tif e.ImageMap != nil && f.OriginalImage == \"\" {\n\t\t\t\tf.OriginalImage = f.Image\n\t\t\t\tif img, ok := e.ImageMap[f.Image]; ok {\n\t\t\t\t\tf.Image = img\n\t\t\t\t}\n\t\t\t}\n\t\t\tif e.Snapshotter != nil && f.Op == Intern && f.State == Ready && !f.MustIntern {\n\t\t\t\t// In this case we don't display status, since we're not doing\n\t\t\t\t// any appreciable work here, and it's confusing to the user.\n\t\t\t\te.Mutate(f, Running, NoStatus)\n\t\t\t\te.pending.Add(f)\n\t\t\t\te.step(f, func(f *Flow) error {\n\t\t\t\t\tfs, err := e.Snapshotter.Snapshot(ctx, f.URL.String())\n\t\t\t\t\tif err != nil {\n\t\t\t\t\t\te.Log.Printf(\"must intern %q: resolve: %v\", f.URL, err)\n\t\t\t\t\t\te.Mutate(f, Ready, MustIntern)\n\t\t\t\t\t} else {\n\t\t\t\t\t\te.Mutate(f, fs, Done)\n\t\t\t\t\t}\n\t\t\t\t\treturn nil\n\t\t\t\t})\n\t\t\t\tcontinue dequeue\n\t\t\t} else if f.Op.External() && f.State == Ready {\n\t\t\t\t// If we're using a scheduler, then we can skip transfer, and\n\t\t\t\t// submit directly to the scheduler.\n\t\t\t\te.Mutate(f, NeedSubmit)\n\t\t\t}\n\n\t\t\tswitch f.State {\n\t\t\tcase NeedLookup:\n\t\t\t\t// TODO(marius): we should perform batch lookups\n\t\t\t\t// as the underyling APIs (e.g., to DynamoDB) do not\n\t\t\t\t// bundle requests automatically.\n\t\t\t\te.Mutate(f, Lookup)\n\t\t\t\te.pending.Add(f)\n\t\t\t\tlookupFlows = append(lookupFlows, f)\n\t\t\tcase Ready:\n\t\t\t\tstate := Running\n\t\t\t\tif f.Op.External() {\n\t\t\t\t\tstate = Execing\n\t\t\t\t}\n\t\t\t\te.Mutate(f, state, SetReserved(f.Resources))\n\t\t\t\te.pending.Add(f)\n\t\t\t\te.step(f, func(f *Flow) error { return e.eval(ctx, f) })\n\t\t\tcase NeedSubmit:\n\t\t\t\tvar err *errors.Error\n\t\t\t\t// Propagate errors immediately. We have to do this manually\n\t\t\t\t// here since we're not going through the evaluator.\n\t\t\t\tfor _, dep := range f.Deps {\n\t\t\t\t\tif err = dep.Err; err != nil {\n\t\t\t\t\t\tbreak\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\te.pending.Add(f)\n\t\t\t\tif err != nil {\n\t\t\t\t\tgo func(err *errors.Error) {\n\t\t\t\t\t\te.Mutate(f, err, Done)\n\t\t\t\t\t\te.returnch <- f\n\t\t\t\t\t}(err)\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t\te.Mutate(f, Execing, SetReserved(f.Resources))\n\t\t\t\ttask := e.newTask(f)\n\t\t\t\ttasks = append(tasks, task)\n\t\t\t\tflows = append(flows, f)\n\t\t\t\te.step(f, func(f *Flow) error {\n\t\t\t\t\tif err := e.taskWait(ctx, f, task); err != nil {\n\t\t\t\t\t\treturn err\n\t\t\t\t\t}\n\t\t\t\t\tfor retries := 0; retries < maxTaskRetries && task.Result.Err != nil; retries++ {\n\t\t\t\t\t\tvar (\n\t\t\t\t\t\t\tretry bool\n\t\t\t\t\t\t\tresources reflow.Resources\n\t\t\t\t\t\t\tretryType, msg string\n\t\t\t\t\t\t)\n\t\t\t\t\t\tswitch {\n\t\t\t\t\t\t// task.Result.Err should be non-nil here (due to for loop cond)\n\t\t\t\t\t\tcase !errors.Is(errors.OOM, task.Result.Err) && f.Reserved[\"mem\"] < f.Resources[\"mem\"]:\n\t\t\t\t\t\t\t// The Predictor can lower a task's memory requirements and cause a non-OOM memory error. This is\n\t\t\t\t\t\t\t// because the linux OOM killer does not catch all OOM errors. In order to prevent such an error from\n\t\t\t\t\t\t\t// causing a reflow program to fail, assume that if the Predictor lowers the memory of a task and\n\t\t\t\t\t\t\t// that task returns a non-OOM error, the task should be retried with its original resources.\n\t\t\t\t\t\t\tretry, retryType, resources = true, \"Predictor\", f.Resources\n\t\t\t\t\t\t\tmsg = fmt.Sprintf(\"non-OOM error, switch from predicted (%s) to default (%s) memory\", data.Size(f.Reserved[\"mem\"]), data.Size(f.Resources[\"mem\"]))\n\t\t\t\t\t\tcase errors.Is(errors.OOM, task.Result.Err):\n\t\t\t\t\t\t\t// Retry OOMs with adjusted resources.\n\t\t\t\t\t\t\tretry, retryType, resources = true, \"OOM\", oomAdjust(f.Resources, task.Config.Resources)\n\t\t\t\t\t\t\tmsg = fmt.Sprintf(\"%v of memory\", data.Size(resources[\"mem\"]))\n\t\t\t\t\t\tcase errors.Is(errors.Temporary, task.Result.Err):\n\t\t\t\t\t\t\t// Retry Temporary.\n\t\t\t\t\t\t\tretry, retryType, resources = true, \"Temporary\", f.Reserved\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif retry {\n\t\t\t\t\t\t\tmsg += fmt.Sprintf(\"(%v/%v) due to error: %s\", retries+1, maxTaskRetries, task.Result.Err)\n\t\t\t\t\t\t\tvar err error\n\t\t\t\t\t\t\tif task, err = e.retryTask(ctx, f, resources, retryType, msg); err != nil {\n\t\t\t\t\t\t\t\treturn err\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tbreak\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\t// Write to the cache only if a task was successfully completed.\n\t\t\t\t\tif e.CacheMode.Writing() && task.Err == nil && task.Result.Err == nil {\n\t\t\t\t\t\te.cacheWriteAsync(ctx, f)\n\t\t\t\t\t}\n\t\t\t\t\treturn nil\n\t\t\t\t})\n\t\t\t}\n\t\t}\n\t\tif len(lookupFlows) > 0 {\n\t\t\tgo e.batchLookup(ctx, lookupFlows...)\n\t\t}\n\t\te.Log.Debugf(\"pending: tasks %d (yet to submit), lookup %d, running %d\", len(tasks), e.pending.NState(Lookup), e.pending.NState(Running))\n\t\t// Delay task submission until we have gathered all potential tasks\n\t\t// that can be scheduled concurrently. This is represented by the\n\t\t// set of tasks that are currently either performing cache lookups\n\t\t// (Lookup) or else are undergoing local evaluation (Running). This\n\t\t// helps the scheduler better allocate underlying resources since\n\t\t// we always submit the largest available working set.\n\t\tif e.Scheduler != nil && len(tasks) > 0 && e.pending.NState(Lookup)+e.pending.NState(Running) == 0 {\n\t\t\te.reviseResources(ctx, tasks, flows)\n\t\t\te.Scheduler.Submit(tasks...)\n\t\t\ttasks = tasks[:0]\n\t\t\tflows = flows[:0]\n\t\t}\n\t\tif root.State == Done {\n\t\t\tbreak\n\t\t}\n\t\tif e.pending.N() == 0 && root.State != Done {\n\t\t\tvar states [Max][]*Flow\n\t\t\tfor v := e.root.Visitor(); v.Walk(); v.Visit() {\n\t\t\t\tstates[v.State] = append(states[v.State], v.Flow)\n\t\t\t}\n\t\t\tvar s [Max]string\n\t\t\tfor i := range states {\n\t\t\t\tn, tasks := accumulate(states[i])\n\t\t\t\ts[i] = fmt.Sprintf(\"%s:%d<%s>\", State(i).Name(), n, tasks)\n\t\t\t}\n\t\t\te.Log.Printf(\"pending %d\", e.pending.N())\n\t\t\te.Log.Printf(\"eval %s\", strings.Join(s[:], \" \"))\n\t\t\tpanic(\"scheduler is stuck\")\n\t\t}\n\t\tif err := e.wait(ctx); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\t// In the case of error, we return immediately. On success, we flush\n\t// all pending tasks so that all logs are properly displayed. We\n\t// also perform another collection, so that the executor may be\n\t// archived without data.\n\tif root.Err != nil {\n\t\treturn nil\n\t}\n\tfor e.pending.N() > 0 {\n\t\tif err := e.wait(ctx); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\tfor _, f := range e.needLog {\n\t\te.LogFlow(ctx, f)\n\t}\n\te.needLog = nil\n\treturn nil\n}", "func (dt *DotTree) GenerateRoutes() map[string]*MetaDot {\n\n\t// Set up Chains of Responsibility for all Dots.\n\tfor _, dot := range dt.dotMap {\n\t\tdotLocal := dot\n\t\tif dotLocal.Id == 0 {\n\t\t\t// Skip any root dots.\n\t\t\tcontinue\n\t\t}\n\t\troute := []string{}\n\t\tdpc := &DotProcessorChannel{}\n\t\t// Create a route all the way to the root for the present dot.\n\t\tfor {\n\t\t\troute = append([]string{dotLocal.Name}, route...)\n\n\t\t\tif dotLocal.ParentId == 0 {\n\t\t\t\tsourceDotRoute := \"/\" + strings.Join(route[:], \"/\")\n\n\t\t\t\tglog.Error(\"Entering new route: \" + sourceDotRoute)\n\t\t\t\tdpc.InitListener(dt, dot, sourceDotRoute)\n\t\t\t\tdt.routeMap[sourceDotRoute] = dot\n\t\t\t\tbreak\n\t\t\t} else {\n\t\t\t\tdotLocal = dt.dotMap[dotLocal.ParentId]\n\t\t\t}\n\t\t}\n\t}\n\treturn dt.routeMap\n}", "func reduceToServiceGraph(trafficMap graph.TrafficMap) graph.TrafficMap {\n\treducedTrafficMap := graph.NewTrafficMap()\n\n\tfor id, n := range trafficMap {\n\t\tif n.NodeType != graph.NodeTypeService {\n\t\t\t// if node isRoot then keep it to better understand traffic flow.\n\t\t\tif val, ok := n.Metadata[graph.IsRoot]; ok && val.(bool) {\n\t\t\t\t// Remove any edge to a non-service node. The service graph only shows non-service root\n\t\t\t\t// nodes, all other nodes are service nodes. The use case is direct workload-to-workload\n\t\t\t\t// traffic, which is unusual but possible. This can lead to nodes with outgoing traffic\n\t\t\t\t// not represented by an outgoing edge, but that is the nature of the graph type.\n\t\t\t\tserviceEdges := []*graph.Edge{}\n\t\t\t\tfor _, e := range n.Edges {\n\t\t\t\t\tif e.Dest.NodeType == graph.NodeTypeService {\n\t\t\t\t\t\tserviceEdges = append(serviceEdges, e)\n\t\t\t\t\t} else {\n\t\t\t\t\t\tlog.Tracef(\"Service graph ignoring non-service root destination [%s]\", e.Dest.Workload)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tn.Edges = serviceEdges\n\t\t\t\treducedTrafficMap[id] = n\n\t\t\t}\n\t\t\tcontinue\n\t\t}\n\n\t\t// handle service node, add to reduced traffic map and generate new edges\n\t\treducedTrafficMap[id] = n\n\t\tworkloadEdges := n.Edges\n\t\tn.Edges = []*graph.Edge{}\n\t\tfor _, workloadEdge := range workloadEdges {\n\t\t\tworkload := workloadEdge.Dest\n\t\t\tcheckNodeType(graph.NodeTypeWorkload, workload)\n\t\t\tfor _, serviceEdge := range workload.Edges {\n\t\t\t\t// As above, ignore edges to non-service destinations\n\t\t\t\tif serviceEdge.Dest.NodeType != graph.NodeTypeService {\n\t\t\t\t\tlog.Tracef(\"Service graph ignoring non-service destination [%s]\", serviceEdge.Dest.Workload)\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t\tchildService := serviceEdge.Dest\n\t\t\t\tvar edge *graph.Edge\n\t\t\t\tfor _, e := range n.Edges {\n\t\t\t\t\tif childService.ID == e.Dest.ID && serviceEdge.Metadata[graph.ProtocolKey] == e.Metadata[graph.ProtocolKey] {\n\t\t\t\t\t\tedge = e\n\t\t\t\t\t\tbreak\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif nil == edge {\n\t\t\t\t\tn.Edges = append(n.Edges, serviceEdge)\n\t\t\t\t} else {\n\t\t\t\t\taddServiceGraphTraffic(edge, serviceEdge)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\treturn reducedTrafficMap\n}", "func (s *Driver) Discover() {\n\tproto := make(map[string]contract.ProtocolProperties)\n\tproto[\"other\"] = map[string]string{\"Address\": \"simple02\", \"Port\": \"301\"}\n\n\tdevice2 := dsModels.DiscoveredDevice{\n\t\tName: \"Simple-Device02\",\n\t\tProtocols: proto,\n\t\tDescription: \"found by discovery\",\n\t\tLabels: []string{\"auto-discovery\"},\n\t}\n\n\tproto = make(map[string]contract.ProtocolProperties)\n\tproto[\"other\"] = map[string]string{\"Address\": \"simple03\", \"Port\": \"399\"}\n\n\tdevice3 := dsModels.DiscoveredDevice{\n\t\tName: \"Simple-Device03\",\n\t\tProtocols: proto,\n\t\tDescription: \"found by discovery\",\n\t\tLabels: []string{\"auto-discovery\"},\n\t}\n\n\tres := []dsModels.DiscoveredDevice{device2, device3}\n\n\ttime.Sleep(10 * time.Second)\n\ts.deviceCh <- res\n}", "func (agent *MerkleAgent) Traverse() {\n\tagent.refreshAuth()\n\tagent.refreshTreeHashStacks()\n}", "func (r *CascadeReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error) {\n\tlog := ctrllog.FromContext(ctx)\n\tlog.Info(\"\\n\\n\\n\\t\\t*** Entering Reconile Logic ***\\n\\n\")\n\tlog.Info(fmt.Sprintf(\"Get request: %+v\", req.NamespacedName))\n\t// Fetch the cascade instance\n\tcascade := &derechov1alpha1.Cascade{}\n\terr := r.Get(ctx, req.NamespacedName, cascade)\n\tif err != nil {\n\t\tif errors.IsNotFound(err) {\n\t\t\t// Request object not found, could have been deleted after reconcile request.\n\t\t\t// Owned objects are automatically garbage collected. For additional cleanup logic use finalizers.\n\t\t\t// Return and don't requeue\n\t\t\tlog.Info(\"cascade resource not found. Ignoring since object must be deleted\")\n\t\t\treturn ctrl.Result{}, nil\n\t\t}\n\t\t// Error reading the object - requeue the request.\n\t\tlog.Error(err, \"Failed to get cascade\")\n\t\treturn ctrl.Result{}, err\n\t}\n\n\tif cascade.Status.LogicalServerSize == 0 {\n\t\tlog.Info(\"==== Step 0: Create for the first time ====\")\n\t\t// this means we are creating the Cascade for the first time, we need to create NodeManager structure manually.\n\n\t\t// Parse the configMap, create pods and the headless service, allocate memory for CascadeReconciler.NodeManager\n\t\tr.NodeManagerMap[req.Name] = new(derechov1alpha1.CascadeNodeManager)\n\t\tconfigMapFinder := cascade.Spec.ConfigMapFinder.DeepCopy()\n\t\terr = r.createNodeManager(ctx, log, req.NamespacedName, configMapFinder)\n\t\tif err != nil {\n\t\t\treturn ctrl.Result{}, err\n\t\t}\n\n\t\tlog.Info(\"r.createNodeManager done\")\n\t\t// Check if the user request enough logical nodes to satisfy the Cascade's need according to the json layout file\n\t\tcheckOK, checkErr := r.checkLogicalNodesRequest(cascade)\n\t\tif !checkOK {\n\t\t\tlog.Error(checkErr, \"Has Not Requested enough\")\n\t\t\treturn ctrl.Result{}, checkErr\n\t\t}\n\n\t\tlog.Info(\"r.checkLogicalNodesRequest done\")\n\t\t// TODO: create the CascadeNodeManager CR, manage status with Conditions. Tutorial: Note The Node field is just to illustrate an example of a Status field. In real cases, it would be recommended to use [Conditions](https://github.com/kubernetes/community/blob/master/contributors/devel/sig-architecture/api-conventions.md#typical-status-properties).\n\n\t\ttempCascadeNodeManager := &derechov1alpha1.CascadeNodeManager{}\n\t\tr.Get(ctx, req.NamespacedName, tempCascadeNodeManager)\n\t\tvar nmError error\n\t\tif err == nil {\n\t\t\t// TODO: FUCKING WHY??\n\t\t\tlog.Info(fmt.Sprintf(\"CascadeNodeManager CR %v somehow exists, delete it.\", req.NamespacedName))\n\t\t\tlog.Info(fmt.Sprintf(\"the existing CascadeNodeManager resource is %+v\", tempCascadeNodeManager))\n\t\t\tnmError = r.Delete(ctx, tempCascadeNodeManager)\n\t\t}\n\t\tnmError = r.Create(ctx, r.NodeManagerMap[req.Name])\n\n\t\tif nmError != nil {\n\t\t\tlog.Error(nmError, fmt.Sprintf(\"Fail to create CR CascadeNodeManager %v\", req.NamespacedName))\n\t\t\treturn ctrl.Result{}, nmError\n\t\t}\n\n\t\terr = r.Status().Update(ctx, r.NodeManagerMap[req.Name])\n\t\tif err != nil {\n\t\t\tlog.Error(err, fmt.Sprintf(\"Fail to update CR CascadeNodeManager's status %v\", req.NamespacedName))\n\t\t\treturn ctrl.Result{}, err\n\t\t}\n\t\tlog.Info(fmt.Sprintf(\"Create CR CascadeNodeManager %v with initial status\", req.NamespacedName))\n\n\t\t// Add finalizer for this CR\n\t\tif !controllerutil.ContainsFinalizer(cascade, cascadeFinalizer) {\n\t\t\tlog.Info(fmt.Sprintf(\"Add finaller %v to Cascade %v\", cascadeFinalizer, req.NamespacedName))\n\t\t\tcontrollerutil.AddFinalizer(cascade, cascadeFinalizer)\n\t\t\terr = r.Update(ctx, cascade)\n\t\t\tif err != nil {\n\t\t\t\tlog.Error(err, fmt.Sprintf(\"Add Finalizer for cascade %v failed\", req.NamespacedName))\n\t\t\t\treturn ctrl.Result{}, err\n\t\t\t}\n\t\t}\n\t}\n\n\t// Check if the Cascade instance is marked to be deleted, which is\n\t// indicated by the deletion timestamp being set.\n\t// TODO: May need to decide adjust the position logic about finalizer\n\tisCascadeMarkedToBeDeleted := cascade.GetDeletionTimestamp() != nil\n\tif isCascadeMarkedToBeDeleted {\n\t\tlog.Info(fmt.Sprintf(\"==== Step Final: Invoke finaller for Cascade %v ====\", req.NamespacedName))\n\t\tif controllerutil.ContainsFinalizer(cascade, cascadeFinalizer) {\n\t\t\t// Run finalization logic for cascadeFinalizer. If the\n\t\t\t// finalization logic fails, don't remove the finalizer so\n\t\t\t// that we can retry during the next reconciliation.\n\t\t\tif err := r.finalizeCascade(ctx, log, cascade); err != nil {\n\t\t\t\treturn ctrl.Result{}, err\n\t\t\t}\n\t\t\t// Remove cascadeFinalizer. Once all finalizers have been\n\t\t\t// removed, the object will be deleted.\n\t\t\tcontrollerutil.RemoveFinalizer(cascade, cascadeFinalizer)\n\t\t\terr := r.Update(ctx, cascade)\n\t\t\tif err != nil {\n\t\t\t\treturn ctrl.Result{}, err\n\t\t\t}\n\t\t}\n\t\treturn ctrl.Result{}, err\n\t\t// TODO: delete corresponding CascadeNodeManager\n\t}\n\n\tlog.Info(\"==== Step 1: Create a Headless Service ====\")\n\t// var headlessService *v1.Service\n\t// NOTE: cannot just declare a pointer, but need a real pointer for r.Get\n\theadlessService := &v1.Service{}\n\terr = r.Get(ctx, req.NamespacedName, headlessService)\n\tif err != nil && errors.IsNotFound(err) {\n\t\tlog.Info(fmt.Sprintf(\"Create the Headless Service Cascade %v\", cascade.Name))\n\t\tr.createHeadlessService(ctx, log, cascade)\n\t}\n\n\tlog.Info(\"==== Step2: Adjust the Num of Pods ====\")\n\n\t// TODO: Currently only support adding an arbitrary number of nodes, or delete the whole Cascade. Deleting an arbitrary number of nodes requires collaboration with the layout information in the Cascade application.\n\n\t// Compare specified logical server number(cascade.Spec.LogicalServerSize) with current logical server number(cascade.Status.LogicalServerSize), and create miss pods.\n\t// What if we add more nodes than the sum of MaxNodes from all shards? —— SST, CAM constraint.\n\tspecLogicalServerSize := cascade.Spec.LogicalServerSize\n\tstatusLogicalServerSize := cascade.Status.LogicalServerSize\n\n\tlog.Info(fmt.Sprintf(\"specLogicalServerSize is %v, statusLogicalServerSize is %v\", specLogicalServerSize, statusLogicalServerSize))\n\n\tif statusLogicalServerSize < specLogicalServerSize {\n\t\terr = r.createPods(ctx, log, specLogicalServerSize-statusLogicalServerSize, cascade, true)\n\t\tif err != nil {\n\t\t\tlog.Error(err, \"Fail to create Server Pods\")\n\t\t}\n\t}\n\n\t// Compare specified logical client number(cascade.Spec.ClientSize) with current logical client number(cascade.Status.ClientSize), and create miss pods.\n\tspecClientSize := cascade.Spec.ClientSize\n\tstatusClientSize := cascade.Status.ClientSize\n\n\tlog.Info(fmt.Sprintf(\"specClientSize is %v, statusClientSize is %v\", specClientSize, statusClientSize))\n\n\tif statusClientSize < specClientSize {\n\t\terr = r.createPods(ctx, log, specClientSize-statusClientSize, cascade, false)\n\t\tif err != nil {\n\t\t\tlog.Error(err, \"Fail to create Server Pods\")\n\t\t}\n\t}\n\n\treturn ctrl.Result{}, nil\n}", "func AddAllManagedByControllerPodEdges(g osgraph.MutableUniqueGraph) {\n\tfor _, node := range g.(graph.Graph).Nodes() {\n\t\tswitch cast := node.(type) {\n\t\tcase *kubegraph.ReplicationControllerNode:\n\t\t\tAddManagedByControllerPodEdges(g, cast, cast.ReplicationController.Namespace, cast.ReplicationController.Spec.Selector)\n\t\tcase *kubegraph.ReplicaSetNode:\n\t\t\tselector := make(map[string]string)\n\t\t\tif cast.ReplicaSet.Spec.Selector != nil {\n\t\t\t\tselector = cast.ReplicaSet.Spec.Selector.MatchLabels\n\t\t\t}\n\t\t\tAddManagedByControllerPodEdges(g, cast, cast.ReplicaSet.Namespace, selector)\n\t\tcase *kubegraph.JobNode:\n\t\t\tselector := make(map[string]string)\n\t\t\tif cast.Job.Spec.Selector != nil {\n\t\t\t\tselector = cast.Job.Spec.Selector.MatchLabels\n\t\t\t}\n\t\t\tAddManagedByControllerPodEdges(g, cast, cast.Job.Namespace, selector)\n\t\tcase *kubegraph.StatefulSetNode:\n\t\t\tselector := make(map[string]string)\n\t\t\tif cast.StatefulSet.Spec.Selector != nil {\n\t\t\t\tselector = cast.StatefulSet.Spec.Selector.MatchLabels\n\t\t\t}\n\t\t\tAddManagedByControllerPodEdges(g, cast, cast.StatefulSet.Namespace, selector)\n\t\tcase *kubegraph.DaemonSetNode:\n\t\t\tselector := make(map[string]string)\n\t\t\tif cast.DaemonSet.Spec.Selector != nil {\n\t\t\t\tselector = cast.DaemonSet.Spec.Selector.MatchLabels\n\t\t\t}\n\t\t\tAddManagedByControllerPodEdges(g, cast, cast.DaemonSet.Namespace, selector)\n\t\t}\n\t}\n}", "func (this *Graph) Cluster() []*Graph {\n /*\n\n Algorithm synopsis:\n\n Loop over the Starters, for each unvisited Starter,\n define an empty sub-graph and, put it into the toVisit set\n\n Loop over the toVisit node set, for each node in it, \n skip if already visited\n add the node to the sub-graph\n remove the nodes into the hasVisited node set\n put all its incoming and outgoing edge into the the toWalk set while\n stop at the hub nodes (edges from the hub nodes are not put in the toWalk set)\n then iterate through the toWalk edge set \n skip if already walked\n add the edge to the sub-graph\n put its connected nodes into the toVisit node set\n remove the edge from the toWalk edge set into the hasWalked edge set\n\n */\n \n // sub-graph index\n sgNdx := -1\n sgRet := make([]*Graph,0)\n\n toVisit := make(nodeSet); hasVisited := make(nodeSet)\n toWalk := make(edgeSet); hasWalked := make(edgeSet)\n\n for starter := range *this.Starters() {\n // define an empty sub-graph and, put it into the toVisit set\n sgRet = append(sgRet, NewGraph(gographviz.NewGraph())); sgNdx++; \n sgRet[sgNdx].Attrs = this.Attrs\n sgRet[sgNdx].SetDir(this.Directed)\n graphName := fmt.Sprintf(\"%s_%03d\\n\", this.Name, sgNdx);\n sgRet[sgNdx].SetName(graphName)\n toVisit.Add(starter)\n hubVisited := make(nodeSet)\n for len(toVisit) > 0 { for nodep := range toVisit {\n toVisit.Del(nodep); //print(\"O \")\n if this.IsHub(nodep) && hasVisited.Has(nodep) && !hubVisited.Has(nodep) { \n // add the already-visited but not-in-this-graph hub node to the sub-graph\n sgRet[sgNdx].AddNode(nodep)\n hubVisited.Add(nodep)\n continue \n }\n if hasVisited.Has(nodep) { continue }\n //spew.Dump(\"toVisit\", nodep)\n // add the node to the sub-graph\n sgRet[sgNdx].AddNode(nodep)\n // remove the nodes into the hasVisited node set\n hasVisited.Add(nodep)\n // stop at the hub nodes\n if this.IsHub(nodep) { continue }\n // put all its incoming and outgoing edge into the the toWalk set\n noden := nodep.Name\n for _, ep := range this.EdgesToParents(noden) {\n toWalk.Add(ep)\n }\n for _, ep := range this.EdgesToChildren(noden) {\n toWalk.Add(ep)\n }\n for edgep := range toWalk {\n toWalk.Del(edgep); //print(\"- \")\n if hasWalked.Has(edgep) { continue }\n //spew.Dump(\"toWalk\", edgep)\n sgRet[sgNdx].Edges.Add(edgep)\n // put its connected nodes into the toVisit node set\n toVisit.Add(this.Lookup(edgep.Src))\n toVisit.Add(this.Lookup(edgep.Dst))\n // remove the edge into the hasWalked edge set\n hasWalked.Add(edgep)\n }\n }}\n //spew.Dump(sgNdx)\n }\n return sgRet\n}", "func (r *ServiceGraphReconciler) Reconcile(req ctrl.Request) (ctrl.Result, error) {\n\tctx := context.Background()\n\tlog := r.Log.WithValues(\"servicegraph\", req.NamespacedName)\n\n\t// your logic here\n\tservicegraph := &onlabv2.ServiceGraph{}\n\terr := r.Get(ctx, req.NamespacedName, servicegraph)\n\tif err != nil {\n\t\tif errors.IsNotFound(err) {\n\t\t\t// Request object not found, could have been deleted after reconcile request.\n\t\t\t// Owned objects are automatically garbage collected. For additional cleanup logic use finalizers.\n\t\t\t// Return and don't requeue\n\t\t\tlog.Info(\"Servicegraph resource not found. Ignoring since object must be deleted\")\n\t\t\treturn ctrl.Result{}, nil\n\t\t}\n\t\t// Error reading the object - requeue the request.\n\t\tlog.Error(err, \"Failed to get ServiceGraph resource\")\n\t\treturn ctrl.Result{}, err\n\t}\n\t// printServiceGraph(servicegraph)\n\n\tfor _, node := range servicegraph.Spec.Nodes {\n\t\t// Check if the deployment for the node already exists, if not create a new one\n\t\tfound := &appsv1.Deployment{}\n\n\t\terr = r.Get(ctx, types.NamespacedName{Name: node.Name, Namespace: \"default\"}, found)\n\t\tif err != nil && errors.IsNotFound(err) {\n\t\t\t//fmt.Printf(\"######### CREATE: %d node type: %T\\n\", i, node)\n\t\t\t// Define a new deployment for the node\n\t\t\tdep := r.deploymentForNode(node, servicegraph)\n\t\t\tlog.Info(\"Creating a new Deployment\", \"Deployment.Namespace\", dep.Namespace, \"Deployment.Name\", dep.Name)\n\n\t\t\terr = r.Create(ctx, dep)\n\t\t\tif err != nil {\n\t\t\t\tlog.Error(err, \"Failed to create new Deployment\", \"Deployment.Namespace\", dep.Namespace, \"Deployment.Name\", dep.Name)\n\t\t\t\treturn ctrl.Result{}, err\n\t\t\t}\n\t\t\t// Deployment created successfully - return and requeue\n\t\t\treturn ctrl.Result{Requeue: true}, nil\n\t\t} else if err != nil {\n\t\t\tlog.Error(err, \"Failed to get Deployment\")\n\t\t\treturn ctrl.Result{}, err\n\t\t}\n\n\t\t// Ensure the deployment size is the same as the spec\n\t\tsize := int32(node.Replicas)\n\t\tif *found.Spec.Replicas != size {\n\t\t\tfound.Spec.Replicas = &size\n\t\t\terr = r.Update(ctx, found)\n\t\t\tif err != nil {\n\t\t\t\tlog.Error(err, \"Failed to update Deployment\", \"Deployment.Namespace\", found.Namespace, \"Deployment.Name\", found.Name)\n\t\t\t\treturn ctrl.Result{}, err\n\t\t\t}\n\t\t\t// Spec updated - return and requeue\n\t\t\treturn ctrl.Result{Requeue: true}, nil\n\t\t}\n\n\t\t// // Update/create services\n\n\t\t// foundSvc := &corev1.Service{}\n\n\t\t// err = r.Get(ctx, client.ObjectKey{Namespace: \"default\", Name: \"name\"}, foundSvc)\n\n\t\t// if err != nil && errors.IsNotFound(err) {\n\t\t// \tsvc := r.serviceForNode(node, servicegraph)\n\t\t// \tlog.Info(\"Creating a new Service\", \"Service.Namespace\", svc.Namespace, \"Service.Name\", svc.Name)\n\t\t// \t// Yes. This is not awesome, but works\n\t\t// \t// \t_ = r.Delete(ctx, svc)\n\t\t// \t// err = r.Create(ctx, svc)\n\t\t// \terr = r.Create(ctx, svc)\n\t\t// \tif err != nil {\n\t\t// \t\tlog.Error(err, \"Failed to create new Service\", \"Service.Namespace\", svc.Namespace, \"Service.Name\", svc.Name)\n\t\t// \t\treturn ctrl.Result{}, err\n\t\t// \t}\n\t\t// \t// Deployment created successfully - return and requeue\n\t\t// \treturn ctrl.Result{Requeue: true}, nil\n\t\t// } else if err != nil {\n\t\t// \tlog.Error(err, \"Failed to get SVC\")\n\t\t// \treturn ctrl.Result{}, err\n\t\t// }\n\t}\n\n\t// Update/create services\n\tfor _, node := range servicegraph.Spec.Nodes {\n\t\tsvc := r.serviceForNode(node, servicegraph)\n\t\t// Yes. This is not awesome, but works\n\t\t//_ = r.Delete(ctx, svc)\n\t\terr = r.Create(ctx, svc)\n\t\tif err != nil {\n\t\t\tlog.Error(err, \"Failed to create new Service\", \"Service.Namespace\", svc.Namespace, \"Service.Name\", svc.Name)\n\t\t\treturn ctrl.Result{}, err\n\t\t}\n\t\t// Deployment created successfully - return and requeue\n\t\treturn ctrl.Result{Requeue: true}, nil\n\t}\n\n\treturn ctrl.Result{}, nil\n}", "func dfs(g *Graph, current int, visited set, visitFunction func(int)) {\n if _, seen := visited[current]; seen {\n return\n }\n\n visited[current] = true\n visitFunction(current)\n\n for neighbour := range g.adjList[current] {\n dfs(g, neighbour, visited, visitFunction)\n }\n}", "func (r *ReconciliationTask) processVisibilities() {\n\tlogger := log.C(r.runContext)\n\tif r.platformClient.Visibility() == nil {\n\t\tlogger.Debug(\"Platform client cannot handle visibilities. Visibility reconciliation will be skipped.\")\n\t\treturn\n\t}\n\n\tplans, err := r.getSMPlans()\n\tif err != nil {\n\t\tlogger.WithError(err).Error(\"An error occurred while obtaining plans from Service Manager\")\n\t\treturn\n\t}\n\tvar platformVisibilities []*platform.ServiceVisibilityEntity\n\tif r.options.VisibilityCache && r.areSMPlansSame(plans) {\n\t\tplatformVisibilities = r.getPlatformVisibilitiesFromCache()\n\t}\n\n\tvisibilityCacheUsed := platformVisibilities != nil\n\tif !visibilityCacheUsed {\n\t\tplatformVisibilities, err = r.loadPlatformVisibilities(plans)\n\t\tif err != nil {\n\t\t\tlogger.WithError(err).Error(\"An error occurred while loading visibilities from platform\")\n\t\t\treturn\n\t\t}\n\t}\n\n\tplansMap := smPlansToMap(plans)\n\tsmVisibilities, err := r.getSMVisibilities(plansMap)\n\tif err != nil {\n\t\tlogger.WithError(err).Error(\"An error occurred while obtaining SM visibilities\")\n\t\treturn\n\t}\n\n\terrorOccured := r.reconcileServiceVisibilities(platformVisibilities, smVisibilities)\n\n\tif r.options.VisibilityCache {\n\t\tif errorOccured {\n\t\t\tr.cache.Delete(platformVisibilityCacheKey)\n\t\t\tr.cache.Delete(smPlansCacheKey)\n\t\t} else {\n\t\t\tr.updateVisibilityCache(visibilityCacheUsed, plansMap, smVisibilities)\n\t\t}\n\t}\n}", "func (d *Depmap) Traverse(key string, visit CallbackFn, loop CallbackFn) {\n\td.lock.Lock()\n\tdefer d.lock.Unlock()\n\tvmap := d.newVisitMap(key)\n\tfor _, dep := range d.store[key] {\n\t\td.traverseRecursive(dep, vmap, visit, loop)\n\t}\n}", "func PlanByGraph(rule *api.Rule) (*topo.Topo, error) {\n\truleGraph := rule.Graph\n\tif ruleGraph == nil {\n\t\treturn nil, errors.New(\"no graph\")\n\t}\n\ttp, err := topo.NewWithNameAndQos(rule.Id, rule.Options.Qos, rule.Options.CheckpointInterval)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tvar (\n\t\tnodeMap = make(map[string]api.TopNode)\n\t\tsinks = make(map[string]bool)\n\t\tsources = make(map[string]bool)\n\t\tstore kv.KeyValue\n\t\tlookupTableChildren = make(map[string]*ast.Options)\n\t\tscanTableEmitters []string\n\t\tsourceNames []string\n\t\tstreamEmitters = make(map[string]struct{})\n\t)\n\tfor _, srcName := range ruleGraph.Topo.Sources {\n\t\tgn, ok := ruleGraph.Nodes[srcName]\n\t\tif !ok {\n\t\t\treturn nil, fmt.Errorf(\"source node %s not defined\", srcName)\n\t\t}\n\t\tif _, ok := ruleGraph.Topo.Edges[srcName]; !ok {\n\t\t\treturn nil, fmt.Errorf(\"no edge defined for source node %s\", srcName)\n\t\t}\n\t\tsrcNode, srcType, name, err := parseSource(srcName, gn, rule, store, lookupTableChildren)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"parse source %s with %v error: %w\", srcName, gn.Props, err)\n\t\t}\n\t\tswitch srcType {\n\t\tcase STREAM:\n\t\t\tstreamEmitters[name] = struct{}{}\n\t\t\tsourceNames = append(sourceNames, name)\n\t\tcase SCANTABLE:\n\t\t\tscanTableEmitters = append(scanTableEmitters, name)\n\t\t\tsourceNames = append(sourceNames, name)\n\t\tcase LOOKUPTABLE:\n\t\t\tsourceNames = append(sourceNames, name)\n\t\t}\n\t\tif srcNode != nil {\n\t\t\tnodeMap[srcName] = srcNode\n\t\t\ttp.AddSrc(srcNode)\n\t\t}\n\t\tsources[srcName] = true\n\t}\n\tfor nodeName, gn := range ruleGraph.Nodes {\n\t\tswitch gn.Type {\n\t\tcase \"source\": // handled above,\n\t\t\tcontinue\n\t\tcase \"sink\":\n\t\t\tif _, ok := ruleGraph.Topo.Edges[nodeName]; ok {\n\t\t\t\treturn nil, fmt.Errorf(\"sink %s has edge\", nodeName)\n\t\t\t}\n\t\t\tnodeMap[nodeName] = node.NewSinkNode(nodeName, gn.NodeType, gn.Props)\n\t\t\tsinks[nodeName] = true\n\t\tcase \"operator\":\n\t\t\tif _, ok := ruleGraph.Topo.Edges[nodeName]; !ok {\n\t\t\t\treturn nil, fmt.Errorf(\"no edge defined for operator node %s\", nodeName)\n\t\t\t}\n\t\t\tnt := strings.ToLower(gn.NodeType)\n\t\t\tswitch nt {\n\t\t\tcase \"watermark\":\n\t\t\t\tn, err := parseWatermark(gn.Props, streamEmitters)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn nil, fmt.Errorf(\"parse watermark %s with %v error: %w\", nodeName, gn.Props, err)\n\t\t\t\t}\n\t\t\t\top := node.NewWatermarkOp(nodeName, n.SendWatermark, n.Emitters, rule.Options)\n\t\t\t\tnodeMap[nodeName] = op\n\t\t\tcase \"function\":\n\t\t\t\tfop, err := parseFunc(gn.Props, sourceNames)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn nil, fmt.Errorf(\"parse function %s with %v error: %w\", nodeName, gn.Props, err)\n\t\t\t\t}\n\t\t\t\top := Transform(fop, nodeName, rule.Options)\n\t\t\t\tnodeMap[nodeName] = op\n\t\t\tcase \"aggfunc\":\n\t\t\t\tfop, err := parseFunc(gn.Props, sourceNames)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn nil, fmt.Errorf(\"parse aggfunc %s with %v error: %w\", nodeName, gn.Props, err)\n\t\t\t\t}\n\t\t\t\tfop.IsAgg = true\n\t\t\t\top := Transform(fop, nodeName, rule.Options)\n\t\t\t\tnodeMap[nodeName] = op\n\t\t\tcase \"filter\":\n\t\t\t\tfop, err := parseFilter(gn.Props, sourceNames)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn nil, fmt.Errorf(\"parse filter %s with %v error: %w\", nodeName, gn.Props, err)\n\t\t\t\t}\n\t\t\t\top := Transform(fop, nodeName, rule.Options)\n\t\t\t\tnodeMap[nodeName] = op\n\t\t\tcase \"pick\":\n\t\t\t\tpop, err := parsePick(gn.Props, sourceNames)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn nil, fmt.Errorf(\"parse pick %s with %v error: %w\", nodeName, gn.Props, err)\n\t\t\t\t}\n\t\t\t\top := Transform(pop, nodeName, rule.Options)\n\t\t\t\tnodeMap[nodeName] = op\n\t\t\tcase \"window\":\n\t\t\t\twconf, err := parseWindow(gn.Props)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn nil, fmt.Errorf(\"parse window conf %s with %v error: %w\", nodeName, gn.Props, err)\n\t\t\t\t}\n\t\t\t\top, err := node.NewWindowOp(nodeName, *wconf, rule.Options)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn nil, fmt.Errorf(\"parse window %s with %v error: %w\", nodeName, gn.Props, err)\n\t\t\t\t}\n\t\t\t\tnodeMap[nodeName] = op\n\t\t\tcase \"join\":\n\t\t\t\tstmt, err := parseJoinAst(gn.Props, sourceNames)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn nil, fmt.Errorf(\"parse join %s with %v error: %w\", nodeName, gn.Props, err)\n\t\t\t\t}\n\t\t\t\tfromNode := stmt.Sources[0].(*ast.Table)\n\t\t\t\tif _, ok := streamEmitters[fromNode.Name]; !ok {\n\t\t\t\t\treturn nil, fmt.Errorf(\"parse join %s with %v error: join source %s is not a stream\", nodeName, gn.Props, fromNode.Name)\n\t\t\t\t}\n\t\t\t\thasLookup := false\n\t\t\t\tif stmt.Joins != nil {\n\t\t\t\t\tif len(lookupTableChildren) > 0 {\n\t\t\t\t\t\tvar joins []ast.Join\n\t\t\t\t\t\tfor _, join := range stmt.Joins {\n\t\t\t\t\t\t\tif hasLookup {\n\t\t\t\t\t\t\t\treturn nil, fmt.Errorf(\"parse join %s with %v error: only support to join one lookup table with one stream\", nodeName, gn.Props)\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tif streamOpt, ok := lookupTableChildren[join.Name]; ok {\n\t\t\t\t\t\t\t\thasLookup = true\n\t\t\t\t\t\t\t\tlookupPlan := LookupPlan{\n\t\t\t\t\t\t\t\t\tjoinExpr: join,\n\t\t\t\t\t\t\t\t\toptions: streamOpt,\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tif !lookupPlan.validateAndExtractCondition() {\n\t\t\t\t\t\t\t\t\treturn nil, fmt.Errorf(\"parse join %s with %v error: join condition %s is invalid, at least one equi-join predicate is required\", nodeName, gn.Props, join.Expr)\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\top, err := node.NewLookupNode(lookupPlan.joinExpr.Name, lookupPlan.fields, lookupPlan.keys, lookupPlan.joinExpr.JoinType, lookupPlan.valvars, lookupPlan.options, rule.Options)\n\t\t\t\t\t\t\t\tif err != nil {\n\t\t\t\t\t\t\t\t\treturn nil, fmt.Errorf(\"parse join %s with %v error: fail to create lookup node\", nodeName, gn.Props)\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tnodeMap[nodeName] = op\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tjoins = append(joins, join)\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\tstmt.Joins = joins\n\t\t\t\t\t}\n\t\t\t\t\t// Not all joins are lookup joins, so we need to create a join plan for the remaining joins\n\t\t\t\t\tif len(stmt.Joins) > 0 && !hasLookup {\n\t\t\t\t\t\tif len(scanTableEmitters) > 0 {\n\t\t\t\t\t\t\treturn nil, fmt.Errorf(\"parse join %s with %v error: do not support scan table %s yet\", nodeName, gn.Props, scanTableEmitters)\n\t\t\t\t\t\t}\n\t\t\t\t\t\tjop := &operator.JoinOp{Joins: stmt.Joins, From: fromNode}\n\t\t\t\t\t\top := Transform(jop, nodeName, rule.Options)\n\t\t\t\t\t\tnodeMap[nodeName] = op\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\tcase \"groupby\":\n\t\t\t\tgop, err := parseGroupBy(gn.Props, sourceNames)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn nil, fmt.Errorf(\"parse groupby %s with %v error: %w\", nodeName, gn.Props, err)\n\t\t\t\t}\n\t\t\t\top := Transform(gop, nodeName, rule.Options)\n\t\t\t\tnodeMap[nodeName] = op\n\t\t\tcase \"orderby\":\n\t\t\t\toop, err := parseOrderBy(gn.Props, sourceNames)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn nil, fmt.Errorf(\"parse orderby %s with %v error: %w\", nodeName, gn.Props, err)\n\t\t\t\t}\n\t\t\t\top := Transform(oop, nodeName, rule.Options)\n\t\t\t\tnodeMap[nodeName] = op\n\t\t\tcase \"switch\":\n\t\t\t\tsconf, err := parseSwitch(gn.Props, sourceNames)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn nil, fmt.Errorf(\"parse switch %s with %v error: %w\", nodeName, gn.Props, err)\n\t\t\t\t}\n\t\t\t\top, err := node.NewSwitchNode(nodeName, sconf, rule.Options)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn nil, fmt.Errorf(\"create switch %s with %v error: %w\", nodeName, gn.Props, err)\n\t\t\t\t}\n\t\t\t\tnodeMap[nodeName] = op\n\t\t\tdefault:\n\t\t\t\tgnf, ok := extNodes[nt]\n\t\t\t\tif !ok {\n\t\t\t\t\treturn nil, fmt.Errorf(\"unknown operator type %s\", gn.NodeType)\n\t\t\t\t}\n\t\t\t\top, err := gnf(nodeName, gn.Props, rule.Options)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn nil, err\n\t\t\t\t}\n\t\t\t\tnodeMap[nodeName] = op\n\t\t\t}\n\t\tdefault:\n\t\t\treturn nil, fmt.Errorf(\"unknown node type %s\", gn.Type)\n\t\t}\n\t}\n\n\t// validate source node\n\tfor _, nodeName := range ruleGraph.Topo.Sources {\n\t\tif _, ok := sources[nodeName]; !ok {\n\t\t\treturn nil, fmt.Errorf(\"source %s is not a source type node\", nodeName)\n\t\t}\n\t}\n\n\t// reverse edges, value is a 2-dim array. Only switch node will have the second dim\n\treversedEdges := make(map[string][][]string)\n\trclone := make(map[string][]string)\n\tfor fromNode, toNodes := range ruleGraph.Topo.Edges {\n\t\tif _, ok := ruleGraph.Nodes[fromNode]; !ok {\n\t\t\treturn nil, fmt.Errorf(\"node %s is not defined\", fromNode)\n\t\t}\n\t\tfor i, toNode := range toNodes {\n\t\t\tswitch tn := toNode.(type) {\n\t\t\tcase string:\n\t\t\t\tif _, ok := ruleGraph.Nodes[tn]; !ok {\n\t\t\t\t\treturn nil, fmt.Errorf(\"node %s is not defined\", tn)\n\t\t\t\t}\n\t\t\t\tif _, ok := reversedEdges[tn]; !ok {\n\t\t\t\t\treversedEdges[tn] = make([][]string, 1)\n\t\t\t\t}\n\t\t\t\treversedEdges[tn][0] = append(reversedEdges[tn][0], fromNode)\n\t\t\t\trclone[tn] = append(rclone[tn], fromNode)\n\t\t\tcase []interface{}:\n\t\t\t\tfor _, tni := range tn {\n\t\t\t\t\ttnn, ok := tni.(string)\n\t\t\t\t\tif !ok { // never happen\n\t\t\t\t\t\treturn nil, fmt.Errorf(\"invalid edge toNode %v\", toNode)\n\t\t\t\t\t}\n\t\t\t\t\tif _, ok := ruleGraph.Nodes[tnn]; !ok {\n\t\t\t\t\t\treturn nil, fmt.Errorf(\"node %s is not defined\", tnn)\n\t\t\t\t\t}\n\t\t\t\t\tfor len(reversedEdges[tnn]) <= i {\n\t\t\t\t\t\treversedEdges[tnn] = append(reversedEdges[tnn], []string{})\n\t\t\t\t\t}\n\t\t\t\t\treversedEdges[tnn][i] = append(reversedEdges[tnn][i], fromNode)\n\t\t\t\t\trclone[tnn] = append(rclone[tnn], fromNode)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\t// sort the nodes by topological order\n\tnodesInOrder := make([]string, len(ruleGraph.Nodes))\n\ti := 0\n\tgenNodesInOrder(ruleGraph.Topo.Sources, ruleGraph.Topo.Edges, rclone, nodesInOrder, i)\n\n\t// validate the typo\n\t// the map is to record the output for each node\n\tdataFlow := make(map[string]*graph.IOType)\n\tfor _, n := range nodesInOrder {\n\t\tgn := ruleGraph.Nodes[n]\n\t\tif gn == nil {\n\t\t\treturn nil, fmt.Errorf(\"can't find node %s\", n)\n\t\t}\n\t\tif gn.Type == \"source\" {\n\t\t\tdataFlow[n] = &graph.IOType{\n\t\t\t\tType: graph.IOINPUT_TYPE_ROW,\n\t\t\t\tRowType: graph.IOROW_TYPE_SINGLE,\n\t\t\t\tCollectionType: graph.IOCOLLECTION_TYPE_ANY,\n\t\t\t\tAllowMulti: false,\n\t\t\t}\n\t\t} else if gn.Type == \"sink\" {\n\t\t\tcontinue\n\t\t} else {\n\t\t\tnodeIO, ok := graph.OpIO[strings.ToLower(gn.NodeType)]\n\t\t\tif !ok {\n\t\t\t\treturn nil, fmt.Errorf(\"can't find the io definition for node type %s\", gn.NodeType)\n\t\t\t}\n\t\t\tdataInCondition := nodeIO[0]\n\t\t\tindim := reversedEdges[n]\n\t\t\tvar innodes []string\n\t\t\tfor _, in := range indim {\n\t\t\t\tinnodes = append(innodes, in...)\n\t\t\t}\n\t\t\tif len(innodes) > 1 {\n\t\t\t\tif dataInCondition.AllowMulti {\n\t\t\t\t\t// special case for join which does not allow multiple streams\n\t\t\t\t\tif gn.NodeType == \"join\" {\n\t\t\t\t\t\tjoinStreams := 0\n\t\t\t\t\t\tfor _, innode := range innodes {\n\t\t\t\t\t\t\tif _, isLookup := lookupTableChildren[innode]; !isLookup {\n\t\t\t\t\t\t\t\tjoinStreams++\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tif joinStreams > 1 {\n\t\t\t\t\t\t\t\treturn nil, fmt.Errorf(\"join node %s does not allow multiple stream inputs\", n)\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tfor _, innode := range innodes {\n\t\t\t\t\t\t_, err = graph.Fit(dataFlow[innode], dataInCondition)\n\t\t\t\t\t\tif err != nil {\n\t\t\t\t\t\t\treturn nil, fmt.Errorf(\"node %s output does not match node %s input: %v\", innode, n, err)\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\treturn nil, fmt.Errorf(\"operator %s of type %s does not allow multiple inputs\", n, gn.NodeType)\n\t\t\t\t}\n\t\t\t} else if len(innodes) == 1 {\n\t\t\t\t_, err := graph.Fit(dataFlow[innodes[0]], dataInCondition)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn nil, fmt.Errorf(\"node %s output does not match node %s input: %v\", innodes[0], n, err)\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\treturn nil, fmt.Errorf(\"operator %s of type %s has no input\", n, gn.NodeType)\n\t\t\t}\n\t\t\tout := nodeIO[1]\n\t\t\tin := dataFlow[innodes[0]]\n\t\t\tdataFlow[n] = graph.MapOut(in, out)\n\t\t\t// convert filter to having if the input is aggregated\n\t\t\tif gn.NodeType == \"filter\" && in.Type == graph.IOINPUT_TYPE_COLLECTION && in.CollectionType == graph.IOCOLLECTION_TYPE_GROUPED {\n\t\t\t\tfop, err := parseHaving(gn.Props, sourceNames)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn nil, err\n\t\t\t\t}\n\t\t\t\top := Transform(fop, n, rule.Options)\n\t\t\t\tnodeMap[n] = op\n\t\t\t}\n\t\t}\n\t}\n\t// add the linkages\n\tfor nodeName, fromNodes := range reversedEdges {\n\t\ttotalLen := 0\n\t\tfor _, fromNode := range fromNodes {\n\t\t\ttotalLen += len(fromNode)\n\t\t}\n\t\tinputs := make([]api.Emitter, 0, totalLen)\n\t\tfor i, fromNode := range fromNodes {\n\t\t\tfor _, from := range fromNode {\n\t\t\t\tif i == 0 {\n\t\t\t\t\tif src, ok := nodeMap[from].(api.Emitter); ok {\n\t\t\t\t\t\tinputs = append(inputs, src)\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tswitch sn := nodeMap[from].(type) {\n\t\t\t\t\tcase *node.SwitchNode:\n\t\t\t\t\t\tinputs = append(inputs, sn.GetEmitter(i))\n\t\t\t\t\tdefault:\n\t\t\t\t\t\treturn nil, fmt.Errorf(\"node %s is not a switch node but have multiple output\", from)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tn := nodeMap[nodeName]\n\t\tif n == nil {\n\t\t\treturn nil, fmt.Errorf(\"node %s is not defined\", nodeName)\n\t\t}\n\t\tif _, ok := sinks[nodeName]; ok {\n\t\t\ttp.AddSink(inputs, n.(*node.SinkNode))\n\t\t} else {\n\t\t\ttp.AddOperator(inputs, n.(node.OperatorNode))\n\t\t}\n\t}\n\treturn tp, nil\n}", "func (novis *Novis) traverse(lookup string) <-chan *Branch {\n\treturn novis.Root.traverse(lookup)\n}", "func (tree *BinaryTree) traverse() {\n\tqueue := []*Node{tree.root}\n\tfor len(queue) > 0 {\n\t\tn := len(queue)\n\t\tfor i := 0; i < n; i++ {\n\t\t\tnode := queue[0]\n\t\t\tqueue = queue[1:]\n\t\t\tfmt.Print(node)\n\t\t\tif node != nil {\n\t\t\t\tqueue = append(queue, node.left, node.right)\n\t\t\t}\n\t\t}\n\t\tfmt.Println()\n\t}\n}", "func VisitAll(algorithm Algorithm, root *html.Node, fn func(*html.Node)) {\n\tif algorithm == BreadthFirst {\n\t\tbfs(root, fn)\n\t\treturn\n\t}\n\tdfs(root, fn)\n}", "func (dl *DoublyLinkedList) traverse() {\n\tcurrent := dl.head\n\tfor current != nil {\n\t\tfmt.Println(current.value)\n\t\tcurrent = current.next\n\t}\n}", "func (s *DHT) iterate(ctx context.Context, iterativeType int, target []byte, data []byte) ([]byte, error) {\n\t// find the closest contacts for target node from local route tables\n\tnl := s.ht.closestContacts(Alpha, target, []*Node{})\n\t// no a closer node, stop search\n\tif nl.Len() == 0 {\n\t\treturn nil, nil\n\t}\n\tlog.WithContext(ctx).Infof(\"type: %v, target: %v, nodes: %v\", iterativeType, base58.Encode(target), nl.String())\n\n\t// keep the closer node\n\tclosestNode := nl.Nodes[0]\n\t// if it's find node, reset the refresh timer\n\tif iterativeType == IterateFindNode {\n\t\tbucket := s.ht.bucketIndex(target, s.ht.self.ID)\n\t\tlog.WithContext(ctx).Debugf(\"bucket for target: %v\", base58.Encode(target))\n\n\t\t// reset the refresh time for the bucket\n\t\ts.ht.resetRefreshTime(bucket)\n\t}\n\n\t// According to the Kademlia white paper, after a round of FIND_NODE RPCs\n\t// fails to provide a node closer than closestNode, we should send a\n\t// FIND_NODE RPC to all remaining nodes in the node list that have not\n\t// yet been contacted.\n\tsearchRest := false\n\n\t// keep track of nodes contacted\n\tvar contacted = make(map[string]bool)\n\tfor {\n\t\t// do the requests concurrently\n\t\tresponses := s.doMultiWorkers(ctx, iterativeType, target, nl, contacted, searchRest)\n\t\t// handle the response one by one\n\t\tfor response := range responses {\n\t\t\tlog.WithContext(ctx).Debugf(\"response: %v\", response.String())\n\t\t\t// add the target node to the bucket\n\t\t\ts.addNode(response.Sender)\n\n\t\t\tswitch response.MessageType {\n\t\t\tcase FindNode, StoreData:\n\t\t\t\tv := response.Data.(*FindNodeResponse)\n\t\t\t\tif len(v.Closest) > 0 {\n\t\t\t\t\tnl.AddNodes(v.Closest)\n\t\t\t\t}\n\t\t\tcase FindValue:\n\t\t\t\tv := response.Data.(*FindValueResponse)\n\t\t\t\tif v.Value != nil {\n\t\t\t\t\treturn v.Value, nil\n\t\t\t\t}\n\t\t\t\tif len(v.Closest) > 0 {\n\t\t\t\t\tnl.AddNodes(v.Closest)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t// stop search\n\t\tif !searchRest && len(nl.Nodes) == 0 {\n\t\t\treturn nil, nil\n\t\t}\n\n\t\t// sort the nodes for node list\n\t\tsort.Sort(nl)\n\n\t\tlog.WithContext(ctx).Debugf(\"id: %v, iterate %d, sorted nodes: %v\", base58.Encode(s.ht.self.ID), iterativeType, nl.String())\n\n\t\t// if closestNode is unchanged\n\t\tif bytes.Equal(nl.Nodes[0].ID, closestNode.ID) || searchRest {\n\t\t\tswitch iterativeType {\n\t\t\tcase IterateFindNode:\n\t\t\t\tif !searchRest {\n\t\t\t\t\t// search all the rest nodes\n\t\t\t\t\tsearchRest = true\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t\treturn nil, nil\n\t\t\tcase IterateFindValue:\n\t\t\t\treturn nil, nil\n\t\t\tcase IterateStore:\n\t\t\t\t// store the value to node list\n\t\t\t\tfor i, n := range nl.Nodes {\n\t\t\t\t\t// limite the count below K\n\t\t\t\t\tif i >= K {\n\t\t\t\t\t\treturn nil, nil\n\t\t\t\t\t}\n\n\t\t\t\t\tdata := &StoreDataRequest{Data: data}\n\t\t\t\t\t// new a request message\n\t\t\t\t\trequest := s.newMessage(StoreData, n, data)\n\t\t\t\t\t// send the request and receive the response\n\t\t\t\t\tif _, err := s.network.Call(ctx, request); err != nil {\n\t\t\t\t\t\t// <TODO> need to remove the node ?\n\t\t\t\t\t\tlog.WithContext(ctx).WithError(err).Error(\"network call\")\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\treturn nil, nil\n\t\t\t}\n\t\t} else {\n\t\t\t// update the closest node\n\t\t\tclosestNode = nl.Nodes[0]\n\t\t}\n\t}\n}", "func Test_Cover_Iterators(T *testing.T) {\n\tdg := graph.NewDGraph(ut.Node(\"A\"), ut.Node(\"B\"))\n\tdg.DFS(\"A\", iterator.PreOrder)\n\tdg.BFS(\"A\")\n\tdg.RDFS(\"A\", iterator.PreOrder)\n\tdg.RBFS(\"A\")\n\n\tug := graph.NewUGraph(ut.Node(\"A\"), ut.Node(\"B\"))\n\tug.DFS(\"A\", iterator.PreOrder)\n\tug.BFS(\"A\")\n\tug.RDFS(\"A\", iterator.PreOrder)\n\tug.RBFS(\"A\")\n}", "func main1() {\n\tfmt.Println(\"Hello World\")\n\tdgraph.Open(\"127.0.0.1:9080\")\n\terr := dgraph.CreateSchema()\n\tif err != nil {\n\t\tfmt.Println(\"Error while creating schema \", err)\n\t}\n\n\t/*uid, err := GetUId(Client, \"default:Pod2\", \"isPod\")\n\tif err != nil {\n\t\tfmt.Println(\"Error while fetching uid \", err)\n\t}\n\tfmt.Println(\"Uid is \" + uid)*/\n\n\tsourcePod := \"weave:weave-scope-app-6d6b76b846-z92wk\"\n\tdestinationPods := []string{\"fiaasco:ccs-billing-deployment-1-1-92-75dc8749f4-gld6q\", \"weave:weave-scope-agent-lbfpj\"}\n\n\terr = dgraph.PersistPodsInteractionGraph(sourcePod, destinationPods)\n\tif err != nil {\n\t\tfmt.Println(\"Error while building interation graph \", err)\n\t}\n}", "func DFS(traversalType string) []int {\n\tvar data []int\n\tif traversalType == \"pre\" {\n\t\tdata = traversePre(data, 0)\n\t} else if traversalType == \"in\" {\n\t\tdata = traverseIn(data, 0)\n\t} else if traversalType == \"pos\" {\n\t\tdata = traversePos(data, 0)\n\t}\n\treturn data\n}", "func (ncc *NetworkConfigCreator) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error) {\n\t// Wait, in case the configuration has not completed yet.\n\tif !ncc.secretWatcher.WaitForConfigured(ctx) || !ncc.serviceWatcher.WaitForConfigured(ctx) {\n\t\treturn ctrl.Result{}, errors.New(\"context expired before initialization completed\")\n\t}\n\n\tklog.V(4).Infof(\"Reconciling ForeignCluster %q\", req.Name)\n\ttracer := trace.New(\"Reconcile\", trace.Field{Key: \"ForeignCluster\", Value: req.Name})\n\tctx = trace.ContextWithTrace(ctx, tracer)\n\tdefer tracer.LogIfLong(traceutils.LongThreshold())\n\n\t// Get the foreign cluster object.\n\tvar fc discoveryv1alpha1.ForeignCluster\n\tif err := ncc.Get(ctx, req.NamespacedName, &fc); err != nil {\n\t\t// Remove the ForeignCluster from the list of known ones.\n\t\tncc.foreignClusters.Remove(req.NamespacedName.Name)\n\n\t\tif !kerrors.IsNotFound(err) {\n\t\t\tklog.Errorf(\"Failed retrieving ForeignCluster: %v\", err)\n\t\t}\n\t\t// Reconcile was triggered by a delete request.\n\t\t// No need to delete anything, as automatically collected by the owner reference.\n\t\treturn ctrl.Result{}, client.IgnoreNotFound(err)\n\t}\n\n\tif fc.Spec.ClusterIdentity.ClusterID == \"\" {\n\t\tklog.V(4).Infof(\"ForeignCluster %q not yet associated with a cluster ID\", req.Name)\n\t\treturn ctrl.Result{}, nil\n\t}\n\n\tif !foreigncluster.IsNetworkingEnabled(&fc) {\n\t\tklog.V(4).Infof(\"Networking for cluster %q is disabled, hence no need to create the networkconfig\", req.Name)\n\t}\n\n\t// Add the ForeignCluster to the list of known ones.\n\tncc.foreignClusters.Add(req.NamespacedName.Name)\n\n\t// A peering is (being) established and networking is enabled, hence we need to ensure the network interconnection.\n\tif fc.GetDeletionTimestamp().IsZero() && foreigncluster.IsNetworkingEnabled(&fc) &&\n\t\t(foreigncluster.IsIncomingJoined(&fc) || foreigncluster.IsOutgoingJoined(&fc)) {\n\t\treturn ctrl.Result{}, ncc.EnforceNetworkConfigPresence(ctx, &fc)\n\t}\n\n\t// A peering is not established or the networking has been disabled, hence we need to tear down the network interconnection.\n\treturn ctrl.Result{}, ncc.EnforceNetworkConfigAbsence(ctx, &fc)\n}", "func generate(g *Graph) error {\n\tvar (\n\t\tassets assets\n\t\texternal []GraphTemplate\n\t)\n\ttemplates, external = g.templates()\n\tfor _, n := range g.Nodes {\n\t\tassets.addDir(filepath.Join(g.Config.Target, n.PackageDir()))\n\t\tfor _, tmpl := range Templates {\n\t\t\tb := bytes.NewBuffer(nil)\n\t\t\tif err := templates.ExecuteTemplate(b, tmpl.Name, n); err != nil {\n\t\t\t\treturn fmt.Errorf(\"execute template %q: %w\", tmpl.Name, err)\n\t\t\t}\n\t\t\tassets.add(filepath.Join(g.Config.Target, tmpl.Format(n)), b.Bytes())\n\t\t}\n\t}\n\tfor _, tmpl := range append(GraphTemplates, external...) {\n\t\tif tmpl.Skip != nil && tmpl.Skip(g) {\n\t\t\tcontinue\n\t\t}\n\t\tif dir := filepath.Dir(tmpl.Format); dir != \".\" {\n\t\t\tassets.addDir(filepath.Join(g.Config.Target, dir))\n\t\t}\n\t\tb := bytes.NewBuffer(nil)\n\t\tif err := templates.ExecuteTemplate(b, tmpl.Name, g); err != nil {\n\t\t\treturn fmt.Errorf(\"execute template %q: %w\", tmpl.Name, err)\n\t\t}\n\t\tassets.add(filepath.Join(g.Config.Target, tmpl.Format), b.Bytes())\n\t}\n\tfor _, f := range AllFeatures {\n\t\tif f.cleanup == nil || g.featureEnabled(f) {\n\t\t\tcontinue\n\t\t}\n\t\tif err := f.cleanup(g.Config); err != nil {\n\t\t\treturn fmt.Errorf(\"cleanup %q feature assets: %w\", f.Name, err)\n\t\t}\n\t}\n\t// Write and format assets only if template execution\n\t// finished successfully.\n\tif err := assets.write(); err != nil {\n\t\treturn err\n\t}\n\t// cleanup assets that are not needed anymore.\n\tcleanOldNodes(assets, g.Config.Target)\n\t// We can't run \"imports\" on files when the state is not completed.\n\t// Because, \"goimports\" will drop undefined package. Therefore, it\n\t// is suspended to the end of the writing.\n\treturn assets.format()\n}", "func (t *T) Do(ctx context.Context) error {\n\terrs := errors.M{}\n\tinterfaces, err := listPackagesOrSpecs(ctx, t.interfacePackages)\n\terrs.Append(err)\n\tfunctions, err := listPackagesOrSpecs(ctx, t.functionPackages)\n\terrs.Append(err)\n\tvar packages []string\n\tif len(t.implementationPackages) > 0 {\n\t\tpackages, err = listPackages(ctx, t.implementationPackages)\n\t\terrs.Append(err)\n\t}\n\tif err := errs.Err(); err != nil {\n\t\treturn err\n\t}\n\n\tpackages = dedup(packages)\n\tallPackages, err := packagesToLoad(ctx, interfaces, functions, packages)\n\tif err != nil {\n\t\treturn err\n\t}\n\tcomments := dedup(t.commentExpressions)\n\tif err := t.loader.loadPaths(allPackages, t.options.tests); err != nil {\n\t\treturn err\n\t}\n\tif err := t.findInterfaces(ctx, interfaces); err != nil {\n\t\treturn err\n\t}\n\tgrp, ctx := errgroup.WithContext(ctx)\n\tgrp.GoContext(ctx, func() error {\n\t\treturn t.findFunctions(ctx, functions)\n\t})\n\tgrp.GoContext(ctx, func() error {\n\t\treturn t.findImplementations(ctx, packages)\n\t})\n\tgrp.GoContext(ctx, func() error {\n\t\treturn t.findComments(ctx, comments)\n\t})\n\treturn grp.Wait()\n}", "func Define(flow *faasflow.Workflow, context *faasflow.Context) (err error) {\n\n\t// Create the dag\n\tmaindag := faasflow.CreateDag()\n\n\tmaindag.AddModifier(\"n1\", debug(\"n1\"))\n\tmaindag.AddModifier(\"n2\", debug(\"n2\"))\n\tmaindag.AddModifier(\"n3\", debug(\"n3\"))\n\tmaindag.AddModifier(\"n4\", debug(\"n4\"))\n\n\tmaindag.AddVertex(\"n5\", faasflow.Aggregator(aggregator))\n\tmaindag.AddModifier(\"n5\", debug(\"n5\"))\n\n\tmaindag.AddModifier(\"n6\", debug(\"n6\"))\n\n\tmaindag.AddVertex(\"n7\", faasflow.Aggregator(aggregator))\n\tmaindag.AddModifier(\"n7\", debug(\"n7\"))\n\n\tmaindag.AddModifier(\"n8\", debug(\"n8\"))\n\tmaindag.AddModifier(\"n9\", debug(\"n9\"))\n\tmaindag.AddModifier(\"n10\", debug(\"n10\"))\n\n\tmaindag.AddVertex(\"n11\", faasflow.Aggregator(aggregator))\n\tmaindag.AddModifier(\"n11\", debug(\"n11\"))\n\n\tsubdag := faasflow.CreateDag()\n\tsubdag.AddModifier(\"n13\", debug(\"n13\"))\n\tsubdag.AddModifier(\"n14\", debug(\"n14\"))\n\n\tsuperSubDag := faasflow.CreateDag()\n\tsuperSubDag.AddModifier(\"n15.1\", debug(\"n15.1\"))\n\tsuperSubDag.AddModifier(\"n15.2\", debug(\"n15.2\"))\n\tsuperSubDag.AddModifier(\"n15.3\", debug(\"n15.3\"))\n\tsuperSubDag.AddModifier(\"n15.4\", debug(\"n15.4\"))\n\tsuperSubDag.AddVertex(\"n15.5\", faasflow.Aggregator(aggregator))\n\tsuperSubDag.AddModifier(\"n15.5\", debug(\"n15.5\"))\n\tsuperSubDag.AddEdge(\"n15.1\", \"n15.2\")\n\tsuperSubDag.AddEdge(\"n15.2\", \"n15.3\")\n\tsuperSubDag.AddEdge(\"n15.3\", \"n15.5\")\n\tsuperSubDag.AddEdge(\"n15.1\", \"n15.4\")\n\tsuperSubDag.AddEdge(\"n15.4\", \"n15.5\")\n\tsubdag.AddSubDag(\"n15\", superSubDag)\n\n\tsubdag.AddVertex(\"n16\", faasflow.Aggregator(aggregator))\n\tsubdag.AddModifier(\"n16\", debug(\"n16\"))\n\tsubdag.AddEdge(\"n13\", \"n14\")\n\tsubdag.AddEdge(\"n13\", \"n15\")\n\tsubdag.AddEdge(\"n14\", \"n16\")\n\tsubdag.AddEdge(\"n15\", \"n16\")\n\tmaindag.AddSubDag(\"n12\", subdag)\n\n\tmaindag.AddVertex(\"n17\", faasflow.Aggregator(aggregator))\n\tmaindag.AddModifier(\"n17\", debug(\"n17\"))\n\n\tmaindag.AddEdge(\"n1\", \"n2\")\n\tmaindag.AddEdge(\"n2\", \"n3\")\n\tmaindag.AddEdge(\"n2\", \"n4\")\n\tmaindag.AddEdge(\"n2\", \"n6\")\n\tmaindag.AddEdge(\"n3\", \"n5\")\n\tmaindag.AddEdge(\"n4\", \"n5\")\n\tmaindag.AddEdge(\"n5\", \"n7\")\n\tmaindag.AddEdge(\"n6\", \"n7\")\n\tmaindag.AddEdge(\"n7\", \"n17\")\n\n\tmaindag.AddEdge(\"n1\", \"n8\")\n\tmaindag.AddEdge(\"n8\", \"n9\")\n\tmaindag.AddEdge(\"n8\", \"n10\")\n\tmaindag.AddEdge(\"n9\", \"n11\")\n\tmaindag.AddEdge(\"n10\", \"n11\")\n\tmaindag.AddEdge(\"n11\", \"n17\")\n\n\tmaindag.AddEdge(\"n1\", \"n12\")\n\tmaindag.AddEdge(\"n12\", \"n17\")\n\n\terr = flow.ExecuteDag(maindag)\n\n\treturn\n}", "func (r Recipe) Traverse(ctx context.Context, parent string, fn TraverseFn) error {\n\tvar (\n\t\tinstaller Installer\n\t\terrs depErrors\n\t\tlastErr *depError\n\t)\n\n\t// Try each installer and use the one that works.\n\tfor _, installer = range r.Installers {\n\t\terr := r.tryInstaller(ctx, parent, installer, fn)\n\t\tlastErr = err\n\t\terrs = append(errs, err)\n\t\tif err == nil {\n\t\t\tbreak\n\t\t}\n\t}\n\n\tif lastErr != nil {\n\t\treturn errs\n\t}\n\n\treturn fn(installer.Runner)\n}", "func (d *NetGenerator) Generate() *graph.Graph {\n\tg := graph.NewGraph()\n\n\t// generate hosts\n\tnodeIPs := map[int]string{}\n\tgen := NewIPGenerator(d.startIP)\n\tfor i := 0; i < d.hosts; i++ {\n\t\tip := gen.NextAddress()\n\t\tnode := NewNode(ip)\n\t\tg.AddNode(node)\n\t\tnodeIPs[i] = ip\n\t}\n\n\t// generate links\n\tfor i := 0; i < d.hosts; i++ {\n\t\tfor j := 0; j < d.conns(); j++ {\n\t\t\tidx, err := nextIdx(g, i, 0, d.hosts)\n\t\t\tif err == nil {\n\t\t\t\tfrom, to := nodeIPs[i], nodeIPs[idx]\n\t\t\t\tif !g.LinkExists(from, to) {\n\t\t\t\t\tg.AddLink(from, to)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\treturn g\n}", "func topoSort(m map[string][]string) []string {\n\tvar order []string\n\tvar visited = make(map[string]bool) // aka `black`\n\tvar visiting = make(map[string]bool) // aka `grey`\n\n\tvar visitAll func(items []string)\n\n\tvisitAll = func(items []string) {\n\t\tfor _, item := range items {\n\t\t\tif !visited[item] {\n\t\t\t\tif visiting[item] {\n\t\t\t\t\tfmt.Printf(\"WARNING: cycle detected from %s\\n\", item)\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t\tvisiting[item] = true\n\n\t\t\t\tadjacent := m[item]\n\t\t\t\tif len(adjacent) > 0 {\n\t\t\t\t\tvisitAll(adjacent)\n\t\t\t\t} else {\n\t\t\t\t\tvisiting[item] = false\n\t\t\t\t}\n\n\t\t\t\tvisited[item] = true\n\t\t\t\torder = append(order, item)\n\t\t\t}\n\t\t}\n\t}\n\n\tvar keys []string // aka `white`\n\tfor key := range m {\n\t\tkeys = append(keys, key)\n\t}\n\n\tvisitAll(keys)\n\treturn order\n}", "func (ant *Ant) traverse(start world.NodeID, end world.Node) {\n\tant.previous = ant.location\n\tant.location = end.ID\n\t//route ++ end\n\tant.route = append(ant.route, end.ID)\n\t//dist += dist callback\n\tant.distTravelled += end.Distance\n\tant.world.UpdatePosition(ant.location, end.ID)\n\n}", "func TopologicalSorting(g Graph) ([]int, error) {\n\tarr := []int{}\n\tparent := make(map[int]int)\n\tstatus := make(map[int]string)\n\trecords := make(map[int]Record)\n\n\t// Initialize data\n\tfor i := 1; i <= g.N; i++ {\n\t\tstatus[i] = Undiscovered\n\t\tparent[i] = Null\n\t}\n\tt := 0\n\n\tfor i := 1; i <= g.N; i++ {\n\t\tif status[i] == Undiscovered {\n\t\t\tv, err := topologicalSorting(g, i, &t, &parent, &status, &records)\n\t\t\tif err != nil {\n\t\t\t\treturn []int{}, err\n\t\t\t}\n\t\t\tif len(v) != 0 {\n\t\t\t\tarr = append(arr, v...)\n\t\t\t}\n\t\t}\n\t}\n\n\t// Topological sorting result is a reverse order of vertices when they are marked `processed`\n\t// `arr` is a stack, reverse it\n\tfor i, j := 0, len(arr)-1; i < j; i, j = i+1, j-1 {\n\t\tarr[i], arr[j] = arr[j], arr[i]\n\t}\n\treturn arr, nil\n}", "func (g *Graph) Populate() error {\n\tfor _, o := range g.named {\n\t\tif o.Complete {\n\t\t\tcontinue\n\t\t}\n\n\t\tif err := g.populateExplicit(o); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\t// We append and modify our slice as we go along, so we don't use a standard\n\t// range loop, and do a single pass thru each object in our graph.\n\ti := 0\n\tfor {\n\t\tif i == len(g.unnamed) {\n\t\t\tbreak\n\t\t}\n\n\t\to := g.unnamed[i]\n\t\ti++\n\n\t\tif o.Complete {\n\t\t\tcontinue\n\t\t}\n\n\t\tif err := g.populateExplicit(o); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\t// A Second pass handles injecting Interface values to ensure we have created\n\t// all concrete types first.\n\tfor _, o := range g.unnamed {\n\t\tif o.Complete {\n\t\t\tcontinue\n\t\t}\n\n\t\tif err := g.populateUnnamedInterface(o); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tfor _, o := range g.named {\n\t\tif o.Complete {\n\t\t\tcontinue\n\t\t}\n\n\t\tif err := g.populateUnnamedInterface(o); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn nil\n}", "func (c *AllNodesFlaggerController) Run() error {\n\tnodes, err := kubernetes.GetNodes(c.kubeClient)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tfor _, n := range nodes {\n\t\tif n.IsFlagged() {\n\t\t\tglog.Infof(\"Found flagged nodes. Continuing with them.\")\n\t\t\treturn nil\n\t\t}\n\t}\n\n\tfor _, n := range nodes {\n\t\tglog.Infof(\"Flagging node %q\", n.ObjectMeta.Name)\n\t\terr = kubernetes.FlagNode(c.kubeClient, n)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn nil\n}", "func (gen *Generator) Generate() {\n\tdefinitions := gen.Ast.Definitions\n\n\ttmpl := gen.Template\n\tmainTemplates := gen.LangConf.Templates\n\n\tvar wait sync.WaitGroup\n\tvar nodes astNodes\n\tconnections := make(map[string]bool)\n\n\t// Gather usefull definitions\n\tfor _, def := range definitions {\n\t\tnamedef, ok := def.(namedDefinition)\n\n\t\tif ok == false {\n\t\t\tcontinue\n\t\t}\n\n\t\tnodes.Definition = append(nodes.Definition, def)\n\n\t\tif gen.LangConf.IsRoot(namedef.GetName().Value) {\n\t\t\tnodes.Root = append(nodes.Root, def)\n\t\t}\n\n\t\tobjectDef, ok := def.(*ast.ObjectDefinition)\n\t\tif ok == false {\n\t\t\tcontinue\n\t\t}\n\n\t\tnodes.Object = append(nodes.Object, def)\n\n\t\t// Find and add relay connections\n\t\tfor _, connection := range objectDef.Fields {\n\t\t\tconloc := connection.Type.GetLoc()\n\t\t\tcontype := string(conloc.Source.Body[conloc.Start:conloc.End])\n\t\t\tif strings.HasSuffix(contype, \"Connection\") {\n\t\t\t\t// if _, ok := nodes.Connection[contype]; ok == true {\n\t\t\t\tif _, ok := connections[contype]; ok == true {\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t\tcon := ConnectionDefinition{\n\t\t\t\t\tName: ast.NewName(&ast.Name{\n\t\t\t\t\t\tValue: contype,\n\t\t\t\t\t\tLoc: conloc,\n\t\t\t\t\t}),\n\t\t\t\t\tLoc: conloc,\n\t\t\t\t\tNodeType: NodeByName(gen.Ast.Definitions, strings.TrimSuffix(contype, \"Connection\")),\n\t\t\t\t}\n\t\t\t\tnodes.Definition = append(nodes.Definition, con)\n\t\t\t\tconnections[contype] = true\n\t\t\t}\n\t\t}\n\n\t\tfor _, iface := range objectDef.Interfaces {\n\t\t\tbody := string(iface.Loc.Source.Body)\n\t\t\tname := body[iface.Loc.Start:iface.Loc.End]\n\t\t\tif name == \"Node\" {\n\t\t\t\tnodes.Relay = append(nodes.Relay, def)\n\t\t\t}\n\t\t}\n\t}\n\n\tgen.Nodes = nodes\n\n\tlinecounter := make(chan int)\n\tquit := make(chan bool)\n\n\tgo func(quit chan bool, counter chan int) {\n\t\tsum := 0\n\t\tfor {\n\t\t\tselect {\n\t\t\tcase number := <-counter:\n\t\t\t\tsum += number\n\t\t\tcase <-quit:\n\t\t\t\tfmt.Println(\"Generated\", sum, \"lines of code\")\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t}(quit, linecounter)\n\n\tfor _, mainTmpl := range mainTemplates {\n\t\twait.Add(1)\n\n\t\tgo func(mainTmpl string, counter chan int) {\n\t\t\tdefer wait.Done()\n\n\t\t\tlocalTemplate, err := tmpl.Clone()\n\t\t\tif err != nil {\n\t\t\t\tpanic(err)\n\t\t\t}\n\n\t\t\tcodebuffer := &utils.SwapBuffer{}\n\t\t\tcodebuffer.SetBuffer(&OutputFileBuffer{\n\t\t\t\tBuffer: &bytes.Buffer{},\n\t\t\t})\n\n\t\t\tlocalFileFuncs := TemplateFileFuncs{\n\t\t\t\tBufferStack: &utils.Lifo{},\n\t\t\t\tSwapBuffer: codebuffer,\n\t\t\t\tLocalTemplate: localTemplate,\n\t\t\t}\n\n\t\t\tpartialfunc := func(name string, data interface{}) string {\n\t\t\t\tlocalbuffer := bytes.Buffer{}\n\t\t\t\tlocalTemplate.ExecuteTemplate(&localbuffer, name, data)\n\t\t\t\treturn localbuffer.String()\n\t\t\t}\n\n\t\t\tfileFuncsMap := template.FuncMap{\n\t\t\t\t\"startfile\": localFileFuncs.Start,\n\t\t\t\t\"endfile\": localFileFuncs.End,\n\t\t\t\t\"partial\": partialfunc,\n\t\t\t}\n\n\t\t\tlocalTemplate = localTemplate.Funcs(fileFuncsMap)\n\n\t\t\terr = localTemplate.ExecuteTemplate(codebuffer, mainTmpl, nil)\n\t\t\tif err != nil {\n\t\t\t\tpanic(err)\n\t\t\t}\n\n\t\t\tcounter <- localFileFuncs.LineNumbers()\n\n\t\t}(mainTmpl, linecounter)\n\t}\n\n\twait.Wait()\n\n\tquit <- true\n\n\t// fmt.Printf(\"Generated %d lines of code\\n\", lines)\n\n}", "func (d *DAG) DescendantsFlow(startID string, inputs []FlowResult, callback FlowCallback) ([]FlowResult, error) {\n\td.muDAG.RLock()\n\tdefer d.muDAG.RUnlock()\n\n\t// Get IDs of all descendant vertices.\n\tflowIDs, errDes := d.GetDescendants(startID)\n\tif errDes != nil {\n\t\treturn []FlowResult{}, errDes\n\t}\n\n\t// inputChannels provides for input channels for each of the descendant vertices (+ the start-vertex).\n\tinputChannels := make(map[string]chan FlowResult, len(flowIDs)+1)\n\n\t// Iterate vertex IDs and create an input channel for each of them and a single\n\t// output channel for leaves. Note, this \"pre-flight\" is needed to ensure we\n\t// really have an input channel regardless of how we traverse the tree and spawn\n\t// workers.\n\tleafCount := 0\n\tif len(flowIDs) == 0 {\n\t\tleafCount = 1\n\t}\n\tfor id := range flowIDs {\n\n\t\t// Get all parents of this vertex.\n\t\tparents, errPar := d.GetParents(id)\n\t\tif errPar != nil {\n\t\t\treturn []FlowResult{}, errPar\n\t\t}\n\n\t\t// Create a buffered input channel that has capacity for all parent results.\n\t\tinputChannels[id] = make(chan FlowResult, len(parents))\n\n\t\tif d.isLeaf(id) {\n\t\t\tleafCount += 1\n\t\t}\n\t}\n\n\t// outputChannel caries the results of leaf vertices.\n\toutputChannel := make(chan FlowResult, leafCount)\n\n\t// To also process the start vertex and to have its results being passed to its\n\t// children, add it to the vertex IDs. Also add an input channel for the start\n\t// vertex and feed the inputs to this channel.\n\tflowIDs[startID] = struct{}{}\n\tinputChannels[startID] = make(chan FlowResult, len(inputs))\n\tfor _, i := range inputs {\n\t\tinputChannels[startID] <- i\n\t}\n\n\twg := sync.WaitGroup{}\n\n\t// Iterate all vertex IDs (now incl. start vertex) and handle each worker (incl.\n\t// inputs and outputs) in a separate goroutine.\n\tfor id := range flowIDs {\n\n\t\t// Get all children of this vertex that later need to be notified. Note, we\n\t\t// collect all children before the goroutine to be able to release the read\n\t\t// lock as early as possible.\n\t\tchildren, errChildren := d.GetChildren(id)\n\t\tif errChildren != nil {\n\t\t\treturn []FlowResult{}, errChildren\n\t\t}\n\n\t\t// Remember to wait for this goroutine.\n\t\twg.Add(1)\n\n\t\tgo func(id string) {\n\n\t\t\t// Get this vertex's input channel.\n\t\t\t// Note, only concurrent read here, which is fine.\n\t\t\tc := inputChannels[id]\n\n\t\t\t// Await all parent inputs and stuff them into a slice.\n\t\t\tparentCount := cap(c)\n\t\t\tparentResults := make([]FlowResult, parentCount)\n\t\t\tfor i := 0; i < parentCount; i++ {\n\t\t\t\tparentResults[i] = <-c\n\t\t\t}\n\n\t\t\t// Execute the worker.\n\t\t\tresult, errWorker := callback(d, id, parentResults)\n\n\t\t\t// Wrap the worker's result into a FlowResult.\n\t\t\tflowResult := FlowResult{\n\t\t\t\tID: id,\n\t\t\t\tResult: result,\n\t\t\t\tError: errWorker,\n\t\t\t}\n\n\t\t\t// Send this worker's FlowResult onto all children's input channels or, if it is\n\t\t\t// a leaf (i.e. no children), send the result onto the output channel.\n\t\t\tif len(children) > 0 {\n\t\t\t\tfor child := range children {\n\t\t\t\t\tinputChannels[child] <- flowResult\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\toutputChannel <- flowResult\n\t\t\t}\n\n\t\t\t// \"Sign off\".\n\t\t\twg.Done()\n\n\t\t}(id)\n\t}\n\n\t// Wait for all go routines to finish.\n\twg.Wait()\n\n\t// Await all leaf vertex results and stuff them into a slice.\n\tresultCount := cap(outputChannel)\n\tresults := make([]FlowResult, resultCount)\n\tfor i := 0; i < resultCount; i++ {\n\t\tresults[i] = <-outputChannel\n\t}\n\n\treturn results, nil\n}", "func (d *Dialect) doRecurse(\n\tctx context.Context, doc *firestore.DocumentRef, events logical.Events,\n) error {\n\tit := doc.Collections(ctx)\n\tfor {\n\t\tcoll, err := it.Next()\n\t\tif err == iterator.Done {\n\t\t\treturn nil\n\t\t}\n\t\tif err != nil {\n\t\t\treturn errors.Wrapf(err, \"loading dynamic collections of %s\", doc.Path)\n\t\t}\n\n\t\tif _, skip := d.recurseFilter.Get(ident.New(coll.ID)); skip {\n\t\t\tcontinue\n\t\t}\n\n\t\tfork := *d\n\t\tfork.query = coll.Query\n\t\tfork.sourcePath = coll.Path\n\n\t\tif err := events.Backfill(ctx, coll.Path, &fork); err != nil {\n\t\t\treturn errors.WithMessage(err, coll.Path)\n\t\t}\n\t}\n}", "func DiscoverNetworkOverview(conn *NetworkConnection, options ...DiscoverOptionFunc) (*NetworkOverview, error) {\n\t// var allPeers []*Peer\n\n\t// channelIDMap := DiscoverChannels(conn, options...)\n\t// for channelID, endpointURL := range channelIDMap {\n\t// \ttempPeers, err := DiscoverChannelPeers(conn, endpointURL, channelID, options...)\n\t// \tif err != nil {\n\t// \t\tlogger.Infof(\"Failed discover chanel peers of endpoint %s, channel ID %s\", endpointURL, channelID)\n\t// \t} else {\n\t// \t\t// TODO to merge all peers.\n\t// \t\tallPeers = append(allPeers, tempPeers...)\n\t// \t}\n\t// }\n\n\t// logger.Infof(\"Totally found %d peers in %d channels of the network.\", len(allPeers), len(channelIDMap))\n\n\t// opt := generateOption(options...)\n\t// if opt.IsDetail {\n\t// \t// Query legder info\n\t// \tfor _, peer := range allPeers {\n\t// \t\tldgs := make(map[string]*Ledger)\n\t// \t\tfor _, channelID := range peer.Channels.StringList() {\n\t// \t\t\tldg, err := QueryLedger(conn, channelID, []string{peer.URL})\n\t// \t\t\tif err == nil {\n\t// \t\t\t\tldgs[channelID] = ldg\n\t// \t\t\t}\n\t// \t\t}\n\t// \t\tpeer.Ledgers = ldgs\n\t// \t}\n\t// }\n\n\t// return allPeers, nil\n\tpeers := []*Peer{}\n\tfor _, peer := range conn.Peers {\n\t\tpeers = append(peers, peer)\n\t}\n\tsort.SliceStable(peers, func(i, j int) bool {\n\t\tif peers[i].MSPID != peers[j].MSPID {\n\t\t\treturn peers[i].MSPID < peers[j].MSPID\n\t\t}\n\t\treturn peers[i].Name < peers[j].Name\n\t})\n\n\treturn &NetworkOverview{\n\t\tPeers: peers,\n\t\tChannelOrderers: conn.ChannelOrderers,\n\t\tChannelLedgers: conn.ChannelLedgers,\n\t\tChannelChainCodes: conn.ChannelChaincodes,\n\t}, nil\n}", "func resolveDeps(m meta.RESTMapper, objects []unstructuredv1.Unstructured, uids []types.UID, depsIsDependencies bool) (NodeMap, error) {\n\tif len(uids) == 0 {\n\t\treturn NodeMap{}, nil\n\t}\n\t// Create global node maps of all objects, one mapped by node UIDs & the other\n\t// mapped by node keys. This step also helps deduplicate the list of provided\n\t// objects\n\tglobalMapByUID := map[types.UID]*Node{}\n\tglobalMapByKey := map[ObjectReferenceKey]*Node{}\n\tfor ix, o := range objects {\n\t\tgvk := o.GroupVersionKind()\n\t\tm, err := m.RESTMapping(gvk.GroupKind(), gvk.Version)\n\t\tif err != nil {\n\t\t\tklog.V(4).Infof(\"Failed to map resource \\\"%s\\\" to GVR\", gvk)\n\t\t\treturn nil, err\n\t\t}\n\t\tns := o.GetNamespace()\n\t\tnode := Node{\n\t\t\tUnstructured: &objects[ix],\n\t\t\tUID: o.GetUID(),\n\t\t\tName: o.GetName(),\n\t\t\tNamespace: ns,\n\t\t\tNamespaced: ns != \"\",\n\t\t\tGroup: m.Resource.Group,\n\t\t\tVersion: m.Resource.Version,\n\t\t\tKind: m.GroupVersionKind.Kind,\n\t\t\tResource: m.Resource.Resource,\n\t\t\tOwnerReferences: o.GetOwnerReferences(),\n\t\t\tDependencies: map[types.UID]RelationshipSet{},\n\t\t\tDependents: map[types.UID]RelationshipSet{},\n\t\t}\n\t\tuid, key := node.UID, node.GetObjectReferenceKey()\n\t\tif n, ok := globalMapByUID[uid]; ok {\n\t\t\tklog.V(4).Infof(\"Duplicated %s.%s resource \\\"%s\\\" in namespace \\\"%s\\\"\", n.Kind, n.Group, n.Name, n.Namespace)\n\t\t}\n\t\tglobalMapByUID[uid] = &node\n\t\tglobalMapByKey[key] = &node\n\n\t\tif node.Group == corev1.GroupName && node.Kind == \"Node\" {\n\t\t\t// Node events sent by the Kubelet uses the node's name as the\n\t\t\t// ObjectReference UID, so we include them as keys in our global map to\n\t\t\t// support lookup by nodename\n\t\t\tglobalMapByUID[types.UID(node.Name)] = &node\n\t\t\t// Node events sent by the kube-proxy uses the node's hostname as the\n\t\t\t// ObjectReference UID, so we include them as keys in our global map to\n\t\t\t// support lookup by hostname\n\t\t\tif hostname, ok := o.GetLabels()[corev1.LabelHostname]; ok {\n\t\t\t\tglobalMapByUID[types.UID(hostname)] = &node\n\t\t\t}\n\t\t}\n\t}\n\n\tresolveLabelSelectorToNodes := func(o ObjectLabelSelector) []*Node {\n\t\tvar result []*Node\n\t\tfor _, n := range globalMapByUID {\n\t\t\tif n.Group == o.Group && n.Kind == o.Kind && n.Namespace == o.Namespace {\n\t\t\t\tif ok := o.Selector.Matches(labels.Set(n.GetLabels())); ok {\n\t\t\t\t\tresult = append(result, n)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn result\n\t}\n\tresolveSelectorToNodes := func(o ObjectSelector) []*Node {\n\t\tvar result []*Node\n\t\tfor _, n := range globalMapByUID {\n\t\t\tif n.Group == o.Group && n.Kind == o.Kind {\n\t\t\t\tif len(o.Namespaces) == 0 || o.Namespaces.Has(n.Namespace) {\n\t\t\t\t\tresult = append(result, n)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn result\n\t}\n\tupdateRelationships := func(node *Node, rmap *RelationshipMap) {\n\t\tfor k, rset := range rmap.DependenciesByRef {\n\t\t\tif n, ok := globalMapByKey[k]; ok {\n\t\t\t\tfor r := range rset {\n\t\t\t\t\tnode.AddDependency(n.UID, r)\n\t\t\t\t\tn.AddDependent(node.UID, r)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tfor k, rset := range rmap.DependentsByRef {\n\t\t\tif n, ok := globalMapByKey[k]; ok {\n\t\t\t\tfor r := range rset {\n\t\t\t\t\tn.AddDependency(node.UID, r)\n\t\t\t\t\tnode.AddDependent(n.UID, r)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tfor k, rset := range rmap.DependenciesByLabelSelector {\n\t\t\tif ols, ok := rmap.ObjectLabelSelectors[k]; ok {\n\t\t\t\tfor _, n := range resolveLabelSelectorToNodes(ols) {\n\t\t\t\t\tfor r := range rset {\n\t\t\t\t\t\tnode.AddDependency(n.UID, r)\n\t\t\t\t\t\tn.AddDependent(node.UID, r)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tfor k, rset := range rmap.DependentsByLabelSelector {\n\t\t\tif ols, ok := rmap.ObjectLabelSelectors[k]; ok {\n\t\t\t\tfor _, n := range resolveLabelSelectorToNodes(ols) {\n\t\t\t\t\tfor r := range rset {\n\t\t\t\t\t\tn.AddDependency(node.UID, r)\n\t\t\t\t\t\tnode.AddDependent(n.UID, r)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tfor k, rset := range rmap.DependenciesBySelector {\n\t\t\tif os, ok := rmap.ObjectSelectors[k]; ok {\n\t\t\t\tfor _, n := range resolveSelectorToNodes(os) {\n\t\t\t\t\tfor r := range rset {\n\t\t\t\t\t\tnode.AddDependency(n.UID, r)\n\t\t\t\t\t\tn.AddDependent(node.UID, r)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tfor k, rset := range rmap.DependentsBySelector {\n\t\t\tif os, ok := rmap.ObjectSelectors[k]; ok {\n\t\t\t\tfor _, n := range resolveSelectorToNodes(os) {\n\t\t\t\t\tfor r := range rset {\n\t\t\t\t\t\tn.AddDependency(node.UID, r)\n\t\t\t\t\t\tnode.AddDependent(n.UID, r)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tfor uid, rset := range rmap.DependenciesByUID {\n\t\t\tif n, ok := globalMapByUID[uid]; ok {\n\t\t\t\tfor r := range rset {\n\t\t\t\t\tnode.AddDependency(n.UID, r)\n\t\t\t\t\tn.AddDependent(node.UID, r)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tfor uid, rset := range rmap.DependentsByUID {\n\t\t\tif n, ok := globalMapByUID[uid]; ok {\n\t\t\t\tfor r := range rset {\n\t\t\t\t\tn.AddDependency(node.UID, r)\n\t\t\t\t\tnode.AddDependent(n.UID, r)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\t// Populate dependencies & dependents based on Owner-Dependent relationships\n\tfor _, node := range globalMapByUID {\n\t\tfor _, ref := range node.OwnerReferences {\n\t\t\tif n, ok := globalMapByUID[ref.UID]; ok {\n\t\t\t\tif ref.Controller != nil && *ref.Controller {\n\t\t\t\t\tnode.AddDependency(n.UID, RelationshipControllerRef)\n\t\t\t\t\tn.AddDependent(node.UID, RelationshipControllerRef)\n\t\t\t\t}\n\t\t\t\tnode.AddDependency(n.UID, RelationshipOwnerRef)\n\t\t\t\tn.AddDependent(node.UID, RelationshipOwnerRef)\n\t\t\t}\n\t\t}\n\t}\n\n\tvar rmap *RelationshipMap\n\tvar err error\n\tfor _, node := range globalMapByUID {\n\t\tswitch {\n\t\t// Populate dependencies & dependents based on PersistentVolume relationships\n\t\tcase node.Group == corev1.GroupName && node.Kind == \"PersistentVolume\":\n\t\t\trmap, err = getPersistentVolumeRelationships(node)\n\t\t\tif err != nil {\n\t\t\t\tklog.V(4).Infof(\"Failed to get relationships for persistentvolume named \\\"%s\\\": %s\", node.Name, err)\n\t\t\t\tcontinue\n\t\t\t}\n\t\t// Populate dependencies & dependents based on PersistentVolumeClaim relationships\n\t\tcase node.Group == corev1.GroupName && node.Kind == \"PersistentVolumeClaim\":\n\t\t\trmap, err = getPersistentVolumeClaimRelationships(node)\n\t\t\tif err != nil {\n\t\t\t\tklog.V(4).Infof(\"Failed to get relationships for persistentvolumeclaim named \\\"%s\\\" in namespace \\\"%s\\\": %s\", node.Name, node.Namespace, err)\n\t\t\t\tcontinue\n\t\t\t}\n\t\t// Populate dependencies & dependents based on Pod relationships\n\t\tcase node.Group == corev1.GroupName && node.Kind == \"Pod\":\n\t\t\trmap, err = getPodRelationships(node)\n\t\t\tif err != nil {\n\t\t\t\tklog.V(4).Infof(\"Failed to get relationships for pod named \\\"%s\\\" in namespace \\\"%s\\\": %s\", node.Name, node.Namespace, err)\n\t\t\t\tcontinue\n\t\t\t}\n\t\t// Populate dependencies & dependents based on Service relationships\n\t\tcase node.Group == corev1.GroupName && node.Kind == \"Service\":\n\t\t\trmap, err = getServiceRelationships(node)\n\t\t\tif err != nil {\n\t\t\t\tklog.V(4).Infof(\"Failed to get relationships for service named \\\"%s\\\" in namespace \\\"%s\\\": %s\", node.Name, node.Namespace, err)\n\t\t\t\tcontinue\n\t\t\t}\n\t\t// Populate dependencies & dependents based on ServiceAccount relationships\n\t\tcase node.Group == corev1.GroupName && node.Kind == \"ServiceAccount\":\n\t\t\trmap, err = getServiceAccountRelationships(node)\n\t\t\tif err != nil {\n\t\t\t\tklog.V(4).Infof(\"Failed to get relationships for serviceaccount named \\\"%s\\\" in namespace \\\"%s\\\": %s\", node.Name, node.Namespace, err)\n\t\t\t\tcontinue\n\t\t\t}\n\t\t// Populate dependencies & dependents based on PodSecurityPolicy relationships\n\t\tcase node.Group == policyv1beta1.GroupName && node.Kind == \"PodSecurityPolicy\":\n\t\t\trmap, err = getPodSecurityPolicyRelationships(node)\n\t\t\tif err != nil {\n\t\t\t\tklog.V(4).Infof(\"Failed to get relationships for podsecuritypolicy named \\\"%s\\\": %s\", node.Name, err)\n\t\t\t\tcontinue\n\t\t\t}\n\t\t// Populate dependencies & dependents based on PodDisruptionBudget relationships\n\t\tcase node.Group == policyv1.GroupName && node.Kind == \"PodDisruptionBudget\":\n\t\t\trmap, err = getPodDisruptionBudgetRelationships(node)\n\t\t\tif err != nil {\n\t\t\t\tklog.V(4).Infof(\"Failed to get relationships for poddisruptionbudget named \\\"%s\\\": %s\", node.Name, err)\n\t\t\t\tcontinue\n\t\t\t}\n\t\t// Populate dependencies & dependents based on MutatingWebhookConfiguration relationships\n\t\tcase node.Group == admissionregistrationv1.GroupName && node.Kind == \"MutatingWebhookConfiguration\":\n\t\t\trmap, err = getMutatingWebhookConfigurationRelationships(node)\n\t\t\tif err != nil {\n\t\t\t\tklog.V(4).Infof(\"Failed to get relationships for mutatingwebhookconfiguration named \\\"%s\\\": %s\", node.Name, err)\n\t\t\t\tcontinue\n\t\t\t}\n\t\t// Populate dependencies & dependents based on ValidatingWebhookConfiguration relationships\n\t\tcase node.Group == admissionregistrationv1.GroupName && node.Kind == \"ValidatingWebhookConfiguration\":\n\t\t\trmap, err = getValidatingWebhookConfigurationRelationships(node)\n\t\t\tif err != nil {\n\t\t\t\tklog.V(4).Infof(\"Failed to get relationships for validatingwebhookconfiguration named \\\"%s\\\": %s\", node.Name, err)\n\t\t\t\tcontinue\n\t\t\t}\n\t\t// Populate dependencies & dependents based on APIService relationships\n\t\tcase node.Group == apiregistrationv1.GroupName && node.Kind == \"APIService\":\n\t\t\trmap, err = getAPIServiceRelationships(node)\n\t\t\tif err != nil {\n\t\t\t\tklog.V(4).Infof(\"Failed to get relationships for apiservice named \\\"%s\\\": %s\", node.Name, err)\n\t\t\t\tcontinue\n\t\t\t}\n\t\t// Populate dependencies & dependents based on Event relationships\n\t\tcase (node.Group == eventsv1.GroupName || node.Group == corev1.GroupName) && node.Kind == \"Event\":\n\t\t\trmap, err = getEventRelationships(node)\n\t\t\tif err != nil {\n\t\t\t\tklog.V(4).Infof(\"Failed to get relationships for event named \\\"%s\\\" in namespace \\\"%s\\\": %s\", node.Name, node.Namespace, err)\n\t\t\t\tcontinue\n\t\t\t}\n\t\t// Populate dependencies & dependents based on Ingress relationships\n\t\tcase (node.Group == networkingv1.GroupName || node.Group == extensionsv1beta1.GroupName) && node.Kind == \"Ingress\":\n\t\t\trmap, err = getIngressRelationships(node)\n\t\t\tif err != nil {\n\t\t\t\tklog.V(4).Infof(\"Failed to get relationships for ingress named \\\"%s\\\" in namespace \\\"%s\\\": %s\", node.Name, node.Namespace, err)\n\t\t\t\tcontinue\n\t\t\t}\n\t\t// Populate dependencies & dependents based on IngressClass relationships\n\t\tcase node.Group == networkingv1.GroupName && node.Kind == \"IngressClass\":\n\t\t\trmap, err = getIngressClassRelationships(node)\n\t\t\tif err != nil {\n\t\t\t\tklog.V(4).Infof(\"Failed to get relationships for ingressclass named \\\"%s\\\": %s\", node.Name, err)\n\t\t\t\tcontinue\n\t\t\t}\n\t\t// Populate dependencies & dependents based on NetworkPolicy relationships\n\t\tcase node.Group == networkingv1.GroupName && node.Kind == \"NetworkPolicy\":\n\t\t\trmap, err = getNetworkPolicyRelationships(node)\n\t\t\tif err != nil {\n\t\t\t\tklog.V(4).Infof(\"Failed to get relationships for networkpolicy named \\\"%s\\\": %s\", node.Name, err)\n\t\t\t\tcontinue\n\t\t\t}\n\t\t// Populate dependencies & dependents based on RuntimeClass relationships\n\t\tcase node.Group == nodev1.GroupName && node.Kind == \"RuntimeClass\":\n\t\t\trmap, err = getRuntimeClassRelationships(node)\n\t\t\tif err != nil {\n\t\t\t\tklog.V(4).Infof(\"Failed to get relationships for runtimeclass named \\\"%s\\\": %s\", node.Name, err)\n\t\t\t\tcontinue\n\t\t\t}\n\t\t// Populate dependencies & dependents based on ClusterRole relationships\n\t\tcase node.Group == rbacv1.GroupName && node.Kind == \"ClusterRole\":\n\t\t\trmap, err = getClusterRoleRelationships(node)\n\t\t\tif err != nil {\n\t\t\t\tklog.V(4).Infof(\"Failed to get relationships for clusterrole named \\\"%s\\\": %s\", node.Name, err)\n\t\t\t\tcontinue\n\t\t\t}\n\t\t// Populate dependencies & dependents based on ClusterRoleBinding relationships\n\t\tcase node.Group == rbacv1.GroupName && node.Kind == \"ClusterRoleBinding\":\n\t\t\trmap, err = getClusterRoleBindingRelationships(node)\n\t\t\tif err != nil {\n\t\t\t\tklog.V(4).Infof(\"Failed to get relationships for clusterrolebinding named \\\"%s\\\": %s\", node.Name, err)\n\t\t\t\tcontinue\n\t\t\t}\n\t\t// Populate dependencies & dependents based on Role relationships\n\t\tcase node.Group == rbacv1.GroupName && node.Kind == \"Role\":\n\t\t\trmap, err = getRoleRelationships(node)\n\t\t\tif err != nil {\n\t\t\t\tklog.V(4).Infof(\"Failed to get relationships for role named \\\"%s\\\" in namespace \\\"%s\\\": %s: %s\", node.Name, node.Namespace, err)\n\t\t\t\tcontinue\n\t\t\t}\n\t\t// Populate dependencies & dependents based on RoleBinding relationships\n\t\tcase node.Group == rbacv1.GroupName && node.Kind == \"RoleBinding\":\n\t\t\trmap, err = getRoleBindingRelationships(node)\n\t\t\tif err != nil {\n\t\t\t\tklog.V(4).Infof(\"Failed to get relationships for rolebinding named \\\"%s\\\" in namespace \\\"%s\\\": %s: %s\", node.Name, node.Namespace, err)\n\t\t\t\tcontinue\n\t\t\t}\n\t\t// Populate dependencies & dependents based on CSIStorageCapacity relationships\n\t\tcase node.Group == storagev1beta1.GroupName && node.Kind == \"CSIStorageCapacity\":\n\t\t\trmap, err = getCSIStorageCapacityRelationships(node)\n\t\t\tif err != nil {\n\t\t\t\tklog.V(4).Infof(\"Failed to get relationships for csistoragecapacity named \\\"%s\\\": %s: %s\", node.Name, err)\n\t\t\t\tcontinue\n\t\t\t}\n\t\t// Populate dependencies & dependents based on CSINode relationships\n\t\tcase node.Group == storagev1.GroupName && node.Kind == \"CSINode\":\n\t\t\trmap, err = getCSINodeRelationships(node)\n\t\t\tif err != nil {\n\t\t\t\tklog.V(4).Infof(\"Failed to get relationships for csinode named \\\"%s\\\": %s: %s\", node.Name, err)\n\t\t\t\tcontinue\n\t\t\t}\n\t\t// Populate dependencies & dependents based on StorageClass relationships\n\t\tcase node.Group == storagev1.GroupName && node.Kind == \"StorageClass\":\n\t\t\trmap, err = getStorageClassRelationships(node)\n\t\t\tif err != nil {\n\t\t\t\tklog.V(4).Infof(\"Failed to get relationships for storageclass named \\\"%s\\\": %s: %s\", node.Name, err)\n\t\t\t\tcontinue\n\t\t\t}\n\t\t// Populate dependencies & dependents based on VolumeAttachment relationships\n\t\tcase node.Group == storagev1.GroupName && node.Kind == \"VolumeAttachment\":\n\t\t\trmap, err = getVolumeAttachmentRelationships(node)\n\t\t\tif err != nil {\n\t\t\t\tklog.V(4).Infof(\"Failed to get relationships for volumeattachment named \\\"%s\\\": %s: %s\", node.Name, err)\n\t\t\t\tcontinue\n\t\t\t}\n\t\tdefault:\n\t\t\tcontinue\n\t\t}\n\t\tupdateRelationships(node, rmap)\n\t}\n\n\t// Create submap containing the provided objects & either their dependencies\n\t// or dependents from the global map\n\tvar depth uint\n\tnodeMap, uidQueue, uidSet := NodeMap{}, []types.UID{}, map[types.UID]struct{}{}\n\tfor _, uid := range uids {\n\t\tif node := globalMapByUID[uid]; node != nil {\n\t\t\tnodeMap[uid] = node\n\t\t\tuidQueue = append(uidQueue, uid)\n\t\t}\n\t}\n\tdepth, uidQueue = 0, append(uidQueue, \"\")\n\tfor {\n\t\tif len(uidQueue) <= 1 {\n\t\t\tbreak\n\t\t}\n\t\tuid := uidQueue[0]\n\t\tif uid == \"\" {\n\t\t\tdepth, uidQueue = depth+1, append(uidQueue[1:], \"\")\n\t\t\tcontinue\n\t\t}\n\n\t\t// Guard against possible cycles\n\t\tif _, ok := uidSet[uid]; ok {\n\t\t\tuidQueue = uidQueue[1:]\n\t\t\tcontinue\n\t\t} else {\n\t\t\tuidSet[uid] = struct{}{}\n\t\t}\n\n\t\tif node := nodeMap[uid]; node != nil {\n\t\t\t// Allow nodes to keep the smallest depth. For example, if a node has a\n\t\t\t// depth of 1 & 7 in the relationship tree, we keep 1 so that when\n\t\t\t// printing the tree with a depth of 2, the node will still be printed\n\t\t\tif node.Depth == 0 || depth < node.Depth {\n\t\t\t\tnode.Depth = depth\n\t\t\t}\n\t\t\tdeps := node.GetDeps(depsIsDependencies)\n\t\t\tdepUIDs, ix := make([]types.UID, len(deps)), 0\n\t\t\tfor depUID := range deps {\n\t\t\t\tnodeMap[depUID] = globalMapByUID[depUID]\n\t\t\t\tdepUIDs[ix] = depUID\n\t\t\t\tix++\n\t\t\t}\n\t\t\tuidQueue = append(uidQueue[1:], depUIDs...)\n\t\t}\n\t}\n\n\tklog.V(4).Infof(\"Resolved %d deps for %d objects\", len(nodeMap)-1, len(uids))\n\treturn nodeMap, nil\n}", "func ProcessGraph(ctx context.Context, sg *SubGraph, taskQuery *task.Query, rch chan error) {\n\tvar err error\n\tif taskQuery != nil {\n\t\tresult, err := worker.ProcessTaskOverNetwork(ctx, taskQuery)\n\t\tif err != nil {\n\t\t\tx.TraceError(ctx, x.Wrapf(err, \"Error while processing task\"))\n\t\t\trch <- err\n\t\t\treturn\n\t\t}\n\t\tsg.uidMatrix = result.UidMatrix\n\t\tsg.values = result.Values\n\t\tif len(sg.values) > 0 {\n\t\t\tv := sg.values[0]\n\t\t\tx.Trace(ctx, \"Sample value for attr: %v Val: %v\", sg.Attr, string(v.Val))\n\t\t}\n\t\tsg.counts = result.Counts\n\t}\n\n\tif sg.Params.DoCount {\n\t\tx.Trace(ctx, \"Zero uids. Only count requested\")\n\t\trch <- nil\n\t\treturn\n\t}\n\n\tsg.DestUIDs = algo.MergeSortedLists(sg.uidMatrix)\n\tif err != nil {\n\t\tx.TraceError(ctx, x.Wrapf(err, \"Error while processing task\"))\n\t\trch <- err\n\t\treturn\n\t}\n\n\tif len(sg.DestUIDs.Uids) == 0 {\n\t\t// Looks like we're done here. Be careful with nil srcUIDs!\n\t\tx.Trace(ctx, \"Zero uids. Num attr children: %v\", len(sg.Children))\n\t\trch <- nil\n\t\treturn\n\t}\n\n\t// Apply filters if any.\n\tif err = sg.applyFilter(ctx); err != nil {\n\t\trch <- err\n\t\treturn\n\t}\n\n\tif len(sg.Params.Order) == 0 {\n\t\t// There is no ordering. Just apply pagination and return.\n\t\tif err = sg.applyPagination(ctx); err != nil {\n\t\t\trch <- err\n\t\t\treturn\n\t\t}\n\t} else {\n\t\t// We need to sort first before pagination.\n\t\tif err = sg.applyOrderAndPagination(ctx); err != nil {\n\t\t\trch <- err\n\t\t\treturn\n\t\t}\n\t}\n\n\tvar processed, leftToProcess []*SubGraph\n\t// First iterate over the value nodes and check for validity.\n\tchildChan := make(chan error, len(sg.Children))\n\tfor i := 0; i < len(sg.Children); i++ {\n\t\tchild := sg.Children[i]\n\t\tchild.SrcUIDs = sg.DestUIDs // Make the connection.\n\t\tif child.Params.AttrType == nil || child.Params.AttrType.IsScalar() {\n\t\t\tprocessed = append(processed, child)\n\t\t\ttaskQuery := createTaskQuery(child, sg.DestUIDs, nil, nil)\n\t\t\tgo ProcessGraph(ctx, child, taskQuery, childChan)\n\t\t} else {\n\t\t\tleftToProcess = append(leftToProcess, child)\n\t\t\tchildChan <- nil\n\t\t}\n\t}\n\n\t// Now get all the results back.\n\tfor i := 0; i < len(sg.Children); i++ {\n\t\tselect {\n\t\tcase err = <-childChan:\n\t\t\tx.Trace(ctx, \"Reply from child. Index: %v Attr: %v\", i, sg.Children[i].Attr)\n\t\t\tif err != nil {\n\t\t\t\tx.TraceError(ctx, x.Wrapf(err, \"Error while processing child task\"))\n\t\t\t\trch <- err\n\t\t\t\treturn\n\t\t\t}\n\t\tcase <-ctx.Done():\n\t\t\tx.TraceError(ctx, x.Wrapf(ctx.Err(), \"Context done before full execution\"))\n\t\t\trch <- ctx.Err()\n\t\t\treturn\n\t\t}\n\t}\n\n\t// If all the child nodes are processed, return.\n\tif len(leftToProcess) == 0 {\n\t\trch <- nil\n\t\treturn\n\t}\n\n\tsgObj, ok := schema.TypeOf(sg.Attr).(types.Object)\n\tinvalidUids := make(map[uint64]bool)\n\t// Check the results of the child and eliminate uids without all results.\n\tif ok {\n\t\tfor _, node := range processed {\n\t\t\tif _, present := sgObj.Fields[node.Attr]; !present {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tfor i, uid := range sg.DestUIDs.Uids {\n\t\t\t\ttv := node.values[i]\n\t\t\t\tvalBytes := tv.Val\n\t\t\t\tv, err := getValue(tv)\n\t\t\t\tif err != nil || bytes.Equal(valBytes, nil) {\n\t\t\t\t\t// The value is not as requested in schema.\n\t\t\t\t\tinvalidUids[uid] = true\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\n\t\t\t\t// type assertion for scalar type values.\n\t\t\t\tif !node.Params.AttrType.IsScalar() {\n\t\t\t\t\trch <- x.Errorf(\"Fatal mistakes in type.\")\n\t\t\t\t}\n\n\t\t\t\t// Check if compatible with schema type.\n\t\t\t\tschemaType := node.Params.AttrType.(types.Scalar)\n\t\t\t\tif _, err = schemaType.Convert(v); err != nil {\n\t\t\t\t\tinvalidUids[uid] = true\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\t// Filter out the invalid UIDs.\n\talgo.ApplyFilter(sg.DestUIDs, func(uid uint64, idx int) bool {\n\t\treturn !invalidUids[uid]\n\t})\n\n\t// Now process next level with valid UIDs.\n\tchildChan = make(chan error, len(leftToProcess))\n\tfor _, child := range leftToProcess {\n\t\ttaskQuery := createTaskQuery(child, sg.DestUIDs, nil, nil)\n\t\tgo ProcessGraph(ctx, child, taskQuery, childChan)\n\t}\n\n\t// Now get the results back.\n\tfor i := 0; i < len(leftToProcess); i++ {\n\t\tselect {\n\t\tcase err = <-childChan:\n\t\t\tx.Trace(ctx, \"Reply from child. Index: %v Attr: %v\", i, sg.Children[i].Attr)\n\t\t\tif err != nil {\n\t\t\t\tx.Trace(ctx, \"Error while processing child task: %v\", err)\n\t\t\t\trch <- err\n\t\t\t\treturn\n\t\t\t}\n\t\tcase <-ctx.Done():\n\t\t\tx.Trace(ctx, \"Context done before full execution: %v\", ctx.Err())\n\t\t\trch <- ctx.Err()\n\t\t\treturn\n\t\t}\n\t}\n\n\trch <- nil\n}", "func DFS(graph map[int]*Vertex, i *Vertex, pass int) {\n\n\ti.Explored = true\n\n\tif pass == 2 {\n\t\ts.AddMember(i.ID)\n\t}\n\n\tfor _, v := range i.Edges {\n\n\t\tvertex := graph[v]\n\n\t\tif !vertex.Explored {\n\t\t\tDFS(graph, vertex, pass)\n\t\t}\n\t}\n\n\tif pass == 1 {\n\t\tt++\n\t\tmagicalOrderMap[t] = i.ID\n\t}\n\n}", "func testDFS() {\n\tg := NewGraph(4)\n\tg.AddEdge(0, 1)\n\tg.AddEdge(0, 2)\n\tg.AddEdge(1, 2)\n\tg.AddEdge(2, 0)\n\tg.AddEdge(2, 3)\n\tg.AddEdge(3, 3)\n\tlog.Printf(\"Graph %v\", g.String())\n\tg.RecursiveDFS(0)\n}", "func (s *Server) loopServiceDiscovery() {\n\ts.Info(\"Starting DNS service discovery for nethealth pod.\")\n\tticker := s.clock.NewTicker(dnsDiscoveryInterval)\n\tdefer ticker.Stop()\n\tquery := s.config.ServiceDiscoveryQuery\n\n\tpreviousNames := []string{}\n\n\tfor {\n\t\t<-ticker.Chan()\n\n\t\ts.Debugf(\"Querying %v for service discovery\", query)\n\t\tnames, err := net.LookupHost(query)\n\t\tif err != nil {\n\t\t\ts.WithError(err).WithField(\"query\", query).Error(\"Error querying service discovery.\")\n\t\t\tcontinue\n\t\t}\n\n\t\tsort.Strings(names)\n\t\tif reflect.DeepEqual(names, previousNames) {\n\t\t\tcontinue\n\t\t}\n\t\tpreviousNames = names\n\t\ts.Info(\"Triggering peer resync due to service discovery change\")\n\n\t\tselect {\n\t\tcase s.triggerResync <- true:\n\t\tdefault:\n\t\t\t// Don't block\n\t\t}\n\t}\n}", "func traverse(tr []Node) (sol []Edge) {\r\n\tc := make(chan *Node)\r\n\tdefer close(c)\r\n\tgo trav(&tr[0], c)\r\n\r\n\tvar distSum float64 = 0\r\n\tprev := <-c\r\n\tsol = append(sol, Edge{prev.data.name, 0})\r\n\r\n\tfor i := 2; i < len(tr); i++ {\r\n\t\tcurr := <-c\r\n\t\tdistSum += dist(prev.data, curr.data)\r\n\t\tsol = append(sol, Edge{curr.data.name, distSum})\r\n\t\tprev = curr\r\n\t}\r\n\r\n\treturn sol\r\n}", "func (v *coveredPathsVisitor) Accept(d *DOM) {\n\tfor _, s := range d.Scenarios {\n\t\tif err, ok := s.accept(v).(error); ok {\n\t\t\tfmt.Println(err)\n\t\t}\n\t}\n\tfor _, s := range d.SubScenarios {\n\t\tif err, ok := s.accept(v).(error); ok {\n\t\t\tfmt.Println(err)\n\t\t}\n\t}\n}", "func (g AdjacencyList) DepthFirst(start NI, options ...TraverseOption) {\n\tcf := &config{start: start}\n\tfor _, o := range options {\n\t\to(cf)\n\t}\n\tb := cf.visBits\n\tif b == nil {\n\t\tn := bits.New(len(g))\n\t\tb = &n\n\t} else if b.Bit(int(cf.start)) != 0 {\n\t\treturn\n\t}\n\tif cf.pathBits != nil {\n\t\tcf.pathBits.ClearAll()\n\t}\n\tvar df func(NI) bool\n\tdf = func(n NI) bool {\n\t\tb.SetBit(int(n), 1)\n\t\tif cf.pathBits != nil {\n\t\t\tcf.pathBits.SetBit(int(n), 1)\n\t\t}\n\n\t\tif cf.nodeVisitor != nil {\n\t\t\tcf.nodeVisitor(n)\n\t\t}\n\t\tif cf.okNodeVisitor != nil {\n\t\t\tif !cf.okNodeVisitor(n) {\n\t\t\t\treturn false\n\t\t\t}\n\t\t}\n\n\t\tif cf.rand == nil {\n\t\t\tfor x, to := range g[n] {\n\t\t\t\tif cf.arcVisitor != nil {\n\t\t\t\t\tcf.arcVisitor(n, x)\n\t\t\t\t}\n\t\t\t\tif cf.okArcVisitor != nil {\n\t\t\t\t\tif !cf.okArcVisitor(n, x) {\n\t\t\t\t\t\treturn false\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif b.Bit(int(to)) != 0 {\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t\tif !df(to) {\n\t\t\t\t\treturn false\n\t\t\t\t}\n\t\t\t}\n\t\t} else {\n\t\t\tto := g[n]\n\t\t\tfor _, x := range cf.rand.Perm(len(to)) {\n\t\t\t\tif cf.arcVisitor != nil {\n\t\t\t\t\tcf.arcVisitor(n, x)\n\t\t\t\t}\n\t\t\t\tif cf.okArcVisitor != nil {\n\t\t\t\t\tif !cf.okArcVisitor(n, x) {\n\t\t\t\t\t\treturn false\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif b.Bit(int(to[x])) != 0 {\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t\tif !df(to[x]) {\n\t\t\t\t\treturn false\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tif cf.pathBits != nil {\n\t\t\tcf.pathBits.SetBit(int(n), 0)\n\t\t}\n\t\treturn true\n\t}\n\tdf(cf.start)\n}", "func (d *dataplane) Reconcile(ctx context.Context, object controllers.Object) (res *reconcile.Result, err error) {\n\tdp := object.(*v1alpha1.DataPlane)\n\t// Get the control plane object, if not found error, add Owner reference to control plane object\n\tif err := d.setOwnerForDataplane(ctx, dp); err != nil {\n\t\treturn results.Failed, fmt.Errorf(\"setting owner reference for dataplane, %w\", err)\n\t}\n\t// Create a launch template and ASG with desired node count\n\tfor _, reconciler := range []reconciler{\n\t\td.launchTemplate.Reconcile,\n\t\td.instances.Reconcile,\n\t} {\n\t\tif err := reconciler(ctx, dp); err != nil {\n\t\t\treturn results.Failed, err\n\t\t}\n\t}\n\tzap.S().Infof(\"[%s] data plane reconciled\", dp.Spec.ClusterName)\n\treturn results.Created, nil\n}", "func (t *tauFuncFinder) propagate() {\n\tvar changed bool\n\tfor {\n\t\tfor _, node := range t.graph.Nodes {\n\t\t\tif !t.istau[node] {\n\t\t\t\tfor _, pred := range node.Preds {\n\t\t\t\t\tif t.istau[pred] {\n\t\t\t\t\t\tt.istau[pred] = false\n\t\t\t\t\t\tchanged = true\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tif !changed {\n\t\t\tbreak // done\n\t\t}\n\t\tchanged = false\n\t}\n}", "func (w *deviceWrapper) processDiscovery(d *device.DiscoveredDevices) {\n\tw.Ctor.Logger.Info(\"Discovered a new device\", common.LogDeviceTypeToken,\n\t\tw.Ctor.DeviceType.String(), common.LogDeviceNameToken, w.ID)\n\n\tsubLoadData := &device.InitDataDevice{\n\t\tLogger: w.Ctor.Logger,\n\t\tSecret: w.Ctor.Secret,\n\t\tDeviceDiscoveredChan: w.Ctor.LoadData.DeviceDiscoveredChan,\n\t\tDeviceStateUpdateChan: make(chan *device.StateUpdateData, 10),\n\t}\n\n\tloadedDevice, ok := d.Interface.(device.IDevice)\n\tif !ok {\n\t\tw.Ctor.Logger.Warn(\"One of the loaded devices is not implementing IDevice interface\",\n\t\t\tcommon.LogDeviceTypeToken, w.Ctor.DeviceConfigName, common.LogDeviceNameToken, w.ID)\n\t\treturn\n\t}\n\n\terr := loadedDevice.Init(subLoadData)\n\tif err != nil {\n\t\tw.Ctor.Logger.Warn(\"Failed to execute device.Load method\",\n\t\t\tcommon.LogDeviceTypeToken, w.Ctor.DeviceConfigName, common.LogDeviceNameToken, w.ID)\n\t\treturn\n\t}\n\n\tctor := &wrapperConstruct{\n\t\tDeviceType: d.Type,\n\t\tDeviceInterface: d.Interface,\n\t\tIsRootDevice: false,\n\t\tCron: w.Ctor.Cron,\n\t\tDeviceConfigName: w.Ctor.DeviceConfigName,\n\t\tDeviceState: d.State,\n\t\tLoadData: w.Ctor.LoadData,\n\t\tLogger: w.Ctor.Logger,\n\t\tSecret: w.Ctor.Secret,\n\t\tWorkerID: w.Ctor.WorkerID,\n\t\tDiscoveryChan: w.Ctor.DiscoveryChan,\n\t\tStatusUpdatesChan: w.Ctor.StatusUpdatesChan,\n\t}\n\n\twrapper := NewDeviceWrapper(ctor)\n\n\tw.Ctor.DiscoveryChan <- &NewDeviceDiscoveredEvent{\n\t\tProvider: wrapper,\n\t}\n}", "func VisitOperations(specs []*loads.Document, fn func(operation Operation)) {\n\tfor _, d := range specs {\n\t\tfor path, item := range d.Spec().Paths.Paths {\n\t\t\tfor method, operation := range getOperationsForItem(item) {\n\t\t\t\tif operation != nil && !IsBlacklistedOperation(operation) {\n\t\t\t\t\tfn(Operation{\n\t\t\t\t\t\titem: item,\n\t\t\t\t\t\top: operation,\n\t\t\t\t\t\tPath: path,\n\t\t\t\t\t\tHttpMethod: method,\n\t\t\t\t\t\tID: operation.ID,\n\t\t\t\t\t})\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}", "func isGraph(spec *engine.Spec) bool {\n\tfor _, step := range spec.Steps {\n\t\tif len(step.DependsOn) > 0 {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "func DFS(mapGame []string, positions []Position) {\n\tplayerPos := positions[0]\n\tgoalPos := append(positions[:0], positions[1:]...)\n\texecuteDFS(playerPos, mapGame, goalPos)\n}", "func buildExecutionOrder(graph *simple.DirectedGraph) ([]Node, error) {\n\tsortedNodes, err := topo.Sort(graph)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tnodes := make([]Node, len(sortedNodes))\n\tfor i, v := range sortedNodes {\n\t\tnodes[i] = v.(Node)\n\t}\n\n\treturn nodes, nil\n}", "func (G *Graph) DFS(cb func(n *Node)) {\r\n\t// initialize a map to keep track of the visited nodes\r\n\tvisited := make(map[*Node]bool)\r\n\t// initialize a ref variable to the root of the graph\r\n\tnode := G.nodes[0]\r\n\t// traverse graph recursively\r\n\tG.TraverseDFS(node, visited, cb)\r\n}", "func (s *Service) Setup(args *SetupArgs) (*VoidReply, error) {\n\tlc := gentree.LocalityContext{}\n\n\t//crt, _ := os.Getwd()\n\t//log.LLvl1(crt)\n\t// TODO use when calling simulation test\n\tlc.Setup(args.Roster, \"../../nodeGen/nodes.txt\")\n\n\t// TODO path to use when running api test\n\t//lc.Setup(args.Roster, \"nodeGen/nodes.txt\")\n\n\t// TODO path to use when running service test\n\t//lc.Setup(args.Roster, \"../nodeGen/nodes.txt\")\n\n\ts.Lc = lc\n\n\t// We store every tree this node is a part of in s.trees, as well as the different roots's ID's of those trees in s.rootsIDs\n\tfor rootName, trees := range lc.LocalityTrees {\n\t\t// this bool is used to know if this root has a tree which contains the current service\n\t\tisRootLinked := false\n\t\tfor _, tree := range trees[1:] {\n\t\t\tfor _, si := range tree.Roster.List {\n\t\t\t\tif si.Equal(s.ServerIdentity()) {\n\t\t\t\t\ts.trees[tree.ID] = tree\n\t\t\t\t\tisRootLinked = true\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tif isRootLinked {\n\t\t\tsID := lc.Nodes.NameToServerIdentity(rootName)\n\t\t\t// We don't want to store this node's identity in this slice\n\t\t\tif !sID.Equal(s.ServerIdentity()) {\n\t\t\t\ts.rootsIDs = append(s.rootsIDs, sID)\n\t\t\t}\n\t\t}\n\t}\n\n\ts.orderedServerIdentities = args.Roster.List\n\ts.treeIDSToSets = args.Translations\n\ts.distances = args.Distances\n\treturn &VoidReply{}, nil\n}", "func pods(ctx interface{}, w http.ResponseWriter, r *http.Request) {\n\tlog := logrus.WithField(\"method\", \"pods\")\n\tlog.Info(\"new request\")\n\n\ts := ctx.(*Server)\n\tc := &chordGraph{\n\t\tData: make([]Element, 0, len(s.serviceList)),\n\t}\n\n\ts.podListLock.Lock()\n\n\tfor ip, index := range s.podIPtoIndex {\n\t\tlog.Infof(\"%v --> %d --> %s\", ip, index, s.podList[index].pod.Meta.Name)\n\t}\n\n\tfor index, p := range s.podList {\n\t\te := Element{Name: p.pod.Meta.Name, IP: p.pod.Status.PodIP, ToElement: make([]Connection, len(s.podList))}\n\t\t// check connections\n\t\tfor _, c := range p.connections {\n\t\t\tlog.Infof(\"processing connection %+v from %v\", c, p.pod.Meta.Name)\n\t\t\tsrcI, srcOK := s.podIPtoIndex[c.SrcIP]\n\t\t\tif srcOK && index != srcI {\n\t\t\t\te.ToElement[srcI].Total++\n\t\t\t\te.ToElement[srcI].Flows = append(e.ToElement[srcI].Flows, *c)\n\t\t\t}\n\t\t\tdstI, dstOK := s.podIPtoIndex[c.DstIP]\n\t\t\tif dstOK && index != dstI {\n\t\t\t\te.ToElement[dstI].Total++\n\t\t\t\te.ToElement[dstI].Flows = append(e.ToElement[dstI].Flows, *c)\n\t\t\t}\n\t\t\t// if both source and destination are equal to this service, this is a connection within the pod\n\t\t\tif srcI == index && dstI == index {\n\t\t\t\te.ToElement[index].Total++\n\t\t\t\te.ToElement[index].Flows = append(e.ToElement[index].Flows, *c)\n\t\t\t}\n\t\t}\n\t\tlog.Infof(\"pod %s(%s) row:%+v\", p.pod.Meta.Name, p.pod.Status.PodIP, e)\n\t\t// append the row\n\t\tc.Data = append(c.Data, e)\n\t}\n\n\ts.podListLock.Unlock()\n\n\tlog.Infof(\"final body:%+v\", c)\n\n\tres, _ := json.Marshal(c)\n\tw.Header().Set(\"Access-Control-Allow-Origin\", \"*\")\n\tfmt.Fprintf(w, \"%s\", res)\n}", "func (tree *RedBlack[K, V]) iterate(o order, cb func(alg.Pair[K, V]) bool) {\n\tif tree.root != nil {\n\t\ttree.root.traverse(o, cb)\n\t}\n}", "func (g *Graph) AllPaths(root string, goal string, maxDepth int) []*TreeNode {\n\n\t// Preconditions\n\tif len(root) == 0 {\n\t\tlog.Fatal(\"Root vertex is empty\")\n\t}\n\n\tif len(goal) == 0 {\n\t\tlog.Fatal(\"Goal vertex is empty\")\n\t}\n\n\tif maxDepth < 0 {\n\t\tlog.Fatalf(\"Maximum depth is invalid: %v\\n\", maxDepth)\n\t}\n\n\t// Number of steps traversed from the root vertex\n\tnumSteps := 0\n\n\t// If the goal is the root, then return without traversing the graph\n\ttreeNode := makeTreeNode(root, root == goal)\n\tif treeNode.marked {\n\t\treturn []*TreeNode{treeNode}\n\t}\n\n\t// Nodes to 'spider' from\n\tqCurrent := queue.New()\n\tqCurrent.Enqueue(treeNode)\n\n\t// Nodes to 'spider' from on the next iteration\n\tqNext := queue.New()\n\n\t// List of complete nodes (where goal has been found)\n\tcomplete := []*TreeNode{}\n\n\tfor numSteps < maxDepth {\n\n\t\tfor qCurrent.Len() > 0 {\n\n\t\t\t// Take a tree node from the queue representing a vertex\n\t\t\tnode := qCurrent.Dequeue().(*TreeNode)\n\n\t\t\tif node.marked {\n\t\t\t\tlog.Fatal(\"Trying to traverse from a marked node\")\n\t\t\t}\n\n\t\t\t// Get a list of the adjacent vertices\n\t\t\tw := g.AdjacentTo(node.name)\n\n\t\t\t// Walk through each of the adjacent vertices\n\t\t\tfor _, adjIdentifier := range w {\n\n\t\t\t\tif !node.containsVertex(adjIdentifier) {\n\n\t\t\t\t\tmarked := adjIdentifier == goal\n\t\t\t\t\tchild := node.makeChild(adjIdentifier, marked)\n\n\t\t\t\t\tif marked {\n\t\t\t\t\t\tcomplete = append(complete, child)\n\t\t\t\t\t} else {\n\t\t\t\t\t\tqNext.Enqueue(child)\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t}\n\t\t}\n\n\t\tqCurrent = qNext\n\t\tqNext = queue.New()\n\t\tnumSteps++\n\n\t}\n\n\treturn complete\n}", "func (w *Walker) Iterate(visitor Visitor) error {\n\n\t// Iterate until either: the end of the DAG (`errUpOnRoot`), a `Pause`\n\t// is requested (`errPauseWalkOperation`) or an error happens (while\n\t// going down).\n\tfor {\n\n\t\t// First, go down as much as possible.\n\t\tfor {\n\t\t\terr := w.down(visitor)\n\n\t\t\tif err == ErrDownNoChild {\n\t\t\t\tbreak\n\t\t\t\t// Can't keep going down from this node, try to move Next.\n\t\t\t}\n\n\t\t\tif err == errPauseWalkOperation {\n\t\t\t\treturn nil\n\t\t\t\t// Pause requested, `errPauseWalkOperation` is just an internal\n\t\t\t\t// error to signal to pause, don't pass it along.\n\t\t\t}\n\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t\t// `down` is the only movement that can return *any* error.\n\t\t\t}\n\t\t}\n\n\t\t// Can't move down anymore, turn to the next child in the `ActiveNode`\n\t\t// to go down a different path. If there are no more child nodes\n\t\t// available, go back up.\n\t\tfor {\n\t\t\terr := w.NextChild()\n\t\t\tif err == nil {\n\t\t\t\tbreak\n\t\t\t\t// No error, it turned to the next child. Try to go down again.\n\t\t\t}\n\n\t\t\t// It can't go Next (`ErrNextNoChild`), try to move up.\n\t\t\terr = w.up()\n\t\t\tif err != nil {\n\t\t\t\t// Can't move up, on the root again (`errUpOnRoot`).\n\t\t\t\treturn EndOfDag\n\t\t\t}\n\n\t\t\t// Moved up, try `NextChild` again.\n\t\t}\n\n\t\t// Turned to the next child (after potentially many up moves),\n\t\t// try going down again.\n\t}\n}", "func buildGraph(parent *node, result *[]*node, actions []Action, goal StateList, agent Agent) bool {\n\n\tfor i, action := range actions {\n\n\t\tif !parent.state.Includes(action.Preconditions()) {\n\t\t\tcontinue\n\t\t}\n\n\t\tcandidate := &node{\n\t\t\tparent: parent,\n\t\t\trunningCost: parent.runningCost + action.Cost(),\n\t\t\tstate: parent.state.Clone().Apply(action.Effects()),\n\t\t\taction: action,\n\t\t}\n\n\t\tif !action.CheckContextPrecondition(candidate.state) {\n\t\t\tcontinue\n\t\t}\n\n\t\t// found a solution\n\t\tif candidate.state.Includes(goal) {\n\t\t\t*result = append(*result, candidate)\n\t\t\tcontinue\n\t\t}\n\n\t\t// not at a solution yet, so test all the remaining actions and branch out the tree\n\t\tbuildGraph(candidate, result, remove(actions, i), goal, agent)\n\t}\n\treturn len(*result) > 0\n}", "func Discover(network string) ([]*Controller, error) {\n\treturn discover(network, discoveryProbes, discoveryIntv)\n}", "func visitAll(root *cobra.Command, fn func(*cobra.Command)) {\n\tfor _, cmd := range root.Commands() {\n\t\tvisitAll(cmd, fn)\n\t}\n\tfn(root)\n}", "func visitAll(root *cobra.Command, fn func(*cobra.Command)) {\n\tfor _, cmd := range root.Commands() {\n\t\tvisitAll(cmd, fn)\n\t}\n\tfn(root)\n}", "func (p *Planner) categorizeNodes(podDestinations map[string]bool, scaleDownCandidates []*apiv1.Node) {\n\tunremovableTimeout := p.latestUpdate.Add(p.context.AutoscalingOptions.UnremovableNodeRecheckTimeout)\n\tunremovableCount := 0\n\tvar removableList []simulator.NodeToBeRemoved\n\tp.unremovableNodes.Update(p.context.ClusterSnapshot.NodeInfos(), p.latestUpdate)\n\tcurrentlyUnneededNodeNames, utilizationMap, ineligible := p.eligibilityChecker.FilterOutUnremovable(p.context, scaleDownCandidates, p.latestUpdate, p.unremovableNodes)\n\tfor _, n := range ineligible {\n\t\tp.unremovableNodes.Add(n)\n\t}\n\tp.nodeUtilizationMap = utilizationMap\n\ttimer := time.NewTimer(p.context.ScaleDownSimulationTimeout)\n\n\tfor i, node := range currentlyUnneededNodeNames {\n\t\tif timedOut(timer) {\n\t\t\tklog.Warningf(\"%d out of %d nodes skipped in scale down simulation due to timeout.\", len(currentlyUnneededNodeNames)-i, len(currentlyUnneededNodeNames))\n\t\t\tbreak\n\t\t}\n\t\tif len(removableList) >= p.unneededNodesLimit() {\n\t\t\tklog.V(4).Infof(\"%d out of %d nodes skipped in scale down simulation: there are already %d unneeded nodes so no point in looking for more.\", len(currentlyUnneededNodeNames)-i, len(currentlyUnneededNodeNames), len(removableList))\n\t\t\tbreak\n\t\t}\n\t\tremovable, unremovable := p.rs.SimulateNodeRemoval(node, podDestinations, p.latestUpdate, p.context.RemainingPdbTracker.GetPdbs())\n\t\tif removable != nil {\n\t\t\t_, inParallel, _ := p.context.RemainingPdbTracker.CanRemovePods(removable.PodsToReschedule)\n\t\t\tif !inParallel {\n\t\t\t\tremovable.IsRisky = true\n\t\t\t}\n\t\t\tdelete(podDestinations, removable.Node.Name)\n\t\t\tp.context.RemainingPdbTracker.RemovePods(removable.PodsToReschedule)\n\t\t\tremovableList = append(removableList, *removable)\n\t\t}\n\t\tif unremovable != nil {\n\t\t\tunremovableCount += 1\n\t\t\tp.unremovableNodes.AddTimeout(unremovable, unremovableTimeout)\n\t\t}\n\t}\n\tp.unneededNodes.Update(removableList, p.latestUpdate)\n\tif unremovableCount > 0 {\n\t\tklog.V(1).Infof(\"%v nodes found to be unremovable in simulation, will re-check them at %v\", unremovableCount, unremovableTimeout)\n\t}\n}", "func Discovery(ctx context.Context, c client.Client, namespace, name string, options DiscoverOptions) (*ObjectTree, error) {\n\t// Fetch the Cluster instance.\n\tcluster := &clusterv1.Cluster{}\n\tclusterKey := client.ObjectKey{\n\t\tNamespace: namespace,\n\t\tName: name,\n\t}\n\tif err := c.Get(ctx, clusterKey, cluster); err != nil {\n\t\treturn nil, err\n\t}\n\n\t// Enforce TypeMeta to make sure checks on GVK works properly.\n\tcluster.TypeMeta = metav1.TypeMeta{\n\t\tKind: \"Cluster\",\n\t\tAPIVersion: clusterv1.GroupVersion.String(),\n\t}\n\n\t// Create an object tree with the cluster as root\n\ttree := NewObjectTree(cluster, options.toObjectTreeOptions())\n\n\t// Adds cluster infra\n\tclusterInfra, err := external.Get(ctx, c, cluster.Spec.InfrastructureRef, cluster.Namespace)\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"get InfraCluster reference from Cluster\")\n\t}\n\ttree.Add(cluster, clusterInfra, ObjectMetaName(\"ClusterInfrastructure\"))\n\n\tif options.ShowClusterResourceSets {\n\t\taddClusterResourceSetsToObjectTree(ctx, c, cluster, tree)\n\t}\n\n\t// Adds control plane\n\tcontrolPlane, err := external.Get(ctx, c, cluster.Spec.ControlPlaneRef, cluster.Namespace)\n\tif err == nil {\n\t\taddControlPlane(cluster, controlPlane, tree, options)\n\t}\n\n\t// Adds control plane machines.\n\tmachinesList, err := getMachinesInCluster(ctx, c, cluster.Namespace, cluster.Name)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tmachineMap := map[string]bool{}\n\taddMachineFunc := func(parent client.Object, m *clusterv1.Machine) {\n\t\t_, visible := tree.Add(parent, m)\n\t\tmachineMap[m.Name] = true\n\n\t\tif visible {\n\t\t\tif (m.Spec.InfrastructureRef != corev1.ObjectReference{}) {\n\t\t\t\tif machineInfra, err := external.Get(ctx, c, &m.Spec.InfrastructureRef, cluster.Namespace); err == nil {\n\t\t\t\t\ttree.Add(m, machineInfra, ObjectMetaName(\"MachineInfrastructure\"), NoEcho(true))\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif m.Spec.Bootstrap.ConfigRef != nil {\n\t\t\t\tif machineBootstrap, err := external.Get(ctx, c, m.Spec.Bootstrap.ConfigRef, cluster.Namespace); err == nil {\n\t\t\t\t\ttree.Add(m, machineBootstrap, ObjectMetaName(\"BootstrapConfig\"), NoEcho(true))\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tcontrolPlaneMachines := selectControlPlaneMachines(machinesList)\n\tif controlPlane != nil {\n\t\tfor i := range controlPlaneMachines {\n\t\t\tcp := controlPlaneMachines[i]\n\t\t\taddMachineFunc(controlPlane, cp)\n\t\t}\n\t}\n\n\tmachinePoolList, err := getMachinePoolsInCluster(ctx, c, cluster.Namespace, cluster.Name)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tworkers := VirtualObject(cluster.Namespace, \"WorkerGroup\", \"Workers\")\n\t// Add WorkerGroup if there are MachineDeployments or MachinePools\n\tif len(machinesList.Items) != len(controlPlaneMachines) || len(machinePoolList.Items) > 0 {\n\t\ttree.Add(cluster, workers)\n\t}\n\n\tif len(machinesList.Items) != len(controlPlaneMachines) { // Add MachineDeployment objects\n\t\ttree.Add(cluster, workers)\n\t\terr = addMachineDeploymentToObjectTree(ctx, c, cluster, workers, machinesList, tree, options, addMachineFunc)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\tif len(machinePoolList.Items) > 0 { // Add MachinePool objects\n\t\ttree.Add(cluster, workers)\n\t\taddMachinePoolsToObjectTree(ctx, c, cluster.Namespace, workers, machinePoolList, machinesList, tree, addMachineFunc)\n\t}\n\n\t// Handles orphan machines.\n\tif len(machineMap) < len(machinesList.Items) {\n\t\tother := VirtualObject(cluster.Namespace, \"OtherGroup\", \"Other\")\n\t\ttree.Add(workers, other)\n\n\t\tfor i := range machinesList.Items {\n\t\t\tm := &machinesList.Items[i]\n\t\t\tif _, ok := machineMap[m.Name]; ok {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\taddMachineFunc(other, m)\n\t\t}\n\t}\n\n\treturn tree, nil\n}", "func (c *SiteReplicationSys) concDo(selfActionFn func() error, peerActionFn func(deploymentID string, p madmin.PeerInfo) error) concErr {\n\tdepIDs := make([]string, 0, len(c.state.Peers))\n\tfor d := range c.state.Peers {\n\t\tdepIDs = append(depIDs, d)\n\t}\n\terrs := make([]error, len(c.state.Peers))\n\tvar wg sync.WaitGroup\n\tfor i := range depIDs {\n\t\twg.Add(1)\n\t\tgo func(i int) {\n\t\t\tif depIDs[i] == globalDeploymentID {\n\t\t\t\tif selfActionFn != nil {\n\t\t\t\t\terrs[i] = selfActionFn()\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\terrs[i] = peerActionFn(depIDs[i], c.state.Peers[depIDs[i]])\n\t\t\t}\n\t\t\twg.Done()\n\t\t}(i)\n\t}\n\twg.Wait()\n\terrMap := make(map[string]error, len(c.state.Peers))\n\tfor i, depID := range depIDs {\n\t\tif errs[i] != nil {\n\t\t\terrMap[depID] = errs[i]\n\t\t}\n\t}\n\tnumActions := len(c.state.Peers) - 1\n\tif selfActionFn != nil {\n\t\tnumActions++\n\t}\n\treturn c.newConcErr(numActions, errMap)\n}", "func (n *network) Start() {\n\n\tfor _, l := range n.learners {\n\t\tgo l.Run()\n\t}\n\n\tfor _, a := range n.acceptors {\n\t\tgo a.Run()\n\t}\n\n\tfor _, p := range n.proposers {\n\t\tgo p.Run()\n\t}\n\t\n}", "func (l *TestLayer) Exec(ctx context.Context, t *testing.T) {\n\tt.Helper()\n\n\tvar (\n\t\tagent = &adagio.Agent{Id: \"foo\"}\n\t\tevents = make(chan *adagio.Event, len(l.Events))\n\t\tcollected = make([]*adagio.Event, 0)\n\t\terr = l.Repository.Subscribe(ctx, agent, events, adagio.Event_NODE_READY)\n\t)\n\trequire.Nil(t, err)\n\n\tdefer func() {\n\t\tl.Repository.UnsubscribeAll(ctx, agent, events)\n\n\t\tclose(events)\n\t}()\n\n\tvar claims map[string]*adagio.Claim\n\tt.Run(l.Name, func(t *testing.T) {\n\t\tcanNotClaim(ctx, t, l.Repository, l.Run, l.Unclaimable...)\n\n\t\tclaims = canClaim(ctx, t, l.Repository, l.Run, l.Claimable)\n\t})\n\n\tcanFinish(ctx, t, l.Repository, l.Run, l.Finish, claims)\n\n\tt.Run(fmt.Sprintf(\"the run is reported with a status of %q\", l.RunStatus), func(t *testing.T) {\n\t\t// check run reports expected status\n\t\trun, err := l.Repository.InspectRun(ctx, l.Run.Id)\n\t\trequire.Nil(t, err)\n\t\trequire.Equal(t, l.RunStatus, run.Status)\n\t})\n\n\tfor i := 0; i < len(l.Events); i++ {\n\t\tselect {\n\t\tcase event := <-events:\n\t\t\tcollected = append(collected, event)\n\t\tcase <-time.After(5 * time.Second):\n\t\t\tfmt.Printf(\"collected so far %#v\", collected)\n\t\t\tt.Error(\"timeout collecting events\")\n\t\t\treturn\n\t\t}\n\t}\n\n\tsort.SliceStable(collected, func(i, j int) bool {\n\t\treturn collected[i].NodeSpec.Name < collected[j].NodeSpec.Name\n\t})\n\n\tif l.Events != nil {\n\t\tif !assert.Equal(t, l.Events, collected) {\n\t\t\tfmt.Println(pretty.Diff(l.Events, collected))\n\t\t}\n\t}\n\n\tt.Run(\"the subscribed agent is listed\", func(t *testing.T) {\n\t\tagents, err := l.Repository.ListAgents(ctx)\n\t\trequire.Nil(t, err)\n\t\trequire.Len(t, agents, 1)\n\n\t\tassert.Equal(t, agent, agents[0])\n\t})\n}", "func main() {\n\tgraphViz := flag.Bool(\"g\", false, \"GraphViz dot output on stdout\")\n\tflag.Parse()\n\n\troot1 := tree.CreateNumericFromString(flag.Args()[0])\n\troot2 := tree.CreateNumericFromString(flag.Args()[1])\n\n\tmerged := merge(root1, root2)\n\n\tif *graphViz {\n\n\t\tfmt.Printf(\"digraph g1 {\\n\")\n\t\tfmt.Printf(\"subgraph cluster_0 {\\n\\tlabel=\\\"1st\\\"\\n\")\n\t\ttree.DrawPrefixed(os.Stdout, root1, \"a\")\n\t\tfmt.Printf(\"\\n}\\n\")\n\t\tfmt.Printf(\"subgraph cluster_1 {\\n\\tlabel=\\\"2nd\\\"\\n\")\n\t\ttree.DrawPrefixed(os.Stdout, root2, \"b\")\n\t\tfmt.Printf(\"\\n}\\n\")\n\t\tfmt.Printf(\"subgraph cluster_2 {\\n\\tlabel=\\\"merged\\\"\\n\")\n\t\ttree.DrawPrefixed(os.Stdout, merged, \"m\")\n\t\tfmt.Printf(\"\\n}\\n\")\n\t\tfmt.Printf(\"\\n}\\n\")\n\n\t\treturn\n\t}\n\ttree.Print(merged)\n}", "func (c *Collector) Run(ctx context.Context) error {\n\tdefer close(c.doneChan)\n\n\twatcher, cancel, err := store.ViewAndWatch(c.store, func(readTx store.ReadTx) error {\n\t\tnodes, err := store.FindNodes(readTx, store.All)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tfor _, node := range nodes {\n\t\t\tc.updateNodeState(nil, node)\n\t\t}\n\t\treturn nil\n\t})\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer cancel()\n\n\tfor {\n\t\tselect {\n\t\tcase event := <-watcher:\n\t\t\tswitch v := event.(type) {\n\t\t\tcase api.EventCreateNode:\n\t\t\t\tc.updateNodeState(nil, v.Node)\n\t\t\tcase api.EventUpdateNode:\n\t\t\t\tc.updateNodeState(v.OldNode, v.Node)\n\t\t\tcase api.EventDeleteNode:\n\t\t\t\tc.updateNodeState(v.Node, nil)\n\t\t\t}\n\t\tcase <-c.stopChan:\n\t\t\treturn nil\n\t\t}\n\t}\n}", "func VisitAll(cmd *cobra.Command, fn func(*cobra.Command)) {\n\tfn(cmd)\n\tfor _, child := range cmd.Commands() {\n\t\tVisitAll(child, fn)\n\t}\n}", "func (e *Eval) todo(f *Flow, visited flowOnce, v *FlowVisitor) {\n\tif f == nil || !visited.Visit(f) {\n\t\treturn\n\t}\n\tfor _, dep := range f.Deps {\n\t\tif dep.ExecDepIncorrectCacheKeyBug {\n\t\t\t// If the dependency was affected by the bug, then so is the parent.\n\t\t\tf.ExecDepIncorrectCacheKeyBug = true\n\t\t\tbreak\n\t\t}\n\t}\n\tswitch f.State {\n\tcase Init:\n\t\tf.Pending = make(map[*Flow]bool)\n\t\tfor _, dep := range f.Deps {\n\t\t\tif dep.State != Done {\n\t\t\t\tf.Pending[dep] = true\n\t\t\t\tdep.Dirty = append(dep.Dirty, f)\n\t\t\t}\n\t\t}\n\t\tswitch f.Op {\n\t\tcase Intern, Exec:\n\t\t\tif !e.BottomUp && e.CacheMode.Reading() && !e.dirty(f) {\n\t\t\t\tv.Push(f)\n\t\t\t\te.Mutate(f, NeedLookup)\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t\te.Mutate(f, TODO)\n\t\tfallthrough\n\tcase TODO:\n\t\tfor _, dep := range f.Deps {\n\t\t\te.todo(dep, visited, v)\n\t\t}\n\t\t// In the case of multiple dependencies, we short-circuit\n\t\t// computation on error. This is because we want to return early,\n\t\t// in case it can be dealt with (e.g., by restarting evaluation).\n\t\tfor _, dep := range f.Deps {\n\t\t\tif dep == nil {\n\t\t\t\tpanic(fmt.Sprintf(\"op %s n %d\", f.Op, len(f.Deps)))\n\t\t\t}\n\t\t\tif dep.State == Done && dep.Err != nil {\n\t\t\t\te.Mutate(f, Ready)\n\t\t\t\tv.Push(f)\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t\tfor _, dep := range f.Deps {\n\t\t\tif dep.State != Done {\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t\t// The node is ready to run. This is done according to the evaluator's mode.\n\t\tswitch f.Op {\n\t\tcase Intern, Exec, Extern:\n\t\t\t// We're ready to run. If we're in bottom up mode, this means we're ready\n\t\t\t// for our cache lookup.\n\t\t\tif e.BottomUp && e.CacheMode.Reading() {\n\t\t\t\te.Mutate(f, NeedLookup)\n\t\t\t} else {\n\t\t\t\te.Mutate(f, Ready)\n\t\t\t}\n\t\tdefault:\n\t\t\t// Other nodes can be computed immediately,\n\t\t\t// and do not need access to the objects.\n\t\t\te.Mutate(f, Ready)\n\t\t}\n\t\tv.Push(f)\n\tdefault:\n\t\tv.Push(f)\n\t}\n}", "func (f FakeContainerImpl) DetectNetworkDestinations(pid int) ([]containers.NetworkDestination, error) {\n\tpanic(\"implement me\")\n}", "func (n *metadataNode) traverse(md []*api.PrefixMetadata, cb func(*metadataNode, []*api.PrefixMetadata) (bool, error)) error {\n\tn.assertFrozen()\n\n\tif md == nil {\n\t\tmd = n.metadata() // calculate from scratch\n\t} else {\n\t\tif n.md != nil {\n\t\t\tmd = append(md, n.md) // just extend what we have\n\t\t}\n\t}\n\n\tswitch cont, err := cb(n, md); {\n\tcase err != nil:\n\t\treturn err\n\tcase !cont:\n\t\treturn nil\n\t}\n\n\tkeys := make([]string, 0, len(n.children))\n\tfor k := range n.children {\n\t\tkeys = append(keys, k)\n\t}\n\tsort.Strings(keys)\n\n\tfor _, k := range keys {\n\t\tif err := n.children[k].traverse(md, cb); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\treturn nil\n}", "func main() {\n\tvar accounts []string\n\n\tpaginator := organizations.NewListAccountsPaginator(orgc, &organizations.ListAccountsInput{})\n\tfor paginator.HasMorePages() {\n\t\tresp, err := paginator.NextPage(context.TODO())\n\t\tif err != nil {\n\t\t\tlog.Fatal(\"ERROR: Unable to list accounts in this organization: \", err)\n\t\t}\n\n\t\tfor _, account := range resp.Accounts {\n\t\t\taccounts = append(accounts, *account.Id)\n\t\t}\n\t}\n\tfmt.Println(accounts)\n\n\t// Begin pipeline by calling gen with a list of every account\n\tin := gen(accounts...)\n\n\t// Fan out and create individual goroutines handling the requested action (getRoute)\n\tvar out []<-chan models.InternetRoute\n\tfor range accounts {\n\t\tc := getRoute(in)\n\t\tout = append(out, c)\n\t}\n\n\t// Fans in and collect the routing information from all go routines\n\tvar allRoutes []models.InternetRoute\n\tfor n := range merge(out...) {\n\t\tallRoutes = append(allRoutes, n)\n\t}\n\n\tsavedRoutes, err := json.MarshalIndent(allRoutes, \"\", \"\\t\")\n\tif err != nil {\n\t\tfmt.Println(\"ERROR: Unable to marshal internet routes to JSON: \", err)\n\t}\n\tioutil.WriteFile(\"routes.json\", savedRoutes, 0644)\n}", "func CheckReachability(deviceA, deviceB string, ig InputGraph) (bool, []Node, error) {\n\tlog.L.Debugf(\"[inputgraph] Looking for a path from %v to %v\", deviceA, deviceB)\n\n\t//check and make sure that both of the devices are actually a part of the graph\n\n\tif _, ok := ig.DeviceMap[deviceA]; !ok {\n\t\tmsg := fmt.Sprintf(\"[inputgraph] Device %v is not part of the graph\", deviceA)\n\n\t\tlog.L.Error(color.HiRedString(msg))\n\n\t\treturn false, []Node{}, errors.New(msg)\n\t}\n\n\tif _, ok := ig.DeviceMap[deviceB]; !ok {\n\t\tmsg := fmt.Sprintf(\"[inputgraph] Device %v is not part of the graph\", deviceA)\n\n\t\tlog.L.Error(color.HiRedString(msg))\n\n\t\treturn false, []Node{}, errors.New(msg)\n\t}\n\n\t//now we need to check to see if we can get from a to b. We're gonna use a BFS\n\tfrontier := make(chan string, len(ig.Nodes))\n\tvisited := make(map[string]bool)\n\tpath := make(map[string]string)\n\n\t//put in our first state\n\tfrontier <- deviceA\n\n\tvisited[deviceA] = true\n\n\tfor {\n\t\tselect {\n\t\tcase cur := <-frontier:\n\t\t\tlog.L.Debugf(\"[inputgraph] Evaluating %v\", cur)\n\t\t\tif cur == deviceB {\n\t\t\t\tlog.L.Debugf(\"[inputgraph] DestinationDevice reached.\")\n\t\t\t\tdev := cur\n\n\t\t\t\ttoReturn := []Node{}\n\t\t\t\ttoReturn = append(toReturn, *ig.DeviceMap[dev])\n\t\t\t\tlog.L.Debugf(\"[inputgraph] First Hop: %v -> %v\", dev, path[dev])\n\t\t\t\tdev, ok := path[dev]\n\n\t\t\t\tcount := 0\n\t\t\t\tfor ok {\n\t\t\t\t\tif count > len(path) {\n\t\t\t\t\t\tmsg := \"[inputgraph] Circular path detected: returnin\"\n\t\t\t\t\t\tlog.L.Error(color.HiRedString(msg))\n\n\t\t\t\t\t\treturn false, []Node{}, errors.New(msg)\n\t\t\t\t\t}\n\t\t\t\t\tlog.L.Debugf(\"[inputgraph] Next hop: %v -> %v\", dev, path[dev])\n\n\t\t\t\t\ttoReturn = append(toReturn, *ig.DeviceMap[dev])\n\n\t\t\t\t\tdev, ok = path[dev]\n\t\t\t\t\tcount++\n\n\t\t\t\t}\n\t\t\t\t//get our path and return it\n\t\t\t\treturn true, toReturn, nil\n\t\t\t}\n\n\t\t\tfor _, next := range ig.AdjacencyMap[cur] {\n\t\t\t\tif _, ok := path[next]; ok || next == deviceA {\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\n\t\t\t\tpath[next] = cur\n\n\t\t\t\tlog.L.Debugf(\"[inputgraph] Path from %v to %v, adding %v to frontier\", cur, next, next)\n\t\t\t\tlog.L.Debugf(\"[inputgraph] Path as it stands is: \")\n\n\t\t\t\tcurDev := next\n\t\t\t\tdev, ok := path[curDev]\n\t\t\t\tfor ok {\n\t\t\t\t\tlog.L.Debugf(\"[inputgraph] %v -> %v\", curDev, dev)\n\t\t\t\t\tcurDev = dev\n\t\t\t\t\tdev, ok = path[curDev]\n\t\t\t\t}\n\t\t\t\tfrontier <- next\n\t\t\t}\n\t\tdefault:\n\t\t\tlog.L.Debugf(\"[inputgraph] No path found\")\n\t\t\treturn false, []Node{}, nil\n\t\t}\n\t}\n}", "func (hssd *HttpStickySessionDiscoverer) Discover(\n\tf discoverer.DiscoverCallback) error {\n\n\tfor {\n\t\tselect {\n\t\tcase <-hssd.every.C:\n\t\t\tpeer := hssd.queryForPeer()\n\t\t\tif peer != nil {\n\t\t\t\tf(peer)\n\t\t\t}\n\t\t}\n\t}\n\n\treturn nil\n}", "func (or *orchestrator) execute() {\n\tdefer func() {\n\t\tor.mgr.finished(or)\n\t}()\n\n\t// access the new heads queue\n\t// it's filled with new heads as the connected node processes blocks from the network\n\theads := repo.ObservedHeaders()\n\tfor {\n\t\tselect {\n\t\tcase <-or.sigStop:\n\t\t\treturn\n\t\tcase h, ok := <-heads:\n\t\t\tif ok {\n\t\t\t\tor.handleNewHead(h)\n\t\t\t}\n\t\tcase idle, ok := <-or.inScanStateSwitch:\n\t\t\tif ok {\n\t\t\t\tor.pushHeads = idle\n\t\t\t\tif idle {\n\t\t\t\t\tor.unloadCache()\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}", "func (dr *DeviceRoutes) ComputeRoutes(ctx context.Context, lps []*voltha.LogicalPort) error {\n\tdr.routeBuildLock.Lock()\n\tdefer dr.routeBuildLock.Unlock()\n\n\tlogger.Debugw(\"computing-all-routes\", log.Fields{\"len-logical-ports\": len(lps)})\n\tvar err error\n\tdefer func() {\n\t\t// On error, clear the routes - any flow request or a port add/delete will trigger the rebuild\n\t\tif err != nil {\n\t\t\tdr.reset()\n\t\t}\n\t}()\n\n\tif len(lps) < 2 {\n\t\treturn status.Error(codes.FailedPrecondition, \"not-enough-logical-ports\")\n\t}\n\n\tdr.reset()\n\tdr.logicalPorts = append(dr.logicalPorts, lps...)\n\n\t// Setup the physical ports to logical ports map, the nni ports as well as the root ports map\n\tphysPortToLogicalPortMap := make(map[string]uint32)\n\tnniPorts := make([]*voltha.LogicalPort, 0)\n\tfor _, lp := range lps {\n\t\tphysPortToLogicalPortMap[concatDeviceIDPortID(lp.DeviceId, lp.DevicePortNo)] = lp.OfpPort.PortNo\n\t\tif lp.RootPort {\n\t\t\tnniPorts = append(nniPorts, lp)\n\t\t\tdr.RootPorts[lp.OfpPort.PortNo] = lp.OfpPort.PortNo\n\t\t}\n\t}\n\tif len(nniPorts) == 0 {\n\t\terr = status.Error(codes.FailedPrecondition, \"no nni port\")\n\t\treturn err\n\t}\n\tvar rootDevice *voltha.Device\n\tvar childDevice *voltha.Device\n\tvar copyFromNNIPort *voltha.LogicalPort\n\tfor idx, nniPort := range nniPorts {\n\t\tif idx == 0 {\n\t\t\tcopyFromNNIPort = nniPort\n\t\t} else if len(dr.Routes) > 0 {\n\t\t\tdr.copyFromExistingNNIRoutes(nniPort, copyFromNNIPort)\n\t\t\treturn nil\n\t\t}\n\t\t// Get root device\n\t\trootDevice, err = dr.getDevice(ctx, nniPort.DeviceId)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif len(rootDevice.Ports) == 0 {\n\t\t\terr = status.Errorf(codes.FailedPrecondition, \"no-port-%s\", rootDevice.Id)\n\t\t\treturn err\n\t\t}\n\t\tfor _, rootDevicePort := range rootDevice.Ports {\n\t\t\tif rootDevicePort.Type == voltha.Port_PON_OLT {\n\t\t\t\tlogger.Debugw(\"peers\", log.Fields{\"root-device-id\": rootDevice.Id, \"port-no\": rootDevicePort.PortNo, \"len-peers\": len(rootDevicePort.Peers)})\n\t\t\t\tfor _, rootDevicePeer := range rootDevicePort.Peers {\n\t\t\t\t\tchildDevice, err = dr.getDevice(ctx, rootDevicePeer.DeviceId)\n\t\t\t\t\tif err != nil {\n\t\t\t\t\t\treturn err\n\t\t\t\t\t}\n\t\t\t\t\tchildPonPorts := dr.getDevicePonPorts(childDevice.Id, nniPort.DeviceId)\n\t\t\t\t\tif len(childPonPorts) < 1 {\n\t\t\t\t\t\terr = status.Errorf(codes.Aborted, \"no-child-pon-port-%s\", childDevice.Id)\n\t\t\t\t\t\treturn err\n\t\t\t\t\t}\n\t\t\t\t\t// We use the first PON port on the ONU whose parent is the root device.\n\t\t\t\t\tchildPonPort := childPonPorts[0].PortNo\n\t\t\t\t\tfor _, childDevicePort := range childDevice.Ports {\n\t\t\t\t\t\tif childDevicePort.Type == voltha.Port_ETHERNET_UNI {\n\t\t\t\t\t\t\tchildLogicalPort, exist := physPortToLogicalPortMap[concatDeviceIDPortID(childDevice.Id, childDevicePort.PortNo)]\n\t\t\t\t\t\t\tif !exist {\n\t\t\t\t\t\t\t\t// This can happen if this logical port has not been created yet for that device\n\t\t\t\t\t\t\t\tcontinue\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tdr.Routes[PathID{Ingress: nniPort.OfpPort.PortNo, Egress: childLogicalPort}] = []Hop{\n\t\t\t\t\t\t\t\t{DeviceID: rootDevice.Id, Ingress: nniPort.DevicePortNo, Egress: rootDevicePort.PortNo},\n\t\t\t\t\t\t\t\t{DeviceID: childDevice.Id, Ingress: childPonPort, Egress: childDevicePort.PortNo},\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tdr.Routes[PathID{Ingress: childLogicalPort, Egress: nniPort.OfpPort.PortNo}] = getReverseRoute(\n\t\t\t\t\t\t\t\tdr.Routes[PathID{Ingress: nniPort.OfpPort.PortNo, Egress: childLogicalPort}])\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\treturn nil\n}", "func doTree(baseDirectory string, actions []Action, dump io.Writer, logRan func(string, Action)) error {\n\tfor _, action := range actions {\n\t\tif err := action.Do(baseDirectory, dump, logRan); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\treturn nil\n}" ]
[ "0.52561283", "0.51364094", "0.5028333", "0.49982435", "0.47353348", "0.46834838", "0.46620485", "0.46489662", "0.4645621", "0.45522377", "0.4543185", "0.45061234", "0.45034868", "0.44126633", "0.43181756", "0.43152002", "0.43142548", "0.43113473", "0.43107462", "0.42963016", "0.42951235", "0.42755425", "0.4270468", "0.42653045", "0.42537403", "0.4241001", "0.4225111", "0.4220172", "0.42196682", "0.42148167", "0.42072117", "0.42064476", "0.41856185", "0.41817623", "0.41760838", "0.41681093", "0.416417", "0.41504836", "0.41493592", "0.41476572", "0.41439742", "0.4139565", "0.41386536", "0.41361243", "0.41285694", "0.41262242", "0.41215065", "0.41178825", "0.41114184", "0.40943846", "0.4093348", "0.4091304", "0.40898988", "0.40866566", "0.4083145", "0.40742245", "0.40501225", "0.40481228", "0.40463224", "0.40396398", "0.40289298", "0.40274984", "0.40222687", "0.4020848", "0.40031573", "0.40024295", "0.3997729", "0.39920577", "0.39703345", "0.39642602", "0.39560062", "0.39536884", "0.39521137", "0.3947345", "0.39454967", "0.39405584", "0.39400333", "0.3936947", "0.39358127", "0.39329782", "0.3926497", "0.3925973", "0.3925973", "0.3913514", "0.39110693", "0.39058095", "0.39055085", "0.3900056", "0.38998625", "0.3897769", "0.3895912", "0.38897738", "0.3886182", "0.3884507", "0.3874155", "0.38738963", "0.38635436", "0.38593888", "0.38564", "0.3853465" ]
0.76954085
0
FuncEncrypt encrypts a buffer of byte data
func FuncEncrypt(a Edge, x Edge, localPrivateKey, remotePublicKey *[32]byte, nonce [24]byte) Node { node := MakeNode("encrypt", []*Edge{&a}, []*Edge{&x}, nil, encryptFire) node.Aux = &enc{LocalPrivateKey: localPrivateKey, RemotePublicKey: remotePublicKey, Nonce: nonce} return node }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func encrypt(key, buf []byte) ([]byte, error) {\n\taesCipher, err := aes.NewCipher(key)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tencrypter := cipher.NewCBCEncrypter(aesCipher, make([]byte, aes.BlockSize))\n\toutput := make([]byte, len(buf))\n\tencrypter.CryptBlocks(output, buf)\n\treturn output, nil\n}", "func encrypt(input []byte, key []byte) []byte {\n\n\tvar block cipher.Block\n\n\tkey = hashBytes(key)\n\tblock, _ = aes.NewCipher(key)\n\n\tbuff := make([]byte, len(input))\n\tcopy(buff, input)\n\n\tcipher.NewCFBEncrypter(block, key[0:block.BlockSize()]).XORKeyStream(buff, buff)\n\n\treturn []byte(base64.RawStdEncoding.EncodeToString(buff))\n}", "func encrypt(sk, dst, src []byte) {\n\n}", "func encryptBytes(key []byte, plaintext []byte) ([]byte, error) {\n\t// Prepend 6 empty bytes to the plaintext so that the decryptor can verify\n\t// that decryption happened correctly.\n\tzeroes := make([]byte, numVerificationBytes)\n\tfulltext := append(zeroes, plaintext...)\n\n\t// Create the cipher and aead.\n\ttwofishCipher, err := twofish.NewCipher(key)\n\tif err != nil {\n\t\treturn nil, errors.New(\"unable to create twofish cipher: \" + err.Error())\n\t}\n\taead, err := cipher.NewGCM(twofishCipher)\n\tif err != nil {\n\t\treturn nil, errors.New(\"unable to create AEAD: \" + err.Error())\n\t}\n\n\t// Generate the nonce.\n\tnonce := make([]byte, aead.NonceSize())\n\t_, err = rand.Read(nonce)\n\tif err != nil {\n\t\treturn nil, errors.New(\"failed to generate entropy for nonce: \" + err.Error())\n\t}\n\n\t// Encrypt the data and return.\n\treturn aead.Seal(nonce, nonce, fulltext, nil), nil\n}", "func Encrypt(data []byte, AESKey256Bit []byte) ([]byte, error) {\n\tblock, _ := aes.NewCipher(AESKey256Bit)\n\tgcm, err := cipher.NewGCM(block)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tnonce := make([]byte, gcm.NonceSize())\n\tif _, err = io.ReadFull(rand.Reader, nonce); err != nil {\n\t\treturn nil, err\n\t}\n\tciphertext := gcm.Seal(nonce, nonce, data, nil)\n\treturn ciphertext, nil\n}", "func Encrypt(data []byte, passphrase string) ([]byte, error) {\n\tkey := []byte(utils.SHA3hash(passphrase)[96:128]) // last 32 characters in hash\n\tblock, _ := aes.NewCipher(key)\n\tgcm, err := cipher.NewGCM(block)\n\tif err != nil {\n\t\tlog.Println(\"Failed to initialize a new AES GCM while encrypting\", err)\n\t\treturn data, err\n\t}\n\tnonce := make([]byte, gcm.NonceSize())\n\tif _, err = io.ReadFull(rand.Reader, nonce); err != nil {\n\t\tlog.Println(\"Error while reading gcm bytes\", err)\n\t\treturn data, err\n\t}\n\tlog.Println(\"RANDOM ENCRYPTION NONCE IS: \", nonce)\n\tciphertext := gcm.Seal(nonce, nonce, data, nil)\n\treturn ciphertext, nil\n}", "func (ob *AESCipher) Encrypt(plaintext []byte) (ciphertext []byte, err error) {\n\tif len(ob.cryptoKey) != 32 {\n\t\treturn nil, logError(0xE64A2E, errKeySize)\n\t}\n\t// nonce is a byte array filled with cryptographically secure random bytes\n\tn := ob.gcm.NonceSize()\n\tnonce := make([]byte, n)\n\t_, err = io.ReadFull(rand.Reader, nonce)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tciphertext = ob.gcm.Seal(\n\t\tnonce, // dst []byte,\n\t\tnonce, // nonce []byte,\n\t\tplaintext, // plaintext []byte,\n\t\tnil, // additionalData []byte) []byte\n\t)\n\treturn ciphertext, nil\n}", "func (packet Packet) Encrypt() []byte {\n\n\tbuffer := new(bytes.Buffer)\n\n\tvar header struct {\n\t\tMagic uint16 // 0x02 0x00\n\t\tSize uint16 // 0xXX 0xXX\n\t\tSender uint8 // 0x01\n\t}\n\theader.Magic = 0x02\n\theader.Size = uint16(packet.Data.Len() + 7) // Data + 5 byte Header + 2 byte ID\n\theader.Sender = 0x01\n\n\tbinary.Write(buffer, binary.LittleEndian, header.Magic)\n\tbinary.Write(buffer, binary.LittleEndian, header.Size)\n\tbinary.Write(buffer, binary.LittleEndian, header.Sender)\n\n\tvar bytes = make([]byte, packet.Data.Len()+2)\n\tcopy(bytes[0:2], []byte{uint8(packet.ID>>8) & 0xFF, uint8(packet.ID & 0xFF)})\n\tcopy(bytes[2:], packet.Data.Bytes())\n\n\tfor i := 0; i < len(bytes); i++ {\n\t\tvar byte1 = bytes[i]\n\t\tvar byte2 = KeyTable[4*int(header.Magic)-3*(i/3)+i]\n\t\t// fmt.Printf(\"%02X ^ %02X = %02X\\n\", byte1, byte2, byte1 ^ byte2)\n\t\tbuffer.WriteByte(byte1 ^ byte2)\n\t}\n\n\treturn buffer.Bytes()\n}", "func (ec *Encrypter) Encrypt(plaintext []byte) ([]byte, error) {\n\tif plaintext == nil {\n\t\treturn nil, fmt.Errorf(\"invalid plaintext: nil\")\n\t}\n\n\t// Create a SHA-512 digest on the plain content to detect data tampering\n\tdigest := sha512.Sum512(plaintext)\n\tif len(digest) != sha512DigestLen {\n\t\treturn nil, fmt.Errorf(\"unexpected SHA512 hash length. Expected %d, got %d\", sha512DigestLen, len(digest))\n\t}\n\n\t// 1 byte space to store version\n\t// 1 byte space to store padding len once we have it\n\tlenContentToEncrypt := len(magicBytes) + 1 + 1 + len(digest) + len(plaintext)\n\n\t// As a block cipher, the content's length must be a multiple of the AES block size (16 bytes).\n\t// To achieve this, we add padding to the plain content so that its size matches.\n\tpaddingLen := 0\n\textra := lenContentToEncrypt % aes.BlockSize\n\tif extra != 0 {\n\t\tpaddingLen = aes.BlockSize - extra\n\t}\n\tlenContentToEncrypt += paddingLen\n\n\t// Copy the plain text content to the buffer\n\tcontentLen := ec.salt.Len() + lenContentToEncrypt\n\tcontent := make([]byte, contentLen)\n\ti := 0\n\ti += copy(content[i:], ec.salt)\n\ti += copy(content[i:], magicBytes)\n\tcontent[i] = byte(version)\n\ti++\n\tcontent[i] = byte(paddingLen)\n\ti++\n\ti += copy(content[i:], make([]byte, paddingLen))\n\ti += copy(content[i:], digest[:])\n\ti += copy(content[i:], plaintext)\n\tif i != contentLen {\n\t\tlog.Panicf(\"Unexpected encryption error: expected length of copied plain content to be %d, got %d\\n\", contentLen, i)\n\t}\n\n\t// Encrypt supports in-place encryption.\n\t// Note that we don't encrypt the salt as we need it for decrypting.\n\tec.cipher.Encrypt(content[ec.salt.Len():], content[ec.salt.Len():], xtsSectorNum)\n\n\treturn content, nil\n}", "func (a *AES) Encrypt() []byte {\n\treturn aesCrypt(a, a.key)\n}", "func (key Key) Encrypt(buf []byte, hash *Hash) ([]byte, error) {\n\tslen := C.DWORD(len(buf))\n\tbuflen := C.DWORD(len(buf))\n\tvar hHash C.HCRYPTHASH\n\tif hash != nil {\n\t\thHash = hash.hHash\n\t}\n\tif C.CryptEncrypt(key.hKey, hHash, C.TRUE, 0, nil, &buflen, 0) == 0 {\n\t\treturn nil, getErr(\"Error getting encrypting data size\")\n\t}\n\tres := make([]byte, buflen)\n\tcopy(res, buf)\n\tif C.CryptEncrypt(key.hKey, hHash, C.TRUE, 0, (*C.BYTE)(&res[0]), &slen, buflen) == 0 {\n\t\treturn nil, getErr(\"Error encrypting data\")\n\t}\n\treturn res, nil\n}", "func encrypt(key, text []byte) ([]byte, error) {\n\tblock, err := aes.NewCipher(key)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tb := base64.StdEncoding.EncodeToString(text)\n\tciphertext := make([]byte, aes.BlockSize+len(b))\n\tiv := ciphertext[:aes.BlockSize]\n\tif _, err := io.ReadFull(rand.Reader, iv); err != nil {\n\t\treturn nil, err\n\t}\n\tcfb := cipher.NewCFBEncrypter(block, iv)\n\tcfb.XORKeyStream(ciphertext[aes.BlockSize:], []byte(b))\n\treturn ciphertext, nil\n}", "func encrypt(contents []byte) ([]byte, error) {\n\tvar spider_key = []byte(\"cloud-barista-cb-spider-cloud-ba\") // 32 bytes\n\n\tencryptData := make([]byte, aes.BlockSize+len(contents))\n\tinitVector := encryptData[:aes.BlockSize]\n\tif _, err := io.ReadFull(rand.Reader, initVector); err != nil {\n\t\treturn nil, err\n\t}\n\n\tcipherBlock, err := aes.NewCipher(spider_key)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tcipherTextFB := cipher.NewCFBEncrypter(cipherBlock, initVector)\n\tcipherTextFB.XORKeyStream(encryptData[aes.BlockSize:], []byte(contents))\n\n\treturn encryptData, nil\n}", "func Encrypt(input []byte, key []byte) []byte {\n\tresult := make([]byte, len(input))\n\n\tfor i, inputByte := range input {\n\t\tresult[i] = inputByte ^ key[i%len(key)]\n\t}\n\n\treturn result\n}", "func (cry *crypt) encrypt(packet []byte) []byte {\n\tif cry.kcr == nil || cry.teo.param.DisallowEncrypt {\n\t\treturn packet\n\t}\n\tbuf := make([]byte, len(packet)+int(C.ksnCryptGetBlockSize(cry.kcr))+C.sizeof_size_t)\n\tvar encryptLen C.size_t\n\tbufPtr := unsafe.Pointer(&buf[0])\n\tpacketPtr := unsafe.Pointer(&packet[0])\n\tC.ksnEncryptPackage(cry.kcr, packetPtr, C.size_t(len(packet)), bufPtr, &encryptLen)\n\tbuf = buf[:encryptLen]\n\treturn buf\n}", "func Encrypt(key string, plaintext string) (string, error) {\n\n\tciphertext := make([]byte, aes.BlockSize+len(plaintext))\n\tiv := ciphertext[:aes.BlockSize]\n\tif _, err := FunctionReadfull(rand.Reader, iv); err != nil {\n\t\treturn \"\", err\n\t}\n\n\tstream, err := FunctionEncryptStream(key, iv)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\tstream.XORKeyStream(ciphertext[aes.BlockSize:], []byte(plaintext))\n\n\treturn fmt.Sprintf(\"%x\", ciphertext), nil\n}", "func Encrypt(data, key []byte) ([]byte, error) {\n\thashKey := Hash32Bit(key)\n\n\tblock, err := aes.NewCipher(hashKey)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tgcm, err := cipher.NewGCM(block)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tnonce := make([]byte, gcm.NonceSize())\n\t_, err = io.ReadFull(rand.Reader, nonce)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn gcm.Seal(nonce, nonce, data, nil), nil\n}", "func encryptAES(data []byte, key []byte) (ciphertext []byte){\n\tciphertext = make([]byte, userlib.BlockSize+len(data))\n\tiv := ciphertext[:userlib.BlockSize]\n\tcopy(iv, userlib.RandomBytes(userlib.BlockSize))\n\tcipher := userlib.CFBEncrypter(key, iv)\n\tcipher.XORKeyStream(ciphertext[userlib.BlockSize:], data)\n\treturn\n}", "func Encrypt(input []byte, password string) ([]byte, error) {\n\tkey := sha256.Sum256([]byte(password))\n\tblock, err := aes.NewCipher(key[:])\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tc, err := cipher.NewGCM(block)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tnonce := make([]byte, 12)\n\t_, err = io.ReadFull(rand.Reader, nonce)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn c.Seal(nonce, nonce, input, nil), nil\n}", "func Encrypt(key string, secret string, nonce string) []byte {\n\tkeyInBytes, err := hex.DecodeString(key)\n\tPanicOnError(err)\n\tsecretInBytes, err := hex.DecodeString(secret)\n\tPanicOnError(err)\n\tblock, err := aes.NewCipher(keyInBytes)\n\tPanicOnError(err)\n\tgcm, err := cipher.NewGCM(block)\n\tPanicOnError(err)\n\tnonceInBytes, err := hex.DecodeString(nonce[0 : 2*gcm.NonceSize()])\n\tPanicOnError(err)\n\tdata := gcm.Seal(nil, nonceInBytes, secretInBytes, nil)\n\treturn data\n}", "func encrypt(block cipher.Block, dst, src, buf []byte) {\n\tblocksize := block.BlockSize()\n\ttbl := buf[:blocksize]\n\tblock.Encrypt(tbl, initialVector)\n\tn := len(src) / blocksize\n\tbase := 0\n\tfor i := 0; i < n; i++ {\n\t\txor.BytesSrc1(dst[base:], src[base:], tbl)\n\t\tblock.Encrypt(tbl, dst[base:])\n\t\tbase += blocksize\n\t}\n\txor.BytesSrc0(dst[base:], src[base:], tbl)\n}", "func encrypt(key []byte, text string) string {\n\t// key needs tp be 16, 24 or 32 bytes.\n\tplaintext := []byte(text)\n\tblock, err := aes.NewCipher(key)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tciphertext := make([]byte, aes.BlockSize+len(plaintext))\n\tiv := ciphertext[:aes.BlockSize]\n\tif _, err := io.ReadFull(rand.Reader, iv); err != nil {\n\t\tpanic(err)\n\t}\n\tstream := cipher.NewCFBEncrypter(block, iv)\n\tstream.XORKeyStream(ciphertext[aes.BlockSize:], plaintext)\n\t// convert to base64\n\treturn base64.URLEncoding.EncodeToString(ciphertext)\n}", "func Encrypt(sliceToEncrypt []byte, ceaserCount int) {\n\tfor i, _ := range sliceToEncrypt {\n\t\tsliceToEncrypt[i] += byte(ceaserCount)\n\t}\n}", "func Encrypt(data []byte, passphrase string) ([]byte, error) {\n\thash := createHash(passphrase)\n\tblock, err := aes.NewCipher(hash)\n\tif err != nil {\n\t\treturn []byte{}, err\n\t}\n\tgcm, err := cipher.NewGCM(block)\n\tif err != nil {\n\t\treturn []byte{}, err\n\t}\n\tnonce := make([]byte, gcm.NonceSize())\n\tif _, err = io.ReadFull(rand.Reader, nonce); err != nil {\n\t\treturn []byte{}, err\n\t}\n\tciphertext := gcm.Seal(nonce, nonce, data, nil)\n\treturn ciphertext, nil\n}", "func Encrypt(key, iv, plaintext []byte) string {\n if len(key) != 32 {\n log.Fatal(\"Key length must be 32 bytes\")\n }\n if len(iv) != 12 {\n log.Fatal(\"initialization vector must be 12 bytes\")\n }\n block, err := aes.NewCipher(key)\n if err != nil {\n log.Fatal(err)\n }\n gcm, _ := cipher.NewGCM(block)\n ciphertext := gcm.Seal(nil, iv, plaintext, nil)\n return base64.StdEncoding.EncodeToString(ciphertext)\n}", "func Encrypt(payload []byte, q Poracle, l *log.Logger) ([]byte, error) {\n\tpayload = crypto.PCKCS5Pad(payload)\n\tn := len(payload) / CipherBlockLen\n\n\t// The clear text have the same length as the cyphertext - 1\n\t// (the IV).\n\tvar im []byte\n\tvar c1 = make([]byte, CipherBlockLen, CipherBlockLen)\n\tvar c0 = make([]byte, CipherBlockLen, CipherBlockLen)\n\n\t// Last block of the encrypted value is not related to the\n\t// text to encrypt, can contain any value.\n\tvar c []byte\n\tc = append(c, c1...)\n\tfor i := n - 1; i >= 0; i-- {\n\t\tdi, err := decryptBlock(c0, c1, q, l)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tmi := di\n\t\tim = append(im, mi...)\n\t\tti := payload[CipherBlockLen*i : (CipherBlockLen*i)+CipherBlockLen]\n\t\tc1 = crypto.BlockXOR(ti, mi)\n\t\tc = append(c1, c...)\n\t}\n\treturn c, nil\n}", "func (s *Server) Encrypt(data []byte) ([]byte, []byte, error) {\n\n\t// obtain aesKey\n\taesKey, err := getAESKey()\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\n\t//Create a new Cipher Block from the key\n\tblock, err := aes.NewCipher(aesKey)\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\n\t//Create a new GCM\n\taesGCM, err := cipher.NewGCM(block)\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\n\t//Create a nonce. Nonce should be from GCM\n\tnonce := make([]byte, aesGCM.NonceSize())\n\tif _, err = io.ReadFull(rand.Reader, nonce); err != nil {\n\t\treturn nil, nil, err\n\t}\n\n\t//Encrypt the data using aesGCM.Seal within the record\n\tdata = aesGCM.Seal(nonce, nonce, data, nil)\n\n\treturn data, aesKey, nil\n\n}", "func Encrypt(key, text []byte) ([]byte, error) {\n\tblock, err := aes.NewCipher(key)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tb := base64.StdEncoding.EncodeToString(text)\n\tciphertext := make([]byte, aes.BlockSize+len(b))\n\tiv := ciphertext[:aes.BlockSize]\n\tif _, err := io.ReadFull(rand.Reader, iv); err != nil {\n\t\treturn nil, err\n\t}\n\tcfb := cipher.NewCFBEncrypter(block, iv)\n\tcfb.XORKeyStream(ciphertext[aes.BlockSize:], []byte(b))\n\treturn ciphertext, nil\n}", "func Encrypt(plaintext []byte, userKey Key, fn EncryptFn,\n\t\thashFn func() hash.Hash) (*CryptoEnvelope, error) {\n\n\t// Currently the only supported algorithm.\n\tconst cipherAlgo = CipherAlgo_AES256CTR\n\n\t// Generate a random encryption key.\n\tkey := make([]byte, 32)\n\tif _, err := rand.Read(key); err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to generate random encryption key: %v\", err)\n\t}\n\n\t// Encrypt the data.\n\tiv, ciphertext, err := fn(key, plaintext)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// Encrypt the cipher key with the user key and prefix the keyIV to it.\n\tkeyIV, keyCipher, err := fn(userKey.Encryption(), key)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tencryptedKey := make([]byte, 0, len(keyIV)+len(keyCipher))\n\tencryptedKey = append(encryptedKey, keyIV...)\n\tencryptedKey = append(encryptedKey, keyCipher...)\n\n\t// Use an HMAC to sign all public data used in the encryption process.\n\tsig, err := Sign(hmac.New(hashFn, userKey.HMAC()),\n\t\t[]byte(strconv.Itoa(int(cipherAlgo))), iv, encryptedKey, ciphertext)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn &CryptoEnvelope{\n\t\tHmac: sig,\n\t\tIv: iv,\n\t\tKey: encryptedKey,\n\t\tAlgorithm: cipherAlgo,\n\t\tData: ciphertext,\n\t}, nil\n}", "func Encrypt(plaintext []byte, key []byte) ([]byte, error) {\n\t// Get cipher object with key\n\taesgcm, err := getCipher(key)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// Generate nonce\n\tnonce := make([]byte, aesgcm.NonceSize())\n\tif _, err := rand.Read(nonce); err != nil {\n\t\treturn nil, err\n\t}\n\n\t// Encrypt data\n\tciphertext := aesgcm.Seal(nil, nonce, plaintext, nil)\n\n\treturn append(nonce, ciphertext...), nil\n}", "func Encrypt(key, payload []byte) (ciphertext []byte, err error) {\n\tblock, err := aes.NewCipher(key)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tciphertext = make([]byte, aes.BlockSize+len(payload))\n\n\tiv := ciphertext[:aes.BlockSize]\n\tif _, err := io.ReadFull(rand.Reader, iv); err != nil {\n\t\treturn nil, err\n\t}\n\n\tstream := cipher.NewCFBEncrypter(block, iv)\n\tstream.XORKeyStream(ciphertext[aes.BlockSize:], payload)\n\n\treturn ciphertext, nil\n}", "func (key TwofishKey) EncryptBytes(plaintext []byte) (ct Ciphertext, err error) {\n\t// Create the cipher, encryptor, and nonce.\n\ttwofishCipher, err := twofish.NewCipher(key[:])\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\taead, err := cipher.NewGCM(twofishCipher)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tnonce := make([]byte, aead.NonceSize())\n\t_, err = rand.Read(nonce)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// Encrypt the data. No authenticated data is provided, as EncryptBytes is\n\t// meant for file encryption.\n\tct = aead.Seal(nonce, nonce, plaintext, nil)\n\treturn ct, nil\n}", "func Encrypt(data []byte, passphrase string) []byte {\n\tblock, _ := aes.NewCipher([]byte(createHash(passphrase)))\n\tgcm, err := cipher.NewGCM(block)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tnonce := make([]byte, gcm.NonceSize())\n\tif _, err = io.ReadFull(rand.Reader, nonce); err != nil {\n\t\tpanic(err.Error())\n\t}\n\tciphertext := gcm.Seal(nonce, nonce, data, nil)\n\treturn ciphertext\n}", "func (nullSecurity) Encrypt(w io.Writer, data []byte) (int, error) {\n\treturn w.Write(data)\n}", "func encrypt(data []byte, key []byte) []byte {\r\n\t// generate a new aes cipher using our 32 byte long key\r\n c, err := aes.NewCipher(key)\r\n if err != nil {\r\n fmt.Println(\"aes.NewCipher failed:\", err)\r\n\t}\r\n\r\n\t// Galois/Counter Mode\r\n\tgcm, err := cipher.NewGCM(c)\r\n if err != nil {\r\n fmt.Println(\"cipher.NewGCM failed:\", err)\r\n }\r\n\r\n\tnonce := make([]byte, gcm.NonceSize())\r\n\r\n\tif _, err = io.ReadFull(rand.Reader, nonce); err != nil {\r\n fmt.Println(err)\r\n\t}\r\n\r\n\tcode := gcm.Seal(nonce, nonce, data, nil)\r\n\r\n\treturn code\r\n}", "func (t *Thread) Encrypt(data []byte) ([]byte, error) {\n\treturn crypto.Encrypt(t.PrivKey.GetPublic(), data)\n}", "func encrypt(value []byte, key Key) ([]byte, error) {\n\tnsize := make([]byte, key.cipherObj.NonceSize())\n\tif _, err := io.ReadFull(rand.Reader, nsize); err != nil {\n\t\treturn value, err\n\t}\n\n\treturn key.cipherObj.Seal(nsize, nsize, value, nil), nil\n}", "func Encrypt(plaintext, key []byte) ([]byte, error) {\n\n // Check the key size.\n if len(key) != KeySize {\n return nil, ErrInvalidKeySize\n }\n\n // Create a random initialization vector.\n iv := make([]byte, aes.BlockSize)\n _, err := io.ReadFull(rand.Reader, iv)\n if err != nil {\n return nil, ErrInvalidIV\n }\n\n // Pad the plaintext so its length is a multiple of the AES block size.\n pplaintext := pad(plaintext)\n ciphertext := make([]byte, len(pplaintext))\n\n // Generate the ciphertext and prepend the initialization vector.\n c, _ := aes.NewCipher(key)\n encrypter := cipher.NewCBCEncrypter(c, iv)\n encrypter.CryptBlocks(ciphertext, pplaintext)\n ciphertext = append(iv, ciphertext...)\n\n // Generate and append the HMAC.\n hash := hmac.New(sha256.New, key)\n hash.Write(ciphertext)\n ciphertext = hash.Sum(ciphertext)\n\n return ciphertext, nil\n}", "func encrypt(msg []byte, k key) (c []byte, err error) {\n\tnonce, err := randomNonce()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tc = box.SealAfterPrecomputation(c, msg, nonce, k)\n\tc = append((*nonce)[:], c...)\n\treturn c, nil\n}", "func encrypt(password, data []byte) ([]byte, error) {\n\tsalt, err := makeSalt(SaltBytes)\n\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tkey := makeKey(password, salt)\n\n\tblock, err := aes.NewCipher(key)\n\n\tif err != nil {\n\t\treturn nil, err // @todo FailedToEncrypt\n\t}\n\n\tcipherText := make([]byte, aes.BlockSize+len(data))\n\tiv := cipherText[:aes.BlockSize]\n\n\tif _, err := io.ReadFull(rand.Reader, iv); err != nil {\n\t\treturn nil, err // @todo FailedToEncrypt\n\t}\n\n\tstream := cipher.NewCFBEncrypter(block, iv)\n\tstream.XORKeyStream(cipherText[aes.BlockSize:], data)\n\n\treturn append(salt, cipherText...), nil\n}", "func encrypt(key, iv, plaintext []byte) ([]byte, error) {\n\n\tif len(iv) != aes.BlockSize {\n\t\treturn nil, fmt.Errorf(\"keystore.encrypt: IV not %d bytes\", aes.BlockSize)\n\t}\n\tif len(key) != 32 {\n\t\treturn nil, fmt.Errorf(\"keystore.encrypt: key not 32 bytes\")\n\t}\n\n\tbl, err := aes.NewCipher(key)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"keystore.encrypt aes.NewCipher: %v\", err.Error())\n\t}\n\n\t// Write IV to the start of ciphertext.\n\tciphertext := make([]byte, len(plaintext)+aes.BlockSize)\n\tcopy(ciphertext[:aes.BlockSize], iv)\n\n\tstream := cipher.NewCFBEncrypter(bl, iv)\n\tstream.XORKeyStream(ciphertext[aes.BlockSize:], plaintext)\n\treturn ciphertext, nil\n}", "func Encrypt(data []byte, key []byte) []byte {\n\tblock, err := aes.NewCipher(key)\n\tif err != nil {\n\t\tlogging.ErrorLogger.Println(err.Error())\n\t}\n\tdata = pad(data)\n\tciphertext := make([]byte, aes.BlockSize+len(data))\n\tiv := ciphertext[:aes.BlockSize]\n\tif _, err := io.ReadFull(rand.Reader, iv); err != nil {\n\t\tpanic(err)\n\t}\n\tmode := cipher.NewCBCEncrypter(block, iv)\n\tmode.CryptBlocks(ciphertext[aes.BlockSize:], data)\n\treturn ciphertext\n}", "func EncryptAES(src string) (based string, err error) {\n\t//Initial []byte token\n\ttoken, err := hex.DecodeString(\"46356afe55fa3cea9cbe73ad442cad47\")\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\t// Block from Cipher\n\tblock, err := aes.NewCipher(token)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t\treturn\n\t}\n\tblockSize := block.BlockSize()\n\tecbe := cipher.NewCBCEncrypter(block, token[:blockSize])\n\tcontent := PKCS5Padding([]byte(src), blockSize)\n\t// Initial crypt value\n\tcrypted := make([]byte, len(content))\n\tecbe.CryptBlocks(crypted, content)\n\tbased = base64.StdEncoding.EncodeToString(crypted)\n\treturn\n}", "func encryptBytes(key []byte, iv []byte, plaintext []byte) []byte {\n\tr, _ := ioutil.ReadAll(makeEncrypterReader(key, iv, bytes.NewReader(plaintext)))\n\treturn r\n}", "func (r *rsaPublicKey) encrypt(data []byte) ([]byte, error) {\n // The label parameter must be the same for decrypt function\n encrypted, err := rsa.EncryptOAEP(r.Hash.New(), rand.Reader, r.PublicKey, data, []byte(\"~pc*crypt^pkg!\")); if err != nil {\n return nil, err\n }\n return encrypted, nil\n}", "func encrypt(key string, plaintext string) string {\n\tvar iv = []byte{83, 71, 26, 58, 54, 35, 22, 11,\n\t\t83, 71, 26, 58, 54, 35, 22, 11}\n\tderivedKey := pbkdf2.Key([]byte(key), iv, 1000, 48, sha1.New)\n\tnewiv := derivedKey[0:16]\n\tnewkey := derivedKey[16:48]\n\tplaintextBytes := pkcs7Pad([]byte(plaintext), aes.BlockSize)\n\tblock, err := aes.NewCipher(newkey)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tn := aes.BlockSize - (len(plaintext) % aes.BlockSize)\n\tciphertext := make([]byte, len(plaintext)+n*2)\n\tmode := cipher.NewCBCEncrypter(block, newiv)\n\tmode.CryptBlocks(ciphertext, plaintextBytes)\n\tcipherstring := base64.StdEncoding.EncodeToString(ciphertext[:len(ciphertext)-n])\n\treturn cipherstring\n}", "func (constr Construction) Encrypt(dst, src []byte) {\n\ttemp := [16]byte{}\n\tcopy(temp[:], src)\n\n\ttemp = encoding.ComposedBlocks(constr).Encode(temp)\n\n\tcopy(dst, temp[:])\n}", "func Encrypt(plaintextBytes, keyBytes []byte) (ciphertextBytes []byte, err error) {\n\tcipher, err := aes.NewCipher(keyBytes)\n\tif err != nil {\n\t\treturn\n\t}\n\n\tblockSize := cipher.BlockSize()\n\n\tfor len(plaintextBytes) > 0 {\n\t\tadd := make([]byte, blockSize)\n\t\tcipher.Encrypt(add, plaintextBytes[:blockSize])\n\t\tplaintextBytes = plaintextBytes[blockSize:]\n\t\tciphertextBytes = append(ciphertextBytes, add...)\n\t}\n\n\treturn\n}", "func (key twofishKey) EncryptBytes(piece []byte) Ciphertext {\n\t// Create the cipher.\n\taead, err := cipher.NewGCM(key.newCipher())\n\tif err != nil {\n\t\tpanic(\"NewGCM only returns an error if twofishCipher.BlockSize != 16\")\n\t}\n\treturn EncryptWithNonce(piece, aead)\n}", "func (store *SessionCookieStore) encrypt(buf []byte) ([]byte, error) {\n\tblock, err := aes.NewCipher([]byte(store.SecretKey))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\taead, err := cipher.NewGCM(block)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tiv := make([]byte, aead.NonceSize(), len(buf)+aead.NonceSize())\n\tif _, err := io.ReadFull(rand.Reader, iv); err != nil {\n\t\treturn nil, err\n\t}\n\tencrypted := aead.Seal(nil, iv, buf, nil)\n\treturn append(iv, encrypted...), nil\n}", "func Encrypt(key []byte, text []byte) string {\n\tblock, err := aes.NewCipher(key)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\t// Creating IV\n\tciphertext := make([]byte, aes.BlockSize+len(text))\n\tiv := ciphertext[:aes.BlockSize]\n\tif _, err := io.ReadFull(rand.Reader, iv); err != nil {\n\t\tpanic(err)\n\t}\n\n\t// Encrpytion Process\n\tstream := cipher.NewCFBEncrypter(block, iv)\n\tstream.XORKeyStream(ciphertext[aes.BlockSize:], text)\n\n\t// Encode to Base64\n\treturn base64.URLEncoding.EncodeToString(ciphertext)\n}", "func (wa *WzAES) Encrypt(plaintext []byte) ([]byte, error) {\n\tblock, err := aes.NewCipher(wa.key[:])\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tgcm, err := cipher.NewGCM(block)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tnonce := make([]byte, gcm.NonceSize())\n\t_, err = io.ReadFull(rand.Reader, nonce)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn gcm.Seal(nonce, nonce, plaintext, nil), nil\n}", "func (e *engine) Encrypt(src, dst []byte) error {\n\tif len(dst) < e.CiphertextSize(src) {\n\t\treturn fmt.Errorf(\"dst is too small, size it using CiphertextSize()\")\n\t}\n\tbuf, hmacSum, stream, err := e.setup(dst)\n\tif err != nil {\n\t\treturn err\n\t}\n\thmacSum.Write(src)\n\tstream.XORKeyStream(buf, hmacSum.Sum(nil))\n\t// Encrypt plaintext\n\tstream.XORKeyStream(buf[e.reg.HMACSize():], src)\n\treturn nil\n}", "func Encrypt(key []byte, data []byte) ([]byte, error) {\n\t// Create a new AES cipher\n\tblock, err := aes.NewCipher(key)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// Never use more than 2^32 random nonces with a given key because of the risk of a repeat.\n\tnonce := make([]byte, NonceLength)\n\tif _, err := io.ReadFull(rand.Reader, nonce); err != nil {\n\t\treturn nil, err\n\t}\n\n\tgcm, err := cipher.NewGCM(block)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// Prefix sealed data with nonce for decryption - see below.\n\treturn append(nonce, gcm.Seal(nil, nonce, data, nil)...), nil\n}", "func encrypt(plaintext []byte) []byte {\n IV := genRandomBytes(ivLen)\n ciphertext := aead.Seal(nil, IV, plaintext, nil)\n\n return append(IV[:], ciphertext[:]...)\n}", "func Encrypt(key, iv, message []byte) []byte {\n\treturn encryption.EncryptAESECB(key, iv, message)\n}", "func (k *Key) encrypt(ks *keys, ciphertext, plaintext []byte) (int, error) {\n\tif cap(ciphertext) < len(plaintext)+ivSize+hmacSize {\n\t\treturn 0, ErrBufferTooSmall\n\t}\n\n\t_, err := io.ReadFull(rand.Reader, ciphertext[:ivSize])\n\tif err != nil {\n\t\tpanic(fmt.Sprintf(\"unable to generate new random iv: %v\", err))\n\t}\n\n\tc, err := aes.NewCipher(ks.Encrypt)\n\tif err != nil {\n\t\tpanic(fmt.Sprintf(\"unable to create cipher: %v\", err))\n\t}\n\n\te := cipher.NewCTR(c, ciphertext[:ivSize])\n\te.XORKeyStream(ciphertext[ivSize:cap(ciphertext)], plaintext)\n\tciphertext = ciphertext[:ivSize+len(plaintext)]\n\n\thm := hmac.New(sha256.New, ks.Sign)\n\n\tn, err := hm.Write(ciphertext)\n\tif err != nil || n != len(ciphertext) {\n\t\tpanic(fmt.Sprintf(\"unable to calculate hmac of ciphertext: %v\", err))\n\t}\n\n\tciphertext = hm.Sum(ciphertext)\n\n\treturn len(ciphertext), nil\n}", "func AESENC(mx, x operand.Op) { ctx.AESENC(mx, x) }", "func (key *SecretKey) Encrypt(dst, src []byte) {\n\tvar result []byte\n\tif err := key.context.withSession(func(session *pkcs11Session) (err error) {\n\t\tmech := []*pkcs11.Mechanism{pkcs11.NewMechanism(key.Cipher.ECBMech, nil)}\n\t\tif err = session.ctx.EncryptInit(session.handle, mech, key.handle); err != nil {\n\t\t\treturn\n\t\t}\n\t\tif result, err = session.ctx.Encrypt(session.handle, src[:key.Cipher.BlockSize]); err != nil {\n\t\t\treturn\n\t\t}\n\t\tif len(result) != key.Cipher.BlockSize {\n\t\t\terr = fmt.Errorf(\"C_Encrypt: unexpectedly returned %v bytes, wanted %v\", len(result), key.Cipher.BlockSize)\n\t\t\treturn\n\t\t}\n\t\treturn\n\t}); err != nil {\n\t\tpanic(err)\n\t} else {\n\t\tcopy(dst[:key.Cipher.BlockSize], result)\n\t}\n}", "func (pk *PublicKey) Encrypt(rand io.Reader, msg []byte) ([]byte, error) {\n\treturn Encrypt(rand, pk, msg)\n}", "func Encrypt(key []byte, plaintext string) (string, error) {\n\tblock, err := aes.NewCipher(key)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\taesgcm, err := cipher.NewGCM(block)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\tnonce := make([]byte, 12)\n\tif _, err := io.ReadFull(rand.Reader, nonce); err != nil {\n\t\treturn \"\", err\n\t}\n\n\tplaintextbytes := []byte(plaintext)\n\tcipherStr := base64.StdEncoding.EncodeToString(aesgcm.Seal(nonce, nonce, plaintextbytes, nil))\n\treturn cipherStr, nil\n}", "func Encrypt(in io.Reader, out io.Writer, key *[32]byte) error {\n\tblock, err := aes.NewCipher(key[:])\n\tif err != nil {\n\t\treturn err\n\t}\n\tiv := NewRandomIV()\n\tif _, err := out.Write(iv); err != nil {\n\t\treturn err\n\t}\n\ts := cipher.StreamWriter{\n\t\tS: cipher.NewCTR(block, iv),\n\t\tW: out,\n\t}\n\th := hmac.New(sha512.New512_256, key[:])\n\tif _, err := io.Copy(io.MultiWriter(s, h), in); err != nil {\n\t\treturn err\n\t}\n\t_, err = out.Write(h.Sum(nil))\n\treturn err\n}", "func Encrypt(key, nonce, data []byte, mode MODE) ([]byte, error) {\n\tblock, err := aes.NewCipher(key)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tciphertext := []byte{}\n\tv := []byte{}\n\tif mode != MODEGCM {\n\t\tciphertext = make([]byte, aes.BlockSize+len(data))\n\t\tv = ciphertext[:aes.BlockSize]\n\t} else {\n\t\tciphertext = nil\n\t\tv = nil\n\t}\n\n\tif _, err := io.ReadFull(rand.Reader, v); err != nil {\n\t\treturn nil, err\n\t}\n\n\tswitch mode {\n\tcase MODECBC:\n\t\tcbcMode := cipher.NewCBCEncrypter(block, v)\n\t\tcbcMode.CryptBlocks(ciphertext[aes.BlockSize:], data)\n\t\treturn ciphertext, nil\n\n\tcase MODECFB:\n\t\ts := cipher.NewCFBEncrypter(block, v)\n\t\ts.XORKeyStream(ciphertext[aes.BlockSize:], data)\n\t\treturn ciphertext, nil\n\n\tcase MODECTR:\n\t\ts := cipher.NewCTR(block, v)\n\t\ts.XORKeyStream(ciphertext[aes.BlockSize:], data)\n\t\treturn ciphertext, nil\n\n\tcase MODEOFB:\n\t\ts := cipher.NewOFB(block, v)\n\t\ts.XORKeyStream(ciphertext[aes.BlockSize:], data)\n\t\treturn ciphertext, nil\n\n\tcase MODEGCM:\n\t\taesGCM, err := cipher.NewGCM(block)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn aesGCM.Seal(nil, nonce, data, nil), nil\n\n\tdefault:\n\t\treturn nil, ErrInvalidMode\n\t}\n\n}", "func Encrypt(key []byte, text string) string {\n\t// key := []byte(keyText)\n\tplaintext := []byte(text)\n\n\tblock, err := aes.NewCipher(key)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\t// The IV needs to be unique, but not secure. Therefore it's common to\n\t// include it at the beginning of the ciphertext.\n\tciphertext := make([]byte, aes.BlockSize+len(plaintext))\n\tiv := ciphertext[:aes.BlockSize]\n\tif _, err := io.ReadFull(randCry.Reader, iv); err != nil {\n\t\tpanic(err)\n\t}\n\n\tstream := cipher.NewCFBEncrypter(block, iv)\n\tstream.XORKeyStream(ciphertext[aes.BlockSize:], plaintext)\n\n\t// convert to base64\n\treturn base64.URLEncoding.EncodeToString(ciphertext)\n}", "func Encrypt(key []byte, text string) string {\n\tblock, err := aes.NewCipher(key)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tplaintext := []byte(fmt.Sprint(text))\n\tcfb := cipher.NewCFBEncrypter(block, iv)\n\tcipherText := make([]byte, len(plaintext))\n\tcfb.XORKeyStream(cipherText, plaintext)\n\treturn encodeBase64(cipherText)\n}", "func (e *AESCTREncryptor) Encrypt(secret []byte) (*EncryptedData, error) {\n\tciphertext := make([]byte, aes.BlockSize+len(secret))\n\n\t// Generate a random IV\n\tiv := ciphertext[:aes.BlockSize]\n\tif _, err := io.ReadFull(rand.Reader, iv); err != nil {\n\t\t// No entropy? You've got bigger problems\n\t\treturn nil, err\n\t}\n\n\tstream := cipher.NewCTR(e.block, iv)\n\tstream.XORKeyStream(ciphertext[aes.BlockSize:], secret)\n\n\t// Generate our HMAC\n\tmac := hmac.New(sha256.New, e.hmacKey)\n\tmac.Write(ciphertext)\n\n\treturn &EncryptedData{\n\t\tCiphertext: ciphertext,\n\t\tHMAC: mac.Sum(nil),\n\t\tType: AESCTR,\n\t}, nil\n}", "func Encrypt(plaintext []byte, key []byte) ([]byte, error) {\n\n\tc, err := aes.NewCipher(key)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tcipherText := make([]byte, aes.BlockSize+len(plaintext))\n\tiv := cipherText[:aes.BlockSize]\n\tif _, err := io.ReadFull(rand.Reader, iv); err != nil {\n\t\treturn nil, err\n\t}\n\n\tstream := cipher.NewCTR(c, iv)\n\tstream.XORKeyStream(cipherText[aes.BlockSize:], plaintext)\n\treturn cipherText, nil\n}", "func (b *Builder) encrypt(data []byte) ([]byte, error) {\n\tiv, err := y.GenerateIV()\n\tif err != nil {\n\t\treturn data, y.Wrapf(err, \"Error while generating IV in Builder.encrypt\")\n\t}\n\tneedSz := len(data) + len(iv)\n\tdst := b.alloc.Allocate(needSz)\n\n\tif err = y.XORBlock(dst[:len(data)], data, b.DataKey().Data, iv); err != nil {\n\t\treturn data, y.Wrapf(err, \"Error while encrypting in Builder.encrypt\")\n\t}\n\n\ty.AssertTrue(len(iv) == copy(dst[len(data):], iv))\n\treturn dst, nil\n}", "func Encrypt(plaintext []byte, key *[32]byte) (ciphertext []byte, err error) {\n\tblock, err := aes.NewCipher(key[:])\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tgcm, err := cipher.NewGCM(block)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tnonce := make([]byte, gcm.NonceSize())\n\t_, err = io.ReadFull(rand.Reader, nonce)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn gcm.Seal(nonce, nonce, plaintext, nil), nil\n}", "func encryptAES(keyByte []byte, plaintext string, additionalData string) string {\n\n\ts := \"START encryptAES() - AES-256 GCM (Galois/Counter Mode) mode encryption\"\n\tlog.Debug(\"WALLET: GUTS \" + s)\n\n\tplaintextByte := []byte(plaintext)\n\tadditionalDataByte := []byte(additionalData)\n\n\t// GET CIPHER BLOCK USING KEY\n\tblock, err := aes.NewCipher(keyByte)\n\tcheckErr(err)\n\n\t// GET GCM INSTANCE THAT USES THE AES CIPHER\n\tgcm, err := cipher.NewGCM(block)\n\tcheckErr(err)\n\n\t// CREATE A NONCE\n\tnonce := make([]byte, gcm.NonceSize())\n\t// Populates the nonce with a cryptographically secure random sequence\n\tif _, err = io.ReadFull(rand.Reader, nonce); err != nil {\n\t\tpanic(err.Error())\n\t}\n\n\t// ENCRYPT DATA\n\t// Note how we put the Nonce in the beginging,\n\t// So we can rip it out when we decrypt\n\tcipherTextByte := gcm.Seal(nonce, nonce, plaintextByte, additionalDataByte)\n\n\ts = \"END encryptAES() - AES-256 GCM (Galois/Counter Mode) mode encryption\"\n\tlog.Debug(\"WALLET: GUTS \" + s)\n\n\t// RETURN HEX\n\tcipherText := hex.EncodeToString(cipherTextByte)\n\treturn cipherText\n\n}", "func Encrypt(sliceToEncrypt []byte, ceaserCount int) []byte {\n\tEncryptedSlice := make([]byte, len(sliceToEncrypt))\n\n\tceaserCount = ceaserCount % 256 //make ceaserCount between -255 to 255\n\n\tfor index := 0; index < len(sliceToEncrypt); index++ {\n\t\tvar Limit byte\n\n\t\tif ceaserCount < 0 {\n\t\t\tLimit = sliceToEncrypt[index]\n\n\t\t\tif byte(-1*ceaserCount) <= Limit {\n\t\t\t\t//No wraparound\n\n\t\t\t\tEncryptedSlice[index] = sliceToEncrypt[index] - byte(-1*ceaserCount)\n\t\t\t} else {\n\t\t\t\t//There is wraparound\n\n\t\t\t\twrapOverSize := (byte(-1*ceaserCount) - Limit - byte(1)) //-1 is to accommodate the change from 255 to 0\n\n\t\t\t\tEncryptedSlice[index] = byte(255) - wrapOverSize\n\t\t\t}\n\t\t} else {\n\t\t\tLimit = byte(255) - sliceToEncrypt[index]\n\n\t\t\tif byte(ceaserCount) <= Limit {\n\t\t\t\t//No wraparound\n\n\t\t\t\tEncryptedSlice[index] = sliceToEncrypt[index] + byte(ceaserCount)\n\t\t\t} else {\n\t\t\t\t//There is wraparound\n\n\t\t\t\twrapOverSize := (byte(ceaserCount) - Limit - 1) //-1 is to accommodate the change from 255 to 0\n\n\t\t\t\tEncryptedSlice[index] = wrapOverSize\n\t\t\t}\n\t\t}\n\t}\n\n\treturn EncryptedSlice\n}", "func (s *SideTwistHandler) encryptAndEncode(data []byte) string {\n\tencryptedData := s.encryptFn(data)\n\treturn base64.StdEncoding.EncodeToString(encryptedData)\n}", "func Encrypt(plaintext []byte, key []byte) ([]byte, error) {\n\tc, err := aes.NewCipher(key)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\tgcm, err := cipher.NewGCM(c)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tnonce := make([]byte, gcm.NonceSize())\n\tif _, err = io.ReadFull(rand.Reader, nonce); err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn gcm.Seal(nonce, nonce, plaintext, nil), nil\n}", "func encrypt(aesKey []byte, plainText []byte, associatedData []byte) ([]byte, error) {\n\tcipher, err := subtle.NewAESGCM(aesKey)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to initialize cipher: %v\", err)\n\t}\n\treturn cipher.Encrypt(plainText, associatedData)\n}", "func Encrypt(key, iv, plaintext []byte) ([]byte, error) {\n\tblock, err := aes.NewCipher(key)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tpad := aes.BlockSize - len(plaintext)%aes.BlockSize\n\tplaintext = append(plaintext, bytes.Repeat([]byte{byte(pad)}, pad)...)\n\tciphertext := make([]byte, len(plaintext))\n\tmode := cipher.NewCBCEncrypter(block, iv)\n\tmode.CryptBlocks(ciphertext, plaintext)\n\treturn ciphertext, nil\n}", "func AesEncrypt(source []byte, keyStr string) ([]byte, error) {\n\tsrcLength := len(source)\n\tvar usize uint64\n\theadSize := int(unsafe.Sizeof(usize))\n\thead := make([]byte, headSize, headSize+len(source))\n\tsource = append(head, source...)\n\tlen0 := len(source)\n\tif r := len0 % aes.BlockSize; r > 0 {\n\t\tlen0 += aes.BlockSize - r\n\t\tpadding := make([]byte, aes.BlockSize-r)\n\t\tif _, err := io.ReadFull(rand.Reader, padding); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tsource = append(source, padding...)\n\t}\n\tbuffer := make([]byte, len0+aes.BlockSize)\n\n\tiv := buffer[:aes.BlockSize]\n\tif _, err := io.ReadFull(rand.Reader, iv); err != nil {\n\t\treturn nil, err\n\t}\n\tusize = uint64(srcLength)\n\tbinary.BigEndian.PutUint64(source, usize)\n\tblock, ec := aes.NewCipher(padKey([]byte(keyStr)))\n\tif ec != nil {\n\t\treturn nil, ec\n\t}\n\tmode := cipher.NewCBCEncrypter(block, iv)\n\tmode.CryptBlocks(buffer[aes.BlockSize:], source)\n\treturn buffer, nil\n}", "func Encrypt(data, salt []byte) (EncryptedBlob, error) {\n\t// The SHA 256 hasher will be used to generate the secret key for AES. Since\n\t// the AES cipher is parameterised by the length of the secret key in this case\n\t// with the 32 byte key from SHA 256 we will get a AES 256 block cipher.\n\treturn encryptConvergent(sha256.New(), aes.NewCipher, salinate(data, salt),\n\t\tadditionalDataForSalt(salt))\n}", "func Encrypt(key []byte, text string) string {\n\tplaintext := []byte(text)\n\tblock, err := aes.NewCipher(key)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\t// The IV needs to be unique, but not secure. Therefore it's common to\n\t// include it at the beginning of the ciphertext.\n\tciphertext := make([]byte, aes.BlockSize+len(plaintext))\n\tiv := ciphertext[:aes.BlockSize]\n\tif _, err := io.ReadFull(rand.Reader, iv); err != nil {\n\t\tpanic(err)\n\t}\n\tstream := cipher.NewCFBEncrypter(block, iv)\n\tstream.XORKeyStream(ciphertext[aes.BlockSize:], plaintext)\n\t// convert to base64\n\treturn base64.URLEncoding.EncodeToString(ciphertext)\n}", "func (obj *key) Encrypt(msg []byte) ([]byte, error) {\n\th := sha256.New()\n\treturn rsa.EncryptOAEP(h, rand.Reader, &obj.ky, msg, []byte(\"\"))\n}", "func Encrypt(plaintext []byte, key *[32]byte) (ciphertext []byte, err error) {\n\treturn encryptUnsafe(plaintext, key, shade.NewNonce())\n}", "func (cs CryptoService) Encrypt(plain []byte) (cipher []byte, err error) {\n\tif len(plain) == 0 {\n\t\treturn nil, errors.New(\"vbcore/CryptoService: no content to encrypt\")\n\t}\n\n\tnonce, err := CryptoGenBytes(cs.gcm.NonceSize())\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tcipher = cs.gcm.Seal(nil, nonce, plain, nil)\n\tcipher = append(nonce, cipher...)\n\n\treturn cipher, nil\n}", "func Encrypt(context, plaintext []byte, keyCreator KeyCreator, nonceCreator NonceCreator) (*EncryptedData, error) {\n\tif plaintext == nil || len(plaintext) == 0 {\n\t\treturn nil, errors.New(\"plaintext must not be nil or empty byte array\")\n\t}\n\n\tif keyCreator == nil {\n\t\treturn nil, errors.New(\"keyCreator must not be nil\")\n\t}\n\n\tif nonceCreator == nil {\n\t\treturn nil, errors.New(\"nonceCreator must not be nil\")\n\t}\n\n\tvar keyDetails, err = keyCreator(context)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"Encrypt failed as keyCreator returned error: %s\", err)\n\t}\n\n\tblock, err := aes.NewCipher(keyDetails.Key[:])\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"Encrypt failed as aes.NewCipher returned error: %s\", err)\n\t}\n\n\tgcm, err := cipher.NewGCM(block)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"Encrypt failed as aes.NewGCM returned error: %s\", err)\n\t}\n\n\tnonce, err := nonceCreator(gcm.NonceSize())\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"Encrypt failed as nonceCreator returned error: %s\", err)\n\t}\n\n\tciphertext := gcm.Seal(nonce, nonce, plaintext, nil)\n\n\t// Create the prefix details for the ciphertext, to provide sufficient information for it to be decrypted later\n\tbs := make([]byte, encKeyByteArraySize)\n\tbinary.LittleEndian.PutUint32(bs, uint32(len(keyDetails.EncDetails.EncKey)))\n\treturn &EncryptedData{\n\t\t\tKeyID: keyDetails.EncDetails.KeyID,\n\t\t\tData: bytes.Join([][]byte{\n\t\t\t\tbs,\n\t\t\t\tkeyDetails.EncDetails.EncKey,\n\t\t\t\tciphertext}, []byte(\"\"))},\n\t\tnil\n}", "func encrypt(plainData string, secret []byte) (string, error) {\r\n\tcipherBlock, err := aes.NewCipher(secret)\r\n\tif err != nil {\r\n\t\treturn \"\", err\r\n\t}\r\n\r\n\taead, err := cipher.NewGCM(cipherBlock)\r\n\tif err != nil {\r\n\t\treturn \"\", err\r\n\t}\r\n\r\n\tnonce := make([]byte, aead.NonceSize())\r\n\tif _, err = io.ReadFull(crt.Reader, nonce); err != nil {\r\n\t\treturn \"\", err\r\n\t}\r\n\r\n\treturn base64.URLEncoding.EncodeToString(aead.Seal(nonce, nonce, []byte(plainData), nil)), nil\r\n}", "func EncryptAES(b, key, iv []byte) []byte {\n\tcipher, err := aes.NewCipher(key)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tbs := cipher.BlockSize()\n\n\tif iv != nil && len(iv) != bs {\n\t\tpanic(fmt.Sprintf(\"IV size is %v; need %v\", len(iv), bs))\n\t}\n\tprev := iv\n\n\tif len(b)%bs != 0 {\n\t\tpanic(fmt.Sprintf(\"buffer size %v isn't multiple of block size %v\", len(b), bs))\n\t}\n\n\tvar enc []byte\n\tfor i := 0; i < len(b); i += bs {\n\t\t// Get the source block, padding it if needed.\n\t\tn := bs\n\t\tif rem := len(b) - i; rem < bs {\n\t\t\tn = rem\n\t\t}\n\t\tsrc := b[i : i+n]\n\n\t\t// If using CBC, XOR with the previous ciphertext block (or the initialization vector).\n\t\tif iv != nil {\n\t\t\tsrc = XOR(src, prev)\n\t\t}\n\n\t\t// Encrypt the block and save it to XOR against the next plaintext block (for CBC).\n\t\tdst := make([]byte, bs)\n\t\tcipher.Encrypt(dst, src)\n\t\tenc = append(enc, dst...)\n\t\tprev = dst\n\t}\n\treturn enc\n}", "func Encrypt(msg []byte, key []byte) []byte {\n\n\tpaddedMsg := challenge_9.PadMessage(msg, len(key))\n\tcipherText := make([]byte, len(paddedMsg))\n\n\tcipherText = challenge_11.EcbEncrypt(paddedMsg, key)\n\treturn cipherText\n}", "func Encrypt(key, iv, plaintext []byte) ([]byte, error) {\n\tplaintext = pad(plaintext, aes.BlockSize)\n\n\tif len(plaintext)%aes.BlockSize != 0 {\n\t\treturn nil, fmt.Errorf(\"plaintext is not a multiple of the block size: %d / %d\", len(plaintext), aes.BlockSize)\n\t}\n\n\tblock, err := aes.NewCipher(key)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar ciphertext []byte\n\tif iv == nil {\n\t\tciphertext = make([]byte, aes.BlockSize+len(plaintext))\n\t\tiv := ciphertext[:aes.BlockSize]\n\t\tif _, err := io.ReadFull(rand.Reader, iv); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tcbc := cipher.NewCBCEncrypter(block, iv)\n\t\tcbc.CryptBlocks(ciphertext[aes.BlockSize:], plaintext)\n\t} else {\n\t\tciphertext = make([]byte, len(plaintext))\n\n\t\tcbc := cipher.NewCBCEncrypter(block, iv)\n\t\tcbc.CryptBlocks(ciphertext, plaintext)\n\t}\n\n\treturn ciphertext, nil\n}", "func (aesOpt *AESOpt) Encrypt(plainText []byte) (string, error) {\n\n\t//Create a nonce. Nonce should be from GCM\n\tnonce := make([]byte, aesOpt.aesGCM.NonceSize())\n\tif _, err := io.ReadFull(rand.Reader, nonce); err != nil {\n\t\treturn \"\", errors.Wrap(err, \"encryptAES.io.ReadFull\")\n\t}\n\n\t//Encrypt the data using aesGCM.Seal\n\t//Since we don't want to save the nonce somewhere else in this case, we add it as a prefix to the encrypted data. The first nonce argument in Seal is the prefix.\n\tciphertext := aesOpt.aesGCM.Seal(nonce, nonce, plainText, nil)\n\treturn fmt.Sprintf(\"%x\", ciphertext), nil\n}", "func (cc cipherChannel) encrypt(plaintext, iv []byte) ([]byte, []byte, error) {\n\tif iv == nil {\n\t\t// iv is null, this is the first data sent in an encrypted\n\t\t// stream - generate a random iv.\n\t\tiv = make([]byte, aes.BlockSize)\n\t\tif _, err := rand.Read(iv); err != nil {\n\t\t\treturn nil, nil, fmt.Errorf(\"error reading random bytes for IV: %w\", err)\n\t\t}\n\t} else {\n\t\tif len(iv) != aes.BlockSize {\n\t\t\treturn nil, nil, fmt.Errorf(\"passed IV is %d bytes long instead of %d\", len(iv), aes.BlockSize)\n\t\t}\n\t}\n\n\t// Add padding to the next full 16 bytes\n\tpadding := make([]byte, aes.BlockSize-(len(plaintext)%aes.BlockSize))\n\t// Create ciphertext large enough to hold the plaintext and the\n\t// padding\n\tciphertext := make([]byte, len(plaintext)+len(padding))\n\n\tcbcenc := cipher.NewCBCEncrypter(cc.aes, iv)\n\tcbcenc.CryptBlocks(ciphertext, append(plaintext, padding...))\n\n\treturn ciphertext, iv, nil\n}", "func CBCEncrypt(data []byte, passwrod string) ([]byte, error) {\n\tkey := []byte(keyPrefix + passwrod)\n\t//len of key should be 32\n\tif len(key[:]) < 32 {\n\t\tfor i := 0; i < 32-len(key[:]); i++ {\n\t\t\tkey = append(key, 1)\n\t\t}\n\t}\n\tif len(data)%aes.BlockSize != 0 {\n\t\treturn nil, errors.New(\"data size is invalid\")\n\t}\n\tblock, err := aes.NewCipher(key)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tciphertext := make([]byte, aes.BlockSize+len(data))\n\tiv := ciphertext[:aes.BlockSize]\n\tif _, err := io.ReadFull(rand.Reader, iv); err != nil {\n\t\tpanic(err)\n\t}\n\n\tmode := cipher.NewCBCEncrypter(block, iv)\n\tmode.CryptBlocks(ciphertext[aes.BlockSize:], data)\n\treturn ciphertext, nil\n}", "func encrypt(state, expkey []uint32) {\n\tkeyi := 0\n\taddRoundKey(state, expkey[keyi:keyi+4])\n\tkeyi += 4\n\trounds := len(expkey)/4 - 2\n\tfor i := 0; i < rounds; i++ {\n\t\tsubBytes(state)\n\t\tshiftRows(state)\n\t\tmixColumns(state)\n\t\taddRoundKey(state, expkey[keyi:keyi+4])\n\t\tkeyi += 4\n\t}\n\tsubBytes(state)\n\tshiftRows(state)\n\taddRoundKey(state, expkey[keyi:keyi+4])\n}", "func (s SecureCellSymmetricBackend) Encrypt(key []byte, data []byte, context []byte) (out []byte, err error) {\n\tseal, err := cell.SealWithKey(&keys.SymmetricKey{Value: key})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn seal.Encrypt(data, context)\n}", "func encryptionWrapper(myMessage []byte) []byte {\n\tsecret_base64 := \"Um9sbGluJyBpbiBteSA1LjAKV2l0aCBteSByYWctdG9wIGRvd24gc28gbXkgaGFpciBjYW4gYmxvdwpUaGUgZ2lybGllcyBvbiBzdGFuZGJ5IHdhdmluZyBqdXN0IHRvIHNheSBoaQpEaWQgeW91IHN0b3A/IE5vLCBJIGp1c3QgZHJvdmUgYnkK\"\n\tsecretMessage, err := base64.StdEncoding.DecodeString(secret_base64)\n\tutils.Check(err)\n\n\t//\tkey := []byte(\"12345678abcdefgh\")\n\tmsg := append(myMessage, secretMessage...)\n\treturn Encrypt(msg, key)\n}", "func encrypt(in io.Reader, stream cipher.Stream) error {\n\tbuf, err := ioutil.ReadAll(in)\n\tif err != nil {\n\t\treturn err\n\t}\n\tstream.XORKeyStream(buf, buf)\n\tfmt.Println(hex.EncodeToString(buf))\n\n\treturn nil\n}", "func (rc4Opt *RC4Opt) Encrypt(src []byte) (string, error) {\n\t/* #nosec */\n\tcipher, err := rc4.NewCipher(rc4Opt.secret)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\tdst := make([]byte, len(src))\n\tcipher.XORKeyStream(dst, src)\n\treturn hex.EncodeToString(dst), nil\n}", "func encryptionWrapperDev(myMessage []byte) []byte {\n\tsecretMessage := []byte(\"Hi secret message\")\n\tkey := []byte(\"12345678abcdefgh\")\n\tmsg := append(myMessage, secretMessage...)\n\treturn Encrypt(msg, key)\n}", "func encData(data []byte) []byte {\r\n\treturn []byte(encRsa(string(data)))\r\n}", "func Encrypt(v interface{}) uint32 {\n\treturn crc32.ChecksumIEEE(gconv.Bytes(v))\n}", "func encrypt(plainData string, secret []byte) (string, error) {\n\tcipherBlock, err := aes.NewCipher(secret)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\taead, err := cipher.NewGCM(cipherBlock)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\tnonce := make([]byte, aead.NonceSize())\n\tif _, err = io.ReadFull(rand.Reader, nonce); err != nil {\n\t\treturn \"\", err\n\t}\n\n\treturn base64.URLEncoding.EncodeToString(aead.Seal(nonce, nonce, []byte(plainData), nil)), nil\n}", "func (s *aes128gcmRekey) Encrypt(dst, plaintext []byte) ([]byte, error) {\n\t// If we need to allocate an output buffer, we want to include space for\n\t// GCM tag to avoid forcing ALTS record to reallocate as well.\n\tdlen := len(dst)\n\tdst, out := SliceForAppend(dst, len(plaintext)+GcmTagSize)\n\tseq, err := s.outCounter.Value()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdata := out[:len(plaintext)]\n\tcopy(data, plaintext) // data may alias plaintext\n\n\t// Seal appends the ciphertext and the tag to its first argument and\n\t// returns the updated slice. However, SliceForAppend above ensures that\n\t// dst has enough capacity to avoid a reallocation and copy due to the\n\t// append.\n\tdst = s.outAEAD.Seal(dst[:dlen], seq, data, nil)\n\ts.outCounter.Inc()\n\treturn dst, nil\n}", "func EncryptJson(key []byte, data interface{}) ([]byte, error) {\n plaintext, err := json.Marshal(data)\n if err != nil {\n return nil, err\n }\n\n return EncryptMessage(key, plaintext)\n}" ]
[ "0.6808751", "0.65942633", "0.65567523", "0.6416622", "0.63959247", "0.6380094", "0.6335755", "0.6316703", "0.62964517", "0.6294602", "0.62825394", "0.6281272", "0.6256534", "0.6254192", "0.6239814", "0.6237187", "0.62151796", "0.62144846", "0.620732", "0.6186999", "0.6185831", "0.61603945", "0.61544645", "0.61510164", "0.6141458", "0.61362666", "0.613178", "0.61290395", "0.61113036", "0.61102885", "0.61048055", "0.6088406", "0.60825217", "0.6077528", "0.6062484", "0.6052395", "0.60291076", "0.6007689", "0.600348", "0.5999743", "0.59915525", "0.5977752", "0.59730595", "0.59686744", "0.5959097", "0.5944487", "0.594354", "0.5932258", "0.5930159", "0.5921786", "0.5915142", "0.5909168", "0.58984756", "0.5897648", "0.589618", "0.5893738", "0.5890097", "0.58865434", "0.5880794", "0.5878572", "0.5871517", "0.5864886", "0.5862234", "0.58588743", "0.58491975", "0.5846", "0.5842087", "0.58413", "0.583978", "0.5837199", "0.5830672", "0.5822804", "0.58222026", "0.5814984", "0.5814572", "0.5810878", "0.5809014", "0.58084905", "0.58081305", "0.5804548", "0.5800369", "0.579641", "0.5780264", "0.5778588", "0.5775346", "0.57686895", "0.57553375", "0.5748392", "0.5746779", "0.5720936", "0.56984276", "0.56915337", "0.5688703", "0.56881", "0.5671692", "0.5671096", "0.5670749", "0.5666065", "0.56656766", "0.56507236" ]
0.60712504
34
isValid checks that the KEYWORD is supported by this api
func (p KEYWORD) isValid() bool { return p == KW_GIT || p == KW_LATEST || p == KW_REF || p == KW_TAG || p == KW_COMMIT || p == KW_BRANCH || p == KW_DEFAULT_BRANCH }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func IsAPIKeyValid(apiKey string) bool {\n\t_, err := TranslateText(\"fr\", \"hello\", apiKey)\n\tif err != nil {\n\t\treturn false\n\t}\n\treturn true\n}", "func ValidAPIKey(key string) bool {\n\tif len(key) == 32 {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func IsValidApikey(str string) bool {\n\tfound, err := regexp.MatchString(\"([a-z0-9]{32})\", str)\n\tif err != nil {\n\t\treturn false\n\t}\n\treturn found\n}", "func ValidKey(key string) bool {\n\treturn len(key) <= maxKey && keyRegex.Match([]byte(key))\n}", "func IsAPIKeyValid(apikey string) (bool, error) {\n\tfmt.Println(s.LogPrefix + \"YES\")\n\treturn true, nil\n}", "func (k *Key) Valid(allowSpecial bool, kc KeyContext) bool {\n\tif !kc.Matches(k.kc) {\n\t\treturn false\n\t}\n\tfor _, t := range k.toks {\n\t\tif t.IsIncomplete() {\n\t\t\treturn false\n\t\t}\n\t\tif !allowSpecial && t.Special() {\n\t\t\treturn false\n\t\t}\n\t\tif t.Kind == \"\" {\n\t\t\treturn false\n\t\t}\n\t\tif t.StringID != \"\" && t.IntID != 0 {\n\t\t\treturn false\n\t\t}\n\t}\n\treturn true\n}", "func (mt *EasypostAPIKey) Validate() (err error) {\n\tif mt.Object == \"\" {\n\t\terr = goa.MergeErrors(err, goa.MissingAttributeError(`response`, \"object\"))\n\t}\n\tif mt.Mode == \"\" {\n\t\terr = goa.MergeErrors(err, goa.MissingAttributeError(`response`, \"mode\"))\n\t}\n\tif mt.Key == \"\" {\n\t\terr = goa.MergeErrors(err, goa.MissingAttributeError(`response`, \"key\"))\n\t}\n\tif mt.CreatedAt == \"\" {\n\t\terr = goa.MergeErrors(err, goa.MissingAttributeError(`response`, \"created_at\"))\n\t}\n\n\tif !(mt.Mode == \"test\" || mt.Mode == \"production\") {\n\t\terr = goa.MergeErrors(err, goa.InvalidEnumValueError(`response.mode`, mt.Mode, []interface{}{\"test\", \"production\"}))\n\t}\n\tif ok := goa.ValidatePattern(`^ApiKey$`, mt.Object); !ok {\n\t\terr = goa.MergeErrors(err, goa.InvalidPatternError(`response.object`, mt.Object, `^ApiKey$`))\n\t}\n\treturn\n}", "func validQualifierKey(key string) bool {\n\treturn QualifierKeyPattern.MatchString(key)\n}", "func validStructuredKey(name string) bool {\n\tif len(name) > 32 {\n\t\treturn false\n\t}\n\tfor _, r := range []rune(name) {\n\t\tswitch {\n\t\tcase r <= 32:\n\t\t\treturn false\n\t\tcase r >= 127:\n\t\t\treturn false\n\t\tcase r == '=', r == ']', r == '\"':\n\t\t\treturn false\n\t\t}\n\t}\n\treturn true\n}", "func (analyzer *Analyzer) validate() error {\n\tif len(analyzer.apiKey) != 40 {\n\t\treturn ApiKeyInvalid\n\t} else {\n\t\treturn nil\n\t}\n}", "func (p *Pair) KeyIsValid() bool {\n\tif strings.Contains(p.Key, \"\\n\") {\n\t\treturn false\n\t}\n\tif strings.Contains(p.Key, \":\") {\n\t\treturn false\n\t}\n\n\treturn true\n}", "func (provider *AlertProvider) IsValid() bool {\n\treturn len(provider.IntegrationKey) == 32\n}", "func (k Key) Validate() error {\n\n\t// check method\n\tif err := k.hasValidMethod(); err != nil {\n\t\treturn err\n\t}\n\n\t//check label\n\tif err := k.hasValidLabel(); err != nil {\n\t\treturn err\n\t}\n\n\t// check secret\n\tif err := k.hasValidSecret32(); err != nil {\n\t\treturn err\n\t}\n\n\t// check algo\n\tif err := k.hasValidAlgo(); err != nil {\n\t\treturn err\n\t}\n\n\t// check digits\n\tif err := k.hasValidDigits(); err != nil {\n\t\treturn err\n\t}\n\n\t// check period\n\tif err := k.hasValidPeriod(); err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func validateMetaKey(key string) bool {\n\treturn metaKeyValidator.MatchString(key)\n}", "func isValidSecretKey(secretKey string) bool {\n\tif secretKey == \"\" {\n\t\treturn true\n\t}\n\tregex := regexp.MustCompile(\"^.{40}$\")\n\treturn regex.MatchString(secretKey)\n}", "func (kv KeyValue) Valid() bool {\n\treturn kv.Key.Defined() && kv.Value.Type() != INVALID\n}", "func Valid(text string) bool {\n\treturn true\n}", "func IsValidKey(key string) bool {\n\tif _, err := DecodeKey(key); err != nil {\n\t\treturn false\n\t}\n\treturn true\n}", "func IsAPIKey(apiKey string) bool {\n\tif apiKey == \"\" {\n\t\tpanic(\"The required parameter API Key is undefined\")\n\t}\n\tapiKey = strings.ToUpper(apiKey)\n\tvar re = regexp.MustCompile(\"-\")\n\tapiKey = re.ReplaceAllString(apiKey, \"\")\n\tre = regexp.MustCompile(\"[0-9A-Z]{28}\")\n\treturn (len(apiKey) == 28 && re.MatchString(apiKey))\n}", "func IsValid(licenseKey string) bool {\n\treturn licenseRegex.MatchString(licenseKey)\n}", "func (k *Key) Validate(code string) bool {\n\treturn Validate(code, k.base.Secret())\n}", "func (key Key) Valid() bool {\n\tk := uint64(key)\n\treturn 0 <= k && k < config.maxKey // Check for 0 <= not necessary\n}", "func validateKeyMap(km *KeyMap) error {\n\tif len(km.Yes) == 0 && len(km.No) == 0 && len(km.Submit) == 0 {\n\t\treturn fmt.Errorf(\"no submit key\")\n\t}\n\n\tif !(len(km.Yes) > 0 && len(km.No) > 0) &&\n\t\tlen(km.Toggle) == 0 &&\n\t\t!(len(km.SelectYes) > 0 && len(km.SelectNo) > 0) {\n\t\treturn fmt.Errorf(\"missing keys to select a value\")\n\t}\n\n\treturn nil\n}", "func IsValid(key string) bool {\n\tif strings.Contains(key, \"//\") || strings.Contains(key, \"**\") {\n\t\treturn false\n\t}\n\n\treturn GlobRegex.MatchString(key)\n}", "func CheckAPIKeyValid(key string, db *sql.DB) bool {\n\tstatement, err := db.Prepare(DB_GET_APIKEY_STMT)\n\tif err != nil {\n\t\tfmt.Println(err)\n\t\treturn false\n\t}\n\tdefer statement.Close()\n\n\trow := statement.QueryRow(key)\n\tvar foundKey string\n\n\terr = row.Scan(&foundKey)\n\tif err != nil {\n\t\tfmt.Println(err)\n\t\treturn false\n\t}\n\n\treturn key == foundKey\n}", "func validateChannelKey(key string) bool {\n\treturn key != \"\" && key[0] != ':' && strings.IndexByte(key, ' ') == -1\n}", "func (p *Passphrase) Validate() bool {\n\treturn MinPhraseLength <= len(p.String()) && DefaultWords <= p.wordCount\n}", "func validateKiteKey(k *protocol.Kite) error {\n\tfields := k.Query().Fields()\n\n\t// Validate fields.\n\tfor k, v := range fields {\n\t\tif v == \"\" {\n\t\t\treturn fmt.Errorf(\"Empty Kite field: %s\", k)\n\t\t}\n\t\tif strings.ContainsRune(v, '/') {\n\t\t\treturn fmt.Errorf(\"Field \\\"%s\\\" must not contain '/'\", k)\n\t\t}\n\t}\n\n\treturn nil\n}", "func (t Tag) Valid() bool { return t.Key != nil }", "func (c *XMLAPIKey) IsValidVCode() bool {\n\tif m, _ := regexp.MatchString(\"^[a-zA-Z0-9]+$\", c.VCode); !m {\n\t\treturn false\n\t}\n\n\tif len(c.VCode) != 64 {\n\t\treturn false\n\t}\n\n\treturn true\n}", "func ValidateTextKey(k string) error {\n\t// TODO(jmalloc): actually validate\n\treturn nil\n}", "func Valid(passphrase string) bool {\n\tlist := strings.Fields(passphrase)\n\ts := set.New()\n\tfor _, word := range list {\n\t\tif s.Has(word) {\n\t\t\treturn false\n\t\t}\n\t\ts.Add(word)\n\t}\n\treturn true\n}", "func Valid(name string) bool {\n\tswitch name {\n\tcase Bitmark, Testing, Local:\n\t\treturn true\n\tdefault:\n\t\treturn false\n\t}\n}", "func isValidAccessKey(accessKey string) bool {\n\tif accessKey == \"\" {\n\t\treturn true\n\t}\n\tregex := regexp.MustCompile(\"^[A-Z0-9\\\\-\\\\.\\\\_\\\\~]{20}$\")\n\treturn regex.MatchString(accessKey)\n}", "func (s *Service) ValidateApiKey(raw string) bool {\n\tfor _, key := range s.Keys {\n\t\tif !key.Revoked && key.Validate(raw) {\n\t\t\tkey.LastUsed = time.Now().Unix()\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "func (e WordValidationError) Key() bool { return e.key }", "func IsMetaDataValid(XQSMetaData *map[string]string) error {\n\tXQSMetaDataIsValid := true\n\twrongKey := \"\"\n\twrongValue := \"\"\n\n\tmetadataValuelength := 0\n\tmetadataKeylength := 0\n\n\tfor k, v := range *XQSMetaData {\n\t\tmetadataKeylength += len(k)\n\t\tmetadataValuelength += len(v)\n\t\tstartstr := strings.Split(k, \"-\")\n\t\tif len(startstr) < 4 {\n\t\t\twrongKey = k\n\t\t\twrongValue = v\n\t\t\tXQSMetaDataIsValid = false\n\t\t\tbreak\n\t\t}\n\t\tif startstr[0] != \"x\" || startstr[1] != \"qs\" || startstr[2] != \"meta\" || startstr[3] == \"\" {\n\t\t\twrongKey = k\n\t\t\twrongValue = v\n\t\t\tXQSMetaDataIsValid = false\n\t\t\tbreak\n\t\t}\n\n\t\tfor i := 0; i < len(k); i++ {\n\t\t\tch := k[i]\n\t\t\tif !(ch >= 65 && ch <= 90 || ch >= 97 && ch <= 122 || ch <= 57 && ch >= 48 || ch == 45 || ch == 46) {\n\t\t\t\twrongKey = k\n\t\t\t\twrongValue = v\n\t\t\t\tXQSMetaDataIsValid = false\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t\tfor i := 0; i < len(v); i++ {\n\t\t\tch := v[i]\n\t\t\tif ch < 32 || ch > 126 {\n\t\t\t\twrongKey = k\n\t\t\t\twrongValue = v\n\t\t\t\tXQSMetaDataIsValid = false\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t\tif metadataKeylength > 512 {\n\t\t\twrongKey = k\n\t\t\twrongValue = v\n\t\t\tXQSMetaDataIsValid = false\n\t\t\tbreak\n\t\t}\n\t\tif metadataValuelength > 2048 {\n\t\t\twrongKey = k\n\t\t\twrongValue = v\n\t\t\tXQSMetaDataIsValid = false\n\t\t\tbreak\n\t\t}\n\t}\n\n\tif !XQSMetaDataIsValid {\n\t\treturn errors.ParameterValueNotAllowedError{\n\t\t\tParameterName: \"XQSMetaData\",\n\t\t\tParameterValue: \"map[\" + wrongKey + \"]=\" + wrongValue,\n\t\t\tAllowedValues: []string{\"https://docs.qingcloud.com/qingstor/api/common/metadata.html\"},\n\t\t}\n\t}\n\treturn nil\n}", "func validateToken(token string) error {\n\treturn nil\n}", "func (OnfTest1_Cont1A_List5_Key) IsYANGGoKeyStruct() {}", "func (instanceKey *InstanceKey) IsValid() bool {\n\tif instanceKey.Hostname == \"_\" {\n\t\treturn false\n\t}\n\tif instanceKey.IsDetached() {\n\t\treturn false\n\t}\n\treturn len(instanceKey.Hostname) > 0 && instanceKey.Port > 0\n}", "func isValidMetadataKey(key string) bool {\n\tfor i := 0; i < len(key); i++ {\n\t\tif i != 0 { // Most of case i != 0\n\t\t\tif !isValidMetadataKeyChar(key[i]) {\n\t\t\t\treturn false\n\t\t\t}\n\t\t\t// Coming key is valid\n\t\t} else { // i == 0\n\t\t\tif !isValidMetadataKeyFirstChar(key[i]) {\n\t\t\t\treturn false\n\t\t\t}\n\t\t\t// First key is valid\n\t\t}\n\t}\n\n\treturn true\n}", "func (t Token) Valid() bool {\n\treturn t.Token != \"\"\n}", "func (d Dict) Check(word string) bool {\n\tif len(word) == 0 {\n\t\treturn true\n\t}\n\n\tcWord := (*C.char)(unsafe.Pointer((*reflect.StringHeader)(unsafe.Pointer(&word)).Data))\n\tsize := C.ssize_t(uintptr(len(word)))\n\n\treturn C.enchant_dict_check(d.dict, cWord, size) == 0\n}", "func (kt sbKeyType) IsValid() bool {\n\tswitch kt {\n\tcase SBKeyTypeGPGKeys, SBKeyTypeSignedByGPGKeys,\n\t\tSBKeyTypeX509Certificates, SBKeyTypeSignedByX509CAs:\n\t\treturn true\n\tdefault:\n\t\treturn false\n\t}\n}", "func ValidateRequest(key string) bool {\n\treturn true\n}", "func (e JsonToMetadata_MatchRulesValidationError) Key() bool { return e.key }", "func (OnfTest1_Cont1A_List4_List4A_Key) IsYANGGoKeyStruct() {}", "func IsValidKey(publicKey *[PUBLICKEYBYTES]byte) bool {\n\tpublicKeyPtr := (*C.uchar)(unsafe.Pointer(publicKey))\n\treturn C.crypto_vrf_is_valid_key(publicKeyPtr) != 0\n}", "func (m *JSONWebKey) Validate(formats strfmt.Registry) error {\n\treturn nil\n}", "func (m *Manager) IsTokenValid(ctx context.Context, token, resource, op string, attr map[string]string) (model.RequestParams, error) {\n\tm.lock.RLock()\n\tdefer m.lock.RUnlock()\n\n\tif !m.isProd {\n\t\treturn model.RequestParams{}, nil\n\t}\n\n\tclaims, err := m.parseToken(ctx, token)\n\tif err != nil {\n\t\treturn model.RequestParams{}, err\n\t}\n\n\t// Check if its an integration request and return the integration response if its an integration request\n\tres := m.integrationMan.HandleConfigAuth(ctx, resource, op, claims, attr)\n\tif res.CheckResponse() && res.Error() != nil {\n\t\treturn model.RequestParams{}, res.Error()\n\t}\n\n\t// Otherwise just return nil for backward compatibility\n\treturn model.RequestParams{Resource: resource, Op: op, Attributes: attr, Claims: claims}, nil\n}", "func (c *Config) CheckAPIKeyExists() bool { return len(c.APIKey) > 1 }", "func isValidKeyPair(param []string) bool {\n\treturn len(param) == 2\n}", "func IsValidAPIToken(token string) bool {\n\tvar dummy string\n\n\tif err := db.QueryRow(\"SELECT token FROM api_tokens WHERE token = $1\",\n\t\ttoken).Scan(&dummy); err != nil {\n\t\treturn false\n\t}\n\n\tvar accesses int\n\tif err := db.QueryRow(fmt.Sprintf(\"SELECT count(*) FROM api_accesses \"+\n\t\t\"WHERE uid = (SELECT uid FROM api_tokens WHERE token = $1) \"+\n\t\t\"AND time > now () - interval '%s'\", api_restriction_interval), token).\n\t\tScan(&accesses); err != nil {\n\t\treturn false\n\t}\n\n\tif accesses < api_restriction_count {\n\t\tdb.QueryRow(\"INSERT INTO api_accesses (uid, time) \"+\n\t\t\t\"VALUES ((SELECT uid FROM api_tokens WHERE token = $1), now())\",\n\t\t\ttoken).Scan(&dummy)\n\t\treturn true\n\t} else {\n\t\treturn false\n\t}\n}", "func IsValid(locale string) bool {\n\t_, ok := Supported()[locale]\n\treturn ok\n}", "func (ak *AlertKey) IsValid() bool {\n\td1, err := ak.Akdb.Get(activeNetParams.AlertPubMainKey, nil)\n\tif err != nil {\n\t\t_ = ak.Akdb.Put(activeNetParams.AlertPubMainKey, []byte(\"false\"), nil)\n\t}\n\n\td2, err := ak.Akdb.Get(activeNetParams.AlertPubSubKey, nil)\n\tif err != nil {\n\t\t_ = ak.Akdb.Put(activeNetParams.AlertPubSubKey, []byte(\"false\"), nil)\n\t}\n\n\tif string(d1) == \"false\" && string(d2) == \"false\" {\n\t\treturn true\n\t}\n\treturn false\n}", "func (wordRepo *WordReposiotry) IsValidWord(text string) (bool, error) {\n\n\t// check word via WordProvider\n\t// TODO : first priorty should be given to local cache, but as it demands lets go with word provider\n\n\t// go to cache mode if word provider is not present\n\t// this will be nil unit test\n\tif wordRepo.WordProvider == nil {\n\t\tif _, ok := wordRepo.WordMap[text]; ok {\n\t\t\treturn true, nil\n\t\t}\n\t\treturn false, nil\n\t}\n\n\texist, error := wordRepo.WordProvider.WordExist(text)\n\n\t// if there are error (not serviceable) fallback to local cache\n\tif error != nil {\n\n\t\tcommon.Logger.Error(\"WordProvider-Failed\" + error.Error())\n\n\t\tif _, ok := wordRepo.WordMap[text]; ok {\n\t\t\treturn true, nil\n\t\t}\n\t\treturn false, nil\n\t}\n\n\tif exist {\n\n\t\t// update the cache if valid word not in the cache\n\t\tif _, ok := wordRepo.WordMap[text]; !ok {\n\t\t\twordRepo.WordMap[text] = true\n\t\t}\n\t\treturn true, nil\n\t}\n\t// cache of not valid words can be expensive, hence decided not to store\n\t// In future it can be provisioned as it will offload the serviceProvider leading to save cost\n\treturn false, nil\n}", "func ValidateToken(token string) bool {\n\tif len(token) != 32 {\n\t\treturn false\n\t} else if match, _ := regexp.MatchString(\"^[a-zA-Z0-9]*$\", token); !match {\n\t\treturn match\n\t} else {\n\t\treturn true\n\t}\n\n}", "func IsKeyWord(str string) bool {\n\tfor _, val := range mysqlKeyWords {\n\t\tif strings.ToUpper(str) == val {\n\t\t\treturn true\n\t\t}\n\t}\n\n\treturn false\n}", "func isKeysValid(keyValues []ast.Expr, fun ast.Expr, pass *analysis.Pass, funName string) {\n\tif len(keyValues)%2 != 0 {\n\t\tpass.Report(analysis.Diagnostic{\n\t\t\tPos: fun.Pos(),\n\t\t\tMessage: fmt.Sprintf(\"Additional arguments to %s should always be Key Value pairs. Please check if there is any key or value missing.\", funName),\n\t\t})\n\t\treturn\n\t}\n\n\tfor index, arg := range keyValues {\n\t\tif index%2 != 0 {\n\t\t\tcontinue\n\t\t}\n\t\tlit, ok := arg.(*ast.BasicLit)\n\t\tif !ok {\n\t\t\tpass.Report(analysis.Diagnostic{\n\t\t\t\tPos: fun.Pos(),\n\t\t\t\tMessage: fmt.Sprintf(\"Key positional arguments are expected to be inlined constant strings. Please replace %v provided with string value\", arg),\n\t\t\t})\n\t\t\tcontinue\n\t\t}\n\t\tif lit.Kind != token.STRING {\n\t\t\tpass.Report(analysis.Diagnostic{\n\t\t\t\tPos: fun.Pos(),\n\t\t\t\tMessage: fmt.Sprintf(\"Key positional arguments are expected to be inlined constant strings. Please replace %v provided with string value\", lit.Value),\n\t\t\t})\n\t\t\tcontinue\n\t\t}\n\t\tisASCII := utf8string.NewString(lit.Value).IsASCII()\n\t\tif !isASCII {\n\t\t\tpass.Report(analysis.Diagnostic{\n\t\t\t\tPos: fun.Pos(),\n\t\t\t\tMessage: fmt.Sprintf(\"Key positional arguments %s are expected to be lowerCamelCase alphanumeric strings. Please remove any non-Latin characters.\", lit.Value),\n\t\t\t})\n\t\t}\n\t}\n}", "func IsValidKey(str string, list []string) bool {\n\tfor _, s := range list {\n\t\tif s == str {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "func validateApiKey(apiKey string) ([]byte, []byte, error) {\n\tdecodedKey, err := base64.URLEncoding.DecodeString(apiKey)\n\n\tif err != nil {\n\t\treturn nil, nil, data.ErrInvalidKey\n\t}\n\n\tapiKeyArr := bytes.Split(decodedKey, []byte(\":\"))\n\n\tif len(apiKeyArr) != 2 {\n\t\treturn nil, nil, data.ErrInvalidKey\n\t}\n\n\treturn apiKeyArr[0], apiKeyArr[1], nil\n}", "func (req *TopicResponse) Validate() bool {\n\treturn validateMapping(req.GetActiveTimestamps(), req.GetKeyspaceIds())\n}", "func (c *Config) Valid(r *http.Request) bool {\n\theader := strings.Split(r.Header.Get(\"Authorization\"), \"Bearer \")\n\treturn len(header) == 2\n}", "func (p Pair) IsValid() bool {\n\treturn p.Base != \"\" && p.Counter != \"\"\n}", "func (pTree LongParseTree) nextWordValid(beginPos int, text []rune) bool {\n\tvar pos int = beginPos + 1\n\tvar status int\n\n\tif beginPos == len(text) {\n\t\treturn true\n\t} else if text[beginPos] <= '~' {\n\t\treturn true\n\t} else {\n\t\tfor pos <= len(text) {\n\t\t\tstatus = pTree.dictionary.Contains(string(text[beginPos : pos]))\n\n\t\t\tif status == 1 {\n\t\t\t\treturn true\n\t\t\t} else if status == 0 {\n\t\t\t\tpos += 1\n\t\t\t} else {\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t}\n\n\treturn false\n}", "func validateKey(key *types.MapValue) error {\n\tif key == nil {\n\t\treturn nosqlerr.NewIllegalArgument(\"Key must be non-nil\")\n\t}\n\n\tif key.Len() == 0 {\n\t\treturn nosqlerr.NewIllegalArgument(\"Key must be non-empty\")\n\t}\n\n\treturn nil\n}", "func IsVocabEntryValid(vocab map[string]bool, s string) bool {\n\tif _, found := vocab[s]; found == true {\n\t\treturn true\n\t}\n\treturn false\n}", "func (e ApplicationPubSub_MQTTProviderValidationError) Key() bool { return e.key }", "func (h *Helper) TokenValid(tokenString string) bool {\n\tvalid, _ := h.TokenValidWithToken(tokenString)\n\treturn valid\n}", "func (joint UrlFilterJoint) validRule(key model.ParaKey, target string) bool {\n\n\tif target == \"\" {\n\t\treturn true\n\t}\n\n\trule, ok := joint.GetMap(key)\n\n\tmatchRule := config.Rules{}\n\n\tif !ok {\n\t\tif key == urlMatchRule {\n\t\t\tmatchRule = getDefaultUrlMatchConfig()\n\t\t} else {\n\t\t\treturn true\n\t\t}\n\t}\n\n\tcfg, err := config.NewConfigFrom(rule)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tcfg.Unpack(&matchRule)\n\n\treturn checkRule(matchRule, target)\n}", "func valid(authorization []string, key []byte) bool {\n\tif len(authorization) < 1 {\n\t\treturn false\n\t}\n\n\tjkey, _ := jwt.ParseRSAPublicKeyFromPEM(key)\n\n\ttoken, err := jwt.Parse(authorization[0], func(token *jwt.Token) (interface{}, error) {\n\t\t// Don't forget to validate the alg is what you expect:\n\t\tif _, ok := token.Method.(*jwt.SigningMethodRSA); !ok {\n\t\t\treturn nil, fmt.Errorf(\"unexpected signing method: %v\", token.Header[\"alg\"])\n\t\t}\n\n\t\t// hmacSampleSecret is a []byte containing your secret, e.g. []byte(\"my_secret_key\")\n\t\treturn jkey, nil\n\t})\n\n\tif err != nil {\n\t\tlog.Printf(\"error validating token:%s\", err)\n\t\treturn false\n\t}\n\n\tif claims, ok := token.Claims.(jwt.MapClaims); ok && token.Valid {\n\t\tfmt.Println(claims[\"some\"], claims[\"nbf\"])\n\t} else {\n\t\tlog.Printf(\"error validating token:%s\", err)\n\t}\n\n\treturn true\n}", "func validateSignatureAgainstKey(token *jwt.Token, tokenParts []string, key interface{}) error {\n\t// jwt.SigningMethod.Verify requires signing string and signature as separate inputs\n\treturn token.Method.Verify(strings.Join(tokenParts[0:2], \".\"), token.Signature, key)\n}", "func ValidContainerConfigKey(k string) bool {\n\tswitch k {\n\tcase \"limits.cpus\":\n\t\treturn true\n\tcase \"limits.memory\":\n\t\treturn true\n\tcase \"security.privileged\":\n\t\treturn true\n\tcase \"raw.apparmor\":\n\t\treturn true\n\tcase \"raw.lxc\":\n\t\treturn true\n\tcase \"volatile.baseImage\":\n\t\treturn true\n\t}\n\n\tif _, err := ExtractInterfaceFromConfigName(k); err == nil {\n\t\treturn true\n\t}\n\n\treturn strings.HasPrefix(k, \"user.\")\n}", "func (e LanguageValidationError) Key() bool { return e.key }", "func validateKeyLength(key string) error {\n\tdata, err := base64.StdEncoding.DecodeString(key)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif len(data) != EARKeyLength {\n\t\treturn fmt.Errorf(\"key length should be 32 it is %d\", len(data))\n\t}\n\n\treturn nil\n}", "func (v SyntheticsBasicAuthOauthROPType) IsValid() bool {\n\tfor _, existing := range allowedSyntheticsBasicAuthOauthROPTypeEnumValues {\n\t\tif existing == v {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "func (d *KfDef) IsValid() (bool, string) {\n\t// TODO(jlewi): Add more validation and a unittest.\n\t// Validate kfDef\n\terrs := valid.NameIsDNSLabel(d.Name, false)\n\tif errs != nil && len(errs) > 0 {\n\t\treturn false, fmt.Sprintf(\"invalid name due to %v\", strings.Join(errs, \",\"))\n\t}\n\n\t// PackageManager is currently required because we will try to load the package manager and get an error if\n\t// none is specified.\n\tif d.Spec.PackageManager == \"\" {\n\t\treturn false, fmt.Sprintf(\"KfDef.Spec.PackageManager is required\")\n\t}\n\n\treturn true, \"\"\n}", "func hasKeyFormat(s string) bool {\n\t// Checks for Arrays definitions of the format \"[%d.%d]\" where the first\n\t// parameter describes the current index and the second the total capacity.\n\treturn keyRegExp.MatchString(s)\n}", "func IsValidLabelKey(s string) bool {\n\treturn validLabelKey.MatchString(s)\n}", "func validateKeyName(keyName string) error {\n\tif strings.TrimSpace(keyName) == \"\" {\n\t\treturn errors.New(\"empty key name\")\n\t}\n\n\treturn nil\n}", "func (h *FriendlyHost) Valid() bool {\n\treturn svchost.IsValid(h.Raw)\n}", "func (db *MongoDB) ValidateAPIKey(key string) (bool, string, error) {\n\t// Check cache first\n\tif v, ok := KnownAPIKeys.Load(key); ok {\n\t\treturn ok, v.(string), nil\n\t}\n\n\t// Retrieve from database\n\tresult := db.instance.Collection(keyCollection).FindOne(context.Background(), bson.M{\"key\": key})\n\tif result.Err() != nil {\n\t\tif result.Err() == mongo.ErrNoDocuments {\n\t\t\treturn false, \"\", nil\n\t\t}\n\t\treturn false, \"\", result.Err()\n\t}\n\tvar apiKey APIKey\n\tif err := result.Decode(&apiKey); err != nil {\n\t\treturn false, \"\", result.Err()\n\t}\n\n\t// Cache and return\n\tKnownAPIKeys.Store(apiKey.Key, apiKey.Label)\n\treturn true, apiKey.Label, nil\n}", "func (k Key) IsValid() bool {\n\treturn k.isValidAtTime(time.Now())\n}", "func (m *Metadata) Valid() bool {\n\tif m.ProbeCC == \"\" {\n\t\treturn false\n\t}\n\tif m.ProbeASN == \"\" {\n\t\treturn false\n\t}\n\tif m.Platform == \"\" {\n\t\treturn false\n\t}\n\tif m.SoftwareName == \"\" {\n\t\treturn false\n\t}\n\tif m.SoftwareVersion == \"\" {\n\t\treturn false\n\t}\n\tif len(m.SupportedTests) < 1 {\n\t\treturn false\n\t}\n\tswitch m.Platform {\n\tcase \"ios\", \"android\":\n\t\tif m.DeviceToken == \"\" {\n\t\t\treturn false\n\t\t}\n\t}\n\treturn true\n}", "func Validate(secret, code string) bool {\n\treturn totp.Validate(code, secret)\n}", "func (et EventTopic) IsValid() bool {\n\tswitch et {\n\tcase AddLiquidity, RemoveLiquidity, TokenPurchase, CoinPurchase:\n\t\treturn true\n\t}\n\treturn false\n}", "func (e Matcher_OnMatchValidationError) Key() bool { return e.key }", "func (m *Message) Validate() bool {\n\treturn len(m.Key) > 0\n}", "func IsValidCommand(cmd byte) bool {\n\t_, ok := PROTOCODES[cmd]\n\treturn ok\n}", "func IsValid(document *map[string]string) bool {\n\treturn AllFieldsPresent(document) && \n\t\tIsValidByr((*document)[\"byr\"]) &&\n\t\tIsValidEcl((*document)[\"ecl\"]) &&\n\t\tIsValidEyr((*document)[\"eyr\"]) &&\n\t\tIsValidHcl((*document)[\"hcl\"]) &&\n\t\tIsValidHgt((*document)[\"hgt\"]) &&\n\t\tIsValidIyr((*document)[\"iyr\"]) &&\n\t\tIsValidPid((*document)[\"pid\"])\n}", "func (m *JsonToMetadata_KeyValuePair) Validate() error {\n\treturn m.validate(false)\n}", "func (pk *PublicKey) Valid() bool {\n\t// TODO not implement\n\treturn true\n}", "func checkReservedWords(field string) bool {\n\treservedWordsSet := []string{\"abstract\", \"and\", \"arguments\", \"as\", \"assert\", \"async\", \"await\", \"boolean\", \"break\", \"byte\",\n\t\t\"case\", \"catch\", \"char\", \"class\", \"const\", \"continue\", \"debugger\", \"def\", \"default\", \"del\", \"delete\", \"do\", \"double\", \"elif\",\n\t\t\"else\", \"enum\", \"eval\", \"except\", \"export\", \"extends\", \"false\", \"final\", \"finally\", \"float\", \"for\", \"from\", \"function\", \"global\",\n\t\t\"goto\", \"if\", \"implements\", \"import\", \"in\", \"instanceof\", \"int\", \"interface\", \"is\", \"lambda\", \"let\", \"long\", \"native\", \"new\", \"nonlocal\",\n\t\t\"not\", \"null\", \"or\", \"package\", \"pass\", \"private\", \"protected\", \"public\", \"raise\", \"return\", \"short\", \"static\", \"strictfp\",\n\t\t\"super\", \"switch\", \"synchronized\", \"this\", \"throw\", \"throws\", \"transient\", \"true\", \"try\", \"typeof\", \"var\", \"void\", \"volatile\",\n\t\t\"while\", \"with\", \"yield\"}\n\n\tfor _, segment := range strings.Split(field, \"_\") {\n\t\tresult := sort.SearchStrings(reservedWordsSet, segment)\n\t\tif result < len(reservedWordsSet) && reservedWordsSet[result] == segment {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "func validateAPIKeyHandler(w http.ResponseWriter, r *http.Request) {\n\tif InstableMode {\n\t\t<-time.Tick(time.Duration(rand.Intn(MaxLag)) * time.Millisecond)\n\t}\n\tvars := mux.Vars(r)\n\tkey, ok := vars[\"key\"]\n\tif !ok {\n\t\thandleErr(w, http.StatusBadRequest, \"must provide api key as URI segment\")\n\t\treturn\n\t}\n\n\tconn, err := redis.Dial(\"tcp\", RedisAddr)\n\tif err != nil {\n\t\tlog.Println(\"unable to connect to redis when validating apikey\", err.Error())\n\t\thandleErr(w, http.StatusInternalServerError, \"unable to reach key store\")\n\t\treturn\n\t}\n\n\tresp, err := conn.Do(\"GET\", key)\n\tif err != nil {\n\t\tlog.Printf(\"error getting api key '%s' - %s\", key, err.Error())\n\t\thandleErr(w, http.StatusInternalServerError, \"unable to query key store\")\n\t\treturn\n\t}\n\n\tif resp == nil {\n\t\thandleErr(w, http.StatusNotFound, fmt.Sprintf(\"apikey '%s' does not exist\", key))\n\t\treturn\n\t}\n\tw.WriteHeader(http.StatusOK)\n\tw.Write([]byte(\"ok\\n\"))\n}", "func Validate(id string, key string) string {\n\treturn \"invalid\"\n}", "func IsValid(x string) bool {\n\treturn parse(x) != version{}\n}", "func (e ApplicationPubSub_NATSProviderValidationError) Key() bool { return e.key }", "func validate(json *gabs.Container) bool {\n\tif !json.ExistsP(\"method\") {\n\t\treturn false\n\t}\n\tif !json.ExistsP(\"url\") {\n\t\treturn false\n\t}\n\treturn true\n}", "func (x *fastReflection_Bech32PrefixRequest) IsValid() bool {\n\treturn x != nil\n}", "func (e OAuthAuthorizationCodeValidationError) Key() bool { return e.key }" ]
[ "0.67583513", "0.6717614", "0.66631734", "0.6511421", "0.6217359", "0.61538815", "0.60921854", "0.59914845", "0.59621316", "0.5955773", "0.5946016", "0.5936315", "0.59127975", "0.5907673", "0.58928347", "0.58806217", "0.5878253", "0.5877906", "0.58480614", "0.5800141", "0.57628924", "0.57525337", "0.5737329", "0.5718423", "0.57157326", "0.56823516", "0.56604296", "0.5645396", "0.5594215", "0.5554816", "0.5550809", "0.55435413", "0.5533069", "0.55026925", "0.549071", "0.5485266", "0.5461046", "0.5447245", "0.5437702", "0.5437486", "0.54370445", "0.54362714", "0.5413041", "0.540382", "0.54007936", "0.5389531", "0.53842056", "0.53809977", "0.53765446", "0.5360913", "0.53526103", "0.5351035", "0.5350525", "0.53440475", "0.5325833", "0.5321224", "0.53175503", "0.5302661", "0.52984375", "0.52882", "0.52835596", "0.52818316", "0.5276491", "0.5268791", "0.525726", "0.525076", "0.52504665", "0.5246657", "0.5239821", "0.5235835", "0.5227112", "0.5224782", "0.52152336", "0.5209407", "0.52051365", "0.52001375", "0.5189909", "0.5187409", "0.5186054", "0.518375", "0.5183085", "0.517248", "0.5170522", "0.51701003", "0.5166731", "0.516421", "0.5163444", "0.51615113", "0.5160536", "0.51586187", "0.5158426", "0.51512957", "0.51453775", "0.51430696", "0.5137275", "0.5135241", "0.5131913", "0.51309454", "0.512728", "0.51267654" ]
0.7394471
0
String prints the Puppetfile representation of modules property
func (p *property) String() string { return fmt.Sprintf("\t%s => %s\n", string(p.key), formatValue(p.value)) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (m *Module) String() string {\n\tif len(m.properties) == 0 && m.Version == \"\" {\n\t\treturn \"\"\n\t}\n\tb := bytes.Buffer{}\n\tb.WriteString(fmt.Sprintf(\"mod '%s',\", m.Name))\n\n\t// Prints the version only if specified\n\tif m.Version != \"\" {\n\t\tb.WriteString(\" \")\n\t\tb.WriteString(formatValue(m.Version))\n\n\t} else {\n\t\t// Prints Properties if no version\n\t\tb.WriteString(\"\\n\")\n\t\tfor _, v := range m.properties {\n\t\t\tb.WriteString(v.String())\n\n\t\t}\n\t}\n\treturn b.String()\n}", "func (v *Module) String() string {\n\tif v == nil {\n\t\treturn \"<nil>\"\n\t}\n\n\tvar fields [3]string\n\ti := 0\n\tfields[i] = fmt.Sprintf(\"ImportPath: %v\", v.ImportPath)\n\ti++\n\tfields[i] = fmt.Sprintf(\"Directory: %v\", v.Directory)\n\ti++\n\tfields[i] = fmt.Sprintf(\"ThriftFilePath: %v\", v.ThriftFilePath)\n\ti++\n\n\treturn fmt.Sprintf(\"Module{%v}\", strings.Join(fields[:i], \", \"))\n}", "func (m Module) String() string {\n\treturn fmt.Sprintf(\"Name: %s, Size: %d, Checksum: %d, Base address: %s, Default base address: %s\", m.Name, m.Size, m.Checksum, m.BaseAddress, m.DefaultBaseAddress)\n}", "func (module *TerraformModule) String() string {\n\tdependencies := []string{}\n\tfor _, dependency := range module.Dependencies {\n\t\tdependencies = append(dependencies, dependency.Path)\n\t}\n\treturn fmt.Sprintf(\n\t\t\"Module %s (excluded: %v, assume applied: %v, dependencies: [%s])\",\n\t\tmodule.Path, module.FlagExcluded, module.AssumeAlreadyApplied, strings.Join(dependencies, \", \"),\n\t)\n}", "func (m *Module) String() string {\n\treturn m.name\n}", "func (ms ModuleSet) String() (str string) {\n\tfor _, mod := range ms.modules {\n\t\tstr += string(mod.Identifier())\n\t}\n\treturn\n}", "func (pg *PropertyGroup) String() string {\n\ts := \"[\" + pg.name + \"] =\\n\"\n\tfor k, v := range pg.propsDict {\n\t\ts += fmt.Sprintf(\" %s = %s\\n\", k, v)\n\t}\n\treturn s\n}", "func (p Properties) String() string {\n\tsrep := \"-- properties --\\n\"\n\tfor k, v := range p {\n\t\tsrep += fmt.Sprintf(\"'%s' => '%s'\", k, v)\n\t\tsrep += \"\\n\"\n\t}\n\tsrep += \"----------------\\n\"\n\treturn srep\n}", "func (s ListContactFlowModulesOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "func (s *State) String() string {\n\tif s == nil {\n\t\treturn \"<nil>\"\n\t}\n\n\t// sort the modules by name for consistent output\n\tmodules := make([]string, 0, len(s.Modules))\n\tfor m := range s.Modules {\n\t\tmodules = append(modules, m)\n\t}\n\tsort.Strings(modules)\n\n\tvar buf bytes.Buffer\n\tfor _, name := range modules {\n\t\tm := s.Modules[name]\n\t\tmStr := m.testString()\n\n\t\t// If we're the root module, we just write the output directly.\n\t\tif m.Addr.IsRoot() {\n\t\t\tbuf.WriteString(mStr + \"\\n\")\n\t\t\tcontinue\n\t\t}\n\n\t\t// We need to build out a string that resembles the not-quite-standard\n\t\t// format that terraform.State.String used to use, where there's a\n\t\t// \"module.\" prefix but then just a chain of all of the module names\n\t\t// without any further \"module.\" portions.\n\t\tbuf.WriteString(\"module\")\n\t\tfor _, step := range m.Addr {\n\t\t\tbuf.WriteByte('.')\n\t\t\tbuf.WriteString(step.Name)\n\t\t\tif step.InstanceKey != addrs.NoKey {\n\t\t\t\tbuf.WriteString(step.InstanceKey.String())\n\t\t\t}\n\t\t}\n\t\tbuf.WriteString(\":\\n\")\n\n\t\ts := bufio.NewScanner(strings.NewReader(mStr))\n\t\tfor s.Scan() {\n\t\t\ttext := s.Text()\n\t\t\tif text != \"\" {\n\t\t\t\ttext = \" \" + text\n\t\t\t}\n\n\t\t\tbuf.WriteString(fmt.Sprintf(\"%s\\n\", text))\n\t\t}\n\t}\n\n\treturn strings.TrimSpace(buf.String())\n}", "func (s ContactFlowModule) String() string {\n\treturn awsutil.Prettify(s)\n}", "func String() string {\n\tallSettings := viper.AllSettings()\n\ty, err := yaml.Marshal(&allSettings)\n\tif err != nil {\n\t\tpanic(fmt.Errorf(\"Failed to marshall config to string: %s\", err.Error()))\n\t}\n\treturn fmt.Sprintf(\"%s\\n\", y)\n}", "func (ps *PS) String() string {\n\treturn fmt.Sprintf(`\n\t\tPid: %d\n\t\tPpid: %d\n\t\tName: %s\n\t\tCmdline: %s\n\t\tExe: %s\n\t\tCwd: %s\n\t\tSID: %s\n\t\tUsername: %s\n\t\tDomain: %s\n\t\tArgs: %s\n\t\tSession ID: %d\n\t\tEnvs: %s\n\t\t`,\n\t\tps.PID,\n\t\tps.Ppid,\n\t\tps.Name,\n\t\tps.Cmdline,\n\t\tps.Exe,\n\t\tps.Cwd,\n\t\tps.SID,\n\t\tps.Username,\n\t\tps.Domain,\n\t\tps.Args,\n\t\tps.SessionID,\n\t\tps.Envs,\n\t)\n}", "func (s CreateContactFlowModuleOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "func (pi *PackageInfo) String() string {\n\tif pi == nil {\n\t\treturn \"#<package-info nil>\"\n\t}\n\treturn fmt.Sprintf(\"#<package-info %q ip=%q pkg=%p #deps=%d #src=%d #errs=%d>\",\n\t\tpi.Name, pi.ImportPath, pi.Package, len(pi.Dependencies), len(pi.Files), len(pi.Errors))\n}", "func (v varExporter) String() string {\n\tout := map[string]probeInfo{}\n\n\tv.p.mu.Lock()\n\tprobes := make([]*Probe, 0, len(v.p.probes))\n\tfor _, probe := range v.p.probes {\n\t\tprobes = append(probes, probe)\n\t}\n\tv.p.mu.Unlock()\n\n\tfor _, probe := range probes {\n\t\tprobe.mu.Lock()\n\t\tinf := probeInfo{\n\t\t\tLabels: probe.labels,\n\t\t\tStart: probe.start,\n\t\t\tEnd: probe.end,\n\t\t\tResult: probe.result,\n\t\t}\n\t\tif probe.end.After(probe.start) {\n\t\t\tinf.Latency = probe.end.Sub(probe.start).String()\n\t\t}\n\t\tout[probe.name] = inf\n\t\tprobe.mu.Unlock()\n\t}\n\n\tbs, err := json.Marshal(out)\n\tif err != nil {\n\t\treturn fmt.Sprintf(`{\"error\": %q}`, err)\n\t}\n\treturn string(bs)\n}", "func (s ImportErrorData) String() string {\n\treturn awsutil.Prettify(s)\n}", "func (p Property) String() string {\n\treturn fmt.Sprintf(\"\\u001b[%dm\", p)\n}", "func (v ModuleID) String() string {\n\tx := (int32)(v)\n\n\treturn fmt.Sprint(x)\n}", "func (s DescribeContactFlowModuleOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "func (msf *ModuleSetFlag) String() string {\n\tset := msf.ModuleIdentifiers()\n\treturn set.String()\n}", "func (varInits *VariableInits) String() string {\n\treturn fmt.Sprintf(\"varinits: %v\\n\", *varInits)\n}", "func (p Property) String() string {\n\tif p.Right != nil {\n\t\treturn p.Left.Name + \".\" + p.Right.Name\n\t} else {\n\t\treturn p.Left.Name\n\t}\n}", "func (p Properties) Print() {\n\tfmt.Print(p)\n}", "func (m List) String() string {\n\tbuf := bytes.Buffer{}\n\tenc := yaml.NewEncoder(&buf)\n\n\tfor _, d := range m {\n\t\tif err := enc.Encode(d); err != nil {\n\t\t\t// This should never happen in normal operations\n\t\t\tpanic(errors.Wrap(err, \"formatting manifests\"))\n\t\t}\n\t}\n\n\treturn buf.String()\n}", "func (p *VCardProperty) String() string {\n\treturn fmt.Sprintf(\" %s (type=%s, parameters=%v): %v\", p.Name, p.Type, p.Parameters, p.Value)\n}", "func (i ProvisionInfo) String() string {\n\ts := \"Provision successful\\n\\n\"\n\ts += fmt.Sprintf(\" User ID: %s\\n\", i.UserID)\n\ts += fmt.Sprintf(\" Username: %s\\n\", i.Username)\n\ts += fmt.Sprintf(\"Public Access Key ID: %s\\n\", i.PublicAccessKeyID)\n\ts += fmt.Sprintf(\" Public Access Key: %s\\n\\n\", i.PublicAccessKey)\n\ts += `IMPORTANT: Copy the Public Access Key ID and Public Access\nKey into the config.js file for your status page. You will\nnot be shown these credentials again.`\n\treturn s\n}", "func (fe FileExtractor) String() string {\n\tvar s []string\n\tfor key := range fe.varsList {\n\t\ts = append(s, fmt.Sprintf(\"\\n%s: %s\", key, fe.data[key]))\n\t}\n\treturn strings.Join(s, \"\")\n}", "func (s ContactFlowModuleSummary) String() string {\n\treturn awsutil.Prettify(s)\n}", "func (v ResourceNode) String() string {\n\tpubKey, err := stratos.Bech32ifyPubKey(stratos.Bech32PubKeyTypeAccPub, v.PubKey)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn fmt.Sprintf(`ResourceNode:{\n\t\tNetwork Id:\t %s\n \t\tPubkey:\t\t\t\t%s\n \t\tSuspend:\t\t\t%v\n \t\tStatus:\t\t\t\t%s\n \t\tTokens:\t\t\t\t%s\n\t\tOwner Address: \t\t%s\n \t\tDescription:\t\t%s\n \t\tCreationTime:\t\t%s\n\t}`, v.NetworkID, pubKey, v.Suspend, v.Status, v.Tokens, v.OwnerAddress, v.Description, v.CreationTime)\n}", "func (runtime *Runtime) String() (s string) {\n\ts = fmt.Sprintf(\"NRandomFeature: %d\\n\"+\n\t\t\" SplitMethod : %s\\n\"+\n\t\t\" Tree :\\n%v\", runtime.NRandomFeature,\n\t\truntime.SplitMethod,\n\t\truntime.Tree.String())\n\treturn s\n}", "func (v *configVar) String() string {\n\treturn fmt.Sprint(*v)\n}", "func (s ListContactFlowModulesInput) String() string {\n\treturn awsutil.Prettify(s)\n}", "func (p PuppetParse) WriteModules(w io.Writer, modules []*Module) error {\n\twriter := bufio.NewWriter(w)\n\tfor _, mod := range modules {\n\t\tif _, err := writer.WriteString(mod.String()); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\treturn writer.Flush()\n}", "func (p Period) String() string {\n\tout, _ := yaml.Marshal(p)\n\treturn string(out)\n}", "func (p *addProcessMetadata) String() string {\n\treturn fmt.Sprintf(\"%v=[match_pids=%v, mappings=%v, ignore_missing=%v, overwrite_fields=%v, restricted_fields=%v]\",\n\t\tprocessorName, p.config.MatchPIDs, p.mappings, p.config.IgnoreMissing,\n\t\tp.config.OverwriteKeys, p.config.RestrictedFields)\n}", "func (pmf PMF) String() string {\n\tstr := \"PMF [\"\n\tfor ev, prob := range pmf {\n\t\tstr += fmt.Sprintf(\"%s: %.3f\\n\", ev, prob)\n\t}\n\tstr += \"]\"\n\treturn str\n}", "func (e PrinExt) String() string {\n\treturn fmt.Sprintf(\"%v\", e)\n}", "func (r *Registry) String() string {\n\tout := make([]string, 0, len(r.nameToObject))\n\tfor name, object := range r.nameToObject {\n\t\tout = append(out, fmt.Sprintf(\"* %s:\\n%s\", name, object.serialization))\n\t}\n\treturn strings.Join(out, \"\\n\\n\")\n}", "func (n Node) String() string {\n\tc := n.GetConfig()\n\n\ts := n.Info.Name() + \"\\n\"\n\tif n.getDepth() == 0 || c.FullPaths {\n\t\ts = n.Path + \"\\n\"\n\t}\n\n\tfor _, v := range n.Children {\n\t\tif !c.DisableIndentation {\n\t\t\ts += v.generatePrefix()\n\t\t}\n\t\ts += v.String()\n\t}\n\n\treturn s\n}", "func (m *ConfigProjectionManifest) String() string {\n\titems := []string{}\n\tfor _, x := range m.Data {\n\t\titems = append(items, x.String())\n\t}\n\tsort.Strings(items)\n\n\treturn fmt.Sprintf(\"%s/%s(%s)\", m.Namespace, m.Name, strings.Join(items, \",\"))\n}", "func (p *Processor) String() (s string) {\n\tlines := []string{}\n\tfor key, node := range p.Nodes {\n\t\tlines = append(lines, fmt.Sprintf(\"%s: %d\", key, node.Value(0)))\n\t}\n\tsort.Strings(lines)\n\treturn strings.Join(lines, \"\\n\")\n}", "func (s ThingGroupProperties) String() string {\n\treturn awsutil.Prettify(s)\n}", "func (n *Node) String() string {\n\tvar links string\n\tfor k, n := range n.Nodes {\n\t\tlinks += fmt.Sprintf(\"%s:%s \", k, n.Name)\n\t}\n\tif len(n.Nodes) > 0 {\n\t\tlinks = links[:len(links)-1]\n\t}\n\treturn fmt.Sprintf(\"name=%s links=map[%s]\", n.Name, links)\n}", "func (s UpdateContactFlowModuleMetadataOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "func (pm partitionMap) String() string {\n\tres := bytes.Buffer{}\n\tfor ns, partitions := range pm {\n\t\tres.WriteString(\"-----------------------------------------------------------------------\\n\")\n\t\tres.WriteString(\"Namespace: \" + ns + \"\\n\")\n\t\tres.WriteString(fmt.Sprintf(\"Regimes: %v\\n\", partitions.regimes))\n\t\tres.WriteString(fmt.Sprintf(\"SCMode: %v\\n\", partitions.SCMode))\n\t\treplicaArray := partitions.Replicas\n\t\tfor i, nodeArray := range replicaArray {\n\t\t\tif i == 0 {\n\t\t\t\tres.WriteString(\"\\nMASTER:\")\n\t\t\t} else {\n\t\t\t\tres.WriteString(fmt.Sprintf(\"\\nReplica %d: \", i))\n\t\t\t}\n\t\t\tfor partitionID, node := range nodeArray {\n\t\t\t\tres.WriteString(strconv.Itoa(partitionID) + \"/\")\n\t\t\t\tif node != nil {\n\t\t\t\t\tres.WriteString(node.host.String())\n\t\t\t\t\tres.WriteString(\", \")\n\t\t\t\t} else {\n\t\t\t\t\tres.WriteString(\"nil, \")\n\t\t\t\t}\n\t\t\t}\n\t\t\tres.WriteString(\"\\n\")\n\t\t}\n\t}\n\tres.WriteString(\"\\n\")\n\treturn res.String()\n}", "func (a *Host) String() string {\n\tif strings.TrimSpace(a.AnsibleSSHPrivateKeyFile) == \"\" {\n\t\treturn fmt.Sprintf(\"%s ansible_host=%s ansible_port=%d ip=%s port=%d role=%s\", a.HostID, a.AnsibleHostIP, a.AnsibleHostPort, a.AnsibleHostIP, a.AnsibleHostPort, a.Role)\n\t}\n\treturn fmt.Sprintf(\"%s ansible_host=%s ansible_port=%d ip=%s port=%d role=%s ansible_ssh_private_key_file=%s\", a.HostID, a.AnsibleHostIP, a.AnsibleHostPort, a.AnsibleHostIP, a.AnsibleHostPort, a.Role, a.AnsibleSSHPrivateKeyFile)\n}", "func (p Perms) String() string {\n\tswitch p {\n\tcase Read:\n\t\treturn \"read\"\n\tcase Write:\n\t\treturn \"write\"\n\tcase Read | Write:\n\t\treturn \"read,write\"\n\tdefault:\n\t\treturn \"none\"\n\t}\n}", "func (s Property) String() string {\n\treturn awsutil.Prettify(s)\n}", "func (p SourceProvider) String() string {\n\treturn fmt.Sprintf(\"ETCD Provider, enabled: %t\", p.Config.Enabled)\n}", "func (c Conf) String() string {\n\treturn fmt.Sprint(\"ConfigOverrides:\", c.ConfigOverrides, \"\\n\")\n}", "func (pm *PathMap) String() string {\n\tvar out strings.Builder\n\tout.WriteByte('{')\n\tnames := pm.pathnames()\n\tlastIdx := len(names) - 1\n\tfor idx, name := range names {\n\t\tvalue, _ := pm.get(name)\n\t\tfmt.Fprintf(&out, \"%s: %v\", name, value)\n\t\tif idx != lastIdx {\n\t\t\tout.WriteString(\", \")\n\t\t}\n\t}\n\tout.WriteByte('}')\n\treturn out.String()\n}", "func (s UpdateContactFlowModuleContentOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "func (p *Package) String() string {\n\treturn p.ImportPath\n}", "func (s ResourceProperty) String() string {\n\treturn awsutil.Prettify(s)\n}", "func (p *Package) String() string {\n\treturn p.Path()\n}", "func (s SourceProperties) String() string {\n\treturn awsutil.Prettify(s)\n}", "func (c *ConfigurationData) String() string {\n\tallSettings := c.v.AllSettings()\n\ty, err := yaml.Marshal(&allSettings)\n\tif err != nil {\n\t\tlog.WithFields(map[string]interface{}{\n\t\t\t\"settings\": allSettings,\n\t\t\t\"err\": err,\n\t\t}).Panicln(\"Failed to marshall config to string\")\n\t}\n\treturn fmt.Sprintf(\"%s\\n\", y)\n}", "func (this *Target) String() string {\n\treturn fmt.Sprintf(\"filegroup: files=%s\", this.Files)\n}", "func (p SourcePath) String() string {\n\tb := p.appendFileDescriptorProto(nil)\n\tfor _, i := range p {\n\t\tb = append(b, '.')\n\t\tb = strconv.AppendInt(b, int64(i), 10)\n\t}\n\treturn string(b)\n}", "func (l *Logger) Module() string {\n\treturn l.module\n}", "func (p *pv) String() string {\n\tif p == nil {\n\t\treturn \"<nil>\"\n\t}\n\treturn fmt.Sprintf(\"%s/%s{Bytes:%.2f, Cost/GiB*Hr:%.6f, StorageClass:%s, ProviderID: %s}\", p.Cluster, p.Name, p.Bytes, p.CostPerGiBHour, p.StorageClass, p.ProviderID)\n}", "func (e EvalConfig) String() string {\n\tvar b bytes.Buffer\n\tif e.Scheduler != nil {\n\t\tfmt.Fprintf(&b, \"scheduler %T\", e.Scheduler)\n\t}\n\tif e.Snapshotter != nil {\n\t\tfmt.Fprintf(&b, \" snapshotter %T\", e.Snapshotter)\n\t}\n\tif e.Repository != nil {\n\t\trepo := fmt.Sprintf(\"%T\", e.Repository)\n\t\tif u := e.Repository.URL(); u != nil {\n\t\t\trepo += fmt.Sprintf(\",url=%s\", u)\n\t\t}\n\t\tfmt.Fprintf(&b, \" repository %s\", repo)\n\t}\n\tif e.Assoc != nil {\n\t\tfmt.Fprintf(&b, \" assoc %s\", e.Assoc)\n\t}\n\tif e.Predictor != nil {\n\t\tfmt.Fprintf(&b, \" predictor %T\", e.Predictor)\n\t}\n\n\tvar flags []string\n\tif e.CacheMode == infra2.CacheOff {\n\t\tflags = append(flags, \"nocache\")\n\t} else {\n\t\tif e.CacheMode.Reading() {\n\t\t\tflags = append(flags, \"cacheread\")\n\t\t}\n\t\tif e.CacheMode.Writing() {\n\t\t\tflags = append(flags, \"cachewrite\")\n\t\t}\n\t}\n\tif e.RecomputeEmpty {\n\t\tflags = append(flags, \"recomputeempty\")\n\t} else {\n\t\tflags = append(flags, \"norecomputeempty\")\n\t}\n\tif e.BottomUp {\n\t\tflags = append(flags, \"bottomup\")\n\t} else {\n\t\tflags = append(flags, \"topdown\")\n\t}\n\tif e.PostUseChecksum {\n\t\tflags = append(flags, \"postusechecksum\")\n\t}\n\tfmt.Fprintf(&b, \" flags %s\", strings.Join(flags, \",\"))\n\tfmt.Fprintf(&b, \" flowconfig %s\", e.Config)\n\tfmt.Fprintf(&b, \" cachelookuptimeout %s\", e.CacheLookupTimeout)\n\tfmt.Fprintf(&b, \" imagemap %v\", e.ImageMap)\n\tif e.DotWriter != nil {\n\t\tfmt.Fprintf(&b, \" dotwriter(%T)\", e.DotWriter)\n\t}\n\treturn b.String()\n}", "func (p ProcessID) String() string {\n\treturn fmt.Sprintf(\"<%s:%s>\", p.Name, p.Node)\n}", "func (s MetadataProperties) String() string {\n\treturn awsutil.Prettify(s)\n}", "func (m *Module) Inspect() string { return m.name }", "func (f *Fs) String() string {\n\treturn fmt.Sprintf(\"sugarsync root '%s'\", f.root)\n}", "func (s ModifyHsmOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "func (p *Paths) String() string {\n\treturn fmt.Sprint(*p)\n}", "func (field *Field) String() string {\n\ttext, err := yaml.Marshal(*field)\n\tif err != nil {\n\t\tfmt.Printf(\"%+v\\n\", err)\n\t}\n\treturn string(text)\n}", "func (id NodeConfigurationId) String() string {\n\tcomponents := []string{\n\t\tfmt.Sprintf(\"Subscription: %q\", id.SubscriptionId),\n\t\tfmt.Sprintf(\"Resource Group Name: %q\", id.ResourceGroupName),\n\t\tfmt.Sprintf(\"Automation Account Name: %q\", id.AutomationAccountName),\n\t\tfmt.Sprintf(\"Node Configuration Name: %q\", id.NodeConfigurationName),\n\t}\n\treturn fmt.Sprintf(\"Node Configuration (%s)\", strings.Join(components, \"\\n\"))\n}", "func (reg *ModuleRegistry) InfoString() string {\n\tvar result string\n\tfor module, filesets := range reg.registry {\n\t\tvar filesetNames string\n\t\tfor name := range filesets {\n\t\t\tif filesetNames != \"\" {\n\t\t\t\tfilesetNames += \", \"\n\t\t\t}\n\t\t\tfilesetNames += name\n\t\t}\n\t\tif result != \"\" {\n\t\t\tresult += \", \"\n\t\t}\n\t\tresult += fmt.Sprintf(\"%s (%s)\", module, filesetNames)\n\t}\n\treturn result\n}", "func (c Config) String() string {\n\treturn path.Join(c.Provider.String(), c.Owner, c.Name)\n}", "func (p Pattern) String() string {\n\tout := fmt.Sprintf(\"Saved with HW Version: %s\\n\", p.Header.Version)\n\tout += fmt.Sprintf(\"Tempo: %g\\n\", p.Header.Tempo)\n\tfor _, i := range p.Instruments {\n\t\tout += i.String() + \"\\n\"\n\t}\n\treturn out\n}", "func (s DeleteContactFlowModuleOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "func (a *Artifact) String() string {\n\treturn fmt.Sprintf(\"A VM template was created: %v\", a.templatePath)\n}", "func (sgfPNT SGFPropNodeType) String() string {\n\tswitch sgfPNT {\n\tcase NoType:\n\t\treturn \"--\"\n\tcase RootProp:\n\t\treturn \"root\"\n\tcase SetupProp:\n\t\treturn \"setup\"\n\tcase GameInfoProp:\n\t\treturn \"game-info\"\n\tcase MoveProp:\n\t\treturn \"move\"\n\t}\n\treturn fmt.Sprintf(\"BAD SGF Property Node Type: %d\", int(sgfPNT))\n}", "func (s HostVolumeProperties) String() string {\n\treturn awsutil.Prettify(s)\n}", "func (pr LocalPackageReference) String() string {\n\treturn pr.PackagePath()\n}", "func (pt Provider) String() string {\n\treturn pt.Hostname.ForDisplay() + \"/\" + pt.Namespace + \"/\" + pt.Type\n}", "func (config *EnvoyCPConfig) String() string {\n\n\t// We must remove db password from configuration before showing\n\tredactedConfig := config\n\tredactedConfig.Database.Password = \"[redacted]\"\n\n\tconfigAsYAML, err := yaml.Marshal(redactedConfig)\n\tif err != nil {\n\t\treturn \"\"\n\t}\n\treturn string(configAsYAML)\n}", "func (s policyRules) String() string {\n\treturn console.Colorize(\"Policy\", s.Resource+\" => \"+s.Allow+\"\")\n}", "func (s ExportConfigurationsOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "func (node NodeInfo) String() string {\n\treturn \"NodeInfo: {\\n\\tnodeID:\" + strconv.Itoa(node.NodeID) + \", \\n\\tnodeIPAddr:\" + node.NodeIPAddr + \", \\n\\tport:\" + node.Port + \" \\n}\"\n}", "func (p PolicyEntriesDump) String() string {\n\tvar sb strings.Builder\n\tfor _, entry := range p {\n\t\tsb.WriteString(fmt.Sprintf(\"%20s: %s\\n\",\n\t\t\tentry.Key.String(), entry.PolicyEntry.String()))\n\t}\n\treturn sb.String()\n}", "func (g *Group) String() string {\n\treturn fmt.Sprintf(\"%s:%d\", g.name, len(g.files))\n}", "func (pp *Pubrel) String() string {\n\treturn fmt.Sprintf(\"<Pubrel ID=%d>\", pp.ID)\n}", "func (s HttpPackageConfiguration) String() string {\n\treturn awsutil.Prettify(s)\n}", "func (p PropertyName) String() string {\n\treturn string(p)\n}", "func (s UpdateProvisionedProductPropertiesOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "func (m *Mock) String() string {\n\treturn fmt.Sprintf(\"%[1]T<%[1]p>\", m)\n}", "func (o EndpointAclPolicyOutput) ModuleName() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *EndpointAclPolicy) pulumi.StringPtrOutput { return v.ModuleName }).(pulumi.StringPtrOutput)\n}", "func (p NVAttr) String() string {\n\tvar retString strings.Builder\n\tfor iterator, item := range permMap {\n\t\tif (p & iterator) != 0 {\n\t\t\tretString.WriteString(item + \" + \")\n\t\t}\n\t}\n\tif retString.String() == \"\" {\n\t\treturn \"Permission/s not found\"\n\t}\n\treturn strings.TrimSuffix(retString.String(), \" + \")\n\n}", "func (m Modifiers) String() string {\n\tif m == 0 {\n\t\treturn \"\"\n\t}\n\tvar buffer bytes.Buffer\n\tif m&ControlModifier == ControlModifier {\n\t\tbuffer.WriteString(\"Ctrl+\")\n\t}\n\tif m&OptionModifier == OptionModifier {\n\t\tif runtime.GOOS == toolbox.MacOS {\n\t\t\tbuffer.WriteString(\"Opt+\")\n\t\t} else {\n\t\t\tbuffer.WriteString(\"Alt+\")\n\t\t}\n\t}\n\tif m&ShiftModifier == ShiftModifier {\n\t\tbuffer.WriteString(\"Shift+\")\n\t}\n\tif m&CapsLockModifier == CapsLockModifier {\n\t\tbuffer.WriteString(\"Caps+\")\n\t}\n\tif m&CommandModifier == CommandModifier {\n\t\tif runtime.GOOS == toolbox.MacOS {\n\t\t\tbuffer.WriteString(\"Cmd+\")\n\t\t} else {\n\t\t\tbuffer.WriteString(\"Win+\")\n\t\t}\n\t}\n\treturn buffer.String()\n}", "func (a *AggregateAndProof) String() string {\n\tdata, err := yaml.Marshal(a)\n\tif err != nil {\n\t\treturn fmt.Sprintf(\"ERR: %v\", err)\n\t}\n\treturn string(data)\n}", "func (s BillingGroupProperties) String() string {\n\treturn awsutil.Prettify(s)\n}", "func (s IncludedProperty) String() string {\n\treturn awsutil.Prettify(s)\n}", "func (p *pathSpec) String() string {\n\ts := pretty.Sprint(p)\n\tif len(p.gNMIPaths) != 0 {\n\t\tif ps, err := PathToString(p.gNMIPaths[0]); err == nil {\n\t\t\ts = ps\n\t\t}\n\t}\n\treturn s\n}", "func (p Pattern) String() string {\n\tvar buf bytes.Buffer\n\tbuf.WriteString(fmt.Sprintln(\"Saved with HW Version:\", p.Version))\n\tbuf.WriteString(fmt.Sprintln(\"Tempo:\", p.Tempo))\n\tfor _, v := range p.Tracks {\n\t\tbuf.WriteString(fmt.Sprintln(v))\n\t}\n\treturn buf.String()\n}", "func (logger FileLogger) String() string {\n\tenableStr := \"disabled\"\n\tif logger.Enable {\n\t\tenableStr = \"enabled\"\n\t}\n\n\treturn fmt.Sprintf(\"file:%s:%s\", enableStr, logger.Filename)\n}" ]
[ "0.7167697", "0.6929215", "0.655924", "0.6549873", "0.62448573", "0.6095395", "0.60641426", "0.6050332", "0.5755962", "0.5718155", "0.55109394", "0.5483291", "0.5461207", "0.54437673", "0.54156995", "0.5405307", "0.5389305", "0.53881025", "0.5387639", "0.53847283", "0.53634286", "0.5325283", "0.53250515", "0.53196627", "0.52955735", "0.52939177", "0.52877116", "0.5287499", "0.52351993", "0.5230495", "0.522575", "0.51990074", "0.5192354", "0.5186438", "0.51845956", "0.5179849", "0.5174403", "0.51691425", "0.5156081", "0.51554", "0.5153617", "0.51468027", "0.51461905", "0.51428455", "0.5127265", "0.5125527", "0.51206136", "0.51165074", "0.51009285", "0.50988466", "0.5095764", "0.5087241", "0.5081937", "0.5065563", "0.5064535", "0.50568676", "0.50518924", "0.50467676", "0.5044693", "0.50414914", "0.5037073", "0.50359005", "0.50328684", "0.5029617", "0.5022219", "0.5008183", "0.500699", "0.5006913", "0.50046086", "0.5003503", "0.49998036", "0.4997732", "0.4995617", "0.4991634", "0.49911043", "0.49889755", "0.49886832", "0.49850225", "0.49824417", "0.4982214", "0.4977412", "0.4971718", "0.496691", "0.4959122", "0.4955439", "0.49535322", "0.4953355", "0.49530867", "0.4952117", "0.4947977", "0.49427947", "0.4942103", "0.49377394", "0.49373528", "0.4937131", "0.49347052", "0.49246612", "0.49230665", "0.4923002", "0.49229434" ]
0.5981977
8
New Module creates a new puppet.Module
func NewModule() *Module { return &Module{} }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func NewModule(moduleType string) *app.Command {\n\tdesc := fmt.Sprintf(\"Create a %s module.\", moduleType)\n\tcmd := app.NewCommand(moduleType, desc, func(ctx *app.Context) error {\n\t\targs := &struct {\n\t\t\tGroup string `option:\"group\"`\n\t\t\tArtifact string `option:\"artifact\"`\n\t\t\tPackage string `option:\"package\"`\n\t\t}{}\n\t\tif err := config.Unmarshal(args); err != nil {\n\t\t\treturn app.Fatal(1, err)\n\t\t}\n\n\t\twd, err := os.Getwd()\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"acquire work directory failed: %v\", err)\n\t\t}\n\n\t\t// load parent pom\n\t\tp, err := pom.NewPom(filepath.Join(wd, \"pom.xml\"))\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\t// check args\n\t\tvar name string\n\t\tif len(ctx.Args()) == 0 {\n\t\t\tif p == nil {\n\t\t\t\treturn fmt.Errorf(\"module name is missing\")\n\t\t\t}\n\t\t\tname = fmt.Sprintf(\"%v-%v\", p.GetArtifactID(), moduleType)\n\t\t} else {\n\t\t\tname = ctx.Args()[0]\n\t\t}\n\n\t\t// build template data\n\t\tif args.Group == \"\" && p != nil {\n\t\t\targs.Group = p.GetGroupID()\n\t\t}\n\t\tif args.Group == \"\" {\n\t\t\treturn fmt.Errorf(\"group arg is missing\")\n\t\t}\n\t\tif args.Artifact == \"\" {\n\t\t\targs.Artifact = name\n\t\t}\n\t\tif args.Package == \"\" {\n\t\t\targs.Package = args.Group + \".\" + strings.Replace(args.Artifact, \"-\", \".\", -1)\n\t\t}\n\t\tdata := map[string]string{\n\t\t\t\"Type\": moduleType,\n\t\t\t\"GroupID\": args.Group,\n\t\t\t\"ArtifactID\": args.Artifact,\n\t\t\t\"Package\": args.Package,\n\t\t}\n\n\t\t// check dir exist\n\t\tmoduleDir := filepath.Join(wd, name)\n\t\t_, err = os.Stat(moduleDir)\n\t\tif err == nil {\n\t\t\treturn fmt.Errorf(\"directory already exist: %v\", moduleDir)\n\t\t}\n\n\t\t// create empty dirs\n\t\tvar dirs []string\n\t\tif moduleType == \"web\" {\n\t\t\tdirs = append(dirs, filepath.Join(wd, name, \"src\", \"main\", \"resources\", \"view\"))\n\t\t\tdirs = append(dirs, filepath.Join(wd, name, \"src\", \"main\", \"resources\", \"static\", \"js\"))\n\t\t\tdirs = append(dirs, filepath.Join(wd, name, \"src\", \"main\", \"resources\", \"static\", \"css\"))\n\t\t}\n\t\tdirs = append(dirs, filepath.Join(wd, name, \"src\", \"test\", \"java\"))\n\t\tfile.CreateDir(dirs...)\n\n\t\tfp := func(name string) string {\n\t\t\treturn fmt.Sprintf(\"modules/%s/%s\", moduleType, name)\n\t\t}\n\n\t\t// create files\n\t\tfiles := make(map[string]string)\n\t\tfiles[filepath.Join(moduleDir, \"pom.xml\")] = fp(\"pom.xml\")\n\t\tfiles[filepath.Join(moduleDir, \"src\", \"main\", \"resources\", \"application.yml\")] = fp(\"application.yml\")\n\t\tfiles[file.NewPath(moduleDir, \"src\", \"main\", \"java\").Join(strings.Split(args.Package, \".\")...).Join(\"Bootstrap.java\").String()] = fp(\"Bootstrap.java\")\n\t\tswitch moduleType {\n\t\tcase \"service\":\n\t\t\tfiles[file.NewPath(moduleDir, \"src\", \"main\", \"java\").Join(strings.Split(args.Package, \".\")...).Join(\"dao\", \"TestDao.java\").String()] = fp(\"TestDao.java\")\n\t\t\tfiles[file.NewPath(moduleDir, \"src\", \"main\", \"java\").Join(strings.Split(args.Package, \".\")...).Join(\"biz\", \"TestBiz.java\").String()] = fp(\"TestBiz.java\")\n\t\t\tfiles[file.NewPath(moduleDir, \"src\", \"main\", \"java\").Join(strings.Split(args.Package, \".\")...).Join(\"entity\", \"TestObject.java\").String()] = fp(\"TestObject.java\")\n\t\t\tfiles[file.NewPath(moduleDir, \"src\", \"main\", \"java\").Join(strings.Split(args.Package, \".\")...).Join(\"impl\", \"TestServiceImpl.java\").String()] = fp(\"TestServiceImpl.java\")\n\t\t\tfiles[file.NewPath(moduleDir, \"src\", \"test\", \"java\").Join(strings.Split(args.Package, \".\")...).Join(\"TestServiceTests.java\").String()] = fp(\"TestServiceTests.java\")\n\t\tcase \"msg\":\n\t\t\tfiles[file.NewPath(moduleDir, \"src\", \"main\", \"java\").Join(strings.Split(args.Package, \".\")...).Join(\"handler\", \"TestHandler.java\").String()] = fp(\"TestHandler.java\")\n\t\t\tfiles[file.NewPath(moduleDir, \"src\", \"test\", \"java\").Join(strings.Split(args.Package, \".\")...).Join(\"handler\", \"TestHandlerTests.java\").String()] = fp(\"TestHandlerTests.java\")\n\t\tcase \"task\":\n\t\t\tfiles[file.NewPath(moduleDir, \"src\", \"main\", \"java\").Join(strings.Split(args.Package, \".\")...).Join(\"executor\", \"TestExecutor.java\").String()] = fp(\"TestExecutor.java\")\n\t\t\tfiles[file.NewPath(moduleDir, \"src\", \"test\", \"java\").Join(strings.Split(args.Package, \".\")...).Join(\"executor\", \"TestExecutorTests.java\").String()] = fp(\"TestExecutorTests.java\")\n\t\tcase \"web\":\n\t\t\tfiles[file.NewPath(moduleDir, \"src\", \"main\", \"java\").Join(strings.Split(args.Package, \".\")...).Join(\"controller\", \"TestController.java\").String()] = fp(\"TestController.java\")\n\t\t\tfiles[file.NewPath(moduleDir, \"src\", \"test\", \"java\").Join(strings.Split(args.Package, \".\")...).Join(\"executor\", \"TestControllerTests.java\").String()] = fp(\"TestControllerTests.java\")\n\t\t}\n\t\tif err = tpl.Execute(files, data); err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\t// modify files\n\t\tif p != nil {\n\t\t\tp.AddModule(args.Artifact)\n\t\t}\n\n\t\tfmt.Println(\"finished.\")\n\t\treturn nil\n\t})\n\tcmd.Flags.Register(flag.Help)\n\tcmd.Flags.String(\"group\", \"g\", \"\", \"group id\")\n\tcmd.Flags.String(\"artifact\", \"a\", \"\", \"artifact id\")\n\tcmd.Flags.String(\"package\", \"p\", \"\", \"package\")\n\treturn cmd\n}", "func createModule(mi *internal.ModuleInfo, licmetas []*licenses.Metadata, latestRequested bool) *Module {\n\turlVersion := linkVersion(mi.Version, mi.ModulePath)\n\tif latestRequested {\n\t\turlVersion = internal.LatestVersion\n\t}\n\treturn &Module{\n\t\tDisplayVersion: displayVersion(mi.Version, mi.ModulePath),\n\t\tLinkVersion: linkVersion(mi.Version, mi.ModulePath),\n\t\tModulePath: mi.ModulePath,\n\t\tCommitTime: absoluteTime(mi.CommitTime),\n\t\tIsRedistributable: mi.IsRedistributable,\n\t\tLicenses: transformLicenseMetadata(licmetas),\n\t\tURL: constructModuleURL(mi.ModulePath, urlVersion),\n\t\tLatestURL: constructModuleURL(mi.ModulePath, middleware.LatestMinorVersionPlaceholder),\n\t}\n}", "func newModule(base mb.BaseModule) (mb.Module, error) {\n\t// Validate that at least one host has been specified.\n\tconfig := struct {\n\t\tHosts []string `config:\"hosts\" validate:\"nonzero,required\"`\n\t}{}\n\tif err := base.UnpackConfig(&config); err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn &base, nil\n}", "func NewModule(name string) *Module {\n\treturn &Module{Name: name, Fields: make(map[string]lua.LValue), Functions: make(map[string]lua.LGFunction)}\n}", "func newModule(name string, methods map[string]RubyMethod, outerEnv Environment) *Module {\n\tif methods == nil {\n\t\tmethods = make(map[string]RubyMethod)\n\t}\n\treturn &Module{\n\t\tname: name,\n\t\tclass: newEigenclass(moduleClass, methods),\n\t\tEnvironment: NewEnclosedEnvironment(outerEnv),\n\t}\n}", "func NewModule(name string, outerEnv Environment) *Module {\n\tmethods := make(map[string]RubyMethod)\n\treturn newModule(name, methods, outerEnv)\n}", "func NewModule(NameSpace string, service *data.ServiceData) *Module {\n\to := &Module{NameSpace, service}\n\treturn o\n}", "func NewModule(ptr ModuleT) *Module {\n\treturn &Module{\n\t\tptr: ptr,\n\t\tnumFunctions: -1,\n\t\tnumImports: -1,\n\t}\n}", "func newModule(moduleName, name string, vrf *VrfInfo) Module {\n\tfactory, found := moduleFactories[moduleName]\n\tif !found {\n\t\tLogger.Printf(\"Module '%s' doesn't exist.\\n\", moduleName)\n\t\treturn nil\n\t}\n\n\trp, ok := ringParams[name]\n\tif !ok {\n\t\trp = defaultRingParam\n\t}\n\trp.Flags = dpdk.RING_F_SC_DEQ\n\n\t// Create a parameter for the module\n\tmodType := moduleTypes[moduleName]\n\tparam := &ModuleParam{\n\t\tt: modType,\n\t\tname: name,\n\t\tvrf: vrf,\n\t\trp: rp,\n\t\tvrp: rp,\n\t\trules: newRules(),\n\t}\n\n\tswitch modType {\n\tcase TypeVif:\n\t\tparam.vif = newVif()\n\tcase TypeBridge:\n\t\tparam.bridge = newBridge()\n\tdefault:\n\t\t// nop\n\t}\n\n\tmodule, err := factory(param)\n\tif err != nil {\n\t\tLogger.Printf(\"Creating module '%s' with name '%s' failed.\\n\", moduleName, name)\n\t\treturn nil\n\t}\n\n\tswitch modType {\n\tcase TypeVif:\n\t\top, ok := module.(VifOp)\n\t\tif !ok {\n\t\t\tLogger.Fatalf(\"'%s' doesn't conform to VifModule interface!\\n\", moduleName)\n\t\t\tbreak\n\t\t}\n\t\tms, _ := module.(ModuleService)\n\t\tparam.vif.config(op, ms)\n\n\tdefault:\n\t\t// nop\n\t}\n\n\tmodules = append(modules, module)\n\n\treturn module\n}", "func NewModule(ptr ModuleT) *Module {\n\treturn &Module{\n\t\tptr: ptr,\n\t\tnumFunctions: -1,\n\t}\n}", "func (tr *Transport) CreateModule(ctx context.Context, m *iotservice.Module) (*iotservice.Module, error) {\n\ttarget, err := url.Parse(\n\t\tfmt.Sprintf(\n\t\t\t\"https://%s/devices/%s/modules/%s?api-version=%s\",\n\t\t\ttr.creds.GetHostName(),\n\t\t\turl.PathEscape(tr.creds.GetDeviceID()), url.PathEscape(m.ModuleID),\n\t\t\tapiVersion,\n\t\t),\n\t)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\trequestPayloadBytes, err := json.Marshal(&m)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tresp, err := tr.getTokenAndSendRequest(http.MethodPut, target, requestPayloadBytes, map[string]string{})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\terr = tr.handleErrorResponse(resp)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar res iotservice.Module\n\terr = json.NewDecoder(resp.Body).Decode(&res)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn &res, nil\n}", "func New() *module {\n\tif os.Getenv(\"FAIL_MODE\") == \"1\" {\n\t\treturn new(module)\n\t}\n\n\treturn nil\n}", "func New(options map[string]string) model.Module {\n\tlog.WithFields(log.Fields{\n\t\t\"id\": ModuleID,\n\t\t\"options\": options,\n\t}).Debug(\"Creating new Module\")\n\tif os.Getenv(\"DOCKER_HOST\") != \"\" && dockerEndpoint != \"unix:///var/run/docker.sock\" { //If default value of tag + env set\n\t\tdockerEndpoint = os.Getenv(\"DOCKER_HOST\")\n\t}\n\tclient, err := docker.NewClient(dockerEndpoint)\n\tif err != nil {\n\t\tlog.WithFields(log.Fields{\n\t\t\t\"client\": client,\n\t\t\t\"err\": err,\n\t\t}).Warn(\"Failed to create docker client\")\n\t\t//return nil\n\t}\n\treturn &Module{Endpoint: dockerEndpoint, Client: client, event: setListener(client)}\n}", "func (m *ModuleBase) New() Module {\n\treturn &ModuleBase{}\n}", "func New(cfg Config) Module { return Module{Factory: cfg} }", "func NewModule(opts *ModuleOptions) module.Module {\n\tif opts == nil {\n\t\topts = &ModuleOptions{}\n\t}\n\treturn &serverModule{opts: opts}\n}", "func NewModuleCreate(m map[string]interface{}) (*ModuleCreate, error) {\n\tol := newOptionLoader(m)\n\n\tmc := &ModuleCreate{\n\t\tapp: ol.LoadApp(),\n\t\tmodule: ol.LoadString(OptionModule),\n\n\t\tcm: component.DefaultManager,\n\t}\n\n\treturn mc, nil\n}", "func New(\n\tarmDeployer arm.Deployer,\n\tpostgresqlManager postgresql.Manager,\n) service.Module {\n\treturn &module{\n\t\tserviceManager: &serviceManager{\n\t\t\tarmDeployer: armDeployer,\n\t\t\tpostgresqlManager: postgresqlManager,\n\t\t},\n\t}\n}", "func newDotnetModule(srcPath string, containingBuild *Build) (module *DotnetModule, err error) {\n\tif srcPath == \"\" {\n\t\tsrcPath, err = os.Getwd()\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\treturn &DotnetModule{solutionPath: srcPath, containingBuild: containingBuild, argAndFlags: []string{\"restore\"}}, nil\n}", "func New(config contract.ConfigAccessor) Module {\n\treturn Module{config: config}\n}", "func NewModule(mid uint8, acts ...IAction) IModule {\n\tmodActions := make(map[uint8]IAction, len(acts))\n\tfor _, v := range acts {\n\t\tmodActions[v.GetAID()] = v\n\t}\n\treturn &baseModule{mid: mid, actions: modActions}\n}", "func New() bot.Module {\n\treturn &module{\n\t\tservers: make(map[string]*server),\n\t\tm: &sync.Mutex{},\n\t}\n}", "func New(\n\tarmDeployer arm.Deployer,\n\taciClient aciSDK.ContainerGroupsClient,\n) service.Module {\n\treturn &module{\n\t\tserviceManager: &serviceManager{\n\t\t\tarmDeployer: armDeployer,\n\t\t\taciClient: aciClient,\n\t\t},\n\t}\n}", "func NewModule(mintClient minttypes.QueryClient, db *database.Db) *Module {\n\treturn &Module{\n\t\tmintClient: mintClient,\n\t\tdb: db,\n\t}\n}", "func (mc ModuleController) CreateModule(w http.ResponseWriter, r *http.Request, p httprouter.Params) {\n\t// Stub an user to be populated from the body\n\tu := models.Module{}\n\n\t// Populate the user data\n\tjson.NewDecoder(r.Body).Decode(&u)\n\n\t// Add an Id\n\tu.Id = bson.NewObjectId()\n\n\t// Write the user to mongo\n\tmc.session.DB(\"go_rest_tutorial\").C(\"users\").Insert(u)\n\n\t// Marshal provided interface into JSON structure\n\tuj, _ := json.Marshal(u)\n\n\t// Write content-type, statuscode, payload\n\tw.Header().Set(\"Content-Type\", \"application/json\")\n\tw.WriteHeader(201)\n\tfmt.Fprintf(w, \"%s\", uj)\n}", "func NewModule(classes ClassMap) *Module {\n\treturn &Module{ClassMap: classes.Clone()}\n}", "func NewModule(name string, requires []string, configFn interface{}) *Module {\n\tif configFn == nil {\n\t\tconfigFn = func() {}\n\t}\n\n\ttransformedFunc, err := MakeFuncInjectable(configFn)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn &Module{js.Global.Get(\"angular\").Call(\"module\", name, requires, transformedFunc)}\n}", "func (config *Config) CreateModule(name string) *Module {\n\tmodule := NewModule(name)\n\tconfig.AppendModule(module)\n\treturn module\n}", "func New(clusterID, projectID, nodeID string, auth model.AuthEventingInterface, crud model.CrudEventingInterface, syncMan *syncman.Manager, file model.FilestoreEventingInterface, hook model.MetricEventingHook) (*Module, error) {\n\t// Create a pub sub client\n\tpubsubClient, err := pubsub.New(projectID, os.Getenv(\"REDIS_CONN\"))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tm := &Module{\n\t\tclusterID: clusterID,\n\t\tproject: projectID,\n\t\tnodeID: nodeID,\n\t\tauth: auth,\n\t\tcrud: crud,\n\t\tsyncMan: syncMan,\n\t\tschemas: map[string]model.Fields{},\n\t\tfileStore: file,\n\t\tmetricHook: hook,\n\t\tconfig: &config.Eventing{Enabled: false, InternalRules: make(config.EventingTriggers)},\n\t\ttemplates: map[string]*template.Template{},\n\t\tpubsubClient: pubsubClient,\n\t}\n\n\t// Start the internal processes\n\tgo m.routineProcessIntents()\n\tgo m.routineProcessStaged()\n\tgo m.routineHandleMessages()\n\tgo m.routineHandleEventResponseMessages()\n\tm.createProcessUpdateEventsRoutine()\n\n\treturn m, nil\n}", "func NewModule(primaryFiles, overrideFiles []*File) (*Module, hcl.Diagnostics) {\n\tvar diags hcl.Diagnostics\n\tmod := &Module{\n\t\tProviderConfigs: map[string]*Provider{},\n\t\tProviderLocalNames: map[addrs.Provider]string{},\n\t\tVariables: map[string]*Variable{},\n\t\tLocals: map[string]*Local{},\n\t\tOutputs: map[string]*Output{},\n\t\tModuleCalls: map[string]*ModuleCall{},\n\t\tManagedResources: map[string]*Resource{},\n\t\tDataResources: map[string]*Resource{},\n\t\tProviderMetas: map[addrs.Provider]*ProviderMeta{},\n\t}\n\n\t// Process the required_providers blocks first, to ensure that all\n\t// resources have access to the correct provider FQNs\n\tfor _, file := range primaryFiles {\n\t\tfor _, r := range file.RequiredProviders {\n\t\t\tif mod.ProviderRequirements != nil {\n\t\t\t\tdiags = append(diags, &hcl.Diagnostic{\n\t\t\t\t\tSeverity: hcl.DiagError,\n\t\t\t\t\tSummary: \"Duplicate required providers configuration\",\n\t\t\t\t\tDetail: fmt.Sprintf(\"A module may have only one required providers configuration. The required providers were previously configured at %s.\", mod.ProviderRequirements.DeclRange),\n\t\t\t\t\tSubject: &r.DeclRange,\n\t\t\t\t})\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tmod.ProviderRequirements = r\n\t\t}\n\t}\n\n\t// If no required_providers block is configured, create a useful empty\n\t// state to reduce nil checks elsewhere\n\tif mod.ProviderRequirements == nil {\n\t\tmod.ProviderRequirements = &RequiredProviders{\n\t\t\tRequiredProviders: make(map[string]*RequiredProvider),\n\t\t}\n\t}\n\n\t// Any required_providers blocks in override files replace the entire\n\t// block for each provider\n\tfor _, file := range overrideFiles {\n\t\tfor _, override := range file.RequiredProviders {\n\t\t\tfor name, rp := range override.RequiredProviders {\n\t\t\t\tmod.ProviderRequirements.RequiredProviders[name] = rp\n\t\t\t}\n\t\t}\n\t}\n\n\tfor _, file := range primaryFiles {\n\t\tfileDiags := mod.appendFile(file)\n\t\tdiags = append(diags, fileDiags...)\n\t}\n\n\tfor _, file := range overrideFiles {\n\t\tfileDiags := mod.mergeFile(file)\n\t\tdiags = append(diags, fileDiags...)\n\t}\n\n\tdiags = append(diags, checkModuleExperiments(mod)...)\n\n\t// Generate the FQN -> LocalProviderName map\n\tmod.gatherProviderLocalNames()\n\n\treturn mod, diags\n}", "func NewModule(opts *ModuleOptions) module.Module {\n\tif opts == nil {\n\t\topts = &ModuleOptions{}\n\t}\n\treturn &gaeModule{opts: opts}\n}", "func New(storage *storage.Storage, execmode bool) ModuleManager {\n\tmm := ModuleManager{}\n\tmm.modules = make(map[string]*shared.Module)\n\n\tmm.storage = storage\n\n\t// set settings\n\tmm.settings.execMode = execmode\n\tlog.Println(mm)\n\treturn mm\n}", "func New(_, clusterID, nodeID string, managers *managers.Managers, globalMods *global.Global) (*Modules, error) {\n\treturn &Modules{\n\t\tblocks: map[string]*Module{},\n\t\tclusterID: clusterID,\n\t\tnodeID: nodeID,\n\t\tGlobalMods: globalMods,\n\t\tManagers: managers,\n\t}, nil\n}", "func New(isMetricDisabled bool, driverType model.DriverType) *Module {\n\tm := &Module{\n\t\tisMetricsDisabled: true,\n\t\tclusterID: os.Getenv(\"CLUSTER_ID\"),\n\t\tnodeID: ksuid.New().String(),\n\t\tsink: api.New(\"spacecloud\", \"api.spaceuptech.com\", true).DB(\"db\"),\n\t\tdriverType: string(driverType),\n\t}\n\treturn m\n}", "func New(confDate string) (module.Module, error) {\n\tvar cfg function.Config\n\terr := module.Load(&cfg, confDate)\n\tif err != nil {\n\t\treturn nil, errors.Trace(err)\n\t}\n\tdefaults(&cfg)\n\tlogger.Init(cfg.Logger, \"module\", cfg.Name)\n\tman, err := function.NewManager(cfg)\n\tif err != nil {\n\t\treturn nil, errors.Trace(err)\n\t}\n\tm := &mo{\n\t\tcfg: cfg,\n\t\tman: man,\n\t\trrs: []*ruler{},\n\t\tlog: logger.WithFields(),\n\t}\n\tfor _, r := range cfg.Rules {\n\t\tf, err := man.Get(r.Compute.Function)\n\t\tif err != nil {\n\t\t\tm.Close()\n\t\t\treturn nil, errors.Trace(err)\n\t\t}\n\t\trr, err := create(r, cfg.Hub, f)\n\t\tif err != nil {\n\t\t\tm.Close()\n\t\t\treturn nil, errors.Trace(err)\n\t\t}\n\t\tm.rrs = append(m.rrs, rr)\n\t}\n\treturn m, nil\n}", "func (c *ModuleClient) Create() *ModuleCreate {\n\treturn &ModuleCreate{config: c.config}\n}", "func NewModule(goPkg *ssa.Package) *Module {\n\treturn &Module{\n\t\tModule: ir.NewModule(),\n\t\tgoPkg: goPkg,\n\t\ttypes: make(map[string]irtypes.Type),\n\t\tconsts: make(map[*ssa.NamedConst]irconstant.Constant),\n\t\tglobals: make(map[ssa.Value]irvalue.Value),\n\t\tpredeclaredFuncs: make(map[string]*ir.Func),\n\t\tstrings: make(map[string]*ir.Global),\n\t}\n}", "func (p *Patch) New() Module {\n\treturn &Patch{}\n}", "func NewModule(m ast.Module) Module {\n\tts := make(map[string]types.Type, len(m.Export().Names()))\n\n\tfor _, b := range m.ExportedBinds() {\n\t\tts[b.Name()] = types.Box(b.Type())\n\t}\n\n\tds := make([]coreast.Declaration, 0, len(ts))\n\n\tfor n, t := range ts {\n\t\tn := m.Name().Qualify(n)\n\n\t\tswitch t := t.(type) {\n\t\tcase types.Function:\n\t\t\tf := t.ToCore().(coretypes.Function)\n\n\t\t\tds = append(\n\t\t\t\tds,\n\t\t\t\tcoreast.NewDeclaration(\n\t\t\t\t\tn,\n\t\t\t\t\tcoreast.NewLambdaDeclaration(nil, f.Arguments(), f.Result()),\n\t\t\t\t),\n\t\t\t)\n\t\tdefault:\n\t\t\tds = append(\n\t\t\t\tds,\n\t\t\t\tcoreast.NewDeclaration(\n\t\t\t\t\tn,\n\t\t\t\t\tcoreast.NewLambdaDeclaration(nil, nil, coretypes.Unbox(t.ToCore())),\n\t\t\t\t),\n\t\t\t)\n\t\t}\n\t}\n\n\treturn Module{m.Name(), ts, ds}\n}", "func New() *dpms.Module {\n\treturn dpms.New(&provider{})\n}", "func NewModules(core *Core) (*Modules, error) {\n\treturn &Modules{\n\t\tSettings: core.Settings,\n\t\tAccounts: Accounts{core: core},\n\t\tSessions: Sessions{core: core},\n\t\tSecurity: Security{csrfProtection: core.CSRFProtection},\n\t\tImages: Images{core: core},\n\t}, nil\n}", "func New(provider Provider) *Module {\n\tm := &Module{\n\t\tprovider: provider,\n\t\tscheduler: timing.NewScheduler(),\n\t}\n\n\tm.notifyFn, m.notifyCh = notifier.New()\n\tm.outputFunc.Set(func(info Info) bar.Output {\n\t\tif info.Updates == 1 {\n\t\t\treturn outputs.Text(\"1 update\")\n\t\t}\n\t\treturn outputs.Textf(\"%d updates\", info.Updates)\n\t})\n\n\tm.Every(time.Hour)\n\n\treturn m\n}", "func (service *ProjectService) NewMod() {\n\tservice.setActiveMod(\"\", nil, nil, nil)\n}", "func New(client zbus.Client, root string, containerd string) *Module {\n\tif len(containerd) == 0 {\n\t\tcontainerd = containerdSock\n\t}\n\n\tmodule := &Module{\n\t\tcontainerd: containerd,\n\t\troot: root,\n\t\tclient: client,\n\t\t// values are cached only for 1 minute. purge cache every 20 second\n\t\tfailures: cache.New(time.Minute, 20*time.Second),\n\t}\n\n\tif err := module.startup(); err != nil {\n\t\tlog.Error().Err(err).Msg(\"failed to update containers configurations\")\n\t}\n\n\treturn module\n}", "func New(config *Config) *HelloWordModule {\n\n\tcheckConfig(config)\n\n\ts := &HelloWordModule{}\n\treturn s\n}", "func NewMod(name string) *Mod {\n\treturn &Mod{Name: name}\n}", "func New() base.Mod {\n\treturn &TestMod{\n\t\tname: \"Test\",\n\t\tcommands: make(map[string]*base.ModCommand),\n\t\tallowedTypes: base.MessageTypeCreate,\n\t\tallowDMs: true,\n\t}\n}", "func (k *k8sService) deployModule(module *protos.Module) {\n\tswitch module.Spec.Type {\n\tcase protos.ModuleSpec_DaemonSet:\n\t\tcreateDaemonSet(k.client, module)\n\tcase protos.ModuleSpec_Deployment:\n\t\tcreateDeployment(k.client, module)\n\tcase protos.ModuleSpec_Job:\n\t\tcreateCronjob(k.client, module)\n\t}\n}", "func New() *Module {\n\tconstruct()\n\tm := new(Module)\n\tl.Register(m, \"outputFunc\")\n\tm.Output(defaultOutput)\n\treturn m\n}", "func New(service Service) interface {\n\tmodule.Module\n\tbackend.Module\n} {\n\treturn newBackendModule(service)\n}", "func ModuleAfterCreate(\n\targModule *types.Module,\n\targOldModule *types.Module,\n\targNamespace *types.Namespace,\n) *moduleAfterCreate {\n\treturn &moduleAfterCreate{\n\t\tmoduleBase: &moduleBase{\n\t\t\timmutable: false,\n\t\t\tmodule: argModule,\n\t\t\toldModule: argOldModule,\n\t\t\tnamespace: argNamespace,\n\t\t},\n\t}\n}", "func NewRPCModule(cfg *config.AppConfig) *RPCModule {\n\treturn &RPCModule{cfg: cfg, ClientContextMaker: newClientContext}\n}", "func (b *Button) New() Module {\n\treturn &Button{}\n}", "func NewAppModule(BxKeeper Keeper) AppModule {\n\treturn AppModule{\n\t\tAppModuleBasic: AppModuleBasic{},\n\t\tBxKeeper: BxKeeper,\n\t}\n}", "func NewAppModule(keeper Keeper) AppModule {\n\treturn AppModule{\n\t\tAppModuleBasic: AppModuleBasic{},\n\t\tkeeper: keeper,\n\t}\n}", "func createModuleTypeInstance(module string) (interface{}, error) {\n\tmoduleType, ex := modules[module]\n\tif !ex {\n\t\treturn nil, errors.Errorf(\"module %s's moduleType is not found.\", module)\n\t}\n\tcallback, ex := getModuleTypeCallback(moduleType)\n\tif !ex {\n\t\treturn nil, errors.Errorf(\"module %s moduleType %s callback is not exist!\", module, moduleType)\n\t}\n\n\treturn callback.creator(), nil\n}", "func makeModule(ed *Editor) eval.Namespace {\n\tns := eval.Namespace{}\n\t// Populate builtins.\n\tfor _, b := range builtins {\n\t\tns[eval.FnPrefix+b.name] = eval.NewPtrVariable(&EditBuiltin{b, ed})\n\t}\n\t// Populate binding tables in the variable $binding.\n\t// TODO Make binding specific to the Editor.\n\tbinding := map[eval.Value]eval.Value{\n\t\teval.String(\"insert\"): BindingTable{keyBindings[modeInsert]},\n\t\teval.String(\"command\"): BindingTable{keyBindings[modeCommand]},\n\t\teval.String(\"completion\"): BindingTable{keyBindings[modeCompletion]},\n\t\teval.String(\"navigation\"): BindingTable{keyBindings[modeNavigation]},\n\t\teval.String(\"history\"): BindingTable{keyBindings[modeHistory]},\n\t}\n\tns[\"binding\"] = eval.NewPtrVariable(eval.NewMap(binding))\n\n\treturn ns\n}", "func NewAppModule(msKeeper keeper.Keeper, poaKeeper poa.Keeper) AppModule {\n\treturn AppModule{\n\t\tAppModuleBasic: AppModuleBasic{},\n\t\tmsKeeper: msKeeper,\n\t\tpoaKeeper: poaKeeper,\n\t}\n}", "func NewModuleFromJSON(json jsoniter.Any) (*Module, error) {\n\tif json.Get(\"type\").ToUint() != TypeModule {\n\t\treturn nil, ErrInvalidJSON\n\t}\n\n\tname := json.Get(\"name\").ToString()\n\n\tvar jsonDefinitions []jsoniter.Any\n\tjson.Get(\"definitions\").ToVal(&jsonDefinitions)\n\n\tdefinitions := make([]*Definition, len(jsonDefinitions))\n\tfor i, json := range jsonDefinitions {\n\t\td, err := NewDefinitionFromJSON(json)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tdefinitions[i] = d\n\t}\n\n\treturn &Module{\n\t\tName: name,\n\t\tDefinitions: definitions,\n\t}, nil\n}", "func (s *Session) CreateClusterModule(ctx context.Context) (string, error) {\n\tlog.Info(\"Creating clusterModule\")\n\n\trestClient := s.Client.RestClient()\n\tmoduleId, err := cluster.NewManager(restClient).CreateModule(ctx, s.cluster)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\tlog.Info(\"Created clusterModule\", \"moduleId\", moduleId)\n\treturn moduleId, nil\n}", "func MakeModule(name string, init Hook, ml *logging.MasterLogger, deps ...*Module) Module {\n\tdone := make(chan struct{})\n\tmux := new(sync.Mutex)\n\treturn Module{\n\t\tName: name,\n\t\tinit: init,\n\t\tdeps: deps,\n\t\tdone: done,\n\t\tmux: mux,\n\t\tlog: ml.PackageLogger(name),\n\t}\n}", "func New(\n\tarmDeployer arm.Deployer,\n\tcosmosdbManager cosmosdb.Manager,\n) service.Module {\n\treturn &module{\n\t\tserviceManager: &serviceManager{\n\t\t\tarmDeployer: armDeployer,\n\t\t\tcosmosdbManager: cosmosdbManager,\n\t\t},\n\t}\n}", "func NewTemplateModule() *restful.WebService {\n\tsrv := new(restful.WebService)\n\tsrv.Path(\"/template\").\n\t\tConsumes(restful.MIME_JSON).\n\t\tProduces(restful.MIME_JSON)\n\n\tsrv.Route(srv.POST(\"/generate/{project-id}\").To(generateTemplateForProject)).\n\t\tRoute(srv.GET(\"/suggestLayout\").To(suggestLayoutWithProjectId))\n\n\treturn srv\n}", "func NewPoolModule(reactor core.MempoolReactor, pushPool types.PushPool) *PoolModule {\n\treturn &PoolModule{mempoolReactor: reactor, pushPool: pushPool}\n}", "func NewMsgDeployModule(signer sdk.AccAddress, modules []Contract) MsgDeployModule {\n\treturn MsgDeployModule{\n\t\tSigner: signer,\n\t\tModule: modules,\n\t}\n}", "func (p PuppetParse) ReadModules(r io.Reader) ([]*Module, error) {\n\treader := bufio.NewReader(r)\n\tvar modules []*Module\n\tvar currentModule *Module\n\tfor {\n\t\tline, err := reader.ReadString('\\n')\n\t\tif err == io.EOF {\n\t\t\tbreak\n\t\t} else if err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\t// start New Module\n\t\tif strings.Contains(line, \"mod '\") {\n\t\t\tparts := strings.Split(line, \",\")\n\t\t\tcurrentModule = NewModule()\n\t\t\tmodules = append(modules, currentModule)\n\t\t\t// Set Module Name\n\t\t\tcurrentModule.Name, err = p.parseQuotedText(parts[0])\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t\t// Versioned Module\n\t\t\tif len(parts) == 2 && strings.TrimSpace(parts[1]) != \"\" {\n\t\t\t\t// Get Version\n\t\t\t\tcurrentModule.Version, err = p.parseValueText(parts[1])\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn nil, err\n\t\t\t\t}\n\t\t\t\t// Bad Format\n\t\t\t} else if len(parts) > 2 {\n\t\t\t\treturn nil, errors.New(fmt.Sprintf(\"Invalid TestPuppetfile, too many parts for module declaration, Could not parse module from line: %s\", line))\n\t\t\t}\n\t\t\t// Add to existing\n\t\t} else {\n\t\t\tparts := strings.Split(line, \"=>\")\n\t\t\tif len(parts) != 2 {\n\t\t\t\treturn nil, errors.New(fmt.Sprintf(\"Invalid TestPuppetfile, Git parameters must contain =>: line: %s\", line))\n\t\t\t}\n\t\t\tlabel, err := p.parseAndValidateKeywordText(parts[0])\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t\tvalue, err := p.parseValueText(parts[1])\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t\tcurrentModule.SetProperty(KEYWORD(label), value)\n\n\t\t}\n\t}\n\treturn modules, nil\n}", "func (c *ModuleVersionClient) Create() *ModuleVersionCreate {\n\treturn &ModuleVersionCreate{config: c.config}\n}", "func New(ctx context.Context) (*Module, error) {\n\tm := filesystem.DefaultDeviceManager()\n\tcache, err := cache.VolatileDir(\"storage\", 1*cache.Megabyte)\n\tif err != nil && !os.IsExist(err) {\n\t\treturn nil, errors.Wrap(err, \"failed to create volatile types cache directory\")\n\t}\n\n\ts := &Module{\n\t\tssds: []filesystem.Pool{},\n\t\tdevices: m,\n\t\tbrokenDevices: []pkg.BrokenDevice{},\n\t\tcache: TypeCache{cache},\n\t}\n\n\t// go for a simple linear setup right now\n\treturn s, s.initialize(ctx)\n}", "func NewUserModule(config UserModuleConfig) *UserModule {\n\tcmd := \"\"\n\n\tswitch config.Action {\n\tcase UserActionAdd:\n\t\tcmd = useraddCmd\n\t\t// You have to use -m, otherwise no home directory will be created. If you want to specify the path of the home directory, use -d and specify the path\n\t\t// useradd -m -d /PATH/TO/FOLDER\n\t\tcmd += \" -m\"\n\t\tif config.Home != \"\" {\n\t\t\tcmd += \" -d\" + config.Home\n\t\t}\n\n\t\t// set user's login shell\n\t\tif config.Shell != \"\" {\n\t\t\tcmd = fmt.Sprintf(\"%s -s %s\", cmd, config.Shell)\n\t\t} else {\n\t\t\tcmd = fmt.Sprintf(\"%s -s %s\", cmd, defaultShell)\n\t\t}\n\n\t\t// set user's group\n\t\tif config.Group == \"\" {\n\t\t\tconfig.Group = config.Name\n\t\t}\n\n\t\t// groupadd -f <group-name>\n\t\tgroupAdd := fmt.Sprintf(\"%s -f %s\", groupaddCmd, config.Group)\n\n\t\t// useradd -g <group-name> <user-name>\n\t\tcmd = fmt.Sprintf(\"%s -g %s %s\", cmd, config.Group, config.Name)\n\n\t\t// prevent errors when username already in use\n\t\tcmd = fmt.Sprintf(\"id -u %s > /dev/null 2>&1 || (%s && %s)\", config.Name, groupAdd, cmd)\n\n\t\t// add user to sudoers list\n\t\tif config.Sudoer {\n\t\t\tsudoLine := fmt.Sprintf(\"%s ALL=(ALL) NOPASSWD:ALL\",\n\t\t\t\tconfig.Name)\n\t\t\tcmd = fmt.Sprintf(\"%s && %s\",\n\t\t\t\tcmd,\n\t\t\t\tfmt.Sprintf(\"echo '%s' > /etc/sudoers.d/%s\", sudoLine, config.Name))\n\t\t}\n\n\tcase UserActionDel:\n\t\tcmd = fmt.Sprintf(\"%s -r %s\", userdelCmd, config.Name)\n\t\t// prevent errors when user does not exist\n\t\tcmd = fmt.Sprintf(\"%s || [ $? -eq 6 ]\", cmd)\n\n\t\t//\tcase UserActionModify:\n\t\t//\t\tcmd = usermodCmd\n\t}\n\n\treturn &UserModule{\n\t\tconfig: config,\n\t\tcmd: cmd,\n\t}\n}", "func New() *BucketModule {\n\treturn &BucketModule{}\n}", "func New(\n\tarmDeployer arm.Deployer,\n\tnamespacesClient servicebusSDK.NamespacesClient,\n\tqueuesClient servicebusSDK.QueuesClient,\n\ttopicsClient servicebusSDK.TopicsClient,\n\tsubscriptionsClient servicebusSDK.SubscriptionsClient,\n) service.Module {\n\treturn &module{\n\t\tnamespaceManager: &namespaceManager{\n\t\t\tarmDeployer: armDeployer,\n\t\t\tnamespacesClient: namespacesClient,\n\t\t},\n\t\tqueueManager: &queueManager{\n\t\t\tarmDeployer: armDeployer,\n\t\t\tqueuesClient: queuesClient,\n\t\t},\n\t\ttopicManager: &topicManager{\n\t\t\tarmDeployer: armDeployer,\n\t\t\ttopicsClient: topicsClient,\n\t\t\tsubscriptionsClient: subscriptionsClient,\n\t\t},\n\t}\n}", "func RunModuleCreate(m map[string]interface{}) error {\n\tmc, err := NewModuleCreate(m)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn mc.Run()\n}", "func ModuleBeforeCreate(\n\targModule *types.Module,\n\targOldModule *types.Module,\n\targNamespace *types.Namespace,\n) *moduleBeforeCreate {\n\treturn &moduleBeforeCreate{\n\t\tmoduleBase: &moduleBase{\n\t\t\timmutable: false,\n\t\t\tmodule: argModule,\n\t\t\toldModule: argOldModule,\n\t\t\tnamespace: argNamespace,\n\t\t},\n\t}\n}", "func ModuleAfterCreateImmutable(\n\targModule *types.Module,\n\targOldModule *types.Module,\n\targNamespace *types.Namespace,\n) *moduleAfterCreate {\n\treturn &moduleAfterCreate{\n\t\tmoduleBase: &moduleBase{\n\t\t\timmutable: true,\n\t\t\tmodule: argModule,\n\t\t\toldModule: argOldModule,\n\t\t\tnamespace: argNamespace,\n\t\t},\n\t}\n}", "func New() *Config {\n\treturn &Config{ Modules: []*Module{} }\n}", "func (this *Motto) AddModule(id string, loader ModuleLoader) {\n this.modules[id] = loader\n}", "func NewModuleController(s *mgo.Session) *ModuleController {\n\treturn &ModuleController{s}\n}", "func New(name string) *Module {\n\tm := &Module{\n\t\tbatteryName: name,\n\t\tscheduler: timing.NewScheduler(),\n\t}\n\tl.Label(m, name)\n\tl.Register(m, \"scheduler\", \"format\")\n\tm.format.Set(format{})\n\tm.RefreshInterval(3 * time.Second)\n\t// Construct a simple template that's just the available battery percent.\n\tm.OutputTemplate(outputs.TextTemplate(`BATT {{.RemainingPct}}%`))\n\treturn m\n}", "func NewJsEvalModule(bot *common.Bot) *JsEval {\n jsEval := &JsEval {\n bot: bot,\n vm: otto.New(),\n }\n return jsEval\n}", "func newInstance(moduleName, name string, priv interface{}) (*BaseInstance, error) {\n\tm, found := modules[moduleName]\n\tif !found {\n\t\treturn nil, fmt.Errorf(\"No such module: %s\", moduleName)\n\t}\n\n\tif _, exists := m.instance[name]; exists {\n\t\treturn nil, fmt.Errorf(\"%s already exists in %s\", name, moduleName)\n\t}\n\n\tbi := &BaseInstance{name: name, module: m, subinstance: false}\n\n\tringName := fmt.Sprintf(\"input-%s\", name)\n\tbi.input = dpdk.RingCreate(ringName, m.ringParam.Count, m.ringParam.SocketId, dpdk.RING_F_SC_DEQ)\n\tif bi.input == nil {\n\t\treturn nil, fmt.Errorf(\"Input ring creation faild for %s.\\n\", name)\n\t}\n\n\tif m.ringParam.SecondaryInput {\n\t\tringName := fmt.Sprintf(\"input2-%s\", name)\n\t\tbi.input2 = dpdk.RingCreate(ringName, m.ringParam.Count, m.ringParam.SocketId, dpdk.RING_F_SC_DEQ)\n\t\tif bi.input2 == nil {\n\t\t\treturn nil, fmt.Errorf(\"Second input ring creation failed for %s\", name)\n\t\t}\n\t}\n\n\tbi.rules = newRules()\n\n\tif m.moduleType == TypeInterface || m.moduleType == TypeRIF {\n\t\tbi.counter = NewCounter()\n\t}\n\n\tinstance, err := m.factory(bi, priv)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"Creating module '%s' with name '%s' failed: %v\\n\", moduleName, name, err)\n\t}\n\tbi.instance = instance\n\n\t// Set rule observer, if the module complies to RulesNotify.\n\tif rn, ok := instance.(RulesNotify); ok {\n\t\tbi.rules.setRulesNotify(rn)\n\t}\n\n\tm.instance[name] = bi\n\n\treturn bi, nil\n}", "func (m *Module) New(state string) (string, error) {\n\tb, err := json.Marshal(&csrfPayload{\n\t\tState: state,\n\t\tToken: token.New32(),\n\t\tExpireAfter: time.Now().Add(m.csrfValidityDuration),\n\t})\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\tobj, err := m.encrypter.Encrypt(b)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\tmsg, err := obj.CompactSerialize()\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\treturn msg, nil\n}", "func NewMod(name string) *Mod {\n\treturn &Mod{\n\t\tapp: coop.NewApplicationContext(name),\n\t}\n}", "func NewAppModule(k Keeper, contractHandler ContractHandler) AppModule {\n\treturn AppModule{\n\t\tAppModuleBasic: AppModuleBasic{},\n\t\tkeeper: k,\n\t\tpacketReceiver: NewPacketReceiver(k, contractHandler),\n\t\tpacketAcknowledgementReceiver: NewPacketAcknowledgementReceiver(k),\n\t\tcontractHandler: contractHandler,\n\t}\n}", "func (f *ModuleFactory) Create(name string, mctx ModuleContext) (Module, bool) {\n\tif mcf, ok := f.mcfs[name]; ok {\n\t\tmodule, err := mcf(mctx)\n\t\tif err != nil {\n\t\t\t// TODO(elliot): Do something?\n\t\t\treturn nil, false\n\t\t}\n\n\t\treturn module, true\n\t}\n\n\treturn nil, false\n}", "func (t *Text) New() Module {\n\treturn &Text{}\n}", "func NewModuleRegistry(moduleConfigs []*common.Config, beatVersion string, init bool) (*ModuleRegistry, error) {\n\tmodulesPath := paths.Resolve(paths.Home, \"module\")\n\n\tstat, err := os.Stat(modulesPath)\n\tif err != nil || !stat.IsDir() {\n\t\tlogp.Err(\"Not loading modules. Module directory not found: %s\", modulesPath)\n\t\treturn &ModuleRegistry{}, nil // empty registry, no error\n\t}\n\n\tvar modulesCLIList []string\n\tvar modulesOverrides *ModuleOverrides\n\tif init {\n\t\tmodulesCLIList, modulesOverrides, err = getModulesCLIConfig()\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\tmcfgs := []*ModuleConfig{}\n\tfor _, moduleConfig := range moduleConfigs {\n\t\tmcfg, err := mcfgFromConfig(moduleConfig)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"Error unpacking module config: %v\", err)\n\t\t}\n\t\tmcfgs = append(mcfgs, mcfg)\n\t}\n\n\tmcfgs, err = appendWithoutDuplicates(mcfgs, modulesCLIList)\n\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn newModuleRegistry(modulesPath, mcfgs, modulesOverrides, beatVersion)\n}", "func NewAppModule(k keeper.Keeper,\n\taccountKeeper types.AccountKeeper,\n) AppModule {\n\treturn AppModule{\n\t\tAppModuleBasic: AppModuleBasic{},\n\t\tkeeper: k,\n\t\taccountKeeper: accountKeeper,\n\t}\n}", "func Module(filename, input string) func(r *Zego) {\n\treturn func(r *Zego) {\n\t\tr.modules = append(r.modules, rawModule{\n\t\t\tfilename: filename,\n\t\t\tmodule: input,\n\t\t})\n\t}\n}", "func NewAppModule(cdc codec.Codec, keeper keeper.Keeper) AppModule {\n\treturn AppModule{\n\t\tAppModuleBasic: AppModuleBasic{cdc: cdc},\n\t\tkeeper: keeper,\n\t}\n}", "func newServiceNode(port int, httpport int, wsport int, modules ...string) (*node.Node, error) {\n\tcfg := &node.DefaultConfig\n\tcfg.P2P.ListenAddr = fmt.Sprintf(\":%d\", port)\n\tcfg.P2P.EnableMsgEvents = true\n\tcfg.P2P.NoDiscovery = true\n\tcfg.IPCPath = ipcpath\n\tcfg.DataDir = fmt.Sprintf(\"%s%d\", datadirPrefix, port)\n\tif httpport > 0 {\n\t\tcfg.HTTPHost = node.DefaultHTTPHost\n\t\tcfg.HTTPPort = httpport\n\t}\n\tif wsport > 0 {\n\t\tcfg.WSHost = node.DefaultWSHost\n\t\tcfg.WSPort = wsport\n\t\tcfg.WSOrigins = []string{\"*\"}\n\t\tfor i := 0; i < len(modules); i++ {\n\t\t\tcfg.WSModules = append(cfg.WSModules, modules[i])\n\t\t}\n\t}\n\tstack, err := node.New(cfg)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"ServiceNode create fail: %v\", err)\n\t}\n\treturn stack, nil\n}", "func NewAppModule(k Keeper, accKeeper types.AccountKeeper, scheduleKeeper types.ScheduleKeeper, bankKeeper types.BankKeeper, profileKeeper types.ProfileKeeper, refKeeper types.ReferralKeeper) AppModule {\n\treturn AppModule{\n\t\tAppModuleBasic: AppModuleBasic{},\n\t\tkeeper: k,\n\t\taccKeeper: accKeeper,\n\t\tscheduleKeeper: scheduleKeeper,\n\t\tbankKeeper: bankKeeper,\n\t\tprofileKeeper: profileKeeper,\n\t\trefKeeper: refKeeper,\n\t}\n}", "func New(\n\tazureEnvironment azure.Environment,\n\tarmDeployer arm.Deployer,\n\tserversClient mysqlSDK.ServersClient,\n) service.Module {\n\treturn &module{\n\t\tserviceManager: &serviceManager{\n\t\t\tsqlDatabaseDNSSuffix: azureEnvironment.SQLDatabaseDNSSuffix,\n\t\t\tarmDeployer: armDeployer,\n\t\t\tserversClient: serversClient,\n\t\t},\n\t}\n}", "func NewExtensionModule(ctx *Context, hideOutput bool) Module {\n\twork := newExtWorker(ctx)\n\tif hideOutput {\n\t\treturn newModule(work)\n\t}\n\trend := newExtRenderer(work, ctx.top)\n\treturn newModule(work, rend)\n}", "func (t Test) Module() error {\n\tmg.Deps(t.FixtureContainerImages, t.GenerateExampleModules)\n\treturn sh.RunWithV(ENV, \"go\", \"test\", \"-v\", \"-tags=module_integration\", \"./integration/...\")\n}", "func AddModule(id string, m ModuleLoader) {\n globalModules[id] = m\n}", "func (module *Module) Clone() *Module {\n\treturn NewModule(module.ClassMap.Clone())\n}", "func (r *FeatureModuleResource) Create(item FeatureModuleConfig) error {\n\tif err := r.c.ModQuery(\"POST\", BasePath+FeatureModuleEndpoint, item); err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "func ModuleBeforeCreateImmutable(\n\targModule *types.Module,\n\targOldModule *types.Module,\n\targNamespace *types.Namespace,\n) *moduleBeforeCreate {\n\treturn &moduleBeforeCreate{\n\t\tmoduleBase: &moduleBase{\n\t\t\timmutable: true,\n\t\t\tmodule: argModule,\n\t\t\toldModule: argOldModule,\n\t\t\tnamespace: argNamespace,\n\t\t},\n\t}\n}", "func (mc *ModuleCreate) Run() error {\n\t_, err := mc.cm.Module(mc.app, mc.module)\n\tif err == nil {\n\t\treturn errors.Errorf(\"module %q already exists\", mc.module)\n\t}\n\n\treturn mc.cm.CreateModule(mc.app, mc.module)\n}", "func NewAccessPackage()(*AccessPackage) {\n m := &AccessPackage{\n Entity: *NewEntity(),\n }\n return m\n}" ]
[ "0.7806673", "0.7403257", "0.7401769", "0.73382664", "0.733018", "0.72794574", "0.72330165", "0.7176429", "0.7170671", "0.70850444", "0.698915", "0.6977004", "0.69332325", "0.6872276", "0.6861295", "0.6768912", "0.67370933", "0.6728899", "0.6697906", "0.6690836", "0.6682623", "0.66788125", "0.66621315", "0.6628042", "0.6623107", "0.6589288", "0.6577393", "0.6536083", "0.65240246", "0.6519261", "0.6501629", "0.64723545", "0.64718276", "0.64523935", "0.6362439", "0.63226503", "0.6311227", "0.62989336", "0.62892586", "0.6258718", "0.62223274", "0.61871386", "0.61447424", "0.60894305", "0.6076483", "0.6036004", "0.6017238", "0.6012732", "0.6012241", "0.59909755", "0.5964451", "0.5926688", "0.59223807", "0.58910483", "0.58765453", "0.58703643", "0.58690596", "0.58279735", "0.5827056", "0.58002037", "0.5799241", "0.57985586", "0.5763951", "0.5762292", "0.5757843", "0.5734616", "0.57302636", "0.57271695", "0.5689101", "0.5684023", "0.56708914", "0.5663717", "0.5654931", "0.56501156", "0.56415534", "0.5637975", "0.561384", "0.5591591", "0.55794245", "0.55763507", "0.5556427", "0.55545384", "0.55488676", "0.5520401", "0.55103904", "0.54990125", "0.54774576", "0.54769117", "0.5470361", "0.5466158", "0.545347", "0.5431187", "0.54256886", "0.5424798", "0.5421946", "0.5418877", "0.5417201", "0.5410637", "0.53935516", "0.53767234" ]
0.7537657
1
SetProperty will add, update or remove a property from the module. If the value is empty, it would be removed. If a key does not exist, it will be added. If a key exists, it will be updated. Note that this function will maintain order and will set the order of the properties in the order they are added to the Module.
func (m *Module) SetProperty(keyword KEYWORD, value string) error { if !keyword.isValid() { return errors.New(fmt.Sprintf("Invalid or Unsupported keyword provided in puppetfile: %s", keyword)) } found := false for i, prop := range m.properties { if prop.key == keyword { found = true if value == "" { m.properties = append(m.properties[:i], m.properties[i+1:]...) break } prop.value = value break } } if !found { m.properties = append(m.properties, &property{key: keyword, value: value}) } return nil }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (p *Properties) Set(key string, value string) error {\n\tvalue, err := p.Expand(value)\n\tp.m[key] = value\n\treturn err\n}", "func UpdateModuleProperty(modules []*puppet.Module, module, key, value string) {\n\tfor _, mod := range modules {\n\t\tif strings.ToLower(mod.Name) == module {\n\t\t\tif strings.ToLower(key) == \"version\" {\n\t\t\t\tmod.Version = value\n\t\t\t} else if err := mod.SetProperty(puppet.KEYWORD(key), value); err != nil {\n\t\t\t\tlog.Fatalf(\"Could not set property: %s\", err)\n\t\t\t}\n\t\t}\n\t}\n}", "func (pg *PropertyGroup) Set(key string, p Property) {\n\tp = Property(strings.ToLower(string(p)))\n\tif pg.propsDict == nil {\n\t\tpg.propsDict = make(map[string]Property)\n\t}\n\tpg.propsDict[key] = p\n}", "func (n *Node) Set(key string, val interface{}) {\n\tn.Properties[key] = val\n}", "func (o *Object) Set(key string, val interface{}) error {\n\tif len(key) == 0 {\n\t\treturn errors.New(\"v8go: You must provide a valid property key\")\n\t}\n\treturn set(o, key, 0, val)\n}", "func (z *ZfsH) SetProperty(d *Dataset, key, val string) error {\n\tprop := strings.Join([]string{key, val}, \"=\")\n\t_, err := z.zfs(\"set\", prop, d.Name)\n\treturn err\n}", "func (obj *OrderedObject) Set(key string, value interface{}) (exists bool) {\n\tif idx, ok := obj.keys[key]; ok {\n\t\tobj.Object[idx].Value = value\n\t\treturn false\n\t} else {\n\t\tobj.keys[key] = len(obj.Object)\n\t\tobj.Object = append(obj.Object, json.Member{Key: key, Value: value})\n\t\treturn true\n\t}\n}", "func (mod *EthModule) SetProperty(field string, value interface{}) error {\n\tcv := reflect.ValueOf(mod.Config).Elem()\n\treturn utils.SetProperty(cv, field, value)\n}", "func (p PropertyPath) Set(dest, v PropertyValue) bool {\n\tif len(p) == 0 {\n\t\treturn false\n\t}\n\n\tdest, ok := p[:len(p)-1].Get(dest)\n\tif !ok {\n\t\treturn false\n\t}\n\n\tkey := p[len(p)-1]\n\tswitch {\n\tcase dest.IsArray():\n\t\tindex, ok := key.(int)\n\t\tif !ok || index < 0 || index >= len(dest.ArrayValue()) {\n\t\t\treturn false\n\t\t}\n\t\tdest.ArrayValue()[index] = v\n\tcase dest.IsObject():\n\t\tk, ok := key.(string)\n\t\tif !ok {\n\t\t\treturn false\n\t\t}\n\t\tdest.ObjectValue()[PropertyKey(k)] = v\n\tdefault:\n\t\treturn false\n\t}\n\treturn true\n}", "func (o *FakeObject) Set(key string, value interface{}) { o.Properties[key] = value }", "func (a *MapVariableProperties_Values) Set(fieldName string, value string) {\n\tif a.AdditionalProperties == nil {\n\t\ta.AdditionalProperties = make(map[string]string)\n\t}\n\ta.AdditionalProperties[fieldName] = value\n}", "func (p *Property) SetValue(v int) {\n\t// change the member value of property\n\tp.value = v\n}", "func (a *AdditionalPropertiesObject1) Set(fieldName string, value int) {\n\tif a.AdditionalProperties == nil {\n\t\ta.AdditionalProperties = make(map[string]int)\n\t}\n\ta.AdditionalProperties[fieldName] = value\n}", "func (a *AdditionalPropertiesObject1) Set(fieldName string, value int) {\n\tif a.AdditionalProperties == nil {\n\t\ta.AdditionalProperties = make(map[string]int)\n\t}\n\ta.AdditionalProperties[fieldName] = value\n}", "func (c *Config) Set(key string, value interface{}) {\n\tif key == \"\" {\n\t\treturn\n\t}\n\n\tpath := strings.Split(key, c.separator)\n\tinsert(c.mp, path, value)\n}", "func (object Object) Set(key string, value interface{}) Object {\n\tobject[key] = value\n\treturn object\n}", "func (pool *Pool) SetProperty(p Prop, value string) (err error) {\n\tif pool.list != nil {\n\t\t// First check if property exist at all\n\t\tif p < PoolPropName || p > PoolNumProps {\n\t\t\terr = errors.New(fmt.Sprint(\"Unknown zpool property: \",\n\t\t\t\tPoolPropertyToName(p)))\n\t\t\treturn\n\t\t}\n\t\tcsPropName := C.CString(PoolPropertyToName(p))\n\t\tcsPropValue := C.CString(value)\n\t\tr := C.zpool_set_prop(pool.list.zph, csPropName, csPropValue)\n\t\tC.free(unsafe.Pointer(csPropName))\n\t\tC.free(unsafe.Pointer(csPropValue))\n\t\tif r != 0 {\n\t\t\terr = LastError()\n\t\t} else {\n\t\t\t// Update Properties member with change made\n\t\t\tif _, err = pool.GetProperty(p); err != nil {\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t\treturn\n\t}\n\treturn errors.New(msgPoolIsNil)\n}", "func Set(property string) PropertyItem {\n\tp := PropertyItem{\n\t\tProperty: property,\n\t\tType: SetType,\n\t\tIsPrefix: false,\n\t}\n\treturn p\n}", "func (p Parameters) Set(key, value string) {\n\tp[key] = value\n}", "func (a *Meta_Priority) Set(fieldName string, value interface{}) {\n\tif a.AdditionalProperties == nil {\n\t\ta.AdditionalProperties = make(map[string]interface{})\n\t}\n\ta.AdditionalProperties[fieldName] = value\n}", "func (o Opts) Set(key, value string) {\n\to[key] = value\n}", "func (a *HTTPNotificationEndpoint_Headers) Set(fieldName string, value string) {\n\tif a.AdditionalProperties == nil {\n\t\ta.AdditionalProperties = make(map[string]string)\n\t}\n\ta.AdditionalProperties[fieldName] = value\n}", "func Set(key string, value interface{}) {\n\tglobalStore.Lock()\n\tdefer globalStore.Unlock()\n\n\tglobalStore.store[key] = value\n}", "func (o *Object) Set(key StringOrSymbol, val, receiver Value) Boolean {\n\tif p, ok := o.fields[key]; ok {\n\t\treturn p.Set()(val)\n\t}\n\treturn False\n}", "func (a *AdditionalPropertiesObject3) Set(fieldName string, value interface{}) {\n\tif a.AdditionalProperties == nil {\n\t\ta.AdditionalProperties = make(map[string]interface{})\n\t}\n\ta.AdditionalProperties[fieldName] = value\n}", "func (a *AdditionalPropertiesObject3) Set(fieldName string, value interface{}) {\n\tif a.AdditionalProperties == nil {\n\t\ta.AdditionalProperties = make(map[string]interface{})\n\t}\n\ta.AdditionalProperties[fieldName] = value\n}", "func (a *LabelUpdate_Properties) Set(fieldName string, value string) {\n\tif a.AdditionalProperties == nil {\n\t\ta.AdditionalProperties = make(map[string]string)\n\t}\n\ta.AdditionalProperties[fieldName] = value\n}", "func (s *Service) SetProperty(n PropertyName, v interface{}) error {\n\tif m := s.mgr; m != nil {\n\t\tm.lock()\n\t\tdefer m.unlock()\n\t}\n\tif e := s.setProp(n, v); e != nil {\n\t\ts.logf(\"Failed to set property %s: %v\", s.Name(), e)\n\t\treturn e\n\t}\n\treturn nil\n}", "func (c *Control) Set(key, value string) {\n\tc.Values[key] = value\n\tfor _, okey := range c.Order {\n\t\tif okey == key {\n\t\t\treturn\n\t\t}\n\t}\n\tc.Order = append(c.Order, key)\n\treturn\n}", "func (a *Label_Properties) Set(fieldName string, value string) {\n\tif a.AdditionalProperties == nil {\n\t\ta.AdditionalProperties = make(map[string]string)\n\t}\n\ta.AdditionalProperties[fieldName] = value\n}", "func (a *Meta_Pulsar) Set(fieldName string, value interface{}) {\n\tif a.AdditionalProperties == nil {\n\t\ta.AdditionalProperties = make(map[string]interface{})\n\t}\n\ta.AdditionalProperties[fieldName] = value\n}", "func (_class PIFClass) SetProperty(sessionID SessionRef, self PIFRef, name string, value string) (_err error) {\n\t_method := \"PIF.set_property\"\n\t_sessionIDArg, _err := convertSessionRefToXen(fmt.Sprintf(\"%s(%s)\", _method, \"session_id\"), sessionID)\n\tif _err != nil {\n\t\treturn\n\t}\n\t_selfArg, _err := convertPIFRefToXen(fmt.Sprintf(\"%s(%s)\", _method, \"self\"), self)\n\tif _err != nil {\n\t\treturn\n\t}\n\t_nameArg, _err := convertStringToXen(fmt.Sprintf(\"%s(%s)\", _method, \"name\"), name)\n\tif _err != nil {\n\t\treturn\n\t}\n\t_valueArg, _err := convertStringToXen(fmt.Sprintf(\"%s(%s)\", _method, \"value\"), value)\n\tif _err != nil {\n\t\treturn\n\t}\n\t_, _err = _class.client.APICall(_method, _sessionIDArg, _selfArg, _nameArg, _valueArg)\n\treturn\n}", "func (s *Store) Set(key string, value interface{}) {\n\ts.access.Lock()\n\tdefer s.access.Unlock()\n\n\ts.data[key] = value\n\ts.sendDataChanged()\n\ts.doKeyChanged(key)\n}", "func (c *Client) SetProperty(name string, value interface{}) error {\n\t_, err := c.Exec(\"set_property\", name, value)\n\treturn err\n}", "func (a *ParamsWithAddPropsParams_P1) Set(fieldName string, value interface{}) {\n\tif a.AdditionalProperties == nil {\n\t\ta.AdditionalProperties = make(map[string]interface{})\n\t}\n\ta.AdditionalProperties[fieldName] = value\n}", "func (m Metadata) Set(key string, value string) {\n\tif key == \"\" || value == \"\" {\n\t\treturn\n\t}\n\tk := strings.ToLower(key)\n\tm[k] = value\n}", "func (s *Service) SetProperty(key, value string) error {\n\treturn s.client.setProperty(key, value)\n}", "func (p *Pipe) Set(key string, value interface{}) {\n\tp.data[key] = value\n}", "func (e *Environment) Set(name string, val Object, mut bool) Object {\n\te.store[name] = Variable{value: val, mutable: mut}\n\treturn val\n}", "func (p *AccumuloProxyClient) SetProperty(login []byte, property string, value string) (err error) {\n\tif err = p.sendSetProperty(login, property, value); err != nil {\n\t\treturn\n\t}\n\treturn p.recvSetProperty()\n}", "func (m Object) Set(k string, v Node) Object {\n\tm[k] = v\n\treturn m\n}", "func (h HttpHeader) Set(key, value string) {\n\tif _, ok := h[key]; ok {\n\t\th[key] = nil\n\t}\n\th[key] = make([]string, 0)\n\th[key] = append(h[key], value)\n}", "func (config *wrapper) Set(section string, key string, value string) error {\n\tconfig.cfg.Section(section).Key(key).SetValue(value)\n\treturn nil\n}", "func (m *Modifier) Set(mod of_snmp.Mod) error {\n\n\t// Confirm mode is for Set.\n\tif mod.Type != of_snmp.Set {\n\t\treturn of.ErrInvalidOperation\n\t}\n\n\t// Check if key is empty.\n\t// Not checking if value is empty. There could be a scenario, where user wants to clear the value of this key.\n\tif mod.Key == \"\" {\n\t\treturn of.ErrKeyMissing\n\t}\n\n\t// Set operation.\n\t(*m.Map)[mod.Key] = mod.Value\n\treturn nil\n}", "func (pg *PropertyGroup) Add(key string, p Property) {\n\tif pg.propsDict == nil {\n\t\tpg.propsDict = make(map[string]Property)\n\t}\n\t_, exists := pg.propsDict[key]\n\tif !exists {\n\t\tpg.propsDict[key] = p\n\t}\n}", "func (e *Entity) AddSetItem(property, key string) PropertyItem {\n\tp := PropertyItem{\n\t\tProperty: property,\n\t\tValue: key,\n\t\tType: SetType,\n\t\tMutationMode: int32(adl.MutationMode_WRITE),\n\t}\n\te.props = append(e.props, p)\n\treturn p\n}", "func set(stub shim.ChaincodeStubInterface, args []string) (string, error) {\r\n\tif len(args) != 2 {\r\n\t\treturn \"\", fmt.Errorf(\"Incorrect arguments. Expecting a key and a value\")\r\n\t}\r\n\r\n\tdebug(\"try to write property with key '%s'\", args[0])\r\n\tbytes := []byte(args[1])\r\n\terr := stub.PutState(args[0], bytes)\r\n\tif err != nil {\r\n\t\treturn \"\", fmt.Errorf(\"Failed to set value for key '%s' with error: %s\", args[0], err)\r\n\t}\r\n\tdebug(\"written value: %s\", bytes)\r\n\treturn args[1], nil\r\n}", "func (obj *SObject) Set(key string, value interface{}) *SObject {\n\t(*obj)[key] = value\n\treturn obj\n}", "func (p *Property) Set(v interface{}) (err error) {\n\tif p.IsBool() {\n\t\tp.vbool, err = boolOf(v)\n\t} else {\n\t\tp.vstr, err = stringOf(v)\n\t}\n\treturn\n}", "func (s *Store) Set(key string, value string) {\r\n\ts.store[key] = value\r\n}", "func (e *Environment) Set(name string, val Object) Object {\n\te.store[name] = val\n\treturn val\n}", "func (e *Environment) Set(name string, val Object) Object {\n\te.store[name] = val\n\treturn val\n}", "func (rs *Store) Set(ctx context.Context, key, value interface{}) error {\n\trs.lock.Lock()\n\tdefer rs.lock.Unlock()\n\trs.values[key] = value\n\treturn nil\n}", "func (s *metadataSupplier) Set(key string, value string) {\n\ts.metadata.Set(key, value)\n}", "func (a *Meta_Up) Set(fieldName string, value interface{}) {\n\tif a.AdditionalProperties == nil {\n\t\ta.AdditionalProperties = make(map[string]interface{})\n\t}\n\ta.AdditionalProperties[fieldName] = value\n}", "func (a *AdditionalPropertiesObject4) Set(fieldName string, value interface{}) {\n\tif a.AdditionalProperties == nil {\n\t\ta.AdditionalProperties = make(map[string]interface{})\n\t}\n\ta.AdditionalProperties[fieldName] = value\n}", "func (a *AdditionalPropertiesObject4) Set(fieldName string, value interface{}) {\n\tif a.AdditionalProperties == nil {\n\t\ta.AdditionalProperties = make(map[string]interface{})\n\t}\n\ta.AdditionalProperties[fieldName] = value\n}", "func (m *Map) Set(key string, value Value) {\n\tif f, ok := m.Get(key); ok {\n\t\tf.Value = value\n\t\treturn\n\t}\n\tm.Items = append(m.Items, Field{Name: key, Value: value})\n\tm.index = nil // Since the append might have reallocated\n}", "func (p *Properties) Put(key, value string) {\r\n\tif p == nil {\r\n\t\tlog.Fatal(\"Try to save value from null Properties\")\r\n\t}\r\n\r\n\tif p.dict == nil {\r\n\t\tp.dict = make(map[string]string)\r\n\t}\r\n\tp.dict[key] = value\r\n}", "func (a *Meta_Weight) Set(fieldName string, value interface{}) {\n\tif a.AdditionalProperties == nil {\n\t\ta.AdditionalProperties = make(map[string]interface{})\n\t}\n\ta.AdditionalProperties[fieldName] = value\n}", "func (a *Meta_Georegion) Set(fieldName string, value interface{}) {\n\tif a.AdditionalProperties == nil {\n\t\ta.AdditionalProperties = make(map[string]interface{})\n\t}\n\ta.AdditionalProperties[fieldName] = value\n}", "func (a *TemplateApply_EnvRefs) Set(fieldName string, value interface{}) {\n\tif a.AdditionalProperties == nil {\n\t\ta.AdditionalProperties = make(map[string]interface{})\n\t}\n\ta.AdditionalProperties[fieldName] = value\n}", "func setJsObject(key string, v interface{}) {\n\tmodule.Set(key, v)\n}", "func (ms *ModuleSet) Set(mod *Module) {\n\tif mod == nil {\n\t\tbuild.Critical(\"nil module cannot be set\")\n\t}\n\tid := mod.Identifier()\n\tfor idx, origMod := range ms.modules {\n\t\tif origMod.Identifier() == id {\n\t\t\t// overwrite an existing module\n\t\t\tms.modules[idx] = Module{\n\t\t\t\tName: mod.Name,\n\t\t\t\tDescription: mod.Description,\n\t\t\t\tDependencies: ModuleIdentifierSet{identifiers: mod.Dependencies.Identifiers()},\n\t\t\t}\n\t\t\treturn\n\t\t}\n\t}\n\t// add the module as a new unique module\n\tms.modules = append(ms.modules, Module{\n\t\tName: mod.Name,\n\t\tDescription: mod.Description,\n\t\tDependencies: ModuleIdentifierSet{identifiers: mod.Dependencies.Identifiers()},\n\t})\n}", "func (d *MemcData) Set(key string, value interface{}) error {\n\td.lock.Lock()\n\tdefer d.lock.Unlock()\n\tif d.values == nil {\n\t\td.values = make(map[string]interface{})\n\t}\n\td.values[key] = value\n\td.isUpd = true\n\n\treturn nil\n}", "func (z *zfsctl) Set(ctx context.Context, name string, properties map[string]string) *execute {\n\targs := []string{\"set\"}\n\tif properties != nil {\n\t\tkv := \"\"\n\t\tfor k, v := range properties {\n\t\t\tkv += fmt.Sprintf(\"%s=%s \", k, v)\n\t\t}\n\t\targs = append(args, kv)\n\t}\n\targs = append(args, name)\n\treturn &execute{ctx: ctx, name: z.cmd, args: args}\n}", "func (l *localStore) Set(key string, b []byte) error {\n\t_, ok := l.m[key]\n\tl.m[key] = b\n\tif ok {\n\t\treturn ErrKeyExist\n\t}\n\treturn nil\n}", "func (e *env) set(key string, value *object) error {\n\tee, err := e.find(key)\n\tif err != nil {\n\t\treturn err\n\t}\n\tee.define(key, value)\n\treturn nil\n}", "func (e *Element) Set(key string, value interface{}) {\n\tif e.items == nil {\n\t\te.items = make(map[string]interface{})\n\t}\n\te.items[key] = value\n}", "func (a *Meta_HighWatermark) Set(fieldName string, value interface{}) {\n\tif a.AdditionalProperties == nil {\n\t\ta.AdditionalProperties = make(map[string]interface{})\n\t}\n\ta.AdditionalProperties[fieldName] = value\n}", "func (c *Config) Set(key, val string) {\n\tif v, ok := c.values[key]; ok {\n\t\tif v == val { //Skip if already set\n\t\t\treturn\n\t\t}\n\t\tdelete(c.values, key)\n\t}\n\tc.values[key] = val\n\tc.Refresh()\n}", "func (s *PostgresStore) Set(key, value interface{}) error {\n\ts.lock.Lock()\n\tdefer s.lock.Unlock()\n\n\ts.data[key] = value\n\treturn nil\n}", "func (h *Header) Set(key, value string) {\r\n\tdone:=false\r\n\tvar next *list.Element\r\n\tfor e := h.List.Front(); e != nil; {\r\n\t\tkv := e.Value.(*KeyValue)\r\n\t\tif kv.Key == key {\r\n\t\t\tif done{\r\n\t\t\t\tnext = e.Next()\r\n\t\t\t\th.List.Remove(e)\r\n\t\t\t\te = next\r\n\t\t\t}else{\r\n\t\t\t\tkv.Value = value\r\n\t\t\t\tdone=true\r\n\t\t\t\te = e.Next()\r\n\t\t\t}\r\n\t\t} else {\r\n\t\t\te = e.Next()\r\n\t\t}\r\n\t}\r\n\r\n\tif !done{\r\n\t\th.Add(key,value)\r\n\t}\r\n}", "func (a *BodyWithAddPropsJSONBody) Set(fieldName string, value interface{}) {\n\tif a.AdditionalProperties == nil {\n\t\ta.AdditionalProperties = make(map[string]interface{})\n\t}\n\ta.AdditionalProperties[fieldName] = value\n}", "func (a *BodyWithAddPropsJSONBody) Set(fieldName string, value interface{}) {\n\tif a.AdditionalProperties == nil {\n\t\ta.AdditionalProperties = make(map[string]interface{})\n\t}\n\ta.AdditionalProperties[fieldName] = value\n}", "func (v values) Set(key, value string) {\n\tv[key] = value\n}", "func (recv *Object) SetProperty(propertyName string, value *Value) {\n\tc_property_name := C.CString(propertyName)\n\tdefer C.free(unsafe.Pointer(c_property_name))\n\n\tc_value := (*C.GValue)(C.NULL)\n\tif value != nil {\n\t\tc_value = (*C.GValue)(value.ToC())\n\t}\n\n\tC.g_object_set_property((*C.GObject)(recv.native), c_property_name, c_value)\n\n\treturn\n}", "func (m Values) Set(key string, value string) {\n\tm[key] = []string{value}\n}", "func (pmap *PropertyMap) Add(key string, value Property) {\n\tif pmap == nil {\n\t\treturn\n\t}\n\tgroupname := GroupNameFromPropertyKey(key)\n\tgroup, found := pmap.m[groupname]\n\tif !found {\n\t\tgroup = NewPropertyGroup(groupname)\n\t\tpmap.m[groupname] = group\n\t}\n\tgroup.Set(key, value)\n}", "func (a *Meta_Asn) Set(fieldName string, value interface{}) {\n\tif a.AdditionalProperties == nil {\n\t\ta.AdditionalProperties = make(map[string]interface{})\n\t}\n\ta.AdditionalProperties[fieldName] = value\n}", "func (a *AdditionalPropertiesObject5) Set(fieldName string, value SchemaObject) {\n\tif a.AdditionalProperties == nil {\n\t\ta.AdditionalProperties = make(map[string]SchemaObject)\n\t}\n\ta.AdditionalProperties[fieldName] = value\n}", "func (m *MetaSpec) Set(key string, value string) error {\n\tif m.IsExternal() {\n\t\treturn errors.New(\"can only meta set current build meta\")\n\t}\n\tmetaFilePath := m.MetaFilePath()\n\tvar previousMeta map[string]interface{}\n\n\tmetaJSON, err := ioutil.ReadFile(metaFilePath)\n\t// Not exist directory\n\tif err != nil {\n\t\tif !os.IsNotExist(err) {\n\t\t\treturn err\n\t\t}\n\t\t_, err := m.SetupDir()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\t// Initialize interface if first setting meta\n\t\tpreviousMeta = make(map[string]interface{})\n\t} else {\n\t\t// Exist meta.json\n\t\tif len(metaJSON) != 0 {\n\t\t\terr = json.Unmarshal(metaJSON, &previousMeta)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t} else {\n\t\t\t// Exist meta.json but it is empty\n\t\t\tpreviousMeta = make(map[string]interface{})\n\t\t}\n\t}\n\n\tkey, parsedValue := setMetaValueRecursive(key, value, previousMeta, m.JSONValue)\n\tpreviousMeta[key] = parsedValue\n\n\tresultJSON, err := json.Marshal(previousMeta)\n\tif err != nil {\n\t\treturn err\n\t}\n\terr = ioutil.WriteFile(metaFilePath, resultJSON, 0666)\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "func (s *LevelDBStore) Set(key string, value []byte) {\n\t_ = s.db.Put([]byte(key), value, nil)\n}", "func (c *ConfigContainer) Set(key, val string) error {\n\tc.Lock()\n\tdefer c.Unlock()\n\tc.data[key] = val\n\treturn nil\n}", "func (m NMap) Set(key uint32, value interface{}) {\n\tinterMap := m.getInternalNMap(key)\n\tinterMap.Lock()\n\tinterMap.objs[key] = value\n\tinterMap.Unlock()\n}", "func (s *Session) Set(key string, value interface{}) {\n\tdefer s.refresh()\n\ts.values[key] = value\n}", "func (a *Event_Payload) Set(fieldName string, value interface{}) {\n\tif a.AdditionalProperties == nil {\n\t\ta.AdditionalProperties = make(map[string]interface{})\n\t}\n\ta.AdditionalProperties[fieldName] = value\n}", "func (s Store) Set(ctx context.Context, key int64, value string) error {\n\tconn := s.Pool.Get()\n\tdefer conn.Close()\n\n\t_, err := conn.Do(\"SET\", key, value)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func SetProp(name string, props map[string]interface{}, source PropSource) error {\n\tcmd := &Cmd{\n\t\tCookie: uint64(source),\n\t}\n\terrList := make(map[string]int64)\n\treturn NvlistIoctl(zfsHandle.Fd(), ZFS_IOC_SET_PROP, name, cmd, props, errList, nil)\n\t// TODO: Distinguish between partial and complete failures using errList\n}", "func (o *Objects) Set(key string, val interface{}, ttl int64) error {\n\tif ttl > 0 {\n\t\tttl = time.Now().Add(time.Duration(ttl) * time.Second).Unix()\n\t}\n\n\to.Lock()\n\tdefer o.Unlock()\n\to.values[key] = &Object{val, ttl}\n\n\treturn nil\n}", "func (h Headers) Set(key, value string) {\n\tkey = strings.ToLower(key)\n\th[key] = value\n}", "func (a *TemplateApply_Secrets) Set(fieldName string, value string) {\n\tif a.AdditionalProperties == nil {\n\t\ta.AdditionalProperties = make(map[string]string)\n\t}\n\ta.AdditionalProperties[fieldName] = value\n}", "func (m *OrderedMap) Set(key string, val interface{}) {\n\t_, ok := m.m[key]\n\tif !ok {\n\t\tm.keys = append(m.keys, key)\n\t}\n\tm.m[key] = val\n}", "func (s *MongodbStore) Set(key, val interface{}) error {\n\ts.lock.Lock()\n\tdefer s.lock.Unlock()\n\n\ts.data[key] = val\n\treturn nil\n}", "func Set(dict map[string]interface{}, key string, value string) {\n\tDataReadWriteLock.Lock()\n\tdefer DataReadWriteLock.Unlock()\n\tdict[key] = value\n}", "func (a *Meta_Note) Set(fieldName string, value interface{}) {\n\tif a.AdditionalProperties == nil {\n\t\ta.AdditionalProperties = make(map[string]interface{})\n\t}\n\ta.AdditionalProperties[fieldName] = value\n}", "func (o *NotificationCreate) SetProperty(key string, value interface{}) {\n\tif o.additionalProperties == nil {\n\t\to.additionalProperties = make(map[string]interface{})\n\t}\n\to.additionalProperties[key] = value\n}", "func (DummyStore) Set(key string, value interface{}) error {\n\treturn nil\n}", "func (a *Secrets) Set(fieldName string, value string) {\n\tif a.AdditionalProperties == nil {\n\t\ta.AdditionalProperties = make(map[string]string)\n\t}\n\ta.AdditionalProperties[fieldName] = value\n}", "func (a *Meta_UsState) Set(fieldName string, value interface{}) {\n\tif a.AdditionalProperties == nil {\n\t\ta.AdditionalProperties = make(map[string]interface{})\n\t}\n\ta.AdditionalProperties[fieldName] = value\n}" ]
[ "0.6621714", "0.6528835", "0.65271294", "0.6077096", "0.60260785", "0.5918111", "0.58526725", "0.584064", "0.57882804", "0.57280535", "0.56456727", "0.56384665", "0.5611549", "0.5611549", "0.56007594", "0.5562666", "0.55614173", "0.55416006", "0.5511458", "0.5501708", "0.5487372", "0.54450315", "0.54346603", "0.5343845", "0.534135", "0.534135", "0.53407586", "0.52885413", "0.5269977", "0.52579194", "0.5249907", "0.52362925", "0.52343786", "0.5211687", "0.5207359", "0.5190568", "0.5184878", "0.51846945", "0.51425093", "0.51381046", "0.5134748", "0.5131901", "0.51274365", "0.5125685", "0.512502", "0.51245475", "0.5121403", "0.511508", "0.51051635", "0.5102565", "0.50930285", "0.50930285", "0.50853264", "0.50714207", "0.50694084", "0.50645226", "0.50645226", "0.5063248", "0.5062089", "0.5047102", "0.5045492", "0.50419277", "0.5037836", "0.5032725", "0.50262463", "0.50237143", "0.50207806", "0.5019028", "0.5012543", "0.50079834", "0.49956813", "0.49942458", "0.4992224", "0.49871588", "0.49871588", "0.49855652", "0.49843365", "0.4981419", "0.4976818", "0.49696738", "0.4966491", "0.49634603", "0.49589738", "0.49553016", "0.4945009", "0.49442726", "0.49435893", "0.49432087", "0.49397397", "0.49391297", "0.49319124", "0.49306554", "0.49290076", "0.49254456", "0.4921254", "0.49111122", "0.49049777", "0.4901698", "0.48959073", "0.48930058" ]
0.65085065
3
String prints the module in the format that can be used in the Puppetfile. If no properties or version exits, the String property will return an empty string.
func (m *Module) String() string { if len(m.properties) == 0 && m.Version == "" { return "" } b := bytes.Buffer{} b.WriteString(fmt.Sprintf("mod '%s',", m.Name)) // Prints the version only if specified if m.Version != "" { b.WriteString(" ") b.WriteString(formatValue(m.Version)) } else { // Prints Properties if no version b.WriteString("\n") for _, v := range m.properties { b.WriteString(v.String()) } } return b.String() }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (v *Module) String() string {\n\tif v == nil {\n\t\treturn \"<nil>\"\n\t}\n\n\tvar fields [3]string\n\ti := 0\n\tfields[i] = fmt.Sprintf(\"ImportPath: %v\", v.ImportPath)\n\ti++\n\tfields[i] = fmt.Sprintf(\"Directory: %v\", v.Directory)\n\ti++\n\tfields[i] = fmt.Sprintf(\"ThriftFilePath: %v\", v.ThriftFilePath)\n\ti++\n\n\treturn fmt.Sprintf(\"Module{%v}\", strings.Join(fields[:i], \", \"))\n}", "func (m Module) String() string {\n\treturn fmt.Sprintf(\"Name: %s, Size: %d, Checksum: %d, Base address: %s, Default base address: %s\", m.Name, m.Size, m.Checksum, m.BaseAddress, m.DefaultBaseAddress)\n}", "func (module *TerraformModule) String() string {\n\tdependencies := []string{}\n\tfor _, dependency := range module.Dependencies {\n\t\tdependencies = append(dependencies, dependency.Path)\n\t}\n\treturn fmt.Sprintf(\n\t\t\"Module %s (excluded: %v, assume applied: %v, dependencies: [%s])\",\n\t\tmodule.Path, module.FlagExcluded, module.AssumeAlreadyApplied, strings.Join(dependencies, \", \"),\n\t)\n}", "func (m *Module) String() string {\n\treturn m.name\n}", "func (p *property) String() string {\n\treturn fmt.Sprintf(\"\\t%s => %s\\n\", string(p.key), formatValue(p.value))\n}", "func String() string {\n\treturn fmt.Sprintf(\n\t\t\"AppVersion = %s\\n\"+\n\t\t\t\"VCSRef = %s\\n\"+\n\t\t\t\"BuildVersion = %s\\n\"+\n\t\t\t\"BuildDate = %s\",\n\t\tAppVersion, VCSRef, BuildVersion, Date,\n\t)\n}", "func (ver Version) String() string {\n\tif ver.RawVersion != \"\" {\n\t\treturn ver.RawVersion\n\t}\n\tv := fmt.Sprintf(\"v%d.%d.%d\", ver.Major, ver.Minor, ver.Patch)\n\tif ver.PreRelease != \"\" {\n\t\tv += \"-\" + ver.PreRelease\n\t}\n\tif ver.GitHash != \"\" {\n\t\tv += \"(\" + ver.GitHash + \")\"\n\t}\n\t// TODO: Add metadata about the commit or build hash.\n\t// See https://golang.org/issue/29814\n\t// See https://golang.org/issue/33533\n\tvar metadata = strings.Join(ver.MetaData, \".\")\n\tif strings.Contains(ver.PreRelease, \"devel\") && metadata != \"\" {\n\t\tv += \"+\" + metadata\n\t}\n\treturn v\n}", "func (p Properties) String() string {\n\tsrep := \"-- properties --\\n\"\n\tfor k, v := range p {\n\t\tsrep += fmt.Sprintf(\"'%s' => '%s'\", k, v)\n\t\tsrep += \"\\n\"\n\t}\n\tsrep += \"----------------\\n\"\n\treturn srep\n}", "func (pi *PackageInfo) String() string {\n\tif pi == nil {\n\t\treturn \"#<package-info nil>\"\n\t}\n\treturn fmt.Sprintf(\"#<package-info %q ip=%q pkg=%p #deps=%d #src=%d #errs=%d>\",\n\t\tpi.Name, pi.ImportPath, pi.Package, len(pi.Dependencies), len(pi.Files), len(pi.Errors))\n}", "func (v Version) String() string {\n\ts := strconv.Itoa(v.Major) + \".\" + strconv.Itoa(v.Minor)\n\tif v.Patch > 0 {\n\t\ts += \".\" + strconv.Itoa(v.Patch)\n\t}\n\tif v.PreRelease != \"\" {\n\t\ts += v.PreRelease\n\t}\n\n\treturn s\n}", "func (v Version) String() string {\n\tvs := fmt.Sprintf(\"%d.%d.%d\", v.major, v.minor, v.patch)\n\tif len(v.preRelease) > 0 {\n\t\tvs += \"-\" + v.PreRelease()\n\t}\n\tif len(v.metadata) > 0 {\n\t\tvs += Metadata + v.Metadata()\n\t}\n\treturn vs\n}", "func String() string {\n\treturn fmt.Sprintf(\"OLM version: %s\\ngit commit: %s\\n\", OLMVersion, GitCommit)\n}", "func (v *Version) String() string {\n\treturn fmt.Sprintf(\"Version: %s%d.%d.%d%s\\nBuild Date: %s\\n Minimum Go Version: %s\",\n\t\tv.Prefix, v.Major, v.Minor, v.Maintenance, v.Suffix, v.BuildDate, v.MinGoVersion)\n}", "func (pg *PropertyGroup) String() string {\n\ts := \"[\" + pg.name + \"] =\\n\"\n\tfor k, v := range pg.propsDict {\n\t\ts += fmt.Sprintf(\" %s = %s\\n\", k, v)\n\t}\n\treturn s\n}", "func (v Version) String() string {\n\treturn fmt.Sprintf(\"v%d.%d.%d\", v.Major, v.Minor, v.Patches)\n}", "func String() string {\n\treturn Version\n}", "func (s ContactFlowModule) String() string {\n\treturn awsutil.Prettify(s)\n}", "func (s CreateContactFlowModuleOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "func String() string {\n\tv := fmt.Sprintf(\"v%d.%d.%d\", Major, Minor, Patch)\n\tif PreRelease != \"\" {\n\t\tv += \"-\" + PreRelease\n\t}\n\treturn v\n}", "func (p *VCardProperty) String() string {\n\treturn fmt.Sprintf(\" %s (type=%s, parameters=%v): %v\", p.Name, p.Type, p.Parameters, p.Value)\n}", "func (v Version) String() string {\n\treturn fmt.Sprintf(\"%d.%d.%d\", v.Major, v.Minor, v.Patch)\n}", "func (v Version) String() string {\n\treturn fmt.Sprintf(\"%d.%d.%d\", v.Major, v.Minor, v.Patch)\n}", "func String() string {\n\tvar version bytes.Buffer\n\tif AppName != \"\" {\n\t\tfmt.Fprintf(&version, \"%s \", AppName)\n\t}\n\tfmt.Fprintf(&version, \"v%s\", Version)\n\tif Prerelease != \"\" {\n\t\tfmt.Fprintf(&version, \"-%s\", Prerelease)\n\t}\n\n\treturn version.String()\n}", "func String() string {\n\treturn fmt.Sprintf(\"%d.%d.%d\", major, minor, patch)\n}", "func String() string {\n\treturn fmt.Sprintf(`Version: \"%s\", BuildTime: \"%s\", Commit: \"%s\" `, Version, BuildTime, Commit)\n}", "func String() string {\n\treturn fmt.Sprintf(\"Build Details:\\n\\tVersion:\\t%s\\n\\tDate:\\t\\t%s\", version, buildDate)\n}", "func (version Version) String() string {\n\treturn strconv.Itoa(int(version))\n}", "func (version Version) String() string {\n\treturn strconv.Itoa(int(version))\n}", "func (g *goVersion) String() string {\n\treturn g.golangVersion()\n}", "func (s SymanticVersion) String() string {\n\treturn fmt.Sprintf(\"%v.%v.%v.%v\", s.Major, s.Minor, s.Patch, s.Build)\n}", "func (s *State) String() string {\n\tif s == nil {\n\t\treturn \"<nil>\"\n\t}\n\n\t// sort the modules by name for consistent output\n\tmodules := make([]string, 0, len(s.Modules))\n\tfor m := range s.Modules {\n\t\tmodules = append(modules, m)\n\t}\n\tsort.Strings(modules)\n\n\tvar buf bytes.Buffer\n\tfor _, name := range modules {\n\t\tm := s.Modules[name]\n\t\tmStr := m.testString()\n\n\t\t// If we're the root module, we just write the output directly.\n\t\tif m.Addr.IsRoot() {\n\t\t\tbuf.WriteString(mStr + \"\\n\")\n\t\t\tcontinue\n\t\t}\n\n\t\t// We need to build out a string that resembles the not-quite-standard\n\t\t// format that terraform.State.String used to use, where there's a\n\t\t// \"module.\" prefix but then just a chain of all of the module names\n\t\t// without any further \"module.\" portions.\n\t\tbuf.WriteString(\"module\")\n\t\tfor _, step := range m.Addr {\n\t\t\tbuf.WriteByte('.')\n\t\t\tbuf.WriteString(step.Name)\n\t\t\tif step.InstanceKey != addrs.NoKey {\n\t\t\t\tbuf.WriteString(step.InstanceKey.String())\n\t\t\t}\n\t\t}\n\t\tbuf.WriteString(\":\\n\")\n\n\t\ts := bufio.NewScanner(strings.NewReader(mStr))\n\t\tfor s.Scan() {\n\t\t\ttext := s.Text()\n\t\t\tif text != \"\" {\n\t\t\t\ttext = \" \" + text\n\t\t\t}\n\n\t\t\tbuf.WriteString(fmt.Sprintf(\"%s\\n\", text))\n\t\t}\n\t}\n\n\treturn strings.TrimSpace(buf.String())\n}", "func (s UpdateProvisionedProductPropertiesOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "func (pv ProtocolVersion) String() string {\n\tstr := fmt.Sprintf(\"%d.%d.%d\",\n\t\t(pv.Version>>24)&0xFF, // major\n\t\t(pv.Version>>16)&0xFF, // minor\n\t\t(pv.Version>>8)&0xFF, // patch\n\t)\n\n\t// optional build number, only printed when non-0\n\tif build := pv.Version & 0xFF; build != 0 {\n\t\tstr += fmt.Sprintf(\".%d\", build)\n\t}\n\n\t// optional prerelease\n\tif pv.Prerelease != nilPreRelease {\n\t\tindex := 0\n\t\tfor index < 8 && pv.Prerelease[index] != 0 {\n\t\t\tindex++\n\t\t}\n\t\tstr += \"-\" + string(pv.Prerelease[:index])\n\t}\n\n\treturn str\n}", "func (v ComponentVersion) String() string {\n\treturn v.Version\n}", "func (s ListContactFlowModulesOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "func (s DescribeContactFlowModuleOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "func (info Info) String() (out string) {\n\tif info.Release {\n\t\tout += fmt.Sprintln(\"Release build\")\n\t} else {\n\t\tout += fmt.Sprintln(\"Development build\")\n\t}\n\n\tif !info.Version.IsZero() {\n\t\tout += fmt.Sprintln(\"Version:\", info.Version.String())\n\t}\n\tif !info.Timestamp.IsZero() {\n\t\tout += fmt.Sprintln(\"Build timestamp:\", info.Timestamp.Format(time.RFC822))\n\t}\n\tif info.CommitHash != \"\" {\n\t\tout += fmt.Sprintln(\"Git commit:\", info.CommitHash)\n\t}\n\tif info.Modified {\n\t\tout += fmt.Sprintln(\"Modified (dirty): true\")\n\t}\n\treturn out\n}", "func (v Version) String() string {\n\treturn fmt.Sprintf(\"%0d.%0d\", v.Major, v.Minor)\n}", "func (i ProvisionInfo) String() string {\n\ts := \"Provision successful\\n\\n\"\n\ts += fmt.Sprintf(\" User ID: %s\\n\", i.UserID)\n\ts += fmt.Sprintf(\" Username: %s\\n\", i.Username)\n\ts += fmt.Sprintf(\"Public Access Key ID: %s\\n\", i.PublicAccessKeyID)\n\ts += fmt.Sprintf(\" Public Access Key: %s\\n\\n\", i.PublicAccessKey)\n\ts += `IMPORTANT: Copy the Public Access Key ID and Public Access\nKey into the config.js file for your status page. You will\nnot be shown these credentials again.`\n\treturn s\n}", "func (s ContactFlowModuleSummary) String() string {\n\treturn awsutil.Prettify(s)\n}", "func (s UpdateContactFlowModuleMetadataOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "func (v IPVSVersion) String() string {\n\treturn fmt.Sprintf(\"%d.%d.%d\", v.Major, v.Minor, v.Patch)\n}", "func (a *Artifact) String() string {\n\treturn fmt.Sprintf(\"A VM template was created: %v\", a.templatePath)\n}", "func (ps *PS) String() string {\n\treturn fmt.Sprintf(`\n\t\tPid: %d\n\t\tPpid: %d\n\t\tName: %s\n\t\tCmdline: %s\n\t\tExe: %s\n\t\tCwd: %s\n\t\tSID: %s\n\t\tUsername: %s\n\t\tDomain: %s\n\t\tArgs: %s\n\t\tSession ID: %d\n\t\tEnvs: %s\n\t\t`,\n\t\tps.PID,\n\t\tps.Ppid,\n\t\tps.Name,\n\t\tps.Cmdline,\n\t\tps.Exe,\n\t\tps.Cwd,\n\t\tps.SID,\n\t\tps.Username,\n\t\tps.Domain,\n\t\tps.Args,\n\t\tps.SessionID,\n\t\tps.Envs,\n\t)\n}", "func (s Section) String() string {\n\treturn fmt.Sprintf(\"type: %s, version: %d, len: %d, size: %d\", s.Type(), s.Version(), s.Len(), s.Size())\n}", "func String() string {\n\tvar b strings.Builder\n\tb.Grow(256)\n\tfmt.Fprintln(&b, \"version\", Version)\n\tfmt.Fprintln(&b, \"commit \", Commit)\n\tfmt.Fprintln(&b, \"date \", Date)\n\tfmt.Fprintf(&b, \"go %s (%s/%s)\\n\",\n\t\tstrings.TrimPrefix(runtime.Version(), \"go\"),\n\t\truntime.GOOS, runtime.GOARCH)\n\tif len(Extra) > 0 {\n\t\tb.WriteByte('\\n')\n\t\tw, keys := 0, make([]string, 0, len(Extra))\n\t\tfor k := range Extra {\n\t\t\tif keys = append(keys, k); len(k) > w {\n\t\t\t\tw = len(k)\n\t\t\t}\n\t\t}\n\t\tsort.Strings(keys)\n\t\tfor _, k := range keys {\n\t\t\tfmt.Fprintf(&b, \"%-*s %s\\n\", w, k, Extra[k])\n\t\t}\n\t}\n\treturn b.String()\n}", "func (s CreateProjectVersionOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "func (p *Pattern) String() string {\n\tversion := fmt.Sprintf(\"Saved with HW Version: %v\", p.Version)\n\ttempo := fmt.Sprintf(\"Tempo: %v\", p.Tempo)\n\n\toutput := []string{version, tempo}\n\tfor _, track := range p.Tracks {\n\t\toutput = append(output, track.String())\n\t}\n\n\treturn strings.Join(output, \"\\n\") + \"\\n\"\n}", "func (p Pattern) String() string {\n\tout := fmt.Sprintf(\"Saved with HW Version: %s\\n\", p.Header.Version)\n\tout += fmt.Sprintf(\"Tempo: %g\\n\", p.Header.Tempo)\n\tfor _, i := range p.Instruments {\n\t\tout += i.String() + \"\\n\"\n\t}\n\treturn out\n}", "func (s EnvironmentTemplateVersion) String() string {\n\treturn awsutil.Prettify(s)\n}", "func (n Version) String() string {\n\tif s, ok := verStrings[n]; ok {\n\t\treturn s\n\t}\n\treturn \"unknown\"\n}", "func String() string {\n\treturn fmt.Sprintf(\"%s %s [date: %s]\", app, version, date)\n}", "func (runtime *Runtime) String() (s string) {\n\ts = fmt.Sprintf(\"NRandomFeature: %d\\n\"+\n\t\t\" SplitMethod : %s\\n\"+\n\t\t\" Tree :\\n%v\", runtime.NRandomFeature,\n\t\truntime.SplitMethod,\n\t\truntime.Tree.String())\n\treturn s\n}", "func (p *PKGBUILD) String() string {\n\tvar s strings.Builder\n\tp.Encode(&s)\n\treturn s.String()\n}", "func (p *Project) String() string {\n\treturn p.FullName()\n}", "func (s Property) String() string {\n\treturn awsutil.Prettify(s)\n}", "func (p Property) String() string {\n\treturn fmt.Sprintf(\"\\u001b[%dm\", p)\n}", "func (i Information) String() string {\n\treturn \"Version: \" + i.Version +\n\t\t\", Revision: \" + i.Revision +\n\t\t\", Branch: \" + i.Branch +\n\t\t\", BuildUser: \" + i.BuildUser +\n\t\t\", BuildDate: \" + i.BuildDate +\n\t\t\", GoVersion: \" + i.GoVersion\n}", "func (v *Version) String() string {\r\n\treturn v.str\r\n}", "func (s GetEnvironmentTemplateVersionOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "func (p *Package) String() string {\n\treturn p.ImportPath\n}", "func (s UpdateContactFlowModuleContentOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "func (s SourceProperties) String() string {\n\treturn awsutil.Prettify(s)\n}", "func (a Artifact) String() (result string) {\n\tswitch a.Type {\n\tcase ArtifactApp:\n\t\tresult = fmt.Sprintf(\"%s, %s\", a.Type.String(), a.Value)\n\t\tif a.Target != \"\" {\n\t\t\tresult += fmt.Sprintf(\" => %s\", a.Target)\n\t\t}\n\tcase ArtifactPkg:\n\t\tresult = fmt.Sprintf(\"%s, %s\", a.Type.String(), a.Value)\n\t\tif a.AllowUntrusted {\n\t\t\tresult += \", allow_untrusted: true\"\n\t\t}\n\tcase ArtifactBinary:\n\t\tresult = fmt.Sprintf(\"%s, %s\", a.Type.String(), a.Value)\n\t\tif a.Target != \"\" {\n\t\t\tresult += fmt.Sprintf(\" => %s\", a.Target)\n\t\t}\n\t}\n\n\treturn result\n}", "func (s ImportErrorData) String() string {\n\treturn awsutil.Prettify(s)\n}", "func (info Info) String() string {\n\treturn info.GitVersion\n}", "func (info Info) String() string {\n\treturn info.GitVersion\n}", "func (s EnvironmentTemplateVersionSummary) String() string {\n\treturn awsutil.Prettify(s)\n}", "func (p *Pattern) String() string {\n\treturn fmt.Sprintf(\"Saved with HW Version: %s\\nTempo: %g\\n%s\", p.Version, p.Tempo, p.TracksString())\n}", "func (s ProvisioningTemplateVersionSummary) String() string {\n\treturn awsutil.Prettify(s)\n}", "func (p *Package) String() string {\n\treturn p.Path()\n}", "func (s MetadataProperties) String() string {\n\treturn awsutil.Prettify(s)\n}", "func (p Property) String() string {\n\tif p.Right != nil {\n\t\treturn p.Left.Name + \".\" + p.Right.Name\n\t} else {\n\t\treturn p.Left.Name\n\t}\n}", "func(t *TargImp) String() string {\n\tvar toReturn string = t.Name() + \":\\t\"\n\tfor _, y := range t.dependencies {\n\t\ttoReturn += y + \" \"\n\t}\n\treturn toReturn\n}", "func (res Resource) String() string {\n\treturn fmt.Sprintf(`go_resource \"%s\" do\n url \"%s\", :using => :%s, :revision => \"%s\"\nend`, res.Name, res.URL, res.DownloadStrategy, res.Revision)\n}", "func (v *VersionInfo) String() string {\n\tbuf := &bytes.Buffer{}\n\tfmt.Fprintf(buf, \"SemVer: %s\\n\", v.SemVer)\n\tfmt.Fprintf(buf, \"OsArch: %s\\n\", v.Arch)\n\tfmt.Fprintf(buf, \"Branch: %s\\n\", v.Branch)\n\tfmt.Fprintf(buf, \"Commit: %s\\n\", v.ShaLong)\n\tfmt.Fprintf(buf, \"Formed: %s\\n\", v.BuildTimestamp.Format(time.RFC1123))\n\treturn buf.String()\n}", "func (v Version) String() (s string) {\n\tif v.epoch != 0 {\n\t\ts = strconv.Itoa(v.epoch) + \":\"\n\t}\n\ts += v.version\n\tif v.revision != \"\" {\n\t\ts += \"-\" + v.revision\n\t}\n\treturn\n}", "func (ms ModuleSet) String() (str string) {\n\tfor _, mod := range ms.modules {\n\t\tstr += string(mod.Identifier())\n\t}\n\treturn\n}", "func (e PrinExt) String() string {\n\treturn fmt.Sprintf(\"%v\", e)\n}", "func (varInits *VariableInits) String() string {\n\treturn fmt.Sprintf(\"varinits: %v\\n\", *varInits)\n}", "func (sv SV) String() string {\n\tif !sv.hasBeenSet {\n\t\treturn \"\"\n\t}\n\n\tb := \"\"\n\tpr := \"\"\n\tif len(sv.buildIDs) > 0 {\n\t\tb = \"+\" + strings.Join(sv.buildIDs, \".\")\n\t}\n\tif len(sv.preRelIDs) > 0 {\n\t\tpr = \"-\" + strings.Join(sv.preRelIDs, \".\")\n\t}\n\treturn fmt.Sprintf(\"v%d.%d.%d%s%s\", sv.major, sv.minor, sv.patch, pr, b)\n}", "func (v *VersionInfo) String() string {\n\treturn fmt.Sprintf(\"%v %v %v\", v.Version, v.BuildDate, v.CommitHash)\n}", "func (s Product) String() string {\n\tres := make([]string, 5)\n\tres[0] = \"ProductID: \" + reform.Inspect(s.ProductID, true)\n\tres[1] = \"PartyID: \" + reform.Inspect(s.PartyID, true)\n\tres[2] = \"CreatedAt: \" + reform.Inspect(s.CreatedAt, true)\n\tres[3] = \"Serial: \" + reform.Inspect(s.Serial, true)\n\tres[4] = \"Addr: \" + reform.Inspect(s.Addr, true)\n\treturn strings.Join(res, \", \")\n}", "func (pr *Product) String() string {\n\tvar builder strings.Builder\n\tbuilder.WriteString(\"Product(\")\n\tbuilder.WriteString(fmt.Sprintf(\"id=%v\", pr.ID))\n\tbuilder.WriteString(\", versionId=\")\n\tbuilder.WriteString(fmt.Sprintf(\"%v\", pr.VersionId))\n\tbuilder.WriteString(\", versionName=\")\n\tbuilder.WriteString(pr.VersionName)\n\tbuilder.WriteString(\", productId=\")\n\tbuilder.WriteString(fmt.Sprintf(\"%v\", pr.ProductId))\n\tbuilder.WriteString(\", productName=\")\n\tbuilder.WriteString(pr.ProductName)\n\tbuilder.WriteString(\", price=\")\n\tbuilder.WriteString(fmt.Sprintf(\"%v\", pr.Price))\n\tbuilder.WriteString(\", attr=\")\n\tbuilder.WriteString(pr.Attr)\n\tbuilder.WriteString(\", productDesc=\")\n\tbuilder.WriteString(pr.ProductDesc)\n\tbuilder.WriteString(\", addtime=\")\n\tbuilder.WriteString(pr.Addtime.Format(time.ANSIC))\n\tbuilder.WriteString(\", mtime=\")\n\tbuilder.WriteString(pr.Mtime.Format(time.ANSIC))\n\tbuilder.WriteByte(')')\n\treturn builder.String()\n}", "func (s UpdateEnvironmentTemplateVersionOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "func (s CreateEnvironmentTemplateVersionOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "func (pt Provider) String() string {\n\treturn pt.Hostname.ForDisplay() + \"/\" + pt.Namespace + \"/\" + pt.Type\n}", "func (i *Instance) String() string {\n\treturn fmt.Sprintf(\"<instance %s-%s>\", i.Name, i.Version)\n}", "func (c *Info) String() string {\n\tvar versionString bytes.Buffer\n\n\tfmt.Fprintf(&versionString, \"Version: %s\\n\", c.Version)\n\n\tif c.BuildID != \"\" {\n\t\tfmt.Fprintf(&versionString, \"Build ID: %s\\n\", c.BuildID)\n\t}\n\tif c.BuildTime != \"\" {\n\t\tfmt.Fprintf(&versionString, \"Build Time: %s\\n\", c.BuildTime)\n\t}\n\tif c.Change != \"\" {\n\t\tfmt.Fprintf(&versionString, \"Change: %s\\n\", c.Change)\n\t}\n\tif c.CommitMsg != \"\" {\n\t\tfmt.Fprintf(&versionString, \"Commit Message: %s\\n\", c.CommitMsg)\n\t}\n\tif c.NewBuildURL != \"\" {\n\t\tfmt.Fprintf(&versionString, \"New Build URL: %s\\n\", c.NewBuildURL)\n\t}\n\tif c.OldBuildURL != \"\" {\n\t\tfmt.Fprintf(&versionString, \"Old Build URL: %s\\n\", c.OldBuildURL)\n\t}\n\tif c.Revision != \"\" {\n\t\tfmt.Fprintf(&versionString, \"Revision: %s\\n\", c.Revision)\n\t}\n\tif c.Tag != \"\" {\n\t\tfmt.Fprintf(&versionString, \"Tag: %s\", c.Tag)\n\t}\n\n\treturn versionString.String()\n}", "func (c *jsiiProxy_CfnModuleVersion) ToString() *string {\n\tvar returns *string\n\n\t_jsii_.Invoke(\n\t\tc,\n\t\t\"toString\",\n\t\tnil, // no parameters\n\t\t&returns,\n\t)\n\n\treturn returns\n}", "func (d Dependencies) String() string {\n\tvar result strings.Builder\n\n\tif len(d) > 0 {\n\t\t_, _ = result.WriteString(`\"github.com/stretchr/testify/suite\"`)\n\t\t_, _ = result.WriteString(\"\\n\")\n\t}\n\n\tfor i := 0; i < len(d); i++ {\n\t\t_, _ = result.WriteString(\"\\\"\")\n\t\t_, _ = result.WriteString(d[i].Pkg())\n\t\t_, _ = result.WriteString(\"\\\"\")\n\t\tif i+1 < len(d) {\n\t\t\t_, _ = result.WriteString(\"\\n\")\n\t\t}\n\t}\n\n\treturn result.String()\n}", "func (p SourceProvider) String() string {\n\treturn fmt.Sprintf(\"ETCD Provider, enabled: %t\", p.Config.Enabled)\n}", "func (v ModuleID) String() string {\n\tx := (int32)(v)\n\n\treturn fmt.Sprint(x)\n}", "func (s ThingGroupProperties) String() string {\n\treturn awsutil.Prettify(s)\n}", "func (s ResourceProperty) String() string {\n\treturn awsutil.Prettify(s)\n}", "func (m *Mock) String() string {\n\treturn fmt.Sprintf(\"%[1]T<%[1]p>\", m)\n}", "func (s Library) String() string {\n\tres := make([]string, 5)\n\tres[0] = \"ID: \" + reform.Inspect(s.ID, true)\n\tres[1] = \"UserID: \" + reform.Inspect(s.UserID, true)\n\tres[2] = \"VolumeID: \" + reform.Inspect(s.VolumeID, true)\n\tres[3] = \"CreatedAt: \" + reform.Inspect(s.CreatedAt, true)\n\tres[4] = \"UpdatedAt: \" + reform.Inspect(s.UpdatedAt, true)\n\treturn strings.Join(res, \", \")\n}", "func (s CreatePackagingConfigurationOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "func (s ImportComponentOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "func (s SoftwarePackage) String() string {\n\treturn awsutil.Prettify(s)\n}" ]
[ "0.7585073", "0.7211935", "0.68430805", "0.6690105", "0.6540159", "0.65322334", "0.65251595", "0.6497296", "0.64823645", "0.64474773", "0.639242", "0.634754", "0.6347534", "0.6339955", "0.631287", "0.62792456", "0.6272774", "0.6267452", "0.6243426", "0.6239333", "0.6227346", "0.6227346", "0.62233967", "0.6217737", "0.62084526", "0.62080276", "0.6205932", "0.6205932", "0.6193806", "0.6191901", "0.6141091", "0.6132028", "0.6110228", "0.61098015", "0.60884255", "0.6081812", "0.60813826", "0.60745364", "0.60735935", "0.60700625", "0.60611415", "0.6053533", "0.60286486", "0.6025592", "0.6021825", "0.60207415", "0.60026324", "0.6001893", "0.600044", "0.59934944", "0.5985636", "0.59854424", "0.5960956", "0.5959788", "0.59593356", "0.59557647", "0.594895", "0.5946044", "0.5940929", "0.5940485", "0.5934581", "0.59162617", "0.59140974", "0.5907125", "0.59062755", "0.5905536", "0.5905536", "0.58961755", "0.5892089", "0.5890588", "0.58881736", "0.58874273", "0.58793485", "0.5874772", "0.5871902", "0.5870591", "0.58679736", "0.58593607", "0.5853901", "0.5842999", "0.58392787", "0.5834358", "0.5829403", "0.5824361", "0.5822426", "0.5821759", "0.5812463", "0.5812359", "0.58051336", "0.5799974", "0.57984525", "0.5797033", "0.5796354", "0.5783422", "0.57759255", "0.5775219", "0.57711524", "0.5770703", "0.5767233", "0.57572865" ]
0.8121144
0
formatValue formats a value of one of the Modules property values
func formatValue(s string) string { if KEYWORD(s).isValid() { return s } return fmt.Sprintf("'%s'", s) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func formatValue(format string, value rel.Value) string {\n\tvar v interface{}\n\tif set, ok := value.(rel.Set); ok {\n\t\tif s, is := rel.AsString(set); is {\n\t\t\tv = s\n\t\t} else {\n\t\t\tv = rel.Repr(set)\n\t\t}\n\t} else {\n\t\tv = value.Export()\n\t}\n\tswitch format[len(format)-1] {\n\tcase 't':\n\t\tv = value.IsTrue()\n\tcase 'c', 'd', 'o', 'O', 'x', 'X', 'U':\n\t\tv = int(value.Export().(float64))\n\tcase 'q':\n\t\tif f, ok := v.(float64); ok {\n\t\t\tv = int(f)\n\t\t}\n\t}\n\treturn fmt.Sprintf(format, v)\n}", "func formatValue(format string, value rel.Value) string {\n\tv := value.Export()\n\tswitch format[len(format)-1] {\n\tcase 't':\n\t\tv = value.Bool()\n\tcase 'c', 'd', 'o', 'O', 'x', 'X', 'U':\n\t\tv = int(value.Export().(float64))\n\tcase 'q':\n\t\tif f, ok := v.(float64); ok {\n\t\t\tv = int(f)\n\t\t}\n\t}\n\treturn fmt.Sprintf(format, v)\n}", "func FormatValue(format string, val interface{}) string {\n\tswitch val := val.(type) {\n\tcase bool:\n\t\tif format == \"%d\" {\n\t\t\tif val {\n\t\t\t\treturn \"1\"\n\t\t\t}\n\t\t\treturn \"0\"\n\t\t}\n\t}\n\n\tif format == \"\" {\n\t\tformat = \"%v\"\n\t}\n\n\treturn fmt.Sprintf(format, val)\n}", "func Format(value any, config *FormatConfig) string {\n\tval, ok := value.(reflect.Value)\n\tif !ok {\n\t\tval = reflect.ValueOf(value)\n\t}\n\treturn FormatValue(val, config)\n}", "func formatValueByConfig(value uint64, config *FreeConfig) string {\n\tif config.HumanOutput {\n\t\treturn humanReadableValue(value)\n\t}\n\t// units and decimal part are not printed when a unit is explicitly specified\n\treturn fmt.Sprintf(\"%v\", value>>config.Unit)\n}", "func formatValue(name, value string) string {\n\tif value != \"\" {\n\t\treturn fmt.Sprintf(\"\\n%v: %v\", name, value)\n\t}\n\treturn \"\"\n}", "func FormatValue(val reflect.Value, config *FormatConfig) string {\n\tif !val.IsValid() {\n\t\treturn config.Nil\n\t}\n\tderefVal, derefType := reflection.DerefValueAndType(val)\n\tif f, ok := config.TypeFormatters[derefType]; ok && derefVal.IsValid() {\n\t\treturn f.FormatValue(derefVal, config)\n\t}\n\n\tif nullable.ReflectIsNull(val) {\n\t\treturn config.Nil\n\t}\n\n\ttextMarshaller, _ := val.Interface().(encoding.TextMarshaler)\n\tif textMarshaller == nil && val.CanAddr() {\n\t\ttextMarshaller, _ = val.Addr().Interface().(encoding.TextMarshaler)\n\t}\n\tif textMarshaller == nil {\n\t\ttextMarshaller, _ = derefVal.Interface().(encoding.TextMarshaler)\n\t}\n\tif textMarshaller != nil {\n\t\ttext, err := textMarshaller.MarshalText()\n\t\tif err != nil {\n\t\t\treturn string(text)\n\t\t}\n\t}\n\n\tswitch derefType.Kind() {\n\tcase reflect.Bool:\n\t\tif derefVal.Bool() {\n\t\t\treturn config.True\n\t\t}\n\t\treturn config.False\n\n\tcase reflect.String:\n\t\treturn derefVal.String()\n\n\tcase reflect.Float32, reflect.Float64:\n\t\treturn float.Format(\n\t\t\tderefVal.Float(),\n\t\t\tconfig.Float.ThousandsSep,\n\t\t\tconfig.Float.DecimalSep,\n\t\t\tconfig.Float.Precision,\n\t\t\tconfig.Float.PadPrecision,\n\t\t)\n\n\tcase reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64:\n\t\treturn strconv.FormatInt(derefVal.Int(), 10)\n\n\tcase reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64:\n\t\treturn strconv.FormatUint(derefVal.Uint(), 10)\n\t}\n\n\tif s, ok := val.Interface().(fmt.Stringer); ok {\n\t\treturn s.String()\n\t}\n\tif val.CanAddr() {\n\t\tif s, ok := val.Addr().Interface().(fmt.Stringer); ok {\n\t\t\treturn s.String()\n\t\t}\n\t}\n\tif s, ok := derefVal.Interface().(fmt.Stringer); ok {\n\t\treturn s.String()\n\t}\n\n\tswitch x := derefVal.Interface().(type) {\n\tcase []byte:\n\t\treturn string(x)\n\tdefault:\n\t\treturn fmt.Sprint(val.Interface())\n\t}\n}", "func PromFormattedValue(v interface{}) string {\n\tswitch x := v.(type) {\n\tcase int:\n\t\treturn fmt.Sprintf(\"%d\", x)\n\tcase float32, float64:\n\t\treturn fmt.Sprintf(\"%f\", x)\n\tcase string:\n\t\treturn fmt.Sprintf(\"%s\", x)\n\tcase bool:\n\t\treturn fmt.Sprintf(\"%v\", x)\n\tcase []interface{}:\n\t\tif len(x) == 0 {\n\t\t\treturn \"\"\n\t\t}\n\t\tswitch x[0].(type) {\n\t\tcase string, int, float32, float64, bool:\n\t\t\treturn strings.Trim(strings.Join(strings.Fields(fmt.Sprint(x)), \"|\"), \"[]\")\n\t\tdefault:\n\t\t\tzap.L().Error(\"invalid type for prom formatted value\", zap.Any(\"type\", reflect.TypeOf(x[0])))\n\t\t\treturn \"\"\n\t\t}\n\tdefault:\n\t\tzap.L().Error(\"invalid type for prom formatted value\", zap.Any(\"type\", reflect.TypeOf(x)))\n\t\treturn \"\"\n\t}\n}", "func Format(ctx context.Context, v interface{}) string {\n\tb, err := encode(v)\n\tif err != nil {\n\t\tG(ctx).WithError(err).Warning(\"could not format value\")\n\t\treturn \"\"\n\t}\n\n\treturn string(b)\n}", "func (node Values) Format(buf *TrackedBuffer) {\n\tprefix := \"values \"\n\tfor _, n := range node {\n\t\tbuf.astPrintf(node, \"%s%v\", prefix, n)\n\t\tprefix = \", \"\n\t}\n}", "func Pformat(value interface{}) (string, error) {\n\tif s, ok := value.(string); ok {\n\t\treturn s, nil\n\t}\n\tvalueJson, err := json.MarshalIndent(value, \"\", \" \")\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\treturn string(valueJson), nil\n}", "func FormattedValue(v interface{}) string {\n\tswitch x := v.(type) {\n\tcase int:\n\t\treturn fmt.Sprintf(\"%d\", x)\n\tcase float32, float64:\n\t\treturn fmt.Sprintf(\"%f\", x)\n\tcase string:\n\t\treturn fmt.Sprintf(\"'%s'\", x)\n\tcase bool:\n\t\treturn fmt.Sprintf(\"%v\", x)\n\tcase []interface{}:\n\t\tif len(x) == 0 {\n\t\t\treturn \"\"\n\t\t}\n\t\tswitch x[0].(type) {\n\t\tcase string:\n\t\t\tstr := \"[\"\n\t\t\tfor idx, sVal := range x {\n\t\t\t\tstr += fmt.Sprintf(\"'%s'\", sVal)\n\t\t\t\tif idx != len(x)-1 {\n\t\t\t\t\tstr += \",\"\n\t\t\t\t}\n\t\t\t}\n\t\t\tstr += \"]\"\n\t\t\treturn str\n\t\tcase int, float32, float64, bool:\n\t\t\treturn strings.Join(strings.Fields(fmt.Sprint(x)), \",\")\n\t\tdefault:\n\t\t\tzap.L().Error(\"invalid type for formatted value\", zap.Any(\"type\", reflect.TypeOf(x[0])))\n\t\t\treturn \"\"\n\t\t}\n\tdefault:\n\t\tzap.L().Error(\"invalid type for formatted value\", zap.Any(\"type\", reflect.TypeOf(x)))\n\t\treturn \"\"\n\t}\n}", "func (a AttrValueFormatter) Format() string {\n\tif a.FormatHref && a.Name == \"href\" {\n\t\tu, _ := url.Parse(a.Value)\n\t\tcompoName := app.ComponentNameFromURL(u)\n\n\t\tif a.Factory.Registered(compoName) {\n\t\t\tu.Scheme = \"compo\"\n\t\t\tu.Path = \"/\" + compoName\n\t\t}\n\t\treturn u.String()\n\t}\n\n\tif !strings.HasPrefix(a.Name, \"on\") {\n\t\treturn a.Value\n\t}\n\n\tif strings.HasPrefix(a.Value, \"js:\") {\n\t\treturn strings.TrimPrefix(a.Value, \"js:\")\n\t}\n\n\treturn fmt.Sprintf(`callGoEventHandler('%s', '%s', this, event)`,\n\t\ta.CompoID,\n\t\ta.Value,\n\t)\n}", "func formatValue(val interface{}) []byte {\n\n\tswitch v := val.(type) {\n\tcase []byte:\n\t\treturn append(v, '|')\n\tcase string:\n\t\treturn append([]byte(v), '|')\n\tcase schema.Text:\n\t\treturn append([]byte(v), '|')\n\tdefault:\n\t\treturn []byte(fmt.Sprintf(\"%v|\", val))\n\t}\n}", "func format(val, name string) string {\n\tswitch name {\n\tcase \"file\":\n\t\treturn splitFile(val)\n\tcase \"function\":\n\t\treturn splitFunction(val)\n\t}\n\treturn \"\"\n}", "func (node *ValuesFuncExpr) Format(buf *TrackedBuffer) {\n\tbuf.astPrintf(node, \"values(%v)\", node.Name)\n}", "func (node *Literal) Format(buf *TrackedBuffer) {\n\tswitch node.Type {\n\tcase StrVal:\n\t\tsqltypes.MakeTrusted(sqltypes.VarBinary, node.Val).EncodeSQL(buf)\n\tcase IntVal, FloatVal, HexNum:\n\t\tbuf.astPrintf(node, \"%s\", node.Val)\n\tcase HexVal:\n\t\tbuf.astPrintf(node, \"X'%s'\", node.Val)\n\tcase BitVal:\n\t\tbuf.astPrintf(node, \"B'%s'\", node.Val)\n\tdefault:\n\t\tpanic(\"unexpected\")\n\t}\n}", "func ClickHouseFormattedValue(v interface{}) string {\n\tswitch x := v.(type) {\n\tcase int:\n\t\treturn fmt.Sprintf(\"%d\", x)\n\tcase float32, float64:\n\t\treturn fmt.Sprintf(\"%f\", x)\n\tcase string:\n\t\treturn fmt.Sprintf(\"'%s'\", x)\n\tcase bool:\n\t\treturn fmt.Sprintf(\"%v\", x)\n\tcase []interface{}:\n\t\tif len(x) == 0 {\n\t\t\treturn \"\"\n\t\t}\n\t\tswitch x[0].(type) {\n\t\tcase string:\n\t\t\tstr := \"[\"\n\t\t\tfor idx, sVal := range x {\n\t\t\t\tstr += fmt.Sprintf(\"'%s'\", sVal)\n\t\t\t\tif idx != len(x)-1 {\n\t\t\t\t\tstr += \",\"\n\t\t\t\t}\n\t\t\t}\n\t\t\tstr += \"]\"\n\t\t\treturn str\n\t\tcase int, float32, float64, bool:\n\t\t\treturn strings.Join(strings.Fields(fmt.Sprint(x)), \",\")\n\t\tdefault:\n\t\t\tzap.S().Error(\"invalid type for formatted value\", zap.Any(\"type\", reflect.TypeOf(x[0])))\n\t\t\treturn \"\"\n\t\t}\n\tdefault:\n\t\tzap.S().Error(\"invalid type for formatted value\", zap.Any(\"type\", reflect.TypeOf(x)))\n\t\treturn \"\"\n\t}\n}", "func (l *Literal) Format() error {\n\t// todo\n\treturn nil\n}", "func (gen *jsGenerator) formatLiteral(value interface{}, typeName string) string {\n\tif typeName == \"#ref\" {\n\t\treturn gen.fullNameOf(value.(string))\n\t} else if typeName == \"char\" {\n\t\treturn fmt.Sprintf(\"%q\", value)\n\t} else {\n\t\treturn fmt.Sprintf(\"%#v\", value)\n\t}\n}", "func (w *WorkBook) Format(xf uint16, v float64) (string, bool) {\n\tvar val string\n\tvar idx = int(xf)\n\tif len(w.Xfs) > idx {\n\t\tif formatter := w.Formats[w.Xfs[idx].FormatNo()]; nil != formatter {\n\t\t\treturn formatter.String(v), true\n\t\t}\n\t}\n\n\treturn val, false\n}", "func (o StageAccessLogSettingsOutput) Format() pulumi.StringOutput {\n\treturn o.ApplyT(func(v StageAccessLogSettings) string { return v.Format }).(pulumi.StringOutput)\n}", "func PercentValueFormatter(v interface{}) string {\n\tif typed, isTyped := v.(float64); isTyped {\n\t\treturn FloatValueFormatterWithFormat(typed*100.0, DefaultPercentValueFormat)\n\t}\n\treturn \"\"\n}", "func (f Field) format() (string, error) {\n\tif len(f.types) == 0 {\n\t\treturn \"\", errors.New(\"Field format: bad wiretypes: must have one or more type\")\n\t}\n\n\twt := f.types[0]\n\tfor _, t := range f.types[1:] {\n\t\twt = wt.join(t)\n\t}\n\treturn fmt.Sprintf(\" %s%s = %d; \\n\", wt.print(), f.varName, f.wire), nil\n}", "func (m *MockConfig) Format() string {\n\targs := m.Called()\n\treturn args.String(0)\n}", "func Format(format string, values Attributes) string {\n\tformatter, err := messageformat.New()\n\tif err != nil {\n\t\treturn format\n\t}\n\n\tfm, err := formatter.Parse(format)\n\tif err != nil {\n\t\treturn format\n\t}\n\n\tfixed := make(map[string]interface{}, len(values))\n\tfor k, v := range values {\n\t\tfixed[k] = fix(v)\n\t}\n\n\t// todo format unsupported types\n\tres, err := fm.FormatMap(fixed)\n\tif err != nil {\n\t\tfmt.Println(\"err\", err)\n\t\treturn format\n\t}\n\n\treturn res\n}", "func FmtStatValue(name, kind string, value int64, units string) string {\n\tif value == 0 {\n\t\treturn \"0\"\n\t}\n\t// uptime\n\tif strings.HasSuffix(name, \".time\") || kind == stats.KindLatency {\n\t\treturn fmtDuration(value, units)\n\t}\n\t// units (enum)\n\tswitch units {\n\tcase cos.UnitsRaw:\n\t\tswitch kind {\n\t\tcase stats.KindSize:\n\t\t\treturn fmt.Sprintf(\"%dB\", value)\n\t\tcase stats.KindThroughput, stats.KindComputedThroughput:\n\t\t\treturn fmt.Sprintf(\"%dB/s\", value)\n\t\tdefault:\n\t\t\treturn fmt.Sprintf(\"%d\", value)\n\t\t}\n\tcase \"\", cos.UnitsIEC:\n\t\tswitch kind {\n\t\tcase stats.KindSize:\n\t\t\treturn cos.ToSizeIEC(value, 2)\n\t\tcase stats.KindThroughput, stats.KindComputedThroughput:\n\t\t\treturn cos.ToSizeIEC(value, 2) + \"/s\"\n\t\tdefault:\n\t\t\treturn fmt.Sprintf(\"%d\", value)\n\t\t}\n\tcase cos.UnitsSI:\n\t\tswitch kind {\n\t\tcase stats.KindSize:\n\t\t\treturn toSizeSI(value, 2)\n\t\tcase stats.KindThroughput, stats.KindComputedThroughput:\n\t\t\treturn toSizeSI(value, 2) + \"/s\"\n\t\tdefault:\n\t\t\treturn fmt.Sprintf(\"%d\", value)\n\t\t}\n\t}\n\tdebug.Assert(false, units)\n\treturn \"\"\n}", "func FloatValueFormatterWithFormat(v interface{}, floatFormat string) string {\n\tif typed, isTyped := v.(float64); isTyped {\n\t\treturn fmt.Sprintf(floatFormat, typed)\n\t}\n\tif typed, isTyped := v.(float32); isTyped {\n\t\treturn fmt.Sprintf(floatFormat, typed)\n\t}\n\tif typed, isTyped := v.(int); isTyped {\n\t\treturn fmt.Sprintf(floatFormat, float64(typed))\n\t}\n\tif typed, isTyped := v.(int64); isTyped {\n\t\treturn fmt.Sprintf(floatFormat, float64(typed))\n\t}\n\treturn \"\"\n}", "func (p Parameter) Format(w fmt.State, verb rune) {\n\tif p.Name != \"\" {\n\t\tfmt.Fprintf(w, \"%v: \", p.Name)\n\t}\n\tfmt.Fprintf(w, \"%v\", p.Type)\n}", "func (p Parameter) Format(w fmt.State, verb rune) {\n\tif p.Name != \"\" {\n\t\tfmt.Fprintf(w, \"%v: \", p.Name)\n\t}\n\tp.Type.Format(w, verb)\n}", "func (node *PartitionDefinition) Format(buf *TrackedBuffer) {\n\tif !node.Maxvalue {\n\t\tbuf.astPrintf(node, \"partition %v values less than (%v)\", node.Name, node.Limit)\n\t} else {\n\t\tbuf.astPrintf(node, \"partition %v values less than (maxvalue)\", node.Name)\n\t}\n}", "func Format(input string) (output string, e error) {\n\to,e := Number(input)\n\toutput = fmt.Sprintf(\"(%s) %s-%s\", o[:3], o[3:6], o[6:])\n\treturn\n}", "func FloatValueFormatter(v interface{}) string {\n\treturn FloatValueFormatterWithFormat(v, DefaultFloatFormat)\n}", "func formatMetaValueForGet(result interface{}, jsonValue bool) (string, error) {\n\tswitch result.(type) {\n\tcase map[string]interface{}, []interface{}:\n\t\tresultJSON, _ := json.Marshal(result)\n\t\treturn fmt.Sprintf(\"%v\", string(resultJSON)), nil\n\tcase nil:\n\t\treturn \"null\", nil\n\tdefault:\n\t\tif jsonValue {\n\t\t\tresultJSON, _ := json.Marshal(result)\n\t\t\treturn fmt.Sprintf(\"%v\", string(resultJSON)), nil\n\t\t}\n\t\treturn fmt.Sprintf(\"%v\", result), nil\n\t}\n}", "func Format(name string) string {\n\n\tver := Get(name)\n\tif len(ver) == 0 {\n\t\treturn \"\"\n\t}\n\n\tif ver[0] != '0' {\n\t\treturn \"%d\"\n\t}\n\n\treturn fmt.Sprintf(\"%%0%dd\", len(ver))\n}", "func Format(name string) string {\n\tver := Get(name)\n\tif len(ver) == 0 {\n\t\treturn \"\"\n\t}\n\n\tif ver[0] != '0' {\n\t\treturn \"%d\"\n\t}\n\n\treturn fmt.Sprintf(\"%%0%dd\", len(ver))\n}", "func (t *dataType) Format(val interface{}) (interface{}, error) {\n\t// probably no formatters since we intentionally don't currently expose Formatter()\n\t// to passwords since passwords *should* theoretically be stored as-is...\n\t// However, format with string datatype to be consistent\n\ts, err := t.str.Format(val)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tstr := s.(string)\n\t// after any previous formatting, hash and salt based on bcrypt algorithm\n\tb, err := bcrypt.GenerateFromPassword([]byte(str), t.getCost())\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn string(b), nil\n}", "func (v *Value) Format2String() string {\n\tret := \"\"\n\tswitch v.ValueType {\n\tcase INT:\n\t\tval := *(*int)(ByteSliceToPointer(v.Value[:]))\n\t\tret = strconv.Itoa(val)\n\tcase FLOAT:\n\t\tval := *(*float64)(ByteSliceToPointer(v.Value[:]))\n\t\tret = strconv.FormatFloat(val, 'g', 10, 64) // TODO: more dynamic float converting\n\tcase VARCHAR:\n\t\tret = string(v.Value[:])\n\tcase DATE:\n\t\tval := *(*int)(ByteSliceToPointer(v.Value[:]))\n\t\tunixTime := time.Unix(int64(val), 0)\n\t\tret = unixTime.Format(\"2006-1-2\")\n\tcase BOOL:\n\t\tval := *(*bool)(ByteSliceToPointer(v.Value[:]))\n\t\tret = strconv.FormatBool(val)\n\t}\n\t// NO ATTR return \"\" by default\n\n\treturn strings.TrimSpace(string(bytes.Trim([]byte(ret), string(byte(0)))))\n}", "func Format(given string) (string, error) {\n\tclean, err := Number(given)\n\tif err != nil {\n\t\treturn clean, err\n\t}\n\treturn fmt.Sprintf(\"(%s) %s-%s\", clean[:3], clean[3:6], clean[6:10]), nil\n}", "func (m *ParameterMutator) Format(v string) *ParameterMutator {\n\tm.lock.Lock()\n\tdefer m.lock.Unlock()\n\tm.proxy.format = v\n\treturn m\n}", "func (t *TypeField) Format() error {\n\t// todo\n\treturn nil\n}", "func (pb *Bar) Format(v int64) string {\n\tif pb.GetBool(Bytes) {\n\t\treturn formatBytes(v, pb.GetBool(SIBytesPrefix))\n\t}\n\treturn strconv.FormatInt(v, 10)\n}", "func (t *StringDataType) Format(val interface{}) (interface{}, error) {\n\ts := val.(string)\n\tfor _, format := range t.formatters {\n\t\ts = format(s)\n\t}\n\treturn s, nil\n}", "func Format(given string) (string, error) {\n\tnumber, err := Number(given)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\treturn fmt.Sprintf(\"(%s) %s-%s\", number[0:3], number[3:6], number[6:]), nil\n}", "func (r *RUT) Format(f Formatter) string {\n\tif f == nil {\n\t\tf = DefaultFormatter\n\t}\n\treturn f(r.number, r.verifier)\n}", "func formatAtom(v reflect.Value) string {\n\tswitch v.Kind() {\n\tcase reflect.Invalid: //表示没有任何值,reflect.Value的零值属于Invalid类型\n\t\treturn \"invalid\"\n\tcase reflect.Int, reflect.Int8, reflect.Int16, //基础类型\n\t\treflect.Int32, reflect.Int64:\n\t\treturn strconv.FormatInt(v.Int(), 10)\n\tcase reflect.Uint, reflect.Uint8, reflect.Uint16, //基础类型\n\t\treflect.Uint32, reflect.Uint64, reflect.Uintptr:\n\t\treturn strconv.FormatUint(v.Uint(), 10)\n\t// ...floating-point and complex cases omitted for brevity...\n\tcase reflect.Bool: //基础类型\n\t\treturn strconv.FormatBool(v.Bool())\n\tcase reflect.String: //基础类型\n\t\treturn strconv.Quote(v.String())\n\tcase reflect.Chan, reflect.Func, reflect.Ptr, reflect.Slice, reflect.Map: //引用类型\n\t\treturn v.Type().String() + \" 0x\" +\n\t\t\tstrconv.FormatUint(uint64(v.Pointer()), 16)\n\tdefault: // reflect.Array, reflect.Struct, reflect.Interface\t//聚合类型 和 接口类型\n\t\t//这个分支处理的不够完善\n\t\treturn v.Type().String() + \" value\"\n\t}\n}", "func (gen *jsGenerator) formatType(t *idl.Type) string {\n\tvar s string\n\tms, ok := jsTypes[t.Name]\n\tif !ok {\n\t\tms = t.Name\n\t}\n\tif t.Name == \"list\" {\n\t\ts = fmt.Sprintf(ms, gen.formatType(t.ValueType))\n\t} else if t.Name == \"map\" {\n\t\ts = fmt.Sprintf(ms, jsTypes[t.KeyType.Name], gen.formatType(t.ValueType))\n\t} else if t.IsPrimitive() && t.Name != \"string\" {\n\t\ts = ms + \"?\"\n\t} else if t.IsEnum(gen.tplRootIdl) {\n\t\ts = ms + \"?\"\n\t} else {\n\t\ts = ms\n\t}\n\treturn s\n}", "func (c *Cell) FormattedValue() string {\n\tvar numberFormat = c.GetNumberFormat()\n\tswitch numberFormat {\n\tcase \"general\", \"@\":\n\t\treturn c.Value\n\tcase \"0\", \"#,##0\":\n\t\treturn c.formatToInt(\"%d\")\n\tcase \"0.00\", \"#,##0.00\":\n\t\treturn c.formatToFloat(\"%.2f\")\n\tcase \"#,##0 ;(#,##0)\", \"#,##0 ;[red](#,##0)\":\n\t\tf, err := strconv.ParseFloat(c.Value, 64)\n\t\tif err != nil {\n\t\t\treturn err.Error()\n\t\t}\n\t\tif f < 0 {\n\t\t\ti := int(math.Abs(f))\n\t\t\treturn fmt.Sprintf(\"(%d)\", i)\n\t\t}\n\t\ti := int(f)\n\t\treturn fmt.Sprintf(\"%d\", i)\n\tcase \"#,##0.00;(#,##0.00)\", \"#,##0.00;[red](#,##0.00)\":\n\t\tf, err := strconv.ParseFloat(c.Value, 64)\n\t\tif err != nil {\n\t\t\treturn err.Error()\n\t\t}\n\t\tif f < 0 {\n\t\t\treturn fmt.Sprintf(\"(%.2f)\", f)\n\t\t}\n\t\treturn fmt.Sprintf(\"%.2f\", f)\n\tcase \"0%\":\n\t\tf, err := strconv.ParseFloat(c.Value, 64)\n\t\tif err != nil {\n\t\t\treturn err.Error()\n\t\t}\n\t\tf = f * 100\n\t\treturn fmt.Sprintf(\"%d%%\", int(f))\n\tcase \"0.00%\":\n\t\tf, err := strconv.ParseFloat(c.Value, 64)\n\t\tif err != nil {\n\t\t\treturn err.Error()\n\t\t}\n\t\tf = f * 100\n\t\treturn fmt.Sprintf(\"%.2f%%\", f)\n\tcase \"0.00e+00\", \"##0.0e+0\":\n\t\treturn c.formatToFloat(\"%e\")\n\tcase \"mm-dd-yy\":\n\t\treturn c.formatToTime(\"01-02-06\")\n\tcase \"d-mmm-yy\":\n\t\treturn c.formatToTime(\"2-Jan-06\")\n\tcase \"d-mmm\":\n\t\treturn c.formatToTime(\"2-Jan\")\n\tcase \"mmm-yy\":\n\t\treturn c.formatToTime(\"Jan-06\")\n\tcase \"h:mm am/pm\":\n\t\treturn c.formatToTime(\"3:04 pm\")\n\tcase \"h:mm:ss am/pm\":\n\t\treturn c.formatToTime(\"3:04:05 pm\")\n\tcase \"h:mm\":\n\t\treturn c.formatToTime(\"15:04\")\n\tcase \"h:mm:ss\":\n\t\treturn c.formatToTime(\"15:04:05\")\n\tcase \"m/d/yy h:mm\":\n\t\treturn c.formatToTime(\"1/2/06 15:04\")\n\tcase \"mm:ss\":\n\t\treturn c.formatToTime(\"04:05\")\n\tcase \"[h]:mm:ss\":\n\t\tf, err := strconv.ParseFloat(c.Value, 64)\n\t\tif err != nil {\n\t\t\treturn err.Error()\n\t\t}\n\t\tt := TimeFromExcelTime(f, c.date1904)\n\t\tif t.Hour() > 0 {\n\t\t\treturn t.Format(\"15:04:05\")\n\t\t}\n\t\treturn t.Format(\"04:05\")\n\tcase \"mmss.0\":\n\t\tf, err := strconv.ParseFloat(c.Value, 64)\n\t\tif err != nil {\n\t\t\treturn err.Error()\n\t\t}\n\t\tt := TimeFromExcelTime(f, c.date1904)\n\t\treturn fmt.Sprintf(\"%0d%0d.%d\", t.Minute(), t.Second(), t.Nanosecond()/1000)\n\n\tcase \"yyyy\\\\-mm\\\\-dd\", \"yyyy\\\\-mm\\\\-dd;@\":\n\t\treturn c.formatToTime(\"2006\\\\-01\\\\-02\")\n\tcase \"dd/mm/yy\":\n\t\treturn c.formatToTime(\"02/01/06\")\n\tcase \"hh:mm:ss\":\n\t\treturn c.formatToTime(\"15:04:05\")\n\tcase \"dd/mm/yy\\\\ hh:mm\":\n\t\treturn c.formatToTime(\"02/01/06\\\\ 15:04\")\n\tcase \"dd/mm/yyyy hh:mm:ss\":\n\t\treturn c.formatToTime(\"02/01/2006 15:04:05\")\n\tcase \"yyyy/mm/dd\":\n\t\treturn c.formatToTime(\"2006/01/02\")\n\tcase \"yy-mm-dd\":\n\t\treturn c.formatToTime(\"06-01-02\")\n\tcase \"d-mmm-yyyy\":\n\t\treturn c.formatToTime(\"2-Jan-2006\")\n\tcase \"m/d/yy\":\n\t\treturn c.formatToTime(\"1/2/06\")\n\tcase \"m/d/yyyy\":\n\t\treturn c.formatToTime(\"1/2/2006\")\n\tcase \"dd-mmm-yyyy\":\n\t\treturn c.formatToTime(\"02-Jan-2006\")\n\tcase \"dd/mm/yyyy\":\n\t\treturn c.formatToTime(\"02/01/2006\")\n\tcase \"mm/dd/yy hh:mm am/pm\":\n\t\treturn c.formatToTime(\"01/02/06 03:04 pm\")\n\tcase \"mm/dd/yyyy hh:mm:ss\":\n\t\treturn c.formatToTime(\"01/02/2006 15:04:05\")\n\tcase \"yyyy-mm-dd hh:mm:ss\":\n\t\treturn c.formatToTime(\"2006-01-02 15:04:05\")\n\t}\n\treturn c.Value\n}", "func formatValueWithType(val interface{}) string {\n\tif val == nil {\n\t\treturn fmt.Sprintf(\"%d:nil\", nilType)\n\t}\n\n\tswitch t := val.(type) {\n\t// Custom pq types.\n\tcase *pq.Error:\n\t\treturn fmt.Sprintf(\"%d:%s\", pqErrorType, formatPqError(t))\n\n\t// Custom pgx types.\n\tcase *pgconn.PgError:\n\t\treturn fmt.Sprintf(\"%d:%s\", pgConnErrorType, formatPgConnError(t))\n\n\t// Built-in Go types.\n\tcase string:\n\t\treturn fmt.Sprintf(\"%d:%s\", stringType, strconv.Quote(t))\n\tcase int:\n\t\treturn fmt.Sprintf(\"%d:%d\", intType, val)\n\tcase int64:\n\t\treturn fmt.Sprintf(\"%d:%d\", int64Type, val)\n\tcase float64:\n\t\treturn fmt.Sprintf(\"%d:%g\", float64Type, t)\n\tcase bool:\n\t\treturn fmt.Sprintf(\"%d:%v\", boolType, t)\n\tcase error:\n\t\treturn fmt.Sprintf(\"%d:%s\", errorType, strconv.Quote(t.Error()))\n\tcase time.Time:\n\t\t// time.Format normalizes the +00:00 UTC timezone into \"Z\". This causes\n\t\t// the recorded output to differ from the \"real\" driver output. Use a\n\t\t// format that's round-trippable by parseValueWithType.\n\t\ts := t.Format(time.RFC3339Nano)\n\t\tif strings.HasSuffix(s, \"Z\") && t.Location() != time.UTC {\n\t\t\ts = s[:len(s)-1] + \"+00:00\"\n\t\t}\n\t\treturn fmt.Sprintf(\"%d:%s\", timeType, s)\n\tcase []string:\n\t\tvar buf bytes.Buffer\n\t\tbuf.WriteByte('[')\n\t\tfor i, s := range t {\n\t\t\tif i != 0 {\n\t\t\t\tbuf.WriteByte(',')\n\t\t\t}\n\t\t\tbuf.WriteString(strconv.Quote(s))\n\t\t}\n\t\tbuf.WriteByte(']')\n\t\treturn fmt.Sprintf(\"%d:%s\", stringSliceType, buf.String())\n\tcase []byte:\n\t\ts := base64.RawStdEncoding.EncodeToString(t)\n\t\treturn fmt.Sprintf(\"%d:%s\", byteSliceType, s)\n\tcase []driver.Value:\n\t\tvar buf bytes.Buffer\n\t\tbuf.WriteByte('[')\n\t\tfor i, v := range t {\n\t\t\tif i != 0 {\n\t\t\t\tbuf.WriteByte(',')\n\t\t\t}\n\t\t\tbuf.WriteString(formatValueWithType(v))\n\t\t}\n\t\tbuf.WriteByte(']')\n\t\treturn fmt.Sprintf(\"%d:%s\", valueSliceType, buf.String())\n\tdefault:\n\t\tpanic(fmt.Errorf(\"unsupported type: %T\", t))\n\t}\n}", "func (t TemplateParam) Format(w fmt.State, verb rune) {\n\tfmt.Fprintf(w, \"%v\", t.Name)\n\tif t.Type.Name != \"\" {\n\t\tfmt.Fprintf(w, \" : \")\n\t\tt.Type.Format(w, verb)\n\t}\n}", "func (metrics *Metrics) metricFormat(name string, value int) string {\n\treturn fmt.Sprintf(\n\t\t\"%s %d %d\\n\",\n\t\tmetrics.Tag+\".\"+name,\n\t\tvalue,\n\t\ttime.Now().Unix(),\n\t)\n}", "func (p *Pair) setFormatString(formatStr string) {\n\tcomponents := strings.Split(formatStr, \",\")\n\tfor i, c := range components {\n\t\tcomponents[i] = strings.TrimSpace(c)\n\t}\n\n\tp.Format = components\n}", "func formatField(field *Field, value interface{}) error {\n\tswitch value.(type) {\n\tcase int8, int16, int32, int64, int:\n\t\tfield.Charset = 63\n\t\tfield.Type = TypeLonglong\n\t\tfield.Flag = uint16(BinaryFlag | NotNullFlag)\n\tcase uint8, uint16, uint32, uint64, uint:\n\t\tfield.Charset = 63\n\t\tfield.Type = TypeLonglong\n\t\tfield.Flag = uint16(BinaryFlag | NotNullFlag | UnsignedFlag)\n\tcase float32, float64:\n\t\tfield.Charset = 63\n\t\tfield.Type = TypeDouble\n\t\tfield.Flag = uint16(BinaryFlag | NotNullFlag)\n\tcase string, []byte:\n\t\tfield.Charset = 33\n\t\tfield.Type = TypeVarString\n\tdefault:\n\t\treturn fmt.Errorf(\"unsupport type %T for resultset\", value)\n\t}\n\treturn nil\n}", "func (t *jsonDataType) Format(val interface{}) (interface{}, error) {\n\tfor _, format := range t.formatters {\n\t\tval = format(val)\n\t}\n\n\t// we need to do the json.Marshal step last\n\tbuf, err := json.Marshal(val)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn buf, nil\n}", "func (jp *JsonPrinter) colorValue(value string) string {\n\tswitch value {\n\tcase \"{\", \"[\", \"{}\", \"{},\":\n\t\treturn value\n\t}\n\n\tformat := \"%s\"\n\tif jp.isString(value) {\n\t\tformat = `\"%s\"`\n\t}\n\tif strings.HasSuffix(value, \",\") {\n\t\tformat += \",\"\n\t}\n\n\tvalue = strings.TrimRight(value, \",\")\n\tvalue = strings.Trim(value, `\"`)\n\n\treturn fmt.Sprintf(format, color.Apply(value, getColorByValueType(value)))\n}", "func Format_Values() []string {\n\treturn []string{\n\t\tFormatJson,\n\t\tFormatParquet,\n\t}\n}", "func (node Nextval) Format(buf *TrackedBuffer) {\n\tbuf.astPrintf(node, \"next %v values\", node.Expr)\n}", "func modRuleValueToJSONValue(modRuleValue string) (string, error) {\n\tjsonb, err := yaml.YAMLToJSON([]byte(modRuleValue))\n\treturn string(jsonb), err\n}", "func (tf *moduleFormatter) Format(entry *logrus.Entry) ([]byte, error) {\n\tentry.Data[moduleLogKey] = fmt.Sprintf(\"%s->pid:%d\", tf.module, os.Getegid())\n\tentry.Data[sysIDLogKey] = viper.GetString(\"sys.id\")\n\tentry.Data[sysNameLogKey] = viper.GetString(\"sys.name\")\n\tentry.Data[svcIDLogKey] = serviceName\n\n\terrHappened := entry.Level == logrus.ErrorLevel || entry.Level == logrus.FatalLevel\n\tif errHappened {\n\t\tentry.Data[isCRLogKey] = entry.Level == logrus.FatalLevel\n\t}\n\n\tdata := make(logrus.Fields)\n\tfor k, v := range entry.Data {\n\t\tdata[k] = v\n\t}\n\n\tprefixFieldClashes(data, tf.FieldMap, entry.HasCaller())\n\tkeys := make([]string, 0, len(data))\n\tfor k := range data {\n\t\tkeys = append(keys, k)\n\t}\n\n\tfixedKeys := make([]string, 0, 3+len(data))\n\tif !tf.DisableTimestamp {\n\t\tfixedKeys = append(fixedKeys, resolve(tf.FieldMap, logrus.FieldKeyTime))\n\t}\n\tfixedKeys = append(fixedKeys, resolve(tf.FieldMap, logrus.FieldKeyLevel))\n\tfixedKeys = append(fixedKeys, resolve(tf.FieldMap, logrus.FieldKeyMsg))\n\n\tvar funcVal, fileVal string\n\tif entry.HasCaller() {\n\t\tif tf.CallerPrettyfier != nil {\n\t\t\tfuncVal, fileVal = tf.CallerPrettyfier(entry.Caller)\n\t\t} else {\n\t\t\tfuncVal = entry.Caller.Function\n\t\t\tfileVal = fmt.Sprintf(\"%s:%d\", entry.Caller.File, entry.Caller.Line)\n\t\t}\n\t}\n\n\tif errHappened {\n\t\tfixedKeys = append(fixedKeys, errMsgLogKey)\n\t}\n\n\tif entry.Level == logrus.WarnLevel {\n\t\tfixedKeys = append(fixedKeys, warnMsgLogKey)\n\t}\n\n\tfixedKeys = append(fixedKeys, keys...)\n\n\tvar b *bytes.Buffer\n\tif entry.Buffer != nil {\n\t\tb = entry.Buffer\n\t} else {\n\t\tb = &bytes.Buffer{}\n\t}\n\n\ttimestampFormat := tf.TimestampFormat\n\tif timestampFormat == \"\" {\n\t\ttimestampFormat = defaultTimeFormat\n\t}\n\tfor _, key := range fixedKeys {\n\t\tvar value interface{}\n\t\tswitch {\n\t\tcase key == resolve(tf.FieldMap, logrus.FieldKeyTime):\n\t\t\tvalue = entry.Time.Format(timestampFormat)\n\t\tcase key == resolve(tf.FieldMap, logrus.FieldKeyLevel):\n\t\t\tvalue = entry.Level.String()\n\t\tcase key == resolve(tf.FieldMap, logrus.FieldKeyMsg):\n\t\t\tif entry.Level >= logrus.InfoLevel {\n\t\t\t\tvalue = fmt.Sprintf(\"%s@%s:%s\", fileVal, funcVal, entry.Message)\n\t\t\t} else {\n\t\t\t\tvalue = fmt.Sprintf(\"%s@%s\", fileVal, funcVal)\n\t\t\t}\n\t\tcase key == errMsgLogKey:\n\t\t\tvar ok bool\n\t\t\tvalue, ok = data[logrusErrorKey]\n\t\t\tif ok {\n\t\t\t\tvalue = data[logrusErrorKey]\n\t\t\t}\n\n\t\t\tif entry.Message != \"\" {\n\t\t\t\tvalue = fmt.Sprintf(\"%v:%s\", value, entry.Message)\n\t\t\t}\n\t\tcase key == warnMsgLogKey:\n\t\t\tvalue = entry.Message\n\t\tcase key == logrusErrorKey:\n\t\t\tcontinue\n\t\tdefault:\n\t\t\tvalue = data[key]\n\t\t}\n\t\ttf.appendKeyValue(b, key, value)\n\t}\n\n\tb.WriteByte('\\n')\n\treturn b.Bytes(), nil\n}", "func (o ParameterGroupParameterOutput) Value() pulumi.StringOutput {\n\treturn o.ApplyT(func(v ParameterGroupParameter) string { return v.Value }).(pulumi.StringOutput)\n}", "func (sms *SMS) format(phoneNumber string) (phoneNumberFormatted string) {\n\tphoneNumberFormatted = phoneNumber\n\n\tif len(phoneNumber) == 10 {\n\t\tphoneNumberFormatted = \"1\" + phoneNumber\n\t}\n\n\treturn\n}", "func Format(major, minor, patch int) string {\n\tif minor == 99 {\n\t\treturn fmt.Sprintf(\"%d.%d.%d-beta.%d\", major+1, 0, 0, patch+1)\n\t}\n\treturn fmt.Sprintf(\"%d.%d.%d\", major, minor, patch)\n}", "func formatStructuredValue(buffer Buffer, v interface{}) {\n\ts, ok := v.(string)\n\tif !ok {\n\t\ts = fmt.Sprint(v)\n\t}\n\n\tfor _, r := range []rune(s) {\n\t\tswitch r {\n\t\tcase '\\'':\n\t\t\tbuffer.WriteRune('\\\\')\n\t\t\tbuffer.WriteRune('\\'')\n\t\tcase '\\\\':\n\t\t\tbuffer.WriteRune('\\\\')\n\t\t\tbuffer.WriteRune('\\\\')\n\t\tcase ']':\n\t\t\tbuffer.WriteRune('\\\\')\n\t\t\tbuffer.WriteRune(']')\n\t\tdefault:\n\t\t\tbuffer.WriteRune(r)\n\t\t}\n\t}\n}", "func (d Attribute) Format(w fmt.State, verb rune) {\n\tfmt.Fprintf(w, \"%v\", d.Name)\n\tif len(d.Values) > 0 {\n\t\tfmt.Fprintf(w, \"(\")\n\t\tfor i, v := range d.Values {\n\t\t\tif i > 0 {\n\t\t\t\tfmt.Fprint(w, \", \")\n\t\t\t}\n\t\t\tfmt.Fprintf(w, \"%v\", v)\n\t\t}\n\t\tfmt.Fprintf(w, \")\")\n\t}\n}", "func (p *Printer) Format(v any) string {\n\tvar b strings.Builder\n\n\tif _, err := p.Write(&b, v); err != nil {\n\t\t// CODE COVERAGE: At the time of writing, strings.Builder.Write() never\n\t\t// returns an error.\n\t\tpanic(err)\n\t}\n\n\treturn b.String()\n}", "func formatValue(value interface{}) ([]byte, error) {\n\tif value == nil {\n\t\treturn hack.Slice(\"NULL\"), nil\n\t}\n\tswitch v := value.(type) {\n\tcase int8:\n\t\treturn strconv.AppendInt(nil, int64(v), 10), nil\n\tcase int16:\n\t\treturn strconv.AppendInt(nil, int64(v), 10), nil\n\tcase int32:\n\t\treturn strconv.AppendInt(nil, int64(v), 10), nil\n\tcase int64:\n\t\treturn strconv.AppendInt(nil, int64(v), 10), nil\n\tcase int:\n\t\treturn strconv.AppendInt(nil, int64(v), 10), nil\n\tcase uint8:\n\t\treturn strconv.AppendUint(nil, uint64(v), 10), nil\n\tcase uint16:\n\t\treturn strconv.AppendUint(nil, uint64(v), 10), nil\n\tcase uint32:\n\t\treturn strconv.AppendUint(nil, uint64(v), 10), nil\n\tcase uint64:\n\t\treturn strconv.AppendUint(nil, uint64(v), 10), nil\n\tcase uint:\n\t\treturn strconv.AppendUint(nil, uint64(v), 10), nil\n\tcase float32:\n\t\treturn strconv.AppendFloat(nil, float64(v), 'f', -1, 64), nil\n\tcase float64:\n\t\treturn strconv.AppendFloat(nil, float64(v), 'f', -1, 64), nil\n\tcase []byte:\n\t\treturn v, nil\n\tcase string:\n\t\treturn hack.Slice(v), nil\n\tdefault:\n\t\treturn nil, fmt.Errorf(\"invalid type %T\", value)\n\t}\n}", "func GetModuleValue(w http.ResponseWriter, r *http.Request) {\n\tw.Header().Add(\"Content-Type\", \"application/json\")\n\tvars := mux.Vars(r)\n\tid, err := strconv.Atoi(vars[\"id\"])\n\n\t// This shouldn't happen since the mux only accepts numbers to this route\n\tif err != nil {\n\t\thttp.Error(w, \"Invalid Id, please try again.\", http.StatusBadRequest)\n\t\treturn\n\t}\n\n\tmodules := hardware.GetModules()\n\tmodule, err := getModuleByID(modules, id)\n\n\tif err != nil {\n\t\thttp.NotFound(w, r)\n\t\treturn\n\t}\n\n\tvalues := hardware.ReadStatus(module.Pin)\n\tvar sens sensor\n\tsens.Name = module.Name\n\tsens.Description = module.Description\n\tsens.ID = module.ID\n\tsens.Pin = module.Pin\n\tsens.Type = module.Type\n\tsens.Values = values\n\tfmt.Println(values)\n\tenc := json.NewEncoder(w)\n\terr = enc.Encode(sens)\n}", "func formatAtom(v reflect.Value) string {\n\tswitch v.Kind() {\n\tcase reflect.Invalid:\n\t\treturn \"invalid\"\n\tcase reflect.Int, reflect.Int8, reflect.Int16,\n\t\treflect.Int32, reflect.Int64:\n\t\treturn strconv.FormatInt(v.Int(), 10)\n\tcase reflect.Uint, reflect.Uint8, reflect.Uint16,\n\t\treflect.Uint32, reflect.Uint64, reflect.Uintptr:\n\t\treturn strconv.FormatUint(v.Uint(), 10)\n\t\t// ...floating-point and complex cases omitted for brevity...\n\tcase reflect.Bool:\n\t\treturn strconv.FormatBool(v.Bool())\n\tcase reflect.String:\n\t\treturn strconv.Quote(v.String())\n\tcase reflect.Chan, reflect.Func, reflect.Ptr, reflect.Slice, reflect.Map:\n\t\treturn v.Type().String() + \" 0x\" +\n\t\t\tstrconv.FormatUint(uint64(v.Pointer()), 16)\n\tdefault: // reflect.Array, reflect.Struct, reflect.Interface\n\t\treturn v.Type().String() + \" value\"\n\t}\n}", "func (node BoolVal) Format(buf *TrackedBuffer) {\n\tif node {\n\t\tbuf.astPrintf(node, \"true\")\n\t} else {\n\t\tbuf.astPrintf(node, \"false\")\n\t}\n}", "func (f *EscapeFormatter) Format(vals []interface{}) ([]*Value, error) {\n\tn := len(vals)\n\tres := make([]*Value, n)\n\t// TODO: change time to v.AppendFormat() + pool\n\t// TODO: use strconv.Format* for numeric times\n\t// TODO: use pool\n\t// TODO: allow configurable runes that can be escaped\n\t// TODO: handler driver.Valuer\n\tfor i := 0; i < n; i++ {\n\t\tval := deref(vals[i])\n\t\tswitch v := val.(type) {\n\t\tcase nil:\n\t\tcase bool:\n\t\t\tres[i] = newValue(strconv.FormatBool(v), AlignLeft, true)\n\t\tcase int, int8, int16, int32, int64,\n\t\t\tuint, uint8, uint16, uint32, uint64:\n\t\t\tvar s string\n\t\t\tif f.printer != nil {\n\t\t\t\ts = f.printer.Sprintf(\"%v\", number.Decimal(v))\n\t\t\t} else {\n\t\t\t\ts = fmt.Sprintf(\"%d\", v)\n\t\t\t}\n\t\t\tres[i] = newValue(s, AlignRight, true)\n\t\tcase float32:\n\t\t\tvar s string\n\t\t\tif f.printer != nil {\n\t\t\t\ts = f.printer.Sprintf(\"%v\", number.Decimal(v, number.MinFractionDigits(1)))\n\t\t\t} else {\n\t\t\t\ts = strconv.FormatFloat(float64(v), 'g', -1, 32)\n\t\t\t}\n\t\t\tres[i] = newValue(s, AlignRight, true)\n\t\tcase float64:\n\t\t\tvar s string\n\t\t\tif f.printer != nil {\n\t\t\t\ts = f.printer.Sprintf(\"%v\", number.Decimal(v, number.MinFractionDigits(1)))\n\t\t\t} else {\n\t\t\t\ts = strconv.FormatFloat(v, 'g', -1, 64)\n\t\t\t}\n\t\t\tres[i] = newValue(s, AlignRight, true)\n\t\tcase uintptr:\n\t\t\tres[i] = newValue(fmt.Sprintf(\"(0x%x)\", v), AlignRight, true)\n\t\tcase complex64:\n\t\t\tres[i] = newValue(fmt.Sprintf(\"%g\", v), AlignRight, false)\n\t\tcase complex128:\n\t\t\tres[i] = newValue(fmt.Sprintf(\"%g\", v), AlignRight, false)\n\t\tcase []byte:\n\t\t\tres[i] = FormatBytes(v, f.invalid, f.invalidWidth, f.isJSON, f.isRaw, f.sep, f.quote)\n\t\tcase string:\n\t\t\tres[i] = FormatBytes([]byte(v), f.invalid, f.invalidWidth, f.isJSON, f.isRaw, f.sep, f.quote)\n\t\tcase time.Time:\n\t\t\tres[i] = newValue(v.Format(f.timeFormat), AlignLeft, false)\n\t\tcase sql.NullBool:\n\t\t\tif v.Valid {\n\t\t\t\tres[i] = newValue(strconv.FormatBool(v.Bool), AlignLeft, true)\n\t\t\t}\n\t\tcase sql.NullByte:\n\t\t\tif v.Valid {\n\t\t\t\tvar s string\n\t\t\t\tif f.printer != nil {\n\t\t\t\t\ts = f.printer.Sprintf(\"%v\", number.Decimal(v.Byte))\n\t\t\t\t} else {\n\t\t\t\t\ts = fmt.Sprintf(\"%d\", v.Byte)\n\t\t\t\t}\n\t\t\t\tres[i] = newValue(s, AlignRight, true)\n\t\t\t}\n\t\tcase sql.NullFloat64:\n\t\t\tif v.Valid {\n\t\t\t\tvar s string\n\t\t\t\tif f.printer != nil {\n\t\t\t\t\ts = f.printer.Sprintf(\"%v\", number.Decimal(v.Float64))\n\t\t\t\t} else {\n\t\t\t\t\ts = strconv.FormatFloat(v.Float64, 'g', -1, 64)\n\t\t\t\t}\n\t\t\t\tres[i] = newValue(s, AlignRight, true)\n\t\t\t}\n\t\tcase sql.NullInt16:\n\t\t\tif v.Valid {\n\t\t\t\tvar s string\n\t\t\t\tif f.printer != nil {\n\t\t\t\t\ts = f.printer.Sprintf(\"%v\", number.Decimal(v.Int16))\n\t\t\t\t} else {\n\t\t\t\t\ts = strconv.FormatInt(int64(v.Int16), 10)\n\t\t\t\t}\n\t\t\t\tres[i] = newValue(s, AlignRight, true)\n\t\t\t}\n\t\tcase sql.NullInt32:\n\t\t\tif v.Valid {\n\t\t\t\tvar s string\n\t\t\t\tif f.printer != nil {\n\t\t\t\t\ts = f.printer.Sprintf(\"%v\", number.Decimal(v.Int32))\n\t\t\t\t} else {\n\t\t\t\t\ts = strconv.FormatInt(int64(v.Int32), 10)\n\t\t\t\t}\n\t\t\t\tres[i] = newValue(s, AlignRight, true)\n\t\t\t}\n\t\tcase sql.NullInt64:\n\t\t\tif v.Valid {\n\t\t\t\tvar s string\n\t\t\t\tif f.printer != nil {\n\t\t\t\t\ts = f.printer.Sprintf(\"%v\", number.Decimal(v.Int64))\n\t\t\t\t} else {\n\t\t\t\t\ts = strconv.FormatInt(v.Int64, 10)\n\t\t\t\t}\n\t\t\t\tres[i] = newValue(s, AlignRight, true)\n\t\t\t}\n\t\tcase sql.NullString:\n\t\t\tif v.Valid {\n\t\t\t\tres[i] = FormatBytes([]byte(v.String), f.invalid, f.invalidWidth, f.isJSON, f.isRaw, f.sep, f.quote)\n\t\t\t}\n\t\tcase sql.NullTime:\n\t\t\tif v.Valid {\n\t\t\t\tres[i] = newValue(v.Time.Format(f.timeFormat), AlignLeft, false)\n\t\t\t}\n\t\tcase sql.RawBytes:\n\t\t\tres[i] = FormatBytes(v, f.invalid, f.invalidWidth, f.isJSON, f.isRaw, f.sep, f.quote)\n\t\tcase fmt.Stringer:\n\t\t\tres[i] = FormatBytes([]byte(v.String()), f.invalid, f.invalidWidth, f.isJSON, f.isRaw, f.sep, f.quote)\n\t\tdefault:\n\t\t\t// TODO: pool\n\t\t\tif f.encoder != nil {\n\t\t\t\tbuf, err := f.encoder(v)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn nil, err\n\t\t\t\t}\n\t\t\t\tres[i] = &Value{\n\t\t\t\t\tBuf: buf,\n\t\t\t\t\tRaw: true,\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\t// json encode\n\t\t\t\tbuf := new(bytes.Buffer)\n\t\t\t\tenc := json.NewEncoder(buf)\n\t\t\t\tenc.SetIndent(f.prefix, f.indent)\n\t\t\t\tenc.SetEscapeHTML(f.escapeHTML)\n\t\t\t\tif err := enc.Encode(v); err != nil {\n\t\t\t\t\treturn nil, err\n\t\t\t\t}\n\t\t\t\tif f.isJSON {\n\t\t\t\t\tres[i] = &Value{\n\t\t\t\t\t\tBuf: bytes.TrimSpace(buf.Bytes()),\n\t\t\t\t\t\tRaw: true,\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tres[i] = FormatBytes(bytes.TrimSpace(buf.Bytes()), f.invalid, f.invalidWidth, false, f.isRaw, f.sep, f.quote)\n\t\t\t\t\tres[i].Raw = true\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\treturn res, nil\n}", "func (node *When) Format(buf *TrackedBuffer) {\n\tbuf.astPrintf(node, \"when %v then %v\", node.Cond, node.Val)\n}", "func formatWithDataValue(valuePtr unsafe.Pointer, dataType memCom.DataType) *string {\n\tformatted := memCom.DataValue{\n\t\tValid: true,\n\t\tDataType: dataType,\n\t\tOtherVal: valuePtr,\n\t}.ConvertToHumanReadable(dataType)\n\tif formatted == nil {\n\t\treturn nil\n\t}\n\tif result, ok := formatted.(string); !ok {\n\t\treturn nil\n\t} else {\n\t\treturn &result\n\t}\n}", "func ViewFormat(value string) *SimpleElement { return newSEString(\"viewFormat\", value) }", "func Format(ctx context.Context) (result string, finalErr error) {\n\tdefer func() {\n\t\tif e := recover(); nil != e {\n\t\t\tfinalErr = bytes.ErrTooLarge\n\t\t}\n\t}()\n\tbuf := new(bytes.Buffer)\n\tfor _, key := range builtInKeys {\n\t\tval, err := getVal(ctx, key)\n\t\tif nil != err {\n\t\t\tcontinue\n\t\t}\n\t\tkname, ok := keyName[key]\n\t\tif !ok {\n\t\t\tcontinue\n\t\t}\n\t\tif shouldConvert2Duration(key) {\n\t\t\ti64 := val.(*int64)\n\t\t\tval = time.Duration(*i64)\n\t\t}\n\t\t_, finalErr = buf.WriteString(fmt.Sprintf(kname+\"=%v\"+delimiter, val))\n\t}\n\treturn strings.TrimRight(buf.String(), delimiter), nil\n}", "func formatAtom(v reflect.Value) string {\n\tswitch v.Kind() {\n\tcase reflect.Invalid:\n\t\treturn \"invalid\"\n\tcase reflect.Int, reflect.Int8, reflect.Int16,\n\t\treflect.Int32, reflect.Int64:\n\t\treturn strconv.FormatInt(v.Int(), 10)\n\tcase reflect.Uint, reflect.Uint8, reflect.Uint16,\n\t\treflect.Uint32, reflect.Uint64, reflect.Uintptr:\n\t\treturn strconv.FormatUint(v.Uint(), 10)\n\t\t// ...floating-point and complex cases omitted for brevity...\n\tcase reflect.Bool:\n\t\tif v.Bool() {\n\t\t\treturn \"true\"\n\t\t}\n\t\treturn \"false\"\n\tcase reflect.String:\n\t\treturn strconv.Quote(v.String())\n\tcase reflect.Chan, reflect.Func, reflect.Ptr,\n\t\treflect.Slice, reflect.Map:\n\t\treturn v.Type().String() + \" 0x\" +\n\t\t\tstrconv.FormatUint(uint64(v.Pointer()), 16)\n\tdefault: // reflect.Array, reflect.Struct, reflect.Interface\n\t\treturn v.Type().String() + \" value\"\n\t}\n}", "func FieldValue(field *InputField) string {\n\treturn field.value\n}", "func ValueFormatter() *Rule {\n\treturn &Rule{\"value\",\n\t\tMatchers{IsValue{}, IsNot{IsEmpty{}}},\n\t\tTermSet{ContentTerm: TermFunction(DataToString)},\n\t}\n}", "func (node VindexParam) Format(buf *TrackedBuffer) {\n\tbuf.astPrintf(node, \"%s=%s\", node.Key.String(), node.Val)\n}", "func formatAtom(v reflect.Value) string {\n\tswitch v.Kind() {\n\tcase reflect.Invalid:\n\t\treturn \"invalid\"\n\tcase reflect.Int, reflect.Int8, reflect.Int16,\n\t\treflect.Int32, reflect.Int64:\n\t\treturn strconv.FormatInt(v.Int(), 10)\n\tcase reflect.Uint, reflect.Uint8, reflect.Uint16,\n\t\treflect.Uint32, reflect.Uint64, reflect.Uintptr:\n\t\treturn strconv.FormatUint(v.Uint(), 10)\n\t// ...floating-point and complex cases omitted for brevity...\n\tcase reflect.Bool:\n\t\treturn strconv.FormatBool(v.Bool())\n\tcase reflect.String:\n\t\treturn v.String()\n\tcase reflect.Chan, reflect.Func, reflect.Ptr, reflect.Slice, reflect.Map:\n\t\treturn v.Type().String() + \" 0x\" +\n\t\t\tstrconv.FormatUint(uint64(v.Pointer()), 16)\n\tcase reflect.Struct:\n\t\tswitch v.Type().String() {\n\t\tcase \"time.Time\":\n\t\t\treturn v.Interface().(time.Time).Format(time.RFC3339)\n\t\tdefault:\n\t\t\treturn fmt.Sprintf(\"%v\", v)\n\t\t}\n\tdefault: // reflect.Array, reflect.Struct, reflect.Interface\n\t\treturn v.Type().String() + \" value\"\n\t}\n\n}", "func Format(in string) (out string, err error) {\n\tout, err = Number(in)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\tout = fmt.Sprintf(\"(%s) %s-%s\", out[:3], out[3:6], out[6:])\n\treturn out[:], err\n}", "func preparedValueFormat(dialect Dialect, counter int) (string, error) {\n\tif dialect == nil {\n\t\treturn \"\", errors.New(\"Dialect is nil\")\n\t}\n\n\tformat, err := dialect.PreparedValueFormat(counter)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\treturn format, nil\n\n\t// case ORACLE:\n\t// \treturn \":val\" + strconv.Itoa(counter+1)\n\t// case POSTGRESQL:\n\t// \treturn \"$\" + strconv.Itoa(counter+1)\n\t// default:\n\t// \t// case MYSQL:\n\t// \t// case SQLITE3:\n\t// \treturn \"?\"\n\t// }\n\n}", "func FormatString(format string, v ...any) string {\n\treturn GetString(Format(format, v...))\n}", "func (o AliasOutput) Format() pulumi.StringOutput {\n\treturn o.ApplyT(func(v *Alias) pulumi.StringOutput { return v.Format }).(pulumi.StringOutput)\n}", "func TimeValueFormatterWithFormat(v interface{}, dateFormat string) string {\n\tif typed, isTyped := v.(time.Time); isTyped {\n\t\treturn typed.Format(dateFormat)\n\t}\n\tif typed, isTyped := v.(int64); isTyped {\n\t\treturn time.Unix(0, typed).Format(dateFormat)\n\t}\n\tif typed, isTyped := v.(float64); isTyped {\n\t\treturn time.Unix(0, int64(typed)).Format(dateFormat)\n\t}\n\treturn \"\"\n}", "func (formatter JsonFormatter) Format(fields entries.Fields, level string, message string) string {\n\tformattedMetadata := make([]string, len(fields)+2)\n\tindex := 2\n\n\tformattedMetadata[0] = formatStringMessageAsJson(\"level\", level)\n\tformattedMetadata[1] = formatStringMessageAsJson(\"message\", message)\n\tfor key, value := range fields {\n\t\tif _, typeOk := value.(string); typeOk {\n\t\t\tformattedMetadata[index] = formatStringMessageAsJson(key, value)\n\t\t} else {\n\t\t\tformattedMetadata[index] = fmt.Sprintf(\"\\\"%v\\\": %v\", key, value)\n\t\t}\n\t\tindex++\n\t}\n\n\tjoinedMetadata := strings.Join(formattedMetadata, \", \")\n\treturn fmt.Sprintf(\"{ %v }\", joinedMetadata)\n}", "func (ctx *Context) OutputFormat(defaultFormat ...output.Format) (output.Format, error) {\n\tformat, err := ctx.Config().GetV(\"output-format\")\n\tif err != nil {\n\t\treturn output.Human, err\n\t}\n\tif len(defaultFormat) > 0 && format.Source == \"CODE\" {\n\t\tformat.Value = string(defaultFormat[0])\n\t}\n\n\tif ctx.Bool(\"json\") {\n\t\tformat.Value = \"json\"\n\t} else if ctx.Bool(\"table\") {\n\t\tformat.Value = \"table\"\n\t} else if ctx.IsSet(\"table-fields\") {\n\t\tval, err := ctx.Config().GetV(\"output-format\")\n\t\tif err != nil || !val.SourceTypeAtLeast(\"FLAG\") {\n\t\t\tformat.Value = \"table\"\n\t\t}\n\n\t}\n\n\treturn output.FormatByName(format.Value), nil\n\n}", "func (x *Float) Format(s fmt.State, format rune) {}", "func UpdateModuleProperty(modules []*puppet.Module, module, key, value string) {\n\tfor _, mod := range modules {\n\t\tif strings.ToLower(mod.Name) == module {\n\t\t\tif strings.ToLower(key) == \"version\" {\n\t\t\t\tmod.Version = value\n\t\t\t} else if err := mod.SetProperty(puppet.KEYWORD(key), value); err != nil {\n\t\t\t\tlog.Fatalf(\"Could not set property: %s\", err)\n\t\t\t}\n\t\t}\n\t}\n}", "func (w *World) Format(name string) Format {\n\treturn w.formats[strings.TrimPrefix(name, \".\")]\n}", "func valueString(v reflect.Value, opts tagOptions, sf reflect.StructField) string {\n\tfor v.Kind() == reflect.Ptr {\n\t\tif v.IsNil() {\n\t\t\treturn \"\"\n\t\t}\n\t\tv = v.Elem()\n\t}\n\n\tif v.Kind() == reflect.Bool && opts.Contains(\"int\") {\n\t\tif v.Bool() {\n\t\t\treturn \"1\"\n\t\t}\n\t\treturn \"0\"\n\t}\n\n\tif v.Type() == timeType {\n\t\tt := v.Interface().(time.Time)\n\t\tif opts.Contains(\"unix\") {\n\t\t\treturn strconv.FormatInt(t.Unix(), 10)\n\t\t}\n\t\tif opts.Contains(\"unixmilli\") {\n\t\t\treturn strconv.FormatInt((t.UnixNano() / 1e6), 10)\n\t\t}\n\t\tif opts.Contains(\"unixnano\") {\n\t\t\treturn strconv.FormatInt(t.UnixNano(), 10)\n\t\t}\n\t\tif layout := sf.Tag.Get(\"layout\"); layout != \"\" {\n\t\t\treturn t.Format(layout)\n\t\t}\n\t\treturn t.Format(time.RFC3339)\n\t}\n\n\treturn fmt.Sprint(v.Interface())\n}", "func (config *SFTPConfig) Format(params utils.Params) error {\n\tif params == nil {\n\t\t// do nothing\n\t\treturn nil\n\t}\n\tconfig.Path = params.FormatString(config.Path)\n\tconfig.Queries = config.Queries.Format(params)\n\tconfig.Script = params.FormatString(config.Script)\n\tconfig.Filter = config.Filter.Format(params)\n\treturn nil\n}", "func formatForEnv(key string, value string, spec secretsyml.SecretSpec, tempFactory *TempFactory) string {\n\tif spec.IsFile() {\n\t\tfname := tempFactory.Push(value)\n\t\tvalue = fname\n\t}\n\n\treturn fmt.Sprintf(\"%s=%s\", key, value)\n}", "func validateFormatString(v models.ValueDescriptor) (bool, error) {\n\t// No formatting specified\n\tif v.Formatting == \"\" {\n\t\treturn true, nil\n\t} else {\n\t\treturn regexp.MatchString(formatSpecifier, v.Formatting)\n\t}\n}", "func (l Parameters) Format(w fmt.State, verb rune) {\n\tfmt.Fprintf(w, \"(\")\n\tfor i, p := range l {\n\t\tif i > 0 {\n\t\t\tfmt.Fprintf(w, \", \")\n\t\t}\n\t\tp.Attributes.Format(w, verb)\n\t\tp.Format(w, verb)\n\t}\n\tfmt.Fprintf(w, \")\")\n}", "func (p Float64Formatter) Format(f fmt.State, c rune) {\n\tif p.p == nil {\n\t\tfmt.Fprintf(f, \"<nil>\")\n\t\treturn\n\t}\n\tfmt.Fprintf(f, \"%\"+string(c), *p.p)\n}", "func (node *SetExpr) Format(buf *TrackedBuffer) {\n\tif node.Scope != ImplicitScope {\n\t\tbuf.WriteString(node.Scope.ToString())\n\t\tbuf.WriteString(\" \")\n\t}\n\t// We don't have to backtick set variable names.\n\tswitch {\n\tcase node.Name.EqualString(\"charset\") || node.Name.EqualString(\"names\"):\n\t\tbuf.astPrintf(node, \"%s %v\", node.Name.String(), node.Expr)\n\tcase node.Name.EqualString(TransactionStr):\n\t\tliteral := node.Expr.(*Literal)\n\t\tbuf.astPrintf(node, \"%s %s\", node.Name.String(), strings.ToLower(string(literal.Val)))\n\tdefault:\n\t\tbuf.astPrintf(node, \"%v = %v\", node.Name, node.Expr)\n\t}\n}", "func (c *ColumnBase) ApplyFormat(data interface{}) string {\n\tvar out string\n\n\tswitch d := data.(type) {\n\tcase int:\n\t\tif c.format == \"\" {\n\t\t\tout = fmt.Sprintf(\"%d\", d)\n\t\t} else {\n\t\t\tout = fmt.Sprintf(c.format, d)\n\t\t}\n\tcase float64:\n\t\tif c.format == \"\" {\n\t\t\tout = fmt.Sprintf(\"%f\", d)\n\t\t} else {\n\t\t\tout = fmt.Sprintf(c.format, d)\n\t\t}\n\tcase float32:\n\t\tif c.format == \"\" {\n\t\t\tout = fmt.Sprintf(\"%f\", d)\n\t\t} else {\n\t\t\tout = fmt.Sprintf(c.format, d)\n\t\t}\n\n\tcase time.Time:\n\t\tt := d\n\t\ttimeFormat := c.timeFormat\n\t\tif timeFormat == \"\" {\n\t\t\ttimeFormat = config.DefaultDateTimeFormat\n\t\t}\n\t\tout = t.Format(timeFormat)\n\n\t\tif c.format != \"\" {\n\t\t\tout = fmt.Sprintf(c.format, out)\n\t\t}\n\tcase nil:\n\t\treturn \"\"\n\tdefault:\n\t\tvar format = c.format\n\t\tif format == \"\" {\n\t\t\tformat = `%v`\n\t\t}\n\t\tif any.IsSlice(d) {\n\t\t\ts := any.InterfaceSlice(d)\n\t\t\tvar items []string\n\t\t\tfor _, i := range s {\n\t\t\t\titems = append(items, fmt.Sprintf(format, i))\n\t\t\t}\n\t\t\treturn strings.Join(items, \", \")\n\t\t} else {\n\t\t\tout = fmt.Sprintf(format, d)\n\t\t}\n\t}\n\treturn out\n}", "func sampleFormat(p *profile.Profile, sampleIndex string, mean bool) (value, meanDiv sampleValueFunc, v *profile.ValueType, err error) {\n\tif len(p.SampleType) == 0 {\n\t\treturn nil, nil, nil, fmt.Errorf(\"profile has no samples\")\n\t}\n\tindex, err := p.SampleIndexByName(sampleIndex)\n\tif err != nil {\n\t\treturn nil, nil, nil, err\n\t}\n\tvalue = valueExtractor(index)\n\tif mean {\n\t\tmeanDiv = valueExtractor(0)\n\t}\n\tv = p.SampleType[index]\n\treturn\n}", "func (o OptionGroupOptionOptionSettingOutput) Value() pulumi.StringOutput {\n\treturn o.ApplyT(func(v OptionGroupOptionOptionSetting) string { return v.Value }).(pulumi.StringOutput)\n}", "func Format(\n\tformatStr StringExpression, formatArg ...Expression,\n) StringExpression {\n\t// TODO: enforce checking on number of formatArgs\n\t// (i.e. make sure is the same as the number of elements to be replaced in formatStr)\n\texpressions := append([]Expression{formatStr}, formatArg...)\n\treturn NewStringExpressionFunction(\"FORMAT\", expressions...)\n}" ]
[ "0.6995628", "0.69494724", "0.67459315", "0.665778", "0.64501625", "0.6375451", "0.61850464", "0.6124824", "0.5816678", "0.5765025", "0.5752466", "0.5606213", "0.5519197", "0.542924", "0.539263", "0.53865474", "0.537951", "0.5340119", "0.5325235", "0.53209096", "0.5302371", "0.52859634", "0.52781093", "0.526587", "0.52360207", "0.519894", "0.51735663", "0.51693195", "0.51536196", "0.5134707", "0.5110056", "0.51029", "0.5101826", "0.5077684", "0.5073703", "0.50661504", "0.5064322", "0.5053851", "0.5049832", "0.50490123", "0.5044228", "0.50372076", "0.5034185", "0.50322855", "0.50216395", "0.50203955", "0.50127786", "0.50056696", "0.5003619", "0.49881348", "0.49806607", "0.49791837", "0.49740574", "0.49733725", "0.49649897", "0.49607238", "0.49505436", "0.4950361", "0.49309993", "0.4923042", "0.49164876", "0.490897", "0.49081382", "0.4907434", "0.48967364", "0.48922065", "0.4887156", "0.48741254", "0.4871151", "0.48667902", "0.48646072", "0.48604548", "0.48599073", "0.48562363", "0.48463035", "0.4843683", "0.4834456", "0.48343524", "0.4834058", "0.48297572", "0.48283595", "0.4821552", "0.48103622", "0.4807339", "0.48043483", "0.48012105", "0.4791213", "0.47759503", "0.47710142", "0.4764999", "0.475149", "0.47476107", "0.47393793", "0.47337487", "0.47311646", "0.47263944", "0.4725309", "0.47244972", "0.47207388", "0.47199193" ]
0.6081533
8
ListProjectMembers gets a list of a project's team members. GitLab API docs:
func (g *Client) ListProjectMembers(project_id string, o *ListOptions) ([]*User, error) { path := getUrl([]string{"projects", url.QueryEscape(project_id), "members"}) u, err := addOptions(path, o) if err != nil { return nil, err } req, _ := http.NewRequest("GET", u, nil) var ret []*User if _, err := g.Do(req, &ret); err != nil { return nil, err } return ret, nil }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (r *ProjectsGroupsMembersService) List(name string) *ProjectsGroupsMembersListCall {\n\tc := &ProjectsGroupsMembersListCall{s: r.s, urlParams_: make(gensupport.URLParams)}\n\tc.name = name\n\treturn c\n}", "func (p *Project) GetMembers() (members []*User) {\n\tmembers, err := readProjectMembers(p.Id)\n\tif err != nil {\n\t\tlog.Error(\"Error get project members:\", err)\n\t\treturn nil\n\t}\n\tlog.Debug(\"proj members:\", members)\n\treturn\n}", "func ListMembers(client *clientv3.Client) (*clientv3.MemberListResponse, error) {\n\tctx, cancel := context.WithTimeout(client.Ctx(), DefaultRequestTimeout)\n\tdefer cancel()\n\treturn client.MemberList(ctx)\n}", "func (t Team) MemberList() (TeamAPI, error) {\n\tm := TeamAPI{\n\t\tParams: &tParams{},\n\t}\n\tm.Method = \"list-team-memberships\"\n\tm.Params.Options.Team = t.Name\n\n\tr, err := teamAPIOut(t.keybase, m)\n\treturn r, err\n}", "func (c *client) ListTeamMembers(org string, id int, role string) ([]TeamMember, error) {\n\tc.logger.WithField(\"methodName\", \"ListTeamMembers\").\n\t\tWarn(\"method is deprecated, please use ListTeamMembersBySlug\")\n\tdurationLogger := c.log(\"ListTeamMembers\", id, role)\n\tdefer durationLogger()\n\n\tif c.fake {\n\t\treturn nil, nil\n\t}\n\tpath := fmt.Sprintf(\"/teams/%d/members\", id)\n\tvar teamMembers []TeamMember\n\terr := c.readPaginatedResultsWithValues(\n\t\tpath,\n\t\turl.Values{\n\t\t\t\"per_page\": []string{\"100\"},\n\t\t\t\"role\": []string{role},\n\t\t},\n\t\t\"application/vnd.github+json\",\n\t\torg,\n\t\tfunc() interface{} {\n\t\t\treturn &[]TeamMember{}\n\t\t},\n\t\tfunc(obj interface{}) {\n\t\t\tteamMembers = append(teamMembers, *(obj.(*[]TeamMember))...)\n\t\t},\n\t)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn teamMembers, nil\n}", "func listMembers() (members []User, err error) {\n\tmembersMu.Lock()\n\tdefer membersMu.Unlock()\n\n\tif membersCache == nil {\n\t\turl := fmt.Sprintf(\"%s/teams/%s/members\", *ghAPIFl, *ghTeamFl)\n\t\treq, err := http.NewRequest(\"GET\", url, nil)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"cannot create GET request: %s\", err)\n\t\t}\n\t\taddAuthentication(req)\n\t\tresp, err := http.DefaultClient.Do(req)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"cannot fetch response: %s\", err)\n\t\t}\n\t\tdefer resp.Body.Close()\n\t\tvar members []User\n\t\tif err := json.NewDecoder(resp.Body).Decode(&members); err != nil {\n\t\t\treturn nil, fmt.Errorf(\"cannot decode response: %s\", err)\n\t\t}\n\t\tisBlacklisted := blacklistedMembers()\n\t\tfor i := len(members) - 1; i >= 0; i-- {\n\t\t\tif isBlacklisted[members[i].Login] {\n\t\t\t\tmembers = append(members[:i], members[(i+1):]...)\n\t\t\t}\n\t\t}\n\t\tmembersCache = members\n\t}\n\n\treturn membersCache, nil\n}", "func TeamListMember(ctx context.Context, w http.ResponseWriter, req *http.Request) error {\n\tvar db = ctx.Value(DBKey).(*sql.DB)\n\tvar user = ctx.Value(UserKey).(*dash.User)\n\tvar team = ctx.Value(TeamKey).(*dash.Team)\n\n\tif team.OwnerID != user.ID {\n\t\treturn ErrNotTeamOwner\n\t}\n\n\tvar payload map[string]interface{}\n\tjson.NewDecoder(req.Body).Decode(&payload)\n\n\tvar rows, err = db.Query(`SELECT tm.role, u.username FROM team_user AS tm INNER JOIN users AS u ON u.id = tm.user_id WHERE tm.team_id = ?`, team.ID)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer rows.Close()\n\n\tvar memberships = make([]membership, 0)\n\tfor rows.Next() {\n\t\tvar membership = membership{}\n\t\tif err := rows.Scan(&membership.Role, &membership.Username); err != nil {\n\t\t\treturn err\n\t\t}\n\t\tmemberships = append(memberships, membership)\n\t}\n\n\tvar resp = teamListMembersResponse{\n\t\tStatus: \"success\",\n\t\tMembers: memberships,\n\t\tHasAccessKey: team.EncryptedAccessKey != \"\",\n\t}\n\tjson.NewEncoder(w).Encode(resp)\n\treturn nil\n}", "func (a *Client) GetProjectsProjectIDMembers(params *GetProjectsProjectIDMembersParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetProjectsProjectIDMembersOK, error) {\n\t// TODO: Validate the params before sending\n\tif params == nil {\n\t\tparams = NewGetProjectsProjectIDMembersParams()\n\t}\n\top := &runtime.ClientOperation{\n\t\tID: \"GetProjectsProjectIDMembers\",\n\t\tMethod: \"GET\",\n\t\tPathPattern: \"/projects/{project_id}/members\",\n\t\tProducesMediaTypes: []string{\"application/json\", \"text/plain\"},\n\t\tConsumesMediaTypes: []string{\"application/json\"},\n\t\tSchemes: []string{\"http\", \"https\"},\n\t\tParams: params,\n\t\tReader: &GetProjectsProjectIDMembersReader{formats: a.formats},\n\t\tAuthInfo: authInfo,\n\t\tContext: params.Context,\n\t\tClient: params.HTTPClient,\n\t}\n\tfor _, opt := range opts {\n\t\topt(op)\n\t}\n\n\tresult, err := a.transport.Submit(op)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tsuccess, ok := result.(*GetProjectsProjectIDMembersOK)\n\tif ok {\n\t\treturn success, nil\n\t}\n\t// unexpected success response\n\t// safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue\n\tmsg := fmt.Sprintf(\"unexpected success response for GetProjectsProjectIDMembers: API contract not enforced by server. Client expected to get an error, but got: %T\", result)\n\tpanic(msg)\n}", "func (g *Client) ListGroupMembers(group_id string, o *ListOptions) ([]*User, error) {\n\tpath := getUrl([]string{\"groups\", group_id, \"members\"})\n\tu, err := addOptions(path, o)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treq, _ := http.NewRequest(\"GET\", u, nil)\n\n\tvar ret []*User\n\tif _, err := g.Do(req, &ret); err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn ret, nil\n}", "func (s *GroupsService) ListGroupMembers(ctx context.Context, groupName string, opts *PagingOptions) (*GroupMembers, error) {\n\tquery := addPaging(url.Values{}, opts)\n\t// The group name is required as a parameter\n\tquery.Set(contextKey, groupName)\n\treq, err := s.Client.NewRequest(ctx, http.MethodGet, newURI(groupMembersURI), WithQuery(query))\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"list groups request creation failed: , %w\", err)\n\t}\n\tres, resp, err := s.Client.Do(req)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"list group members failed: , %w\", err)\n\t}\n\n\tif resp != nil && resp.StatusCode == http.StatusNotFound {\n\t\treturn nil, ErrNotFound\n\t}\n\n\tm := &GroupMembers{\n\t\tGroupName: groupName,\n\t\tUsers: []*User{},\n\t}\n\n\tif err := json.Unmarshal(res, m); err != nil {\n\t\treturn nil, fmt.Errorf(\"list group members failed, unable to unmarshal repository list json: , %w\", err)\n\t}\n\n\tfor _, member := range m.GetGroupMembers() {\n\t\tmember.Session.set(resp)\n\t}\n\n\treturn m, nil\n}", "func (c *Client) ListMembers() ([]Member, error) {\n\tresp, err := c.listMembers()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tret := make([]Member, 0, len(resp.Members))\n\tfor _, m := range resp.Members {\n\t\tret = append(ret, Member{Name: m.Name, PeerURL: m.PeerURLs[0]})\n\t}\n\treturn ret, nil\n}", "func ProjectList(c *gin.Context) error {\n\tuserID, err := GetIDParam(c, userIDParam)\n\n\tif err != nil {\n\t\treturn err\n\t}\n\n\toption := &model.ProjectQueryOption{\n\t\tUserID: userID,\n\t}\n\n\tif limit := c.Query(\"limit\"); limit != \"\" {\n\t\tif i, err := strconv.Atoi(limit); err == nil {\n\t\t\toption.Limit = i\n\t\t}\n\t}\n\n\tif offset := c.Query(\"offset\"); offset != \"\" {\n\t\tif i, err := strconv.Atoi(offset); err == nil {\n\t\t\toption.Offset = i\n\t\t}\n\t}\n\n\tif order := c.Query(\"order\"); order != \"\" {\n\t\toption.Order = order\n\t} else {\n\t\toption.Order = \"-created_at\"\n\t}\n\n\tif err := CheckUserPermission(c, *userID); err == nil {\n\t\toption.Private = true\n\t}\n\n\tlist, err := model.GetProjectList(option)\n\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn common.APIResponse(c, http.StatusOK, list)\n}", "func (m *MockClient) ListTeamMembers(org string, id int, role string) ([]github.TeamMember, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"ListTeamMembers\", org, id, role)\n\tret0, _ := ret[0].([]github.TeamMember)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "func (g *Gitlab) GroupMembers(id string) ([]*Member, error) {\n\turl, opaque := g.ResourceUrlRaw(group_url_members, map[string]string{\":id\": id})\n\n\tvar members []*Member\n\n\tcontents, err := g.buildAndExecRequestRaw(\"GET\", url, opaque, nil)\n\tif err == nil {\n\t\terr = json.Unmarshal(contents, &members)\n\t}\n\n\treturn members, err\n}", "func (c *Client) GetMembers(pageNumber int) ([]Member, error) {\n\tlogger := zerolog.New(os.Stdout).\n\t\tWith().Timestamp().Str(\"service\", \"dice\").Logger().\n\t\tOutput(zerolog.ConsoleWriter{Out: os.Stderr})\n\tvar ret []Member\n\turi := viper.GetString(\"github_api\") + \"orgs/\" + viper.GetString(\"github_org\") + \"/members?page=\" + strconv.Itoa(pageNumber)\n\tlogger.Debug().Str(\"uri\", uri).Msg(\"github client called for organization members\")\n\tresp, err := c.doGet(uri, nil)\n\tif err != nil {\n\t\treturn ret, fmt.Errorf(\"error performing request: %v\", err)\n\t}\n\tdefer resp.Body.Close()\n\tif resp.StatusCode != http.StatusOK {\n\t\treturn ret, errorFromResponse(resp)\n\t}\n\tbody, err := ioutil.ReadAll(resp.Body)\n\tif err != nil {\n\t\treturn ret, err\n\t}\n\tjsonErr := json.Unmarshal(body, &ret)\n\tif jsonErr != nil {\n\t\treturn ret, jsonErr\n\t}\n\treturn ret, nil\n}", "func (m *MockTeamClient) ListTeamMembers(org string, id int, role string) ([]github.TeamMember, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"ListTeamMembers\", org, id, role)\n\tret0, _ := ret[0].([]github.TeamMember)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "func (c *Client) ListProject() (projectNames []string, err error) {\n\th := map[string]string{\n\t\t\"x-log-bodyrawsize\": \"0\",\n\t}\n\n\turi := \"/\"\n\tproj := convert(c, \"\")\n\n\ttype Project struct {\n\t\tProjectName string `json:\"projectName\"`\n\t}\n\n\ttype Body struct {\n\t\tProjects []Project `json:\"projects\"`\n\t}\n\n\tr, err := request(proj, \"GET\", uri, h, nil)\n\tif err != nil {\n\t\treturn nil, NewClientError(err)\n\t}\n\n\tdefer r.Body.Close()\n\tbuf, _ := ioutil.ReadAll(r.Body)\n\tif r.StatusCode != http.StatusOK {\n\t\terr := new(Error)\n\t\tjson.Unmarshal(buf, err)\n\t\treturn nil, err\n\t}\n\n\tbody := &Body{}\n\terr = json.Unmarshal(buf, body)\n\tfor _, project := range body.Projects {\n\t\tprojectNames = append(projectNames, project.ProjectName)\n\t}\n\treturn projectNames, err\n}", "func (c *Client) TeamMembers(id int64) ([]*TeamMember, error) {\n\tmembers := make([]*TeamMember, 0)\n\terr := c.request(\"GET\", fmt.Sprintf(\"/api/teams/%d/members\", id), nil, nil, &members)\n\tif err != nil {\n\t\treturn members, err\n\t}\n\n\treturn members, nil\n}", "func (c *Client) ClanMembers(tag string, params url.Values) (members ClanMemberList, err error) {\n\tvar b []byte\n\tpath := \"/clans/%23\" + strings.ToUpper(tag) + \"/members\"\n\tif b, err = c.get(path, params); err == nil {\n\t\terr = json.Unmarshal(b, &members)\n\t}\n\treturn\n}", "func (r *apiV1Router) GetTeamMembers(ctx *gin.Context) {\n\tteam := ctx.Param(\"id\")\n\tif len(team) == 0 {\n\t\tr.logger.Debug(\"team id not provided\")\n\t\tmodels.SendAPIError(ctx, http.StatusBadRequest, \"team id must be provided\")\n\t\treturn\n\t}\n\n\tteamMembers, err := r.userService.GetUsersWithTeam(ctx, team)\n\tif err != nil {\n\t\tswitch err {\n\t\tcase services.ErrInvalidID:\n\t\t\tr.logger.Debug(\"invalid team id\")\n\t\t\tmodels.SendAPIError(ctx, http.StatusBadRequest, \"invalid team id provided\")\n\t\t\tbreak\n\t\tdefault:\n\t\t\tr.logger.Error(\"could fetch users with team\", zap.Error(err))\n\t\t\tmodels.SendAPIError(ctx, http.StatusInternalServerError, \"there was a problem with finding users in the team\")\n\t\t\tbreak\n\t\t}\n\t\treturn\n\t}\n\n\tctx.JSON(http.StatusOK, getTeamMembersRes{\n\t\tResponse: models.Response{\n\t\t\tStatus: http.StatusOK,\n\t\t},\n\t\tUsers: teamMembers,\n\t})\n}", "func (pg *MongoDb) ListProjects(ctx context.Context, filter string, pageSize int, pageToken string) ([]*prpb.Project, string, error) {\n\t//id := decryptInt64(pageToken, pg.PaginationKey, 0)\n\t//TODO\n\treturn nil, \"\", nil\n}", "func GetTeamMembers(query *models.GetTeamMembersQuery) error {\n\tquery.Result = make([]*models.TeamMemberDTO, 0)\n\tsess := x.Table(\"team_member\")\n\tsess.Join(\"INNER\", x.Dialect().Quote(\"user\"), fmt.Sprintf(\"team_member.user_id=%s.id\", x.Dialect().Quote(\"user\")))\n\n\t// Join with only most recent auth module\n\tauthJoinCondition := `(\n\t\tSELECT id from user_auth\n\t\t\tWHERE user_auth.user_id = team_member.user_id\n\t\t\tORDER BY user_auth.created DESC `\n\tauthJoinCondition = \"user_auth.id=\" + authJoinCondition + dialect.Limit(1) + \")\"\n\tsess.Join(\"LEFT\", \"user_auth\", authJoinCondition)\n\n\tif query.OrgId != 0 {\n\t\tsess.Where(\"team_member.org_id=?\", query.OrgId)\n\t}\n\tif query.TeamId != 0 {\n\t\tsess.Where(\"team_member.team_id=?\", query.TeamId)\n\t}\n\tif query.UserId != 0 {\n\t\tsess.Where(\"team_member.user_id=?\", query.UserId)\n\t}\n\tif query.External {\n\t\tsess.Where(\"team_member.external=?\", dialect.BooleanStr(true))\n\t}\n\tsess.Cols(\n\t\t\"team_member.org_id\",\n\t\t\"team_member.team_id\",\n\t\t\"team_member.user_id\",\n\t\t\"user.email\",\n\t\t\"user.name\",\n\t\t\"user.login\",\n\t\t\"team_member.external\",\n\t\t\"team_member.permission\",\n\t\t\"user_auth.auth_module\",\n\t)\n\tsess.Asc(\"user.login\", \"user.email\")\n\n\terr := sess.Find(&query.Result)\n\treturn err\n}", "func (s *GroupsService) Members(\n\tctx context.Context,\n\tgroupName string,\n) ([]PrincipalName, error) {\n\treq, err := http.NewRequest(\n\t\thttp.MethodGet,\n\t\ts.client.url+\"2.0/groups/list-members\",\n\t\tnil,\n\t)\n\tif err != nil {\n\t\treturn []PrincipalName{}, err\n\t}\n\treq = req.WithContext(ctx)\n\tq := req.URL.Query()\n\tq.Add(\"group_name\", groupName)\n\treq.URL.RawQuery = q.Encode()\n\tres, err := s.client.client.Do(req)\n\tif err != nil {\n\t\treturn []PrincipalName{}, err\n\t}\n\tif res.StatusCode >= 300 || res.StatusCode <= 199 {\n\t\treturn []PrincipalName{}, fmt.Errorf(\n\t\t\t\"Failed to returns 2XX response: %d\", res.StatusCode)\n\t}\n\tdefer res.Body.Close()\n\tdecoder := json.NewDecoder(res.Body)\n\n\tmembersRes := struct {\n\t\tMembers []PrincipalName\n\t}{[]PrincipalName{}}\n\terr = decoder.Decode(&membersRes)\n\n\treturn membersRes.Members, err\n}", "func (p *Project) GetMembersName() []string {\n\tnames, err := readProjectMembersName(p.Id)\n\tif err != nil {\n\t\tlog.Error(\"Error get project members\", err)\n\t\treturn nil\n\t}\n\tlog.Debug(\"proj members name:\", names)\n\treturn names\n}", "func (c *client) ListOrgMembers(org, role string) ([]TeamMember, error) {\n\tc.log(\"ListOrgMembers\", org, role)\n\tif c.fake {\n\t\treturn nil, nil\n\t}\n\tpath := fmt.Sprintf(\"/orgs/%s/members\", org)\n\tvar teamMembers []TeamMember\n\terr := c.readPaginatedResultsWithValues(\n\t\tpath,\n\t\turl.Values{\n\t\t\t\"per_page\": []string{\"100\"},\n\t\t\t\"role\": []string{role},\n\t\t},\n\t\tacceptNone,\n\t\torg,\n\t\tfunc() interface{} {\n\t\t\treturn &[]TeamMember{}\n\t\t},\n\t\tfunc(obj interface{}) {\n\t\t\tteamMembers = append(teamMembers, *(obj.(*[]TeamMember))...)\n\t\t},\n\t)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn teamMembers, nil\n}", "func (p *Project) GetMembersId() []int {\n\tids, err := readProjectMembersId(p.Id)\n\tif err != nil {\n\t\tlog.Error(\"Error get project members\", err)\n\t\treturn nil\n\t}\n\tlog.Debug(\"proj members id:\", ids)\n\treturn ids\n}", "func (client *Client) ListClusterMembers(request *ListClusterMembersRequest) (response *ListClusterMembersResponse, err error) {\n\tresponse = CreateListClusterMembersResponse()\n\terr = client.DoAction(request, response)\n\treturn\n}", "func (m *MembershipsClient) List(ctx context.Context, org, user, team *identity.ID) ([]MembershipResult, error) {\n\tv := &url.Values{}\n\tv.Set(\"org_id\", org.String())\n\tif user != nil {\n\t\tv.Set(\"owner_id\", user.String())\n\t}\n\tif team != nil {\n\t\tv.Set(\"team_id\", team.String())\n\t}\n\n\treq, _, err := m.client.NewRequest(\"GET\", \"/memberships\", v, nil, true)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tmemberships := []MembershipResult{}\n\t_, err = m.client.Do(ctx, req, &memberships, nil, nil)\n\treturn memberships, err\n}", "func ProjectList(opts gitlab.ListProjectsOptions, n int) ([]*gitlab.Project, error) {\n\tlist, resp, err := lab.Projects.ListProjects(&opts)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif resp.CurrentPage == resp.TotalPages {\n\t\treturn list, nil\n\t}\n\topts.Page = resp.NextPage\n\tfor len(list) < n || n == -1 {\n\t\tif n != -1 {\n\t\t\topts.PerPage = n - len(list)\n\t\t}\n\t\tprojects, resp, err := lab.Projects.ListProjects(&opts)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\topts.Page = resp.NextPage\n\t\tlist = append(list, projects...)\n\t\tif resp.CurrentPage == resp.TotalPages {\n\t\t\tbreak\n\t\t}\n\t}\n\treturn list, nil\n}", "func ListProjects() error {\n\tclient, err := NewPacketClient()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tprojects, _, err := client.Projects.List()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\te := MarshallAndPrint(projects)\n\treturn e\n}", "func (p *ProjectHandler) ListProjects(ctx context.Context,\n\treq *proto.ListProjectsRequest, resp *proto.ListProjectsResponse) error {\n\tla := project.NewListAction(p.model)\n\tprojects, e := la.Do(ctx, req)\n\tif e != nil {\n\t\treturn e\n\t}\n\tauthUser, err := middleware.GetUserFromContext(ctx)\n\tif err == nil && authUser.Username != \"\" {\n\t\t// with username\n\t\t// 获取 project id, 用以获取对应的权限\n\t\tids := getProjectIDs(projects)\n\t\tperms, err := auth.ProjectIamClient.GetMultiProjectMultiActionPermission(\n\t\t\tauthUser.Username, ids,\n\t\t\t[]string{auth.ProjectCreate, auth.ProjectView, auth.ProjectEdit, auth.ProjectDelete},\n\t\t)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\t// 处理返回\n\t\tsetListPermsResp(resp, projects, perms)\n\t} else {\n\t\t// without username\n\t\tsetListPermsResp(resp, projects, nil)\n\t}\n\tif err := projutil.PatchBusinessName(resp.Data.Results); err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "func (c *client) GetMembers(ctx context.Context, groupID string) ([]user.User, error) {\n\tcli := c.getGroupClient()\n\n\tmemberResp, err := cli.Members(ctx, &pb.GroupRequest{Groupid: groupID})\n\tif err != nil {\n\t\treturn []user.User{}, err\n\t}\n\n\trespUsers := make([]user.User, len(memberResp.Users))\n\tfor i, pbUser := range memberResp.Users {\n\t\trespUsers[i] = user.User{UserID: pbUser.UserId, Email: pbUser.Email}\n\t}\n\n\treturn respUsers, nil\n}", "func (a *Client) ListProjects(params *ListProjectsParams) (*ListProjectsOK, error) {\n\t// TODO: Validate the params before sending\n\tif params == nil {\n\t\tparams = NewListProjectsParams()\n\t}\n\n\tresult, err := a.transport.Submit(&runtime.ClientOperation{\n\t\tID: \"listProjects\",\n\t\tMethod: \"GET\",\n\t\tPathPattern: \"/projects\",\n\t\tProducesMediaTypes: []string{\"application/release-manager.v1+json\"},\n\t\tConsumesMediaTypes: []string{\"application/release-manager.v1+json\"},\n\t\tSchemes: []string{\"http\"},\n\t\tParams: params,\n\t\tReader: &ListProjectsReader{formats: a.formats},\n\t\tContext: params.Context,\n\t\tClient: params.HTTPClient,\n\t})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn result.(*ListProjectsOK), nil\n\n}", "func (repos *TestRepositories) ListProjects(ctx context.Context, owner string, repo string, opts *github.ProjectListOptions) ([]*github.Project, *github.Response, error) {\n\n\tvar resultProjects = make([]*github.Project, 3)\n\n\tnames := []string{\"Project 1\", \"Project 2\", \"Project 3\"}\n\tbodies := []string{\"This is a project\", \"This is a project\", \"This is a project\"}\n\n\tfor i, v := range []int{1, 2, 3} {\n\t\tresultProjects[i] = &github.Project{\n\t\t\tNumber: &v,\n\t\t\tName: &names[i],\n\t\t\tBody: &bodies[i],\n\t\t}\n\t}\n\n\treturn resultProjects, prepareGitHubAPIResponse(), nil\n\n}", "func ListProject(projectID string) error {\n\tclient, err := NewPacketClient()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tp, _, err := client.Projects.Get(projectID)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\te := MarshallAndPrint(p)\n\treturn e\n}", "func (bot *BotAPI) GetGroupMemberList(groupID int64) ([]User, error) {\n\tv := url.Values{}\n\tv.Add(\"group_id\", strconv.FormatInt(groupID, 10))\n\tresp, err := bot.MakeRequest(\"get_group_member_list\", v)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tusers := make([]User, 0)\n\tjson.Unmarshal(resp.Data, &users)\n\n\tbot.debugLog(\"GetGroupMemberInfo\", nil, users)\n\n\treturn users, nil\n}", "func (k *Keystone) ListProjectsAPI(c echo.Context) error {\n\tclusterID := c.Request().Header.Get(xClusterIDKey)\n\tif ke := getKeystoneEndpoints(clusterID, k.endpointStore); len(ke) > 0 {\n\t\treturn k.proxyRequest(c, ke)\n\t}\n\n\ttoken, err := k.validateToken(c.Request())\n\tif err != nil {\n\t\treturn err\n\t}\n\tconfigEndpoint, err := k.setAssignment(clusterID)\n\tif err != nil {\n\t\treturn err\n\t}\n\tuserProjects := []*keystone.Project{}\n\tuser := token.User\n\tprojects := k.Assignment.ListProjects()\n\tif configEndpoint == \"\" {\n\t\tfor _, project := range projects {\n\t\t\tfor _, role := range user.Roles {\n\t\t\t\tif role.Project.Name == project.Name {\n\t\t\t\t\tuserProjects = append(userProjects, role.Project)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t} else {\n\t\tuserProjects = append(userProjects, projects...)\n\t}\n\tprojectsResponse := &ProjectListResponse{\n\t\tProjects: userProjects,\n\t}\n\treturn c.JSON(http.StatusOK, projectsResponse)\n}", "func (c *Client) ListOrgMembers(name string) ([]*api.OrgMember, error) {\n\tout := []*api.OrgMember{}\n\trawURL := fmt.Sprintf(pathOrgMembers, c.base.String(), name)\n\terr := c.get(rawURL, true, &out)\n\treturn out, errio.Error(err)\n}", "func (k *Keystone) ListAuthProjectsAPI(c echo.Context) error {\n\tclusterID := c.Request().Header.Get(xClusterIDKey)\n\tif ke := getKeystoneEndpoints(clusterID, k.endpointStore); len(ke) > 0 {\n\t\treturn k.proxyRequest(c)\n\t}\n\n\ttoken, err := k.validateToken(c.Request())\n\tif err != nil {\n\t\treturn err\n\t}\n\tconfigEndpoint, err := k.setAssignment(clusterID)\n\tif err != nil {\n\t\treturn err\n\t}\n\tuserProjects := []*keystone.Project{}\n\tuser := token.User\n\tprojects := k.Assignment.ListProjects()\n\tif configEndpoint == \"\" {\n\t\tfor _, project := range projects {\n\t\t\tfor _, role := range user.Roles {\n\t\t\t\tif role.Project.Name == project.Name {\n\t\t\t\t\tuserProjects = append(userProjects, role.Project)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t} else {\n\t\tuserProjects = append(userProjects, projects...)\n\t}\n\tprojectsResponse := &asfkeystone.ProjectListResponse{\n\t\tProjects: userProjects,\n\t}\n\treturn c.JSON(http.StatusOK, projectsResponse)\n}", "func (g *Gitlab) ListProjects(page int) (projects []*gitlab.Project, err error) {\n\n\topt := &gitlab.ListProjectsOptions{}\n\topt.ListOptions.Page = page\n\topt.ListOptions.PerPage = _defaultPerPage\n\n\tif projects, _, err = g.client.Projects.ListProjects(opt); err != nil {\n\t\terr = errors.Wrapf(err, \"ListProjects err(%+v)\", err)\n\t\treturn\n\t}\n\treturn\n}", "func (s *ProjectService) ListProjects(p *ListProjectsParams) (*ListProjectsResponse, error) {\n\tresp, err := s.cs.newRequest(\"listProjects\", p.toURLValues())\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar r ListProjectsResponse\n\tif err := json.Unmarshal(resp, &r); err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn &r, nil\n}", "func (b *Board) GetMembers(extraArgs ...Arguments) (members []*Member, err error) {\n\targs := flattenArguments(extraArgs)\n\tpath := fmt.Sprintf(\"boards/%s/members\", b.ID)\n\terr = b.client.Get(path, args, &members)\n\tfor i := range members {\n\t\tmembers[i].SetClient(b.client)\n\t}\n\treturn\n}", "func ListProjects(config *Config) error {\n\tgitlab := gogitlab.NewGitlab(config.Host, config.ApiPath, config.Token)\n\tprojects, err := gitlab.AllProjects()\n\tif err != nil {\n\t\treturn Mask(err)\n\t}\n\tfor _, p := range projects {\n\t\tif p.Archived {\n\t\t\tcontinue\n\t\t}\n\t\tfmt.Printf(\"%s\\n\", p.Name)\n\t}\n\treturn nil\n}", "func (t *TeamsService) ListProjects(teamID int) (*TeamProjectAssocListResponse, *simpleresty.Response, error) {\n\tvar result *TeamProjectAssocListResponse\n\turlStr := t.client.http.RequestURL(\"/team/%d/projects\", teamID)\n\n\t// Set the correct authentication header\n\tt.client.setAuthTokenHeader(t.client.accountAccessToken)\n\n\t// Execute the request\n\tresponse, getErr := t.client.http.Get(urlStr, &result, nil)\n\n\treturn result, response, getErr\n}", "func (c *Client) CloudProjectUsersList(projectID string) ([]types.CloudUser, error) {\n\tusers := []types.CloudUser{}\n\treturn users, c.Get(queryEscape(\"/cloud/project/%s/user\", projectID), &users)\n}", "func (h *TerminalValidator) canManageProjectMembers(ctx context.Context, userInfo authenticationv1.UserInfo, namespace string) (bool, error) {\n\tproject, err := gardenclient.GetProjectByNamespace(ctx, h.client, namespace)\n\tif err != nil {\n\t\treturn false, err\n\t}\n\n\treturn h.canManageProjectMembersAccessReview(ctx, userInfo, *project)\n}", "func (s *ProjectsService) ListProjects(opt *ProjectOptions) (*map[string]ProjectInfo, *Response, error) {\n\tu := \"projects/\"\n\n\tu, err := addOptions(u, opt)\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\n\tv := new(map[string]ProjectInfo)\n\tresp, err := s.client.Call(\"GET\", u, nil, v)\n\treturn v, resp, err\n}", "func (a *Client) GetOrganizationTeamMembers(params *GetOrganizationTeamMembersParams, authInfo runtime.ClientAuthInfoWriter) (*GetOrganizationTeamMembersOK, error) {\n\t// TODO: Validate the params before sending\n\tif params == nil {\n\t\tparams = NewGetOrganizationTeamMembersParams()\n\t}\n\n\tresult, err := a.transport.Submit(&runtime.ClientOperation{\n\t\tID: \"getOrganizationTeamMembers\",\n\t\tMethod: \"GET\",\n\t\tPathPattern: \"/api/v1/organization/{orgname}/team/{teamname}/members\",\n\t\tProducesMediaTypes: []string{\"application/json\"},\n\t\tConsumesMediaTypes: []string{\"application/json\"},\n\t\tSchemes: []string{\"https\"},\n\t\tParams: params,\n\t\tReader: &GetOrganizationTeamMembersReader{formats: a.formats},\n\t\tAuthInfo: authInfo,\n\t\tContext: params.Context,\n\t\tClient: params.HTTPClient,\n\t})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tsuccess, ok := result.(*GetOrganizationTeamMembersOK)\n\tif ok {\n\t\treturn success, nil\n\t}\n\t// unexpected success response\n\t// safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue\n\tmsg := fmt.Sprintf(\"unexpected success response for getOrganizationTeamMembers: API contract not enforced by server. Client expected to get an error, but got: %T\", result)\n\tpanic(msg)\n}", "func (r *RoleCreate) GetMembers() []string {\n\treturn r.Members\n}", "func ListMemberPath(project string, expedition string, team string) string {\n\tparam0 := project\n\tparam1 := expedition\n\tparam2 := team\n\n\treturn fmt.Sprintf(\"/projects/@/%s/expeditions/@/%s/teams/@/%s/members\", param0, param1, param2)\n}", "func (m *MockOrganizationClient) ListOrgMembers(org, role string) ([]github.TeamMember, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"ListOrgMembers\", org, role)\n\tret0, _ := ret[0].([]github.TeamMember)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "func (m *MockClient) ListOrgMembers(org, role string) ([]github.TeamMember, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"ListOrgMembers\", org, role)\n\tret0, _ := ret[0].([]github.TeamMember)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "func (k *Keystone) ListProjectsAPI(c echo.Context) error {\n\tclusterID := c.Request().Header.Get(xClusterIDKey)\n\tif ke := getKeystoneEndpoints(clusterID, k.endpointStore); len(ke) > 0 {\n\t\treturn k.proxyRequest(c)\n\t}\n\t_, err := k.validateToken(c.Request())\n\tif err != nil {\n\t\treturn err\n\t}\n\t_, err = k.setAssignment(clusterID)\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn c.JSON(http.StatusOK, &asfkeystone.ProjectListResponse{\n\t\tProjects: k.Assignment.ListProjects(),\n\t})\n}", "func (o *Organization) GetMembers(extraArgs ...Arguments) (members []*Member, err error) {\n\targs := flattenArguments(extraArgs)\n\tpath := fmt.Sprintf(\"organizations/%s/members\", o.ID)\n\terr = o.client.Get(path, args, &members)\n\tfor i := range members {\n\t\tmembers[i].SetClient(o.client)\n\t}\n\treturn\n}", "func (c *ClientImpl) ListProject(ctx context.Context, hcpHostURL string) ([]hcpModels.Tenant, error) {\n\tspan, _ := opentracing.StartSpanFromContext(ctx, \"List HCP Projects\")\n\tdefer span.Finish()\n\n\tsession, err := c.getSession(ctx, hcpHostURL, hcpUserName, hcpPassword)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tstatus = Failure\n\tmonitor := metrics.StartExternalCall(externalSvcName, \"List Projects from HCP\")\n\tdefer func() { monitor.RecordWithStatus(status) }()\n\n\tresp, err := mlopsHttp.ExecuteHTTPRequest(\n\t\tctx,\n\t\tc.client,\n\t\thcpHostURL+projectPathV1,\n\t\thttp.MethodGet,\n\t\tmap[string]string{sessionHeader: session},\n\t\tbytes.NewReader(nil),\n\t)\n\tif err != nil {\n\t\treturn nil, errors.Wrapf(err, \"while fetching projects from MLOps controller platform.\")\n\t}\n\n\tstatus = Success\n\n\terr = c.deleteSession(ctx, hcpHostURL, session)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar tenants hcpModels.ListTenants\n\t_, parseRespErr := common.ParseResponse(resp, &tenants)\n\tif parseRespErr != nil {\n\t\tlog.Errorf(\"Failed to fetch projects from HCP: %v\", parseRespErr)\n\t\treturn nil, errors.Wrapf(parseRespErr, \"Failed to fetch projects from HCP\")\n\t}\n\n\t// filter only ML projects\n\tvar mlProjects []hcpModels.Tenant\n\tfor _, tenant := range tenants.Embedded.Tenants {\n\t\tif tenant.Features.MlProject {\n\t\t\tmlProjects = append(mlProjects, tenant)\n\t\t}\n\t}\n\treturn mlProjects, nil\n}", "func (e *EtcdBackoffAdapter) MemberList(ctx context.Context) (*clientv3.MemberListResponse, error) {\n\tctx, cancel := context.WithTimeout(ctx, e.Timeout)\n\tdefer cancel()\n\tvar response *clientv3.MemberListResponse\n\terr := wait.ExponentialBackoff(e.BackoffParams, func() (bool, error) {\n\t\tresp, err := e.EtcdClient.MemberList(ctx)\n\t\tif err != nil {\n\t\t\tLog.Info(\"failed to list etcd members\", \"etcd client error\", err)\n\t\t\treturn false, nil\n\t\t}\n\t\tresponse = resp\n\t\treturn true, nil\n\t})\n\treturn response, err\n}", "func (p *listDiscoveryPlugin) ListProjects(provider *gophercloud.ProviderClient, eo gophercloud.EndpointOpts, domainUUID string) ([]core.KeystoneProject, error) {\n\tclient, err := openstack.NewIdentityV3(provider, eo)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t//gophercloud does not support project listing yet - do it manually\n\turl := client.ServiceURL(\"projects\")\n\tvar opts struct {\n\t\tDomainUUID string `q:\"domain_id\"`\n\t}\n\topts.DomainUUID = domainUUID\n\tquery, err := gophercloud.BuildQueryString(opts)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\turl += query.String()\n\n\tvar result gophercloud.Result\n\t_, err = client.Get(url, &result.Body, nil)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar data struct {\n\t\tProjects []core.KeystoneProject `json:\"projects\"`\n\t}\n\terr = result.ExtractInto(&data)\n\treturn data.Projects, err\n}", "func (gr *GroupResource) GetMembers(owner string, group string) (members *[]User, err error) {\n\townerOrCurrentUser(gr, &owner)\n\n\tpath := fmt.Sprintf(\"/groups/%s/%s/members/\", owner, group)\n\terr = gr.client.do(\"GET\", path, nil, nil, &members)\n\treturn\n}", "func (_BaseAccessControlGroup *BaseAccessControlGroupCaller) MembersList(opts *bind.CallOpts, arg0 *big.Int) (common.Address, error) {\n\tvar out []interface{}\n\terr := _BaseAccessControlGroup.contract.Call(opts, &out, \"membersList\", arg0)\n\n\tif err != nil {\n\t\treturn *new(common.Address), err\n\t}\n\n\tout0 := *abi.ConvertType(out[0], new(common.Address)).(*common.Address)\n\n\treturn out0, err\n\n}", "func (app *App) GroupMembers(ctx context.Context, groupName string) ([]string, error) {\n\treturn app.groups.GroupMembers(ctx, groupName)\n}", "func (s *ProjectsService) ListProjects() ([]*Project, *Response, error) {\n\treq, err := s.client.NewRequest(\"GET\", \"projects\", nil)\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\tvar p []*Project\n\tresp, err := s.client.Do(req, &p)\n\tif err != nil {\n\t\treturn nil, resp, err\n\t}\n\treturn p, resp, err\n}", "func (d *Driver) ProjectList() (*ProjectListResponse, error) {\n\tresponse := &ProjectListResponse{}\n\tlistProjects := project.NewListProjectsParams()\n\tresp, err := d.project.ListProjects(listProjects, d.auth)\n\tif err != nil {\n\t\treturn response, err\n\t}\n\tresponse.Project = resp.Payload\n\treturn response, nil\n}", "func (m *OrganizationManager) Members(id string, opts ...RequestOption) (o *OrganizationMemberList, err error) {\n\terr = m.Request(\"GET\", m.URI(\"organizations\", id, \"members\"), &o, applyListDefaults(opts))\n\treturn\n}", "func (s *ProjectsService) List(ctx context.Context, opts *PagingOptions) (*ProjectsList, error) {\n\tquery := addPaging(url.Values{}, opts)\n\treq, err := s.Client.NewRequest(ctx, http.MethodGet, newURI(projectsURI), WithQuery(query))\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"get projects request creation failed: %w\", err)\n\t}\n\tres, resp, err := s.Client.Do(req)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"list projects failed: %w\", err)\n\t}\n\n\tif resp != nil && resp.StatusCode == http.StatusNotFound {\n\t\treturn nil, ErrNotFound\n\t}\n\n\tif resp != nil && resp.StatusCode == http.StatusBadRequest {\n\t\treturn nil, fmt.Errorf(\"list projects failed: %s\", resp.Status)\n\t}\n\n\tp := &ProjectsList{\n\t\tProjects: []*Project{},\n\t}\n\tif err := json.Unmarshal(res, p); err != nil {\n\t\treturn nil, fmt.Errorf(\"list projects failed, unable to unmarshal repository list json: %w\", err)\n\t}\n\n\tfor _, r := range p.GetProjects() {\n\t\tr.Session.set(resp)\n\t}\n\n\treturn p, nil\n}", "func (g *Gitlab) ListProjectJobs(projID, page int) (jobs []gitlab.Job, resp *gitlab.Response, err error) {\n\tvar opt = &gitlab.ListJobsOptions{}\n\topt.Page = page\n\t// perPage max is 100\n\topt.PerPage = _maxPerPage\n\n\tif jobs, resp, err = g.client.Jobs.ListProjectJobs(projID, opt); err != nil {\n\t\terr = errors.Wrapf(err, \"ListProjectJobs projectId(%d), err(%+v)\", projID, err)\n\t\treturn\n\t}\n\treturn\n}", "func (t *Team) GetMembersCount() int {\n\tif t == nil || t.MembersCount == nil {\n\t\treturn 0\n\t}\n\treturn *t.MembersCount\n}", "func AllListMembers(w http.ResponseWriter, r *http.Request) {\r\n\tvar listMembers []ListMember\r\n\r\n\tdb.Find(&listMembers)\r\n\tjson.NewEncoder(w).Encode(listMembers)\r\n\t// fmt.Fprintf(w, \"All listMembers Endpoint Hit\")\r\n}", "func (s *TeamsService) ListTeamMembersByID(ctx context.Context, orgID, teamID int64, opts *TeamListTeamMembersOptions) ([]*User, *Response, error) {\n\tu := fmt.Sprintf(\"organizations/%v/team/%v/members\", orgID, teamID)\n\tu, err := addOptions(u, opts)\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\n\treq, err := s.client.NewRequest(\"GET\", u, nil)\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\n\tvar members []*User\n\tresp, err := s.client.Do(ctx, req, &members)\n\tif err != nil {\n\t\treturn nil, resp, err\n\t}\n\n\treturn members, resp, nil\n}", "func (p *ProjectProvider) List(options *provider.ProjectListOptions) ([]*kubermaticapiv1.Project, error) {\n\tif options == nil {\n\t\toptions = &provider.ProjectListOptions{}\n\t}\n\tprojects := &kubermaticapiv1.ProjectList{}\n\tif err := p.clientPrivileged.List(context.Background(), projects); err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar ret []*kubermaticapiv1.Project\n\tfor _, project := range projects.Items {\n\t\tif len(options.ProjectName) > 0 && project.Spec.Name != options.ProjectName {\n\t\t\tcontinue\n\t\t}\n\t\tif len(options.OwnerUID) > 0 {\n\t\t\towners := project.GetOwnerReferences()\n\t\t\tfor _, owner := range owners {\n\t\t\t\tif owner.UID == options.OwnerUID {\n\t\t\t\t\tret = append(ret, project.DeepCopy())\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t}\n\t\t\tcontinue\n\t\t}\n\n\t\tret = append(ret, project.DeepCopy())\n\t}\n\n\t// Filter out restricted labels\n\tfor i, project := range ret {\n\t\tproject.Labels = label.FilterLabels(label.ClusterResourceType, project.Labels)\n\t\tret[i] = project\n\t}\n\n\treturn ret, nil\n}", "func ProjectListUsers(w http.ResponseWriter, r *http.Request) {\n\n\tvar err error\n\tvar pageSize int\n\tvar paginatedUsers auth.PaginatedUsers\n\n\t// Init output\n\toutput := []byte(\"\")\n\n\t// Add content type header to the response\n\tcontentType := \"application/json\"\n\tcharset := \"utf-8\"\n\tw.Header().Add(\"Content-Type\", fmt.Sprintf(\"%s; charset=%s\", contentType, charset))\n\n\t// Grab context references\n\trefStr := gorillaContext.Get(r, \"str\").(stores.Store)\n\trefRoles := gorillaContext.Get(r, \"auth_roles\").([]string)\n\tprojectUUID := gorillaContext.Get(r, \"auth_project_uuid\").(string)\n\n\t// Grab url path variables\n\turlValues := r.URL.Query()\n\tpageToken := urlValues.Get(\"pageToken\")\n\tstrPageSize := urlValues.Get(\"pageSize\")\n\n\tif strPageSize != \"\" {\n\t\tif pageSize, err = strconv.Atoi(strPageSize); err != nil {\n\t\t\tlog.Errorf(\"Pagesize %v produced an error while being converted to int: %v\", strPageSize, err.Error())\n\t\t\terr := APIErrorInvalidData(\"Invalid page size\")\n\t\t\trespondErr(w, err)\n\t\t\treturn\n\t\t}\n\t}\n\n\t// check that user is indeed a service admin in order to be priviledged to see full user info\n\tpriviledged := auth.IsServiceAdmin(refRoles)\n\n\t// Get Results Object - call is always priviledged because this handler is only accessible by service admins\n\tif paginatedUsers, err = auth.PaginatedFindUsers(pageToken, int32(pageSize), projectUUID, priviledged, refStr); err != nil {\n\t\terr := APIErrorInvalidData(\"Invalid page token\")\n\t\trespondErr(w, err)\n\t\treturn\n\t}\n\n\t// Output result to JSON\n\tresJSON, err := paginatedUsers.ExportJSON()\n\n\tif err != nil {\n\t\terr := APIErrExportJSON()\n\t\trespondErr(w, err)\n\t\treturn\n\t}\n\n\t// Write response\n\toutput = []byte(resJSON)\n\trespondOK(w, output)\n\n}", "func (a *Client) PostProjectsProjectIDMembers(params *PostProjectsProjectIDMembersParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PostProjectsProjectIDMembersCreated, error) {\n\t// TODO: Validate the params before sending\n\tif params == nil {\n\t\tparams = NewPostProjectsProjectIDMembersParams()\n\t}\n\top := &runtime.ClientOperation{\n\t\tID: \"PostProjectsProjectIDMembers\",\n\t\tMethod: \"POST\",\n\t\tPathPattern: \"/projects/{project_id}/members\",\n\t\tProducesMediaTypes: []string{\"application/json\", \"text/plain\"},\n\t\tConsumesMediaTypes: []string{\"application/json\"},\n\t\tSchemes: []string{\"http\", \"https\"},\n\t\tParams: params,\n\t\tReader: &PostProjectsProjectIDMembersReader{formats: a.formats},\n\t\tAuthInfo: authInfo,\n\t\tContext: params.Context,\n\t\tClient: params.HTTPClient,\n\t}\n\tfor _, opt := range opts {\n\t\topt(op)\n\t}\n\n\tresult, err := a.transport.Submit(op)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tsuccess, ok := result.(*PostProjectsProjectIDMembersCreated)\n\tif ok {\n\t\treturn success, nil\n\t}\n\t// unexpected success response\n\t// safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue\n\tmsg := fmt.Sprintf(\"unexpected success response for PostProjectsProjectIDMembers: API contract not enforced by server. Client expected to get an error, but got: %T\", result)\n\tpanic(msg)\n}", "func (g *Group) Members() ([]string, error) {\n\treturn groupMembers(g)\n}", "func (g *Group) Members() ([]string, error) {\n\treturn groupMembers(g)\n}", "func (s *GroupsService) ListGroupProjects(gid interface{}, opt *ListGroupProjectsOptions, options ...RequestOptionFunc) ([]*Project, *Response, error) {\n\tgroup, err := parseID(gid)\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\tu := fmt.Sprintf(\"groups/%s/projects\", PathEscape(group))\n\n\treq, err := s.client.NewRequest(http.MethodGet, u, opt, options)\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\n\tvar ps []*Project\n\tresp, err := s.client.Do(req, &ps)\n\tif err != nil {\n\t\treturn nil, resp, err\n\t}\n\n\treturn ps, resp, nil\n}", "func (r *RoleUpdate) GetMembers() []string {\n\treturn r.Members\n}", "func (s *Server) List(ctx context.Context, q *project.ProjectQuery) (*v1alpha1.AppProjectList, error) {\n\tlist, err := s.appclientset.ArgoprojV1alpha1().AppProjects(s.ns).List(ctx, metav1.ListOptions{})\n\tif list != nil {\n\t\tnewItems := make([]v1alpha1.AppProject, 0)\n\t\tfor i := range list.Items {\n\t\t\tproject := list.Items[i]\n\t\t\tif s.enf.Enforce(ctx.Value(\"claims\"), rbacpolicy.ResourceProjects, rbacpolicy.ActionGet, project.Name) {\n\t\t\t\tnewItems = append(newItems, project)\n\t\t\t}\n\t\t}\n\t\tlist.Items = newItems\n\t}\n\treturn list, err\n}", "func GetProjects() []m.Project {\n body, err := authenticatedGet(\"projects\")\n if err != nil {\n panic(err.Error())\n } else {\n var responseData projectResponse\n err = json.Unmarshal(body, &responseData)\n if err != nil {\n panic(err.Error())\n }\n\n return responseData.Data\n }\n}", "func (m *ModelProject) ListProjects(ctx context.Context, cond *operator.Condition, pagination *page.Pagination) (\n\t[]Project, int64, error) {\n\tprojectList := make([]Project, 0)\n\tfinder := m.db.Table(m.tableName).Find(cond)\n\t// total 表示根据条件得到的总量\n\ttotal, err := finder.Count(ctx)\n\tif err != nil {\n\t\treturn nil, 0, err\n\t}\n\n\tif len(pagination.Sort) != 0 {\n\t\tfinder = finder.WithSort(dbtable.MapInt2MapIf(pagination.Sort))\n\t}\n\tif pagination.Offset != 0 {\n\t\tfinder = finder.WithStart(pagination.Offset * pagination.Limit)\n\t}\n\tif pagination.Limit == 0 {\n\t\tfinder = finder.WithLimit(page.DefaultProjectLimit)\n\t} else {\n\t\tfinder = finder.WithLimit(pagination.Limit)\n\t}\n\n\t// 设置拉取全量数据\n\tif pagination.All {\n\t\tfinder = finder.WithLimit(0).WithStart(0)\n\t}\n\n\t// 获取数据\n\tif err := finder.All(ctx, &projectList); err != nil {\n\t\treturn nil, 0, err\n\t}\n\n\treturn projectList, total, nil\n}", "func (r *SpacesMembersService) List(parent string) *SpacesMembersListCall {\n\tc := &SpacesMembersListCall{s: r.s, urlParams_: make(gensupport.URLParams)}\n\tc.parent = parent\n\treturn c\n}", "func (o ServerGroupOutput) Members() pulumi.StringArrayOutput {\n\treturn o.ApplyT(func(v *ServerGroup) pulumi.StringArrayOutput { return v.Members }).(pulumi.StringArrayOutput)\n}", "func (s *Server) List(ctx context.Context, q *ProjectQuery) (*v1alpha1.AppProjectList, error) {\n\tlist, err := s.appclientset.ArgoprojV1alpha1().AppProjects(s.ns).List(metav1.ListOptions{})\n\tlist.Items = append(list.Items, v1alpha1.GetDefaultProject(s.ns))\n\tif list != nil {\n\t\tnewItems := make([]v1alpha1.AppProject, 0)\n\t\tfor i := range list.Items {\n\t\t\tproject := list.Items[i]\n\t\t\tif s.enf.EnforceClaims(ctx.Value(\"claims\"), \"projects\", \"get\", project.Name) {\n\t\t\t\tnewItems = append(newItems, project)\n\t\t\t}\n\t\t}\n\t\tlist.Items = newItems\n\t}\n\treturn list, err\n}", "func (m *Memberlist) Members() []Member {\n\tmembers := []Member{}\n\n\tfor _, member := range m.list.Members() {\n\t\tmembers = append(members, &MemberlistNode{member})\n\t}\n\n\treturn members\n}", "func (g *projectGateway) ListProjectsAction(params project.ListProjectsParams) middleware.Responder {\n\tlistRsp, err := g.projectClient.List(context.TODO(), &proto.ListRequest{})\n\n\tif err != nil {\n\t\tfmt.Println(err)\n\t\treturn project.NewCreateProjectInternalServerError()\n\t}\n\n\tvar projects = []*models.Project{}\n\tfor _, listResp := range listRsp.Projects {\n\t\tp := &models.Project{\n\t\t\tUUID: strfmt.UUID(listResp.Uuid),\n\t\t\tName: listResp.Name,\n\t\t\tDescription: listResp.Description,\n\t\t}\n\t\tprojects = append(projects, p)\n\t}\n\n\treturn project.NewListProjectsOK().WithPayload(projects)\n}", "func (mr *MockClientMockRecorder) ListTeamMembers(org, id, role interface{}) *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"ListTeamMembers\", reflect.TypeOf((*MockClient)(nil).ListTeamMembers), org, id, role)\n}", "func (c *RollbarAPIClient) ListTeamProjectIDs(teamID int) ([]int, error) {\n\tl := log.With().Int(\"teamID\", teamID).Logger()\n\tl.Debug().Msg(\"Listing projects for team\")\n\tresp, err := c.Resty.R().\n\t\tSetPathParams(map[string]string{\n\t\t\t\"teamID\": strconv.Itoa(teamID),\n\t\t}).\n\t\tSetResult(teamProjectListResponse{}).\n\t\tSetError(ErrorResult{}).\n\t\tGet(c.BaseURL + pathTeamProjects)\n\tif err != nil {\n\t\tl.Err(err).Msg(\"Error listing projects for team\")\n\t\treturn nil, err\n\t}\n\terr = errorFromResponse(resp)\n\tif err != nil {\n\t\tl.Err(err).Msg(\"Error listing projects for team\")\n\t\treturn nil, err\n\t}\n\tresult := resp.Result().(*teamProjectListResponse).Result\n\tvar projectIDs []int\n\tfor _, item := range result {\n\t\tprojectIDs = append(projectIDs, item.ProjectID)\n\t}\n\tl.Debug().Msg(\"Successfully listed projects for team\")\n\treturn projectIDs, nil\n}", "func (api *API) OrganizationMembers(organizationID string) ([]OrganizationMember, ResultInfo, error) {\n\tvar r organizationMembersResponse\n\turi := \"/organizations/\" + organizationID + \"/members\"\n\tres, err := api.makeRequest(\"GET\", uri, nil)\n\tif err != nil {\n\t\treturn []OrganizationMember{}, ResultInfo{}, errors.Wrap(err, errMakeRequestError)\n\t}\n\n\terr = json.Unmarshal(res, &r)\n\tif err != nil {\n\t\treturn []OrganizationMember{}, ResultInfo{}, errors.Wrap(err, errUnmarshalError)\n\t}\n\n\treturn r.Result, r.ResultInfo, nil\n}", "func (s *ProjectsService) ListProjectColumns(ctx context.Context, projectID int64, opt *ListOptions) ([]*ProjectColumn, *Response, error) {\n\tu := fmt.Sprintf(\"projects/%v/columns\", projectID)\n\tu, err := addOptions(u, opt)\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\n\treq, err := s.client.NewRequest(\"GET\", u, nil)\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\n\t// TODO: remove custom Accept headers when APIs fully launch.\n\treq.Header.Set(\"Accept\", mediaTypeProjectsPreview)\n\n\tcolumns := []*ProjectColumn{}\n\tresp, err := s.client.Do(ctx, req, &columns)\n\tif err != nil {\n\t\treturn nil, resp, err\n\t}\n\n\treturn columns, resp, nil\n}", "func (e *BcsDataManager) GetAllProjectList(ctx context.Context,\n\treq *bcsdatamanager.GetAllProjectListRequest, rsp *bcsdatamanager.GetAllProjectListResponse) error {\n\tblog.Infof(\"Received GetAllProjectList.Call request. Dimension:%s, page:%d, size:%d, startTime=%s, endTime=%s\",\n\t\treq.GetDimension(), req.Page, req.Size, time.Unix(req.GetStartTime(), 0),\n\t\ttime.Unix(req.GetEndTime(), 0))\n\tstart := time.Now()\n\tresult, total, err := e.model.GetProjectList(ctx, req)\n\tif err != nil {\n\t\trsp.Message = fmt.Sprintf(\"get project list error: %v\", err)\n\t\trsp.Code = bcsCommon.AdditionErrorCode + 500\n\t\tblog.Errorf(rsp.Message)\n\t\tprom.ReportAPIRequestMetric(\"GetAllProjectList\", \"grpc\", prom.StatusErr, start)\n\t\treturn nil\n\t}\n\trsp.Data = result\n\trsp.Message = bcsCommon.BcsSuccessStr\n\trsp.Code = bcsCommon.BcsSuccess\n\trsp.Total = uint32(total)\n\tprom.ReportAPIRequestMetric(\"GetAllProjectList\", \"grpc\", prom.StatusOK, start)\n\treturn nil\n}", "func (s *Status) Members(args *structs.GenericRequest, reply *structs.ServerMembersResponse) error {\n\t// Check node read permissions\n\tif aclObj, err := s.srv.ResolveToken(args.AuthToken); err != nil {\n\t\treturn err\n\t} else if aclObj != nil && !aclObj.AllowNodeRead() {\n\t\treturn structs.ErrPermissionDenied\n\t}\n\n\tserfMembers := s.srv.Members()\n\tmembers := make([]*structs.ServerMember, len(serfMembers))\n\tfor i, mem := range serfMembers {\n\t\tmembers[i] = &structs.ServerMember{\n\t\t\tName: mem.Name,\n\t\t\tAddr: mem.Addr,\n\t\t\tPort: mem.Port,\n\t\t\tTags: mem.Tags,\n\t\t\tStatus: mem.Status.String(),\n\t\t\tProtocolMin: mem.ProtocolMin,\n\t\t\tProtocolMax: mem.ProtocolMax,\n\t\t\tProtocolCur: mem.ProtocolCur,\n\t\t\tDelegateMin: mem.DelegateMin,\n\t\t\tDelegateMax: mem.DelegateMax,\n\t\t\tDelegateCur: mem.DelegateCur,\n\t\t}\n\t}\n\t*reply = structs.ServerMembersResponse{\n\t\tServerName: s.srv.config.NodeName,\n\t\tServerRegion: s.srv.config.Region,\n\t\tServerDC: s.srv.config.Datacenter,\n\t\tMembers: members,\n\t}\n\treturn nil\n}", "func (s *TeamsService) ListTeamMembersBySlug(ctx context.Context, org, slug string, opts *TeamListTeamMembersOptions) ([]*User, *Response, error) {\n\tu := fmt.Sprintf(\"orgs/%v/teams/%v/members\", org, slug)\n\tu, err := addOptions(u, opts)\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\n\treq, err := s.client.NewRequest(\"GET\", u, nil)\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\n\tvar members []*User\n\tresp, err := s.client.Do(ctx, req, &members)\n\tif err != nil {\n\t\treturn nil, resp, err\n\t}\n\n\treturn members, resp, nil\n}", "func (r *LoggingRepository) List(ctx context.Context, teamID, userID string) ([]*model.Member, error) {\n\tstart := time.Now()\n\trecords, err := r.upstream.List(ctx, teamID, userID)\n\n\tlogger := r.logger.With().\n\t\tStr(\"request\", r.requestID(ctx)).\n\t\tStr(\"method\", \"list\").\n\t\tDur(\"duration\", time.Since(start)).\n\t\tStr(\"team\", teamID).\n\t\tStr(\"user\", userID).\n\t\tLogger()\n\n\tif err != nil {\n\t\tlogger.Warn().\n\t\t\tErr(err).\n\t\t\tMsg(\"failed to fetch members\")\n\t} else {\n\t\tlogger.Debug().\n\t\t\tMsg(\"\")\n\t}\n\n\treturn records, err\n}", "func (c *Client) ListProjects(listall bool) ([]models.Project, error) {\n\treq, err := c.newRequest(\"GET\", projectPath, nil)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tif listall {\n\t\tparams := req.URL.Query()\n\t\tparams.Add(\"displayAll\", \"true\")\n\t\treq.URL.RawQuery = params.Encode()\n\t}\n\n\tresult := make([]models.Project, 0)\n\n\tresp, err := c.do(req, &result)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// StatusCodes 401 and 409 mean empty response and should be treated as such\n\tif resp.StatusCode == 401 || resp.StatusCode == 409 {\n\t\treturn nil, nil\n\t}\n\n\tif resp.StatusCode >= 299 {\n\t\treturn nil, errors.New(\"Got non-2xx return code: \" + strconv.Itoa(resp.StatusCode))\n\t}\n\n\treturn result, nil\n}", "func (mr *MockTeamClientMockRecorder) ListTeamMembers(org, id, role interface{}) *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"ListTeamMembers\", reflect.TypeOf((*MockTeamClient)(nil).ListTeamMembers), org, id, role)\n}", "func (o ProtectionGroupOutput) Members() pulumi.StringArrayOutput {\n\treturn o.ApplyT(func(v *ProtectionGroup) pulumi.StringArrayOutput { return v.Members }).(pulumi.StringArrayOutput)\n}", "func (g *GH) ListProjectColumns(prjID int64) []*github.ProjectColumn {\n\tctx := context.Background()\n\tcolumns, _, err := g.c.Projects.ListProjectColumns(ctx, prjID, &github.ListOptions{})\n\tif err != nil {\n\t\tlog.Fatal(\"Unable to List columns in project \", err)\n\t\treturn nil\n\t}\n\treturn columns\n}", "func (rm *RedisMembership) GetMembers(ctx context.Context) ([]string, error) {\n\terr := rm.validateDefaults()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\t// get the list of members multiple times\n\tallMembers := make([]string, 0)\n\tfor i := 0; i < rm.RepeatCount; i++ {\n\t\tmems, err := rm.getMembersOnce(ctx)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tallMembers = append(allMembers, mems...)\n\t}\n\n\t// then sort and compact the list so we get the union of all the previous\n\t// member requests\n\tsort.Strings(allMembers)\n\tmembers := make([]string, 0, len(allMembers)/rm.RepeatCount)\n\tvar prevMember string\n\tfor _, member := range allMembers {\n\t\tif member == prevMember {\n\t\t\tcontinue\n\t\t}\n\t\tmembers = append(members, member)\n\t\tprevMember = member\n\t}\n\treturn members, nil\n}", "func (s *ProjectService) ListProjectInvitations(p *ListProjectInvitationsParams) (*ListProjectInvitationsResponse, error) {\n\tresp, err := s.cs.newRequest(\"listProjectInvitations\", p.toURLValues())\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar r ListProjectInvitationsResponse\n\tif err := json.Unmarshal(resp, &r); err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn &r, nil\n}", "func (c *ProjectService) List() ([]Project, *http.Response, error) {\n\tresponse := new(projectListResponse)\n\tapiError := new(APIError)\n\tresp, err := c.sling.New().Get(\"\").Receive(response, apiError)\n\treturn response.Results, resp, relevantError(err, *apiError)\n}", "func ListProjects() ([]model.Project, error) {\n\tprojects, err := model.ListProjects()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif len(projects) == 0 {\n\t\treturn nil, errors.New(\"no project found\")\n\t}\n\treturn projects, nil\n}", "func (g *GH) ListProjects() []*github.Project {\n\tctx := context.Background()\n\tprojectOptions := &github.ProjectListOptions{State: \"open\"}\n\tprojects, rsp, err := g.c.Organizations.ListProjects(ctx, g.org, projectOptions)\n\tif err != nil {\n\t\tlog.Println(\"Unable to List Projects in Org\", rsp, g.org, err)\n\t}\n\treturn projects\n}" ]
[ "0.68653005", "0.68466157", "0.6716187", "0.665247", "0.66454184", "0.64930016", "0.6479798", "0.633954", "0.631462", "0.63009024", "0.62344366", "0.6189459", "0.61785614", "0.61296403", "0.6102629", "0.60745835", "0.6071409", "0.6056891", "0.5963298", "0.59357166", "0.59334576", "0.5916195", "0.5907848", "0.5899445", "0.58632773", "0.58517104", "0.58484864", "0.5842067", "0.5837461", "0.5825458", "0.58200085", "0.58193916", "0.58161825", "0.57958734", "0.57922184", "0.57850254", "0.5778665", "0.576294", "0.576023", "0.57408834", "0.57301724", "0.57269", "0.57179356", "0.5699752", "0.5697917", "0.56523013", "0.5631953", "0.56280476", "0.56120956", "0.56039494", "0.5566348", "0.556561", "0.55613285", "0.5541482", "0.5529841", "0.55203354", "0.5498355", "0.54975", "0.54972833", "0.5442845", "0.5427013", "0.54187036", "0.5412196", "0.54080015", "0.54054916", "0.5398793", "0.53967524", "0.5390629", "0.5386255", "0.5373437", "0.53707826", "0.53641427", "0.53641427", "0.53589606", "0.53529423", "0.5337836", "0.533119", "0.5319991", "0.5316996", "0.531508", "0.5310937", "0.53069973", "0.53010786", "0.5292604", "0.52883047", "0.52655274", "0.5265193", "0.52575576", "0.5244615", "0.5234355", "0.52310205", "0.5230721", "0.52248913", "0.5209476", "0.52083164", "0.52044255", "0.5201354", "0.5199194", "0.51878345", "0.51827085" ]
0.83762556
0
ListProjectMembers gets a list of a group's team members. GitLab API docs:
func (g *Client) ListGroupMembers(group_id string, o *ListOptions) ([]*User, error) { path := getUrl([]string{"groups", group_id, "members"}) u, err := addOptions(path, o) if err != nil { return nil, err } req, _ := http.NewRequest("GET", u, nil) var ret []*User if _, err := g.Do(req, &ret); err != nil { return nil, err } return ret, nil }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (g *Client) ListProjectMembers(project_id string, o *ListOptions) ([]*User, error) {\n\tpath := getUrl([]string{\"projects\", url.QueryEscape(project_id), \"members\"})\n\tu, err := addOptions(path, o)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treq, _ := http.NewRequest(\"GET\", u, nil)\n\n\tvar ret []*User\n\tif _, err := g.Do(req, &ret); err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn ret, nil\n}", "func (r *ProjectsGroupsMembersService) List(name string) *ProjectsGroupsMembersListCall {\n\tc := &ProjectsGroupsMembersListCall{s: r.s, urlParams_: make(gensupport.URLParams)}\n\tc.name = name\n\treturn c\n}", "func (s *GroupsService) ListGroupMembers(ctx context.Context, groupName string, opts *PagingOptions) (*GroupMembers, error) {\n\tquery := addPaging(url.Values{}, opts)\n\t// The group name is required as a parameter\n\tquery.Set(contextKey, groupName)\n\treq, err := s.Client.NewRequest(ctx, http.MethodGet, newURI(groupMembersURI), WithQuery(query))\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"list groups request creation failed: , %w\", err)\n\t}\n\tres, resp, err := s.Client.Do(req)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"list group members failed: , %w\", err)\n\t}\n\n\tif resp != nil && resp.StatusCode == http.StatusNotFound {\n\t\treturn nil, ErrNotFound\n\t}\n\n\tm := &GroupMembers{\n\t\tGroupName: groupName,\n\t\tUsers: []*User{},\n\t}\n\n\tif err := json.Unmarshal(res, m); err != nil {\n\t\treturn nil, fmt.Errorf(\"list group members failed, unable to unmarshal repository list json: , %w\", err)\n\t}\n\n\tfor _, member := range m.GetGroupMembers() {\n\t\tmember.Session.set(resp)\n\t}\n\n\treturn m, nil\n}", "func (g *Gitlab) GroupMembers(id string) ([]*Member, error) {\n\turl, opaque := g.ResourceUrlRaw(group_url_members, map[string]string{\":id\": id})\n\n\tvar members []*Member\n\n\tcontents, err := g.buildAndExecRequestRaw(\"GET\", url, opaque, nil)\n\tif err == nil {\n\t\terr = json.Unmarshal(contents, &members)\n\t}\n\n\treturn members, err\n}", "func (t Team) MemberList() (TeamAPI, error) {\n\tm := TeamAPI{\n\t\tParams: &tParams{},\n\t}\n\tm.Method = \"list-team-memberships\"\n\tm.Params.Options.Team = t.Name\n\n\tr, err := teamAPIOut(t.keybase, m)\n\treturn r, err\n}", "func (bot *BotAPI) GetGroupMemberList(groupID int64) ([]User, error) {\n\tv := url.Values{}\n\tv.Add(\"group_id\", strconv.FormatInt(groupID, 10))\n\tresp, err := bot.MakeRequest(\"get_group_member_list\", v)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tusers := make([]User, 0)\n\tjson.Unmarshal(resp.Data, &users)\n\n\tbot.debugLog(\"GetGroupMemberInfo\", nil, users)\n\n\treturn users, nil\n}", "func (p *Project) GetMembers() (members []*User) {\n\tmembers, err := readProjectMembers(p.Id)\n\tif err != nil {\n\t\tlog.Error(\"Error get project members:\", err)\n\t\treturn nil\n\t}\n\tlog.Debug(\"proj members:\", members)\n\treturn\n}", "func (c *client) ListTeamMembers(org string, id int, role string) ([]TeamMember, error) {\n\tc.logger.WithField(\"methodName\", \"ListTeamMembers\").\n\t\tWarn(\"method is deprecated, please use ListTeamMembersBySlug\")\n\tdurationLogger := c.log(\"ListTeamMembers\", id, role)\n\tdefer durationLogger()\n\n\tif c.fake {\n\t\treturn nil, nil\n\t}\n\tpath := fmt.Sprintf(\"/teams/%d/members\", id)\n\tvar teamMembers []TeamMember\n\terr := c.readPaginatedResultsWithValues(\n\t\tpath,\n\t\turl.Values{\n\t\t\t\"per_page\": []string{\"100\"},\n\t\t\t\"role\": []string{role},\n\t\t},\n\t\t\"application/vnd.github+json\",\n\t\torg,\n\t\tfunc() interface{} {\n\t\t\treturn &[]TeamMember{}\n\t\t},\n\t\tfunc(obj interface{}) {\n\t\t\tteamMembers = append(teamMembers, *(obj.(*[]TeamMember))...)\n\t\t},\n\t)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn teamMembers, nil\n}", "func TeamListMember(ctx context.Context, w http.ResponseWriter, req *http.Request) error {\n\tvar db = ctx.Value(DBKey).(*sql.DB)\n\tvar user = ctx.Value(UserKey).(*dash.User)\n\tvar team = ctx.Value(TeamKey).(*dash.Team)\n\n\tif team.OwnerID != user.ID {\n\t\treturn ErrNotTeamOwner\n\t}\n\n\tvar payload map[string]interface{}\n\tjson.NewDecoder(req.Body).Decode(&payload)\n\n\tvar rows, err = db.Query(`SELECT tm.role, u.username FROM team_user AS tm INNER JOIN users AS u ON u.id = tm.user_id WHERE tm.team_id = ?`, team.ID)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer rows.Close()\n\n\tvar memberships = make([]membership, 0)\n\tfor rows.Next() {\n\t\tvar membership = membership{}\n\t\tif err := rows.Scan(&membership.Role, &membership.Username); err != nil {\n\t\t\treturn err\n\t\t}\n\t\tmemberships = append(memberships, membership)\n\t}\n\n\tvar resp = teamListMembersResponse{\n\t\tStatus: \"success\",\n\t\tMembers: memberships,\n\t\tHasAccessKey: team.EncryptedAccessKey != \"\",\n\t}\n\tjson.NewEncoder(w).Encode(resp)\n\treturn nil\n}", "func (s *GroupsService) Members(\n\tctx context.Context,\n\tgroupName string,\n) ([]PrincipalName, error) {\n\treq, err := http.NewRequest(\n\t\thttp.MethodGet,\n\t\ts.client.url+\"2.0/groups/list-members\",\n\t\tnil,\n\t)\n\tif err != nil {\n\t\treturn []PrincipalName{}, err\n\t}\n\treq = req.WithContext(ctx)\n\tq := req.URL.Query()\n\tq.Add(\"group_name\", groupName)\n\treq.URL.RawQuery = q.Encode()\n\tres, err := s.client.client.Do(req)\n\tif err != nil {\n\t\treturn []PrincipalName{}, err\n\t}\n\tif res.StatusCode >= 300 || res.StatusCode <= 199 {\n\t\treturn []PrincipalName{}, fmt.Errorf(\n\t\t\t\"Failed to returns 2XX response: %d\", res.StatusCode)\n\t}\n\tdefer res.Body.Close()\n\tdecoder := json.NewDecoder(res.Body)\n\n\tmembersRes := struct {\n\t\tMembers []PrincipalName\n\t}{[]PrincipalName{}}\n\terr = decoder.Decode(&membersRes)\n\n\treturn membersRes.Members, err\n}", "func ListMembers(client *clientv3.Client) (*clientv3.MemberListResponse, error) {\n\tctx, cancel := context.WithTimeout(client.Ctx(), DefaultRequestTimeout)\n\tdefer cancel()\n\treturn client.MemberList(ctx)\n}", "func listMembers() (members []User, err error) {\n\tmembersMu.Lock()\n\tdefer membersMu.Unlock()\n\n\tif membersCache == nil {\n\t\turl := fmt.Sprintf(\"%s/teams/%s/members\", *ghAPIFl, *ghTeamFl)\n\t\treq, err := http.NewRequest(\"GET\", url, nil)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"cannot create GET request: %s\", err)\n\t\t}\n\t\taddAuthentication(req)\n\t\tresp, err := http.DefaultClient.Do(req)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"cannot fetch response: %s\", err)\n\t\t}\n\t\tdefer resp.Body.Close()\n\t\tvar members []User\n\t\tif err := json.NewDecoder(resp.Body).Decode(&members); err != nil {\n\t\t\treturn nil, fmt.Errorf(\"cannot decode response: %s\", err)\n\t\t}\n\t\tisBlacklisted := blacklistedMembers()\n\t\tfor i := len(members) - 1; i >= 0; i-- {\n\t\t\tif isBlacklisted[members[i].Login] {\n\t\t\t\tmembers = append(members[:i], members[(i+1):]...)\n\t\t\t}\n\t\t}\n\t\tmembersCache = members\n\t}\n\n\treturn membersCache, nil\n}", "func (app *App) GroupMembers(ctx context.Context, groupName string) ([]string, error) {\n\treturn app.groups.GroupMembers(ctx, groupName)\n}", "func (c *client) GetMembers(ctx context.Context, groupID string) ([]user.User, error) {\n\tcli := c.getGroupClient()\n\n\tmemberResp, err := cli.Members(ctx, &pb.GroupRequest{Groupid: groupID})\n\tif err != nil {\n\t\treturn []user.User{}, err\n\t}\n\n\trespUsers := make([]user.User, len(memberResp.Users))\n\tfor i, pbUser := range memberResp.Users {\n\t\trespUsers[i] = user.User{UserID: pbUser.UserId, Email: pbUser.Email}\n\t}\n\n\treturn respUsers, nil\n}", "func (a *Client) GetProjectsProjectIDMembers(params *GetProjectsProjectIDMembersParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetProjectsProjectIDMembersOK, error) {\n\t// TODO: Validate the params before sending\n\tif params == nil {\n\t\tparams = NewGetProjectsProjectIDMembersParams()\n\t}\n\top := &runtime.ClientOperation{\n\t\tID: \"GetProjectsProjectIDMembers\",\n\t\tMethod: \"GET\",\n\t\tPathPattern: \"/projects/{project_id}/members\",\n\t\tProducesMediaTypes: []string{\"application/json\", \"text/plain\"},\n\t\tConsumesMediaTypes: []string{\"application/json\"},\n\t\tSchemes: []string{\"http\", \"https\"},\n\t\tParams: params,\n\t\tReader: &GetProjectsProjectIDMembersReader{formats: a.formats},\n\t\tAuthInfo: authInfo,\n\t\tContext: params.Context,\n\t\tClient: params.HTTPClient,\n\t}\n\tfor _, opt := range opts {\n\t\topt(op)\n\t}\n\n\tresult, err := a.transport.Submit(op)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tsuccess, ok := result.(*GetProjectsProjectIDMembersOK)\n\tif ok {\n\t\treturn success, nil\n\t}\n\t// unexpected success response\n\t// safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue\n\tmsg := fmt.Sprintf(\"unexpected success response for GetProjectsProjectIDMembers: API contract not enforced by server. Client expected to get an error, but got: %T\", result)\n\tpanic(msg)\n}", "func (s *GroupsService) ListGroupProjects(gid interface{}, opt *ListGroupProjectsOptions, options ...RequestOptionFunc) ([]*Project, *Response, error) {\n\tgroup, err := parseID(gid)\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\tu := fmt.Sprintf(\"groups/%s/projects\", PathEscape(group))\n\n\treq, err := s.client.NewRequest(http.MethodGet, u, opt, options)\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\n\tvar ps []*Project\n\tresp, err := s.client.Do(req, &ps)\n\tif err != nil {\n\t\treturn nil, resp, err\n\t}\n\n\treturn ps, resp, nil\n}", "func (gr *GroupResource) GetMembers(owner string, group string) (members *[]User, err error) {\n\townerOrCurrentUser(gr, &owner)\n\n\tpath := fmt.Sprintf(\"/groups/%s/%s/members/\", owner, group)\n\terr = gr.client.do(\"GET\", path, nil, nil, &members)\n\treturn\n}", "func (c *Client) ListMembers() ([]Member, error) {\n\tresp, err := c.listMembers()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tret := make([]Member, 0, len(resp.Members))\n\tfor _, m := range resp.Members {\n\t\tret = append(ret, Member{Name: m.Name, PeerURL: m.PeerURLs[0]})\n\t}\n\treturn ret, nil\n}", "func ProjectList(c *gin.Context) error {\n\tuserID, err := GetIDParam(c, userIDParam)\n\n\tif err != nil {\n\t\treturn err\n\t}\n\n\toption := &model.ProjectQueryOption{\n\t\tUserID: userID,\n\t}\n\n\tif limit := c.Query(\"limit\"); limit != \"\" {\n\t\tif i, err := strconv.Atoi(limit); err == nil {\n\t\t\toption.Limit = i\n\t\t}\n\t}\n\n\tif offset := c.Query(\"offset\"); offset != \"\" {\n\t\tif i, err := strconv.Atoi(offset); err == nil {\n\t\t\toption.Offset = i\n\t\t}\n\t}\n\n\tif order := c.Query(\"order\"); order != \"\" {\n\t\toption.Order = order\n\t} else {\n\t\toption.Order = \"-created_at\"\n\t}\n\n\tif err := CheckUserPermission(c, *userID); err == nil {\n\t\toption.Private = true\n\t}\n\n\tlist, err := model.GetProjectList(option)\n\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn common.APIResponse(c, http.StatusOK, list)\n}", "func (c *EtcdGroupService) GroupMembers(ctx context.Context, groupName string) ([]string, error) {\n\tprefix := memberKey(groupName, \"\")\n\tctxT, cancel := context.WithTimeout(ctx, transactionTimeout)\n\tdefer cancel()\n\tetcdRes, err := clientInstance.Txn(ctxT).\n\t\tIf(clientv3.Compare(clientv3.CreateRevision(groupKey(groupName)), \">\", 0)).\n\t\tThen(clientv3.OpGet(prefix, clientv3.WithPrefix(), clientv3.WithKeysOnly())).\n\t\tCommit()\n\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif !etcdRes.Succeeded {\n\t\treturn nil, constants.ErrGroupNotFound\n\t}\n\n\tgetRes := etcdRes.Responses[0].GetResponseRange()\n\tmembers := make([]string, getRes.GetCount())\n\tfor i, kv := range getRes.GetKvs() {\n\t\tmembers[i] = string(kv.Key)[len(prefix):]\n\t}\n\treturn members, nil\n}", "func (c *Client) GetMembers(pageNumber int) ([]Member, error) {\n\tlogger := zerolog.New(os.Stdout).\n\t\tWith().Timestamp().Str(\"service\", \"dice\").Logger().\n\t\tOutput(zerolog.ConsoleWriter{Out: os.Stderr})\n\tvar ret []Member\n\turi := viper.GetString(\"github_api\") + \"orgs/\" + viper.GetString(\"github_org\") + \"/members?page=\" + strconv.Itoa(pageNumber)\n\tlogger.Debug().Str(\"uri\", uri).Msg(\"github client called for organization members\")\n\tresp, err := c.doGet(uri, nil)\n\tif err != nil {\n\t\treturn ret, fmt.Errorf(\"error performing request: %v\", err)\n\t}\n\tdefer resp.Body.Close()\n\tif resp.StatusCode != http.StatusOK {\n\t\treturn ret, errorFromResponse(resp)\n\t}\n\tbody, err := ioutil.ReadAll(resp.Body)\n\tif err != nil {\n\t\treturn ret, err\n\t}\n\tjsonErr := json.Unmarshal(body, &ret)\n\tif jsonErr != nil {\n\t\treturn ret, jsonErr\n\t}\n\treturn ret, nil\n}", "func (m *MembershipsClient) List(ctx context.Context, org, user, team *identity.ID) ([]MembershipResult, error) {\n\tv := &url.Values{}\n\tv.Set(\"org_id\", org.String())\n\tif user != nil {\n\t\tv.Set(\"owner_id\", user.String())\n\t}\n\tif team != nil {\n\t\tv.Set(\"team_id\", team.String())\n\t}\n\n\treq, _, err := m.client.NewRequest(\"GET\", \"/memberships\", v, nil, true)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tmemberships := []MembershipResult{}\n\t_, err = m.client.Do(ctx, req, &memberships, nil, nil)\n\treturn memberships, err\n}", "func (m *MockClient) ListTeamMembers(org string, id int, role string) ([]github.TeamMember, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"ListTeamMembers\", org, id, role)\n\tret0, _ := ret[0].([]github.TeamMember)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "func (c *Client) TeamMembers(id int64) ([]*TeamMember, error) {\n\tmembers := make([]*TeamMember, 0)\n\terr := c.request(\"GET\", fmt.Sprintf(\"/api/teams/%d/members\", id), nil, nil, &members)\n\tif err != nil {\n\t\treturn members, err\n\t}\n\n\treturn members, nil\n}", "func (m *MockTeamClient) ListTeamMembers(org string, id int, role string) ([]github.TeamMember, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"ListTeamMembers\", org, id, role)\n\tret0, _ := ret[0].([]github.TeamMember)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "func (c *client) ListOrgMembers(org, role string) ([]TeamMember, error) {\n\tc.log(\"ListOrgMembers\", org, role)\n\tif c.fake {\n\t\treturn nil, nil\n\t}\n\tpath := fmt.Sprintf(\"/orgs/%s/members\", org)\n\tvar teamMembers []TeamMember\n\terr := c.readPaginatedResultsWithValues(\n\t\tpath,\n\t\turl.Values{\n\t\t\t\"per_page\": []string{\"100\"},\n\t\t\t\"role\": []string{role},\n\t\t},\n\t\tacceptNone,\n\t\torg,\n\t\tfunc() interface{} {\n\t\t\treturn &[]TeamMember{}\n\t\t},\n\t\tfunc(obj interface{}) {\n\t\t\tteamMembers = append(teamMembers, *(obj.(*[]TeamMember))...)\n\t\t},\n\t)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn teamMembers, nil\n}", "func (c *Client) ListProject() (projectNames []string, err error) {\n\th := map[string]string{\n\t\t\"x-log-bodyrawsize\": \"0\",\n\t}\n\n\turi := \"/\"\n\tproj := convert(c, \"\")\n\n\ttype Project struct {\n\t\tProjectName string `json:\"projectName\"`\n\t}\n\n\ttype Body struct {\n\t\tProjects []Project `json:\"projects\"`\n\t}\n\n\tr, err := request(proj, \"GET\", uri, h, nil)\n\tif err != nil {\n\t\treturn nil, NewClientError(err)\n\t}\n\n\tdefer r.Body.Close()\n\tbuf, _ := ioutil.ReadAll(r.Body)\n\tif r.StatusCode != http.StatusOK {\n\t\terr := new(Error)\n\t\tjson.Unmarshal(buf, err)\n\t\treturn nil, err\n\t}\n\n\tbody := &Body{}\n\terr = json.Unmarshal(buf, body)\n\tfor _, project := range body.Projects {\n\t\tprojectNames = append(projectNames, project.ProjectName)\n\t}\n\treturn projectNames, err\n}", "func (r *apiV1Router) GetTeamMembers(ctx *gin.Context) {\n\tteam := ctx.Param(\"id\")\n\tif len(team) == 0 {\n\t\tr.logger.Debug(\"team id not provided\")\n\t\tmodels.SendAPIError(ctx, http.StatusBadRequest, \"team id must be provided\")\n\t\treturn\n\t}\n\n\tteamMembers, err := r.userService.GetUsersWithTeam(ctx, team)\n\tif err != nil {\n\t\tswitch err {\n\t\tcase services.ErrInvalidID:\n\t\t\tr.logger.Debug(\"invalid team id\")\n\t\t\tmodels.SendAPIError(ctx, http.StatusBadRequest, \"invalid team id provided\")\n\t\t\tbreak\n\t\tdefault:\n\t\t\tr.logger.Error(\"could fetch users with team\", zap.Error(err))\n\t\t\tmodels.SendAPIError(ctx, http.StatusInternalServerError, \"there was a problem with finding users in the team\")\n\t\t\tbreak\n\t\t}\n\t\treturn\n\t}\n\n\tctx.JSON(http.StatusOK, getTeamMembersRes{\n\t\tResponse: models.Response{\n\t\t\tStatus: http.StatusOK,\n\t\t},\n\t\tUsers: teamMembers,\n\t})\n}", "func (c *Client) ListOrgMembers(name string) ([]*api.OrgMember, error) {\n\tout := []*api.OrgMember{}\n\trawURL := fmt.Sprintf(pathOrgMembers, c.base.String(), name)\n\terr := c.get(rawURL, true, &out)\n\treturn out, errio.Error(err)\n}", "func GetTeamMembers(query *models.GetTeamMembersQuery) error {\n\tquery.Result = make([]*models.TeamMemberDTO, 0)\n\tsess := x.Table(\"team_member\")\n\tsess.Join(\"INNER\", x.Dialect().Quote(\"user\"), fmt.Sprintf(\"team_member.user_id=%s.id\", x.Dialect().Quote(\"user\")))\n\n\t// Join with only most recent auth module\n\tauthJoinCondition := `(\n\t\tSELECT id from user_auth\n\t\t\tWHERE user_auth.user_id = team_member.user_id\n\t\t\tORDER BY user_auth.created DESC `\n\tauthJoinCondition = \"user_auth.id=\" + authJoinCondition + dialect.Limit(1) + \")\"\n\tsess.Join(\"LEFT\", \"user_auth\", authJoinCondition)\n\n\tif query.OrgId != 0 {\n\t\tsess.Where(\"team_member.org_id=?\", query.OrgId)\n\t}\n\tif query.TeamId != 0 {\n\t\tsess.Where(\"team_member.team_id=?\", query.TeamId)\n\t}\n\tif query.UserId != 0 {\n\t\tsess.Where(\"team_member.user_id=?\", query.UserId)\n\t}\n\tif query.External {\n\t\tsess.Where(\"team_member.external=?\", dialect.BooleanStr(true))\n\t}\n\tsess.Cols(\n\t\t\"team_member.org_id\",\n\t\t\"team_member.team_id\",\n\t\t\"team_member.user_id\",\n\t\t\"user.email\",\n\t\t\"user.name\",\n\t\t\"user.login\",\n\t\t\"team_member.external\",\n\t\t\"team_member.permission\",\n\t\t\"user_auth.auth_module\",\n\t)\n\tsess.Asc(\"user.login\", \"user.email\")\n\n\terr := sess.Find(&query.Result)\n\treturn err\n}", "func ProjectList(opts gitlab.ListProjectsOptions, n int) ([]*gitlab.Project, error) {\n\tlist, resp, err := lab.Projects.ListProjects(&opts)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif resp.CurrentPage == resp.TotalPages {\n\t\treturn list, nil\n\t}\n\topts.Page = resp.NextPage\n\tfor len(list) < n || n == -1 {\n\t\tif n != -1 {\n\t\t\topts.PerPage = n - len(list)\n\t\t}\n\t\tprojects, resp, err := lab.Projects.ListProjects(&opts)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\topts.Page = resp.NextPage\n\t\tlist = append(list, projects...)\n\t\tif resp.CurrentPage == resp.TotalPages {\n\t\t\tbreak\n\t\t}\n\t}\n\treturn list, nil\n}", "func (pg *MongoDb) ListProjects(ctx context.Context, filter string, pageSize int, pageToken string) ([]*prpb.Project, string, error) {\n\t//id := decryptInt64(pageToken, pg.PaginationKey, 0)\n\t//TODO\n\treturn nil, \"\", nil\n}", "func (c *UsersClient) ListGroupMemberships(ctx context.Context, id string, filter string) (*[]models.Group, int, error) {\n\tparams := url.Values{}\n\tif filter != \"\" {\n\t\tparams.Add(\"$filter\", filter)\n\t}\n\tresp, status, _, err := c.BaseClient.Get(ctx, base.GetHttpRequestInput{\n\t\tValidStatusCodes: []int{http.StatusOK},\n\t\tUri: base.Uri{\n\t\t\tEntity: fmt.Sprintf(\"/users/%s/transitiveMemberOf\", id),\n\t\t\tParams: params,\n\t\t\tHasTenantId: true,\n\t\t},\n\t})\n\tif err != nil {\n\t\treturn nil, status, err\n\t}\n\tdefer resp.Body.Close()\n\trespBody, _ := ioutil.ReadAll(resp.Body)\n\tvar data struct {\n\t\tGroups []models.Group `json:\"value\"`\n\t}\n\tif err := json.Unmarshal(respBody, &data); err != nil {\n\t\treturn nil, status, err\n\t}\n\treturn &data.Groups, status, nil\n}", "func (m *GroupMembers) GetGroupMembers() []*User {\n\treturn m.Users\n}", "func ListProjects() error {\n\tclient, err := NewPacketClient()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tprojects, _, err := client.Projects.List()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\te := MarshallAndPrint(projects)\n\treturn e\n}", "func (p *Project) GetMembersId() []int {\n\tids, err := readProjectMembersId(p.Id)\n\tif err != nil {\n\t\tlog.Error(\"Error get project members\", err)\n\t\treturn nil\n\t}\n\tlog.Debug(\"proj members id:\", ids)\n\treturn ids\n}", "func (p *Project) GetMembersName() []string {\n\tnames, err := readProjectMembersName(p.Id)\n\tif err != nil {\n\t\tlog.Error(\"Error get project members\", err)\n\t\treturn nil\n\t}\n\tlog.Debug(\"proj members name:\", names)\n\treturn names\n}", "func ListProject(projectID string) error {\n\tclient, err := NewPacketClient()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tp, _, err := client.Projects.Get(projectID)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\te := MarshallAndPrint(p)\n\treturn e\n}", "func (b *Board) GetMembers(extraArgs ...Arguments) (members []*Member, err error) {\n\targs := flattenArguments(extraArgs)\n\tpath := fmt.Sprintf(\"boards/%s/members\", b.ID)\n\terr = b.client.Get(path, args, &members)\n\tfor i := range members {\n\t\tmembers[i].SetClient(b.client)\n\t}\n\treturn\n}", "func (g *Group) Members() ([]string, error) {\n\treturn groupMembers(g)\n}", "func (g *Group) Members() ([]string, error) {\n\treturn groupMembers(g)\n}", "func (c *Client) ClanMembers(tag string, params url.Values) (members ClanMemberList, err error) {\n\tvar b []byte\n\tpath := \"/clans/%23\" + strings.ToUpper(tag) + \"/members\"\n\tif b, err = c.get(path, params); err == nil {\n\t\terr = json.Unmarshal(b, &members)\n\t}\n\treturn\n}", "func (k *Keystone) ListProjectsAPI(c echo.Context) error {\n\tclusterID := c.Request().Header.Get(xClusterIDKey)\n\tif ke := getKeystoneEndpoints(clusterID, k.endpointStore); len(ke) > 0 {\n\t\treturn k.proxyRequest(c, ke)\n\t}\n\n\ttoken, err := k.validateToken(c.Request())\n\tif err != nil {\n\t\treturn err\n\t}\n\tconfigEndpoint, err := k.setAssignment(clusterID)\n\tif err != nil {\n\t\treturn err\n\t}\n\tuserProjects := []*keystone.Project{}\n\tuser := token.User\n\tprojects := k.Assignment.ListProjects()\n\tif configEndpoint == \"\" {\n\t\tfor _, project := range projects {\n\t\t\tfor _, role := range user.Roles {\n\t\t\t\tif role.Project.Name == project.Name {\n\t\t\t\t\tuserProjects = append(userProjects, role.Project)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t} else {\n\t\tuserProjects = append(userProjects, projects...)\n\t}\n\tprojectsResponse := &ProjectListResponse{\n\t\tProjects: userProjects,\n\t}\n\treturn c.JSON(http.StatusOK, projectsResponse)\n}", "func (a *Client) ListProjects(params *ListProjectsParams) (*ListProjectsOK, error) {\n\t// TODO: Validate the params before sending\n\tif params == nil {\n\t\tparams = NewListProjectsParams()\n\t}\n\n\tresult, err := a.transport.Submit(&runtime.ClientOperation{\n\t\tID: \"listProjects\",\n\t\tMethod: \"GET\",\n\t\tPathPattern: \"/projects\",\n\t\tProducesMediaTypes: []string{\"application/release-manager.v1+json\"},\n\t\tConsumesMediaTypes: []string{\"application/release-manager.v1+json\"},\n\t\tSchemes: []string{\"http\"},\n\t\tParams: params,\n\t\tReader: &ListProjectsReader{formats: a.formats},\n\t\tContext: params.Context,\n\t\tClient: params.HTTPClient,\n\t})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn result.(*ListProjectsOK), nil\n\n}", "func (client *Client) ListClusterMembers(request *ListClusterMembersRequest) (response *ListClusterMembersResponse, err error) {\n\tresponse = CreateListClusterMembersResponse()\n\terr = client.DoAction(request, response)\n\treturn\n}", "func (r *ProjectsGroupsService) List(name string) *ProjectsGroupsListCall {\n\tc := &ProjectsGroupsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}\n\tc.name = name\n\treturn c\n}", "func (p *ProjectHandler) ListProjects(ctx context.Context,\n\treq *proto.ListProjectsRequest, resp *proto.ListProjectsResponse) error {\n\tla := project.NewListAction(p.model)\n\tprojects, e := la.Do(ctx, req)\n\tif e != nil {\n\t\treturn e\n\t}\n\tauthUser, err := middleware.GetUserFromContext(ctx)\n\tif err == nil && authUser.Username != \"\" {\n\t\t// with username\n\t\t// 获取 project id, 用以获取对应的权限\n\t\tids := getProjectIDs(projects)\n\t\tperms, err := auth.ProjectIamClient.GetMultiProjectMultiActionPermission(\n\t\t\tauthUser.Username, ids,\n\t\t\t[]string{auth.ProjectCreate, auth.ProjectView, auth.ProjectEdit, auth.ProjectDelete},\n\t\t)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\t// 处理返回\n\t\tsetListPermsResp(resp, projects, perms)\n\t} else {\n\t\t// without username\n\t\tsetListPermsResp(resp, projects, nil)\n\t}\n\tif err := projutil.PatchBusinessName(resp.Data.Results); err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "func (repos *TestRepositories) ListProjects(ctx context.Context, owner string, repo string, opts *github.ProjectListOptions) ([]*github.Project, *github.Response, error) {\n\n\tvar resultProjects = make([]*github.Project, 3)\n\n\tnames := []string{\"Project 1\", \"Project 2\", \"Project 3\"}\n\tbodies := []string{\"This is a project\", \"This is a project\", \"This is a project\"}\n\n\tfor i, v := range []int{1, 2, 3} {\n\t\tresultProjects[i] = &github.Project{\n\t\t\tNumber: &v,\n\t\t\tName: &names[i],\n\t\t\tBody: &bodies[i],\n\t\t}\n\t}\n\n\treturn resultProjects, prepareGitHubAPIResponse(), nil\n\n}", "func (g *Gitlab) ListProjects(page int) (projects []*gitlab.Project, err error) {\n\n\topt := &gitlab.ListProjectsOptions{}\n\topt.ListOptions.Page = page\n\topt.ListOptions.PerPage = _defaultPerPage\n\n\tif projects, _, err = g.client.Projects.ListProjects(opt); err != nil {\n\t\terr = errors.Wrapf(err, \"ListProjects err(%+v)\", err)\n\t\treturn\n\t}\n\treturn\n}", "func (k *Keystone) ListAuthProjectsAPI(c echo.Context) error {\n\tclusterID := c.Request().Header.Get(xClusterIDKey)\n\tif ke := getKeystoneEndpoints(clusterID, k.endpointStore); len(ke) > 0 {\n\t\treturn k.proxyRequest(c)\n\t}\n\n\ttoken, err := k.validateToken(c.Request())\n\tif err != nil {\n\t\treturn err\n\t}\n\tconfigEndpoint, err := k.setAssignment(clusterID)\n\tif err != nil {\n\t\treturn err\n\t}\n\tuserProjects := []*keystone.Project{}\n\tuser := token.User\n\tprojects := k.Assignment.ListProjects()\n\tif configEndpoint == \"\" {\n\t\tfor _, project := range projects {\n\t\t\tfor _, role := range user.Roles {\n\t\t\t\tif role.Project.Name == project.Name {\n\t\t\t\t\tuserProjects = append(userProjects, role.Project)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t} else {\n\t\tuserProjects = append(userProjects, projects...)\n\t}\n\tprojectsResponse := &asfkeystone.ProjectListResponse{\n\t\tProjects: userProjects,\n\t}\n\treturn c.JSON(http.StatusOK, projectsResponse)\n}", "func (s *GroupsService) AllGroupMembers(ctx context.Context, groupName string) ([]*User, error) {\n\tp := []*User{}\n\topts := &PagingOptions{Limit: perPageLimit}\n\terr := allPages(opts, func() (*Paging, error) {\n\t\tlist, err := s.ListGroupMembers(ctx, groupName, opts)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tp = append(p, list.GetGroupMembers()...)\n\t\treturn &list.Paging, nil\n\t})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn p, nil\n}", "func (s *ProjectsService) ListProjects(opt *ProjectOptions) (*map[string]ProjectInfo, *Response, error) {\n\tu := \"projects/\"\n\n\tu, err := addOptions(u, opt)\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\n\tv := new(map[string]ProjectInfo)\n\tresp, err := s.client.Call(\"GET\", u, nil, v)\n\treturn v, resp, err\n}", "func (s *ProjectService) ListProjects(p *ListProjectsParams) (*ListProjectsResponse, error) {\n\tresp, err := s.cs.newRequest(\"listProjects\", p.toURLValues())\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar r ListProjectsResponse\n\tif err := json.Unmarshal(resp, &r); err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn &r, nil\n}", "func (t *TeamsService) ListProjects(teamID int) (*TeamProjectAssocListResponse, *simpleresty.Response, error) {\n\tvar result *TeamProjectAssocListResponse\n\turlStr := t.client.http.RequestURL(\"/team/%d/projects\", teamID)\n\n\t// Set the correct authentication header\n\tt.client.setAuthTokenHeader(t.client.accountAccessToken)\n\n\t// Execute the request\n\tresponse, getErr := t.client.http.Get(urlStr, &result, nil)\n\n\treturn result, response, getErr\n}", "func ListMemberPath(project string, expedition string, team string) string {\n\tparam0 := project\n\tparam1 := expedition\n\tparam2 := team\n\n\treturn fmt.Sprintf(\"/projects/@/%s/expeditions/@/%s/teams/@/%s/members\", param0, param1, param2)\n}", "func ListProjects(config *Config) error {\n\tgitlab := gogitlab.NewGitlab(config.Host, config.ApiPath, config.Token)\n\tprojects, err := gitlab.AllProjects()\n\tif err != nil {\n\t\treturn Mask(err)\n\t}\n\tfor _, p := range projects {\n\t\tif p.Archived {\n\t\t\tcontinue\n\t\t}\n\t\tfmt.Printf(\"%s\\n\", p.Name)\n\t}\n\treturn nil\n}", "func getGroupMembers(client *chef.Client, groupInfo chef.Group) []string {\n // TODO: Verify we are extracting the correct set of users\n\tmembers := usersFromGroups(client, groupInfo.Groups)\n\tmembers = append(members, groupInfo.Actors...)\n\tmembers = append(members, groupInfo.Users...)\n\tmembers = co.Unique(members)\n\treturn members\n}", "func (a *Client) GetOrganizationTeamMembers(params *GetOrganizationTeamMembersParams, authInfo runtime.ClientAuthInfoWriter) (*GetOrganizationTeamMembersOK, error) {\n\t// TODO: Validate the params before sending\n\tif params == nil {\n\t\tparams = NewGetOrganizationTeamMembersParams()\n\t}\n\n\tresult, err := a.transport.Submit(&runtime.ClientOperation{\n\t\tID: \"getOrganizationTeamMembers\",\n\t\tMethod: \"GET\",\n\t\tPathPattern: \"/api/v1/organization/{orgname}/team/{teamname}/members\",\n\t\tProducesMediaTypes: []string{\"application/json\"},\n\t\tConsumesMediaTypes: []string{\"application/json\"},\n\t\tSchemes: []string{\"https\"},\n\t\tParams: params,\n\t\tReader: &GetOrganizationTeamMembersReader{formats: a.formats},\n\t\tAuthInfo: authInfo,\n\t\tContext: params.Context,\n\t\tClient: params.HTTPClient,\n\t})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tsuccess, ok := result.(*GetOrganizationTeamMembersOK)\n\tif ok {\n\t\treturn success, nil\n\t}\n\t// unexpected success response\n\t// safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue\n\tmsg := fmt.Sprintf(\"unexpected success response for getOrganizationTeamMembers: API contract not enforced by server. Client expected to get an error, but got: %T\", result)\n\tpanic(msg)\n}", "func (client IdentityClient) listUserGroupMemberships(ctx context.Context, request common.OCIRequest, binaryReqBody *common.OCIReadSeekCloser, extraHeaders map[string]string) (common.OCIResponse, error) {\n\n\thttpRequest, err := request.HTTPRequest(http.MethodGet, \"/userGroupMemberships\", binaryReqBody, extraHeaders)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar response ListUserGroupMembershipsResponse\n\tvar httpResponse *http.Response\n\thttpResponse, err = client.Call(ctx, &httpRequest)\n\tdefer common.CloseBodyIfValid(httpResponse)\n\tresponse.RawResponse = httpResponse\n\tif err != nil {\n\t\treturn response, err\n\t}\n\n\terr = common.UnmarshalResponse(httpResponse, &response)\n\treturn response, err\n}", "func (k *Keystone) ListProjectsAPI(c echo.Context) error {\n\tclusterID := c.Request().Header.Get(xClusterIDKey)\n\tif ke := getKeystoneEndpoints(clusterID, k.endpointStore); len(ke) > 0 {\n\t\treturn k.proxyRequest(c)\n\t}\n\t_, err := k.validateToken(c.Request())\n\tif err != nil {\n\t\treturn err\n\t}\n\t_, err = k.setAssignment(clusterID)\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn c.JSON(http.StatusOK, &asfkeystone.ProjectListResponse{\n\t\tProjects: k.Assignment.ListProjects(),\n\t})\n}", "func (s *SyncStorage) GetMembers(ns string, group string) ([]string, error) {\n\tretVal, err := s.getDbBackend(ns).SMembers(getNsPrefix(ns) + group)\n\tif err != nil {\n\t\treturn []string{}, err\n\t}\n\treturn retVal, err\n}", "func (o *Organization) GetMembers(extraArgs ...Arguments) (members []*Member, err error) {\n\targs := flattenArguments(extraArgs)\n\tpath := fmt.Sprintf(\"organizations/%s/members\", o.ID)\n\terr = o.client.Get(path, args, &members)\n\tfor i := range members {\n\t\tmembers[i].SetClient(o.client)\n\t}\n\treturn\n}", "func (_BaseAccessControlGroup *BaseAccessControlGroupCaller) MembersList(opts *bind.CallOpts, arg0 *big.Int) (common.Address, error) {\n\tvar out []interface{}\n\terr := _BaseAccessControlGroup.contract.Call(opts, &out, \"membersList\", arg0)\n\n\tif err != nil {\n\t\treturn *new(common.Address), err\n\t}\n\n\tout0 := *abi.ConvertType(out[0], new(common.Address)).(*common.Address)\n\n\treturn out0, err\n\n}", "func (m *MockClient) ListOrgMembers(org, role string) ([]github.TeamMember, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"ListOrgMembers\", org, role)\n\tret0, _ := ret[0].([]github.TeamMember)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "func (o ServerGroupOutput) Members() pulumi.StringArrayOutput {\n\treturn o.ApplyT(func(v *ServerGroup) pulumi.StringArrayOutput { return v.Members }).(pulumi.StringArrayOutput)\n}", "func (m *MockOrganizationClient) ListOrgMembers(org, role string) ([]github.TeamMember, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"ListOrgMembers\", org, role)\n\tret0, _ := ret[0].([]github.TeamMember)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "func (c *Client) CloudProjectUsersList(projectID string) ([]types.CloudUser, error) {\n\tusers := []types.CloudUser{}\n\treturn users, c.Get(queryEscape(\"/cloud/project/%s/user\", projectID), &users)\n}", "func (v *IADsGroup) Members() (members *IADsMembers, err error) {\n\thr, _, _ := syscall.Syscall(\n\t\tuintptr(v.VTable().Members),\n\t\t2,\n\t\tuintptr(unsafe.Pointer(v)),\n\t\tuintptr(unsafe.Pointer(&members)),\n\t\t0)\n\tif hr != 0 {\n\t\treturn nil, convertHresultToError(hr)\n\t}\n\treturn\n}", "func (v *IADsGroup) Members() (members *IADsMembers, err error) {\n\thr, _, _ := syscall.Syscall(\n\t\tuintptr(v.VTable().Members),\n\t\t2,\n\t\tuintptr(unsafe.Pointer(v)),\n\t\tuintptr(unsafe.Pointer(&members)),\n\t\t0)\n\tif hr != 0 {\n\t\treturn nil, convertHresultToError(hr)\n\t}\n\treturn\n}", "func (s *ProjectsService) List(ctx context.Context, opts *PagingOptions) (*ProjectsList, error) {\n\tquery := addPaging(url.Values{}, opts)\n\treq, err := s.Client.NewRequest(ctx, http.MethodGet, newURI(projectsURI), WithQuery(query))\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"get projects request creation failed: %w\", err)\n\t}\n\tres, resp, err := s.Client.Do(req)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"list projects failed: %w\", err)\n\t}\n\n\tif resp != nil && resp.StatusCode == http.StatusNotFound {\n\t\treturn nil, ErrNotFound\n\t}\n\n\tif resp != nil && resp.StatusCode == http.StatusBadRequest {\n\t\treturn nil, fmt.Errorf(\"list projects failed: %s\", resp.Status)\n\t}\n\n\tp := &ProjectsList{\n\t\tProjects: []*Project{},\n\t}\n\tif err := json.Unmarshal(res, p); err != nil {\n\t\treturn nil, fmt.Errorf(\"list projects failed, unable to unmarshal repository list json: %w\", err)\n\t}\n\n\tfor _, r := range p.GetProjects() {\n\t\tr.Session.set(resp)\n\t}\n\n\treturn p, nil\n}", "func (o ProtectionGroupOutput) Members() pulumi.StringArrayOutput {\n\treturn o.ApplyT(func(v *ProtectionGroup) pulumi.StringArrayOutput { return v.Members }).(pulumi.StringArrayOutput)\n}", "func (e *EtcdBackoffAdapter) MemberList(ctx context.Context) (*clientv3.MemberListResponse, error) {\n\tctx, cancel := context.WithTimeout(ctx, e.Timeout)\n\tdefer cancel()\n\tvar response *clientv3.MemberListResponse\n\terr := wait.ExponentialBackoff(e.BackoffParams, func() (bool, error) {\n\t\tresp, err := e.EtcdClient.MemberList(ctx)\n\t\tif err != nil {\n\t\t\tLog.Info(\"failed to list etcd members\", \"etcd client error\", err)\n\t\t\treturn false, nil\n\t\t}\n\t\tresponse = resp\n\t\treturn true, nil\n\t})\n\treturn response, err\n}", "func (d *Driver) ProjectList() (*ProjectListResponse, error) {\n\tresponse := &ProjectListResponse{}\n\tlistProjects := project.NewListProjectsParams()\n\tresp, err := d.project.ListProjects(listProjects, d.auth)\n\tif err != nil {\n\t\treturn response, err\n\t}\n\tresponse.Project = resp.Payload\n\treturn response, nil\n}", "func AllListMembers(w http.ResponseWriter, r *http.Request) {\r\n\tvar listMembers []ListMember\r\n\r\n\tdb.Find(&listMembers)\r\n\tjson.NewEncoder(w).Encode(listMembers)\r\n\t// fmt.Fprintf(w, \"All listMembers Endpoint Hit\")\r\n}", "func NewGetGroupMembersListV1OK() *GetGroupMembersListV1OK {\n\treturn &GetGroupMembersListV1OK{}\n}", "func (s *TeamsService) ListTeamMembersByID(ctx context.Context, orgID, teamID int64, opts *TeamListTeamMembersOptions) ([]*User, *Response, error) {\n\tu := fmt.Sprintf(\"organizations/%v/team/%v/members\", orgID, teamID)\n\tu, err := addOptions(u, opts)\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\n\treq, err := s.client.NewRequest(\"GET\", u, nil)\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\n\tvar members []*User\n\tresp, err := s.client.Do(ctx, req, &members)\n\tif err != nil {\n\t\treturn nil, resp, err\n\t}\n\n\treturn members, resp, nil\n}", "func (m *OrganizationManager) Members(id string, opts ...RequestOption) (o *OrganizationMemberList, err error) {\n\terr = m.Request(\"GET\", m.URI(\"organizations\", id, \"members\"), &o, applyListDefaults(opts))\n\treturn\n}", "func (client IdentityClient) ListUserGroupMemberships(ctx context.Context, request ListUserGroupMembershipsRequest) (response ListUserGroupMembershipsResponse, err error) {\n\tvar ociResponse common.OCIResponse\n\tpolicy := common.NoRetryPolicy()\n\tif client.RetryPolicy() != nil {\n\t\tpolicy = *client.RetryPolicy()\n\t}\n\tif request.RetryPolicy() != nil {\n\t\tpolicy = *request.RetryPolicy()\n\t}\n\tociResponse, err = common.Retry(ctx, request, client.listUserGroupMemberships, policy)\n\tif err != nil {\n\t\tif ociResponse != nil {\n\t\t\tif httpResponse := ociResponse.HTTPResponse(); httpResponse != nil {\n\t\t\t\topcRequestId := httpResponse.Header.Get(\"opc-request-id\")\n\t\t\t\tresponse = ListUserGroupMembershipsResponse{RawResponse: httpResponse, OpcRequestId: &opcRequestId}\n\t\t\t} else {\n\t\t\t\tresponse = ListUserGroupMembershipsResponse{}\n\t\t\t}\n\t\t}\n\t\treturn\n\t}\n\tif convertedResponse, ok := ociResponse.(ListUserGroupMembershipsResponse); ok {\n\t\tresponse = convertedResponse\n\t} else {\n\t\terr = fmt.Errorf(\"failed to convert OCIResponse into ListUserGroupMembershipsResponse\")\n\t}\n\treturn\n}", "func (p *listDiscoveryPlugin) ListProjects(provider *gophercloud.ProviderClient, eo gophercloud.EndpointOpts, domainUUID string) ([]core.KeystoneProject, error) {\n\tclient, err := openstack.NewIdentityV3(provider, eo)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t//gophercloud does not support project listing yet - do it manually\n\turl := client.ServiceURL(\"projects\")\n\tvar opts struct {\n\t\tDomainUUID string `q:\"domain_id\"`\n\t}\n\topts.DomainUUID = domainUUID\n\tquery, err := gophercloud.BuildQueryString(opts)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\turl += query.String()\n\n\tvar result gophercloud.Result\n\t_, err = client.Get(url, &result.Body, nil)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar data struct {\n\t\tProjects []core.KeystoneProject `json:\"projects\"`\n\t}\n\terr = result.ExtractInto(&data)\n\treturn data.Projects, err\n}", "func (r *RoleCreate) GetMembers() []string {\n\treturn r.Members\n}", "func (m *Group) GetMembers()([]DirectoryObjectable) {\n return m.members\n}", "func (r *SpacesMembersService) List(parent string) *SpacesMembersListCall {\n\tc := &SpacesMembersListCall{s: r.s, urlParams_: make(gensupport.URLParams)}\n\tc.parent = parent\n\treturn c\n}", "func (r *LoggingRepository) List(ctx context.Context, teamID, userID string) ([]*model.Member, error) {\n\tstart := time.Now()\n\trecords, err := r.upstream.List(ctx, teamID, userID)\n\n\tlogger := r.logger.With().\n\t\tStr(\"request\", r.requestID(ctx)).\n\t\tStr(\"method\", \"list\").\n\t\tDur(\"duration\", time.Since(start)).\n\t\tStr(\"team\", teamID).\n\t\tStr(\"user\", userID).\n\t\tLogger()\n\n\tif err != nil {\n\t\tlogger.Warn().\n\t\t\tErr(err).\n\t\t\tMsg(\"failed to fetch members\")\n\t} else {\n\t\tlogger.Debug().\n\t\t\tMsg(\"\")\n\t}\n\n\treturn records, err\n}", "func (s *ProjectsService) ListProjects() ([]*Project, *Response, error) {\n\treq, err := s.client.NewRequest(\"GET\", \"projects\", nil)\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\tvar p []*Project\n\tresp, err := s.client.Do(req, &p)\n\tif err != nil {\n\t\treturn nil, resp, err\n\t}\n\treturn p, resp, err\n}", "func (c *ClientImpl) ListProject(ctx context.Context, hcpHostURL string) ([]hcpModels.Tenant, error) {\n\tspan, _ := opentracing.StartSpanFromContext(ctx, \"List HCP Projects\")\n\tdefer span.Finish()\n\n\tsession, err := c.getSession(ctx, hcpHostURL, hcpUserName, hcpPassword)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tstatus = Failure\n\tmonitor := metrics.StartExternalCall(externalSvcName, \"List Projects from HCP\")\n\tdefer func() { monitor.RecordWithStatus(status) }()\n\n\tresp, err := mlopsHttp.ExecuteHTTPRequest(\n\t\tctx,\n\t\tc.client,\n\t\thcpHostURL+projectPathV1,\n\t\thttp.MethodGet,\n\t\tmap[string]string{sessionHeader: session},\n\t\tbytes.NewReader(nil),\n\t)\n\tif err != nil {\n\t\treturn nil, errors.Wrapf(err, \"while fetching projects from MLOps controller platform.\")\n\t}\n\n\tstatus = Success\n\n\terr = c.deleteSession(ctx, hcpHostURL, session)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar tenants hcpModels.ListTenants\n\t_, parseRespErr := common.ParseResponse(resp, &tenants)\n\tif parseRespErr != nil {\n\t\tlog.Errorf(\"Failed to fetch projects from HCP: %v\", parseRespErr)\n\t\treturn nil, errors.Wrapf(parseRespErr, \"Failed to fetch projects from HCP\")\n\t}\n\n\t// filter only ML projects\n\tvar mlProjects []hcpModels.Tenant\n\tfor _, tenant := range tenants.Embedded.Tenants {\n\t\tif tenant.Features.MlProject {\n\t\t\tmlProjects = append(mlProjects, tenant)\n\t\t}\n\t}\n\treturn mlProjects, nil\n}", "func (g *projectGateway) ListProjectsAction(params project.ListProjectsParams) middleware.Responder {\n\tlistRsp, err := g.projectClient.List(context.TODO(), &proto.ListRequest{})\n\n\tif err != nil {\n\t\tfmt.Println(err)\n\t\treturn project.NewCreateProjectInternalServerError()\n\t}\n\n\tvar projects = []*models.Project{}\n\tfor _, listResp := range listRsp.Projects {\n\t\tp := &models.Project{\n\t\t\tUUID: strfmt.UUID(listResp.Uuid),\n\t\t\tName: listResp.Name,\n\t\t\tDescription: listResp.Description,\n\t\t}\n\t\tprojects = append(projects, p)\n\t}\n\n\treturn project.NewListProjectsOK().WithPayload(projects)\n}", "func (k *Keybase) ListUserMemberships(user string) (TeamAPI, error) {\n\tm := TeamAPI{\n\t\tParams: &tParams{},\n\t}\n\tm.Method = \"list-user-memberships\"\n\tm.Params.Options.Username = user\n\n\tr, err := teamAPIOut(k, m)\n\treturn r, err\n}", "func (p *ProjectProvider) List(options *provider.ProjectListOptions) ([]*kubermaticapiv1.Project, error) {\n\tif options == nil {\n\t\toptions = &provider.ProjectListOptions{}\n\t}\n\tprojects := &kubermaticapiv1.ProjectList{}\n\tif err := p.clientPrivileged.List(context.Background(), projects); err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar ret []*kubermaticapiv1.Project\n\tfor _, project := range projects.Items {\n\t\tif len(options.ProjectName) > 0 && project.Spec.Name != options.ProjectName {\n\t\t\tcontinue\n\t\t}\n\t\tif len(options.OwnerUID) > 0 {\n\t\t\towners := project.GetOwnerReferences()\n\t\t\tfor _, owner := range owners {\n\t\t\t\tif owner.UID == options.OwnerUID {\n\t\t\t\t\tret = append(ret, project.DeepCopy())\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t}\n\t\t\tcontinue\n\t\t}\n\n\t\tret = append(ret, project.DeepCopy())\n\t}\n\n\t// Filter out restricted labels\n\tfor i, project := range ret {\n\t\tproject.Labels = label.FilterLabels(label.ClusterResourceType, project.Labels)\n\t\tret[i] = project\n\t}\n\n\treturn ret, nil\n}", "func (h *TerminalValidator) canManageProjectMembers(ctx context.Context, userInfo authenticationv1.UserInfo, namespace string) (bool, error) {\n\tproject, err := gardenclient.GetProjectByNamespace(ctx, h.client, namespace)\n\tif err != nil {\n\t\treturn false, err\n\t}\n\n\treturn h.canManageProjectMembersAccessReview(ctx, userInfo, *project)\n}", "func (r *UserRolePermissionGroupsService) List(profileId int64) *UserRolePermissionGroupsListCall {\n\tc := &UserRolePermissionGroupsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}\n\tc.profileId = profileId\n\treturn c\n}", "func ProjectListUsers(w http.ResponseWriter, r *http.Request) {\n\n\tvar err error\n\tvar pageSize int\n\tvar paginatedUsers auth.PaginatedUsers\n\n\t// Init output\n\toutput := []byte(\"\")\n\n\t// Add content type header to the response\n\tcontentType := \"application/json\"\n\tcharset := \"utf-8\"\n\tw.Header().Add(\"Content-Type\", fmt.Sprintf(\"%s; charset=%s\", contentType, charset))\n\n\t// Grab context references\n\trefStr := gorillaContext.Get(r, \"str\").(stores.Store)\n\trefRoles := gorillaContext.Get(r, \"auth_roles\").([]string)\n\tprojectUUID := gorillaContext.Get(r, \"auth_project_uuid\").(string)\n\n\t// Grab url path variables\n\turlValues := r.URL.Query()\n\tpageToken := urlValues.Get(\"pageToken\")\n\tstrPageSize := urlValues.Get(\"pageSize\")\n\n\tif strPageSize != \"\" {\n\t\tif pageSize, err = strconv.Atoi(strPageSize); err != nil {\n\t\t\tlog.Errorf(\"Pagesize %v produced an error while being converted to int: %v\", strPageSize, err.Error())\n\t\t\terr := APIErrorInvalidData(\"Invalid page size\")\n\t\t\trespondErr(w, err)\n\t\t\treturn\n\t\t}\n\t}\n\n\t// check that user is indeed a service admin in order to be priviledged to see full user info\n\tpriviledged := auth.IsServiceAdmin(refRoles)\n\n\t// Get Results Object - call is always priviledged because this handler is only accessible by service admins\n\tif paginatedUsers, err = auth.PaginatedFindUsers(pageToken, int32(pageSize), projectUUID, priviledged, refStr); err != nil {\n\t\terr := APIErrorInvalidData(\"Invalid page token\")\n\t\trespondErr(w, err)\n\t\treturn\n\t}\n\n\t// Output result to JSON\n\tresJSON, err := paginatedUsers.ExportJSON()\n\n\tif err != nil {\n\t\terr := APIErrExportJSON()\n\t\trespondErr(w, err)\n\t\treturn\n\t}\n\n\t// Write response\n\toutput = []byte(resJSON)\n\trespondOK(w, output)\n\n}", "func TeamList(ctx context.Context, w http.ResponseWriter, req *http.Request) error {\n\tvar user = ctx.Value(UserKey).(*dash.User)\n\n\tjson.NewEncoder(w).Encode(teamListResponse{\n\t\tStatus: \"success\",\n\t\tTeams: user.TeamMemberships,\n\t})\n\treturn nil\n}", "func (a *Client) PostProjectsProjectIDMembers(params *PostProjectsProjectIDMembersParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PostProjectsProjectIDMembersCreated, error) {\n\t// TODO: Validate the params before sending\n\tif params == nil {\n\t\tparams = NewPostProjectsProjectIDMembersParams()\n\t}\n\top := &runtime.ClientOperation{\n\t\tID: \"PostProjectsProjectIDMembers\",\n\t\tMethod: \"POST\",\n\t\tPathPattern: \"/projects/{project_id}/members\",\n\t\tProducesMediaTypes: []string{\"application/json\", \"text/plain\"},\n\t\tConsumesMediaTypes: []string{\"application/json\"},\n\t\tSchemes: []string{\"http\", \"https\"},\n\t\tParams: params,\n\t\tReader: &PostProjectsProjectIDMembersReader{formats: a.formats},\n\t\tAuthInfo: authInfo,\n\t\tContext: params.Context,\n\t\tClient: params.HTTPClient,\n\t}\n\tfor _, opt := range opts {\n\t\topt(op)\n\t}\n\n\tresult, err := a.transport.Submit(op)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tsuccess, ok := result.(*PostProjectsProjectIDMembersCreated)\n\tif ok {\n\t\treturn success, nil\n\t}\n\t// unexpected success response\n\t// safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue\n\tmsg := fmt.Sprintf(\"unexpected success response for PostProjectsProjectIDMembers: API contract not enforced by server. Client expected to get an error, but got: %T\", result)\n\tpanic(msg)\n}", "func (e *BcsDataManager) GetAllProjectList(ctx context.Context,\n\treq *bcsdatamanager.GetAllProjectListRequest, rsp *bcsdatamanager.GetAllProjectListResponse) error {\n\tblog.Infof(\"Received GetAllProjectList.Call request. Dimension:%s, page:%d, size:%d, startTime=%s, endTime=%s\",\n\t\treq.GetDimension(), req.Page, req.Size, time.Unix(req.GetStartTime(), 0),\n\t\ttime.Unix(req.GetEndTime(), 0))\n\tstart := time.Now()\n\tresult, total, err := e.model.GetProjectList(ctx, req)\n\tif err != nil {\n\t\trsp.Message = fmt.Sprintf(\"get project list error: %v\", err)\n\t\trsp.Code = bcsCommon.AdditionErrorCode + 500\n\t\tblog.Errorf(rsp.Message)\n\t\tprom.ReportAPIRequestMetric(\"GetAllProjectList\", \"grpc\", prom.StatusErr, start)\n\t\treturn nil\n\t}\n\trsp.Data = result\n\trsp.Message = bcsCommon.BcsSuccessStr\n\trsp.Code = bcsCommon.BcsSuccess\n\trsp.Total = uint32(total)\n\tprom.ReportAPIRequestMetric(\"GetAllProjectList\", \"grpc\", prom.StatusOK, start)\n\treturn nil\n}", "func (t *Team) GetMembersCount() int {\n\tif t == nil || t.MembersCount == nil {\n\t\treturn 0\n\t}\n\treturn *t.MembersCount\n}", "func (r *RoleUpdate) GetMembers() []string {\n\treturn r.Members\n}", "func (st *API) UserGroupList(ctx context.Context) ([]UserGroup, error) {\n\terr := checkPermission(ctx, \"bot\", \"usergroups:read\")\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tst.mx.Lock()\n\tdefer st.mx.Unlock()\n\n\tids := make([]string, 0, len(st.usergroups))\n\tfor id := range st.usergroups {\n\t\tids = append(ids, id)\n\t}\n\tsort.Strings(ids)\n\n\tresult := make([]UserGroup, 0, len(ids))\n\tfor _, id := range ids {\n\t\tch := st.usergroups[id]\n\t\tresult = append(result, ch.UserGroup)\n\t}\n\n\treturn result, nil\n}", "func (s *TeamsService) ListTeamMembersBySlug(ctx context.Context, org, slug string, opts *TeamListTeamMembersOptions) ([]*User, *Response, error) {\n\tu := fmt.Sprintf(\"orgs/%v/teams/%v/members\", org, slug)\n\tu, err := addOptions(u, opts)\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\n\treq, err := s.client.NewRequest(\"GET\", u, nil)\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\n\tvar members []*User\n\tresp, err := s.client.Do(ctx, req, &members)\n\tif err != nil {\n\t\treturn nil, resp, err\n\t}\n\n\treturn members, resp, nil\n}", "func (c *EtcdGroupService) GroupCountMembers(ctx context.Context, groupName string) (int, error) {\n\tctxT, cancel := context.WithTimeout(ctx, transactionTimeout)\n\tdefer cancel()\n\tetcdRes, err := clientInstance.Get(ctxT, memberKey(groupName, \"\"), clientv3.WithPrefix(), clientv3.WithCountOnly())\n\tif err != nil {\n\t\treturn 0, err\n\t}\n\treturn int(etcdRes.Count), nil\n}", "func (g *Gitlab) ListProjectJobs(projID, page int) (jobs []gitlab.Job, resp *gitlab.Response, err error) {\n\tvar opt = &gitlab.ListJobsOptions{}\n\topt.Page = page\n\t// perPage max is 100\n\topt.PerPage = _maxPerPage\n\n\tif jobs, resp, err = g.client.Jobs.ListProjectJobs(projID, opt); err != nil {\n\t\terr = errors.Wrapf(err, \"ListProjectJobs projectId(%d), err(%+v)\", projID, err)\n\t\treturn\n\t}\n\treturn\n}" ]
[ "0.80967855", "0.7313049", "0.7201911", "0.68773246", "0.6580697", "0.65603346", "0.6559878", "0.6554985", "0.65114266", "0.64982545", "0.64100695", "0.6392216", "0.6206373", "0.6203927", "0.61835086", "0.61619246", "0.61165816", "0.6056603", "0.6055609", "0.6034577", "0.59942657", "0.59925485", "0.5969709", "0.59319466", "0.58564115", "0.5855145", "0.5842561", "0.5824287", "0.58181894", "0.5817513", "0.57961285", "0.57776356", "0.5763244", "0.57430315", "0.57341737", "0.5730773", "0.5727654", "0.5712558", "0.5706139", "0.56890434", "0.56890434", "0.56845826", "0.56762743", "0.5673858", "0.5660578", "0.5653089", "0.5639001", "0.56383145", "0.5627145", "0.56102324", "0.5607367", "0.5586908", "0.55798185", "0.5561645", "0.55401844", "0.55195016", "0.55137324", "0.5508021", "0.55031526", "0.550103", "0.5488145", "0.547286", "0.5469006", "0.5445238", "0.5442832", "0.5427877", "0.5419185", "0.5415126", "0.5415126", "0.5406244", "0.54012537", "0.53876066", "0.53678304", "0.5355628", "0.5344053", "0.5340559", "0.53352934", "0.53351676", "0.532306", "0.5316919", "0.5314623", "0.53034467", "0.5294463", "0.52894825", "0.52854955", "0.5271392", "0.5269497", "0.5259796", "0.52596265", "0.52466", "0.5242853", "0.52353245", "0.5221171", "0.51963073", "0.51959205", "0.51878345", "0.5182638", "0.5172323", "0.516414", "0.51563376" ]
0.71515566
3
CurrentUser gets currently authenticated user. GitLab API docs:
func (g *Client) CurrentUser() (*User, error) { path := getUrl([]string{"user"}) req, _ := http.NewRequest("GET", path, nil) var ret *User if _, err := g.Do(req, &ret); err != nil { return nil, err } return ret, nil }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func CurrentUser(client client.Client) (User, error) {\n\tuser := User{}\n\tres, err := client.PerformAction(\"user\", \"current\", map[string]string{}, nil)\n\tif err != nil {\n\t\treturn user, fmt.Errorf(\"Error: Could not get current user! \\n%s\", err.Error())\n\t}\n\tif res.StatusCode > 299 {\n\t\tbody, err := ioutil.ReadAll(res.Body)\n\t\tif err != nil {\n\t\t\treturn user, err\n\t\t}\n\t\treturn user, fmt.Errorf(\"Unexpected HTTP status: %d\\n%s\\n\", res.StatusCode, string(body))\n\t}\n\tdefer res.Body.Close()\n\tres.Unmarshal(&user)\n\treturn user, nil\n}", "func (mc *MonitaClient) CurrentUser() (*user.CurrentUserResponse, error) {\n\tres, err := mc.request(\"GET\", \"v1/user\", nil, &user.CurrentUserResponse{}, 200)\n\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tresult, _ := res.(*user.CurrentUserResponse)\n\n\treturn result, nil\n}", "func (i *interactor) CurrentUser(ctx context.Context) (api.UserInfo, error) {\n\treturn server.GetUserInfo(ctx)\n}", "func (s *UsersService) CurrentUser() (*User, *Response, error) {\n\treq, err := s.client.NewRequest(\"GET\", \"users/me\", nil)\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\tusr := new(User)\n\tresp, err := s.client.Do(req, usr)\n\tif err != nil {\n\t\treturn nil, resp, err\n\t}\n\n\treturn usr, resp, err\n}", "func GetCurrentUser(c *gin.Context) {\n\tuser := middleware.GetCurrentUser(c)\n\tif user == nil {\n\t\tc.AbortWithStatus(http.StatusUnauthorized)\n\t\treturn\n\t}\n\n\tc.JSON(http.StatusOK, user)\n}", "func (c *Client) CurrentUser(userID uint64) (user *User, err error) {\n\n\t// No current user\n\tif userID == 0 {\n\t\terr = c.createError(fmt.Sprintf(\"missing required attribute: %s\", fieldID), http.StatusBadRequest)\n\t\treturn\n\t}\n\n\t// Fire the Request\n\tvar response string\n\tif response, err = c.Request(fmt.Sprintf(\"%s/account?id=%d\", modelUser, userID), http.MethodGet, nil); err != nil {\n\t\treturn\n\t}\n\n\t// Only a 200 is treated as a success\n\tif err = c.Error(http.StatusOK, response); err != nil {\n\t\treturn\n\t}\n\n\t// Convert model response\n\tif err = json.Unmarshal([]byte(response), &user); err != nil {\n\t\terr = c.createError(fmt.Sprintf(\"failed unmarshaling data: %s\", \"user\"), http.StatusExpectationFailed)\n\t}\n\treturn\n}", "func (client *Client) CurrentUser() string {\n\treturn client.currentUser\n}", "func getCurrentUser(c context.Context) (*user.User, error) {\n\tu, err := endpoints.CurrentUser(c, scopes, audiences, clientIds)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif u == nil {\n\t\treturn nil, errors.New(\"Unauthorized: Please, sign in.\")\n\t}\n\t//c.Value(\"Current user: %#v\", u)\n\t//\tc.Debugf(\"Current user: %#v\", u)\n\tc.Done()\n\treturn u, nil\n}", "func GetCurrentUser(e Executor) (*User, error) {\n\treq, _ := http.NewRequest(\"GET\", RexBaseURL+apiCurrentUser, nil)\n\n\tresp, err := e.Execute(req)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer func() {\n\t\tio.Copy(ioutil.Discard, resp.Body)\n\t}()\n\n\tbody, err := ioutil.ReadAll(resp.Body)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar u User\n\terr = json.Unmarshal(body, &u)\n\tu.SelfLink = u.Links.User.Href // assign self link\n\treturn &u, err\n}", "func (env *Env) currentUser(r *http.Request) (*models.User, error) {\n\ts, err := env.session(r)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif s.UserID == 0 {\n\t\treturn nil, errors.New(\"user not logged in\")\n\t}\n\n\treturn env.db.GetUser(s.UserID)\n}", "func CurrentUser(c *gin.Context) {\n\tsession := sessions.Default(c)\n\tuserID := session.Get(\"userID\")\n\tif userID == nil {\n\t\tc.JSON(http.StatusOK, gin.H{\n\t\t\t\"msg\": \"User not logged in.\",\n\t\t\t\"err\": \"User ID not in session.\",\n\t\t})\n\t} else {\n\t\tc.JSON(http.StatusOK, gin.H{\n\t\t\t\"msg\": session.Get(\"Username\"),\n\t\t\t\"err\": \"\",\n\t\t})\n\t}\n}", "func (c *anypointClient) GetCurrentUser() (*User, error) {\n\treturn c.getCurrentUser(c.auth.GetToken())\n}", "func CurrentUser(ctx context.Context) (User, error) {\n\tif user, ok := ctx.Value(UserContextKey).(User); ok {\n\t\treturn user, nil\n\t}\n\n\treturn User{}, ErrBadTypeAssertion\n}", "func (g *GlobalContext) CurrentUser() (*keybase1.User, error) {\n\tconfigCli, err := client.GetConfigClient(libkb.G)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tcurrentStatus, err := configCli.GetCurrentStatus(context.TODO(), 0)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tif !currentStatus.LoggedIn {\n\t\treturn nil, fmt.Errorf(\"Please login to Keybase before using Secrets. You can do this by issuing the command `keybase login`\")\n\t}\n\n\tmyUID := currentStatus.User.Uid\n\n\tuserCli, err := client.GetUserClient(libkb.G)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tme, err := userCli.LoadUser(context.TODO(), keybase1.LoadUserArg{Uid: myUID})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn &me, nil\n}", "func getCurrentUser() {\n\tvar URL *url.URL\n\tURL, err := url.Parse(\"https://api.spotify.com\")\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tURL.Path += \"v1/me\"\n\n\tclient := &http.Client{}\n\treq, err := http.NewRequest(\"GET\", URL.String(), nil)\n\treq.Header.Set(\"Accept\", \"application/json\")\n\treq.Header.Set(\"Content-Type\", \"application/json\")\n\treq.Header.Set(\"Authorization\", \"Bearer \"+sAcsTok.AccessToken)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\tresp, err := client.Do(req)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\tbody, err := ioutil.ReadAll(resp.Body)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\terr = json.Unmarshal(body, &sCurrentUser)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tfmt.Println()\n\tfmt.Println(\"User Information:\")\n\tfmt.Printf(\"\\t:User Name: %s\\n\", sCurrentUser.DisplayName)\n\tfmt.Printf(\"\\t:User ID: %s\\n\", sCurrentUser.UserID)\n\tfmt.Printf(\"\\t:User account type: %s\\n\", sCurrentUser.AccountLevel)\n\n\tdefer resp.Body.Close()\n}", "func (a *UserAPI) GetCurrentUser(ctx *gin.Context) {\n\tuser := a.DB.GetUserByID(auth.GetUserID(ctx))\n\tctx.JSON(200, toExternal(user))\n}", "func (c *anypointClient) getCurrentUser(token string) (*User, error) {\n\theaders := map[string]string{\n\t\t\"Authorization\": \"Bearer \" + token,\n\t}\n\n\trequest := coreapi.Request{\n\t\tMethod: coreapi.GET,\n\t\tURL: c.baseURL + \"/accounts/api/me\",\n\t\tHeaders: headers,\n\t}\n\n\tvar user CurrentUser\n\terr := c.invokeJSON(request, &user)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn &user.User, nil\n}", "func (c *Config) GetCurrentUser(w http.ResponseWriter, r *http.Request) {\n\tu := middleware.UserFromContext(r.Context())\n\tbjson.WriteJSON(w, u, http.StatusOK)\n}", "func (c *APIClient) GetCurrentUser() (*models.User, error) {\n\tvar user models.User\n\n\tresponse, err := c.getJSON(\"/api/user\", &user)\n\n\t// We are not authenticated\n\tif response != nil && response.StatusCode == http.StatusForbidden {\n\t\treturn nil, nil\n\t}\n\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn &user, nil\n}", "func CurrentUser(c *gin.Context) *models.User {\n\tvar user models.User\n\tsession := sessions.Default(c)\n\tcurrentUserID := session.Get(\"user_id\")\n\n\tif currentUserID == nil {\n\t\treturn nil\n\t} else if err := config.DB.First(&user, currentUserID).Error; err != nil {\n\t\treturn nil\n\t}\n\n\treturn &user\n}", "func (ac *AuthContext) CurrentUser() (*models.User, error) {\n\tsession, _ := ac.session.GetSession()\n\tuserId := session.Values[\"user_id\"]\n\n\tif userId == nil {\n\t\treturn nil, errors.New(\"No current user.\")\n\t}\n\n\tuser := &models.User{}\n\tif err := user.SelectId(userId.(int)); err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn user, nil\n}", "func CurrentUser(r *http.Request) models.User {\n\tidentity := tokenware.CurrentIdentity(r)\n\n\tif identity != nil {\n\t\t// Identity was found! get user model and add token\n\t\tuser, _ := models.GetUser(identity.(string))\n\n\t\t// Ignore error, if this function fails there is no way we got here\n\t\ttoken, _ := tokenware.GetRawToken(r)\n\t\tuser.Token = token\n\t\treturn user\n\t}\n\n\t// No identity found, return empty user\n\t// We don't return an error because in this situation it isn't an error\n\t// in the context of tokenware.Required() the identity is always added\n\t// in the context of tokenware.Optional() the identity is expected to sometimes be blank\n\n\treturn models.User{}\n}", "func GetCurrent(r *http.Request) (*User, error) {\n\tun, pass, _ := r.BasicAuth()\n\tu := &User{\n\t\tUsername: un,\n\t\tPassword: pass,\n\t}\n\tif u.Username == os.Getenv(\"REGISTRY_ADMIN_USER\") && u.Password == os.Getenv(\"REGISTRY_ADMIN_PASS\") {\n\t\tu.Admin = true\n\t\treturn u, nil\n\t}\n\tu.Username = strings.ToLower(u.Username)\n\tauth, aerr := u.Authenticated()\n\tif aerr != nil {\n\t\treturn u, aerr\n\t}\n\tif !auth {\n\t\treturn u, errors.New(http.StatusText(http.StatusUnauthorized))\n\t}\n\terr := u.Get()\n\tif err != nil {\n\t\treturn u, err\n\t}\n\treturn u, nil\n}", "func (c MethodsCollection) CurrentUser() pCurrentUser {\n\treturn pCurrentUser{\n\t\tMethod: c.MustGet(\"CurrentUser\"),\n\t}\n}", "func GetCurrentUser(ctx context.Context) string {\n\treturn ctx.Value(userIdKey).(string)\n}", "func GetCurrentUserByGit() string { return cgitUser }", "func (a *App) CurrentUser() dapp.Identity {\n\treturn dapp.CurrentUser(a.ID)\n}", "func GetCurrentUser(r *http.Request, ctx *handlers.Context) *users.User {\r\n\tsessionState := &handlers.SessionState{}\r\n\t_, err := sessions.GetState(r, ctx.SessionKey, ctx.SessionStore, sessionState)\r\n\tif err != nil {\r\n\t\tfmt.Printf(\"Error cannot get session state: \"+err.Error(), http.StatusUnauthorized)\r\n\t}\r\n\tsessionUser := sessionState.User\r\n\treturn sessionUser\r\n}", "func (s *UsersService) GetCurrent() (*User, error) {\n\tvar data User\n\terr := s.client.get(\"/users/me\", map[string]string{}, nil, &data)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &data, err\n}", "func Current() (*User, error) {\n\treturn current()\n}", "func GetCurrentUser(ctx context.Context) (graphrbac.AADObject, error) {\n\tobjClient := getObjectsClient()\n\treturn objClient.GetCurrentUser(ctx)\n}", "func (c *Client) GetAccountCurrentUser(ctx context.Context) (*Account, error) {\n\tvar account Account\n\terr := c.doAPI(ctx, http.MethodGet, \"/api/v1/accounts/verify_credentials\", nil, &account, nil)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &account, nil\n}", "func GetCurrentPulumiUser() (string, error) {\n\toutput, err := utils.RunCommand(\"pulumi\", []string{\"whoami\"})\n\tif err != nil {\n\t\treturn \"\", fmt.Errorf(\"Couldn't successfully authenticate the Pulumi user\")\n\t}\n\n\treturn strings.TrimSpace(output), nil\n}", "func Current(c context.Context) *User {\n\th := internal.IncomingHeaders(c)\n\tu := &User{\n\t\tEmail: h.Get(\"X-AppEngine-User-Email\"),\n\t\tAuthDomain: h.Get(\"X-AppEngine-Auth-Domain\"),\n\t\tID: h.Get(\"X-AppEngine-User-Id\"),\n\t\tAdmin: h.Get(\"X-AppEngine-User-Is-Admin\") == \"1\",\n\t\tFederatedIdentity: h.Get(\"X-AppEngine-Federated-Identity\"),\n\t\tFederatedProvider: h.Get(\"X-AppEngine-Federated-Provider\"),\n\t}\n\tif u.Email == \"\" && u.FederatedIdentity == \"\" {\n\t\treturn nil\n\t}\n\treturn u\n}", "func GetUserCurrent(baseURL string) {\n\ttargetURL := baseURL + \"/current\"\n\tfmt.Println(\"==> GET\", targetURL)\n\n\t// Read beegosessionID from .cookie.yaml\n\tc, err := utils.CookieLoad()\n\tif err != nil {\n\t\tfmt.Println(\"error:\", err)\n\t\treturn\n\t}\n\n\tutils.Request.Get(targetURL).\n\t\tSet(\"Cookie\", \"harbor-lang=zh-cn; beegosessionID=\"+c.BeegosessionID).\n\t\t// NOTE:\n\t\t// 若后续需要根据用户权限做文章,则需要将用户信息进行维护\n\t\t// 可以定制一个新的回调函数\n\t\tEnd(utils.PrintStatus)\n}", "func GetCurrentUser() (string, error) {\n\tu, err := user.Current()\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\treturn u.Username, err\n}", "func GetCurrentUser(t *testing.T) *user.User {\n\tuser, err := user.Current()\n\tif err != nil {\n\t\tt.Fatal(\"Expectd to fetch the current user but received an error\", err)\n\t}\n\treturn user\n}", "func (s UserSet) CurrentUser() m.UserSet {\n\tres := s.Collection().Call(\"CurrentUser\")\n\tresTyped, _ := res.(m.UserSet)\n\treturn resTyped\n}", "func (g *GitLab) Me() (ret User, err error) {\n\turi := g.uri(\"/user\", nil)\n\tresp, _, err := g.get(uri, nil)\n\terr = forgeRet(resp, &ret, err)\n\treturn\n}", "func GetUser(c *gin.Context) *models.User {\n\tuser, _, _ := cookies.CurrentUser(c)\n\tif user == nil {\n\t\treturn &models.User{}\n\t}\n\treturn user\n}", "func CurrentUsername(r *kite.Request) (interface{}, error) {\n\tu, err := currentLookup()\n\tif err != nil {\n\t\tr.LocalKite.Log.Error(\"Current user lookup failed. err:%s\", err)\n\t\treturn nil, err\n\t}\n\n\treturn u.Username, nil\n}", "func parseCurrentUser(r *http.Request) string {\n\tclaims := utilities.GetClaims(\n\t\tr.Header.Get(\"Authorization\")[len(\"Bearer \"):])\n\treturn fmt.Sprintf(\"%v\", claims[\"user_id\"])\n}", "func (c *Client) GetUser() (*User, error) {\n\treq, err := c.getRequest(\"/users/current.json\", \"\")\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar userResponse UserAPIResponse\n\t_, err = c.Do(req, &userResponse)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn &(userResponse.User), nil\n}", "func CurrentUserAsRequested(repo *repositories.UsersRepository, responseService responses.ResponseHandler) gin.HandlerFunc {\n\treturn func(ctx *gin.Context) {\n\t\tuser, ok := ctx.Get(\"_user\")\n\t\tif !ok {\n\t\t\t// Returns a \"400 StatusBadRequest\" response\n\t\t\tresponseService.Error(ctx, responses.CannotFindUserByAccessToken, \"Can't find user.\")\n\t\t\treturn\n\t\t}\n\n\t\tfoundUser, err := repo.FindByUID(user.(*userpb.User).UID)\n\t\tif err != nil {\n\t\t\tresponseService.NotFound(ctx)\n\t\t\tctx.Abort()\n\t\t\treturn\n\t\t}\n\t\tctx.Set(\"_requested_user\", foundUser)\n\t}\n}", "func (obj *Global) GetAuthenticatedUser(ctx context.Context) (string, error) {\n\tresult := &struct {\n\t\tReturn string `json:\"qReturn\"`\n\t}{}\n\terr := obj.RPC(ctx, \"GetAuthenticatedUser\", result)\n\treturn result.Return, err\n}", "func (ctx *Context) User() interface{} {\n\treturn ctx.UserValue[\"user\"]\n}", "func CurrentUsername() string {\n\tusername := os.Getenv(\"USER\")\n\tif len(username) > 0 {\n\t\treturn username\n\t}\n\n\tusername = os.Getenv(\"USERNAME\")\n\tif len(username) > 0 {\n\t\treturn username\n\t}\n\n\tif user, err := user.Current(); err == nil {\n\t\tusername = user.Username\n\t}\n\treturn username\n}", "func (i *interactor) CurrentUserID(ctx context.Context) (string, error) {\n\tu, err := i.CurrentUser(ctx)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\treturn u.ID(), nil\n}", "func GetCurrentUser(inputUser string) (string, error) {\n\tu, err := user.Current()\n\tif err == nil {\n\t\t//Only root could specify a filter username\n\t\tif u.Username == \"root\" {\n\t\t\tif inputUser == \"\" {\n\t\t\t\treturn \"\", nil\n\t\t\t} else {\n\t\t\t\treturn inputUser, nil\n\t\t\t}\n\t\t} else {\n\t\t\tif inputUser != \"\" {\n\t\t\t\tvar err = errors.New(\"Only root could specify -u user!\")\n\t\t\t\treturn \"\", err\n\t\t\t} else {\n\t\t\t\treturn u.Username, nil\n\t\t\t}\n\t\t}\n\t}\n\treturn \"\", err\n}", "func CurrentUserMiddleware(resolver *graph.Resolver, next http.Handler) http.Handler {\n\treturn http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n\t\tauthHeaderParts := strings.Split(r.Header.Get(\"Authorization\"), \" \")\n\n\t\tif len(authHeaderParts) < 2 {\n\t\t\tpanic(\"Authentication token missing\")\n\t\t}\n\n\t\ttokenString := authHeaderParts[1]\n\n\t\tif tokenString == \"\" {\n\t\t\tpanic(\"Authentication token missing\")\n\t\t}\n\n\t\ttoken, err := jwt.ParseWithClaims(tokenString, jwt.MapClaims{}, func(token *jwt.Token) (interface{}, error) {\n\t\t\tcert, err := getPemCert(token)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\n\t\t\tresult, _ := jwt.ParseRSAPublicKeyFromPEM([]byte(cert))\n\t\t\treturn result, nil\n\t\t})\n\n\t\tif err != nil {\n\t\t\tfmt.Println(\"Failed to parse with claims\")\n\t\t}\n\n\t\treq := r\n\t\tif token != nil {\n\t\t\tuserID := token.Claims.(jwt.MapClaims)[\"sub\"]\n\t\t\tresolver.UserID = userID.(string)\n\n\t\t\tctx := context.WithValue(r.Context(), userIdKey, userID)\n\t\t\treq = r.WithContext(ctx)\n\t\t}\n\n\t\tnext.ServeHTTP(w, req)\n\t})\n}", "func (g *GitLab) Auth(ctx context.Context, token, _ string) (string, error) {\n\tclient, err := newClient(g.url, token, g.SkipVerify)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\tlogin, _, err := client.Users.CurrentUser(gitlab.WithContext(ctx))\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\treturn login.Username, nil\n}", "func getUser(ctx context.Context) string {\n\tidentityContext := auth.IdentityContextFromContext(ctx)\n\treturn identityContext.UserID()\n}", "func (c *baseClient) GetMe(ctx context.Context) (*User, error) {\n\tuser := new(User)\n\treturn user, c.Execute(ctx, \"getMe\", nil, user)\n}", "func (s *AuthService) User(ctx context.Context) (User, error) {\n\tu := ctx.Value(\"auth\")\n\tif u == nil {\n\t\treturn User{}, errors.New(\"Invalid user\")\n\t}\n\n\treturn u.(User), nil\n}", "func (os *OrganizationsService) GetCurrent(ctx context.Context) (res *Response, o *Organization, err error) {\n\treturn os.get(ctx, \"v2/organizations/me\")\n}", "func CurrUser() string {\n\tu, err := user.Current()\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn u.Username\n}", "func (c *Controller) CurrentUserState(w http.ResponseWriter, r *http.Request, u *studynook.User) {\n\n\tcoins, err := c.DB.GetCoins(u.ID)\n\tif err != nil {\n\t\tw.WriteHeader(http.StatusBadRequest)\n\t\treturn\n\t}\n\n\texp, err := c.DB.GetEXPAmount(u.ID)\n\tif err != nil {\n\t\tw.WriteHeader(http.StatusBadRequest)\n\t\treturn\n\t}\n\n\tuserLevel, userExp := CalculateLevelEXP(exp)\n\n\tcurrentBackground, err := c.DB.GetCurrentBackground(u.ID)\n\tif err != nil {\n\t\tw.WriteHeader(http.StatusBadRequest)\n\t\treturn\n\t}\n\n\tcurrentAvatar, err := c.DB.GetCurrentAvatar(u.ID)\n\tif err != nil {\n\t\tw.WriteHeader(http.StatusBadRequest)\n\t\treturn\n\t}\n\n\tcurrentUser := &currentUserState{Email: u.Email,\n\t\tName: u.Name,\n\t\tUsername: u.Username,\n\t\tCoins:\t strconv.Itoa(coins),\n\t\tLevel:\t strconv.Itoa(userLevel),\n\t\tEXP:\t strconv.Itoa(userExp),\n\t\tZone:\t currentBackground,\n\t\tAvatar:\t currentAvatar,\n\t}\n\n\terr = json.NewEncoder(w).Encode(currentUser)\n\tif err != nil {\n\t\tw.WriteHeader(http.StatusBadRequest)\n\t\tfmt.Println(err)\n\t\treturn\n\t}\n}", "func get_current_user() string {\n\tusr, err := user.Current()\n\tif err != nil {\n\t\tlog.Println(err)\n\t}\n\treturn usr.HomeDir\n}", "func GetUser(context *gin.Context) {\n\t//TODO: implement me uwu\n\tJwtCtx := login.ExtractClaims(context)\n\t// identity claim is the username in the database\n\tusername := JwtCtx[jwt.IdentityKey]\n\tuserData := database.GetUser(username.(string))\n\tpayload := models.UserInfoPayload{\n\t\tUserCommon: userData.UserCommon,\n\t}\n\tcontext.JSON(http.StatusOK, payload)\n}", "func (k *Klient) RemoteCurrentUsername(opts req.CurrentUsernameOptions) (string, error) {\n\tvar username string\n\n\tkRes, err := k.Tell(\"remote.currentUsername\", opts)\n\tif err != nil {\n\t\treturn username, err\n\t}\n\n\treturn username, kRes.Unmarshal(&username)\n}", "func (it IssueTracker) GetLoggedInUser() (string, error) {\n\terrFmt := \"error retrieving user email: %s\"\n\tif !it.IsAuthenticated() {\n\t\treturn \"\", fmt.Errorf(errFmt, \"User is not authenticated!\")\n\t}\n\tresp, err := it.OAuthTransport.Client().Get(PERSON_API_URL)\n\tif err != nil {\n\t\treturn \"\", fmt.Errorf(errFmt, err)\n\t}\n\tdefer resp.Body.Close()\n\tbody, _ := ioutil.ReadAll(resp.Body)\n\tif resp.StatusCode != http.StatusOK {\n\t\treturn \"\", fmt.Errorf(errFmt, fmt.Sprintf(\n\t\t\t\"user data API returned code %d: %v\", resp.StatusCode, string(body)))\n\t}\n\tuserInfo := struct {\n\t\tEmail string `json:\"email\"`\n\t}{}\n\tif err := json.Unmarshal(body, &userInfo); err != nil {\n\t\treturn \"\", fmt.Errorf(errFmt, err)\n\t}\n\treturn userInfo.Email, nil\n}", "func (c *Client) ModifyCurrentUser(data ModifyCurrentUserData) (*discord.User, error) {\n\tvar u *discord.User\n\treturn u, c.RequestJSON(\n\t\t&u,\n\t\t\"PATCH\", EndpointMe,\n\t\thttputil.WithJSONBody(data), httputil.WithHeaders(data.Header()),\n\t)\n}", "func (s userService) Me() (*api.User, error) {\n\treturn s.client.httpClient.GetMyUser()\n}", "func UserID() (int, error) {\n\tfilename := \"current_user.json\"\n\tgetUser := func() (*gitlab.User, error) {\n\t\tu, _, err := lab.Users.CurrentUser()\n\t\treturn u, err\n\t}\n\treturn userIdWithCache(filename, getUser)\n}", "func User(ctx context.Context) string {\n\tuserIdentity, _ := ctx.Value(UserIdentityKey).(string)\n\treturn userIdentity\n}", "func current(w http.ResponseWriter, r *http.Request) {\n\tu := Current(r.Context(), r)\n\tif u == nil {\n\t\tapi.RequestLogin(w, r)\n\t\treturn\n\t}\n\tapi.Encode(w, r, u, http.StatusOK)\n}", "func (c *config) User(token string, t int) (*model.User, error) {\n\tuser, err := c.newClientToken(token, \"\").GetCurrentUser()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn user, nil\n\t// return all, nil\n}", "func GetUser(c *context.Context) {\n\ta, _ := auth.GetCurrentTokenData(c)\n\n\turl := fmt.Sprintf(\"%s/users/show.json?source=%s&uid=%s&access_token=%s\",\n\t\tWEIBOSERVER, auth.APPKEY, a.UID, a.AccessToken)\n\tresp, err := http.Get(url)\n\tif err != nil {\n\t\tc.WriteJson(500, \"无法联系新浪服务器\")\n\t\treturn\n\t}\n\tdefer resp.Body.Close()\n\tbody, _ := ioutil.ReadAll(resp.Body)\n\tc.WriteBody(resp.StatusCode, body)\n}", "func GetUser(c *gin.Context) {\n\t//authenticate the user and check the user by the auth_token\n\tif err := oauth.AuthenticateRequest(c.Request); err != nil {\n\t\tc.JSON(err.Status, err)\n\t\treturn\n\t}\n\t// strconv.ParseInt(c.Param(\"user_id\"), 10, 64)\n\t// strconv.Atoi(c.Param(\"user_id\"))\n\tuserID, userErr := strconv.ParseInt(c.Param(\"user_id\"), 10, 64)\n\tif userErr != nil {\n\t\terr := errors.NewBadRequestError(\"user id should be a number\")\n\t\tc.JSON(err.Status, err)\n\t\treturn\n\t}\n\t// send the id to the services\n\tuser, getErr := services.UsersService.GetUser(userID)\n\tif getErr != nil {\n\t\tc.JSON(getErr.Status, getErr)\n\t\treturn\n\t}\n\n\t//check whether the caller ID is the same with the user ID\n\tif oauth.GetCallerId(c.Request) == user.ID {\n\t\tc.JSON(http.StatusOK, user.Marshall(false))\n\t\treturn\n\t}\n\tc.JSON(http.StatusOK, user.Marshall(oauth.IsPublic(c.Request)))\n}", "func User(r *http.Request) Info {\n\tv := r.Context().Value(userKey{})\n\tif info, ok := v.(Info); ok {\n\t\treturn info\n\t}\n\treturn nil\n}", "func (s *Service) Current(w http.ResponseWriter, r *http.Request,\n\targs *Args, reply *Args) (err error) {\n\n\tc := context.NewContext(r)\n\tvar isSet bool\n\tuserID, _ := user.CurrentUserID(r)\n\t_, err = profile.Get(c, profile.GenAuthID(\"Password\", userID))\n\tif err == nil {\n\t\tisSet = true\n\t}\n\treply.Password = &Password{IsSet: isSet}\n\treturn nil\n}", "func GetCurrentUserPath() string {\n\treturn \"/user\"\n}", "func GetIamCurrentUserName(t *testing.T) string {\n\tout, err := GetIamCurrentUserNameE(t)\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\treturn out\n}", "func (tc TeresaClient) Me() (user *models.User, err error) {\n\tr, err := tc.teresa.Users.GetCurrentUser(nil, tc.apiKeyAuthFunc)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn r.Payload, nil\n}", "func (s *UserService) GetUser() (*models.User, error) {\n\tvar localUser *models.User\n\n\tremoteUser, err := getRemoteUser(s.token)\n\tif err != nil {\n\t\ts.log.Info(\"couldn't authenticate user with internal-apis\")\n\t\treturn nil, errors.Errorf(\"cannot authenticate user with internal-apis: %v\", err)\n\t}\n\n\ts.updateLogger(monitor.F{\"id\": remoteUser.ID, \"email\": remoteUser.Email})\n\n\tif remoteUser.Email == \"\" {\n\t\ts.log.Info(\"empty email for internal-api user\")\n\t\treturn nil, errors.New(\"cannot authenticate user: email is empty/not confirmed\")\n\t}\n\n\tlocalUser, errStorage := s.getLocalUser(remoteUser.ID)\n\tif errStorage == sql.ErrNoRows {\n\t\tlocalUser, err = s.createLocalUser(remoteUser.ID)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\terr = s.createSDKAccount(localUser)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t} else if errStorage != nil {\n\t\treturn nil, errStorage\n\t}\n\n\treturn localUser, nil\n}", "func (a UsersAPI) Me() (ScimUser, error) {\n\treturn a.readByPath(\"/preview/scim/v2/Me\")\n}", "func (grc *GitRemoteConfiguration) GetUser() *string {\n\treturn grc.User\n}", "func GetUser(r *http.Request, db *gorm.DB) (User, error) {\n\t// Retrieve the auth token from the request context\n\ttoken, err := GetTokenFrom(r.Context())\n\tif err != nil {\n\t\treturn User{}, err\n\t}\n\t// Retrieve the client UID from the token\n\tcurrentUID := token.UID\n\n\t// Fetch the current user\n\tvar user User\n\tif result := db.FirstOrCreate(&user, User{ID: currentUID}); result.Error != nil {\n\t\treturn User{}, result.Error\n\t}\n\treturn user, nil\n}", "func CurrentOfflineUser(r *http.Request, c appengine.Context) *mdl.User {\n\tvar u *mdl.User\n\tif config.OfflineMode {\n\t\tif currentUser := mdl.FindUser(c, \"Username\", config.OfflineUser.Name); currentUser == nil {\n\t\t\tu, _ = mdl.CreateUser(c, config.OfflineUser.Email, config.OfflineUser.Name, config.OfflineUser.Username, \"\", true, mdl.GenerateAuthKey())\n\t\t} else {\n\t\t\tu = currentUser\n\t\t}\n\t}\n\treturn u\n}", "func GetCurrentAccount(c echo.Context) error {\n\taccountID := c.Get(\"account_id\").(string)\n\n\tif accountID == \"\" {\n\t\treturn echo.NewHTTPError(http.StatusNotFound)\n\t}\n\n\tdb, err := db.Connect(types.AdminAccount)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"Error connecting to the database: %s\", err)\n\t}\n\tdefer db.Close()\n\n\taccount, dbErr := db.GetAccountByID(accountID)\n\tif dbErr != nil {\n\t\treturn dbErr\n\t}\n\n\treturn c.JSON(http.StatusOK, account)\n}", "func User() string {\n\treturn user\n}", "func (c *Client) Me() (*object.PublicUser, error) {\n\tvar user object.PublicUser\n\tif err := c.Get(\"/me\", &user); err != nil {\n\t\treturn nil, err\n\t}\n\treturn &user, nil\n}", "func (client *Client) User() string {\n\tclient.mutex.RLock()\n\tdefer client.mutex.RUnlock()\n\n\treturn client.user\n}", "func (c *Client) GetMe() (dto.User, error) {\n\tr, err := c.NewRequest(\"GET\", \"v1/user\", nil)\n\n\tif err != nil {\n\t\treturn dto.User{}, err\n\t}\n\n\tvar user dto.User\n\t_, err = c.Do(r, &user)\n\treturn user, err\n}", "func GetAuthenticatedUser(c *gin.Context, db *gorm.DB) (models.User, error) {\n\tuser := models.User{}\n\ttoken := c.GetHeader(\"Authorization\")\n\n\tif token == \"\" {\n\t\treturn user, errors.New(\"Invalid token\")\n\t}\n\n\tif err := db.Where(\"token = ?\", token).First(&user).Error; err != nil {\n\t\treturn user, err\n\t}\n\n\treturn user, nil\n}", "func userCurrent(w http.ResponseWriter, r *http.Request) {}", "func (h *HostState) User(\n\tctx context.Context,\n) warp.User {\n\treturn warp.User{\n\t\tToken: h.UserState.token,\n\t\tUsername: h.UserState.username,\n\t\tMode: h.UserState.mode,\n\t\tHosting: true,\n\t}\n}", "func (g *GitLab) Login(ctx context.Context, res http.ResponseWriter, req *http.Request) (*model.User, error) {\n\tconfig, oauth2Ctx := g.oauth2Config(ctx)\n\n\t// get the OAuth errors\n\tif err := req.FormValue(\"error\"); err != \"\" {\n\t\treturn nil, &forge_types.AuthError{\n\t\t\tErr: err,\n\t\t\tDescription: req.FormValue(\"error_description\"),\n\t\t\tURI: req.FormValue(\"error_uri\"),\n\t\t}\n\t}\n\n\t// get the OAuth code\n\tcode := req.FormValue(\"code\")\n\tif len(code) == 0 {\n\t\thttp.Redirect(res, req, config.AuthCodeURL(\"woodpecker\"), http.StatusSeeOther)\n\t\treturn nil, nil\n\t}\n\n\ttoken, err := config.Exchange(oauth2Ctx, code)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"Error exchanging token. %w\", err)\n\t}\n\n\tclient, err := newClient(g.url, token.AccessToken, g.SkipVerify)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tlogin, _, err := client.Users.CurrentUser(gitlab.WithContext(ctx))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tuser := &model.User{\n\t\tLogin: login.Username,\n\t\tEmail: login.Email,\n\t\tAvatar: login.AvatarURL,\n\t\tForgeRemoteID: model.ForgeRemoteID(fmt.Sprint(login.ID)),\n\t\tToken: token.AccessToken,\n\t\tSecret: token.RefreshToken,\n\t}\n\tif !strings.HasPrefix(user.Avatar, \"http\") {\n\t\tuser.Avatar = g.url + \"/\" + login.AvatarURL\n\t}\n\n\treturn user, nil\n}", "func (c Config) User(ctx *context.Context) (string, string, bool) {\n\treturn ctx.Request().BasicAuth()\n}", "func (o *Content) GetRunAsCurrentUser() bool {\n\tif o == nil || o.RunAsCurrentUser == nil {\n\t\tvar ret bool\n\t\treturn ret\n\t}\n\treturn *o.RunAsCurrentUser\n}", "func Get(c *gin.Context) {\n\tuserID, err := getUserID(c.Param(\"user_id\"))\n\tif err != nil {\n\t\tc.JSON(err.Status, err)\n\t\treturn\n\t}\n\n\tuser, getErr := services.UserServ.GetUser(userID)\n\tif getErr != nil {\n\t\tc.JSON(getErr.Status, getErr)\n\t\treturn\n\t}\n\n\tisPublic := c.GetHeader(\"X-Public\") == \"true\"\n\tc.JSON(http.StatusOK, user.Marshall(isPublic))\n}", "func (h *Handler) GetSelf(w http.ResponseWriter, r *http.Request) {\n\tctx := r.Context()\n\n\t// TODO move user to handler parameter?\n\tu, ok := ctxpkg.ContextGetUser(ctx)\n\tif !ok {\n\t\tresponse.WriteOCSError(w, r, response.MetaServerError.StatusCode, \"missing user in context\", fmt.Errorf(\"missing user in context\"))\n\t\treturn\n\t}\n\n\tresponse.WriteOCSSuccess(w, r, &User{\n\t\tID: u.Username,\n\t\tDisplayName: u.DisplayName,\n\t\tEmail: u.Mail,\n\t\tUserType: conversions.UserTypeString(u.Id.Type),\n\t\tLanguage: h.getLanguage(ctx),\n\t})\n}", "func (a *App) Get(w http.ResponseWriter, r *http.Request) {\n\tctx := r.Context()\n\tuserID := ctx.Value(middleware.UserCtxKeys(0)).(int64)\n\tvar err error\n\tuser, err := a.dbAuthenticatedGetUserSelf(userID)\n\tif err != nil {\n\t\tutils.RespondWithError(w, http.StatusInternalServerError, err.Error())\n\t\treturn\n\t}\n\tutils.RespondWithJSON(w, http.StatusOK, &user)\n}", "func CurrentClient(ctx *context.Context) *string {\n\tcurrentClientAccess := (*ctx).Value(KeyCurrentClient)\n\tif currentClientAccess != nil {\n\t\tv := currentClientAccess.(string)\n\t\treturn &v\n\t}\n\treturn nil\n}", "func GetUser(c *fiber.Ctx) error {\n\tclaims, err := utils.ExtractTokenMetadata(c)\n\tusername := claims.Username\n\t// check if the user requested is equel to JWT user\n\tif username != c.Params(\"user_name\") {\n\t\treturn c.Status(fiber.StatusInternalServerError).JSON(fiber.Map{\n\t\t\t\"error\": true,\n\t\t\t\"msg\": \"Forbidden, requested user is different from JWT user\",\n\t\t})\n\t}\n\n\tuser, err := queries.GetUserByUsername(username)\n\tif err != nil {\n\t\treturn c.Status(400).JSON(fiber.Map{\n\t\t\t\"error\": true,\n\t\t\t\"msg\": err.Error(),\n\t\t})\n\t}\n\tif user == nil {\n\t\treturn c.Status(400).JSON(fiber.Map{\n\t\t\t\"error\": true,\n\t\t\t\"msg\": \"Error, apparently we could not find you on the database\",\n\t\t})\n\t}\n\ttype user_simple struct {\n\t\tUsername string `json:\"Username\"`\n\t\tEmail string `json:\"Email\"`\n\t\tCreatedAt time.Time `json:\"CreatedAt\"`\n\t}\n\n\tvar my_user_simple user_simple\n\tmy_user_simple.Username = user.Username\n\tmy_user_simple.Email = user.Email\n\tmy_user_simple.CreatedAt = user.CreatedAt\n\n\treturn c.Status(200).JSON(user) //my_user_simple)\n}", "func GetUser(ctx *aero.Context) *arn.User {\n\treturn arn.GetUserFromContext(ctx)\n}", "func GetUser(r *http.Request) string {\n\tres, _ := noodle.Value(r, userKey).(string)\n\treturn res\n}", "func (action *Action) User() (apifabclient.User, error) {\n\tuserName := cliconfig.Config().UserName()\n\tif userName == \"\" {\n\t\tuserName = defaultUser\n\t}\n\treturn action.OrgUser(action.OrgID(), userName)\n}", "func (a Authentic) CurrentUserMW(h buffalo.Handler) buffalo.Handler {\n\treturn func(c buffalo.Context) error {\n\t\tuserID := c.Session().Get(SessionField)\n\n\t\tif userID == nil {\n\t\t\treturn h(c)\n\t\t}\n\n\t\tuser, err := a.provider.FindByID(userID)\n\t\tif err != nil {\n\t\t\treturn errors.WithStack(err)\n\t\t}\n\n\t\terr = a.provider.UserDetails(user, c)\n\t\tif err != nil {\n\t\t\treturn errors.WithStack(err)\n\t\t}\n\n\t\treturn h(c)\n\t}\n}", "func (p *EC2Provisioner) GetUser() string { return p.user }" ]
[ "0.7717936", "0.76365036", "0.7492538", "0.7327906", "0.722871", "0.71746415", "0.71389246", "0.71194893", "0.7112225", "0.70918316", "0.70659107", "0.7064282", "0.70525044", "0.70471305", "0.701816", "0.69982785", "0.6994063", "0.6988662", "0.698106", "0.6956354", "0.695497", "0.6954814", "0.6945034", "0.6881261", "0.68070316", "0.67622656", "0.67351836", "0.6704118", "0.6588797", "0.657753", "0.6478691", "0.63941884", "0.63782704", "0.63776404", "0.63771665", "0.6367288", "0.636164", "0.6333687", "0.62497383", "0.62389266", "0.6192294", "0.61538255", "0.60884637", "0.60561866", "0.6017259", "0.59867066", "0.5963671", "0.5960725", "0.59397423", "0.59262806", "0.5918294", "0.58672506", "0.5839156", "0.5796457", "0.5762285", "0.576156", "0.5758949", "0.57531315", "0.574677", "0.5740162", "0.5738121", "0.573799", "0.57058936", "0.5703789", "0.5700438", "0.56759256", "0.5649328", "0.5647793", "0.56357056", "0.56307966", "0.56301075", "0.5614875", "0.56087565", "0.560525", "0.5598481", "0.55917645", "0.55888987", "0.5585929", "0.55627084", "0.5562508", "0.5536104", "0.5528446", "0.55267245", "0.55206126", "0.5518848", "0.5504867", "0.5497468", "0.5495951", "0.5495501", "0.549177", "0.54651266", "0.54631835", "0.54611844", "0.54443", "0.5434305", "0.54341394", "0.5419858", "0.5408026", "0.5403614", "0.53901756" ]
0.7774972
0
go test v github.com/dylenfu/golibs/base run TestAddWithBinararyAction
func TestAddWithBinararyAction(t *testing.T) { if (3 + 4) != (3 | 4) { t.Fatal("(3 + 4) != (3 | 4)") } if math.MaxInt32 != (1<<31 - 1) { t.Log("math.MaxInt32 != (1 << 32 - 1)") } if math.MinInt32 != -(1 << 31) { t.Log("math.MinInt32 != -(1 << 31)") } if (3 ^ 4) != (3 + 4) { t.Log("(3 ^ 4) != (3 + 4)") } if aplusb(100, -100) != 0 { t.Fatal("aplusb(100, -100) != 0") } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func TestAddBR(t *testing.T) {\n\trunCreateBucket(t, \"add\")\n}", "func TestAdd(t *testing.T) {\n\tscheme, err := contrail.SchemeBuilder.Build()\n\tassert.NoError(t, err)\n\tassert.NoError(t, core.SchemeBuilder.AddToScheme(scheme))\n\tassert.NoError(t, apps.SchemeBuilder.AddToScheme(scheme))\n\taddCases := map[string]struct {\n\t\tmanager *mockManager\n\t\treconciler *mockReconciler\n\t}{\n\t\t\"add process suceeds\": {\n\t\t\tmanager: &mockManager{\n\t\t\t\tscheme: scheme,\n\t\t\t},\n\t\t\treconciler: &mockReconciler{},\n\t\t},\n\t}\n\tfor name, addCase := range addCases {\n\t\tt.Run(name, func(t *testing.T) {\n\t\t\terr := add(addCase.manager, addCase.reconciler)\n\t\t\tassert.NoError(t, err)\n\t\t})\n\t}\n}", "func TestAddWithMultipleBR(t *testing.T) {\n\trunCreateBucketWithMultipleBR(t, \"addWithMultipleBR\")\n}", "func TestAdd(t *testing.T) {\n\tfmt.Println(Add(1,2))\n}", "func TestAddApp(t *testing.T) {\n\n\tvar err error\n\n\t// Use the configuration manager to get Algolia's keys to mock the app interactor\n\tconfigInteractor := interfaces.ConfigurationManager{}\n\tconfigInteractor.ConfigurationInteractor = infrastructure.NewViperConfig()\n\n\t// Instanciate the App interactor\n\tappInteractor := usecases.NewAppInteractor(\n\t\tinterfaces.NewAlgoliaRepository(\n\t\t\tconfigInteractor.GetConfigString(\"algolia.applicationID\", \"NOT_SET\"),\n\t\t\tconfigInteractor.GetConfigString(\"algolia.apiKey\", \"NOT_SET\"),\n\t\t\tconfigInteractor.GetConfigString(\"algolia.indexes.apps\", \"NOT_SET\"),\n\t\t),\n\t)\n\n\t// Single addition\n\t// Create a random app\n\ttestApp := domain.NewApp(\n\t\t\"Unit testing app interactor\",\n\t\t\"static.whatthetvshow.com:9000/media/snapshots/c4c3021b168ba93572d402e313f0f884_medium.png\",\n\t\t\"http://whatthetvshow.com/fe/snapshots/2205\",\n\t\t\"Quiz unit tests Benjamin\",\n\t\t223,\n\t)\n\t// Try to persist it\n\tres, err := appInteractor.Create(testApp)\n\n\t// Testing returns\n\tif err != nil {\n\t\t// Error raised during the creation\n\t\tt.Error(\"The app was not properly added : \", err)\n\t\treturn\n\t}\n\tif res == \"\" {\n\t\t// No object created\n\t\tt.Error(\"The app was not properly added : no identifier returned\")\n\t\treturn\n\t}\n\n\t_, _ = appInteractor.Delete(res)\n\n\tt.Log(\"TestAddApp: Test Clear\")\n\treturn\n}", "func TestAdd(t *testing.T) {\n\tbody, err := json.Marshal(&fakeRequests)\n\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\n\tres, err := http.Post(url+\"add\", contentType, bytes.NewBuffer(body))\n\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\n\tif res.StatusCode != http.StatusOK {\n\t\tt.Fatal(fmt.Errorf(\"Wrong status code = %v\", res.StatusCode))\n\t}\n}", "func TestAdd(t *testing.T) {\n\n\tresult := Add(1, 2)\n\tif result != 3 {\n\t\tt.Error(\"Existing 1 + 2 to equal 3\")\n\t}\n}", "func TestCheckBinaryExprStringAddInt(t *testing.T) {\n\tenv := MakeSimpleEnv()\n\n\texpectCheckError(t, `\"abc\" + 4`, env,\n\t\t`cannot convert \"abc\" to type int`,\n\t\t`invalid operation: \"abc\" + 4 (mismatched types string and int)`,\n\t)\n\n}", "func addBobba(w http.ResponseWriter, r *http.Request) {\n\tvar bobba bobba.Bobba\n\tdecoder := json.NewDecoder(r.Body)\n\terr := decoder.Decode(&bobba)\n\n\t// Set JSON header\n\tw.Header().Set(\"Content-type\", \"application/json\")\n\n\tif err != nil {\n\t\terrPayload := buildErrorPayload(err.Error(), 200)\n\t\tw.Write(errPayload)\n\t\treturn\n\t}\n\n\t// call our goroutine\n\tlast, insertErr := runAddRoutine(bobba)\n\n\tif insertErr != nil {\n\t\terrPayload := buildErrorPayload(insertErr.Error(), 200)\n\t\tw.Write(errPayload)\n\t\treturn\n\t}\n\n\tpayload := buildSuccessPayload(last, 200)\n\tw.Write(payload)\n\treturn\n}", "func TestBinaryKDBXv31(t *testing.T) {\n\tdb := NewDatabase()\n\n\tbinary := db.AddBinary([]byte(\"test\"))\n\tbinary.ID = 4\n\n\tbinary2 := db.AddBinary([]byte(\"replace me\"))\n\tbinary2.SetContent([]byte(\"Hello world!\"))\n\tif binary2.ID != 5 {\n\t\tt.Fatalf(\"Binary2 assigned wrong id by binaries.Add, should be 5, was %d\", binary2.ID)\n\t}\n\n\tif db.FindBinary(2) != nil {\n\t\tt.Fatalf(\"Binaries.find for id 2 should be nil, wasn't\")\n\t}\n\n\treferences := []BinaryReference{}\n\treferences = append(references, binary.CreateReference(\"example.txt\"))\n\tif references[0].Value.ID != 4 {\n\t\tt.Fatalf(\"Binary Reference ID is incorrect. Should be 4, was %d\", references[0].Value.ID)\n\t}\n\tif data, _ := db.FindBinary(references[0].Value.ID).GetContentBytes(); string(data) != \"test\" {\n\t\tt.Fatalf(\"Binary Reference GetContentBytes is incorrect. Should be `test`, was '%s'\", string(data))\n\t}\n\tif str, _ := db.FindBinary(references[0].Value.ID).GetContentString(); str != \"test\" {\n\t\tt.Fatalf(\"Binary Reference GetContentString is incorrect. Should be `test`, was '%s'\", str)\n\t}\n\n\tfound := db.FindBinary(binary2.ID)\n\tif data, _ := found.GetContentBytes(); string(data) != \"Hello world!\" {\n\t\tt.Fatalf(\"Binary content from FindBinary is incorrect. Should be `Hello world!`, was '%s'\", string(data))\n\t}\n\tif str, _ := found.GetContentString(); str != \"Hello world!\" {\n\t\tt.Fatalf(\"Binary content from FindBinary is incorrect. Should be `Hello world!`, was '%s'\", str)\n\t}\n}", "func TestAdd(t *testing.T) {\n\t_ph := New()\n\t_ph.Add(Item{})\n\tif len(_ph.Items) != 1 {\n\t\tt.Errorf(\"Item was not added\")\n\t}\n}", "func TestAdd(t *testing.T) {\n\tConvey(\"Unmarshaling fails.\\n\", t, func() {\n\t\tbadJSON := \"badJSON\"\n\n\t\t// Function under test.\n\t\terr := Add(badJSON)\n\n\t\tSo(err, ShouldNotBeNil)\n\t\tSo(err.Error(), ShouldEqual,\n\t\t\t`error unmarshaling action JSON [badJSON]: invalid character 'b' looking for beginning of value`)\n\t\tSo(len(actions), ShouldEqual, 0)\n\t})\n\n\tConvey(\"Adding one action succeeds.\\n\", t, func() {\n\t\t// Function under test.\n\t\terr := Add(action1)\n\n\t\tSo(err, ShouldBeNil)\n\t\tSo(len(actions), ShouldEqual, 1)\n\t})\n\n\tConvey(\"Adding multiple actions in parallel succeeds.\\n\", t, func() {\n\t\t// Kick off one client.\n\t\tc1 := make(chan error)\n\t\tvar err1 error\n\t\tgo func() {\n\t\t\t// Notify the caller when we're done, no matter how we end up.\n\t\t\tdefer func() {c1 <- err1}()\n\n\t\t\tfor i := 0; i < 10; i++ {\n\t\t\t\t// Function under test.\n\t\t\t\terr1 = Add(action2)\n\t\t\t\tif err1 != nil {\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t}\n\t\t}()\n\n\t\t// Kick off another client.\n\t\tc2 := make(chan error)\n\t\tvar err2 error\n\t\tgo func() {\n\t\t\t// Notify the caller when we're done, no matter how we end up.\n\t\t\tdefer func() {c2 <- err2}()\n\n\t\t\tfor i := 0; i < 10; i++ {\n\t\t\t\t// Function under test.\n\t\t\t\terr2 = Add(action3)\n\t\t\t\tif err2 != nil {\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t}\n\t\t}()\n\n\t\t// Wait for both clients to finish.\n\t\t<- c1\n\t\t<- c2\n\n\t\tSo(err1, ShouldBeNil)\n\t\tSo(err2, ShouldBeNil)\n\t\tSo(len(actions), ShouldEqual, 21) // 1 added in the previous test case.\n\t})\n\n\t// Clean up from these tests.\n\tactions = nil\n}", "func TestIpfsAdd(t *testing.T) {\n\tvar (\n\t\texpect = \"QmPZ9gcCEpqKTo6aq61g2nXGUhM4iCL3ewB6LDXZCtioEB\"\n\t)\n\tgot, err := IpfsAdd(testConfig, \"testdata/ipfs/readme\")\n\tif err != nil {\n\t\tt.Error(err)\n\t}\n\tif got != expect {\n\t\tt.Errorf(\"expect %s got %s\", expect, got)\n\t}\n\n}", "func TestEncodeDecodeBinary(t *testing.T) {\n\ttestEncodeDecodeFunctions(t,\n\t\tencodeLeaseRequestBinary, encodeLeaseReplyBinary,\n\t\tdecodeLeaseRequestBinary, decodeLeaseReplyBinary)\n}", "func TestToManyAdd(t *testing.T) {}", "func TestToManyAdd(t *testing.T) {}", "func TestToManyAdd(t *testing.T) {}", "func TestAdd(t *testing.T) {\n\t_plague := New()\n\t_plague.Add(Item{})\n\tif len(_plague.Items) != 1 {\n\t\tt.Errorf(\"Item was not added\")\n\t}\n}", "func (k *Keychain) AddBinKey(key []byte) {\n\tk.pushKey(key)\n}", "func TestAddResource(t *testing.T) {\n\ttestName := \"TestAddResource\"\n\tbeforeTest()\n\t// kinds to check for status\n\tvar kindsToCheckStatus = map[string]bool{\n\t\tAPPLICATION: true,\n\t\t\"Ingress\": true,\n\t\t\"Service\": true,\n\t\t\"Deployment\": true,\n\t\t\"StatefulSet\": true,\n\t\t\"NetworkPolicy\": true,\n\t\t//\t\t\"Kappnav\": true,\n\t}\n\n\t// resources to pre-populate\n\tvar files = []string{\n\t\t/* 0 */ KappnavConfigFile,\n\t\t/* 1 */ CrdApplication,\n\t\t/* 2 */ appBookinfo,\n\t\t/* 3 */ appProductpage,\n\t\t/* 4 */ appDetails,\n\t\t/* 5 */ appReviews,\n\t\t/* 6 */ deploymentDetailsV1,\n\t\t/* 7 */ deploymentProcuctpageV1,\n\t\t/* 8 */ deploymentReviewsV1,\n\t\t/* 9 */ deploymentReviewsV2,\n\t\t/* 10 */ serviceDetails,\n\t\t/* 11 */ serviceProductpage,\n\t\t/* 12 */ serviceReview,\n\t\t/* 13 */ networkpolicyProductpage,\n\t\t/* 14 */ ingressBookinfo,\n\t\t/* 15 */ networkpolicyReviews,\n\t\t//\t\t/* 16 */ kappnavCRFile,\n\t}\n\n\titeration0IDs, err := readResourceIDs(files)\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\n\t/* Iteration 0: all normal */\n\ttestActions := newTestActions(testName, kindsToCheckStatus)\n\tvar emptyIDs = []resourceID{}\n\ttestActions.addIteration(iteration0IDs, emptyIDs)\n\n\t// iteration 1: Add deploymentReviewsV3\n\t// /* 16 */deploymentReviewsV3,\n\tres, err := readOneResourceID(deploymentReviewsV3)\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\tarrayLength := len(iteration0IDs)\n\tvar iteration1IDs = make([]resourceID, arrayLength, arrayLength)\n\tcopy(iteration1IDs, iteration0IDs)\n\titeration1IDs = append(iteration1IDs, res)\n\titeration1IDs[2].expectedStatus = warning // bookfino warning\n\titeration1IDs[5].expectedStatus = warning // review app warning\n\titeration1IDs[16].expectedStatus = warning // new deployment starts with warning status\n\ttestActions.addIteration(iteration1IDs, emptyIDs)\n\n\t// iteration 2: stabilize the new deployment to Normal\n\tarrayLength = len(iteration1IDs)\n\tvar iteration2IDs = make([]resourceID, arrayLength, arrayLength)\n\tcopy(iteration2IDs, iteration1IDs)\n\titeration2IDs[2].expectedStatus = Normal // bookfino Normal\n\titeration2IDs[5].expectedStatus = Normal // review app Normal\n\titeration2IDs[16].expectedStatus = Normal // new deployment Normal\n\ttestActions.addIteration(iteration2IDs, emptyIDs)\n\n\t/* iteration 3: add a new app */\n\tvar newFiles = []string{\n\t\t/* 17 */ appRatings,\n\t\t/* 18 */ deploymentRatingsV1,\n\t\t/* 19 */ serviceRatings,\n\t}\n\tnewResources, err := readResourceIDs(newFiles)\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\tarrayLength = len(iteration2IDs)\n\tvar iteration3IDs = make([]resourceID, arrayLength, arrayLength)\n\tcopy(iteration3IDs, iteration2IDs)\n\tfor _, newRes := range newResources {\n\t\titeration3IDs = append(iteration3IDs, newRes)\n\t}\n\titeration3IDs[2].expectedStatus = warning // bookfino now warning due to ratings app\n\titeration3IDs[17].expectedStatus = warning // ratings app warning\n\titeration3IDs[18].expectedStatus = warning // ratings deployment warning\n\ttestActions.addIteration(iteration3IDs, emptyIDs)\n\n\t/* iteration 4: everything back to normal */\n\tarrayLength = len(iteration3IDs)\n\tvar iteration4IDs = make([]resourceID, arrayLength, arrayLength)\n\tcopy(iteration4IDs, iteration3IDs)\n\titeration4IDs[2].expectedStatus = Normal // bookfino app Normal\n\titeration4IDs[17].expectedStatus = Normal // ratings app Normal\n\titeration4IDs[18].expectedStatus = Normal // ratings deployment Normal\n\ttestActions.addIteration(iteration4IDs, emptyIDs)\n\n\t/* iteration 7: clean up */\n\ttestActions.addIteration(emptyIDs, emptyIDs)\n\n\tclusterWatcher, err := createClusterWatcher(iteration0IDs, testActions, StatusFailureRate)\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\tdefer clusterWatcher.shutDown()\n\n\t// make all trasition of testAction\n\terr = testActions.transitionAll()\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n}", "func TestCheckBinaryExprIntAddString(t *testing.T) {\n\tenv := MakeSimpleEnv()\n\n\texpectCheckError(t, `4 + \"abc\"`, env,\n\t\t`cannot convert \"abc\" to type int`,\n\t\t`invalid operation: 4 + \"abc\" (mismatched types int and string)`,\n\t)\n\n}", "func applyBinaryDeltaAdd(w io.Writer, op byte, delta []byte) (n int64, rest []byte, err error) {\n\tsize := int(op)\n\tif len(delta) < size {\n\t\treturn 0, delta, errors.New(\"corrupt binary delta: incomplete add\")\n\t}\n\t_, err = w.Write(delta[:size])\n\treturn int64(size), delta[size:], err\n}", "func TestNewBinaryValue(t *testing.T) {\n\tvar origin int64 = time.Now().UnixNano()\n\t// assign instance of mockStructB as a CBOR encoded CommandValue payload\n\tvar mock1 models.Event\n\tmock1.DeviceName = \"Device01234567890\"\n\tmock1.Created = origin\n\tmock1.Id = \"MyStringIdentifier\"\n\tmock1.Modified = origin + 123\n\t// To extend coverage cborMock becomes encoded byte array.\n\t// We will then confirm CommandValue particulars of binary payload are valid\n\tcborMock, err := encodeMockEvent(mock1)\n\tif err != nil {\n\t\tt.Errorf(\"NewBinaryValue: Error encoding struct as binary value\")\n\t}\n\tcv, errAssign := NewBinaryValue(\"resource\", origin, cborMock)\n\tif errAssign != nil {\n\t\tt.Errorf(\"NewBinaryValue: Error invoking NewBinaryValue [%v]\", errAssign)\n\t}\n\t// Confirm CommandValue particulars\n\tif cv.Type != contracts.ValueTypeBinary {\n\t\tt.Errorf(\"Expected Binary type! invalid Type: %v\", cv.Type)\n\t}\n\tif cv.Origin != origin {\n\t\tt.Errorf(\"Expected matching value! invalid Origin: %d != %d\", cv.Origin, origin)\n\t}\n\tval, err := cv.BinaryValue()\n\tif err != nil {\n\t\tt.Errorf(\"BinaryValue: error retrieving binary value from command value\")\n\t}\n\tif !reflect.DeepEqual(val, cborMock) {\n\t\tt.Errorf(\"BinaryValue() result doesn't match expected payload\")\n\t}\n}", "func TestAddFile(t *testing.T) {\n\ts, dir := createTestServer(5, 8, 8, 0.000001, uint64(100000))\n\tdefer os.RemoveAll(dir)\n\n\tc, cliDir := createTestClient(s, 0)\n\tdefer os.RemoveAll(cliDir)\n\n\tcontent := \"This is a simple test file\"\n\tfile := createTestFile(content)\n\t_, filename := path.Split(file)\n\tdefer os.Remove(file)\n\n\tif c.AddFile(file) != nil {\n\t\tt.Fatalf(\"first time adding file fails\")\n\t}\n\n\tif c.AddFile(file) == nil {\n\t\tt.Fatalf(\"same file added twice\")\n\t}\n\n\tif c.lookupTable[\"0\"] != filename {\n\t\tt.Fatalf(\"lookup table not set up correctly on the client\")\n\t}\n\tif c.reverseLookup[filename] != \"0\" {\n\t\tt.Fatalf(\"reverse lookup table not set up correctly on the client\")\n\t}\n\n\tserverLookupTable := make(map[string]string)\n\tif tableContent, found := s.ReadLookupTable(); found {\n\t\tjson.Unmarshal(tableContent, &serverLookupTable)\n\t}\n\tif serverLookupTable[\"0\"] != filename {\n\t\tt.Fatalf(\"lookup table not set up correctly on the server\")\n\t}\n\n\tif actual, err := s.GetFile(0); err != nil || !bytes.Equal(actual, []byte(content)) {\n\t\tt.Fatalf(\"file not written correctly to the server: %s\", err)\n\t}\n\n\tif !reflect.DeepEqual(s.SearchWord(c.indexer.ComputeTrapdoors(\"simple\")), []int{0}) {\n\t\tt.Fatalf(\"index file not written correctly to server\")\n\t}\n\n\tcontentRead, err := ioutil.ReadFile(path.Join(cliDir, filename))\n\tif err != nil || !bytes.Equal(contentRead, []byte(content)) {\n\t\tt.Fatalf(\"file not correctly written to local client storage\")\n\t}\n}", "func TestCheckBinaryExprStringAddBool(t *testing.T) {\n\tenv := MakeSimpleEnv()\n\n\texpectCheckError(t, `\"abc\" + true`, env,\n\t\t`cannot convert \"abc\" to type int`,\n\t\t`cannot convert true to type int`,\n\t\t`invalid operation: \"abc\" + true (mismatched types string and bool)`,\n\t)\n\n}", "func TestCheckBinaryExprStringAddString(t *testing.T) {\n\tenv := MakeSimpleEnv()\n\n\texpectConst(t, `\"abc\" + \"abc\"`, env, (\"abc\" + \"abc\"), ConstString)\n}", "func TestAddUser(t *testing.T) {\n\taddUserWithArgs(t, []string{\n\t\t\"--user\", \"someuser\",\n\t})\n}", "func TestAddHandler(t *testing.T) {\n\tvar jsonStr = []byte(`{\"num1\":\"10\", \"num2\": \"5\"}`)\n req, err := http.NewRequest(\"POST\", \"/api/v1/add\", bytes.NewBuffer(jsonStr))\n req.Header.Set(\"Content-Type\", \"application/json\")\n if err != nil {\n t.Fatal(err)\n }\n\n rr := httptest.NewRecorder()\n handler := http.HandlerFunc(addHandler)\n\n handler.ServeHTTP(rr, req)\n\n if status := rr.Code; status != http.StatusOK {\n t.Errorf(\"handler returned wrong status code: got %v want %v\",\n status, http.StatusOK)\n }\n\n\texpected := \"15\"\n\tif rr.Body.String() != expected {\n\t\tt.Fatalf(\"handler returned: got %v want %v\", rr.Body, expected)\n\t}\n}", "func GitAdd(tb testing.TB) {\n\ttb.Helper()\n\tout, err := fakeGit(\"add\", \"-A\")\n\trequire.NoError(tb, err)\n\trequire.Empty(tb, out)\n}", "func TestAddSSN(pri1, pri2 string, api string) {\n\tfmt.Println(\"------------------------ start AddSSN ------------------------\")\n\terr, proxy, impl := DeployAndUpgrade(pri1)\n\tif err != nil {\n\t\tpanic(\"got error = \" + err.Error())\n\t}\n\tfmt.Println(\"proxy = \", proxy)\n\tfmt.Println(\"impl = \", impl)\n\tp := NewProxy(api, proxy, impl)\n\tp.AddSSN(pri1, pri2)\n}", "func TestAckInstalledApplicationListDuplicateRegression(t *testing.T) {\n\n}", "func TestCheckBinaryExprBoolAddString(t *testing.T) {\n\tenv := MakeSimpleEnv()\n\n\texpectCheckError(t, `true + \"abc\"`, env,\n\t\t`cannot convert \"abc\" to type bool`,\n\t\t`invalid operation: true + \"abc\" (mismatched types bool and string)`,\n\t)\n\n}", "func TestCheckBinaryExprIntAddInt(t *testing.T) {\n\tenv := MakeSimpleEnv()\n\n\texpectConst(t, `4 + 4`, env, NewConstInt64(4 + 4), ConstInt)\n}", "func TestAdd(t *testing.T) {\n\tnums := []int{2, 7, 11, 15}\n\tt.Log(myTwoSum(nums, 22))\n}", "func addb(context *Context) {\n x := context.opcode & 0x0F00 >> 8\n b := byte(context.opcode & 0x00FF)\n context.cpu.v[x] += b\n context.cpu.pc += 2\n}", "func TestAddApps(t *testing.T) {\n\n\tvar err error\n\n\t// Use the configuration manager to get Algolia's keys to mock the app interactor\n\tconfigInteractor := interfaces.ConfigurationManager{}\n\tconfigInteractor.ConfigurationInteractor = infrastructure.NewViperConfig()\n\n\t// Instanciate the App interactor\n\tappInteractor := usecases.NewAppInteractor(\n\t\tinterfaces.NewAlgoliaRepository(\n\t\t\tconfigInteractor.GetConfigString(\"algolia.applicationID\", \"NOT_SET\"),\n\t\t\tconfigInteractor.GetConfigString(\"algolia.apiKey\", \"NOT_SET\"),\n\t\t\tconfigInteractor.GetConfigString(\"algolia.indexes.apps\", \"NOT_SET\"),\n\t\t),\n\t)\n\n\t// Batch addition\n\t// Create a random app\n\ttestApps := []domain.App{\n\t\tdomain.NewApp(\n\t\t\t\"Unit testing app interactor\",\n\t\t\t\"static.whatthetvshow.com:9000/media/snapshots/c4c3021b168ba93572d402e313f0f884_medium.png\",\n\t\t\t\"http://whatthetvshow.com/fe/snapshots/2205\",\n\t\t\t\"Quiz unit tests Benjamin\",\n\t\t\t223,\n\t\t),\n\t\tdomain.NewApp(\n\t\t\t\"Unit testing app interactor 2\",\n\t\t\t\"static.whatthetvshow.com:9000/media/snapshots/c4c3021b168ba93572d402e313f0f884_medium.png\",\n\t\t\t\"http://whatthetvshow.com/fe/snapshots/2205\",\n\t\t\t\"Quiz unit tests Benjamin\",\n\t\t\t224,\n\t\t),\n\t\tdomain.NewApp(\n\t\t\t\"Unit testing app interactor 3\",\n\t\t\t\"static.whatthetvshow.com:9000/media/snapshots/c4c3021b168ba93572d402e313f0f884_medium.png\",\n\t\t\t\"http://whatthetvshow.com/fe/snapshots/2205\",\n\t\t\t\"Quiz unit tests Benjamin\",\n\t\t\t225,\n\t\t),\n\t\tdomain.NewApp(\n\t\t\t\"Unit testing app interactor 4\",\n\t\t\t\"static.whatthetvshow.com:9000/media/snapshots/c4c3021b168ba93572d402e313f0f884_medium.png\",\n\t\t\t\"http://whatthetvshow.com/fe/snapshots/2205\",\n\t\t\t\"Quiz unit tests Benjamin\",\n\t\t\t226,\n\t\t),\n\t}\n\t// Try to persist it\n\tres, err := appInteractor.CreateBatch(testApps)\n\n\t// Testing returns\n\tif err != nil {\n\t\t// Error raised during the creation\n\t\tt.Error(\"Apps were not properly added : \", err)\n\t\treturn\n\t}\n\tif len(res) == 0 {\n\t\t// None of apps were created properly\n\t\tt.Error(\"Apps were not properly added : no identifiers returned\")\n\t\treturn\n\t}\n\tfor i := range testApps {\n\t\tif len(res) > 0 && res[i] == \"\" {\n\t\t\t// No object created\n\t\t\tt.Error(\"App number \", i, \" '\", testApps[i].Name, \" was not properly added : no identifier returned\")\n\t\t}\n\t}\n\n\t_, _ = appInteractor.DeleteBatch(res)\n\n\tt.Log(\"TestAddApp: Test Clear\")\n\n\tt.Log(\"TestAddApps: Test Clear\")\n\treturn\n}", "func TestAddSchemesToFramework(t *testing.T) {\n\tlogf.SetLogger(logf.ZapLogger(true))\n\n\tt.Log(\"Adding ServiceBindingRequestList scheme to cluster...\")\n\tsbrlist := v1alpha1.ServiceBindingRequestList{}\n\trequire.NoError(t, framework.AddToFrameworkScheme(apis.AddToScheme, &sbrlist))\n\n\tt.Log(\"Adding ClusterServiceVersionList scheme to cluster...\")\n\tcsvList := olmv1alpha1.ClusterServiceVersionList{}\n\trequire.NoError(t, framework.AddToFrameworkScheme(olmv1alpha1.AddToScheme, &csvList))\n\n\tt.Log(\"Adding DatabaseList scheme to cluster...\")\n\tdbList := pgv1alpha1.DatabaseList{}\n\trequire.NoError(t, framework.AddToFrameworkScheme(pgsqlapis.AddToScheme, &dbList))\n\n\tt.Log(\"Adding EtcdCluster scheme to cluster...\")\n\tetcdCluster := v1beta2.EtcdCluster{}\n\trequire.Nil(t, framework.AddToFrameworkScheme(v1beta2.AddToScheme, &etcdCluster))\n\n\tt.Run(\"end-to-end\", func(t *testing.T) {\n\t\tt.Run(\"scenario-etcd-unannotated-app-db-sbr\", func(t *testing.T) {\n\t\t\tServiceBindingRequest(t, []Step{AppStep, EtcdClusterStep, SBREtcdStep})\n\t\t})\n\t\tt.Run(\"scenario-db-app-sbr\", func(t *testing.T) {\n\t\t\tServiceBindingRequest(t, []Step{DBStep, AppStep, SBRStep})\n\t\t})\n\t\tt.Run(\"scenario-app-db-sbr\", func(t *testing.T) {\n\t\t\tServiceBindingRequest(t, []Step{AppStep, DBStep, SBRStep})\n\t\t})\n\t\tt.Run(\"scenario-db-sbr-app\", func(t *testing.T) {\n\t\t\tServiceBindingRequest(t, []Step{DBStep, SBRStep, AppStep})\n\t\t})\n\t\tt.Run(\"scenario-app-sbr-db\", func(t *testing.T) {\n\t\t\tServiceBindingRequest(t, []Step{AppStep, SBRStep, DBStep})\n\t\t})\n\t\tt.Run(\"scenario-sbr-db-app\", func(t *testing.T) {\n\t\t\tServiceBindingRequest(t, []Step{SBRStep, DBStep, AppStep})\n\t\t})\n\t\tt.Run(\"scenario-sbr-app-db\", func(t *testing.T) {\n\t\t\tServiceBindingRequest(t, []Step{SBRStep, AppStep, DBStep})\n\t\t})\n\t\tt.Run(\"scenario-csv-db-app-sbr\", func(t *testing.T) {\n\t\t\tServiceBindingRequest(t, []Step{CSVStep, DBStep, AppStep, SBRStep})\n\t\t})\n\t\tt.Run(\"scenario-csv-app-db-sbr\", func(t *testing.T) {\n\t\t\tServiceBindingRequest(t, []Step{CSVStep, AppStep, DBStep, SBRStep})\n\t\t})\n\t})\n}", "func TestStringToBin(t *testing.T) {\n\ttestStrings := [3]string{\n\t\t\"abcdefghijklmnopqrstuvxyz\",\n\t\t\"ABCDEFGHIJKLMNOPQRSTUVWXYZ\",\n\t\t\"1234567890!@#$%^&*),./?\",\n\t}\n\n\texpectedStrings := [3]string{\n\t\t\"01100001011000100110001101100100011001010110011001100111011010000110100101101010011010110110110001101101011011100110111101110000011100010111001001110011011101000111010101110110011110000111100101111010\",\n\t\t\"0100000101000010010000110100010001000101010001100100011101001000010010010100101001001011010011000100110101001110010011110101000001010001010100100101001101010100010101010101011001010111010110000101100101011010\",\n\t\t\"0011000100110010001100110011010000110101001101100011011100111000001110010011000000100001010000000010001100100100001001010101111000100110001010100010100100101100001011100010111100111111\",\n\t}\n\n\tfor i, input := range testStrings {\n\t\toutput := stringToBin(input)\n\t\tif output != expectedStrings[i] {\n\t\t\tt.Fail()\n\t\t}\n\t}\n}", "func AddStaticBinary(mux Mux, path string, content []byte) {\n\tmux.Handle(\n\t\tpath,\n\t\thttp.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n\t\t\thttp.ServeContent(w, r, path, kAppStart, bytes.NewReader(content))\n\t\t}))\n}", "func TestAdd(t *testing.T) {\n\tfeed := New()\n\tfeed.Add(Item{})\n\n\tif len(feed.Items) != 1 {\n\t\tt.Errorf(\"Item was not added\")\n\t}\n}", "func TestAddAllEventHandlers(t *testing.T) {\n\ttests := []struct {\n\t\tname string\n\t\tgvkMap map[framework.GVK]framework.ActionType\n\t\texpectStaticInformers map[reflect.Type]bool\n\t\texpectDynamicInformers map[schema.GroupVersionResource]bool\n\t}{\n\t\t{\n\t\t\tname: \"default handlers in framework\",\n\t\t\tgvkMap: map[framework.GVK]framework.ActionType{},\n\t\t\texpectStaticInformers: map[reflect.Type]bool{\n\t\t\t\treflect.TypeOf(&v1.Pod{}): true,\n\t\t\t\treflect.TypeOf(&v1.Node{}): true,\n\t\t\t\treflect.TypeOf(&v1.Namespace{}): true,\n\t\t\t},\n\t\t\texpectDynamicInformers: map[schema.GroupVersionResource]bool{},\n\t\t},\n\t\t{\n\t\t\tname: \"add GVKs handlers defined in framework dynamically\",\n\t\t\tgvkMap: map[framework.GVK]framework.ActionType{\n\t\t\t\t\"Pod\": framework.Add | framework.Delete,\n\t\t\t\t\"PersistentVolume\": framework.Delete,\n\t\t\t\t\"storage.k8s.io/CSIStorageCapacity\": framework.Update,\n\t\t\t},\n\t\t\texpectStaticInformers: map[reflect.Type]bool{\n\t\t\t\treflect.TypeOf(&v1.Pod{}): true,\n\t\t\t\treflect.TypeOf(&v1.Node{}): true,\n\t\t\t\treflect.TypeOf(&v1.Namespace{}): true,\n\t\t\t\treflect.TypeOf(&v1.PersistentVolume{}): true,\n\t\t\t\treflect.TypeOf(&storagev1.CSIStorageCapacity{}): true,\n\t\t\t},\n\t\t\texpectDynamicInformers: map[schema.GroupVersionResource]bool{},\n\t\t},\n\t\t{\n\t\t\tname: \"add GVKs handlers defined in plugins dynamically\",\n\t\t\tgvkMap: map[framework.GVK]framework.ActionType{\n\t\t\t\t\"daemonsets.v1.apps\": framework.Add | framework.Delete,\n\t\t\t\t\"cronjobs.v1.batch\": framework.Delete,\n\t\t\t},\n\t\t\texpectStaticInformers: map[reflect.Type]bool{\n\t\t\t\treflect.TypeOf(&v1.Pod{}): true,\n\t\t\t\treflect.TypeOf(&v1.Node{}): true,\n\t\t\t\treflect.TypeOf(&v1.Namespace{}): true,\n\t\t\t},\n\t\t\texpectDynamicInformers: map[schema.GroupVersionResource]bool{\n\t\t\t\t{Group: \"apps\", Version: \"v1\", Resource: \"daemonsets\"}: true,\n\t\t\t\t{Group: \"batch\", Version: \"v1\", Resource: \"cronjobs\"}: true,\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tname: \"add GVKs handlers defined in plugins dynamically, with one illegal GVK form\",\n\t\t\tgvkMap: map[framework.GVK]framework.ActionType{\n\t\t\t\t\"daemonsets.v1.apps\": framework.Add | framework.Delete,\n\t\t\t\t\"custommetrics.v1beta1\": framework.Update,\n\t\t\t},\n\t\t\texpectStaticInformers: map[reflect.Type]bool{\n\t\t\t\treflect.TypeOf(&v1.Pod{}): true,\n\t\t\t\treflect.TypeOf(&v1.Node{}): true,\n\t\t\t\treflect.TypeOf(&v1.Namespace{}): true,\n\t\t\t},\n\t\t\texpectDynamicInformers: map[schema.GroupVersionResource]bool{\n\t\t\t\t{Group: \"apps\", Version: \"v1\", Resource: \"daemonsets\"}: true,\n\t\t\t},\n\t\t},\n\t}\n\n\tscheme := runtime.NewScheme()\n\tvar localSchemeBuilder = runtime.SchemeBuilder{\n\t\tappsv1.AddToScheme,\n\t\tbatchv1.AddToScheme,\n\t}\n\tlocalSchemeBuilder.AddToScheme(scheme)\n\n\tfor _, tt := range tests {\n\t\tt.Run(tt.name, func(t *testing.T) {\n\t\t\tlogger, ctx := ktesting.NewTestContext(t)\n\t\t\tctx, cancel := context.WithCancel(ctx)\n\t\t\tdefer cancel()\n\n\t\t\tinformerFactory := informers.NewSharedInformerFactory(fake.NewSimpleClientset(), 0)\n\t\t\tschedulingQueue := queue.NewTestQueueWithInformerFactory(ctx, nil, informerFactory)\n\t\t\ttestSched := Scheduler{\n\t\t\t\tStopEverything: ctx.Done(),\n\t\t\t\tSchedulingQueue: schedulingQueue,\n\t\t\t\tlogger: logger,\n\t\t\t}\n\n\t\t\tdynclient := dyfake.NewSimpleDynamicClient(scheme)\n\t\t\tdynInformerFactory := dynamicinformer.NewDynamicSharedInformerFactory(dynclient, 0)\n\n\t\t\tif err := addAllEventHandlers(&testSched, informerFactory, dynInformerFactory, tt.gvkMap); err != nil {\n\t\t\t\tt.Fatalf(\"Add event handlers failed, error = %v\", err)\n\t\t\t}\n\n\t\t\tinformerFactory.Start(testSched.StopEverything)\n\t\t\tdynInformerFactory.Start(testSched.StopEverything)\n\t\t\tstaticInformers := informerFactory.WaitForCacheSync(testSched.StopEverything)\n\t\t\tdynamicInformers := dynInformerFactory.WaitForCacheSync(testSched.StopEverything)\n\n\t\t\tif diff := cmp.Diff(tt.expectStaticInformers, staticInformers); diff != \"\" {\n\t\t\t\tt.Errorf(\"Unexpected diff (-want, +got):\\n%s\", diff)\n\t\t\t}\n\t\t\tif diff := cmp.Diff(tt.expectDynamicInformers, dynamicInformers); diff != \"\" {\n\t\t\t\tt.Errorf(\"Unexpected diff (-want, +got):\\n%s\", diff)\n\t\t\t}\n\t\t})\n\t}\n}", "func TestCheckBinaryExprBoolAddInt(t *testing.T) {\n\tenv := MakeSimpleEnv()\n\n\texpectCheckError(t, `true + 4`, env,\n\t\t`cannot convert 4 to type bool`,\n\t\t`invalid operation: true + 4 (mismatched types bool and int)`,\n\t)\n\n}", "func TestToManyAdd(t *testing.T) {\n\tt.Run(\"CacheToEscrowCaches\", testCacheToManyAddOpEscrowCaches)\n\tt.Run(\"EscrowToBundles\", testEscrowToManyAddOpBundles)\n\tt.Run(\"EscrowToEscrowCaches\", testEscrowToManyAddOpEscrowCaches)\n}", "func TestCheckBinaryExprIntAddBool(t *testing.T) {\n\tenv := MakeSimpleEnv()\n\n\texpectCheckError(t, `4 + true`, env,\n\t\t`cannot convert true to type int`,\n\t\t`invalid operation: 4 + true (mismatched types int and bool)`,\n\t)\n\n}", "func TestCheckBinaryExprBoolAddBool(t *testing.T) {\n\tenv := MakeSimpleEnv()\n\n\texpectCheckError(t, `true + true`, env,\n\t\t`invalid operation: true + true (operator + not defined on bool)`,\n\t)\n\n}", "func (s *upgradeTestSuite) TestUpgradeBinaryNoDownloadUrl() {\n\thome := copyTestData(s.T(), \"validate\")\n\tcfg := &cosmovisor.Config{Home: home, Name: \"dummyd\", AllowDownloadBinaries: true}\n\tlogger := log.NewLogger(os.Stdout).With(log.ModuleKey, \"cosmovisor\")\n\n\tcurrentBin, err := cfg.CurrentBin()\n\ts.Require().NoError(err)\n\n\ts.Require().Equal(cfg.GenesisBin(), currentBin)\n\n\t// do upgrade ignores bad files\n\tfor _, name := range []string{\"missing\", \"nobin\"} {\n\t\tinfo := upgradetypes.Plan{Name: name}\n\t\terr = cosmovisor.UpgradeBinary(logger, cfg, info)\n\t\ts.Require().Error(err, name)\n\t\tcurrentBin, err := cfg.CurrentBin()\n\t\ts.Require().NoError(err)\n\t\ts.Require().Equal(cfg.GenesisBin(), currentBin, name)\n\t}\n\n\t// make sure it updates a few times\n\tfor _, upgrade := range []string{\"chain2\", \"chain3\"} {\n\t\t// now set it to a valid upgrade and make sure CurrentBin is now set properly\n\t\tinfo := upgradetypes.Plan{Name: upgrade}\n\t\terr = cosmovisor.UpgradeBinary(logger, cfg, info)\n\t\ts.Require().NoError(err)\n\t\t// we should see current point to the new upgrade dir\n\t\tupgradeBin := cfg.UpgradeBin(upgrade)\n\t\tcurrentBin, err := cfg.CurrentBin()\n\t\ts.Require().NoError(err)\n\n\t\ts.Require().Equal(upgradeBin, currentBin)\n\t}\n}", "func TestTableAdd(t *testing.T) {\n\n\t//iterate over test array\n\tfor _, test := range testingArray {\n\n\t\t//call Add and get the result\n\t\tresult := Add(test.x, test.y)\n\n\t\t//compare the result to expected. return error if failed\n\t\tif result != test.expected {\n\t\t\tt.Error(\"Testing failed\")\n\t\t}\n\t}\n\n}", "func TestAdd(t *testing.T) {\n\toperand, a, expected := 42, 3, 45\n\tresult := Add(a, operand)\n\tif result != expected {\n\t\tt.Errorf(\"Add result incorrect. Operand: %d, A: %d, Expected: %d, Received: %d\", operand, a, expected, result)\n\t}\n}", "func copyKubernetesTestBinaries(kuberoot string, outroot string) error {\n\tconst dockerizedOutput = \"_output/dockerized\"\n\troot := filepath.Join(kuberoot, dockerizedOutput, \"bin\", runtime.GOOS, runtime.GOARCH)\n\tfor _, binary := range kubernetesTestBinaries {\n\t\tsource := filepath.Join(root, binary)\n\t\tdest := filepath.Join(outroot, binary)\n\t\tif _, err := os.Stat(source); err == nil {\n\t\t\tklog.Infof(\"copying %s to %s\", source, dest)\n\t\t\tif err := CopyFile(source, dest); err != nil {\n\t\t\t\treturn fmt.Errorf(\"failed to copy %s to %s: %v\", source, dest, err.Error())\n\t\t\t}\n\t\t} else {\n\t\t\treturn fmt.Errorf(\"could not find %s: %v\", source, err.Error())\n\t\t}\n\t}\n\treturn nil\n}", "func Add(db *gorm.DB, bundleID string, bookID int) {\n\tlogrus.Debug(\"add\", bundleID, bookID)\n\tif id, err := strconv.Atoi(bundleID); err == nil {\n\t\tvar bundleMaster database.BundleMaster\n\n\t\tif db.Where(database.BundleMaster{ID: uint(id)}).First(&bundleMaster).RecordNotFound() {\n\t\t\tfmt.Println(\"bundle ID does not exsit\")\n\t\t} else {\n\t\t\tbundleDetail := database.BundleDetail{BundleID: uint(id), BookID: bookID}\n\t\t\terr := db.Create(&bundleDetail).Error\n\t\t\tif err != nil {\n\t\t\t\tlogrus.Error(err)\n\t\t\t}\n\t\t}\n\t}\n}", "func (h *MemHome) TestBin(p string) io.WriteCloser {\n\tpkg := h.pkgs[p]\n\tif pkg == nil {\n\t\tpanic(\"pkg not exists\")\n\t}\n\tif pkg.test == nil {\n\t\tpkg.test = newMemFile()\n\t} else {\n\t\tpkg.test.Reset()\n\t}\n\treturn pkg.test\n}", "func TestCurlPostBinaryCookie(t *testing.T) {\n\tcurl := curlTester{\n\t\thandler: \"curl_post_binary_cookie\",\n\t\ttestName: \"TestCurlPostBinaryCookie\",\n\t\ttestHandle: t,\n\t}\n\tcurl.testPostCookie()\n}", "func TestCurlPostBinaryDigestAuth(t *testing.T) {\n\tcurl := curlTester{\n\t\thandler: \"curl_post_binary\",\n\t\ttestName: \"TestCurlPostBinaryDigestAuth\",\n\t\ttestHandle: t,\n\t}\n\tcurl.testPostDigestAuth()\n}", "func TestInsert2(t *testing.T) {\n\tkv := LoadBadger(os.TempDir())\n\tvf := VaultFile{}\n\tinsertVaultFile(kv, \"1\", vf)\n\t_, err := getVaultFile(kv, \"2\")\n\tif err == nil {\n\t\tt.Fatal(\"expect error here\")\n\t}\n}", "func TestNewBinaryChop(t *testing.T) {\n\tfakeAlgo := new(AlgorithmMock)\n\tbinaryChop := NewBinaryChop(fakeAlgo)\n\tassert.Equal(t, binaryChop.algorithm, fakeAlgo, \"algorithms should be pointer\")\n}", "func setupRootfsBinary(t *testing.T, rootfs, path string) {\n\tt.Helper()\n\n\tdst := filepath.Join(rootfs, path)\n\terr := os.MkdirAll(filepath.Dir(dst), 0755)\n\trequire.NoError(t, err)\n\n\tsrc := filepath.Join(\n\t\t\"test-resources\", \"busybox\",\n\t\tfmt.Sprintf(\"busybox-%s\", runtime.GOARCH),\n\t)\n\n\terr = os.Link(src, dst)\n\tif err != nil {\n\t\t// On failure, fallback to copying the file directly.\n\t\t// Linking may fail if the test source code lives on a separate\n\t\t// volume/partition from the temp dir used for testing\n\t\tcopyFile(t, src, dst)\n\t}\n}", "func (b Plugin) Add(taps []string) error {\n\tif len(taps) == 0 {\n\t\tlogrus.Info(\"no Hombrew taps to install\")\n\t\treturn nil\n\t}\n\tlogrus.Info(\"Installing brew packages:\", taps)\n\tbrewArgs := append([]string{\"tap\"}, taps...)\n\t_, err := b.Commander(brewExe, brewArgs...)\n\tif err != nil {\n\t\tlogrus.Error(\"Failed installing brew packages:\", err)\n\t\treturn err\n\t}\n\treturn nil\n}", "func TestAddProductToCatalog(t *testing.T) {\n\t\n\te := httpexpect.New(t, API_URL)\n\t\n\tprintComment(\"ADD0001\", \"Test add product 1 to catalog --> ult_small Unlimited 1GB $24.90\")\n\tproduct := map[string]interface{}{\n\t\t\"code\": \"ult_small\",\n\t\t\"name\": \"Unlimited 1GB\",\n\t\t\"price\": 24.90,\n\t}\n\n\te.POST(\"/products\").\n\t\tWithJSON(product).\n\t\tExpect().\n\t\tStatus(http.StatusOK)\n\n}", "func TestGetAllBackendServer(t *testing.T) {\n\tcloud, _, resp, err := beforeTestBlb()\n\tif err != nil {\n\t\tt.Errorf(\"beforeTestBlb err, err: %v\", err)\n\t}\n\tctx := context.Background()\n\t// bs is nil\n\tlb := &blb.LoadBalancer{\n\t\tBlbId: resp.LoadBalancerId,\n\t}\n\tbs, err := cloud.getAllBackendServer(ctx, lb)\n\tif err != nil {\n\t\tt.Errorf(\"getAllBackendServer err, err: %v\", err)\n\t}\n\tif len(bs) != 0 {\n\t\tt.Errorf(\"getAllBackendServer err, bs should be nil but get : %v\", bs)\n\t}\n\t// add bs\n\tbsAdd := []blb.BackendServer{\n\t\t{\n\t\t\tInstanceId: \"1\",\n\t\t},\n\t\t{\n\t\t\tInstanceId: \"2\",\n\t\t},\n\t}\n\targs := blb.AddBackendServersArgs{\n\t\tLoadBalancerId: lb.BlbId,\n\t\tBackendServerList: bsAdd,\n\t}\n\terr = cloud.clientSet.BLBClient.AddBackendServers(ctx, &args, &bce.SignOption{\n\t\tCustomSignFunc: CCEServiceSign,\n\t})\n\tif err != nil {\n\t\tt.Errorf(\"AddBackendServers err, err: %v\", err)\n\t}\n\t// get bs\n\tbs, err = cloud.getAllBackendServer(ctx, lb)\n\tif err != nil {\n\t\tt.Errorf(\"getAllBackendServer err, err: %v\", err)\n\t}\n\tif len(bs) != 2 {\n\t\tt.Errorf(\"getAllBackendServer err, bs should be nil but get : %v\", bs)\n\t}\n}", "func TestCommitMultipleKeys4A(t *testing.T) {\n}", "func TestAdditionalObjects(t *testing.T) {\n\tnewIntegrationTest(\"additionalobjects.example.com\", \"additionalobjects\").\n\t\twithAddons(dnsControllerAddon, awsEBSCSIAddon, leaderElectionAddon).\n\t\trunTestTerraformAWS(t)\n}", "func BinInstaller(pkgType resource.PkgType, f *eksd.EKSD) (func(string, string) plan.Resource, error) {\n\tif f != nil {\n\t\tlog.Debugf(\"Using flavor %+v\", f)\n\t\treturn func(binName, version string) plan.Resource {\n\t\t\t// TODO (Mark) logic for the architecture\n\t\t\tbinURL, sha256, err := f.KubeBinURL(binName)\n\t\t\tif err != nil {\n\t\t\t\tlog.Fatalf(\"%v\", err)\n\t\t\t\treturn nil\n\t\t\t}\n\t\t\tbinPath := \"/usr/bin/\" + binName\n\t\t\treturn &resource.Run{\n\t\t\t\tScript: object.String(fmt.Sprintf(\"curl -o %s %s && openssl dgst -sha256 %s | grep \\\"%s\\\" > /dev/null && chmod 755 %s\", binPath, binURL, binPath, sha256, binPath)),\n\t\t\t\tUndoScript: object.String(fmt.Sprintf(\"pkill --uid 0 %s && rm %s || true\", binName, binPath))}\n\t\t}, nil\n\t}\n\tif pkgType == resource.PkgTypeDeb {\n\t\treturn func(binName, version string) plan.Resource {\n\t\t\treturn &resource.Deb{Name: binName, Suffix: \"=\" + version + \"-00\"}\n\t\t}, nil\n\t}\n\treturn func(binName, version string) plan.Resource {\n\t\treturn &resource.RPM{Name: binName, Version: version, DisableExcludes: \"kubernetes\"}\n\t}, nil\n\n}", "func init() {\n\t\tpackr.PackJSONBytes(\"./lua\", \"add_to_topic.lua\", \"\\\"bG9jYWwgdG9waWNJRCA9IEtFWVNbMV0KbG9jYWwgZXhwaXJlQXQgPSBBUkdWWzFdCmxvY2FsIGNoYW5uZWxJRCA9IEFSR1ZbMl0KbG9jYWwgcmVzID0gcmVkaXMuY2FsbCgnemFkZCcsIHRvcGljSUQsICdOWCcsICcwJywgY2hhbm5lbElEKQppZiByZXMgPT0gMCB0aGVuCiAgICByZXR1cm4gMAplbmQKbG9jYWwgYyA9IHRvbnVtYmVyKHJlZGlzLmNhbGwoJ3R0bCcsIHRvcGljSUQpKQppZiBjIDwgMCB0aGVuCiAgICByZWRpcy5jYWxsKCdleHBpcmVhdCcsIHRvcGljSUQsIGV4cGlyZUF0KQplbmQKcmV0dXJuIDEK\\\"\")\n\t\tpackr.PackJSONBytes(\"./lua\", \"create_or_extend_queue.lua\", \"\\\"bG9jYWwgY2hhbm5lbElEID0gS0VZU1sxXQpsb2NhbCBleHBpcmVJbiA9IEFSR1ZbMV0KbG9jYWwgYyA9IHRvbnVtYmVyKHJlZGlzLmNhbGwoJ3R0bCcsIGNoYW5uZWxJRCkpCmlmIGMgfj0gLTIgdGhlbgogICAgbG9jYWwgbiA9IHRvbnVtYmVyKGV4cGlyZUluKQogICAgaWYgYyA+PSAwIGFuZCBuIDwgYyB0aGVuCiAgICAgICAgcmV0dXJuIDEKICAgIGVuZAogICAgcmVkaXMuY2FsbCgnZXhwaXJlJywgY2hhbm5lbElELCBleHBpcmVJbikKICAgIHJldHVybiAxCmVuZApyZWRpcy5jYWxsKCd4YWRkJywgY2hhbm5lbElELCAnMC0xJywgJ25ld19xdWV1ZScsICcwJykKcmVkaXMuY2FsbCgnZXhwaXJlJywgY2hhbm5lbElELCBleHBpcmVJbikKcmVkaXMuY2FsbCgneGRlbCcsIGNoYW5uZWxJRCwgJzAtMScpCnJldHVybiAyCg==\\\"\")\n\t\tpackr.PackJSONBytes(\"./lua\", \"extend_queue.lua\", \"\\\"bG9jYWwgY2hhbm5lbElEID0gS0VZU1sxXQpsb2NhbCBleHBpcmVJbiA9IEFSR1ZbMV0KbG9jYWwgYyA9IHRvbnVtYmVyKHJlZGlzLmNhbGwoJ3R0bCcsIGNoYW5uZWxJRCkpCmlmIGMgPT0gLTIgdGhlbgogICAgcmV0dXJuIDAKZW5kCmxvY2FsIG4gPSB0b251bWJlcihleHBpcmVJbikKaWYgYyB+PSAtMSBhbmQgbiA8IGMgdGhlbgogICAgcmV0dXJuIDEKZW5kCnJlZGlzLmNhbGwoJ2V4cGlyZScsIGNoYW5uZWxJRCwgZXhwaXJlSW4pCnJldHVybiAxCg==\\\"\")\n\t\tpackr.PackJSONBytes(\"./lua\", \"push_if_exists.lua\", \"\\\"bG9jYWwgY2hhbm5lbElEID0gS0VZU1sxXQpsb2NhbCBleGlzdHMgPSByZWRpcy5jYWxsKCdleGlzdHMnLCBjaGFubmVsSUQpCmlmIGV4aXN0cyA9PSAwIHRoZW4KICAgIHJldHVybiBuaWwKZW5kCnJldHVybiByZWRpcy5jYWxsKCd4YWRkJywgY2hhbm5lbElELCAnKicsIHVucGFjayhBUkdWKSkK\\\"\")\n}", "func TestAddTag(t *testing.T) {\n\tdb := getDb(t)\n\tdefer db.Close()\n\ttags, err := GetAllTags(db)\n\tif err != nil || (tags != nil && len(tags) > 0) {\n\t\tt.Errorf(\"Tag database should start off empty\")\n\t}\n\n\ttagText := \"toptag\"\n\n\t// add a top-level tag and ensure it's inserted\n\ttagInfo, err := AddTag(db, tagText, nil)\n\tif err != nil || tagInfo.Id == metadata.UnknownTag.Id {\n\t\tt.Errorf(\"could not insert tag\")\n\t}\n\t// ensure it's there\n\ttags, _ = GetAllTags(db)\n\tif len(tags) != 1 {\n\t\tt.Errorf(\"Expected 1 tag but found %d\", len(tags))\n\t}\n\tif tags[0].Id != tagInfo.Id || tags[0].Text != tagInfo.Text || tagInfo.Text != tagText {\n\t\tt.Errorf(\"Tag found did not match values from insert\")\n\t}\n\n\t//ensure we don't get a duplicate if we try to insert again\n\totherTagInfo, err := AddTag(db, tagText, nil)\n\tif otherTagInfo.Id != tagInfo.Id {\n\t\tt.Errorf(\"Expected to get id %d back from duplicate insert but found %d\", tagInfo.Id, otherTagInfo.Id)\n\t}\n\n\t// now insert a child tag and ensure it is associated\n\tchildTag, err := AddTag(db, \"child\", []metadata.TagInfo{tagInfo})\n\tif childTag.Id == metadata.UnknownTag.Id {\n\t\tt.Errorf(\"Could not insert child tag\")\n\t}\n\n}", "func TestNewFile(t *testing.T) {\n\tdir, err := ioutil.TempDir(\"\", tstprefix)\n\tif err != nil {\n\t\tt.Fatalf(\"error creating tempdir: %v\", err)\n\t}\n\tdefer os.RemoveAll(dir)\n\tds := NewTestStore()\n\n\timj := `\n\t\t{\n\t\t \"acKind\": \"ImageManifest\",\n\t\t \"acVersion\": \"0.1.1\",\n\t\t \"name\": \"example.com/test01\"\n\t\t}\n\t`\n\n\tentries := []*testTarEntry{\n\t\t{\n\t\t\tcontents: imj,\n\t\t\theader: &tar.Header{\n\t\t\t\tName: \"manifest\",\n\t\t\t\tSize: int64(len(imj)),\n\t\t\t},\n\t\t},\n\t}\n\n\tkey1, err := newTestACI(entries, dir, ds)\n\tif err != nil {\n\t\tt.Fatalf(\"unexpected error: %v\", err)\n\t}\n\tim, err := createImageManifest(imj)\n\tif err != nil {\n\t\tt.Fatalf(\"unexpected error: %v\", err)\n\t}\n\timage1 := Image{Im: im, Key: key1, Level: 0}\n\n\timj = `\n\t\t{\n\t\t \"acKind\": \"ImageManifest\",\n\t\t \"acVersion\": \"0.1.1\",\n\t\t \"name\": \"example.com/test02\"\n\t\t}\n\t`\n\n\tk1, _ := types.NewHash(key1)\n\timj, err = addDependencies(imj,\n\t\ttypes.Dependency{\n\t\t\tImageName: \"example.com/test01\",\n\t\t\tImageID: k1},\n\t)\n\n\tentries = []*testTarEntry{\n\t\t{\n\t\t\tcontents: imj,\n\t\t\theader: &tar.Header{\n\t\t\t\tName: \"manifest\",\n\t\t\t\tSize: int64(len(imj)),\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tcontents: \"hellohello\",\n\t\t\theader: &tar.Header{\n\t\t\t\tName: \"rootfs/a/file01.txt\",\n\t\t\t\tSize: 10,\n\t\t\t},\n\t\t},\n\t}\n\n\texpectedFiles := []*fileInfo{\n\t\t&fileInfo{path: \"manifest\", typeflag: tar.TypeReg},\n\t\t&fileInfo{path: \"rootfs/a/file01.txt\", typeflag: tar.TypeReg, size: 10},\n\t}\n\n\tkey2, err := newTestACI(entries, dir, ds)\n\tif err != nil {\n\t\tt.Fatalf(\"unexpected error: %v\", err)\n\t}\n\tim, err = createImageManifest(imj)\n\tif err != nil {\n\t\tt.Fatalf(\"unexpected error: %v\", err)\n\t}\n\timage2 := Image{Im: im, Key: key2, Level: 1}\n\n\timages := Images{image2, image1}\n\terr = checkRenderACIFromList(images, expectedFiles, ds)\n\tif err != nil {\n\t\tt.Fatalf(\"unexpected error: %v\", err)\n\t}\n\terr = checkRenderACI(\"example.com/test02\", expectedFiles, ds)\n\tif err != nil {\n\t\tt.Fatalf(\"unexpected error: %v\", err)\n\t}\n}", "func TestBstAdd(t *testing.T) {\n\ttestval1 := 1\n\ttestval2 := 2\n\ttestval3 := 3\n\ttestval4 := 4\n\ttestval5 := 5\n\ttestval6 := 6\n\ttestval7 := 7\n\ttestval8 := 8\n\ttestval9 := 9\n\n\troot := NewRoot(NewTestWrapInt(testval3))\n\n\tif toInt(root.Value) != testval3 {\n\t\tt.Errorf(\"root.Value = %v; want = %v\", root.Value, testval3)\n\t}\n\n\troot.Add(NewTestWrapInt(testval5))\n\n\tif root.Right == nil {\n\t\tt.Errorf(\"root.Right = %v; want = %v\", root.Right, NewTestWrapInt(testval5))\n\t}\n\n\tif root.Left != nil {\n\t\tt.Errorf(\"root.Left = %v; want = %v\", root.Left, nil)\n\t}\n\n\tif toInt(root.Right.Value) != testval5 {\n\t\tt.Errorf(\"root.Value = %v; want = %v\", root.Right.Value, testval5)\n\t}\n\n\troot.Add(NewTestWrapInt(testval1))\n\troot.Add(NewTestWrapInt(testval6))\n\troot.Add(NewTestWrapInt(testval2))\n\troot.Add(NewTestWrapInt(testval4))\n\troot.Add(NewTestWrapInt(testval7))\n\troot.Add(NewTestWrapInt(testval8))\n\troot.Add(NewTestWrapInt(testval9))\n\n\t// valid leafs\n\n\tleaf1 := root.Left.Value\n\tleaf6 := root.Right.Right.Value\n\tleaf2 := root.Left.Right.Value\n\tleaf4 := root.Right.Left.Value\n\tleaf7 := root.Right.Right.Right.Value\n\tleaf8 := root.Right.Right.Right.Right.Value\n\tleaf9 := root.Right.Right.Right.Right.Right.Value\n\n\tif toInt(leaf4) != testval4 {\n\t\tt.Errorf(\"leaf 4 = %v; want = %v\", leaf4, testval4)\n\t}\n\n\tif toInt(leaf1) != testval1 {\n\t\tt.Errorf(\"leaf 1 = %v; want = %v\", leaf1, testval1)\n\t}\n\n\tif toInt(leaf2) != testval2 {\n\t\tt.Errorf(\"leaf 2 = %v; want = %v\", leaf2, testval2)\n\t}\n\n\tif toInt(leaf6) != testval6 {\n\t\tt.Errorf(\"leaf 6 = %v; want = %v\", leaf6, testval6)\n\t}\n\n\tif toInt(leaf7) != testval7 {\n\t\tt.Errorf(\"leaf 7 = %v; want = %v\", leaf7, testval7)\n\t}\n\n\tif toInt(leaf8) != testval8 {\n\t\tt.Errorf(\"leaf 8 = %v; want = %v\", leaf8, testval8)\n\t}\n\n\tif toInt(leaf9) != testval9 {\n\t\tt.Errorf(\"leaf 9 = %v; want = %v\", leaf9, testval9)\n\t}\n\n\tif root.Left.Left != nil {\n\t\tt.Errorf(\"leaf root.Left.Left = %v; want = %v\", root.Left.Left, nil)\n\t}\n\n\troot.Add(NewTestWrapInt(0))\n\n\tif toInt(root.Left.Left.Value) != 0 {\n\t\tt.Errorf(\"leaf root.Left.Left = %v; want = %v\", root.Left.Left.Value, 0)\n\t}\n\n}", "func testAppendStringToByteSlice() {\n\tfmt.Println(\"testAppendStringToByteSlice\")\n\ts := []byte(\"hello\")\n\ts = append(s, \" world\"...)\n\tfmt.Println(s)\n\tfmt.Println()\n}", "func (restorer *APTRestorer) addFile(restoreState *models.RestoreState, absPath, relativePath string) {\n\tgf := models.NewGenericFile()\n\tgf.IntellectualObjectIdentifier = restoreState.IntellectualObject.Identifier\n\tgf.Identifier = fmt.Sprintf(\"%s/%s\", restoreState.IntellectualObject.Identifier, relativePath)\n\tmd5, err := fileutil.CalculateChecksum(absPath, constants.AlgMd5)\n\tif err != nil {\n\t\trestoreState.PackageSummary.AddError(\"Can't get md5 digest of %s: %v\", absPath, err)\n\t}\n\tsha256, err := fileutil.CalculateChecksum(absPath, constants.AlgSha256)\n\tif err != nil {\n\t\trestoreState.PackageSummary.AddError(\"Can't get sha256 digest of %s: %v\", absPath, err)\n\t}\n\tchecksumMd5 := &models.Checksum{\n\t\tAlgorithm: constants.AlgMd5,\n\t\tDigest: md5,\n\t\tDateTime: time.Now().UTC(),\n\t}\n\tchecksumSha256 := &models.Checksum{\n\t\tAlgorithm: constants.AlgSha256,\n\t\tDigest: sha256,\n\t\tDateTime: time.Now().UTC(),\n\t}\n\tgf.Checksums = append(gf.Checksums, checksumMd5)\n\tgf.Checksums = append(gf.Checksums, checksumSha256)\n\t//restorer.Context.MessageLog.Info(\"ObjIdentifer: %s, gf.OriginalPath: %s\",\n\t//\trestoreState.IntellectualObject.Identifier, gf.OriginalPath())\n\n\t// PT #158704126\n\t// Because we have saved the bag-info.txt file for a number of bags,\n\t// our IntellectualObject may have checksums for that original file.\n\t// We need to get rid of those, so they don't show up in the tag-manifests.\n\tif gf.OriginalPath() == \"bag-info.txt\" {\n\t\tindex := -1\n\t\tfor i, file := range restoreState.IntellectualObject.GenericFiles {\n\t\t\tif file.OriginalPath() == \"bag-info.txt\" {\n\t\t\t\tindex = i\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t\tif index > -1 {\n\t\t\trestorer.Context.MessageLog.Info(\"Deleting old bag-info.txt restoration record from %s so we can replace it with info about the newly generated bag-info.txt file.\",\n\t\t\t\trestoreState.IntellectualObject.Identifier)\n\t\t\tfiles := restoreState.IntellectualObject.GenericFiles\n\t\t\tcopy(files[index:], files[index+1:])\n\t\t\tfiles[len(files)-1] = nil // so we can garbage-collect the GenericFile we're deleting\n\t\t\trestoreState.IntellectualObject.GenericFiles = files[:len(files)-1]\n\t\t}\n\t}\n\trestoreState.IntellectualObject.GenericFiles = append(\n\t\trestoreState.IntellectualObject.GenericFiles, gf)\n\trestorer.Context.MessageLog.Info(\"Added file %s to bag. Abs path: %s. Relative path: %s\",\n\t\tgf.Identifier, absPath, relativePath)\n}", "func TestSingleCommit4A(t *testing.T) {\n}", "func Test_Pack(t *testing.T) {\n\t_, packData, err := evmAbi.Pack(\"mintTokenBatch(14KEKbYtKKQm4wMthSK9J4La4nAiidGozt, [1,2,3], [100, 200, 300])\", abiStr, false)\n\tassert.Equal(t, nil, err)\n\tpackStr := common.ToHex(packData)\n\tfmt.Println(\"packStr = \", packStr)\n\t//0xa08fad67000000000000000000000000245afbf176934ccdd7ca291a8dddaa13c8184822000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000e000000000000000000000000000000000000000000000000000000000000000030000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000030000000000000000000000000000000000000000000000000000000000000003000000000000000000000000000000000000000000000000000000000000006400000000000000000000000000000000000000000000000000000000000000c8000000000000000000000000000000000000000000000000000000000000012c\n}", "func (cfg *Config) genBinarySpec(t xsd.Builtin) ([]spec, error) {\n\tcfg.debugf(\"generating Go source for binary type %q\", xsd.XMLName(t).Local)\n\ts := spec{\n\t\texpr: builtinExpr(t),\n\t\tname: xsd.XMLName(t).Local,\n\t\txsdType: t,\n\t}\n\tmarshal := gen.Func(\"MarshalText\").Receiver(\"b \"+s.name).Returns(\"[]byte\", \"error\")\n\tunmarshal := gen.Func(\"UnmarshalText\").Receiver(\"b \" + s.name).Args(\"text []byte\").\n\t\tReturns(\"err error\")\n\n\tswitch t {\n\tcase xsd.HexBinary:\n\t\tunmarshal.Body(`\n\t\t\t*b, err = hex.DecodeString(string(text))\n\t\t\treturn err\n\t\t`)\n\t\tmarshal.Body(`\n\t\t\tn := hex.EncodedLen([]byte(b))\n\t\t\tbuf := make([]byte, n)\n\t\t\thex.Encode(buf, []byte(b))\n\t\t\treturn buf, nil\n\t\t`)\n\tcase xsd.Base64Binary:\n\t\tunmarshal.Body(`\n\t\t\t*b, err = base64.StdEncoding.DecodeString(string(text))\n\t\t\treturn err\n\t\t`)\n\t\tmarshal.Body(`\n\t\t\tvar buf bytes.Buffer\n\t\t\tenc := base64.NewEncoder(base64.StdEncoding, &buf)\n\t\t\tenc.Write([]byte(b))\n\t\t\tenc.Close()\n\t\t\treturn buf.Bytes()\n\t\t`)\n\t}\n\tmarshalFn, err := marshal.Decl()\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"MarshalText %s: %v\", s.name, err)\n\t}\n\tunmarshalFn, err := unmarshal.Decl()\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"UnmarshalText %s: %v\", s.name, err)\n\t}\n\ts.methods = append(s.methods, unmarshalFn, marshalFn)\n\treturn []spec{s}, nil\n}", "func TestOracleMsg_AddAsset(t *testing.T) {\n\tt.Parallel()\n\n\tnominee := sdk.AccAddress([]byte(\"someName\"))\n\tassetCode := dnTypes.AssetCode(\"btc_xfi\")\n\toracles := Oracles([]Oracle{NewOracle(sdk.AccAddress([]byte(\"someName\")))})\n\tasset := NewAsset(assetCode, oracles, true)\n\n\tt.Run(\"MsgInterface\", func(t *testing.T) {\n\t\ttarget := NewMsgAddAsset(nominee, asset)\n\t\trequire.Equal(t, \"add_asset\", target.Type())\n\t\trequire.Equal(t, RouterKey, target.Route())\n\t\trequire.True(t, len(target.GetSignBytes()) > 0)\n\t\trequire.Equal(t, []sdk.AccAddress{nominee}, target.GetSigners())\n\t})\n\n\tt.Run(\"ValidateBasic\", func(t *testing.T) {\n\t\t// ok\n\t\t{\n\t\t\tmsg := NewMsgAddAsset(nominee, asset)\n\t\t\trequire.NoError(t, msg.ValidateBasic())\n\t\t}\n\n\t\t// fail: invalid asset code\n\t\t{\n\t\t\ttmpAsset := &asset\n\t\t\tasset2 := *tmpAsset\n\t\t\tasset2.AssetCode = dnTypes.AssetCode(\"wrong\")\n\t\t\tmsg := NewMsgAddAsset(nominee, asset2)\n\t\t\trequire.Error(t, msg.ValidateBasic())\n\t\t}\n\n\t\t// fail: invalid nominee\n\t\t{\n\t\t\tmsg := NewMsgAddAsset(sdk.AccAddress{}, asset)\n\t\t\trequire.Error(t, msg.ValidateBasic())\n\t\t}\n\n\t\t// fail: invalid asset\n\t\t{\n\t\t\tmsg := NewMsgAddAsset(nominee, Asset{})\n\t\t\trequire.Error(t, msg.ValidateBasic())\n\t\t}\n\t})\n}", "func TestAddToSecretFromDataBase64EncodesInput(t *testing.T) {\n\tt.Parallel()\n\n\tcontents := random.UniqueId()\n\tsecret := PrepareSecret(\n\t\t\"test-namespace\",\n\t\t\"test-name\",\n\t\tmap[string]string{},\n\t\tmap[string]string{},\n\t)\n\tAddToSecretFromData(secret, \"data\", []byte(contents))\n\tassert.Equal(t, secret.Data[\"data\"], []byte(contents))\n}", "func TestAddRecipe(t *testing.T) {\n\tpayload := fmt.Sprintf(`\n {\n \"mealtype\": \"Breakfast\",\n \"name\": \"Pancakes\",\n \"Ingredients\": [ \"150g all purpose flour\",\n \t\t\t\t \"150ml of milk\"],\n \"preparation\": \"Add all ingredients and mix. Put in Pan.\"\n}`)\n\n\tresponse, err := http.Post(baseURL+\"/recipes\", \"application/json\", strings.NewReader(payload))\n\tif err != nil {\n\t\tt.Fatalf(\"failed to get json, %s\", err)\n\t}\n\n\tcheckResponseCode(t, http.StatusOK, response.StatusCode)\n}", "func TestLoadABI(t *testing.T) {\n\n\tconst AbiPath = \"/src/github.com/cosmos/peggy/cmd/ebrelayer/contract/abi/BridgeBank.abi\"\n\n\t//Get the ABI ready\n\tabi := LoadABI(true)\n\n\trequire.NotNil(t, abi.Events[\"LogLock\"])\n}", "func TestAdd(t *testing.T) {\n\tassert.Equal(t, NewAdd(NewIntegerLiteral(1), NewIntegerLiteral(2)).Eval(nil), NewIntValue(3))\n}", "func TestCurlPutBinaryCookie(t *testing.T) {\n\tcurl := curlTester{\n\t\thandler: \"curl_put_binary_cookie\",\n\t\ttestName: \"TestCurlPutBinaryCookie\",\n\t\ttestHandle: t,\n\t}\n\tcurl.testPutCookie()\n}", "func TestAddNetwork(t *testing.T) {\n\t// initialize rsrcMgr since we use it for resource allocation\n\trsrcMgr.Init(nil)\n\n\t// Initialize the ctrler\n\tInit()\n\n\t// Create network\n\tnetwork, err := NewNetwork(\"default\")\n\tif err != nil {\n\t\tt.Errorf(\"Error creating network default. Err: %v\", err)\n\t\treturn\n\t}\n\n\tlog.Infof(\"Successfully Created network: %+v\", network)\n\n\t// Create new endpoint\n\tep, err := network.NewEndPoint(\"alta1234.0\")\n\tif err != nil {\n\t\tt.Errorf(\"Error creating network endpoint. Err: %v\", err)\n\t\treturn\n\t}\n\n\tlog.Infof(\"Successfully Created endpoint: %+v\", ep)\n}", "func TestAddCMD(t *testing.T) {\n\tinitdb()\n\ttestSuit := []struct {\n\t\targs []string\n\t\texpected string\n\t}{\n\t\t{args: []string{\"do\", \"testing\"}, expected: `Task:\"do testing\" is Added in todo list`},\n\t\t{args: []string{\"do\", \"development\"}, expected: `Task:\"do development\" is Added in todo list`},\n\t\t{args: []string{\"do\", \"deployment\"}, expected: `Task:\"do deployment\" is Added in todo list`},\n\t\t{args: []string{\"do\", \"release\"}, expected: `Task:\"do release\" is Added in todo list`},\n\t\t{args: []string{}, expected: `Please provide task`},\n\t}\n\tfile, _ := os.Create(\"./testresult.txt\")\n\tfile.Truncate(0)\n\tdefer file.Close()\n\tdefer os.Remove(file.Name())\n\told := os.Stdout\n\tos.Stdout = file\n\tfor _, testcase := range testSuit {\n\t\tAddTask.Run(AddTask, testcase.args)\n\t\tfile.Seek(0, 0)\n\t\tfp, _ := ioutil.ReadFile(file.Name())\n\n\t\tmatch, err := regexp.Match(testcase.expected, fp)\n\t\tif err != nil {\n\t\t\tt.Error(\"Error in expected result regex\")\n\t\t}\n\t\tif match {\n\t\t\tt.Log(\"Result is as Expected\")\n\t\t} else {\n\t\t\tt.Error(\"Result is not as Expected\")\n\t\t}\n\t}\n\tos.Stdout = old\n}", "func TestInsert(t *testing.T) {\n\thash := \"5891b5b522d5df086d0ff0b110fbd9d21bb4fc7163af34d08286a2e846f6be03\"\n\t// use fake data\n\tvf := VaultFile{\n\t\tHash: hash,\n\t\tAliases: []string{\"foo/bar\", \"foo\"},\n\t\tGlacier: \"\",\n\t\tKeyId: \"C21B7817\",\n\t}\n\n\tkv := LoadBadger(os.TempDir())\n\tinsertVaultFile(kv, hash, vf)\n\tvf, err := getVaultFile(kv, hash)\n\n\tif err != nil {\n\t\tt.Fatal(\"error insert or get: \", err.Error())\n\t}\n\n\tif vf.Hash != hash {\n\t\tt.Fatal(\"wrong hash value: \", vf.Hash)\n\t}\n\tif len(vf.Aliases) != 2 || vf.Aliases[0] != \"foo/bar\" || vf.Aliases[1] != \"foo\" {\n\t\tt.Fatal(\"wrong aliases\")\n\t}\n\tif vf.Glacier != \"\" {\n\t\tt.Fatal(\"wrong glaicer id\")\n\t}\n\tif vf.KeyId != \"C21B7817\" {\n\t\tt.Fatal(\"wrong keyid\")\n\t}\n}", "func TestAddBlock(t *testing.T) {\n\tblockchain := Blockchain{}\n\tblockchain.AddBlock(\"hello\")\n\tlastBlock := blockchain[len(blockchain)-1]\n\n\tassertEq(t, lastBlock.Data, \"hello\")\n}", "func GenerateBinaries(c Calls, provider fsProviderFn) map[string]string {\n\t// Load all binaries\n\tbinaries := make(map[string]string)\n\tfor project, config := range c {\n\t\tbinaries[project] = loadBinary(provider, *config)\n\t}\n\treturn binaries\n}", "func add(a, b, carry int32) (sum int32, newCarry int32) {\n\tsum = a + b + carry\n\tif sum >= wordBase {\n\t\tnewCarry = 1\n\t\tsum -= wordBase\n\t} else {\n\t\tnewCarry = 0\n\t}\n\treturn sum, newCarry\n}", "func TestInstructionSingleAppend(t *testing.T) {\n\thost := newTestHost()\n\tmdm := New(host)\n\tdefer mdm.Stop()\n\n\t// Create a program to append a full sector to a storage obligation.\n\tappendData1 := randomSectorData()\n\tappendDataRoot1 := crypto.MerkleRoot(appendData1)\n\tpt := newTestPriceTable()\n\tduration := types.BlockHeight(fastrand.Uint64n(5))\n\ttb := newTestProgramBuilder(pt, duration)\n\ttb.AddAppendInstruction(appendData1, true)\n\n\t// Execute it.\n\tso := host.newTestStorageObligation(true)\n\tfinalizeFn, budget, outputs, err := mdm.ExecuteProgramWithBuilderManualFinalize(tb, so, duration, true)\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\t// Assert the outputs.\n\tfor _, output := range outputs {\n\t\terr = output.assert(modules.SectorSize, crypto.MerkleRoot(appendData1), []crypto.Hash{}, nil, nil)\n\t\tif err != nil {\n\t\t\tt.Fatal(err)\n\t\t}\n\t}\n\t// The storage obligation should be unchanged before finalizing the program.\n\tif len(so.sectorMap) > 0 {\n\t\tt.Fatalf(\"wrong sectorMap len %v > %v\", len(so.sectorMap), 0)\n\t}\n\tif len(so.sectorRoots) > 0 {\n\t\tt.Fatalf(\"wrong sectorRoots len %v > %v\", len(so.sectorRoots), 0)\n\t}\n\t// Finalize the program.\n\tif err := finalizeFn(so); err != nil {\n\t\tt.Fatal(err)\n\t}\n\t// Budget should be empty now.\n\tif !budget.Remaining().IsZero() {\n\t\tt.Fatal(\"budget wasn't completely depleted\")\n\t}\n\t// Check the storage obligation again.\n\tif len(so.sectorMap) != 1 {\n\t\tt.Fatalf(\"wrong sectorMap len %v != %v\", len(so.sectorMap), 1)\n\t}\n\tif len(so.sectorRoots) != 1 {\n\t\tt.Fatalf(\"wrong sectorRoots len %v != %v\", len(so.sectorRoots), 1)\n\t}\n\tif _, exists := so.sectorMap[appendDataRoot1]; !exists {\n\t\tt.Fatal(\"sectorMap contains wrong root\")\n\t}\n\tif so.sectorRoots[0] != appendDataRoot1 {\n\t\tt.Fatal(\"sectorRoots contains wrong root\")\n\t}\n\n\t// Execute same program again to append another sector.\n\tappendData2 := randomSectorData() // new random data\n\tappendDataRoot2 := crypto.MerkleRoot(appendData2)\n\tduration = types.BlockHeight(1)\n\ttb = newTestProgramBuilder(pt, duration)\n\ttb.AddAppendInstruction(appendData2, true)\n\tics := so.ContractSize()\n\n\t// Expected outputs\n\texpectedOutput := output{\n\t\tNewSize: ics + modules.SectorSize,\n\t\tNewMerkleRoot: cachedMerkleRoot([]crypto.Hash{appendDataRoot1, appendDataRoot2}),\n\t\tProof: []crypto.Hash{appendDataRoot1},\n\t}\n\n\t// Execute it.\n\tfinalizeFn, budget, outputs, err = mdm.ExecuteProgramWithBuilderManualFinalize(tb, so, duration, true)\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\t// Assert the outputs.\n\tfor _, output := range outputs {\n\t\terr = output.assert(expectedOutput.NewSize, expectedOutput.NewMerkleRoot, expectedOutput.Proof, expectedOutput.Output, nil)\n\t\tif err != nil {\n\t\t\tt.Fatal(err)\n\t\t}\n\t}\n\t// The storage obligation should be unchanged before finalizing the program.\n\tif len(so.sectorMap) != 1 {\n\t\tt.Fatalf(\"wrong sectorMap len %v > %v\", len(so.sectorMap), 1)\n\t}\n\tif len(so.sectorRoots) != 1 {\n\t\tt.Fatalf(\"wrong sectorRoots len %v > %v\", len(so.sectorRoots), 1)\n\t}\n\t// Finalize the program.\n\tif err := finalizeFn(so); err != nil {\n\t\tt.Fatal(err)\n\t}\n\t// Budget should be empty now.\n\tif !budget.Remaining().IsZero() {\n\t\tt.Fatal(\"budget wasn't completely depleted\")\n\t}\n\t// Check the storage obligation again.\n\tif len(so.sectorMap) != 2 {\n\t\tt.Fatalf(\"wrong sectorMap len %v != %v\", len(so.sectorMap), 2)\n\t}\n\tif len(so.sectorRoots) != 2 {\n\t\tt.Fatalf(\"wrong sectorRoots len %v != %v\", len(so.sectorRoots), 2)\n\t}\n\tif _, exists := so.sectorMap[appendDataRoot2]; !exists {\n\t\tt.Fatal(\"sectorMap contains wrong root\")\n\t}\n\tif so.sectorRoots[0] != appendDataRoot1 {\n\t\tt.Fatal(\"sectorRoots contains wrong root\")\n\t}\n\tif so.sectorRoots[1] != appendDataRoot2 {\n\t\tt.Fatal(\"sectorRoots contains wrong root\")\n\t}\n}", "func TestInstructionAddByte(t *testing.T) {\n\tchipCfg := GetDefaultConfig()\n\tchip, _, _ := NewCHIP8(chipCfg)\n\n\tchip.Reg[0x0] = 0x10\n\tchip.Reg[0x1] = 0xff\n\n\tchip.WriteShort(0x200, 0x7001)\n\tchip.WriteShort(0x202, 0x7101)\n\n\tvar tests = []struct {\n\t\tPC uint16\n\t\tregIdx uint8\n\t\tregVal uint8\n\t}{\n\t\t{0x202, 0x0, 0x11},\n\t\t{0x204, 0x1, 0x00},\n\t}\n\n\tfor i, want := range tests {\n\t\tchip.StepEmulation()\n\n\t\tif chip.PC != want.PC {\n\t\t\tt.Errorf(\"test %d: chip.PC = 0x%x; want 0x%x\", i, chip.PC, want.PC)\n\t\t}\n\n\t\tif chip.Reg[want.regIdx] != want.regVal {\n\t\t\tt.Errorf(\"test %d: chip.Reg[0x%x] = 0x%x; want 0x%x\", i, want.regIdx, chip.Reg[want.regIdx], want.regVal)\n\t\t}\n\t}\n}", "func testInstructionUpdateRegistry(t *testing.T, entryType modules.RegistryEntryType, expectType bool, addUpdateRegistryInstruction func(tb *testProgramBuilder, spk types.SiaPublicKey, rv modules.SignedRegistryValue)) {\n\thost := newTestHost()\n\tmdm := New(host)\n\tdefer mdm.Stop()\n\n\t// Create a program to update a registry value that doesn't exist yet.\n\tsk, pk := crypto.GenerateKeyPair()\n\ttweak := crypto.Hash{1, 2, 3}\n\tdata := fastrand.Bytes(modules.RegistryDataSize)\n\trev := uint64(0)\n\trv := modules.NewRegistryValue(tweak, data, rev, entryType).Sign(sk)\n\tspk := types.SiaPublicKey{\n\t\tAlgorithm: types.SignatureEd25519,\n\t\tKey: pk[:],\n\t}\n\n\tpt := newTestPriceTable()\n\ttb := newTestProgramBuilder(pt, 0)\n\taddUpdateRegistryInstruction(tb, spk, rv)\n\n\t// Execute it.\n\tso := host.newTestStorageObligation(true)\n\toutputs, err := mdm.ExecuteProgramWithBuilder(tb, so, 0, false)\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\t// Assert output.\n\toutput := outputs[0]\n\terr = output.assert(0, crypto.Hash{}, []crypto.Hash{}, []byte{}, nil)\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\t// Registry should contain correct value.\n\t_, rv2, ok := host.RegistryGet(modules.DeriveRegistryEntryID(spk, rv.Tweak))\n\tif !ok {\n\t\tt.Fatal(\"registry doesn't contain entry\")\n\t}\n\terr = rv2.Verify(pk)\n\tif entryType == modules.RegistryTypeInvalid && !errors.Contains(err, modules.ErrInvalidRegistryEntryType) {\n\t\tt.Fatal(\"wrong error\")\n\t} else if entryType != modules.RegistryTypeInvalid && err != nil {\n\t\tt.Fatal(err)\n\t}\n\tif !reflect.DeepEqual(rv2, rv) {\n\t\tt.Fatal(\"registry returned wrong data\")\n\t}\n\n\tif entryType == modules.RegistryTypeInvalid {\n\t\treturn // test for invalid entry is over\n\t}\n\n\t// Execute it again. This should fail with ErrSameRevNum.\n\toutputs, err = mdm.ExecuteProgramWithBuilder(tb, so, 0, false)\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\t// Construct expected output.\n\trevBytes := make([]byte, 8)\n\tbinary.LittleEndian.PutUint64(revBytes, rv.Revision)\n\texpectedOutput := append(rv.Signature[:], append(revBytes, rv.Data...)...)\n\tif expectType {\n\t\texpectedOutput = append(expectedOutput, byte(entryType))\n\t}\n\t// Assert output.\n\toutput = outputs[0]\n\terr = output.assert(0, crypto.Hash{}, []crypto.Hash{}, expectedOutput, modules.ErrSameRevNum)\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\n\t// Update the revision to 1. This should work.\n\ttb = newTestProgramBuilder(pt, 0)\n\trv.Revision++\n\trv = rv.Sign(sk)\n\taddUpdateRegistryInstruction(tb, spk, rv)\n\toutputs, err = mdm.ExecuteProgramWithBuilder(tb, so, 0, false)\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\t// Assert output.\n\toutput = outputs[0]\n\terr = output.assert(0, crypto.Hash{}, []crypto.Hash{}, []byte{}, nil)\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\t// Registry should contain correct value.\n\t_, rv2, ok = host.RegistryGet(modules.DeriveRegistryEntryID(spk, rv.Tweak))\n\tif !ok {\n\t\tt.Fatal(\"registry doesn't contain entry\")\n\t}\n\tif err := rv2.Verify(pk); err != nil {\n\t\tt.Fatal(err)\n\t}\n\tif !reflect.DeepEqual(rv2, rv) {\n\t\tt.Fatal(\"registry returned wrong data\")\n\t}\n\n\t// Update the revision to 0. This should fail again but provide the right\n\t// proof.\n\ttb = newTestProgramBuilder(pt, 0)\n\toldRevision := rv.Revision\n\trv.Revision = 0\n\trv = rv.Sign(sk)\n\taddUpdateRegistryInstruction(tb, spk, rv)\n\toutputs, err = mdm.ExecuteProgramWithBuilder(tb, so, 0, false)\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\t// Construct expected output.\n\trevBytes = make([]byte, 8)\n\tbinary.LittleEndian.PutUint64(revBytes, rv2.Revision)\n\texpectedOutput = append(rv2.Signature[:], append(revBytes, rv2.Data...)...)\n\tif expectType {\n\t\texpectedOutput = append(expectedOutput, byte(entryType))\n\t}\n\t// Assert output.\n\toutput = outputs[0]\n\terr = output.assert(0, crypto.Hash{}, []crypto.Hash{}, expectedOutput, modules.ErrLowerRevNum)\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\n\t// Update the value again but with an empty registry entry.\n\ttb = newTestProgramBuilder(pt, 0)\n\trv.Revision = oldRevision + 1\n\trv.Data = []byte{}\n\trv = rv.Sign(sk)\n\taddUpdateRegistryInstruction(tb, spk, rv)\n\n\t// Execute it.\n\toutputs, err = mdm.ExecuteProgramWithBuilder(tb, so, 0, false)\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\t// Assert output.\n\toutput = outputs[0]\n\terr = output.assert(0, crypto.Hash{}, []crypto.Hash{}, []byte{}, nil)\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\t// Registry should contain correct value.\n\t_, rv2, ok = host.RegistryGet(modules.DeriveRegistryEntryID(spk, rv.Tweak))\n\tif !ok {\n\t\tt.Fatal(\"registry doesn't contain entry\")\n\t}\n\terr = rv2.Verify(pk)\n\tif entryType == modules.RegistryTypeWithPubkey && !errors.Contains(err, modules.ErrRegistryEntryDataMalformed) {\n\t\tt.Fatal(\"wrong error\", err)\n\t} else if entryType != modules.RegistryTypeWithPubkey && err != nil {\n\t\tt.Fatal(err)\n\t}\n\tif !reflect.DeepEqual(rv2, rv) {\n\t\tt.Fatal(\"registry returned wrong data\")\n\t}\n}", "func Add(client *cliHttp.SimpleClient, gameID, packageID int, releaseVersion *semver.Version, isDownloadable bool, size int64, checksum string, forceRestart bool, filepath string, startByte, chunkSize int64, bar *pb.ProgressBar) (*AddResult, error) {\n\tgetParams := url.Values(map[string][]string{\n\t\t\"game_id\": {strconv.Itoa(gameID)},\n\t\t\"package_id\": {strconv.Itoa(packageID)},\n\t\t\"release_version\": {releaseVersion.String()},\n\t\t\"downloadable\": {formatBool(isDownloadable)},\n\t\t\"size\": {strconv.FormatInt(size, 10)},\n\t\t\"checksum\": {checksum},\n\t\t\"restart\": {formatBool(forceRestart)},\n\t})\n\n\twriteFileFunc := func(dst io.Writer, src cliHttp.MultipartFileEntry) (int64, error) {\n\t\toffset, err := src.File.Seek(startByte, 0)\n\t\tif err != nil || offset != startByte {\n\t\t\treturn 0, errors.New(\"Failed to seek the file, has it changed while I was running?\")\n\t\t}\n\n\t\t// Read only the wanted chunk size\n\t\treader := io.LimitReader(src.File, chunkSize)\n\n\t\t// Limit the upload speed in development for testing\n\t\treader = customIO.NewReader(reader)\n\n\t\tbar.SetTemplate(pb.Default)\n\t\treader = bar.NewProxyReader(reader)\n\n\t\treturn io.Copy(dst, reader)\n\t}\n\n\t_, res, err := client.Multipart(\"files/add\", map[string]string{\"file\": filepath}, getParams, nil, writeFileFunc)\n\n\tif err != nil {\n\t\treturn nil, errors.New(\"Failed to upload file: \" + err.Error())\n\t}\n\tdefer res.Body.Close()\n\n\tbody, err := ioutil.ReadAll(res.Body)\n\tif err != nil {\n\t\treturn nil, errors.New(\"Failed to upload file: \" + err.Error())\n\t}\n\n\tresult := &AddResult{}\n\tif err = json.Unmarshal(body, result); err != nil {\n\t\treturn nil, errors.New(\"Failed to upload file, the server returned a weird looking response: \" + string(body))\n\t}\n\n\tif result.Error != nil {\n\t\treturn nil, apiErrors.New(result.Error)\n\t}\n\treturn result, nil\n}", "func (s *ObjectsIntegrationSuite) TestTA_PublishAddLookup10_1_Test(cc *C) {\n\tdoPublishAddLookup(1, 10, 10, cc)\n}", "func (pc *programCode) createAdd(a, b, sum string) {\n\tcode := \"\\n\\t\\t\\t; Add \" + b + \" to \" +\n\t\ta + \" and save sum in \" + sum + \"\\n\"\n\n\tif _, err := strconv.Atoi(a); err == nil {\n\t\tcode += \"\\tmov rax, \" + a + \"\\n\"\n\t} else {\n\t\tcode += \"\\tmov rax, [\" + a + \"]\\n\"\n\t}\n\tif _, err := strconv.Atoi(b); err == nil {\n\t\tcode += \"\\tadd rax, \" + b + \"\\n\"\n\t} else {\n\t\tcode += \"\\tadd rax, [\" + b + \"]\\n\"\n\t}\n\tcode += \"\\tmov [\" + sum + \"], rax\\n\"\n\n\tpc.appendCode(code)\n}", "func (s *TaffyDeploySuite) TestDeploys(t *c.C) {\n\tassertMeta := func(m map[string]string, k string, checker c.Checker, args ...interface{}) {\n\t\tv, ok := m[k]\n\t\tt.Assert(ok, c.Equals, true)\n\t\tt.Assert(v, checker, args...)\n\t}\n\n\tclient := s.controllerClient(t)\n\n\tgithub := map[string]string{\n\t\t\"user\": \"flynn-examples\",\n\t\t\"repo\": \"nodejs-flynn-example\",\n\t\t\"branch\": \"master\",\n\t\t\"rev\": \"5e177fec38fbde7d0a03e9e8dccf8757c68caa11\",\n\t\t\"clone_url\": \"https://github.com/flynn-examples/nodejs-flynn-example.git\",\n\t}\n\n\t// initial deploy\n\n\tapp := &ct.App{}\n\tt.Assert(client.CreateApp(app), c.IsNil)\n\tdebugf(t, \"created app %s (%s)\", app.Name, app.ID)\n\n\tenv := map[string]string{\n\t\t\"SOMEVAR\": \"SOMEVAL\",\n\t}\n\tmeta := map[string]string{\n\t\t\"github\": \"true\",\n\t\t\"github_user\": github[\"user\"],\n\t\t\"github_repo\": github[\"repo\"],\n\t}\n\ts.deployWithTaffy(t, app, env, meta, github)\n\n\trelease, err := client.GetAppRelease(app.ID)\n\tt.Assert(err, c.IsNil)\n\tt.Assert(release, c.NotNil)\n\tt.Assert(release.Meta, c.NotNil)\n\tassertMeta(release.Meta, \"git\", c.Equals, \"true\")\n\tassertMeta(release.Meta, \"clone_url\", c.Equals, github[\"clone_url\"])\n\tassertMeta(release.Meta, \"branch\", c.Equals, github[\"branch\"])\n\tassertMeta(release.Meta, \"rev\", c.Equals, github[\"rev\"])\n\tassertMeta(release.Meta, \"taffy_job\", c.Not(c.Equals), \"\")\n\tassertMeta(release.Meta, \"github\", c.Equals, \"true\")\n\tassertMeta(release.Meta, \"github_user\", c.Equals, github[\"user\"])\n\tassertMeta(release.Meta, \"github_repo\", c.Equals, github[\"repo\"])\n\tt.Assert(release.Env, c.NotNil)\n\tassertMeta(release.Env, \"SOMEVAR\", c.Equals, \"SOMEVAL\")\n\n\t// second deploy\n\n\tgithub[\"rev\"] = \"4231f8871da2b9fd73a5402753df3dfc5609d7b7\"\n\n\trelease, err = client.GetAppRelease(app.ID)\n\tt.Assert(err, c.IsNil)\n\n\ts.deployWithTaffy(t, app, env, meta, github)\n\n\tnewRelease, err := client.GetAppRelease(app.ID)\n\tt.Assert(err, c.IsNil)\n\tt.Assert(newRelease.ID, c.Not(c.Equals), release.ID)\n\tt.Assert(env, c.DeepEquals, newRelease.Env)\n\tt.Assert(release.Processes, c.DeepEquals, newRelease.Processes)\n\tt.Assert(newRelease, c.NotNil)\n\tt.Assert(newRelease.Meta, c.NotNil)\n\tassertMeta(newRelease.Meta, \"git\", c.Equals, \"true\")\n\tassertMeta(newRelease.Meta, \"clone_url\", c.Equals, github[\"clone_url\"])\n\tassertMeta(newRelease.Meta, \"branch\", c.Equals, github[\"branch\"])\n\tassertMeta(newRelease.Meta, \"rev\", c.Equals, github[\"rev\"])\n\tassertMeta(newRelease.Meta, \"taffy_job\", c.Not(c.Equals), \"\")\n\tassertMeta(newRelease.Meta, \"github\", c.Equals, \"true\")\n\tassertMeta(newRelease.Meta, \"github_user\", c.Equals, github[\"user\"])\n\tassertMeta(newRelease.Meta, \"github_repo\", c.Equals, github[\"repo\"])\n}", "func addBinary(a string, b string) string {\n\taL, bL, plus, res := len(a)-1, len(b)-1, 0, \"\"\n\tfor plus > 0 || (aL >= 0 && bL >= 0) {\n\t\ttmp := plus\n\t\tif aL >= 0 {\n\t\t\ttmp += int(a[aL] - '0')\n\t\t}\n\t\tif bL >= 0 {\n\t\t\ttmp += int(b[bL] - '0')\n\t\t}\n\t\tres = strconv.Itoa(tmp%2) + res\n\t\tplus = tmp / 2\n\n\t\t//fmt.Println(\"=======\", a[aL] - '0', \"==\", b[bL] - '0', \"===\", tmp % 2, \"==\", tmp / 2, \"==\", strconv.Itoa(tmp % 2), \"==\", res)\n\n\t\taL--\n\t\tbL--\n\t}\n\tif aL >= 0 {\n\t\tres = a[:aL+1] + res\n\t}\n\tif bL >= 0 {\n\t\tres = b[:bL+1] + res\n\t}\n\treturn res\n}", "func testTaskWork(args []string) error {\n\tif len(args) < 2 {\n\t\treturn errors.New(\"Task Did Not Receive Set Key and Value!\")\n\t}\n\n\tlog.Printf(\"Unit Test Work Running!\\nAdding %s to %s\\n\", args[0], args[1])\n\treturn redis.MainRedis.Do(radix.Cmd(nil, \"SADD\", args[0], args[1]))\n}", "func TestBinaryEncoding(t *testing.T) {\n\t// Create po objects\n\tpo := NewPo()\n\tpo2 := NewPo()\n\n\t// Parse file\n\tpo.ParseFile(\"fixtures/en_US/default.po\")\n\n\tbuff, err := po.GetDomain().MarshalBinary()\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\n\terr = po2.GetDomain().UnmarshalBinary(buff)\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\n\t// Test translations\n\ttr := po2.Get(\"My text\")\n\tif tr != translatedText {\n\t\tt.Errorf(\"Expected '%s' but got '%s'\", translatedText, tr)\n\t}\n\t// Test translations\n\ttr = po2.Get(\"language\")\n\tif tr != \"en_US\" {\n\t\tt.Errorf(\"Expected 'en_US' but got '%s'\", tr)\n\t}\n}", "func (t *SimpleChaincode)addPartToAssemb(stub shim.ChaincodeStubInterface, args []string)([]byte, error) {\n\tkey := args[0]\n\tidpart := args[1]\n// Vérification\n\ttest, err := findPartById (stub, idpart) \n\t\tif(err !=nil){return nil,err}\n\tptA, _ := json.Marshal(test)\n\tvar ppart Part\n\t\terr = json.Unmarshal(ptA, &ppart)\n\t\tif err != nil {return nil, errors.New(\"Failed to Unmarshal Part #\" + key)}\n\tif (ppart.Helicopter == \"\" && ppart.Assembly == \"\") {\t\n// Fin vérification\n// Debut Partie Assembly \n\tac,err:=findAssemblyById(stub,key)\n\t\tif(err !=nil){return nil,err}\n\tptAS1, _ := json.Marshal(ac)\n\tvar assemb Assembly\n\t\terr = json.Unmarshal(ptAS1, &assemb)\n\t\tif err != nil {return nil, errors.New(\"Failed to Unmarshal Part #\" + key)}\n\tvar tx LogAssembly\n\t\ttx.Responsible = assemb.Responsible\n\t\ttx.Owner \t\t= assemb.Owner\n\t\ttx.LType \t\t= \"PART_AFFILIATION\"\n\t\ttx.Description = idpart + \" has been affiliated to this Assembly\"\n\t\ttx.VDate\t\t= args [2]\n\tassemb.Parts = append(assemb.Parts, idpart)\t\n\tassemb.Logs = append(assemb.Logs, tx)\n\ty:= UpdateAssembly (stub, assemb) \n\t\tif y != nil { return nil, errors.New(y.Error())}\n// Fin Partie Assembly \n// Debut Partie Part\t\n\tpart,err:=findPartById(stub,idpart)\n\t\tif err != nil {return nil, errors.New(\"Failed to get part #\" + key)}\n\tptAS, _ := json.Marshal(part)\n\t\tvar pt Part\n\t\terr = json.Unmarshal(ptAS, &pt)\n\t\tif err != nil {return nil, errors.New(\"Failed to Unmarshal Part #\" + key)}\n\t\tpt.Assembly = key\n\t\tpt.Owner = assemb.Owner\n\tvar tf Log\n\t\ttf.Responsible \t= pt.Responsible\n\t\ttf.Owner \t\t= pt.Owner\n\t\ttf.LType \t\t= \"ASSEMBLY_AFFILIATION\"\n\t\ttf.Description = \"This part has been affiliated to assembly: \" + key\n\t\ttf.VDate\t\t= args [2]\n\tpt.Logs = append(pt.Logs, tf)\n\te:= UpdatePart (stub, pt) \n\t\tif e != nil { return nil, errors.New(e.Error())}\n// Fin Partie Part\n\t} else if (ppart.Helicopter != \"\" && ppart.Assembly != \"\") {\n\t\treturn nil, errors.New (\"Impossible\") }\t\t\nfmt.Println(\"Responsible created successfully\")\t\nreturn nil, nil\n}", "func (suite *TestAgentSuite) TestConformOfAgentForAdding(c *C) {\n\ttestedAgent := &AgentForAdding {\n\t\tName: \" name-1 \",\n\t\tConnectionId: \" conn-id-1 \",\n\t\tComment: \" comment-1 \",\n\t\tHostname: \" hostname-1 \",\n\t\tNameTagValue: \" name-tag-1 \",\n\t\tGroupTags: []string{ \" gt-1 \", \" gt-2 \" },\n\t}\n\n\tconform.Strings(testedAgent)\n\n\tc.Assert(testedAgent.Name, Equals, \"name-1\")\n\tc.Assert(testedAgent.ConnectionId, Equals, \"conn-id-1\")\n\tc.Assert(testedAgent.Comment, Equals, \"comment-1\")\n\tc.Assert(testedAgent.Hostname, Equals, \"hostname-1\")\n\tc.Assert(testedAgent.NameTagValue, Equals, \"name-tag-1\")\n\tc.Assert(testedAgent.GroupTags, DeepEquals, []string{ \"gt-1\", \"gt-2\" })\n}", "func TestCheckBinaryExprStringAddComplex(t *testing.T) {\n\tenv := MakeSimpleEnv()\n\n\texpectCheckError(t, `\"abc\" + 8.0i`, env,\n\t\t`cannot convert \"abc\" to type complex128`,\n\t\t`invalid operation: \"abc\" + 8i (mismatched types string and complex128)`,\n\t)\n\n}", "func (bm *DockerBenchmarker) CheckAdd() {\n\tdfiles := []string{}\n\n\tfor file, df := range bm.dfiles {\n\t\tfound := df.LookupInstruction(dockerfile.ADD)\n\n\t\tif found {\n\t\t\tdfiles = append(dfiles, file)\n\t\t}\n\t}\n\n\tbm.violationReport.AddViolation(benchmark.CIS_4_9, dfiles)\n}", "func Add(b []byte) error {\n\tfd, err := os.OpenFile(eventLogFile, os.O_WRONLY, 0644)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tdefer fd.Close()\n\t_, err = fd.Write(b)\n\tif err != nil && err != io.EOF {\n\t\treturn err\n\t}\n\tslaunch.Debug(\"err = %v\", err)\n\treturn nil\n}", "func TestAddOrder(t *testing.T) {\n\tt.Parallel()\n\targs := AddOrderOptions{OrderFlags: \"fcib\"}\n\tcp, err := currency.NewPairFromString(\"XXBTZUSD\")\n\tif err != nil {\n\t\tt.Error(err)\n\t}\n\t_, err = k.AddOrder(context.Background(),\n\t\tcp,\n\t\torder.Sell.Lower(), order.Limit.Lower(),\n\t\t0.00000001, 0, 0, 0, &args)\n\tif err == nil {\n\t\tt.Error(\"AddOrder() Expected error\")\n\t}\n}", "func TestStage(t *testing.T) {\n\ttd := newTestData(t, `#!/bin/bash\necho -n \"$*\" > ${!#}\n`)\n\tdefer td.Close()\n\n\tconst (\n\t\tparams = \"archive_url=gs://chromiumos-test-assets-public/path/to&files=file.bin\"\n\t\tcheckPath = \"/is_staged?\" + params\n\t\tstagePath = \"/stage?\" + params\n\t\tstaticPath = \"/static/path/to/file.bin\"\n\t)\n\n\tif status, err := td.Get(checkPath); err != nil {\n\t\tt.Error(\"Checking staged status failed: \", err)\n\t} else if exp := \"False\"; status != exp {\n\t\tt.Errorf(\"Checking staged status failed: got %q, want %q\", status, exp)\n\t}\n\n\tif _, err := td.Get(stagePath); err != nil {\n\t\tt.Fatal(\"Staging request failed: \", err)\n\t}\n\n\tif status, err := td.Get(checkPath); err != nil {\n\t\tt.Error(\"Checking staged status failed: \", err)\n\t} else if exp := \"True\"; status != exp {\n\t\tt.Errorf(\"Checking staged status failed: got %q, want %q\", status, exp)\n\t}\n\n\targs, err := td.Get(staticPath)\n\tif err != nil {\n\t\tt.Fatal(\"Static file request failed: \", err)\n\t}\n\n\tconst exp = \"-m cp gs://chromiumos-test-assets-public/path/to/file.bin \"\n\tif !strings.HasPrefix(args, exp) {\n\t\tt.Fatalf(\"Unexpected gsutil parameters: got %q, want prefix %q\", args, exp)\n\t}\n}" ]
[ "0.651003", "0.5975519", "0.59601086", "0.567035", "0.55979115", "0.5570606", "0.55538917", "0.55483836", "0.5547611", "0.5503694", "0.5494669", "0.54765517", "0.54552215", "0.5435148", "0.5427293", "0.5427293", "0.5427293", "0.5392837", "0.53809404", "0.5342625", "0.52957606", "0.52906656", "0.5284574", "0.52750105", "0.52669954", "0.52662027", "0.5218077", "0.5217643", "0.52072644", "0.5195103", "0.5184895", "0.5181472", "0.5165915", "0.51590747", "0.5138727", "0.5112296", "0.51022273", "0.509225", "0.50561947", "0.5053286", "0.5046895", "0.50462705", "0.50408286", "0.50349665", "0.5025853", "0.5018663", "0.500809", "0.50061566", "0.5002191", "0.50018686", "0.50013465", "0.49948743", "0.49885923", "0.49837673", "0.4982091", "0.4973825", "0.4969471", "0.49647447", "0.49528047", "0.49493405", "0.49475005", "0.49452987", "0.49430788", "0.49330696", "0.4923445", "0.49214923", "0.49162945", "0.49085072", "0.4907106", "0.49053672", "0.48979816", "0.4888333", "0.4885905", "0.4885071", "0.48845285", "0.48801538", "0.4868469", "0.48585314", "0.48521423", "0.4852053", "0.4846091", "0.4841586", "0.48281813", "0.4828143", "0.482766", "0.48265794", "0.48255202", "0.4807476", "0.48073524", "0.48016727", "0.4792149", "0.47916386", "0.4791023", "0.47905767", "0.47871378", "0.47793055", "0.47779942", "0.47756493", "0.47723097", "0.47635117" ]
0.68985945
0
helper func should this be in graph "class"?
func createVertex(children []string, name string) (NodeG) { if len(children) == 0 { // this is wrong... // you can't this return a nil. // you can declare a var and return it but that seems weird... return NodeG{name, nil} } // this has to be a make cant declare a slice... result := make([]NodeG, len(children)) for i:= 0 ; i<len(children) ; i++ { n := NodeG{children[i], nil} result[i] = n } return NodeG{name, result} }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func NewGraph(base Base) {\n\n}", "func g2() *Graph {\n\ttf := &testFactory{}\n\tn := [20]*Node{}\n\tfor i := 0; i < 20; i++ {\n\t\tm := fmt.Sprintf(\"g2n%d\", i)\n\t\tp, _ := tf.Make(job.NewIdWithRequestId(m, m, m, \"reqId1\"))\n\t\tn[i] = &Node{\n\t\t\tDatum: p,\n\t\t\tNext: map[string]*Node{},\n\t\t\tPrev: map[string]*Node{},\n\t\t}\n\t}\n\n\t// yeah good luck following this\n\tn[0].Next[\"g2n1\"] = n[1]\n\tn[1].Next[\"g2n2\"] = n[2]\n\tn[1].Next[\"g2n5\"] = n[5]\n\tn[1].Next[\"g2n6\"] = n[6]\n\tn[2].Next[\"g2n3\"] = n[3]\n\tn[2].Next[\"g2n4\"] = n[4]\n\tn[3].Next[\"g2n7\"] = n[7]\n\tn[4].Next[\"g2n8\"] = n[8]\n\tn[7].Next[\"g2n8\"] = n[8]\n\tn[8].Next[\"g2n13\"] = n[13]\n\tn[13].Next[\"g2n14\"] = n[14]\n\tn[5].Next[\"g2n9\"] = n[9]\n\tn[9].Next[\"g2n12\"] = n[12]\n\tn[12].Next[\"g2n14\"] = n[14]\n\tn[6].Next[\"g2n10\"] = n[10]\n\tn[10].Next[\"g2n11\"] = n[11]\n\tn[10].Next[\"g2n19\"] = n[19]\n\tn[11].Next[\"g2n12\"] = n[12]\n\tn[19].Next[\"g2n16\"] = n[16]\n\tn[16].Next[\"g2n15\"] = n[15]\n\tn[16].Next[\"g2n17\"] = n[17]\n\tn[15].Next[\"g2n18\"] = n[18]\n\tn[17].Next[\"g2n18\"] = n[18]\n\tn[18].Next[\"g2n14\"] = n[14]\n\tn[1].Prev[\"g2n0\"] = n[0]\n\tn[2].Prev[\"g2n1\"] = n[1]\n\tn[3].Prev[\"g2n2\"] = n[2]\n\tn[4].Prev[\"g2n2\"] = n[2]\n\tn[5].Prev[\"g2n1\"] = n[1]\n\tn[6].Prev[\"g2n1\"] = n[1]\n\tn[7].Prev[\"g2n3\"] = n[3]\n\tn[8].Prev[\"g2n4\"] = n[4]\n\tn[8].Prev[\"g2n7\"] = n[7]\n\tn[9].Prev[\"g2n5\"] = n[5]\n\tn[10].Prev[\"g2n6\"] = n[6]\n\tn[11].Prev[\"g2n10\"] = n[10]\n\tn[12].Prev[\"g2n9\"] = n[9]\n\tn[12].Prev[\"g2n11\"] = n[11]\n\tn[13].Prev[\"g2n8\"] = n[8]\n\tn[14].Prev[\"g2n12\"] = n[12]\n\tn[14].Prev[\"g2n13\"] = n[13]\n\tn[14].Prev[\"g2n18\"] = n[18]\n\tn[15].Prev[\"g2n16\"] = n[16]\n\tn[16].Prev[\"g2n19\"] = n[19]\n\tn[17].Prev[\"g2n16\"] = n[16]\n\tn[18].Prev[\"g2n15\"] = n[15]\n\tn[18].Prev[\"g2n17\"] = n[17]\n\tn[19].Prev[\"g2n10\"] = n[10]\n\n\treturn &Graph{\n\t\tName: \"g2\",\n\t\tFirst: n[0],\n\t\tLast: n[14],\n\t\tVertices: map[string]*Node{\n\t\t\t\"g2n0\": n[0],\n\t\t\t\"g2n1\": n[1],\n\t\t\t\"g2n2\": n[2],\n\t\t\t\"g2n3\": n[3],\n\t\t\t\"g2n4\": n[4],\n\t\t\t\"g2n5\": n[5],\n\t\t\t\"g2n6\": n[6],\n\t\t\t\"g2n7\": n[7],\n\t\t\t\"g2n8\": n[8],\n\t\t\t\"g2n9\": n[9],\n\t\t\t\"g2n10\": n[10],\n\t\t\t\"g2n11\": n[11],\n\t\t\t\"g2n12\": n[12],\n\t\t\t\"g2n13\": n[13],\n\t\t\t\"g2n14\": n[14],\n\t\t\t\"g2n15\": n[15],\n\t\t\t\"g2n16\": n[16],\n\t\t\t\"g2n17\": n[17],\n\t\t\t\"g2n18\": n[18],\n\t\t\t\"g2n19\": n[19],\n\t\t},\n\t\tEdges: map[string][]string{\n\t\t\t\"g2n0\": []string{\"g2n1\"},\n\t\t\t\"g2n1\": []string{\"g2n2\", \"g2n5\", \"g2n6\"},\n\t\t\t\"g2n2\": []string{\"g2n3\", \"g2n4\"},\n\t\t\t\"g2n3\": []string{\"g2n7\"},\n\t\t\t\"g2n4\": []string{\"g2n8\"},\n\t\t\t\"g2n5\": []string{\"g2n9\"},\n\t\t\t\"g2n6\": []string{\"g2n10\"},\n\t\t\t\"g2n7\": []string{\"g2n8\"},\n\t\t\t\"g2n8\": []string{\"g2n13\"},\n\t\t\t\"g2n9\": []string{\"g2n12\"},\n\t\t\t\"g2n10\": []string{\"g2n11\", \"g2n19\"},\n\t\t\t\"g2n11\": []string{\"g2n12\"},\n\t\t\t\"g2n12\": []string{\"g2n14\"},\n\t\t\t\"g2n13\": []string{\"g2n14\"},\n\t\t\t\"g2n15\": []string{\"g2n18\"},\n\t\t\t\"g2n16\": []string{\"g2n15\", \"g2n17\"},\n\t\t\t\"g2n17\": []string{\"g2n18\"},\n\t\t\t\"g2n18\": []string{\"g2n14\"},\n\t\t\t\"g2n19\": []string{\"g2n16\"},\n\t\t},\n\t}\n}", "func (s StatsGraph) construct() StatsGraphClass { return &s }", "func simpleGraph() (*Graph, []interface{}) {\n\n\t// Some sequence of probabilities. (rows correspond to states.)\n\tscores := [][]float64{\n\t\t{0.1, 0.1, 0.2, 0.4, 0.11, 0.11, 0.12, 0.14},\n\t\t{0.4, 0.1, 0.3, 0.5, 0.21, 0.01, 0.12, 0.08},\n\t\t{0.2, 0.2, 0.4, 0.5, 0.09, 0.11, 0.32, 0.444},\n\t}\n\n\t// Convert to log scores.\n\tvar n []interface{}\n\tfor i, v := range scores {\n\t\tfor j, _ := range v {\n\t\t\tscores[i][j] = math.Log(scores[i][j])\n\t\t}\n\t\tn = append(n, i)\n\t}\n\t// Define score functions to return state probabilities.\n\tvar s1Func = func(n interface{}) float64 {\n\t\treturn scores[0][n.(int)]\n\t}\n\tvar s2Func = func(n interface{}) float64 {\n\t\treturn scores[1][n.(int)]\n\t}\n\tvar s3Func = func(n interface{}) float64 {\n\t\treturn scores[2][n.(int)]\n\t}\n\tvar s5Func = func(n interface{}) float64 {\n\t\treturn scores[2][n.(int)]\n\t}\n\tvar finalFunc = func(n interface{}) float64 {\n\t\treturn 0\n\t}\n\n\t// Creates a new graph.\n\tg := New()\n\n\t// Create some nodes and assign values.\n\tg.Set(\"s0\", vvalue{null: true}) // initial state\n\tg.Set(\"s1\", vvalue{f: s1Func})\n\tg.Set(\"s2\", vvalue{f: s2Func})\n\tg.Set(\"s3\", vvalue{f: s3Func})\n\tg.Set(\"s5\", vvalue{f: s5Func})\n\tg.Set(\"s4\", vvalue{f: finalFunc, null: true}) // final state\n\n\t// Make connections.\n\tg.Connect(\"s0\", \"s1\", 1)\n\tg.Connect(\"s1\", \"s1\", 0.4)\n\tg.Connect(\"s1\", \"s2\", 0.5)\n\tg.Connect(\"s1\", \"s3\", 0.1)\n\tg.Connect(\"s2\", \"s2\", 0.5)\n\tg.Connect(\"s2\", \"s3\", 0.4)\n\tg.Connect(\"s2\", \"s5\", 0.1)\n\tg.Connect(\"s5\", \"s5\", 0.7)\n\tg.Connect(\"s5\", \"s1\", 0.3)\n\tg.Connect(\"s3\", \"s3\", 0.6)\n\tg.Connect(\"s3\", \"s4\", 0.4)\n\n\t// Convert transition probabilities to log.\n\tg.ConvertToLogProbs()\n\treturn g, n\n}", "func (this *Graph) Cluster() []*Graph {\n /*\n\n Algorithm synopsis:\n\n Loop over the Starters, for each unvisited Starter,\n define an empty sub-graph and, put it into the toVisit set\n\n Loop over the toVisit node set, for each node in it, \n skip if already visited\n add the node to the sub-graph\n remove the nodes into the hasVisited node set\n put all its incoming and outgoing edge into the the toWalk set while\n stop at the hub nodes (edges from the hub nodes are not put in the toWalk set)\n then iterate through the toWalk edge set \n skip if already walked\n add the edge to the sub-graph\n put its connected nodes into the toVisit node set\n remove the edge from the toWalk edge set into the hasWalked edge set\n\n */\n \n // sub-graph index\n sgNdx := -1\n sgRet := make([]*Graph,0)\n\n toVisit := make(nodeSet); hasVisited := make(nodeSet)\n toWalk := make(edgeSet); hasWalked := make(edgeSet)\n\n for starter := range *this.Starters() {\n // define an empty sub-graph and, put it into the toVisit set\n sgRet = append(sgRet, NewGraph(gographviz.NewGraph())); sgNdx++; \n sgRet[sgNdx].Attrs = this.Attrs\n sgRet[sgNdx].SetDir(this.Directed)\n graphName := fmt.Sprintf(\"%s_%03d\\n\", this.Name, sgNdx);\n sgRet[sgNdx].SetName(graphName)\n toVisit.Add(starter)\n hubVisited := make(nodeSet)\n for len(toVisit) > 0 { for nodep := range toVisit {\n toVisit.Del(nodep); //print(\"O \")\n if this.IsHub(nodep) && hasVisited.Has(nodep) && !hubVisited.Has(nodep) { \n // add the already-visited but not-in-this-graph hub node to the sub-graph\n sgRet[sgNdx].AddNode(nodep)\n hubVisited.Add(nodep)\n continue \n }\n if hasVisited.Has(nodep) { continue }\n //spew.Dump(\"toVisit\", nodep)\n // add the node to the sub-graph\n sgRet[sgNdx].AddNode(nodep)\n // remove the nodes into the hasVisited node set\n hasVisited.Add(nodep)\n // stop at the hub nodes\n if this.IsHub(nodep) { continue }\n // put all its incoming and outgoing edge into the the toWalk set\n noden := nodep.Name\n for _, ep := range this.EdgesToParents(noden) {\n toWalk.Add(ep)\n }\n for _, ep := range this.EdgesToChildren(noden) {\n toWalk.Add(ep)\n }\n for edgep := range toWalk {\n toWalk.Del(edgep); //print(\"- \")\n if hasWalked.Has(edgep) { continue }\n //spew.Dump(\"toWalk\", edgep)\n sgRet[sgNdx].Edges.Add(edgep)\n // put its connected nodes into the toVisit node set\n toVisit.Add(this.Lookup(edgep.Src))\n toVisit.Add(this.Lookup(edgep.Dst))\n // remove the edge into the hasWalked edge set\n hasWalked.Add(edgep)\n }\n }}\n //spew.Dump(sgNdx)\n }\n return sgRet\n}", "func followGraph(a, b *actor, collision quad.Collision) node {\n\t// normalize a, b to collision.[A, B]\n\tif a.actorEntity.Id() != collision.A.Id() {\n\t\ta, b = b, a\n\t}\n\n\tvar actor *actor\n\tvar entity entity.Entity\n\n\tswitch {\n\tcase a.pathAction.Orig == b.pathAction.Dest:\n\t\tentity = collision.A\n\t\tactor = a\n\n\tcase b.pathAction.Orig == a.pathAction.Dest:\n\t\tentity = collision.B\n\t\tactor = b\n\n\tdefault:\n\t\tpanic(fmt.Sprintf(\"unexpected graph state %v between %v & %v\", collision, a, b))\n\t}\n\n\treturn node{actor, entity}\n}", "func createGraph() *Graph {\n var g = Graph{}\n g.adjList = make(map[int]set)\n return &g\n}", "func (s StatsGraphError) construct() StatsGraphClass { return &s }", "func (this Graph) getNeighboursOfVertex(vertex graph.VertexInterface) graph.VerticesInterface {\n if this.IsDirected() {\n return vertex.GetOutgoingNeighbours()\n }\n return vertex.GetNeighbours()\n}", "func (this Graph) getEdgesOfVertex(vertex graph.VertexInterface) graph.EdgesInterface {\n if this.IsDirected() {\n return vertex.GetOutgoingEdges()\n }\n return vertex.GetEdges()\n}", "func createGraph2() *NodeG {\n n1 := NodeG{2, nil}\n n2 := NodeG{4, nil}\n n1.neighbors = append(n1.neighbors, &n2)\n n2.neighbors = append(n2.neighbors, &n1)\n\n return &n1\n}", "func testgraph() *Graph {\n\tg := New()\n\n\tg.Link(0, 1)\n\tg.Link(0, 4)\n\tg.Link(1, 2)\n\tg.Link(1, 3)\n\tg.Link(2, 1)\n\tg.Link(3, 3)\n\tg.Link(4, 3)\n\tg.Link(4, 0)\n\tg.Link(5, 6)\n\tg.Link(5, 0)\n\tg.Link(5, 2)\n\tg.Link(6, 2)\n\tg.Link(6, 7)\n\tg.Link(7, 5)\n\n\treturn g\n}", "func (AnnotationImpl) annotationNode() {}", "func main() {\n\n nodes := []graph.Node{}\n router := Router{ \"routerA\",1 }\n router2 := Router{ \"routerB\",2 }\n subnet := Subnet{ \"subnet1\", 10}\n nodes = append(nodes, router)\n// nodes = append(nodes, subnet)\n g := graph.NewGraph(nodes)\n g.AddNode(subnet)\n g.AddNode(router2)\n\n\n g.SetEdge(router, subnet)\n g.SetEdge(router2, subnet)\n\n g.Dump()\n\n// weight := float64(40)\n// edge := g.NewWeightedEdge(router, subnet, weight)\n// g.SetWeightedEdge(edge)\n\n// fmt.Printf(\"%v\\n\", g)\n// g.Dump()\n\n/*\n self := 0.0 // the cost of self connection\n absent := 10.0 // the wieght returned for absent edges\n\n graph := simple.NewWeightedUndirectedGraph(self, absent)\n fmt.Printf(\"%v\\n\", graph)\n\n var id int64\n //var node simple.Node\n\n id = 0\n from := simple.Node(id)\n graph.AddNode(from)\n\n id = 1\n to := simple.Node(id)\n graph.AddNode(to)\n\n id = 2\n from2 := simple.Node(id)\n graph.AddNode(from2)\n\n id = 3\n to2 := simple.Node(id)\n graph.AddNode(to2)\n\n\n nodeA := graph.Node(int64(2))\n\n\n\n fmt.Printf(\"%v\\n\", graph)\n\n nodes := graph.Nodes()\n fmt.Printf(\"%v\\n\", nodes)\n fmt.Printf(\"%v\\n\", nodeA)\n\n weight := float64(40)\n edge := graph.NewWeightedEdge(from, to, weight)\n graph.SetWeightedEdge(edge)\n\n edge2 := graph.NewWeightedEdge(from2, to2, weight)\n graph.SetWeightedEdge(edge2)\n\n fmt.Printf(\"%v\\n\", graph)\n edges := graph.Edges()\n fmt.Printf(\"%v\\n\", edges)\n\n edge_ := graph.Edge(int64(0) ,int64(1))\n fmt.Printf(\"%v\\n\", edge_)\n*/\n}", "func (obj *set) Graphbase() specifiers.Specifier {\n\treturn obj.graphbase\n}", "func main() {\n\tg, nodesMap := graphLineByLine()\n\n\tstart := nodesMap[\"shiny gold\"]\n\tnodeWeight(g, start)\n\tfmt.Println(weights[start])\n\t//fmt.Println(g, nodesMap)\n}", "func createGraph1() *NodeG {\n n1 := NodeG{2, nil}\n n2 := NodeG{4, nil}\n n1.neighbors = append(n1.neighbors, &n2)\n n1.neighbors = append(n1.neighbors, &n1)\n n2.neighbors = append(n2.neighbors, &n1)\n\n // fmt.Println(\">>>>>>1\")\n // fmt.Println(n1)\n // fmt.Println(n2)\n // fmt.Println(\">>>>>>2\")\n\n return &n1\n}", "func createGraph3() *NodeG {\n n1 := NodeG{1, nil}\n n2 := NodeG{2, nil}\n n3 := NodeG{3, nil}\n n1.neighbors = append(n1.neighbors, &n2)\n n2.neighbors = append(n2.neighbors, &n3)\n\n return &n1\n}", "func (g *graph) begin(ctx context.Context, rpcType transport.Type, direction directionName, req *transport.Request) call {\n\tnow := _timeNow()\n\n\td := digester.New()\n\td.Add(req.Caller)\n\td.Add(req.Service)\n\td.Add(req.Transport)\n\td.Add(string(req.Encoding))\n\td.Add(req.Procedure)\n\td.Add(req.RoutingKey)\n\td.Add(req.RoutingDelegate)\n\td.Add(string(direction))\n\td.Add(rpcType.String())\n\te := g.getOrCreateEdge(d.Digest(), req, string(direction), rpcType)\n\td.Free()\n\n\tlevels := &g.inboundLevels\n\tif direction != _directionInbound {\n\t\tlevels = &g.outboundLevels\n\t}\n\n\treturn call{\n\t\tedge: e,\n\t\textract: g.extract,\n\t\tstarted: now,\n\t\tctx: ctx,\n\t\treq: req,\n\t\trpcType: rpcType,\n\t\tdirection: direction,\n\t\tlevels: levels,\n\t}\n}", "func main() {\n\tg := getGraph()\n\tfmt.Println(components(g))\n}", "func g1() *Graph {\n\ttf := &testFactory{}\n\tn1, _ := tf.Make(job.NewIdWithRequestId(\"g1n1\", \"g1n1\", \"g1n1\", \"reqId1\"))\n\tn2, _ := tf.Make(job.NewIdWithRequestId(\"g1n2\", \"g1n2\", \"g1n2\", \"reqId1\"))\n\tn3, _ := tf.Make(job.NewIdWithRequestId(\"g1n3\", \"g1n3\", \"g1n3\", \"reqId1\"))\n\tg1n1 := &Node{Datum: n1}\n\tg1n2 := &Node{Datum: n2}\n\tg1n3 := &Node{Datum: n3}\n\n\tg1n1.Prev = map[string]*Node{}\n\tg1n1.Next = map[string]*Node{\"g1n2\": g1n2}\n\tg1n2.Next = map[string]*Node{\"g1n3\": g1n3}\n\tg1n2.Prev = map[string]*Node{\"g1n1\": g1n1}\n\tg1n3.Prev = map[string]*Node{\"g1n2\": g1n2}\n\tg1n3.Next = map[string]*Node{}\n\n\treturn &Graph{\n\t\tName: \"test1\",\n\t\tFirst: g1n1,\n\t\tLast: g1n3,\n\t\tVertices: map[string]*Node{\n\t\t\t\"g1n1\": g1n1,\n\t\t\t\"g1n2\": g1n2,\n\t\t\t\"g1n3\": g1n3,\n\t\t},\n\t\tEdges: map[string][]string{\n\t\t\t\"g1n1\": []string{\"g1n2\"},\n\t\t\t\"g1n2\": []string{\"g1n3\"},\n\t\t},\n\t}\n}", "func (g UndirectWeighted) Node(id int64) Node { return g.G.Node(id) }", "func DerivedGraphSeq(src *cfg.Graph) []*cfg.Graph {\n\tvar Gs []*cfg.Graph\n\t// The first order graph, G^1, is G.\n\tG := src\n\tG.SetDOTID(\"G1\")\n\tcreateGraph(G)\n\tGs = append(Gs, G)\n\tintNum := 1\n\tfor i := 2; G.Nodes().Len() > 1; i++ {\n\t\tIs := flow.Intervals(G, G.Entry())\n\t\tfor _, I := range Is {\n\t\t\t// Collapse interval into a single node.\n\t\t\tnewName := fmt.Sprintf(\"I%d\", intNum)\n\t\t\tdelNodes := make(map[string]bool)\n\t\t\tInodes := I.Nodes()\n\t\t\tfor Inodes.Next() {\n\t\t\t\tn := Inodes.Node()\n\t\t\t\tnn := node(n)\n\t\t\t\tnn.Attrs[\"fillcolor\"] = \"red\"\n\t\t\t\tnn.Attrs[\"style\"] = \"filled\"\n\t\t\t\tdelNodes[nn.DOTID()] = true\n\t\t\t}\n\t\t\t// Dump pre-merge.\n\t\t\t// Store graph DOTID before dump.\n\t\t\tnameBak := G.DOTID()\n\t\t\tG.SetDOTID(nameBak + \"_a\")\n\t\t\tcreateGraph(G)\n\t\t\tfor Inodes.Reset(); Inodes.Next(); {\n\t\t\t\tn := Inodes.Node()\n\t\t\t\tnn := node(n)\n\t\t\t\tdelete(nn.Attrs, \"fillcolor\")\n\t\t\t\tdelete(nn.Attrs, \"style\")\n\t\t\t}\n\t\t\tG.SetDOTID(nameBak)\n\n\t\t\t// The second order graph, G^2, is derived from G^1 by collapsing each\n\t\t\t// interval in G^1 into a node.\n\n\t\t\tG = cfg.Merge(G, delNodes, newName)\n\t\t\tn, ok := G.NodeWithName(newName)\n\t\t\tif !ok {\n\t\t\t\tpanic(fmt.Errorf(\"unable to locate new node %q after merge\", newName))\n\t\t\t}\n\t\t\tn.Attrs[\"fillcolor\"] = \"red\"\n\t\t\tn.Attrs[\"style\"] = \"filled\"\n\t\t\tname := fmt.Sprintf(\"G%d_b_%d\", i-1, intNum)\n\t\t\tG.SetDOTID(name)\n\t\t\tcreateGraph(G)\n\t\t\tdelete(n.Attrs, \"fillcolor\")\n\t\t\tdelete(n.Attrs, \"style\")\n\t\t\tintNum++\n\t\t}\n\t\tname := fmt.Sprintf(\"G%d\", i)\n\t\tG.SetDOTID(name)\n\t\tcreateGraph(G)\n\t\tGs = append(Gs, G)\n\t}\n\treturn Gs\n}", "func main15() {\n\tgph := new(Graph)\n\tgph.Init(5)\n gph.AddDirectedEdge(0, 1, 3)\n gph.AddDirectedEdge(0, 4, 2)\n gph.AddDirectedEdge(1, 2, 1)\n gph.AddDirectedEdge(2, 3, 1)\n gph.AddDirectedEdge(4, 1, -2)\n gph.AddDirectedEdge(4, 3, 1)\n gph.BellmanFordShortestPath(0)\n}", "func Map(w io.Writer, is interface{}, spec *Spec) error {\n\n\tvar vertexAppendix string\n\tvar edgeAppendix string\n\n\tfmt.Fprintln(w, \"strict graph {\")\n\tfmt.Fprintln(w, \" node [shape=\\\"circle\\\"];\")\n\n\tswitch is.(type) {\n\n\tcase *graph.Graph:\n\n\t\t// Initialize nodes\n\t\tfor _, v := range is.(*graph.Graph).V {\n\n\t\t\t// Visualize mst\n\t\t\tif spec.MST == true {\n\t\t\t\tvertexAppendix = \" color=\\\"red\\\" style=\\\"bold,filled\\\"\"\n\t\t\t}\n\n\t\t\tfmt.Fprintf(w, \" %d [label=\\\"%+v\\\"%s]\\n\", v.Serial, v.ID, vertexAppendix)\n\n\t\t}\n\n\t\t// Initialize edges\n\t\tfor _, e := range is.(*graph.Graph).E {\n\n\t\t\t// Visualize mst\n\t\t\tif (is.(*graph.Graph).V[e.EndpointA].GetEdgeByEndpoint(e.EndpointB).InMST == true ||\n\t\t\t\tis.(*graph.Graph).V[e.EndpointB].GetEdgeByEndpoint(e.EndpointA).InMST == true) && spec.MST == true {\n\t\t\t\tedgeAppendix = \" color=\\\"red\\\" style=\\\"bold\\\"\"\n\t\t\t}\n\n\t\t\tif is.(*graph.Graph).Type == graph.UNDIRECTED {\n\t\t\t\tfmt.Fprintf(w, \" %d -- %d [label=\\\"%d\\\"%s]\\n\", e.EndpointA, e.EndpointB, e.Weight, edgeAppendix)\n\t\t\t} else {\n\t\t\t\tfmt.Fprintf(w, \" %d -> %d [label=\\\"%d\\\"%s]\\n\", e.EndpointA, e.EndpointB, e.Weight, edgeAppendix)\n\t\t\t}\n\n\t\t\tedgeAppendix = \"\"\n\n\t\t}\n\t// case []graph.SEdge:\n\t// case []*graph.Node:\n\tdefault:\n\t\treturn fmt.Errorf(\"Unsupported Type\")\n\t}\n\n\tfmt.Fprintln(w, \"}\")\n\n\treturn nil\n\n}", "func (a *Add) Constructor() func(g graph.WeightedDirected, n graph.Node) (interface{}, error) {\n\treturn func(g graph.WeightedDirected, n graph.Node) (interface{}, error) {\n\t\tit := getOrderedChildren(g, n)\n\t\t// Get the shape from the child\n\t\tif it.Len() != 2 {\n\t\t\treturn nil, errors.New(\"invalid number of children, expected 2\")\n\t\t}\n\t\tchildren := make([]*engine.Node, it.Len())\n\t\tfor i := 0; it.Next(); i++ {\n\t\t\tchildren[i] = it.Node().(*engine.Node)\n\t\t}\n\n\t\tx := children[0]\n\t\ty := children[1]\n\t\tvar leftPattern []byte\n\t\tvar rightPattern []byte\n\t\tswitch {\n\t\tcase len(x.Shape()) == 1 && len(y.Shape()) != 1:\n\t\t\t// Need left broadcasting\n\t\t\t// Make an educated guess: find the axis that has the same dimension\n\t\t\t// as x.Shape()[0] and broadcast on all axes of y but this one.\n\t\t\tdims := make([]int, len(x.Shape()))\n\t\t\tfor i := 0; i < len(y.Shape()); i++ {\n\t\t\t\tif y.Shape()[i] != x.Shape()[0] {\n\t\t\t\t\tdims[i] = 1\n\t\t\t\t\tleftPattern = append(leftPattern, byte(i))\n\t\t\t\t} else {\n\t\t\t\t\tdims[i] = x.Shape()[0]\n\t\t\t\t}\n\t\t\t}\n\t\t\tif _, ok := g.(graph.DirectedWeightedBuilder); !ok {\n\t\t\t\treturn nil, errors.New(\"graph is not a builder\")\n\t\t\t}\n\t\t\t// Add a reshaped node\n\t\t\treshaped := g.(graph.DirectedWeightedBuilder).NewNode()\n\t\t\tg.(graph.DirectedWeightedBuilder).AddNode(reshaped)\n\n\t\t\tw, ok := g.Weight(n.ID(), x.ID())\n\t\t\tif !ok {\n\t\t\t\treturn nil, errors.New(\"no link found\")\n\t\t\t}\n\t\t\t// n -> reshaped\n\t\t\tg.(graph.DirectedWeightedBuilder).SetWeightedEdge(g.(graph.DirectedWeightedBuilder).NewWeightedEdge(n, reshaped, w))\n\t\t\t// reshaped -> x\n\t\t\tg.(graph.DirectedWeightedBuilder).SetWeightedEdge(g.(graph.DirectedWeightedBuilder).NewWeightedEdge(reshaped, x, 0))\n\t\t\t// unlink n -> x\n\t\t\tg.(graph.EdgeRemover).RemoveEdge(n.ID(), x.ID())\n\t\t\terr := g.(*engine.ExprGraph).ApplyOp(engine.Operation(engine.NewReshapeOperation(dims)), reshaped.(*engine.Node))\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\tcase len(y.Shape()) == 1 && len(x.Shape()) != 1:\n\t\t\t// Need right broadcasting\n\t\t\tdims := make([]int, len(x.Shape()))\n\t\t\tfor i := 0; i < len(x.Shape()); i++ {\n\t\t\t\tif x.Shape()[i] != y.Shape()[0] {\n\t\t\t\t\tdims[i] = 1\n\t\t\t\t\trightPattern = append(rightPattern, byte(i))\n\t\t\t\t} else {\n\t\t\t\t\tdims[i] = y.Shape()[0]\n\t\t\t\t}\n\t\t\t}\n\t\t\tvar err error\n\t\t\t// Add a reshaped node\n\t\t\treshaped := g.(graph.DirectedWeightedBuilder).NewNode()\n\t\t\tg.(graph.DirectedWeightedBuilder).AddNode(reshaped)\n\n\t\t\tw, ok := g.Weight(n.ID(), y.ID())\n\t\t\tif !ok {\n\t\t\t\treturn nil, errors.New(\"no link found\")\n\t\t\t}\n\t\t\t// n -> reshaped\n\t\t\tg.(graph.DirectedWeightedBuilder).SetWeightedEdge(g.(graph.DirectedWeightedBuilder).NewWeightedEdge(n, reshaped, w))\n\t\t\t// reshaped -> x\n\t\t\tg.(graph.DirectedWeightedBuilder).SetWeightedEdge(g.(graph.DirectedWeightedBuilder).NewWeightedEdge(reshaped, y, 0))\n\t\t\t// unlink n -> x\n\t\t\tg.(graph.EdgeRemover).RemoveEdge(n.ID(), y.ID())\n\t\t\terr = g.(*engine.ExprGraph).ApplyOp(engine.Operation(engine.NewReshapeOperation(dims)), reshaped.(*engine.Node))\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\tcase len(y.Shape()) == 3 && len(x.Shape()) == 4:\n\t\t\t// Ugly hack for the mnist model\n\t\t\tdims := make([]int, 4)\n\t\t\tdims[0] = 1\n\t\t\tfor i := 0; i < 3; i++ {\n\t\t\t\tdims[i+1] = y.Shape()[i]\n\t\t\t}\n\t\t\tvar err error\n\t\t\t// Add a reshaped node\n\t\t\treshaped := g.(graph.DirectedWeightedBuilder).NewNode()\n\t\t\tg.(graph.DirectedWeightedBuilder).AddNode(reshaped)\n\n\t\t\tw, ok := g.Weight(n.ID(), y.ID())\n\t\t\tif !ok {\n\t\t\t\treturn nil, errors.New(\"no link found\")\n\t\t\t}\n\t\t\t// n -> reshaped\n\t\t\tg.(graph.DirectedWeightedBuilder).SetWeightedEdge(g.(graph.DirectedWeightedBuilder).NewWeightedEdge(n, reshaped, w))\n\t\t\t// reshaped -> x\n\t\t\tg.(graph.DirectedWeightedBuilder).SetWeightedEdge(g.(graph.DirectedWeightedBuilder).NewWeightedEdge(reshaped, y, 0))\n\t\t\t// unlink n -> x\n\t\t\tg.(graph.EdgeRemover).RemoveEdge(n.ID(), y.ID())\n\t\t\terr = g.(*engine.ExprGraph).ApplyOp(engine.Operation(engine.NewReshapeOperation(dims)), reshaped.(*engine.Node))\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t\trightPattern = []byte{0, 2, 3}\n\t\tcase len(y.Shape()) == 4 && len(x.Shape()) == 3:\n\t\t\t// Ugly hack for the mnist model\n\t\t\tdims := make([]int, 4)\n\t\t\tdims[0] = 1\n\t\t\tfor i := 0; i < 3; i++ {\n\t\t\t\tdims[i+1] = x.Shape()[i]\n\t\t\t}\n\t\t\tvar err error\n\t\t\tif _, ok := g.(graph.DirectedWeightedBuilder); !ok {\n\t\t\t\treturn nil, errors.New(\"graph is not a builder\")\n\t\t\t}\n\t\t\t// Add a reshaped node\n\t\t\treshaped := g.(graph.DirectedWeightedBuilder).NewNode()\n\t\t\tg.(graph.DirectedWeightedBuilder).AddNode(reshaped)\n\n\t\t\tw, ok := g.Weight(n.ID(), x.ID())\n\t\t\tif !ok {\n\t\t\t\treturn nil, errors.New(\"no link found\")\n\t\t\t}\n\t\t\t// n -> reshaped\n\t\t\tg.(graph.DirectedWeightedBuilder).SetWeightedEdge(g.(graph.DirectedWeightedBuilder).NewWeightedEdge(n, reshaped, w))\n\t\t\t// reshaped -> x\n\t\t\tg.(graph.DirectedWeightedBuilder).SetWeightedEdge(g.(graph.DirectedWeightedBuilder).NewWeightedEdge(reshaped, x, 0))\n\t\t\t// unlink n -> x\n\t\t\tg.(graph.EdgeRemover).RemoveEdge(n.ID(), x.ID())\n\t\t\terr = g.(*engine.ExprGraph).ApplyOp(engine.Operation(engine.NewReshapeOperation(dims)), reshaped.(*engine.Node))\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\n\t\t\tleftPattern = []byte{0, 2, 3}\n\t\t}\n\t\treturn engine.NewAddOperation(leftPattern, rightPattern)(g, n.(*engine.Node))\n\t}\n}", "func Marshal(g *graph.DirectedGraph) ([]byte, error) {\n\tvar b bytes.Buffer\n\n\t// Static graph configuration attributes\n\n\tb.WriteString(\"strict digraph bridge {\\n\")\n\tb.WriteByte('\\n')\n\tb.WriteString(\"graph [\\n\")\n\tb.WriteString(\" rankdir=LR\\n\")\n\tb.WriteString(\"]\\n\")\n\tb.WriteByte('\\n')\n\tb.WriteString(\"node [\\n\")\n\tb.WriteString(\" fontname=\\\"Helvetica\\\"\\n\")\n\tb.WriteString(\" shape=plain\\n\")\n\tb.WriteString(\"]\\n\")\n\tb.WriteByte('\\n')\n\n\t// Vertices\n\n\t// Index of vertices already converted to node, for faster access\n\t// during sorting of edges.\n\t// The keys used in the map are also the ones used in the graph.DirectedGraph\n\tvertIndex := make(map[interface{}]*node)\n\n\tsortedNodes := make(nodeList, 0, len(g.Vertices()))\n\tfor k, v := range g.Vertices() {\n\t\tn := graphVertexToNode(v)\n\t\tvertIndex[k] = n\n\n\t\tsortedNodes = append(sortedNodes, n)\n\t\tsort.Sort(sortedNodes)\n\t}\n\n\tfor _, n := range sortedNodes {\n\t\tdotN, err := n.marshalDOT()\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"marshaling node to DOT: %w\", err)\n\t\t}\n\t\tb.Write(dotN)\n\t}\n\n\tb.WriteByte('\\n')\n\n\t// Edges\n\n\tsortedDownEdges := make(downEdgesList, 0, len(g.DownEdges()))\n\tfor tailVertKey, headVerts := range g.DownEdges() {\n\t\ttailNode := vertIndex[tailVertKey]\n\n\t\tsortedHeadNodes := make(nodeList, 0, len(headVerts))\n\t\tfor headVertKey := range headVerts {\n\t\t\tsortedHeadNodes = append(sortedHeadNodes, vertIndex[headVertKey])\n\t\t}\n\t\tsort.Sort(sortedHeadNodes)\n\n\t\tsortedDownEdges = append(sortedDownEdges, downEdges{\n\t\t\ttail: tailNode,\n\t\t\theads: sortedHeadNodes,\n\t\t})\n\t}\n\tsort.Sort(sortedDownEdges)\n\n\tfor _, e := range sortedDownEdges {\n\t\tb.WriteString(e.tail.id() + \" -> {\")\n\t\tfor _, h := range e.heads {\n\t\t\tb.WriteByte(' ')\n\t\t\tb.WriteString(h.id())\n\t\t}\n\t\tb.WriteString(\" }\\n\")\n\t}\n\n\tb.WriteByte('\\n')\n\n\tb.WriteString(\"}\\n\")\n\n\treturn b.Bytes(), nil\n}", "func g3() *Graph {\n\ttf := &testFactory{}\n\tn1, _ := tf.Make(job.NewIdWithRequestId(\"g3n1\", \"g3n1\", \"g3n1\", \"reqId1\"))\n\tn2, _ := tf.Make(job.NewIdWithRequestId(\"g3n2\", \"g3n2\", \"g3n2\", \"reqId1\"))\n\tn3, _ := tf.Make(job.NewIdWithRequestId(\"g3n3\", \"g3n3\", \"g3n3\", \"reqId1\"))\n\tn4, _ := tf.Make(job.NewIdWithRequestId(\"g3n4\", \"g3n4\", \"g3n4\", \"reqId1\"))\n\tg3n1 := &Node{Datum: n1}\n\tg3n2 := &Node{Datum: n2}\n\tg3n3 := &Node{Datum: n3}\n\tg3n4 := &Node{Datum: n4}\n\n\tg3n1.Prev = map[string]*Node{}\n\tg3n1.Next = map[string]*Node{\"g3n2\": g3n2, \"g3n3\": g3n3}\n\tg3n2.Next = map[string]*Node{\"g3n4\": g3n4}\n\tg3n3.Next = map[string]*Node{\"g3n4\": g3n4}\n\tg3n4.Prev = map[string]*Node{\"g3n2\": g3n2, \"g3n3\": g3n3}\n\tg3n2.Prev = map[string]*Node{\"g3n1\": g3n1}\n\tg3n3.Prev = map[string]*Node{\"g3n1\": g3n1}\n\tg3n4.Next = map[string]*Node{}\n\n\treturn &Graph{\n\t\tName: \"test1\",\n\t\tFirst: g3n1,\n\t\tLast: g3n4,\n\t\tVertices: map[string]*Node{\n\t\t\t\"g3n1\": g3n1,\n\t\t\t\"g3n2\": g3n2,\n\t\t\t\"g3n3\": g3n3,\n\t\t\t\"g3n4\": g3n4,\n\t\t},\n\t\tEdges: map[string][]string{\n\t\t\t\"g3n1\": []string{\"g3n2\", \"g3n3\"},\n\t\t\t\"g3n2\": []string{\"g3n4\"},\n\t\t\t\"g3n3\": []string{\"g3n4\"},\n\t\t},\n\t}\n}", "func (Step) IsNode() {}", "func insertRelationEdges(conn types.TGConnection, gof types.TGGraphObjectFactory, houseMemberTable map[string]types.TGNode) {\n\tfmt.Println(\">>>>>>> Entering InsertRelationEdges: Insert Few Family Relations with individual properties <<<<<<<\")\n\n\t// Insert edge data into database\n\t// Two edge types defined in ancestry-initdb.conf.\n\t// Added year of marriage and place of marriage edge attributes for spouseEdge desc\n\t// Added Birth order edge attribute for offspringEdge desc\n\n\tgmd, err := conn.GetGraphMetadata(true)\n\tif err != nil {\n\t\tfmt.Println(\">>>>>>> Returning from InsertRelationEdges - error during conn.GetGraphMetadata <<<<<<<\")\n\t\treturn\n\t}\n\n\tspouseEdgeType, err := gmd.GetEdgeType(\"spouseEdge\")\n\tif err != nil {\n\t\tfmt.Println(\">>>>>>> Returning from InsertRelationEdges - error during conn.GetEdgeType('spouseEdge') <<<<<<<\")\n\t\treturn\n\t}\n\tif spouseEdgeType != nil {\n\t\tfmt.Printf(\">>>>>>> 'spouseEdge' is found with %d attributes <<<<<<<\\n\", len(spouseEdgeType.GetAttributeDescriptors()))\n\t} else {\n\t\tfmt.Println(\">>>>>>> 'spouseEdge' is not found from meta data fetch <<<<<<<\")\n\t\treturn\n\t}\n\n\toffspringEdgeType, err := gmd.GetEdgeType(\"offspringEdge\")\n\tif err != nil {\n\t\tfmt.Println(\">>>>>>> Returning from InsertRelationEdges - error during conn.GetEdgeType('offspringEdge') <<<<<<<\")\n\t\treturn\n\t}\n\tif offspringEdgeType != nil {\n\t\tfmt.Printf(\">>>>>>> 'offspringEdgeType' is found with %d attributes <<<<<<<\\n\", len(offspringEdgeType.GetAttributeDescriptors()))\n\t} else {\n\t\tfmt.Println(\">>>>>>> 'spouseEdge' is not found from meta data fetch <<<<<<<\")\n\t\treturn\n\t}\n\n\tfor _, houseRelation := range HouseRelationData {\n\t\thouseMemberFrom := houseMemberTable[houseRelation.FromMemberName]\n\t\thouseMemberTo := houseMemberTable[houseRelation.ToMemberName]\n\t\trelationName := houseRelation.RelationDesc\n\t\tfmt.Printf(\">>>>>>> Inside InsertRelationEdges: trying to create edge('%s'): From '%s' To '%s' <<<<<<<\\n\", relationName, houseRelation.FromMemberName, houseRelation.ToMemberName)\n\t\t//var relationDirection types.TGDirectionType\n\t\tif relationName == \"spouse\" {\n\t\t\t//relationDirection = types.DirectionTypeUnDirected\n\t\t\tspouseEdgeType.GetFromNodeType()\n\t\t\tedge1, err := gof.CreateEdgeWithEdgeType(houseMemberFrom, houseMemberTo, spouseEdgeType)\n\t\t\tif err != nil {\n\t\t\t\tfmt.Println(\">>>>>>> Returning from InsertRelationEdges - error during gof.CreateEdgeWithEdgeType(spouseEdgeType) <<<<<<<\")\n\t\t\t\treturn\n\t\t\t}\n\t\t\t_ = edge1.SetOrCreateAttribute(\"yearMarried\", houseRelation.Attribute1)\n\t\t\t_ = edge1.SetOrCreateAttribute(\"placeMarried\", houseRelation.Attribute2)\n\t\t\t_ = edge1.SetOrCreateAttribute(\"relType\", relationName)\n\t\t\terr = conn.InsertEntity(edge1)\n\t\t\tif err != nil {\n\t\t\t\tfmt.Println(\">>>>>>> Returning from InsertRelationEdges - error during conn.InsertEntity(edge1) <<<<<<<\")\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\t_, err = conn.Commit()\n\t\t\tif err != nil {\n\t\t\t\tfmt.Println(\">>>>>>> Returning from InsertRelationEdges w/ error during conn.Commit() <<<<<<<\")\n\t\t\t\treturn\n\t\t\t}\n\t\t\tfmt.Printf(\">>>>>>> Inside InsertRelationEdges: Successfully added edge(spouse): From '%+v' To '%+v' <<<<<<<\\n\", houseRelation.FromMemberName, houseRelation.ToMemberName)\n\t\t} else {\n\t\t\t//relationDirection = types.DirectionTypeDirected\n\t\t\tedge1, err := gof.CreateEdgeWithEdgeType(houseMemberFrom, houseMemberTo, offspringEdgeType)\n\t\t\tif err != nil {\n\t\t\t\tfmt.Println(\">>>>>>> Returning from InsertRelationEdges - error during gof.CreateEdgeWithEdgeType(offspringEdgeType) <<<<<<<\")\n\t\t\t\treturn\n\t\t\t}\n\t\t\t_ = edge1.SetOrCreateAttribute(\"birthOrder\", houseRelation.Attribute1)\n\t\t\t_ = edge1.SetOrCreateAttribute(\"relType\", relationName)\n\t\t\terr = conn.InsertEntity(edge1)\n\t\t\tif err != nil {\n\t\t\t\tfmt.Println(\">>>>>>> Returning from InsertRelationEdges - error during conn.InsertEntity(edge1) <<<<<<<\")\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\t_, err = conn.Commit()\n\t\t\tif err != nil {\n\t\t\t\tfmt.Println(\">>>>>>> Returning from InsertRelationEdges w/ error during conn.Commit() <<<<<<<\")\n\t\t\t\treturn\n\t\t\t}\n\t\t\tfmt.Printf(\">>>>>>> Inside InsertRelationEdges: Successfully added edge: From '%+v' To '%+v' <<<<<<<\\n\", houseRelation.FromMemberName, houseRelation.ToMemberName)\n\t\t}\n\t} // End of for loop\n\n\tfmt.Println(\">>>>>>> Successfully added edges w/ NO ERRORS !!! <<<<<<<\")\n\tfmt.Println(\">>>>>>> Returning from InsertRelationEdges w/ NO ERRORS !!! <<<<<<<\")\n}", "func (e *Enumeration) setupGraph() error {\n\tif e.Config.GremlinURL != \"\" {\n\t\tgremlin := handlers.NewGremlin(e.Config.GremlinURL,\n\t\t\te.Config.GremlinUser, e.Config.GremlinPass, e.Config.Log)\n\t\te.Graph = gremlin\n\t\treturn nil\n\t}\n\n\tgraph := handlers.NewGraph(e.Config.Dir)\n\tif graph == nil {\n\t\treturn errors.New(\"Failed to create the graph\")\n\t}\n\te.Graph = graph\n\treturn nil\n}", "func usageGraph(cmd string) string {\n\treturn \"Generates a DOT representation of a Bridge and writes it to standard \" +\n\t\t\"output.\\n\" +\n\t\t\"\\n\" +\n\t\t\"USAGE:\\n\" +\n\t\t\" \" + cmd + \" FILE\\n\"\n}", "func (g UndirectWeighted) Nodes() Nodes { return g.G.Nodes() }", "func (currentLabel *Label) removeNode(removeLabel *Label, g *Graph) uint16 {\n Assert(nilGraph, g != nil)\n Assert(nilLabelStore, g.labelStore != nil)\n Assert(nilLabel, removeLabel != nil)\n \n // make sure we haven't reached the end of the road\n if (currentLabel == nil) { // TODO should this cause an error?\n return uint16(0)\n }\n \n // this is the one we want\n if removeLabel.Id == currentLabel.Id {\n // remove this label\n cl, _ := currentLabel.left(g) // TODO do not ignore error\n cr, _ := currentLabel.right(g) // TODO do not ignore error\n \n if cl == nil && cr == nil { // no descendents\n return uint16(0)\n } else if cl == nil { // one descendent\n return cr.Id\n } else if cr == nil { // one descendent\n return cl.Id\n } else if cl.height() > cr.height() {\n // get the right most node of the left branch\n rLabel := cl.rightmostNode(g)\n rLabel.l = cl.removeNode(rLabel, g)\n rLabel.r = currentLabel.r\n g.labelStore.writes[rLabel.Id] = rLabel\n return rLabel.balance(g)\n } else {\n // get the left most node of the right branch\n lLabel := cr.leftmostNode(g)\n lLabel.r = cl.removeNode(lLabel, g)\n lLabel.l = currentLabel.l\n g.labelStore.writes[lLabel.Id] = lLabel\n return lLabel.balance(g)\n }\n \n // keep looking\n } else if removeLabel.Value(g) < currentLabel.Value(g) {\n left, _ := currentLabel.left(g) // TODO do not ignore error\n l := left.removeNode(removeLabel, g)\n if (l != currentLabel.l) {\n g.labelStore.writes[currentLabel.Id] = currentLabel\n }\n currentLabel.l = l\n } else {\n right, _ := currentLabel.right(g) // TODO do not ignore error\n r := right.removeNode(removeLabel, g)\n if (r != currentLabel.r) {\n g.labelStore.writes[currentLabel.Id] = currentLabel\n }\n currentLabel.r = r\n }\n \n return currentLabel.balance(g)\n \n}", "func GraphToStructs(e []GraphEdge, v map[string]GraphVertex, posPrec int, strokePrec int, fontsizePrec int, transform TransformSvg, clip string) []TagStruct {\n\tparams := []TagStruct{}\n\n\tfor _, edge := range e {\n\t\tv1, ok1 := v[edge.V1]\n\t\tv2, ok2 := v[edge.V2]\n\n\t\tif ok1 && ok2 {\n\t\t\tline := LineSvg{v1.Vertex.Cx, v1.Vertex.Cy, v2.Vertex.Cx, v2.Vertex.Cy, edge.Color, transform, \"\"}\n\n\t\t\tparams = append(params, line.ToStruct(posPrec, strokePrec))\n\t\t} else {\n\t\t\tfmt.Println(\"at svgco.GraphToStruct,\", \"an edge:\", edge.V1, \"--\", edge.V2, \"does Not exist\")\n\t\t}\n\t}\n\n\tfor _, v := range v {\n\t\tparams = append(params, v.Vertex.ToStruct(posPrec, strokePrec))\n\t\tparams = append(params, v.Label.ToStruct(posPrec, fontsizePrec))\n\t}\n\n\t/*\n\t\t// if clipId len > 0 ....\n\t\tif len(clip) > 0 {\n\t\t\tfor _, e := range paramsEdge {\n\t\t\t\te.param[\"clip-path\"] = \"url(#\" + clipId + \")\"\n\t\t\t}\n\t\t\tfor _, e := range paramsVertex {\n\t\t\t\te.param[\"clip-path\"] = \"url(#\" + clipId + \")\"\n\t\t\t}\n\t\t\tfor _, e := range paramsLabel {\n\t\t\t\te.param[\"clip-path\"] = \"url(#\" + clipId + \")\"\n\t\t\t}\n\t\t}\n\t*/\n\treturn params\n}", "func (obj *transaction) Graphbase() graphbases.Transaction {\n\treturn obj.graphbase\n}", "func buildGraphEdges(dp *simple.DirectedGraph, registry map[string]Node) error {\n\tnodeIt := dp.Nodes()\n\n\tfor nodeIt.Next() {\n\t\tnode := nodeIt.Node().(Node)\n\n\t\tif node.NodeType() != TypeCMDNode {\n\t\t\t// datasource node, nothing to do for now. Although if we want expression results to be\n\t\t\t// used as datasource query params some day this will need change\n\t\t\tcontinue\n\t\t}\n\n\t\tcmdNode := node.(*CMDNode)\n\n\t\tfor _, neededVar := range cmdNode.Command.NeedsVars() {\n\t\t\tneededNode, ok := registry[neededVar]\n\t\t\tif !ok {\n\t\t\t\treturn fmt.Errorf(\"unable to find dependent node '%v'\", neededVar)\n\t\t\t}\n\n\t\t\tif neededNode.ID() == cmdNode.ID() {\n\t\t\t\treturn fmt.Errorf(\"can not add self referencing node for var '%v' \", neededVar)\n\t\t\t}\n\n\t\t\tedge := dp.NewEdge(neededNode, cmdNode)\n\n\t\t\tdp.SetEdge(edge)\n\t\t}\n\t}\n\treturn nil\n}", "func SomeGraphToJSONable(\n\tinstance *SomeGraph) (\n\ttarget map[string]interface{}, err error) {\n\n\tif instance == nil {\n\t\tpanic(\"unexpected nil instance\")\n\t}\n\n\ttarget = make(map[string]interface{})\n\tdefer func() {\n\t\tif err != nil {\n\t\t\ttarget = nil\n\t\t}\n\t}()\n\t////\n\t// Serialize instance registry of SomeClass\n\t////\n\n\tif len(instance.SomeClasses) > 0 {\n\t\ttargetSomeClasses := make(map[string]interface{})\n\t\tfor id := range instance.SomeClasses {\n\t\t\tsomeClassInstance := instance.SomeClasses[id]\n\n\t\t\tif id != someClassInstance.ID {\n\t\t\t\terr = fmt.Errorf(\n\t\t\t\t\t\"expected the instance of SomeClass to have the ID %s according to the registry, but got: %s\",\n\t\t\t\t\tid, someClassInstance.ID)\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\ttargetSomeClasses[id] = SomeClassToJSONable(\n\t\t\t\tsomeClassInstance)\n\t\t}\n\n\t\ttarget[\"some_classes\"] = targetSomeClasses\n\t}\n\n\t////\n\t// Serialize instance registry of OtherClass\n\t////\n\n\tif len(instance.OtherClasses) > 0 {\n\t\ttargetOtherClasses := make(map[string]interface{})\n\t\tfor id := range instance.OtherClasses {\n\t\t\totherClassInstance := instance.OtherClasses[id]\n\n\t\t\tif id != otherClassInstance.ID {\n\t\t\t\terr = fmt.Errorf(\n\t\t\t\t\t\"expected the instance of OtherClass to have the ID %s according to the registry, but got: %s\",\n\t\t\t\t\tid, otherClassInstance.ID)\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\ttargetOtherClasses[id] = OtherClassToJSONable(\n\t\t\t\totherClassInstance)\n\t\t}\n\n\t\ttarget[\"other_classes\"] = targetOtherClasses\n\t}\n\n\treturn\n}", "func (r *resolver) buildSingleVertexGraph(nodeDef *spec.Node, jobArgs map[string]interface{}) (*Graph, error) {\n\tn, err := r.newNode(nodeDef, jobArgs)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tg := &Graph{\n\t\tName: nodeDef.Name,\n\t\tSource: n,\n\t\tSink: n,\n\t\tNodes: map[string]*Node{n.Id: n},\n\t\tEdges: map[string][]string{},\n\t\tRevEdges: map[string][]string{},\n\t}\n\treturn g, nil\n}", "func (g *Graph) adj(v int) []int {\n if g.vertex[v] == nil {\n return []int{}\n } else {\n adjNodes := make([]int, 0)\n n := g.vertex[v]\n //fmt.Println(\"adj\", n)\n for {\n adjNodes = append(adjNodes, (*n).val)\n n = n.next\n if n == nil {\n break\n } else if n.next == nil {\n adjNodes = append(adjNodes, (*n).val)\n break\n }\n }\n return adjNodes\n }\n}", "func (msaNodes *msaNodes) drawEdges() error {\n\t// getFirstNode returns the nodeID for the first node in the MSA derived from a specified sequence\n\tgetFirstNode := func(seqID string) int {\n\t\tfor nodeID := 1; nodeID <= len(msaNodes.nodeHolder); nodeID++ {\n\t\t\tfor _, id := range msaNodes.nodeHolder[nodeID].parentSeqIDs {\n\t\t\t\tif seqID == id {\n\t\t\t\t\t\treturn nodeID\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn 0\n\t}\n\t// findNextNode returns the ID of the next node that is derived from a query MSA sequence\n\tfindNextNode := func(seqID string, startNode int) int {\n\t\tfor nextNode := startNode + 1; nextNode <= len(msaNodes.nodeHolder); nextNode++ {\n\t\t\tfor _, parentSeqID := range msaNodes.nodeHolder[nextNode].parentSeqIDs {\n\t\t\t\tif seqID == parentSeqID {\n\t\t\t\t\t\t\treturn nextNode\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn 0\n\t}\n\t// iterate over each MSA sequence, connecting edges for each one\n\tfor _, seqID := range msaNodes.seqIDs {\n\t\tstartNode := getFirstNode(seqID)\n\t\tif startNode == 0 {\n\t\t\treturn fmt.Errorf(\"Node parse error: Could not identify start node for %v\", seqID)\n\t\t}\n\t\tfor {\n\t\t\tnextNode := findNextNode(seqID, startNode)\n\t\t\tif nextNode == 0 {\n\t\t\t\tbreak\n\t\t\t}\n\t\t\t// draw edges\n\t\t\tmsaNodes.nodeHolder[startNode].outEdges[nextNode] = struct{}{}\n\t\t\tmsaNodes.nodeHolder[nextNode].inEdges[startNode] = struct{}{}\n\t\t\tstartNode = nextNode\n\t\t}\n\t}\n\treturn nil\n}", "func (currentLabel *Label) addNode(newLabel *Label, g *Graph) uint16 {\n Assert(nilGraph, g != nil)\n Assert(nilLabelStore, g.labelStore != nil)\n Assert(nilLabel, newLabel != nil)\n \n if currentLabel == nil {\n return newLabel.Id\n }\n \n currentVal := currentLabel.Value(g)\n newVal := newLabel.Value(g)\n \n if newVal < currentVal {\n ln, _ := currentLabel.left(g) // TODO do not ignore error\n l := ln.addNode(newLabel, g)\n if l != currentLabel.l {\n g.labelStore.writes[currentLabel.Id] = currentLabel\n }\n currentLabel.l = l\n } else {\n rn, _ := currentLabel.right(g) // TODO do not ignore error\n r := rn.addNode(newLabel, g) \n if r != currentLabel.r {\n g.labelStore.writes[currentLabel.Id] = currentLabel\n }\n currentLabel.r = r\n }\n \n currentLabel.setHeight(g)\n return currentLabel.balance(g)\n}", "func copyGraph(ctx context.Context, src content.ReadOnlyStorage, dst content.Storage, root ocispec.Descriptor,\n\tproxy *cas.Proxy, limiter *semaphore.Weighted, tracker *status.Tracker, opts CopyGraphOptions) error {\n\tif proxy == nil {\n\t\t// use caching proxy on non-leaf nodes\n\t\tif opts.MaxMetadataBytes <= 0 {\n\t\t\topts.MaxMetadataBytes = defaultCopyMaxMetadataBytes\n\t\t}\n\t\tproxy = cas.NewProxyWithLimit(src, cas.NewMemory(), opts.MaxMetadataBytes)\n\t}\n\tif limiter == nil {\n\t\t// if Concurrency is not set or invalid, use the default concurrency\n\t\tif opts.Concurrency <= 0 {\n\t\t\topts.Concurrency = defaultConcurrency\n\t\t}\n\t\tlimiter = semaphore.NewWeighted(int64(opts.Concurrency))\n\t}\n\tif tracker == nil {\n\t\t// track content status\n\t\ttracker = status.NewTracker()\n\t}\n\t// if FindSuccessors is not provided, use the default one\n\tif opts.FindSuccessors == nil {\n\t\topts.FindSuccessors = content.Successors\n\t}\n\n\t// traverse the graph\n\tvar fn syncutil.GoFunc[ocispec.Descriptor]\n\tfn = func(ctx context.Context, region *syncutil.LimitedRegion, desc ocispec.Descriptor) (err error) {\n\t\t// skip the descriptor if other go routine is working on it\n\t\tdone, committed := tracker.TryCommit(desc)\n\t\tif !committed {\n\t\t\treturn nil\n\t\t}\n\t\tdefer func() {\n\t\t\tif err == nil {\n\t\t\t\t// mark the content as done on success\n\t\t\t\tclose(done)\n\t\t\t}\n\t\t}()\n\n\t\t// skip if a rooted sub-DAG exists\n\t\texists, err := dst.Exists(ctx, desc)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif exists {\n\t\t\tif opts.OnCopySkipped != nil {\n\t\t\t\tif err := opts.OnCopySkipped(ctx, desc); err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn nil\n\t\t}\n\n\t\t// find successors while non-leaf nodes will be fetched and cached\n\t\tsuccessors, err := opts.FindSuccessors(ctx, proxy, desc)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tsuccessors = removeForeignLayers(successors)\n\n\t\tif len(successors) != 0 {\n\t\t\t// for non-leaf nodes, process successors and wait for them to complete\n\t\t\tregion.End()\n\t\t\tif err := syncutil.Go(ctx, limiter, fn, successors...); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tfor _, node := range successors {\n\t\t\t\tdone, committed := tracker.TryCommit(node)\n\t\t\t\tif committed {\n\t\t\t\t\treturn fmt.Errorf(\"%s: %s: successor not committed\", desc.Digest, node.Digest)\n\t\t\t\t}\n\t\t\t\tselect {\n\t\t\t\tcase <-done:\n\t\t\t\tcase <-ctx.Done():\n\t\t\t\t\treturn ctx.Err()\n\t\t\t\t}\n\t\t\t}\n\t\t\tif err := region.Start(); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t\texists, err = proxy.Cache.Exists(ctx, desc)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif exists {\n\t\t\treturn copyNode(ctx, proxy.Cache, dst, desc, opts)\n\t\t}\n\t\treturn copyNode(ctx, src, dst, desc, opts)\n\t}\n\n\treturn syncutil.Go(ctx, limiter, fn, root)\n}", "func (g *Graph) Link(sourceURL, targetURL *url.URL, weight float64) {\n\tlog.Printf(\"attempting %s > %s\\n\", sourceURL, targetURL)\n\n\tsource := g.Get(sourceURL)\n\ttarget := g.Get(targetURL)\n\n\tif source == nil {\n\t\tlog.Printf(\"node %s doesn't exist\\n\", sourceURL)\n\t\treturn\n\t}\n\tsource.outbound += weight\n\n\tif target == nil {\n\t\tlog.Printf(\"node %s doesn't exist\\n\", targetURL)\n\t\treturn\n\t}\n\n\tif source.ID() == target.ID() {\n\t\tlog.Printf(\"source target are the same %s %x > %s %x \\n\", sourceURL, source.ID(), targetURL, target.ID())\n\t\treturn\n\t}\n\n\tg.Lock()\n\tif _, ok := g.edges[source.ID()]; ok == false {\n\t\tg.edges[source.ID()] = map[uint32]float64{}\n\t}\n\tg.edges[source.ID()][target.ID()] += weight\n\tg.Unlock()\n\n\tlog.Printf(\"linked %s > %s\\n\", sourceURL, targetURL)\n\n}", "func (g Digraph) Link(n1, n2 interface{}, arc graph2.Arc) {\n\tnd2, ok := g[n2]\n\tif !ok {\n\t\tnd2 = &Node{Data: n2}\n\t\tg[n2] = nd2\n\t}\n\tif nd1, ok := g[n1]; !ok {\n\t\tnd1 = &Node{n1, []graph2.Half{{arc, nd2}}}\n\t\tg[n1] = nd1\n\t} else {\n\t\tnd1.Nbs = append(nd1.Nbs, graph2.Half{arc, nd2})\n\t}\n}", "func (m VarnishPlugin) GraphDefinition() map[string]mp.Graphs {\n\treturn graphdef\n}", "func (q *Qualifier) Graph(w io.Writer) {\n\tfmt.Fprintf(w, \"digraph {\\n\")\n\tq.root.Graph(w, 0, \"[root]\")\n\tfmt.Fprintf(w, \"}\\n\")\n}", "func (graphS Graph) traverse(f *os.File, vertex *dag.Vertex, done *[]*dag.Vertex, fname string) error {\n graph := graphS.g\n\n var err error\n // Check if we are in done[]; if we are, we don't need to do anything\n if sliceContains(*done, vertex) {\n return nil\n }\n\n // We set this here to avoid loops\n *done = append(*done, vertex)\n\n // Loop over children\n children, err := graph.Successors(vertex)\n if err != nil {\n return fmt.Errorf(\"Unable to get children of %s with %w\", vertex.ID, err)\n }\n\n for _, child := range children {\n // Add the line to the DOT\n _, err = f.WriteString(fmt.Sprintf(\"\\\"%s\\\" -> \\\"%s\\\"\\n\", vertex.ID, child.ID))\n if err != nil {\n return fmt.Errorf(\"Unable to write to %s with %w\", fname, err)\n }\n // Recurse to children\n err = graphS.traverse(f, child, done, fname)\n if err != nil {\n return err\n }\n }\n\n return nil\n}", "func MakeGraph(matrix [9][9]int) int {\n\tgraph := implementDS.Graph{}\n\tnodes := make(map[string]*implementDS.Node)\n\tfor i := 0; i < 9; i++ {\n\t\tfor j := 0; j < 9; j++ {\n\t\t\tif matrix[i][j] == 1 {\n\t\t\t\tname := strconv.Itoa(i) + strconv.Itoa(j)\n\t\t\t\tnodes[name] = &implementDS.Node{Name: name}\n\t\t\t}\n\t\t}\n\t}\n\tfor i := 0; i < 9; i++ {\n\t\tfor j := 0; j < 9; j++ {\n\t\t\tif matrix[i][j] == 1 {\n\t\t\t\tif i+1 < 9 && matrix[i+1][j] == 1 {\n\t\t\t\t\tname := strconv.Itoa(i) + strconv.Itoa(j)\n\t\t\t\t\tname2 := strconv.Itoa(i+1) + strconv.Itoa(j)\n\t\t\t\t\tgraph.AddEdge(nodes[name], nodes[name2], 1)\n\t\t\t\t}\n\t\t\t\tif i-1 >= 0 && matrix[i-1][j] == 1 {\n\t\t\t\t\tname := strconv.Itoa(i) + strconv.Itoa(j)\n\t\t\t\t\tname2 := strconv.Itoa(i-1) + strconv.Itoa(j)\n\t\t\t\t\tgraph.AddEdge(nodes[name], nodes[name2], 1)\n\t\t\t\t}\n\t\t\t\tif j-1 >= 0 && matrix[i][j-1] == 1 {\n\t\t\t\t\tname := strconv.Itoa(i) + strconv.Itoa(j)\n\t\t\t\t\tname2 := strconv.Itoa(i) + strconv.Itoa(j-1)\n\t\t\t\t\tgraph.AddEdge(nodes[name], nodes[name2], 1)\n\t\t\t\t}\n\t\t\t\tif j+1 < 9 && matrix[i][j+1] == 1 {\n\t\t\t\t\tname := strconv.Itoa(i) + strconv.Itoa(j)\n\t\t\t\t\tname2 := strconv.Itoa(i) + strconv.Itoa(j+1)\n\t\t\t\t\tgraph.AddEdge(nodes[name], nodes[name2], 1)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t}\n\t//fmt.Println(graph.Dijkstra(nodes[\"80\"], nodes[\"08\"]))\n\tdijkstra := graph.Dijkstra(nodes[\"80\"], nodes[\"08\"])\n\treturn dijkstra\n}", "func (s StatsGraphAsync) construct() StatsGraphClass { return &s }", "func writeDotGraph(outf *os.File, start *node, id string) {\n\tdone := make(map[*node]bool)\n\tvar show func(*node)\n\tshow = func(u *node) {\n\t\tif u.accept {\n\t\t\tfmt.Fprintf(outf, \" %v[style=filled,color=green];\\n\", u.n)\n\t\t}\n\t\tdone[u] = true\n\t\tfor _, e := range u.e {\n\t\t\t// We use -1 to denote the dead end node in DFAs.\n\t\t\tif e.dst.n == -1 {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tlabel := \"\"\n\t\t\truneToDot := func(r rune) string {\n\t\t\t\tif strconv.IsPrint(r) {\n\t\t\t\t\treturn fmt.Sprintf(\"%v\", string(r))\n\t\t\t\t}\n\t\t\t\treturn fmt.Sprintf(\"U+%X\", int(r))\n\t\t\t}\n\t\t\tswitch e.kind {\n\t\t\tcase kRune:\n\t\t\t\tlabel = fmt.Sprintf(\"[label=%q]\", runeToDot(e.r))\n\t\t\tcase kWild:\n\t\t\t\tlabel = \"[color=blue]\"\n\t\t\tcase kClass:\n\t\t\t\tlabel = \"[label=\\\"[\"\n\t\t\t\tif e.negate {\n\t\t\t\t\tlabel += \"^\"\n\t\t\t\t}\n\t\t\t\tfor i := 0; i < len(e.lim); i += 2 {\n\t\t\t\t\tlabel += runeToDot(e.lim[i])\n\t\t\t\t\tif e.lim[i] != e.lim[i+1] {\n\t\t\t\t\t\tlabel += \"-\" + runeToDot(e.lim[i+1])\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tlabel += \"]\\\"]\"\n\t\t\t}\n\t\t\tfmt.Fprintf(outf, \" %v -> %v%v;\\n\", u.n, e.dst.n, label)\n\t\t}\n\t\tfor _, e := range u.e {\n\t\t\tif !done[e.dst] {\n\t\t\t\tshow(e.dst)\n\t\t\t}\n\t\t}\n\t}\n\tfmt.Fprintf(outf, \"digraph %v {\\n 0[shape=box];\\n\", id)\n\tshow(start)\n\tfmt.Fprintln(outf, \"}\")\n}", "func (c ClusterNodes) Add() {\n\n}", "func (r *resolver) newReqGraph(name string, jobArgs map[string]interface{}) (*Graph, error) {\n\tvar err error\n\n\tjobArgsCopy, err := remapNodeArgs(&spec.NoopNode, jobArgs)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tsource, err := r.newNoopNode(name+\"_begin\", jobArgsCopy)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tsink, err := r.newNoopNode(name+\"_end\", jobArgsCopy)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tif err := setNodeArgs(&spec.NoopNode, jobArgs, jobArgsCopy); err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn &Graph{\n\t\tName: name,\n\t\tSource: source,\n\t\tSink: sink,\n\t\tNodes: map[string]*Node{source.Id: source, sink.Id: sink},\n\t\tEdges: map[string][]string{source.Id: []string{sink.Id}},\n\t\tRevEdges: map[string][]string{sink.Id: []string{source.Id}},\n\t}, nil\n}", "func (g Gram) Weight() {\n\n}", "func (s *BaseGraffleParserListener) EnterGraph_assign(ctx *Graph_assignContext) {}", "func newGraph(ctx context.Context, gq *gql.GraphQuery) (*SubGraph, error) {\n\teuid, exid := gq.UID, gq.XID\n\t// This would set the Result field in SubGraph,\n\t// and populate the children for attributes.\n\tif len(exid) > 0 {\n\t\tx.AssertTruef(!strings.HasPrefix(exid, \"_new_:\"), \"Query shouldn't contain _new_\")\n\t\teuid = farm.Fingerprint64([]byte(exid))\n\t\tx.Trace(ctx, \"Xid: %v Uid: %v\", exid, euid)\n\t}\n\n\tif euid == 0 && gq.Gen == nil {\n\t\terr := x.Errorf(\"Invalid query, query internal id is zero and generator is nil\")\n\t\tx.TraceError(ctx, err)\n\t\treturn nil, err\n\t}\n\n\t// sg is to be returned.\n\targs := params{\n\t\tAttrType: schema.TypeOf(gq.Attr),\n\t\tisDebug: gq.Attr == \"debug\",\n\t}\n\n\tsg := &SubGraph{\n\t\tAttr: gq.Attr,\n\t\tParams: args,\n\t\tFilter: gq.Filter,\n\t}\n\tif gq.Gen != nil {\n\t\terr := sg.applyGenerator(ctx, gq.Gen)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t} else {\n\t\t// euid is the root UID.\n\t\tsg.SrcUIDs = &task.List{Uids: []uint64{euid}}\n\t\tsg.uidMatrix = []*task.List{&task.List{Uids: []uint64{euid}}}\n\t}\n\tsg.values = createNilValuesList(1)\n\treturn sg, nil\n}", "func main() {\n graph := createGraph()\n graph.addEdge(1, 2)\n graph.addEdge(2, 3)\n graph.addEdge(2, 4)\n graph.addEdge(3, 4)\n graph.addEdge(1, 5)\n graph.addEdge(5, 6)\n graph.addEdge(5, 7)\n\n visited := make(set)\n\n dfs(graph, 1, visited, func(node int) {\n fmt.Print(node, \" \")\n })\n}", "func (g *Graph) AddNode(nodeLabel string) {\n}", "func (Task) IsNode() {}", "func (p HAProxyPlugin) GraphDefinition() map[string]mp.Graphs {\n\treturn graphdef\n}", "func testgraphs() {\n\tg, err := buildGraph(false)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\terr = makegrid(2, &g)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\terr = expandgraph(&g)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\terr = g.printGraph()\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n}", "func (m *Machine) Graph() string {\n\treturn fsm.Visualize(m.fsm)\n}", "func SomeGraphFromJSONable(\n\tvalue interface{},\n\tref string,\n\ttarget *SomeGraph,\n\terrors *Errors) {\n\n\tif target == nil {\n\t\tpanic(\"unexpected nil target\")\n\t}\n\n\tif errors == nil {\n\t\tpanic(\"unexpected nil errors\")\n\t}\n\n\tif !errors.Empty() {\n\t\tpanic(\"unexpected non-empty errors\")\n\t}\n\n\tcast, ok := value.(map[string]interface{})\n\tif !ok {\n\t\terrors.Add(\n\t\t\tref,\n\t\t\tfmt.Sprintf(\n\t\t\t\t\"expected a map[string]interface{}, but got: %T\",\n\t\t\t\tvalue))\n\t\treturn\n\t}\n\n\t////\n\t// Pre-allocate Empties\n\t////\n\n\temptiesRef := ref+\"/empties\";\n\tvar emptiesOk bool\n\tvar emptiesValue interface{}\n\tvar emptiesMap map[string]interface{}\n\n\temptiesValue, emptiesOk = cast[\n\t\t\"empties\"]\n\tif emptiesOk {\n\t\temptiesMap, ok = emptiesValue.(map[string]interface{})\n\t\tif !ok {\n\t\t\terrors.Add(\n\t\t\t\temptiesRef,\n\t\t\t\tfmt.Sprintf(\n\t\t\t\t\t\"expected a map[string]interface{}, but got: %T\",\n\t\t\t\t\temptiesValue));\n\t\t} else {\n\t\t\ttarget.Empties = make(\n\t\t\t\tmap[string]*Empty)\n\n\t\t\tfor id := range emptiesMap {\n\t\t\t\ttarget.Empties[id] = &Empty{}\n\t\t\t}\n\t\t}\n\t}\n\n\t// Pre-allocating class instances is critical.\n\t// If the pre-allocation failed, we can not continue to parse the instances.\n\tif !errors.Empty() {\n\t\treturn\n\t}\n\n\t////\n\t// Parse Empties\n\t////\n\n\tif emptiesOk {\n\t\tfor id, value := range emptiesMap {\n\t\t\tEmptyFromJSONable(\n\t\t\t\tvalue,\n\t\t\t\tid,\n\t\t\t\tstrings.Join([]string{\n\t\t\t\t\temptiesRef, id}, \"/\"),\n\t\t\t\ttarget.Empties[id],\n\t\t\t\terrors)\n\n\t\t\tif errors.Full() {\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t}\n\n\tif errors.Full() {\n\t\treturn\n\t}\n\n\t////\n\t// Parse OptionalArray\n\t////\n\n\tvalue0, ok0 := cast[\n\t\t\"optional_array\"]\n\n\tif ok0 {\n\t\tcast1, ok1 := value0.([]interface{})\n\t\tif !ok1 {\n\t\t\terrors.Add(\n\t\t\t\tstrings.Join(\n\t\t\t\t\t[]string{\n\t\t\t\t\t\tref, \"optional_array\"},\n\t\t\t\t\t\"/\"),\n\t\t\t\tfmt.Sprintf(\n\t\t\t\t\t\"expected a []interface{}, but got: %T\",\n\t\t\t\t\tvalue0))\n\t\t} else {\n\t\t\ttarget1 := make(\n\t\t\t\t[]int64,\n\t\t\t\tlen(cast1))\n\t\t\tfor i1 := range cast1 {\n\t\t\t\tfcast2, ok2 := (cast1[i1]).(float64)\n\t\t\t\tif !ok2 {\n\t\t\t\t\terrors.Add(\n\t\t\t\t\t\tstrings.Join(\n\t\t\t\t\t\t\t[]string{\n\t\t\t\t\t\t\t\tref, \"optional_array\", strconv.Itoa(i1)},\n\t\t\t\t\t\t\t\"/\"),\n\t\t\t\t\t\tfmt.Sprintf(\n\t\t\t\t\t\t\t\"expected a float64, but got: %T\",\n\t\t\t\t\t\t\tcast1[i1]))\n\t\t\t\t} else if fcast2 != math.Trunc(fcast2) {\n\t\t\t\t\terrors.Add(\n\t\t\t\t\t\tstrings.Join(\n\t\t\t\t\t\t\t[]string{\n\t\t\t\t\t\t\t\tref, \"optional_array\", strconv.Itoa(i1)},\n\t\t\t\t\t\t\t\"/\"),\n\t\t\t\t\t\tfmt.Sprintf(\n\t\t\t\t\t\t\t\"expected a whole number, but got: %f\",\n\t\t\t\t\t\t\tfcast2))\n\t\t\t\t// 9223372036854775808.0 == 2^63 is the first float > MaxInt64.\n\t\t\t\t// -9223372036854775808.0 == -(2^63) is the last float >= MinInt64.\n\t\t\t\t} else if fcast2 >= 9223372036854775808.0 ||\n\t\t\t\t\tfcast2 < -9223372036854775808.0 {\n\n\t\t\t\t\terrors.Add(\n\t\t\t\t\t\tstrings.Join(\n\t\t\t\t\t\t\t[]string{\n\t\t\t\t\t\t\t\tref, \"optional_array\", strconv.Itoa(i1)},\n\t\t\t\t\t\t\t\"/\"),\n\t\t\t\t\t\tfmt.Sprintf(\n\t\t\t\t\t\t\t\"expected the value to fit into int64, but got an overflow: %f\",\n\t\t\t\t\t\t\tfcast2))\n\t\t\t\t} else {\n\t\t\t\t\ttarget1[i1] = int64(fcast2)\n\t\t\t\t}\n\n\t\t\t\tif errors.Full() {\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\ttarget.OptionalArray = target1\n\t\t}\n\t}\n\n\tif errors.Full() {\n\t\treturn\n\t}\n\n\t////\n\t// Parse OptionalBoolean\n\t////\n\n\tvalue3, ok3 := cast[\n\t\t\"optional_boolean\"]\n\n\tif ok3 {\n\t\tvar target3 bool\n\t\tcast4, ok4 := value3.(bool)\n\t\tif !ok4 {\n\t\t\terrors.Add(\n\t\t\t\tstrings.Join(\n\t\t\t\t\t[]string{\n\t\t\t\t\t\tref, \"optional_boolean\"},\n\t\t\t\t\t\"/\"),\n\t\t\t\tfmt.Sprintf(\n\t\t\t\t\t\"expected a bool, but got: %T\",\n\t\t\t\t\tvalue3))\n\t\t} else {\n\t\t\ttarget3 = cast4\n\t\t}\n\n\t\ttarget.OptionalBoolean = &target3\n\t}\n\n\tif errors.Full() {\n\t\treturn\n\t}\n\n\t////\n\t// Parse OptionalDate\n\t////\n\n\tvalue5, ok5 := cast[\n\t\t\"optional_date\"]\n\n\tif ok5 {\n\t\tvar target5 time.Time\n\t\tcast6, ok6 := value5.(string)\n\t\tif !ok6 {\n\t\t\terrors.Add(\n\t\t\t\tstrings.Join(\n\t\t\t\t\t[]string{\n\t\t\t\t\t\tref, \"optional_date\"},\n\t\t\t\t\t\"/\"),\n\t\t\t\tfmt.Sprintf(\n\t\t\t\t\t\"expected a string, but got: %T\",\n\t\t\t\t\tvalue5))\n\t\t} else {\n\t\t\ttarget6, err6 := time.Parse(\n\t\t\t\t\"2006-01-02\",\n\t\t\t\tcast6)\n\t\t\tif err6 != nil {\n\t\t\t\terrors.Add(\n\t\t\t\t\tstrings.Join(\n\t\t\t\t\t\t[]string{\n\t\t\t\t\t\t\tref, \"optional_date\"},\n\t\t\t\t\t\t\"/\"),\n\t\t\t\t\tfmt.Sprintf(\n\t\t\t\t\t\t\"expected layout 2006-01-02, got: %s\",\n\t\t\t\t\t\tcast6))\n\t\t\t} else {\n\t\t\t\ttarget5 = target6\n\t\t\t}\n\t\t}\n\n\t\ttarget.OptionalDate = &target5\n\t}\n\n\tif errors.Full() {\n\t\treturn\n\t}\n\n\t////\n\t// Parse OptionalDatetime\n\t////\n\n\tvalue7, ok7 := cast[\n\t\t\"optional_datetime\"]\n\n\tif ok7 {\n\t\tvar target7 time.Time\n\t\tcast8, ok8 := value7.(string)\n\t\tif !ok8 {\n\t\t\terrors.Add(\n\t\t\t\tstrings.Join(\n\t\t\t\t\t[]string{\n\t\t\t\t\t\tref, \"optional_datetime\"},\n\t\t\t\t\t\"/\"),\n\t\t\t\tfmt.Sprintf(\n\t\t\t\t\t\"expected a string, but got: %T\",\n\t\t\t\t\tvalue7))\n\t\t} else {\n\t\t\ttarget8, err8 := time.Parse(\n\t\t\t\t\"2006-01-02T15:04:05Z\",\n\t\t\t\tcast8)\n\t\t\tif err8 != nil {\n\t\t\t\terrors.Add(\n\t\t\t\t\tstrings.Join(\n\t\t\t\t\t\t[]string{\n\t\t\t\t\t\t\tref, \"optional_datetime\"},\n\t\t\t\t\t\t\"/\"),\n\t\t\t\t\tfmt.Sprintf(\n\t\t\t\t\t\t\"expected layout 2006-01-02T15:04:05Z, got: %s\",\n\t\t\t\t\t\tcast8))\n\t\t\t} else {\n\t\t\t\ttarget7 = target8\n\t\t\t}\n\t\t}\n\n\t\ttarget.OptionalDatetime = &target7\n\t}\n\n\tif errors.Full() {\n\t\treturn\n\t}\n\n\t////\n\t// Parse OptionalDuration\n\t////\n\n\tvalue9, ok9 := cast[\n\t\t\"optional_duration\"]\n\n\tif ok9 {\n\t\tvar target9 time.Duration\n\t\tcast10, ok10 := value9.(string)\n\t\tif !ok10 {\n\t\t\terrors.Add(\n\t\t\t\tstrings.Join(\n\t\t\t\t\t[]string{\n\t\t\t\t\t\tref, \"optional_duration\"},\n\t\t\t\t\t\"/\"),\n\t\t\t\tfmt.Sprintf(\n\t\t\t\t\t\"expected a string, but got: %T\",\n\t\t\t\t\tvalue9))\n\t\t} else {\n\t\t\ttarget10, err10 := durationFromString(cast10)\n\t\t\tif err10 != nil {\n\t\t\t\terrors.Add(\n\t\t\t\t\tstrings.Join(\n\t\t\t\t\t\t[]string{\n\t\t\t\t\t\t\tref, \"optional_duration\"},\n\t\t\t\t\t\t\"/\"),\n\t\t\t\t\tfmt.Sprintf(\n\t\t\t\t\t\t\"failed to parse duration from %#v: %s\",\n\t\t\t\t\t\tcast10,\n\t\t\t\t\t\terr10.Error()))\n\t\t\t} else {\n\t\t\t\ttarget9 = target10\n\t\t\t}\n\t\t}\n\n\t\ttarget.OptionalDuration = &target9\n\t}\n\n\tif errors.Full() {\n\t\treturn\n\t}\n\n\t////\n\t// Parse OptionalFloat\n\t////\n\n\tvalue11, ok11 := cast[\n\t\t\"optional_float\"]\n\n\tif ok11 {\n\t\tvar target11 float64\n\t\tcast12, ok12 := value11.(float64)\n\t\tif !ok12 {\n\t\t\terrors.Add(\n\t\t\t\tstrings.Join(\n\t\t\t\t\t[]string{\n\t\t\t\t\t\tref, \"optional_float\"},\n\t\t\t\t\t\"/\"),\n\t\t\t\tfmt.Sprintf(\n\t\t\t\t\t\"expected a float64, but got: %T\",\n\t\t\t\t\tvalue11))\n\t\t} else {\n\t\t\ttarget11 = cast12\n\t\t}\n\n\t\ttarget.OptionalFloat = &target11\n\t}\n\n\tif errors.Full() {\n\t\treturn\n\t}\n\n\t////\n\t// Parse OptionalInteger\n\t////\n\n\tvalue13, ok13 := cast[\n\t\t\"optional_integer\"]\n\n\tif ok13 {\n\t\tvar target13 int64\n\t\tfcast14, ok14 := value13.(float64)\n\t\tif !ok14 {\n\t\t\terrors.Add(\n\t\t\t\tstrings.Join(\n\t\t\t\t\t[]string{\n\t\t\t\t\t\tref, \"optional_integer\"},\n\t\t\t\t\t\"/\"),\n\t\t\t\tfmt.Sprintf(\n\t\t\t\t\t\"expected a float64, but got: %T\",\n\t\t\t\t\tvalue13))\n\t\t} else if fcast14 != math.Trunc(fcast14) {\n\t\t\terrors.Add(\n\t\t\t\tstrings.Join(\n\t\t\t\t\t[]string{\n\t\t\t\t\t\tref, \"optional_integer\"},\n\t\t\t\t\t\"/\"),\n\t\t\t\tfmt.Sprintf(\n\t\t\t\t\t\"expected a whole number, but got: %f\",\n\t\t\t\t\tfcast14))\n\t\t// 9223372036854775808.0 == 2^63 is the first float > MaxInt64.\n\t\t// -9223372036854775808.0 == -(2^63) is the last float >= MinInt64.\n\t\t} else if fcast14 >= 9223372036854775808.0 ||\n\t\t\tfcast14 < -9223372036854775808.0 {\n\n\t\t\terrors.Add(\n\t\t\t\tstrings.Join(\n\t\t\t\t\t[]string{\n\t\t\t\t\t\tref, \"optional_integer\"},\n\t\t\t\t\t\"/\"),\n\t\t\t\tfmt.Sprintf(\n\t\t\t\t\t\"expected the value to fit into int64, but got an overflow: %f\",\n\t\t\t\t\tfcast14))\n\t\t} else {\n\t\t\ttarget13 = int64(fcast14)\n\t\t}\n\n\t\ttarget.OptionalInteger = &target13\n\t}\n\n\tif errors.Full() {\n\t\treturn\n\t}\n\n\t////\n\t// Parse OptionalMap\n\t////\n\n\tvalue15, ok15 := cast[\n\t\t\"optional_map\"]\n\n\tif ok15 {\n\t\tcast16, ok16 := value15.(map[string]interface{})\n\t\tif !ok16 {\n\t\t\terrors.Add(\n\t\t\t\tstrings.Join(\n\t\t\t\t\t[]string{\n\t\t\t\t\t\tref, \"optional_map\"},\n\t\t\t\t\t\"/\"),\n\t\t\t\tfmt.Sprintf(\n\t\t\t\t\t\"expected a map[string]interface{}, but got: %T\",\n\t\t\t\t\tvalue15))\n\t\t} else {\n\t\t\ttarget16 := make(map[string]int64)\n\t\t\tfor k16 := range cast16 {\n\t\t\t\tfcast17, ok17 := (cast16[k16]).(float64)\n\t\t\t\tif !ok17 {\n\t\t\t\t\terrors.Add(\n\t\t\t\t\t\tstrings.Join(\n\t\t\t\t\t\t\t[]string{\n\t\t\t\t\t\t\t\tref, \"optional_map\", k16},\n\t\t\t\t\t\t\t\"/\"),\n\t\t\t\t\t\tfmt.Sprintf(\n\t\t\t\t\t\t\t\"expected a float64, but got: %T\",\n\t\t\t\t\t\t\tcast16[k16]))\n\t\t\t\t} else if fcast17 != math.Trunc(fcast17) {\n\t\t\t\t\terrors.Add(\n\t\t\t\t\t\tstrings.Join(\n\t\t\t\t\t\t\t[]string{\n\t\t\t\t\t\t\t\tref, \"optional_map\", k16},\n\t\t\t\t\t\t\t\"/\"),\n\t\t\t\t\t\tfmt.Sprintf(\n\t\t\t\t\t\t\t\"expected a whole number, but got: %f\",\n\t\t\t\t\t\t\tfcast17))\n\t\t\t\t// 9223372036854775808.0 == 2^63 is the first float > MaxInt64.\n\t\t\t\t// -9223372036854775808.0 == -(2^63) is the last float >= MinInt64.\n\t\t\t\t} else if fcast17 >= 9223372036854775808.0 ||\n\t\t\t\t\tfcast17 < -9223372036854775808.0 {\n\n\t\t\t\t\terrors.Add(\n\t\t\t\t\t\tstrings.Join(\n\t\t\t\t\t\t\t[]string{\n\t\t\t\t\t\t\t\tref, \"optional_map\", k16},\n\t\t\t\t\t\t\t\"/\"),\n\t\t\t\t\t\tfmt.Sprintf(\n\t\t\t\t\t\t\t\"expected the value to fit into int64, but got an overflow: %f\",\n\t\t\t\t\t\t\tfcast17))\n\t\t\t\t} else {\n\t\t\t\t\ttarget16[k16] = int64(fcast17)\n\t\t\t\t}\n\n\t\t\t\tif errors.Full() {\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\ttarget.OptionalMap = target16\n\t\t}\n\t}\n\n\tif errors.Full() {\n\t\treturn\n\t}\n\n\t////\n\t// Parse OptionalPath\n\t////\n\n\tvalue18, ok18 := cast[\n\t\t\"optional_path\"]\n\n\tif ok18 {\n\t\tvar target18 string\n\t\tcast19, ok19 := value18.(string)\n\t\tif !ok19 {\n\t\t\terrors.Add(\n\t\t\t\tstrings.Join(\n\t\t\t\t\t[]string{\n\t\t\t\t\t\tref, \"optional_path\"},\n\t\t\t\t\t\"/\"),\n\t\t\t\tfmt.Sprintf(\n\t\t\t\t\t\"expected a string, but got: %T\",\n\t\t\t\t\tvalue18))\n\t\t} else {\n\t\t\ttarget18 = cast19\n\t\t}\n\n\t\ttarget.OptionalPath = &target18\n\t}\n\n\tif errors.Full() {\n\t\treturn\n\t}\n\n\t////\n\t// Parse OptionalString\n\t////\n\n\tvalue20, ok20 := cast[\n\t\t\"optional_string\"]\n\n\tif ok20 {\n\t\tvar target20 string\n\t\tcast21, ok21 := value20.(string)\n\t\tif !ok21 {\n\t\t\terrors.Add(\n\t\t\t\tstrings.Join(\n\t\t\t\t\t[]string{\n\t\t\t\t\t\tref, \"optional_string\"},\n\t\t\t\t\t\"/\"),\n\t\t\t\tfmt.Sprintf(\n\t\t\t\t\t\"expected a string, but got: %T\",\n\t\t\t\t\tvalue20))\n\t\t} else {\n\t\t\ttarget20 = cast21\n\t\t}\n\n\t\ttarget.OptionalString = &target20\n\t}\n\n\tif errors.Full() {\n\t\treturn\n\t}\n\n\t////\n\t// Parse OptionalTime\n\t////\n\n\tvalue22, ok22 := cast[\n\t\t\"optional_time\"]\n\n\tif ok22 {\n\t\tvar target22 time.Time\n\t\tcast23, ok23 := value22.(string)\n\t\tif !ok23 {\n\t\t\terrors.Add(\n\t\t\t\tstrings.Join(\n\t\t\t\t\t[]string{\n\t\t\t\t\t\tref, \"optional_time\"},\n\t\t\t\t\t\"/\"),\n\t\t\t\tfmt.Sprintf(\n\t\t\t\t\t\"expected a string, but got: %T\",\n\t\t\t\t\tvalue22))\n\t\t} else {\n\t\t\ttarget23, err23 := time.Parse(\n\t\t\t\t\"15:04:05\",\n\t\t\t\tcast23)\n\t\t\tif err23 != nil {\n\t\t\t\terrors.Add(\n\t\t\t\t\tstrings.Join(\n\t\t\t\t\t\t[]string{\n\t\t\t\t\t\t\tref, \"optional_time\"},\n\t\t\t\t\t\t\"/\"),\n\t\t\t\t\tfmt.Sprintf(\n\t\t\t\t\t\t\"expected layout 15:04:05, got: %s\",\n\t\t\t\t\t\tcast23))\n\t\t\t} else {\n\t\t\t\ttarget22 = target23\n\t\t\t}\n\t\t}\n\n\t\ttarget.OptionalTime = &target22\n\t}\n\n\tif errors.Full() {\n\t\treturn\n\t}\n\n\t////\n\t// Parse OptionalTimeZone\n\t////\n\n\tvalue24, ok24 := cast[\n\t\t\"optional_time_zone\"]\n\n\tif ok24 {\n\t\tcast25, ok25 := value24.(string)\n\t\tif !ok25 {\n\t\t\terrors.Add(\n\t\t\t\tstrings.Join(\n\t\t\t\t\t[]string{\n\t\t\t\t\t\tref, \"optional_time_zone\"},\n\t\t\t\t\t\"/\"),\n\t\t\t\tfmt.Sprintf(\n\t\t\t\t\t\"expected a string, but got: %T\",\n\t\t\t\t\tvalue24))\n\t\t} else {\n\t\t\ttarget25, err25 := time.LoadLocation(cast25)\n\t\t\tif err25 != nil {\n\t\t\t\terrors.Add(\n\t\t\t\t\tstrings.Join(\n\t\t\t\t\t\t[]string{\n\t\t\t\t\t\t\tref, \"optional_time_zone\"},\n\t\t\t\t\t\t\"/\"),\n\t\t\t\t\tfmt.Sprintf(\n\t\t\t\t\t\t\"failed to load location from %#v: %s\",\n\t\t\t\t\t\tcast25,\n\t\t\t\t\t\terr25.Error()))\n\t\t\t} else {\n\t\t\t\ttarget.OptionalTimeZone = target25\n\t\t\t}\n\t\t}\n\t}\n\n\tif errors.Full() {\n\t\treturn\n\t}\n\n\t////\n\t// Parse OptionalReference\n\t////\n\n\tvalue26, ok26 := cast[\n\t\t\"optional_reference\"]\n\n\tif ok26 {\n\t\tcast27, ok27 := value26.(string)\n\t\tif !ok27 {\n\t\t\terrors.Add(\n\t\t\t\tstrings.Join(\n\t\t\t\t\t[]string{\n\t\t\t\t\t\tref, \"optional_reference\"},\n\t\t\t\t\t\"/\"),\n\t\t\t\tfmt.Sprintf(\n\t\t\t\t\t\"expected a string, but got: %T\",\n\t\t\t\t\tvalue26))\n\t\t} else {\n\t\t\ttarget27, ok27 := target.Empties[cast27]\n\t\t\tif !ok27 {\n\t\t\t\terrors.Add(\n\t\t\t\t\tstrings.Join(\n\t\t\t\t\t\t[]string{\n\t\t\t\t\t\t\tref, \"optional_reference\"},\n\t\t\t\t\t\t\"/\"),\n\t\t\t\t\tfmt.Sprintf(\n\t\t\t\t\t\t\"reference to an instance of class Empty not found: %s\",\n\t\t\t\t\t\tvalue26))\n\t\t\t} else {\n\t\t\t\ttarget.OptionalReference = target27\n\t\t\t}\n\t\t}\n\t}\n\n\tif errors.Full() {\n\t\treturn\n\t}\n\n\t////\n\t// Parse OptionalEmbed\n\t////\n\n\tvalue28, ok28 := cast[\n\t\t\"optional_embed\"]\n\n\tif ok28 {\n\t\tvar target28 SomeEmbed\n\t\tSomeEmbedFromJSONable(\n\t\t\tvalue28,\n\t\t\tstrings.Join(\n\t\t\t\t[]string{\n\t\t\t\t\tref, \"optional_embed\"},\n\t\t\t\t\"/\"),\n\t\t\t&(target28),\n\t\t\terrors)\n\n\t\ttarget.OptionalEmbed = &target28\n\t}\n\n\tif errors.Full() {\n\t\treturn\n\t}\n\n\treturn\n}", "func (p RekognitionPlugin) GraphDefinition() map[string]mp.Graphs {\n\treturn graphdef\n}", "func toJsGraph(g *gen.Graph) jsGraph {\n\tgraph := jsGraph{}\n\tfor _, n := range g.Nodes {\n\t\tnode := jsNode{ID: n.Name}\n\t\tfor _, f := range n.Fields {\n\t\t\tnode.Fields = append(node.Fields, jsField{\n\t\t\t\tName: f.Name,\n\t\t\t\tType: f.Type.String(),\n\t\t\t})\n\t\t}\n\t\tgraph.Nodes = append(graph.Nodes, node)\n\t\tfor _, e := range n.Edges {\n\t\t\tif e.IsInverse() {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tgraph.Edges = append(graph.Edges, jsEdge{\n\t\t\t\tFrom: n.Name,\n\t\t\t\tTo: e.Type.Name,\n\t\t\t\tLabel: e.Name,\n\t\t\t})\n\t\t}\n\n\t}\n\treturn graph\n}", "func (em edgeMap) set(from, to *Vertex) {\n\t// This can take O(seconds), so let's do it outside the lock.\n\tnumUsages := astParser.ModuleUsagesForModule(from.Label, to.Label)\n\n\temMu.Lock()\n\tdefer emMu.Unlock()\n\tif em == nil {\n\t\tem = make(edgeMap)\n\t}\n\tif _, ok := em[from.Label]; !ok {\n\t\tem[from.Label] = make(map[string]*edge)\n\t}\n\tem[from.Label][to.Label] = &edge{From: from, To: to, NumUsages: numUsages}\n}", "func (g Undirect) Node(id int64) Node { return g.G.Node(id) }", "func (address Address) IsNode() {}", "func IsGraph(b byte) bool { return lookup[b]&graphMask != 0 }", "func (g Undirect) Nodes() Nodes { return g.G.Nodes() }", "func (n *Node) Opt() interface{}", "func (c *Context) Graph(typ GraphType, opts *ContextGraphOpts) (*Graph, error) {\n\tif opts == nil {\n\t\topts = &ContextGraphOpts{Validate: true}\n\t}\n\n\tlog.Printf(\"[INFO] terraform: building graph: %s\", typ)\n\tswitch typ {\n\tcase GraphTypeApply:\n\t\treturn (&ApplyGraphBuilder{\n\t\t\tModule: c.module,\n\t\t\tDiff: c.diff,\n\t\t\tState: c.state,\n\t\t\tProviders: c.components.ResourceProviders(),\n\t\t\tProvisioners: c.components.ResourceProvisioners(),\n\t\t\tTargets: c.targets,\n\t\t\tDestroy: c.destroy,\n\t\t\tValidate: opts.Validate,\n\t\t}).Build(RootModulePath)\n\n\tcase GraphTypeInput:\n\t\t// The input graph is just a slightly modified plan graph\n\t\tfallthrough\n\tcase GraphTypeValidate:\n\t\t// The validate graph is just a slightly modified plan graph\n\t\tfallthrough\n\tcase GraphTypePlan:\n\t\t// Create the plan graph builder\n\t\tp := &PlanGraphBuilder{\n\t\t\tModule: c.module,\n\t\t\tState: c.state,\n\t\t\tProviders: c.components.ResourceProviders(),\n\t\t\tTargets: c.targets,\n\t\t\tValidate: opts.Validate,\n\t\t}\n\n\t\t// Some special cases for other graph types shared with plan currently\n\t\tvar b GraphBuilder = p\n\t\tswitch typ {\n\t\tcase GraphTypeInput:\n\t\t\tb = InputGraphBuilder(p)\n\t\tcase GraphTypeValidate:\n\t\t\t// We need to set the provisioners so those can be validated\n\t\t\tp.Provisioners = c.components.ResourceProvisioners()\n\n\t\t\tb = ValidateGraphBuilder(p)\n\t\t}\n\n\t\treturn b.Build(RootModulePath)\n\n\tcase GraphTypePlanDestroy:\n\t\treturn (&DestroyPlanGraphBuilder{\n\t\t\tModule: c.module,\n\t\t\tState: c.state,\n\t\t\tTargets: c.targets,\n\t\t\tValidate: opts.Validate,\n\t\t}).Build(RootModulePath)\n\n\tcase GraphTypeRefresh:\n\t\treturn (&RefreshGraphBuilder{\n\t\t\tModule: c.module,\n\t\t\tState: c.state,\n\t\t\tProviders: c.components.ResourceProviders(),\n\t\t\tTargets: c.targets,\n\t\t\tValidate: opts.Validate,\n\t\t}).Build(RootModulePath)\n\t}\n\n\treturn nil, fmt.Errorf(\"unknown graph type: %s\", typ)\n}", "func (list DoublyLinkedList) GetGraphviz() string {\n\tvar text string\n\n\tvar letter string\n\n\ttext += \"\\trankdir = \\\"TB\\\"\\n\"\n\tletter = string(list.head.data.Name[0])\n\n\tvar tempNode1 *Node\n\tvar tempNode2 *Node\n\ti := 0\n\tfor i < list.lenght-1 || i == 0 {\n\n\t\tif list.lenght == 1 {\n\t\t\ttempNode1 := list.GetLastNode()\n\t\t\tnodeName := letter + fmt.Sprint(tempNode1.data.Rating) + fmt.Sprint(i+1) + strings.ReplaceAll(tempNode1.data.Name, \" \", \"\")\n\n\t\t\ttext += \"\\tnode [ shape= rect label=\\\"\" + tempNode1.data.Name + \"\\\" ] \" + nodeName + \";\\n\"\n\t\t} else {\n\t\t\ttempNode1, _ = list.GetNodeAt(i)\n\t\t\ttempNode2 = tempNode1.next\n\t\t\tnodeName := letter + fmt.Sprint(tempNode1.data.Rating) + fmt.Sprint(i) + strings.ReplaceAll(tempNode1.data.Name, \" \", \"\")\n\t\t\tnodeName2 := letter + fmt.Sprint(tempNode2.data.Rating) + fmt.Sprint(i+1) + strings.ReplaceAll(tempNode1.data.Name, \" \", \"\")\n\t\t\ttext += \"\\tnode [ shape= rect label=\\\"\" + tempNode1.data.Name + \"\\\" ] \" + nodeName + \";\\n\"\n\t\t\ttext += \"\\tnode [ shape= rect label=\\\"\" + tempNode2.data.Name + \"\\\" ] \" + nodeName2 + \";\\n\"\n\t\t\ttext += \"\\t\" + nodeName + \" -> \" + nodeName2 + \";\\n\"\n\t\t\ttext += \"\\t\" + nodeName2 + \" -> \" + nodeName + \";\\n\"\n\t\t}\n\n\t\ti++\n\t}\n\n\treturn text\n}", "func ofParse(a string) *Network {\n\tlines := strings.Split(a, \"\\n\")\n\n\tlinks := make(map[int]map[int]float64)\n\tlayers := make([][]int, 1)\n\tlayers[0] = make([]int, 0)\n\tfunction := make(map[int]string)\n\tcurrentLayer := 0\n\n\ttracker := -1\n\n\tfor _, line := range lines {\n\n\t\tif len(line) == 0 {\n\t\t\tcontinue\n\t\t}\n\n\t\tif len(line) > 0 && string(line[0]) == \"#\" {\n\t\t\tcontinue\n\t\t}\n\n\t\tif len(line) >= 2 && line[:2] == \"->\" {\n\t\t\tdat := strings.Split(line[2:], \" \")\n\t\t\tnumba, err := strconv.Atoi(dat[0])\n\t\t\tfunctionID := dat[1]\n\t\t\tif err != nil {\n\t\t\t\tpanic(\"TROUBLE PARSING NODE ID\")\n\t\t\t}\n\t\t\tfunction[numba] = functionID\n\n\t\t\tif numba < tracker {\n\t\t\t\tcurrentLayer++\n\t\t\t\tlayers = append(layers, make([]int, 0))\n\t\t\t}\n\t\t\ttracker = numba\n\n\t\t\tlayers[currentLayer] = append(layers[currentLayer], numba)\n\t\t} else { //Line is assumed to be links\n\t\t\tsource := layers[currentLayer][len(layers[currentLayer])-1]\n\t\t\tlList := strings.Split(line, \"\\t\")\n\t\t\tlinks[source] = make(map[int]float64)\n\t\t\tfor _, item := range lList {\n\t\t\t\tif len(item) == 0 {\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t\titem = strings.Replace(item, \":\", \"=\", -1)\n\t\t\t\tdatums := strings.Split(item, \"=\")\n\t\t\t\tfrom, err0 := strconv.Atoi(datums[0])\n\t\t\t\tto, err1 := strconv.Atoi(datums[1])\n\t\t\t\tweight, err2 := strconv.ParseFloat(datums[2], 64)\n\t\t\t\tif from != source {\n\t\t\t\t\tpanic(\"weight / link mismatch\")\n\t\t\t\t}\n\t\t\t\tif err0 != nil || err1 != nil || err2 != nil {\n\t\t\t\t\tpanic(\"error converting from string\")\n\t\t\t\t}\n\t\t\t\tlinks[from][to] = weight\n\t\t\t}\n\n\t\t}\n\t}\n\n\t// fmt.Println(layers, links, function)\n\n\treverseLookup := make(map[int]*node)\n\n\tnet := new(Network)\n\n\tnet.inputNodes = make([]*node, len(layers[0]))\n\tfor i := range net.inputNodes {\n\t\tnode := new(node)\n\t\tid := layers[0][i]\n\t\tnode.activation = byID(function[id])\n\t\tnode.activationD = byIDD(function[id])\n\t\t// node.delta = float64(id)\n\t\treverseLookup[layers[0][i]] = node\n\t\tnet.inputNodes[i] = node\n\t}\n\n\tnet.hiddenNodes = make([][]*node, 0)\n\tfor hid := 1; hid <= len(layers)-2; hid++ {\n\t\tlayer := make([]*node, len(layers[hid]))\n\t\tfor i := 0; i < len(layer); i++ {\n\t\t\tnode := new(node)\n\t\t\tid := layers[hid][i]\n\t\t\tnode.activation = byID(function[id])\n\t\t\tnode.activationD = byIDD(function[id])\n\t\t\t// node.delta = float64(id)\n\t\t\treverseLookup[layers[hid][i]] = node\n\t\t\tlayer[i] = node\n\t\t}\n\t\tnet.hiddenNodes = append(net.hiddenNodes, layer)\n\t}\n\n\tlastPl := len(layers) - 1\n\n\tnet.outputNodes = make([]*node, len(layers[lastPl]))\n\tfor i := range net.outputNodes {\n\t\tnode := new(node)\n\t\tid := layers[lastPl][i]\n\t\tnode.activation = byID(function[id])\n\t\tnode.activationD = byIDD(function[id])\n\t\t// node.delta = float64(id)\n\t\treverseLookup[layers[lastPl][i]] = node\n\t\tnet.outputNodes[i] = node\n\t}\n\n\tfor from, chart := range links {\n\t\tfor to, weight := range chart {\n\t\t\tfro := reverseLookup[from]\n\t\t\tot := reverseLookup[to]\n\t\t\tfro.forward = append(fro.forward, ot)\n\t\t\tfro.weights = append(fro.weights, weight)\n\t\t}\n\t}\n\n\treturn net\n\n}", "func main() {\n\tg, nodesMap := graphLineByLine()\n\n\tstart := nodesMap[\"shiny gold\"]\n\tcount := 0\n\tgraph.BFS(g, start, func(v, w int, _ int64) {\n\t\t//fmt.Println(v, \"to\", w)\n\t\tcount++\n\n\t})\n\n\tfmt.Println(count)\n}", "func CreateGraphNodeAndRelationships(m map[string]interface{}, id string) error {\n\n\t// Connect to the graph database server from remote\n\tdb, err := neoism.Connect(\"http://54.187.83.59:7474/db/data\")\n\tif err != nil {\n\t\treturn err\n\t}\n\t// Create a node with a Cypher query\n\tres0 := []struct {\n\t\tN neoism.Node // Column \"n\" gets automagically unmarshalled into field N\n\t}{}\n\tcq0 := neoism.CypherQuery{\n\t\tStatement: \"CREATE (n:LearningObject {tile: {tile},_id: {_id}}) RETURN n\",\n\t\t// Use parameters instead of constructing a query string\n\t\tParameters: neoism.Props{\"tile\": m[\"title\"], \"_id\": id},\n\t\tResult: &res0,\n\t}\n\tdb.Cypher(&cq0)\n\tn1 := res0[0].N // Only one row of data returned\n\tn1.Db = db // Must manually set Db with objects returned from Cypher query\n\t//\n\t// Create a relationship\n\tprerequisites := m[\"prerequisites\"].([]interface{})\n\n\t// Create relationship if has\n\tres := []struct {\n\t\tN neoism.Node // Column \"n\" gets automagically unmarshalled into field N\n\t}{}\n\tfor _, id := range prerequisites {\n\t\tcq := neoism.CypherQuery{\n\t\t\tStatement: `MATCH (n {_id:{_id}}) RETURN n`,\n\t\t\tParameters: neoism.Props{\"_id\": id},\n\t\t\tResult: &res,\n\t\t}\n\t\tdb.Cypher(&cq)\n\t\tfmt.Println(id)\n\t\tif len(res) != 0 {\n\t\t\tn2 := res[0].N\n\t\t\tn2.Db = db\n\t\t\t// Create relationship\n\t\t\tn2.Relate(\"prerequisite for\", n1.Id(), neoism.Props{}) // Empty Props{} is okay\n\t\t}\n\t}\n\n\treturn nil\n}", "func createNewNodeNetworkObject(writer *bufio.Writer, sourceOsmNode *osm.Node) {\n\ttags := sourceOsmNode.TagMap()\n\n\t// Punktnetzwerk 'Fahrrad'\n\tnewOsmNode := *sourceOsmNode // copy content (don't modify origin/source node)\n\tnewOsmNode.ID = 0\n\tnewOsmNode.Tags = []osm.Tag{} // remove all source tags\n\trefValue, found := tags[\"icn_ref\"]\n\tif found {\n\t\ttag := osm.Tag{Key: \"node_network\", Value: \"node_bicycle\"}\n\t\tnewOsmNode.Tags = append(newOsmNode.Tags, tag)\n\t\ttag = osm.Tag{Key: \"name\", Value: refValue}\n\t\tnewOsmNode.Tags = append(newOsmNode.Tags, tag)\n\t\twriteNewNodeObject(writer, &newOsmNode)\n\t} else {\n\t\trefValue, found = tags[\"ncn_ref\"]\n\t\tif found {\n\t\t\ttag := osm.Tag{Key: \"node_network\", Value: \"node_bicycle\"}\n\t\t\tnewOsmNode.Tags = append(newOsmNode.Tags, tag)\n\t\t\ttag = osm.Tag{Key: \"name\", Value: refValue}\n\t\t\tnewOsmNode.Tags = append(newOsmNode.Tags, tag)\n\t\t\twriteNewNodeObject(writer, &newOsmNode)\n\t\t} else {\n\t\t\trefValue, found = tags[\"rcn_ref\"]\n\t\t\tif found {\n\t\t\t\ttag := osm.Tag{Key: \"node_network\", Value: \"node_bicycle\"}\n\t\t\t\tnewOsmNode.Tags = append(newOsmNode.Tags, tag)\n\t\t\t\ttag = osm.Tag{Key: \"name\", Value: refValue}\n\t\t\t\tnewOsmNode.Tags = append(newOsmNode.Tags, tag)\n\t\t\t\twriteNewNodeObject(writer, &newOsmNode)\n\t\t\t} else {\n\t\t\t\trefValue, found = tags[\"lcn_ref\"]\n\t\t\t\tif found {\n\t\t\t\t\ttag := osm.Tag{Key: \"node_network\", Value: \"node_bicycle\"}\n\t\t\t\t\tnewOsmNode.Tags = append(newOsmNode.Tags, tag)\n\t\t\t\t\ttag = osm.Tag{Key: \"name\", Value: refValue}\n\t\t\t\t\tnewOsmNode.Tags = append(newOsmNode.Tags, tag)\n\t\t\t\t\twriteNewNodeObject(writer, &newOsmNode)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\t// Punktnetzwerk 'Wandern'\n\tnewOsmNode = *sourceOsmNode // copy content (don't modify origin/source node)\n\tnewOsmNode.ID = 0\n\tnewOsmNode.Tags = []osm.Tag{} // remove all source tags\n\trefValue, found = tags[\"iwn_ref\"]\n\tif found {\n\t\ttag := osm.Tag{Key: \"node_network\", Value: \"node_hiking\"}\n\t\tnewOsmNode.Tags = append(newOsmNode.Tags, tag)\n\t\ttag = osm.Tag{Key: \"name\", Value: refValue}\n\t\tnewOsmNode.Tags = append(newOsmNode.Tags, tag)\n\t\twriteNewNodeObject(writer, &newOsmNode)\n\t} else {\n\t\trefValue, found = tags[\"nwn_ref\"]\n\t\tif found {\n\t\t\ttag := osm.Tag{Key: \"node_network\", Value: \"node_hiking\"}\n\t\t\tnewOsmNode.Tags = append(newOsmNode.Tags, tag)\n\t\t\ttag = osm.Tag{Key: \"name\", Value: refValue}\n\t\t\tnewOsmNode.Tags = append(newOsmNode.Tags, tag)\n\t\t\twriteNewNodeObject(writer, &newOsmNode)\n\t\t} else {\n\t\t\trefValue, found = tags[\"rwn_ref\"]\n\t\t\tif found {\n\t\t\t\ttag := osm.Tag{Key: \"node_network\", Value: \"node_hiking\"}\n\t\t\t\tnewOsmNode.Tags = append(newOsmNode.Tags, tag)\n\t\t\t\ttag = osm.Tag{Key: \"name\", Value: refValue}\n\t\t\t\tnewOsmNode.Tags = append(newOsmNode.Tags, tag)\n\t\t\t\twriteNewNodeObject(writer, &newOsmNode)\n\t\t\t} else {\n\t\t\t\trefValue, found = tags[\"lwn_ref\"]\n\t\t\t\tif found {\n\t\t\t\t\ttag := osm.Tag{Key: \"node_network\", Value: \"node_hiking\"}\n\t\t\t\t\tnewOsmNode.Tags = append(newOsmNode.Tags, tag)\n\t\t\t\t\ttag = osm.Tag{Key: \"name\", Value: refValue}\n\t\t\t\t\tnewOsmNode.Tags = append(newOsmNode.Tags, tag)\n\t\t\t\t\twriteNewNodeObject(writer, &newOsmNode)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\t// Punktnetzwerk 'Inline-Skaten'\n\tnewOsmNode = *sourceOsmNode // copy content (don't modify origin/source node)\n\tnewOsmNode.ID = 0\n\tnewOsmNode.Tags = []osm.Tag{} // remove all source tags\n\trefValue, found = tags[\"rin_ref\"]\n\tif found {\n\t\ttag := osm.Tag{Key: \"node_network\", Value: \"node_inline_skates\"}\n\t\tnewOsmNode.Tags = append(newOsmNode.Tags, tag)\n\t\ttag = osm.Tag{Key: \"name\", Value: refValue}\n\t\tnewOsmNode.Tags = append(newOsmNode.Tags, tag)\n\t\twriteNewNodeObject(writer, &newOsmNode)\n\t}\n\n\t// Punktnetzwerk 'Reiten'\n\tnewOsmNode = *sourceOsmNode // copy content (don't modify origin/source node)\n\tnewOsmNode.ID = 0\n\tnewOsmNode.Tags = []osm.Tag{} // remove all source tags\n\trefValue, found = tags[\"rhn_ref\"]\n\tif found {\n\t\ttag := osm.Tag{Key: \"node_network\", Value: \"node_horse\"}\n\t\tnewOsmNode.Tags = append(newOsmNode.Tags, tag)\n\t\ttag = osm.Tag{Key: \"name\", Value: refValue}\n\t\tnewOsmNode.Tags = append(newOsmNode.Tags, tag)\n\t\twriteNewNodeObject(writer, &newOsmNode)\n\t}\n\n\t// Punktnetzwerk 'Kanu'\n\tnewOsmNode = *sourceOsmNode // copy content (don't modify origin/source node)\n\tnewOsmNode.ID = 0\n\tnewOsmNode.Tags = []osm.Tag{} // remove all source tags\n\trefValue, found = tags[\"rpn_ref\"]\n\tif found {\n\t\ttag := osm.Tag{Key: \"node_network\", Value: \"node_canoe\"}\n\t\tnewOsmNode.Tags = append(newOsmNode.Tags, tag)\n\t\ttag = osm.Tag{Key: \"name\", Value: refValue}\n\t\tnewOsmNode.Tags = append(newOsmNode.Tags, tag)\n\t\twriteNewNodeObject(writer, &newOsmNode)\n\t}\n\n\t// Punktnetzwerk 'Motorboot'\n\tnewOsmNode = *sourceOsmNode // copy content (don't modify origin/source node)\n\tnewOsmNode.ID = 0\n\tnewOsmNode.Tags = []osm.Tag{} // remove all source tags\n\trefValue, found = tags[\"rmn_ref\"]\n\tif found {\n\t\ttag := osm.Tag{Key: \"node_network\", Value: \"node_motorboat\"}\n\t\tnewOsmNode.Tags = append(newOsmNode.Tags, tag)\n\t\ttag = osm.Tag{Key: \"name\", Value: refValue}\n\t\tnewOsmNode.Tags = append(newOsmNode.Tags, tag)\n\t\twriteNewNodeObject(writer, &newOsmNode)\n\t}\n}", "func (g *Graph) get(key string) *Node {\n\treturn g.nodes[key]\n}", "func Igen(n *Node, a *Node, res *Node)", "func expandgraph(g *Graph) error {\n\n\tnewedges := make(map[Edge]bool)\n\n\tfor e := range g.edges {\n\t\tfrom := e.from\n\t\tto := e.to\n\n\t\tv1, err := g.addVertex()\n\t\tif err != nil {\n\t\t\tlog.Fatal(err)\n\t\t}\n\t\tv2, err := g.addVertex()\n\t\tif err != nil {\n\t\t\tlog.Fatal(err)\n\t\t}\n\n\t\te1 := Edge{\n\t\t\tfrom: from,\n\t\t\tto: v1,\n\t\t}\n\t\te2 := Edge{\n\t\t\tfrom: v1,\n\t\t\tto: v2,\n\t\t}\n\t\te3 := Edge{\n\t\t\tfrom: v2,\n\t\t\tto: to,\n\t\t}\n\n\t\tnewedges[e1] = true\n\t\tnewedges[e2] = true\n\t\tnewedges[e3] = true\n\n\t\terr = g.removeEdge(e)\n\t\tif err != nil {\n\t\t\tlog.Fatal(err)\n\t\t}\n\n\t}\n\n\tg.edges = newedges\n\n\treturn nil\n}", "func newGraph() *graph {\n\treturn &graph{Schedules: make(map[string][]edge)}\n}", "func newEdge(logger *zap.Logger, meter *metrics.Scope, metricTagsBlocklist []string, req *transport.Request, direction string, rpcType transport.Type) *edge {\n\ttags := metrics.Tags{\n\t\t\"source\": req.Caller,\n\t\t\"dest\": req.Service,\n\t\t\"transport\": unknownIfEmpty(req.Transport),\n\t\t\"procedure\": req.Procedure,\n\t\t\"encoding\": string(req.Encoding),\n\t\t\"routing_key\": req.RoutingKey,\n\t\t\"routing_delegate\": req.RoutingDelegate,\n\t\t\"direction\": direction,\n\t\t\"rpc_type\": rpcType.String(),\n\t}\n\n\tfor _, tagName := range metricTagsBlocklist {\n\t\ttags[tagName] = _droppedTagValue\n\t}\n\n\t// metrics for all RPCs\n\tcalls, err := meter.Counter(metrics.Spec{\n\t\tName: \"calls\",\n\t\tHelp: \"Total number of RPCs.\",\n\t\tConstTags: tags,\n\t})\n\tif err != nil {\n\t\tlogger.Error(\"Failed to create calls counter.\", zap.Error(err))\n\t}\n\tsuccesses, err := meter.Counter(metrics.Spec{\n\t\tName: \"successes\",\n\t\tHelp: \"Number of successful RPCs.\",\n\t\tConstTags: tags,\n\t})\n\tif err != nil {\n\t\tlogger.Error(\"Failed to create successes counter.\", zap.Error(err))\n\t}\n\tpanics, err := meter.Counter(metrics.Spec{\n\t\tName: \"panics\",\n\t\tHelp: \"Number of RPCs failed because of panic.\",\n\t\tConstTags: tags,\n\t})\n\tif err != nil {\n\t\tlogger.Error(\"Failed to create panics counter.\", zap.Error(err))\n\t}\n\tcallerFailures, err := meter.CounterVector(metrics.Spec{\n\t\tName: \"caller_failures\",\n\t\tHelp: \"Number of RPCs failed because of caller error.\",\n\t\tConstTags: tags,\n\t\tVarTags: []string{_error, _errorNameMetricsKey},\n\t})\n\tif err != nil {\n\t\tlogger.Error(\"Failed to create caller failures vector.\", zap.Error(err))\n\t}\n\tserverFailures, err := meter.CounterVector(metrics.Spec{\n\t\tName: \"server_failures\",\n\t\tHelp: \"Number of RPCs failed because of server error.\",\n\t\tConstTags: tags,\n\t\tVarTags: []string{_error, _errorNameMetricsKey},\n\t})\n\tif err != nil {\n\t\tlogger.Error(\"Failed to create server failures vector.\", zap.Error(err))\n\t}\n\n\t// metrics for only unary and oneway\n\tvar latencies, callerErrLatencies, serverErrLatencies, ttls, timeoutTtls,\n\t\trequestPayloadSizes, responsePayloadSizes *metrics.Histogram\n\tif rpcType == transport.Unary || rpcType == transport.Oneway {\n\t\tlatencies, err = meter.Histogram(metrics.HistogramSpec{\n\t\t\tSpec: metrics.Spec{\n\t\t\t\tName: \"success_latency_ms\",\n\t\t\t\tHelp: \"Latency distribution of successful RPCs.\",\n\t\t\t\tConstTags: tags,\n\t\t\t},\n\t\t\tUnit: time.Millisecond,\n\t\t\tBuckets: _bucketsMs,\n\t\t})\n\t\tif err != nil {\n\t\t\tlogger.Error(\"Failed to create success latency distribution.\", zap.Error(err))\n\t\t}\n\t\tcallerErrLatencies, err = meter.Histogram(metrics.HistogramSpec{\n\t\t\tSpec: metrics.Spec{\n\t\t\t\tName: \"caller_failure_latency_ms\",\n\t\t\t\tHelp: \"Latency distribution of RPCs failed because of caller error.\",\n\t\t\t\tConstTags: tags,\n\t\t\t},\n\t\t\tUnit: time.Millisecond,\n\t\t\tBuckets: _bucketsMs,\n\t\t})\n\t\tif err != nil {\n\t\t\tlogger.Error(\"Failed to create caller failure latency distribution.\", zap.Error(err))\n\t\t}\n\t\tserverErrLatencies, err = meter.Histogram(metrics.HistogramSpec{\n\t\t\tSpec: metrics.Spec{\n\t\t\t\tName: \"server_failure_latency_ms\",\n\t\t\t\tHelp: \"Latency distribution of RPCs failed because of server error.\",\n\t\t\t\tConstTags: tags,\n\t\t\t},\n\t\t\tUnit: time.Millisecond,\n\t\t\tBuckets: _bucketsMs,\n\t\t})\n\t\tif err != nil {\n\t\t\tlogger.Error(\"Failed to create server failure latency distribution.\", zap.Error(err))\n\t\t}\n\t\tttls, err = meter.Histogram(metrics.HistogramSpec{\n\t\t\tSpec: metrics.Spec{\n\t\t\t\tName: \"ttl_ms\",\n\t\t\t\tHelp: \"TTL distribution of the RPCs passed by the caller\",\n\t\t\t\tConstTags: tags,\n\t\t\t},\n\t\t\tUnit: time.Millisecond,\n\t\t\tBuckets: _bucketsMs,\n\t\t})\n\t\tif err != nil {\n\t\t\tlogger.Error(\"Failed to create ttl distribution.\", zap.Error(err))\n\t\t}\n\t\ttimeoutTtls, err = meter.Histogram(metrics.HistogramSpec{\n\t\t\tSpec: metrics.Spec{\n\t\t\t\tName: \"timeout_ttl_ms\",\n\t\t\t\tHelp: \"TTL distribution of the RPCs passed by caller which failed due to timeout\",\n\t\t\t\tConstTags: tags,\n\t\t\t},\n\t\t\tUnit: time.Millisecond,\n\t\t\tBuckets: _bucketsMs,\n\t\t})\n\t\tif err != nil {\n\t\t\tlogger.Error(\"Failed to create timeout ttl distribution.\", zap.Error(err))\n\t\t}\n\t\trequestPayloadSizes, err = meter.Histogram(metrics.HistogramSpec{\n\t\t\tSpec: metrics.Spec{\n\t\t\t\tName: \"request_payload_size_bytes\",\n\t\t\t\tHelp: \"Request payload size distribution of the RPCs in bytes\",\n\t\t\t\tConstTags: tags,\n\t\t\t},\n\t\t\tUnit: time.Millisecond, // Unit is relevent for this histogram\n\t\t\tBuckets: _bucketsBytes,\n\t\t})\n\t\tif err != nil {\n\t\t\tlogger.Error(\"Failed to create request payload size histogram.\", zap.Error(err))\n\t\t}\n\t\tresponsePayloadSizes, err = meter.Histogram(metrics.HistogramSpec{\n\t\t\tSpec: metrics.Spec{\n\t\t\t\tName: \"response_payload_size_bytes\",\n\t\t\t\tHelp: \"Response payload size distribution of the RPCs in bytes\",\n\t\t\t\tConstTags: tags,\n\t\t\t},\n\t\t\tUnit: time.Millisecond, // Unit is relevent for this histogram\n\t\t\tBuckets: _bucketsBytes,\n\t\t})\n\t\tif err != nil {\n\t\t\tlogger.Error(\"Failed to create response payload size histogram.\", zap.Error(err))\n\t\t}\n\t}\n\n\t// metrics for only streams\n\tvar streaming *streamEdge\n\tif rpcType == transport.Streaming {\n\t\t// sends\n\t\tsends, err := meter.Counter(metrics.Spec{\n\t\t\tName: \"stream_sends\",\n\t\t\tHelp: \"Total number of streaming messages sent.\",\n\t\t\tConstTags: tags,\n\t\t})\n\t\tif err != nil {\n\t\t\tlogger.DPanic(\"Failed to create streaming sends counter.\", zap.Error(err))\n\t\t}\n\t\tsendSuccesses, err := meter.Counter(metrics.Spec{\n\t\t\tName: \"stream_send_successes\",\n\t\t\tHelp: \"Number of successful streaming messages sent.\",\n\t\t\tConstTags: tags,\n\t\t})\n\t\tif err != nil {\n\t\t\tlogger.DPanic(\"Failed to create streaming sends successes counter.\", zap.Error(err))\n\t\t}\n\t\tsendFailures, err := meter.CounterVector(metrics.Spec{\n\t\t\tName: \"stream_send_failures\",\n\t\t\tHelp: \"Number streaming messages that failed to send.\",\n\t\t\tConstTags: tags,\n\t\t\tVarTags: []string{_error},\n\t\t})\n\t\tif err != nil {\n\t\t\tlogger.DPanic(\"Failed to create streaming sends failure counter.\", zap.Error(err))\n\t\t}\n\n\t\t// receives\n\t\treceives, err := meter.Counter(metrics.Spec{\n\t\t\tName: \"stream_receives\",\n\t\t\tHelp: \"Total number of streaming messages recevied.\",\n\t\t\tConstTags: tags,\n\t\t})\n\t\tif err != nil {\n\t\t\tlogger.DPanic(\"Failed to create streaming receives counter.\", zap.Error(err))\n\t\t}\n\t\treceiveSuccesses, err := meter.Counter(metrics.Spec{\n\t\t\tName: \"stream_receive_successes\",\n\t\t\tHelp: \"Number of successful streaming messages received.\",\n\t\t\tConstTags: tags,\n\t\t})\n\t\tif err != nil {\n\t\t\tlogger.DPanic(\"Failed to create streaming receives successes counter.\", zap.Error(err))\n\t\t}\n\t\treceiveFailures, err := meter.CounterVector(metrics.Spec{\n\t\t\tName: \"stream_receive_failures\",\n\t\t\tHelp: \"Number streaming messages failed to be recieved.\",\n\t\t\tConstTags: tags,\n\t\t\tVarTags: []string{_error},\n\t\t})\n\t\tif err != nil {\n\t\t\tlogger.DPanic(\"Failed to create streaming receives failure counter.\", zap.Error(err))\n\t\t}\n\n\t\t// entire stream\n\t\tstreamDurations, err := meter.Histogram(metrics.HistogramSpec{\n\t\t\tSpec: metrics.Spec{\n\t\t\t\tName: \"stream_duration_ms\",\n\t\t\t\tHelp: \"Latency distribution of total stream duration.\",\n\t\t\t\tConstTags: tags,\n\t\t\t},\n\t\t\tUnit: time.Millisecond,\n\t\t\tBuckets: _bucketsMs,\n\t\t})\n\t\tif err != nil {\n\t\t\tlogger.DPanic(\"Failed to create stream duration histogram.\", zap.Error(err))\n\t\t}\n\n\t\tstreamRequestPayloadSizes, err := meter.Histogram(metrics.HistogramSpec{\n\t\t\tSpec: metrics.Spec{\n\t\t\t\tName: \"stream_request_payload_size_bytes\",\n\t\t\t\tHelp: \"Stream request payload size distribution\",\n\t\t\t\tConstTags: tags,\n\t\t\t},\n\t\t\tUnit: time.Millisecond,\n\t\t\tBuckets: _bucketsBytes,\n\t\t})\n\t\tif err != nil {\n\t\t\tlogger.DPanic(\"Failed to create stream request payload size histogram\", zap.Error(err))\n\t\t}\n\n\t\tstreamResponsePayloadSizes, err := meter.Histogram(metrics.HistogramSpec{\n\t\t\tSpec: metrics.Spec{\n\t\t\t\tName: \"stream_response_payload_size_bytes\",\n\t\t\t\tHelp: \"Stream response payload size distribution\",\n\t\t\t\tConstTags: tags,\n\t\t\t},\n\t\t\tUnit: time.Millisecond,\n\t\t\tBuckets: _bucketsBytes,\n\t\t})\n\t\tif err != nil {\n\t\t\tlogger.DPanic(\"Failed to create stream response payload size histogram\", zap.Error(err))\n\t\t}\n\n\t\tstreamsActive, err := meter.Gauge(metrics.Spec{\n\t\t\tName: \"streams_active\",\n\t\t\tHelp: \"Number of active streams.\",\n\t\t\tConstTags: tags,\n\t\t})\n\t\tif err != nil {\n\t\t\tlogger.DPanic(\"Failed to create active stream gauge.\", zap.Error(err))\n\t\t}\n\n\t\tstreaming = &streamEdge{\n\t\t\tsends: sends,\n\t\t\tsendSuccesses: sendSuccesses,\n\t\t\tsendFailures: sendFailures,\n\t\t\treceives: receives,\n\t\t\treceiveSuccesses: receiveSuccesses,\n\t\t\treceiveFailures: receiveFailures,\n\n\t\t\tstreamDurations: streamDurations,\n\t\t\tstreamRequestPayloadSizes: streamRequestPayloadSizes,\n\t\t\tstreamResponsePayloadSizes: streamResponsePayloadSizes,\n\n\t\t\tstreamsActive: streamsActive,\n\t\t}\n\t}\n\n\tlogger = logger.With(\n\t\tzap.String(\"source\", req.Caller),\n\t\tzap.String(\"dest\", req.Service),\n\t\tzap.String(\"transport\", unknownIfEmpty(req.Transport)),\n\t\tzap.String(\"procedure\", req.Procedure),\n\t\tzap.String(\"encoding\", string(req.Encoding)),\n\t\tzap.String(\"routingKey\", req.RoutingKey),\n\t\tzap.String(\"routingDelegate\", req.RoutingDelegate),\n\t\tzap.String(\"direction\", direction),\n\t)\n\treturn &edge{\n\t\tlogger: logger,\n\t\tcalls: calls,\n\t\tsuccesses: successes,\n\t\tpanics: panics,\n\t\tcallerFailures: callerFailures,\n\t\tserverFailures: serverFailures,\n\t\trequestPayloadSizes: requestPayloadSizes,\n\t\tresponsePayloadSizes: responsePayloadSizes,\n\t\tlatencies: latencies,\n\t\tcallerErrLatencies: callerErrLatencies,\n\t\tserverErrLatencies: serverErrLatencies,\n\t\tttls: ttls,\n\t\ttimeoutTtls: timeoutTtls,\n\t\tstreaming: streaming,\n\t}\n}", "func cfi(g *Graph) (Graph, error) {\n\tcfig, err := buildGraph(false)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\t//**make an array with all the Cfi Gadgets**//\n\tvar gadgets map[Vertex]Cfigadget\n\tgadgets = make(map[Vertex]Cfigadget)\n\n\t//number the vertices in the original graphs\n\tvertcount := 1\n\n\t//the current vertcount will be the key for a vertex of the new graph\n\tvar nodekeys map[int]Vertex\n\tnodekeys = make(map[int]Vertex)\n\n\tfor node, value := range g.vertices {\n\t\tif value {\n\t\t\tdeg, err := g.degree(node)\n\t\t\tif err != nil {\n\t\t\t\tlog.Fatal(err)\n\t\t\t}\n\n\t\t\t//Make a new Gadget\n\t\t\tgadget := Cfigadget{\n\t\t\t\touter: make([]Vertex, 2*deg),\n\t\t\t\tinner: make([]Vertex, int(math.Exp2(float64(deg-1)))),\n\t\t\t\tref: &node,\n\t\t\t\tdegree: deg,\n\t\t\t\tedges: make([]Edge, deg*int(math.Exp2(float64(deg-1)))),\n\t\t\t\tneighbours: make([]Vertex, deg),\n\t\t\t}\n\n\t\t\tgadget.neighbours, err = g.neighbourhood(node)\n\n\t\t\t//insert actual vertices into the gadget\n\t\t\tfor ind := range gadget.inner {\n\t\t\t\tgadget.inner[ind] = Vertex{vert: vertcount}\n\t\t\t\tnodekeys[vertcount] = gadget.inner[ind]\n\t\t\t\tvertcount++\n\t\t\t}\n\t\t\tfor ind := range gadget.outer {\n\t\t\t\tgadget.outer[ind] = Vertex{vert: vertcount}\n\t\t\t\tnodekeys[vertcount] = gadget.outer[ind]\n\t\t\t\tvertcount++\n\t\t\t}\n\n\t\t\t//just somewhere to save the number of edges to\n\t\t\tedgecount := 0\n\n\t\t\t//Build the gadget\n\t\t\tmax := int(math.Exp2(float64(deg)))\n\t\t\tinnercount := 0 //tells how many of the inner vertices have been used\n\t\t\tfor i := 0; i < max; i++ {\n\t\t\t\tcur := i\n\n\t\t\t\t//save the calculated bits\n\t\t\t\tvar bits []int\n\t\t\t\tbits = make([]int, deg)\n\n\t\t\t\t//number of 1s in the binary representation of the number\n\t\t\t\tones := 0\n\n\t\t\t\t//calculate binary representation\n\t\t\t\tfor j := 0; j < deg; j++ {\n\t\t\t\t\tif cur&1 == 1 {\n\t\t\t\t\t\tones++\n\t\t\t\t\t\tbits[j] = 1\n\t\t\t\t\t} else {\n\t\t\t\t\t\tbits[j] = 0\n\t\t\t\t\t}\n\t\t\t\t\tcur = cur >> 1\n\t\t\t\t}\n\n\t\t\t\t//with an even number of ones, connect the vertices\n\t\t\t\tif ones%2 == 0 {\n\t\t\t\t\tfor ind := 0; ind < deg; ind++ {\n\t\t\t\t\t\toutbit := ((ind + 1) * 2) / 2 //which of the outer bits is controlled\n\n\t\t\t\t\t\tif bits[outbit-1] == 0 { //connect to b vertices\n\t\t\t\t\t\t\toutvertex := ind*2 + 1\n\t\t\t\t\t\t\tgadget.edges[edgecount] = Edge{\n\t\t\t\t\t\t\t\tfrom: gadget.outer[outvertex],\n\t\t\t\t\t\t\t\tto: gadget.inner[innercount],\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t} else { //connect to a vertices\n\t\t\t\t\t\t\toutvertex := ind * 2\n\t\t\t\t\t\t\tgadget.edges[edgecount] = Edge{\n\t\t\t\t\t\t\t\tfrom: gadget.outer[outvertex],\n\t\t\t\t\t\t\t\tto: gadget.inner[innercount],\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\tedgecount++\n\t\t\t\t\t}\n\t\t\t\t\tinnercount++\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\t//Save it to the map\n\t\t\tgadgets[node] = gadget\n\t\t}\n\t}\n\n\t//**build a graph from the gadgets**//\n\n\t//add inner and outer vertices (the content of nodekeys) to the graph\n\tfor _, v := range nodekeys {\n\t\tcfig.vertices[v] = true\n\t\tcfig.numvert++\n\t}\n\n\t//add the known edges from within the gadgets\n\tfor _, gadget := range gadgets {\n\t\tfor _, e := range gadget.edges {\n\t\t\tcfig.addEdge(e.from, e.to)\n\t\t}\n\t}\n\n\t//connect the gadgets\n\tfor e := range g.edges {\n\t\tedgefrom := e.from\n\t\tedgeto := e.to\n\t\tgadgetfrom := gadgets[edgefrom]\n\t\tgadgetto := gadgets[edgeto]\n\n\t\tneighbournofrom := 0 //number of the to-neighbour in the \"from\" gadget\n\t\tneighbournoto := 0 //number of the from-neighbour in the \"to\" gadget\n\n\t\tfor ind, n := range gadgetfrom.neighbours {\n\t\t\tif n == edgeto {\n\t\t\t\tneighbournofrom = ind\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t\tfor ind, n := range gadgetto.neighbours {\n\t\t\tif n == edgefrom {\n\t\t\t\tneighbournoto = ind\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t\tcfig.addEdge(gadgetfrom.outer[2*neighbournofrom], gadgetto.outer[2*neighbournoto])\n\t\tcfig.addEdge(gadgetfrom.outer[2*neighbournofrom+1], gadgetto.outer[2*neighbournoto+1])\n\t}\n\n\t//cfig.printGraph()\n\treturn cfig, nil\n}", "func printGraph(format string, dependencies map[string]map[string]bool) {\n\tswitch format {\n\tcase formatDigraph:\n\t\tprintDigraph(os.Stdout, dependencies)\n\tcase formatGraphviz:\n\t\tprintGraphviz(os.Stdout, dependencies)\n\t}\n}", "func (bgPtr *baseGraph) GetGraph() *gographviz.Graph {\n\treturn bgPtr.graph\n}", "func (s *BaseGraffleParserListener) EnterGraph_type(ctx *Graph_typeContext) {}", "func add_node( conn Conn ){\n conn.expressed = false\n\n innovation_num := 0\n node := Node{ is_hidden : true }\n conn1 := Conn{ conn.inNode, node, 1, true, innovation_num }\n conn2 := Conn{ node, conn.outNode, conn.weight, true, innovation_num }\n}", "func graphVertexToNode(v graph.Vertex) *node {\n\tif dv, ok := v.(graph.DOTableVertex); ok {\n\t\treturn &node{DOTNode: dv.Node()}\n\t}\n\n\treflectType := reflect.TypeOf(v)\n\tswitch reflectType.Kind() {\n\tcase reflect.Array, reflect.Chan, reflect.Map, reflect.Ptr, reflect.Slice:\n\t\treflectType = reflectType.Elem()\n\t}\n\n\tn := &node{}\n\tn.Header = reflectType.Name()\n\tn.Body = fmt.Sprint(v)\n\n\treturn n\n}", "func (p TreeWriter) graphStructure(nodes []*yaml.RNode) error {\n\tresourceToOwner := map[string]*node{}\n\troot := &node{}\n\t// index each of the nodes by their owner\n\tfor _, n := range nodes {\n\t\townerVal, err := ownerToString(n)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tvar owner *node\n\t\tif ownerVal == \"\" {\n\t\t\t// no owner -- attach to the root\n\t\t\towner = root\n\t\t} else {\n\t\t\t// owner found -- attach to the owner\n\t\t\tvar found bool\n\t\t\towner, found = resourceToOwner[ownerVal]\n\t\t\tif !found {\n\t\t\t\t// initialize the owner if not found\n\t\t\t\tresourceToOwner[ownerVal] = &node{p: p}\n\t\t\t\towner = resourceToOwner[ownerVal]\n\t\t\t}\n\t\t}\n\n\t\tnodeVal, err := nodeToString(n)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tval, found := resourceToOwner[nodeVal]\n\t\tif !found {\n\t\t\t// initialize the node if not found -- may have already been initialized if it\n\t\t\t// is the owner of another node\n\t\t\tresourceToOwner[nodeVal] = &node{p: p}\n\t\t\tval = resourceToOwner[nodeVal]\n\t\t}\n\t\tval.RNode = n\n\t\towner.children = append(owner.children, val)\n\t}\n\n\tfor k, v := range resourceToOwner {\n\t\tif v.RNode == nil {\n\t\t\treturn fmt.Errorf(\n\t\t\t\t\"owner '%s' not found in input, but found as an owner of input objects\", k)\n\t\t}\n\t}\n\n\t// print the tree\n\ttree := treeprint.New()\n\tif err := root.Tree(tree); err != nil {\n\t\treturn err\n\t}\n\n\t_, err := io.WriteString(p.Writer, tree.String())\n\treturn err\n}", "func testTrafficMapIssue2783() map[string]*graph.Node {\n\ttrafficMap := make(map[string]*graph.Node)\n\n\tn0, _ := graph.NewNode(config.DefaultClusterID, \"testNamespace\", \"a\", \"testNamespace\", \"a-v1\", \"a\", \"v1\", graph.GraphTypeVersionedApp)\n\n\tn1, _ := graph.NewNode(config.DefaultClusterID, \"testNamespace\", \"b\", graph.Unknown, graph.Unknown, graph.Unknown, graph.Unknown, graph.GraphTypeVersionedApp)\n\n\tn2, _ := graph.NewNode(config.DefaultClusterID, \"testNamespace\", \"b\", \"testNamespace\", \"b-v1\", \"b\", \"v1\", graph.GraphTypeVersionedApp)\n\n\ttrafficMap[n0.ID] = n0\n\ttrafficMap[n1.ID] = n1\n\ttrafficMap[n2.ID] = n2\n\n\tn0.AddEdge(n1)\n\tn1.AddEdge(n2)\n\n\treturn trafficMap\n}", "func isGraph(spec *engine.Spec) bool {\n\tfor _, step := range spec.Steps {\n\t\tif len(step.DependsOn) > 0 {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "func (g *Graph) HasPath (startS, endS string) (bool) {\n var q Queue\n\n // add start node\n // the biggie is that you can't create this.\n // you have to take it from the graph...\n //fmt.Println(startV)\n q.Add(g.FindVertex(startS))\n //fmt.Println(\">>>\",g.FindVertex(startS))\n\n curV := q.Remove()\n //fmt.Println(curV)\n for ; curV.name != \"\" ; curV = q.Remove() {\n // has this as val before.\n // this was wrong. should be the graph node.\n // and here too...\n if curV.name == endS {\n return true\n } \n for i :=0 ; i<len(curV.children) ; i++ {\n v := g.FindVertex(curV.children[i].name)\n //fmt.Println(\">\", v)\n q.Add(v)\n }\n }\n\n // nothing found...\n return false\n}", "func G() {}", "func (g *Graph) addEdge(node1 int, node2 int) {\n // Check if node1 is already in the graph\n if g.adjList[node1] == nil {\n // Nope. Add it\n g.adjList[node1] = make(set)\n }\n g.adjList[node1][node2] = true\n\n // Check if node2 is already in the graph\n if g.adjList[node2] == nil {\n // Nope. Add it\n g.adjList[node2] = make(set)\n }\n g.adjList[node2][node1] = true\n}", "func setup(f func(int) Grapher, n int) (graph Grapher) {\n\tgraph = f(n)\n\trandom := rand.New(rand.NewSource(time.Now().UnixNano()))\n\tfor count := 0; count < n; {\n\t\ta := random.Intn(n)\n\t\tb := random.Intn(n)\n\t\tif !graph.HasEdge(a, b) {\n\t\t\tgraph.Add(a, b)\n\t\t\tcount++\n\t\t}\n\t}\n\treturn\n}", "func (m *Mongo) Graph(name string) (*Graph, bool) {\n\tm.muGraph.Lock()\n\tdefer m.muGraph.Unlock()\n\tg, ok := m.Graphs[name]\n\tif ok {\n\t\treturn g.Graph, true\n\t}\n\treturn nil, false\n}", "func (fcg *FuncCallGraph) Graph() (*gv.Graph, error) {\n\tg := gv.NewGraph()\n\tif err := g.SetName(\"fcg\"); err != nil {\n\t\treturn nil, err\n\t}\n\tif err := g.SetDir(true); err != nil {\n\t\treturn nil, err\n\t}\n\tfor f := range fcg.callerToCallees {\n\t\tif err := g.AddNode(\"fcg\", f.Handle(), nil); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\tfor caller, callees := range fcg.callerToCallees {\n\t\tfor callee := range callees {\n\t\t\tif err := g.AddEdge(caller.Handle(), callee.Handle(), true, nil); err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t}\n\t}\n\treturn g, nil\n}", "func TestGraphNoDuplicates(t *testing.T) {\n\ta := NewResource(\"a\", nil)\n\tb := NewResource(\"b\", nil, a.URN)\n\tc := NewResource(\"c\", nil, a.URN)\n\td := NewResource(\"d\", nil, b.URN, c.URN)\n\n\tdg := NewDependencyGraph([]*resource.State{\n\t\ta,\n\t\tb,\n\t\tc,\n\t\td,\n\t})\n\n\tassert.Equal(t, []*resource.State{\n\t\tb, c, d,\n\t}, dg.DependingOn(a))\n}", "func GraphPrefix() []byte {\n\treturn graphPrefix\n}", "func (Project) IsNode() {}" ]
[ "0.6205856", "0.5798086", "0.56521183", "0.5516461", "0.55035466", "0.54961205", "0.5452377", "0.54010755", "0.53994185", "0.5397716", "0.5371286", "0.5366891", "0.5349546", "0.52819616", "0.5276783", "0.5263382", "0.5255224", "0.5183256", "0.51771843", "0.5148493", "0.51202786", "0.5099289", "0.5051456", "0.50507647", "0.50445354", "0.50408494", "0.5039697", "0.5030108", "0.49775964", "0.4975105", "0.49543014", "0.49536514", "0.4948715", "0.49460933", "0.4943244", "0.49428132", "0.4939925", "0.49351126", "0.49324122", "0.49191484", "0.49167186", "0.49138594", "0.49053463", "0.4901406", "0.48918772", "0.4889644", "0.48895618", "0.48752668", "0.48712656", "0.48704597", "0.4868308", "0.48652342", "0.4864888", "0.48627338", "0.4856601", "0.48562437", "0.484453", "0.48424545", "0.48402128", "0.48402113", "0.48274285", "0.4826815", "0.4826058", "0.48227802", "0.48207712", "0.48168847", "0.48156342", "0.48116904", "0.4809716", "0.48070392", "0.480567", "0.48055026", "0.47971687", "0.4786358", "0.47838137", "0.4782758", "0.47725812", "0.47715974", "0.47674075", "0.47503284", "0.4743565", "0.474191", "0.47402662", "0.4739758", "0.47280318", "0.47275054", "0.47258815", "0.47219256", "0.47212756", "0.4718934", "0.47150674", "0.47111842", "0.47040427", "0.47011182", "0.4700393", "0.4700079", "0.46916634", "0.46908656", "0.46890196", "0.4684199" ]
0.49112827
42
don't use start and end as variable names... method name should be upper camel case.
func (g *Graph) HasPath (startS, endS string) (bool) { var q Queue // add start node // the biggie is that you can't create this. // you have to take it from the graph... //fmt.Println(startV) q.Add(g.FindVertex(startS)) //fmt.Println(">>>",g.FindVertex(startS)) curV := q.Remove() //fmt.Println(curV) for ; curV.name != "" ; curV = q.Remove() { // has this as val before. // this was wrong. should be the graph node. // and here too... if curV.name == endS { return true } for i :=0 ; i<len(curV.children) ; i++ { v := g.FindVertex(curV.children[i].name) //fmt.Println(">", v) q.Add(v) } } // nothing found... return false }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (s StringInterval) Begin() string {\n\treturn s.Name\n}", "func (m *Method) Method() {\n\n}", "func main() {\n\tword := \"apple\"\n\tprefix := \"app\"\n\tobj := Constructor()\n\tobj.Insert(word)\n\tparam_2 := obj.Search(word)\n\tparam_3 := obj.StartsWith(prefix)\n\tfmt.Println(param_2, param_3)\n}", "func (fn *Function) instRange() [2]int {\n\td := len(fn.Name)\n\tinst := [2]int{d, d}\n\tif strings.HasPrefix(fn.Name, \"type..\") {\n\t\treturn inst\n\t}\n\tinst[0] = strings.Index(fn.Name, \"[\")\n\tif inst[0] < 0 {\n\t\tinst[0] = d\n\t\treturn inst\n\t}\n\tinst[1] = strings.LastIndex(fn.Name, \"]\")\n\tif inst[1] < 0 {\n\t\tinst[0] = d\n\t\tinst[1] = d\n\t\treturn inst\n\t}\n\treturn inst\n}", "func (m Method) String() string { return m.Name() }", "func (s StringInterval) End() string {\n\treturn s.Name\n}", "func (v *VerbalExpression) Range(args ...interface{}) *VerbalExpression {\n\tif len(args)%2 != 0 {\n\t\tlog.Panicf(\"Range: not even args number\")\n\t}\n\n\tparts := make([]string, 3)\n\tapp := \"\"\n\tfor i := 0; i < len(args); i++ {\n\t\tapp += tostring(args[i])\n\t\tif i%2 != 0 {\n\t\t\tparts = append(parts, quote(app))\n\t\t\tapp = \"\"\n\t\t} else {\n\t\t\tapp += \"-\"\n\t\t}\n\t}\n\treturn v.add(\"[\" + strings.Join(parts, \"\") + \"]\")\n}", "func (m Method) Name() string { return methodMappings[m] }", "func (x *fastReflection_Bech32PrefixRequest) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) {\n}", "func (s *BaseSyslParserListener) EnterMethod_def(ctx *Method_defContext) {}", "func (g *mapGen) genRange() {\n\tg.P(\"func (x *\", g.typeName, \") Range(f func(\", protoreflectPkg.Ident(\"MapKey\"), \", \", protoreflectPkg.Ident(\"Value\"), \") bool) {\")\n\t// invalid map\n\tg.P(\"if x.m == nil {\")\n\tg.P(\"return\")\n\tg.P(\"}\")\n\t// valid map\n\tg.P(\"for k, v := range *x.m {\")\n\tg.P(\"mapKey := (\", protoreflectPkg.Ident(\"MapKey\"), \")(\", kindToValueConstructor(g.field.Message.Fields[0].Desc.Kind()), \"(k))\")\n\tswitch g.field.Message.Fields[1].Desc.Kind() {\n\tcase protoreflect.MessageKind:\n\t\tg.P(\"mapValue := \", kindToValueConstructor(g.field.Message.Fields[1].Desc.Kind()), \"(v.ProtoReflect())\")\n\tdefault:\n\t\tg.P(\"mapValue := \", kindToValueConstructor(g.field.Message.Fields[1].Desc.Kind()), \"(v)\")\n\t}\n\tg.P(\"if !f(mapKey, mapValue) {\")\n\tg.P(\"break\")\n\tg.P(\"}\")\n\tg.P(\"}\")\n\tg.P(\"}\")\n\tg.P()\n}", "func (r *baseNsRange) Start() int { return r.start }", "func Start(_ string) error {\n\treturn nil\n}", "func (q *Query) Range(indexName string, start, end interface{}) *Query {\n\t// For an index range search,\n\t// it is non-sensical to pass two nils\n\t// Set the error and return the query unchanged\n\tif start == nil && end == nil {\n\t\tq.err = errors.New(ErrNilInputsRangeIndexQuery)\n\t\treturn q\n\t}\n\tq.start = start\n\tq.end = end\n\tq.isIndexQuery = true\n\tq.indexName = []byte(indexName)\n\treturn q\n}", "func newRange(file *token.File, start, end token.Pos) Range {\n\tfileBase := file.Base()\n\tfileEnd := fileBase + file.Size()\n\tif !start.IsValid() {\n\t\tpanic(\"invalid start token.Pos\")\n\t}\n\tif !end.IsValid() {\n\t\tpanic(\"invalid end token.Pos\")\n\t}\n\tif int(start) < fileBase || int(start) > fileEnd {\n\t\tpanic(fmt.Sprintf(\"invalid start: %d not in [%d, %d]\", start, fileBase, fileEnd))\n\t}\n\tif int(end) < fileBase || int(end) > fileEnd {\n\t\tpanic(fmt.Sprintf(\"invalid end: %d not in [%d, %d]\", end, fileBase, fileEnd))\n\t}\n\tif start > end {\n\t\tpanic(\"invalid start: greater than end\")\n\t}\n\treturn Range{\n\t\tTokFile: file,\n\t\tStart: start,\n\t\tEnd: end,\n\t}\n}", "func (e StartElement) End() EndElement {\n\treturn EndElement{e.Name}\n}", "func parseServiceMethod(svcAndMethod string) (string, string, error) {\n\tif len(svcAndMethod) == 0 {\n\t\treturn \"\", \"\", errNoMethodNameSpecified\n\t}\n\tif svcAndMethod[0] == '.' {\n\t\tsvcAndMethod = svcAndMethod[1:]\n\t}\n\tif len(svcAndMethod) == 0 {\n\t\treturn \"\", \"\", errNoMethodNameSpecified\n\t}\n\tswitch strings.Count(svcAndMethod, \"/\") {\n\tcase 0:\n\t\tpos := strings.LastIndex(svcAndMethod, \".\")\n\t\tif pos < 0 {\n\t\t\treturn \"\", \"\", newInvalidMethodNameError(svcAndMethod)\n\t\t}\n\t\treturn svcAndMethod[:pos], svcAndMethod[pos+1:], nil\n\tcase 1:\n\t\tsplit := strings.Split(svcAndMethod, \"/\")\n\t\treturn split[0], split[1], nil\n\tdefault:\n\t\treturn \"\", \"\", newInvalidMethodNameError(svcAndMethod)\n\t}\n}", "func canTransform(start string, end string) bool {\n \n}", "func (t TotalInterval) Begin() string {\n\treturn \"\"\n}", "func (method *Method) GetName() string { return method.Name }", "func expectRange(r *style.Range) parser {\n\treturn func(in parserInput) parserOutput {\n\t\t// check for start symbol\n\t\tout := expectString(r.StartSymbol)(in)\n\t\tif out.result == nil {\n\t\t\treturn fail()\n\t\t}\n\t\tin = out.remaining\n\t\tvar b strings.Builder\n\t\t_, err := b.WriteString(r.StartSymbol)\n\t\tcheck(err)\n\n\t\t// search until end symbol or end\n\t\tout = searchUntil(expectString(r.EndSymbol))(in)\n\t\ts := out.result.(search)\n\t\t_, err = b.WriteString(s.consumed)\n\t\tcheck(err)\n\n\t\t// if end symbol found, add to builder\n\t\tif s.result != nil {\n\t\t\t_, err = b.WriteString(r.EndSymbol)\n\t\t\tcheck(err)\n\t\t}\n\t\tin = out.remaining\n\t\treturn success(rangeOutput{b.String(), r}, in)\n\t}\n}", "func FormatEndpointMethod(n string) string {\n\tp := strings.Split(n, \"/\")\n\tm := \"\"\n\tfor _, s := range p {\n\t\tm = fmt.Sprintf(\"%s%s\", m, strings.Title(s))\n\t}\n\treturn m\n}", "func (pc *programCode) createStart() {\n\tstart := \"section .text\\nglobal _start\\n_start:\\n\"\n\tpc.code += start\n}", "func (defn *Definition) Start() Pos {\n\tswitch {\n\tcase defn.Operation != nil:\n\t\treturn defn.Operation.Start\n\tcase defn.Fragment != nil:\n\t\treturn defn.Fragment.Keyword\n\tcase defn.Type != nil:\n\t\treturn defn.Type.Start()\n\tdefault:\n\t\tpanic(\"unknown definition\")\n\t}\n}", "func makeNames(fullMethod string) (names api.Names) {\n\t// Strip the leading slash. It should always be present in practice.\n\tif len(fullMethod) > 0 && fullMethod[0] == '/' {\n\t\tfullMethod = fullMethod[1:]\n\t}\n\n\t// Parse the slash separated service and method name. The separating slash\n\t// should always be present in practice.\n\tif slashIndex := strings.Index(fullMethod, \"/\"); slashIndex != -1 {\n\t\tnames.RawService = fullMethod[0:slashIndex]\n\t\tnames.Method = fullMethod[slashIndex+1:]\n\t}\n\n\tnames.Service = serviceReplacer.Replace(names.RawService)\n\tnames.MetricKey = append(names.MetricKey, strings.Split(names.Service, \".\")...)\n\tnames.MetricKey = append(names.MetricKey, methodMetricKeyReplacer.Replace(names.Method))\n\tfor i := range names.MetricKey {\n\t\tnames.MetricKey[i] = metricKey(names.MetricKey[i])\n\t}\n\treturn names\n}", "func (s *Tsfs) TestRange(c *C) {\n r := RangeStartEnd(1, 5) // [ 1, 2, 3, 4 ]\n AssertString(c, r, \"1:4\")\n\n // negative arg\n AssertString(c, r.Drop(-1), \"1:4\")\n AssertString(c, r.DropRight(-1), \"1:4\")\n AssertString(c, r.Take(-1), \"0:0\")\n AssertString(c, r.TakeRight(-1), \"0:0\")\n\n // zero arg\n AssertString(c, r.Drop(0), \"1:4\")\n AssertString(c, r.DropRight(0), \"1:4\")\n AssertString(c, r.Take(0), \"0:0\")\n AssertString(c, r.TakeRight(0), \"0:0\")\n\n // positive arg\n AssertString(c, r.Drop(1), \"2:3\")\n AssertString(c, r.DropRight(1), \"1:3\")\n AssertString(c, r.Take(1), \"1:1\")\n AssertString(c, r.TakeRight(1), \"4:1\")\n\n // length - 1\n AssertString(c, r.Drop(3), \"4:1\")\n AssertString(c, r.DropRight(3), \"1:1\")\n AssertString(c, r.Take(3), \"1:3\")\n AssertString(c, r.TakeRight(3), \"2:3\")\n\n // length\n AssertString(c, r.Drop(4), \"0:0\")\n AssertString(c, r.DropRight(4), \"0:0\")\n AssertString(c, r.Take(4), \"1:4\")\n AssertString(c, r.TakeRight(4), \"1:4\")\n\n // length + 1\n AssertString(c, r.Drop(5), \"0:0\")\n AssertString(c, r.DropRight(5), \"0:0\")\n AssertString(c, r.Take(5), \"1:4\")\n AssertString(c, r.TakeRight(5), \"1:4\")\n\n // slice is implemented in terms of take and drop so is\n // primarily assured by the above passing.\n AssertString(c, r.Slice(0, 0), \"0:0\")\n AssertString(c, r.Slice(0, 1), \"1:1\")\n AssertString(c, r.Slice(0, 2), \"1:2\")\n AssertString(c, r.Slice(1, 2), \"2:1\")\n AssertString(c, r.Slice(2, 1), \"0:0\")\n AssertString(c, r.Slice(-2, -1), \"0:0\")\n AssertString(c, r.Slice(-2, 2), \"1:2\")\n\n}", "func (b Body) Range(start, end int) Range {\n\treturn Range{b.Position(start), b.Position(end)}\n}", "func (l Languages) MyMethod() string {\n\tstr := strings.ToUpper(l.x) + strings.ToUpper(l.y)\n\treturn str\n}", "func (l Languages) MyMethod() string {\n\tstr := strings.ToUpper(l.x) + strings.ToUpper(l.y)\n\treturn str\n}", "func (p *PropertyGenerator) isMethodName(i int) string {\n\treturn fmt.Sprintf(\"%s%s\", isMethod, p.kindCamelName(i))\n}", "func (s *BasejossListener) EnterRange_(ctx *Range_Context) {}", "func substring(start, length int, s string) string {\n\tif start < 0 {\n\t\treturn s[:length]\n\t}\n\tif length < 0 {\n\t\treturn s[start:]\n\t}\n\treturn s[start:length]\n}", "func methodIn(method string, methods ...string) bool {\n\tfor _, m := range methods {\n\t\tif method == m {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "func nameStart(c byte) bool {\n\treturn 'a' <= c && c <= 'z' || 'A' <= c && c <= 'Z' || c == '_' || c > 127\n}", "func nameStart(c byte) bool {\n\treturn 'a' <= c && c <= 'z' || 'A' <= c && c <= 'Z' || c == '_' || c > 127\n}", "func (r *baseNsRange) Set(start, end int) { r.start, r.end = start, end }", "func exampleStartWith() {\n\t// Read text from file\n\ttext, err := streeng.StringFromFile(\"pp.txt\")\n\tif err != nil {\n\t\tfmt.Println(\"String from file error:\", err.Error())\n\t\treturn\n\t}\n\n\t// split text with whitespace seperator\n\twords := strings.Fields(text)\n\n\t// Make a new Streeng\n\ts := streeng.MakeStreeng(words)\n\n\t// Match string which start with given string in streeng\n\tlistOfIndex := s.StartWith(\"sta\")\n\n\tfmt.Println(listOfIndex)\n}", "func removeMatching(name string, start, end byte) string {\n\ts := string(start) + string(end)\n\tvar nesting, first, current int\n\tfor index := strings.IndexAny(name[current:], s); index != -1; index = strings.IndexAny(name[current:], s) {\n\t\tswitch current += index; name[current] {\n\t\tcase start:\n\t\t\tnesting++\n\t\t\tif nesting == 1 {\n\t\t\t\tfirst = current\n\t\t\t}\n\t\tcase end:\n\t\t\tnesting--\n\t\t\tswitch {\n\t\t\tcase nesting < 0:\n\t\t\t\treturn name // Mismatch, abort\n\t\t\tcase nesting == 0:\n\t\t\t\tname = name[:first] + name[current+1:]\n\t\t\t\tcurrent = first - 1\n\t\t\t}\n\t\t}\n\t\tcurrent++\n\t}\n\treturn name\n}", "func Start(val string) Argument {\n\treturn func(request *requests.Request) error {\n\t\terr := assertDateFormatV2(val, \"Start\")\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\trequest.AddArgument(\"start\", val)\n\t\treturn nil\n\t}\n}", "func (pm *IntegerParameterRange) Start() interface{} {\n\treturn pm.start\n}", "func (ref *TypeRef) Start() Pos {\n\tswitch {\n\tcase ref.Named != nil:\n\t\treturn ref.Named.Start\n\tcase ref.List != nil:\n\t\treturn ref.List.LBracket\n\tcase ref.NonNull != nil:\n\t\treturn ref.NonNull.Start()\n\tdefault:\n\t\tpanic(\"unknown type reference\")\n\t}\n}", "func main() {\n\tx := 5\n\tw := 3\n\ty := 4\n\ta := `amen `\n\tb := `sister`\n\tc := `we are love`\n\tvar q int\n\tfmt.Print(`how old are u ?`)\n\tfmt.Scanln(&q)\n\tfmt.Println(`i am `, q, ` years old`)\n\n\tfmt.Println(onefunc(c))\n\tfmt.Println(stringop(a, b))\n\t//start(w, y)\n\tzero(x)\n\tfmt.Println(x) // x is still 5\n\tfmt.Println(start(w, y))\n}", "func (n *Name) End() Pos {\n\treturn n.Start + Pos(len(n.Value))\n}", "func (t TotalInterval) End() string {\n\treturn \"\"\n}", "func (inNode *InputNode) Start() {\n}", "func MethodsFunc() {\n\tv := vertex{5, 12}\n\tfmt.Println(abs(v))\n}", "func (o Int64RangeMatchResponseOutput) RangeStart() pulumi.StringOutput {\n\treturn o.ApplyT(func(v Int64RangeMatchResponse) string { return v.RangeStart }).(pulumi.StringOutput)\n}", "func methodReceiver(p Elem) string {\n\tswitch p.(type) {\n\n\t// structs and arrays are\n\t// dereferenced automatically,\n\t// so no need to alter varname\n\tcase *Struct, *Array:\n\t\treturn \"*\" + p.TypeName()\n\t// set variable name to\n\t// *varname\n\tdefault:\n\t\tp.SetVarname(\"(*\" + p.Varname() + \")\")\n\t\treturn \"*\" + p.TypeName()\n\t}\n}", "func (endpointName) Complete(s string) []string {\n\t// TODO get endpoints\n\treturn []string{\"aaa\", \"abb\", \"c\"}\n}", "func Range(args ...interface{}) Term {\n\treturn constructRootTerm(\"Range\", p.Term_RANGE, args, map[string]interface{}{})\n}", "func (e Expr) Begin() uint16 { return e.Pos.Begin }", "func (p *Parser) begin() {\n\tp.match(\"TK_BEGIN\");\n\tp.statements();\n\tp.match(\"TK_END\");\n\tp.match(\"TK_DOT\");\n\tp.match(\"TK_EOF\");\n\tp.genOpCode(OP_CODE(HALT));\n}", "func End(val string) Argument {\n\treturn func(request *requests.Request) error {\n\t\terr := assertDateFormatV2(val, \"End\")\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\trequest.AddArgument(\"end\", val)\n\t\treturn nil\n\t}\n}", "func Location() {}", "func startsWith(fl FieldLevel) bool {\n\treturn strings.HasPrefix(fl.Field().String(), fl.Param())\n}", "func (s *BasevhdlListener) EnterRange_decl(ctx *Range_declContext) {}", "func (o Int64RangeMatchOutput) RangeStart() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v Int64RangeMatch) *string { return v.RangeStart }).(pulumi.StringPtrOutput)\n}", "func StartsAndEndsWith(str, prefix, suffix string) bool {\n\treturn strings.HasPrefix(str, prefix) && strings.HasSuffix(str, suffix)\n}", "func (this *Parser) Range(start, end int) *OrderedChoice {\r\n\texps := make([]Exp, (end - start)+1)\r\n\tfor i := start; i <= end; i++ {\r\n\t\texps[i-start] = &Terminal{this,i}\r\n\t}\r\n\treturn &OrderedChoice{this,exps}\r\n}", "func (rf *Raft) Start(command interface{}) (int, int, bool) {\n\tindex := -1\n\tterm := -1\n\tisLeader := true\n\n\t// Your code here (2B).\n\n\n\treturn index, term, isLeader\n}", "func (x* xmlWriter) tagStart(tag string) {\n\tx.iFmt(\"<%s\", tag)\n\tx.path = append(x.path, tag)\n\tx.tagOpen = true\n}", "func main() {\n\tnums := []int{-2, 0, 3, -5, 2, -1}\n\tobj := Constructor(nums)\n\tparam_1 := obj.SumRange(0, 2)\n\tfmt.Println(param_1)\n}", "func GetStringInBetween(str string, start string, end string) (result string) {\n\ts := strings.Index(str, start)\n\tif s == -1 {\n\t\treturn\n\t}\n\ts += len(start)\n\te := strings.Index(str[s:], end)\n\tif e == -1 {\n\t\treturn\n\t}\n\te += s\n\treturn str[s:e]\n}", "func (rf *Raft) Start(command interface{}) (int, int, bool) {\n\tindex := -1\n\tterm := -1\n\tisLeader := true\n\n\t// Your code here (2B).\n\n\treturn index, term, isLeader\n}", "func (rf *Raft) Start(command interface{}) (int, int, bool) {\n\tindex := -1\n\tterm := -1\n\tisLeader := true\n\n\t// Your code here (2B).\n\n\treturn index, term, isLeader\n}", "func PageStart(args ...interface{}) string {\n\treturn \"\"\n}", "func parseRangeLine(line string) *note {\n\tparts := strings.Split(line, \": \")\n\n\tbes := strings.Split(parts[1], \" or \")\n\n\tbeginEnds := make([]*beginEnd, 0)\n\tfor _, secondPart := range bes {\n\t\tvals := strings.Split(secondPart, \"-\")\n\t\tstart, err := strconv.Atoi(vals[0])\n\t\tif err != nil {\n\t\t\tpanic(err)\n\t\t}\n\t\tend, err := strconv.Atoi(vals[1])\n\t\tif err != nil {\n\t\t\tpanic(err)\n\t\t}\n\t\tbe := &beginEnd{\n\t\t\tstart: start,\n\t\t\tend: end,\n\t\t}\n\t\tbeginEnds = append(beginEnds, be)\n\t}\n\n\treturn &note{\n\t\tname: parts[0],\n\t\tbe: beginEnds,\n\t}\n}", "func parseRangeLine(line string) *note {\n\tparts := strings.Split(line, \": \")\n\n\tbes := strings.Split(parts[1], \" or \")\n\n\tbeginEnds := make([]*beginEnd, 0)\n\tfor _, secondPart := range bes {\n\t\tvals := strings.Split(secondPart, \"-\")\n\t\tstart, err := strconv.Atoi(vals[0])\n\t\tif err != nil {\n\t\t\tpanic(err)\n\t\t}\n\t\tend, err := strconv.Atoi(vals[1])\n\t\tif err != nil {\n\t\t\tpanic(err)\n\t\t}\n\t\tbe := &beginEnd{\n\t\t\tstart: start,\n\t\t\tend: end,\n\t\t}\n\t\tbeginEnds = append(beginEnds, be)\n\t}\n\n\treturn &note{\n\t\tname: parts[0],\n\t\tbe: beginEnds,\n\t}\n}", "func (e ExampleType) ExampleMethod() {\n}", "func (r *Range) String() string {\n\treturn fmt.Sprintf(\"range(%s, %s)\", r.Start, r.End)\n}", "func getEnd(args []string) (string, error) {\n\treTime := regexp.MustCompile(`^(([0-9]*\\.)?[0-9]+)`)\n\t// Set the default string for end to an empty string to simplify\n\t// things.\n\tend := \"\"\n\tif len(args) == 2 {\n\t\tmatch := reTime.FindStringSubmatch(args[1])\n\t\tif len(match) > 0 {\n\t\t\tend = match[1]\n\t\t} else {\n\t\t\terr := errors.New(\"end must be a number\")\n\t\t\treturn \"\", err\n\t\t}\n\t}\n\n\treturn end, nil\n}", "func startsWithFunc(a, b string) bool {\n\treturn strings.HasPrefix(a, b)\n}", "func (e *Engine) BeginMethod() (string, error) {\n\tif e.curMethodIdx+1 >= len(e.cfg.AvailableMethods) {\n\t\treturn \"\", fmt.Errorf(\"all available SASL authentication methods exhausted\")\n\t}\n\n\te.curMethodIdx++\n\treturn e.cfg.AvailableMethods[e.curMethodIdx], nil\n}", "func (defn *TypeDefinition) Start() Pos {\n\tswitch {\n\tcase defn.Scalar != nil:\n\t\treturn defn.Scalar.Keyword\n\tcase defn.Object != nil:\n\t\treturn defn.Object.Keyword\n\tcase defn.Union != nil:\n\t\treturn defn.Union.Keyword\n\tcase defn.Enum != nil:\n\t\treturn defn.Enum.Keyword\n\tcase defn.InputObject != nil:\n\t\treturn defn.InputObject.Keyword\n\tdefault:\n\t\tpanic(\"unknown type definition\")\n\t}\n}", "func (sr SourceRange) Start() SourceLocation {\n\treturn SourceLocation{C.clang_getRangeStart(sr.c)}\n}", "func Intersection() {\n\n}", "func getFullName()(string, string) {\n\treturn \"Ninja\", \"Coder\"\n}", "func Verses(start, stop int) (string, error) {\n\tswitch {\n\tcase 0 > start || start > 99:\n\t\treturn \"\", fmt.Errorf(\"start value[%d] is not a valid verse\", start)\n\tcase 0 > stop || stop > 99:\n\t\treturn \"\", fmt.Errorf(\"stop value[%d] is not a valid verse\", stop)\n\tcase start < stop:\n\t\treturn \"\", fmt.Errorf(\"start value[%d] is less than stop value[%d]\", start, stop)\n\t}\n\n\tvar buff bytes.Buffer\n\tfor i := start; i >= stop; i-- {\n\t\tv, _ := Verse(i)\n\t\tbuff.WriteString(v)\n\t\tbuff.WriteString(\"\\n\")\n\t}\n\treturn buff.String(), nil\n}", "func isStartIdentifier(p []byte) bool {\n\tif p[0] == '-' {\n\t\tp = p[1:]\n\t}\n\tif isNameStart(p[0]) {\n\t\treturn true\n\t} else if isValidEscape(p) {\n\t\treturn true\n\t}\n\treturn false\n}", "func GetStringInBetween(str string, start string, end string) (result string) {\n\ts := strings.Index(str, start)\n\tif s == -1 {\n\t\treturn\n\t}\n\ts += len(start)\n\te := strings.Index(str[s:], end)\n\tif e == -1 {\n\t\treturn\n\t}\n\treturn str[s : s+e]\n}", "func StrBetween(str string, start string, end string) (result string) {\n\tpos1 := strings.Index(str, start)\n\tif pos1 == -1 {\n\t\treturn\n\t}\n\tpos1 += len(start)\n\n\t//var str2 string\n\tstr2 := str[pos1:]\n\n\tpos2 := strings.Index(str2, end)\n\tif pos2 == -1 {\n\t\treturn\n\t}\n\treturn str2[0:pos2]\n}", "func (list *TList) Range(start, stop int) []string {\n\tlist.mux.RLock()\n\n\tstart = list.convertPos(start)\n\tstop = list.convertPos(stop)\n\n\tif start > list.Len()-1 || start < 0 {\n\t\tlist.mux.RUnlock()\n\t\treturn []string{}\n\t}\n\n\tif stop > list.Len()-1 {\n\t\tstop = list.Len() - 1\n\t}\n\n\tdist := stop - start\n\n\tif dist < 0 {\n\t\tlist.mux.RUnlock()\n\t\treturn []string{}\n\t}\n\n\tres := make([]string, dist+1)\n\n\tfor i, j, e := start, 0, list.findAtIndex(start); e != nil && i <= stop; i, j, e = i+1, j+1, e.Next() {\n\t\tres[j] = util.ToString(e.Value)\n\t}\n\n\tlist.mux.RUnlock()\n\treturn res[:]\n}", "func Mid(s string, start, length int) string {\n\tif start < 0 {\n\t\tstart = 0\n\t}\n\tif start > len(s) {\n\t\treturn \"\"\n\t}\n\tif length < 1 {\n\t\treturn \"\"\n\t}\n\n\trunes := []rune(s)\n\tif start > len(runes) {\n\t\treturn \"\"\n\t}\n\tif start+length > len(runes) {\n\t\treturn string(runes[start:])\n\t}\n\treturn string(runes[start : start+length])\n\n}", "func (r *baseNsRange) SetStart(start int) { r.start = start }", "func (p *printer) Method(method *descriptor.MethodDescriptorProto) {\n\tp.MaybeLeadingComments(method)\n\tp.Printf(\n\t\t\"rpc %s(%s) returns (%s) {};\\n\",\n\t\tmethod.GetName(),\n\t\tp.shorten(method.GetInputType()),\n\t\tp.shorten(method.GetOutputType()),\n\t)\n}", "func (c *ReferencesBasesListCall) Start(start int64) *ReferencesBasesListCall {\n\tc.urlParams_.Set(\"start\", fmt.Sprint(start))\n\treturn c\n}", "func Demo4() {}", "func evaluateAtModifierFunction(query string, start, end int64) (string, error) {\n\texpr, err := parser.ParseExpr(query)\n\tif err != nil {\n\t\treturn \"\", httpgrpc.Errorf(http.StatusBadRequest, \"%s\", err)\n\t}\n\tparser.Inspect(expr, func(n parser.Node, _ []parser.Node) error {\n\t\tif selector, ok := n.(*parser.VectorSelector); ok {\n\t\t\tswitch selector.StartOrEnd {\n\t\t\tcase parser.START:\n\t\t\t\tselector.Timestamp = &start\n\t\t\tcase parser.END:\n\t\t\t\tselector.Timestamp = &end\n\t\t\t}\n\t\t\tselector.StartOrEnd = 0\n\t\t}\n\t\treturn nil\n\t})\n\treturn expr.String(), err\n}", "func (sr SourceRange) End() SourceLocation {\n\treturn SourceLocation{C.clang_getRangeEnd(sr.c)}\n}", "func PtSmethod(name string, addr net.Addr) {\n\tPtLine(\"SMETHOD\", name, addr.String())\n}", "func (c *ConvertAllDayProcessor) getStartAndEndDuration() (time.Duration, time.Duration, error) {\n\tvar startDuration time.Duration\n\tvar endDuration time.Duration\n\tif duration, err := c.getDurationFromTimeString(*c.startTime); err != nil {\n\t\treturn startDuration, endDuration, err\n\t} else {\n\t\tstartDuration = duration\n\t}\n\tif duration, err := c.getDurationFromTimeString(*c.endTime); err != nil {\n\t\treturn startDuration, endDuration, err\n\t} else {\n\t\tendDuration = duration\n\t}\n\treturn startDuration, endDuration, nil\n}", "func (f *Field) Start() Pos {\n\tif f.Alias != nil {\n\t\treturn f.Alias.Start\n\t}\n\treturn f.Name.Start\n}", "func (r *NSNormalizedRange) normalizedRange(ns *NormalizedString) (start, end int, ok bool) {\n\tif r.start > r.end || r.start < 0 || r.end > len(ns.alignments) {\n\t\treturn -1, -1, false\n\t}\n\treturn r.start, r.end, true\n}", "func inRange(r ipRange, ipAddress net.IP) bool {\n\t// strcmp type byte comparison\n\tif bytes.Compare(ipAddress, r.start) >= 0 && bytes.Compare(ipAddress, r.end) < 0 {\n\t\treturn true\n\t}\n\treturn false\n}", "func getArgs() (string, string) {\n\tvar showHelp = flag.Bool(\"h\", false, \"help\")\n\tflag.Parse()\n\n\tif *showHelp {\n\t\tfmt.Println(\"usage: walseq [-h] [seg_start [seg_end]]\")\n\t\tos.Exit(-1)\n\t}\n\n\targs := flag.Args()\n\n\tdefaultStart := fmt.Sprintf(SEG_FMT, MIN_TIMELINE, MIN_LOGICAL, MIN_PHYSICAL)\n\tdefaultStop := fmt.Sprintf(SEG_FMT, MAX_TIMELINE, MAX_LOGICAL, MAX_PHYSICAL)\n\n\tif len(args) == 0 {\n\t\treturn defaultStart, defaultStop\n\t}\n\n\tsegStart := args[0]\n\tif len(segStart) != 24 {\n\t\tfmt.Fprintln(os.Stderr, \"seg_start should be 24 characters long\")\n\t\tos.Exit(100)\n\t}\n\n\tif len(args) == 1 {\n\t\treturn segStart, defaultStop\n\t}\n\n\tsegStop := args[1]\n\tif len(segStop) != 24 {\n\t\tfmt.Fprintln(os.Stderr, \"seg_stop should be 24 characters long\")\n\t\tos.Exit(101)\n\t}\n\n\treturn segStart, segStop\n}", "func trimBetween(s string, start string, end string) string {\n\tif idx := strings.Index(s, start); idx != -1 {\n\t\ts = s[idx+len(start):]\n\t}\n\n\tif idx := strings.Index(s, end); idx != -1 {\n\t\ts = s[:idx]\n\t}\n\n\treturn s\n}", "func (p IPPrefix) Range() IPRange {\n\tp = p.Masked()\n\tif p.IsZero() {\n\t\treturn IPRange{}\n\t}\n\treturn IPRange{From: p.IP, To: p.lastIP()}\n}", "func struct_range() {\n\t// stuc1 := stru{name: \"abc\", age: 12}\n\t// for i, v := range stuc1 {\n\t// \tfmt.Println(i, v)\n\t// }\n\tfmt.Println(\"----------------\")\n}", "func find(input, target string, start, end int) bool {\n\tlength := len(input)\n\tif length < end || start < 0 {\n\t\treturn false\n\t}\n\n\treturn input[start:end] == target\n}", "func (m Method) Name() string {\n\treturn m.function.name\n}", "func (f *Formatter) begin(stmt string, v proto.Visitee) {\n\t// if not the first statement and different from last and on same indent level.\n\tif len(f.lastStmt) > 0 && f.lastStmt != stmt && f.lastLevel == f.indentLevel {\n\t\tf.nl()\n\t}\n\tf.lastStmt = stmt\n\tf.printDoc(v)\n\tf.indent(0)\n}" ]
[ "0.5352793", "0.53079545", "0.5307953", "0.5270175", "0.5204226", "0.5073433", "0.50607365", "0.50431955", "0.5032989", "0.49977338", "0.49951833", "0.4994729", "0.49817798", "0.49630356", "0.4958788", "0.49487862", "0.49427646", "0.49184117", "0.49077627", "0.49043593", "0.48692966", "0.48678502", "0.4867401", "0.48538348", "0.48438704", "0.48411864", "0.48347282", "0.4833632", "0.4833632", "0.48330274", "0.48070756", "0.47968072", "0.47908887", "0.47897932", "0.47897932", "0.47893614", "0.47720414", "0.47647312", "0.47595653", "0.4758842", "0.47566935", "0.4756398", "0.474043", "0.4739636", "0.47365186", "0.47229704", "0.47104812", "0.46992892", "0.46923923", "0.46903762", "0.4681682", "0.46740988", "0.4670648", "0.46705127", "0.46645153", "0.46589133", "0.46496066", "0.46488667", "0.46415102", "0.4639838", "0.46341097", "0.46235037", "0.46184698", "0.46176007", "0.46176007", "0.4616379", "0.46151808", "0.46151808", "0.46141642", "0.46106818", "0.46076834", "0.4595704", "0.4585407", "0.4584719", "0.45842433", "0.45775715", "0.45753255", "0.4574141", "0.45706892", "0.45704257", "0.4562249", "0.4561277", "0.4549704", "0.4547163", "0.4543835", "0.45403528", "0.4537469", "0.4535498", "0.45289612", "0.4527568", "0.45231706", "0.45210233", "0.45204946", "0.4514985", "0.45097867", "0.450655", "0.450524", "0.45030776", "0.4502067", "0.44967765", "0.44950876" ]
0.0
-1
NewClient creates a new client configured with the given options.
func NewClient(opts ...Option) *Client { cfg := config{log: log.Println, hooks: &hooks{}} cfg.options(opts...) client := &Client{config: cfg} client.init() return client }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func NewClient(\n\thost string,\n\tapplicationName string,\n\toptions ...Option,\n) (*Client, error) {\n\tc := &Client{\n\t\thost: host,\n\t\tapplicationName: applicationName,\n\t}\n\n\tfor _, o := range options {\n\t\terr := o(c)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"client.NewClient failed to apply option: %s\", err)\n\t\t}\n\t}\n\n\treturn c, nil\n}", "func NewClient(options Options) *Client {\n\treturn &Client{Options: options}\n}", "func NewClient(options Options) (*Client, error) {\n\tc := &Client{\n\t\tserver: options.Server,\n\t\tappCode: options.AppCode,\n\t\tappSecret: options.AppSecret,\n\t\tbkUserName: options.BKUserName,\n\t\tserverDebug: options.Debug,\n\t}\n\n\treturn c, nil\n}", "func NewClient(o *Option) Client {\n\treturn &client{\n\t\to: o,\n\t}\n}", "func NewClient(options Options) (client Client) {\n\tmergo.Merge(&options, defaultClientOptions)\n\n\tclient = Client{newDefaultClient(options)}\n\n\tif options.Proxy != \"\" {\n\t\tclient.setProxy(options.Proxy, options.ProxyConnectHeaders)\n\t}\n\n\tif options.MaxRedirects > 0 {\n\t\tclient.setLimitRedirect(options.MaxRedirects)\n\t}\n\n\treturn client\n}", "func NewClient(options ...ClientOptionFunc) (*Client, error) {\n\tc := &Client{\n\t\t// client: client(false),\n\t\tremote: DefaultRemote,\n\t\turl: DefaultURL,\n\t\tverbose: DefaultVerbose,\n\t}\n\tfor _, option := range options {\n\t\tif err := option(c); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\treturn c, nil\n}", "func NewClient(apiKey string, serverID string, options ...clientOption) *Client {\n\tc := &Client{\n\t\tapiKey: apiKey,\n\t\tserverID: serverID,\n\t\tserviceURL: ServiceURL,\n\t}\n\tfor _, opt := range options {\n\t\topt(c)\n\t}\n\treturn c\n}", "func NewClient(options ...Option) (*Client, error) {\n\tclient := &Client{\n\t\tbaseURL: DefaultBaseURL,\n\t\tclient: http.DefaultClient,\n\t\tworkers: DefaultWorkers,\n\t}\n\n\tfor _, option := range options {\n\t\tif err := option(client); err != nil {\n\t\t\treturn nil, fmt.Errorf(\"failed to create client: %v\", err)\n\t\t}\n\t}\n\n\treturn client, nil\n}", "func New(opt *Options) (*client, error) {\n\tif err := opt.init(); err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn &client{\n\t\tappKey: opt.AppKey,\n\t\tappSecret: opt.AppSecret,\n\t\tsid: opt.SID,\n\t\tbaseURL: opt.BaseURL,\n\t\thttpClient: opt.HttpClient,\n\t}, nil\n}", "func NewClient(options *ClientOptions) *Client {\n\tclient := &Client{\n\t\tappID: options.AppID,\n\t\tappKey: options.AppKey,\n\t\tmasterKey: options.MasterKey,\n\t\tserverURL: options.ServerURL,\n\t}\n\n\tif !strings.HasSuffix(options.AppID, \"MdYXbMMI\") {\n\t\tif client.serverURL == \"\" {\n\t\t\tpanic(fmt.Errorf(\"please set API's serverURL\"))\n\t\t}\n\t}\n\n\t_, debugEnabled := os.LookupEnv(\"LEANCLOUD_DEBUG\")\n\n\tif debugEnabled {\n\t\tclient.requestLogger = log.New(os.Stdout, \"\", log.LstdFlags)\n\t}\n\n\tclient.Users.c = client\n\tclient.Files.c = client\n\tclient.Roles.c = client\n\treturn client\n}", "func New(opts ...Option) Client {\n\treturn newClient(opts...)\n}", "func (o *ClientConfig) NewClient(options ...ClientOption) (Client, error) {\n\n\t// Run provided ClientOption configuration options.\n\tfor _, opt := range options {\n\t\terr := opt(o)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"failed applying functional option: %w\", err)\n\t\t}\n\t}\n\n\t// Check mandatory option is provided.\n\tif o.githubUserClient == nil {\n\t\treturn nil, fmt.Errorf(\"github client not provided\")\n\t}\n\n\ttokenGenerator := secret.GetTokenGenerator(o.tokenPath)\n\n\tgitFactory, err := o.GitClient(o.githubUserClient, tokenGenerator, secret.Censor, false)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tgitClient := &client{}\n\t// Initialize map to enable writing to it in methods.\n\tgitClient.clonedRepos = make(map[string]string)\n\tgitClient.ClientFactory = gitFactory\n\treturn gitClient, err\n}", "func NewClient(o *Options) (*Client, error) {\n\tconn, err := o.getDialer()()\n\treturn &Client{\n\t\tconn: conn,\n\t}, err\n}", "func NewClient(ctx *pulumi.Context,\n\tname string, args *ClientArgs, opts ...pulumi.ResourceOption) (*Client, error) {\n\tif args == nil {\n\t\treturn nil, errors.New(\"missing one or more required arguments\")\n\t}\n\n\tif args.Brand == nil {\n\t\treturn nil, errors.New(\"invalid value for required argument 'Brand'\")\n\t}\n\tif args.DisplayName == nil {\n\t\treturn nil, errors.New(\"invalid value for required argument 'DisplayName'\")\n\t}\n\tsecrets := pulumi.AdditionalSecretOutputs([]string{\n\t\t\"secret\",\n\t})\n\topts = append(opts, secrets)\n\topts = internal.PkgResourceDefaultOpts(opts)\n\tvar resource Client\n\terr := ctx.RegisterResource(\"gcp:iap/client:Client\", name, args, &resource, opts...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &resource, nil\n}", "func NewClientWithOptions(opts ...Option) (*Client, error) {\n\toptions := &Configuration{}\n\tfor _, opt := range opts {\n\t\topt(options)\n\t}\n\n\terr := options.Validate()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tc, err := NewClient(options)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn c, nil\n}", "func NewClient(transportFactory TransportFactory, options ...ClientOption) *Client {\n\tclient := &Client{\n\t\tTransportFactory: transportFactory,\n\t\tRetrier: retry.NewRetrier(),\n\t}\n\n\tfor _, option := range options {\n\t\toption(client)\n\t}\n\n\treturn client\n}", "func newClient(configuration *Configuration, options ...ClientOption) (Client, error) {\n\tclientCfg, err := newTLSClientConfig(configuration)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"error reading and/or parsing the certification files. Cause: %w\", err)\n\t}\n\n\tnetClient := http.Client{\n\t\tTransport: &http.Transport{\n\t\t\tTLSClientConfig: clientCfg,\n\t\t},\n\t}\n\n\tinstance := &client{client: &netClient, configuration: configuration, encoder: newJSONEncoder(), decoder: newJSONDecoder()}\n\n\t// Apply options if there are any, can overwrite default\n\tfor _, option := range options {\n\t\toption(instance)\n\t}\n\n\treturn instance, nil\n}", "func NewClient(ctx context.Context, options ...func(Party) error) (Client, error) {\n\tinfo, dbg := buildInfoDebugLogger(log.NewLogfmtLogger(os.Stderr), true)\n\tc := &client{\n\t\tstate: ClientCreated,\n\t\tstateChangeChans: make([]chan<- struct{}, 0),\n\t\tformat: \"json\",\n\t\tpartyBase: newPartyBase(ctx, info, dbg),\n\t\tlastID: -1,\n\t}\n\tfor _, option := range options {\n\t\tif option != nil {\n\t\t\tif err := option(c); err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t}\n\t}\n\tif c.conn == nil && c.connectionFactory == nil {\n\t\treturn nil, errors.New(\"neither WithConnection nor WithAutoReconnect option was given\")\n\t}\n\treturn c, nil\n}", "func New(opts ...ClientOption) *Client {\n\tcl := newDefaultClient()\n\tcl.opts = opts\n\treturn cl\n}", "func NewClient(option *Option) Client {\n\tc := &client{\n\t\toption: option,\n\t}\n\tif option.TLSConfig != nil {\n\t\tc.client = restclient.NewRESTClientWithTLS(option.TLSConfig)\n\t} else {\n\t\tc.client = restclient.NewRESTClient()\n\t}\n\treturn c\n}", "func NewClient(options ClientOptions) (*Client, error) {\n\tc := &Client{\n\t\thttpClient: &http.Client{},\n\t\toptions: options,\n\t}\n\terr := c.login()\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"login failed, %s\", err)\n\t}\n\treturn c, nil\n}", "func NewClient(options ...ClientOptionFunc) (c *Client, err error) {\n\ttr := &http.Transport{\n\t\tTLSClientConfig: &tls.Config{InsecureSkipVerify: true},\n\t}\n\tc = &Client{\n\t\tc: &http.Client{Transport: tr},\n\t}\n\n\tfor _, option := range options {\n\t\tif err := option(c); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\treturn c, err\n}", "func New(opt ...Option) Client {\n\n\topts := &Options{}\n\tfor _, o := range opt {\n\t\to(opts)\n\t}\n\n\treturn &defaultClient {\n\t\topts: opts,\n\t\tTransport: transport.DefaultClientTransport,\n\t}\n}", "func NewClient(key string, options ...clientOption) (*client, error) {\n\tvar url string\n\tif url = os.Getenv(\"TAPPAY_SERVER\"); url == \"\" {\n\t\turl = APIURL\n\t}\n\n\t// defaultTimeout is the default timeout on the http.Client used the by the library\n\t// This is chosen according to the document\n\t// https://docs.tappaysdk.com/tutorial/zh/back.html\n\tconst defaultTimeout = 30 * time.Second\n\thttpClient := &http.Client{\n\t\tTimeout: defaultTimeout,\n\t}\n\n\tcli := &client{\n\t\tpartnerKey: key,\n\t\thttpClient: httpClient,\n\t\turl: url,\n\t}\n\n\tfor _, option := range options {\n\t\toption(cli)\n\t}\n\tu, err := sanitizeURL(cli.url)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"supplied server %q is not valid: %v\", cli.url, err)\n\t}\n\tcli.url = u.String()\n\treturn cli, nil\n}", "func New(options ...Option) (*Client, error) {\n\tc := &Client{\n\t\thttpHost: \"http://localhost:8080\",\n\t\twsHost: \"ws://localhost:8080\",\n\t}\n\n\t// apply options\n\tfor _, option := range options {\n\t\tif err := option(c); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\treturn c, nil\n}", "func New(options Options, optFns ...func(*Options)) *Client {\n\toptions = options.Copy()\n\n\tresolveRetryer(&options)\n\n\tresolveHTTPClient(&options)\n\n\tresolveHTTPSignerV4(&options)\n\n\tresolveDefaultEndpointConfiguration(&options)\n\n\tresolveIdempotencyTokenProvider(&options)\n\n\tfor _, fn := range optFns {\n\t\tfn(&options)\n\t}\n\n\tclient := &Client{\n\t\toptions: options,\n\t}\n\n\treturn client\n}", "func New(config *rest.Config, options Options) (c Client, err error) {\n\tc, err = newClient(config, options)\n\tif err == nil && options.DryRun != nil && *options.DryRun {\n\t\tc = NewDryRunClient(c)\n\t}\n\treturn c, err\n}", "func NewClient(options ...ConfigOption) *Client {\n\tc := Client{\n\t\tconfig: Config{\n\t\t\thttpClient: http.DefaultClient,\n\t\t\tbaseURL: defaultBaseURL,\n\t\t\tcoin: defaultCoin,\n\t\t\tlogger: &NoopLogger{},\n\t\t},\n\t}\n\n\tc.Wallet = &walletService{client: &c}\n\n\tfor _, opt := range options {\n\t\topt(&c.config)\n\t}\n\treturn &c\n}", "func New(o *Opt) *Client {\n\treturn &Client{\n\t\to: o,\n\t}\n}", "func New(opts ...ClientOpt) (*Client, error) {\n\tc := NewClient()\n\tfor _, opt := range opts {\n\t\tif err := opt(c); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\treturn c, nil\n}", "func NewClient(opt ...requests.Option) Client {\n\treturn opt\n}", "func NewClient(options ClientOptions) Client {\n\tgenericInfo := generic{\n\t\tappName: options.LocalConfigProvider.GetApplication(),\n\t\tcomponentName: options.LocalConfigProvider.GetName(),\n\t\tlocalConfig: options.LocalConfigProvider,\n\t}\n\n\tif _, ok := options.LocalConfigProvider.(*config.LocalConfigInfo); ok {\n\t\treturn s2iClient{\n\t\t\tgeneric: genericInfo,\n\t\t\tclient: options.OCClient,\n\t\t}\n\t} else {\n\t\treturn kubernetesClient{\n\t\t\tgeneric: genericInfo,\n\t\t\tisRouteSupported: options.IsRouteSupported,\n\t\t\tclient: options.OCClient,\n\t\t}\n\t}\n}", "func NewClient(c *ConnectionOption) (*Client, error) {\n\tvar t transport\n\tswitch c.Interface {\n\tcase \"lan\":\n\t\tif c.IntegrityAlgorithm != RAKPAlgorithmIntegrity_None {\n\t\t\treturn nil, fmt.Errorf(\"unsupported integrity algorithm for lan: %s\", c.IntegrityAlgorithm.String())\n\t\t}\n\n\t\tif c.ConfidentialityAlgorithm != RAKPAlgorithmEncryto_None {\n\t\t\treturn nil, fmt.Errorf(\"unsupported confidentiality algorithm for lan: %s\", c.ConfidentialityAlgorithm.String())\n\t\t}\n\n\t\tt = newLan(c)\n\tcase \"lanplus\":\n\t\tif c.ConfidentialityAlgorithm != RAKPAlgorithmEncryto_None &&\n\t\t\tc.ConfidentialityAlgorithm != RAKPAlgorithmEncryto_AES_CBC_128 {\n\t\t\treturn nil, fmt.Errorf(\"unsupported confidentiality algorithm: %s\", c.ConfidentialityAlgorithm.String())\n\t\t}\n\t\tt = newLanPlus(c)\n\tdefault:\n\t\treturn nil, fmt.Errorf(\"unsupported interface: %s\", c.Interface)\n\t}\n\n\treturn &Client{\n\t\tConnectionOption: c,\n\t\ttransport: t,\n\t}, nil\n}", "func New(opts ...Option) *Client {\n\tc := defaultCfg()\n\n\tfor _, opt := range opts {\n\t\topt(c)\n\t}\n\n\treturn &Client{\n\t\tcfg: c,\n\t}\n}", "func NewClient(options ...ClientOption) *Client {\n\tclient := &Client{\n\t\tendpoint: Endpoint,\n\t\thttpClient: &http.Client{},\n\t\ttimeout: 5 * time.Second,\n\t}\n\n\tfor _, option := range options {\n\t\toption(client)\n\t}\n\n\tclient.httpClient.Timeout = client.timeout\n\n\tif client.instrumentationRegistry != nil {\n\t\ti := instrumentation.New(\"metadata\", client.instrumentationRegistry)\n\t\tclient.httpClient.Transport = i.InstrumentedRoundTripper()\n\t}\n\treturn client\n}", "func NewClient(endpoint string, options ...Option) *Client {\n\tc := &Client{endpoint: endpoint}\n\n\tfor _, option := range options {\n\t\toption(c)\n\t}\n\n\tif c.httpClient == nil {\n\t\tc.httpClient = http.DefaultClient\n\t}\n\n\treturn c\n}", "func New(opt *Options) *Client {\n\tsetDefaults(opt)\n\treturn &Client{\n\t\taddr: opt.Addr,\n\t\tuser: opt.User,\n\t\tpassword: opt.Password,\n\t\taccessCode: opt.AccessCode,\n\t\ttps: opt.Tps,\n\t\tsubmitSmRespCh: make(chan []string, 1),\n\t\tdeliverNotifCh: make(chan []string, 1),\n\t\tdeliverMsgCh: make(chan []string, 1),\n\t\tdeliverMsgPartCh: make(chan deliverMsgPart, 1),\n\t\tdeliverMsgCompleteCh: make(chan deliverMsgPart, 1),\n\t\tcloseChan: make(chan struct{}),\n\t\talertInterval: opt.KeepAlive,\n\t\ttimeout: opt.Timeout,\n\t\tdeliveryHandler: DefaultHandler,\n\t\tshortMessageHandler: DefaultHandler,\n\t\twg: new(sync.WaitGroup),\n\t\tlogger: opt.Logger,\n\t\tmuconn: new(sync.Mutex),\n\t\tmu: new(sync.Mutex),\n\t}\n}", "func NewClient(ctx context.Context, projectID string, opts ...option.ClientOption) (*Client, error) {\n\tclient, err := NewClientWithDatabase(ctx, projectID, DefaultDatabaseID, opts...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn client, nil\n}", "func New(opt Option) *Client {\n\treturn &Client{\n\t\ttoken: opt.Token,\n\t\taddr: opt.Addr,\n\t}\n}", "func New(info metadata.ClientInfo, options ...ClientOpt) *Client {\n\tc := &Client{\n\t\tInfo: info,\n\t\tHandlers: request.DefaultHandlers(),\n\t\tHTTPClient: &http.Client{\n\t\t\tTimeout: 60 * time.Second,\n\t\t\tTransport: &http.Transport{\n\t\t\t\tProxy: http.ProxyFromEnvironment,\n\t\t\t\tDialContext: (&net.Dialer{\n\t\t\t\t\tTimeout: 1 * time.Second,\n\t\t\t\t\tKeepAlive: 90 * time.Second,\n\t\t\t\t}).DialContext,\n\t\t\t\tTLSHandshakeTimeout: 3 * time.Second,\n\t\t\t\tMaxIdleConns: 100,\n\t\t\t\tMaxIdleConnsPerHost: 8,\n\t\t\t\tIdleConnTimeout: 90 * time.Second,\n\t\t\t},\n\t\t},\n\t}\n\n\t// Apply options\n\tfor _, option := range options {\n\t\toption(c)\n\t}\n\n\treturn c\n}", "func NewClient(opt *Option) (*Client, error) {\n\t// validates option.\n\tif err := opt.Validate(); err != nil {\n\t\treturn nil, err\n\t}\n\n\t// new esb client.\n\tnewClient := &Client{endpoints: opt.Endpoints, schema: \"http\"}\n\n\t// tls config.\n\tvar tlsConf *tls.Config\n\tvar err error\n\n\t// build tls.\n\tif len(opt.CAFile) != 0 || len(opt.CertFile) != 0 || len(opt.KeyFile) != 0 {\n\t\tif tlsConf, err = ssl.ClientTLSConfVerify(opt.CAFile, opt.CertFile, opt.KeyFile, opt.Password); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tnewClient.schema = \"https\"\n\t}\n\n\t// create http client.\n\thttpClient := &http.Client{\n\t\tTransport: &http.Transport{\n\t\t\tProxy: http.ProxyFromEnvironment,\n\t\t\tDial: (&net.Dialer{Timeout: defaultDialerTimeout}).Dial,\n\t\t\tTLSHandshakeTimeout: defaultTLSHandshakeTimeout,\n\t\t\tTLSClientConfig: tlsConf,\n\t\t\tMaxConnsPerHost: defaultMaxConnsPerHost,\n\t\t\tMaxIdleConnsPerHost: defaultMaxIdleConnsPerHost,\n\t\t\tIdleConnTimeout: defaultIdleConnTimeout,\n\t\t},\n\t}\n\tnewClient.client = httpClient\n\n\treturn newClient, nil\n}", "func NewClient(options Options) *Client {\n\tif options.Timeout.String() == \"\" {\n\t\toptions.Timeout = 30 * time.Second\n\t}\n\n\tteamsClient := &Client{\n\t\thttpClient: &http.Client{\n\t\t\tTimeout: options.Timeout,\n\t\t},\n\t\toptions: &options,\n\t}\n\n\treturn teamsClient\n}", "func NewClient(opts ...ClientOps) ClientInterface {\n\n\t// Create a client with defaults\n\tc := &Client{\n\t\toptions: &ClientOptions{\n\t\t\thttpOptions: DefaultHTTPOptions(),\n\t\t\tsearchOptions: DefaultSearchOptions(),\n\t\t\tuserAgent: defaultUserAgent,\n\t\t},\n\t}\n\n\t// Overwrite defaults with any set by user\n\tfor _, opt := range opts {\n\t\topt(c.options)\n\t}\n\n\t// Set a default http client if one does not exist\n\tif c.options.httpClient == nil {\n\t\tc.options.httpClient = createDefaultHTTPClient(c)\n\t}\n\n\treturn c\n}", "func NewClient(conf *ClientConfig, opt ...grpc.DialOption) *Client {\n\tc := new(Client)\n\tif err := c.SetConfig(conf); err != nil {\n\t\tpanic(err)\n\t}\n\tc.UseOpt(opt...)\n\tc.Use(c.recovery(), c.handle())\n\treturn c\n}", "func NewClient(opts *ClientOptions) *Client {\n\treturn &Client{options: opts}\n}", "func NewClient(opts *Options) Client {\n\treturn &client{\n\t\topts: opts,\n\t}\n}", "func New(opts ClientOptions) Client {\n\taddress := opts.Address\n\tif address == \"\" {\n\t\taddress = defaultAddress\n\t}\n\n\thttpClient := opts.HTTPClient\n\tif httpClient == nil {\n\t\thttpClient = clean.DefaultPooledClient()\n\t\thttpClient.Timeout = defaultTimeout\n\t}\n\n\tlogger := opts.Logger\n\tif logger == nil {\n\t\tlogger = loggy.Discard()\n\t}\n\n\treturn &client{\n\t\taddress: address,\n\t\ttoken: opts.Token,\n\t\thttpClient: httpClient,\n\t\tlog: logger,\n\t}\n}", "func NewClient(options ...DNSOption) networkservice.NetworkServiceClient {\n\tvar c = &dnsContextClient{\n\t\tchainContext: context.Background(),\n\t\tdefaultNameServerIP: \"127.0.0.1\",\n\t\tresolveConfigPath: \"/etc/resolv.conf\",\n\t}\n\tfor _, o := range options {\n\t\to.apply(c)\n\t}\n\n\tc.initialize()\n\n\treturn c\n}", "func New(options ...Option) *Client {\n\t// Instantiate client with static defaults.\n\tc := &Client{\n\t\tbuilder: &noopBuilder{output: os.Stdout},\n\t\tpusher: &noopPusher{output: os.Stdout},\n\t\tdeployer: &noopDeployer{output: os.Stdout},\n\t\trunner: &noopRunner{output: os.Stdout},\n\t\tremover: &noopRemover{output: os.Stdout},\n\t\tlister: &noopLister{output: os.Stdout},\n\t\tdnsProvider: &noopDNSProvider{output: os.Stdout},\n\t\tprogressListener: &noopProgressListener{},\n\t}\n\n\t// Apply passed options, which take ultimate precidence.\n\tfor _, o := range options {\n\t\to(c)\n\t}\n\treturn c\n}", "func NewClient(c context.Context, opts ...ClientOption) (*Client, error) {\n\tcl := &Client{\n\t\tkeepAlive: 60 * time.Second,\n\t\thandshakeTimeout: 10 * time.Second,\n\t}\n\n\tvar err error\n\n\t// execute all options\n\tfor _, opt := range opts {\n\t\tif err = opt(c, cl); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\tcl.setClient()\n\n\treturn cl, nil\n}", "func NewClient(clientOptions *ClientOptions) (*Client, error) {\n\tctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)\n\tdefer cancel()\n\n\turi := \"mongodb://\" + clientOptions.Host + \":\" + clientOptions.Port\n\toptions := options.Client().ApplyURI(uri)\n\toptions.SetMaxPoolSize(10)\n\tclient, err := mongo.Connect(ctx, options)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn &Client{\n\t\tDatabase: client.Database(clientOptions.Name),\n\t}, nil\n}", "func New(opts ...FnOption) (c Client, err error) {\n\to := new(Option).Assign(opts...).Default()\n\terr = o.Validate()\n\tif err != nil {\n\t\treturn\n\t}\n\n\tc = (new(client)).Assign(o)\n\treturn\n}", "func New(host string, options Options) *Client {\n\tif options.DebugPrintf == nil {\n\t\toptions.DebugPrintf = log.Printf // default debug Printf\n\t}\n\treturn &Client{host: host, opt: options}\n}", "func NewClient(options ...ErgOptions) (*ErgClient, error) {\n\tif len(options) > 1 {\n\t\treturn nil, errors.New(\"too many options provided. Expects no or just one item\")\n\t}\n\n\topts := DefaultOptions\n\n\tif len(options) == 1 {\n\t\toption := options[0]\n\n\t\tif option.BaseUrl != \"\" {\n\t\t\topts.BaseUrl = option.BaseUrl\n\t\t}\n\n\t\tif option.Doer != nil {\n\t\t\topts.Doer = option.Doer\n\t\t}\n\n\t\tif option.ApiKey != \"\" {\n\t\t\topts.ApiKey = option.ApiKey\n\t\t}\n\t}\n\n\tc := &ErgClient{\n\t\tOptions: opts,\n\t}\n\n\treturn c, nil\n}", "func NewClient(config *Config) *Client {\n\tc := &Client{config: defaultConfig.Merge(config)}\n\n\treturn c\n}", "func NewClient(confs ...ClientConfiguration) *Client {\n\tq := setupClient()\n\n\t// Loop through the configurations and apply them to the client.\n\tfor _, c := range confs {\n\t\tc(q)\n\t}\n\n\treturn q\n}", "func NewClient(options ...ClientOption) (*Client, error) {\n\tc := &Client{\n\t\thttpClient: http.DefaultClient,\n\t\tbaseURL: DefaultBaseURL,\n\t\tlangs: append([]Lang{DefaultLang}, Langs...),\n\t}\n\tfor _, o := range options {\n\t\to(c)\n\t}\n\ttags := make([]language.Tag, len(c.langs))\n\tfor i, lang := range c.langs {\n\t\ttag, err := language.Parse(string(lang))\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\ttags[i] = tag\n\t}\n\tc.matcher = language.NewMatcher(tags)\n\treturn c, nil\n}", "func NewClient(d *schema.ResourceData, terraformVersion string, options client.Options) (client.Client, error) {\n\t// Config initialization\n\tcfg, err := GetConfig(d, terraformVersion)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn client.New(cfg, options)\n}", "func NewClient(option *Option) (*Client, error) {\n\thttpClient := http.DefaultClient\n\tbaseURL, _ := url.Parse(defaultBaseURL)\n\n\tc := &Client{client: httpClient, BaseURL: baseURL, UserAgent: userAgent, Option: option}\n\tc.SizesService = &SizesService{client: c}\n\tc.RegionsService = &RegionsService{client: c}\n\tc.DropletsService = &DropletsService{client: c}\n\tc.ImagesService = &ImagesService{client: c, Page: 1, PerPage: 50}\n\tc.SSHKeysService = &SSHKeysService{client: c}\n\tc.AccountService = &AccountService{client: c}\n\n\treturn c, nil\n}", "func NewClient(cfg *Config, args ...interface{}) (endpoint.Connector, error) {\n\treturn cfg.newClient(args)\n}", "func NewClient(cfg *api.Config, address, name string, port int) (Client, error) {\n\n\tc, err := api.NewClient(cfg)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tfmt.Println(\">>> Started a new Consul client.\")\n\treturn &client{\n\t\tclient: c,\n\t\tname: name,\n\t\taddress: address,\n\t\tport: port,\n\t}, nil\n}", "func NewClient(endpoint string, options *Options) *Client {\n\treturn &Client{\n\t\tmu: new(sync.Mutex),\n\t\tendpoint: endpoint,\n\t\toptions: options,\n\t}\n}", "func NewClient(appID int, appHash string, opt Options) *Client {\n\topt.setDefaults()\n\n\tmode := manager.ConnModeUpdates\n\tif opt.NoUpdates {\n\t\tmode = manager.ConnModeData\n\t}\n\tclient := &Client{\n\t\trand: opt.Random,\n\t\tlog: opt.Logger,\n\t\tappID: appID,\n\t\tappHash: appHash,\n\t\tupdateHandler: opt.UpdateHandler,\n\t\tsession: pool.NewSyncSession(pool.Session{\n\t\t\tDC: opt.DC,\n\t\t}),\n\t\tdomains: opt.DCList.Domains,\n\t\ttestDC: opt.DCList.Test,\n\t\tcfg: manager.NewAtomicConfig(tg.Config{\n\t\t\tDCOptions: opt.DCList.Options,\n\t\t}),\n\t\tcreate: defaultConstructor(),\n\t\tresolver: opt.Resolver,\n\t\tdefaultMode: mode,\n\t\tconnBackoff: opt.ReconnectionBackoff,\n\t\tclock: opt.Clock,\n\t\tdevice: opt.Device,\n\t\tmigrationTimeout: opt.MigrationTimeout,\n\t\tnoUpdatesMode: opt.NoUpdates,\n\t\tmw: opt.Middlewares,\n\t}\n\tif opt.TracerProvider != nil {\n\t\tclient.tracer = opt.TracerProvider.Tracer(oteltg.Name)\n\t}\n\tclient.init()\n\n\t// Including version into client logger to help with debugging.\n\tif v := version.GetVersion(); v != \"\" {\n\t\tclient.log = client.log.With(zap.String(\"v\", v))\n\t}\n\n\tif opt.SessionStorage != nil {\n\t\tclient.storage = &session.Loader{\n\t\t\tStorage: opt.SessionStorage,\n\t\t}\n\t}\n\n\tclient.opts = mtproto.Options{\n\t\tPublicKeys: opt.PublicKeys,\n\t\tRandom: opt.Random,\n\t\tLogger: opt.Logger,\n\t\tAckBatchSize: opt.AckBatchSize,\n\t\tAckInterval: opt.AckInterval,\n\t\tRetryInterval: opt.RetryInterval,\n\t\tMaxRetries: opt.MaxRetries,\n\t\tCompressThreshold: opt.CompressThreshold,\n\t\tMessageID: opt.MessageID,\n\t\tExchangeTimeout: opt.ExchangeTimeout,\n\t\tDialTimeout: opt.DialTimeout,\n\t\tClock: opt.Clock,\n\n\t\tTypes: getTypesMapping(),\n\n\t\tTracer: client.tracer,\n\t}\n\tclient.conn = client.createPrimaryConn(nil)\n\n\treturn client\n}", "func New(clientID string, options ...Option) (Client, error) {\n\topts := clientOptions{\n\t\tauthority: base.AuthorityPublicCloud,\n\t\thttpClient: shared.DefaultClient,\n\t}\n\n\tfor _, o := range options {\n\t\to(&opts)\n\t}\n\tif err := opts.validate(); err != nil {\n\t\treturn Client{}, err\n\t}\n\n\tbase, err := base.New(clientID, opts.authority, oauth.New(opts.httpClient), base.WithCacheAccessor(opts.accessor), base.WithClientCapabilities(opts.capabilities), base.WithInstanceDiscovery(!opts.disableInstanceDiscovery))\n\tif err != nil {\n\t\treturn Client{}, err\n\t}\n\treturn Client{base}, nil\n}", "func NewClient(cfg Config) (*Client, error) {\n\tvar (\n\t\tc Client\n\t\tv *validator.Validate\n\t\terr error\n\t)\n\n\tv = validator.New()\n\n\terr = v.Struct(cfg)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tc.cfg = cfg\n\tc.clntCredCfg = clientcredentials.Config{\n\t\tClientID: cfg.ClientID,\n\t\tClientSecret: cfg.ClientSecret,\n\t}\n\n\tc.oauth = OAuth{\n\t\tClientID: cfg.ClientID,\n\t\tClientSecret: cfg.ClientSecret,\n\t}\n\n\terr = c.SetRegionParameters(cfg.Region, cfg.Locale)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn &c, nil\n}", "func NewClient(op Options, limit int) *Client {\n\treturn &Client{\n\t\tOptions: op,\n\t\tLimit: limit,\n\t\tlimitCh: make(chan struct{}, limit),\n\t}\n}", "func NewClient(with ...ClientOption) *Client {\n\ttimeout := DefaultTimeout\n\n\tclient := &Client{\n\t\tclient: &http.Client{\n\t\t\tTimeout: timeout,\n\t\t},\n\t\tbase: getBaseURL(url.URL{\n\t\t\tScheme: \"https\",\n\t\t\tHost: \"api.secrethub.io\",\n\t\t}),\n\t\tuserAgent: DefaultUserAgent,\n\t}\n\tclient.Options(with...)\n\treturn client\n}", "func NewClient(options ...func(c *Client)) *Client {\n\tc := &Client{}\n\tfor _, option := range options {\n\t\toption(c)\n\t}\n\n\t// Set default user-agent if not set\n\tif c.UserAgent == \"\" {\n\t\tc.UserAgent = \"wporg/1.0\"\n\t}\n\n\t// Set default client if not set\n\tif c.HTTPClient == nil {\n\t\tc.HTTPClient = getDefaultClient()\n\t}\n\n\treturn c\n}", "func NewClient(opts ...Option) *Client {\n\tc := config{log: log.Println}\n\tc.options(opts...)\n\treturn &Client{\n\t\tconfig: c,\n\t\tSchema: migrate.NewSchema(c.driver),\n\t\tModule: NewModuleClient(c),\n\t\tModuleVersion: NewModuleVersionClient(c),\n\t}\n}", "func NewClient(opts ClientOptions) Client {\n\tif opts.ServiceURL == \"\" {\n\t\topts.ServiceURL = ServiceURL\n\t}\n\tif opts.AnonymousClient == nil {\n\t\topts.AnonymousClient = http.DefaultClient\n\t}\n\tif opts.AuthenticatedClient == nil {\n\t\topts.AuthenticatedClient = opts.AnonymousClient\n\t}\n\tif opts.UserAgent == \"\" {\n\t\topts.UserAgent = UserAgent\n\t}\n\treturn &clientImpl{\n\t\tClientOptions: opts,\n\t\tremote: &remoteImpl{\n\t\t\tserviceURL: opts.ServiceURL,\n\t\t\tuserAgent: opts.UserAgent,\n\t\t\tclient: opts.AuthenticatedClient,\n\t\t},\n\t\tstorage: &storageImpl{\n\t\t\tchunkSize: uploadChunkSize,\n\t\t\tuserAgent: opts.UserAgent,\n\t\t\tclient: opts.AnonymousClient,\n\t\t},\n\t\tdeployer: local.NewDeployer(opts.Root),\n\t}\n}", "func NewClient(opts ClientOptions) *Client {\n\treturn &Client{\n\t\tbaseUrl: opts.baseUrl(),\n\t\topts: &opts,\n\t}\n}", "func New(opts ...Option) (*Client, error) {\n\tcfg := options{\n\t\tlog: logrus.New(),\n\t}\n\n\tfor _, opt := range opts {\n\t\topt(&cfg)\n\t}\n\n\tcli := Client{\n\t\ttarget: cfg.target,\n\t\tclient: http.Client{\n\t\t\tTimeout: timeout * time.Second,\n\t\t},\n\t}\n\n\treturn &cli, nil\n}", "func NewClient(cfg *Config) *Client {\n\treturn &Client{\n\t\tcfg: cfg,\n\t}\n}", "func NewClient(opts ...Option) *Client {\n\tvar client Client\n\tclient.Client = &http.Client{}\n\t// client.Option(Timeout(30))\n\tclient.Option(opts...)\n\tclient.Timeout = client.opts.timeout\n\treturn &client\n}", "func NewClient(config Config) Client {\n\treturn DefaultClient{\n\t\tconfig: config,\n\t}\n}", "func NewClient(opts ...func(c *Client) error) (*Client, error) {\n\tc := &Client{\n\t\tclient: http.DefaultClient,\n\t\tBasePath: basePath,\n\t}\n\tc.common.client = c\n\tfor _, opt := range opts {\n\t\tif err := opt(c); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\tc.Run = (*RunService)(&c.common)\n\n\treturn c, nil\n}", "func NewClient(list, create, show, update, delete_ goa.Endpoint) *Client {\n\treturn &Client{\n\t\tListEndpoint: list,\n\t\tCreateEndpoint: create,\n\t\tShowEndpoint: show,\n\t\tUpdateEndpoint: update,\n\t\tDeleteEndpoint: delete_,\n\t}\n}", "func NewClient(token string, opts ...ClientOption) Client {\n\tc := &client{\n\t\ttoken: token,\n\t\tbaseUrl: defaultBaseUrl,\n\t\thttpClient: &http.Client{},\n\t}\n\n\tfor _, opt := range opts {\n\t\topt.apply(c)\n\t}\n\n\treturn c\n}", "func NewClient(cfg *Config) (*Client, error) {\r\n\tBaseURL := new(url.URL)\r\n\tvar err error\r\n\r\n\tviper.SetEnvPrefix(\"TS\")\r\n\tviper.BindEnv(\"LOG\")\r\n\r\n\tswitch l := viper.Get(\"LOG\"); l {\r\n\tcase \"trace\":\r\n\t\tlog.SetLevel(log.TraceLevel)\r\n\tcase \"debug\":\r\n\t\tlog.SetLevel(log.DebugLevel)\r\n\tcase \"info\":\r\n\t\tlog.SetLevel(log.InfoLevel)\r\n\tcase \"warn\":\r\n\t\tlog.SetLevel(log.WarnLevel)\r\n\tcase \"fatal\":\r\n\t\tlog.SetLevel(log.FatalLevel)\r\n\tcase \"panic\":\r\n\t\tlog.SetLevel(log.PanicLevel)\r\n\t}\r\n\r\n\tif cfg.BaseURL != \"\" {\r\n\t\tBaseURL, err = url.Parse(cfg.BaseURL)\r\n\t\tif err != nil {\r\n\t\t\treturn nil, err\r\n\t\t}\r\n\t} else {\r\n\t\tBaseURL, err = url.Parse(defaultBaseURL)\r\n\t\tif err != nil {\r\n\t\t\treturn nil, err\r\n\t\t}\r\n\t}\r\n\r\n\tnewClient := &Client{\r\n\t\tBaseURL: BaseURL,\r\n\t\tclient: http.DefaultClient,\r\n\t\tcreds: &Credentials{\r\n\t\t\tAPIKey: cfg.APIKey,\r\n\t\t\tOrganizationID: cfg.OrganizationID,\r\n\t\t\tUserID: cfg.UserID,\r\n\t\t},\r\n\t}\r\n\r\n\tnewClient.Rulesets = &RulesetService{newClient}\r\n\tnewClient.Rules = &RuleService{newClient}\r\n\r\n\treturn newClient, nil\r\n}" ]
[ "0.7874265", "0.781066", "0.7621724", "0.74696696", "0.74487823", "0.7431415", "0.741714", "0.7393907", "0.732049", "0.7303147", "0.7297823", "0.7295807", "0.7292489", "0.7253151", "0.72078866", "0.71829766", "0.71472573", "0.7147141", "0.714478", "0.7140239", "0.71375835", "0.71149063", "0.71064323", "0.709505", "0.7080346", "0.70791554", "0.7067566", "0.706385", "0.7063553", "0.7056522", "0.70400625", "0.702269", "0.7021585", "0.69852775", "0.6955914", "0.6955749", "0.695393", "0.6949361", "0.6947465", "0.6943995", "0.6916361", "0.6892448", "0.6870517", "0.6863368", "0.6860412", "0.6848323", "0.6842198", "0.6839511", "0.68317676", "0.68162614", "0.6814952", "0.6807372", "0.6802256", "0.6799033", "0.67969924", "0.67851835", "0.67816293", "0.6780756", "0.6758341", "0.6751406", "0.6749455", "0.67348653", "0.6734549", "0.6733902", "0.67287976", "0.67281944", "0.67273456", "0.672272", "0.6720167", "0.67188495", "0.6716539", "0.6707774", "0.6695773", "0.66916746", "0.6688769", "0.66874915", "0.66757524", "0.6674901", "0.6668067" ]
0.701668
47
Open opens a database/sql.DB specified by the driver name and the data source name, and returns a new client attached to it. Optional parameters can be added for configuring the client.
func Open(driverName, dataSourceName string, options ...Option) (*Client, error) { switch driverName { case dialect.MySQL, dialect.Postgres, dialect.SQLite: drv, err := sql.Open(driverName, dataSourceName) if err != nil { return nil, err } return NewClient(append(options, Driver(drv))...), nil default: return nil, fmt.Errorf("unsupported driver: %q", driverName) } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func Open(driverName, dataSourceName string, options ...Option) (*Client, error) {\n\tswitch driverName {\n\tcase dialect.MySQL, dialect.SQLite:\n\t\tdrv, err := sql.Open(driverName, dataSourceName)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn NewClient(append(options, Driver(drv))...), nil\n\n\tdefault:\n\t\treturn nil, fmt.Errorf(\"unsupported driver: %q\", driverName)\n\t}\n}", "func NewClient(\n\tdriver string,\n\tdatasource string,\n) (DbClient, error) {\n\tdb, err := sql.Open(driver, datasource)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &Client{\n\t\tdb: db,\n\t}, nil\n}", "func Open(driverName, dataSourceName string) (*DB, error) {\n db, err := sql.Open(driverName, dataSourceName)\n if err != nil {\n return nil, err\n }\n return &DB{DB: db, driverName: driverName, Mapper: mapper()}, err\n}", "func Open(driver, source string) (*DB, error) {\n\tdb, err := sql.Open(driver, source)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &DB{\n\t\tDB: db,\n\t\twrap: &wrap{conn: db},\n\t}, nil\n}", "func Open(dataSourceName string) (*DB, error) {\n\tdb, err := mgo.Dial(dataSourceName)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &DB{db}, nil\n}", "func Open() (DB, error) {\n\tif config.Bridge.DB.Driver != \"sqlserver\" {\n\t\treturn nil, errors.New(\"only sqlserver is supported at the moment\")\n\t}\n\n\tquery := url.Values{}\n\tquery.Add(\"database\", config.Bridge.DB.Name)\n\n\tconnURL := &url.URL{\n\t\tScheme: \"sqlserver\",\n\t\tUser: url.UserPassword(config.Bridge.DB.User, config.Bridge.DB.Password),\n\t\tHost: fmt.Sprintf(\"%s:%d\", config.Bridge.DB.Host, config.Bridge.DB.Port),\n\t\tRawQuery: query.Encode(),\n\t}\n\n\tdbConn, err := sql.Open(config.Bridge.DB.Driver, connURL.String())\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"could not create db connection pool\")\n\t}\n\n\tif err := dbConn.Ping(); err != nil {\n\t\tdbConn.Close()\n\t\treturn nil, errors.Wrap(err, \"could not connect to database server\")\n\t}\n\treturn &db{dbConn}, nil\n}", "func Open(driverName, masterDSN string, replicasDSNs []string) (*DB, error) {\n\tconns := make([]string, 0, len(replicasDSNs)+1)\n\tconns = append(conns, masterDSN)\n\tconns = append(conns, replicasDSNs...)\n\n\tdb := &DB{\n\t\tcpdbs: make([]*connection, len(conns)),\n\t}\n\n\terr := scatter(len(db.cpdbs), func(i int) (err error) {\n\t\tconn, err := sql.Open(driverName, conns[i])\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\terr = conn.Ping()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tdb.cpdbs[i] = new(connection)\n\t\tdb.cpdbs[i].db = conn\n\n\t\treturn nil\n\t})\n\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn db, nil\n}", "func Open(driverName, dataSourceName string) (*DB, error) {\n\tdb, err := sql.Open(driverName, dataSourceName)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &DB{\n\t\tDB: db,\n\t\tMapper: names.NewCacheMapper(&names.SnakeMapper{}),\n\t\treflectCache: make(map[reflect.Type]*cacheStruct),\n\t}, nil\n}", "func Open(driverName, dataSourceNames string) (db *DB, err error) {\n\tdsns := strings.Split(dataSourceNames, \";\")\n\tif len(dsns) < 2 {\n\t\treturn nil, fmt.Errorf(\"At least one master and worker DB are required\")\n\t}\n\n\tdb = &DB{\n\t\tdriverName: driverName,\n\t\tconnInfo: make(map[uint32]string),\n\t\tsick: make(map[uint32]struct{}),\n\t\tresurrect: make(map[uint32]*sql.DB),\n\t}\n\n\tmaster, err := sql.Open(driverName, dsns[0])\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar workers []*sql.DB\n\tfor i, dsn := range dsns[1:] {\n\t\tworker, err := sql.Open(driverName, dsn)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tdb.connInfo[uint32(i)] = dsn\n\t\tworkers = append(workers, worker)\n\t}\n\n\treturn db.newDB(master, workers...)\n}", "func Open(driverName, dataSourceName string) (*DB, error) {\n\tvar ez DB\n\tvar err error\n\n\tez.DB, err = sql.Open(driverName, dataSourceName)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tez.dbTag, ez.dbjsonTag, ez.dbskipTag = \"db\", \"dbjson\", \"dbskip\"\n\n\treturn &ez, nil\n}", "func (d *Driver) Open(connStr string) (driver.Conn, error) {\n\trestClient, err := NewRestClient(nil, connStr)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefaultDb, ok := restClient.params[\"DEFAULTDB\"]\n\tif !ok {\n\t\tdefaultDb, _ = restClient.params[\"DB\"]\n\t}\n\treturn &Conn{restClient: restClient, defaultDb: defaultDb}, nil\n}", "func New(dsn string) (*Client, error) {\n\tdb, err := sql.Open(\"postgres\", dsn)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn &Client{db: db}, nil\n}", "func Open(dsn string) *sql.DB {\n\treturn sql.OpenDB(connector{dsn})\n}", "func (c *client) Open() error {\n\n\tsslmode := \"require\"\n\tif c.config.Environment == \"DEV\" {\n\t\tsslmode = \"disable\"\n\t}\n\tconnectionStr := fmt.Sprintf(\"host=%s port=%s user=%s \"+\n\t\t\"password=%s dbname=%s search_path=%s sslmode=%s\",\n\t\tc.config.Database.Host, c.config.Database.Port, c.config.Database.User,\n\t\tc.config.Database.Password, c.config.Database.DB, c.config.Database.Schema, sslmode,\n\t)\n\n\t// pq.Driver\n\tdriverName := c.config.Database.Dialect + \"WithHooks\"\n\tsql.Register(driverName, sqlhooks.Wrap(&pq.Driver{}, &Hooks{}))\n\n\t// driverName := c.config.Database.Dialect\n\tsqlDatabase, err := sql.Open(driverName, connectionStr)\n\n\tdatabase := sqlx.NewDb(sqlDatabase, c.config.Database.Dialect)\n\n\tif err != nil {\n\t\treturn err\n\t}\n\tc.db = database\n\n\tif err = database.Ping(); err != nil {\n\t\tlog.Fatal(err)\n\t\tos.Exit(1)\n\t}\n\n\treturn nil\n}", "func (c *Client) Open(source string) error {\n\tvar err error\n\n\tc.logger.Debug().Msg(\"connecting to db\")\n\tc.db, err = gorm.Open(\"postgres\", source)\n\tif err != nil {\n\t\tc.logger.Err(err).Msg(\"sql open failed\")\n\t\treturn err\n\t}\n\n\terr = c.db.DB().Ping()\n\tif err != nil {\n\t\tc.logger.Err(err).Msg(\"sql ping failed\")\n\t\treturn err\n\t}\n\tc.logger.Debug().Msg(\"connected to db\")\n\n\tc.db.SingularTable(true)\n\n\treturn nil\n}", "func Open(dataSourceName string) (*sql.DB, error) {\n\treturn sql.Open(\"postgres\", dataSourceName)\n}", "func NewClient(cfg *Config) *sql.DB {\n\tpsqlInfo := fmt.Sprintf(\"host=%s port=%d user=%s password=%s dbname=%s sslmode=disable\",\n\t\tcfg.Host, cfg.Port, cfg.User, cfg.Password, cfg.Database,\n\t)\n\n\tdb, err := sql.Open(\"postgres\", psqlInfo)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\treturn db\n}", "func Open(driverName, dsn string) (*DB, error) {\n\tswitch driverName {\n\tcase \"mysql\":\n\tdefault:\n\t\tdsn = fmt.Sprintf(\"%s://%s\", driverName, dsn)\n\t}\n\n\tctx, cancel := context.WithTimeout(context.Background(), 5*time.Second)\n\tdefer cancel()\n\n\tdbC := make(chan *sql.DB, 1)\n\terrC := make(chan error, 1)\n\n\tgo func(driverName, dsn string) {\n\t\tdb, err := sql.Open(driverName, dsn)\n\t\tif err != nil {\n\t\t\terrC <- err\n\t\t\treturn\n\t\t}\n\t\tdbC <- db\n\t}(driverName, dsn)\n\n\tselect {\n\tcase db := <-dbC:\n\t\t// see: https://github.com/go-sql-driver/mysql/issues/674\n\t\tdb.SetMaxIdleConns(0)\n\t\treturn &DB{db}, nil\n\tcase err := <-errC:\n\t\treturn nil, err\n\tcase <-ctx.Done():\n\t\treturn nil, errTimeout\n\t}\n}", "func Open(conf *config.DataStore) (Conn, error) {\n\tdriver, ok := drivers[conf.Driver]\n\tif !ok {\n\t\treturn nil, fmt.Errorf(\n\t\t\t\"backend: unknown driver %q (forgotten import?)\",\n\t\t\tconf.Driver,\n\t\t)\n\t}\n\tpool := driver.New(conf)\n\treturn pool, nil\n}", "func Open(name string, settings Settings) (Database, error) {\n\n\tdriver, ok := wrappers[name]\n\tif ok == false {\n\t\t// Using panic instead of returning error because attemping to use an\n\t\t// nonexistent adapter will never result in a successful connection,\n\t\t// therefore should be considered a developer's mistake and must be catched\n\t\t// at compilation time.\n\t\tpanic(fmt.Sprintf(\"Open: Unknown adapter %s. (see: https://upper.io/db#database-adapters)\", name))\n\t}\n\n\t// Creating a new connection everytime Open() is called.\n\tdriverType := reflect.ValueOf(driver).Elem().Type()\n\tnewAdapter := reflect.New(driverType).Interface().(Database)\n\n\t// Setting up the connection.\n\terr := newAdapter.Setup(settings)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn newAdapter, nil\n}", "func OpenDB(driver, dsn string, opts ...Option) (*sql.DB, error) {\n\tconfig := &dbConfig{\n\t\tlogger: log.NewNopLogger(),\n\t\tcensusTraceOptions: []ocsql.TraceOption{ocsql.WithAllTraceOptions()},\n\t\tmaxAttempts: 15,\n\t}\n\n\tfor _, opt := range opts {\n\t\topt(config)\n\t}\n\n\tif config.wrapWithCensus && !config.alreadyRegisteredDriver {\n\t\tdriverName, err := ocsql.Register(driver, config.censusTraceOptions...)\n\t\tif err != nil {\n\t\t\treturn nil, errors.Wrapf(err, \"wrapping driver %s with opencensus sql %s\", driver, driverName)\n\t\t}\n\t\tdriver = driverName\n\t}\n\n\tdb, err := sql.Open(driver, dsn)\n\tif err != nil {\n\t\treturn nil, errors.Wrapf(err, \"opening %s connection, dsn=%s\", driver, dsn)\n\t}\n\n\tvar dbError error\n\tfor attempt := 0; attempt < config.maxAttempts; attempt++ {\n\t\tdbError = db.Ping()\n\t\tif dbError == nil {\n\t\t\t// we're connected!\n\t\t\tbreak\n\t\t}\n\t\tinterval := time.Duration(attempt) * time.Second\n\t\tlevel.Info(config.logger).Log(driver, fmt.Sprintf(\n\t\t\t\"could not connect to db: %v, sleeping %v\", dbError, interval))\n\t\ttime.Sleep(interval)\n\t}\n\tif dbError != nil {\n\t\treturn nil, dbError\n\t}\n\n\treturn db, nil\n}", "func Open(name, connectionString string) (*sql.DB, error) {\n\tif err := CheckCodeEngine(name); err != nil {\n\t\treturn nil, err\n\t}\n\treturn sql.Open(name, connectionString)\n}", "func New(dsn string) (Client, error) {\n\tdb, err := sqlx.Connect(\"postgres\", dsn)\n\tif err != nil {\n\t\treturn Client{}, err\n\t}\n\n\treturn Client{db: db}, nil\n}", "func Open(dialect, source string) (*Driver, error) {\n\tdb, err := sql.Open(dialect, source)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn NewDriver(dialect, Conn{db}), nil\n}", "func Open(dataSourceName string) (*DB, error) {\n\tdb, err := sql.Open(\"mysql\", dataSourceName)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn &DB{DB: db}, nil\n}", "func (c *PGConnector) Open(cfg *config.Config) (*sql.DB, error) {\n\tsslmode := \"disable\"\n\tif cfg.DBSSLModeOption == \"enable\" {\n\t\tsslmode = \"require\"\n\t}\n\n\tdbstring := fmt.Sprintf(\"user=%s dbname=%s sslmode=%s password=%s host=%s port=%s\",\n\t\tcfg.DBUserName,\n\t\tcfg.DBName,\n\t\tsslmode,\n\t\tcfg.DBPassword,\n\t\tcfg.DBHostname,\n\t\tcfg.DBPort,\n\t)\n\n\treturn sql.Open(\"postgres\", dbstring)\n}", "func (c *PGConnector) Open(cfg *config.Config) (*sql.DB, error) {\n\tsslmode := \"disable\"\n\tif cfg.DBSSLModeOption == \"enable\" {\n\t\tsslmode = \"require\"\n\t}\n\n\tdbstring := fmt.Sprintf(\"user=%s dbname=%s sslmode=%s password=%s host=%s port=%s\",\n\t\tcfg.DBUserName,\n\t\tcfg.DBName,\n\t\tsslmode,\n\t\tcfg.DBPassword,\n\t\tcfg.DBHostname,\n\t\tcfg.DBPort,\n\t)\n\n\treturn sql.Open(\"postgres\", dbstring)\n}", "func (drv *Driver) Open() (*sql.DB, error) {\n\treturn sql.Open(\"sqlite3\", ConnectionString(drv.databaseURL))\n}", "func Open() (*sql.DB, error) {\n\tdb, err := sql.Open(\"postgres\", config.DSN())\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tif err := db.Ping(); err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn db, nil\n}", "func Open() Database {\n\tinitEnvConfigs()\n\tdbConfigs := getDBConfigs()\n\n\tdb, err := sqlx.Connect(\"postgres\", dbConfigs)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\treturn &dbase{db}\n}", "func Open() (*sql.DB, error) {\n\tdatabase := os.Getenv(\"DB_DATABASE\")\n\tdbUser := os.Getenv(\"DB_USERNAME\")\n\tdbPassword := os.Getenv(\"DB_PASSWORD\")\n\tdbHost := os.Getenv(\"DB_HOST\")\n\tconn := dbUser + \":\" + dbPassword + \"@tcp(\" + dbHost + \":3306)/\" + database\n\n\treturn sql.Open(os.Getenv(\"DB_CONNECTION\"), conn)\n}", "func Open(ctx context.Context, addr string, opts ...PGOpt) (*sql.DB, error) {\n\toptions := &pgOptions{\n\t\tdb: \"postgres\",\n\t\tuser: \"postgres\",\n\t\tpassword: \"\",\n\t\tdialAttempts: 5,\n\t}\n\tfor _, o := range opts {\n\t\to(options)\n\t}\n\n\tconnStr := fmt.Sprintf(\"postgres://%s:%s@%s/%s?sslmode=disable\",\n\t\tescp(options.user),\n\t\tescp(options.password),\n\t\taddr,\n\t\tescp(options.db))\n\n\tvar err error\n\tfor i := 0; i < options.dialAttempts; i++ {\n\t\tlog.Printf(\"Attempting connection %d of %d to %v\", i+1, options.dialAttempts, addr)\n\t\tvar db *sql.DB\n\t\tif db, err = connect(ctx, connStr); err == nil {\n\t\t\tlog.Printf(\"Connected\")\n\t\t\treturn db, nil\n\t\t}\n\t\tlog.Printf(\"Error connecting: %v\", err)\n\t\tif i < options.dialAttempts-1 {\n\t\t\tselect {\n\t\t\tcase <-ctx.Done():\n\t\t\t\treturn nil, ctx.Err()\n\t\t\tcase <-time.After(5 * time.Second):\n\t\t\t}\n\t\t}\n\t}\n\treturn nil, err\n}", "func Open(dsn string) (*Adapter, error) {\n\tvar err error\n\n\tadapter := &Adapter{sql.New(\"?\", false, errorFunc, incrementFunc)}\n\tadapter.DB, err = db.Open(\"sqlite3\", dsn)\n\n\treturn adapter, err\n}", "func Open(dsn string) (*sql.DB, error) {\n\tcfg, err := mysql.ParseDSN(dsn)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// MySQL flags that affect storage logic.\n\tcfg.ClientFoundRows = true // Return number of matching rows instead of rows changed.\n\tcfg.ParseTime = true // Parse time values to time.Time\n\tcfg.Loc = time.UTC\n\n\tdb, err := sql.Open(\"mysql\", cfg.FormatDSN())\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn db, db.Ping()\n}", "func Open(user, addr, dbName string) (*sql.DB, error) {\n\tc := &mysql.Config{\n\t\tUser: user,\n\t\tNet: \"tcp\",\n\t\tAddr: addr,\n\t\tDBName: dbName,\n\t\tCollation: \"utf8mb4_bin\",\n\t\tParseTime: true,\n\t}\n\n\treturn sql.Open(\"mysql\", c.FormatDSN())\n}", "func NewDBClient() (*sql.DB, error) {\n\t//var (\n\t//\tdbUser = os.Getenv(\"DB_USER\") // e.g. 'my-db-user'\n\t//\tdbPwd = os.Getenv(\"DB_PASS\") // e.g. 'my-db-password'\n\t//\tinstanceConnectionName = os.Getenv(\"INSTANCE_CONNECTION_NAME\") // e.g. 'project:region:instance'\n\t//\tdbName = os.Getenv(\"DB_NAME\") // e.g. 'my-database'\n\t//)\n\t//\n\t//socketDir, isSet := os.LookupEnv(\"DB_SOCKET_DIR\")\n\t//if !isSet {\n\t//\tsocketDir = \"/cloudsql\"\n\t//}\n\t//\n\t//var dbURI string\n\t//dbURI = fmt.Sprintf(\"%s:%s@unix(%s/%s)/%s?parseTime=true\", dbUser, dbPwd, socketDir, instanceConnectionName, dbName)\n\t//if os.Getenv(\"APP_MODE\") == \"DEBUG\" {\n\tdbURI := os.Getenv(\"CONNECTION_STRING\")\n\t//}\n\n\t// dbPool is the pool of database connections.\n\tdb, err := sql.Open(\"mysql\", dbURI)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"sql.Open: %v\", err)\n\t}\n\t// See \"Important settings\" section.\n\tdb.SetConnMaxLifetime(time.Minute * 3)\n\tdb.SetMaxOpenConns(10)\n\tdb.SetMaxIdleConns(10)\n\n\treturn db, nil\n}", "func New(dsn string) (*Client, error) {\n\tdb, err := gorm.Open(mysql.Open(dsn), &gorm.Config{})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tdb = db.Debug()\n\n\treturn &Client{db}, nil\n}", "func (*Driver) Open(name string) (driver.Conn, error) {\n\tif debug {\n\t\tfmt.Println(\"Driver Open:\", name)\n\t}\n\n\tif name == \"\" {\n\t\treturn nil, ErrInvalidArgs\n\t}\n\n\treturn &Conn{name}, nil\n}", "func Open(datasource string) (*UserDatabase, error) {\n\tdriver := strings.SplitN(datasource, \":\", 2)[0]\n\tlog.Printf(\"Connecting to %s\", datasource)\n\tdb, err := sqlx.Connect(driver, datasource)\n\tif err != nil {\n\t\treturn nil, errors.InternalError(err)\n\t}\n\tuserDB := UserDatabase{db}\n\treturn &userDB, nil\n}", "func (d *hdbDriver) Open(dsn string) (driver.Conn, error) {\n\tconnector, err := NewDSNConnector(dsn)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn connector.Connect(context.Background())\n}", "func Open(ctx context.Context, config settings.Database) (*Database, error) {\n\tvar (\n\t\t// Set defaults.\n\t\tdatabase = &Database{\n\t\t\tconfig: config,\n\t\t\ttable: config.Table,\n\t\t\tdriver: config.Driver,\n\t\t}\n\t\terr error\n\t)\n\n\t// By default, our table will be located in `network.dropout`.\n\t// But this location can be overridden.\n\tif database.table == \"\" {\n\t\tdatabase.table = \"network.dropout\"\n\t}\n\n\t// The ability to change the driver is so that way we can easily test this\n\t// code against go-sqlmock. In practice, we normally won't ever need to do\n\t// this, but we may use the `config.Driver` option to specify the type of\n\t// database interface we plan on using so we can swap easily.\n\tif database.driver == \"\" {\n\t\tdatabase.driver = \"postgres\"\n\t}\n\n\t// Create the query once.\n\tdatabase.query = fmt.Sprintf(\n\t\t\"INSERT INTO %s (at) VALUES (current_timestamp);\",\n\t\tdatabase.table,\n\t)\n\n\t// Connect to our database.\n\tdatabase.DB, err = sql.Open(database.driver, config.DSN)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// Ensure that it's actually there.\n\tif err = database.DB.PingContext(ctx); err != nil {\n\t\treturn nil, err\n\t}\n\n\t// Finally done.\n\treturn database, nil\n}", "func Open(connStr string) (*sqlx.DB, error) {\n\treturn sqlx.Open(\"postgres\", connStr)\n}", "func Open(driverName, source string) (Conn, error) {\n\tdrv, found := drivers[driverName]\n\tif !found {\n\t\treturn nil, fmt.Errorf(\"morsel: driver '%s' not found. (did you import it?)\", driverName)\n\t}\n\n\treturn drv.Open(source)\n}", "func (c *SQLClient) OpenConn(user string, pass string) (*gorm.DB, error) {\n\tdsnConfig := mysql.NewConfig()\n\tdsnConfig.Net = \"tcp\"\n\tdsnConfig.Addr = fmt.Sprintf(\"%s:%d\", c.config.Host, c.config.Port)\n\tdsnConfig.User = user\n\tdsnConfig.Passwd = pass\n\tdsnConfig.Timeout = time.Second * 5\n\tdsnConfig.ParseTime = true\n\tdsnConfig.Loc = time.Local\n\tdsnConfig.MultiStatements = true // TODO: Disable this, as it increase security risk.\n\tdsnConfig.TLSConfig = c.config.TLSKey\n\tdsn := dsnConfig.FormatDSN()\n\n\tdb, err := gorm.Open(mysqlDriver.Open(dsn))\n\tif err != nil {\n\t\tlog.Warn(\"Failed to open SQL connection\",\n\t\t\tzap.String(\"targetComponent\", distro.R().TiDB),\n\t\t\tzap.Error(err))\n\t\tif mysqlErr, ok := err.(*mysql.MySQLError); ok {\n\t\t\tif mysqlErr.Number == mysqlerr.ER_ACCESS_DENIED_ERROR {\n\t\t\t\treturn nil, ErrAuthFailed.New(\"Bad SQL username or password\")\n\t\t\t}\n\t\t}\n\t\treturn nil, ErrConnFailed.Wrap(err, \"Failed to connect to %s\", distro.R().TiDB)\n\t}\n\n\t// Ensure that when the App stops resources are released\n\tif c.config.BaseContext != nil {\n\t\tdb = db.WithContext(c.config.BaseContext)\n\t}\n\n\treturn db, nil\n}", "func (s *Driver) Open(name string) (c driver.Conn, err error) {\n\tif trace {\n\t\tdefer func() {\n\t\t\ttracer(s, \"Open(%s): (%v, %v)\", name, c, err)\n\t\t}()\n\t}\n\treturn newConn(s, name)\n}", "func Open(redisAddr, redisPassword string) *DB {\n\treturn &DB{redisAddr, redisPassword}\n}", "func (d *DriverWrapper) Open(name string) (driver.Conn, error) {\n\tconn, err := d.Driver.Open(name)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tswitch connType := reflect.TypeOf(conn).String(); connType {\n\tcase \"*mysql.mysqlConn\":\n\t\treturn &ConnWrapper{Conn: conn, dsn: name, integration: &mysqlIntegration{}}, nil\n\n\tcase \"*pq.conn\":\n\t\treturn &ConnWrapper{Conn: conn, dsn: name, integration: &postgresqlIntegration{}}, nil\n\t}\n\treturn conn, nil\n}", "func Open(c string) (*sql.DB, error) {\n\treturn sql.Open(\"postgres\", c)\n\n}", "func Open(cfg Config) (DBEngine, error) {\n\tdb, err := gorm.Open(cfg.DSN())\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &DB{\n\t\tdb: db,\n\t}, nil\n}", "func Open(filename string) (*DB, error) {\n\tdb, err := sdb.OpenFile(filename)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &DB{\n\t\tdb: db,\n\t}, nil\n}", "func Open(ctx context.Context, t *testing.T, dbCfg psql.Config) *sql.DB {\n\t// Create test database\n\tdb, err := psql.Open(ctx, dbCfg)\n\tif err != nil {\n\t\tt.Fatalf(\"err opening test db: %v\", err)\n\t}\n\ttestDbName := t.Name()\n\tt.Logf(\"creating test db: %s\", testDbName)\n\terr = createTestDb(testDbName, db)\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\t// Open test database\n\tdbCfg.DBName = testDbName\n\ttdb, err := psql.Open(ctx, dbCfg)\n\tif err != nil {\n\t\tt.Fatalf(\"err opening test db: %v\", err)\n\t}\n\treturn tdb\n}", "func (d *pgDriver) Open(ctx context.Context) (sqlbk.DB, error) {\n\treturn d.open(ctx, d.url())\n}", "func (p *CockroachDriver) Open() error {\n\tvar err error\n\tp.dbConn, err = sql.Open(\"postgres\", p.connStr)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func Open() (TestDB, *sql.DB, error) {\n\tconnection := fmt.Sprintf(\n\t\t`host=%s port=%s user=%s\n\t\tpassword=%s dbname=%s sslmode=disable`,\n\t\tdbHost, dbPort, dbUser, dbPass, dbName)\n\n\tdbConn, err := sql.Open(\"postgres\", connection)\n\tif err != nil {\n\t\treturn TestDB{}, nil, err\n\t}\n\n\ttdb := TestDB{Conn: dbConn}\n\treturn tdb, dbConn, nil\n}", "func Open(\n\tctx context.Context,\n\taddr string,\n\tappname string,\n\tnames ...string,\n) (*MongoDB, error) {\n\tm := &MongoDB{\n\t\tctx: context.WithValue(\n\t\t\tctx,\n\t\t\tkeyPrincipalID,\n\t\t\tprimitive.NewObjectID().Hex(),\n\t\t),\n\t\tconnstr: fmt.Sprintf(\n\t\t\t\"mongodb://%s/?readPreference=primary&appname=%s\",\n\t\t\taddr, appname,\n\t\t),\n\t\tcoll: make(map[string]*mongo.Collection),\n\t}\n\n\topts := options.Client().ApplyURI(m.connstr)\n\tclient, err := mongo.NewClient(opts)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tm.client = client\n\n\tif err := m.Connect(); err != nil {\n\t\treturn nil, err\n\t}\n\n\tif len(names) > 0 {\n\t\tm.SetDatabase(names[0])\n\t}\n\n\tif len(names) > 1 {\n\t\tm.SetCollections(names[1:]...)\n\t}\n\n\treturn m, nil\n}", "func (p Config) Client() (*gorm.DB, error) {\n\tdsn := fmt.Sprintf(\"user=%s password=%s dbname=%s host=%s port=%d %s\",\n\t\tp.Username, p.Password, p.Database, p.Host, p.Port, p.Params)\n\n\tlogMode := func() logger.LogLevel {\n\t\tswitch strings.ToLower(p.LogMode) {\n\t\tcase \"silent\":\n\t\t\treturn logger.Silent\n\t\tcase \"error\":\n\t\t\treturn logger.Error\n\t\tcase \"warn\":\n\t\t\treturn logger.Warn\n\t\tcase \"info\":\n\t\t\treturn logger.Info\n\t\tdefault:\n\t\t\treturn logger.Silent\n\t\t}\n\t}\n\n\tconfig := &gorm.Config{\n\t\tLogger: logger.Default.LogMode(logMode()),\n\t}\n\n\tdb, err = gorm.Open(postgres.Open(dsn), config)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tif p.DebugEnabled {\n\t\tdb = db.Debug()\n\t}\n\n\tsqlDB, err := db.DB()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tsqlDB.SetMaxIdleConns(p.MaxIdleConn)\n\tsqlDB.SetMaxOpenConns(p.MaxOpenConn)\n\n\treturn db, nil\n}", "func OpenDB() *sql.DB {\n\tvar db *sql.DB\n\n\tpsqlInfo := fmt.Sprintf(\"host=%s port=%d user=%s \"+\"password=%s dbname=%s sslmode=disable\", host, port, user, password, dbname)\n\tdb, err := sql.Open(\"postgres\", psqlInfo)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\tif err = db.Ping(); err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\treturn db\n}", "func (p *DSNProvider) Open(ctx context.Context, k string) (persistence.DataStore, error) {\n\treturn p.open(\n\t\tctx,\n\t\tk,\n\t\tp.Driver,\n\t\tp.LockTTL,\n\t\tp.openDB,\n\t\t(*sql.DB).Close,\n\t)\n}", "func Open(typ string, args ...interface{}) (DatabaseInterface, error) {\n\td, exists := drivers[typ]\n\tif !exists {\n\t\treturn nil, NewDatabaseError(DriverNotRegisterErr, errors.Errorf(\"Driver %s is not registered\", typ))\n\t}\n\treturn d.Open(args...)\n}", "func Open(f Fataler, opts ...Option) *sql.DB {\n\tdata := optionData{\n\t\tdatabaseURL: \"postgres:///postgres?sslmode=disable\",\n\t}\n\tfor _, opt := range opts {\n\t\topt.apply(f, &data)\n\t}\n\n\tfor _, sp := range data.schemaPaths {\n\t\tschemaBytes, err := ioutil.ReadFile(sp)\n\t\tif err != nil {\n\t\t\tf.Fatal(sp, err)\n\t\t}\n\t\tdata.schema = append(data.schema, string(schemaBytes))\n\t}\n\n\tnewDatabaseURL, err := mkdb(data.databaseURL)\n\tif err != nil {\n\t\tf.Fatal(err)\n\t}\n\tfmt.Println(newDatabaseURL)\n\tdb, err := sql.Open(\"postgres\", newDatabaseURL)\n\tif err != nil {\n\t\tf.Fatal(err)\n\t}\n\tfor _, schema := range data.schema {\n\t\t_, err = db.Exec(schema)\n\t\tif err != nil {\n\t\t\tf.Fatal(err)\n\t\t}\n\t}\n\treturn db\n}", "func (d *drv) Open(s string) (driver.Conn, error) {\n\tc, err := d.OpenConnector(s)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn d.createConnFromParams(context.Background(), c.(connector).ConnectionParams)\n}", "func Open(dbname string, o *Options) (*DB, error) {\n\tvar errStr *C.char\n\tldbname := C.CString(dbname)\n\tdefer C.free(unsafe.Pointer(ldbname))\n\n\tleveldb := C.leveldb_open(o.Opt, ldbname, &errStr)\n\tif errStr != nil {\n\t\tgs := C.GoString(errStr)\n\t\tC.leveldb_free(unsafe.Pointer(errStr))\n\t\treturn nil, DatabaseError(gs)\n\t}\n\treturn &DB{leveldb, false}, nil\n}", "func Open(args ...interface{}) (dbc *QData, err error) {\n\tlenArgs := len(args)\n\tif lenArgs == 0 {\n\t\terr = errors.New(\"dataq: invalid database source\")\n\t}\n\tvar (\n\t\tconnectString string\n\t\tdbConn QInterface\n\t\tdbName string\n\t\tconfig Config\n\t\tok bool\n\t)\n\n\tswitch value := args[0].(type) {\n\tcase string:\n\t\tconnectString = value\n\t\tdbConn, err = sql.Open(\"mysql\", connectString)\n\t}\n\n\tif lenArgs == 2 {\n\t\t// TODO: need more params\n\t\tif _, ok = args[1].(float64); ok {\n\t\t\tconfig.DebugLvl = int(args[1].(float64))\n\t\t} else if _, ok = args[1].(Config); ok {\n\t\t\tconfig = args[1].(Config)\n\t\t}\n\t}\n\n\tif config.ConnMaxIdleTime == 0 {\n\t\tconfig.ConnMaxIdleTime = DefaultConnMaxIdleTime\n\t}\n\tif config.ConnMaxLifetime == 0 {\n\t\tconfig.ConnMaxLifetime = DefaultConnMaxLifetime\n\t}\n\tif config.MaxOpenConns == 0 {\n\t\tconfig.MaxOpenConns = 128\n\t}\n\tif config.MaxIdleConns == 0 {\n\t\tconfig.MaxIdleConns = 128\n\t}\n\n\tif d, ok := dbConn.(*sql.DB); ok {\n\t\tif err := d.Ping(); err != nil {\n\t\t\td.Close()\n\t\t\treturn nil, err\n\t\t}\n\t\td.SetMaxOpenConns(config.MaxOpenConns)\n\t\td.SetMaxIdleConns(config.MaxIdleConns)\n\t\td.SetConnMaxLifetime(config.ConnMaxLifetime)\n\t\td.SetConnMaxIdleTime(config.ConnMaxIdleTime)\n\t}\n\n\tdbConn.QueryRow(\"SELECT DATABASE()\").Scan(&dbName)\n\tdbc = &QData{\n\t\tdb: dbConn,\n\t\tdbName: dbName,\n\t\tconfig: config,\n\t\tshared: &sharedConfig{\n\t\t\tstore: &sync.Map{},\n\t\t\tpreparedStmt: map[string]*sql.Stmt{},\n\t\t},\n\t\tpreparedStmt: &sync.Map{},\n\t}\n\n\treturn\n}", "func New(filename string) (*Client, error) {\n\tdb, err := sql.Open(\"sqlite\", filename)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdb.SetMaxOpenConns(0)\n\n\t_, err = db.Exec(schema)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn &Client{\n\t\tdb: db,\n\t}, nil\n}", "func NewDB(driverName, dataSourceName string) (*DB, error) {\n\terr := checkDSNParams(dataSourceName)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tx, err := sql.Open(driverName, dataSourceName)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tdb := &DB{DB: x}\n\n\terr = db.initStmts(driverName)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn db, nil\n}", "func (c *Client) Open() (string, error) {\n\n\tif c.config.Dir != \"\" {\n\t\tif err := os.MkdirAll(c.config.Dir, 0666); err != nil {\n\t\t\treturn \"\", err\n\t\t}\n\t}\n\n\tdbPath := c.Path()\n\t// Open database file.\n\tif dbConn, err := bolt.Open(dbPath, 0666, &bolt.Options{Timeout: 1 * time.Second}); err != nil {\n\t\treturn dbPath, err\n\t} else {\n\t\tc.Db = dbConn\n\t\treturn dbPath, nil\n\t}\n}", "func newDBClient() connection {\n\tc := client{}\n\terr := c.connect()\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\terr = c.applySchema()\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\treturn &c\n}", "func (a *Driver) Open(dsn string) (driver.Conn, error) {\n\treturn NewConnector(dsn).Connect(context.TODO())\n}", "func (d *pgDriver) open(ctx context.Context, u *url.URL) (sqlbk.DB, error) {\n\tconnConfig, err := pgx.ParseConfig(u.String())\n\tif err != nil {\n\t\treturn nil, trace.Wrap(err)\n\t}\n\tconnConfig.Logger = d.sqlLogger\n\n\t// extract the user from the first client certificate in TLSConfig.\n\tif connConfig.TLSConfig != nil {\n\t\tconnConfig.User, err = tlsConfigUser(connConfig.TLSConfig)\n\t\tif err != nil {\n\t\t\treturn nil, trace.Wrap(err)\n\t\t}\n\t\tif connConfig.User == \"\" {\n\t\t\treturn nil, trace.BadParameter(\"storage backend certificate CommonName field is blank; database username is required\")\n\t\t}\n\t}\n\n\t// Attempt to create backend database if it does not exist.\n\terr = d.maybeCreateDatabase(ctx, connConfig)\n\tif err != nil {\n\t\treturn nil, trace.Wrap(err)\n\t}\n\n\t// Open connection/pool for backend database.\n\tdb, err := sql.Open(\"pgx\", stdlib.RegisterConnConfig(connConfig))\n\tif err != nil {\n\t\treturn nil, trace.Wrap(err)\n\t}\n\n\t// Configure the connection pool.\n\tdb.SetConnMaxIdleTime(d.cfg.ConnMaxIdleTime)\n\tdb.SetConnMaxLifetime(d.cfg.ConnMaxLifetime)\n\tdb.SetMaxIdleConns(d.cfg.MaxIdleConns)\n\tdb.SetMaxOpenConns(d.cfg.MaxOpenConns)\n\n\tpgdb := &pgDB{\n\t\tDB: db,\n\t\tpgDriver: d,\n\t\treadOnlyOpts: &sql.TxOptions{ReadOnly: true},\n\t\treadWriteOpts: &sql.TxOptions{},\n\t}\n\n\terr = pgdb.migrate(ctx)\n\tif err != nil {\n\t\treturn nil, trace.Wrap(err)\n\t}\n\n\treturn pgdb, nil\n}", "func Open(filepath string) (DataSource, error) {\n\n\tif !fs.Exists(filepath) {\n\t\terr := os.MkdirAll(filepath, 0644)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\tidgen, err := newSEQIDGen(filepath)\n\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tpersistence, err := newDB(filepath)\n\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn &_DataSource{\n\t\tLog: gslogger.Get(\"tsdb\"),\n\t\tSEQIDGen: idgen,\n\t\tPersistence: persistence,\n\t\tcached: make(map[string]*_Cached),\n\t\tcachedsize: gsconfig.Int(\"tsdb.cached.size\", 1024),\n\t}, nil\n}", "func (dbInfo *DbInfo) Open() (*sql.DB, error) {\n\tconn := dbInfo.ConnectionString()\n\tdb, err := sql.Open(\"postgres\", conn)\n\treturn db, err\n}", "func Open(name string) (*Cdb, error) {\n\tf, err := os.Open(name)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tc := New(f)\n\tc.closer = f\n\truntime.SetFinalizer(c, (*Cdb).Close)\n\treturn c, nil\n}", "func OpenDatabase(user string, pass string, host string, schema string) *sql.DB {\n\tvar dsn string\n\n\tdsn = user\n\tif pass != \"\" {\n\t\tdsn += \":\" + pass\n\t}\n\tdsn += \"@\"\n\tif host != \"\" {\n\t\tdsn += \"tcp(\"\n\t\tdsn += host\n\t\tdsn += \")\"\n\t}\n\tdsn += \"/\"\n\tdsn += schema\n\tdsn += \"?parseTime=true\"\n\n\treturn OpenDatabaseDSN(dsn)\n}", "func (config Service) Open(log gopi.Logger) (gopi.Driver, error) {\n\tlog.Debug(\"<grpc.service.sensordb.Open>{ server=%v database=%v }\", config.Server, config.Database)\n\n\t// Check for bad input parameters\n\tif config.Server == nil || config.Database == nil {\n\t\treturn nil, gopi.ErrBadParameter\n\t}\n\n\tthis := new(service)\n\tthis.log = log\n\tthis.database = config.Database\n\n\t// Register service with GRPC server\n\tpb.RegisterSensorDBServer(config.Server.(grpc.GRPCServer).GRPCServer(), this)\n\n\t// Success\n\treturn this, nil\n}", "func Connect() (*sql.DB, error) {\n\thost := viper.GetString(\"google.cloudsql.host\")\n\tname := viper.GetString(\"google.cloudsql.name\")\n\tuser := viper.GetString(\"google.cloudsql.user\")\n\tpass := viper.GetString(\"google.cloudsql.pass\")\n\tdsn := fmt.Sprintf(\"host=%s dbname=%s user=%s password=%s sslmode=disable\",\n\t\thost, name, user, pass)\n\tdb, err := sql.Open(\"cloudsqlpostgres\", dsn)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"error while connecting to cloudsql: %v\", err)\n\t}\n\tlog.Printf(\"Connected to cloudsql %q\", host)\n\treturn db, nil\n}", "func Open() *sql.DB {\n\treturn database\n}", "func New(db *sql.DB) *Client {\n\treturn &Client{\n\t\tDB: db,\n\t}\n\n}", "func NewDB(dbConnString string, log logger.Logger, wg *sync.WaitGroup, driver string, netParams *params.ChainParams) *Database {\n\tdb, err := sql.Open(driver, dbConnString)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\terr = db.Ping()\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\tdbclient := &Database{\n\t\tlog: log,\n\t\tdb: db,\n\t\tcanClose: wg,\n\t\tdriver: driver,\n\t\tnetParams: netParams,\n\t}\n\n\tdbclient.log.Info(\"Database connection established\")\n\n\treturn dbclient\n}", "func Open(adapter string, url db.ConnectionURL) (Session, error) {\n\tconn, err := sqlbuilder.Open(adapter, url)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tsess := New(conn)\n\treturn sess, nil\n}" ]
[ "0.77973974", "0.7449986", "0.72807825", "0.710408", "0.7090206", "0.70423377", "0.69934213", "0.6935235", "0.69137764", "0.6912296", "0.68191785", "0.67942804", "0.67088974", "0.67048466", "0.66992784", "0.666593", "0.6630858", "0.65460294", "0.6512449", "0.65062606", "0.6467085", "0.6425493", "0.64075625", "0.6372208", "0.6344936", "0.6326145", "0.6326145", "0.63032746", "0.6286472", "0.6278712", "0.6275619", "0.6265922", "0.62455016", "0.62346745", "0.6222749", "0.62202066", "0.61700225", "0.61565334", "0.61440873", "0.6137992", "0.61361885", "0.6135149", "0.61334026", "0.61235106", "0.60991406", "0.609898", "0.609225", "0.609104", "0.6083609", "0.6068413", "0.605119", "0.60407734", "0.60271215", "0.597892", "0.597499", "0.5972447", "0.5959467", "0.59498376", "0.59493816", "0.5946855", "0.59437007", "0.5939493", "0.59376216", "0.5935686", "0.5933943", "0.5920623", "0.5907376", "0.5907294", "0.58865815", "0.58764786", "0.586673", "0.5849086", "0.5833707", "0.58315456", "0.5813728", "0.5807853", "0.58064866", "0.5803599", "0.57965815" ]
0.7890017
16
Tx returns a new transactional client. The provided context is used until the transaction is committed or rolled back.
func (c *Client) Tx(ctx context.Context) (*Tx, error) { if _, ok := c.driver.(*txDriver); ok { return nil, fmt.Errorf("ent: cannot start a transaction within a transaction") } tx, err := newTx(ctx, c.driver) if err != nil { return nil, fmt.Errorf("ent: starting a transaction: %w", err) } cfg := c.config cfg.driver = tx return &Tx{ ctx: ctx, config: cfg, Admin: NewAdminClient(cfg), AdminSession: NewAdminSessionClient(cfg), Category: NewCategoryClient(cfg), Post: NewPostClient(cfg), PostAttachment: NewPostAttachmentClient(cfg), PostImage: NewPostImageClient(cfg), PostThumbnail: NewPostThumbnailClient(cfg), PostVideo: NewPostVideoClient(cfg), UnsavedPost: NewUnsavedPostClient(cfg), UnsavedPostAttachment: NewUnsavedPostAttachmentClient(cfg), UnsavedPostImage: NewUnsavedPostImageClient(cfg), UnsavedPostThumbnail: NewUnsavedPostThumbnailClient(cfg), UnsavedPostVideo: NewUnsavedPostVideoClient(cfg), }, nil }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (c *Client) Tx(ctx context.Context) (*Tx, error) {\n\tif _, ok := c.driver.(*txDriver); ok {\n\t\treturn nil, fmt.Errorf(\"ent: cannot start a transaction within a transaction\")\n\t}\n\ttx, err := newTx(ctx, c.driver)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"ent: starting a transaction: %v\", err)\n\t}\n\tcfg := config{driver: tx, log: c.log, debug: c.debug, hooks: c.hooks}\n\treturn &Tx{\n\t\tctx: ctx,\n\t\tconfig: cfg,\n\t\tAppointment: NewAppointmentClient(cfg),\n\t\tClinic: NewClinicClient(cfg),\n\t\tCustomer: NewCustomerClient(cfg),\n\t\tPet: NewPetClient(cfg),\n\t\tUser: NewUserClient(cfg),\n\t\tVeterinarian: NewVeterinarianClient(cfg),\n\t}, nil\n}", "func (c *Client) Tx(ctx context.Context) (*Tx, error) {\n\tif _, ok := c.driver.(*txDriver); ok {\n\t\treturn nil, fmt.Errorf(\"ent: cannot start a transaction within a transaction\")\n\t}\n\ttx, err := newTx(ctx, c.driver)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"ent: starting a transaction: %v\", err)\n\t}\n\tcfg := config{driver: tx, log: c.log, debug: c.debug, hooks: c.hooks}\n\treturn &Tx{\n\t\tctx: ctx,\n\t\tconfig: cfg,\n\t\tBooking: NewBookingClient(cfg),\n\t\tOperationroom: NewOperationroomClient(cfg),\n\t\tPatient: NewPatientClient(cfg),\n\t\tUser: NewUserClient(cfg),\n\t}, nil\n}", "func (c *Client) Tx(ctx context.Context) (*Tx, error) {\n\tif _, ok := c.driver.(*txDriver); ok {\n\t\treturn nil, fmt.Errorf(\"ent: cannot start a transaction within a transaction\")\n\t}\n\ttx, err := newTx(ctx, c.driver)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"ent: starting a transaction: %w\", err)\n\t}\n\tcfg := c.config\n\tcfg.driver = tx\n\treturn &Tx{\n\t\tctx: ctx,\n\t\tconfig: cfg,\n\t\tCompany: NewCompanyClient(cfg),\n\t\tJob: NewJobClient(cfg),\n\t\tSkill: NewSkillClient(cfg),\n\t\tUser: NewUserClient(cfg),\n\t\tWorkExperience: NewWorkExperienceClient(cfg),\n\t}, nil\n}", "func (c *Client) Tx(ctx context.Context) (*Tx, error) {\n\tif _, ok := c.driver.(*txDriver); ok {\n\t\treturn nil, fmt.Errorf(\"ent: cannot start a transaction within a transaction\")\n\t}\n\ttx, err := newTx(ctx, c.driver)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"ent: starting a transaction: %v\", err)\n\t}\n\tcfg := config{driver: tx, log: c.log, debug: c.debug, hooks: c.hooks}\n\treturn &Tx{\n\t\tctx: ctx,\n\t\tconfig: cfg,\n\t\tDepartment: NewDepartmentClient(cfg),\n\t\tPhysician: NewPhysicianClient(cfg),\n\t\tPosition: NewPositionClient(cfg),\n\t\tPositionassingment: NewPositionassingmentClient(cfg),\n\t}, nil\n}", "func (c *Client) Tx(ctx context.Context) (*Tx, error) {\n\tif _, ok := c.driver.(*txDriver); ok {\n\t\treturn nil, fmt.Errorf(\"ent: cannot start a transaction within a transaction\")\n\t}\n\ttx, err := newTx(ctx, c.driver)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"ent: starting a transaction: %v\", err)\n\t}\n\tcfg := config{driver: tx, log: c.log, debug: c.debug, hooks: c.hooks}\n\treturn &Tx{\n\t\tctx: ctx,\n\t\tconfig: cfg,\n\t\tDentist: NewDentistClient(cfg),\n\t\tEmployee: NewEmployeeClient(cfg),\n\t\tPatient: NewPatientClient(cfg),\n\t\tQueue: NewQueueClient(cfg),\n\t}, nil\n}", "func (c *Client) Tx(ctx context.Context) (*Tx, error) {\n\tif _, ok := c.driver.(*txDriver); ok {\n\t\treturn nil, fmt.Errorf(\"ent: cannot start a transaction within a transaction\")\n\t}\n\ttx, err := newTx(ctx, c.driver)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"ent: starting a transaction: %v\", err)\n\t}\n\tcfg := config{driver: tx, log: c.log, debug: c.debug, hooks: c.hooks}\n\treturn &Tx{\n\t\tctx: ctx,\n\t\tconfig: cfg,\n\t\tEatinghistory: NewEatinghistoryClient(cfg),\n\t\tFoodmenu: NewFoodmenuClient(cfg),\n\t\tMealplan: NewMealplanClient(cfg),\n\t\tTaste: NewTasteClient(cfg),\n\t\tUser: NewUserClient(cfg),\n\t}, nil\n}", "func (c *Client) Tx(ctx context.Context) (*Tx, error) {\n\tif _, ok := c.driver.(*txDriver); ok {\n\t\treturn nil, fmt.Errorf(\"ent: cannot start a transaction within a transaction\")\n\t}\n\ttx, err := newTx(ctx, c.driver)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"ent: starting a transaction: %v\", err)\n\t}\n\tcfg := config{driver: tx, log: c.log, debug: c.debug, hooks: c.hooks}\n\treturn &Tx{\n\t\tctx: ctx,\n\t\tconfig: cfg,\n\t\tExaminationroom: NewExaminationroomClient(cfg),\n\t\tNurse: NewNurseClient(cfg),\n\t\tOperative: NewOperativeClient(cfg),\n\t\tOperativerecord: NewOperativerecordClient(cfg),\n\t\tTool: NewToolClient(cfg),\n\t}, nil\n}", "func (c *Client) Tx(ctx context.Context) (*Tx, error) {\n\tif _, ok := c.driver.(*txDriver); ok {\n\t\treturn nil, fmt.Errorf(\"ent: cannot start a transaction within a transaction\")\n\t}\n\ttx, err := newTx(ctx, c.driver)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"ent: starting a transaction: %w\", err)\n\t}\n\tcfg := c.config\n\tcfg.driver = tx\n\treturn &Tx{\n\t\tctx: ctx,\n\t\tconfig: cfg,\n\t\tBinaryFile: NewBinaryFileClient(cfg),\n\t\tUser: NewUserClient(cfg),\n\t}, nil\n}", "func (c *Client) Tx(ctx context.Context) (*Tx, error) {\n\tif _, ok := c.driver.(*txDriver); ok {\n\t\treturn nil, fmt.Errorf(\"ent: cannot start a transaction within a transaction\")\n\t}\n\ttx, err := newTx(ctx, c.driver)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"ent: starting a transaction: %v\", err)\n\t}\n\tcfg := config{driver: tx, log: c.log, debug: c.debug, hooks: c.hooks}\n\treturn &Tx{\n\t\tctx: ctx,\n\t\tconfig: cfg,\n\t\tGender: NewGenderClient(cfg),\n\t\tPosition: NewPositionClient(cfg),\n\t\tTitle: NewTitleClient(cfg),\n\t\tUser: NewUserClient(cfg),\n\t}, nil\n}", "func (c *Client) Tx(ctx context.Context) (*Tx, error) {\n\tif _, ok := c.driver.(*txDriver); ok {\n\t\treturn nil, fmt.Errorf(\"ent: cannot start a transaction within a transaction\")\n\t}\n\ttx, err := newTx(ctx, c.driver)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"ent: starting a transaction: %v\", err)\n\t}\n\tcfg := config{driver: tx, log: c.log, debug: c.debug, hooks: c.hooks}\n\treturn &Tx{\n\t\tconfig: cfg,\n\t\tPlanet: NewPlanetClient(cfg),\n\t\tSession: NewSessionClient(cfg),\n\t\tTimer: NewTimerClient(cfg),\n\t\tUser: NewUserClient(cfg),\n\t}, nil\n}", "func (c *Client) Tx(ctx context.Context) (*Tx, error) {\n\tif _, ok := c.driver.(*txDriver); ok {\n\t\treturn nil, fmt.Errorf(\"ent: cannot start a transaction within a transaction\")\n\t}\n\ttx, err := newTx(ctx, c.driver)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"ent: starting a transaction: %v\", err)\n\t}\n\tcfg := config{driver: tx, log: c.log, debug: c.debug, hooks: c.hooks}\n\treturn &Tx{\n\t\tctx: ctx,\n\t\tconfig: cfg,\n\t\tAnnotation: NewAnnotationClient(cfg),\n\t\tBill: NewBillClient(cfg),\n\t\tCompany: NewCompanyClient(cfg),\n\t\tDispenseMedicine: NewDispenseMedicineClient(cfg),\n\t\tDoctor: NewDoctorClient(cfg),\n\t\tDrugAllergy: NewDrugAllergyClient(cfg),\n\t\tLevelOfDangerous: NewLevelOfDangerousClient(cfg),\n\t\tMedicine: NewMedicineClient(cfg),\n\t\tMedicineType: NewMedicineTypeClient(cfg),\n\t\tOrder: NewOrderClient(cfg),\n\t\tPatientInfo: NewPatientInfoClient(cfg),\n\t\tPayment: NewPaymentClient(cfg),\n\t\tPharmacist: NewPharmacistClient(cfg),\n\t\tPositionInPharmacist: NewPositionInPharmacistClient(cfg),\n\t\tPrescription: NewPrescriptionClient(cfg),\n\t\tUnitOfMedicine: NewUnitOfMedicineClient(cfg),\n\t}, nil\n}", "func (c *Client) Tx(ctx context.Context) (*Tx, error) {\n\tif _, ok := c.driver.(*txDriver); ok {\n\t\treturn nil, fmt.Errorf(\"ent: cannot start a transaction within a transaction\")\n\t}\n\ttx, err := newTx(ctx, c.driver)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"ent: starting a transaction: %v\", err)\n\t}\n\tcfg := config{driver: tx, log: c.log, debug: c.debug, hooks: c.hooks}\n\treturn &Tx{\n\t\tctx: ctx,\n\t\tconfig: cfg,\n\t\tAcademicYear: NewAcademicYearClient(cfg),\n\t\tActivities: NewActivitiesClient(cfg),\n\t\tActivityType: NewActivityTypeClient(cfg),\n\t\tClub: NewClubClient(cfg),\n\t\tClubBranch: NewClubBranchClient(cfg),\n\t\tClubType: NewClubTypeClient(cfg),\n\t\tClubappStatus: NewClubappStatusClient(cfg),\n\t\tClubapplication: NewClubapplicationClient(cfg),\n\t\tComplaint: NewComplaintClient(cfg),\n\t\tComplaintType: NewComplaintTypeClient(cfg),\n\t\tDiscipline: NewDisciplineClient(cfg),\n\t\tGender: NewGenderClient(cfg),\n\t\tPosition: NewPositionClient(cfg),\n\t\tPurpose: NewPurposeClient(cfg),\n\t\tRoom: NewRoomClient(cfg),\n\t\tRoomuse: NewRoomuseClient(cfg),\n\t\tUser: NewUserClient(cfg),\n\t\tUserStatus: NewUserStatusClient(cfg),\n\t\tUsertype: NewUsertypeClient(cfg),\n\t\tYear: NewYearClient(cfg),\n\t}, nil\n}", "func (c *Client) Tx(ctx context.Context) (*Tx, error) {\n\tif _, ok := c.driver.(*txDriver); ok {\n\t\treturn nil, fmt.Errorf(\"ent: cannot start a transaction within a transaction\")\n\t}\n\ttx, err := newTx(ctx, c.driver)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"ent: starting a transaction: %v\", err)\n\t}\n\tcfg := config{driver: tx, log: c.log, debug: c.debug, hooks: c.hooks}\n\treturn &Tx{\n\t\tctx: ctx,\n\t\tconfig: cfg,\n\t\tDNSBLQuery: NewDNSBLQueryClient(cfg),\n\t\tDNSBLResponse: NewDNSBLResponseClient(cfg),\n\t\tIP: NewIPClient(cfg),\n\t\tOperation: NewOperationClient(cfg),\n\t\tUser: NewUserClient(cfg),\n\t}, nil\n}", "func (c *Client) Tx(ctx context.Context) (*Tx, error) {\n\tif _, ok := c.driver.(*txDriver); ok {\n\t\treturn nil, fmt.Errorf(\"ent: cannot start a transaction within a transaction\")\n\t}\n\ttx, err := newTx(ctx, c.driver)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"ent: starting a transaction: %v\", err)\n\t}\n\tcfg := config{driver: tx, log: c.log, debug: c.debug, hooks: c.hooks}\n\treturn &Tx{\n\t\tctx: ctx,\n\t\tconfig: cfg,\n\t\tBill: NewBillClient(cfg),\n\t\tBillingstatus: NewBillingstatusClient(cfg),\n\t\tBranch: NewBranchClient(cfg),\n\t\tBuilding: NewBuildingClient(cfg),\n\t\tDevice: NewDeviceClient(cfg),\n\t\tEmployee: NewEmployeeClient(cfg),\n\t\tFaculty: NewFacultyClient(cfg),\n\t\tPart: NewPartClient(cfg),\n\t\tPartorder: NewPartorderClient(cfg),\n\t\tRepairInvoice: NewRepairInvoiceClient(cfg),\n\t\tReturninvoice: NewReturninvoiceClient(cfg),\n\t\tRoom: NewRoomClient(cfg),\n\t\tStatusR: NewStatusRClient(cfg),\n\t\tStatust: NewStatustClient(cfg),\n\t\tSymptom: NewSymptomClient(cfg),\n\t\tUser: NewUserClient(cfg),\n\t}, nil\n}", "func (c *Client) Tx(ctx context.Context) (*Tx, error) {\n\tif _, ok := c.driver.(*txDriver); ok {\n\t\treturn nil, fmt.Errorf(\"ent: cannot start a transaction within a transaction\")\n\t}\n\ttx, err := newTx(ctx, c.driver)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"ent: starting a transaction: %v\", err)\n\t}\n\tcfg := config{driver: tx, log: c.log, debug: c.debug}\n\treturn &Tx{\n\t\tconfig: cfg,\n\t\tModule: NewModuleClient(cfg),\n\t\tModuleVersion: NewModuleVersionClient(cfg),\n\t}, nil\n}", "func (c *Client) Tx(ctx context.Context) (*Tx, error) {\n\tif _, ok := c.driver.(*txDriver); ok {\n\t\treturn nil, fmt.Errorf(\"ent: cannot start a transaction within a transaction\")\n\t}\n\ttx, err := newTx(ctx, c.driver)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"ent: starting a transaction: %v\", err)\n\t}\n\tcfg := config{driver: tx, log: c.log, debug: c.debug, hooks: c.hooks}\n\treturn &Tx{\n\t\tctx: ctx,\n\t\tconfig: cfg,\n\t\tPatient: NewPatientClient(cfg),\n\t\tPatientofphysician: NewPatientofphysicianClient(cfg),\n\t\tPatientroom: NewPatientroomClient(cfg),\n\t\tPhysician: NewPhysicianClient(cfg),\n\t}, nil\n}", "func (c *Client) Tx(ctx context.Context) (*Tx, error) {\n\tif _, ok := c.driver.(*txDriver); ok {\n\t\treturn nil, fmt.Errorf(\"ent: cannot start a transaction within a transaction\")\n\t}\n\ttx, err := newTx(ctx, c.driver)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"ent: starting a transaction: %w\", err)\n\t}\n\tcfg := c.config\n\tcfg.driver = tx\n\treturn &Tx{\n\t\tctx: ctx,\n\t\tconfig: cfg,\n\t\tEvent: NewEventClient(cfg),\n\t\tTag: NewTagClient(cfg),\n\t}, nil\n}", "func (c *Client) Tx(ctx context.Context) (*Tx, error) {\n\tif _, ok := c.driver.(*txDriver); ok {\n\t\treturn nil, fmt.Errorf(\"ent: cannot start a transaction within a transaction\")\n\t}\n\ttx, err := newTx(ctx, c.driver)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"ent: starting a transaction: %v\", err)\n\t}\n\tcfg := config{driver: tx, log: c.log, debug: c.debug, hooks: c.hooks}\n\treturn &Tx{\n\t\tctx: ctx,\n\t\tconfig: cfg,\n\t\tCard: NewCardClient(cfg),\n\t\tCardScan: NewCardScanClient(cfg),\n\t\tPlaylist: NewPlaylistClient(cfg),\n\t}, nil\n}", "func (c *Client) Tx(ctx context.Context) (*Tx, error) {\n\tif _, ok := c.driver.(*txDriver); ok {\n\t\treturn nil, fmt.Errorf(\"ent: cannot start a transaction within a transaction\")\n\t}\n\ttx, err := newTx(ctx, c.driver)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"ent: starting a transaction: %w\", err)\n\t}\n\tcfg := c.config\n\tcfg.driver = tx\n\treturn &Tx{\n\t\tctx: ctx,\n\t\tconfig: cfg,\n\t\tCoinInfo: NewCoinInfoClient(cfg),\n\t\tEmpty: NewEmptyClient(cfg),\n\t\tKeyStore: NewKeyStoreClient(cfg),\n\t\tReview: NewReviewClient(cfg),\n\t\tTransaction: NewTransactionClient(cfg),\n\t\tWalletNode: NewWalletNodeClient(cfg),\n\t}, nil\n}", "func (c *Client) Tx(ctx context.Context) (*Tx, error) {\n\tif _, ok := c.driver.(*txDriver); ok {\n\t\treturn nil, fmt.Errorf(\"ent: cannot start a transaction within a transaction\")\n\t}\n\ttx, err := newTx(ctx, c.driver)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"ent: starting a transaction: %v\", err)\n\t}\n\tcfg := config{driver: tx, log: c.log, debug: c.debug, hooks: c.hooks}\n\treturn &Tx{\n\t\tctx: ctx,\n\t\tconfig: cfg,\n\t\tBedtype: NewBedtypeClient(cfg),\n\t\tBill: NewBillClient(cfg),\n\t\tCleanername: NewCleanernameClient(cfg),\n\t\tCleaningroom: NewCleaningroomClient(cfg),\n\t\tDeposit: NewDepositClient(cfg),\n\t\tEmployee: NewEmployeeClient(cfg),\n\t\tJobposition: NewJobpositionClient(cfg),\n\t\tLease: NewLeaseClient(cfg),\n\t\tLengthtime: NewLengthtimeClient(cfg),\n\t\tPayment: NewPaymentClient(cfg),\n\t\tPetrule: NewPetruleClient(cfg),\n\t\tPledge: NewPledgeClient(cfg),\n\t\tRentalstatus: NewRentalstatusClient(cfg),\n\t\tRepairinvoice: NewRepairinvoiceClient(cfg),\n\t\tRoomdetail: NewRoomdetailClient(cfg),\n\t\tSituation: NewSituationClient(cfg),\n\t\tStatusd: NewStatusdClient(cfg),\n\t\tStaytype: NewStaytypeClient(cfg),\n\t\tWifi: NewWifiClient(cfg),\n\t}, nil\n}", "func (c *Client) Tx(ctx context.Context) (*Tx, error) {\n\tif _, ok := c.driver.(*txDriver); ok {\n\t\treturn nil, fmt.Errorf(\"models: cannot start a transaction within a transaction\")\n\t}\n\ttx, err := newTx(ctx, c.driver)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"models: starting a transaction: %w\", err)\n\t}\n\tcfg := c.config\n\tcfg.driver = tx\n\treturn &Tx{\n\t\tctx: ctx,\n\t\tconfig: cfg,\n\t\tBeer: NewBeerClient(cfg),\n\t\tMedia: NewMediaClient(cfg),\n\t}, nil\n}", "func (c *Client) Tx(ctx context.Context) (*Tx, error) {\n\tif _, ok := c.driver.(*txDriver); ok {\n\t\treturn nil, fmt.Errorf(\"ent: cannot start a transaction within a transaction\")\n\t}\n\ttx, err := newTx(ctx, c.driver)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"ent: starting a transaction: %w\", err)\n\t}\n\tcfg := c.config\n\tcfg.driver = tx\n\treturn &Tx{\n\t\tctx: ctx,\n\t\tconfig: cfg,\n\t\tUser: NewUserClient(cfg),\n\t\tUserCard: NewUserCardClient(cfg),\n\t\tUserWallet: NewUserWalletClient(cfg),\n\t}, nil\n}", "func WithTxContext(ctx context.Context) context.Context {\r\n\treturn context.WithValue(ctx, exec, &Tx{})\r\n}", "func withTx(ctx context.Context, client *ent.Client, fn func(tx *ent.Tx) error) error {\n\ttx, err := client.Tx(ctx)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer func() {\n\t\tif v := recover(); v != nil {\n\t\t\ttx.Rollback()\n\t\t\tpanic(v)\n\t\t}\n\t}()\n\tif err := fn(tx); err != nil {\n\t\tif rerr := tx.Rollback(); rerr != nil {\n\t\t\terr = errors.Wrapf(err, \"rolling back transaction: %v\", rerr)\n\t\t}\n\t\treturn err\n\t}\n\tif err := tx.Commit(); err != nil {\n\t\trerr := errors.Wrapf(err, \"committing transaction: %v\", err)\n\t\treturn rerr\n\t}\n\treturn nil\n}", "func (c *Client) BeginTx(ctx context.Context, opts *sql.TxOptions) (*Tx, error) {\n\tif _, ok := c.driver.(*txDriver); ok {\n\t\treturn nil, fmt.Errorf(\"ent: cannot start a transaction within a transaction\")\n\t}\n\ttx, err := c.driver.(*sql.Driver).BeginTx(ctx, opts)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"ent: starting a transaction: %v\", err)\n\t}\n\tcfg := config{driver: &txDriver{tx: tx, drv: c.driver}, log: c.log, debug: c.debug, hooks: c.hooks}\n\treturn &Tx{\n\t\tconfig: cfg,\n\t\tAnnotation: NewAnnotationClient(cfg),\n\t\tBill: NewBillClient(cfg),\n\t\tCompany: NewCompanyClient(cfg),\n\t\tDispenseMedicine: NewDispenseMedicineClient(cfg),\n\t\tDoctor: NewDoctorClient(cfg),\n\t\tDrugAllergy: NewDrugAllergyClient(cfg),\n\t\tLevelOfDangerous: NewLevelOfDangerousClient(cfg),\n\t\tMedicine: NewMedicineClient(cfg),\n\t\tMedicineType: NewMedicineTypeClient(cfg),\n\t\tOrder: NewOrderClient(cfg),\n\t\tPatientInfo: NewPatientInfoClient(cfg),\n\t\tPayment: NewPaymentClient(cfg),\n\t\tPharmacist: NewPharmacistClient(cfg),\n\t\tPositionInPharmacist: NewPositionInPharmacistClient(cfg),\n\t\tPrescription: NewPrescriptionClient(cfg),\n\t\tUnitOfMedicine: NewUnitOfMedicineClient(cfg),\n\t}, nil\n}", "func ctxForTx() (context.Context, func()) {\n\treturn context.WithTimeout(context.Background(), timeoutTx)\n}", "func (c *Client) BeginTx(ctx context.Context, opts *sql.TxOptions) (*Tx, error) {\n\tif _, ok := c.driver.(*txDriver); ok {\n\t\treturn nil, fmt.Errorf(\"ent: cannot start a transaction within a transaction\")\n\t}\n\ttx, err := c.driver.(interface {\n\t\tBeginTx(context.Context, *sql.TxOptions) (dialect.Tx, error)\n\t}).BeginTx(ctx, opts)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"ent: starting a transaction: %w\", err)\n\t}\n\tcfg := c.config\n\tcfg.driver = &txDriver{tx: tx, drv: c.driver}\n\treturn &Tx{\n\t\tconfig: cfg,\n\t\tAdmin: NewAdminClient(cfg),\n\t\tAdminSession: NewAdminSessionClient(cfg),\n\t\tCategory: NewCategoryClient(cfg),\n\t\tPost: NewPostClient(cfg),\n\t\tPostAttachment: NewPostAttachmentClient(cfg),\n\t\tPostImage: NewPostImageClient(cfg),\n\t\tPostThumbnail: NewPostThumbnailClient(cfg),\n\t\tPostVideo: NewPostVideoClient(cfg),\n\t\tUnsavedPost: NewUnsavedPostClient(cfg),\n\t\tUnsavedPostAttachment: NewUnsavedPostAttachmentClient(cfg),\n\t\tUnsavedPostImage: NewUnsavedPostImageClient(cfg),\n\t\tUnsavedPostThumbnail: NewUnsavedPostThumbnailClient(cfg),\n\t\tUnsavedPostVideo: NewUnsavedPostVideoClient(cfg),\n\t}, nil\n}", "func (c *Client) BeginTx(ctx context.Context, opts *sql.TxOptions) (*Tx, error) {\n\tif _, ok := c.driver.(*txDriver); ok {\n\t\treturn nil, fmt.Errorf(\"ent: cannot start a transaction within a transaction\")\n\t}\n\ttx, err := c.driver.(*sql.Driver).BeginTx(ctx, opts)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"ent: starting a transaction: %v\", err)\n\t}\n\tcfg := config{driver: &txDriver{tx: tx, drv: c.driver}, log: c.log, debug: c.debug, hooks: c.hooks}\n\treturn &Tx{\n\t\tconfig: cfg,\n\t\tAcademicYear: NewAcademicYearClient(cfg),\n\t\tActivities: NewActivitiesClient(cfg),\n\t\tActivityType: NewActivityTypeClient(cfg),\n\t\tClub: NewClubClient(cfg),\n\t\tClubBranch: NewClubBranchClient(cfg),\n\t\tClubType: NewClubTypeClient(cfg),\n\t\tClubappStatus: NewClubappStatusClient(cfg),\n\t\tClubapplication: NewClubapplicationClient(cfg),\n\t\tComplaint: NewComplaintClient(cfg),\n\t\tComplaintType: NewComplaintTypeClient(cfg),\n\t\tDiscipline: NewDisciplineClient(cfg),\n\t\tGender: NewGenderClient(cfg),\n\t\tPosition: NewPositionClient(cfg),\n\t\tPurpose: NewPurposeClient(cfg),\n\t\tRoom: NewRoomClient(cfg),\n\t\tRoomuse: NewRoomuseClient(cfg),\n\t\tUser: NewUserClient(cfg),\n\t\tUserStatus: NewUserStatusClient(cfg),\n\t\tUsertype: NewUsertypeClient(cfg),\n\t\tYear: NewYearClient(cfg),\n\t}, nil\n}", "func (tx *txDriver) Tx(context.Context) (dialect.Tx, error) { return tx, nil }", "func (tx *txDriver) Tx(context.Context) (dialect.Tx, error) { return tx, nil }", "func (c *Client) BeginTx(ctx context.Context, opts *sql.TxOptions) (*Tx, error) {\n\tif _, ok := c.driver.(*txDriver); ok {\n\t\treturn nil, fmt.Errorf(\"ent: cannot start a transaction within a transaction\")\n\t}\n\ttx, err := c.driver.(*sql.Driver).BeginTx(ctx, opts)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"ent: starting a transaction: %v\", err)\n\t}\n\tcfg := config{driver: &txDriver{tx: tx, drv: c.driver}, log: c.log, debug: c.debug, hooks: c.hooks}\n\treturn &Tx{\n\t\tconfig: cfg,\n\t\tBedtype: NewBedtypeClient(cfg),\n\t\tBill: NewBillClient(cfg),\n\t\tCleanername: NewCleanernameClient(cfg),\n\t\tCleaningroom: NewCleaningroomClient(cfg),\n\t\tDeposit: NewDepositClient(cfg),\n\t\tEmployee: NewEmployeeClient(cfg),\n\t\tJobposition: NewJobpositionClient(cfg),\n\t\tLease: NewLeaseClient(cfg),\n\t\tLengthtime: NewLengthtimeClient(cfg),\n\t\tPayment: NewPaymentClient(cfg),\n\t\tPetrule: NewPetruleClient(cfg),\n\t\tPledge: NewPledgeClient(cfg),\n\t\tRentalstatus: NewRentalstatusClient(cfg),\n\t\tRepairinvoice: NewRepairinvoiceClient(cfg),\n\t\tRoomdetail: NewRoomdetailClient(cfg),\n\t\tSituation: NewSituationClient(cfg),\n\t\tStatusd: NewStatusdClient(cfg),\n\t\tStaytype: NewStaytypeClient(cfg),\n\t\tWifi: NewWifiClient(cfg),\n\t}, nil\n}", "func (c *Client) BeginTx(ctx context.Context, opts *sql.TxOptions) (*Tx, error) {\n\tif _, ok := c.driver.(*txDriver); ok {\n\t\treturn nil, fmt.Errorf(\"ent: cannot start a transaction within a transaction\")\n\t}\n\ttx, err := c.driver.(*sql.Driver).BeginTx(ctx, opts)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"ent: starting a transaction: %v\", err)\n\t}\n\tcfg := config{driver: &txDriver{tx: tx, drv: c.driver}, log: c.log, debug: c.debug, hooks: c.hooks}\n\treturn &Tx{\n\t\tconfig: cfg,\n\t\tAppointment: NewAppointmentClient(cfg),\n\t\tClinic: NewClinicClient(cfg),\n\t\tCustomer: NewCustomerClient(cfg),\n\t\tPet: NewPetClient(cfg),\n\t\tUser: NewUserClient(cfg),\n\t\tVeterinarian: NewVeterinarianClient(cfg),\n\t}, nil\n}", "func (c *Client) BeginTx(ctx context.Context, opts *sql.TxOptions) (*Tx, error) {\n\tif _, ok := c.driver.(*txDriver); ok {\n\t\treturn nil, fmt.Errorf(\"ent: cannot start a transaction within a transaction\")\n\t}\n\ttx, err := c.driver.(interface {\n\t\tBeginTx(context.Context, *sql.TxOptions) (dialect.Tx, error)\n\t}).BeginTx(ctx, opts)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"ent: starting a transaction: %w\", err)\n\t}\n\tcfg := c.config\n\tcfg.driver = &txDriver{tx: tx, drv: c.driver}\n\treturn &Tx{\n\t\tconfig: cfg,\n\t\tCompany: NewCompanyClient(cfg),\n\t\tJob: NewJobClient(cfg),\n\t\tSkill: NewSkillClient(cfg),\n\t\tUser: NewUserClient(cfg),\n\t\tWorkExperience: NewWorkExperienceClient(cfg),\n\t}, nil\n}", "func (c *Client) BeginTx(ctx context.Context, opts *sql.TxOptions) (*Tx, error) {\n\tif _, ok := c.driver.(*txDriver); ok {\n\t\treturn nil, fmt.Errorf(\"ent: cannot start a transaction within a transaction\")\n\t}\n\ttx, err := c.driver.(*sql.Driver).BeginTx(ctx, opts)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"ent: starting a transaction: %v\", err)\n\t}\n\tcfg := config{driver: &txDriver{tx: tx, drv: c.driver}, log: c.log, debug: c.debug, hooks: c.hooks}\n\treturn &Tx{\n\t\tconfig: cfg,\n\t\tBill: NewBillClient(cfg),\n\t\tBillingstatus: NewBillingstatusClient(cfg),\n\t\tBranch: NewBranchClient(cfg),\n\t\tBuilding: NewBuildingClient(cfg),\n\t\tDevice: NewDeviceClient(cfg),\n\t\tEmployee: NewEmployeeClient(cfg),\n\t\tFaculty: NewFacultyClient(cfg),\n\t\tPart: NewPartClient(cfg),\n\t\tPartorder: NewPartorderClient(cfg),\n\t\tRepairInvoice: NewRepairInvoiceClient(cfg),\n\t\tReturninvoice: NewReturninvoiceClient(cfg),\n\t\tRoom: NewRoomClient(cfg),\n\t\tStatusR: NewStatusRClient(cfg),\n\t\tStatust: NewStatustClient(cfg),\n\t\tSymptom: NewSymptomClient(cfg),\n\t\tUser: NewUserClient(cfg),\n\t}, nil\n}", "func (c *Client) BeginTx(ctx context.Context, opts *sql.TxOptions) (*Tx, error) {\n\tif _, ok := c.driver.(*txDriver); ok {\n\t\treturn nil, fmt.Errorf(\"ent: cannot start a transaction within a transaction\")\n\t}\n\ttx, err := c.driver.(interface {\n\t\tBeginTx(context.Context, *sql.TxOptions) (dialect.Tx, error)\n\t}).BeginTx(ctx, opts)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"ent: starting a transaction: %w\", err)\n\t}\n\tcfg := c.config\n\tcfg.driver = &txDriver{tx: tx, drv: c.driver}\n\treturn &Tx{\n\t\tconfig: cfg,\n\t\tCoinInfo: NewCoinInfoClient(cfg),\n\t\tEmpty: NewEmptyClient(cfg),\n\t\tKeyStore: NewKeyStoreClient(cfg),\n\t\tReview: NewReviewClient(cfg),\n\t\tTransaction: NewTransactionClient(cfg),\n\t\tWalletNode: NewWalletNodeClient(cfg),\n\t}, nil\n}", "func WithTx(ctx context.Context, tx Tx) context.Context {\n\treturn context.WithValue(ctx, txKey, tx)\n}", "func (c *Client) BeginTx(ctx context.Context, opts *sql.TxOptions) (*Tx, error) {\n\tif _, ok := c.driver.(*txDriver); ok {\n\t\treturn nil, fmt.Errorf(\"ent: cannot start a transaction within a transaction\")\n\t}\n\ttx, err := c.driver.(*sql.Driver).BeginTx(ctx, opts)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"ent: starting a transaction: %v\", err)\n\t}\n\tcfg := config{driver: &txDriver{tx: tx, drv: c.driver}, log: c.log, debug: c.debug, hooks: c.hooks}\n\treturn &Tx{\n\t\tconfig: cfg,\n\t\tExaminationroom: NewExaminationroomClient(cfg),\n\t\tNurse: NewNurseClient(cfg),\n\t\tOperative: NewOperativeClient(cfg),\n\t\tOperativerecord: NewOperativerecordClient(cfg),\n\t\tTool: NewToolClient(cfg),\n\t}, nil\n}", "func (c *Client) BeginTx(ctx context.Context, opts *sql.TxOptions) (*Tx, error) {\n\tif _, ok := c.driver.(*txDriver); ok {\n\t\treturn nil, fmt.Errorf(\"ent: cannot start a transaction within a transaction\")\n\t}\n\ttx, err := c.driver.(interface {\n\t\tBeginTx(context.Context, *sql.TxOptions) (dialect.Tx, error)\n\t}).BeginTx(ctx, opts)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"ent: starting a transaction: %w\", err)\n\t}\n\tcfg := c.config\n\tcfg.driver = &txDriver{tx: tx, drv: c.driver}\n\treturn &Tx{\n\t\tctx: ctx,\n\t\tconfig: cfg,\n\t\tBeer: NewBeerClient(cfg),\n\t\tMedia: NewMediaClient(cfg),\n\t}, nil\n}", "func (c *Client) Ctx() context.Context {\n\treturn c.ctx\n}", "func (c *Client) BeginTx(ctx context.Context, opts *sql.TxOptions) (*Tx, error) {\n\tif _, ok := c.driver.(*txDriver); ok {\n\t\treturn nil, fmt.Errorf(\"ent: cannot start a transaction within a transaction\")\n\t}\n\ttx, err := c.driver.(*sql.Driver).BeginTx(ctx, opts)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"ent: starting a transaction: %v\", err)\n\t}\n\tcfg := config{driver: &txDriver{tx: tx, drv: c.driver}, log: c.log, debug: c.debug, hooks: c.hooks}\n\treturn &Tx{\n\t\tconfig: cfg,\n\t\tBooking: NewBookingClient(cfg),\n\t\tOperationroom: NewOperationroomClient(cfg),\n\t\tPatient: NewPatientClient(cfg),\n\t\tUser: NewUserClient(cfg),\n\t}, nil\n}", "func (ctx *DatabaseContext) NewTx() (*TxContext, error) {\n\tdbTransaction, err := ctx.db.Begin()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &TxContext{dbTransaction: dbTransaction}, nil\n}", "func (c *Client) BeginTx(ctx context.Context, opts *sql.TxOptions) (*Tx, error) {\n\tif _, ok := c.driver.(*txDriver); ok {\n\t\treturn nil, fmt.Errorf(\"ent: cannot start a transaction within a transaction\")\n\t}\n\ttx, err := c.driver.(*sql.Driver).BeginTx(ctx, opts)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"ent: starting a transaction: %v\", err)\n\t}\n\tcfg := config{driver: &txDriver{tx: tx, drv: c.driver}, log: c.log, debug: c.debug, hooks: c.hooks}\n\treturn &Tx{\n\t\tconfig: cfg,\n\t\tDentist: NewDentistClient(cfg),\n\t\tEmployee: NewEmployeeClient(cfg),\n\t\tPatient: NewPatientClient(cfg),\n\t\tQueue: NewQueueClient(cfg),\n\t}, nil\n}", "func (c *Client) BeginTx(ctx context.Context, opts *sql.TxOptions) (*Tx, error) {\n\tif _, ok := c.driver.(*txDriver); ok {\n\t\treturn nil, fmt.Errorf(\"ent: cannot start a transaction within a transaction\")\n\t}\n\ttx, err := c.driver.(*sql.Driver).BeginTx(ctx, opts)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"ent: starting a transaction: %v\", err)\n\t}\n\tcfg := config{driver: &txDriver{tx: tx, drv: c.driver}, log: c.log, debug: c.debug, hooks: c.hooks}\n\treturn &Tx{\n\t\tconfig: cfg,\n\t\tDepartment: NewDepartmentClient(cfg),\n\t\tPhysician: NewPhysicianClient(cfg),\n\t\tPosition: NewPositionClient(cfg),\n\t\tPositionassingment: NewPositionassingmentClient(cfg),\n\t}, nil\n}", "func (c *Client) BeginTx(ctx context.Context, opts *sql.TxOptions) (*Tx, error) {\n\tif _, ok := c.driver.(*txDriver); ok {\n\t\treturn nil, fmt.Errorf(\"ent: cannot start a transaction within a transaction\")\n\t}\n\ttx, err := c.driver.(interface {\n\t\tBeginTx(context.Context, *sql.TxOptions) (dialect.Tx, error)\n\t}).BeginTx(ctx, opts)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"ent: starting a transaction: %w\", err)\n\t}\n\tcfg := c.config\n\tcfg.driver = &txDriver{tx: tx, drv: c.driver}\n\treturn &Tx{\n\t\tconfig: cfg,\n\t\tUser: NewUserClient(cfg),\n\t\tUserCard: NewUserCardClient(cfg),\n\t\tUserWallet: NewUserWalletClient(cfg),\n\t}, nil\n}", "func (c *Client) BeginTx(ctx context.Context, opts *sql.TxOptions) (*Tx, error) {\n\tif _, ok := c.driver.(*txDriver); ok {\n\t\treturn nil, fmt.Errorf(\"ent: cannot start a transaction within a transaction\")\n\t}\n\ttx, err := c.driver.(interface {\n\t\tBeginTx(context.Context, *sql.TxOptions) (dialect.Tx, error)\n\t}).BeginTx(ctx, opts)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"ent: starting a transaction: %w\", err)\n\t}\n\tcfg := c.config\n\tcfg.driver = &txDriver{tx: tx, drv: c.driver}\n\treturn &Tx{\n\t\tconfig: cfg,\n\t\tBinaryFile: NewBinaryFileClient(cfg),\n\t\tUser: NewUserClient(cfg),\n\t}, nil\n}", "func (c *Client) BeginTx(ctx context.Context, opts *sql.TxOptions) (*Tx, error) {\n\tif _, ok := c.driver.(*txDriver); ok {\n\t\treturn nil, fmt.Errorf(\"ent: cannot start a transaction within a transaction\")\n\t}\n\ttx, err := c.driver.(*sql.Driver).BeginTx(ctx, opts)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"ent: starting a transaction: %v\", err)\n\t}\n\tcfg := config{driver: &txDriver{tx: tx, drv: c.driver}, log: c.log, debug: c.debug, hooks: c.hooks}\n\treturn &Tx{\n\t\tconfig: cfg,\n\t\tPatient: NewPatientClient(cfg),\n\t\tPatientofphysician: NewPatientofphysicianClient(cfg),\n\t\tPatientroom: NewPatientroomClient(cfg),\n\t\tPhysician: NewPhysicianClient(cfg),\n\t}, nil\n}", "func (c *Client) BeginTx(ctx context.Context, opts *sql.TxOptions) (*Tx, error) {\n\tif _, ok := c.driver.(*txDriver); ok {\n\t\treturn nil, fmt.Errorf(\"ent: cannot start a transaction within a transaction\")\n\t}\n\ttx, err := c.driver.(*sql.Driver).BeginTx(ctx, opts)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"ent: starting a transaction: %v\", err)\n\t}\n\tcfg := config{driver: &txDriver{tx: tx, drv: c.driver}, log: c.log, debug: c.debug, hooks: c.hooks}\n\treturn &Tx{\n\t\tconfig: cfg,\n\t\tEatinghistory: NewEatinghistoryClient(cfg),\n\t\tFoodmenu: NewFoodmenuClient(cfg),\n\t\tMealplan: NewMealplanClient(cfg),\n\t\tTaste: NewTasteClient(cfg),\n\t\tUser: NewUserClient(cfg),\n\t}, nil\n}", "func (c *Client) BeginTx(ctx context.Context, opts *sql.TxOptions) (*Tx, error) {\n\tif _, ok := c.driver.(*txDriver); ok {\n\t\treturn nil, fmt.Errorf(\"ent: cannot start a transaction within a transaction\")\n\t}\n\ttx, err := c.driver.(*sql.Driver).BeginTx(ctx, opts)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"ent: starting a transaction: %v\", err)\n\t}\n\tcfg := config{driver: &txDriver{tx: tx, drv: c.driver}, log: c.log, debug: c.debug, hooks: c.hooks}\n\treturn &Tx{\n\t\tconfig: cfg,\n\t\tGender: NewGenderClient(cfg),\n\t\tPosition: NewPositionClient(cfg),\n\t\tTitle: NewTitleClient(cfg),\n\t\tUser: NewUserClient(cfg),\n\t}, nil\n}", "func TxFromContext(ctx context.Context) *Tx {\r\n\tif tx, ok := ctx.Value(exec).(*Tx); ok {\r\n\t\treturn tx\r\n\t}\r\n\treturn nil\r\n}", "func (c *Client) BeginTx(ctx context.Context, opts *sql.TxOptions) (*Tx, error) {\n\tif _, ok := c.driver.(*txDriver); ok {\n\t\treturn nil, fmt.Errorf(\"ent: cannot start a transaction within a transaction\")\n\t}\n\ttx, err := c.driver.(interface {\n\t\tBeginTx(context.Context, *sql.TxOptions) (dialect.Tx, error)\n\t}).BeginTx(ctx, opts)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"ent: starting a transaction: %w\", err)\n\t}\n\tcfg := c.config\n\tcfg.driver = &txDriver{tx: tx, drv: c.driver}\n\treturn &Tx{\n\t\tconfig: cfg,\n\t\tEvent: NewEventClient(cfg),\n\t\tTag: NewTagClient(cfg),\n\t}, nil\n}", "func (d *Driver) Tx(ctx context.Context) (dialect.Tx, error) {\n\treturn d.BeginTx(ctx, nil)\n}", "func (c *Client) BeginTx(ctx context.Context, opts *sql.TxOptions) (*Tx, error) {\n\tif _, ok := c.driver.(*txDriver); ok {\n\t\treturn nil, fmt.Errorf(\"ent: cannot start a transaction within a transaction\")\n\t}\n\ttx, err := c.driver.(*sql.Driver).BeginTx(ctx, opts)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"ent: starting a transaction: %v\", err)\n\t}\n\tcfg := config{driver: &txDriver{tx: tx, drv: c.driver}, log: c.log, debug: c.debug, hooks: c.hooks}\n\treturn &Tx{\n\t\tconfig: cfg,\n\t\tCard: NewCardClient(cfg),\n\t\tCardScan: NewCardScanClient(cfg),\n\t\tPlaylist: NewPlaylistClient(cfg),\n\t}, nil\n}", "func TxFromContext(ctx context.Context) (*sql.Tx, bool) {\n\ttx, ok := ctx.Value(dbTxCtxKey).(*sql.Tx)\n\treturn tx, ok\n}", "func FromContext(c echo.Context) *newrelic.Transaction {\n\treturn newrelic.FromContext(c.Request().Context())\n}", "func (c *Client) BeginTx(ctx context.Context, opts *sql.TxOptions) (*Tx, error) {\n\tif _, ok := c.driver.(*txDriver); ok {\n\t\treturn nil, fmt.Errorf(\"ent: cannot start a transaction within a transaction\")\n\t}\n\ttx, err := c.driver.(*sql.Driver).BeginTx(ctx, opts)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"ent: starting a transaction: %v\", err)\n\t}\n\tcfg := config{driver: &txDriver{tx: tx, drv: c.driver}, log: c.log, debug: c.debug, hooks: c.hooks}\n\treturn &Tx{\n\t\tconfig: cfg,\n\t\tDNSBLQuery: NewDNSBLQueryClient(cfg),\n\t\tDNSBLResponse: NewDNSBLResponseClient(cfg),\n\t\tIP: NewIPClient(cfg),\n\t\tOperation: NewOperationClient(cfg),\n\t\tUser: NewUserClient(cfg),\n\t}, nil\n}", "func GetTx() *TX {\n\ttx := &TX{\n\t\tDB: DB.Begin(),\n\t\tfired: false,\n\t}\n\treturn tx\n}", "func (w *DBConnWrapper) BeginTx(ctx context.Context, opts *sql.TxOptions) (*sql.Tx, error) {\n\treturn w.beginTxFunc(ctx, opts)\n}", "func (c *sqlmock) BeginTx(ctx context.Context, opts driver.TxOptions) (driver.Tx, error) {\n\tex, err := c.begin()\n\tif ex != nil {\n\t\tselect {\n\t\tcase <-time.After(ex.delay):\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t\treturn c, nil\n\t\tcase <-ctx.Done():\n\t\t\treturn nil, ErrCancelled\n\t\t}\n\t}\n\n\treturn nil, err\n}", "func (p *politeiawww) beginTx() (*sql.Tx, func(), error) {\n\tctx, cancel := ctxForTx()\n\n\topts := &sql.TxOptions{\n\t\tIsolation: sql.LevelDefault,\n\t}\n\ttx, err := p.db.BeginTx(ctx, opts)\n\tif err != nil {\n\t\treturn nil, nil, errors.WithStack(err)\n\t}\n\n\treturn tx, cancel, nil\n}", "func newTx(ctx context.Context, drv dialect.Driver) (*txDriver, error) {\n\ttx, err := drv.Tx(ctx)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &txDriver{tx: tx, drv: drv}, nil\n}", "func newTx(ctx context.Context, drv dialect.Driver) (*txDriver, error) {\n\ttx, err := drv.Tx(ctx)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &txDriver{tx: tx, drv: drv}, nil\n}", "func (t *Transacter) WithTx(ctx context.Context) context.Context {\r\n\treturn WithTxContext(ctx)\r\n}", "func (f *userFactory) Tx(tx *ent.Tx) *userFactory {\n\treturn f.Client(tx.Client())\n}", "func (c *Conn) Ctx(ctx context.Context) *Conn {\n\tc.ctx = ctx\n\treturn c\n}", "func (c *Client) BeginTx(ctx context.Context, opts *sql.TxOptions) (*Tx, error) {\n\tif _, ok := c.driver.(*txDriver); ok {\n\t\treturn nil, fmt.Errorf(\"ent: cannot start a transaction within a transaction\")\n\t}\n\ttx, err := c.driver.(*sql.Driver).BeginTx(ctx, opts)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"ent: starting a transaction: %v\", err)\n\t}\n\tcfg := config{driver: &txDriver{tx: tx, drv: c.driver}, log: c.log, debug: c.debug}\n\treturn &Tx{\n\t\tconfig: cfg,\n\t\tBlob: NewBlobClient(cfg),\n\t}, nil\n}", "func newTx(meta metaStore, store localStore) *tx {\n\treturn &tx{\n\t\tmeta: meta,\n\t\tstore: store,\n\t\tnow: time.Now(),\n\t}\n}", "func TransactContext(ctx context.Context, opts *sql.TxOptions, db DB, fn func(ctx context.Context, tx *sql.Tx) error) (err error) {\n\ttx, err := db.BeginTx(ctx, opts)\n\tif err != nil {\n\t\treturn\n\t}\n\tdefer func() {\n\t\tif p := recover(); p != nil {\n\t\t\ttx.Rollback()\n\t\t\tpanic(p)\n\t\t} else if err != nil {\n\t\t\ttx.Rollback()\n\t\t} else {\n\t\t\terr = tx.Commit()\n\t\t}\n\t}()\n\terr = fn(ctx, tx)\n\treturn err\n}", "func NewTx(ro bool) (Transaction, error) {\n\tif ro {\n\t\treturn readOnlyDB.NewTx()\n\t}\n\n\treturn readWriteDB.NewTx()\n}", "func (db *DB) GetTx() *GetTx {\n\treturn &GetTx{\n\t\tdb: db,\n\t}\n}", "func WithTx(ctx context.Context, pool *pgx.ConnPool, fn TxFunc, opts *pgx.TxOptions) (err error) {\n\ttx, err := pool.BeginEx(ctx, opts)\n\tif err != nil {\n\t\treturn status.ErrInternal().WithError(err)\n\t}\n\tdefer func() {\n\t\tif p := recover(); p != nil {\n\t\t\ttx.Rollback()\n\t\t\tpanic(p)\n\t\t} else if err != nil {\n\t\t\ttx.Rollback()\n\t\t} else {\n\t\t\tif errc := tx.Commit(); errc != nil {\n\t\t\t\terr = status.ErrInternal().WithError(errc)\n\t\t\t}\n\t\t}\n\t}()\n\terr = fn(ctx, tx)\n\tif err != nil {\n\t\tif _, ok := err.(status.ErrServiceStatus); !ok {\n\t\t\treturn status.ErrInternal().WithError(err)\n\t\t}\n\t}\n\treturn err\n}", "func (db *Database) BeginTx(ctx context.Context, opts *TxOptions) (*Transaction, error) {\n\tif opts == nil {\n\t\topts = new(TxOptions)\n\t}\n\n\tdb.attachedTxMu.Lock()\n\tdefer db.attachedTxMu.Unlock()\n\n\tif db.attachedTransaction != nil {\n\t\treturn nil, errors.New(\"cannot open a transaction within a transaction\")\n\t}\n\n\tntx, err := db.ng.Begin(ctx, engine.TxOptions{\n\t\tWritable: !opts.ReadOnly,\n\t})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\ttx := Transaction{\n\t\tdb: db,\n\t\ttx: ntx,\n\t\twritable: !opts.ReadOnly,\n\t\tattached: opts.Attached,\n\t}\n\n\ttx.tableInfoStore, err = tx.getTableInfoStore()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\ttx.indexStore, err = tx.getIndexStore()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tif opts.Attached {\n\t\tdb.attachedTransaction = &tx\n\t}\n\n\treturn &tx, nil\n}", "func (e *Engine) Begin(ctx context.Context, lock bool) (*Transaction, error) {\n\t// acquire lock\n\te.mutex.Lock()\n\tdefer e.mutex.Unlock()\n\n\t// check if closed\n\tif e.closed {\n\t\treturn nil, ErrEngineClosed\n\t}\n\n\t// non lock transactions do not need to be managed\n\tif !lock {\n\t\treturn NewTransaction(e.catalog), nil\n\t}\n\n\t// ensure context\n\tctx = ensureContext(ctx)\n\n\t// check for transaction\n\tsess, ok := ctx.Value(sessionKey{}).(*Session)\n\tif ok {\n\t\ttxn := sess.Transaction()\n\t\tif txn != nil {\n\t\t\treturn nil, fmt.Errorf(\"detected nested transaction\")\n\t\t}\n\t}\n\n\t// acquire token (without lock)\n\te.mutex.Unlock()\n\tok = e.token.Acquire(ctx.Done(), time.Minute)\n\te.mutex.Lock()\n\tif !ok {\n\t\treturn nil, fmt.Errorf(\"token acquisition timeout\")\n\t}\n\n\t// assert transaction\n\tif e.txn != nil {\n\t\te.token.Release()\n\t\treturn nil, fmt.Errorf(\"existing transaction\")\n\t}\n\n\t// create transaction\n\te.txn = NewTransaction(e.catalog)\n\n\treturn e.txn, nil\n}", "func Tx(ctx context.Context, db *sqlx.DB, opts *sqltx.Options, fn TXFn) (err error) {\n\treturn sqltx.TxHandler(ctx, &sqlxDB{db}, opts, func(tx sqltx.TXer) error {\n\t\treturn fn(tx.(*sqlx.Tx))\n\t})\n}", "func (c *ConnWrapper) BeginTx(ctx context.Context, opts driver.TxOptions) (tx driver.Tx, err error) {\n\tif connBeginTx, ok := c.Conn.(driver.ConnBeginTx); ok {\n\t\treturn connBeginTx.BeginTx(ctx, opts)\n\t}\n\n\treturn c.Conn.Begin()\n}", "func (database *Database) BeginTx(ctx context.Context, opts *sql.TxOptions) (*sql.Tx, error) {\n\treturn database.db.(TxStarter).BeginTx(ctx, opts)\n}", "func (v *connection) BeginTx(ctx context.Context, opts driver.TxOptions) (driver.Tx, error) {\n\tconnectionLogger.Trace(\"connection.BeginTx()\")\n\treturn newTransaction(ctx, v, opts)\n}", "func (b *BadgerStore) NewTx(autoFinish, renew bool) types.Tx {\n\treturn NewTx(b.db, autoFinish, renew)\n}", "func NewTx(sqlTx *sql.Tx) (sqlbuilder.Tx, error) {\n\treturn registeredAdapter.NewTx(sqlTx)\n}", "func NewTransactionClient(c config) *TransactionClient {\n\treturn &TransactionClient{config: c}\n}", "func (ar *AwsRedshift) OpenTx() (*Transaction, error) {\n\ttx, err := ar.dataSourceProxy.dataSource.BeginTx(ar.dataSourceProxy.ctx, nil)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn &Transaction{tx: tx, dbType: ar.Type()}, nil\n}", "func WithinTx(db DB, fn FuncInTransaction, options ...transaction.Option) error {\n\treturn WithinTemplate(db.Options().RetryTxCount,\n\t\tfunc() time.Duration {\n\t\t\treturn db.Options().RetryTxInterval\n\t\t},\n\t\tfunc() (ITransaction, error) {\n\t\t\treturn db.BeginTx(options...)\n\t\t},\n\t\tfunc(tx ITransaction) error {\n\t\t\treturn fn(tx.(transaction.Transaction))\n\t\t},\n\t)\n}", "func (db *DB) Begin() (*Tx, error) {\n\tif db.isTx {\n\t\treturn nil, ErrNestTx\n\t}\n\n\ttx := new(Tx)\n\n\ttx.DB = new(DB)\n\ttx.DB.dbLock = db.dbLock\n\n\ttx.DB.dbLock.Lock()\n\n\ttx.DB.l = db.l\n\ttx.index = db.index\n\n\ttx.DB.sdb = db.sdb\n\n\tvar err error\n\ttx.tx, err = db.sdb.Begin()\n\tif err != nil {\n\t\ttx.DB.dbLock.Unlock()\n\t\treturn nil, err\n\t}\n\n\ttx.DB.bucket = tx.tx\n\n\ttx.DB.isTx = true\n\n\ttx.DB.index = db.index\n\n\ttx.DB.kvBatch = tx.newBatch()\n\ttx.DB.listBatch = tx.newBatch()\n\ttx.DB.hashBatch = tx.newBatch()\n\ttx.DB.zsetBatch = tx.newBatch()\n\ttx.DB.binBatch = tx.newBatch()\n\ttx.DB.setBatch = tx.newBatch()\n\n\treturn tx, nil\n}", "func NewTransactionWithContext(ctx context.Context) (*sql.Tx, context.Context, error) {\n\tvar (\n\t\ttx *sql.Tx\n\t\terr error\n\t)\n\n\t// get the new transaction\n\ttx, err = DB.DirDB.Begin()\n\tif err != nil {\n\t\treturn tx, ctx, err\n\t}\n\n\t// set the transaction in context\n\tctx = SetDBTxContextKey(ctx, tx)\n\n\treturn tx, ctx, err\n}", "func (s *Service) CreateClientTx(tx *gorm.DB, clientID, secret, redirectURI string) (*models.OauthClient, error) {\n\treturn s.createClientCommon(tx, clientID, secret, redirectURI)\n}", "func (db *DB) WithContext(ctx context.Context) *pg.DB {\n\tif db.tx != nil {\n\t\t// is actually a transaction\n\t\t// panic because we can't return an error without breaking the interface contract\n\t\tpanic(\"cannot call WithContext in a transaction\")\n\t}\n\treturn db.inner.WithContext(ctx)\n}", "func (m *MSSQLDatastore) BeginTx(ctx context.Context) (Transaction, error) {\n\ttx, err := m.db.BeginTx(ctx, &sql.TxOptions{})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn &MSSQLTx{db: m.db, tx: tx}, nil\n}", "func CreateWithTx(ctx context.Context, dr *firestore.DocumentRef, data interface{}) error {\n\ttx, ok := GetTx(ctx)\n\tif ok {\n\t\treturn tx.Create(dr, data)\n\t} else {\n\t\t_, err := dr.Create(ctx, data)\n\t\treturn err\n\t}\n}", "func GetTX(c echo.Context) newrelic.Transaction {\n\ttx := c.Get(\"txn\")\n\tif tx == nil {\n\t\treturn nil\n\t}\n\n\treturn tx.(newrelic.Transaction)\n}", "func GetTX(c echo.Context) newrelic.Transaction {\n\ttx := c.Get(\"txn\")\n\tif tx == nil {\n\t\treturn nil\n\t}\n\n\treturn tx.(newrelic.Transaction)\n}", "func GetTX(c echo.Context) newrelic.Transaction {\n\ttx := c.Get(\"txn\")\n\tif tx == nil {\n\t\treturn nil\n\t}\n\n\treturn tx.(newrelic.Transaction)\n}", "func (db *GoLevelDB) BeginTx() (TxKV, error) {\n\ttx, err := db.db.OpenTransaction()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &goLevelDBTx{tx: tx}, nil\n}", "func WithTx(db *sql.DB, query func(*sql.Tx) error) error {\n\ttx, err := db.Begin()\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer tx.Rollback()\n\terr = query(tx)\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn tx.Commit()\n}", "func (c *Context) GetTx() interface{} {\n\treturn c.tx\n}", "func (c *Context) Ctx() context.Context {\n\treturn context.WithValue(c.state.ctx, contextKey{}, c)\n}", "func Transaction(next http.Handler) http.Handler {\n\tfn := func(w http.ResponseWriter, r *http.Request) {\n\t\tt, ctx := orm.NewTransaction(r.Context())\n\t\tdefer func() {\n\t\t\tif rec := recover(); rec != nil {\n\t\t\t\tt.Rollback()\n\t\t\t\t// Panic to let recoverer handle 500\n\t\t\t\tpanic(rec)\n\t\t\t} else {\n\t\t\t\terr := t.Commit()\n\t\t\t\tif err != nil {\n\t\t\t\t\tpanic(err)\n\t\t\t\t}\n\t\t\t}\n\t\t}()\n\t\tnext.ServeHTTP(w, r.WithContext(ctx))\n\t}\n\treturn http.HandlerFunc(fn)\n}", "func TxGetContext(ctx context.Context, tx *sqlx.Tx, builder sq.Sqlizer, dest interface{}) error {\n\tsqlStr, args, err := builder.ToSql()\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn tx.GetContext(ctx, dest, sqlStr, args...)\n}", "func (db *DB) BeginTx(ctx context.Context, opts *sql.TxOptions) (*sql.Tx, error) {\n\treturn db.master.BeginTx(ctx, opts)\n}", "func (db *DB) BeginTx(ctx context.Context, opts *sql.TxOptions) (*sql.Tx, error) {\n\treturn db.Master().BeginTx(ctx, opts)\n}", "func WithTransactionContext(ctx context.Context, tx *bolt.Tx) context.Context {\n\treturn context.WithValue(ctx, transactionKey{}, tx)\n}", "func (ds *DataStore) BeginTx(ctx context.Context) (persistence.Tx, persistence.Committer, error) {\n\ttx, err := ds.DB.BeginTx(ctx, txOptions)\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\n\treturn &Tx{ds, tx}, tx, nil\n}" ]
[ "0.75281006", "0.7450889", "0.74375165", "0.7425923", "0.74131805", "0.74117035", "0.7403872", "0.7393596", "0.73722124", "0.734179", "0.73408645", "0.73340017", "0.73313963", "0.7328541", "0.7324701", "0.731626", "0.7308523", "0.7273194", "0.7267323", "0.7257192", "0.7255535", "0.7232519", "0.671936", "0.66869235", "0.6593615", "0.6565869", "0.654811", "0.654621", "0.652135", "0.652135", "0.6466022", "0.6408555", "0.6401879", "0.63842416", "0.631273", "0.6270933", "0.6244562", "0.6242234", "0.62292635", "0.6226315", "0.62248", "0.6215315", "0.62121695", "0.6197707", "0.6192191", "0.6190258", "0.61853254", "0.6163484", "0.6159016", "0.61558247", "0.6154009", "0.6151539", "0.6120693", "0.61152256", "0.61122113", "0.6099518", "0.6057098", "0.6050476", "0.602393", "0.60203135", "0.60203135", "0.60122293", "0.5997552", "0.5953064", "0.59432817", "0.5898168", "0.58905804", "0.58416456", "0.5830524", "0.5828212", "0.5816406", "0.58136684", "0.5810461", "0.5806161", "0.5759462", "0.5758094", "0.5734385", "0.5733007", "0.5700682", "0.5690572", "0.56903607", "0.56841105", "0.56781703", "0.5676447", "0.5667145", "0.56573874", "0.56533813", "0.5646171", "0.5646171", "0.5646171", "0.56444746", "0.5641031", "0.5617116", "0.56138253", "0.5613637", "0.5611876", "0.56048834", "0.55974376", "0.55824214", "0.557467" ]
0.7348015
9
BeginTx returns a transactional client with specified options.
func (c *Client) BeginTx(ctx context.Context, opts *sql.TxOptions) (*Tx, error) { if _, ok := c.driver.(*txDriver); ok { return nil, fmt.Errorf("ent: cannot start a transaction within a transaction") } tx, err := c.driver.(interface { BeginTx(context.Context, *sql.TxOptions) (dialect.Tx, error) }).BeginTx(ctx, opts) if err != nil { return nil, fmt.Errorf("ent: starting a transaction: %w", err) } cfg := c.config cfg.driver = &txDriver{tx: tx, drv: c.driver} return &Tx{ config: cfg, Admin: NewAdminClient(cfg), AdminSession: NewAdminSessionClient(cfg), Category: NewCategoryClient(cfg), Post: NewPostClient(cfg), PostAttachment: NewPostAttachmentClient(cfg), PostImage: NewPostImageClient(cfg), PostThumbnail: NewPostThumbnailClient(cfg), PostVideo: NewPostVideoClient(cfg), UnsavedPost: NewUnsavedPostClient(cfg), UnsavedPostAttachment: NewUnsavedPostAttachmentClient(cfg), UnsavedPostImage: NewUnsavedPostImageClient(cfg), UnsavedPostThumbnail: NewUnsavedPostThumbnailClient(cfg), UnsavedPostVideo: NewUnsavedPostVideoClient(cfg), }, nil }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (c *Client) BeginTx(ctx context.Context, opts *sql.TxOptions) (*Tx, error) {\n\tif _, ok := c.driver.(*txDriver); ok {\n\t\treturn nil, fmt.Errorf(\"ent: cannot start a transaction within a transaction\")\n\t}\n\ttx, err := c.driver.(*sql.Driver).BeginTx(ctx, opts)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"ent: starting a transaction: %v\", err)\n\t}\n\tcfg := config{driver: &txDriver{tx: tx, drv: c.driver}, log: c.log, debug: c.debug, hooks: c.hooks}\n\treturn &Tx{\n\t\tconfig: cfg,\n\t\tAcademicYear: NewAcademicYearClient(cfg),\n\t\tActivities: NewActivitiesClient(cfg),\n\t\tActivityType: NewActivityTypeClient(cfg),\n\t\tClub: NewClubClient(cfg),\n\t\tClubBranch: NewClubBranchClient(cfg),\n\t\tClubType: NewClubTypeClient(cfg),\n\t\tClubappStatus: NewClubappStatusClient(cfg),\n\t\tClubapplication: NewClubapplicationClient(cfg),\n\t\tComplaint: NewComplaintClient(cfg),\n\t\tComplaintType: NewComplaintTypeClient(cfg),\n\t\tDiscipline: NewDisciplineClient(cfg),\n\t\tGender: NewGenderClient(cfg),\n\t\tPosition: NewPositionClient(cfg),\n\t\tPurpose: NewPurposeClient(cfg),\n\t\tRoom: NewRoomClient(cfg),\n\t\tRoomuse: NewRoomuseClient(cfg),\n\t\tUser: NewUserClient(cfg),\n\t\tUserStatus: NewUserStatusClient(cfg),\n\t\tUsertype: NewUsertypeClient(cfg),\n\t\tYear: NewYearClient(cfg),\n\t}, nil\n}", "func (c *Client) BeginTx(ctx context.Context, opts *sql.TxOptions) (*Tx, error) {\n\tif _, ok := c.driver.(*txDriver); ok {\n\t\treturn nil, fmt.Errorf(\"ent: cannot start a transaction within a transaction\")\n\t}\n\ttx, err := c.driver.(*sql.Driver).BeginTx(ctx, opts)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"ent: starting a transaction: %v\", err)\n\t}\n\tcfg := config{driver: &txDriver{tx: tx, drv: c.driver}, log: c.log, debug: c.debug, hooks: c.hooks}\n\treturn &Tx{\n\t\tconfig: cfg,\n\t\tAnnotation: NewAnnotationClient(cfg),\n\t\tBill: NewBillClient(cfg),\n\t\tCompany: NewCompanyClient(cfg),\n\t\tDispenseMedicine: NewDispenseMedicineClient(cfg),\n\t\tDoctor: NewDoctorClient(cfg),\n\t\tDrugAllergy: NewDrugAllergyClient(cfg),\n\t\tLevelOfDangerous: NewLevelOfDangerousClient(cfg),\n\t\tMedicine: NewMedicineClient(cfg),\n\t\tMedicineType: NewMedicineTypeClient(cfg),\n\t\tOrder: NewOrderClient(cfg),\n\t\tPatientInfo: NewPatientInfoClient(cfg),\n\t\tPayment: NewPaymentClient(cfg),\n\t\tPharmacist: NewPharmacistClient(cfg),\n\t\tPositionInPharmacist: NewPositionInPharmacistClient(cfg),\n\t\tPrescription: NewPrescriptionClient(cfg),\n\t\tUnitOfMedicine: NewUnitOfMedicineClient(cfg),\n\t}, nil\n}", "func (c *Client) BeginTx(ctx context.Context, opts *sql.TxOptions) (*Tx, error) {\n\tif _, ok := c.driver.(*txDriver); ok {\n\t\treturn nil, fmt.Errorf(\"ent: cannot start a transaction within a transaction\")\n\t}\n\ttx, err := c.driver.(*sql.Driver).BeginTx(ctx, opts)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"ent: starting a transaction: %v\", err)\n\t}\n\tcfg := config{driver: &txDriver{tx: tx, drv: c.driver}, log: c.log, debug: c.debug, hooks: c.hooks}\n\treturn &Tx{\n\t\tconfig: cfg,\n\t\tAppointment: NewAppointmentClient(cfg),\n\t\tClinic: NewClinicClient(cfg),\n\t\tCustomer: NewCustomerClient(cfg),\n\t\tPet: NewPetClient(cfg),\n\t\tUser: NewUserClient(cfg),\n\t\tVeterinarian: NewVeterinarianClient(cfg),\n\t}, nil\n}", "func (c *Client) BeginTx(ctx context.Context, opts *sql.TxOptions) (*Tx, error) {\n\tif _, ok := c.driver.(*txDriver); ok {\n\t\treturn nil, fmt.Errorf(\"ent: cannot start a transaction within a transaction\")\n\t}\n\ttx, err := c.driver.(*sql.Driver).BeginTx(ctx, opts)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"ent: starting a transaction: %v\", err)\n\t}\n\tcfg := config{driver: &txDriver{tx: tx, drv: c.driver}, log: c.log, debug: c.debug, hooks: c.hooks}\n\treturn &Tx{\n\t\tconfig: cfg,\n\t\tBedtype: NewBedtypeClient(cfg),\n\t\tBill: NewBillClient(cfg),\n\t\tCleanername: NewCleanernameClient(cfg),\n\t\tCleaningroom: NewCleaningroomClient(cfg),\n\t\tDeposit: NewDepositClient(cfg),\n\t\tEmployee: NewEmployeeClient(cfg),\n\t\tJobposition: NewJobpositionClient(cfg),\n\t\tLease: NewLeaseClient(cfg),\n\t\tLengthtime: NewLengthtimeClient(cfg),\n\t\tPayment: NewPaymentClient(cfg),\n\t\tPetrule: NewPetruleClient(cfg),\n\t\tPledge: NewPledgeClient(cfg),\n\t\tRentalstatus: NewRentalstatusClient(cfg),\n\t\tRepairinvoice: NewRepairinvoiceClient(cfg),\n\t\tRoomdetail: NewRoomdetailClient(cfg),\n\t\tSituation: NewSituationClient(cfg),\n\t\tStatusd: NewStatusdClient(cfg),\n\t\tStaytype: NewStaytypeClient(cfg),\n\t\tWifi: NewWifiClient(cfg),\n\t}, nil\n}", "func (c *Client) BeginTx(ctx context.Context, opts *sql.TxOptions) (*Tx, error) {\n\tif _, ok := c.driver.(*txDriver); ok {\n\t\treturn nil, fmt.Errorf(\"ent: cannot start a transaction within a transaction\")\n\t}\n\ttx, err := c.driver.(interface {\n\t\tBeginTx(context.Context, *sql.TxOptions) (dialect.Tx, error)\n\t}).BeginTx(ctx, opts)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"ent: starting a transaction: %w\", err)\n\t}\n\tcfg := c.config\n\tcfg.driver = &txDriver{tx: tx, drv: c.driver}\n\treturn &Tx{\n\t\tconfig: cfg,\n\t\tCompany: NewCompanyClient(cfg),\n\t\tJob: NewJobClient(cfg),\n\t\tSkill: NewSkillClient(cfg),\n\t\tUser: NewUserClient(cfg),\n\t\tWorkExperience: NewWorkExperienceClient(cfg),\n\t}, nil\n}", "func (c *Client) BeginTx(ctx context.Context, opts *sql.TxOptions) (*Tx, error) {\n\tif _, ok := c.driver.(*txDriver); ok {\n\t\treturn nil, fmt.Errorf(\"ent: cannot start a transaction within a transaction\")\n\t}\n\ttx, err := c.driver.(interface {\n\t\tBeginTx(context.Context, *sql.TxOptions) (dialect.Tx, error)\n\t}).BeginTx(ctx, opts)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"ent: starting a transaction: %w\", err)\n\t}\n\tcfg := c.config\n\tcfg.driver = &txDriver{tx: tx, drv: c.driver}\n\treturn &Tx{\n\t\tconfig: cfg,\n\t\tCoinInfo: NewCoinInfoClient(cfg),\n\t\tEmpty: NewEmptyClient(cfg),\n\t\tKeyStore: NewKeyStoreClient(cfg),\n\t\tReview: NewReviewClient(cfg),\n\t\tTransaction: NewTransactionClient(cfg),\n\t\tWalletNode: NewWalletNodeClient(cfg),\n\t}, nil\n}", "func (c *Client) BeginTx(ctx context.Context, opts *sql.TxOptions) (*Tx, error) {\n\tif _, ok := c.driver.(*txDriver); ok {\n\t\treturn nil, fmt.Errorf(\"ent: cannot start a transaction within a transaction\")\n\t}\n\ttx, err := c.driver.(*sql.Driver).BeginTx(ctx, opts)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"ent: starting a transaction: %v\", err)\n\t}\n\tcfg := config{driver: &txDriver{tx: tx, drv: c.driver}, log: c.log, debug: c.debug, hooks: c.hooks}\n\treturn &Tx{\n\t\tconfig: cfg,\n\t\tDepartment: NewDepartmentClient(cfg),\n\t\tPhysician: NewPhysicianClient(cfg),\n\t\tPosition: NewPositionClient(cfg),\n\t\tPositionassingment: NewPositionassingmentClient(cfg),\n\t}, nil\n}", "func (c *Client) BeginTx(ctx context.Context, opts *sql.TxOptions) (*Tx, error) {\n\tif _, ok := c.driver.(*txDriver); ok {\n\t\treturn nil, fmt.Errorf(\"ent: cannot start a transaction within a transaction\")\n\t}\n\ttx, err := c.driver.(*sql.Driver).BeginTx(ctx, opts)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"ent: starting a transaction: %v\", err)\n\t}\n\tcfg := config{driver: &txDriver{tx: tx, drv: c.driver}, log: c.log, debug: c.debug, hooks: c.hooks}\n\treturn &Tx{\n\t\tconfig: cfg,\n\t\tExaminationroom: NewExaminationroomClient(cfg),\n\t\tNurse: NewNurseClient(cfg),\n\t\tOperative: NewOperativeClient(cfg),\n\t\tOperativerecord: NewOperativerecordClient(cfg),\n\t\tTool: NewToolClient(cfg),\n\t}, nil\n}", "func (c *Client) BeginTx(ctx context.Context, opts *sql.TxOptions) (*Tx, error) {\n\tif _, ok := c.driver.(*txDriver); ok {\n\t\treturn nil, fmt.Errorf(\"ent: cannot start a transaction within a transaction\")\n\t}\n\ttx, err := c.driver.(interface {\n\t\tBeginTx(context.Context, *sql.TxOptions) (dialect.Tx, error)\n\t}).BeginTx(ctx, opts)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"ent: starting a transaction: %w\", err)\n\t}\n\tcfg := c.config\n\tcfg.driver = &txDriver{tx: tx, drv: c.driver}\n\treturn &Tx{\n\t\tconfig: cfg,\n\t\tBinaryFile: NewBinaryFileClient(cfg),\n\t\tUser: NewUserClient(cfg),\n\t}, nil\n}", "func (c *Client) BeginTx(ctx context.Context, opts *sql.TxOptions) (*Tx, error) {\n\tif _, ok := c.driver.(*txDriver); ok {\n\t\treturn nil, fmt.Errorf(\"ent: cannot start a transaction within a transaction\")\n\t}\n\ttx, err := c.driver.(*sql.Driver).BeginTx(ctx, opts)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"ent: starting a transaction: %v\", err)\n\t}\n\tcfg := config{driver: &txDriver{tx: tx, drv: c.driver}, log: c.log, debug: c.debug, hooks: c.hooks}\n\treturn &Tx{\n\t\tconfig: cfg,\n\t\tBill: NewBillClient(cfg),\n\t\tBillingstatus: NewBillingstatusClient(cfg),\n\t\tBranch: NewBranchClient(cfg),\n\t\tBuilding: NewBuildingClient(cfg),\n\t\tDevice: NewDeviceClient(cfg),\n\t\tEmployee: NewEmployeeClient(cfg),\n\t\tFaculty: NewFacultyClient(cfg),\n\t\tPart: NewPartClient(cfg),\n\t\tPartorder: NewPartorderClient(cfg),\n\t\tRepairInvoice: NewRepairInvoiceClient(cfg),\n\t\tReturninvoice: NewReturninvoiceClient(cfg),\n\t\tRoom: NewRoomClient(cfg),\n\t\tStatusR: NewStatusRClient(cfg),\n\t\tStatust: NewStatustClient(cfg),\n\t\tSymptom: NewSymptomClient(cfg),\n\t\tUser: NewUserClient(cfg),\n\t}, nil\n}", "func (c *Client) BeginTx(ctx context.Context, opts *sql.TxOptions) (*Tx, error) {\n\tif _, ok := c.driver.(*txDriver); ok {\n\t\treturn nil, fmt.Errorf(\"ent: cannot start a transaction within a transaction\")\n\t}\n\ttx, err := c.driver.(*sql.Driver).BeginTx(ctx, opts)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"ent: starting a transaction: %v\", err)\n\t}\n\tcfg := config{driver: &txDriver{tx: tx, drv: c.driver}, log: c.log, debug: c.debug, hooks: c.hooks}\n\treturn &Tx{\n\t\tconfig: cfg,\n\t\tGender: NewGenderClient(cfg),\n\t\tPosition: NewPositionClient(cfg),\n\t\tTitle: NewTitleClient(cfg),\n\t\tUser: NewUserClient(cfg),\n\t}, nil\n}", "func (c *Client) BeginTx(ctx context.Context, opts *sql.TxOptions) (*Tx, error) {\n\tif _, ok := c.driver.(*txDriver); ok {\n\t\treturn nil, fmt.Errorf(\"ent: cannot start a transaction within a transaction\")\n\t}\n\ttx, err := c.driver.(interface {\n\t\tBeginTx(context.Context, *sql.TxOptions) (dialect.Tx, error)\n\t}).BeginTx(ctx, opts)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"ent: starting a transaction: %w\", err)\n\t}\n\tcfg := c.config\n\tcfg.driver = &txDriver{tx: tx, drv: c.driver}\n\treturn &Tx{\n\t\tconfig: cfg,\n\t\tUser: NewUserClient(cfg),\n\t\tUserCard: NewUserCardClient(cfg),\n\t\tUserWallet: NewUserWalletClient(cfg),\n\t}, nil\n}", "func (c *Client) BeginTx(ctx context.Context, opts *sql.TxOptions) (*Tx, error) {\n\tif _, ok := c.driver.(*txDriver); ok {\n\t\treturn nil, fmt.Errorf(\"ent: cannot start a transaction within a transaction\")\n\t}\n\ttx, err := c.driver.(interface {\n\t\tBeginTx(context.Context, *sql.TxOptions) (dialect.Tx, error)\n\t}).BeginTx(ctx, opts)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"ent: starting a transaction: %w\", err)\n\t}\n\tcfg := c.config\n\tcfg.driver = &txDriver{tx: tx, drv: c.driver}\n\treturn &Tx{\n\t\tctx: ctx,\n\t\tconfig: cfg,\n\t\tBeer: NewBeerClient(cfg),\n\t\tMedia: NewMediaClient(cfg),\n\t}, nil\n}", "func (c *Client) BeginTx(ctx context.Context, opts *sql.TxOptions) (*Tx, error) {\n\tif _, ok := c.driver.(*txDriver); ok {\n\t\treturn nil, fmt.Errorf(\"ent: cannot start a transaction within a transaction\")\n\t}\n\ttx, err := c.driver.(*sql.Driver).BeginTx(ctx, opts)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"ent: starting a transaction: %v\", err)\n\t}\n\tcfg := config{driver: &txDriver{tx: tx, drv: c.driver}, log: c.log, debug: c.debug, hooks: c.hooks}\n\treturn &Tx{\n\t\tconfig: cfg,\n\t\tPatient: NewPatientClient(cfg),\n\t\tPatientofphysician: NewPatientofphysicianClient(cfg),\n\t\tPatientroom: NewPatientroomClient(cfg),\n\t\tPhysician: NewPhysicianClient(cfg),\n\t}, nil\n}", "func (c *Client) BeginTx(ctx context.Context, opts *sql.TxOptions) (*Tx, error) {\n\tif _, ok := c.driver.(*txDriver); ok {\n\t\treturn nil, fmt.Errorf(\"ent: cannot start a transaction within a transaction\")\n\t}\n\ttx, err := c.driver.(*sql.Driver).BeginTx(ctx, opts)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"ent: starting a transaction: %v\", err)\n\t}\n\tcfg := config{driver: &txDriver{tx: tx, drv: c.driver}, log: c.log, debug: c.debug, hooks: c.hooks}\n\treturn &Tx{\n\t\tconfig: cfg,\n\t\tDentist: NewDentistClient(cfg),\n\t\tEmployee: NewEmployeeClient(cfg),\n\t\tPatient: NewPatientClient(cfg),\n\t\tQueue: NewQueueClient(cfg),\n\t}, nil\n}", "func (c *Client) BeginTx(ctx context.Context, opts *sql.TxOptions) (*Tx, error) {\n\tif _, ok := c.driver.(*txDriver); ok {\n\t\treturn nil, fmt.Errorf(\"ent: cannot start a transaction within a transaction\")\n\t}\n\ttx, err := c.driver.(*sql.Driver).BeginTx(ctx, opts)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"ent: starting a transaction: %v\", err)\n\t}\n\tcfg := config{driver: &txDriver{tx: tx, drv: c.driver}, log: c.log, debug: c.debug, hooks: c.hooks}\n\treturn &Tx{\n\t\tconfig: cfg,\n\t\tBooking: NewBookingClient(cfg),\n\t\tOperationroom: NewOperationroomClient(cfg),\n\t\tPatient: NewPatientClient(cfg),\n\t\tUser: NewUserClient(cfg),\n\t}, nil\n}", "func (c *Client) BeginTx(ctx context.Context, opts *sql.TxOptions) (*Tx, error) {\n\tif _, ok := c.driver.(*txDriver); ok {\n\t\treturn nil, fmt.Errorf(\"ent: cannot start a transaction within a transaction\")\n\t}\n\ttx, err := c.driver.(*sql.Driver).BeginTx(ctx, opts)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"ent: starting a transaction: %v\", err)\n\t}\n\tcfg := config{driver: &txDriver{tx: tx, drv: c.driver}, log: c.log, debug: c.debug, hooks: c.hooks}\n\treturn &Tx{\n\t\tconfig: cfg,\n\t\tCard: NewCardClient(cfg),\n\t\tCardScan: NewCardScanClient(cfg),\n\t\tPlaylist: NewPlaylistClient(cfg),\n\t}, nil\n}", "func (c *Client) BeginTx(ctx context.Context, opts *sql.TxOptions) (*Tx, error) {\n\tif _, ok := c.driver.(*txDriver); ok {\n\t\treturn nil, fmt.Errorf(\"ent: cannot start a transaction within a transaction\")\n\t}\n\ttx, err := c.driver.(interface {\n\t\tBeginTx(context.Context, *sql.TxOptions) (dialect.Tx, error)\n\t}).BeginTx(ctx, opts)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"ent: starting a transaction: %w\", err)\n\t}\n\tcfg := c.config\n\tcfg.driver = &txDriver{tx: tx, drv: c.driver}\n\treturn &Tx{\n\t\tconfig: cfg,\n\t\tEvent: NewEventClient(cfg),\n\t\tTag: NewTagClient(cfg),\n\t}, nil\n}", "func (c *Client) BeginTx(ctx context.Context, opts *sql.TxOptions) (*Tx, error) {\n\tif _, ok := c.driver.(*txDriver); ok {\n\t\treturn nil, fmt.Errorf(\"ent: cannot start a transaction within a transaction\")\n\t}\n\ttx, err := c.driver.(*sql.Driver).BeginTx(ctx, opts)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"ent: starting a transaction: %v\", err)\n\t}\n\tcfg := config{driver: &txDriver{tx: tx, drv: c.driver}, log: c.log, debug: c.debug, hooks: c.hooks}\n\treturn &Tx{\n\t\tconfig: cfg,\n\t\tDNSBLQuery: NewDNSBLQueryClient(cfg),\n\t\tDNSBLResponse: NewDNSBLResponseClient(cfg),\n\t\tIP: NewIPClient(cfg),\n\t\tOperation: NewOperationClient(cfg),\n\t\tUser: NewUserClient(cfg),\n\t}, nil\n}", "func (c *Client) BeginTx(ctx context.Context, opts *sql.TxOptions) (*Tx, error) {\n\tif _, ok := c.driver.(*txDriver); ok {\n\t\treturn nil, fmt.Errorf(\"ent: cannot start a transaction within a transaction\")\n\t}\n\ttx, err := c.driver.(*sql.Driver).BeginTx(ctx, opts)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"ent: starting a transaction: %v\", err)\n\t}\n\tcfg := config{driver: &txDriver{tx: tx, drv: c.driver}, log: c.log, debug: c.debug, hooks: c.hooks}\n\treturn &Tx{\n\t\tconfig: cfg,\n\t\tEatinghistory: NewEatinghistoryClient(cfg),\n\t\tFoodmenu: NewFoodmenuClient(cfg),\n\t\tMealplan: NewMealplanClient(cfg),\n\t\tTaste: NewTasteClient(cfg),\n\t\tUser: NewUserClient(cfg),\n\t}, nil\n}", "func (c *Client) BeginTx(ctx context.Context, opts *sql.TxOptions) (*Tx, error) {\n\tif _, ok := c.driver.(*txDriver); ok {\n\t\treturn nil, fmt.Errorf(\"ent: cannot start a transaction within a transaction\")\n\t}\n\ttx, err := c.driver.(*sql.Driver).BeginTx(ctx, opts)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"ent: starting a transaction: %v\", err)\n\t}\n\tcfg := config{driver: &txDriver{tx: tx, drv: c.driver}, log: c.log, debug: c.debug}\n\treturn &Tx{\n\t\tconfig: cfg,\n\t\tBlob: NewBlobClient(cfg),\n\t}, nil\n}", "func (c *sqlmock) BeginTx(ctx context.Context, opts driver.TxOptions) (driver.Tx, error) {\n\tex, err := c.begin()\n\tif ex != nil {\n\t\tselect {\n\t\tcase <-time.After(ex.delay):\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t\treturn c, nil\n\t\tcase <-ctx.Done():\n\t\t\treturn nil, ErrCancelled\n\t\t}\n\t}\n\n\treturn nil, err\n}", "func (v *connection) BeginTx(ctx context.Context, opts driver.TxOptions) (driver.Tx, error) {\n\tconnectionLogger.Trace(\"connection.BeginTx()\")\n\treturn newTransaction(ctx, v, opts)\n}", "func (database *Database) BeginTx(ctx context.Context, opts *sql.TxOptions) (*sql.Tx, error) {\n\treturn database.db.(TxStarter).BeginTx(ctx, opts)\n}", "func (w *DBConnWrapper) BeginTx(ctx context.Context, opts *sql.TxOptions) (*sql.Tx, error) {\n\treturn w.beginTxFunc(ctx, opts)\n}", "func (c *Conn) BeginTx(ctx context.Context, opts driver.TxOptions) (driver.Tx, error) {\n\treturn nil, fmt.Errorf(\"unimplemented\") // TODO(TimSatke): implement\n}", "func (db *DB) BeginTx(ctx context.Context, opts *sql.TxOptions) (*sql.Tx, error) {\n\treturn db.master.BeginTx(ctx, opts)\n}", "func (db *DB) BeginTx(ctx context.Context, opts *sql.TxOptions) (*sql.Tx, error) {\n\treturn db.Master().BeginTx(ctx, opts)\n}", "func (sw *DbSyncWrapper) BeginTx(ctx context.Context, options *transaction.TxOptions) (transaction.Transaction, error) {\n\ttx, err := sw.DB.BeginTx(ctx, options)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn syncTransactionWrap(tx), nil\n}", "func (db *Database) BeginTx(ctx context.Context, opts *TxOptions) (*Transaction, error) {\n\tif opts == nil {\n\t\topts = new(TxOptions)\n\t}\n\n\tdb.attachedTxMu.Lock()\n\tdefer db.attachedTxMu.Unlock()\n\n\tif db.attachedTransaction != nil {\n\t\treturn nil, errors.New(\"cannot open a transaction within a transaction\")\n\t}\n\n\tntx, err := db.ng.Begin(ctx, engine.TxOptions{\n\t\tWritable: !opts.ReadOnly,\n\t})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\ttx := Transaction{\n\t\tdb: db,\n\t\ttx: ntx,\n\t\twritable: !opts.ReadOnly,\n\t\tattached: opts.Attached,\n\t}\n\n\ttx.tableInfoStore, err = tx.getTableInfoStore()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\ttx.indexStore, err = tx.getIndexStore()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tif opts.Attached {\n\t\tdb.attachedTransaction = &tx\n\t}\n\n\treturn &tx, nil\n}", "func (m *MSSQLDatastore) BeginTx(ctx context.Context) (Transaction, error) {\n\ttx, err := m.db.BeginTx(ctx, &sql.TxOptions{})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn &MSSQLTx{db: m.db, tx: tx}, nil\n}", "func (ds *DataStore) BeginTx(ctx context.Context) (persistence.Tx, persistence.Committer, error) {\n\ttx, err := ds.DB.BeginTx(ctx, txOptions)\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\n\treturn &Tx{ds, tx}, tx, nil\n}", "func (db *GoLevelDB) BeginTx() (TxKV, error) {\n\ttx, err := db.db.OpenTransaction()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &goLevelDBTx{tx: tx}, nil\n}", "func (db *DB) BeginTx(ctx context.Context, opts *sql.TxOptions) (*TX, error) {\n\tdb.logBefore(\"BEGIN\", nil)\n\tstart := time.Now()\n\ttx, err := db.db.BeginTx(ctx, opts)\n\tdb.logAfter(\"BEGIN\", nil, time.Since(start), err)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn newTX(ctx, tx, db.Dialect, db.Logger), nil\n}", "func (c *ConnWrapper) BeginTx(ctx context.Context, opts driver.TxOptions) (tx driver.Tx, err error) {\n\tif connBeginTx, ok := c.Conn.(driver.ConnBeginTx); ok {\n\t\treturn connBeginTx.BeginTx(ctx, opts)\n\t}\n\n\treturn c.Conn.Begin()\n}", "func (c *Client) Tx(ctx context.Context) (*Tx, error) {\n\tif _, ok := c.driver.(*txDriver); ok {\n\t\treturn nil, fmt.Errorf(\"ent: cannot start a transaction within a transaction\")\n\t}\n\ttx, err := newTx(ctx, c.driver)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"ent: starting a transaction: %v\", err)\n\t}\n\tcfg := config{driver: tx, log: c.log, debug: c.debug, hooks: c.hooks}\n\treturn &Tx{\n\t\tctx: ctx,\n\t\tconfig: cfg,\n\t\tDepartment: NewDepartmentClient(cfg),\n\t\tPhysician: NewPhysicianClient(cfg),\n\t\tPosition: NewPositionClient(cfg),\n\t\tPositionassingment: NewPositionassingmentClient(cfg),\n\t}, nil\n}", "func (cl *Client) BeginTransaction() error {\n\tif cl.cfg.txnID == nil {\n\t\treturn ErrNotTransactional\n\t}\n\n\tcl.producer.txnMu.Lock()\n\tdefer cl.producer.txnMu.Unlock()\n\tif cl.producer.inTxn {\n\t\treturn ErrAlreadyInTransaction\n\t}\n\tcl.producer.inTxn = true\n\tatomic.StoreUint32(&cl.producer.producingTxn, 1) // allow produces for txns now\n\tcl.cfg.logger.Log(LogLevelInfo, \"beginning transaction\", \"transactional_id\", *cl.cfg.txnID)\n\treturn nil\n}", "func (c *Client) Tx(ctx context.Context) (*Tx, error) {\n\tif _, ok := c.driver.(*txDriver); ok {\n\t\treturn nil, fmt.Errorf(\"ent: cannot start a transaction within a transaction\")\n\t}\n\ttx, err := newTx(ctx, c.driver)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"ent: starting a transaction: %w\", err)\n\t}\n\tcfg := c.config\n\tcfg.driver = tx\n\treturn &Tx{\n\t\tctx: ctx,\n\t\tconfig: cfg,\n\t\tBinaryFile: NewBinaryFileClient(cfg),\n\t\tUser: NewUserClient(cfg),\n\t}, nil\n}", "func (d *Driver) BeginTx(ctx context.Context, opts *TxOptions) (dialect.Tx, error) {\n\ttx, err := d.DB().BeginTx(ctx, opts)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &Tx{\n\t\tConn: Conn{tx},\n\t\tTx: tx,\n\t}, nil\n}", "func (c *Client) Tx(ctx context.Context) (*Tx, error) {\n\tif _, ok := c.driver.(*txDriver); ok {\n\t\treturn nil, fmt.Errorf(\"ent: cannot start a transaction within a transaction\")\n\t}\n\ttx, err := newTx(ctx, c.driver)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"ent: starting a transaction: %w\", err)\n\t}\n\tcfg := c.config\n\tcfg.driver = tx\n\treturn &Tx{\n\t\tctx: ctx,\n\t\tconfig: cfg,\n\t\tCompany: NewCompanyClient(cfg),\n\t\tJob: NewJobClient(cfg),\n\t\tSkill: NewSkillClient(cfg),\n\t\tUser: NewUserClient(cfg),\n\t\tWorkExperience: NewWorkExperienceClient(cfg),\n\t}, nil\n}", "func (c *Client) Tx(ctx context.Context) (*Tx, error) {\n\tif _, ok := c.driver.(*txDriver); ok {\n\t\treturn nil, fmt.Errorf(\"ent: cannot start a transaction within a transaction\")\n\t}\n\ttx, err := newTx(ctx, c.driver)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"ent: starting a transaction: %v\", err)\n\t}\n\tcfg := config{driver: tx, log: c.log, debug: c.debug, hooks: c.hooks}\n\treturn &Tx{\n\t\tctx: ctx,\n\t\tconfig: cfg,\n\t\tAppointment: NewAppointmentClient(cfg),\n\t\tClinic: NewClinicClient(cfg),\n\t\tCustomer: NewCustomerClient(cfg),\n\t\tPet: NewPetClient(cfg),\n\t\tUser: NewUserClient(cfg),\n\t\tVeterinarian: NewVeterinarianClient(cfg),\n\t}, nil\n}", "func (c *Client) Tx(ctx context.Context) (*Tx, error) {\n\tif _, ok := c.driver.(*txDriver); ok {\n\t\treturn nil, fmt.Errorf(\"ent: cannot start a transaction within a transaction\")\n\t}\n\ttx, err := newTx(ctx, c.driver)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"ent: starting a transaction: %v\", err)\n\t}\n\tcfg := config{driver: tx, log: c.log, debug: c.debug, hooks: c.hooks}\n\treturn &Tx{\n\t\tctx: ctx,\n\t\tconfig: cfg,\n\t\tGender: NewGenderClient(cfg),\n\t\tPosition: NewPositionClient(cfg),\n\t\tTitle: NewTitleClient(cfg),\n\t\tUser: NewUserClient(cfg),\n\t}, nil\n}", "func (c *Client) Tx(ctx context.Context) (*Tx, error) {\n\tif _, ok := c.driver.(*txDriver); ok {\n\t\treturn nil, fmt.Errorf(\"ent: cannot start a transaction within a transaction\")\n\t}\n\ttx, err := newTx(ctx, c.driver)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"ent: starting a transaction: %v\", err)\n\t}\n\tcfg := config{driver: tx, log: c.log, debug: c.debug, hooks: c.hooks}\n\treturn &Tx{\n\t\tctx: ctx,\n\t\tconfig: cfg,\n\t\tExaminationroom: NewExaminationroomClient(cfg),\n\t\tNurse: NewNurseClient(cfg),\n\t\tOperative: NewOperativeClient(cfg),\n\t\tOperativerecord: NewOperativerecordClient(cfg),\n\t\tTool: NewToolClient(cfg),\n\t}, nil\n}", "func (c *Client) Tx(ctx context.Context) (*Tx, error) {\n\tif _, ok := c.driver.(*txDriver); ok {\n\t\treturn nil, fmt.Errorf(\"ent: cannot start a transaction within a transaction\")\n\t}\n\ttx, err := newTx(ctx, c.driver)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"ent: starting a transaction: %w\", err)\n\t}\n\tcfg := c.config\n\tcfg.driver = tx\n\treturn &Tx{\n\t\tctx: ctx,\n\t\tconfig: cfg,\n\t\tEvent: NewEventClient(cfg),\n\t\tTag: NewTagClient(cfg),\n\t}, nil\n}", "func (c *Client) Tx(ctx context.Context) (*Tx, error) {\n\tif _, ok := c.driver.(*txDriver); ok {\n\t\treturn nil, fmt.Errorf(\"ent: cannot start a transaction within a transaction\")\n\t}\n\ttx, err := newTx(ctx, c.driver)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"ent: starting a transaction: %v\", err)\n\t}\n\tcfg := config{driver: tx, log: c.log, debug: c.debug, hooks: c.hooks}\n\treturn &Tx{\n\t\tctx: ctx,\n\t\tconfig: cfg,\n\t\tDentist: NewDentistClient(cfg),\n\t\tEmployee: NewEmployeeClient(cfg),\n\t\tPatient: NewPatientClient(cfg),\n\t\tQueue: NewQueueClient(cfg),\n\t}, nil\n}", "func (c *Client) Tx(ctx context.Context) (*Tx, error) {\n\tif _, ok := c.driver.(*txDriver); ok {\n\t\treturn nil, fmt.Errorf(\"ent: cannot start a transaction within a transaction\")\n\t}\n\ttx, err := newTx(ctx, c.driver)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"ent: starting a transaction: %v\", err)\n\t}\n\tcfg := config{driver: tx, log: c.log, debug: c.debug, hooks: c.hooks}\n\treturn &Tx{\n\t\tconfig: cfg,\n\t\tPlanet: NewPlanetClient(cfg),\n\t\tSession: NewSessionClient(cfg),\n\t\tTimer: NewTimerClient(cfg),\n\t\tUser: NewUserClient(cfg),\n\t}, nil\n}", "func (c *Client) Tx(ctx context.Context) (*Tx, error) {\n\tif _, ok := c.driver.(*txDriver); ok {\n\t\treturn nil, fmt.Errorf(\"ent: cannot start a transaction within a transaction\")\n\t}\n\ttx, err := newTx(ctx, c.driver)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"ent: starting a transaction: %w\", err)\n\t}\n\tcfg := c.config\n\tcfg.driver = tx\n\treturn &Tx{\n\t\tctx: ctx,\n\t\tconfig: cfg,\n\t\tCoinInfo: NewCoinInfoClient(cfg),\n\t\tEmpty: NewEmptyClient(cfg),\n\t\tKeyStore: NewKeyStoreClient(cfg),\n\t\tReview: NewReviewClient(cfg),\n\t\tTransaction: NewTransactionClient(cfg),\n\t\tWalletNode: NewWalletNodeClient(cfg),\n\t}, nil\n}", "func (l *Lock) BeginTx(ctx context.Context, opts *sql.TxOptions) (*sql.Tx, error) {\n\treturn l._BeginTx(ctx, l.db, opts)\n}", "func BeginTx() (*sqlx.Tx, error) {\n\treturn db.Beginx()\n}", "func (c *Client) Tx(ctx context.Context) (*Tx, error) {\n\tif _, ok := c.driver.(*txDriver); ok {\n\t\treturn nil, fmt.Errorf(\"ent: cannot start a transaction within a transaction\")\n\t}\n\ttx, err := newTx(ctx, c.driver)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"ent: starting a transaction: %v\", err)\n\t}\n\tcfg := config{driver: tx, log: c.log, debug: c.debug, hooks: c.hooks}\n\treturn &Tx{\n\t\tctx: ctx,\n\t\tconfig: cfg,\n\t\tAcademicYear: NewAcademicYearClient(cfg),\n\t\tActivities: NewActivitiesClient(cfg),\n\t\tActivityType: NewActivityTypeClient(cfg),\n\t\tClub: NewClubClient(cfg),\n\t\tClubBranch: NewClubBranchClient(cfg),\n\t\tClubType: NewClubTypeClient(cfg),\n\t\tClubappStatus: NewClubappStatusClient(cfg),\n\t\tClubapplication: NewClubapplicationClient(cfg),\n\t\tComplaint: NewComplaintClient(cfg),\n\t\tComplaintType: NewComplaintTypeClient(cfg),\n\t\tDiscipline: NewDisciplineClient(cfg),\n\t\tGender: NewGenderClient(cfg),\n\t\tPosition: NewPositionClient(cfg),\n\t\tPurpose: NewPurposeClient(cfg),\n\t\tRoom: NewRoomClient(cfg),\n\t\tRoomuse: NewRoomuseClient(cfg),\n\t\tUser: NewUserClient(cfg),\n\t\tUserStatus: NewUserStatusClient(cfg),\n\t\tUsertype: NewUsertypeClient(cfg),\n\t\tYear: NewYearClient(cfg),\n\t}, nil\n}", "func (c *Client) Tx(ctx context.Context) (*Tx, error) {\n\tif _, ok := c.driver.(*txDriver); ok {\n\t\treturn nil, fmt.Errorf(\"models: cannot start a transaction within a transaction\")\n\t}\n\ttx, err := newTx(ctx, c.driver)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"models: starting a transaction: %w\", err)\n\t}\n\tcfg := c.config\n\tcfg.driver = tx\n\treturn &Tx{\n\t\tctx: ctx,\n\t\tconfig: cfg,\n\t\tBeer: NewBeerClient(cfg),\n\t\tMedia: NewMediaClient(cfg),\n\t}, nil\n}", "func (c *Client) Begin() (*Transaction, error) {\n\tr, err := http.NewRequest(http.MethodPost, c.Host+\"/begin\", nil)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar result ResponseEntity\n\tif err := c.doReq(r, http.StatusOK, &result); err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn result.Transaction, nil\n}", "func (c *Client) Tx(ctx context.Context) (*Tx, error) {\n\tif _, ok := c.driver.(*txDriver); ok {\n\t\treturn nil, fmt.Errorf(\"ent: cannot start a transaction within a transaction\")\n\t}\n\ttx, err := newTx(ctx, c.driver)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"ent: starting a transaction: %v\", err)\n\t}\n\tcfg := config{driver: tx, log: c.log, debug: c.debug, hooks: c.hooks}\n\treturn &Tx{\n\t\tctx: ctx,\n\t\tconfig: cfg,\n\t\tBooking: NewBookingClient(cfg),\n\t\tOperationroom: NewOperationroomClient(cfg),\n\t\tPatient: NewPatientClient(cfg),\n\t\tUser: NewUserClient(cfg),\n\t}, nil\n}", "func (c *Client) Tx(ctx context.Context) (*Tx, error) {\n\tif _, ok := c.driver.(*txDriver); ok {\n\t\treturn nil, fmt.Errorf(\"ent: cannot start a transaction within a transaction\")\n\t}\n\ttx, err := newTx(ctx, c.driver)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"ent: starting a transaction: %v\", err)\n\t}\n\tcfg := config{driver: tx, log: c.log, debug: c.debug, hooks: c.hooks}\n\treturn &Tx{\n\t\tctx: ctx,\n\t\tconfig: cfg,\n\t\tEatinghistory: NewEatinghistoryClient(cfg),\n\t\tFoodmenu: NewFoodmenuClient(cfg),\n\t\tMealplan: NewMealplanClient(cfg),\n\t\tTaste: NewTasteClient(cfg),\n\t\tUser: NewUserClient(cfg),\n\t}, nil\n}", "func (c *Client) Tx(ctx context.Context) (*Tx, error) {\n\tif _, ok := c.driver.(*txDriver); ok {\n\t\treturn nil, fmt.Errorf(\"ent: cannot start a transaction within a transaction\")\n\t}\n\ttx, err := newTx(ctx, c.driver)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"ent: starting a transaction: %v\", err)\n\t}\n\tcfg := config{driver: tx, log: c.log, debug: c.debug}\n\treturn &Tx{\n\t\tconfig: cfg,\n\t\tModule: NewModuleClient(cfg),\n\t\tModuleVersion: NewModuleVersionClient(cfg),\n\t}, nil\n}", "func (c *Client) Tx(ctx context.Context) (*Tx, error) {\n\tif _, ok := c.driver.(*txDriver); ok {\n\t\treturn nil, fmt.Errorf(\"ent: cannot start a transaction within a transaction\")\n\t}\n\ttx, err := newTx(ctx, c.driver)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"ent: starting a transaction: %v\", err)\n\t}\n\tcfg := config{driver: tx, log: c.log, debug: c.debug, hooks: c.hooks}\n\treturn &Tx{\n\t\tctx: ctx,\n\t\tconfig: cfg,\n\t\tPatient: NewPatientClient(cfg),\n\t\tPatientofphysician: NewPatientofphysicianClient(cfg),\n\t\tPatientroom: NewPatientroomClient(cfg),\n\t\tPhysician: NewPhysicianClient(cfg),\n\t}, nil\n}", "func (c *Client) Tx(ctx context.Context) (*Tx, error) {\n\tif _, ok := c.driver.(*txDriver); ok {\n\t\treturn nil, fmt.Errorf(\"ent: cannot start a transaction within a transaction\")\n\t}\n\ttx, err := newTx(ctx, c.driver)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"ent: starting a transaction: %v\", err)\n\t}\n\tcfg := config{driver: tx, log: c.log, debug: c.debug, hooks: c.hooks}\n\treturn &Tx{\n\t\tctx: ctx,\n\t\tconfig: cfg,\n\t\tDNSBLQuery: NewDNSBLQueryClient(cfg),\n\t\tDNSBLResponse: NewDNSBLResponseClient(cfg),\n\t\tIP: NewIPClient(cfg),\n\t\tOperation: NewOperationClient(cfg),\n\t\tUser: NewUserClient(cfg),\n\t}, nil\n}", "func (c *Client) Tx(ctx context.Context) (*Tx, error) {\n\tif _, ok := c.driver.(*txDriver); ok {\n\t\treturn nil, fmt.Errorf(\"ent: cannot start a transaction within a transaction\")\n\t}\n\ttx, err := newTx(ctx, c.driver)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"ent: starting a transaction: %w\", err)\n\t}\n\tcfg := c.config\n\tcfg.driver = tx\n\treturn &Tx{\n\t\tctx: ctx,\n\t\tconfig: cfg,\n\t\tUser: NewUserClient(cfg),\n\t\tUserCard: NewUserCardClient(cfg),\n\t\tUserWallet: NewUserWalletClient(cfg),\n\t}, nil\n}", "func (tbl DbCompoundTable) BeginTx(opts *sql.TxOptions) (DbCompoundTable, error) {\n\tvar err error\n\ttbl.db, err = tbl.db.(sqlgen2.TxStarter).BeginTx(tbl.ctx, opts)\n\treturn tbl, tbl.logIfError(err)\n}", "func (c *Client) Tx(ctx context.Context) (*Tx, error) {\n\tif _, ok := c.driver.(*txDriver); ok {\n\t\treturn nil, fmt.Errorf(\"ent: cannot start a transaction within a transaction\")\n\t}\n\ttx, err := newTx(ctx, c.driver)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"ent: starting a transaction: %v\", err)\n\t}\n\tcfg := config{driver: tx, log: c.log, debug: c.debug, hooks: c.hooks}\n\treturn &Tx{\n\t\tctx: ctx,\n\t\tconfig: cfg,\n\t\tCard: NewCardClient(cfg),\n\t\tCardScan: NewCardScanClient(cfg),\n\t\tPlaylist: NewPlaylistClient(cfg),\n\t}, nil\n}", "func (c *Client) Tx(ctx context.Context) (*Tx, error) {\n\tif _, ok := c.driver.(*txDriver); ok {\n\t\treturn nil, fmt.Errorf(\"ent: cannot start a transaction within a transaction\")\n\t}\n\ttx, err := newTx(ctx, c.driver)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"ent: starting a transaction: %v\", err)\n\t}\n\tcfg := config{driver: tx, log: c.log, debug: c.debug, hooks: c.hooks}\n\treturn &Tx{\n\t\tctx: ctx,\n\t\tconfig: cfg,\n\t\tAnnotation: NewAnnotationClient(cfg),\n\t\tBill: NewBillClient(cfg),\n\t\tCompany: NewCompanyClient(cfg),\n\t\tDispenseMedicine: NewDispenseMedicineClient(cfg),\n\t\tDoctor: NewDoctorClient(cfg),\n\t\tDrugAllergy: NewDrugAllergyClient(cfg),\n\t\tLevelOfDangerous: NewLevelOfDangerousClient(cfg),\n\t\tMedicine: NewMedicineClient(cfg),\n\t\tMedicineType: NewMedicineTypeClient(cfg),\n\t\tOrder: NewOrderClient(cfg),\n\t\tPatientInfo: NewPatientInfoClient(cfg),\n\t\tPayment: NewPaymentClient(cfg),\n\t\tPharmacist: NewPharmacistClient(cfg),\n\t\tPositionInPharmacist: NewPositionInPharmacistClient(cfg),\n\t\tPrescription: NewPrescriptionClient(cfg),\n\t\tUnitOfMedicine: NewUnitOfMedicineClient(cfg),\n\t}, nil\n}", "func Begin() (*Transaction, error) {\n\td, lock := driver.Get()\n\tdefer lock.Unlock()\n\n\ttx, err := d.Begin()\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"Unable to begin transaction - %s\", err)\n\t}\n\treturn &Transaction{\n\t\ttx: tx,\n\t}, nil\n}", "func (c *Client) Tx(ctx context.Context) (*Tx, error) {\n\tif _, ok := c.driver.(*txDriver); ok {\n\t\treturn nil, fmt.Errorf(\"ent: cannot start a transaction within a transaction\")\n\t}\n\ttx, err := newTx(ctx, c.driver)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"ent: starting a transaction: %v\", err)\n\t}\n\tcfg := config{driver: tx, log: c.log, debug: c.debug, hooks: c.hooks}\n\treturn &Tx{\n\t\tctx: ctx,\n\t\tconfig: cfg,\n\t\tBill: NewBillClient(cfg),\n\t\tBillingstatus: NewBillingstatusClient(cfg),\n\t\tBranch: NewBranchClient(cfg),\n\t\tBuilding: NewBuildingClient(cfg),\n\t\tDevice: NewDeviceClient(cfg),\n\t\tEmployee: NewEmployeeClient(cfg),\n\t\tFaculty: NewFacultyClient(cfg),\n\t\tPart: NewPartClient(cfg),\n\t\tPartorder: NewPartorderClient(cfg),\n\t\tRepairInvoice: NewRepairInvoiceClient(cfg),\n\t\tReturninvoice: NewReturninvoiceClient(cfg),\n\t\tRoom: NewRoomClient(cfg),\n\t\tStatusR: NewStatusRClient(cfg),\n\t\tStatust: NewStatustClient(cfg),\n\t\tSymptom: NewSymptomClient(cfg),\n\t\tUser: NewUserClient(cfg),\n\t}, nil\n}", "func (c *Client) Tx(ctx context.Context) (*Tx, error) {\n\tif _, ok := c.driver.(*txDriver); ok {\n\t\treturn nil, fmt.Errorf(\"ent: cannot start a transaction within a transaction\")\n\t}\n\ttx, err := newTx(ctx, c.driver)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"ent: starting a transaction: %v\", err)\n\t}\n\tcfg := config{driver: tx, log: c.log, debug: c.debug, hooks: c.hooks}\n\treturn &Tx{\n\t\tctx: ctx,\n\t\tconfig: cfg,\n\t\tBedtype: NewBedtypeClient(cfg),\n\t\tBill: NewBillClient(cfg),\n\t\tCleanername: NewCleanernameClient(cfg),\n\t\tCleaningroom: NewCleaningroomClient(cfg),\n\t\tDeposit: NewDepositClient(cfg),\n\t\tEmployee: NewEmployeeClient(cfg),\n\t\tJobposition: NewJobpositionClient(cfg),\n\t\tLease: NewLeaseClient(cfg),\n\t\tLengthtime: NewLengthtimeClient(cfg),\n\t\tPayment: NewPaymentClient(cfg),\n\t\tPetrule: NewPetruleClient(cfg),\n\t\tPledge: NewPledgeClient(cfg),\n\t\tRentalstatus: NewRentalstatusClient(cfg),\n\t\tRepairinvoice: NewRepairinvoiceClient(cfg),\n\t\tRoomdetail: NewRoomdetailClient(cfg),\n\t\tSituation: NewSituationClient(cfg),\n\t\tStatusd: NewStatusdClient(cfg),\n\t\tStaytype: NewStaytypeClient(cfg),\n\t\tWifi: NewWifiClient(cfg),\n\t}, nil\n}", "func (c *Conn) BeginTransaction(t TransactionType) error {\n\tif t == Deferred {\n\t\treturn c.FastExec(\"BEGIN\")\n\t} else if t == Immediate {\n\t\treturn c.FastExec(\"BEGIN IMMEDIATE\")\n\t} else if t == Exclusive {\n\t\treturn c.FastExec(\"BEGIN EXCLUSIVE\")\n\t}\n\tpanic(fmt.Sprintf(\"Unsupported transaction type: '%#v'\", t))\n}", "func (db *DB) BeginTx() RKSyncCATx {\n\treturn db.MustBegin()\n}", "func (c *Client) Tx(ctx context.Context) (*Tx, error) {\n\tif _, ok := c.driver.(*txDriver); ok {\n\t\treturn nil, fmt.Errorf(\"ent: cannot start a transaction within a transaction\")\n\t}\n\ttx, err := newTx(ctx, c.driver)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"ent: starting a transaction: %w\", err)\n\t}\n\tcfg := c.config\n\tcfg.driver = tx\n\treturn &Tx{\n\t\tctx: ctx,\n\t\tconfig: cfg,\n\t\tAdmin: NewAdminClient(cfg),\n\t\tAdminSession: NewAdminSessionClient(cfg),\n\t\tCategory: NewCategoryClient(cfg),\n\t\tPost: NewPostClient(cfg),\n\t\tPostAttachment: NewPostAttachmentClient(cfg),\n\t\tPostImage: NewPostImageClient(cfg),\n\t\tPostThumbnail: NewPostThumbnailClient(cfg),\n\t\tPostVideo: NewPostVideoClient(cfg),\n\t\tUnsavedPost: NewUnsavedPostClient(cfg),\n\t\tUnsavedPostAttachment: NewUnsavedPostAttachmentClient(cfg),\n\t\tUnsavedPostImage: NewUnsavedPostImageClient(cfg),\n\t\tUnsavedPostThumbnail: NewUnsavedPostThumbnailClient(cfg),\n\t\tUnsavedPostVideo: NewUnsavedPostVideoClient(cfg),\n\t}, nil\n}", "func (db *DB) BeginTransaction(update bool) *TransactionManager {\n\tif update {\n\t\tdb.dropWG.Add(1)\n\t}\n\treturn &TransactionManager{\n\t\tdb: db,\n\t\tupdate: update,\n\t\ttxupdates: make(map[string]keyval),\n\t}\n}", "func (db *DB) BeginTransaction(update bool) *TransactionManager {\n\tif update {\n\t\tdb.dropWG.Add(1)\n\t}\n\treturn &TransactionManager{\n\t\tdb: db,\n\t\tupdate: update,\n\t\ttxupdates: make(map[string]keyval),\n\t}\n}", "func (db *pgDB) begin(ctx context.Context, opts *sql.TxOptions) *pgTx {\n\ttx, err := db.DB.BeginTx(ctx, opts)\n\treturn &pgTx{\n\t\topts: opts,\n\t\tpgDB: db,\n\t\tsqlTx: tx,\n\t\tctx: ctx,\n\t\terr: convertError(err),\n\t}\n}", "func (s *Session) BeginTx(opts *sql.TxOptions) error {\n\ttx, err := s.db.Master().BeginTx(s.ctx, opts)\n\tif err != nil {\n\t\treturn err\n\t}\n\ts.logger.Debugf(\"[Session Begin] begin transaction opts: %v\", opts)\n\t// 重置 transaction 状态\n\ts.hasCommittedOrRollback = false\n\ts.isAutoCommit = false\n\ts.tx = tx\n\treturn nil\n}", "func (tx *Tx) Begin(ctx context.Context) (pgx.Tx, error) {\n\treturn tx.t.Begin(ctx)\n}", "func BeginTx() (tx *pg.Tx, err error) {\n\tvar conn *pg.DB\n\tif conn, err = Connect(); err == nil {\n\t\tif tx, err = conn.Begin(); err == nil && tx == nil {\n\t\t\terr = errors.New(\"Failed To Initiate Transaction.\")\n\t\t}\n\t}\n\treturn\n}", "func (c *Client) BeginTransaction(ctx context.Context, req *firestorepb.BeginTransactionRequest, opts ...gax.CallOption) (*firestorepb.BeginTransactionResponse, error) {\n\treturn c.internalClient.BeginTransaction(ctx, req, opts...)\n}", "func (db *DB) Begin() (*Tx, error) {\n\tif db.isTx {\n\t\treturn nil, ErrNestTx\n\t}\n\n\ttx := new(Tx)\n\n\ttx.DB = new(DB)\n\ttx.DB.dbLock = db.dbLock\n\n\ttx.DB.dbLock.Lock()\n\n\ttx.DB.l = db.l\n\ttx.index = db.index\n\n\ttx.DB.sdb = db.sdb\n\n\tvar err error\n\ttx.tx, err = db.sdb.Begin()\n\tif err != nil {\n\t\ttx.DB.dbLock.Unlock()\n\t\treturn nil, err\n\t}\n\n\ttx.DB.bucket = tx.tx\n\n\ttx.DB.isTx = true\n\n\ttx.DB.index = db.index\n\n\ttx.DB.kvBatch = tx.newBatch()\n\ttx.DB.listBatch = tx.newBatch()\n\ttx.DB.hashBatch = tx.newBatch()\n\ttx.DB.zsetBatch = tx.newBatch()\n\ttx.DB.binBatch = tx.newBatch()\n\ttx.DB.setBatch = tx.newBatch()\n\n\treturn tx, nil\n}", "func (ses *Ses) StartTx(opts ...TxOption) (tx *Tx, err error) {\n\tses.log(_drv.Cfg().Log.Ses.StartTx)\n\terr = ses.checkClosed()\n\tif err != nil {\n\t\treturn nil, errE(err)\n\t}\n\n\tvar o txOption\n\tfor _, opt := range opts {\n\t\topt(&o)\n\t}\n\t// start transaction\n\t// the number of seconds the transaction can be inactive\n\t// before it is automatically terminated by the system.\n\tvar timeout = C.uword(60)\n\tif o.timeout > 0 {\n\t\ttimeout = C.uword(o.timeout / time.Second)\n\t}\n\tses.RLock()\n\tenv := ses.Env()\n\tr := C.OCITransStart(\n\t\tses.ocisvcctx, //OCISvcCtx *svchp,\n\t\tenv.ocierr, //OCIError *errhp,\n\t\ttimeout, //uword timeout,\n\t\tC.OCI_TRANS_NEW|C.ub4(o.flags)) //ub4 flags );\n\tses.RUnlock()\n\tif r == C.OCI_ERROR {\n\t\treturn nil, errE(env.ociError())\n\t}\n\ttx = _drv.txPool.Get().(*Tx) // set *Tx\n\ttx.cmu.Lock()\n\ttx.Lock()\n\ttx.ses = ses\n\tif tx.id == 0 {\n\t\ttx.id = _drv.txId.nextId()\n\t}\n\ttx.Unlock()\n\ttx.cmu.Unlock()\n\tses.openTxs.add(tx)\n\n\treturn tx, nil\n}", "func (db *DB) Begin() (*sql.Tx, error) {\n\tif db.checker.unreachable() {\n\t\treturn nil, ErrUnreachable\n\t}\n\n\ttx, err := newTx(db.DB, db.txTimeout)\n\tif err == ErrNewTxTimedOut {\n\t\tgo func() {\n\t\t\tdb.checker.check(db.DB, db.txTimeout)\n\t\t}()\n\t}\n\n\treturn tx, err\n}", "func (ng *Engine) Begin(ctx context.Context, opts engine.TxOptions) (engine.Transaction, error) {\n\tselect {\n\tcase <-ctx.Done():\n\t\treturn nil, ctx.Err()\n\tdefault:\n\t}\n\n\tif ng.Closed {\n\t\treturn nil, errors.New(\"engine closed\")\n\t}\n\n\treturn &transaction{ctx: ctx, ng: ng, writable: opts.Writable}, nil\n}", "func Begin(c context.Context) (*RollbackTx, error) {\n\ttx, err := Get(c).BeginTx(c, nil)\n\treturn &RollbackTx{Tx: tx}, err\n}", "func (p *politeiawww) beginTx() (*sql.Tx, func(), error) {\n\tctx, cancel := ctxForTx()\n\n\topts := &sql.TxOptions{\n\t\tIsolation: sql.LevelDefault,\n\t}\n\ttx, err := p.db.BeginTx(ctx, opts)\n\tif err != nil {\n\t\treturn nil, nil, errors.WithStack(err)\n\t}\n\n\treturn tx, cancel, nil\n}", "func StartTransaction(w http.ResponseWriter, DB *sql.DB) (*sql.Tx, error) {\n\tvar err error\n\ttx, err := DB.Begin()\n\tif err != nil {\n\t\ttx.Rollback()\n\t\trequestUtils.RespondWithError(w, http.StatusInternalServerError, err.Error())\n\t\treturn nil, err\n\t}\n\treturn tx, err\n}", "func (db *DB) Begin() (*Tx, error) {\n\treturn &Tx{db.Session}, nil\n}", "func (s *Session) TxBegin(cfg ...TxCfg) error {\n\tcfgC := configC(cfg)\n\tr := C.wt_session_begin_transaction(s.s, cfgC)\n\ts.inTx = (r == 0)\n\treturn wtError(r)\n}", "func (s *Service) CreateClientTx(tx *gorm.DB, clientID, secret, redirectURI string) (*models.OauthClient, error) {\n\treturn s.createClientCommon(tx, clientID, secret, redirectURI)\n}", "func (r *dsState) BeginTransaction(c context.Context) error {\n\treturn r.run(c, func() error { return nil })\n}", "func (m *Manifest) BeginTransaction() (*sqlx.Tx, error) {\n\ttx, err := m.Conn.Beginx()\n\tif err != nil {\n\t\treturn nil, terror.New(err, \"\")\n\t}\n\treturn tx, nil\n}", "func (c *Conn) Begin() (driver.Tx, error) {\n\treturn c.BeginTx(context.Background(), driver.TxOptions{})\n}", "func (db *DB) Begin() (*Tx, error) {\n\ttx, err := db.DB.Begin()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn &Tx{\n\t\tTx: tx,\n\t\twrap: &wrap{conn: tx},\n\t}, nil\n}", "func (c *conn) Begin() (driver.Tx, error) {\n\treturn c.BeginTx(context.Background(), driver.TxOptions{})\n}", "func (c *Conn) Begin() (driver.Tx, error) {\n\treturn nil, ErrNotSupported\n}", "func (app *App) BeginTrans(ctx context.Context, logger zap.Logger) (gorp.Transaction, error) {\n\tlog.D(logger, \"Beginning DB tx...\")\n\ttx, err := app.Db(ctx).Begin()\n\tif err != nil {\n\t\tlog.E(logger, \"Failed to begin tx.\", func(cm log.CM) {\n\t\t\tcm.Write(zap.Error(err))\n\t\t})\n\t\treturn nil, err\n\t}\n\tlog.D(logger, \"Tx begun successfuly.\")\n\treturn tx, nil\n}", "func (p *planner) BeginTransaction(n *parser.BeginTransaction) (planNode, error) {\n\tif p.txn == nil {\n\t\treturn nil, errors.Errorf(\"the server should have already created a transaction\")\n\t}\n\tif err := p.setIsolationLevel(n.Isolation); err != nil {\n\t\treturn nil, err\n\t}\n\tif err := p.setUserPriority(n.UserPriority); err != nil {\n\t\treturn nil, err\n\t}\n\treturn &emptyNode{}, nil\n}", "func (extDb *Database) StartTransaction() (*TxConnection, error) {\n\tcon, err := extDb.GetConnection()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\ttx, err := con.Begin()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif err = extDb.i.initTx(tx); err != nil {\n\t\treturn nil, err\n\t}\n\treturn &TxConnection{Tx: tx, Con: con}, nil\n}", "func (d *Driver) Tx(ctx context.Context) (dialect.Tx, error) {\n\treturn d.BeginTx(ctx, nil)\n}", "func (s *SqlDb) Begin(ctx context.Context) (txid TransactionID) {\n\tvar c *SqlContext\n\n\ti := ctx.Value(goradd.SqlContext)\n\tif i == nil {\n\t\tpanic(\"Can't use transactions without pre-loading a context\")\n\t} else {\n\t\tc = i.(*SqlContext)\n\t}\n\tc.txCount++\n\n\tif c.txCount == 1 {\n\t\tvar err error\n\n\t\tc.tx, err = s.db.Begin()\n\t\tif err != nil {\n\t\t\t_ = c.tx.Rollback()\n\t\t\tc.txCount-- // transaction did not begin\n\t\t\tpanic(err.Error())\n\t\t}\n\t}\n\treturn TransactionID(c.txCount)\n}", "func (c *restClient) BeginTransaction(ctx context.Context, req *firestorepb.BeginTransactionRequest, opts ...gax.CallOption) (*firestorepb.BeginTransactionResponse, error) {\n\tm := protojson.MarshalOptions{AllowPartial: true, UseEnumNumbers: true}\n\tjsonReq, err := m.Marshal(req)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tbaseUrl, err := url.Parse(c.endpoint)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tbaseUrl.Path += fmt.Sprintf(\"/v1/%v/documents:beginTransaction\", req.GetDatabase())\n\n\tparams := url.Values{}\n\tparams.Add(\"$alt\", \"json;enum-encoding=int\")\n\n\tbaseUrl.RawQuery = params.Encode()\n\n\t// Build HTTP headers from client and context metadata.\n\thds := []string{\"x-goog-request-params\", fmt.Sprintf(\"%s=%v\", \"database\", url.QueryEscape(req.GetDatabase()))}\n\n\thds = append(c.xGoogHeaders, hds...)\n\thds = append(hds, \"Content-Type\", \"application/json\")\n\theaders := gax.BuildHeaders(ctx, hds...)\n\topts = append((*c.CallOptions).BeginTransaction[0:len((*c.CallOptions).BeginTransaction):len((*c.CallOptions).BeginTransaction)], opts...)\n\tunm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true}\n\tresp := &firestorepb.BeginTransactionResponse{}\n\te := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {\n\t\tif settings.Path != \"\" {\n\t\t\tbaseUrl.Path = settings.Path\n\t\t}\n\t\thttpReq, err := http.NewRequest(\"POST\", baseUrl.String(), bytes.NewReader(jsonReq))\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\thttpReq = httpReq.WithContext(ctx)\n\t\thttpReq.Header = headers\n\n\t\thttpRsp, err := c.httpClient.Do(httpReq)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tdefer httpRsp.Body.Close()\n\n\t\tif err = googleapi.CheckResponse(httpRsp); err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tbuf, err := io.ReadAll(httpRsp.Body)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tif err := unm.Unmarshal(buf, resp); err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\treturn nil\n\t}, opts...)\n\tif e != nil {\n\t\treturn nil, e\n\t}\n\treturn resp, nil\n}", "func (db *DB) Begin(writable bool) (*Tx, error) {\n\tif writable {\n\t\treturn db.beginRWTx()\n\t}\n\treturn db.beginTx()\n}", "func (db TestDB) Begin() (*sql.Tx, error) {\n\treturn db.testTx, nil\n}", "func (db *DB) Begin() (*TX, error) {\n\treturn db.BeginTx(db.Querier.ctx, nil)\n}", "func (db *DB) BeginTx() BlogTx {\n\treturn &TX{\n\t\tTX: db.DB.MustBegin(),\n\t}\n}" ]
[ "0.7691348", "0.76782745", "0.7623037", "0.75972027", "0.75933254", "0.75789803", "0.757535", "0.75455236", "0.75242734", "0.752073", "0.75197613", "0.749707", "0.74934614", "0.7485911", "0.7484181", "0.7474293", "0.7472846", "0.74536836", "0.7452426", "0.7452073", "0.7393321", "0.7245196", "0.7094648", "0.7082575", "0.7002899", "0.69729173", "0.6891075", "0.68833137", "0.687162", "0.68651795", "0.6859453", "0.6846927", "0.6818498", "0.68034875", "0.67899543", "0.67141366", "0.6692754", "0.66786397", "0.6677761", "0.6658762", "0.66560185", "0.6623121", "0.6596857", "0.6586556", "0.65847576", "0.65839034", "0.6568292", "0.6561351", "0.6558791", "0.6558195", "0.65550435", "0.65536034", "0.6552766", "0.653634", "0.65343475", "0.65221006", "0.6521458", "0.65133786", "0.64853126", "0.6466798", "0.64654547", "0.64464587", "0.6424814", "0.6417757", "0.6402694", "0.63908714", "0.63617206", "0.6346859", "0.6346859", "0.6345848", "0.6314785", "0.63118607", "0.62969935", "0.6291856", "0.62682897", "0.6255778", "0.6252383", "0.6247443", "0.62268746", "0.62132466", "0.615316", "0.61506677", "0.6131267", "0.61017954", "0.60980284", "0.6076471", "0.60681", "0.60389185", "0.6034178", "0.6019325", "0.60096705", "0.5986885", "0.5944898", "0.5927222", "0.5913623", "0.59035057", "0.59016025", "0.5901255", "0.58900166", "0.5889204" ]
0.75040174
11
Debug returns a new debugclient. It's used to get verbose logging on specific operations. client.Debug(). Admin. Query(). Count(ctx)
func (c *Client) Debug() *Client { if c.debug { return c } cfg := c.config cfg.driver = dialect.Debug(c.driver, c.log) client := &Client{config: cfg} client.init() return client }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (c *Client) Debug() *Client {\n\tif c.debug {\n\t\treturn c\n\t}\n\tcfg := config{driver: dialect.Debug(c.driver, c.log), log: c.log, debug: true}\n\treturn &Client{\n\t\tconfig: cfg,\n\t\tSchema: migrate.NewSchema(cfg.driver),\n\t\tModule: NewModuleClient(cfg),\n\t\tModuleVersion: NewModuleVersionClient(cfg),\n\t}\n}", "func (c *Client) Debug() *Client {\n\tif c.debug {\n\t\treturn c\n\t}\n\tcfg := config{driver: dialect.Debug(c.driver, c.log), log: c.log, debug: true, hooks: c.hooks}\n\tclient := &Client{config: cfg}\n\tclient.init()\n\treturn client\n}", "func (c *Client) Debug() *Client {\n\tif c.debug {\n\t\treturn c\n\t}\n\tcfg := config{driver: dialect.Debug(c.driver, c.log), log: c.log, debug: true, hooks: c.hooks}\n\tclient := &Client{config: cfg}\n\tclient.init()\n\treturn client\n}", "func (c *Client) Debug() *Client {\n\tif c.debug {\n\t\treturn c\n\t}\n\tcfg := config{driver: dialect.Debug(c.driver, c.log), log: c.log, debug: true, hooks: c.hooks}\n\tclient := &Client{config: cfg}\n\tclient.init()\n\treturn client\n}", "func (c *Client) Debug() *Client {\n\tif c.debug {\n\t\treturn c\n\t}\n\tcfg := config{driver: dialect.Debug(c.driver, c.log), log: c.log, debug: true, hooks: c.hooks}\n\tclient := &Client{config: cfg}\n\tclient.init()\n\treturn client\n}", "func (c *Client) Debug() *Client {\n\tif c.debug {\n\t\treturn c\n\t}\n\tcfg := config{driver: dialect.Debug(c.driver, c.log), log: c.log, debug: true, hooks: c.hooks}\n\tclient := &Client{config: cfg}\n\tclient.init()\n\treturn client\n}", "func (c *Client) Debug() *Client {\n\tif c.debug {\n\t\treturn c\n\t}\n\tcfg := config{driver: dialect.Debug(c.driver, c.log), log: c.log, debug: true, hooks: c.hooks}\n\tclient := &Client{config: cfg}\n\tclient.init()\n\treturn client\n}", "func (c *Client) Debug() *Client {\n\tif c.debug {\n\t\treturn c\n\t}\n\tcfg := config{driver: dialect.Debug(c.driver, c.log), log: c.log, debug: true, hooks: c.hooks}\n\tclient := &Client{config: cfg}\n\tclient.init()\n\treturn client\n}", "func (c *Client) Debug() *Client {\n\tif c.debug {\n\t\treturn c\n\t}\n\tcfg := config{driver: dialect.Debug(c.driver, c.log), log: c.log, debug: true, hooks: c.hooks}\n\tclient := &Client{config: cfg}\n\tclient.init()\n\treturn client\n}", "func (c *Client) Debug() *Client {\n\tif c.debug {\n\t\treturn c\n\t}\n\tcfg := config{driver: dialect.Debug(c.driver, c.log), log: c.log, debug: true, hooks: c.hooks}\n\tclient := &Client{config: cfg}\n\tclient.init()\n\treturn client\n}", "func (c *Client) Debug() *Client {\n\tif c.debug {\n\t\treturn c\n\t}\n\tcfg := config{driver: dialect.Debug(c.driver, c.log), log: c.log, debug: true, hooks: c.hooks}\n\tclient := &Client{config: cfg}\n\tclient.init()\n\treturn client\n}", "func (c *Client) Debug() *Client {\n\tif c.debug {\n\t\treturn c\n\t}\n\tcfg := config{driver: dialect.Debug(c.driver, c.log), log: c.log, debug: true, hooks: c.hooks}\n\tclient := &Client{config: cfg}\n\tclient.init()\n\treturn client\n}", "func (c *Client) Debug() *Client {\n\tif c.debug {\n\t\treturn c\n\t}\n\tcfg := config{driver: dialect.Debug(c.driver, c.log), log: c.log, debug: true, hooks: c.hooks}\n\tclient := &Client{config: cfg}\n\tclient.init()\n\treturn client\n}", "func (c *Client) Debug() *Client {\n\tif c.debug {\n\t\treturn c\n\t}\n\tcfg := config{driver: dialect.Debug(c.driver, c.log), log: c.log, debug: true, hooks: c.hooks}\n\tclient := &Client{config: cfg}\n\tclient.init()\n\treturn client\n}", "func (c *Client) Debug() *Client {\n\tif c.debug {\n\t\treturn c\n\t}\n\tcfg := config{driver: dialect.Debug(c.driver, c.log), log: c.log, debug: true, hooks: c.hooks}\n\tclient := &Client{config: cfg}\n\tclient.init()\n\treturn client\n}", "func (c *Client) Debug() *Client {\n\tif c.debug {\n\t\treturn c\n\t}\n\tcfg := config{driver: dialect.Debug(c.driver, c.log), log: c.log, debug: true, hooks: c.hooks}\n\tclient := &Client{config: cfg}\n\tclient.init()\n\treturn client\n}", "func (cdp *Client) Debug(enable bool) *Client {\n\tcdp.debug = enable\n\treturn cdp\n}", "func (c *APIClient) Debug() {\n\tc.debug = true\n}", "func (c *Client) Debug(debug bool) {\n\tc.debug = debug\n}", "func Debug(ctx ...interface{}) {\n\tlogNormal(debugStatus, time.Now(), ctx...)\n}", "func Debug(ctx context.Context, v ...interface{}) {\n\tlog := ExtractLogger(ctx)\n\tlog.Debug(v...)\n}", "func Debug(ctx context.Context, args ...interface{}) {\n\tGetLogger().Log(ctx, loggers.DebugLevel, 1, args...)\n}", "func (api *Client) Debug() bool {\n\treturn api.debug\n}", "func WithDebug() ClientOption {\n\treturn func(c *Client) error {\n\t\tc.debug = true\n\t\treturn nil\n\t}\n}", "func (c *Client) DebugMode(debug bool) {\n\tif debug {\n\t\tc.graphql.Log = func(s string) { log.Println(s) }\n\t} else {\n\t\tc.graphql.Log = func(s string) {}\n\t}\n}", "func Debug(msg string, ctx ...interface{}) {\n\tmetrics.GetOrRegisterCounter(\"debug\", nil).Inc(1)\n\tl.Output(msg, l.LvlDebug, CallDepth, ctx...)\n}", "func Debug(ctx context.Context, args ...interface{}) {\n\tlog.WithFields(utils.GetCommonMetaFromCtx(ctx)).Debug(args...)\n}", "func (c *Client) EnableDebug() {\n\tc.Debug = true\n}", "func (c *clientHandler) Debug() bool {\n\treturn c.debug\n}", "func Debug(ctx context.Context, args ...interface{}) {\n\tglobal.Debug(ctx, args...)\n}", "func ExampleDebug() {\n\tsetup()\n\tlog.Debug().Msg(\"hello world\")\n\n\t// Output: {\"level\":\"debug\",\"time\":1199811905,\"message\":\"hello world\"}\n}", "func (client *GroupMgmtClient) EnableDebug() {\n\tclient.Client.SetDebug(true)\n}", "func Debug(dbg bool) func(*Context) {\n\treturn func(ctx *Context) {\n\t\tif dbg {\n\t\t\tctx.msg.SetLevel(logger.DEBUG)\n\t\t}\n\t}\n}", "func (l nullLogger) Debug(msg string, ctx ...interface{}) {}", "func (c *context) Debug(format string, args ...interface{}) {\n\tc.logger.Debug(c.prefixFormat()+format, args...)\n}", "func NewDebug() *InjectWrapper {\n\tdi := New()\n\tdi.g.Logger = &log{}\n\treturn di\n}", "func (s *DefaultClient) SetDebug(enable bool) {\n\ts.Debug = enable\n}", "func Debug(ctx context.Context, msg string, fields ...zap.Field) {\n\tFromContext(ctx).WithOptions(zap.AddCallerSkip(1)).Debug(msg, fields...)\n}", "func (c *Poloniex) SetDebug(enable bool) {\n\tc.client.debug = enable\n}", "func Debug() Option {\n\treturn func(c *Client) error {\n\t\tc.debug = true\n\t\treturn nil\n\t}\n}", "func Debug(ctx context.Context, msg string, args ...Args) {\n\tL(ctx).Log(NewEntry(LevelDebug, msg, args...))\n}", "func (a *Adapter) Debug(ctx context.Context, message string, options ...interface{}) {\n\ta.log(ctx, levelDebug, message, options...)\n}", "func (cl *APIClient) EnableDebugMode() *APIClient {\n\tcl.debugMode = true\n\treturn cl\n}", "func etcdClientDebugLevel() zapcore.Level {\n\tenvLevel := os.Getenv(\"ETCD_CLIENT_DEBUG\")\n\tif envLevel == \"\" || envLevel == \"true\" {\n\t\treturn zapcore.InfoLevel\n\t}\n\tvar l zapcore.Level\n\tif err := l.Set(envLevel); err != nil {\n\t\tlog.Printf(\"Invalid value for environment variable 'ETCD_CLIENT_DEBUG'. Using default level: 'info'\")\n\t\treturn zapcore.InfoLevel\n\t}\n\treturn l\n}", "func (c MockClient) SetDebug(d bool) MockClient {\n\tc.restyClient.SetDebug(d)\n\treturn c\n}", "func (c *Client) debug(str string, args ...interface{}) {\n\tif c.level >= 2 {\n\t\tc.log.Printf(str, args...)\n\t}\n}", "func (c *clientHandler) SetDebug(debug bool) {\n\tc.debug = debug\n}", "func (rl *limiter) Debug(enable bool) {\n\trl.debug = enable\n}", "func Debug(ctx context.Context, err error) {\n\tif err == nil {\n\t\treturn\n\t}\n\tif ctx == nil {\n\t\tctx = defaultContext\n\t}\n\tif !verbose {\n\t\tif v, _ := ctx.Value(logContextKeyDebug).(bool); !v {\n\t\t\treturn\n\t\t}\n\t}\n\tctx = addSource(ctx, err)\n\n\tgetLogger(ctx).WithError(err).Infoln()\n}", "func OptionDebug(b bool) func(*Client) {\n\treturn func(c *Client) {\n\t\tc.debug = b\n\t}\n}", "func Debug(c *common.Context, message string) {\n\tlog.WithFields(log.Fields{\n\t\t\"eventID\": c.EventID,\n\t\t\"correlationID\": c.CorrelationID,\n\t\t\"name\": c.Name,\n\t\t\"timestamp\": time.Now(),\n\t}).Debug(message)\n}", "func (c Context) Debug(msg string) {\n\tc.Log(40, msg, GetCallingFunction())\n}", "func (e *Engine) Debug(enabled bool) *Engine {\n\te.Verbose = enabled\n\treturn e\n}", "func (l *AppLogger) Debug(tag string, message ...interface{}) {\n\tl.logging.SetFormatter(&logrus.JSONFormatter{})\n\tk := getAppFields(l.reqId, tag, l.userId)\n\tl.logging.WithFields(k).Debug(message...)\n}", "func DebugCtx(ctx context.Context, format string, v ...interface{}) {\n\tif LogLevel >= 4 {\n\t\tlc := FromContext(ctx)\n\t\tif len(lc) > 0 {\n\t\t\tformat = fmt.Sprintf(\"%s %s\", lc, format)\n\t\t}\n\t\tDoLog(3, DEBUG, fmt.Sprintf(format, v...))\n\t}\n}", "func EnableDebug(ctx context.Context) context.Context {\n\treturn context.WithValue(ctx, logContextKeyDebug, true)\n}", "func (a *APITest) Debug() *APITest {\n\ta.debugEnabled = true\n\treturn a\n}", "func (c *TaskContext) Debug(message string, v ...interface{}) {\n\tc.Logger.Debugf(message, v...)\n}", "func (c *Client) SetDebug(debug bool) {\n\tc.debug = debug\n}", "func Debug(args ...interface{}) {\n\tif glog.V(debug) {\n\t\tglog.InfoDepth(1, \"DEBUG: \"+fmt.Sprint(args...)) // 1 == depth in the stack of the caller\n\t}\n}", "func (logger MockLogger) Debug(args ...interface{}) {\n\tlogger.Sugar.Debug(args)\n}", "func (p *Provider) Debug(debug bool) {}", "func (p *Provider) Debug(debug bool) {}", "func (p *Provider) Debug(debug bool) {}", "func (p *Provider) Debug(debug bool) {}", "func Debug(v ...interface{}) {\n\tif enableDebug {\n\t\tinfoLog(v...)\n\t}\n}", "func (c classy) Debug() Classy {\n\tc.debug = true\n\treturn c\n}", "func (l *GlogLogger) Debug(ctx context.Context, format string, args ...interface{}) {\n\tif glog.V(l.debugV) {\n\t\tmsg := fmt.Sprintf(format, args...)\n\t\tglog.InfoDepth(1, msg)\n\t}\n}", "func (l *LvLogger) Debug(v ...interface{}) {\n\tif l.level > Debug {\n\t\treturn\n\t}\n\n\tl.inner.Output(2, fmt.Sprint(v...))\n}", "func (l *LoggerService) Debug(message string, values ...interface{}) {\n\tlog.Printf(\"[DEBUG] \"+message+\"\\n\", values...)\n}", "func (s SugaredLogger) Debug(message string, fields ...interface{}) {\n\ts.zapLogger.Debugw(message, fields...)\n}", "func SetDebugTrue() func(*Client) error {\n\treturn func(client *Client) error {\n\t\tclient.debug = true\n\n\t\treturn nil\n\t}\n}", "func (ctx *Context) Debug(format string, values ...interface{}) {\n\tctx.Debugf(format+\"\\n\", values...)\n}", "func (o DebugSessionOutput) Count() pulumi.IntOutput {\n\treturn o.ApplyT(func(v *DebugSession) pulumi.IntOutput { return v.Count }).(pulumi.IntOutput)\n}", "func Debugf(ctx context.Context, format string, args ...interface{}) {\n\tif ctx == nil {\n\t\tctx = defaultContext\n\t}\n\tif !verbose {\n\t\tif v, _ := ctx.Value(logContextKeyDebug).(bool); !v {\n\t\t\treturn\n\t\t}\n\t}\n\n\tgetLogger(ctx).Infof(format, args...)\n}", "func Debug(l ...interface{}) {\n\tlog.WithFields(log.Fields{\n\t\t\"SERVICE\": \"WINGO\",\n\t}).Debugln(l...)\n}", "func (l *logWrapper) Debug(args ...interface{}) {\n\tl.Log(LogDebug, 3, args...)\n}", "func (c *StatusdClient) Query() *StatusdQuery {\n\treturn &StatusdQuery{config: c.config}\n}", "func (l *jsonLogger) DebugContext(ctx context.Context, message interface{}, params ...interface{}) {\n\tl.jsonLogParser.parse(ctx, l.jsonLogParser.log.Debug(), \"\", params...).Msgf(\"%s\", message)\n}", "func (zw *zerologWrapper) Debug(ctx context.Context, format string, args ...interface{}) {\n\tnewEntry(zw, false, zw.cfg.staticFields).Debug(ctx, format, args...)\n}", "func (db RDB) Debug(enable bool) {\n\tdb.debug = enable\n}", "func Debug(g *types.Cmd) {\n\tg.Debug = true\n}", "func DebugLogging(c *Client) {\n\tc.Handlers.Send.Prepend(request.RequestLogger)\n\tc.Handlers.Send.Append(request.ResponseLogger)\n}", "func DebugcN(ctx context.Context, name, format string, v ...interface{}) {\n\tif logger, ok := mutil[name]; ok {\n\t\tlogger.Debugc(ctx, format, v...)\n\t}\n}", "func Debug(args ...interface{}) {\r\n\tLogger.Debug(\"\", args)\r\n}", "func ClientWithDebugLog(debugLog DebugLog) ClientOption {\n\treturn clientOptionAdapter(func(o *clientOptions) {\n\t\to.DebugLog = debugLog\n\t})\n}", "func handlerAdminCount(w http.ResponseWriter, r *http.Request) {\n\tsession, err := mgo.Dial(db.HostURL)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tdefer session.Close()\n\t//Get the count of all the tracks in db\n\tcount, err := session.DB(db.Databasename).C(db.TrackCollectionName).Count()\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\t_, err = fmt.Fprintf(w, \"%d\", count)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n}", "func (s *MultipassServer) Debug(ctx context.Context, request *apigrpc.NodeGroupServiceRequest) (*apigrpc.DebugReply, error) {\n\tglog.V(5).Infof(\"Call server Debug: %v\", request)\n\n\tif request.GetProviderID() != s.Configuration.ProviderID {\n\t\tglog.Errorf(errMismatchingProvider)\n\t\treturn nil, fmt.Errorf(errMismatchingProvider)\n\t}\n\n\tnodeGroup := s.Groups[request.GetNodeGroupID()]\n\n\tif nodeGroup == nil {\n\t\tglog.Errorf(errNodeGroupNotFound, request.GetNodeGroupID())\n\n\t\treturn nil, fmt.Errorf(errNodeGroupNotFound, request.GetNodeGroupID())\n\t}\n\n\treturn &apigrpc.DebugReply{\n\t\tResponse: fmt.Sprintf(\"%s-%s\", request.GetProviderID(), nodeGroup.NodeGroupIdentifier),\n\t}, nil\n}", "func (instance *DSInstance) Count(ctx context.Context, query *datastore.Query) (int, error) {\n\treturn instance.client.Count(ctx, query)\n}", "func (log *logger) Debug(message string) slf.Tracer {\n\treturn log.log(slf.LevelDebug, message)\n}", "func Debug(v ...interface{}) {\n\tWithLevel(LevelDebug, v...)\n}", "func WithDebug(fn func(ctx context.Context, event Request) (Response, error)) func(ctx context.Context, event Request) (Response, error) {\n\treturn func(ctx context.Context, event Request) (resp Response, err error) {\n\t\t_ = json.NewEncoder(os.Stdout).Encode(event)\n\t\tdefer func() {\n\t\t\t_ = json.NewEncoder(os.Stdout).Encode(resp)\n\t\t}()\n\n\t\treturn fn(ctx, event)\n\t}\n}", "func Debug(msg string, fields ...zapcore.Field) {\n\tGetZapLogger().Debug(msg, fields...)\n}", "func (l *logHandler) Debug(args ...interface{}) {\n\tl.Log(LogDebug, 3, args...)\n}" ]
[ "0.61493033", "0.60555303", "0.60555303", "0.60555303", "0.60555303", "0.60555303", "0.60555303", "0.60555303", "0.60555303", "0.60555303", "0.60555303", "0.60555303", "0.60555303", "0.60555303", "0.60555303", "0.60555303", "0.59392524", "0.5938695", "0.5846729", "0.57928205", "0.56539875", "0.5493298", "0.5458617", "0.54573095", "0.54176104", "0.5398854", "0.53816116", "0.53658485", "0.53222805", "0.53138757", "0.5297227", "0.526163", "0.5255427", "0.5223682", "0.51737314", "0.5173289", "0.5125154", "0.512083", "0.511945", "0.5101538", "0.5099055", "0.5010684", "0.5009678", "0.49881056", "0.49807963", "0.49571714", "0.49373084", "0.49235153", "0.49156004", "0.49042112", "0.49011824", "0.4886912", "0.48744354", "0.48425224", "0.48370564", "0.4830013", "0.4828811", "0.48286885", "0.48126832", "0.48116723", "0.47957298", "0.47933146", "0.47933146", "0.47933146", "0.47933146", "0.4784988", "0.47795236", "0.4777328", "0.47699273", "0.4758939", "0.4756267", "0.47476926", "0.4723703", "0.47158659", "0.4713653", "0.46958983", "0.4693708", "0.46913168", "0.46786904", "0.46769536", "0.4674673", "0.46728426", "0.46600178", "0.46444377", "0.46436736", "0.46366012", "0.4630701", "0.4628215", "0.46281776", "0.46224964", "0.4620897", "0.46119714", "0.46099287", "0.46071142" ]
0.61175984
6
Close closes the database connection and prevents new queries from starting.
func (c *Client) Close() error { return c.driver.Close() }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (db *Database) Close() { db.pg.Close() }", "func Close() {\n\tdb.Close()\n\n\treturn\n}", "func (db *Database) Close() {\n\tif db != nil {\n\t\tdb.conn.Close()\n\t}\n}", "func (this *Database) Close() {\n\tthis.db.Close()\n}", "func (this *Database) Close() {\n\tthis.db.Close()\n}", "func Close() {\n\tdb.Close()\n}", "func Close() {\n\tdb.Close()\n}", "func Close() {\n\tdb.Close()\n}", "func (d *Driver) Close() error { return d.DB().Close() }", "func (db *dbConnection) Close() error {\n\tfmt.Println(\"Close: Connection\", db.ID)\n\treturn nil\n}", "func Close() {\n\tdatabase.db.Close()\n}", "func (db *Database) Close() error {\n\treturn db.sql.Close()\n}", "func (m *mysqlDB) Close() {\n\tfmt.Println(\"DB close\")\n\tm.conn.Close()\n}", "func (db *DB) Close() error {\n\tif db.isClosed {\n\t\treturn errors.New(\"database already closed\")\n\t}\n\tclose(db.request)\n\treturn nil\n}", "func Close() {\n\t_db.Close()\n\t_db = nil\n}", "func (db *DB) Close() {\n\tdb.db.Close()\n}", "func (db *Database) Close() error {\n\tdb.lock.Lock()\n\tdefer db.lock.Unlock()\n\n\tif db.db == nil {\n\t\treturn database.ErrClosed\n\t}\n\n\tdb.readOptions.Destroy()\n\tdb.iteratorOptions.Destroy()\n\tdb.writeOptions.Destroy()\n\tdb.db.Close()\n\n\tdb.db = nil\n\treturn nil\n}", "func Close(db *sql.DB) {\n\tdb.Close()\n}", "func (db *Database) Close() error {\n\treturn db.inst.Close()\n}", "func (self PostgresDatabase) Close() {\n if self.conn != nil {\n self.conn.Close()\n self.conn = nil\n }\n}", "func (p Pgconnector) Close() error {\r\n\treturn p.Db.Close()\r\n}", "func Close() error {\n\treturn db.Close()\n}", "func (db Database) Close() {\n\tdb.DB.Close()\n}", "func (d *database) Close() {\n\td.DB.Close()\n}", "func (db *DB) Close() error {\n\treturn db.simple(jdh.Close)\n}", "func (db *DB) Close() {\n\t// Possible Deaollocate errors ignored, we are going to close the connnection anyway.\n\tdb.ClearMap()\n\tdb.Pool.Close()\n}", "func (d *Database) Close() {\n\terr := d.Conn.Close()\n\tif err != nil {\n\t\tfmt.Println(err)\n\t}\n}", "func (db *db) Close() error {\n\treturn db.DB.Close()\n}", "func (db *DB) Close() {\n\tdb.boltDB.Close()\n}", "func (c *client) Close() error {\n\tif c.db != nil {\n\t\treturn c.db.Close()\n\t}\n\treturn nil\n}", "func (db *DB) Close() error {\n\treturn db.db.Close()\n}", "func (db *DB) Close() error {\n\treturn db.db.Close()\n}", "func (db *DB) Close() error {\n\treturn db.db.Close()\n}", "func (db *DB) Close() {\n\tdb.session.Close()\n}", "func (db *DB) Close() {\n\tdb.session.Close()\n}", "func (r *RavelDatabase) Close() {\n\terr := r.Conn.Close()\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n}", "func (dbConn *DBConnection) Close() {\n\tif dbConn.db != nil {\n\t\tdbConn.db.Close()\n\t}\n}", "func (db *DB) Close() error {\n\terr := db.DB.Close()\n\tdb.metrics.close()\n\treturn err\n}", "func Close() (err error) {\n\tif db != nil {\n\t\terr = db.Close()\n\t\tdb = nil\n\t}\n\treturn\n}", "func Close() {\n\tdbcontext.Close()\n}", "func (db *DB) Close() error {\n\tif db.db != nil {\n\t\tdb.db.Close()\n\t}\n\treturn nil\n}", "func (db *WorkDB) Close() {\n\tdb.db.Close()\n}", "func (db *DB) Close() error {\n\t// return db.redis.Close()\n\treturn nil\n}", "func Close() error {\n\treturn DB.Close()\n}", "func (s *Postgres) Close() {\n\ts.db.Close()\n}", "func (db *DB) Close() {\n\tdb.mu.Lock()\n\tdefer db.mu.Unlock()\n\tif !db.closed {\n\t\tdb.closed = true\n\t\tclose(db.notifyQuit)\n\t\tclose(db.notifyOpen)\n\t\tclose(db.notifyError)\n\t\tclose(db.notifyInfo)\n\t}\n\tif db.reader != nil {\n\t\tdb.reader.Close()\n\t\tdb.reader = nil\n\t}\n}", "func (db *DB) Close() error {\n\tdb.closeOnce.Do(func() {\n\t\tclose(db.closed)\n\t})\n\treturn nil\n}", "func (db *DB) Close() error {\n\terr := db.levelJobsStmt.Close()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\terr = db.clientsStmt.Close()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn db.DB.Close()\n}", "func (s *Server) Close() {\n\t_ = s.db.Close()\n}", "func (db *DB) Close() error {\n\tif db.cancelBgWorker != nil {\n\t\tdb.cancelBgWorker()\n\t}\n\tdb.closeWg.Wait()\n\tdb.mu.Lock()\n\tdefer db.mu.Unlock()\n\tif err := db.writeMeta(); err != nil {\n\t\treturn err\n\t}\n\tif err := db.datalog.close(); err != nil {\n\t\treturn err\n\t}\n\tif err := db.index.close(); err != nil {\n\t\treturn err\n\t}\n\tif err := db.lock.Unlock(); err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "func CloseDatabase() {\n\tdatabaseAccess.close()\n}", "func (c *cockroachdb) Close() {\n\tlog.Tracef(\"Close\")\n\n\tc.Lock()\n\tdefer c.Unlock()\n\n\tc.shutdown = true\n\tc.recordsdb.Close()\n}", "func (g *DB) Close() {\n\tg.mutex.Lock()\n\tdefer g.mutex.Unlock()\n\tg.reader.Close()\n}", "func (db *Database) Close() error {\n\tsqlDB, err := db.conn.DB()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn sqlDB.Close()\n}", "func (db *DB) Close() {\n\tif db == nil {\n\t\treturn\n\t}\n\n\tif db.roIt != nil {\n\t\tdb.roIt.Close()\n\t}\n\n\tif db.ro != nil {\n\t\tdb.ro.Close()\n\t}\n\n\tif db.wo != nil {\n\t\tdb.wo.Close()\n\t}\n\n\tif db.LevigoDB != nil {\n\t\tdb.LevigoDB.Close()\n\t}\n\t// delete cache AFTER close leveldb or it will hang.\n\t// See cache in http://leveldb.googlecode.com/svn/trunk/doc/index.html\n\tif db.cache != nil {\n\t\tdb.cache.Close()\n\t}\n}", "func Close() {\n\tif err := db.Close(); err != nil {\n\t\tpanic(err)\n\t}\n}", "func Close() {\n\tif err := db.Close(); err != nil {\n\t\tpanic(err)\n\t}\n}", "func Close() {\n\tdatabase.Close()\n\tfmt.Println(\"Database closed\")\n}", "func (db *DB) Close() error {\n\tdb.rwlock.Lock()\n\tdefer db.rwlock.Unlock()\n\n\tdb.metalock.Lock()\n\tdefer db.metalock.Unlock()\n\n\tdb.mmaplock.Lock()\n\tdefer db.mmaplock.Unlock()\n\n\treturn db.close()\n}", "func (db *DB) Close() {\n\tif db.closed {\n\t\treturn\n\t}\n\n\tdb.closed = true\n\tC.leveldb_close(db.Ldb)\n}", "func (this *DBHandler) Close() {\n\tthis.db.Close()\n}", "func DBClose(db *sql.DB) {\n\tdb.Close()\n}", "func (db *BotDB) Close() {\n\tif db.db != nil {\n\t\tdb.db.Close()\n\t\tdb.db = nil\n\t}\n}", "func (db *mongoDB) Close() {\n\tdb.logger.Info(\"Disconnecting from database\")\n\tdb.conn.Close()\n}", "func Close() {\n\tdefaultDB.Close()\n}", "func (c *PostgreSQLConnection) Close() {\n\ttry := 0\n\terr := c.db.Close()\n\n\tif err != nil {\n\t\tlog.Printf(\"[!] Failed to close the connection. Reason %v\\n\", err)\n\t\tfor ; try < 3; try++ {\n\t\t\tlog.Printf(\"[-] Trying to close the connection again\\n\")\n\t\t\terr = c.db.Close()\n\t\t}\n\n\t\tif err != nil {\n\t\t\tlog.Printf(\"[!] Database connection couldn't be closed. Reason %v\\n\",\n\t\t\t\terr)\n\t\t}\n\t}\n}", "func (db *TriasDB) Close() {\n\t// TODO: unimplement\n\tpanic(\"TriasDB.Close not yet implemented\")\n}", "func (d DB) Close() error {\n\treturn d.conn.Close()\n}", "func (db *TaskDB) Close() {\n\tif db.conn != nil {\n\t\tdb.conn.Close()\n\t}\n}", "func (db *DB) Close() error {\n\treturn db.bolt.Close()\n}", "func (d *BoltDB) Close() {\n\td.Close()\n}", "func (c *PostgresConnect) Close() error {\n\tif c.DB != nil {\n\t\treturn c.DB.Close()\n\t}\n\treturn nil\n}", "func (db *DB) Close() {\n\tdb.e.Close()\n}", "func (db *mongoDB) Close() {\n\tdb.conn.Close()\n}", "func (db *Database) Close() error {\n\treturn db.ng.Close()\n}", "func (s DB) Close() error {\n\treturn s.DB.Close()\n}", "func (db *Connection) Close() error {\n\treturn db.con.Close()\n}", "func (db *Database) Close() {\n\terr := db.DB.Close()\n\n\tif err != nil {\n\t\tfmt.Printf(\"Error closing db: %v\\n\", err)\n\t}\n}", "func (db *SQLStore) Close() error {\n\treturn db.conn.Close()\n}", "func Close(db *pg.DB) {\n\tcloseErr := db.Close()\n\tif closeErr != nil {\n\t\tlog.Printf(\"Failed to close db connection %v\\n\", closeErr)\n\t}\n\tlog.Println(\"Closing db connection\")\n}", "func Close() error {\n\tlock.Lock()\n\tdefer lock.Unlock()\n\n\tif database == nil {\n\t\tlog.Log.Warn().Msg(\"database already closed\")\n\t\treturn nil\n\t}\n\tif err := database.Close(); err != nil {\n\t\tlog.Log.Err(err).Msg(\"error closing database\")\n\t\treturn err\n\t}\n\tdatabase = nil\n\tlog.Log.Debug().Msg(\"closed database\")\n\n\treturn nil\n}", "func CloseDB() {\n\tdb.Close()\n}", "func CloseDB() {\n\tdb.Close()\n}", "func (db *DB) Close() error {\n\terr := db.db.Close()\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "func (d *Database) Close() error {\n\treturn d.Database.Close()\n}", "func (db TestDB) Close() error {\n\treturn nil\n}", "func (db *EdDb) Close() {\n\t// close prepared statements\n\tfor title := range db.preparedStatements() {\n\t\tdb.statements[title].Close()\n\t}\n\n\t//close databases\n\tdb.dbConn.Close()\n\treturn\n}", "func (gdb *generalDatabase) Close() error {\n\treturn gdb.db.Close()\n}", "func (db *DB) Close() error {\n\n\tdb.rwlock.Lock()\n\tdefer db.rwlock.Unlock()\n\n\tdb.metalock.Lock()\n\tdefer db.metalock.Unlock()\n\n\tdb.mmaplock.RLock()\n\tdefer db.mmaplock.RUnlock()\n\n\treturn db.close()\n}", "func (s *mysql) Close() {\n\tlog.Tracef(\"Close\")\n\n\tatomic.AddUint64(&s.shutdown, 1)\n\n\t// Zero the encryption key\n\tutil.Zero(s.key[:])\n\n\t// Close mysql connection\n\ts.db.Close()\n}", "func (p *CockroachDriver) Close() {\n\tp.dbConn.Close()\n}", "func (d *remoteDB) Close() error {\n\treturn d.conn.Close()\n}", "func Close() (err error) {\n\tif readOnlyDB != nil {\n\t\tif err = readOnlyDB.Close(); err != nil {\n\t\t\treturn\n\t\t}\n\t}\n\n\tif readWriteDB != nil {\n\t\tif err = readWriteDB.Close(); err != nil {\n\t\t\treturn\n\t\t}\n\t}\n\n\treturn\n}", "func (d *MovieDatabase) Close() {\n\td.Client.Disconnect(d.Context)\n}", "func CloseDB() {\n\tDb.Close()\n}", "func (c *Client) Close() error {\n\tif c.db != nil {\n\t\treturn c.db.Close()\n\t}\n\treturn nil\n}", "func (c *PostgresConnection) Close() error {\n\treturn c.DB.Close()\n}", "func (c *Client) Close() error {\n\tc.logger.Debug().Msg(\"connection to db closed\")\n\treturn c.db.Close()\n}", "func (db *VersionedDatabase) Close() error {\n\treturn db.Database.Close()\n}", "func (db *DB) Close() error {\n\treturn db.client.Close()\n}", "func (dbHandler *Handler) Close() {\n\tdbHandler.DB.Close() //nolint:errcheck,gosec\n}" ]
[ "0.7853149", "0.78257537", "0.7783495", "0.7776901", "0.7776901", "0.7771785", "0.7771785", "0.7771785", "0.7742943", "0.77089447", "0.7683307", "0.7679106", "0.765418", "0.76489776", "0.7647668", "0.76407033", "0.76242566", "0.7614262", "0.7612574", "0.75927186", "0.75847787", "0.7570561", "0.7564322", "0.7543436", "0.7535683", "0.751487", "0.75063145", "0.7493594", "0.748804", "0.74853", "0.7476559", "0.7476559", "0.7476559", "0.74683356", "0.74683356", "0.7464242", "0.7459754", "0.7456081", "0.74560386", "0.7442126", "0.74344313", "0.74324393", "0.7427269", "0.7422581", "0.74185383", "0.741847", "0.74109626", "0.74081206", "0.7405677", "0.74056363", "0.7399085", "0.73881996", "0.7387177", "0.73850447", "0.7382264", "0.73804", "0.73804", "0.73786026", "0.73778385", "0.7367867", "0.73677367", "0.736751", "0.7366899", "0.7365233", "0.73586196", "0.73574245", "0.73564327", "0.7356377", "0.735336", "0.73410815", "0.7340132", "0.7340103", "0.7339045", "0.73389363", "0.7338215", "0.7334613", "0.73339576", "0.73318577", "0.7331782", "0.73265606", "0.73261136", "0.7318172", "0.7318172", "0.7315725", "0.73148096", "0.73125964", "0.73056626", "0.7301789", "0.730077", "0.72990996", "0.7291323", "0.7291086", "0.72893107", "0.7284706", "0.72839797", "0.7274987", "0.7266445", "0.7265005", "0.7263494", "0.72570306", "0.72363687" ]
0.0
-1
Use adds the mutation hooks to all the entity clients. In order to add hooks to a specific client, call: `client.Node.Use(...)`.
func (c *Client) Use(hooks ...Hook) { c.Admin.Use(hooks...) c.AdminSession.Use(hooks...) c.Category.Use(hooks...) c.Post.Use(hooks...) c.PostAttachment.Use(hooks...) c.PostImage.Use(hooks...) c.PostThumbnail.Use(hooks...) c.PostVideo.Use(hooks...) c.UnsavedPost.Use(hooks...) c.UnsavedPostAttachment.Use(hooks...) c.UnsavedPostImage.Use(hooks...) c.UnsavedPostThumbnail.Use(hooks...) c.UnsavedPostVideo.Use(hooks...) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (c *WalletNodeClient) Use(hooks ...Hook) {\n\tc.hooks.WalletNode = append(c.hooks.WalletNode, hooks...)\n}", "func (c *OperationClient) Use(hooks ...Hook) {\n\tc.hooks.Operation = append(c.hooks.Operation, hooks...)\n}", "func (c *SituationClient) Use(hooks ...Hook) {\n\tc.hooks.Situation = append(c.hooks.Situation, hooks...)\n}", "func (c *Client) Use(hooks ...Hook) {\n\tc.Event.Use(hooks...)\n\tc.Tag.Use(hooks...)\n}", "func (c *LevelOfDangerousClient) Use(hooks ...Hook) {\n\tc.hooks.LevelOfDangerous = append(c.hooks.LevelOfDangerous, hooks...)\n}", "func (c *AdminClient) Use(hooks ...Hook) {\n\tc.hooks.Admin = append(c.hooks.Admin, hooks...)\n}", "func (c *StatustClient) Use(hooks ...Hook) {\n\tc.hooks.Statust = append(c.hooks.Statust, hooks...)\n}", "func (c *OperativeClient) Use(hooks ...Hook) {\n\tc.hooks.Operative = append(c.hooks.Operative, hooks...)\n}", "func (c *PhysicianClient) Use(hooks ...Hook) {\n\tc.hooks.Physician = append(c.hooks.Physician, hooks...)\n}", "func (c *PhysicianClient) Use(hooks ...Hook) {\n\tc.hooks.Physician = append(c.hooks.Physician, hooks...)\n}", "func (c *Client) Use(hooks ...Hook) {\n\tc.Eatinghistory.Use(hooks...)\n\tc.Foodmenu.Use(hooks...)\n\tc.Mealplan.Use(hooks...)\n\tc.Taste.Use(hooks...)\n\tc.User.Use(hooks...)\n}", "func (c *DentistClient) Use(hooks ...Hook) {\n\tc.hooks.Dentist = append(c.hooks.Dentist, hooks...)\n}", "func (c *TransactionClient) Use(hooks ...Hook) {\n\tc.hooks.Transaction = append(c.hooks.Transaction, hooks...)\n}", "func (c *VeterinarianClient) Use(hooks ...Hook) {\n\tc.hooks.Veterinarian = append(c.hooks.Veterinarian, hooks...)\n}", "func (c *OperativerecordClient) Use(hooks ...Hook) {\n\tc.hooks.Operativerecord = append(c.hooks.Operativerecord, hooks...)\n}", "func (c *ComplaintClient) Use(hooks ...Hook) {\n\tc.hooks.Complaint = append(c.hooks.Complaint, hooks...)\n}", "func (c *ToolClient) Use(hooks ...Hook) {\n\tc.hooks.Tool = append(c.hooks.Tool, hooks...)\n}", "func (c *TagClient) Use(hooks ...Hook) {\n\tc.hooks.Tag = append(c.hooks.Tag, hooks...)\n}", "func (c *EmployeeClient) Use(hooks ...Hook) {\n\tc.hooks.Employee = append(c.hooks.Employee, hooks...)\n}", "func (c *EmployeeClient) Use(hooks ...Hook) {\n\tc.hooks.Employee = append(c.hooks.Employee, hooks...)\n}", "func (c *EmployeeClient) Use(hooks ...Hook) {\n\tc.hooks.Employee = append(c.hooks.Employee, hooks...)\n}", "func (c *Client) Use(hooks ...Hook) {\n\tc.CoinInfo.Use(hooks...)\n\tc.Empty.Use(hooks...)\n\tc.KeyStore.Use(hooks...)\n\tc.Review.Use(hooks...)\n\tc.Transaction.Use(hooks...)\n\tc.WalletNode.Use(hooks...)\n}", "func (c *PurposeClient) Use(hooks ...Hook) {\n\tc.hooks.Purpose = append(c.hooks.Purpose, hooks...)\n}", "func (c *Client) Use(hooks ...Hook) {\n\tc.Gender.Use(hooks...)\n\tc.Position.Use(hooks...)\n\tc.Title.Use(hooks...)\n\tc.User.Use(hooks...)\n}", "func (c *BeerClient) Use(hooks ...Hook) {\n\tc.hooks.Beer = append(c.hooks.Beer, hooks...)\n}", "func (c *PlanetClient) Use(hooks ...Hook) {\n\tc.hooks.Planet = append(c.hooks.Planet, hooks...)\n}", "func (c *Client) Use(hooks ...Hook) {\n\tc.Dentist.Use(hooks...)\n\tc.Employee.Use(hooks...)\n\tc.Patient.Use(hooks...)\n\tc.Queue.Use(hooks...)\n}", "func (c *FoodmenuClient) Use(hooks ...Hook) {\n\tc.hooks.Foodmenu = append(c.hooks.Foodmenu, hooks...)\n}", "func (c *ClubClient) Use(hooks ...Hook) {\n\tc.hooks.Club = append(c.hooks.Club, hooks...)\n}", "func (c *Client) Use(hooks ...Hook) {\n\tc.Company.Use(hooks...)\n\tc.Job.Use(hooks...)\n\tc.Skill.Use(hooks...)\n\tc.User.Use(hooks...)\n\tc.WorkExperience.Use(hooks...)\n}", "func (c *CompanyClient) Use(hooks ...Hook) {\n\tc.hooks.Company = append(c.hooks.Company, hooks...)\n}", "func (c *CompanyClient) Use(hooks ...Hook) {\n\tc.hooks.Company = append(c.hooks.Company, hooks...)\n}", "func (c *Client) Use(hooks ...Hook) {\n\tc.Appointment.Use(hooks...)\n\tc.Clinic.Use(hooks...)\n\tc.Customer.Use(hooks...)\n\tc.Pet.Use(hooks...)\n\tc.User.Use(hooks...)\n\tc.Veterinarian.Use(hooks...)\n}", "func (c *AnnotationClient) Use(hooks ...Hook) {\n\tc.hooks.Annotation = append(c.hooks.Annotation, hooks...)\n}", "func (c *SymptomClient) Use(hooks ...Hook) {\n\tc.hooks.Symptom = append(c.hooks.Symptom, hooks...)\n}", "func (c *LeaseClient) Use(hooks ...Hook) {\n\tc.hooks.Lease = append(c.hooks.Lease, hooks...)\n}", "func (c *PetClient) Use(hooks ...Hook) {\n\tc.hooks.Pet = append(c.hooks.Pet, hooks...)\n}", "func (c *Client) Use(hooks ...Hook) {\n\tc.Annotation.Use(hooks...)\n\tc.Bill.Use(hooks...)\n\tc.Company.Use(hooks...)\n\tc.DispenseMedicine.Use(hooks...)\n\tc.Doctor.Use(hooks...)\n\tc.DrugAllergy.Use(hooks...)\n\tc.LevelOfDangerous.Use(hooks...)\n\tc.Medicine.Use(hooks...)\n\tc.MedicineType.Use(hooks...)\n\tc.Order.Use(hooks...)\n\tc.PatientInfo.Use(hooks...)\n\tc.Payment.Use(hooks...)\n\tc.Pharmacist.Use(hooks...)\n\tc.PositionInPharmacist.Use(hooks...)\n\tc.Prescription.Use(hooks...)\n\tc.UnitOfMedicine.Use(hooks...)\n}", "func (c *Client) Use(hooks ...Hook) {\n\tc.Department.Use(hooks...)\n\tc.Physician.Use(hooks...)\n\tc.Position.Use(hooks...)\n\tc.Positionassingment.Use(hooks...)\n}", "func (c *Client) Use(hooks ...Hook) {\n\tc.Planet.Use(hooks...)\n\tc.Session.Use(hooks...)\n\tc.Timer.Use(hooks...)\n\tc.User.Use(hooks...)\n}", "func (c *Client) Use(hooks ...Hook) {\n\tc.Examinationroom.Use(hooks...)\n\tc.Nurse.Use(hooks...)\n\tc.Operative.Use(hooks...)\n\tc.Operativerecord.Use(hooks...)\n\tc.Tool.Use(hooks...)\n}", "func (c *DoctorClient) Use(hooks ...Hook) {\n\tc.hooks.Doctor = append(c.hooks.Doctor, hooks...)\n}", "func (c *CleanernameClient) Use(hooks ...Hook) {\n\tc.hooks.Cleanername = append(c.hooks.Cleanername, hooks...)\n}", "func (c *PetruleClient) Use(hooks ...Hook) {\n\tc.hooks.Petrule = append(c.hooks.Petrule, hooks...)\n}", "func (c *PositionassingmentClient) Use(hooks ...Hook) {\n\tc.hooks.Positionassingment = append(c.hooks.Positionassingment, hooks...)\n}", "func (c *EatinghistoryClient) Use(hooks ...Hook) {\n\tc.hooks.Eatinghistory = append(c.hooks.Eatinghistory, hooks...)\n}", "func (c *OperationroomClient) Use(hooks ...Hook) {\n\tc.hooks.Operationroom = append(c.hooks.Operationroom, hooks...)\n}", "func (c *EventClient) Use(hooks ...Hook) {\n\tc.hooks.Event = append(c.hooks.Event, hooks...)\n}", "func (c *Client) Use(hooks ...Hook) {\n\tc.Booking.Use(hooks...)\n\tc.Operationroom.Use(hooks...)\n\tc.Patient.Use(hooks...)\n\tc.User.Use(hooks...)\n}", "func (c *MealplanClient) Use(hooks ...Hook) {\n\tc.hooks.Mealplan = append(c.hooks.Mealplan, hooks...)\n}", "func (c *Client) Use(hooks ...Hook) {\n\tc.DNSBLQuery.Use(hooks...)\n\tc.DNSBLResponse.Use(hooks...)\n\tc.IP.Use(hooks...)\n\tc.Operation.Use(hooks...)\n\tc.User.Use(hooks...)\n}", "func (c *UserWalletClient) Use(hooks ...Hook) {\n\tc.hooks.UserWallet = append(c.hooks.UserWallet, hooks...)\n}", "func (c *SkillClient) Use(hooks ...Hook) {\n\tc.hooks.Skill = append(c.hooks.Skill, hooks...)\n}", "func (c *ClubTypeClient) Use(hooks ...Hook) {\n\tc.hooks.ClubType = append(c.hooks.ClubType, hooks...)\n}", "func (c *DepositClient) Use(hooks ...Hook) {\n\tc.hooks.Deposit = append(c.hooks.Deposit, hooks...)\n}", "func (c *WorkExperienceClient) Use(hooks ...Hook) {\n\tc.hooks.WorkExperience = append(c.hooks.WorkExperience, hooks...)\n}", "func (c *Client) Use(hooks ...Hook) {\n\tc.AcademicYear.Use(hooks...)\n\tc.Activities.Use(hooks...)\n\tc.ActivityType.Use(hooks...)\n\tc.Club.Use(hooks...)\n\tc.ClubBranch.Use(hooks...)\n\tc.ClubType.Use(hooks...)\n\tc.ClubappStatus.Use(hooks...)\n\tc.Clubapplication.Use(hooks...)\n\tc.Complaint.Use(hooks...)\n\tc.ComplaintType.Use(hooks...)\n\tc.Discipline.Use(hooks...)\n\tc.Gender.Use(hooks...)\n\tc.Position.Use(hooks...)\n\tc.Purpose.Use(hooks...)\n\tc.Room.Use(hooks...)\n\tc.Roomuse.Use(hooks...)\n\tc.User.Use(hooks...)\n\tc.UserStatus.Use(hooks...)\n\tc.Usertype.Use(hooks...)\n\tc.Year.Use(hooks...)\n}", "func (c *Client) Use(hooks ...Hook) {\n\tc.Patient.Use(hooks...)\n\tc.Patientofphysician.Use(hooks...)\n\tc.Patientroom.Use(hooks...)\n\tc.Physician.Use(hooks...)\n}", "func (c *DrugAllergyClient) Use(hooks ...Hook) {\n\tc.hooks.DrugAllergy = append(c.hooks.DrugAllergy, hooks...)\n}", "func (c *PatientofphysicianClient) Use(hooks ...Hook) {\n\tc.hooks.Patientofphysician = append(c.hooks.Patientofphysician, hooks...)\n}", "func (c *CoinInfoClient) Use(hooks ...Hook) {\n\tc.hooks.CoinInfo = append(c.hooks.CoinInfo, hooks...)\n}", "func (c *BedtypeClient) Use(hooks ...Hook) {\n\tc.hooks.Bedtype = append(c.hooks.Bedtype, hooks...)\n}", "func (c *PostClient) Use(hooks ...Hook) {\n\tc.hooks.Post = append(c.hooks.Post, hooks...)\n}", "func (c *ComplaintTypeClient) Use(hooks ...Hook) {\n\tc.hooks.ComplaintType = append(c.hooks.ComplaintType, hooks...)\n}", "func (c *ReviewClient) Use(hooks ...Hook) {\n\tc.hooks.Review = append(c.hooks.Review, hooks...)\n}", "func (c *NurseClient) Use(hooks ...Hook) {\n\tc.hooks.Nurse = append(c.hooks.Nurse, hooks...)\n}", "func (c *ClinicClient) Use(hooks ...Hook) {\n\tc.hooks.Clinic = append(c.hooks.Clinic, hooks...)\n}", "func (c *StaytypeClient) Use(hooks ...Hook) {\n\tc.hooks.Staytype = append(c.hooks.Staytype, hooks...)\n}", "func (c *AdminSessionClient) Use(hooks ...Hook) {\n\tc.hooks.AdminSession = append(c.hooks.AdminSession, hooks...)\n}", "func (c *PatientClient) Use(hooks ...Hook) {\n\tc.hooks.Patient = append(c.hooks.Patient, hooks...)\n}", "func (c *PatientClient) Use(hooks ...Hook) {\n\tc.hooks.Patient = append(c.hooks.Patient, hooks...)\n}", "func (c *PatientClient) Use(hooks ...Hook) {\n\tc.hooks.Patient = append(c.hooks.Patient, hooks...)\n}", "func (c *CustomerClient) Use(hooks ...Hook) {\n\tc.hooks.Customer = append(c.hooks.Customer, hooks...)\n}", "func (c *MedicineClient) Use(hooks ...Hook) {\n\tc.hooks.Medicine = append(c.hooks.Medicine, hooks...)\n}", "func (c *BuildingClient) Use(hooks ...Hook) {\n\tc.hooks.Building = append(c.hooks.Building, hooks...)\n}", "func (c *PartClient) Use(hooks ...Hook) {\n\tc.hooks.Part = append(c.hooks.Part, hooks...)\n}", "func (c *ClubapplicationClient) Use(hooks ...Hook) {\n\tc.hooks.Clubapplication = append(c.hooks.Clubapplication, hooks...)\n}", "func (c *PositionClient) Use(hooks ...Hook) {\n\tc.hooks.Position = append(c.hooks.Position, hooks...)\n}", "func (c *PositionClient) Use(hooks ...Hook) {\n\tc.hooks.Position = append(c.hooks.Position, hooks...)\n}", "func (c *PositionClient) Use(hooks ...Hook) {\n\tc.hooks.Position = append(c.hooks.Position, hooks...)\n}", "func (c *UsertypeClient) Use(hooks ...Hook) {\n\tc.hooks.Usertype = append(c.hooks.Usertype, hooks...)\n}", "func (c *ClubBranchClient) Use(hooks ...Hook) {\n\tc.hooks.ClubBranch = append(c.hooks.ClubBranch, hooks...)\n}", "func (c *PharmacistClient) Use(hooks ...Hook) {\n\tc.hooks.Pharmacist = append(c.hooks.Pharmacist, hooks...)\n}", "func (c *CategoryClient) Use(hooks ...Hook) {\n\tc.hooks.Category = append(c.hooks.Category, hooks...)\n}", "func (c *GenderClient) Use(hooks ...Hook) {\n\tc.hooks.Gender = append(c.hooks.Gender, hooks...)\n}", "func (c *GenderClient) Use(hooks ...Hook) {\n\tc.hooks.Gender = append(c.hooks.Gender, hooks...)\n}", "func (c *UserClient) Use(hooks ...Hook) {\n\tc.hooks.User = append(c.hooks.User, hooks...)\n}", "func (c *UserClient) Use(hooks ...Hook) {\n\tc.hooks.User = append(c.hooks.User, hooks...)\n}", "func (c *UserClient) Use(hooks ...Hook) {\n\tc.hooks.User = append(c.hooks.User, hooks...)\n}", "func (c *UserClient) Use(hooks ...Hook) {\n\tc.hooks.User = append(c.hooks.User, hooks...)\n}", "func (c *UserClient) Use(hooks ...Hook) {\n\tc.hooks.User = append(c.hooks.User, hooks...)\n}", "func (c *UserClient) Use(hooks ...Hook) {\n\tc.hooks.User = append(c.hooks.User, hooks...)\n}", "func (c *UserClient) Use(hooks ...Hook) {\n\tc.hooks.User = append(c.hooks.User, hooks...)\n}", "func (c *UserClient) Use(hooks ...Hook) {\n\tc.hooks.User = append(c.hooks.User, hooks...)\n}", "func (c *UserClient) Use(hooks ...Hook) {\n\tc.hooks.User = append(c.hooks.User, hooks...)\n}", "func (c *UserClient) Use(hooks ...Hook) {\n\tc.hooks.User = append(c.hooks.User, hooks...)\n}", "func (c *UserClient) Use(hooks ...Hook) {\n\tc.hooks.User = append(c.hooks.User, hooks...)\n}", "func (c *Client) Use(hooks ...Hook) {\n\tc.User.Use(hooks...)\n\tc.UserCard.Use(hooks...)\n\tc.UserWallet.Use(hooks...)\n}", "func (c *UnitOfMedicineClient) Use(hooks ...Hook) {\n\tc.hooks.UnitOfMedicine = append(c.hooks.UnitOfMedicine, hooks...)\n}", "func (c *Client) Use(hooks ...Hook) {\n\tc.Bill.Use(hooks...)\n\tc.Billingstatus.Use(hooks...)\n\tc.Branch.Use(hooks...)\n\tc.Building.Use(hooks...)\n\tc.Device.Use(hooks...)\n\tc.Employee.Use(hooks...)\n\tc.Faculty.Use(hooks...)\n\tc.Part.Use(hooks...)\n\tc.Partorder.Use(hooks...)\n\tc.RepairInvoice.Use(hooks...)\n\tc.Returninvoice.Use(hooks...)\n\tc.Room.Use(hooks...)\n\tc.StatusR.Use(hooks...)\n\tc.Statust.Use(hooks...)\n\tc.Symptom.Use(hooks...)\n\tc.User.Use(hooks...)\n}" ]
[ "0.73156387", "0.6934168", "0.68373275", "0.6830245", "0.68195266", "0.681435", "0.67450345", "0.67267996", "0.67176294", "0.67176294", "0.67155915", "0.6699692", "0.6683322", "0.6680877", "0.66504014", "0.66459477", "0.6634452", "0.661542", "0.6608337", "0.6608337", "0.6608337", "0.66034853", "0.65734583", "0.6561813", "0.655352", "0.65350026", "0.65339476", "0.65322995", "0.6529444", "0.6523265", "0.65079427", "0.65079427", "0.65040195", "0.64918983", "0.6488523", "0.6487522", "0.6479102", "0.6479039", "0.6472929", "0.64686245", "0.64670897", "0.6452725", "0.6450951", "0.6439372", "0.6438059", "0.64099133", "0.640693", "0.6393253", "0.6387233", "0.6386483", "0.63844466", "0.6381235", "0.6378713", "0.63713133", "0.6365917", "0.63617796", "0.6358432", "0.63516325", "0.6348611", "0.63374585", "0.6320504", "0.63171566", "0.6309058", "0.6303917", "0.6300294", "0.6292654", "0.6289119", "0.6288511", "0.62878376", "0.62864834", "0.62864834", "0.62864834", "0.6286398", "0.6285215", "0.6284732", "0.6282945", "0.6267928", "0.62668455", "0.62668455", "0.62668455", "0.6254923", "0.6253391", "0.62529296", "0.62493515", "0.6247709", "0.6247709", "0.6242976", "0.6242976", "0.6242976", "0.6242976", "0.6242976", "0.6242976", "0.6242976", "0.6242976", "0.6242976", "0.6242976", "0.6242976", "0.6239723", "0.62396467", "0.6229417" ]
0.6578559
22
NewAdminClient returns a client for the Admin from the given config.
func NewAdminClient(c config) *AdminClient { return &AdminClient{config: c} }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func NewAdminClient(conf *ConfigMap) (*AdminClient, error) {\n\n\terr := versionCheck()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\ta := &AdminClient{}\n\ta.handle = &handle{}\n\n\t// Convert ConfigMap to librdkafka conf_t\n\tcConf, err := conf.convert()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tcErrstr := (*C.char)(C.malloc(C.size_t(256)))\n\tdefer C.free(unsafe.Pointer(cErrstr))\n\n\tC.rd_kafka_conf_set_events(cConf, C.RD_KAFKA_EVENT_STATS|C.RD_KAFKA_EVENT_ERROR|C.RD_KAFKA_EVENT_OAUTHBEARER_TOKEN_REFRESH)\n\n\t// Create librdkafka producer instance. The Producer is somewhat cheaper than\n\t// the consumer, but any instance type can be used for Admin APIs.\n\ta.handle.rk = C.rd_kafka_new(C.RD_KAFKA_PRODUCER, cConf, cErrstr, 256)\n\tif a.handle.rk == nil {\n\t\treturn nil, newErrorFromCString(C.RD_KAFKA_RESP_ERR__INVALID_ARG, cErrstr)\n\t}\n\n\ta.isDerived = false\n\ta.handle.setup()\n\n\ta.isClosed = 0\n\n\treturn a, nil\n}", "func (m *MockedKafkaAdminClient) NewAdminClient(conf *kafka.ConfigMap) (*kafka.AdminClient, error) {\n\targs := m.Called(conf)\n\treturn args.Get(0).(*kafka.AdminClient), args.Error(1)\n}", "func NewAdminClient(ctx context.Context, project, instance string, opts ...option.ClientOption) (*AdminClient, error) {\n\to, err := btopt.DefaultClientOptions(adminAddr, AdminScope, clientUserAgent)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\to = append(o, opts...)\n\tconn, err := transport.DialGRPC(ctx, o...)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"dialing: %v\", err)\n\t}\n\treturn &AdminClient{\n\t\tconn: conn,\n\t\ttClient: btapb.NewBigtableTableAdminClient(conn),\n\t\tproject: project,\n\t\tinstance: instance,\n\t\tmd: metadata.Pairs(resourcePrefixHeader, fmt.Sprintf(\"projects/%s/instances/%s\", project, instance)),\n\t}, nil\n}", "func NewAdminClient(rslvr resolver.Interface, opts ...Option) (AdminClient, error) {\n\tc := &adminClient{\n\t\tr: rslvr,\n\t}\n\n\tfor _, o := range opts {\n\t\to(c)\n\t}\n\n\tif err := c.connect(\"\"); err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn c, nil\n}", "func NewAdminSessionClient(c config) *AdminSessionClient {\n\treturn &AdminSessionClient{config: c}\n}", "func NewClient(cfg Config, l *logrus.Logger) (*Client, error) {\n\tctx := context.Background()\n\tkClient := gocloak.NewClient(cfg.Host)\n\tadmin, err := kClient.Login(ctx, adminClientID, cfg.AdminSecret, cfg.AdminRealm, cfg.AdminUser, cfg.AdminPassword)\n\tif err != nil {\n\t\tl.Errorf(\"NewClient\", err, \"failed to log admin user in\")\n\t\treturn nil, err\n\t}\n\tclients, err := kClient.GetClients(ctx, admin.AccessToken, cfg.ClientRealm, gocloak.GetClientsParams{ClientID: &cfg.ClientID})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif len(clients) == 0 {\n\t\treturn nil, ErrClientNotFound\n\t}\n\n\treturn &Client{\n\t\tcfg: cfg,\n\t\tctx: ctx,\n\t\tkc: kClient,\n\t\tac: &adminClient{\n\t\t\tadmin: admin,\n\t\t\taccessExpiry: time.Now().Add(time.Second * time.Duration(admin.ExpiresIn)),\n\t\t\trefreshExpiry: time.Now().Add(time.Second * time.Duration(admin.RefreshExpiresIn)),\n\t\t},\n\t\tclient: keycloakClient{\n\t\t\tid: *clients[0].ID,\n\t\t\tclientID: *clients[0].ClientID,\n\t\t},\n\t\trealm: cfg.ClientRealm,\n\t\tiss: cfg.Host + \"/auth/realms/\" + cfg.ClientRealm,\n\t\tl: l,\n\t}, nil\n}", "func GetAdminClient() (pb.AdminClient, error) {\n\tpeerClient, err := NewPeerClientFromEnv()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn peerClient.Admin()\n}", "func New(endpoint string, accessKeyID, secretAccessKey string, secure bool) (*AdminClient, error) {\n\tclnt, err := privateNew(endpoint, accessKeyID, secretAccessKey, secure)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn clnt, nil\n}", "func NewClient(config *Config) (client *Client, err error) {\n\t// bootstrap the config\n\tdefConfig := DefaultConfig()\n\n\tif len(config.ApiAddress) == 0 {\n\t\tconfig.ApiAddress = defConfig.ApiAddress\n\t}\n\n\tif len(config.Username) == 0 {\n\t\tconfig.Username = defConfig.Username\n\t}\n\n\tif len(config.Password) == 0 {\n\t\tconfig.Password = defConfig.Password\n\t}\n\n\tif len(config.Token) == 0 {\n\t\tconfig.Token = defConfig.Token\n\t}\n\n\tif len(config.UserAgent) == 0 {\n\t\tconfig.UserAgent = defConfig.UserAgent\n\t}\n\n\tif config.HttpClient == nil {\n\t\tconfig.HttpClient = defConfig.HttpClient\n\t}\n\n\tif config.HttpClient.Transport == nil {\n\t\tconfig.HttpClient.Transport = shallowDefaultTransport()\n\t}\n\n\tvar tp *http.Transport\n\n\tswitch t := config.HttpClient.Transport.(type) {\n\tcase *http.Transport:\n\t\ttp = t\n\tcase *oauth2.Transport:\n\t\tif bt, ok := t.Base.(*http.Transport); ok {\n\t\t\ttp = bt\n\t\t}\n\t}\n\n\tif tp != nil {\n\t\tif tp.TLSClientConfig == nil {\n\t\t\ttp.TLSClientConfig = &tls.Config{}\n\t\t}\n\t\ttp.TLSClientConfig.InsecureSkipVerify = config.SkipSslValidation\n\t}\n\n\tconfig.ApiAddress = strings.TrimRight(config.ApiAddress, \"/\")\n\n\tclient = &Client{\n\t\tConfig: *config,\n\t}\n\n\tif err := client.refreshEndpoint(); err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn client, nil\n}", "func (b *clientFactory) ServerAdminClient(c *cli.Context) serverAdmin.Interface {\n\tb.ensureDispatcher(c)\n\treturn serverAdmin.New(b.dispatcher.ClientConfig(cadenceFrontendService))\n}", "func NewClient(config Config) Client {\n\treturn DefaultClient{\n\t\tconfig: config,\n\t}\n}", "func NewClient(config Config) *Client {\n\treturn &Client{Config: config}\n}", "func GetClient(config Config) (*client.Client, error) {\n\topts := []client.Option{\n\t\tclient.WithNamespace(config.GetNamespace()),\n\t\tclient.WithScope(config.GetScope()),\n\t}\n\tmember := config.GetMember()\n\thost := config.GetHost()\n\tif host != \"\" {\n\t\topts = append(opts, client.WithPeerHost(config.GetHost()))\n\t\topts = append(opts, client.WithPeerPort(config.GetPort()))\n\t\tfor _, s := range serviceRegistry.services {\n\t\t\tservice := func(service cluster.Service) func(peer.ID, *grpc.Server) {\n\t\t\t\treturn func(id peer.ID, server *grpc.Server) {\n\t\t\t\t\tservice(cluster.NodeID(id), server)\n\t\t\t\t}\n\t\t\t}(s)\n\t\t\topts = append(opts, client.WithPeerService(service))\n\t\t}\n\t}\n\tif member != \"\" {\n\t\topts = append(opts, client.WithMemberID(config.GetMember()))\n\t} else if host != \"\" {\n\t\topts = append(opts, client.WithMemberID(config.GetHost()))\n\t}\n\n\treturn client.New(config.GetController(), opts...)\n}", "func NewClient(conf *Config, auth *AuthConfig) (*Client, error) {\n\tconfig := DefaultConfig\n\tif conf != nil {\n\t\tconfig = *conf\n\t}\n\n\tauthConf := DefaultAuth\n\tif auth != nil {\n\t\tauthConf = *auth\n\t}\n\n\tlogger, _ := zap.NewProduction()\n\tc := &Client{\n\t\tlog: logger.Sugar(),\n\t\tconfig: config,\n\t\tauthConfig: authConf,\n\t}\n\n\tvar err error\n\tc.TokenService = &TokenService{client: c}\n\tif c.IfNeedAuth() {\n\t\tc.authConfig.JWT, err = c.TokenService.GetNew()\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\tc.Company = &CompanyService{client: c}\n\tc.Device = &DeviceService{client: c}\n\tc.DeviceGroup = &DeviceGroupService{client: c}\n\tc.Parameter = &ParameterService{client: c}\n\tc.User = &UserService{client: c}\n\tc.Location = &LocationService{client: c}\n\tc.Role = &RoleService{client: c}\n\tc.Subscription = &SubscriptionService{client: c}\n\tc.Manufacturer = &ManufacturerService{client: c}\n\tc.DeviceModel = &DeviceModelService{client: c}\n\tc.Event = &EventService{client: c}\n\tc.EventsSession = &EventsSessionService{client: c}\n\n\treturn c, nil\n}", "func NewClient(config *Config) *Client {\n\ttr := config.Transport()\n\n\treturn &Client{\n\t\tconfig: config.Clone(),\n\t\ttr: tr,\n\t\tclient: &http.Client{Transport: tr},\n\t}\n}", "func NewClient(config *Config) (*Client, error) {\n\tdefConfig := DefaultConfig()\n\n\tif len(config.Address) == 0 {\n\t\tconfig.Address = defConfig.Address\n\t}\n\n\tif len(config.Scheme) == 0 {\n\t\tconfig.Scheme = defConfig.Scheme\n\t}\n\n\tif config.HTTPClient == nil {\n\t\tconfig.HTTPClient = defConfig.HTTPClient\n\t}\n\n\tclient := &Client{\n\t\tConfig: *config,\n\t}\n\treturn client, nil\n}", "func New(config Config) (*client, error) {\n\tvar prefix string\n\tswitch config.Version {\n\tcase \"1\":\n\t\tprefix = PrefixVaultV1\n\tcase \"2\":\n\t\tprefix = PrefixVaultV2\n\tdefault:\n\t\treturn nil, fmt.Errorf(\"unrecognized vault version of %s\", config.Version)\n\t}\n\n\t// append admin defined prefix if not empty\n\tif config.Prefix != \"\" {\n\t\tprefix = fmt.Sprintf(\"%s/%s\", prefix, config.Prefix)\n\t}\n\n\tconf := api.Config{Address: config.Address}\n\n\t// create Vault client\n\tc, err := api.NewClient(&conf)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif config.Token != \"\" {\n\t\tc.SetToken(config.Token)\n\t}\n\n\tclient := &client{\n\t\tVault: c,\n\t\tPrefix: prefix,\n\t\tAuthMethod: config.AuthMethod,\n\t\tRenewal: config.Renewal,\n\t\tAws: awsCfg{\n\t\t\tRole: config.AwsRole,\n\t\t},\n\t}\n\n\tif config.AuthMethod != \"\" {\n\t\terr = client.initialize()\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\t// start the routine to refresh the token\n\t\tgo client.refreshToken()\n\t}\n\n\treturn client, nil\n}", "func NewClient(kubeconfig, configContext string) (*Client, error) {\n\tconfig, err := defaultRestConfig(kubeconfig, configContext)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\trestClient, err := rest.RESTClientFor(config)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &Client{config, restClient}, nil\n}", "func NewClient(kubeconfig, configContext string) (*Client, error) {\n\tconfig, err := defaultRestConfig(kubeconfig, configContext)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\trestClient, err := rest.RESTClientFor(config)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &Client{config, restClient}, nil\n}", "func NewClient(config Config) Client {\n\ttyp := config.Type()\n\n\tswitch typ {\n\tcase Bolt:\n\t\tbe := NewBoltBackend(config.(*BoltConfig))\n\t\t// TODO: Return an error instead of panicking.\n\t\tif err := be.Open(); err != nil {\n\t\t\tpanic(fmt.Errorf(\"Opening bolt backend: %s\", err))\n\t\t}\n\t\tq := NewBoltQueue(be.db)\n\t\treturn newKVClient(be, q)\n\n\tcase Rocks:\n\t\t// MORE TEMPORARY UGLINESS TO MAKE IT WORK FOR NOW:\n\t\tif err := os.MkdirAll(config.(*RocksConfig).Dir, os.FileMode(int(0700))); err != nil {\n\t\t\tpanic(fmt.Errorf(\"Creating rocks directory %q: %s\", config.(*RocksConfig).Dir, err))\n\t\t}\n\t\tbe := NewRocksBackend(config.(*RocksConfig))\n\t\tqueueFile := filepath.Join(config.(*RocksConfig).Dir, DefaultBoltQueueFilename)\n\t\tdb, err := bolt.Open(queueFile, 0600, NewBoltConfig(\"\").BoltOptions)\n\t\tif err != nil {\n\t\t\tpanic(fmt.Errorf(\"Creating bolt queue: %s\", err))\n\t\t}\n\t\tq := NewBoltQueue(db)\n\t\treturn newKVClient(be, q)\n\n\tcase Postgres:\n\t\tbe := NewPostgresBackend(config.(*PostgresConfig))\n\t\tq := NewPostgresQueue(config.(*PostgresConfig))\n\t\treturn newKVClient(be, q)\n\n\tdefault:\n\t\tpanic(fmt.Errorf(\"no client constructor available for db configuration type: %v\", typ))\n\t}\n}", "func NewClient(config *Config) (c *Client, err error) {\n\tif config == nil {\n\t\treturn nil, errClientConfigNil\n\t}\n\n\tc = &Client{\n\t\trevocationTransport: http.DefaultTransport,\n\t}\n\n\tif c.transport, err = ghinstallation.NewAppsTransport(\n\t\thttp.DefaultTransport,\n\t\tint64(config.AppID),\n\t\t[]byte(config.PrvKey),\n\t); err != nil {\n\t\treturn nil, err\n\t}\n\n\tif c.url, err = url.ParseRequestURI(fmt.Sprintf(\n\t\t\"%s/app/installations/%v/access_tokens\",\n\t\tstrings.TrimSuffix(fmt.Sprint(config.BaseURL), \"/\"),\n\t\tconfig.InsID,\n\t)); err != nil {\n\t\treturn nil, err\n\t}\n\n\tif c.revocationURL, err = url.ParseRequestURI(fmt.Sprintf(\n\t\t\"%s/installation/token\",\n\t\tstrings.TrimSuffix(fmt.Sprint(config.BaseURL), \"/\"),\n\t)); err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn c, nil\n}", "func NewClient(c *Config) *Client {\n\treturn &Client{\n\t\tBaseURL: BaseURLV1,\n\t\tUname: c.Username,\n\t\tPword: c.Password,\n\t\tHTTPClient: &http.Client{\n\t\t\tTimeout: time.Minute,\n\t\t},\n\t}\n}", "func TestCreateAdminClientCustom(t *testing.T) {\n\n\t// Test Data\n\tcommontesting.SetTestEnvironment(t)\n\tctx := context.WithValue(context.TODO(), env.Key{}, &env.Environment{SystemNamespace: system.Namespace()})\n\tclientId := \"TestClientId\"\n\tadminClientType := Custom\n\tmockAdminClient = &MockAdminClient{}\n\n\t// Replace the NewPluginAdminClientWrapper To Provide Mock AdminClient & Defer Reset\n\tNewCustomAdminClientWrapperRef := NewCustomAdminClientWrapper\n\tNewCustomAdminClientWrapper = func(ctxArg context.Context, namespaceArg string) (AdminClientInterface, error) {\n\t\tassert.Equal(t, ctx, ctxArg)\n\t\tassert.Equal(t, system.Namespace(), namespaceArg)\n\t\tassert.Equal(t, adminClientType, adminClientType)\n\t\treturn mockAdminClient, nil\n\t}\n\tdefer func() { NewCustomAdminClientWrapper = NewCustomAdminClientWrapperRef }()\n\n\tsaramaConfig, err := client.NewConfigBuilder().\n\t\tWithDefaults().\n\t\tFromYaml(commontesting.SaramaDefaultConfigYaml).\n\t\tBuild()\n\tassert.Nil(t, err)\n\n\t// Perform The Test\n\tadminClient, err := CreateAdminClient(ctx, saramaConfig, clientId, adminClientType)\n\n\t// Verify The Results\n\tassert.Nil(t, err)\n\tassert.NotNil(t, adminClient)\n\tassert.Equal(t, mockAdminClient, adminClient)\n}", "func NewPinnedAdminClient(url string, opts ...Option) (AdminClient, error) {\n\tc := &adminClient{}\n\n\tfor _, o := range opts {\n\t\to(c)\n\t}\n\n\tif err := c.connect(url); err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn c, nil\n}", "func NewClient(config ClientConfig) (*Client, error) {\n\tvar baseURLToUse *url.URL\n\tvar err error\n\tif config.BaseURL == \"\" {\n\t\tbaseURLToUse, err = url.Parse(defaultBaseURL)\n\t} else {\n\t\tbaseURLToUse, err = url.Parse(config.BaseURL)\n\t}\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tc := &Client{\n\t\temail: config.Username,\n\t\tpassword: config.Password,\n\t\tbaseURL: baseURLToUse.String(),\n\t}\n\tc.client = http.DefaultClient\n\tc.InvitationService = &InvitationService{client: c}\n\tc.ActiveUserService = &ActiveUserService{client: c}\n\tc.UserService = &UserService{\n\t\tActiveUserService: c.ActiveUserService,\n\t\tInvitationService: c.InvitationService,\n\t}\n\treturn c, nil\n}", "func NewClient(config *Config) *Client {\n\treturn &Client{\n\t\tconfig: config,\n\t}\n}", "func NewClient(config *Config) (c *Client, err error) {\n\tc = &Client{Config: config, volume: 15}\n\n\t// Check if Matrix and Telegram aren't enabled at the same time.\n\tif config.Telegram != nil && config.Matrix != nil {\n\t\treturn nil, fmt.Errorf(\"both Telegram and Matrix may not be configured at the same time\")\n\t}\n\n\t// Telegram\n\tif config.Telegram != nil {\n\t\tc.Telegram, err = telegram.NewClient(config.Telegram.Token, config.Telegram.Target)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"connecting to Telegram: %w\", err)\n\t\t}\n\t\tgo c.Telegram.Start()\n\t}\n\n\t// Matrix\n\tif config.Matrix != nil {\n\t\tc.Matrix, err = matrix.NewClient(config.Matrix.Server, config.Matrix.User, config.Matrix.Token, config.Matrix.Room)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"connecting to Matrix: %w\", err)\n\t\t}\n\t}\n\n\t// Mumble\n\tc.Mumble, err = mumble.NewClient(config.Mumble.Server, config.Mumble.User)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"connecting to Mumble: %w\", err)\n\t}\n\n\treturn\n}", "func New(db *gorm.DB, prefix, cookiesecret string) *Admin {\n\tadminpath := filepath.Join(prefix, \"/admin\")\n\ta := Admin{\n\t\tdb: db,\n\t\tprefix: prefix,\n\t\tadminpath: adminpath,\n\t\tauth: auth{\n\t\t\tdb: db,\n\t\t\tpaths: pathConfig{\n\t\t\t\tadmin: adminpath,\n\t\t\t\tlogin: filepath.Join(prefix, \"/login\"),\n\t\t\t\tlogout: filepath.Join(prefix, \"/logout\"),\n\t\t\t},\n\t\t\tsession: sessionConfig{\n\t\t\t\tkey: \"userid\",\n\t\t\t\tname: \"admsession\",\n\t\t\t\tstore: cookie.NewStore([]byte(cookiesecret)),\n\t\t\t},\n\t\t},\n\t}\n\ta.adm = admin.New(&admin.AdminConfig{\n\t\tSiteName: \"My Admin Interface\",\n\t\tDB: db,\n\t\tAuth: a.auth,\n\t\tAssetFS: bindatafs.AssetFS.NameSpace(\"admin\"),\n\t})\n\taddUser(a.adm)\n\tresources.AddProduct(a.adm)\n\treturn &a\n}", "func newM3adminClient() m3admin.Client {\n\tretry := retryhttp.NewClient()\n\tretry.RetryMax = 0\n\n\treturn m3admin.NewClient(m3admin.WithHTTPClient(retry))\n}", "func New(c *Config) Client {\n\treturn newClient(c)\n}", "func NewForConfig(config clientcmd.ClientConfig) (client *Client, err error) {\n\tif config == nil {\n\t\t// initialize client-go clients\n\t\tloadingRules := clientcmd.NewDefaultClientConfigLoadingRules()\n\t\tconfigOverrides := &clientcmd.ConfigOverrides{}\n\t\tconfig = clientcmd.NewNonInteractiveDeferredLoadingClientConfig(loadingRules, configOverrides)\n\t}\n\n\tclient = new(Client)\n\tclient.KubeConfig = config\n\n\tclient.KubeClientConfig, err = client.KubeConfig.ClientConfig()\n\tif err != nil {\n\t\treturn nil, errors.Wrapf(err, errorMsg)\n\t}\n\n\tclient.KubeClient, err = kubernetes.NewForConfig(client.KubeClientConfig)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tclient.Namespace, _, err = client.KubeConfig.Namespace()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tclient.OperatorClient, err = operatorsclientset.NewForConfig(client.KubeClientConfig)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tclient.DynamicClient, err = dynamic.NewForConfig(client.KubeClientConfig)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tclient.appsClient, err = appsclientset.NewForConfig(client.KubeClientConfig)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tclient.serviceCatalogClient, err = servicecatalogclienset.NewForConfig(client.KubeClientConfig)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tclient.discoveryClient, err = discovery.NewDiscoveryClientForConfig(client.KubeClientConfig)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tclient.checkIngressSupports = true\n\n\tclient.userClient, err = userclientset.NewForConfig(client.KubeClientConfig)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tclient.projectClient, err = projectclientset.NewForConfig(client.KubeClientConfig)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tclient.routeClient, err = routeclientset.NewForConfig(client.KubeClientConfig)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn client, nil\n}", "func NewClient(config *Config) *Client {\n\tc := &Client{config: defaultConfig.Merge(config)}\n\n\treturn c\n}", "func NewClient(config *Config) *Client {\n\treturn &Client{\n\t\tchanged: make(chan struct{}),\n\t\tclosing: make(chan struct{}),\n\t\tcacheData: &Data{},\n\t\tlogger: log.New(os.Stderr, \"[metaclient] \", log.LstdFlags),\n\t\tpath: config.Dir,\n\t\tretentionAutoCreate: config.RetentionAutoCreate,\n\t\tconfig: config,\n\t}\n}", "func newConfigManagedClient(mgr manager.Manager) (runtimeclient.Client, manager.Runnable, error) {\n\tcacheOpts := cache.Options{\n\t\tScheme: mgr.GetScheme(),\n\t\tMapper: mgr.GetRESTMapper(),\n\t\tNamespace: alibabacloudClient.KubeCloudConfigNamespace,\n\t}\n\n\tc, err := cache.New(mgr.GetConfig(), cacheOpts)\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\n\tclientOpts := runtimeclient.Options{\n\t\tScheme: mgr.GetScheme(),\n\t\tMapper: mgr.GetRESTMapper(),\n\t}\n\n\tcachedClient, err := cluster.DefaultNewClient(c, config.GetConfigOrDie(), clientOpts)\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\n\treturn cachedClient, c, nil\n}", "func NewClient(config ClientConfig) (Client, error) {\n\t// raise error on client creation if the url is invalid\n\tneturl, err := url.Parse(config.URL)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\thttpClient := http.DefaultClient\n\n\tif config.TLSInsecureSkipVerify {\n\t\thttpClient.Transport = &http.Transport{TLSClientConfig: &tls.Config{InsecureSkipVerify: true}}\n\t}\n\n\tc := &client{\n\t\tclient: httpClient,\n\t\trawurl: neturl.String(),\n\t\tusername: config.Username,\n\t\tpassword: config.Password,\n\t}\n\n\t// create a single service object and reuse it for each API service\n\tc.service.client = c\n\tc.knowledge = (*knowledgeService)(&c.service)\n\n\treturn c, nil\n}", "func NewClient(config *Config) (*Client, error) {\n\t// bootstrap the config\n\tdefConfig := DefaultConfig()\n\n\tif config.Address == \"\" {\n\t\tconfig.Address = defConfig.Address\n\t} else if _, err := url.Parse(config.Address); err != nil {\n\t\treturn nil, fmt.Errorf(\"invalid address '%s': %v\", config.Address, err)\n\t}\n\n\thttpClient := config.HttpClient\n\tif httpClient == nil {\n\t\thttpClient = defaultHttpClient()\n\t\tif err := ConfigureTLS(httpClient, config.TLSConfig); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\tclient := &Client{\n\t\tconfig: *config,\n\t\thttpClient: httpClient,\n\t}\n\treturn client, nil\n}", "func ProductionNewAdminClientWrapper(ctx context.Context, brokers []string, config *sarama.Config, adminClientType types.AdminClientType) (types.AdminClientInterface, error) {\n\tswitch adminClientType {\n\tcase types.Kafka:\n\t\treturn kafka.NewAdminClient(ctx, brokers, config)\n\tcase types.EventHub:\n\t\treturn eventhub.NewAdminClient(ctx, config) // Config Must Contain EventHub Namespace ConnectionString In Net.SASL.Password Field !\n\tcase types.Custom:\n\t\treturn custom.NewAdminClient(ctx)\n\tcase types.Unknown:\n\t\treturn nil, fmt.Errorf(\"received unknown AdminClientType\") // Should Never Happen But...\n\tdefault:\n\t\treturn nil, fmt.Errorf(\"received unsupported AdminClientType of %d\", adminClientType)\n\t}\n}", "func (m *GraphBaseServiceClient) Admin()(*i7c9d1b36ac198368c1d8bed014b43e2a518b170ee45bf02c8bbe64544a50539a.AdminRequestBuilder) {\n return i7c9d1b36ac198368c1d8bed014b43e2a518b170ee45bf02c8bbe64544a50539a.NewAdminRequestBuilderInternal(m.pathParameters, m.requestAdapter);\n}", "func (m *GraphBaseServiceClient) Admin()(*i7c9d1b36ac198368c1d8bed014b43e2a518b170ee45bf02c8bbe64544a50539a.AdminRequestBuilder) {\n return i7c9d1b36ac198368c1d8bed014b43e2a518b170ee45bf02c8bbe64544a50539a.NewAdminRequestBuilderInternal(m.pathParameters, m.requestAdapter);\n}", "func NewClient(config *Config, token string) (Client, error) {\n\tif config == nil {\n\t\tconfig = &Config{Config: api.DefaultConfig()}\n\t}\n\tclient, err := api.NewClient(config.Config)\n\tif err != nil {\n\t\treturn Client{}, err\n\t}\n\n\tif config.Namespace != \"\" {\n\t\tclient.SetNamespace(config.Namespace)\n\t}\n\n\tclient.SetToken(token)\n\tlog.Entry().Debugf(\"Login to Vault %s in namespace %s successfull\", config.Address, config.Namespace)\n\treturn Client{client.Logical(), config}, nil\n}", "func NewMockConfigAdminServiceClient(ctrl *gomock.Controller) *MockConfigAdminServiceClient {\n\tmock := &MockConfigAdminServiceClient{ctrl: ctrl}\n\tmock.recorder = &MockConfigAdminServiceClientMockRecorder{mock}\n\treturn mock\n}", "func NewClient(ctx context.Context, config *ClientConfig, httpClient auth.HTTPClient) Client {\n\tif httpClient != nil {\n\t\treturn &serviceManagerClient{Context: ctx, Config: config, HTTPClient: httpClient}\n\t}\n\tccConfig := &clientcredentials.Config{\n\t\tClientID: config.ClientID,\n\t\tClientSecret: config.ClientSecret,\n\t\tTokenURL: config.TokenURL + tokenURLSuffix,\n\t\tAuthStyle: oauth2.AuthStyleInParams,\n\t}\n\n\tauthClient := auth.NewAuthClient(ccConfig, config.SSLDisabled)\n\treturn &serviceManagerClient{Context: ctx, Config: config, HTTPClient: authClient}\n}", "func (pc *PeerClient) Admin() (pb.AdminClient, error) {\n\tconn, err := pc.commonClient.NewConnection(pc.address, pc.sn)\n\tif err != nil {\n\t\treturn nil, errors.WithMessage(err,\n\t\t\tfmt.Sprintf(\"admin client failed to connect to %s\", pc.address))\n\t}\n\treturn pb.NewAdminClient(conn), nil\n}", "func NewClient(config *config.RedisConfig) (*Client, error) {\n\tif config == nil {\n\t\treturn nil, errors.New(\"db config is not exist\")\n\t}\n\tclient := redis.NewClient(&redis.Options{\n\t\tAddr: config.Host,\n\t\tPassword: config.Password,\n\t\tDB: config.Name,\n\t})\n\t_, err := client.Ping().Result()\n\tif err != nil {\n\t\tlog.Fatalf(\"redis connection failed\")\n\t}\n\treturn &Client{client, nil, nil}, nil\n}", "func NewClient(config *Config) (*Client, error) {\n\n\tconfig = DefaultConfig().Merge(config)\n\n\tif !strings.HasPrefix(config.Address, \"http\") {\n\t\tconfig.Address = \"http://\" + config.Address\n\t}\n\n\tif err := config.Validate(); err != nil {\n\t\treturn nil, err\n\t}\n\n\tclient := &Client{\n\t\tconfig: *config,\n\t\theaders: map[string]string{},\n\t\thttpClient: cleanhttp.DefaultClient(),\n\t}\n\n\treturn client, nil\n}", "func NewClient(log logr.Logger, config *rest.Config) (*Client, error) {\n\tdiscoveryClient, err := discovery.NewDiscoveryClientForConfig(config)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &Client{\n\t\tdiscovery: discoveryClient,\n\t\tlog: log,\n\t\ttimeout: defaultTimeout,\n\t}, nil\n}", "func NewClient(c Config) (Client, error) {\n\tif len(c.Endpoint) == 0 {\n\t\tc.Endpoint = EndpointProduction\n\t}\n\n\treturn &client{\n\t\tapikey: c.APIKey,\n\t\tendpoint: c.Endpoint,\n\t\torganizationid: c.OrganizationID,\n\t\thttpClient: http.DefaultClient,\n\t}, nil\n}", "func NewClient(c Config) Client {\n\treturn &client{config: c}\n}", "func NewAdminAPI(\n\tctx context.Context,\n\tcl client.Client,\n\tscheme *runtime.Scheme,\n\tcluster *vectorizedv1alpha1.Cluster,\n\tclusterDomain string,\n\tadminAPI adminutils.AdminAPIClientFactory,\n\tlog logr.Logger,\n) (adminutils.AdminAPIClient, error) {\n\theadlessSvc := resources.NewHeadlessService(cl, cluster, scheme, nil, log)\n\tclusterSvc := resources.NewClusterService(cl, cluster, scheme, nil, log)\n\tpki, err := certmanager.NewPki(\n\t\tctx,\n\t\tcl,\n\t\tcluster,\n\t\theadlessSvc.HeadlessServiceFQDN(clusterDomain),\n\t\tclusterSvc.ServiceFQDN(clusterDomain),\n\t\tscheme,\n\t\tlog,\n\t)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"creating PKI: %w\", err)\n\t}\n\tadminTLSConfigProvider := pki.AdminAPIConfigProvider()\n\tadminAPIClient, err := adminAPI(\n\t\tctx,\n\t\tcl,\n\t\tcluster,\n\t\theadlessSvc.HeadlessServiceFQDN(clusterDomain),\n\t\tadminTLSConfigProvider,\n\t)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"creating AdminAPIClient: %w\", err)\n\t}\n\treturn adminAPIClient, nil\n}", "func NewClient(config *core.Config) (c *Client, err error) {\n\t// create client\n\tc = &Client{\n\t\tconfig: config,\n\t\tdone: make(chan bool, 2),\n\t}\n\n\t// create cipher\n\tif c.cipher, err = core.NewCipher(c.config.Cipher, c.config.Passwd); err != nil {\n\t\tlogln(\"core: failed to initialize cipher:\", err)\n\t\treturn\n\t}\n\n\t// create managed net\n\tif c.net, err = nat.NewNetFromCIDR(DefaultClientSubnet); err != nil {\n\t\tlogln(\"nat: failed to create managed subnet:\", err)\n\t\treturn\n\t}\n\n\t// assign a localIP\n\tif c.localIP, err = c.net.Take(); err != nil {\n\t\tlogln(\"nat: faield to assign a localIP:\", err)\n\t\treturn\n\t}\n\n\treturn\n}", "func NewClient(config *Config) (*Client, error) {\n\tif !(config.Dimensionality > 0) {\n\t\treturn nil, fmt.Errorf(\"dimensionality must be >0\")\n\t}\n\n\treturn &Client{\n\t\tcoord: NewCoordinate(config),\n\t\torigin: NewCoordinate(config),\n\t\tconfig: config,\n\t\tadjustmentIndex: 0,\n\t\tadjustmentSamples: make([]float64, config.AdjustmentWindowSize),\n\t\tlatencyFilterSamples: make(map[string][]float64),\n\t}, nil\n}", "func NewClient(config *Config) Client {\n\tendpoint := net.JoinHostPort(config.Hostname, strconv.Itoa(config.port()))\n\tif !strings.Contains(endpoint, \"//\") {\n\t\tendpoint = \"http://\" + endpoint\n\t}\n\n\topts := &jsonrpc.RPCClientOpts{\n\t\tCustomHeaders: map[string]string{\n\t\t\t\"Authorization\": \"Basic \" + base64.StdEncoding.EncodeToString([]byte(config.Username+\":\"+config.Password)),\n\t\t},\n\t}\n\n\treturn &client{\n\t\tRPCClient: jsonrpc.NewClientWithOpts(endpoint, opts),\n\t}\n}", "func NewClient(ctx context.Context, cfg ClientConfig) (*Client, error) {\n\tconfig := &tfe.Config{\n\t\tToken: cfg.Token,\n\t}\n\ttfeClient, err := tfe.NewClient(config)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"could not create a new TFE tfeClient: %w\", err)\n\t}\n\n\tw, err := tfeClient.Workspaces.Read(ctx, cfg.Organization, cfg.Workspace)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"could not retrieve workspace '%v/%v': %w\", cfg.Organization, cfg.Workspace, err)\n\t}\n\n\tc := Client{\n\t\tclient: tfeClient,\n\t\tworkspace: w,\n\t}\n\treturn &c, nil\n}", "func NewClient(config *Config) (*Client, error) {\n\tclient := new(Client)\n\terr := client.Init(config)\n\treturn client, err\n}", "func NewClient(config *Config) (*Client, error) {\n\tclient := new(Client)\n\terr := client.Init(config)\n\treturn client, err\n}", "func NewClient(config *Config) (*Client, error) {\n\tclient := new(Client)\n\terr := client.Init(config)\n\treturn client, err\n}", "func NewClient(config *Config) (*Client, error) {\n\tclient := new(Client)\n\terr := client.Init(config)\n\treturn client, err\n}", "func NewClient(config *Config) (*Client, error) {\n\tclient := new(Client)\n\terr := client.Init(config)\n\treturn client, err\n}", "func NewClient(config *Config) (*Client, error) {\n\tclient := new(Client)\n\terr := client.Init(config)\n\treturn client, err\n}", "func NewClient(configMode string) (client AzureClient) {\n\tvar configload Config\n\tif configMode == \"metadata\" {\n\t\tconfigload = LoadConfig()\n\t} else if configMode == \"environment\" {\n\t\tconfigload = EnvLoadConfig()\n\t} else {\n\t\tlog.Print(\"Invalid config Mode\")\n\t}\n\n\tclient = AzureClient{\n\t\tconfigload,\n\t\tGetVMClient(configload),\n\t\tGetNicClient(configload),\n\t\tGetLbClient(configload),\n\t}\n\treturn\n}", "func NewClient(config *config.Config, httpClient *http.Client) *Client {\n\treturn &Client{\n\t\tGetter: NewGetter(config, httpClient),\n\t}\n}", "func newClient(conf config) (*storage.Client, error) {\n\tdb, err := storage.NewDBClient(conf.MongoURI, conf.DBName, conf.MongoMICol, conf.MongoAgCol)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"error creating DB client: %q\", err)\n\t}\n\tdb.Collection(conf.MongoMICol)\n\tbc := storage.NewCloudClient(conf.SwiftUsername, conf.SwiftAPIKey, conf.SwiftAuthURL, conf.SwiftDomain, conf.SwiftContainer)\n\tclient, err := storage.NewClient(db, bc)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"error creating storage.client: %q\", err)\n\t}\n\treturn client, nil\n}", "func NewClient(kubeconfig string) (client versioned.Interface, err error) {\n\tvar config *rest.Config\n\tconfig, err = getConfig(kubeconfig)\n\tif err != nil {\n\t\treturn\n\t}\n\treturn versioned.NewForConfig(config)\n}", "func NewClient(config Config) (*Client, error) {\n\tclient := &Client{\n\t\tuserAgent: \"GoGenderize/\" + Version,\n\t\tapiKey: config.APIKey,\n\t\thttpClient: http.DefaultClient,\n\t}\n\n\tif config.UserAgent != \"\" {\n\t\tclient.userAgent = config.UserAgent\n\t}\n\n\tif config.HTTPClient != nil {\n\t\tclient.httpClient = config.HTTPClient\n\t}\n\n\tserver := defaultServer\n\tif config.Server != \"\" {\n\t\tserver = config.Server\n\t}\n\tapiURL, err := url.Parse(server)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tclient.apiURL = apiURL\n\n\treturn client, nil\n}", "func NewClient(add, get, transfer, defaultPhoto, update, listMine, listProject, listAssociated, listProjectAssociated, downloadPhoto, listAll, delete_, adminSearch, progress, updateModule goa.Endpoint) *Client {\n\treturn &Client{\n\t\tAddEndpoint: add,\n\t\tGetEndpoint: get,\n\t\tTransferEndpoint: transfer,\n\t\tDefaultPhotoEndpoint: defaultPhoto,\n\t\tUpdateEndpoint: update,\n\t\tListMineEndpoint: listMine,\n\t\tListProjectEndpoint: listProject,\n\t\tListAssociatedEndpoint: listAssociated,\n\t\tListProjectAssociatedEndpoint: listProjectAssociated,\n\t\tDownloadPhotoEndpoint: downloadPhoto,\n\t\tListAllEndpoint: listAll,\n\t\tDeleteEndpoint: delete_,\n\t\tAdminSearchEndpoint: adminSearch,\n\t\tProgressEndpoint: progress,\n\t\tUpdateModuleEndpoint: updateModule,\n\t}\n}", "func NewClient(config *Configuration) (*Client, error) {\n\t// Check that authorization values are defined at all\n\tif config.AuthorizationHeaderToken == \"\" {\n\t\treturn nil, fmt.Errorf(\"No authorization is defined. You need AuthorizationHeaderToken\")\n\t}\n\n\tif config.ApplicationID == \"\" {\n\t\treturn nil, fmt.Errorf(\"ApplicationID is required - this is the only way to identify your requests in highwinds logs\")\n\t}\n\n\t// Configure the client from final configuration\n\tc := &Client{\n\t\tc: http.DefaultClient,\n\t\tDebug: config.Debug,\n\t\tApplicationID: config.ApplicationID,\n\t\tIdentity: &identity.Identification{\n\t\t\tAuthorizationHeaderToken: config.AuthorizationHeaderToken,\n\t\t},\n\t}\n\n\t// TODO eventually instantiate a custom client but not ready for that yet\n\n\t// Configure timeout on default client\n\tif config.Timeout == 0 {\n\t\tc.c.Timeout = time.Second * 10\n\t} else {\n\t\tc.c.Timeout = time.Second * time.Duration(config.Timeout)\n\t}\n\n\t// Set default headers\n\tc.Headers = c.GetHeaders()\n\treturn c, nil\n}", "func NewClient(config *Config) Client {\n\tendpoint := net.JoinHostPort(config.hostname(), strconv.Itoa(config.port()))\n\tif !strings.Contains(endpoint, \"//\") {\n\t\tendpoint = \"http://\" + endpoint\n\t}\n\n\topts := &jsonrpc.RPCClientOpts{\n\t\tCustomHeaders: map[string]string{\n\t\t\t\"Authorization\": \"Basic \" + base64.StdEncoding.EncodeToString([]byte(config.username()+\":\"+config.password())),\n\t\t},\n\t}\n\n\treturn &client{\n\t\tRPCClient: jsonrpc.NewClientWithOpts(endpoint, opts),\n\t}\n}", "func NewClient(c *Config) (*Client, error) {\n\tdef := DefaultConfig()\n\tif def == nil {\n\t\treturn nil, fmt.Errorf(\"could not create/read default configuration\")\n\t}\n\tif def.Error != nil {\n\t\treturn nil, errwrap.Wrapf(\"error encountered setting up default configuration: {{err}}\", def.Error)\n\t}\n\n\tif c == nil {\n\t\tc = def\n\t}\n\n\tc.modifyLock.Lock()\n\tdefer c.modifyLock.Unlock()\n\n\tif c.MinRetryWait == 0 {\n\t\tc.MinRetryWait = def.MinRetryWait\n\t}\n\n\tif c.MaxRetryWait == 0 {\n\t\tc.MaxRetryWait = def.MaxRetryWait\n\t}\n\n\tif c.HttpClient == nil {\n\t\tc.HttpClient = def.HttpClient\n\t}\n\tif c.HttpClient.Transport == nil {\n\t\tc.HttpClient.Transport = def.HttpClient.Transport\n\t}\n\n\taddress := c.Address\n\tif c.AgentAddress != \"\" {\n\t\taddress = c.AgentAddress\n\t}\n\n\tu, err := c.ParseAddress(address)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tclient := &Client{\n\t\taddr: u,\n\t\tconfig: c,\n\t\theaders: make(http.Header),\n\t}\n\n\tif c.ReadYourWrites {\n\t\tclient.replicationStateStore = &replicationStateStore{}\n\t}\n\n\t// Add the VaultRequest SSRF protection header\n\tclient.headers[RequestHeaderName] = []string{\"true\"}\n\n\tif token := os.Getenv(EnvVaultToken); token != \"\" {\n\t\tclient.token = token\n\t}\n\n\tif namespace := os.Getenv(EnvVaultNamespace); namespace != \"\" {\n\t\tclient.setNamespace(namespace)\n\t}\n\n\treturn client, nil\n}", "func (j *joinData) Client() (clientset.Interface, error) {\n\tif j.client != nil {\n\t\treturn j.client, nil\n\t}\n\tpath := filepath.Join(j.KubeConfigDir(), kubeadmconstants.AdminKubeConfigFileName)\n\n\tclient, err := kubeconfigutil.ClientSetFromFile(path)\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"[preflight] couldn't create Kubernetes client\")\n\t}\n\tj.client = client\n\treturn client, nil\n}", "func NewClient(config *latest.Config, kubeClient kubectl.Client, dockerClient docker.Client, log log.Logger) Client {\n\treturn &client{\n\t\tconfig: config,\n\t\tkubeClient: kubeClient,\n\t\tdockerClient: dockerClient,\n\t\tlog: log,\n\t}\n}", "func NewForConfig(c *rest.Config) (*ZdyfapiV1alpha1Client, error) {\n\tconfig := *c\n\tif err := setConfigDefaults(&config); err != nil {\n\t\treturn nil, err\n\t}\n\tclient, err := rest.RESTClientFor(&config)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &ZdyfapiV1alpha1Client{client}, nil\n}", "func (c *Config) NewClient(database string) *Client {\n\treturn &Client{\n\t\tconfig: *c,\n\t\tdatabaseName: database,\n\t}\n}", "func New(config model.Config) (model.Client, error) {\n\tconfig, err := validateConfig(config)\n\tif err != nil {\n\t\tWriteLogFile(err)\n\t\treturn nil, err\n\t}\n\tc := client{config}\n\tconn, err := connect(c.Host) // test connection\n\tif err != nil {\n\t\tWriteLogFile(err)\n\t\treturn nil, err\n\t}\n\tif err = conn.Bind(c.ROUser.Name, c.ROUser.Password); err != nil {\n\t\tWriteLogFile(err)\n\t\treturn nil, err\n\t}\n\tconn.Close()\n\treturn c, err\n}", "func NewClient(config Config, opts ...Option) (*Client, error) {\n\tconfig.applyDefaults()\n\tif !path.IsAbs(config.RootDirectory) {\n\t\treturn nil, errors.New(\"invalid config: root_directory must be absolute path\")\n\t}\n\tpather, err := namepath.New(config.RootDirectory, config.NamePath)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"namepath: %s\", err)\n\t}\n\twebhdfs, err := webhdfs.NewClient(config.WebHDFS, config.NameNodes, config.UserName)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tclient := &Client{config, pather, webhdfs}\n\tfor _, opt := range opts {\n\t\topt(client)\n\t}\n\treturn client, nil\n}", "func NewClient() (*Client, error) {\n\tconfig, err := rest.InClusterConfig()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\ttypes := runtime.NewScheme()\n\tschemeBuilder := runtime.NewSchemeBuilder(\n\t\tfunc(scheme *runtime.Scheme) error {\n\t\t\treturn nil\n\t\t})\n\n\terr = schemeBuilder.AddToScheme(types)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tclient, err := newClientForAPI(config, v1alpha1.GroupVersion, types)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &Client{\n\t\tclient: client,\n\t}, err\n}", "func NewClientFromConfig() *Client {\n\treturn &Client{\n\t\tregistry: config.GlobalConfig.Registry,\n\t\torganization: config.GlobalConfig.Organization,\n\t\tusername: config.GlobalConfig.Username,\n\t\tpassword: config.GlobalConfig.Password,\n\t\tcopyTimeoutSeconds: config.GlobalConfig.ImageCopyTimeoutSeconds,\n\t\ttransport: defaultSkopeoTransport,\n\t}\n}", "func NewClient(logger log.Logger, endpoint string, debug bool) Client {\n\tconf := watchman.NewConfiguration()\n\tconf.BasePath = \"http://localhost\" + bind.HTTP(\"watchman\")\n\tconf.Debug = debug\n\n\tif k8s.Inside() {\n\t\tconf.BasePath = \"http://watchman.apps.svc.cluster.local:8080\"\n\t}\n\tif endpoint != \"\" {\n\t\tconf.BasePath = endpoint // override from provided Watchman_ENDPOINT env variable\n\t}\n\n\tlogger = logger.WithKeyValue(\"package\", \"watchman\")\n\tlogger.Log(fmt.Sprintf(\"using %s for Watchman address\", conf.BasePath))\n\n\treturn &moovWatchmanClient{\n\t\tunderlying: watchman.NewAPIClient(conf),\n\t\tlogger: logger,\n\t}\n}", "func NewClient(config *latest.Config, kubeClient kubectl.Client, tillerNamespace string, log log.Logger) (types.Client, error) {\n\tif tillerNamespace == \"\" {\n\t\ttillerNamespace = kubeClient.Namespace()\n\t}\n\n\treturn &client{\n\t\tconfig: config,\n\n\t\tkubeClient: kubeClient,\n\t\ttillerNamespace: tillerNamespace,\n\n\t\texec: command.Command,\n\t\textract: extract.NewExtractor(),\n\t\thttpGet: http.Get,\n\n\t\tlog: log,\n\t}, nil\n}", "func New(kubeconfig string, clusterContextOptions ...string) (*Client, error) {\n\tvar clusterCtxName string\n\tif len(clusterContextOptions) > 0 {\n\t\tclusterCtxName = clusterContextOptions[0]\n\t}\n\n\t// creating cfg for each client type because each\n\t// setup needs its own cfg default which may not be compatible\n\tdynCfg, err := makeRESTConfig(kubeconfig, clusterCtxName)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tclient, err := dynamic.NewForConfig(dynCfg)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tdiscoCfg, err := makeRESTConfig(kubeconfig, clusterCtxName)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdisco, err := discovery.NewDiscoveryClientForConfig(discoCfg)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tresources, err := restmapper.GetAPIGroupResources(disco)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tmapper := restmapper.NewDiscoveryRESTMapper(resources)\n\n\trestCfg, err := makeRESTConfig(kubeconfig, clusterCtxName)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tsetCoreDefaultConfig(restCfg)\n\trestc, err := rest.RESTClientFor(restCfg)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn &Client{Client: client, Disco: disco, CoreRest: restc, Mapper: mapper}, nil\n}", "func NewClient(kubeConfig string) (client *Client, err error) {\n\tconfig, err := GetClientConfig(kubeConfig)\n\tif err != nil {\n\t\treturn nil, trace.Wrap(err)\n\t}\n\n\tclientset, err := kubernetes.NewForConfig(config)\n\tif err != nil {\n\t\treturn nil, trace.Wrap(err)\n\t}\n\n\textClientset, err := apiextensionsclientset.NewForConfig(config)\n\tif err != nil {\n\t\treturn nil, trace.Wrap(err)\n\t}\n\n\treturn &Client{\n\t\tClient: clientset,\n\t\tExtClient: extClientset,\n\t}, nil\n}", "func NewAdmin(addrs []string, options *AdminOptions, log logr.Logger) IAdmin {\n\ta := &Admin{\n\t\thashMaxSlots: DefaultHashMaxSlots,\n\t\tlog: log.WithName(\"redis_util\"),\n\t}\n\n\t// perform initial connections\n\ta.cnx = NewAdminConnections(addrs, options, log)\n\n\treturn a\n}", "func NewClient(cfg *restclient.Config) (Client, error) {\n\tresult := &client{}\n\tc, err := dynamic.NewForConfig(cfg)\n\tif err != nil {\n\t\tmsg := fmt.Sprintf(\"Failed to create client, with error: %v\", err)\n\t\tlog.Printf(\"[Error] %s\", msg)\n\t\treturn nil, fmt.Errorf(msg)\n\t}\n\tresult.dynamicClient = c\n\treturn result, nil\n}", "func NewClient(pluginsDir, configsDir string) (*client, error) {\n\treturn &client{\n\t\tpluginsDir: pluginsDir,\n\t\tconfigsDir: configsDir,\n\t}, nil\n}", "func NewClient(config *ClientConfig) *Client {\n\tvar httpClient *http.Client\n\tvar logger LeveledLoggerInterface\n\n\tif config.HTTPClient == nil {\n\t\thttpClient = &http.Client{}\n\t} else {\n\t\thttpClient = config.HTTPClient\n\t}\n\n\tif config.Logger == nil {\n\t\tlogger = &LeveledLogger{Level: LevelError}\n\t} else {\n\t\tlogger = config.Logger\n\t}\n\n\treturn &Client{\n\t\tAPIToken: config.APIToken,\n\t\tLogger: logger,\n\n\t\tbaseURL: WaniKaniAPIURL,\n\t\thttpClient: httpClient,\n\t}\n}", "func NewForConfig(c *rest.Config) (*KudzuV1alpha1Client, error) {\n\tconfig := *c\n\tif err := setConfigDefaults(&config); err != nil {\n\t\treturn nil, err\n\t}\n\tclient, err := rest.RESTClientFor(&config)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &KudzuV1alpha1Client{client}, nil\n}", "func New(cfg client.Config) (client.Client, error) {\n\treturn client.New(cfg)\n}", "func NewClient(config Config) (*Client, error) {\n\n\tswitch {\n\tcase config.URL == \"\":\n\t\treturn &Client{}, ErrNoAPIURL\n\tcase config.OAPIKey == \"\":\n\t\treturn &Client{}, ErrNoOAPIKey\n\tcase config.OAPISecret == \"\":\n\t\treturn &Client{}, ErrNoOAPISecret\n\tcase config.AuthKey == \"\":\n\t\treturn &Client{}, ErrNoAuthKey\n\tcase config.AuthSecret == \"\":\n\t\treturn &Client{}, ErrNoAuthSecret\n\tcase config.ComplianceDate == \"\":\n\t\treturn &Client{}, ErrNoComplianceDate\n\tcase !regexp.MustCompile(`^\\d{8}$`).MatchString(config.ComplianceDate):\n\t\treturn &Client{}, ErrNoComplianceDate\n\t}\n\n\t_, err := url.ParseRequestURI(config.URL)\n\tif err != nil {\n\t\treturn &Client{}, ErrInvalidURL\n\t}\n\n\tparts := strings.Split(config.URL, \"//\")\n\tif len(parts) < 2 {\n\t\treturn &Client{}, ErrInvalidURL\n\t}\n\n\tconfig.OAPIURL = fmt.Sprintf(\"%s//%s:%s@%s\",\n\t\tparts[0], config.OAPIKey, config.OAPISecret, parts[1],\n\t)\n\n\treturn &Client{\n\t\tclient: &API{\n\t\t\tConfig: config,\n\t\t},\n\t}, nil\n}", "func (c *SiteReplicationSys) getAdminClient(ctx context.Context, deploymentID string) (*madmin.AdminClient, error) {\n\tcreds, err := c.getPeerCreds()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tpeer, ok := c.state.Peers[deploymentID]\n\tif !ok {\n\t\treturn nil, errSRPeerNotFound\n\t}\n\n\treturn getAdminClient(peer.Endpoint, creds.AccessKey, creds.SecretKey)\n}", "func NewClient(api *zabbix.API, writepath, readpath string, editables *EditableConfiguration) *Client {\n\treturn &Client{api, writepath, readpath, editables}\n}", "func NewAdminClientFromProducer(p *Producer) (a *AdminClient, err error) {\n\tif p.handle.rk == nil {\n\t\treturn nil, newErrorFromString(ErrInvalidArg, \"Can't derive AdminClient from closed producer\")\n\t}\n\n\ta = &AdminClient{}\n\ta.handle = &p.handle\n\ta.isDerived = true\n\ta.isClosed = 0\n\treturn a, nil\n}", "func NewClient(d *schema.ResourceData, terraformVersion string, options client.Options) (client.Client, error) {\n\t// Config initialization\n\tcfg, err := GetConfig(d, terraformVersion)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn client.New(cfg, options)\n}", "func NewForConfigAndClient(c *rest.Config, h *http.Client) (*ConfigV1Client, error) {\n\tconfig := *c\n\tif err := setConfigDefaults(&config); err != nil {\n\t\treturn nil, err\n\t}\n\tclient, err := rest.RESTClientForConfigAndClient(&config, h)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &ConfigV1Client{client}, nil\n}", "func New(ctx context.Context, config Config) (*Client, error) {\n\terr := config.checkAndSetDefaults()\n\tif err != nil {\n\t\treturn nil, trace.Wrap(err)\n\t}\n\tc := &Client{Config: config}\n\tclient, err := c.connect(ctx)\n\tif err != nil {\n\t\treturn nil, trace.Wrap(err)\n\t}\n\tc.client = client\n\tc.addTerminationHandler()\n\treturn c, nil\n}", "func NewForConfig(c *rest.Config) (*ServicebrokerV1alpha1Client, error) {\n\tconfig := *c\n\tif err := setConfigDefaults(&config); err != nil {\n\t\treturn nil, err\n\t}\n\tclient, err := rest.RESTClientFor(&config)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &ServicebrokerV1alpha1Client{client}, nil\n}", "func New(c rest.Interface) *ConfigV1Client {\n\treturn &ConfigV1Client{c}\n}", "func NewClient(ctx context.Context, config *ClientConfig) (*Client, error) {\n\tc := &Client{\n\t\tconfig: config,\n\t}\n\tif err := c.Reconnect(ctx); err != nil {\n\t\treturn nil, err\n\t}\n\treturn c, nil\n}", "func New(config ClientConfig) (Client, error) {\n\tvar err error\n\n\tclient := Client{collections: make(map[string]*mongo.Collection)}\n\tclientOptions := options.Client().ApplyURI(config.url())\n\n\t// Connect to MongoDB\n\tif client.client, err = mongo.Connect(context.TODO(), clientOptions); err != nil {\n\t\treturn client, err\n\t}\n\n\t// Check the connection\n\tif err = client.client.Ping(context.TODO(), nil); err != nil {\n\t\treturn client, err\n\t}\n\n\tclient.database = client.client.Database(config.Database)\n\n\treturn client, nil\n}", "func NewClient(config Config) ClientInterface {\n\tcontext := ctx.Background()\n\tif config.GitHubToken == \"\" {\n\t\treturn Client{\n\t\t\tClient: github.NewClient(nil),\n\t\t\tContext: context,\n\t\t\tConfig: config,\n\t\t}\n\t}\n\toauth2Client := oauth2.NewClient(context, oauth2.StaticTokenSource(\n\t\t&oauth2.Token{AccessToken: config.GitHubToken},\n\t))\n\treturn Client{\n\t\tClient: github.NewClient(oauth2Client),\n\t\tContext: context,\n\t\tConfig: config,\n\t}\n}", "func NewInstanceAdminClient(ctx context.Context, project string, opts ...option.ClientOption) (*InstanceAdminClient, error) {\n\to, err := btopt.DefaultClientOptions(instanceAdminAddr, InstanceAdminScope, clientUserAgent)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\to = append(o, opts...)\n\tconn, err := transport.DialGRPC(ctx, o...)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"dialing: %v\", err)\n\t}\n\treturn &InstanceAdminClient{\n\t\tconn: conn,\n\t\tiClient: btapb.NewBigtableInstanceAdminClient(conn),\n\n\t\tproject: project,\n\t\tmd: metadata.Pairs(resourcePrefixHeader, \"projects/\"+project),\n\t}, nil\n}", "func NewClientWithConfig(config *vaultapi.Config, vaultCfg *Config, gcpCfg *GCPBackendConfig) (*Client, error) {\n\tvar clientToken string\n\tvar err error\n\trawClient, err := vaultapi.NewClient(config)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tlogical := rawClient.Logical()\n\tclient := &Client{Client: rawClient, Logical: logical}\n\n\tswitch vaultCfg.Backend {\n\tcase \"gcp\":\n\t\tclientToken, err = GCPBackendLogin(client, gcpCfg, vaultCfg)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\tdefault:\n\t\tjwt, err := GetServiceAccountToken(vaultCfg.TokenPath)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tclientToken, err = KubernetesBackendLogin(client, vaultCfg.Role, jwt)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\tif err == nil {\n\t\trawClient.SetToken(string(clientToken))\n\t} else {\n\t\treturn nil, err\n\t}\n\treturn client, nil\n}" ]
[ "0.75122625", "0.73733056", "0.73534054", "0.702173", "0.6796817", "0.66140497", "0.65188307", "0.6421051", "0.6340027", "0.6317679", "0.6248883", "0.6227624", "0.6216524", "0.62138546", "0.6209691", "0.6204539", "0.6197792", "0.617365", "0.617365", "0.6169799", "0.6169632", "0.616783", "0.61494595", "0.61394", "0.61342245", "0.61248326", "0.61111987", "0.6107585", "0.6100973", "0.60953695", "0.6093453", "0.60924655", "0.605988", "0.605469", "0.60477173", "0.6044395", "0.6040918", "0.6035067", "0.6035067", "0.6031594", "0.6016461", "0.6011443", "0.6008514", "0.5999098", "0.5996972", "0.5965609", "0.59456545", "0.5944175", "0.59354913", "0.5928759", "0.5928158", "0.59138054", "0.58958554", "0.5892533", "0.5892533", "0.5892533", "0.5892533", "0.5892533", "0.5892533", "0.5891243", "0.5889316", "0.5888303", "0.58878785", "0.58777505", "0.5874467", "0.586474", "0.58636403", "0.58551043", "0.5849002", "0.58423495", "0.5837609", "0.5834795", "0.5833353", "0.58294535", "0.5826239", "0.5819065", "0.5811857", "0.58096194", "0.5806823", "0.58067197", "0.58036405", "0.5796961", "0.57957363", "0.5792193", "0.57863694", "0.57789433", "0.57780993", "0.57711333", "0.5763948", "0.57604146", "0.5752615", "0.57481474", "0.5746037", "0.5746016", "0.57439137", "0.5733", "0.5729933", "0.5725118", "0.5718893", "0.57153994" ]
0.8036019
0
Use adds a list of mutation hooks to the hooks stack. A call to `Use(f, g, h)` equals to `admin.Hooks(f(g(h())))`.
func (c *AdminClient) Use(hooks ...Hook) { c.hooks.Admin = append(c.hooks.Admin, hooks...) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (em *entityManager) Use(mw ...MiddlewareFunc) {\n\tem.mwStack = append(em.mwStack, mw...)\n}", "func (c *StatustClient) Use(hooks ...Hook) {\n\tc.hooks.Statust = append(c.hooks.Statust, hooks...)\n}", "func (c *FoodmenuClient) Use(hooks ...Hook) {\n\tc.hooks.Foodmenu = append(c.hooks.Foodmenu, hooks...)\n}", "func (c *EatinghistoryClient) Use(hooks ...Hook) {\n\tc.hooks.Eatinghistory = append(c.hooks.Eatinghistory, hooks...)\n}", "func (c *LevelOfDangerousClient) Use(hooks ...Hook) {\n\tc.hooks.LevelOfDangerous = append(c.hooks.LevelOfDangerous, hooks...)\n}", "func (f *Flame) Use(handlers ...Handler) {\n\tvalidateAndWrapHandlers(handlers, nil)\n\tf.handlers = append(f.handlers, handlers...)\n}", "func (ms *MiddlewareStack) Use(mw ...MiddlewareFunc) {\n\tms.stack = append(ms.stack, mw...)\n}", "func (ms *MiddlewareStack) Use(mw ...MiddlewareFunc) {\n\tms.stack = append(ms.stack, mw...)\n}", "func (c *MealplanClient) Use(hooks ...Hook) {\n\tc.hooks.Mealplan = append(c.hooks.Mealplan, hooks...)\n}", "func (c *TagClient) Use(hooks ...Hook) {\n\tc.hooks.Tag = append(c.hooks.Tag, hooks...)\n}", "func (c *ToolClient) Use(hooks ...Hook) {\n\tc.hooks.Tool = append(c.hooks.Tool, hooks...)\n}", "func (c *WalletNodeClient) Use(hooks ...Hook) {\n\tc.hooks.WalletNode = append(c.hooks.WalletNode, hooks...)\n}", "func (c *WorkExperienceClient) Use(hooks ...Hook) {\n\tc.hooks.WorkExperience = append(c.hooks.WorkExperience, hooks...)\n}", "func (c *BranchClient) Use(hooks ...Hook) {\n\tc.hooks.Branch = append(c.hooks.Branch, hooks...)\n}", "func (c *PharmacistClient) Use(hooks ...Hook) {\n\tc.hooks.Pharmacist = append(c.hooks.Pharmacist, hooks...)\n}", "func (c *VeterinarianClient) Use(hooks ...Hook) {\n\tc.hooks.Veterinarian = append(c.hooks.Veterinarian, hooks...)\n}", "func (c *ClubClient) Use(hooks ...Hook) {\n\tc.hooks.Club = append(c.hooks.Club, hooks...)\n}", "func (c *SituationClient) Use(hooks ...Hook) {\n\tc.hooks.Situation = append(c.hooks.Situation, hooks...)\n}", "func (c *OperativeClient) Use(hooks ...Hook) {\n\tc.hooks.Operative = append(c.hooks.Operative, hooks...)\n}", "func (c *DentistClient) Use(hooks ...Hook) {\n\tc.hooks.Dentist = append(c.hooks.Dentist, hooks...)\n}", "func (c *CleanernameClient) Use(hooks ...Hook) {\n\tc.hooks.Cleanername = append(c.hooks.Cleanername, hooks...)\n}", "func (c *ClubBranchClient) Use(hooks ...Hook) {\n\tc.hooks.ClubBranch = append(c.hooks.ClubBranch, hooks...)\n}", "func (c *BeerClient) Use(hooks ...Hook) {\n\tc.hooks.Beer = append(c.hooks.Beer, hooks...)\n}", "func (c *EventClient) Use(hooks ...Hook) {\n\tc.hooks.Event = append(c.hooks.Event, hooks...)\n}", "func (c *PetruleClient) Use(hooks ...Hook) {\n\tc.hooks.Petrule = append(c.hooks.Petrule, hooks...)\n}", "func (c *OperationClient) Use(hooks ...Hook) {\n\tc.hooks.Operation = append(c.hooks.Operation, hooks...)\n}", "func (c *UserWalletClient) Use(hooks ...Hook) {\n\tc.hooks.UserWallet = append(c.hooks.UserWallet, hooks...)\n}", "func (c *PhysicianClient) Use(hooks ...Hook) {\n\tc.hooks.Physician = append(c.hooks.Physician, hooks...)\n}", "func (c *PhysicianClient) Use(hooks ...Hook) {\n\tc.hooks.Physician = append(c.hooks.Physician, hooks...)\n}", "func (c *ComplaintClient) Use(hooks ...Hook) {\n\tc.hooks.Complaint = append(c.hooks.Complaint, hooks...)\n}", "func (c *PlanetClient) Use(hooks ...Hook) {\n\tc.hooks.Planet = append(c.hooks.Planet, hooks...)\n}", "func (c *FacultyClient) Use(hooks ...Hook) {\n\tc.hooks.Faculty = append(c.hooks.Faculty, hooks...)\n}", "func (c *UserClient) Use(hooks ...Hook) {\n\tc.hooks.User = append(c.hooks.User, hooks...)\n}", "func (c *UserClient) Use(hooks ...Hook) {\n\tc.hooks.User = append(c.hooks.User, hooks...)\n}", "func (c *UserClient) Use(hooks ...Hook) {\n\tc.hooks.User = append(c.hooks.User, hooks...)\n}", "func (c *UserClient) Use(hooks ...Hook) {\n\tc.hooks.User = append(c.hooks.User, hooks...)\n}", "func (c *UserClient) Use(hooks ...Hook) {\n\tc.hooks.User = append(c.hooks.User, hooks...)\n}", "func (c *UserClient) Use(hooks ...Hook) {\n\tc.hooks.User = append(c.hooks.User, hooks...)\n}", "func (c *UserClient) Use(hooks ...Hook) {\n\tc.hooks.User = append(c.hooks.User, hooks...)\n}", "func (c *UserClient) Use(hooks ...Hook) {\n\tc.hooks.User = append(c.hooks.User, hooks...)\n}", "func (c *UserClient) Use(hooks ...Hook) {\n\tc.hooks.User = append(c.hooks.User, hooks...)\n}", "func (c *UserClient) Use(hooks ...Hook) {\n\tc.hooks.User = append(c.hooks.User, hooks...)\n}", "func (c *UserClient) Use(hooks ...Hook) {\n\tc.hooks.User = append(c.hooks.User, hooks...)\n}", "func (c *SymptomClient) Use(hooks ...Hook) {\n\tc.hooks.Symptom = append(c.hooks.Symptom, hooks...)\n}", "func (c *PurposeClient) Use(hooks ...Hook) {\n\tc.hooks.Purpose = append(c.hooks.Purpose, hooks...)\n}", "func (c *PositionClient) Use(hooks ...Hook) {\n\tc.hooks.Position = append(c.hooks.Position, hooks...)\n}", "func (c *PositionClient) Use(hooks ...Hook) {\n\tc.hooks.Position = append(c.hooks.Position, hooks...)\n}", "func (c *PositionClient) Use(hooks ...Hook) {\n\tc.hooks.Position = append(c.hooks.Position, hooks...)\n}", "func (c *EmployeeClient) Use(hooks ...Hook) {\n\tc.hooks.Employee = append(c.hooks.Employee, hooks...)\n}", "func (c *EmployeeClient) Use(hooks ...Hook) {\n\tc.hooks.Employee = append(c.hooks.Employee, hooks...)\n}", "func (c *EmployeeClient) Use(hooks ...Hook) {\n\tc.hooks.Employee = append(c.hooks.Employee, hooks...)\n}", "func (c *TransactionClient) Use(hooks ...Hook) {\n\tc.hooks.Transaction = append(c.hooks.Transaction, hooks...)\n}", "func (c *ReviewClient) Use(hooks ...Hook) {\n\tc.hooks.Review = append(c.hooks.Review, hooks...)\n}", "func (c *ClubTypeClient) Use(hooks ...Hook) {\n\tc.hooks.ClubType = append(c.hooks.ClubType, hooks...)\n}", "func (c *SkillClient) Use(hooks ...Hook) {\n\tc.hooks.Skill = append(c.hooks.Skill, hooks...)\n}", "func (c *BillClient) Use(hooks ...Hook) {\n\tc.hooks.Bill = append(c.hooks.Bill, hooks...)\n}", "func (c *BillClient) Use(hooks ...Hook) {\n\tc.hooks.Bill = append(c.hooks.Bill, hooks...)\n}", "func (c *BillClient) Use(hooks ...Hook) {\n\tc.hooks.Bill = append(c.hooks.Bill, hooks...)\n}", "func (c *PetClient) Use(hooks ...Hook) {\n\tc.hooks.Pet = append(c.hooks.Pet, hooks...)\n}", "func (c *TasteClient) Use(hooks ...Hook) {\n\tc.hooks.Taste = append(c.hooks.Taste, hooks...)\n}", "func (c *BuildingClient) Use(hooks ...Hook) {\n\tc.hooks.Building = append(c.hooks.Building, hooks...)\n}", "func (c *PostClient) Use(hooks ...Hook) {\n\tc.hooks.Post = append(c.hooks.Post, hooks...)\n}", "func (c *MedicineClient) Use(hooks ...Hook) {\n\tc.hooks.Medicine = append(c.hooks.Medicine, hooks...)\n}", "func (c *PositionassingmentClient) Use(hooks ...Hook) {\n\tc.hooks.Positionassingment = append(c.hooks.Positionassingment, hooks...)\n}", "func (c *BedtypeClient) Use(hooks ...Hook) {\n\tc.hooks.Bedtype = append(c.hooks.Bedtype, hooks...)\n}", "func (c *UnitOfMedicineClient) Use(hooks ...Hook) {\n\tc.hooks.UnitOfMedicine = append(c.hooks.UnitOfMedicine, hooks...)\n}", "func (c *PositionInPharmacistClient) Use(hooks ...Hook) {\n\tc.hooks.PositionInPharmacist = append(c.hooks.PositionInPharmacist, hooks...)\n}", "func (c *GenderClient) Use(hooks ...Hook) {\n\tc.hooks.Gender = append(c.hooks.Gender, hooks...)\n}", "func (c *GenderClient) Use(hooks ...Hook) {\n\tc.hooks.Gender = append(c.hooks.Gender, hooks...)\n}", "func (c *AdminSessionClient) Use(hooks ...Hook) {\n\tc.hooks.AdminSession = append(c.hooks.AdminSession, hooks...)\n}", "func (c *PlaylistClient) Use(hooks ...Hook) {\n\tc.hooks.Playlist = append(c.hooks.Playlist, hooks...)\n}", "func (c *PatientClient) Use(hooks ...Hook) {\n\tc.hooks.Patient = append(c.hooks.Patient, hooks...)\n}", "func (c *PatientClient) Use(hooks ...Hook) {\n\tc.hooks.Patient = append(c.hooks.Patient, hooks...)\n}", "func (c *PatientClient) Use(hooks ...Hook) {\n\tc.hooks.Patient = append(c.hooks.Patient, hooks...)\n}", "func (c *PaymentClient) Use(hooks ...Hook) {\n\tc.hooks.Payment = append(c.hooks.Payment, hooks...)\n}", "func (c *PaymentClient) Use(hooks ...Hook) {\n\tc.hooks.Payment = append(c.hooks.Payment, hooks...)\n}", "func (c *Client) Use(hooks ...Hook) {\n\tc.Eatinghistory.Use(hooks...)\n\tc.Foodmenu.Use(hooks...)\n\tc.Mealplan.Use(hooks...)\n\tc.Taste.Use(hooks...)\n\tc.User.Use(hooks...)\n}", "func (c *Client) Use(hooks ...Hook) {\n\tc.Admin.Use(hooks...)\n\tc.AdminSession.Use(hooks...)\n\tc.Category.Use(hooks...)\n\tc.Post.Use(hooks...)\n\tc.PostAttachment.Use(hooks...)\n\tc.PostImage.Use(hooks...)\n\tc.PostThumbnail.Use(hooks...)\n\tc.PostVideo.Use(hooks...)\n\tc.UnsavedPost.Use(hooks...)\n\tc.UnsavedPostAttachment.Use(hooks...)\n\tc.UnsavedPostImage.Use(hooks...)\n\tc.UnsavedPostThumbnail.Use(hooks...)\n\tc.UnsavedPostVideo.Use(hooks...)\n}", "func (c *DepositClient) Use(hooks ...Hook) {\n\tc.hooks.Deposit = append(c.hooks.Deposit, hooks...)\n}", "func (c *DoctorClient) Use(hooks ...Hook) {\n\tc.hooks.Doctor = append(c.hooks.Doctor, hooks...)\n}", "func (c *PledgeClient) Use(hooks ...Hook) {\n\tc.hooks.Pledge = append(c.hooks.Pledge, hooks...)\n}", "func (c *MedicineTypeClient) Use(hooks ...Hook) {\n\tc.hooks.MedicineType = append(c.hooks.MedicineType, hooks...)\n}", "func (c *ClubapplicationClient) Use(hooks ...Hook) {\n\tc.hooks.Clubapplication = append(c.hooks.Clubapplication, hooks...)\n}", "func (c *CategoryClient) Use(hooks ...Hook) {\n\tc.hooks.Category = append(c.hooks.Category, hooks...)\n}", "func (c *DrugAllergyClient) Use(hooks ...Hook) {\n\tc.hooks.DrugAllergy = append(c.hooks.DrugAllergy, hooks...)\n}", "func (c *OrderClient) Use(hooks ...Hook) {\n\tc.hooks.Order = append(c.hooks.Order, hooks...)\n}", "func (c *PartClient) Use(hooks ...Hook) {\n\tc.hooks.Part = append(c.hooks.Part, hooks...)\n}", "func (c *UsertypeClient) Use(hooks ...Hook) {\n\tc.hooks.Usertype = append(c.hooks.Usertype, hooks...)\n}", "func (c *ClubappStatusClient) Use(hooks ...Hook) {\n\tc.hooks.ClubappStatus = append(c.hooks.ClubappStatus, hooks...)\n}", "func (c *ActivitiesClient) Use(hooks ...Hook) {\n\tc.hooks.Activities = append(c.hooks.Activities, hooks...)\n}", "func (c *ComplaintTypeClient) Use(hooks ...Hook) {\n\tc.hooks.ComplaintType = append(c.hooks.ComplaintType, hooks...)\n}", "func (c *JobpositionClient) Use(hooks ...Hook) {\n\tc.hooks.Jobposition = append(c.hooks.Jobposition, hooks...)\n}", "func (c *UserStatusClient) Use(hooks ...Hook) {\n\tc.hooks.UserStatus = append(c.hooks.UserStatus, hooks...)\n}", "func (c *ActivityTypeClient) Use(hooks ...Hook) {\n\tc.hooks.ActivityType = append(c.hooks.ActivityType, hooks...)\n}", "func (User) Hooks() []ent.Hook {\n\treturn []ent.Hook{\n\t\thook.If(\n\t\t\tfunc(next ent.Mutator) ent.Mutator {\n\t\t\t\treturn hook.UserFunc(func(ctx context.Context, m *gen.UserMutation) (gen.Value, error) {\n\t\t\t\t\tv, ok := m.Name()\n\t\t\t\t\tif !ok || v == \"\" {\n\t\t\t\t\t\treturn nil, errors.New(\"unexpected 'name' value\")\n\t\t\t\t\t}\n\t\t\t\t\tc, err := m.SecretsKeeper.Encrypt(ctx, []byte(v))\n\t\t\t\t\tif err != nil {\n\t\t\t\t\t\treturn nil, err\n\t\t\t\t\t}\n\t\t\t\t\tm.SetName(hex.EncodeToString(c))\n\t\t\t\t\tu, err := next.Mutate(ctx, m)\n\t\t\t\t\tif err != nil {\n\t\t\t\t\t\treturn nil, err\n\t\t\t\t\t}\n\t\t\t\t\tif u, ok := u.(*gen.User); ok {\n\t\t\t\t\t\t// Another option, is to assign `u.Name = v` here.\n\t\t\t\t\t\terr = decrypt(ctx, m.SecretsKeeper, u)\n\t\t\t\t\t}\n\t\t\t\t\treturn u, err\n\t\t\t\t})\n\t\t\t},\n\t\t\thook.HasFields(\"name\"),\n\t\t),\n\t}\n}", "func (c *Client) Use(hooks ...Hook) {\n\tc.Event.Use(hooks...)\n\tc.Tag.Use(hooks...)\n}", "func (c *PatientInfoClient) Use(hooks ...Hook) {\n\tc.hooks.PatientInfo = append(c.hooks.PatientInfo, hooks...)\n}", "func (c *PrescriptionClient) Use(hooks ...Hook) {\n\tc.hooks.Prescription = append(c.hooks.Prescription, hooks...)\n}", "func (c *ExaminationroomClient) Use(hooks ...Hook) {\n\tc.hooks.Examinationroom = append(c.hooks.Examinationroom, hooks...)\n}", "func (c *CoinInfoClient) Use(hooks ...Hook) {\n\tc.hooks.CoinInfo = append(c.hooks.CoinInfo, hooks...)\n}" ]
[ "0.6836745", "0.67361706", "0.6731922", "0.66070056", "0.66068083", "0.65988255", "0.65802115", "0.65802115", "0.6575323", "0.6564315", "0.6544297", "0.653167", "0.6530647", "0.64979583", "0.64638865", "0.6447226", "0.64196503", "0.6419115", "0.64186347", "0.6411382", "0.6402426", "0.64017963", "0.64002705", "0.6398508", "0.6396338", "0.63947433", "0.6389727", "0.638033", "0.638033", "0.63741016", "0.6368737", "0.6367906", "0.6364216", "0.6364216", "0.6364216", "0.6364216", "0.6364216", "0.6364216", "0.6364216", "0.6364216", "0.6364216", "0.6364216", "0.6364216", "0.6352444", "0.634399", "0.6327915", "0.6327915", "0.6327915", "0.6324185", "0.6324185", "0.6324185", "0.63192934", "0.6314943", "0.6310391", "0.63075525", "0.62955785", "0.62955785", "0.62955785", "0.6288041", "0.6277109", "0.6273676", "0.62713116", "0.6266329", "0.6245234", "0.6237478", "0.6236188", "0.62189716", "0.6209228", "0.6209228", "0.61977553", "0.61899173", "0.6187245", "0.6187245", "0.6187245", "0.6176175", "0.6176175", "0.61756545", "0.61670995", "0.6162062", "0.61609805", "0.61543554", "0.6144442", "0.6143431", "0.61387277", "0.6125288", "0.6116616", "0.61108524", "0.6102898", "0.60842127", "0.6083852", "0.6082523", "0.60718197", "0.6070454", "0.6052385", "0.6052113", "0.6048911", "0.603995", "0.60169923", "0.60083425", "0.6007862" ]
0.7210789
0
Create returns a create builder for Admin.
func (c *AdminClient) Create() *AdminCreate { mutation := newAdminMutation(c.config, OpCreate) return &AdminCreate{config: c.config, hooks: c.Hooks(), mutation: mutation} }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func AdminCreate(w http.ResponseWriter, data interface{}) {\n\trender(tpAdminCreate, w, data)\n}", "func AdminCreate(w http.ResponseWriter, data interface{}) {\n\trender(tpAdminCreate, w, data)\n}", "func CreateAdmin(w http.ResponseWriter, r *http.Request) {\n\tvar body CreateAdminRequest\n\tif err := read.JSON(r.Body, &body); err != nil {\n\t\trender.Error(w, admin.WrapError(admin.ErrorBadRequestType, err, \"error reading request body\"))\n\t\treturn\n\t}\n\n\tif err := body.Validate(); err != nil {\n\t\trender.Error(w, err)\n\t\treturn\n\t}\n\n\tauth := mustAuthority(r.Context())\n\tp, err := auth.LoadProvisionerByName(body.Provisioner)\n\tif err != nil {\n\t\trender.Error(w, admin.WrapErrorISE(err, \"error loading provisioner %s\", body.Provisioner))\n\t\treturn\n\t}\n\tadm := &linkedca.Admin{\n\t\tProvisionerId: p.GetID(),\n\t\tSubject: body.Subject,\n\t\tType: body.Type,\n\t}\n\t// Store to authority collection.\n\tif err := auth.StoreAdmin(r.Context(), adm, p); err != nil {\n\t\trender.Error(w, admin.WrapErrorISE(err, \"error storing admin\"))\n\t\treturn\n\t}\n\n\trender.ProtoJSONStatus(w, adm, http.StatusCreated)\n}", "func (a *Admin) Create(c *gin.Context) {\n\n\tflash := helper.GetFlash(c)\n\n\tc.HTML(http.StatusOK, \"admin/create\", gin.H{\n\t\t\"title\": \"创建管理员\",\n\t\t\"flash\": flash,\n\t})\n}", "func (v AdminsResource) Create(c buffalo.Context) error {\n\t// Allocate an empty Admin\n\tadmin := &models.Admin{}\n\n\t// Bind admin to the html form elements\n\tif err := c.Bind(admin); err != nil {\n\t\treturn errors.WithStack(err)\n\t}\n\n\t// Get the DB connection from the context\n\ttx, ok := c.Value(\"tx\").(*pop.Connection)\n\tif !ok {\n\t\treturn errors.WithStack(errors.New(\"no transaction found\"))\n\t}\n\n\th, err := generatePasswordHash(admin.Password)\n\tif err != nil {\n\t\treturn err\n\t}\n\tadmin.Password = h\n\t// Validate the data from the html form\n\tverrs, err := tx.ValidateAndCreate(admin)\n\tif err != nil {\n\t\treturn errors.WithStack(err)\n\t}\n\n\tif verrs.HasAny() {\n\t\t// Make the errors available inside the response\n\t\tc.Set(\"errors\", verrs)\n\n\t\treturn c.Render(422, r.JSON(admin))\n\t}\n\n\treturn c.Render(201, r.JSON(admin))\n}", "func New(db *gorm.DB, prefix, cookiesecret string) *Admin {\n\tadminpath := filepath.Join(prefix, \"/admin\")\n\ta := Admin{\n\t\tdb: db,\n\t\tprefix: prefix,\n\t\tadminpath: adminpath,\n\t\tauth: auth{\n\t\t\tdb: db,\n\t\t\tpaths: pathConfig{\n\t\t\t\tadmin: adminpath,\n\t\t\t\tlogin: filepath.Join(prefix, \"/login\"),\n\t\t\t\tlogout: filepath.Join(prefix, \"/logout\"),\n\t\t\t},\n\t\t\tsession: sessionConfig{\n\t\t\t\tkey: \"userid\",\n\t\t\t\tname: \"admsession\",\n\t\t\t\tstore: cookie.NewStore([]byte(cookiesecret)),\n\t\t\t},\n\t\t},\n\t}\n\ta.adm = admin.New(&admin.AdminConfig{\n\t\tSiteName: \"My Admin Interface\",\n\t\tDB: db,\n\t\tAuth: a.auth,\n\t\tAssetFS: bindatafs.AssetFS.NameSpace(\"admin\"),\n\t})\n\taddUser(a.adm)\n\tresources.AddProduct(a.adm)\n\treturn &a\n}", "func (ct *customer) CreateAdmin(c echo.Context) error {\n\tpanic(\"implement me later on\")\n}", "func (app *accessBuilder) Create() AccessBuilder {\n\treturn createAccessBuilder()\n}", "func (orm *ORM) CreateAdmin(ctx context.Context, name string, email string, password string, role string, createdBy *string, phone *string) (*models.Admin, error) {\n\t_Admin := models.Admin{\n\t\tFullName: name,\n\t\tEmail: email,\n\t\tPassword: password,\n\t\tPhone: phone,\n\t\tRole: role,\n\t\tCreatedByID: createdBy,\n\t}\n\t_Result := orm.DB.DB.Select(\"FullName\", \"Email\", \"Password\", \"Phone\", \"Role\", \"CreatedByID\").Create(&_Admin)\n\tif _Result.Error != nil {\n\t\treturn nil, _Result.Error\n\t}\n\treturn &_Admin, nil\n}", "func CreateAdmin(a AdminRegForm) (*mongo.InsertOneResult, error) {\n\tnewAdmin := Admin{\n\t\tID: primitive.NewObjectID(),\n\t\tFrasUsername: a.FrasUsername,\n\t\tPassword: a.Password,\n\t\tInstID: a.InstID,\n\t\tModifiedAt: time.Now(),\n\t}\n\treturn adminCollection.InsertOne(context.TODO(), newAdmin)\n}", "func (s *rpcServer) CreateAdmin(ctx context.Context, req *api.CreateAdminRequest) (*api.CreateAdminResponse, error) {\n\tlogger := log.GetLogger(ctx)\n\ta, _ := admin.ByEmail(req.Email)\n\tif a != nil {\n\t\treturn nil, fmt.Errorf(\"email %s already exists\", req.Email)\n\t}\n\ta = admin.New(req.Name, req.Email, req.PasswordPlainText)\n\tif err := a.Register(); err != nil {\n\t\tlogger.Errorf(\"error while registering admin: %v\", err)\n\t\treturn nil, err\n\t}\n\tlogger.Debugf(\"%+v\", a)\n\treturn &api.CreateAdminResponse{\n\t\tAdmin: &api.Admin{\n\t\t\tId: a.ID,\n\t\t\tName: a.Name,\n\t\t\tEmail: a.Email,\n\t\t\tACL: a.ACL,\n\t\t},\n\t}, nil\n}", "func (admin *Admin) CreateAdmin(db *gorm.DB) (*Admin, error) {\n\n\terr := db.Debug().Create(&admin).Error\n\tif err != nil {\n\t\treturn &Admin{}, err\n\t}\n\n\treturn admin, nil\n}", "func (a *Admin) Create() (*mongo.InsertOneResult, error) {\n\ta.CreatedAt = variable.DateTimeNowPtr()\n\ta.ModifiedAt = variable.DateTimeNowPtr()\n\treturn a.Collection().InsertOne(context.Background(), *a)\n}", "func (app *builder) Create() Builder {\n\treturn createBuilder()\n}", "func (app *builder) Create() Builder {\n\treturn createBuilder()\n}", "func (adminrepo *AdminRepo) CreateAdmin(admin *entity.Admin) (*entity.Admin, error) {\n\tinsertOneResult, era := adminrepo.DB.Collection(entity.ADMIN).InsertOne(context.TODO(), admin)\n\tif era != nil {\n\t\treturn admin, era\n\t}\n\tresult := Helper.ObjectIDFromInsertResult(insertOneResult)\n\tif result != \"\" {\n\t\tadmin.ID = result\n\t}\n\treturn admin, nil\n}", "func (m *MockActivityHandler) AdminCreate(w http.ResponseWriter, r *http.Request) {\n\tm.ctrl.T.Helper()\n\tm.ctrl.Call(m, \"AdminCreate\", w, r)\n}", "func (c *AdminSessionClient) Create() *AdminSessionCreate {\n\tmutation := newAdminSessionMutation(c.config, OpCreate)\n\treturn &AdminSessionCreate{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (ad *Admin) Create() error {\n\tif ad.dbCollection == nil {\n\t\treturn errors.New(\"Uninitialized Object Admin\")\n\t}\n\ttz, _ := utils.GetTimeZone()\n\tad.Timestamp = time.Now().In(tz).Format(time.ANSIC)\n\treturn ad.dbCollection.Insert(ad)\n}", "func (m *GraphBaseServiceClient) Admin()(*i7c9d1b36ac198368c1d8bed014b43e2a518b170ee45bf02c8bbe64544a50539a.AdminRequestBuilder) {\n return i7c9d1b36ac198368c1d8bed014b43e2a518b170ee45bf02c8bbe64544a50539a.NewAdminRequestBuilderInternal(m.pathParameters, m.requestAdapter);\n}", "func (m *GraphBaseServiceClient) Admin()(*i7c9d1b36ac198368c1d8bed014b43e2a518b170ee45bf02c8bbe64544a50539a.AdminRequestBuilder) {\n return i7c9d1b36ac198368c1d8bed014b43e2a518b170ee45bf02c8bbe64544a50539a.NewAdminRequestBuilderInternal(m.pathParameters, m.requestAdapter);\n}", "func (app *builder) Create() Builder {\n\treturn createBuilder(app.immutableBuilder)\n}", "func (app *builder) Create() Builder {\n\treturn createBuilder(app.immutableBuilder)\n}", "func (app *folderNameBuilder) Create() FolderNameBuilder {\n\treturn createFolderNameBuilder()\n}", "func (c *MealplanClient) Create() *MealplanCreate {\n\tmutation := newMealplanMutation(c.config, OpCreate)\n\treturn &MealplanCreate{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (v AdminsResource) New(c buffalo.Context) error {\n\treturn c.Render(200, r.JSON(&models.Admin{}))\n}", "func (app *externalBuilder) Create() ExternalBuilder {\n\treturn createExternalBuilder()\n}", "func (c *BuildingClient) Create() *BuildingCreate {\n\tmutation := newBuildingMutation(c.config, OpCreate)\n\treturn &BuildingCreate{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (app *updateBuilder) Create() UpdateBuilder {\n\treturn createUpdateBuilder()\n}", "func (app *adapterBuilder) Create() AdapterBuilder {\n\treturn createAdapterBuilder()\n}", "func (c *DoctorClient) Create() *DoctorCreate {\n\tmutation := newDoctorMutation(c.config, OpCreate)\n\treturn &DoctorCreate{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (app *scriptCommandBuilder) Create() ScriptCommandBuilder {\n\treturn createScriptCommandBuilder()\n}", "func (c *FoodmenuClient) Create() *FoodmenuCreate {\n\tmutation := newFoodmenuMutation(c.config, OpCreate)\n\treturn &FoodmenuCreate{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (app *builder) Create() Builder {\n\treturn createBuilder(app.hashAdapter, app.immutableBuilder)\n}", "func (app *builder) Create() Builder {\n\treturn createBuilder(app.eventsAdapter)\n}", "func NewAdmin(opts *ServerOptions) (string, *elton.Elton) {\n\tcfg := opts.cfg\n\tadminConfig, _ := cfg.GetAdmin()\n\tif adminConfig == nil {\n\t\treturn \"\", nil\n\t}\n\tadminPath := defaultAdminPath\n\tif adminConfig.Prefix != \"\" {\n\t\tadminPath = adminConfig.Prefix\n\t}\n\n\te := elton.New()\n\n\tif adminConfig != nil {\n\t\te.Use(newAdminValidateMiddlewares(adminConfig)...)\n\t}\n\tcompressConfig := middleware.NewCompressConfig(\n\t\tnew(compress.BrCompressor),\n\t\tnew(middleware.GzipCompressor),\n\t)\n\te.Use(middleware.NewCompress(compressConfig))\n\n\te.Use(middleware.NewDefaultFresh())\n\te.Use(middleware.NewDefaultETag())\n\n\te.Use(middleware.NewDefaultError())\n\te.Use(middleware.NewDefaultResponder())\n\te.Use(middleware.NewDefaultBodyParser())\n\n\tg := elton.NewGroup(adminPath)\n\n\t// 按分类获取配置\n\tg.GET(\"/configs/{category}\", newGetConfigHandler(cfg))\n\t// 添加与更新使用相同处理\n\tg.POST(\"/configs/{category}\", newCreateOrUpdateConfigHandler(cfg))\n\t// 删除配置\n\tg.DELETE(\"/configs/{category}/{name}\", newDeleteConfigHandler(cfg))\n\n\tfiles := new(assetFiles)\n\n\tg.GET(\"/\", func(c *elton.Context) (err error) {\n\t\tfile := \"index.html\"\n\t\tbuf, err := files.Get(file)\n\t\tif err != nil {\n\t\t\treturn\n\t\t}\n\t\tc.SetContentTypeByExt(file)\n\t\tc.BodyBuffer = bytes.NewBuffer(buf)\n\t\treturn\n\t})\n\n\ticons := []string{\n\t\t\"favicon.ico\",\n\t\t\"logo.png\",\n\t}\n\thandleIcon := func(icon string) {\n\t\tg.GET(\"/\"+icon, func(c *elton.Context) (err error) {\n\t\t\tbuf, err := application.DefaultAsset().Find(icon)\n\t\t\tif err != nil {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tc.SetContentTypeByExt(icon)\n\t\t\tc.Body = buf\n\t\t\treturn\n\t\t})\n\t}\n\tfor _, icon := range icons {\n\t\thandleIcon(icon)\n\t}\n\n\tg.GET(\"/static/*\", middleware.NewStaticServe(files, middleware.StaticServeConfig{\n\t\tPath: \"/static\",\n\t\t// 客户端缓存一年\n\t\tMaxAge: 365 * 24 * 3600,\n\t\t// 缓存服务器缓存一个小时\n\t\tSMaxAge: 60 * 60,\n\t\tDenyQueryString: true,\n\t\tDisableLastModified: true,\n\t}))\n\n\t// 获取应用状态\n\tg.GET(\"/application\", func(c *elton.Context) error {\n\t\tc.Body = application.Default()\n\t\treturn nil\n\t})\n\n\t// 获取upstream的状态\n\tg.GET(\"/upstreams\", func(c *elton.Context) error {\n\t\tc.Body = opts.upstreams.Status()\n\t\treturn nil\n\t})\n\n\t// 上传\n\tg.POST(\"/upload\", func(c *elton.Context) (err error) {\n\t\tfile, fileHeader, err := c.Request.FormFile(\"file\")\n\t\tif err != nil {\n\t\t\treturn\n\t\t}\n\t\tbuf, err := ioutil.ReadAll(file)\n\t\tif err != nil {\n\t\t\treturn\n\t\t}\n\t\tc.Body = map[string]string{\n\t\t\t\"contentType\": fileHeader.Header.Get(\"Content-Type\"),\n\t\t\t\"data\": base64.StdEncoding.EncodeToString(buf),\n\t\t}\n\t\treturn\n\t})\n\t// alarm 测试\n\tg.POST(\"/alarms/{name}/try\", func(c *elton.Context) (err error) {\n\t\tname := c.Param(\"name\")\n\t\talarms, err := cfg.GetAlarms()\n\t\tif err != nil {\n\t\t\treturn\n\t\t}\n\t\talarm := alarms.Get(name)\n\t\tif alarm == nil {\n\t\t\terr = hes.New(\"alarm is nil, please check the alarm configs\")\n\t\t\treturn\n\t\t}\n\t\terr = alarmHandle(alarm, nil)\n\t\tif err != nil {\n\t\t\treturn\n\t\t}\n\t\tc.NoContent()\n\t\treturn\n\t})\n\n\t// list caches 获取缓存列表\n\tg.GET(\"/caches/{name}\", func(c *elton.Context) (err error) {\n\t\tdisp := opts.dispatchers.Get(c.Param(\"name\"))\n\t\tif disp == nil {\n\t\t\terr = hes.New(\"cache not found\")\n\t\t\treturn\n\t\t}\n\t\tstatus, _ := strconv.Atoi(c.QueryParam(\"status\"))\n\t\tlimit, _ := strconv.Atoi(c.QueryParam(\"limit\"))\n\t\tif status <= 0 {\n\t\t\tstatus = cache.StatusCacheable\n\t\t}\n\t\tif limit <= 0 {\n\t\t\tlimit = 100\n\t\t}\n\n\t\tc.Body = disp.List(status, limit, c.QueryParam(\"keyword\"))\n\t\treturn\n\t})\n\t// delete cache 删除缓存\n\tg.DELETE(\"/caches/{name}\", func(c *elton.Context) (err error) {\n\t\tdisp := opts.dispatchers.Get(c.Param(\"name\"))\n\t\tif disp == nil {\n\t\t\terr = hes.New(\"cache not found\")\n\t\t\treturn\n\t\t}\n\t\tdisp.Remove([]byte(c.QueryParam(\"key\")))\n\t\tc.NoContent()\n\t\treturn\n\t})\n\n\te.AddGroup(g)\n\treturn adminPath, e\n}", "func (app *builder) Create() Builder {\n\treturn createBuilder(\n\t\tapp.hashAdapter,\n\t\tapp.pkAdapter,\n\t)\n}", "func (app *builder) Create() Builder {\n\treturn createBuilder(app.hashAdapter, app.minPubKeysInOwner)\n}", "func (c *LevelOfDangerousClient) Create() *LevelOfDangerousCreate {\n\tmutation := newLevelOfDangerousMutation(c.config, OpCreate)\n\treturn &LevelOfDangerousCreate{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *BedtypeClient) Create() *BedtypeCreate {\n\tmutation := newBedtypeMutation(c.config, OpCreate)\n\treturn &BedtypeCreate{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *RoomdetailClient) Create() *RoomdetailCreate {\n\tmutation := newRoomdetailMutation(c.config, OpCreate)\n\treturn &RoomdetailCreate{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *RoomuseClient) Create() *RoomuseCreate {\n\tmutation := newRoomuseMutation(c.config, OpCreate)\n\treturn &RoomuseCreate{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *CleaningroomClient) Create() *CleaningroomCreate {\n\tmutation := newCleaningroomMutation(c.config, OpCreate)\n\treturn &CleaningroomCreate{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *MedicineTypeClient) Create() *MedicineTypeCreate {\n\tmutation := newMedicineTypeMutation(c.config, OpCreate)\n\treturn &MedicineTypeCreate{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (app *builder) Create() Builder {\n\treturn createBuilder(app.hashAdapter)\n}", "func (app *builder) Create() Builder {\n\treturn createBuilder(app.hashAdapter)\n}", "func (fac *BuilderFactory) Create() met.Builder {\n\tout := createBuilder()\n\treturn out\n}", "func (c *MedicineClient) Create() *MedicineCreate {\n\tmutation := newMedicineMutation(c.config, OpCreate)\n\treturn &MedicineCreate{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *PhysicianClient) Create() *PhysicianCreate {\n\tmutation := newPhysicianMutation(c.config, OpCreate)\n\treturn &PhysicianCreate{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *PhysicianClient) Create() *PhysicianCreate {\n\tmutation := newPhysicianMutation(c.config, OpCreate)\n\treturn &PhysicianCreate{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (h *Handler) CreateAdminHandler(w http.ResponseWriter, r *http.Request) {\n\tvar u user.User\n\n\terr := json.NewDecoder(r.Body).Decode(&u)\n\tif err != nil {\n\t\th.log.Error(err)\n\t\t_ = response.HTTPError(w, http.StatusBadRequest, response.ErrorParsingUser.Error())\n\t\treturn\n\t}\n\n\tu.Role = user.Admin\n\n\tctx, cancel := context.WithCancel(r.Context())\n\tdefer cancel()\n\n\tselect {\n\tcase <-ctx.Done():\n\t\t_ = response.HTTPError(w, http.StatusBadGateway, response.ErrTimeout.Error())\n\t\treturn\n\tdefault:\n\t\terr = h.service.Create(ctx, &u)\n\t}\n\n\tif err != nil {\n\t\th.log.Error(err)\n\t\t_ = response.HTTPError(w, http.StatusBadRequest, err.Error())\n\t\treturn\n\t}\n\n\tw.Header().Add(\"Location\", r.URL.String()+u.ID.Hex())\n\t_ = response.JSON(w, http.StatusCreated, response.Map{\"user\": u})\n}", "func (c *UnitOfMedicineClient) Create() *UnitOfMedicineCreate {\n\tmutation := newUnitOfMedicineMutation(c.config, OpCreate)\n\treturn &UnitOfMedicineCreate{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *BeerClient) Create() *BeerCreate {\n\tmutation := newBeerMutation(c.config, OpCreate)\n\treturn &BeerCreate{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (ac *AdminCtl) Create() {\n\tif ac.Ctx.Request().Method == \"POST\" {\n\t\tnumber, _ := strconv.Atoi(ac.Ctx.Request().FormValue(\"number\"))\n\t\tname := ac.Ctx.Request().FormValue(\"name\")\n\t\tmtype := ac.Ctx.Request().FormValue(\"type\")\n\t\tcount, _ := strconv.Atoi(strings.Trim(ac.Ctx.Request().FormValue(\"count\"), \" \")) // 去除空白字符\n\t\tprice, _ := strconv.Atoi(ac.Ctx.Request().FormValue(\"price\"))\n\t\thref := ac.Ctx.Request().FormValue(\"href\")\n\t\turl := ac.Ctx.Request().FormValue(\"url\")\n\t\tsnumber := ac.Ctx.Request().FormValue(\"number\")\n\n\t\tproduct := &models.Product{\n\t\t\tNumber: number,\n\t\t\tName: name,\n\t\t\tType: mtype,\n\t\t\tCount: count,\n\t\t\tPrice: price,\n\t\t\tHref: href,\n\t\t\tURL: url,\n\t\t\tBrief: \"/data/\" + snumber + \"/brief\",\n\t\t\tDetail: \"/data/\" + snumber + \"/detail\",\n\t\t}\n\t\tac.Ctx.DB.Create(&product)\n\t\tac.Ctx.Redirect(\"/admin\", http.StatusFound)\n\t} else {\n\t\tac.Ctx.Data[\"AddPage\"] = true\n\t\tac.Ctx.Template = \"admin-add\"\n\t\tac.HTML(http.StatusOK)\n\t}\n}", "func (app *operationBuilder) Create() OperationBuilder {\n\treturn createOperationBuilder()\n}", "func NewAdmin(creator string, opts ...Options) (*Permission, error) {\n\tif creator == \"\" {\n\t\treturn nil, fmt.Errorf(\"permission creator cannot be an empty string\")\n\t}\n\n\tp := &Permission{\n\t\tUsername: util.RandStr(),\n\t\tPassword: uuid.New().String(),\n\t\tOwner: creator,\n\t\tCreator: creator,\n\t\tCategories: adminCategories,\n\t\tOps: adminOps,\n\t\tIndices: []string{\"*\"},\n\t\tSources: []string{\"0.0.0.0/0\"},\n\t\tReferers: []string{\"*\"},\n\t\tCreatedAt: time.Now().Format(time.RFC3339),\n\t\tTTL: -1,\n\t\tLimits: &defaultAdminLimits,\n\t}\n\n\t// run the options on it\n\tfor _, option := range opts {\n\t\tif err := option(p); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\t// set the acls if not set by options explicitly\n\tif p.ACLs == nil {\n\t\tp.ACLs = category.ACLsFor(p.Categories...)\n\t}\n\n\treturn p, nil\n}", "func (c *PatientroomClient) Create() *PatientroomCreate {\n\tmutation := newPatientroomMutation(c.config, OpCreate)\n\treturn &PatientroomCreate{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *ExaminationroomClient) Create() *ExaminationroomCreate {\n\tmutation := newExaminationroomMutation(c.config, OpCreate)\n\treturn &ExaminationroomCreate{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *CleanernameClient) Create() *CleanernameCreate {\n\tmutation := newCleanernameMutation(c.config, OpCreate)\n\treturn &CleanernameCreate{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *ToolClient) Create() *ToolCreate {\n\tmutation := newToolMutation(c.config, OpCreate)\n\treturn &ToolCreate{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *DepartmentClient) Create() *DepartmentCreate {\n\tmutation := newDepartmentMutation(c.config, OpCreate)\n\treturn &DepartmentCreate{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *RoomClient) Create() *RoomCreate {\n\tmutation := newRoomMutation(c.config, OpCreate)\n\treturn &RoomCreate{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *RoomClient) Create() *RoomCreate {\n\tmutation := newRoomMutation(c.config, OpCreate)\n\treturn &RoomCreate{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *OperationroomClient) Create() *OperationroomCreate {\n\tmutation := newOperationroomMutation(c.config, OpCreate)\n\treturn &OperationroomCreate{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (factory) Create(cfg config.NodeHostConfig,\n\tcb config.LogDBCallback, dirs []string, wals []string) (raftio.ILogDB, error) {\n\treturn CreateTan(cfg, cb, dirs, wals)\n}", "func (c *DeviceClient) Create() *DeviceCreate {\n\tmutation := newDeviceMutation(c.config, OpCreate)\n\treturn &DeviceCreate{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *ModuleClient) Create() *ModuleCreate {\n\treturn &ModuleCreate{config: c.config}\n}", "func (app *propertyBuilder) Create() PropertyBuilder {\n\treturn createPropertyBuilder()\n}", "func (c *DentistClient) Create() *DentistCreate {\n\tmutation := newDentistMutation(c.config, OpCreate)\n\treturn &DentistCreate{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *PharmacistClient) Create() *PharmacistCreate {\n\tmutation := newPharmacistMutation(c.config, OpCreate)\n\treturn &PharmacistCreate{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (mr *MockActivityHandlerMockRecorder) AdminCreate(w, r interface{}) *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"AdminCreate\", reflect.TypeOf((*MockActivityHandler)(nil).AdminCreate), w, r)\n}", "func (c *DispenseMedicineClient) Create() *DispenseMedicineCreate {\n\tmutation := newDispenseMedicineMutation(c.config, OpCreate)\n\treturn &DispenseMedicineCreate{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *OperativeClient) Create() *OperativeCreate {\n\tmutation := newOperativeMutation(c.config, OpCreate)\n\treturn &OperativeCreate{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *UserClient) Create() *UserCreate {\n\tmutation := newUserMutation(c.config, OpCreate)\n\treturn &UserCreate{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *UserClient) Create() *UserCreate {\n\tmutation := newUserMutation(c.config, OpCreate)\n\treturn &UserCreate{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *UserClient) Create() *UserCreate {\n\tmutation := newUserMutation(c.config, OpCreate)\n\treturn &UserCreate{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *UserClient) Create() *UserCreate {\n\tmutation := newUserMutation(c.config, OpCreate)\n\treturn &UserCreate{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *UserClient) Create() *UserCreate {\n\tmutation := newUserMutation(c.config, OpCreate)\n\treturn &UserCreate{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *UserClient) Create() *UserCreate {\n\tmutation := newUserMutation(c.config, OpCreate)\n\treturn &UserCreate{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *UserClient) Create() *UserCreate {\n\tmutation := newUserMutation(c.config, OpCreate)\n\treturn &UserCreate{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *UserClient) Create() *UserCreate {\n\tmutation := newUserMutation(c.config, OpCreate)\n\treturn &UserCreate{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *UserClient) Create() *UserCreate {\n\tmutation := newUserMutation(c.config, OpCreate)\n\treturn &UserCreate{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *UserClient) Create() *UserCreate {\n\tmutation := newUserMutation(c.config, OpCreate)\n\treturn &UserCreate{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *UserClient) Create() *UserCreate {\n\tmutation := newUserMutation(c.config, OpCreate)\n\treturn &UserCreate{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func CreateAdminUser(c *gin.Context) {\n\tvar user models.AdminUser\n\tif err := c.Bind(&user); err != nil {\n\t\tc.JSON(http.StatusBadRequest, gin.H{\n\t\t\t\"message\": \"Invalid Request\",\n\t\t})\n\t\treturn\n\t}\n\n\tif err := db.Get().Create(&user).Error; err != nil {\n\t\tc.JSON(http.StatusInternalServerError, gin.H{\n\t\t\t\"message\": \"Internal Server Error\",\n\t\t})\n\t\treturn\n\t}\n\n\tc.JSON(http.StatusOK, gin.H{\n\t\t\"message\": \"Success\",\n\t})\n}", "func (*AdminInfoService) NewAdmin(id int, pwd string, name string) *entities.AdminInfo {\n\tadmin := &entities.AdminInfo{\n\t\tAdminId: id,\n\t\tAdminPwd: pwd,\n\t\tAdminName: name,\n\t}\n\treturn admin\n}", "func (app *applicationBuilder) Create() ApplicationBuilder {\n\treturn createApplicationBuilder()\n}", "func (a *AdminStore) CreateOrUpdate(c *cephclient.ClusterInfo) error {\n\tkeyring := fmt.Sprintf(adminKeyringTemplate, c.CephCred.Secret)\n\treturn a.secretStore.CreateOrUpdate(adminKeyringResourceName, keyring)\n}", "func Create(writer http.ResponseWriter, request *http.Request) {\n\ttemplate_html.ExecuteTemplate(writer, \"Create\", nil)\n}", "func (c *FacultyClient) Create() *FacultyCreate {\n\tmutation := newFacultyMutation(c.config, OpCreate)\n\treturn &FacultyCreate{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *VeterinarianClient) Create() *VeterinarianCreate {\n\tmutation := newVeterinarianMutation(c.config, OpCreate)\n\treturn &VeterinarianCreate{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *PatientofphysicianClient) Create() *PatientofphysicianCreate {\n\tmutation := newPatientofphysicianMutation(c.config, OpCreate)\n\treturn &PatientofphysicianCreate{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (app *mainSectionBuilder) Create() MainSectionBuilder {\n\treturn createMainSectionBuilder()\n}", "func (app *exitBuilder) Create() ExitBuilder {\n\treturn createExitBuilder()\n}", "func (c *EmployeeClient) Create() *EmployeeCreate {\n\tmutation := newEmployeeMutation(c.config, OpCreate)\n\treturn &EmployeeCreate{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *EmployeeClient) Create() *EmployeeCreate {\n\tmutation := newEmployeeMutation(c.config, OpCreate)\n\treturn &EmployeeCreate{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *EmployeeClient) Create() *EmployeeCreate {\n\tmutation := newEmployeeMutation(c.config, OpCreate)\n\treturn &EmployeeCreate{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (webType WebType) Create() error {\n\tlog.WithFields(log.Fields{}).Debug(\"Creating client app\")\n\n\terr := webType.Client.Create()\n\n\tif err != nil {\n\t\treturn err\n\t}\n\tif !webType.includeBackend {\n\t\treturn nil\n\t}\n\tlog.WithFields(log.Fields{}).Debug(\"Creating backend app\")\n\n\treturn webType.Server.Create()\n}", "func (e *ApiClientService) Create(clientName string, admin bool) (data *ApiClientCreateResult, err error) {\n\tpost := ApiNewClient{\n\t\tName: clientName,\n\t\tAdmin: admin,\n\t}\n\tbody, err := JSONReader(post)\n\tif err != nil {\n\t\treturn\n\t}\n\n\terr = e.client.magicRequestDecoder(\"POST\", \"clients\", body, &data)\n\treturn\n}", "func NewAdminCreateNewUserResponseBodyAdmin(res *adminviews.JeeekUserView) *AdminCreateNewUserResponseBodyAdmin {\n\tbody := &AdminCreateNewUserResponseBodyAdmin{\n\t\tUserID: *res.UserID,\n\t\tUserName: *res.UserName,\n\t\tEmailAddress: *res.EmailAddress,\n\t\tPhoneNumber: *res.PhoneNumber,\n\t\tPhotoURL: *res.PhotoURL,\n\t\tEmailVerified: *res.EmailVerified,\n\t\tDisabled: res.Disabled,\n\t\tCreatedAt: res.CreatedAt,\n\t\tLastSignedinAt: res.LastSignedinAt,\n\t}\n\treturn body\n}" ]
[ "0.7083886", "0.7083886", "0.69651806", "0.6892801", "0.6684461", "0.66214234", "0.6612593", "0.6483913", "0.64582354", "0.63087827", "0.60962504", "0.60863996", "0.6053614", "0.604168", "0.604168", "0.59621656", "0.59471315", "0.5915521", "0.59128773", "0.5903166", "0.5903166", "0.5900018", "0.5900018", "0.58720285", "0.5865313", "0.5833239", "0.58222204", "0.5812338", "0.5794961", "0.5792571", "0.5776226", "0.5768963", "0.57648087", "0.57379746", "0.5727698", "0.57178074", "0.5715672", "0.5701734", "0.56975496", "0.5696947", "0.5688449", "0.5680589", "0.56734186", "0.56659734", "0.56386", "0.56386", "0.5632816", "0.56095904", "0.56077856", "0.56077856", "0.56028044", "0.55929154", "0.5571938", "0.5571808", "0.5566396", "0.5523451", "0.5480513", "0.54587483", "0.54530764", "0.5431638", "0.54249746", "0.54153895", "0.54153895", "0.5408683", "0.53994095", "0.5397283", "0.53925085", "0.539205", "0.53805465", "0.53774023", "0.53312564", "0.5326243", "0.5320528", "0.5310678", "0.5310678", "0.5310678", "0.5310678", "0.5310678", "0.5310678", "0.5310678", "0.5310678", "0.5310678", "0.5310678", "0.5310678", "0.53059536", "0.52966654", "0.52740675", "0.527386", "0.5271391", "0.5260881", "0.5253021", "0.52471435", "0.5246374", "0.5242822", "0.5241742", "0.5241742", "0.5241742", "0.5236106", "0.52278376", "0.52274495" ]
0.75161225
0
CreateBulk returns a builder for creating a bulk of Admin entities.
func (c *AdminClient) CreateBulk(builders ...*AdminCreate) *AdminCreateBulk { return &AdminCreateBulk{config: c.config, builders: builders} }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (c *TransactionClient) CreateBulk(builders ...*TransactionCreate) *TransactionCreateBulk {\n\treturn &TransactionCreateBulk{config: c.config, builders: builders}\n}", "func (c *OperationClient) CreateBulk(builders ...*OperationCreate) *OperationCreateBulk {\n\treturn &OperationCreateBulk{config: c.config, builders: builders}\n}", "func (c *VeterinarianClient) CreateBulk(builders ...*VeterinarianCreate) *VeterinarianCreateBulk {\n\treturn &VeterinarianCreateBulk{config: c.config, builders: builders}\n}", "func (c *BeerClient) CreateBulk(builders ...*BeerCreate) *BeerCreateBulk {\n\treturn &BeerCreateBulk{config: c.config, builders: builders}\n}", "func (c *SkillClient) CreateBulk(builders ...*SkillCreate) *SkillCreateBulk {\n\treturn &SkillCreateBulk{config: c.config, builders: builders}\n}", "func (c *UserClient) CreateBulk(builders ...*UserCreate) *UserCreateBulk {\n\treturn &UserCreateBulk{config: c.config, builders: builders}\n}", "func (c *UserClient) CreateBulk(builders ...*UserCreate) *UserCreateBulk {\n\treturn &UserCreateBulk{config: c.config, builders: builders}\n}", "func (c *UserClient) CreateBulk(builders ...*UserCreate) *UserCreateBulk {\n\treturn &UserCreateBulk{config: c.config, builders: builders}\n}", "func (c *UserClient) CreateBulk(builders ...*UserCreate) *UserCreateBulk {\n\treturn &UserCreateBulk{config: c.config, builders: builders}\n}", "func (c *UserClient) CreateBulk(builders ...*UserCreate) *UserCreateBulk {\n\treturn &UserCreateBulk{config: c.config, builders: builders}\n}", "func (c *WalletNodeClient) CreateBulk(builders ...*WalletNodeCreate) *WalletNodeCreateBulk {\n\treturn &WalletNodeCreateBulk{config: c.config, builders: builders}\n}", "func (c *AdminSessionClient) CreateBulk(builders ...*AdminSessionCreate) *AdminSessionCreateBulk {\n\treturn &AdminSessionCreateBulk{config: c.config, builders: builders}\n}", "func (c *DNSBLQueryClient) CreateBulk(builders ...*DNSBLQueryCreate) *DNSBLQueryCreateBulk {\n\treturn &DNSBLQueryCreateBulk{config: c.config, builders: builders}\n}", "func (c *UserWalletClient) CreateBulk(builders ...*UserWalletCreate) *UserWalletCreateBulk {\n\treturn &UserWalletCreateBulk{config: c.config, builders: builders}\n}", "func (c *CompanyClient) CreateBulk(builders ...*CompanyCreate) *CompanyCreateBulk {\n\treturn &CompanyCreateBulk{config: c.config, builders: builders}\n}", "func (c *PostClient) CreateBulk(builders ...*PostCreate) *PostCreateBulk {\n\treturn &PostCreateBulk{config: c.config, builders: builders}\n}", "func (c *EmptyClient) CreateBulk(builders ...*EmptyCreate) *EmptyCreateBulk {\n\treturn &EmptyCreateBulk{config: c.config, builders: builders}\n}", "func (c *JobClient) CreateBulk(builders ...*JobCreate) *JobCreateBulk {\n\treturn &JobCreateBulk{config: c.config, builders: builders}\n}", "func (c *WorkExperienceClient) CreateBulk(builders ...*WorkExperienceCreate) *WorkExperienceCreateBulk {\n\treturn &WorkExperienceCreateBulk{config: c.config, builders: builders}\n}", "func (c *UnsavedPostClient) CreateBulk(builders ...*UnsavedPostCreate) *UnsavedPostCreateBulk {\n\treturn &UnsavedPostCreateBulk{config: c.config, builders: builders}\n}", "func (c *TagClient) CreateBulk(builders ...*TagCreate) *TagCreateBulk {\n\treturn &TagCreateBulk{config: c.config, builders: builders}\n}", "func (c *CategoryClient) CreateBulk(builders ...*CategoryCreate) *CategoryCreateBulk {\n\treturn &CategoryCreateBulk{config: c.config, builders: builders}\n}", "func (c *AppointmentClient) CreateBulk(builders ...*AppointmentCreate) *AppointmentCreateBulk {\n\treturn &AppointmentCreateBulk{config: c.config, builders: builders}\n}", "func (c *CustomerClient) CreateBulk(builders ...*CustomerCreate) *CustomerCreateBulk {\n\treturn &CustomerCreateBulk{config: c.config, builders: builders}\n}", "func (c *IPClient) CreateBulk(builders ...*IPCreate) *IPCreateBulk {\n\treturn &IPCreateBulk{config: c.config, builders: builders}\n}", "func (c *BinaryFileClient) CreateBulk(builders ...*BinaryFileCreate) *BinaryFileCreateBulk {\n\treturn &BinaryFileCreateBulk{config: c.config, builders: builders}\n}", "func (c *PetClient) CreateBulk(builders ...*PetCreate) *PetCreateBulk {\n\treturn &PetCreateBulk{config: c.config, builders: builders}\n}", "func (c *PostAttachmentClient) CreateBulk(builders ...*PostAttachmentCreate) *PostAttachmentCreateBulk {\n\treturn &PostAttachmentCreateBulk{config: c.config, builders: builders}\n}", "func (c *ClinicClient) CreateBulk(builders ...*ClinicCreate) *ClinicCreateBulk {\n\treturn &ClinicCreateBulk{config: c.config, builders: builders}\n}", "func (c *EventClient) CreateBulk(builders ...*EventCreate) *EventCreateBulk {\n\treturn &EventCreateBulk{config: c.config, builders: builders}\n}", "func (c *KeyStoreClient) CreateBulk(builders ...*KeyStoreCreate) *KeyStoreCreateBulk {\n\treturn &KeyStoreCreateBulk{config: c.config, builders: builders}\n}", "func (c *UnsavedPostAttachmentClient) CreateBulk(builders ...*UnsavedPostAttachmentCreate) *UnsavedPostAttachmentCreateBulk {\n\treturn &UnsavedPostAttachmentCreateBulk{config: c.config, builders: builders}\n}", "func (c *CoinInfoClient) CreateBulk(builders ...*CoinInfoCreate) *CoinInfoCreateBulk {\n\treturn &CoinInfoCreateBulk{config: c.config, builders: builders}\n}", "func (c *PostImageClient) CreateBulk(builders ...*PostImageCreate) *PostImageCreateBulk {\n\treturn &PostImageCreateBulk{config: c.config, builders: builders}\n}", "func (c *UnsavedPostImageClient) CreateBulk(builders ...*UnsavedPostImageCreate) *UnsavedPostImageCreateBulk {\n\treturn &UnsavedPostImageCreateBulk{config: c.config, builders: builders}\n}", "func (c *UserCardClient) CreateBulk(builders ...*UserCardCreate) *UserCardCreateBulk {\n\treturn &UserCardCreateBulk{config: c.config, builders: builders}\n}", "func (c *MediaClient) CreateBulk(builders ...*MediaCreate) *MediaCreateBulk {\n\treturn &MediaCreateBulk{config: c.config, builders: builders}\n}", "func (c *DNSBLResponseClient) CreateBulk(builders ...*DNSBLResponseCreate) *DNSBLResponseCreateBulk {\n\treturn &DNSBLResponseCreateBulk{config: c.config, builders: builders}\n}", "func (c *CardClient) CreateBulk(builders ...*CardCreate) *CardCreateBulk {\n\treturn &CardCreateBulk{config: c.config, builders: builders}\n}", "func (c *PostThumbnailClient) CreateBulk(builders ...*PostThumbnailCreate) *PostThumbnailCreateBulk {\n\treturn &PostThumbnailCreateBulk{config: c.config, builders: builders}\n}", "func (c *ReviewClient) CreateBulk(builders ...*ReviewCreate) *ReviewCreateBulk {\n\treturn &ReviewCreateBulk{config: c.config, builders: builders}\n}", "func (c *UnsavedPostThumbnailClient) CreateBulk(builders ...*UnsavedPostThumbnailCreate) *UnsavedPostThumbnailCreateBulk {\n\treturn &UnsavedPostThumbnailCreateBulk{config: c.config, builders: builders}\n}", "func (c *CardScanClient) CreateBulk(builders ...*CardScanCreate) *CardScanCreateBulk {\n\treturn &CardScanCreateBulk{config: c.config, builders: builders}\n}", "func (c *PlaylistClient) CreateBulk(builders ...*PlaylistCreate) *PlaylistCreateBulk {\n\treturn &PlaylistCreateBulk{config: c.config, builders: builders}\n}", "func (c *PostVideoClient) CreateBulk(builders ...*PostVideoCreate) *PostVideoCreateBulk {\n\treturn &PostVideoCreateBulk{config: c.config, builders: builders}\n}", "func (m *Manager) BulkCreate(obj interface{}) error {\n\treturn m.Query(m.Insert().Values(obj).Returning(), obj)\n}", "func (a *DefaultApiService) BulkCreate(ctx _context.Context) ApiBulkCreateRequest {\n\treturn ApiBulkCreateRequest{\n\t\tApiService: a,\n\t\tctx: ctx,\n\t}\n}", "func (c *UnsavedPostVideoClient) CreateBulk(builders ...*UnsavedPostVideoCreate) *UnsavedPostVideoCreateBulk {\n\treturn &UnsavedPostVideoCreateBulk{config: c.config, builders: builders}\n}", "func (bcb *BulkCreateBulk) Save(ctx context.Context) ([]*Bulk, error) {\n\tspecs := make([]*sqlgraph.CreateSpec, len(bcb.builders))\n\tnodes := make([]*Bulk, len(bcb.builders))\n\tmutators := make([]Mutator, len(bcb.builders))\n\tfor i := range bcb.builders {\n\t\tfunc(i int, root context.Context) {\n\t\t\tbuilder := bcb.builders[i]\n\t\t\tvar mut Mutator = MutateFunc(func(ctx context.Context, m Mutation) (Value, error) {\n\t\t\t\tmutation, ok := m.(*BulkMutation)\n\t\t\t\tif !ok {\n\t\t\t\t\treturn nil, fmt.Errorf(\"unexpected mutation type %T\", m)\n\t\t\t\t}\n\t\t\t\tif err := builder.check(); err != nil {\n\t\t\t\t\treturn nil, err\n\t\t\t\t}\n\t\t\t\tbuilder.mutation = mutation\n\t\t\t\tnodes[i], specs[i] = builder.createSpec()\n\t\t\t\tvar err error\n\t\t\t\tif i < len(mutators)-1 {\n\t\t\t\t\t_, err = mutators[i+1].Mutate(root, bcb.builders[i+1].mutation)\n\t\t\t\t} else {\n\t\t\t\t\t// Invoke the actual operation on the latest mutation in the chain.\n\t\t\t\t\tif err = sqlgraph.BatchCreate(ctx, bcb.driver, &sqlgraph.BatchCreateSpec{Nodes: specs}); err != nil {\n\t\t\t\t\t\tif cerr, ok := isSQLConstraintError(err); ok {\n\t\t\t\t\t\t\terr = cerr\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tmutation.done = true\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn nil, err\n\t\t\t\t}\n\t\t\t\tif nodes[i].ID == 0 {\n\t\t\t\t\tid := specs[i].ID.Value.(int64)\n\t\t\t\t\tnodes[i].ID = int(id)\n\t\t\t\t}\n\t\t\t\treturn nodes[i], nil\n\t\t\t})\n\t\t\tfor i := len(builder.hooks) - 1; i >= 0; i-- {\n\t\t\t\tmut = builder.hooks[i](mut)\n\t\t\t}\n\t\t\tmutators[i] = mut\n\t\t}(i, ctx)\n\t}\n\tif len(mutators) > 0 {\n\t\tif _, err := mutators[0].Mutate(ctx, bcb.builders[0].mutation); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\treturn nodes, nil\n}", "func (r *AssetRepository) CreateBulk(assets []assetEntity.Asset) (int, error) {\n\terr := r.restore()\n\tif err != nil {\n\t\treturn 0, err\n\t}\n\n\tn, err := r.repository.CreateBulk(assets)\n\tif err != nil {\n\t\treturn n, fmt.Errorf(\"assets bulk create failed: %w\", err)\n\t}\n\terr = r.dump()\n\treturn n, err\n}", "func (a *BulkApiService) CreateBulkExport(ctx context.Context) ApiCreateBulkExportRequest {\n\treturn ApiCreateBulkExportRequest{\n\t\tApiService: a,\n\t\tctx: ctx,\n\t}\n}", "func (a *BulkApiService) CreateBulkMoCloner(ctx context.Context) ApiCreateBulkMoClonerRequest {\n\treturn ApiCreateBulkMoClonerRequest{\n\t\tApiService: a,\n\t\tctx: ctx,\n\t}\n}", "func (a *BulkApiService) CreateBulkRequest(ctx context.Context) ApiCreateBulkRequestRequest {\n\treturn ApiCreateBulkRequestRequest{\n\t\tApiService: a,\n\t\tctx: ctx,\n\t}\n}", "func (a *BulkApiService) CreateBulkMoMerger(ctx context.Context) ApiCreateBulkMoMergerRequest {\n\treturn ApiCreateBulkMoMergerRequest{\n\t\tApiService: a,\n\t\tctx: ctx,\n\t}\n}", "func (c *queryClient) Bulk(args []*RequestBody) (io.ReadCloser, error) {\n\tbody := RequestBody{\n\t\tType: \"bulk\",\n\t\tArgs: args,\n\t}\n\n\treturn c.Send(body)\n}", "func (m *MessagesController) CreateBulk(ctx *gin.Context) {\n\tmessagesIn := &tat.MessagesJSONIn{}\n\tctx.Bind(messagesIn)\n\tvar msgs []*tat.MessageJSONOut\n\tfor _, messageIn := range messagesIn.Messages {\n\t\tm, code, err := m.createSingle(ctx, messageIn)\n\t\tif err != nil {\n\t\t\tctx.JSON(code, gin.H{\"error\": err.Error()})\n\t\t\treturn\n\t\t}\n\t\tmsgs = append(msgs, m)\n\t}\n\tctx.JSON(http.StatusCreated, msgs)\n}", "func (ocb *OrganizationCreateBulk) Save(ctx context.Context) ([]*Organization, error) {\n\tspecs := make([]*sqlgraph.CreateSpec, len(ocb.builders))\n\tnodes := make([]*Organization, len(ocb.builders))\n\tmutators := make([]Mutator, len(ocb.builders))\n\tfor i := range ocb.builders {\n\t\tfunc(i int, root context.Context) {\n\t\t\tbuilder := ocb.builders[i]\n\t\t\tbuilder.defaults()\n\t\t\tvar mut Mutator = MutateFunc(func(ctx context.Context, m Mutation) (Value, error) {\n\t\t\t\tmutation, ok := m.(*OrganizationMutation)\n\t\t\t\tif !ok {\n\t\t\t\t\treturn nil, fmt.Errorf(\"unexpected mutation type %T\", m)\n\t\t\t\t}\n\t\t\t\tif err := builder.check(); err != nil {\n\t\t\t\t\treturn nil, err\n\t\t\t\t}\n\t\t\t\tbuilder.mutation = mutation\n\t\t\t\tnodes[i], specs[i] = builder.createSpec()\n\t\t\t\tvar err error\n\t\t\t\tif i < len(mutators)-1 {\n\t\t\t\t\t_, err = mutators[i+1].Mutate(root, ocb.builders[i+1].mutation)\n\t\t\t\t} else {\n\t\t\t\t\tspec := &sqlgraph.BatchCreateSpec{Nodes: specs}\n\t\t\t\t\tspec.OnConflict = ocb.conflict\n\t\t\t\t\t// Invoke the actual operation on the latest mutation in the chain.\n\t\t\t\t\tif err = sqlgraph.BatchCreate(ctx, ocb.driver, spec); err != nil {\n\t\t\t\t\t\tif sqlgraph.IsConstraintError(err) {\n\t\t\t\t\t\t\terr = &ConstraintError{err.Error(), err}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn nil, err\n\t\t\t\t}\n\t\t\t\tmutation.id = &nodes[i].ID\n\t\t\t\tmutation.done = true\n\t\t\t\tif specs[i].ID.Value != nil {\n\t\t\t\t\tid := specs[i].ID.Value.(int64)\n\t\t\t\t\tnodes[i].ID = int(id)\n\t\t\t\t}\n\t\t\t\treturn nodes[i], nil\n\t\t\t})\n\t\t\tfor i := len(builder.hooks) - 1; i >= 0; i-- {\n\t\t\t\tmut = builder.hooks[i](mut)\n\t\t\t}\n\t\t\tmutators[i] = mut\n\t\t}(i, ctx)\n\t}\n\tif len(mutators) > 0 {\n\t\tif _, err := mutators[0].Mutate(ctx, ocb.builders[0].mutation); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\treturn nodes, nil\n}", "func (a *APIGen) BulkCreateIndexPattern(ctx context.Context, indexPatterns []IndexPattern) error {\n\tpanic(\"Should Not Be Called from Gen Pattern.\")\n}", "func (ccb *CampaignCreateBulk) Save(ctx context.Context) ([]*Campaign, error) {\n\tspecs := make([]*sqlgraph.CreateSpec, len(ccb.builders))\n\tnodes := make([]*Campaign, len(ccb.builders))\n\tmutators := make([]Mutator, len(ccb.builders))\n\tfor i := range ccb.builders {\n\t\tfunc(i int, root context.Context) {\n\t\t\tbuilder := ccb.builders[i]\n\t\t\tbuilder.defaults()\n\t\t\tvar mut Mutator = MutateFunc(func(ctx context.Context, m Mutation) (Value, error) {\n\t\t\t\tmutation, ok := m.(*CampaignMutation)\n\t\t\t\tif !ok {\n\t\t\t\t\treturn nil, fmt.Errorf(\"unexpected mutation type %T\", m)\n\t\t\t\t}\n\t\t\t\tif err := builder.check(); err != nil {\n\t\t\t\t\treturn nil, err\n\t\t\t\t}\n\t\t\t\tbuilder.mutation = mutation\n\t\t\t\tnodes[i], specs[i] = builder.createSpec()\n\t\t\t\tvar err error\n\t\t\t\tif i < len(mutators)-1 {\n\t\t\t\t\t_, err = mutators[i+1].Mutate(root, ccb.builders[i+1].mutation)\n\t\t\t\t} else {\n\t\t\t\t\t// Invoke the actual operation on the latest mutation in the chain.\n\t\t\t\t\tif err = sqlgraph.BatchCreate(ctx, ccb.driver, &sqlgraph.BatchCreateSpec{Nodes: specs}); err != nil {\n\t\t\t\t\t\tif cerr, ok := isSQLConstraintError(err); ok {\n\t\t\t\t\t\t\terr = cerr\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tmutation.done = true\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn nil, err\n\t\t\t\t}\n\t\t\t\treturn nodes[i], nil\n\t\t\t})\n\t\t\tfor i := len(builder.hooks) - 1; i >= 0; i-- {\n\t\t\t\tmut = builder.hooks[i](mut)\n\t\t\t}\n\t\t\tmutators[i] = mut\n\t\t}(i, ctx)\n\t}\n\tif len(mutators) > 0 {\n\t\tif _, err := mutators[0].Mutate(ctx, ccb.builders[0].mutation); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\treturn nodes, nil\n}", "func NewBulk(data []byte) *EncodeData {\n\tans := &EncodeData{}\n\tans.Type = TypeBulk\n\tans.Value = data\n\treturn ans\n}", "func (s *CampaignNegativeKeywordService) CreateBulk(ctx context.Context, campaignID int64, data []*NegativeKeyword) ([]*NegativeKeyword, *Response, error) {\n\tif campaignID == 0 {\n\t\treturn nil, nil, fmt.Errorf(\"campaignID can not be 0\")\n\t}\n\tu := fmt.Sprintf(\"campaigns/%d/negativekeywords/bulk\", campaignID)\n\treq, err := s.client.NewRequest(\"POST\", u, data)\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\tnegativekeywords := []*NegativeKeyword{}\n\tresp, err := s.client.Do(ctx, req, &negativekeywords)\n\tif err != nil {\n\t\treturn nil, resp, err\n\t}\n\treturn negativekeywords, resp, nil\n}", "func (s *AdGroupNegativeKeywordService) CreateBulk(ctx context.Context, campaignID int64, adGroupID int64, data []*NegativeKeyword) ([]*NegativeKeyword, *Response, error) {\n\tif campaignID == 0 {\n\t\treturn nil, nil, fmt.Errorf(\"campaignID can not be 0\")\n\t}\n\tif adGroupID == 0 {\n\t\treturn nil, nil, fmt.Errorf(\"adGroupID can not be 0\")\n\t}\n\tu := fmt.Sprintf(\"campaigns/%d/adgroups/%d/negativekeywords/bulk\", campaignID, adGroupID)\n\treq, err := s.client.NewRequest(\"POST\", u, data)\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\tnegativekeywords := []*NegativeKeyword{}\n\tresp, err := s.client.Do(ctx, req, &negativekeywords)\n\tif err != nil {\n\t\treturn nil, resp, err\n\t}\n\n\treturn negativekeywords, resp, nil\n}", "func (ucb *UserCreateBulk) Save(ctx context.Context) ([]*User, error) {\n\tspecs := make([]*sqlgraph.CreateSpec, len(ucb.builders))\n\tnodes := make([]*User, len(ucb.builders))\n\tmutators := make([]Mutator, len(ucb.builders))\n\tfor i := range ucb.builders {\n\t\tfunc(i int, root context.Context) {\n\t\t\tbuilder := ucb.builders[i]\n\t\t\tvar mut Mutator = MutateFunc(func(ctx context.Context, m Mutation) (Value, error) {\n\t\t\t\tmutation, ok := m.(*UserMutation)\n\t\t\t\tif !ok {\n\t\t\t\t\treturn nil, fmt.Errorf(\"unexpected mutation type %T\", m)\n\t\t\t\t}\n\t\t\t\tif err := builder.check(); err != nil {\n\t\t\t\t\treturn nil, err\n\t\t\t\t}\n\t\t\t\tbuilder.mutation = mutation\n\t\t\t\tnodes[i], specs[i] = builder.createSpec()\n\t\t\t\tvar err error\n\t\t\t\tif i < len(mutators)-1 {\n\t\t\t\t\t_, err = mutators[i+1].Mutate(root, ucb.builders[i+1].mutation)\n\t\t\t\t} else {\n\t\t\t\t\t// Invoke the actual operation on the latest mutation in the chain.\n\t\t\t\t\tif err = sqlgraph.BatchCreate(ctx, ucb.driver, &sqlgraph.BatchCreateSpec{Nodes: specs}); err != nil {\n\t\t\t\t\t\tif cerr, ok := isSQLConstraintError(err); ok {\n\t\t\t\t\t\t\terr = cerr\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tmutation.done = true\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn nil, err\n\t\t\t\t}\n\t\t\t\tid := specs[i].ID.Value.(int64)\n\t\t\t\tnodes[i].ID = int(id)\n\t\t\t\treturn nodes[i], nil\n\t\t\t})\n\t\t\tfor i := len(builder.hooks) - 1; i >= 0; i-- {\n\t\t\t\tmut = builder.hooks[i](mut)\n\t\t\t}\n\t\t\tmutators[i] = mut\n\t\t}(i, ctx)\n\t}\n\tif len(mutators) > 0 {\n\t\tif _, err := mutators[0].Mutate(ctx, ucb.builders[0].mutation); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\treturn nodes, nil\n}", "func (icb *InstanceCreateBulk) Save(ctx context.Context) ([]*Instance, error) {\n\tspecs := make([]*sqlgraph.CreateSpec, len(icb.builders))\n\tnodes := make([]*Instance, len(icb.builders))\n\tmutators := make([]Mutator, len(icb.builders))\n\tfor i := range icb.builders {\n\t\tfunc(i int, root context.Context) {\n\t\t\tbuilder := icb.builders[i]\n\t\t\tbuilder.defaults()\n\t\t\tvar mut Mutator = MutateFunc(func(ctx context.Context, m Mutation) (Value, error) {\n\t\t\t\tmutation, ok := m.(*InstanceMutation)\n\t\t\t\tif !ok {\n\t\t\t\t\treturn nil, fmt.Errorf(\"unexpected mutation type %T\", m)\n\t\t\t\t}\n\t\t\t\tif err := builder.check(); err != nil {\n\t\t\t\t\treturn nil, err\n\t\t\t\t}\n\t\t\t\tbuilder.mutation = mutation\n\t\t\t\tnodes[i], specs[i] = builder.createSpec()\n\t\t\t\tvar err error\n\t\t\t\tif i < len(mutators)-1 {\n\t\t\t\t\t_, err = mutators[i+1].Mutate(root, icb.builders[i+1].mutation)\n\t\t\t\t} else {\n\t\t\t\t\tspec := &sqlgraph.BatchCreateSpec{Nodes: specs}\n\t\t\t\t\t// Invoke the actual operation on the latest mutation in the chain.\n\t\t\t\t\tif err = sqlgraph.BatchCreate(ctx, icb.driver, spec); err != nil {\n\t\t\t\t\t\tif sqlgraph.IsConstraintError(err) {\n\t\t\t\t\t\t\terr = &ConstraintError{err.Error(), err}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn nil, err\n\t\t\t\t}\n\t\t\t\tmutation.id = &nodes[i].ID\n\t\t\t\tmutation.done = true\n\t\t\t\treturn nodes[i], nil\n\t\t\t})\n\t\t\tfor i := len(builder.hooks) - 1; i >= 0; i-- {\n\t\t\t\tmut = builder.hooks[i](mut)\n\t\t\t}\n\t\t\tmutators[i] = mut\n\t\t}(i, ctx)\n\t}\n\tif len(mutators) > 0 {\n\t\tif _, err := mutators[0].Mutate(ctx, icb.builders[0].mutation); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\treturn nodes, nil\n}", "func (rcb *RestaurantCreateBulk) Save(ctx context.Context) ([]*Restaurant, error) {\n\tspecs := make([]*sqlgraph.CreateSpec, len(rcb.builders))\n\tnodes := make([]*Restaurant, len(rcb.builders))\n\tmutators := make([]Mutator, len(rcb.builders))\n\tfor i := range rcb.builders {\n\t\tfunc(i int, root context.Context) {\n\t\t\tbuilder := rcb.builders[i]\n\t\t\tvar mut Mutator = MutateFunc(func(ctx context.Context, m Mutation) (Value, error) {\n\t\t\t\tmutation, ok := m.(*RestaurantMutation)\n\t\t\t\tif !ok {\n\t\t\t\t\treturn nil, fmt.Errorf(\"unexpected mutation type %T\", m)\n\t\t\t\t}\n\t\t\t\tif err := builder.check(); err != nil {\n\t\t\t\t\treturn nil, err\n\t\t\t\t}\n\t\t\t\tbuilder.mutation = mutation\n\t\t\t\tnodes[i], specs[i] = builder.createSpec()\n\t\t\t\tvar err error\n\t\t\t\tif i < len(mutators)-1 {\n\t\t\t\t\t_, err = mutators[i+1].Mutate(root, rcb.builders[i+1].mutation)\n\t\t\t\t} else {\n\t\t\t\t\t// Invoke the actual operation on the latest mutation in the chain.\n\t\t\t\t\tif err = sqlgraph.BatchCreate(ctx, rcb.driver, &sqlgraph.BatchCreateSpec{Nodes: specs}); err != nil {\n\t\t\t\t\t\tif sqlgraph.IsConstraintError(err) {\n\t\t\t\t\t\t\terr = &ConstraintError{err.Error(), err}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn nil, err\n\t\t\t\t}\n\t\t\t\tmutation.id = &nodes[i].ID\n\t\t\t\tmutation.done = true\n\t\t\t\tid := specs[i].ID.Value.(int64)\n\t\t\t\tnodes[i].ID = int(id)\n\t\t\t\treturn nodes[i], nil\n\t\t\t})\n\t\t\tfor i := len(builder.hooks) - 1; i >= 0; i-- {\n\t\t\t\tmut = builder.hooks[i](mut)\n\t\t\t}\n\t\t\tmutators[i] = mut\n\t\t}(i, ctx)\n\t}\n\tif len(mutators) > 0 {\n\t\tif _, err := mutators[0].Mutate(ctx, rcb.builders[0].mutation); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\treturn nodes, nil\n}", "func (ucb *UserCreateBulk) Save(ctx context.Context) ([]*User, error) {\n\tspecs := make([]*sqlgraph.CreateSpec, len(ucb.builders))\n\tnodes := make([]*User, len(ucb.builders))\n\tmutators := make([]Mutator, len(ucb.builders))\n\tfor i := range ucb.builders {\n\t\tfunc(i int, root context.Context) {\n\t\t\tbuilder := ucb.builders[i]\n\t\t\tvar mut Mutator = MutateFunc(func(ctx context.Context, m Mutation) (Value, error) {\n\t\t\t\tif err := builder.preSave(); err != nil {\n\t\t\t\t\treturn nil, err\n\t\t\t\t}\n\t\t\t\tmutation, ok := m.(*UserMutation)\n\t\t\t\tif !ok {\n\t\t\t\t\treturn nil, fmt.Errorf(\"unexpected mutation type %T\", m)\n\t\t\t\t}\n\t\t\t\tbuilder.mutation = mutation\n\t\t\t\tnodes[i], specs[i] = builder.createSpec()\n\t\t\t\tvar err error\n\t\t\t\tif i < len(mutators)-1 {\n\t\t\t\t\t_, err = mutators[i+1].Mutate(root, ucb.builders[i+1].mutation)\n\t\t\t\t} else {\n\t\t\t\t\t// Invoke the actual operation on the latest mutation in the chain.\n\t\t\t\t\tif err = sqlgraph.BatchCreate(ctx, ucb.driver, &sqlgraph.BatchCreateSpec{Nodes: specs}); err != nil {\n\t\t\t\t\t\tif cerr, ok := isSQLConstraintError(err); ok {\n\t\t\t\t\t\t\terr = cerr\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tmutation.done = true\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn nil, err\n\t\t\t\t}\n\t\t\t\treturn nodes[i], nil\n\t\t\t})\n\t\t\tfor i := len(builder.hooks) - 1; i >= 0; i-- {\n\t\t\t\tmut = builder.hooks[i](mut)\n\t\t\t}\n\t\t\tmutators[i] = mut\n\t\t}(i, ctx)\n\t}\n\tif len(mutators) > 0 {\n\t\tif _, err := mutators[0].Mutate(ctx, ucb.builders[0].mutation); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\treturn nodes, nil\n}", "func (ccb *CompanyCreateBulk) Save(ctx context.Context) ([]*Company, error) {\n\tspecs := make([]*sqlgraph.CreateSpec, len(ccb.builders))\n\tnodes := make([]*Company, len(ccb.builders))\n\tmutators := make([]Mutator, len(ccb.builders))\n\tfor i := range ccb.builders {\n\t\tfunc(i int, root context.Context) {\n\t\t\tbuilder := ccb.builders[i]\n\t\t\tbuilder.defaults()\n\t\t\tvar mut Mutator = MutateFunc(func(ctx context.Context, m Mutation) (Value, error) {\n\t\t\t\tmutation, ok := m.(*CompanyMutation)\n\t\t\t\tif !ok {\n\t\t\t\t\treturn nil, fmt.Errorf(\"unexpected mutation type %T\", m)\n\t\t\t\t}\n\t\t\t\tif err := builder.check(); err != nil {\n\t\t\t\t\treturn nil, err\n\t\t\t\t}\n\t\t\t\tbuilder.mutation = mutation\n\t\t\t\tnodes[i], specs[i] = builder.createSpec()\n\t\t\t\tvar err error\n\t\t\t\tif i < len(mutators)-1 {\n\t\t\t\t\t_, err = mutators[i+1].Mutate(root, ccb.builders[i+1].mutation)\n\t\t\t\t} else {\n\t\t\t\t\t// Invoke the actual operation on the latest mutation in the chain.\n\t\t\t\t\tif err = sqlgraph.BatchCreate(ctx, ccb.driver, &sqlgraph.BatchCreateSpec{Nodes: specs}); err != nil {\n\t\t\t\t\t\tif sqlgraph.IsConstraintError(err) {\n\t\t\t\t\t\t\terr = &ConstraintError{err.Error(), err}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn nil, err\n\t\t\t\t}\n\t\t\t\tmutation.id = &nodes[i].ID\n\t\t\t\tmutation.done = true\n\t\t\t\tid := specs[i].ID.Value.(int64)\n\t\t\t\tnodes[i].ID = int(id)\n\t\t\t\treturn nodes[i], nil\n\t\t\t})\n\t\t\tfor i := len(builder.hooks) - 1; i >= 0; i-- {\n\t\t\t\tmut = builder.hooks[i](mut)\n\t\t\t}\n\t\t\tmutators[i] = mut\n\t\t}(i, ctx)\n\t}\n\tif len(mutators) > 0 {\n\t\tif _, err := mutators[0].Mutate(ctx, ccb.builders[0].mutation); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\treturn nodes, nil\n}", "func (wcb *WalletCreateBulk) Save(ctx context.Context) ([]*Wallet, error) {\n\tspecs := make([]*sqlgraph.CreateSpec, len(wcb.builders))\n\tnodes := make([]*Wallet, len(wcb.builders))\n\tmutators := make([]Mutator, len(wcb.builders))\n\tfor i := range wcb.builders {\n\t\tfunc(i int, root context.Context) {\n\t\t\tbuilder := wcb.builders[i]\n\t\t\tbuilder.defaults()\n\t\t\tvar mut Mutator = MutateFunc(func(ctx context.Context, m Mutation) (Value, error) {\n\t\t\t\tmutation, ok := m.(*WalletMutation)\n\t\t\t\tif !ok {\n\t\t\t\t\treturn nil, fmt.Errorf(\"unexpected mutation type %T\", m)\n\t\t\t\t}\n\t\t\t\tif err := builder.check(); err != nil {\n\t\t\t\t\treturn nil, err\n\t\t\t\t}\n\t\t\t\tbuilder.mutation = mutation\n\t\t\t\tnodes[i], specs[i] = builder.createSpec()\n\t\t\t\tvar err error\n\t\t\t\tif i < len(mutators)-1 {\n\t\t\t\t\t_, err = mutators[i+1].Mutate(root, wcb.builders[i+1].mutation)\n\t\t\t\t} else {\n\t\t\t\t\tspec := &sqlgraph.BatchCreateSpec{Nodes: specs}\n\t\t\t\t\t// Invoke the actual operation on the latest mutation in the chain.\n\t\t\t\t\tif err = sqlgraph.BatchCreate(ctx, wcb.driver, spec); err != nil {\n\t\t\t\t\t\tif sqlgraph.IsConstraintError(err) {\n\t\t\t\t\t\t\terr = &ConstraintError{msg: err.Error(), wrap: err}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn nil, err\n\t\t\t\t}\n\t\t\t\tmutation.id = &nodes[i].ID\n\t\t\t\tmutation.done = true\n\t\t\t\treturn nodes[i], nil\n\t\t\t})\n\t\t\tfor i := len(builder.hooks) - 1; i >= 0; i-- {\n\t\t\t\tmut = builder.hooks[i](mut)\n\t\t\t}\n\t\t\tmutators[i] = mut\n\t\t}(i, ctx)\n\t}\n\tif len(mutators) > 0 {\n\t\tif _, err := mutators[0].Mutate(ctx, wcb.builders[0].mutation); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\treturn nodes, nil\n}", "func (ucb *UserCreateBulk) Save(ctx context.Context) ([]*User, error) {\n\tspecs := make([]*sqlgraph.CreateSpec, len(ucb.builders))\n\tnodes := make([]*User, len(ucb.builders))\n\tmutators := make([]Mutator, len(ucb.builders))\n\tfor i := range ucb.builders {\n\t\tfunc(i int, root context.Context) {\n\t\t\tbuilder := ucb.builders[i]\n\t\t\tvar mut Mutator = MutateFunc(func(ctx context.Context, m Mutation) (Value, error) {\n\t\t\t\tif err := builder.preSave(); err != nil {\n\t\t\t\t\treturn nil, err\n\t\t\t\t}\n\t\t\t\tmutation, ok := m.(*UserMutation)\n\t\t\t\tif !ok {\n\t\t\t\t\treturn nil, fmt.Errorf(\"unexpected mutation type %T\", m)\n\t\t\t\t}\n\t\t\t\tbuilder.mutation = mutation\n\t\t\t\tnodes[i], specs[i] = builder.createSpec()\n\t\t\t\tvar err error\n\t\t\t\tif i < len(mutators)-1 {\n\t\t\t\t\t_, err = mutators[i+1].Mutate(root, ucb.builders[i+1].mutation)\n\t\t\t\t} else {\n\t\t\t\t\t// Invoke the actual operation on the latest mutation in the chain.\n\t\t\t\t\tif err = sqlgraph.BatchCreate(ctx, ucb.driver, &sqlgraph.BatchCreateSpec{Nodes: specs}); err != nil {\n\t\t\t\t\t\tif cerr, ok := isSQLConstraintError(err); ok {\n\t\t\t\t\t\t\terr = cerr\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tmutation.done = true\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn nil, err\n\t\t\t\t}\n\t\t\t\tid := specs[i].ID.Value.(int64)\n\t\t\t\tnodes[i].ID = int(id)\n\t\t\t\treturn nodes[i], nil\n\t\t\t})\n\t\t\tfor i := len(builder.hooks) - 1; i >= 0; i-- {\n\t\t\t\tmut = builder.hooks[i](mut)\n\t\t\t}\n\t\t\tmutators[i] = mut\n\t\t}(i, ctx)\n\t}\n\tif len(mutators) > 0 {\n\t\tif _, err := mutators[0].Mutate(ctx, ucb.builders[0].mutation); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\treturn nodes, nil\n}", "func (p Database) Bulk(docs []interface{}) ([]Response, error) {\n\tm := map[string]interface{}{}\n\tm[\"docs\"] = docs\n\tjsonBuf, err := json.Marshal(m)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tresults := []Response{}\n\t_, err = interact(\"POST\", p.DBURL()+\"/_bulk_docs\", p.defaultHdrs, jsonBuf, &results)\n\treturn results, err\n}", "func (bcb *BeerCreateBulk) Save(ctx context.Context) ([]*Beer, error) {\n\tspecs := make([]*sqlgraph.CreateSpec, len(bcb.builders))\n\tnodes := make([]*Beer, len(bcb.builders))\n\tmutators := make([]Mutator, len(bcb.builders))\n\tfor i := range bcb.builders {\n\t\tfunc(i int, root context.Context) {\n\t\t\tbuilder := bcb.builders[i]\n\t\t\tbuilder.defaults()\n\t\t\tvar mut Mutator = MutateFunc(func(ctx context.Context, m Mutation) (Value, error) {\n\t\t\t\tmutation, ok := m.(*BeerMutation)\n\t\t\t\tif !ok {\n\t\t\t\t\treturn nil, fmt.Errorf(\"unexpected mutation type %T\", m)\n\t\t\t\t}\n\t\t\t\tif err := builder.check(); err != nil {\n\t\t\t\t\treturn nil, err\n\t\t\t\t}\n\t\t\t\tbuilder.mutation = mutation\n\t\t\t\tnodes[i], specs[i] = builder.createSpec()\n\t\t\t\tvar err error\n\t\t\t\tif i < len(mutators)-1 {\n\t\t\t\t\t_, err = mutators[i+1].Mutate(root, bcb.builders[i+1].mutation)\n\t\t\t\t} else {\n\t\t\t\t\t// Invoke the actual operation on the latest mutation in the chain.\n\t\t\t\t\tif err = sqlgraph.BatchCreate(ctx, bcb.driver, &sqlgraph.BatchCreateSpec{Nodes: specs}); err != nil {\n\t\t\t\t\t\tif cerr, ok := isSQLConstraintError(err); ok {\n\t\t\t\t\t\t\terr = cerr\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tmutation.done = true\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn nil, err\n\t\t\t\t}\n\t\t\t\tif nodes[i].ID == 0 {\n\t\t\t\t\tid := specs[i].ID.Value.(int64)\n\t\t\t\t\tnodes[i].ID = int64(id)\n\t\t\t\t}\n\t\t\t\treturn nodes[i], nil\n\t\t\t})\n\t\t\tfor i := len(builder.hooks) - 1; i >= 0; i-- {\n\t\t\t\tmut = builder.hooks[i](mut)\n\t\t\t}\n\t\t\tmutators[i] = mut\n\t\t}(i, ctx)\n\t}\n\tif len(mutators) > 0 {\n\t\tif _, err := mutators[0].Mutate(ctx, bcb.builders[0].mutation); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\treturn nodes, nil\n}", "func (dscb *DataSourceCreateBulk) Save(ctx context.Context) ([]*DataSource, error) {\n\tspecs := make([]*sqlgraph.CreateSpec, len(dscb.builders))\n\tnodes := make([]*DataSource, len(dscb.builders))\n\tmutators := make([]Mutator, len(dscb.builders))\n\tfor i := range dscb.builders {\n\t\tfunc(i int, root context.Context) {\n\t\t\tbuilder := dscb.builders[i]\n\t\t\tbuilder.defaults()\n\t\t\tvar mut Mutator = MutateFunc(func(ctx context.Context, m Mutation) (Value, error) {\n\t\t\t\tmutation, ok := m.(*DataSourceMutation)\n\t\t\t\tif !ok {\n\t\t\t\t\treturn nil, fmt.Errorf(\"unexpected mutation type %T\", m)\n\t\t\t\t}\n\t\t\t\tif err := builder.check(); err != nil {\n\t\t\t\t\treturn nil, err\n\t\t\t\t}\n\t\t\t\tbuilder.mutation = mutation\n\t\t\t\tnodes[i], specs[i] = builder.createSpec()\n\t\t\t\tvar err error\n\t\t\t\tif i < len(mutators)-1 {\n\t\t\t\t\t_, err = mutators[i+1].Mutate(root, dscb.builders[i+1].mutation)\n\t\t\t\t} else {\n\t\t\t\t\tspec := &sqlgraph.BatchCreateSpec{Nodes: specs}\n\t\t\t\t\t// Invoke the actual operation on the latest mutation in the chain.\n\t\t\t\t\tif err = sqlgraph.BatchCreate(ctx, dscb.driver, spec); err != nil {\n\t\t\t\t\t\tif sqlgraph.IsConstraintError(err) {\n\t\t\t\t\t\t\terr = &ConstraintError{msg: err.Error(), wrap: err}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn nil, err\n\t\t\t\t}\n\t\t\t\tmutation.id = &nodes[i].ID\n\t\t\t\tif specs[i].ID.Value != nil {\n\t\t\t\t\tid := specs[i].ID.Value.(int64)\n\t\t\t\t\tnodes[i].ID = int(id)\n\t\t\t\t}\n\t\t\t\tmutation.done = true\n\t\t\t\treturn nodes[i], nil\n\t\t\t})\n\t\t\tfor i := len(builder.hooks) - 1; i >= 0; i-- {\n\t\t\t\tmut = builder.hooks[i](mut)\n\t\t\t}\n\t\t\tmutators[i] = mut\n\t\t}(i, ctx)\n\t}\n\tif len(mutators) > 0 {\n\t\tif _, err := mutators[0].Mutate(ctx, dscb.builders[0].mutation); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\treturn nodes, nil\n}", "func (client *Client) CreateBulkTransaction(txn []*CreateTransaction) (_ *Response, err error) {\n\tpath := \"/transaction_bulk\"\n\turi := fmt.Sprintf(\"%s%s\", client.apiBaseURL, path)\n\n\tif len(txn) > MaxBulkPutSize {\n\t\treturn nil, ErrMaxBulkSizeExceeded\n\t}\n\n\ttxnBytes, err := json.Marshal(txn)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treq, err := http.NewRequest(http.MethodPost, uri, bytes.NewBuffer(txnBytes))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tresp, err := client.performRequest(req, string(txnBytes))\n\treturn resp, err\n}", "func (ocb *OAuth2ClientCreateBulk) Save(ctx context.Context) ([]*OAuth2Client, error) {\n\tspecs := make([]*sqlgraph.CreateSpec, len(ocb.builders))\n\tnodes := make([]*OAuth2Client, len(ocb.builders))\n\tmutators := make([]Mutator, len(ocb.builders))\n\tfor i := range ocb.builders {\n\t\tfunc(i int, root context.Context) {\n\t\t\tbuilder := ocb.builders[i]\n\t\t\tvar mut Mutator = MutateFunc(func(ctx context.Context, m Mutation) (Value, error) {\n\t\t\t\tmutation, ok := m.(*OAuth2ClientMutation)\n\t\t\t\tif !ok {\n\t\t\t\t\treturn nil, fmt.Errorf(\"unexpected mutation type %T\", m)\n\t\t\t\t}\n\t\t\t\tif err := builder.check(); err != nil {\n\t\t\t\t\treturn nil, err\n\t\t\t\t}\n\t\t\t\tbuilder.mutation = mutation\n\t\t\t\tvar err error\n\t\t\t\tnodes[i], specs[i] = builder.createSpec()\n\t\t\t\tif i < len(mutators)-1 {\n\t\t\t\t\t_, err = mutators[i+1].Mutate(root, ocb.builders[i+1].mutation)\n\t\t\t\t} else {\n\t\t\t\t\tspec := &sqlgraph.BatchCreateSpec{Nodes: specs}\n\t\t\t\t\t// Invoke the actual operation on the latest mutation in the chain.\n\t\t\t\t\tif err = sqlgraph.BatchCreate(ctx, ocb.driver, spec); err != nil {\n\t\t\t\t\t\tif sqlgraph.IsConstraintError(err) {\n\t\t\t\t\t\t\terr = &ConstraintError{msg: err.Error(), wrap: err}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn nil, err\n\t\t\t\t}\n\t\t\t\tmutation.id = &nodes[i].ID\n\t\t\t\tmutation.done = true\n\t\t\t\treturn nodes[i], nil\n\t\t\t})\n\t\t\tfor i := len(builder.hooks) - 1; i >= 0; i-- {\n\t\t\t\tmut = builder.hooks[i](mut)\n\t\t\t}\n\t\t\tmutators[i] = mut\n\t\t}(i, ctx)\n\t}\n\tif len(mutators) > 0 {\n\t\tif _, err := mutators[0].Mutate(ctx, ocb.builders[0].mutation); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\treturn nodes, nil\n}", "func (wcb *WordCreateBulk) Save(ctx context.Context) ([]*Word, error) {\n\tspecs := make([]*sqlgraph.CreateSpec, len(wcb.builders))\n\tnodes := make([]*Word, len(wcb.builders))\n\tmutators := make([]Mutator, len(wcb.builders))\n\tfor i := range wcb.builders {\n\t\tfunc(i int, root context.Context) {\n\t\t\tbuilder := wcb.builders[i]\n\t\t\tbuilder.defaults()\n\t\t\tvar mut Mutator = MutateFunc(func(ctx context.Context, m Mutation) (Value, error) {\n\t\t\t\tmutation, ok := m.(*WordMutation)\n\t\t\t\tif !ok {\n\t\t\t\t\treturn nil, fmt.Errorf(\"unexpected mutation type %T\", m)\n\t\t\t\t}\n\t\t\t\tif err := builder.check(); err != nil {\n\t\t\t\t\treturn nil, err\n\t\t\t\t}\n\t\t\t\tbuilder.mutation = mutation\n\t\t\t\tnodes[i], specs[i] = builder.createSpec()\n\t\t\t\tvar err error\n\t\t\t\tif i < len(mutators)-1 {\n\t\t\t\t\t_, err = mutators[i+1].Mutate(root, wcb.builders[i+1].mutation)\n\t\t\t\t} else {\n\t\t\t\t\t// Invoke the actual operation on the latest mutation in the chain.\n\t\t\t\t\tif err = sqlgraph.BatchCreate(ctx, wcb.driver, &sqlgraph.BatchCreateSpec{Nodes: specs}); err != nil {\n\t\t\t\t\t\tif cerr, ok := isSQLConstraintError(err); ok {\n\t\t\t\t\t\t\terr = cerr\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tmutation.done = true\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn nil, err\n\t\t\t\t}\n\t\t\t\tid := specs[i].ID.Value.(int64)\n\t\t\t\tnodes[i].ID = int(id)\n\t\t\t\treturn nodes[i], nil\n\t\t\t})\n\t\t\tfor i := len(builder.hooks) - 1; i >= 0; i-- {\n\t\t\t\tmut = builder.hooks[i](mut)\n\t\t\t}\n\t\t\tmutators[i] = mut\n\t\t}(i, ctx)\n\t}\n\tif len(mutators) > 0 {\n\t\tif _, err := mutators[0].Mutate(ctx, wcb.builders[0].mutation); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\treturn nodes, nil\n}", "func (epcb *EntryPointCreateBulk) Save(ctx context.Context) ([]*EntryPoint, error) {\n\tspecs := make([]*sqlgraph.CreateSpec, len(epcb.builders))\n\tnodes := make([]*EntryPoint, len(epcb.builders))\n\tmutators := make([]Mutator, len(epcb.builders))\n\tfor i := range epcb.builders {\n\t\tfunc(i int, root context.Context) {\n\t\t\tbuilder := epcb.builders[i]\n\t\t\tbuilder.defaults()\n\t\t\tvar mut Mutator = MutateFunc(func(ctx context.Context, m Mutation) (Value, error) {\n\t\t\t\tmutation, ok := m.(*EntryPointMutation)\n\t\t\t\tif !ok {\n\t\t\t\t\treturn nil, fmt.Errorf(\"unexpected mutation type %T\", m)\n\t\t\t\t}\n\t\t\t\tif err := builder.check(); err != nil {\n\t\t\t\t\treturn nil, err\n\t\t\t\t}\n\t\t\t\tbuilder.mutation = mutation\n\t\t\t\tnodes[i], specs[i] = builder.createSpec()\n\t\t\t\tvar err error\n\t\t\t\tif i < len(mutators)-1 {\n\t\t\t\t\t_, err = mutators[i+1].Mutate(root, epcb.builders[i+1].mutation)\n\t\t\t\t} else {\n\t\t\t\t\t// Invoke the actual operation on the latest mutation in the chain.\n\t\t\t\t\tif err = sqlgraph.BatchCreate(ctx, epcb.driver, &sqlgraph.BatchCreateSpec{Nodes: specs}); err != nil {\n\t\t\t\t\t\tif cerr, ok := isSQLConstraintError(err); ok {\n\t\t\t\t\t\t\terr = cerr\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tmutation.done = true\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn nil, err\n\t\t\t\t}\n\t\t\t\tid := specs[i].ID.Value.(int64)\n\t\t\t\tnodes[i].ID = int(id)\n\t\t\t\treturn nodes[i], nil\n\t\t\t})\n\t\t\tfor i := len(builder.hooks) - 1; i >= 0; i-- {\n\t\t\t\tmut = builder.hooks[i](mut)\n\t\t\t}\n\t\t\tmutators[i] = mut\n\t\t}(i, ctx)\n\t}\n\tif len(mutators) > 0 {\n\t\tif _, err := mutators[0].Mutate(ctx, epcb.builders[0].mutation); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\treturn nodes, nil\n}", "func (a *BulkApiService) CreateBulkMoDeepCloner(ctx context.Context) ApiCreateBulkMoDeepClonerRequest {\n\treturn ApiCreateBulkMoDeepClonerRequest{\n\t\tApiService: a,\n\t\tctx: ctx,\n\t}\n}", "func (m *MockSubjectRoleManager) BulkCreate(roles []dao.SubjectRole) error {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"BulkCreate\", roles)\n\tret0, _ := ret[0].(error)\n\treturn ret0\n}", "func (lcb *LoggerCreateBulk) Save(ctx context.Context) ([]*Logger, error) {\n\tspecs := make([]*sqlgraph.CreateSpec, len(lcb.builders))\n\tnodes := make([]*Logger, len(lcb.builders))\n\tmutators := make([]Mutator, len(lcb.builders))\n\tfor i := range lcb.builders {\n\t\tfunc(i int, root context.Context) {\n\t\t\tbuilder := lcb.builders[i]\n\t\t\tbuilder.defaults()\n\t\t\tvar mut Mutator = MutateFunc(func(ctx context.Context, m Mutation) (Value, error) {\n\t\t\t\tmutation, ok := m.(*LoggerMutation)\n\t\t\t\tif !ok {\n\t\t\t\t\treturn nil, fmt.Errorf(\"unexpected mutation type %T\", m)\n\t\t\t\t}\n\t\t\t\tif err := builder.check(); err != nil {\n\t\t\t\t\treturn nil, err\n\t\t\t\t}\n\t\t\t\tbuilder.mutation = mutation\n\t\t\t\tnodes[i], specs[i] = builder.createSpec()\n\t\t\t\tvar err error\n\t\t\t\tif i < len(mutators)-1 {\n\t\t\t\t\t_, err = mutators[i+1].Mutate(root, lcb.builders[i+1].mutation)\n\t\t\t\t} else {\n\t\t\t\t\t// Invoke the actual operation on the latest mutation in the chain.\n\t\t\t\t\tif err = sqlgraph.BatchCreate(ctx, lcb.driver, &sqlgraph.BatchCreateSpec{Nodes: specs}); err != nil {\n\t\t\t\t\t\tif cerr, ok := isSQLConstraintError(err); ok {\n\t\t\t\t\t\t\terr = cerr\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tmutation.done = true\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn nil, err\n\t\t\t\t}\n\t\t\t\tif nodes[i].ID == 0 {\n\t\t\t\t\tid := specs[i].ID.Value.(int64)\n\t\t\t\t\tnodes[i].ID = int(id)\n\t\t\t\t}\n\t\t\t\treturn nodes[i], nil\n\t\t\t})\n\t\t\tfor i := len(builder.hooks) - 1; i >= 0; i-- {\n\t\t\t\tmut = builder.hooks[i](mut)\n\t\t\t}\n\t\t\tmutators[i] = mut\n\t\t}(i, ctx)\n\t}\n\tif len(mutators) > 0 {\n\t\tif _, err := mutators[0].Mutate(ctx, lcb.builders[0].mutation); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\treturn nodes, nil\n}", "func (a *DefaultApiService) BulkCreateExecute(r ApiBulkCreateRequest) (BulkCreateResponse, *_nethttp.Response, GenericOpenAPIError) {\n\tvar (\n\t\tlocalVarHTTPMethod = _nethttp.MethodPost\n\t\tlocalVarPostBody interface{}\n\t\tlocalVarFormFileName string\n\t\tlocalVarFileName string\n\t\tlocalVarFileBytes []byte\n\t\texecutionError GenericOpenAPIError\n\t\tlocalVarReturnValue BulkCreateResponse\n\t)\n\n\tlocalBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, \"DefaultApiService.BulkCreate\")\n\tif err != nil {\n\t\texecutionError.error = err.Error()\n\t\treturn localVarReturnValue, nil, executionError\n\t}\n\n\tlocalVarPath := localBasePath + \"/bulk_create\"\n\n\tlocalVarHeaderParams := make(map[string]string)\n\tlocalVarQueryParams := _neturl.Values{}\n\tlocalVarFormParams := _neturl.Values{}\n\n\t// to determine the Content-Type header\n\tlocalVarHTTPContentTypes := []string{\"application/json\"}\n\n\t// set Content-Type header\n\tlocalVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)\n\tif localVarHTTPContentType != \"\" {\n\t\tlocalVarHeaderParams[\"Content-Type\"] = localVarHTTPContentType\n\t}\n\n\t// to determine the Accept header\n\tlocalVarHTTPHeaderAccepts := []string{\"application/json\"}\n\n\t// set Accept header\n\tlocalVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)\n\tif localVarHTTPHeaderAccept != \"\" {\n\t\tlocalVarHeaderParams[\"Accept\"] = localVarHTTPHeaderAccept\n\t}\n\t// body params\n\tlocalVarPostBody = r.bulkCreatePayload\n\treq, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)\n\tif err != nil {\n\t\texecutionError.error = err.Error()\n\t\treturn localVarReturnValue, nil, executionError\n\t}\n\n\tlocalVarHTTPResponse, err := a.client.callAPI(req)\n\tif err != nil || localVarHTTPResponse == nil {\n\t\texecutionError.error = err.Error()\n\t\treturn localVarReturnValue, localVarHTTPResponse, executionError\n\t}\n\n\tlocalVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body)\n\tlocalVarHTTPResponse.Body.Close()\n\tlocalVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody))\n\tif err != nil {\n\t\texecutionError.error = err.Error()\n\t\treturn localVarReturnValue, localVarHTTPResponse, executionError\n\t}\n\n\tif localVarHTTPResponse.StatusCode >= 300 {\n\t\tnewErr := GenericOpenAPIError{\n\t\t\tbody: localVarBody,\n\t\t\terror: localVarHTTPResponse.Status,\n\t\t}\n\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t}\n\n\terr = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\tif err != nil {\n\t\tnewErr := GenericOpenAPIError{\n\t\t\tbody: localVarBody,\n\t\t\terror: err.Error(),\n\t\t}\n\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t}\n\n\treturn localVarReturnValue, localVarHTTPResponse, executionError\n}", "func (hcb *HarborCreateBulk) Save(ctx context.Context) ([]*Harbor, error) {\n\tspecs := make([]*sqlgraph.CreateSpec, len(hcb.builders))\n\tnodes := make([]*Harbor, len(hcb.builders))\n\tmutators := make([]Mutator, len(hcb.builders))\n\tfor i := range hcb.builders {\n\t\tfunc(i int, root context.Context) {\n\t\t\tbuilder := hcb.builders[i]\n\t\t\tvar mut Mutator = MutateFunc(func(ctx context.Context, m Mutation) (Value, error) {\n\t\t\t\tmutation, ok := m.(*HarborMutation)\n\t\t\t\tif !ok {\n\t\t\t\t\treturn nil, fmt.Errorf(\"unexpected mutation type %T\", m)\n\t\t\t\t}\n\t\t\t\tif err := builder.check(); err != nil {\n\t\t\t\t\treturn nil, err\n\t\t\t\t}\n\t\t\t\tbuilder.mutation = mutation\n\t\t\t\tnodes[i], specs[i] = builder.createSpec()\n\t\t\t\tvar err error\n\t\t\t\tif i < len(mutators)-1 {\n\t\t\t\t\t_, err = mutators[i+1].Mutate(root, hcb.builders[i+1].mutation)\n\t\t\t\t} else {\n\t\t\t\t\t// Invoke the actual operation on the latest mutation in the chain.\n\t\t\t\t\tif err = sqlgraph.BatchCreate(ctx, hcb.driver, &sqlgraph.BatchCreateSpec{Nodes: specs}); err != nil {\n\t\t\t\t\t\tif cerr, ok := isSQLConstraintError(err); ok {\n\t\t\t\t\t\t\terr = cerr\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tmutation.done = true\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn nil, err\n\t\t\t\t}\n\t\t\t\tid := specs[i].ID.Value.(int64)\n\t\t\t\tnodes[i].ID = int(id)\n\t\t\t\treturn nodes[i], nil\n\t\t\t})\n\t\t\tfor i := len(builder.hooks) - 1; i >= 0; i-- {\n\t\t\t\tmut = builder.hooks[i](mut)\n\t\t\t}\n\t\t\tmutators[i] = mut\n\t\t}(i, ctx)\n\t}\n\tif len(mutators) > 0 {\n\t\tif _, err := mutators[0].Mutate(ctx, hcb.builders[0].mutation); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\treturn nodes, nil\n}", "func (dcb *DatasourceCreateBulk) Save(ctx context.Context) ([]*Datasource, error) {\n\tspecs := make([]*sqlgraph.CreateSpec, len(dcb.builders))\n\tnodes := make([]*Datasource, len(dcb.builders))\n\tmutators := make([]Mutator, len(dcb.builders))\n\tfor i := range dcb.builders {\n\t\tfunc(i int, root context.Context) {\n\t\t\tbuilder := dcb.builders[i]\n\t\t\tbuilder.defaults()\n\t\t\tvar mut Mutator = MutateFunc(func(ctx context.Context, m Mutation) (Value, error) {\n\t\t\t\tmutation, ok := m.(*DatasourceMutation)\n\t\t\t\tif !ok {\n\t\t\t\t\treturn nil, fmt.Errorf(\"unexpected mutation type %T\", m)\n\t\t\t\t}\n\t\t\t\tif err := builder.check(); err != nil {\n\t\t\t\t\treturn nil, err\n\t\t\t\t}\n\t\t\t\tbuilder.mutation = mutation\n\t\t\t\tnodes[i], specs[i] = builder.createSpec()\n\t\t\t\tvar err error\n\t\t\t\tif i < len(mutators)-1 {\n\t\t\t\t\t_, err = mutators[i+1].Mutate(root, dcb.builders[i+1].mutation)\n\t\t\t\t} else {\n\t\t\t\t\t// Invoke the actual operation on the latest mutation in the chain.\n\t\t\t\t\tif err = sqlgraph.BatchCreate(ctx, dcb.driver, &sqlgraph.BatchCreateSpec{Nodes: specs}); err != nil {\n\t\t\t\t\t\tif cerr, ok := isSQLConstraintError(err); ok {\n\t\t\t\t\t\t\terr = cerr\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tmutation.done = true\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn nil, err\n\t\t\t\t}\n\t\t\t\tif nodes[i].ID == 0 {\n\t\t\t\t\tid := specs[i].ID.Value.(int64)\n\t\t\t\t\tnodes[i].ID = int64(id)\n\t\t\t\t}\n\t\t\t\treturn nodes[i], nil\n\t\t\t})\n\t\t\tfor i := len(builder.hooks) - 1; i >= 0; i-- {\n\t\t\t\tmut = builder.hooks[i](mut)\n\t\t\t}\n\t\t\tmutators[i] = mut\n\t\t}(i, ctx)\n\t}\n\tif len(mutators) > 0 {\n\t\tif _, err := mutators[0].Mutate(ctx, dcb.builders[0].mutation); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\treturn nodes, nil\n}", "func (wcb *WritelogCreateBulk) Save(ctx context.Context) ([]*Writelog, error) {\n\tspecs := make([]*sqlgraph.CreateSpec, len(wcb.builders))\n\tnodes := make([]*Writelog, len(wcb.builders))\n\tmutators := make([]Mutator, len(wcb.builders))\n\tfor i := range wcb.builders {\n\t\tfunc(i int, root context.Context) {\n\t\t\tbuilder := wcb.builders[i]\n\t\t\tvar mut Mutator = MutateFunc(func(ctx context.Context, m Mutation) (Value, error) {\n\t\t\t\tmutation, ok := m.(*WritelogMutation)\n\t\t\t\tif !ok {\n\t\t\t\t\treturn nil, fmt.Errorf(\"unexpected mutation type %T\", m)\n\t\t\t\t}\n\t\t\t\tif err := builder.check(); err != nil {\n\t\t\t\t\treturn nil, err\n\t\t\t\t}\n\t\t\t\tbuilder.mutation = mutation\n\t\t\t\tnodes[i], specs[i] = builder.createSpec()\n\t\t\t\tvar err error\n\t\t\t\tif i < len(mutators)-1 {\n\t\t\t\t\t_, err = mutators[i+1].Mutate(root, wcb.builders[i+1].mutation)\n\t\t\t\t} else {\n\t\t\t\t\t// Invoke the actual operation on the latest mutation in the chain.\n\t\t\t\t\tif err = sqlgraph.BatchCreate(ctx, wcb.driver, &sqlgraph.BatchCreateSpec{Nodes: specs}); err != nil {\n\t\t\t\t\t\tif cerr, ok := isSQLConstraintError(err); ok {\n\t\t\t\t\t\t\terr = cerr\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tmutation.done = true\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn nil, err\n\t\t\t\t}\n\t\t\t\tif nodes[i].ID == 0 {\n\t\t\t\t\tid := specs[i].ID.Value.(int64)\n\t\t\t\t\tnodes[i].ID = int(id)\n\t\t\t\t}\n\t\t\t\treturn nodes[i], nil\n\t\t\t})\n\t\t\tfor i := len(builder.hooks) - 1; i >= 0; i-- {\n\t\t\t\tmut = builder.hooks[i](mut)\n\t\t\t}\n\t\t\tmutators[i] = mut\n\t\t}(i, ctx)\n\t}\n\tif len(mutators) > 0 {\n\t\tif _, err := mutators[0].Mutate(ctx, wcb.builders[0].mutation); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\treturn nodes, nil\n}", "func (mcb *MenuCreateBulk) Save(ctx context.Context) ([]*Menu, error) {\n\tspecs := make([]*sqlgraph.CreateSpec, len(mcb.builders))\n\tnodes := make([]*Menu, len(mcb.builders))\n\tmutators := make([]Mutator, len(mcb.builders))\n\tfor i := range mcb.builders {\n\t\tfunc(i int, root context.Context) {\n\t\t\tbuilder := mcb.builders[i]\n\t\t\tbuilder.defaults()\n\t\t\tvar mut Mutator = MutateFunc(func(ctx context.Context, m Mutation) (Value, error) {\n\t\t\t\tmutation, ok := m.(*MenuMutation)\n\t\t\t\tif !ok {\n\t\t\t\t\treturn nil, fmt.Errorf(\"unexpected mutation type %T\", m)\n\t\t\t\t}\n\t\t\t\tif err := builder.check(); err != nil {\n\t\t\t\t\treturn nil, err\n\t\t\t\t}\n\t\t\t\tbuilder.mutation = mutation\n\t\t\t\tnodes[i], specs[i] = builder.createSpec()\n\t\t\t\tvar err error\n\t\t\t\tif i < len(mutators)-1 {\n\t\t\t\t\t_, err = mutators[i+1].Mutate(root, mcb.builders[i+1].mutation)\n\t\t\t\t} else {\n\t\t\t\t\t// Invoke the actual operation on the latest mutation in the chain.\n\t\t\t\t\tif err = sqlgraph.BatchCreate(ctx, mcb.driver, &sqlgraph.BatchCreateSpec{Nodes: specs}); err != nil {\n\t\t\t\t\t\tif cerr, ok := isSQLConstraintError(err); ok {\n\t\t\t\t\t\t\terr = cerr\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tmutation.done = true\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn nil, err\n\t\t\t\t}\n\t\t\t\treturn nodes[i], nil\n\t\t\t})\n\t\t\tfor i := len(builder.hooks) - 1; i >= 0; i-- {\n\t\t\t\tmut = builder.hooks[i](mut)\n\t\t\t}\n\t\t\tmutators[i] = mut\n\t\t}(i, ctx)\n\t}\n\tif len(mutators) > 0 {\n\t\tif _, err := mutators[0].Mutate(ctx, mcb.builders[0].mutation); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\treturn nodes, nil\n}", "func (c *Client) BulkSend(documents []Document) (*Response, error) {\n\t// We do not generate a traditional JSON here (often a one liner)\n\t// Elasticsearch expects one line of JSON per line (EOL = \\n)\n\t// plus an extra \\n at the very end of the document\n\t//\n\t// More informations about the Bulk JSON format for Elasticsearch:\n\t//\n\t// - http://www.elasticsearch.org/guide/reference/api/bulk.html\n\t//\n\t// This is quite annoying for us as we can not use the simple JSON\n\t// Marshaler available in Run().\n\t//\n\t// We have to generate this special JSON by ourselves which leads to\n\t// the code below.\n\t//\n\t// I know it is unreadable I must find an elegant way to fix this.\n\n\t// len(documents) * 2 : action + optional_sources\n\t// + 1 : room for the trailing \\n\n\tbulkData := make([][]byte, 0, len(documents)*2+1)\n\ti := 0\n\n\tfor _, doc := range documents {\n\t\taction, err := json.Marshal(map[string]interface{}{\n\t\t\tdoc.BulkCommand: map[string]interface{}{\n\t\t\t\t\"_index\": doc.Index,\n\t\t\t\t\"_type\": doc.Type,\n\t\t\t\t\"_id\": doc.ID,\n\t\t\t},\n\t\t})\n\n\t\tif err != nil {\n\t\t\treturn &Response{}, err\n\t\t}\n\n\t\tbulkData = append(bulkData, action)\n\t\ti++\n\n\t\tif doc.Fields != nil {\n\t\t\tif docFields, ok := doc.Fields.(map[string]interface{}); ok {\n\t\t\t\tif len(docFields) == 0 {\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\ttypeOfFields := reflect.TypeOf(doc.Fields)\n\t\t\t\tif typeOfFields.Kind() == reflect.Ptr {\n\t\t\t\t\ttypeOfFields = typeOfFields.Elem()\n\t\t\t\t}\n\t\t\t\tif typeOfFields.Kind() != reflect.Struct {\n\t\t\t\t\treturn &Response{}, fmt.Errorf(\"Document fields not in struct or map[string]interface{} format\")\n\t\t\t\t}\n\t\t\t\tif typeOfFields.NumField() == 0 {\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tsources, err := json.Marshal(doc.Fields)\n\t\t\tif err != nil {\n\t\t\t\treturn &Response{}, err\n\t\t\t}\n\n\t\t\tbulkData = append(bulkData, sources)\n\t\t\ti++\n\t\t}\n\t}\n\n\t// forces an extra trailing \\n absolutely necessary for elasticsearch\n\tbulkData = append(bulkData, []byte(nil))\n\n\tr := Request{\n\t\tMethod: \"POST\",\n\t\tAPI: \"_bulk\",\n\t\tBulkData: bytes.Join(bulkData, []byte(\"\\n\")),\n\t}\n\n\tresp, err := c.Do(&r)\n\tif err != nil {\n\t\treturn resp, err\n\t}\n\n\tif resp.Errors {\n\t\tfor _, item := range resp.Items {\n\t\t\tfor _, i := range item {\n\t\t\t\tif i.Error != \"\" {\n\t\t\t\t\treturn resp, &SearchError{i.Error, i.Status}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn resp, &SearchError{Msg: \"Unknown error while bulk indexing\"}\n\t}\n\n\treturn resp, err\n}", "func (*SecretsManagerV2) NewCreateSecretLocksBulkOptions(id string, locks []SecretLockPrototype) *CreateSecretLocksBulkOptions {\n\treturn &CreateSecretLocksBulkOptions{\n\t\tID: core.StringPtr(id),\n\t\tLocks: locks,\n\t}\n}", "func (rcb *RentalCreateBulk) Save(ctx context.Context) ([]*Rental, error) {\n\tspecs := make([]*sqlgraph.CreateSpec, len(rcb.builders))\n\tnodes := make([]*Rental, len(rcb.builders))\n\tmutators := make([]Mutator, len(rcb.builders))\n\tfor i := range rcb.builders {\n\t\tfunc(i int, root context.Context) {\n\t\t\tbuilder := rcb.builders[i]\n\t\t\tbuilder.defaults()\n\t\t\tvar mut Mutator = MutateFunc(func(ctx context.Context, m Mutation) (Value, error) {\n\t\t\t\tmutation, ok := m.(*RentalMutation)\n\t\t\t\tif !ok {\n\t\t\t\t\treturn nil, fmt.Errorf(\"unexpected mutation type %T\", m)\n\t\t\t\t}\n\t\t\t\tif err := builder.check(); err != nil {\n\t\t\t\t\treturn nil, err\n\t\t\t\t}\n\t\t\t\tbuilder.mutation = mutation\n\t\t\t\tnodes[i], specs[i] = builder.createSpec()\n\t\t\t\tvar err error\n\t\t\t\tif i < len(mutators)-1 {\n\t\t\t\t\t_, err = mutators[i+1].Mutate(root, rcb.builders[i+1].mutation)\n\t\t\t\t} else {\n\t\t\t\t\tspec := &sqlgraph.BatchCreateSpec{Nodes: specs}\n\t\t\t\t\t// Invoke the actual operation on the latest mutation in the chain.\n\t\t\t\t\tif err = sqlgraph.BatchCreate(ctx, rcb.driver, spec); err != nil {\n\t\t\t\t\t\tif sqlgraph.IsConstraintError(err) {\n\t\t\t\t\t\t\terr = &ConstraintError{msg: err.Error(), wrap: err}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn nil, err\n\t\t\t\t}\n\t\t\t\tmutation.id = &nodes[i].ID\n\t\t\t\tif specs[i].ID.Value != nil {\n\t\t\t\t\tid := specs[i].ID.Value.(int64)\n\t\t\t\t\tnodes[i].ID = int(id)\n\t\t\t\t}\n\t\t\t\tmutation.done = true\n\t\t\t\treturn nodes[i], nil\n\t\t\t})\n\t\t\tfor i := len(builder.hooks) - 1; i >= 0; i-- {\n\t\t\t\tmut = builder.hooks[i](mut)\n\t\t\t}\n\t\t\tmutators[i] = mut\n\t\t}(i, ctx)\n\t}\n\tif len(mutators) > 0 {\n\t\tif _, err := mutators[0].Mutate(ctx, rcb.builders[0].mutation); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\treturn nodes, nil\n}", "func (ccb *CustomerCreateBulk) Save(ctx context.Context) ([]*Customer, error) {\n\tspecs := make([]*sqlgraph.CreateSpec, len(ccb.builders))\n\tnodes := make([]*Customer, len(ccb.builders))\n\tmutators := make([]Mutator, len(ccb.builders))\n\tfor i := range ccb.builders {\n\t\tfunc(i int, root context.Context) {\n\t\t\tbuilder := ccb.builders[i]\n\t\t\tbuilder.defaults()\n\t\t\tvar mut Mutator = MutateFunc(func(ctx context.Context, m Mutation) (Value, error) {\n\t\t\t\tmutation, ok := m.(*CustomerMutation)\n\t\t\t\tif !ok {\n\t\t\t\t\treturn nil, fmt.Errorf(\"unexpected mutation type %T\", m)\n\t\t\t\t}\n\t\t\t\tif err := builder.check(); err != nil {\n\t\t\t\t\treturn nil, err\n\t\t\t\t}\n\t\t\t\tbuilder.mutation = mutation\n\t\t\t\tnodes[i], specs[i] = builder.createSpec()\n\t\t\t\tvar err error\n\t\t\t\tif i < len(mutators)-1 {\n\t\t\t\t\t_, err = mutators[i+1].Mutate(root, ccb.builders[i+1].mutation)\n\t\t\t\t} else {\n\t\t\t\t\t// Invoke the actual operation on the latest mutation in the chain.\n\t\t\t\t\tif err = sqlgraph.BatchCreate(ctx, ccb.driver, &sqlgraph.BatchCreateSpec{Nodes: specs}); err != nil {\n\t\t\t\t\t\tif cerr, ok := isSQLConstraintError(err); ok {\n\t\t\t\t\t\t\terr = cerr\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tmutation.done = true\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn nil, err\n\t\t\t\t}\n\t\t\t\tid := specs[i].ID.Value.(int64)\n\t\t\t\tnodes[i].ID = int(id)\n\t\t\t\treturn nodes[i], nil\n\t\t\t})\n\t\t\tfor i := len(builder.hooks) - 1; i >= 0; i-- {\n\t\t\t\tmut = builder.hooks[i](mut)\n\t\t\t}\n\t\t\tmutators[i] = mut\n\t\t}(i, ctx)\n\t}\n\tif len(mutators) > 0 {\n\t\tif _, err := mutators[0].Mutate(ctx, ccb.builders[0].mutation); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\treturn nodes, nil\n}", "func AdminIndex(c *cli.Context) {\n\tesClient := getESClient(c)\n\tindexName := getRequiredOption(c, FlagIndex)\n\tinputFileName := getRequiredOption(c, FlagInputFile)\n\tbatchSize := c.Int(FlagBatchSize)\n\n\tmessages, err := parseIndexerMessage(inputFileName)\n\tif err != nil {\n\t\tErrorAndExit(\"Unable to parse indexer message\", err)\n\t}\n\n\tbulkRequest := esClient.Bulk()\n\tbulkConductFn := func() {\n\t\t_, err := bulkRequest.Do(context.Background())\n\t\tif err != nil {\n\t\t\tErrorAndExit(\"Bulk failed\", err)\n\t\t}\n\t\tif bulkRequest.NumberOfActions() != 0 {\n\t\t\tErrorAndExit(fmt.Sprintf(\"Bulk request not done, %d\", bulkRequest.NumberOfActions()), err)\n\t\t}\n\t}\n\tfor i, message := range messages {\n\t\tdocID := message.GetWorkflowID() + esDocIDDelimiter + message.GetRunID()\n\t\tvar req elastic.BulkableRequest\n\t\tswitch message.GetMessageType() {\n\t\tcase indexer.MessageTypeIndex:\n\t\t\tdoc := generateESDoc(message)\n\t\t\treq = elastic.NewBulkIndexRequest().\n\t\t\t\tIndex(indexName).\n\t\t\t\tType(esDocType).\n\t\t\t\tId(docID).\n\t\t\t\tVersionType(versionTypeExternal).\n\t\t\t\tVersion(message.GetVersion()).\n\t\t\t\tDoc(doc)\n\t\tcase indexer.MessageTypeDelete:\n\t\t\treq = elastic.NewBulkDeleteRequest().\n\t\t\t\tIndex(indexName).\n\t\t\t\tType(esDocType).\n\t\t\t\tId(docID).\n\t\t\t\tVersionType(versionTypeExternal).\n\t\t\t\tVersion(message.GetVersion())\n\t\tdefault:\n\t\t\tErrorAndExit(\"Unknown message type\", nil)\n\t\t}\n\t\tbulkRequest.Add(req)\n\n\t\tif i%batchSize == batchSize-1 {\n\t\t\tbulkConductFn()\n\t\t}\n\t}\n\tif bulkRequest.NumberOfActions() != 0 {\n\t\tbulkConductFn()\n\t}\n}", "func (icb *ItemCreateBulk) Save(ctx context.Context) ([]*Item, error) {\n\tspecs := make([]*sqlgraph.CreateSpec, len(icb.builders))\n\tnodes := make([]*Item, len(icb.builders))\n\tmutators := make([]Mutator, len(icb.builders))\n\tfor i := range icb.builders {\n\t\tfunc(i int, root context.Context) {\n\t\t\tbuilder := icb.builders[i]\n\t\t\tbuilder.defaults()\n\t\t\tvar mut Mutator = MutateFunc(func(ctx context.Context, m Mutation) (Value, error) {\n\t\t\t\tmutation, ok := m.(*ItemMutation)\n\t\t\t\tif !ok {\n\t\t\t\t\treturn nil, fmt.Errorf(\"unexpected mutation type %T\", m)\n\t\t\t\t}\n\t\t\t\tif err := builder.check(); err != nil {\n\t\t\t\t\treturn nil, err\n\t\t\t\t}\n\t\t\t\tbuilder.mutation = mutation\n\t\t\t\tnodes[i], specs[i] = builder.createSpec()\n\t\t\t\tvar err error\n\t\t\t\tif i < len(mutators)-1 {\n\t\t\t\t\t_, err = mutators[i+1].Mutate(root, icb.builders[i+1].mutation)\n\t\t\t\t} else {\n\t\t\t\t\tspec := &sqlgraph.BatchCreateSpec{Nodes: specs}\n\t\t\t\t\tspec.OnConflict = icb.conflict\n\t\t\t\t\t// Invoke the actual operation on the latest mutation in the chain.\n\t\t\t\t\tif err = sqlgraph.BatchCreate(ctx, icb.driver, spec); err != nil {\n\t\t\t\t\t\tif sqlgraph.IsConstraintError(err) {\n\t\t\t\t\t\t\terr = &ConstraintError{msg: err.Error(), wrap: err}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn nil, err\n\t\t\t\t}\n\t\t\t\tmutation.id = &nodes[i].ID\n\t\t\t\tmutation.done = true\n\t\t\t\treturn nodes[i], nil\n\t\t\t})\n\t\t\tfor i := len(builder.hooks) - 1; i >= 0; i-- {\n\t\t\t\tmut = builder.hooks[i](mut)\n\t\t\t}\n\t\t\tmutators[i] = mut\n\t\t}(i, ctx)\n\t}\n\tif len(mutators) > 0 {\n\t\tif _, err := mutators[0].Mutate(ctx, icb.builders[0].mutation); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\treturn nodes, nil\n}", "func (acb *AppCreateBulk) Save(ctx context.Context) ([]*App, error) {\n\tspecs := make([]*sqlgraph.CreateSpec, len(acb.builders))\n\tnodes := make([]*App, len(acb.builders))\n\tmutators := make([]Mutator, len(acb.builders))\n\tfor i := range acb.builders {\n\t\tfunc(i int, root context.Context) {\n\t\t\tbuilder := acb.builders[i]\n\t\t\tvar mut Mutator = MutateFunc(func(ctx context.Context, m Mutation) (Value, error) {\n\t\t\t\tif err := builder.preSave(); err != nil {\n\t\t\t\t\treturn nil, err\n\t\t\t\t}\n\t\t\t\tmutation, ok := m.(*AppMutation)\n\t\t\t\tif !ok {\n\t\t\t\t\treturn nil, fmt.Errorf(\"unexpected mutation type %T\", m)\n\t\t\t\t}\n\t\t\t\tbuilder.mutation = mutation\n\t\t\t\tnodes[i], specs[i] = builder.createSpec()\n\t\t\t\tvar err error\n\t\t\t\tif i < len(mutators)-1 {\n\t\t\t\t\t_, err = mutators[i+1].Mutate(root, acb.builders[i+1].mutation)\n\t\t\t\t} else {\n\t\t\t\t\t// Invoke the actual operation on the latest mutation in the chain.\n\t\t\t\t\tif err = sqlgraph.BatchCreate(ctx, acb.driver, &sqlgraph.BatchCreateSpec{Nodes: specs}); err != nil {\n\t\t\t\t\t\tif cerr, ok := isSQLConstraintError(err); ok {\n\t\t\t\t\t\t\terr = cerr\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tmutation.done = true\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn nil, err\n\t\t\t\t}\n\t\t\t\tid := specs[i].ID.Value.(int64)\n\t\t\t\tnodes[i].ID = int(id)\n\t\t\t\treturn nodes[i], nil\n\t\t\t})\n\t\t\tfor i := len(builder.hooks) - 1; i >= 0; i-- {\n\t\t\t\tmut = builder.hooks[i](mut)\n\t\t\t}\n\t\t\tmutators[i] = mut\n\t\t}(i, ctx)\n\t}\n\tif len(mutators) > 0 {\n\t\tif _, err := mutators[0].Mutate(ctx, acb.builders[0].mutation); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\treturn nodes, nil\n}", "func (drcb *DeviceRequestCreateBulk) Save(ctx context.Context) ([]*DeviceRequest, error) {\n\tspecs := make([]*sqlgraph.CreateSpec, len(drcb.builders))\n\tnodes := make([]*DeviceRequest, len(drcb.builders))\n\tmutators := make([]Mutator, len(drcb.builders))\n\tfor i := range drcb.builders {\n\t\tfunc(i int, root context.Context) {\n\t\t\tbuilder := drcb.builders[i]\n\t\t\tvar mut Mutator = MutateFunc(func(ctx context.Context, m Mutation) (Value, error) {\n\t\t\t\tmutation, ok := m.(*DeviceRequestMutation)\n\t\t\t\tif !ok {\n\t\t\t\t\treturn nil, fmt.Errorf(\"unexpected mutation type %T\", m)\n\t\t\t\t}\n\t\t\t\tif err := builder.check(); err != nil {\n\t\t\t\t\treturn nil, err\n\t\t\t\t}\n\t\t\t\tbuilder.mutation = mutation\n\t\t\t\tvar err error\n\t\t\t\tnodes[i], specs[i] = builder.createSpec()\n\t\t\t\tif i < len(mutators)-1 {\n\t\t\t\t\t_, err = mutators[i+1].Mutate(root, drcb.builders[i+1].mutation)\n\t\t\t\t} else {\n\t\t\t\t\tspec := &sqlgraph.BatchCreateSpec{Nodes: specs}\n\t\t\t\t\t// Invoke the actual operation on the latest mutation in the chain.\n\t\t\t\t\tif err = sqlgraph.BatchCreate(ctx, drcb.driver, spec); err != nil {\n\t\t\t\t\t\tif sqlgraph.IsConstraintError(err) {\n\t\t\t\t\t\t\terr = &ConstraintError{msg: err.Error(), wrap: err}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn nil, err\n\t\t\t\t}\n\t\t\t\tmutation.id = &nodes[i].ID\n\t\t\t\tif specs[i].ID.Value != nil {\n\t\t\t\t\tid := specs[i].ID.Value.(int64)\n\t\t\t\t\tnodes[i].ID = int(id)\n\t\t\t\t}\n\t\t\t\tmutation.done = true\n\t\t\t\treturn nodes[i], nil\n\t\t\t})\n\t\t\tfor i := len(builder.hooks) - 1; i >= 0; i-- {\n\t\t\t\tmut = builder.hooks[i](mut)\n\t\t\t}\n\t\t\tmutators[i] = mut\n\t\t}(i, ctx)\n\t}\n\tif len(mutators) > 0 {\n\t\tif _, err := mutators[0].Mutate(ctx, drcb.builders[0].mutation); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\treturn nodes, nil\n}", "func (secretsManager *SecretsManagerV2) CreateSecretLocksBulkWithContext(ctx context.Context, createSecretLocksBulkOptions *CreateSecretLocksBulkOptions) (result *SecretLocks, response *core.DetailedResponse, err error) {\n\terr = core.ValidateNotNil(createSecretLocksBulkOptions, \"createSecretLocksBulkOptions cannot be nil\")\n\tif err != nil {\n\t\treturn\n\t}\n\terr = core.ValidateStruct(createSecretLocksBulkOptions, \"createSecretLocksBulkOptions\")\n\tif err != nil {\n\t\treturn\n\t}\n\n\tpathParamsMap := map[string]string{\n\t\t\"id\": *createSecretLocksBulkOptions.ID,\n\t}\n\n\tbuilder := core.NewRequestBuilder(core.POST)\n\tbuilder = builder.WithContext(ctx)\n\tbuilder.EnableGzipCompression = secretsManager.GetEnableGzipCompression()\n\t_, err = builder.ResolveRequestURL(secretsManager.Service.Options.URL, `/api/v2/secrets/{id}/locks_bulk`, pathParamsMap)\n\tif err != nil {\n\t\treturn\n\t}\n\n\tfor headerName, headerValue := range createSecretLocksBulkOptions.Headers {\n\t\tbuilder.AddHeader(headerName, headerValue)\n\t}\n\n\tsdkHeaders := common.GetSdkHeaders(\"secrets_manager\", \"V2\", \"CreateSecretLocksBulk\")\n\tfor headerName, headerValue := range sdkHeaders {\n\t\tbuilder.AddHeader(headerName, headerValue)\n\t}\n\tbuilder.AddHeader(\"Accept\", \"application/json\")\n\tbuilder.AddHeader(\"Content-Type\", \"application/json\")\n\n\tif createSecretLocksBulkOptions.Mode != nil {\n\t\tbuilder.AddQuery(\"mode\", fmt.Sprint(*createSecretLocksBulkOptions.Mode))\n\t}\n\n\tbody := make(map[string]interface{})\n\tif createSecretLocksBulkOptions.Locks != nil {\n\t\tbody[\"locks\"] = createSecretLocksBulkOptions.Locks\n\t}\n\t_, err = builder.SetBodyContentJSON(body)\n\tif err != nil {\n\t\treturn\n\t}\n\n\trequest, err := builder.Build()\n\tif err != nil {\n\t\treturn\n\t}\n\n\tvar rawResponse map[string]json.RawMessage\n\tresponse, err = secretsManager.Service.Request(request, &rawResponse)\n\tif err != nil {\n\t\treturn\n\t}\n\tif rawResponse != nil {\n\t\terr = core.UnmarshalModel(rawResponse, \"\", &result, UnmarshalSecretLocks)\n\t\tif err != nil {\n\t\t\treturn\n\t\t}\n\t\tresponse.Result = result\n\t}\n\n\treturn\n}", "func (acb *ArticleCreateBulk) Save(ctx context.Context) ([]*Article, error) {\n\tspecs := make([]*sqlgraph.CreateSpec, len(acb.builders))\n\tnodes := make([]*Article, len(acb.builders))\n\tmutators := make([]Mutator, len(acb.builders))\n\tfor i := range acb.builders {\n\t\tfunc(i int, root context.Context) {\n\t\t\tbuilder := acb.builders[i]\n\t\t\tbuilder.defaults()\n\t\t\tvar mut Mutator = MutateFunc(func(ctx context.Context, m Mutation) (Value, error) {\n\t\t\t\tmutation, ok := m.(*ArticleMutation)\n\t\t\t\tif !ok {\n\t\t\t\t\treturn nil, fmt.Errorf(\"unexpected mutation type %T\", m)\n\t\t\t\t}\n\t\t\t\tif err := builder.check(); err != nil {\n\t\t\t\t\treturn nil, err\n\t\t\t\t}\n\t\t\t\tbuilder.mutation = mutation\n\t\t\t\tnodes[i], specs[i] = builder.createSpec()\n\t\t\t\tvar err error\n\t\t\t\tif i < len(mutators)-1 {\n\t\t\t\t\t_, err = mutators[i+1].Mutate(root, acb.builders[i+1].mutation)\n\t\t\t\t} else {\n\t\t\t\t\t// Invoke the actual operation on the latest mutation in the chain.\n\t\t\t\t\tif err = sqlgraph.BatchCreate(ctx, acb.driver, &sqlgraph.BatchCreateSpec{Nodes: specs}); err != nil {\n\t\t\t\t\t\tif cerr, ok := isSQLConstraintError(err); ok {\n\t\t\t\t\t\t\terr = cerr\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tmutation.done = true\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn nil, err\n\t\t\t\t}\n\t\t\t\tif nodes[i].ID == 0 {\n\t\t\t\t\tid := specs[i].ID.Value.(int64)\n\t\t\t\t\tnodes[i].ID = int64(id)\n\t\t\t\t}\n\t\t\t\treturn nodes[i], nil\n\t\t\t})\n\t\t\tfor i := len(builder.hooks) - 1; i >= 0; i-- {\n\t\t\t\tmut = builder.hooks[i](mut)\n\t\t\t}\n\t\t\tmutators[i] = mut\n\t\t}(i, ctx)\n\t}\n\tif len(mutators) > 0 {\n\t\tif _, err := mutators[0].Mutate(ctx, acb.builders[0].mutation); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\treturn nodes, nil\n}", "func (accb *AccessControlCreateBulk) Save(ctx context.Context) ([]*AccessControl, error) {\n\tspecs := make([]*sqlgraph.CreateSpec, len(accb.builders))\n\tnodes := make([]*AccessControl, len(accb.builders))\n\tmutators := make([]Mutator, len(accb.builders))\n\tfor i := range accb.builders {\n\t\tfunc(i int, root context.Context) {\n\t\t\tbuilder := accb.builders[i]\n\t\t\tvar mut Mutator = MutateFunc(func(ctx context.Context, m Mutation) (Value, error) {\n\t\t\t\tmutation, ok := m.(*AccessControlMutation)\n\t\t\t\tif !ok {\n\t\t\t\t\treturn nil, fmt.Errorf(\"unexpected mutation type %T\", m)\n\t\t\t\t}\n\t\t\t\tif err := builder.check(); err != nil {\n\t\t\t\t\treturn nil, err\n\t\t\t\t}\n\t\t\t\tbuilder.mutation = mutation\n\t\t\t\tnodes[i], specs[i] = builder.createSpec()\n\t\t\t\tvar err error\n\t\t\t\tif i < len(mutators)-1 {\n\t\t\t\t\t_, err = mutators[i+1].Mutate(root, accb.builders[i+1].mutation)\n\t\t\t\t} else {\n\t\t\t\t\t// Invoke the actual operation on the latest mutation in the chain.\n\t\t\t\t\tif err = sqlgraph.BatchCreate(ctx, accb.driver, &sqlgraph.BatchCreateSpec{Nodes: specs}); err != nil {\n\t\t\t\t\t\tif cerr, ok := isSQLConstraintError(err); ok {\n\t\t\t\t\t\t\terr = cerr\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tmutation.done = true\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn nil, err\n\t\t\t\t}\n\t\t\t\tif nodes[i].ID == 0 {\n\t\t\t\t\tid := specs[i].ID.Value.(int64)\n\t\t\t\t\tnodes[i].ID = int64(id)\n\t\t\t\t}\n\t\t\t\treturn nodes[i], nil\n\t\t\t})\n\t\t\tfor i := len(builder.hooks) - 1; i >= 0; i-- {\n\t\t\t\tmut = builder.hooks[i](mut)\n\t\t\t}\n\t\t\tmutators[i] = mut\n\t\t}(i, ctx)\n\t}\n\tif len(mutators) > 0 {\n\t\tif _, err := mutators[0].Mutate(ctx, accb.builders[0].mutation); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\treturn nodes, nil\n}", "func (c *AdminClient) Create() *AdminCreate {\n\tmutation := newAdminMutation(c.config, OpCreate)\n\treturn &AdminCreate{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func NewMultiBulk(array []*EncodeData) *EncodeData {\n\tans := &EncodeData{}\n\tans.Type = TypeMultiBulk\n\tans.Array = array\n\treturn ans\n}", "func (ccb *ConstructionCreateBulk) Save(ctx context.Context) ([]*Construction, error) {\n\tspecs := make([]*sqlgraph.CreateSpec, len(ccb.builders))\n\tnodes := make([]*Construction, len(ccb.builders))\n\tmutators := make([]Mutator, len(ccb.builders))\n\tfor i := range ccb.builders {\n\t\tfunc(i int, root context.Context) {\n\t\t\tbuilder := ccb.builders[i]\n\t\t\tbuilder.defaults()\n\t\t\tvar mut Mutator = MutateFunc(func(ctx context.Context, m Mutation) (Value, error) {\n\t\t\t\tmutation, ok := m.(*ConstructionMutation)\n\t\t\t\tif !ok {\n\t\t\t\t\treturn nil, fmt.Errorf(\"unexpected mutation type %T\", m)\n\t\t\t\t}\n\t\t\t\tif err := builder.check(); err != nil {\n\t\t\t\t\treturn nil, err\n\t\t\t\t}\n\t\t\t\tbuilder.mutation = mutation\n\t\t\t\tnodes[i], specs[i] = builder.createSpec()\n\t\t\t\tvar err error\n\t\t\t\tif i < len(mutators)-1 {\n\t\t\t\t\t_, err = mutators[i+1].Mutate(root, ccb.builders[i+1].mutation)\n\t\t\t\t} else {\n\t\t\t\t\t// Invoke the actual operation on the latest mutation in the chain.\n\t\t\t\t\tif err = sqlgraph.BatchCreate(ctx, ccb.driver, &sqlgraph.BatchCreateSpec{Nodes: specs}); err != nil {\n\t\t\t\t\t\tif cerr, ok := isSQLConstraintError(err); ok {\n\t\t\t\t\t\t\terr = cerr\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tmutation.done = true\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn nil, err\n\t\t\t\t}\n\t\t\t\tid := specs[i].ID.Value.(int64)\n\t\t\t\tnodes[i].ID = int(id)\n\t\t\t\treturn nodes[i], nil\n\t\t\t})\n\t\t\tfor i := len(builder.hooks) - 1; i >= 0; i-- {\n\t\t\t\tmut = builder.hooks[i](mut)\n\t\t\t}\n\t\t\tmutators[i] = mut\n\t\t}(i, ctx)\n\t}\n\tif len(mutators) > 0 {\n\t\tif _, err := mutators[0].Mutate(ctx, ccb.builders[0].mutation); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\treturn nodes, nil\n}", "func (uccb *UseCaseCreateBulk) Save(ctx context.Context) ([]*UseCase, error) {\n\tspecs := make([]*sqlgraph.CreateSpec, len(uccb.builders))\n\tnodes := make([]*UseCase, len(uccb.builders))\n\tmutators := make([]Mutator, len(uccb.builders))\n\tfor i := range uccb.builders {\n\t\tfunc(i int, root context.Context) {\n\t\t\tbuilder := uccb.builders[i]\n\t\t\tvar mut Mutator = MutateFunc(func(ctx context.Context, m Mutation) (Value, error) {\n\t\t\t\tmutation, ok := m.(*UseCaseMutation)\n\t\t\t\tif !ok {\n\t\t\t\t\treturn nil, fmt.Errorf(\"unexpected mutation type %T\", m)\n\t\t\t\t}\n\t\t\t\tif err := builder.check(); err != nil {\n\t\t\t\t\treturn nil, err\n\t\t\t\t}\n\t\t\t\tbuilder.mutation = mutation\n\t\t\t\tnodes[i], specs[i] = builder.createSpec()\n\t\t\t\tvar err error\n\t\t\t\tif i < len(mutators)-1 {\n\t\t\t\t\t_, err = mutators[i+1].Mutate(root, uccb.builders[i+1].mutation)\n\t\t\t\t} else {\n\t\t\t\t\tspec := &sqlgraph.BatchCreateSpec{Nodes: specs}\n\t\t\t\t\t// Invoke the actual operation on the latest mutation in the chain.\n\t\t\t\t\tif err = sqlgraph.BatchCreate(ctx, uccb.driver, spec); err != nil {\n\t\t\t\t\t\tif sqlgraph.IsConstraintError(err) {\n\t\t\t\t\t\t\terr = &ConstraintError{err.Error(), err}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn nil, err\n\t\t\t\t}\n\t\t\t\tmutation.id = &nodes[i].ID\n\t\t\t\tmutation.done = true\n\t\t\t\tif specs[i].ID.Value != nil {\n\t\t\t\t\tid := specs[i].ID.Value.(int64)\n\t\t\t\t\tnodes[i].ID = int(id)\n\t\t\t\t}\n\t\t\t\treturn nodes[i], nil\n\t\t\t})\n\t\t\tfor i := len(builder.hooks) - 1; i >= 0; i-- {\n\t\t\t\tmut = builder.hooks[i](mut)\n\t\t\t}\n\t\t\tmutators[i] = mut\n\t\t}(i, ctx)\n\t}\n\tif len(mutators) > 0 {\n\t\tif _, err := mutators[0].Mutate(ctx, uccb.builders[0].mutation); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\treturn nodes, nil\n}", "func (ocb *OAuth2ClientCreateBulk) Exec(ctx context.Context) error {\n\t_, err := ocb.Save(ctx)\n\treturn err\n}" ]
[ "0.7269414", "0.72481203", "0.7227715", "0.7163071", "0.71467423", "0.71414846", "0.71414846", "0.71414846", "0.71414846", "0.71414846", "0.71011126", "0.70828944", "0.70778054", "0.7068791", "0.7058289", "0.705827", "0.69994843", "0.6973101", "0.6958296", "0.6923243", "0.69145", "0.68762267", "0.6858395", "0.6849481", "0.68221456", "0.6819023", "0.67949337", "0.67579776", "0.67297316", "0.671143", "0.6692586", "0.6652315", "0.6637468", "0.6616208", "0.65754575", "0.65597963", "0.65428436", "0.64910334", "0.6485241", "0.6468913", "0.641919", "0.6403253", "0.6382753", "0.6321912", "0.6138281", "0.60929143", "0.60297316", "0.60157824", "0.55601615", "0.55320066", "0.5470303", "0.540002", "0.5303609", "0.5274664", "0.5268193", "0.52144605", "0.51964855", "0.5186742", "0.51648074", "0.51384085", "0.51327163", "0.51016104", "0.5100855", "0.50917315", "0.5088882", "0.50784403", "0.50669926", "0.5061906", "0.5059832", "0.50562656", "0.5053913", "0.5046924", "0.50417733", "0.5035752", "0.5018648", "0.5003964", "0.49991345", "0.49910304", "0.49850646", "0.49747264", "0.49482426", "0.49417874", "0.4929572", "0.49273634", "0.4909994", "0.49066612", "0.49035063", "0.48946723", "0.4885916", "0.48742828", "0.48726436", "0.48531437", "0.4852742", "0.48049554", "0.4804042", "0.47973943", "0.47952077", "0.478884", "0.47811604", "0.4780977" ]
0.81593883
0
Update returns an update builder for Admin.
func (c *AdminClient) Update() *AdminUpdate { mutation := newAdminMutation(c.config, OpUpdate) return &AdminUpdate{config: c.config, hooks: c.Hooks(), mutation: mutation} }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func UpdateAdmin(w http.ResponseWriter, r *http.Request) {\n\tvar body UpdateAdminRequest\n\tif err := read.JSON(r.Body, &body); err != nil {\n\t\trender.Error(w, admin.WrapError(admin.ErrorBadRequestType, err, \"error reading request body\"))\n\t\treturn\n\t}\n\n\tif err := body.Validate(); err != nil {\n\t\trender.Error(w, err)\n\t\treturn\n\t}\n\n\tid := chi.URLParam(r, \"id\")\n\tauth := mustAuthority(r.Context())\n\tadm, err := auth.UpdateAdmin(r.Context(), id, &linkedca.Admin{Type: body.Type})\n\tif err != nil {\n\t\trender.Error(w, admin.WrapErrorISE(err, \"error updating admin %s\", id))\n\t\treturn\n\t}\n\n\trender.ProtoJSON(w, adm)\n}", "func (m *manager) AdminUpdate(ctx context.Context) error {\n\ttoRun := m.adminUpdate()\n\treturn m.runSteps(ctx, toRun, \"adminUpdate\")\n}", "func (svc *AdminBuildService) Update(b *library.Build) (*library.Build, *Response, error) {\n\t// set the API endpoint path we send the request to\n\tu := \"/api/v1/admin/build\"\n\n\t// library Build type we want to return\n\tv := new(library.Build)\n\n\t// send request using client\n\tresp, err := svc.client.Call(\"PUT\", u, b, v)\n\n\treturn v, resp, err\n}", "func (c *BuildingClient) Update() *BuildingUpdate {\n\tmutation := newBuildingMutation(c.config, OpUpdate)\n\treturn &BuildingUpdate{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (a *Admin) Update() (*mongo.UpdateResult, error) {\n\ta.ModifiedAt = variable.DateTimeNowPtr()\n\n\tupdate := bson.M{\"$set\": *a}\n\treturn a.Collection().UpdateOne(context.Background(), bson.M{\"_id\": a.ID}, update)\n}", "func (svc *AdminSvcService) Update(s *library.Service) (*library.Service, *Response, error) {\n\t// set the API endpoint path we send the request to\n\tu := \"/api/v1/admin/service\"\n\n\t// library Service type we want to return\n\tv := new(library.Service)\n\n\t// send request using client\n\tresp, err := svc.client.Call(\"PUT\", u, s, v)\n\n\treturn v, resp, err\n}", "func (g guildMemberQueryBuilder) UpdateBuilder() UpdateGuildMemberBuilder {\n\tbuilder := &updateGuildMemberBuilder{}\n\tbuilder.r.itemFactory = func() interface{} {\n\t\treturn &Member{\n\t\t\tGuildID: g.gid,\n\t\t\tUserID: g.uid,\n\t\t}\n\t}\n\tbuilder.r.flags = g.flags\n\tbuilder.r.setup(g.client.req, &httd.Request{\n\t\tMethod: http.MethodPatch,\n\t\tCtx: g.ctx,\n\t\tEndpoint: endpoint.GuildMember(g.gid, g.uid),\n\t\tContentType: httd.ContentTypeJSON,\n\t}, nil)\n\n\t// TODO: cache member changes\n\treturn builder\n}", "func (c *MealplanClient) Update() *MealplanUpdate {\n\tmutation := newMealplanMutation(c.config, OpUpdate)\n\treturn &MealplanUpdate{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (d *UpdateBuilder) UpdateBuilder(setMap map[string]interface{}) squirrel.UpdateBuilder {\n\tqry := squirrel.Update(d.table).SetMap(setMap)\n\tif d.HasJoins() {\n\t\twith, where := d.preparePrefixExprForCondition()\n\t\tqry = qry.PrefixExpr(with).Where(where)\n\t} else {\n\t\tparams := d.generateConditionOptionPreprocessParams()\n\t\tqry = ApplyPaging(d.StatementBuilder, qry)\n\t\tqry = ApplySort(d.StatementBuilder, params, qry)\n\t\tqry = ApplyConditions(d.Where, params, qry)\n\t}\n\treturn qry\n}", "func NewUpdateBuilder() *UpdateBuilder {\n\treturn &UpdateBuilder{}\n}", "func (svc *AdminStepService) Update(s *library.Step) (*library.Step, *Response, error) {\n\t// set the API endpoint path we send the request to\n\tu := \"/api/v1/admin/step\"\n\n\t// library Step type we want to return\n\tv := new(library.Step)\n\n\t// send request using client\n\tresp, err := svc.client.Call(\"PUT\", u, s, v)\n\n\treturn v, resp, err\n}", "func Update(table string) *UpdateBuilder {\n\treturn NewUpdateBuilder(table)\n}", "func NewUpdateBuilder() *UpdateBuilder {\n\treturn DefaultFlavor.NewUpdateBuilder()\n}", "func (ad *Admin) Update() error {\n\tif ad.dbCollection == nil {\n\t\treturn errors.New(\"Uninitialized Object Admin\")\n\t}\n\tquery := bson.M{\"uid\": ad.UID}\n\tchange := bson.M{\"$set\": ad}\n\treturn ad.dbCollection.Update(query, change)\n}", "func (c *ModuleClient) Update() *ModuleUpdate {\n\treturn &ModuleUpdate{config: c.config}\n}", "func (svc *AdminSecretService) Update(s *library.Secret) (*library.Secret, *Response, error) {\n\t// set the API endpoint path we send the request to\n\tu := \"/api/v1/admin/secret\"\n\n\t// library Secret type we want to return\n\tv := new(library.Secret)\n\n\t// send request using client\n\tresp, err := svc.client.Call(\"PUT\", u, s, v)\n\n\treturn v, resp, err\n}", "func (c *AdminSessionClient) Update() *AdminSessionUpdate {\n\tmutation := newAdminSessionMutation(c.config, OpUpdate)\n\treturn &AdminSessionUpdate{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func Update(table string) *UpdateBuilder {\n\treturn DefaultFlavor.NewUpdateBuilder().Update(table)\n}", "func (s *rpcServer) UpdateAdmin(ctx context.Context, req *api.UpdateAdminRequest) (*api.UpdateAdminResponse, error) {\n\tlogger := log.GetLogger(ctx)\n\tlogger.Debugf(\"%+v\", req)\n\tadmin, err := admin.ByID(req.AdminId)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\t// Update all the fields\n\tadmin.Name = req.Admin.Name\n\tadmin.Email = req.Admin.Email\n\tadmin.ACL = req.Admin.ACL\n\tif err := admin.Save(); err != nil {\n\t\treturn nil, errors.Wrap(err, \"error while saving admin to db\")\n\t}\n\treturn &api.UpdateAdminResponse{\n\t\tAdmin: &api.Admin{\n\t\t\tId: admin.ID,\n\t\t\tName: admin.Name,\n\t\t\tEmail: admin.Email,\n\t\t\tACL: admin.ACL,\n\t\t},\n\t}, nil\n}", "func (svc *AdminUserService) Update(u *library.User) (*library.User, *Response, error) {\n\t// set the API endpoint path we send the request to\n\turl := \"/api/v1/admin/user\"\n\n\t// library User type we want to return\n\tv := new(library.User)\n\n\t// send request using client\n\tresp, err := svc.client.Call(\"PUT\", url, u, v)\n\n\treturn v, resp, err\n}", "func (svc *AdminDeploymentService) Update(d *library.Deployment) (*library.Deployment, *Response, error) {\n\t// set the API endpoint path we send the request to\n\tu := \"/api/v1/admin/deployment\"\n\n\t// library Deployment type we want to return\n\tv := new(library.Deployment)\n\n\t// send request using client\n\tresp, err := svc.client.Call(\"PUT\", u, d, v)\n\n\treturn v, resp, err\n}", "func (m *GraphBaseServiceClient) Admin()(*i7c9d1b36ac198368c1d8bed014b43e2a518b170ee45bf02c8bbe64544a50539a.AdminRequestBuilder) {\n return i7c9d1b36ac198368c1d8bed014b43e2a518b170ee45bf02c8bbe64544a50539a.NewAdminRequestBuilderInternal(m.pathParameters, m.requestAdapter);\n}", "func (m *GraphBaseServiceClient) Admin()(*i7c9d1b36ac198368c1d8bed014b43e2a518b170ee45bf02c8bbe64544a50539a.AdminRequestBuilder) {\n return i7c9d1b36ac198368c1d8bed014b43e2a518b170ee45bf02c8bbe64544a50539a.NewAdminRequestBuilderInternal(m.pathParameters, m.requestAdapter);\n}", "func (c *BedtypeClient) Update() *BedtypeUpdate {\n\tmutation := newBedtypeMutation(c.config, OpUpdate)\n\treturn &BedtypeUpdate{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (svc *AdminRepoService) Update(r *library.Repo) (*library.Repo, *Response, error) {\n\t// set the API endpoint path we send the request to\n\tu := \"/api/v1/admin/repo\"\n\n\t// library Repo type we want to return\n\tv := new(library.Repo)\n\n\t// send request using client\n\tresp, err := svc.client.Call(\"PUT\", u, r, v)\n\n\treturn v, resp, err\n}", "func (svc *AdminHookService) Update(h *library.Hook) (*library.Hook, *Response, error) {\n\t// set the API endpoint path we send the request to\n\tu := \"/api/v1/admin/hook\"\n\n\t// library Hook type we want to return\n\tv := new(library.Hook)\n\n\t// send request using client\n\tresp, err := svc.client.Call(\"PUT\", u, h, v)\n\n\treturn v, resp, err\n}", "func (c *RoomuseClient) Update() *RoomuseUpdate {\n\tmutation := newRoomuseMutation(c.config, OpUpdate)\n\treturn &RoomuseUpdate{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *CleaningroomClient) Update() *CleaningroomUpdate {\n\tmutation := newCleaningroomMutation(c.config, OpUpdate)\n\treturn &CleaningroomUpdate{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (orm *ORM) UpdateAdmin(ctx context.Context, adminID string, fullname *string, email *string, phone *string) (bool, error) {\n\tvar _Admin models.Admin\n\n\terr := orm.DB.DB.First(&_Admin, \"id = ?\", adminID).Error\n\tif errors.Is(err, gorm.ErrRecordNotFound) {\n\t\treturn false, errors.New(\"AdminNotFound\")\n\t}\n\n\tif fullname != nil {\n\t\t_Admin.FullName = *fullname\n\t}\n\tif email != nil {\n\t\t_Admin.Email = *email\n\t}\n\tif phone != nil {\n\t\t_Admin.Phone = phone\n\t}\n\torm.DB.DB.Save(&_Admin)\n\treturn true, nil\n\n}", "func (c *RoomdetailClient) Update() *RoomdetailUpdate {\n\tmutation := newRoomdetailMutation(c.config, OpUpdate)\n\treturn &RoomdetailUpdate{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *ModuleVersionClient) Update() *ModuleVersionUpdate {\n\treturn &ModuleVersionUpdate{config: c.config}\n}", "func (c *ToolClient) Update() *ToolUpdate {\n\tmutation := newToolMutation(c.config, OpUpdate)\n\treturn &ToolUpdate{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *DoctorClient) Update() *DoctorUpdate {\n\tmutation := newDoctorMutation(c.config, OpUpdate)\n\treturn &DoctorUpdate{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (m *Module) Update() (*Module, error) {\n\tif err := database.BackendDB.DB.Save(m).Error; err != nil {\n\t\tlog.Print(err)\n\t\treturn nil, err\n\t}\n\treturn m, nil\n}", "func (c *LevelOfDangerousClient) Update() *LevelOfDangerousUpdate {\n\tmutation := newLevelOfDangerousMutation(c.config, OpUpdate)\n\treturn &LevelOfDangerousUpdate{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *OperationroomClient) Update() *OperationroomUpdate {\n\tmutation := newOperationroomMutation(c.config, OpUpdate)\n\treturn &OperationroomUpdate{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *BeerClient) Update() *BeerUpdate {\n\tmutation := newBeerMutation(c.config, OpUpdate)\n\treturn &BeerUpdate{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *FoodmenuClient) Update() *FoodmenuUpdate {\n\tmutation := newFoodmenuMutation(c.config, OpUpdate)\n\treturn &FoodmenuUpdate{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func AdminEdit(w http.ResponseWriter, data interface{}) {\n\trender(tpAdminEdit, w, data)\n}", "func AdminEdit(w http.ResponseWriter, data interface{}) {\n\trender(tpAdminEdit, w, data)\n}", "func Update() *UpdateOptions {\n\treturn &UpdateOptions{}\n}", "func (u SysDBUpdater) Update() error {\n\treturn u.db.Updates(u.fields).Error\n}", "func (b *Builder) Update(updates ...Eq) *Builder {\r\n\tb.updates = updates\r\n\tb.optype = updateType\r\n\treturn b\r\n}", "func (c *AdminClient) UpdateOne(a *Admin) *AdminUpdateOne {\n\tmutation := newAdminMutation(c.config, OpUpdateOne, withAdmin(a))\n\treturn &AdminUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (u *App) Update(c echo.Context, r *Update) (result *model.Post, err error) {\n\tif err = u.rbac.EnforceRole(c, model.AdminRole); err != nil {\n\t\tzaplog.ZLog(err)\n\t\treturn\n\t}\n\n\tif len(r.Excerpt) > 255 {\n\t\tr.Excerpt = r.Excerpt[:250] + \"...\"\n\t}\n\n\told, err := u.udb.View(u.db, r.ID)\n\tif err = zaplog.ZLog(err); err != nil {\n\t\treturn\n\t}\n\n\tif r.Status != \"\" && old.Status != r.Status && !old.AllowedStatuses(r.Status) {\n\t\terr = zaplog.ZLog(fmt.Errorf(\"Não é possível passar de %s para %s\", old.Status, r.Status))\n\t\treturn\n\t}\n\n\tupdate := model.Post{\n\t\tBase: model.Base{ID: r.ID},\n\t\tAuthor: r.Author,\n\t\tCategory: r.Category,\n\t\tTags: r.Tags,\n\t\tTitle: r.Title,\n\t\tSlug: r.Slug,\n\t\tContent: r.Content,\n\t\tExcerpt: r.Excerpt,\n\t\tStatus: r.Status,\n\t}\n\n\tvar operator model.User\n\tif err = u.db.Model(&model.User{}).Where(\"uuid = ?\", r.Author).First(&operator).Error; err == nil {\n\t\tupdate.AuthorName = operator.Name\n\t}\n\n\tif err = zaplog.ZLog(u.udb.Update(u.db, &update)); err != nil {\n\t\treturn\n\t}\n\treturn u.udb.View(u.db, r.ID)\n}", "func (c *UnitOfMedicineClient) Update() *UnitOfMedicineUpdate {\n\tmutation := newUnitOfMedicineMutation(c.config, OpUpdate)\n\treturn &UnitOfMedicineUpdate{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (t *RestControllerDescriptor) Update() *ggt.MethodDescriptor { return t.methodUpdate }", "func (c *PhysicianClient) Update() *PhysicianUpdate {\n\tmutation := newPhysicianMutation(c.config, OpUpdate)\n\treturn &PhysicianUpdate{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *PhysicianClient) Update() *PhysicianUpdate {\n\tmutation := newPhysicianMutation(c.config, OpUpdate)\n\treturn &PhysicianUpdate{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *RoomClient) Update() *RoomUpdate {\n\tmutation := newRoomMutation(c.config, OpUpdate)\n\treturn &RoomUpdate{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *RoomClient) Update() *RoomUpdate {\n\tmutation := newRoomMutation(c.config, OpUpdate)\n\treturn &RoomUpdate{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (o *sampleUpdateHandler) Update(rw http.ResponseWriter, req *http.Request) {\n\to.UpdateHandler.Update(rw, req)\n}", "func (d *Demo) Update() *DemoUpdateOne {\n\treturn (&DemoClient{config: d.config}).UpdateOne(d)\n}", "func (c *MedicineClient) Update() *MedicineUpdate {\n\tmutation := newMedicineMutation(c.config, OpUpdate)\n\treturn &MedicineUpdate{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func NewAdmin(opts *ServerOptions) (string, *elton.Elton) {\n\tcfg := opts.cfg\n\tadminConfig, _ := cfg.GetAdmin()\n\tif adminConfig == nil {\n\t\treturn \"\", nil\n\t}\n\tadminPath := defaultAdminPath\n\tif adminConfig.Prefix != \"\" {\n\t\tadminPath = adminConfig.Prefix\n\t}\n\n\te := elton.New()\n\n\tif adminConfig != nil {\n\t\te.Use(newAdminValidateMiddlewares(adminConfig)...)\n\t}\n\tcompressConfig := middleware.NewCompressConfig(\n\t\tnew(compress.BrCompressor),\n\t\tnew(middleware.GzipCompressor),\n\t)\n\te.Use(middleware.NewCompress(compressConfig))\n\n\te.Use(middleware.NewDefaultFresh())\n\te.Use(middleware.NewDefaultETag())\n\n\te.Use(middleware.NewDefaultError())\n\te.Use(middleware.NewDefaultResponder())\n\te.Use(middleware.NewDefaultBodyParser())\n\n\tg := elton.NewGroup(adminPath)\n\n\t// 按分类获取配置\n\tg.GET(\"/configs/{category}\", newGetConfigHandler(cfg))\n\t// 添加与更新使用相同处理\n\tg.POST(\"/configs/{category}\", newCreateOrUpdateConfigHandler(cfg))\n\t// 删除配置\n\tg.DELETE(\"/configs/{category}/{name}\", newDeleteConfigHandler(cfg))\n\n\tfiles := new(assetFiles)\n\n\tg.GET(\"/\", func(c *elton.Context) (err error) {\n\t\tfile := \"index.html\"\n\t\tbuf, err := files.Get(file)\n\t\tif err != nil {\n\t\t\treturn\n\t\t}\n\t\tc.SetContentTypeByExt(file)\n\t\tc.BodyBuffer = bytes.NewBuffer(buf)\n\t\treturn\n\t})\n\n\ticons := []string{\n\t\t\"favicon.ico\",\n\t\t\"logo.png\",\n\t}\n\thandleIcon := func(icon string) {\n\t\tg.GET(\"/\"+icon, func(c *elton.Context) (err error) {\n\t\t\tbuf, err := application.DefaultAsset().Find(icon)\n\t\t\tif err != nil {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tc.SetContentTypeByExt(icon)\n\t\t\tc.Body = buf\n\t\t\treturn\n\t\t})\n\t}\n\tfor _, icon := range icons {\n\t\thandleIcon(icon)\n\t}\n\n\tg.GET(\"/static/*\", middleware.NewStaticServe(files, middleware.StaticServeConfig{\n\t\tPath: \"/static\",\n\t\t// 客户端缓存一年\n\t\tMaxAge: 365 * 24 * 3600,\n\t\t// 缓存服务器缓存一个小时\n\t\tSMaxAge: 60 * 60,\n\t\tDenyQueryString: true,\n\t\tDisableLastModified: true,\n\t}))\n\n\t// 获取应用状态\n\tg.GET(\"/application\", func(c *elton.Context) error {\n\t\tc.Body = application.Default()\n\t\treturn nil\n\t})\n\n\t// 获取upstream的状态\n\tg.GET(\"/upstreams\", func(c *elton.Context) error {\n\t\tc.Body = opts.upstreams.Status()\n\t\treturn nil\n\t})\n\n\t// 上传\n\tg.POST(\"/upload\", func(c *elton.Context) (err error) {\n\t\tfile, fileHeader, err := c.Request.FormFile(\"file\")\n\t\tif err != nil {\n\t\t\treturn\n\t\t}\n\t\tbuf, err := ioutil.ReadAll(file)\n\t\tif err != nil {\n\t\t\treturn\n\t\t}\n\t\tc.Body = map[string]string{\n\t\t\t\"contentType\": fileHeader.Header.Get(\"Content-Type\"),\n\t\t\t\"data\": base64.StdEncoding.EncodeToString(buf),\n\t\t}\n\t\treturn\n\t})\n\t// alarm 测试\n\tg.POST(\"/alarms/{name}/try\", func(c *elton.Context) (err error) {\n\t\tname := c.Param(\"name\")\n\t\talarms, err := cfg.GetAlarms()\n\t\tif err != nil {\n\t\t\treturn\n\t\t}\n\t\talarm := alarms.Get(name)\n\t\tif alarm == nil {\n\t\t\terr = hes.New(\"alarm is nil, please check the alarm configs\")\n\t\t\treturn\n\t\t}\n\t\terr = alarmHandle(alarm, nil)\n\t\tif err != nil {\n\t\t\treturn\n\t\t}\n\t\tc.NoContent()\n\t\treturn\n\t})\n\n\t// list caches 获取缓存列表\n\tg.GET(\"/caches/{name}\", func(c *elton.Context) (err error) {\n\t\tdisp := opts.dispatchers.Get(c.Param(\"name\"))\n\t\tif disp == nil {\n\t\t\terr = hes.New(\"cache not found\")\n\t\t\treturn\n\t\t}\n\t\tstatus, _ := strconv.Atoi(c.QueryParam(\"status\"))\n\t\tlimit, _ := strconv.Atoi(c.QueryParam(\"limit\"))\n\t\tif status <= 0 {\n\t\t\tstatus = cache.StatusCacheable\n\t\t}\n\t\tif limit <= 0 {\n\t\t\tlimit = 100\n\t\t}\n\n\t\tc.Body = disp.List(status, limit, c.QueryParam(\"keyword\"))\n\t\treturn\n\t})\n\t// delete cache 删除缓存\n\tg.DELETE(\"/caches/{name}\", func(c *elton.Context) (err error) {\n\t\tdisp := opts.dispatchers.Get(c.Param(\"name\"))\n\t\tif disp == nil {\n\t\t\terr = hes.New(\"cache not found\")\n\t\t\treturn\n\t\t}\n\t\tdisp.Remove([]byte(c.QueryParam(\"key\")))\n\t\tc.NoContent()\n\t\treturn\n\t})\n\n\te.AddGroup(g)\n\treturn adminPath, e\n}", "func (c *PatientroomClient) Update() *PatientroomUpdate {\n\tmutation := newPatientroomMutation(c.config, OpUpdate)\n\treturn &PatientroomUpdate{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (r *DeviceAppManagementRequest) Update(ctx context.Context, reqObj *DeviceAppManagement) error {\n\treturn r.JSONRequest(ctx, \"PATCH\", \"\", reqObj, nil)\n}", "func (c *ExaminationroomClient) Update() *ExaminationroomUpdate {\n\tmutation := newExaminationroomMutation(c.config, OpUpdate)\n\treturn &ExaminationroomUpdate{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (aaa *ThirdPartyService) AdminUpdateThirdPartyConfig(input *third_party.AdminUpdateThirdPartyConfigParams) (*lobbyclientmodels.ModelsUpdateConfigResponse, error) {\n\ttoken, err := aaa.TokenRepository.GetToken()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tok, badRequest, unauthorized, forbidden, internalServerError, err := aaa.Client.ThirdParty.AdminUpdateThirdPartyConfig(input, client.BearerToken(*token.AccessToken))\n\tif badRequest != nil {\n\t\treturn nil, badRequest\n\t}\n\tif unauthorized != nil {\n\t\treturn nil, unauthorized\n\t}\n\tif forbidden != nil {\n\t\treturn nil, forbidden\n\t}\n\tif internalServerError != nil {\n\t\treturn nil, internalServerError\n\t}\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn ok.GetPayload(), nil\n}", "func (*AdminInfoService) UpdateInfo(id int, pwd string) error {\n\tadm := new(entities.AdminInfo)\n\tadm.AdminPwd = pwd\n\n\t_, err := entities.MasterEngine.Id(id).Update(adm)\n\n\treturn err\n}", "func (adminOrg *AdminOrg) Update() (Task, error) {\n\tvcomp := &types.AdminOrg{\n\t\tXmlns: types.XMLNamespaceVCloud,\n\t\tName: adminOrg.AdminOrg.Name,\n\t\tIsEnabled: adminOrg.AdminOrg.IsEnabled,\n\t\tFullName: adminOrg.AdminOrg.FullName,\n\t\tDescription: adminOrg.AdminOrg.Description,\n\t\tOrgSettings: adminOrg.AdminOrg.OrgSettings,\n\t}\n\n\t// Same workaround used in Org creation, where OrgGeneralSettings properties\n\t// are not set unless UseServerBootSequence is also set\n\tif vcomp.OrgSettings.OrgGeneralSettings != nil {\n\t\tvcomp.OrgSettings.OrgGeneralSettings.UseServerBootSequence = true\n\t}\n\n\t// Return the task\n\treturn adminOrg.client.ExecuteTaskRequest(adminOrg.AdminOrg.HREF, http.MethodPut,\n\t\t\"application/vnd.vmware.admin.organization+xml\", \"error updating Org: %s\", vcomp)\n}", "func (_Bindings *BindingsCallerSession) Admin() (common.Address, error) {\n\treturn _Bindings.Contract.Admin(&_Bindings.CallOpts)\n}", "func (o *CMFAdminMenu) Update(ctx context.Context, exec boil.ContextExecutor, columns boil.Columns) (int64, error) {\n\tvar err error\n\tif err = o.doBeforeUpdateHooks(ctx, exec); err != nil {\n\t\treturn 0, err\n\t}\n\tkey := makeCacheKey(columns, nil)\n\tcmfAdminMenuUpdateCacheMut.RLock()\n\tcache, cached := cmfAdminMenuUpdateCache[key]\n\tcmfAdminMenuUpdateCacheMut.RUnlock()\n\n\tif !cached {\n\t\twl := columns.UpdateColumnSet(\n\t\t\tcmfAdminMenuAllColumns,\n\t\t\tcmfAdminMenuPrimaryKeyColumns,\n\t\t)\n\n\t\tif !columns.IsWhitelist() {\n\t\t\twl = strmangle.SetComplement(wl, []string{\"created_at\"})\n\t\t}\n\t\tif len(wl) == 0 {\n\t\t\treturn 0, errors.New(\"models: unable to update cmf_admin_menu, could not build whitelist\")\n\t\t}\n\n\t\tcache.query = fmt.Sprintf(\"UPDATE `cmf_admin_menu` SET %s WHERE %s\",\n\t\t\tstrmangle.SetParamNames(\"`\", \"`\", 0, wl),\n\t\t\tstrmangle.WhereClause(\"`\", \"`\", 0, cmfAdminMenuPrimaryKeyColumns),\n\t\t)\n\t\tcache.valueMapping, err = queries.BindMapping(cmfAdminMenuType, cmfAdminMenuMapping, append(wl, cmfAdminMenuPrimaryKeyColumns...))\n\t\tif err != nil {\n\t\t\treturn 0, err\n\t\t}\n\t}\n\n\tvalues := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(o)), cache.valueMapping)\n\n\tif boil.IsDebug(ctx) {\n\t\twriter := boil.DebugWriterFrom(ctx)\n\t\tfmt.Fprintln(writer, cache.query)\n\t\tfmt.Fprintln(writer, values)\n\t}\n\tvar result sql.Result\n\tresult, err = exec.ExecContext(ctx, cache.query, values...)\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: unable to update cmf_admin_menu row\")\n\t}\n\n\trowsAff, err := result.RowsAffected()\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: failed to get rows affected by update for cmf_admin_menu\")\n\t}\n\n\tif !cached {\n\t\tcmfAdminMenuUpdateCacheMut.Lock()\n\t\tcmfAdminMenuUpdateCache[key] = cache\n\t\tcmfAdminMenuUpdateCacheMut.Unlock()\n\t}\n\n\treturn rowsAff, o.doAfterUpdateHooks(ctx, exec)\n}", "func (b *blogsQueryBuilder) Update() (int64, error) {\n\tif b.err != nil {\n\t\treturn 0, b.err\n\t}\n\treturn b.builder.Update()\n}", "func (_Bindings *BindingsSession) Admin() (common.Address, error) {\n\treturn _Bindings.Contract.Admin(&_Bindings.CallOpts)\n}", "func (a *Appwidgets) Update(code string, pType string) (resp objects.BaseOkResponse, err error) {\n\tparams := map[string]interface{}{}\n\n\tparams[\"code\"] = code\n\n\tparams[\"type\"] = pType\n\n\terr = a.SendObjRequest(\"appWidgets.update\", params, &resp)\n\n\treturn\n}", "func (c *PurposeClient) Update() *PurposeUpdate {\n\tmutation := newPurposeMutation(c.config, OpUpdate)\n\treturn &PurposeUpdate{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (qs ControlQS) Update() ControlUpdateQS {\n\treturn ControlUpdateQS{condFragments: qs.condFragments}\n}", "func (dau *DdgAdminUser) Update(ctx context.Context, key ...interface{}) error {\n\tvar err error\n\tvar dbConn *sql.DB\n\n\t// if deleted, bail\n\tif dau._deleted {\n\t\treturn errors.New(\"update failed: marked for deletion\")\n\t}\n\n\ttx, err := components.M.GetConnFromCtx(ctx)\n\tif err != nil {\n\t\tdbConn, err = components.M.GetMasterConn()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\ttableName, err := GetDdgAdminUserTableName(key...)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// sql query\n\tsqlstr := `UPDATE ` + tableName + ` SET ` +\n\t\t`name = ?, account = ?, password = ?, permission_ids = ?, status = ?` +\n\t\t` WHERE id = ?`\n\n\t// run query\n\tutils.GetTraceLog(ctx).Debug(\"DB\", zap.String(\"SQL\", fmt.Sprint(sqlstr, dau.Name, dau.Account, dau.Password, dau.PermissionIds, dau.Status, dau.ID)))\n\tif tx != nil {\n\t\t_, err = tx.Exec(sqlstr, dau.Name, dau.Account, dau.Password, dau.PermissionIds, dau.Status, dau.ID)\n\t} else {\n\t\t_, err = dbConn.Exec(sqlstr, dau.Name, dau.Account, dau.Password, dau.PermissionIds, dau.Status, dau.ID)\n\t}\n\treturn err\n}", "func (c *StatusdClient) Update() *StatusdUpdate {\n\tmutation := newStatusdMutation(c.config, OpUpdate)\n\treturn &StatusdUpdate{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *OperativeClient) Update() *OperativeUpdate {\n\tmutation := newOperativeMutation(c.config, OpUpdate)\n\treturn &OperativeUpdate{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (t *Tool) Update() *ToolUpdateOne {\n\treturn (&ToolClient{config: t.config}).UpdateOne(t)\n}", "func (t *TablesType) Update() *qb.UpdateBuilder {\n\treturn t.table.Update()\n}", "func (c *PharmacistClient) Update() *PharmacistUpdate {\n\tmutation := newPharmacistMutation(c.config, OpUpdate)\n\treturn &PharmacistUpdate{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *StatustClient) Update() *StatustUpdate {\n\tmutation := newStatustMutation(c.config, OpUpdate)\n\treturn &StatustUpdate{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (pm *basePackageManager) Update() error {\n\t_, _, err := RunCommandWithRetry(pm.cmder.UpdateCmd(), nil)\n\treturn err\n}", "func (_obj *Apichannels) Channels_editAdmin(params *TLchannels_editAdmin, _opt ...map[string]string) (ret Updates, err error) {\n\n\tvar length int32\n\tvar have bool\n\tvar ty byte\n\t_os := codec.NewBuffer()\n\terr = params.WriteBlock(_os, 1)\n\tif err != nil {\n\t\treturn ret, err\n\t}\n\n\tvar _status map[string]string\n\tvar _context map[string]string\n\tif len(_opt) == 1 {\n\t\t_context = _opt[0]\n\t} else if len(_opt) == 2 {\n\t\t_context = _opt[0]\n\t\t_status = _opt[1]\n\t}\n\t_resp := new(requestf.ResponsePacket)\n\ttarsCtx := context.Background()\n\n\terr = _obj.s.Tars_invoke(tarsCtx, 0, \"channels_editAdmin\", _os.ToBytes(), _status, _context, _resp)\n\tif err != nil {\n\t\treturn ret, err\n\t}\n\n\t_is := codec.NewReader(tools.Int8ToByte(_resp.SBuffer))\n\terr = ret.ReadBlock(_is, 0, true)\n\tif err != nil {\n\t\treturn ret, err\n\t}\n\n\tif len(_opt) == 1 {\n\t\tfor k := range _context {\n\t\t\tdelete(_context, k)\n\t\t}\n\t\tfor k, v := range _resp.Context {\n\t\t\t_context[k] = v\n\t\t}\n\t} else if len(_opt) == 2 {\n\t\tfor k := range _context {\n\t\t\tdelete(_context, k)\n\t\t}\n\t\tfor k, v := range _resp.Context {\n\t\t\t_context[k] = v\n\t\t}\n\t\tfor k := range _status {\n\t\t\tdelete(_status, k)\n\t\t}\n\t\tfor k, v := range _resp.Status {\n\t\t\t_status[k] = v\n\t\t}\n\n\t}\n\t_ = length\n\t_ = have\n\t_ = ty\n\treturn ret, nil\n}", "func (m *TenantManager) Update(t *Tenant, opts ...RequestOption) (err error) {\n\treturn m.Request(\"PATCH\", m.URI(\"tenants\", \"settings\"), t, opts...)\n}", "func (ub *UpdateBuilder) Build() (sql string, args []interface{}) {\n\treturn ub.BuildWithFlavor(ub.args.Flavor)\n}", "func (c *MedicineTypeClient) Update() *MedicineTypeUpdate {\n\tmutation := newMedicineTypeMutation(c.config, OpUpdate)\n\treturn &MedicineTypeUpdate{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (d *Doctorinfo) Update() *DoctorinfoUpdateOne {\n\treturn (&DoctorinfoClient{config: d.config}).UpdateOne(d)\n}", "func (r *DeviceManagementComplexSettingInstanceRequest) Update(ctx context.Context, reqObj *DeviceManagementComplexSettingInstance) error {\n\treturn r.JSONRequest(ctx, \"PATCH\", \"\", reqObj, nil)\n}", "func NewAdminUpdateUserResponseBodyAdmin(res *adminviews.JeeekUserView) *AdminUpdateUserResponseBodyAdmin {\n\tbody := &AdminUpdateUserResponseBodyAdmin{\n\t\tUserID: *res.UserID,\n\t\tUserName: *res.UserName,\n\t\tEmailAddress: *res.EmailAddress,\n\t\tPhoneNumber: *res.PhoneNumber,\n\t\tPhotoURL: *res.PhotoURL,\n\t\tEmailVerified: *res.EmailVerified,\n\t\tDisabled: res.Disabled,\n\t\tCreatedAt: res.CreatedAt,\n\t\tLastSignedinAt: res.LastSignedinAt,\n\t}\n\treturn body\n}", "func (t *ColumnsType) Update() *qb.UpdateBuilder {\n\treturn t.table.Update()\n}", "func (uar *UpdateAdminRequest) Validate() error {\n\tswitch uar.Type {\n\tcase linkedca.Admin_SUPER_ADMIN, linkedca.Admin_ADMIN:\n\tdefault:\n\t\treturn admin.NewError(admin.ErrorBadRequestType, \"invalid value for admin type\")\n\t}\n\treturn nil\n}", "func (admin *Admin) UpdateAdmin(db *gorm.DB, id string) (*Admin, error) {\n\n\terr := admin.BeforeSave()\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\terr = db.Debug().Model(Admin{}).Updates(&admin).Error\n\tif err != nil {\n\t\treturn &Admin{}, err\n\t}\n\n\treturn admin.FindAdminByID(db, id)\n}", "func (c *Controller) Update(config model.Config) (string, error) {\n\treturn \"\", errUnsupported\n}", "func (p *postsQueryBuilder) Update() (int64, error) {\n\tif p.err != nil {\n\t\treturn 0, p.err\n\t}\n\treturn p.builder.Update()\n}", "func (c *DNSBLQueryClient) Update() *DNSBLQueryUpdate {\n\tmutation := newDNSBLQueryMutation(c.config, OpUpdate)\n\treturn &DNSBLQueryUpdate{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *Client) Update() goa.Endpoint {\n\treturn func(ctx context.Context, v interface{}) (interface{}, error) {\n\t\tinv := goagrpc.NewInvoker(\n\t\t\tBuildUpdateFunc(c.grpccli, c.opts...),\n\t\t\tEncodeUpdateRequest,\n\t\t\tnil)\n\t\tres, err := inv.Invoke(ctx, v)\n\t\tif err != nil {\n\t\t\treturn nil, goa.Fault(err.Error())\n\t\t}\n\t\treturn res, nil\n\t}\n}", "func (c *PostClient) Update() *PostUpdate {\n\tmutation := newPostMutation(c.config, OpUpdate)\n\treturn &PostUpdate{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (r *resourceFrameworkShare) Update(ctx context.Context, req resource.UpdateRequest, resp *resource.UpdateResponse) {\n}", "func (c *BillClient) Update() *BillUpdate {\n\tmutation := newBillMutation(c.config, OpUpdate)\n\treturn &BillUpdate{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *BillClient) Update() *BillUpdate {\n\tmutation := newBillMutation(c.config, OpUpdate)\n\treturn &BillUpdate{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *BillClient) Update() *BillUpdate {\n\tmutation := newBillMutation(c.config, OpUpdate)\n\treturn &BillUpdate{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (ub *UpdateBuilder) Update(table string) *UpdateBuilder {\n\tub.table = Escape(table)\n\tub.marker = updateMarkerAfterUpdate\n\treturn ub\n}", "func UpdateAdminByID(i AdminEditForm, idToUpdate string) (*mongo.UpdateResult, error) {\n\toid, _ := primitive.ObjectIDFromHex(idToUpdate)\n\treturn adminCollection.UpdateOne(context.TODO(), bson.M{\"_id\": oid}, bson.D{\n\t\tprimitive.E{Key: \"$set\", Value: bson.D{\n\t\t\tprimitive.E{Key: \"fras_username\", Value: i.FrasUsername},\n\t\t}},\n\t\tprimitive.E{Key: \"$currentDate\", Value: bson.D{\n\t\t\tprimitive.E{Key: \"modified_at\", Value: true},\n\t\t}},\n\t})\n}", "func (c *ClubapplicationClient) Update() *ClubapplicationUpdate {\n\tmutation := newClubapplicationMutation(c.config, OpUpdate)\n\treturn &ClubapplicationUpdate{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (au *AdminUpdate) Exec(ctx context.Context) error {\n\t_, err := au.Save(ctx)\n\treturn err\n}", "func (c *EmployeeClient) Update() *EmployeeUpdate {\n\tmutation := newEmployeeMutation(c.config, OpUpdate)\n\treturn &EmployeeUpdate{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}" ]
[ "0.6878991", "0.6750765", "0.6275159", "0.61202425", "0.6105625", "0.61002636", "0.60964257", "0.60597795", "0.60094273", "0.59535974", "0.5897689", "0.58848155", "0.5883852", "0.5883645", "0.5870217", "0.5868933", "0.5858464", "0.58505106", "0.58492994", "0.58167124", "0.5816236", "0.575837", "0.575837", "0.5731288", "0.5718232", "0.5713583", "0.57030904", "0.5699214", "0.56911296", "0.5686951", "0.56513476", "0.56226635", "0.5613308", "0.5590574", "0.5575767", "0.55630136", "0.5559099", "0.55530024", "0.5552556", "0.5552556", "0.5549173", "0.554237", "0.5511894", "0.5502623", "0.55007064", "0.54761076", "0.54722553", "0.5471448", "0.5471448", "0.544703", "0.544703", "0.5429873", "0.54199433", "0.54183894", "0.5408545", "0.5400404", "0.53998405", "0.53981805", "0.53973705", "0.5394613", "0.53944415", "0.5381984", "0.5381849", "0.53736997", "0.5370632", "0.53690255", "0.53667253", "0.536075", "0.5356539", "0.5351839", "0.5348184", "0.53340584", "0.5329636", "0.53293747", "0.5327019", "0.5324202", "0.53241587", "0.5320827", "0.53183573", "0.5316596", "0.53042305", "0.52935946", "0.528837", "0.52747166", "0.52686995", "0.52670586", "0.5265741", "0.52652526", "0.52650994", "0.5264662", "0.5255802", "0.52551156", "0.5254528", "0.5254528", "0.5254528", "0.52538216", "0.525012", "0.5242879", "0.5239368", "0.52389336" ]
0.6986776
0
UpdateOne returns an update builder for the given entity.
func (c *AdminClient) UpdateOne(a *Admin) *AdminUpdateOne { mutation := newAdminMutation(c.config, OpUpdateOne, withAdmin(a)) return &AdminUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation} }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (c *BuildingClient) UpdateOne(b *Building) *BuildingUpdateOne {\n\tmutation := newBuildingMutation(c.config, OpUpdateOne, withBuilding(b))\n\treturn &BuildingUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *BedtypeClient) UpdateOne(b *Bedtype) *BedtypeUpdateOne {\n\tmutation := newBedtypeMutation(c.config, OpUpdateOne, withBedtype(b))\n\treturn &BedtypeUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *EmptyClient) UpdateOne(e *Empty) *EmptyUpdateOne {\n\tmutation := newEmptyMutation(c.config, OpUpdateOne, withEmpty(e))\n\treturn &EmptyUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *DentistClient) UpdateOne(d *Dentist) *DentistUpdateOne {\n\tmutation := newDentistMutation(c.config, OpUpdateOne, withDentist(d))\n\treturn &DentistUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *BeerClient) UpdateOne(b *Beer) *BeerUpdateOne {\n\tmutation := newBeerMutation(c.config, OpUpdateOne, withBeer(b))\n\treturn &BeerUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *BillClient) UpdateOne(b *Bill) *BillUpdateOne {\n\tmutation := newBillMutation(c.config, OpUpdateOne, withBill(b))\n\treturn &BillUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *BillClient) UpdateOne(b *Bill) *BillUpdateOne {\n\tmutation := newBillMutation(c.config, OpUpdateOne, withBill(b))\n\treturn &BillUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *BillClient) UpdateOne(b *Bill) *BillUpdateOne {\n\tmutation := newBillMutation(c.config, OpUpdateOne, withBill(b))\n\treturn &BillUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *OperationClient) UpdateOne(o *Operation) *OperationUpdateOne {\n\tmutation := newOperationMutation(c.config, OpUpdateOne, withOperation(o))\n\treturn &OperationUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *PostAttachmentClient) UpdateOne(pa *PostAttachment) *PostAttachmentUpdateOne {\n\tmutation := newPostAttachmentMutation(c.config, OpUpdateOne, withPostAttachment(pa))\n\treturn &PostAttachmentUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *CleaningroomClient) UpdateOne(cl *Cleaningroom) *CleaningroomUpdateOne {\n\tmutation := newCleaningroomMutation(c.config, OpUpdateOne, withCleaningroom(cl))\n\treturn &CleaningroomUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *CompanyClient) UpdateOne(co *Company) *CompanyUpdateOne {\n\tmutation := newCompanyMutation(c.config, OpUpdateOne, withCompany(co))\n\treturn &CompanyUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *CompanyClient) UpdateOne(co *Company) *CompanyUpdateOne {\n\tmutation := newCompanyMutation(c.config, OpUpdateOne, withCompany(co))\n\treturn &CompanyUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *EventClient) UpdateOne(e *Event) *EventUpdateOne {\n\tmutation := newEventMutation(c.config, OpUpdateOne, withEvent(e))\n\treturn &EventUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *PostClient) UpdateOne(po *Post) *PostUpdateOne {\n\tmutation := newPostMutation(c.config, OpUpdateOne, withPost(po))\n\treturn &PostUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *DeviceClient) UpdateOne(d *Device) *DeviceUpdateOne {\n\tmutation := newDeviceMutation(c.config, OpUpdateOne, withDevice(d))\n\treturn &DeviceUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *OperationroomClient) UpdateOne(o *Operationroom) *OperationroomUpdateOne {\n\tmutation := newOperationroomMutation(c.config, OpUpdateOne, withOperationroom(o))\n\treturn &OperationroomUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *UnsavedPostAttachmentClient) UpdateOne(upa *UnsavedPostAttachment) *UnsavedPostAttachmentUpdateOne {\n\tmutation := newUnsavedPostAttachmentMutation(c.config, OpUpdateOne, withUnsavedPostAttachment(upa))\n\treturn &UnsavedPostAttachmentUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *DrugAllergyClient) UpdateOne(da *DrugAllergy) *DrugAllergyUpdateOne {\n\tmutation := newDrugAllergyMutation(c.config, OpUpdateOne, withDrugAllergy(da))\n\treturn &DrugAllergyUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *MealplanClient) UpdateOne(m *Mealplan) *MealplanUpdateOne {\n\tmutation := newMealplanMutation(c.config, OpUpdateOne, withMealplan(m))\n\treturn &MealplanUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *PhysicianClient) UpdateOne(ph *Physician) *PhysicianUpdateOne {\n\tmutation := newPhysicianMutation(c.config, OpUpdateOne, withPhysician(ph))\n\treturn &PhysicianUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *PhysicianClient) UpdateOne(ph *Physician) *PhysicianUpdateOne {\n\tmutation := newPhysicianMutation(c.config, OpUpdateOne, withPhysician(ph))\n\treturn &PhysicianUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *RoomdetailClient) UpdateOne(r *Roomdetail) *RoomdetailUpdateOne {\n\tmutation := newRoomdetailMutation(c.config, OpUpdateOne, withRoomdetail(r))\n\treturn &RoomdetailUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *OperativerecordClient) UpdateOne(o *Operativerecord) *OperativerecordUpdateOne {\n\tmutation := newOperativerecordMutation(c.config, OpUpdateOne, withOperativerecord(o))\n\treturn &OperativerecordUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *PatientroomClient) UpdateOne(pa *Patientroom) *PatientroomUpdateOne {\n\tmutation := newPatientroomMutation(c.config, OpUpdateOne, withPatientroom(pa))\n\treturn &PatientroomUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *AppointmentClient) UpdateOne(a *Appointment) *AppointmentUpdateOne {\n\tmutation := newAppointmentMutation(c.config, OpUpdateOne, withAppointment(a))\n\treturn &AppointmentUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *ToolClient) UpdateOne(t *Tool) *ToolUpdateOne {\n\tmutation := newToolMutation(c.config, OpUpdateOne, withTool(t))\n\treturn &ToolUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *UnsavedPostClient) UpdateOne(up *UnsavedPost) *UnsavedPostUpdateOne {\n\tmutation := newUnsavedPostMutation(c.config, OpUpdateOne, withUnsavedPost(up))\n\treturn &UnsavedPostUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *WorkExperienceClient) UpdateOne(we *WorkExperience) *WorkExperienceUpdateOne {\n\tmutation := newWorkExperienceMutation(c.config, OpUpdateOne, withWorkExperience(we))\n\treturn &WorkExperienceUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *TransactionClient) UpdateOne(t *Transaction) *TransactionUpdateOne {\n\tmutation := newTransactionMutation(c.config, OpUpdateOne, withTransaction(t))\n\treturn &TransactionUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *RoomuseClient) UpdateOne(r *Roomuse) *RoomuseUpdateOne {\n\tmutation := newRoomuseMutation(c.config, OpUpdateOne, withRoomuse(r))\n\treturn &RoomuseUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *DispenseMedicineClient) UpdateOne(dm *DispenseMedicine) *DispenseMedicineUpdateOne {\n\tmutation := newDispenseMedicineMutation(c.config, OpUpdateOne, withDispenseMedicine(dm))\n\treturn &DispenseMedicineUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *OrderClient) UpdateOne(o *Order) *OrderUpdateOne {\n\tmutation := newOrderMutation(c.config, OpUpdateOne, withOrder(o))\n\treturn &OrderUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *PharmacistClient) UpdateOne(ph *Pharmacist) *PharmacistUpdateOne {\n\tmutation := newPharmacistMutation(c.config, OpUpdateOne, withPharmacist(ph))\n\treturn &PharmacistUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *BookingClient) UpdateOne(b *Booking) *BookingUpdateOne {\n\tmutation := newBookingMutation(c.config, OpUpdateOne, withBooking(b))\n\treturn &BookingUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *MedicineClient) UpdateOne(m *Medicine) *MedicineUpdateOne {\n\tmutation := newMedicineMutation(c.config, OpUpdateOne, withMedicine(m))\n\treturn &MedicineUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *MedicineTypeClient) UpdateOne(mt *MedicineType) *MedicineTypeUpdateOne {\n\tmutation := newMedicineTypeMutation(c.config, OpUpdateOne, withMedicineType(mt))\n\treturn &MedicineTypeUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *DoctorClient) UpdateOne(d *Doctor) *DoctorUpdateOne {\n\tmutation := newDoctorMutation(c.config, OpUpdateOne, withDoctor(d))\n\treturn &DoctorUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *PatientofphysicianClient) UpdateOne(pa *Patientofphysician) *PatientofphysicianUpdateOne {\n\tmutation := newPatientofphysicianMutation(c.config, OpUpdateOne, withPatientofphysician(pa))\n\treturn &PatientofphysicianUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *ActivityTypeClient) UpdateOne(at *ActivityType) *ActivityTypeUpdateOne {\n\tmutation := newActivityTypeMutation(c.config, OpUpdateOne, withActivityType(at))\n\treturn &ActivityTypeUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *DNSBLQueryClient) UpdateOne(dq *DNSBLQuery) *DNSBLQueryUpdateOne {\n\tmutation := newDNSBLQueryMutation(c.config, OpUpdateOne, withDNSBLQuery(dq))\n\treturn &DNSBLQueryUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *OperativeClient) UpdateOne(o *Operative) *OperativeUpdateOne {\n\tmutation := newOperativeMutation(c.config, OpUpdateOne, withOperative(o))\n\treturn &OperativeUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *PatientClient) UpdateOne(pa *Patient) *PatientUpdateOne {\n\tmutation := newPatientMutation(c.config, OpUpdateOne, withPatient(pa))\n\treturn &PatientUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *PatientClient) UpdateOne(pa *Patient) *PatientUpdateOne {\n\tmutation := newPatientMutation(c.config, OpUpdateOne, withPatient(pa))\n\treturn &PatientUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *PatientClient) UpdateOne(pa *Patient) *PatientUpdateOne {\n\tmutation := newPatientMutation(c.config, OpUpdateOne, withPatient(pa))\n\treturn &PatientUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *FoodmenuClient) UpdateOne(f *Foodmenu) *FoodmenuUpdateOne {\n\tmutation := newFoodmenuMutation(c.config, OpUpdateOne, withFoodmenu(f))\n\treturn &FoodmenuUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *StaytypeClient) UpdateOne(s *Staytype) *StaytypeUpdateOne {\n\tmutation := newStaytypeMutation(c.config, OpUpdateOne, withStaytype(s))\n\treturn &StaytypeUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *LevelOfDangerousClient) UpdateOne(lod *LevelOfDangerous) *LevelOfDangerousUpdateOne {\n\tmutation := newLevelOfDangerousMutation(c.config, OpUpdateOne, withLevelOfDangerous(lod))\n\treturn &LevelOfDangerousUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (su *PostUseCase) UpdateOne(id string, request data.Post) error {\n\tpost := &models.Post{ID: id}\n\terr := post.Get()\n\tif err != nil {\n\t\treturn err\n\t}\n\tpost.Post = request\n\terr = post.Update()\n\treturn err\n}", "func UpdateOne(query interface{}, update interface{}) error {\n\treturn db.Update(Collection, query, update)\n}", "func (c *PartorderClient) UpdateOne(pa *Partorder) *PartorderUpdateOne {\n\tmutation := newPartorderMutation(c.config, OpUpdateOne, withPartorder(pa))\n\treturn &PartorderUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *UnitOfMedicineClient) UpdateOne(uom *UnitOfMedicine) *UnitOfMedicineUpdateOne {\n\tmutation := newUnitOfMedicineMutation(c.config, OpUpdateOne, withUnitOfMedicine(uom))\n\treturn &UnitOfMedicineUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *PurposeClient) UpdateOne(pu *Purpose) *PurposeUpdateOne {\n\tmutation := newPurposeMutation(c.config, OpUpdateOne, withPurpose(pu))\n\treturn &PurposeUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *ExaminationroomClient) UpdateOne(e *Examinationroom) *ExaminationroomUpdateOne {\n\tmutation := newExaminationroomMutation(c.config, OpUpdateOne, withExaminationroom(e))\n\treturn &ExaminationroomUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *PaymentClient) UpdateOne(pa *Payment) *PaymentUpdateOne {\n\tmutation := newPaymentMutation(c.config, OpUpdateOne, withPayment(pa))\n\treturn &PaymentUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *PaymentClient) UpdateOne(pa *Payment) *PaymentUpdateOne {\n\tmutation := newPaymentMutation(c.config, OpUpdateOne, withPayment(pa))\n\treturn &PaymentUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *StatustClient) UpdateOne(s *Statust) *StatustUpdateOne {\n\tmutation := newStatustMutation(c.config, OpUpdateOne, withStatust(s))\n\treturn &StatustUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *TagClient) UpdateOne(t *Tag) *TagUpdateOne {\n\tmutation := newTagMutation(c.config, OpUpdateOne, withTag(t))\n\treturn &TagUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *RepairinvoiceClient) UpdateOne(r *Repairinvoice) *RepairinvoiceUpdateOne {\n\tmutation := newRepairinvoiceMutation(c.config, OpUpdateOne, withRepairinvoice(r))\n\treturn &RepairinvoiceUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *DepositClient) UpdateOne(d *Deposit) *DepositUpdateOne {\n\tmutation := newDepositMutation(c.config, OpUpdateOne, withDeposit(d))\n\treturn &DepositUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *EmployeeClient) UpdateOne(e *Employee) *EmployeeUpdateOne {\n\tmutation := newEmployeeMutation(c.config, OpUpdateOne, withEmployee(e))\n\treturn &EmployeeUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *EmployeeClient) UpdateOne(e *Employee) *EmployeeUpdateOne {\n\tmutation := newEmployeeMutation(c.config, OpUpdateOne, withEmployee(e))\n\treturn &EmployeeUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *EmployeeClient) UpdateOne(e *Employee) *EmployeeUpdateOne {\n\tmutation := newEmployeeMutation(c.config, OpUpdateOne, withEmployee(e))\n\treturn &EmployeeUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *RoomClient) UpdateOne(r *Room) *RoomUpdateOne {\n\tmutation := newRoomMutation(c.config, OpUpdateOne, withRoom(r))\n\treturn &RoomUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *RoomClient) UpdateOne(r *Room) *RoomUpdateOne {\n\tmutation := newRoomMutation(c.config, OpUpdateOne, withRoom(r))\n\treturn &RoomUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *BillingstatusClient) UpdateOne(b *Billingstatus) *BillingstatusUpdateOne {\n\tmutation := newBillingstatusMutation(c.config, OpUpdateOne, withBillingstatus(b))\n\treturn &BillingstatusUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *EatinghistoryClient) UpdateOne(e *Eatinghistory) *EatinghistoryUpdateOne {\n\tmutation := newEatinghistoryMutation(c.config, OpUpdateOne, withEatinghistory(e))\n\treturn &EatinghistoryUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *StatusdClient) UpdateOne(s *Statusd) *StatusdUpdateOne {\n\tmutation := newStatusdMutation(c.config, OpUpdateOne, withStatusd(s))\n\treturn &StatusdUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (b *Bill) Update() *BillUpdateOne {\n\treturn (&BillClient{config: b.config}).UpdateOne(b)\n}", "func (c *AnnotationClient) UpdateOne(a *Annotation) *AnnotationUpdateOne {\n\tmutation := newAnnotationMutation(c.config, OpUpdateOne, withAnnotation(a))\n\treturn &AnnotationUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func UpdateOne(ctx context.Context, tx pgx.Tx, sb sq.UpdateBuilder) error {\n\tq, vs, err := sb.ToSql()\n\tif err != nil {\n\t\treturn err\n\t}\n\ttag, err := tx.Exec(ctx, q, vs...)\n\tif err != nil {\n\t\treturn err\n\t}\n\tif tag.RowsAffected() != 1 {\n\t\treturn ErrNoRowsAffected\n\t}\n\treturn nil\n}", "func (c *CleanernameClient) UpdateOne(cl *Cleanername) *CleanernameUpdateOne {\n\tmutation := newCleanernameMutation(c.config, OpUpdateOne, withCleanername(cl))\n\treturn &CleanernameUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *LeaseClient) UpdateOne(l *Lease) *LeaseUpdateOne {\n\tmutation := newLeaseMutation(c.config, OpUpdateOne, withLease(l))\n\treturn &LeaseUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *BinaryFileClient) UpdateOne(bf *BinaryFile) *BinaryFileUpdateOne {\n\tmutation := newBinaryFileMutation(c.config, OpUpdateOne, withBinaryFile(bf))\n\treturn &BinaryFileUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *JobClient) UpdateOne(j *Job) *JobUpdateOne {\n\tmutation := newJobMutation(c.config, OpUpdateOne, withJob(j))\n\treturn &JobUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *ActivitiesClient) UpdateOne(a *Activities) *ActivitiesUpdateOne {\n\tmutation := newActivitiesMutation(c.config, OpUpdateOne, withActivities(a))\n\treturn &ActivitiesUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *UnsavedPostImageClient) UpdateOne(upi *UnsavedPostImage) *UnsavedPostImageUpdateOne {\n\tmutation := newUnsavedPostImageMutation(c.config, OpUpdateOne, withUnsavedPostImage(upi))\n\treturn &UnsavedPostImageUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *ClubapplicationClient) UpdateOne(cl *Clubapplication) *ClubapplicationUpdateOne {\n\tmutation := newClubapplicationMutation(c.config, OpUpdateOne, withClubapplication(cl))\n\treturn &ClubapplicationUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *SkillClient) UpdateOne(s *Skill) *SkillUpdateOne {\n\tmutation := newSkillMutation(c.config, OpUpdateOne, withSkill(s))\n\treturn &SkillUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *RentalstatusClient) UpdateOne(r *Rentalstatus) *RentalstatusUpdateOne {\n\tmutation := newRentalstatusMutation(c.config, OpUpdateOne, withRentalstatus(r))\n\treturn &RentalstatusUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *UsertypeClient) UpdateOne(u *Usertype) *UsertypeUpdateOne {\n\tmutation := newUsertypeMutation(c.config, OpUpdateOne, withUsertype(u))\n\treturn &UsertypeUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *TasteClient) UpdateOne(t *Taste) *TasteUpdateOne {\n\tmutation := newTasteMutation(c.config, OpUpdateOne, withTaste(t))\n\treturn &TasteUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *PositionassingmentClient) UpdateOne(po *Positionassingment) *PositionassingmentUpdateOne {\n\tmutation := newPositionassingmentMutation(c.config, OpUpdateOne, withPositionassingment(po))\n\treturn &PositionassingmentUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *SymptomClient) UpdateOne(s *Symptom) *SymptomUpdateOne {\n\tmutation := newSymptomMutation(c.config, OpUpdateOne, withSymptom(s))\n\treturn &SymptomUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *PartClient) UpdateOne(pa *Part) *PartUpdateOne {\n\tmutation := newPartMutation(c.config, OpUpdateOne, withPart(pa))\n\treturn &PartUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func NewUpdateOneModel() *UpdateOneModel {\n\treturn &UpdateOneModel{}\n}", "func (c *DepartmentClient) UpdateOne(d *Department) *DepartmentUpdateOne {\n\tmutation := newDepartmentMutation(c.config, OpUpdateOne, withDepartment(d))\n\treturn &DepartmentUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *SituationClient) UpdateOne(s *Situation) *SituationUpdateOne {\n\tmutation := newSituationMutation(c.config, OpUpdateOne, withSituation(s))\n\treturn &SituationUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *ComplaintClient) UpdateOne(co *Complaint) *ComplaintUpdateOne {\n\tmutation := newComplaintMutation(c.config, OpUpdateOne, withComplaint(co))\n\treturn &ComplaintUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (t *Todo) Update() *TodoUpdateOne {\n\treturn (&TodoClient{t.config}).UpdateOne(t)\n}", "func (c *QueueClient) UpdateOne(q *Queue) *QueueUpdateOne {\n\tmutation := newQueueMutation(c.config, OpUpdateOne, withQueue(q))\n\treturn &QueueUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *UserWalletClient) UpdateOne(uw *UserWallet) *UserWalletUpdateOne {\n\tmutation := newUserWalletMutation(c.config, OpUpdateOne, withUserWallet(uw))\n\treturn &UserWalletUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *BranchClient) UpdateOne(b *Branch) *BranchUpdateOne {\n\tmutation := newBranchMutation(c.config, OpUpdateOne, withBranch(b))\n\treturn &BranchUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *ReturninvoiceClient) UpdateOne(r *Returninvoice) *ReturninvoiceUpdateOne {\n\tmutation := newReturninvoiceMutation(c.config, OpUpdateOne, withReturninvoice(r))\n\treturn &ReturninvoiceUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *PatientInfoClient) UpdateOne(pi *PatientInfo) *PatientInfoUpdateOne {\n\tmutation := newPatientInfoMutation(c.config, OpUpdateOne, withPatientInfo(pi))\n\treturn &PatientInfoUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *UserClient) UpdateOne(u *User) *UserUpdateOne {\n\tmutation := newUserMutation(c.config, OpUpdateOne, withUser(u))\n\treturn &UserUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *UserClient) UpdateOne(u *User) *UserUpdateOne {\n\tmutation := newUserMutation(c.config, OpUpdateOne, withUser(u))\n\treturn &UserUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *UserClient) UpdateOne(u *User) *UserUpdateOne {\n\tmutation := newUserMutation(c.config, OpUpdateOne, withUser(u))\n\treturn &UserUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *UserClient) UpdateOne(u *User) *UserUpdateOne {\n\tmutation := newUserMutation(c.config, OpUpdateOne, withUser(u))\n\treturn &UserUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *UserClient) UpdateOne(u *User) *UserUpdateOne {\n\tmutation := newUserMutation(c.config, OpUpdateOne, withUser(u))\n\treturn &UserUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}" ]
[ "0.69773513", "0.6700239", "0.66991323", "0.66772205", "0.66711056", "0.65891296", "0.65891296", "0.65891296", "0.6529943", "0.651992", "0.6517249", "0.6488436", "0.6488436", "0.6461467", "0.64580745", "0.6444564", "0.6440813", "0.64263475", "0.6407116", "0.64044094", "0.6402244", "0.6402244", "0.6401924", "0.63997734", "0.63976485", "0.63883317", "0.63816136", "0.6380565", "0.6370969", "0.63709646", "0.6364213", "0.6363832", "0.6348345", "0.6335132", "0.6330745", "0.6325927", "0.63202494", "0.631989", "0.6319132", "0.6316663", "0.6287886", "0.6282346", "0.62710464", "0.62710464", "0.62710464", "0.6258297", "0.62548864", "0.6243332", "0.6216176", "0.62148726", "0.6214705", "0.6211075", "0.62070787", "0.6187787", "0.6186292", "0.6186292", "0.618427", "0.61778814", "0.6174648", "0.61743003", "0.61704266", "0.61704266", "0.61704266", "0.6158959", "0.6158959", "0.6158523", "0.615801", "0.61553144", "0.6135769", "0.6133886", "0.6126848", "0.610412", "0.6084781", "0.6083719", "0.607597", "0.60747206", "0.6073408", "0.60694623", "0.6044985", "0.6041846", "0.6037389", "0.60345656", "0.6029807", "0.60198456", "0.6018794", "0.60022384", "0.59993756", "0.59894186", "0.59838474", "0.5975079", "0.59639263", "0.59572136", "0.5950218", "0.5949224", "0.5938023", "0.5934483", "0.5934483", "0.5934483", "0.5934483", "0.5934483" ]
0.63263464
35
UpdateOneID returns an update builder for the given id.
func (c *AdminClient) UpdateOneID(id int) *AdminUpdateOne { mutation := newAdminMutation(c.config, OpUpdateOne, withAdminID(id)) return &AdminUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation} }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (c *BuildingClient) UpdateOneID(id int) *BuildingUpdateOne {\n\tmutation := newBuildingMutation(c.config, OpUpdateOne, withBuildingID(id))\n\treturn &BuildingUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *BedtypeClient) UpdateOneID(id int) *BedtypeUpdateOne {\n\tmutation := newBedtypeMutation(c.config, OpUpdateOne, withBedtypeID(id))\n\treturn &BedtypeUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *ModuleClient) UpdateOneID(id int) *ModuleUpdateOne {\n\treturn &ModuleUpdateOne{config: c.config, id: id}\n}", "func (c *ModuleVersionClient) UpdateOneID(id int) *ModuleVersionUpdateOne {\n\treturn &ModuleVersionUpdateOne{config: c.config, id: id}\n}", "func (c *BillClient) UpdateOneID(id int) *BillUpdateOne {\n\tmutation := newBillMutation(c.config, OpUpdateOne, withBillID(id))\n\treturn &BillUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *BillClient) UpdateOneID(id int) *BillUpdateOne {\n\tmutation := newBillMutation(c.config, OpUpdateOne, withBillID(id))\n\treturn &BillUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *BillClient) UpdateOneID(id int) *BillUpdateOne {\n\tmutation := newBillMutation(c.config, OpUpdateOne, withBillID(id))\n\treturn &BillUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *MealplanClient) UpdateOneID(id int) *MealplanUpdateOne {\n\tmutation := newMealplanMutation(c.config, OpUpdateOne, withMealplanID(id))\n\treturn &MealplanUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *BeerClient) UpdateOneID(id int) *BeerUpdateOne {\n\tmutation := newBeerMutation(c.config, OpUpdateOne, withBeerID(id))\n\treturn &BeerUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *RoomuseClient) UpdateOneID(id int) *RoomuseUpdateOne {\n\tmutation := newRoomuseMutation(c.config, OpUpdateOne, withRoomuseID(id))\n\treturn &RoomuseUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *BookingClient) UpdateOneID(id int) *BookingUpdateOne {\n\tmutation := newBookingMutation(c.config, OpUpdateOne, withBookingID(id))\n\treturn &BookingUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *CleaningroomClient) UpdateOneID(id int) *CleaningroomUpdateOne {\n\tmutation := newCleaningroomMutation(c.config, OpUpdateOne, withCleaningroomID(id))\n\treturn &CleaningroomUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *LengthtimeClient) UpdateOneID(id int) *LengthtimeUpdateOne {\n\tmutation := newLengthtimeMutation(c.config, OpUpdateOne, withLengthtimeID(id))\n\treturn &LengthtimeUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *ToolClient) UpdateOneID(id int) *ToolUpdateOne {\n\tmutation := newToolMutation(c.config, OpUpdateOne, withToolID(id))\n\treturn &ToolUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *StatustClient) UpdateOneID(id int) *StatustUpdateOne {\n\tmutation := newStatustMutation(c.config, OpUpdateOne, withStatustID(id))\n\treturn &StatustUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *DrugAllergyClient) UpdateOneID(id int) *DrugAllergyUpdateOne {\n\tmutation := newDrugAllergyMutation(c.config, OpUpdateOne, withDrugAllergyID(id))\n\treturn &DrugAllergyUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *ClubapplicationClient) UpdateOneID(id int) *ClubapplicationUpdateOne {\n\tmutation := newClubapplicationMutation(c.config, OpUpdateOne, withClubapplicationID(id))\n\treturn &ClubapplicationUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *AppointmentClient) UpdateOneID(id uuid.UUID) *AppointmentUpdateOne {\n\tmutation := newAppointmentMutation(c.config, OpUpdateOne, withAppointmentID(id))\n\treturn &AppointmentUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *EmptyClient) UpdateOneID(id int) *EmptyUpdateOne {\n\tmutation := newEmptyMutation(c.config, OpUpdateOne, withEmptyID(id))\n\treturn &EmptyUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *OperationroomClient) UpdateOneID(id int) *OperationroomUpdateOne {\n\tmutation := newOperationroomMutation(c.config, OpUpdateOne, withOperationroomID(id))\n\treturn &OperationroomUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *BinaryFileClient) UpdateOneID(id int) *BinaryFileUpdateOne {\n\tmutation := newBinaryFileMutation(c.config, OpUpdateOne, withBinaryFileID(id))\n\treturn &BinaryFileUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *PhysicianClient) UpdateOneID(id int) *PhysicianUpdateOne {\n\tmutation := newPhysicianMutation(c.config, OpUpdateOne, withPhysicianID(id))\n\treturn &PhysicianUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *PhysicianClient) UpdateOneID(id int) *PhysicianUpdateOne {\n\tmutation := newPhysicianMutation(c.config, OpUpdateOne, withPhysicianID(id))\n\treturn &PhysicianUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *RoomdetailClient) UpdateOneID(id int) *RoomdetailUpdateOne {\n\tmutation := newRoomdetailMutation(c.config, OpUpdateOne, withRoomdetailID(id))\n\treturn &RoomdetailUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *OperativeClient) UpdateOneID(id int) *OperativeUpdateOne {\n\tmutation := newOperativeMutation(c.config, OpUpdateOne, withOperativeID(id))\n\treturn &OperativeUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *DoctorClient) UpdateOneID(id int) *DoctorUpdateOne {\n\tmutation := newDoctorMutation(c.config, OpUpdateOne, withDoctorID(id))\n\treturn &DoctorUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *DentistClient) UpdateOneID(id int) *DentistUpdateOne {\n\tmutation := newDentistMutation(c.config, OpUpdateOne, withDentistID(id))\n\treturn &DentistUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *UnitOfMedicineClient) UpdateOneID(id int) *UnitOfMedicineUpdateOne {\n\tmutation := newUnitOfMedicineMutation(c.config, OpUpdateOne, withUnitOfMedicineID(id))\n\treturn &UnitOfMedicineUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *LeaseClient) UpdateOneID(id int) *LeaseUpdateOne {\n\tmutation := newLeaseMutation(c.config, OpUpdateOne, withLeaseID(id))\n\treturn &LeaseUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *PatientroomClient) UpdateOneID(id int) *PatientroomUpdateOne {\n\tmutation := newPatientroomMutation(c.config, OpUpdateOne, withPatientroomID(id))\n\treturn &PatientroomUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *RoomClient) UpdateOneID(id int) *RoomUpdateOne {\n\tmutation := newRoomMutation(c.config, OpUpdateOne, withRoomID(id))\n\treturn &RoomUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *RoomClient) UpdateOneID(id int) *RoomUpdateOne {\n\tmutation := newRoomMutation(c.config, OpUpdateOne, withRoomID(id))\n\treturn &RoomUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *JobClient) UpdateOneID(id int) *JobUpdateOne {\n\tmutation := newJobMutation(c.config, OpUpdateOne, withJobID(id))\n\treturn &JobUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *StatusdClient) UpdateOneID(id int) *StatusdUpdateOne {\n\tmutation := newStatusdMutation(c.config, OpUpdateOne, withStatusdID(id))\n\treturn &StatusdUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *BuildingClient) UpdateOne(b *Building) *BuildingUpdateOne {\n\tmutation := newBuildingMutation(c.config, OpUpdateOne, withBuilding(b))\n\treturn &BuildingUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *MedicineClient) UpdateOneID(id int) *MedicineUpdateOne {\n\tmutation := newMedicineMutation(c.config, OpUpdateOne, withMedicineID(id))\n\treturn &MedicineUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *DeviceClient) UpdateOneID(id int) *DeviceUpdateOne {\n\tmutation := newDeviceMutation(c.config, OpUpdateOne, withDeviceID(id))\n\treturn &DeviceUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *CleanernameClient) UpdateOneID(id int) *CleanernameUpdateOne {\n\tmutation := newCleanernameMutation(c.config, OpUpdateOne, withCleanernameID(id))\n\treturn &CleanernameUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *BillingstatusClient) UpdateOneID(id int) *BillingstatusUpdateOne {\n\tmutation := newBillingstatusMutation(c.config, OpUpdateOne, withBillingstatusID(id))\n\treturn &BillingstatusUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *PaymentClient) UpdateOneID(id int) *PaymentUpdateOne {\n\tmutation := newPaymentMutation(c.config, OpUpdateOne, withPaymentID(id))\n\treturn &PaymentUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *PaymentClient) UpdateOneID(id int) *PaymentUpdateOne {\n\tmutation := newPaymentMutation(c.config, OpUpdateOne, withPaymentID(id))\n\treturn &PaymentUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *LevelOfDangerousClient) UpdateOneID(id int) *LevelOfDangerousUpdateOne {\n\tmutation := newLevelOfDangerousMutation(c.config, OpUpdateOne, withLevelOfDangerousID(id))\n\treturn &LevelOfDangerousUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *FoodmenuClient) UpdateOneID(id int) *FoodmenuUpdateOne {\n\tmutation := newFoodmenuMutation(c.config, OpUpdateOne, withFoodmenuID(id))\n\treturn &FoodmenuUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *PostClient) UpdateOneID(id int) *PostUpdateOne {\n\tmutation := newPostMutation(c.config, OpUpdateOne, withPostID(id))\n\treturn &PostUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *PharmacistClient) UpdateOneID(id int) *PharmacistUpdateOne {\n\tmutation := newPharmacistMutation(c.config, OpUpdateOne, withPharmacistID(id))\n\treturn &PharmacistUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *ExaminationroomClient) UpdateOneID(id int) *ExaminationroomUpdateOne {\n\tmutation := newExaminationroomMutation(c.config, OpUpdateOne, withExaminationroomID(id))\n\treturn &ExaminationroomUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *KeyStoreClient) UpdateOneID(id int32) *KeyStoreUpdateOne {\n\tmutation := newKeyStoreMutation(c.config, OpUpdateOne, withKeyStoreID(id))\n\treturn &KeyStoreUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *ActivitiesClient) UpdateOneID(id int) *ActivitiesUpdateOne {\n\tmutation := newActivitiesMutation(c.config, OpUpdateOne, withActivitiesID(id))\n\treturn &ActivitiesUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *PatientofphysicianClient) UpdateOneID(id int) *PatientofphysicianUpdateOne {\n\tmutation := newPatientofphysicianMutation(c.config, OpUpdateOne, withPatientofphysicianID(id))\n\treturn &PatientofphysicianUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *PostAttachmentClient) UpdateOneID(id int) *PostAttachmentUpdateOne {\n\tmutation := newPostAttachmentMutation(c.config, OpUpdateOne, withPostAttachmentID(id))\n\treturn &PostAttachmentUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *SkillClient) UpdateOneID(id int) *SkillUpdateOne {\n\tmutation := newSkillMutation(c.config, OpUpdateOne, withSkillID(id))\n\treturn &SkillUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *QueueClient) UpdateOneID(id int) *QueueUpdateOne {\n\tmutation := newQueueMutation(c.config, OpUpdateOne, withQueueID(id))\n\treturn &QueueUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *EventClient) UpdateOneID(id int) *EventUpdateOne {\n\tmutation := newEventMutation(c.config, OpUpdateOne, withEventID(id))\n\treturn &EventUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *DNSBLQueryClient) UpdateOneID(id uuid.UUID) *DNSBLQueryUpdateOne {\n\tmutation := newDNSBLQueryMutation(c.config, OpUpdateOne, withDNSBLQueryID(id))\n\treturn &DNSBLQueryUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *SymptomClient) UpdateOneID(id int) *SymptomUpdateOne {\n\tmutation := newSymptomMutation(c.config, OpUpdateOne, withSymptomID(id))\n\treturn &SymptomUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *PatientClient) UpdateOneID(id int) *PatientUpdateOne {\n\tmutation := newPatientMutation(c.config, OpUpdateOne, withPatientID(id))\n\treturn &PatientUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *PatientClient) UpdateOneID(id int) *PatientUpdateOne {\n\tmutation := newPatientMutation(c.config, OpUpdateOne, withPatientID(id))\n\treturn &PatientUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *PatientClient) UpdateOneID(id int) *PatientUpdateOne {\n\tmutation := newPatientMutation(c.config, OpUpdateOne, withPatientID(id))\n\treturn &PatientUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *NurseClient) UpdateOneID(id int) *NurseUpdateOne {\n\tmutation := newNurseMutation(c.config, OpUpdateOne, withNurseID(id))\n\treturn &NurseUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *PurposeClient) UpdateOneID(id int) *PurposeUpdateOne {\n\tmutation := newPurposeMutation(c.config, OpUpdateOne, withPurposeID(id))\n\treturn &PurposeUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *OrderClient) UpdateOneID(id int) *OrderUpdateOne {\n\tmutation := newOrderMutation(c.config, OpUpdateOne, withOrderID(id))\n\treturn &OrderUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *DepositClient) UpdateOneID(id int) *DepositUpdateOne {\n\tmutation := newDepositMutation(c.config, OpUpdateOne, withDepositID(id))\n\treturn &DepositUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *DispenseMedicineClient) UpdateOneID(id int) *DispenseMedicineUpdateOne {\n\tmutation := newDispenseMedicineMutation(c.config, OpUpdateOne, withDispenseMedicineID(id))\n\treturn &DispenseMedicineUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *PartorderClient) UpdateOneID(id int) *PartorderUpdateOne {\n\tmutation := newPartorderMutation(c.config, OpUpdateOne, withPartorderID(id))\n\treturn &PartorderUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *PlanetClient) UpdateOneID(id int) *PlanetUpdateOne {\n\tmutation := newPlanetMutation(c.config, OpUpdateOne)\n\tmutation.id = &id\n\treturn &PlanetUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *StaytypeClient) UpdateOneID(id int) *StaytypeUpdateOne {\n\tmutation := newStaytypeMutation(c.config, OpUpdateOne, withStaytypeID(id))\n\treturn &StaytypeUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *UsertypeClient) UpdateOneID(id int) *UsertypeUpdateOne {\n\tmutation := newUsertypeMutation(c.config, OpUpdateOne, withUsertypeID(id))\n\treturn &UsertypeUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *RentalstatusClient) UpdateOneID(id int) *RentalstatusUpdateOne {\n\tmutation := newRentalstatusMutation(c.config, OpUpdateOne, withRentalstatusID(id))\n\treturn &RentalstatusUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *PetruleClient) UpdateOneID(id int) *PetruleUpdateOne {\n\tmutation := newPetruleMutation(c.config, OpUpdateOne, withPetruleID(id))\n\treturn &PetruleUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *ActivityTypeClient) UpdateOneID(id int) *ActivityTypeUpdateOne {\n\tmutation := newActivityTypeMutation(c.config, OpUpdateOne, withActivityTypeID(id))\n\treturn &ActivityTypeUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *WorkExperienceClient) UpdateOneID(id int) *WorkExperienceUpdateOne {\n\tmutation := newWorkExperienceMutation(c.config, OpUpdateOne, withWorkExperienceID(id))\n\treturn &WorkExperienceUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *TasteClient) UpdateOneID(id int) *TasteUpdateOne {\n\tmutation := newTasteMutation(c.config, OpUpdateOne, withTasteID(id))\n\treturn &TasteUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *OperativerecordClient) UpdateOneID(id int) *OperativerecordUpdateOne {\n\tmutation := newOperativerecordMutation(c.config, OpUpdateOne, withOperativerecordID(id))\n\treturn &OperativerecordUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *OperationClient) UpdateOneID(id uuid.UUID) *OperationUpdateOne {\n\tmutation := newOperationMutation(c.config, OpUpdateOne, withOperationID(id))\n\treturn &OperationUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *UserClient) UpdateOneID(id int) *UserUpdateOne {\n\tmutation := newUserMutation(c.config, OpUpdateOne, withUserID(id))\n\treturn &UserUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *UserClient) UpdateOneID(id int) *UserUpdateOne {\n\tmutation := newUserMutation(c.config, OpUpdateOne, withUserID(id))\n\treturn &UserUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *UserClient) UpdateOneID(id int) *UserUpdateOne {\n\tmutation := newUserMutation(c.config, OpUpdateOne, withUserID(id))\n\treturn &UserUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *UserClient) UpdateOneID(id int) *UserUpdateOne {\n\tmutation := newUserMutation(c.config, OpUpdateOne, withUserID(id))\n\treturn &UserUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *UserClient) UpdateOneID(id int) *UserUpdateOne {\n\tmutation := newUserMutation(c.config, OpUpdateOne, withUserID(id))\n\treturn &UserUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *UserClient) UpdateOneID(id int) *UserUpdateOne {\n\tmutation := newUserMutation(c.config, OpUpdateOne, withUserID(id))\n\treturn &UserUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *UserClient) UpdateOneID(id int) *UserUpdateOne {\n\tmutation := newUserMutation(c.config, OpUpdateOne, withUserID(id))\n\treturn &UserUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *FacultyClient) UpdateOneID(id int) *FacultyUpdateOne {\n\tmutation := newFacultyMutation(c.config, OpUpdateOne, withFacultyID(id))\n\treturn &FacultyUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *MedicineTypeClient) UpdateOneID(id int) *MedicineTypeUpdateOne {\n\tmutation := newMedicineTypeMutation(c.config, OpUpdateOne, withMedicineTypeID(id))\n\treturn &MedicineTypeUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *TransactionClient) UpdateOneID(id int32) *TransactionUpdateOne {\n\tmutation := newTransactionMutation(c.config, OpUpdateOne, withTransactionID(id))\n\treturn &TransactionUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *AdminSessionClient) UpdateOneID(id int) *AdminSessionUpdateOne {\n\tmutation := newAdminSessionMutation(c.config, OpUpdateOne, withAdminSessionID(id))\n\treturn &AdminSessionUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *UnsavedPostAttachmentClient) UpdateOneID(id int) *UnsavedPostAttachmentUpdateOne {\n\tmutation := newUnsavedPostAttachmentMutation(c.config, OpUpdateOne, withUnsavedPostAttachmentID(id))\n\treturn &UnsavedPostAttachmentUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *EatinghistoryClient) UpdateOneID(id int) *EatinghistoryUpdateOne {\n\tmutation := newEatinghistoryMutation(c.config, OpUpdateOne, withEatinghistoryID(id))\n\treturn &EatinghistoryUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *UnsavedPostClient) UpdateOneID(id int) *UnsavedPostUpdateOne {\n\tmutation := newUnsavedPostMutation(c.config, OpUpdateOne, withUnsavedPostID(id))\n\treturn &UnsavedPostUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *UserWalletClient) UpdateOneID(id int64) *UserWalletUpdateOne {\n\tmutation := newUserWalletMutation(c.config, OpUpdateOne, withUserWalletID(id))\n\treturn &UserWalletUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *RepairinvoiceClient) UpdateOneID(id int) *RepairinvoiceUpdateOne {\n\tmutation := newRepairinvoiceMutation(c.config, OpUpdateOne, withRepairinvoiceID(id))\n\treturn &RepairinvoiceUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *ClubappStatusClient) UpdateOneID(id int) *ClubappStatusUpdateOne {\n\tmutation := newClubappStatusMutation(c.config, OpUpdateOne, withClubappStatusID(id))\n\treturn &ClubappStatusUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *UserClient) UpdateOneID(id int64) *UserUpdateOne {\n\tmutation := newUserMutation(c.config, OpUpdateOne, withUserID(id))\n\treturn &UserUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *PledgeClient) UpdateOneID(id int) *PledgeUpdateOne {\n\tmutation := newPledgeMutation(c.config, OpUpdateOne, withPledgeID(id))\n\treturn &PledgeUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *AnnotationClient) UpdateOneID(id int) *AnnotationUpdateOne {\n\tmutation := newAnnotationMutation(c.config, OpUpdateOne, withAnnotationID(id))\n\treturn &AnnotationUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *ComplaintClient) UpdateOneID(id int) *ComplaintUpdateOne {\n\tmutation := newComplaintMutation(c.config, OpUpdateOne, withComplaintID(id))\n\treturn &ComplaintUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *PatientInfoClient) UpdateOneID(id int) *PatientInfoUpdateOne {\n\tmutation := newPatientInfoMutation(c.config, OpUpdateOne, withPatientInfoID(id))\n\treturn &PatientInfoUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *BillClient) UpdateOne(b *Bill) *BillUpdateOne {\n\tmutation := newBillMutation(c.config, OpUpdateOne, withBill(b))\n\treturn &BillUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *BillClient) UpdateOne(b *Bill) *BillUpdateOne {\n\tmutation := newBillMutation(c.config, OpUpdateOne, withBill(b))\n\treturn &BillUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *BillClient) UpdateOne(b *Bill) *BillUpdateOne {\n\tmutation := newBillMutation(c.config, OpUpdateOne, withBill(b))\n\treturn &BillUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *BedtypeClient) UpdateOne(b *Bedtype) *BedtypeUpdateOne {\n\tmutation := newBedtypeMutation(c.config, OpUpdateOne, withBedtype(b))\n\treturn &BedtypeUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}" ]
[ "0.7161348", "0.7021795", "0.70109475", "0.6987695", "0.6971843", "0.6971843", "0.6971843", "0.6955421", "0.6893299", "0.6873468", "0.686999", "0.6867514", "0.68326384", "0.67677706", "0.676005", "0.67582935", "0.67317337", "0.6730868", "0.6728914", "0.67245674", "0.67212975", "0.67189515", "0.67189515", "0.67102355", "0.6707127", "0.669769", "0.6690616", "0.66827035", "0.66774124", "0.6675087", "0.66744506", "0.66744506", "0.66643935", "0.6663119", "0.6659082", "0.6657644", "0.6655289", "0.6655261", "0.6653554", "0.66460645", "0.66460645", "0.663756", "0.6631523", "0.6627142", "0.6624707", "0.6623987", "0.6601843", "0.65797526", "0.6576547", "0.6568908", "0.65603995", "0.6557924", "0.6552158", "0.6549937", "0.6521825", "0.65147156", "0.65147156", "0.65147156", "0.65099955", "0.65054363", "0.648952", "0.6478015", "0.6473789", "0.6471547", "0.6471048", "0.6470727", "0.6462047", "0.6457952", "0.64534163", "0.64484423", "0.6447777", "0.6440799", "0.6436213", "0.64297175", "0.6427824", "0.6427824", "0.6427824", "0.6427824", "0.6427824", "0.6427824", "0.6427824", "0.6426412", "0.64258724", "0.6424467", "0.6424315", "0.64222825", "0.64198", "0.6416395", "0.6413874", "0.64108914", "0.640751", "0.6402095", "0.63971955", "0.6396155", "0.63862425", "0.63839704", "0.6378773", "0.6378773", "0.6378773", "0.6374693" ]
0.6725172
19
Delete returns a delete builder for Admin.
func (c *AdminClient) Delete() *AdminDelete { mutation := newAdminMutation(c.config, OpDelete) return &AdminDelete{config: c.config, hooks: c.Hooks(), mutation: mutation} }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (c *BuildingClient) Delete() *BuildingDelete {\n\tmutation := newBuildingMutation(c.config, OpDelete)\n\treturn &BuildingDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *Admin) Delete(id string) error {\n\n\treturn crud.Delete(id).Error()\n}", "func (c *BedtypeClient) Delete() *BedtypeDelete {\n\tmutation := newBedtypeMutation(c.config, OpDelete)\n\treturn &BedtypeDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *DoctorClient) Delete() *DoctorDelete {\n\tmutation := newDoctorMutation(c.config, OpDelete)\n\treturn &DoctorDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func NewDeleteBuilder() *DeleteBuilder {\n\treturn &DeleteBuilder{}\n}", "func (c *CleaningroomClient) Delete() *CleaningroomDelete {\n\tmutation := newCleaningroomMutation(c.config, OpDelete)\n\treturn &CleaningroomDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *FoodmenuClient) Delete() *FoodmenuDelete {\n\tmutation := newFoodmenuMutation(c.config, OpDelete)\n\treturn &FoodmenuDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *BeerClient) Delete() *BeerDelete {\n\tmutation := newBeerMutation(c.config, OpDelete)\n\treturn &BeerDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (ad *Admin) Delete() error {\n\tif ad.dbCollection == nil {\n\t\treturn errors.New(\"Uninitialized Object Admin\")\n\t}\n\treturn ad.dbCollection.RemoveId(ad.Id)\n}", "func (s *rpcServer) DeleteAdmin(ctx context.Context, req *api.DeleteAdminRequest) (*api.DeleteAdminResponse, error) {\n\treturn &api.DeleteAdminResponse{}, nil\n}", "func (c *MealplanClient) Delete() *MealplanDelete {\n\tmutation := newMealplanMutation(c.config, OpDelete)\n\treturn &MealplanDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *RoomdetailClient) Delete() *RoomdetailDelete {\n\tmutation := newRoomdetailMutation(c.config, OpDelete)\n\treturn &RoomdetailDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *LevelOfDangerousClient) Delete() *LevelOfDangerousDelete {\n\tmutation := newLevelOfDangerousMutation(c.config, OpDelete)\n\treturn &LevelOfDangerousDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *AdminSessionClient) Delete() *AdminSessionDelete {\n\tmutation := newAdminSessionMutation(c.config, OpDelete)\n\treturn &AdminSessionDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *PhysicianClient) Delete() *PhysicianDelete {\n\tmutation := newPhysicianMutation(c.config, OpDelete)\n\treturn &PhysicianDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *PhysicianClient) Delete() *PhysicianDelete {\n\tmutation := newPhysicianMutation(c.config, OpDelete)\n\treturn &PhysicianDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *RoomuseClient) Delete() *RoomuseDelete {\n\tmutation := newRoomuseMutation(c.config, OpDelete)\n\treturn &RoomuseDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *PharmacistClient) Delete() *PharmacistDelete {\n\tmutation := newPharmacistMutation(c.config, OpDelete)\n\treturn &PharmacistDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *MedicineClient) Delete() *MedicineDelete {\n\tmutation := newMedicineMutation(c.config, OpDelete)\n\treturn &MedicineDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *OperativeClient) Delete() *OperativeDelete {\n\tmutation := newOperativeMutation(c.config, OpDelete)\n\treturn &OperativeDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *DentistClient) Delete() *DentistDelete {\n\tmutation := newDentistMutation(c.config, OpDelete)\n\treturn &DentistDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *CleanernameClient) Delete() *CleanernameDelete {\n\tmutation := newCleanernameMutation(c.config, OpDelete)\n\treturn &CleanernameDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *ToolClient) Delete() *ToolDelete {\n\tmutation := newToolMutation(c.config, OpDelete)\n\treturn &ToolDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *MedicineTypeClient) Delete() *MedicineTypeDelete {\n\tmutation := newMedicineTypeMutation(c.config, OpDelete)\n\treturn &MedicineTypeDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *DeviceClient) Delete() *DeviceDelete {\n\tmutation := newDeviceMutation(c.config, OpDelete)\n\treturn &DeviceDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (b *QueryBuilder) Delete() {\n}", "func (c *PatientroomClient) Delete() *PatientroomDelete {\n\tmutation := newPatientroomMutation(c.config, OpDelete)\n\treturn &PatientroomDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *StatusdClient) Delete() *StatusdDelete {\n\tmutation := newStatusdMutation(c.config, OpDelete)\n\treturn &StatusdDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *UnitOfMedicineClient) Delete() *UnitOfMedicineDelete {\n\tmutation := newUnitOfMedicineMutation(c.config, OpDelete)\n\treturn &UnitOfMedicineDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *OperativerecordClient) Delete() *OperativerecordDelete {\n\tmutation := newOperativerecordMutation(c.config, OpDelete)\n\treturn &OperativerecordDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *OperationroomClient) Delete() *OperationroomDelete {\n\tmutation := newOperationroomMutation(c.config, OpDelete)\n\treturn &OperationroomDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *DispenseMedicineClient) Delete() *DispenseMedicineDelete {\n\tmutation := newDispenseMedicineMutation(c.config, OpDelete)\n\treturn &DispenseMedicineDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *DrugAllergyClient) Delete() *DrugAllergyDelete {\n\tmutation := newDrugAllergyMutation(c.config, OpDelete)\n\treturn &DrugAllergyDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *DNSBLQueryClient) Delete() *DNSBLQueryDelete {\n\tmutation := newDNSBLQueryMutation(c.config, OpDelete)\n\treturn &DNSBLQueryDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *OperationClient) Delete() *OperationDelete {\n\tmutation := newOperationMutation(c.config, OpDelete)\n\treturn &OperationDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *PatientofphysicianClient) Delete() *PatientofphysicianDelete {\n\tmutation := newPatientofphysicianMutation(c.config, OpDelete)\n\treturn &PatientofphysicianDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *StatustClient) Delete() *StatustDelete {\n\tmutation := newStatustMutation(c.config, OpDelete)\n\treturn &StatustDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *RoomClient) Delete() *RoomDelete {\n\tmutation := newRoomMutation(c.config, OpDelete)\n\treturn &RoomDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *RoomClient) Delete() *RoomDelete {\n\tmutation := newRoomMutation(c.config, OpDelete)\n\treturn &RoomDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *PostClient) Delete() *PostDelete {\n\tmutation := newPostMutation(c.config, OpDelete)\n\treturn &PostDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *VeterinarianClient) Delete() *VeterinarianDelete {\n\tmutation := newVeterinarianMutation(c.config, OpDelete)\n\treturn &VeterinarianDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (dsl *PutDSL) Delete() linux.DeleteDSL {\n\treturn &DeleteDSL{dsl.parent, dsl.vppPut.Delete()}\n}", "func (dsl *PutDSL) Delete() linux.DeleteDSL {\n\treturn &DeleteDSL{dsl.parent, dsl.vppPut.Delete()}\n}", "func Delete(g *types.Cmd) {\n\tg.AddOptions(\"--delete\")\n}", "func Delete(streams genericclioptions.IOStreams, f factory.Factory) *cobra.Command {\n\t// o := NewDeleteOptions(streams).(*DeleteOptions)\n\n\tcmd := &cobra.Command{\n\t\tUse: \"delete\",\n\t\tDisableFlagsInUseLine: true,\n\t\tShort: \"Delete a component wih falcoctl\",\n\t\tLong: `Delete a component wih falcoctl`,\n\t}\n\n\tcmd.AddCommand(DeleteFalco(streams, f))\n\n\treturn cmd\n}", "func (c *PurposeClient) Delete() *PurposeDelete {\n\tmutation := newPurposeMutation(c.config, OpDelete)\n\treturn &PurposeDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *ExaminationroomClient) Delete() *ExaminationroomDelete {\n\tmutation := newExaminationroomMutation(c.config, OpDelete)\n\treturn &ExaminationroomDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (a *App) Delete(w http.ResponseWriter, r *http.Request) {\n\tw.Write([]byte(\"need a definition of delete on our platform\"))\n}", "func (c *DepartmentClient) Delete() *DepartmentDelete {\n\tmutation := newDepartmentMutation(c.config, OpDelete)\n\treturn &DepartmentDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (controller *EchoController) Delete(context *qhttp.Context) {\n\tcontroller.Get(context)\n}", "func (c *FacultyClient) Delete() *FacultyDelete {\n\tmutation := newFacultyMutation(c.config, OpDelete)\n\treturn &FacultyDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *OrderClient) Delete() *OrderDelete {\n\tmutation := newOrderMutation(c.config, OpDelete)\n\treturn &OrderDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *PatientClient) Delete() *PatientDelete {\n\tmutation := newPatientMutation(c.config, OpDelete)\n\treturn &PatientDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *PatientClient) Delete() *PatientDelete {\n\tmutation := newPatientMutation(c.config, OpDelete)\n\treturn &PatientDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *PatientClient) Delete() *PatientDelete {\n\tmutation := newPatientMutation(c.config, OpDelete)\n\treturn &PatientDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func NewDelete(appName string) *commander.CommandWrapper {\n\treturn &commander.CommandWrapper{\n\t\tHandler: &Delete{},\n\t\tHelp: &commander.CommandDescriptor{\n\t\t\tName: \"delete\",\n\t\t\tShortDescription: \"Delete a server.\",\n\t\t\tLongDescription: `Delete a server will destroy the world and container and the version file.`,\n\t\t\tArguments: \"name\",\n\t\t\tExamples: []string{\"\", \"my_server\"},\n\t\t},\n\t}\n}", "func (c *EmptyClient) Delete() *EmptyDelete {\n\tmutation := newEmptyMutation(c.config, OpDelete)\n\treturn &EmptyDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *PartorderClient) Delete() *PartorderDelete {\n\tmutation := newPartorderMutation(c.config, OpDelete)\n\treturn &PartorderDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *QueueClient) Delete() *QueueDelete {\n\tmutation := newQueueMutation(c.config, OpDelete)\n\treturn &QueueDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (self Accessor) Delete(expr interface{}) *DeleteManager {\n\treturn Deletion(self.Relation()).Delete(expr)\n}", "func (c *UsertypeClient) Delete() *UsertypeDelete {\n\tmutation := newUsertypeMutation(c.config, OpDelete)\n\treturn &UsertypeDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (b *Executor) Delete() (err error) {\n\tif b.builder != nil {\n\t\terr = b.builder.Delete()\n\t\tb.builder = nil\n\t}\n\treturn err\n}", "func (m *GraphBaseServiceClient) Admin()(*i7c9d1b36ac198368c1d8bed014b43e2a518b170ee45bf02c8bbe64544a50539a.AdminRequestBuilder) {\n return i7c9d1b36ac198368c1d8bed014b43e2a518b170ee45bf02c8bbe64544a50539a.NewAdminRequestBuilderInternal(m.pathParameters, m.requestAdapter);\n}", "func (m *GraphBaseServiceClient) Admin()(*i7c9d1b36ac198368c1d8bed014b43e2a518b170ee45bf02c8bbe64544a50539a.AdminRequestBuilder) {\n return i7c9d1b36ac198368c1d8bed014b43e2a518b170ee45bf02c8bbe64544a50539a.NewAdminRequestBuilderInternal(m.pathParameters, m.requestAdapter);\n}", "func (c *WalletNodeClient) Delete() *WalletNodeDelete {\n\tmutation := newWalletNodeMutation(c.config, OpDelete)\n\treturn &WalletNodeDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *LeaseClient) Delete() *LeaseDelete {\n\tmutation := newLeaseMutation(c.config, OpDelete)\n\treturn &LeaseDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *DepositClient) Delete() *DepositDelete {\n\tmutation := newDepositMutation(c.config, OpDelete)\n\treturn &DepositDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *ModuleClient) Delete() *ModuleDelete {\n\treturn &ModuleDelete{config: c.config}\n}", "func (c *ShortcutController) Delete() {\n\n\to := orm.NewOrm()\n\ttoken := c.Ctx.Input.Header(\"Authorization\")\n\t_auth := models.Auths{Token: token}\n\tif err := o.Read(&_auth, \"Token\"); err != nil {\n\t\tc.Data[\"json\"] = utils.ResponseError(c.Ctx, \"登录已失效!\", nil)\n\t\tc.ServeJSON()\n\t\treturn\n\t}\n\t_admin := models.Admin{ID: _auth.UID}\n\t_ = o.Read(&_admin)\n\n\tid, _ := strconv.ParseInt(c.Ctx.Input.Param(\":id\"), 10, 64)\n\n\tshortcut := models.Shortcut{ID: id}\n\n\t// exist\n\tif err := o.Read(&shortcut); err != nil || shortcut.UID != _admin.ID {\n\t\tc.Data[\"json\"] = utils.ResponseError(c.Ctx, \"删除失败,内容不存在!\", nil)\n\t\tc.ServeJSON()\n\t\treturn\n\t}\n\n\tif num, err := o.Delete(&shortcut); err != nil {\n\t\tlogs.Error(err)\n\t\tc.Data[\"json\"] = utils.ResponseError(c.Ctx, \"删除失败!\", nil)\n\t} else {\n\t\tc.Data[\"json\"] = utils.ResponseSuccess(c.Ctx, \"删除成功!\", &num)\n\t}\n\tc.ServeJSON()\n}", "func (c *CustomerClient) Delete() *CustomerDelete {\n\tmutation := newCustomerMutation(c.config, OpDelete)\n\treturn &CustomerDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func Delete(cmd *cobra.Command, args []string) error {\n\n\tdeleteRequest := &module.ModuleDeleteRequest{\n\t\tName: deleteOpts.name,\n\t}\n\n\tfmt.Println(\"deleting module\")\n\t_, err := Client.Delete(context.Background(), deleteRequest)\n\tif err != nil {\n\t\treturn fmt.Errorf(fmt.Sprintf(\"failed to delete module: %+v\", err))\n\t}\n\tfmt.Printf(\"deleted module %s\\n\", deleteOpts.name)\n\treturn nil\n}", "func (c *ComplaintClient) Delete() *ComplaintDelete {\n\tmutation := newComplaintMutation(c.config, OpDelete)\n\treturn &ComplaintDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (b *JoinBuilder) Delete(tables ...*Table) *DeleteBuilder {\n\treturn makeDeleteBuilder(b, tables...)\n}", "func (c *ClubTypeClient) Delete() *ClubTypeDelete {\n\tmutation := newClubTypeMutation(c.config, OpDelete)\n\treturn &ClubTypeDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *TransactionClient) Delete() *TransactionDelete {\n\tmutation := newTransactionMutation(c.config, OpDelete)\n\treturn &TransactionDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *BillClient) Delete() *BillDelete {\n\tmutation := newBillMutation(c.config, OpDelete)\n\treturn &BillDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *BillClient) Delete() *BillDelete {\n\tmutation := newBillMutation(c.config, OpDelete)\n\treturn &BillDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *BillClient) Delete() *BillDelete {\n\tmutation := newBillMutation(c.config, OpDelete)\n\treturn &BillDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *NurseClient) Delete() *NurseDelete {\n\tmutation := newNurseMutation(c.config, OpDelete)\n\treturn &NurseDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *PetruleClient) Delete() *PetruleDelete {\n\tmutation := newPetruleMutation(c.config, OpDelete)\n\treturn &PetruleDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (r *DeviceManagementRequest) Delete(ctx context.Context) error {\n\treturn r.JSONRequest(ctx, \"DELETE\", \"\", nil, nil)\n}", "func (m *DirectoryRequestBuilder) Delete(ctx context.Context, requestConfiguration *DirectoryRequestBuilderDeleteRequestConfiguration)(error) {\n requestInfo, err := m.CreateDeleteRequestInformation(ctx, requestConfiguration);\n if err != nil {\n return err\n }\n errorMapping := i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.ErrorMappings {\n \"4XX\": ia572726a95efa92ddd544552cd950653dc691023836923576b2f4bf716cf204a.CreateODataErrorFromDiscriminatorValue,\n \"5XX\": ia572726a95efa92ddd544552cd950653dc691023836923576b2f4bf716cf204a.CreateODataErrorFromDiscriminatorValue,\n }\n err = m.requestAdapter.SendNoContentAsync(ctx, requestInfo, errorMapping)\n if err != nil {\n return err\n }\n return nil\n}", "func (c *BillingstatusClient) Delete() *BillingstatusDelete {\n\tmutation := newBillingstatusMutation(c.config, OpDelete)\n\treturn &BillingstatusDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *PartClient) Delete() *PartDelete {\n\tmutation := newPartMutation(c.config, OpDelete)\n\treturn &PartDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func Delete(h http.Handler) http.Handler {\n\treturn HTTP(h, DELETE)\n}", "func OptDelete() Option {\n\treturn RequestOption(webutil.OptDelete())\n}", "func (c *PatientInfoClient) Delete() *PatientInfoDelete {\n\tmutation := newPatientInfoMutation(c.config, OpDelete)\n\treturn &PatientInfoDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *UserClient) Delete() *UserDelete {\n\tmutation := newUserMutation(c.config, OpDelete)\n\treturn &UserDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *UserClient) Delete() *UserDelete {\n\tmutation := newUserMutation(c.config, OpDelete)\n\treturn &UserDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *UserClient) Delete() *UserDelete {\n\tmutation := newUserMutation(c.config, OpDelete)\n\treturn &UserDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *UserClient) Delete() *UserDelete {\n\tmutation := newUserMutation(c.config, OpDelete)\n\treturn &UserDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *UserClient) Delete() *UserDelete {\n\tmutation := newUserMutation(c.config, OpDelete)\n\treturn &UserDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *UserClient) Delete() *UserDelete {\n\tmutation := newUserMutation(c.config, OpDelete)\n\treturn &UserDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *UserClient) Delete() *UserDelete {\n\tmutation := newUserMutation(c.config, OpDelete)\n\treturn &UserDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *UserClient) Delete() *UserDelete {\n\tmutation := newUserMutation(c.config, OpDelete)\n\treturn &UserDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *UserClient) Delete() *UserDelete {\n\tmutation := newUserMutation(c.config, OpDelete)\n\treturn &UserDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *UserClient) Delete() *UserDelete {\n\tmutation := newUserMutation(c.config, OpDelete)\n\treturn &UserDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *UserClient) Delete() *UserDelete {\n\tmutation := newUserMutation(c.config, OpDelete)\n\treturn &UserDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func NewDeleteaspecificAdminRequest(server string, id string) (*http.Request, error) {\n\tvar err error\n\n\tvar pathParam0 string\n\n\tpathParam0, err = runtime.StyleParam(\"simple\", false, \"id\", id)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tqueryUrl, err := url.Parse(server)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tbasePath := fmt.Sprintf(\"/admins/%s\", pathParam0)\n\tif basePath[0] == '/' {\n\t\tbasePath = basePath[1:]\n\t}\n\n\tqueryUrl, err = queryUrl.Parse(basePath)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treq, err := http.NewRequest(\"DELETE\", queryUrl.String(), nil)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn req, nil\n}", "func (d *cephobject) Delete(op *operations.Operation) error {\n\tif shared.IsTrue(d.config[\"volatile.pool.pristine\"]) {\n\t\terr := d.radosgwadminUserDelete(context.TODO(), cephobjectRadosgwAdminUser)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"Failed deleting admin user %q: %w\", cephobjectRadosgwAdminUser, err)\n\t\t}\n\t}\n\n\treturn nil\n}" ]
[ "0.6808646", "0.6641751", "0.657913", "0.65386504", "0.6513128", "0.64941233", "0.64625174", "0.64360094", "0.64242125", "0.6378439", "0.6348727", "0.63384336", "0.6337405", "0.63228554", "0.6312587", "0.6312587", "0.6266605", "0.6264083", "0.62565136", "0.62386465", "0.6230249", "0.62198836", "0.61807066", "0.6170866", "0.6169483", "0.61694765", "0.6165331", "0.6137673", "0.61179775", "0.61085373", "0.6082464", "0.60133713", "0.6001274", "0.59869933", "0.59809273", "0.597364", "0.59713227", "0.5961892", "0.5961892", "0.5949552", "0.594119", "0.5919874", "0.5919874", "0.5890024", "0.58844733", "0.5882232", "0.5881825", "0.58654916", "0.5861741", "0.5857371", "0.5845669", "0.58423626", "0.58420473", "0.58420473", "0.58420473", "0.5841567", "0.58285487", "0.5820811", "0.57907593", "0.5787734", "0.57853806", "0.57830757", "0.57823926", "0.57823926", "0.5763866", "0.5763199", "0.57420206", "0.5739583", "0.5737743", "0.5736531", "0.57223994", "0.5710808", "0.5709927", "0.57070154", "0.57055587", "0.5697161", "0.5697161", "0.5697161", "0.5684264", "0.56744844", "0.56685054", "0.5668295", "0.5665821", "0.5663375", "0.56532973", "0.56494725", "0.56484026", "0.5634053", "0.5634053", "0.5634053", "0.5634053", "0.5634053", "0.5634053", "0.5634053", "0.5634053", "0.5634053", "0.5634053", "0.5634053", "0.56331867", "0.5630084" ]
0.7796683
0
DeleteOne returns a delete builder for the given entity.
func (c *AdminClient) DeleteOne(a *Admin) *AdminDeleteOne { return c.DeleteOneID(a.ID) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (c *BuildingClient) DeleteOne(b *Building) *BuildingDeleteOne {\n\treturn c.DeleteOneID(b.ID)\n}", "func (c *DeviceClient) DeleteOne(d *Device) *DeviceDeleteOne {\n\treturn c.DeleteOneID(d.ID)\n}", "func (c *EmptyClient) DeleteOne(e *Empty) *EmptyDeleteOne {\n\treturn c.DeleteOneID(e.ID)\n}", "func (c *DentistClient) DeleteOne(d *Dentist) *DentistDeleteOne {\n\treturn c.DeleteOneID(d.ID)\n}", "func (c *BedtypeClient) DeleteOne(b *Bedtype) *BedtypeDeleteOne {\n\treturn c.DeleteOneID(b.ID)\n}", "func (c *OperativerecordClient) DeleteOne(o *Operativerecord) *OperativerecordDeleteOne {\n\treturn c.DeleteOneID(o.ID)\n}", "func (c *OperationClient) DeleteOne(o *Operation) *OperationDeleteOne {\n\treturn c.DeleteOneID(o.ID)\n}", "func (c *DNSBLQueryClient) DeleteOne(dq *DNSBLQuery) *DNSBLQueryDeleteOne {\n\treturn c.DeleteOneID(dq.ID)\n}", "func (c *DispenseMedicineClient) DeleteOne(dm *DispenseMedicine) *DispenseMedicineDeleteOne {\n\treturn c.DeleteOneID(dm.ID)\n}", "func (c *Command) DeleteOne() (int64, error) {\n\tclient := c.set.gom.GetClient()\n\n\tcollection := client.Database(c.set.gom.GetDatabase()).Collection(c.set.tableName)\n\n\tif len(c.set.filter.(bson.M)) == 0 {\n\t\treturn 0, errors.New(\"filter can't be empty\")\n\t}\n\n\tctx, cancelFunc := c.set.GetContext()\n\tdefer cancelFunc()\n\n\tres, err := collection.DeleteOne(ctx, c.set.filter)\n\n\tif err != nil {\n\t\treturn 0, err\n\t}\n\n\treturn res.DeletedCount, nil\n}", "func (c *DoctorClient) DeleteOne(d *Doctor) *DoctorDeleteOne {\n\treturn c.DeleteOneID(d.ID)\n}", "func NewDeleteOneModel() *DeleteOneModel {\n\treturn &DeleteOneModel{}\n}", "func (c *DrugAllergyClient) DeleteOne(da *DrugAllergy) *DrugAllergyDeleteOne {\n\treturn c.DeleteOneID(da.ID)\n}", "func (c *BeerClient) DeleteOne(b *Beer) *BeerDeleteOne {\n\treturn c.DeleteOneID(b.ID)\n}", "func (d *Demo) DeleteOne(g *gom.Gom) {\n\ttoolkit.Println(\"===== Delete One =====\")\n\n\tvar err error\n\tif d.useParams {\n\t\t_, err = g.Set(&gom.SetParams{\n\t\t\tTableName: \"hero\",\n\t\t\tFilter: gom.Eq(\"Name\", \"Batman\"),\n\t\t\tTimeout: 10,\n\t\t}).Cmd().DeleteOne()\n\t} else {\n\t\t_, err = g.Set(nil).Table(\"hero\").Timeout(10).Filter(gom.Eq(\"Name\", \"Batman\")).Cmd().DeleteOne()\n\t}\n\n\tif err != nil {\n\t\ttoolkit.Println(err.Error())\n\t\treturn\n\t}\n}", "func (c *OrderClient) DeleteOne(o *Order) *OrderDeleteOne {\n\treturn c.DeleteOneID(o.ID)\n}", "func (c *PharmacistClient) DeleteOne(ph *Pharmacist) *PharmacistDeleteOne {\n\treturn c.DeleteOneID(ph.ID)\n}", "func (c *FoodmenuClient) DeleteOne(f *Foodmenu) *FoodmenuDeleteOne {\n\treturn c.DeleteOneID(f.ID)\n}", "func (c *CleaningroomClient) DeleteOne(cl *Cleaningroom) *CleaningroomDeleteOne {\n\treturn c.DeleteOneID(cl.ID)\n}", "func (c *PatientClient) DeleteOne(pa *Patient) *PatientDeleteOne {\n\treturn c.DeleteOneID(pa.ID)\n}", "func (c *PatientClient) DeleteOne(pa *Patient) *PatientDeleteOne {\n\treturn c.DeleteOneID(pa.ID)\n}", "func (c *PatientClient) DeleteOne(pa *Patient) *PatientDeleteOne {\n\treturn c.DeleteOneID(pa.ID)\n}", "func (c *PostClient) DeleteOne(po *Post) *PostDeleteOne {\n\treturn c.DeleteOneID(po.ID)\n}", "func (c *CompanyClient) DeleteOne(co *Company) *CompanyDeleteOne {\n\treturn c.DeleteOneID(co.ID)\n}", "func (c *CompanyClient) DeleteOne(co *Company) *CompanyDeleteOne {\n\treturn c.DeleteOneID(co.ID)\n}", "func (c *DepositClient) DeleteOne(d *Deposit) *DepositDeleteOne {\n\treturn c.DeleteOneID(d.ID)\n}", "func (c *OperativeClient) DeleteOne(o *Operative) *OperativeDeleteOne {\n\treturn c.DeleteOneID(o.ID)\n}", "func (c *EventClient) DeleteOne(e *Event) *EventDeleteOne {\n\treturn c.DeleteOneID(e.ID)\n}", "func (c *UnsavedPostClient) DeleteOne(up *UnsavedPost) *UnsavedPostDeleteOne {\n\treturn c.DeleteOneID(up.ID)\n}", "func (c *BedtypeClient) DeleteOneID(id int) *BedtypeDeleteOne {\n\tbuilder := c.Delete().Where(bedtype.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &BedtypeDeleteOne{builder}\n}", "func (c *MedicineClient) DeleteOne(m *Medicine) *MedicineDeleteOne {\n\treturn c.DeleteOneID(m.ID)\n}", "func (c *OperativerecordClient) DeleteOneID(id int) *OperativerecordDeleteOne {\n\tbuilder := c.Delete().Where(operativerecord.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &OperativerecordDeleteOne{builder}\n}", "func (c *PatientofphysicianClient) DeleteOne(pa *Patientofphysician) *PatientofphysicianDeleteOne {\n\treturn c.DeleteOneID(pa.ID)\n}", "func (c *PhysicianClient) DeleteOne(ph *Physician) *PhysicianDeleteOne {\n\treturn c.DeleteOneID(ph.ID)\n}", "func (c *PhysicianClient) DeleteOne(ph *Physician) *PhysicianDeleteOne {\n\treturn c.DeleteOneID(ph.ID)\n}", "func DeleteOne(ctx context.Context, tx pgx.Tx, sb sq.DeleteBuilder) error {\n\tq, vs, err := sb.ToSql()\n\tif err != nil {\n\t\treturn err\n\t}\n\ttag, err := tx.Exec(ctx, q, vs...)\n\tif err != nil {\n\t\treturn err\n\t}\n\tif tag.RowsAffected() != 1 {\n\t\treturn ErrNoRowsAffected\n\t}\n\treturn nil\n}", "func (c *TransactionClient) DeleteOne(t *Transaction) *TransactionDeleteOne {\n\treturn c.DeleteOneID(t.ID)\n}", "func (c *LevelOfDangerousClient) DeleteOne(lod *LevelOfDangerous) *LevelOfDangerousDeleteOne {\n\treturn c.DeleteOneID(lod.ID)\n}", "func (c *BillClient) DeleteOne(b *Bill) *BillDeleteOne {\n\treturn c.DeleteOneID(b.ID)\n}", "func (c *BillClient) DeleteOne(b *Bill) *BillDeleteOne {\n\treturn c.DeleteOneID(b.ID)\n}", "func (c *BillClient) DeleteOne(b *Bill) *BillDeleteOne {\n\treturn c.DeleteOneID(b.ID)\n}", "func (c *PaymentClient) DeleteOne(pa *Payment) *PaymentDeleteOne {\n\treturn c.DeleteOneID(pa.ID)\n}", "func (c *PaymentClient) DeleteOne(pa *Payment) *PaymentDeleteOne {\n\treturn c.DeleteOneID(pa.ID)\n}", "func (c *CleanernameClient) DeleteOne(cl *Cleanername) *CleanernameDeleteOne {\n\treturn c.DeleteOneID(cl.ID)\n}", "func (d *DBRepository) deleteOne(ctx context.Context, id string) error {\n\tobjectId, err := primitive.ObjectIDFromHex(id)\n\tif err != nil {\n\t\treturn err\n\t}\n\tif _, err := d.Collection.DeleteOne(ctx, bson.M{\"_id\": objectId}); err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "func (c *MedicineTypeClient) DeleteOne(mt *MedicineType) *MedicineTypeDeleteOne {\n\treturn c.DeleteOneID(mt.ID)\n}", "func (c *StatusdClient) DeleteOne(s *Statusd) *StatusdDeleteOne {\n\treturn c.DeleteOneID(s.ID)\n}", "func (c *ToolClient) DeleteOne(t *Tool) *ToolDeleteOne {\n\treturn c.DeleteOneID(t.ID)\n}", "func (c *ActivityTypeClient) DeleteOne(at *ActivityType) *ActivityTypeDeleteOne {\n\treturn c.DeleteOneID(at.ID)\n}", "func (c *LevelOfDangerousClient) DeleteOneID(id int) *LevelOfDangerousDeleteOne {\n\tbuilder := c.Delete().Where(levelofdangerous.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &LevelOfDangerousDeleteOne{builder}\n}", "func (c *OperationroomClient) DeleteOne(o *Operationroom) *OperationroomDeleteOne {\n\treturn c.DeleteOneID(o.ID)\n}", "func (c *TagClient) DeleteOne(t *Tag) *TagDeleteOne {\n\treturn c.DeleteOneID(t.ID)\n}", "func (c *DentistClient) DeleteOneID(id int) *DentistDeleteOne {\n\tbuilder := c.Delete().Where(dentist.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &DentistDeleteOne{builder}\n}", "func (c *OperativeClient) DeleteOneID(id int) *OperativeDeleteOne {\n\tbuilder := c.Delete().Where(operative.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &OperativeDeleteOne{builder}\n}", "func NewDeleteOneNoContent() *DeleteOneNoContent {\n\treturn &DeleteOneNoContent{}\n}", "func (c *UnsavedPostClient) DeleteOneID(id int) *UnsavedPostDeleteOne {\n\tbuilder := c.Delete().Where(unsavedpost.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &UnsavedPostDeleteOne{builder}\n}", "func (c *StaytypeClient) DeleteOne(s *Staytype) *StaytypeDeleteOne {\n\treturn c.DeleteOneID(s.ID)\n}", "func (c *OrderClient) DeleteOneID(id int) *OrderDeleteOne {\n\tbuilder := c.Delete().Where(order.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &OrderDeleteOne{builder}\n}", "func (c *BuildingClient) DeleteOneID(id int) *BuildingDeleteOne {\n\tbuilder := c.Delete().Where(building.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &BuildingDeleteOne{builder}\n}", "func (c *PostClient) DeleteOneID(id int) *PostDeleteOne {\n\tbuilder := c.Delete().Where(post.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &PostDeleteOne{builder}\n}", "func (c *PatientroomClient) DeleteOne(pa *Patientroom) *PatientroomDeleteOne {\n\treturn c.DeleteOneID(pa.ID)\n}", "func (c *EventClient) DeleteOneID(id int) *EventDeleteOne {\n\tbuilder := c.Delete().Where(event.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &EventDeleteOne{builder}\n}", "func NewDeleteOneDefault(code int) *DeleteOneDefault {\n\treturn &DeleteOneDefault{\n\t\t_statusCode: code,\n\t}\n}", "func (c *UnsavedPostAttachmentClient) DeleteOne(upa *UnsavedPostAttachment) *UnsavedPostAttachmentDeleteOne {\n\treturn c.DeleteOneID(upa.ID)\n}", "func (c *UnitOfMedicineClient) DeleteOne(uom *UnitOfMedicine) *UnitOfMedicineDeleteOne {\n\treturn c.DeleteOneID(uom.ID)\n}", "func (c *FoodmenuClient) DeleteOneID(id int) *FoodmenuDeleteOne {\n\tbuilder := c.Delete().Where(foodmenu.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &FoodmenuDeleteOne{builder}\n}", "func (c *PostAttachmentClient) DeleteOne(pa *PostAttachment) *PostAttachmentDeleteOne {\n\treturn c.DeleteOneID(pa.ID)\n}", "func (c *DeviceClient) DeleteOneID(id int) *DeviceDeleteOne {\n\tbuilder := c.Delete().Where(device.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &DeviceDeleteOne{builder}\n}", "func (c *ToolClient) DeleteOneID(id int) *ToolDeleteOne {\n\tbuilder := c.Delete().Where(tool.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &ToolDeleteOne{builder}\n}", "func (c *AppointmentClient) DeleteOne(a *Appointment) *AppointmentDeleteOne {\n\treturn c.DeleteOneID(a.ID)\n}", "func (c *EmptyClient) DeleteOneID(id int) *EmptyDeleteOne {\n\tbuilder := c.Delete().Where(empty.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &EmptyDeleteOne{builder}\n}", "func (c *PurposeClient) DeleteOne(pu *Purpose) *PurposeDeleteOne {\n\treturn c.DeleteOneID(pu.ID)\n}", "func (c *AdminClient) DeleteOneID(id int) *AdminDeleteOne {\n\tbuilder := c.Delete().Where(admin.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &AdminDeleteOne{builder}\n}", "func (c *CleaningroomClient) DeleteOneID(id int) *CleaningroomDeleteOne {\n\tbuilder := c.Delete().Where(cleaningroom.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &CleaningroomDeleteOne{builder}\n}", "func (c *LengthtimeClient) DeleteOneID(id int) *LengthtimeDeleteOne {\n\tbuilder := c.Delete().Where(lengthtime.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &LengthtimeDeleteOne{builder}\n}", "func (c *DepartmentClient) DeleteOne(d *Department) *DepartmentDeleteOne {\n\treturn c.DeleteOneID(d.ID)\n}", "func (c *UnsavedPostAttachmentClient) DeleteOneID(id int) *UnsavedPostAttachmentDeleteOne {\n\tbuilder := c.Delete().Where(unsavedpostattachment.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &UnsavedPostAttachmentDeleteOne{builder}\n}", "func (c *PhysicianClient) DeleteOneID(id int) *PhysicianDeleteOne {\n\tbuilder := c.Delete().Where(physician.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &PhysicianDeleteOne{builder}\n}", "func (c *PhysicianClient) DeleteOneID(id int) *PhysicianDeleteOne {\n\tbuilder := c.Delete().Where(physician.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &PhysicianDeleteOne{builder}\n}", "func (c *DoctorClient) DeleteOneID(id int) *DoctorDeleteOne {\n\tbuilder := c.Delete().Where(doctor.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &DoctorDeleteOne{builder}\n}", "func (c *MealplanClient) DeleteOne(m *Mealplan) *MealplanDeleteOne {\n\treturn c.DeleteOneID(m.ID)\n}", "func (c *CleanernameClient) DeleteOneID(id int) *CleanernameDeleteOne {\n\tbuilder := c.Delete().Where(cleanername.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &CleanernameDeleteOne{builder}\n}", "func (c *ComplaintClient) DeleteOne(co *Complaint) *ComplaintDeleteOne {\n\treturn c.DeleteOneID(co.ID)\n}", "func (c *StatustClient) DeleteOneID(id int) *StatustDeleteOne {\n\tbuilder := c.Delete().Where(statust.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &StatustDeleteOne{builder}\n}", "func (c *PartorderClient) DeleteOne(pa *Partorder) *PartorderDeleteOne {\n\treturn c.DeleteOneID(pa.ID)\n}", "func (c *StaytypeClient) DeleteOneID(id int) *StaytypeDeleteOne {\n\tbuilder := c.Delete().Where(staytype.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &StaytypeDeleteOne{builder}\n}", "func (c *PatientofphysicianClient) DeleteOneID(id int) *PatientofphysicianDeleteOne {\n\tbuilder := c.Delete().Where(patientofphysician.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &PatientofphysicianDeleteOne{builder}\n}", "func (c *RoomdetailClient) DeleteOne(r *Roomdetail) *RoomdetailDeleteOne {\n\treturn c.DeleteOneID(r.ID)\n}", "func (c *BranchClient) DeleteOne(b *Branch) *BranchDeleteOne {\n\treturn c.DeleteOneID(b.ID)\n}", "func (c *UnitOfMedicineClient) DeleteOneID(id int) *UnitOfMedicineDeleteOne {\n\tbuilder := c.Delete().Where(unitofmedicine.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &UnitOfMedicineDeleteOne{builder}\n}", "func (c *TitleClient) DeleteOne(t *Title) *TitleDeleteOne {\n\treturn c.DeleteOneID(t.ID)\n}", "func (c *WorkExperienceClient) DeleteOne(we *WorkExperience) *WorkExperienceDeleteOne {\n\treturn c.DeleteOneID(we.ID)\n}", "func (c *AnnotationClient) DeleteOne(a *Annotation) *AnnotationDeleteOne {\n\treturn c.DeleteOneID(a.ID)\n}", "func (c *DispenseMedicineClient) DeleteOneID(id int) *DispenseMedicineDeleteOne {\n\tbuilder := c.Delete().Where(dispensemedicine.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &DispenseMedicineDeleteOne{builder}\n}", "func (c *UnsavedPostImageClient) DeleteOne(upi *UnsavedPostImage) *UnsavedPostImageDeleteOne {\n\treturn c.DeleteOneID(upi.ID)\n}", "func (c *DepositClient) DeleteOneID(id int) *DepositDeleteOne {\n\tbuilder := c.Delete().Where(deposit.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &DepositDeleteOne{builder}\n}", "func (c *PharmacistClient) DeleteOneID(id int) *PharmacistDeleteOne {\n\tbuilder := c.Delete().Where(pharmacist.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &PharmacistDeleteOne{builder}\n}", "func (c *PositionassingmentClient) DeleteOne(po *Positionassingment) *PositionassingmentDeleteOne {\n\treturn c.DeleteOneID(po.ID)\n}", "func (c *KeyStoreClient) DeleteOneID(id int32) *KeyStoreDeleteOne {\n\tbuilder := c.Delete().Where(keystore.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &KeyStoreDeleteOne{builder}\n}", "func (c *PaymentClient) DeleteOneID(id int) *PaymentDeleteOne {\n\tbuilder := c.Delete().Where(payment.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &PaymentDeleteOne{builder}\n}" ]
[ "0.6754239", "0.67072296", "0.67016196", "0.67011034", "0.6653609", "0.66129434", "0.6570163", "0.6555882", "0.6550148", "0.6522204", "0.6504479", "0.6499032", "0.64316624", "0.6429749", "0.64246684", "0.6418696", "0.63832575", "0.6371247", "0.63639766", "0.63630384", "0.63630384", "0.63630384", "0.6360122", "0.6355269", "0.6355269", "0.6351107", "0.63370615", "0.6333473", "0.6327508", "0.63201904", "0.63149154", "0.6302125", "0.6295902", "0.6284729", "0.6284729", "0.6276979", "0.62732875", "0.62684214", "0.6266123", "0.6266123", "0.6266123", "0.62612474", "0.62612474", "0.626064", "0.62476856", "0.6246732", "0.62460977", "0.62330806", "0.6232218", "0.6224974", "0.62241215", "0.62202203", "0.6211777", "0.6209366", "0.6203329", "0.6194709", "0.61866176", "0.6185029", "0.61803836", "0.6173257", "0.61721545", "0.61568314", "0.6156593", "0.61521", "0.6147634", "0.61444926", "0.61355424", "0.61347204", "0.6133231", "0.6115534", "0.611403", "0.611028", "0.6107552", "0.6100868", "0.60994744", "0.609352", "0.6092299", "0.60922116", "0.60922116", "0.60901564", "0.6088162", "0.608726", "0.60788137", "0.60774815", "0.6075914", "0.6070514", "0.60651606", "0.6063153", "0.6062919", "0.6060779", "0.6053847", "0.6052841", "0.6044668", "0.60371774", "0.603689", "0.6034605", "0.6022237", "0.60202974", "0.6018651", "0.60141647" ]
0.6396313
16
DeleteOneID returns a delete builder for the given id.
func (c *AdminClient) DeleteOneID(id int) *AdminDeleteOne { builder := c.Delete().Where(admin.ID(id)) builder.mutation.id = &id builder.mutation.op = OpDeleteOne return &AdminDeleteOne{builder} }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (c *BedtypeClient) DeleteOneID(id int) *BedtypeDeleteOne {\n\tbuilder := c.Delete().Where(bedtype.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &BedtypeDeleteOne{builder}\n}", "func (c *BuildingClient) DeleteOneID(id int) *BuildingDeleteOne {\n\tbuilder := c.Delete().Where(building.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &BuildingDeleteOne{builder}\n}", "func (c *LengthtimeClient) DeleteOneID(id int) *LengthtimeDeleteOne {\n\tbuilder := c.Delete().Where(lengthtime.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &LengthtimeDeleteOne{builder}\n}", "func (c *CleanernameClient) DeleteOneID(id int) *CleanernameDeleteOne {\n\tbuilder := c.Delete().Where(cleanername.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &CleanernameDeleteOne{builder}\n}", "func (c *ToolClient) DeleteOneID(id int) *ToolDeleteOne {\n\tbuilder := c.Delete().Where(tool.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &ToolDeleteOne{builder}\n}", "func (c *OperativeClient) DeleteOneID(id int) *OperativeDeleteOne {\n\tbuilder := c.Delete().Where(operative.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &OperativeDeleteOne{builder}\n}", "func (c *FoodmenuClient) DeleteOneID(id int) *FoodmenuDeleteOne {\n\tbuilder := c.Delete().Where(foodmenu.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &FoodmenuDeleteOne{builder}\n}", "func (c *CleaningroomClient) DeleteOneID(id int) *CleaningroomDeleteOne {\n\tbuilder := c.Delete().Where(cleaningroom.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &CleaningroomDeleteOne{builder}\n}", "func (c *DoctorClient) DeleteOneID(id int) *DoctorDeleteOne {\n\tbuilder := c.Delete().Where(doctor.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &DoctorDeleteOne{builder}\n}", "func (c *MealplanClient) DeleteOneID(id int) *MealplanDeleteOne {\n\tbuilder := c.Delete().Where(mealplan.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &MealplanDeleteOne{builder}\n}", "func (c *DentistClient) DeleteOneID(id int) *DentistDeleteOne {\n\tbuilder := c.Delete().Where(dentist.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &DentistDeleteOne{builder}\n}", "func (c *OperativerecordClient) DeleteOneID(id int) *OperativerecordDeleteOne {\n\tbuilder := c.Delete().Where(operativerecord.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &OperativerecordDeleteOne{builder}\n}", "func (c *LevelOfDangerousClient) DeleteOneID(id int) *LevelOfDangerousDeleteOne {\n\tbuilder := c.Delete().Where(levelofdangerous.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &LevelOfDangerousDeleteOne{builder}\n}", "func (c *PhysicianClient) DeleteOneID(id int) *PhysicianDeleteOne {\n\tbuilder := c.Delete().Where(physician.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &PhysicianDeleteOne{builder}\n}", "func (c *PhysicianClient) DeleteOneID(id int) *PhysicianDeleteOne {\n\tbuilder := c.Delete().Where(physician.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &PhysicianDeleteOne{builder}\n}", "func (c *BillClient) DeleteOneID(id int) *BillDeleteOne {\n\tbuilder := c.Delete().Where(bill.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &BillDeleteOne{builder}\n}", "func (c *BillClient) DeleteOneID(id int) *BillDeleteOne {\n\tbuilder := c.Delete().Where(bill.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &BillDeleteOne{builder}\n}", "func (c *BillClient) DeleteOneID(id int) *BillDeleteOne {\n\tbuilder := c.Delete().Where(bill.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &BillDeleteOne{builder}\n}", "func (c *DeviceClient) DeleteOneID(id int) *DeviceDeleteOne {\n\tbuilder := c.Delete().Where(device.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &DeviceDeleteOne{builder}\n}", "func (c *UnitOfMedicineClient) DeleteOneID(id int) *UnitOfMedicineDeleteOne {\n\tbuilder := c.Delete().Where(unitofmedicine.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &UnitOfMedicineDeleteOne{builder}\n}", "func (c *DrugAllergyClient) DeleteOneID(id int) *DrugAllergyDeleteOne {\n\tbuilder := c.Delete().Where(drugallergy.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &DrugAllergyDeleteOne{builder}\n}", "func (c *RoomuseClient) DeleteOneID(id int) *RoomuseDeleteOne {\n\tbuilder := c.Delete().Where(roomuse.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &RoomuseDeleteOne{builder}\n}", "func (c *PatientofphysicianClient) DeleteOneID(id int) *PatientofphysicianDeleteOne {\n\tbuilder := c.Delete().Where(patientofphysician.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &PatientofphysicianDeleteOne{builder}\n}", "func (c *OrderClient) DeleteOneID(id int) *OrderDeleteOne {\n\tbuilder := c.Delete().Where(order.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &OrderDeleteOne{builder}\n}", "func (c *MedicineClient) DeleteOneID(id int) *MedicineDeleteOne {\n\tbuilder := c.Delete().Where(medicine.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &MedicineDeleteOne{builder}\n}", "func (c *EmptyClient) DeleteOneID(id int) *EmptyDeleteOne {\n\tbuilder := c.Delete().Where(empty.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &EmptyDeleteOne{builder}\n}", "func (c *MedicineTypeClient) DeleteOneID(id int) *MedicineTypeDeleteOne {\n\tbuilder := c.Delete().Where(medicinetype.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &MedicineTypeDeleteOne{builder}\n}", "func (c *BeerClient) DeleteOneID(id int) *BeerDeleteOne {\n\tbuilder := c.Delete().Where(beer.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &BeerDeleteOne{builder}\n}", "func (c *RoomdetailClient) DeleteOneID(id int) *RoomdetailDeleteOne {\n\tbuilder := c.Delete().Where(roomdetail.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &RoomdetailDeleteOne{builder}\n}", "func (c *StatustClient) DeleteOneID(id int) *StatustDeleteOne {\n\tbuilder := c.Delete().Where(statust.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &StatustDeleteOne{builder}\n}", "func (c *BookingClient) DeleteOneID(id int) *BookingDeleteOne {\n\tbuilder := c.Delete().Where(booking.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &BookingDeleteOne{builder}\n}", "func (c *BinaryFileClient) DeleteOneID(id int) *BinaryFileDeleteOne {\n\tbuilder := c.Delete().Where(binaryfile.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &BinaryFileDeleteOne{builder}\n}", "func (c *PharmacistClient) DeleteOneID(id int) *PharmacistDeleteOne {\n\tbuilder := c.Delete().Where(pharmacist.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &PharmacistDeleteOne{builder}\n}", "func (c *KeyStoreClient) DeleteOneID(id int32) *KeyStoreDeleteOne {\n\tbuilder := c.Delete().Where(keystore.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &KeyStoreDeleteOne{builder}\n}", "func (c *LeaseClient) DeleteOneID(id int) *LeaseDeleteOne {\n\tbuilder := c.Delete().Where(lease.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &LeaseDeleteOne{builder}\n}", "func (c *PaymentClient) DeleteOneID(id int) *PaymentDeleteOne {\n\tbuilder := c.Delete().Where(payment.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &PaymentDeleteOne{builder}\n}", "func (c *PaymentClient) DeleteOneID(id int) *PaymentDeleteOne {\n\tbuilder := c.Delete().Where(payment.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &PaymentDeleteOne{builder}\n}", "func (c *DispenseMedicineClient) DeleteOneID(id int) *DispenseMedicineDeleteOne {\n\tbuilder := c.Delete().Where(dispensemedicine.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &DispenseMedicineDeleteOne{builder}\n}", "func (c *DepositClient) DeleteOneID(id int) *DepositDeleteOne {\n\tbuilder := c.Delete().Where(deposit.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &DepositDeleteOne{builder}\n}", "func (c *StaytypeClient) DeleteOneID(id int) *StaytypeDeleteOne {\n\tbuilder := c.Delete().Where(staytype.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &StaytypeDeleteOne{builder}\n}", "func (c *OperationroomClient) DeleteOneID(id int) *OperationroomDeleteOne {\n\tbuilder := c.Delete().Where(operationroom.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &OperationroomDeleteOne{builder}\n}", "func (c *NurseClient) DeleteOneID(id int) *NurseDeleteOne {\n\tbuilder := c.Delete().Where(nurse.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &NurseDeleteOne{builder}\n}", "func (c *QueueClient) DeleteOneID(id int) *QueueDeleteOne {\n\tbuilder := c.Delete().Where(queue.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &QueueDeleteOne{builder}\n}", "func (c *OperationClient) DeleteOneID(id uuid.UUID) *OperationDeleteOne {\n\tbuilder := c.Delete().Where(operation.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &OperationDeleteOne{builder}\n}", "func (c *PostClient) DeleteOneID(id int) *PostDeleteOne {\n\tbuilder := c.Delete().Where(post.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &PostDeleteOne{builder}\n}", "func (c *ComplaintClient) DeleteOneID(id int) *ComplaintDeleteOne {\n\tbuilder := c.Delete().Where(complaint.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &ComplaintDeleteOne{builder}\n}", "func (c *PatientroomClient) DeleteOneID(id int) *PatientroomDeleteOne {\n\tbuilder := c.Delete().Where(patientroom.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &PatientroomDeleteOne{builder}\n}", "func (c *ModuleClient) DeleteOneID(id int) *ModuleDeleteOne {\n\treturn &ModuleDeleteOne{c.Delete().Where(module.ID(id))}\n}", "func (c *ComplaintTypeClient) DeleteOneID(id int) *ComplaintTypeDeleteOne {\n\tbuilder := c.Delete().Where(complainttype.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &ComplaintTypeDeleteOne{builder}\n}", "func (c *PurposeClient) DeleteOneID(id int) *PurposeDeleteOne {\n\tbuilder := c.Delete().Where(purpose.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &PurposeDeleteOne{builder}\n}", "func (c *AdminSessionClient) DeleteOneID(id int) *AdminSessionDeleteOne {\n\tbuilder := c.Delete().Where(adminsession.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &AdminSessionDeleteOne{builder}\n}", "func (c *StatusdClient) DeleteOneID(id int) *StatusdDeleteOne {\n\tbuilder := c.Delete().Where(statusd.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &StatusdDeleteOne{builder}\n}", "func (c *DNSBLQueryClient) DeleteOneID(id uuid.UUID) *DNSBLQueryDeleteOne {\n\tbuilder := c.Delete().Where(dnsblquery.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &DNSBLQueryDeleteOne{builder}\n}", "func (c *PetruleClient) DeleteOneID(id int) *PetruleDeleteOne {\n\tbuilder := c.Delete().Where(petrule.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &PetruleDeleteOne{builder}\n}", "func (c *EventClient) DeleteOneID(id int) *EventDeleteOne {\n\tbuilder := c.Delete().Where(event.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &EventDeleteOne{builder}\n}", "func (c *ClubapplicationClient) DeleteOneID(id int) *ClubapplicationDeleteOne {\n\tbuilder := c.Delete().Where(clubapplication.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &ClubapplicationDeleteOne{builder}\n}", "func (c *DisciplineClient) DeleteOneID(id int) *DisciplineDeleteOne {\n\tbuilder := c.Delete().Where(discipline.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &DisciplineDeleteOne{builder}\n}", "func (c *RoomClient) DeleteOneID(id int) *RoomDeleteOne {\n\tbuilder := c.Delete().Where(room.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &RoomDeleteOne{builder}\n}", "func (c *RoomClient) DeleteOneID(id int) *RoomDeleteOne {\n\tbuilder := c.Delete().Where(room.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &RoomDeleteOne{builder}\n}", "func (c *PledgeClient) DeleteOneID(id int) *PledgeDeleteOne {\n\tbuilder := c.Delete().Where(pledge.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &PledgeDeleteOne{builder}\n}", "func (c *CardClient) DeleteOneID(id int) *CardDeleteOne {\n\tbuilder := c.Delete().Where(card.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &CardDeleteOne{builder}\n}", "func (c *BillingstatusClient) DeleteOneID(id int) *BillingstatusDeleteOne {\n\tbuilder := c.Delete().Where(billingstatus.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &BillingstatusDeleteOne{builder}\n}", "func (c *SymptomClient) DeleteOneID(id int) *SymptomDeleteOne {\n\tbuilder := c.Delete().Where(symptom.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &SymptomDeleteOne{builder}\n}", "func (c *PatientClient) DeleteOneID(id int) *PatientDeleteOne {\n\tbuilder := c.Delete().Where(patient.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &PatientDeleteOne{builder}\n}", "func (c *PatientClient) DeleteOneID(id int) *PatientDeleteOne {\n\tbuilder := c.Delete().Where(patient.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &PatientDeleteOne{builder}\n}", "func (c *PatientClient) DeleteOneID(id int) *PatientDeleteOne {\n\tbuilder := c.Delete().Where(patient.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &PatientDeleteOne{builder}\n}", "func (c *TasteClient) DeleteOneID(id int) *TasteDeleteOne {\n\tbuilder := c.Delete().Where(taste.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &TasteDeleteOne{builder}\n}", "func (c *UnsavedPostClient) DeleteOneID(id int) *UnsavedPostDeleteOne {\n\tbuilder := c.Delete().Where(unsavedpost.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &UnsavedPostDeleteOne{builder}\n}", "func (c *JobClient) DeleteOneID(id int) *JobDeleteOne {\n\tbuilder := c.Delete().Where(job.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &JobDeleteOne{builder}\n}", "func (c *ExaminationroomClient) DeleteOneID(id int) *ExaminationroomDeleteOne {\n\tbuilder := c.Delete().Where(examinationroom.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &ExaminationroomDeleteOne{builder}\n}", "func (c *PlanetClient) DeleteOneID(id int) *PlanetDeleteOne {\n\tbuilder := c.Delete().Where(planet.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &PlanetDeleteOne{builder}\n}", "func (c *PrescriptionClient) DeleteOneID(id int) *PrescriptionDeleteOne {\n\tbuilder := c.Delete().Where(prescription.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &PrescriptionDeleteOne{builder}\n}", "func (c *TransactionClient) DeleteOneID(id int32) *TransactionDeleteOne {\n\tbuilder := c.Delete().Where(transaction.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &TransactionDeleteOne{builder}\n}", "func (c *SessionClient) DeleteOneID(id int) *SessionDeleteOne {\n\tbuilder := c.Delete().Where(session.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &SessionDeleteOne{builder}\n}", "func (c *TitleClient) DeleteOneID(id int) *TitleDeleteOne {\n\tbuilder := c.Delete().Where(title.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &TitleDeleteOne{builder}\n}", "func (c *PatientInfoClient) DeleteOneID(id int) *PatientInfoDeleteOne {\n\tbuilder := c.Delete().Where(patientinfo.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &PatientInfoDeleteOne{builder}\n}", "func (c *EatinghistoryClient) DeleteOneID(id int) *EatinghistoryDeleteOne {\n\tbuilder := c.Delete().Where(eatinghistory.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &EatinghistoryDeleteOne{builder}\n}", "func (c *WifiClient) DeleteOneID(id int) *WifiDeleteOne {\n\tbuilder := c.Delete().Where(wifi.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &WifiDeleteOne{builder}\n}", "func (c *FacultyClient) DeleteOneID(id int) *FacultyDeleteOne {\n\tbuilder := c.Delete().Where(faculty.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &FacultyDeleteOne{builder}\n}", "func (c *WalletNodeClient) DeleteOneID(id int32) *WalletNodeDeleteOne {\n\tbuilder := c.Delete().Where(walletnode.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &WalletNodeDeleteOne{builder}\n}", "func (c *ClubTypeClient) DeleteOneID(id int) *ClubTypeDeleteOne {\n\tbuilder := c.Delete().Where(clubtype.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &ClubTypeDeleteOne{builder}\n}", "func (c *AppointmentClient) DeleteOneID(id uuid.UUID) *AppointmentDeleteOne {\n\tbuilder := c.Delete().Where(appointment.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &AppointmentDeleteOne{builder}\n}", "func (c *PartorderClient) DeleteOneID(id int) *PartorderDeleteOne {\n\tbuilder := c.Delete().Where(partorder.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &PartorderDeleteOne{builder}\n}", "func (c *ClubClient) DeleteOneID(id int) *ClubDeleteOne {\n\tbuilder := c.Delete().Where(club.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &ClubDeleteOne{builder}\n}", "func (c *CoinInfoClient) DeleteOneID(id int32) *CoinInfoDeleteOne {\n\tbuilder := c.Delete().Where(coininfo.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &CoinInfoDeleteOne{builder}\n}", "func (c *ClinicClient) DeleteOneID(id uuid.UUID) *ClinicDeleteOne {\n\tbuilder := c.Delete().Where(clinic.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &ClinicDeleteOne{builder}\n}", "func (c *TimerClient) DeleteOneID(id int) *TimerDeleteOne {\n\tbuilder := c.Delete().Where(timer.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &TimerDeleteOne{builder}\n}", "func (c *ClubappStatusClient) DeleteOneID(id int) *ClubappStatusDeleteOne {\n\tbuilder := c.Delete().Where(clubappstatus.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &ClubappStatusDeleteOne{builder}\n}", "func (c *ActivityTypeClient) DeleteOneID(id int) *ActivityTypeDeleteOne {\n\tbuilder := c.Delete().Where(activitytype.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &ActivityTypeDeleteOne{builder}\n}", "func (c *ModuleVersionClient) DeleteOneID(id int) *ModuleVersionDeleteOne {\n\treturn &ModuleVersionDeleteOne{c.Delete().Where(moduleversion.ID(id))}\n}", "func (c *UsertypeClient) DeleteOneID(id int) *UsertypeDeleteOne {\n\tbuilder := c.Delete().Where(usertype.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &UsertypeDeleteOne{builder}\n}", "func (c *ActivitiesClient) DeleteOneID(id int) *ActivitiesDeleteOne {\n\tbuilder := c.Delete().Where(activities.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &ActivitiesDeleteOne{builder}\n}", "func (c *SituationClient) DeleteOneID(id int) *SituationDeleteOne {\n\tbuilder := c.Delete().Where(situation.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &SituationDeleteOne{builder}\n}", "func (c *SkillClient) DeleteOneID(id int) *SkillDeleteOne {\n\tbuilder := c.Delete().Where(skill.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &SkillDeleteOne{builder}\n}", "func (c *RentalstatusClient) DeleteOneID(id int) *RentalstatusDeleteOne {\n\tbuilder := c.Delete().Where(rentalstatus.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &RentalstatusDeleteOne{builder}\n}", "func (c *BranchClient) DeleteOneID(id int) *BranchDeleteOne {\n\tbuilder := c.Delete().Where(branch.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &BranchDeleteOne{builder}\n}", "func (c *YearClient) DeleteOneID(id int) *YearDeleteOne {\n\tbuilder := c.Delete().Where(year.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &YearDeleteOne{builder}\n}", "func (c *PartClient) DeleteOneID(id int) *PartDeleteOne {\n\tbuilder := c.Delete().Where(part.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &PartDeleteOne{builder}\n}", "func (c *TagClient) DeleteOneID(id int) *TagDeleteOne {\n\tbuilder := c.Delete().Where(tag.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &TagDeleteOne{builder}\n}", "func (c *RepairinvoiceClient) DeleteOneID(id int) *RepairinvoiceDeleteOne {\n\tbuilder := c.Delete().Where(repairinvoice.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &RepairinvoiceDeleteOne{builder}\n}" ]
[ "0.76778156", "0.75968426", "0.75511706", "0.7541144", "0.7539394", "0.7526723", "0.74882805", "0.7487795", "0.74769074", "0.74767685", "0.74631363", "0.74613", "0.7458024", "0.745116", "0.745116", "0.7442616", "0.7442616", "0.7442616", "0.743347", "0.7425805", "0.74197966", "0.7418542", "0.7399402", "0.7396725", "0.73856103", "0.73840207", "0.7375385", "0.735778", "0.73571473", "0.73506707", "0.73470324", "0.7346839", "0.7345604", "0.7343301", "0.73415756", "0.7339983", "0.7339983", "0.73328143", "0.7330048", "0.7329202", "0.7325914", "0.7323134", "0.7313714", "0.7307478", "0.7304015", "0.72893864", "0.7282448", "0.72806984", "0.72796077", "0.7279311", "0.72784746", "0.7277576", "0.7277483", "0.72763735", "0.72697914", "0.7263448", "0.72509044", "0.7238351", "0.7238351", "0.7237803", "0.72373664", "0.723381", "0.72292316", "0.7228588", "0.7228588", "0.7228588", "0.72245425", "0.72225535", "0.72206736", "0.72152764", "0.7205751", "0.7203806", "0.72032803", "0.71952355", "0.7193382", "0.7190719", "0.7189693", "0.7165575", "0.71655035", "0.71611136", "0.7160824", "0.7160091", "0.7155872", "0.71474624", "0.7144856", "0.71436256", "0.71384954", "0.7131519", "0.712696", "0.7125728", "0.71234626", "0.7122792", "0.71096176", "0.7108689", "0.71075124", "0.7105292", "0.7104324", "0.7101526", "0.7095171", "0.7091349" ]
0.7422992
20
Query returns a query builder for Admin.
func (c *AdminClient) Query() *AdminQuery { return &AdminQuery{ config: c.config, } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (c *AdminSessionClient) Query() *AdminSessionQuery {\n\treturn &AdminSessionQuery{\n\t\tconfig: c.config,\n\t}\n}", "func (c *BuildingClient) Query() *BuildingQuery {\n\treturn &BuildingQuery{config: c.config}\n}", "func (b *Blog) QueryAdmins() *UserQuery {\n\treturn NewBlogClient(b.config).QueryAdmins(b)\n}", "func (c *RoomuseClient) Query() *RoomuseQuery {\n\treturn &RoomuseQuery{config: c.config}\n}", "func (c *CleaningroomClient) Query() *CleaningroomQuery {\n\treturn &CleaningroomQuery{config: c.config}\n}", "func (c *MealplanClient) Query() *MealplanQuery {\n\treturn &MealplanQuery{config: c.config}\n}", "func (c *RoomdetailClient) Query() *RoomdetailQuery {\n\treturn &RoomdetailQuery{config: c.config}\n}", "func (t *Template) QueryCreator() *AdminQuery {\n\treturn (&TemplateClient{config: t.config}).QueryCreator(t)\n}", "func (c *LevelOfDangerousClient) Query() *LevelOfDangerousQuery {\n\treturn &LevelOfDangerousQuery{config: c.config}\n}", "func (c *UnitOfMedicineClient) Query() *UnitOfMedicineQuery {\n\treturn &UnitOfMedicineQuery{config: c.config}\n}", "func (c *MedicineClient) Query() *MedicineQuery {\n\treturn &MedicineQuery{config: c.config}\n}", "func (c *MedicineTypeClient) Query() *MedicineTypeQuery {\n\treturn &MedicineTypeQuery{config: c.config}\n}", "func (c *RoomClient) Query() *RoomQuery {\n\treturn &RoomQuery{config: c.config}\n}", "func (c *RoomClient) Query() *RoomQuery {\n\treturn &RoomQuery{config: c.config}\n}", "func (c *ModuleClient) Query() *ModuleQuery {\n\treturn &ModuleQuery{config: c.config}\n}", "func (c *ModuleVersionClient) Query() *ModuleVersionQuery {\n\treturn &ModuleVersionQuery{config: c.config}\n}", "func (c *BedtypeClient) Query() *BedtypeQuery {\n\treturn &BedtypeQuery{config: c.config}\n}", "func (builder *QueryBuilder[K, F]) Query() Query[K, F] {\n\tif len(builder.query.Conditions) == 0 {\n\t\tbuilder.Where(defaultFilter[K, F]{})\n\t}\n\tif len(builder.query.Aggregators) == 0 {\n\t\tbuilder.Aggregate(defaultAggregator[K, F]{})\n\t}\n\tbuilder.query.results = &Result[K, F]{\n\t\tentries: make(map[ResultKey]*ResultEntry[K, F]),\n\t}\n\treturn builder.query\n}", "func (c *DoctorClient) Query() *DoctorQuery {\n\treturn &DoctorQuery{config: c.config}\n}", "func (pq *PersonQuery) QueryAdminOf() *DomainQuery {\n\tquery := &DomainQuery{config: pq.config}\n\tquery.path = func(ctx context.Context) (fromU *sql.Selector, err error) {\n\t\tif err := pq.prepareQuery(ctx); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tstep := sqlgraph.NewStep(\n\t\t\tsqlgraph.From(person.Table, person.FieldID, pq.sqlQuery()),\n\t\t\tsqlgraph.To(domain.Table, domain.FieldID),\n\t\t\tsqlgraph.Edge(sqlgraph.M2M, true, person.AdminOfTable, person.AdminOfPrimaryKey...),\n\t\t)\n\t\tfromU = sqlgraph.SetNeighbors(pq.driver.Dialect(), step)\n\t\treturn fromU, nil\n\t}\n\treturn query\n}", "func (c *OperativerecordClient) Query() *OperativerecordQuery {\n\treturn &OperativerecordQuery{config: c.config}\n}", "func (r *Resolver) Query() gqlhandler.QueryResolver { return &queryResolver{r} }", "func (m *GraphBaseServiceClient) Admin()(*i7c9d1b36ac198368c1d8bed014b43e2a518b170ee45bf02c8bbe64544a50539a.AdminRequestBuilder) {\n return i7c9d1b36ac198368c1d8bed014b43e2a518b170ee45bf02c8bbe64544a50539a.NewAdminRequestBuilderInternal(m.pathParameters, m.requestAdapter);\n}", "func (m *GraphBaseServiceClient) Admin()(*i7c9d1b36ac198368c1d8bed014b43e2a518b170ee45bf02c8bbe64544a50539a.AdminRequestBuilder) {\n return i7c9d1b36ac198368c1d8bed014b43e2a518b170ee45bf02c8bbe64544a50539a.NewAdminRequestBuilderInternal(m.pathParameters, m.requestAdapter);\n}", "func (qs *Querier) QueryBuilder() *Query {\n\treturn &Query{\n\t\tPath: qs.DBPath,\n\t\t// range \"nil\" represents all time-series as querying\n\t\tRange: nil,\n\t\tType: qs.Type,\n\t}\n}", "func (c *BeerClient) Query() *BeerQuery {\n\treturn &BeerQuery{\n\t\tconfig: c.config,\n\t}\n}", "func (b *SqliteBuilder) QueryBuilder() QueryBuilder {\n\treturn b.qb\n}", "func (c *ExaminationroomClient) Query() *ExaminationroomQuery {\n\treturn &ExaminationroomQuery{config: c.config}\n}", "func (c *PatientroomClient) Query() *PatientroomQuery {\n\treturn &PatientroomQuery{config: c.config}\n}", "func (r *Resolver) Query() generated.QueryResolver { return &queryResolver{r} }", "func (r *Resolver) Query() generated.QueryResolver { return &queryResolver{r} }", "func (r *Resolver) Query() generated.QueryResolver { return &queryResolver{r} }", "func (r *Resolver) Query() generated.QueryResolver { return &queryResolver{r} }", "func (r *Resolver) Query() generated.QueryResolver { return &queryResolver{r} }", "func (r *Resolver) Query() generated.QueryResolver { return &queryResolver{r} }", "func (r *Resolver) Query() generated.QueryResolver { return &queryResolver{r} }", "func (r *Resolver) Query() generated.QueryResolver { return &queryResolver{r} }", "func (r *Resolver) Query() generated.QueryResolver { return &queryResolver{r} }", "func (r *Resolver) Query() generated.QueryResolver { return &queryResolver{r} }", "func (r *Resolver) Query() generated.QueryResolver { return &queryResolver{r} }", "func (r *Resolver) Query() generated.QueryResolver { return &queryResolver{r} }", "func (r *Resolver) Query() generated.QueryResolver { return &queryResolver{r} }", "func (r *Resolver) Query() generated.QueryResolver { return &queryResolver{r} }", "func (r *Resolver) Query() generated.QueryResolver { return &queryResolver{r} }", "func (r *Resolver) Query() generated.QueryResolver { return &queryResolver{r} }", "func (r *Resolver) Query() generated.QueryResolver { return &queryResolver{r} }", "func (r *Resolver) Query() generated.QueryResolver { return &queryResolver{r} }", "func (r *Resolver) Query() generated.QueryResolver { return &queryResolver{r} }", "func (r *Resolver) Query() generated.QueryResolver { return &queryResolver{r} }", "func (r *Resolver) Query() generated.QueryResolver { return &queryResolver{r} }", "func (r *Resolver) Query() generated.QueryResolver { return &queryResolver{r} }", "func (r *Resolver) Query() generated.QueryResolver { return &queryResolver{r} }", "func (r *Resolver) Query() generated.QueryResolver { return &queryResolver{r} }", "func (r *Resolver) Query() generated.QueryResolver { return &queryResolver{r} }", "func (r *Resolver) Query() generated.QueryResolver { return &queryResolver{r} }", "func (r *Resolver) Query() generated.QueryResolver { return &queryResolver{r} }", "func (r *Resolver) Query() generated.QueryResolver { return &queryResolver{r} }", "func (r *Resolver) Query() generated.QueryResolver { return &queryResolver{r} }", "func (r *Resolver) Query() generated.QueryResolver { return &queryResolver{r} }", "func (r *Resolver) Query() generated.QueryResolver { return &queryResolver{r} }", "func (r *Resolver) Query() generated.QueryResolver { return &queryResolver{r} }", "func (r *Resolver) Query() generated.QueryResolver { return &queryResolver{r} }", "func (r *Resolver) Query() generated.QueryResolver { return &queryResolver{r} }", "func (r *Resolver) Query() generated.QueryResolver { return &queryResolver{r} }", "func (r *Resolver) Query() generated.QueryResolver { return &queryResolver{r} }", "func (r *Resolver) Query() generated.QueryResolver { return &queryResolver{r} }", "func (r *Resolver) Query() generated.QueryResolver { return &queryResolver{r} }", "func (r *Resolver) Query() generated.QueryResolver { return &queryResolver{r} }", "func (r *Resolver) Query() generated.QueryResolver { return &queryResolver{r} }", "func (r *Resolver) Query() generated.QueryResolver { return &queryResolver{r} }", "func (r *Resolver) Query() generated.QueryResolver { return &queryResolver{r} }", "func (r *Resolver) Query() generated.QueryResolver { return &queryResolver{r} }", "func (r *Resolver) Query() generated.QueryResolver { return &queryResolver{r} }", "func (r *Resolver) Query() generated.QueryResolver { return &queryResolver{r} }", "func (r *Resolver) Query() generated.QueryResolver { return &queryResolver{r} }", "func (r *Resolver) Query() generated.QueryResolver { return &queryResolver{r} }", "func (r *Resolver) Query() generated.QueryResolver { return &queryResolver{r} }", "func (r *Resolver) Query() generated.QueryResolver { return &queryResolver{r} }", "func (r *Resolver) Query() generated.QueryResolver { return &queryResolver{r} }", "func (r *Resolver) Query() generated.QueryResolver { return &queryResolver{r} }", "func (r *Resolver) Query() generated.QueryResolver { return &queryResolver{r} }", "func (r *Resolver) Query() generated.QueryResolver { return &queryResolver{r} }", "func (r *Resolver) Query() generated.QueryResolver { return &queryResolver{r} }", "func (r *Resolver) Query() generated.QueryResolver { return &queryResolver{r} }", "func (r *Resolver) Query() generated.QueryResolver { return &queryResolver{r} }", "func (r *Resolver) Query() generated.QueryResolver { return &queryResolver{r} }", "func (r *Resolver) Query() generated.QueryResolver { return &queryResolver{r} }", "func (r *Resolver) Query() generated.QueryResolver { return &queryResolver{r} }", "func (r *Resolver) Query() generated.QueryResolver { return &queryResolver{r} }", "func (c Combinator) Query() cqr.CommonQueryRepresentation {\n\treturn c.Clause.Query\n}", "func (c *CleanernameClient) Query() *CleanernameQuery {\n\treturn &CleanernameQuery{config: c.config}\n}", "func (r *Resolver) Query() exec.QueryResolver { return &queryResolver{r} }", "func (c *OperationroomClient) Query() *OperationroomQuery {\n\treturn &OperationroomQuery{config: c.config}\n}", "func (c *DispenseMedicineClient) Query() *DispenseMedicineQuery {\n\treturn &DispenseMedicineQuery{config: c.config}\n}", "func (c *FoodmenuClient) Query() *FoodmenuQuery {\n\treturn &FoodmenuQuery{config: c.config}\n}", "func Query() error {\n\tvar user TbUser\n\terr := orm.Where(\"name=$1\", \"viney\").Limit(1).Find(&user)\n\tif err == nil {\n\t\tfmt.Println(user)\n\t\treturn nil\n\t}\n\n\treturn err\n}", "func (c *PharmacistClient) Query() *PharmacistQuery {\n\treturn &PharmacistQuery{config: c.config}\n}", "func (c *ClubapplicationClient) Query() *ClubapplicationQuery {\n\treturn &ClubapplicationQuery{config: c.config}\n}", "func (c *UserClient) Query() *UserQuery {\n\treturn &UserQuery{\n\t\tconfig: c.config,\n\t}\n}", "func (c *UserClient) Query() *UserQuery {\n\treturn &UserQuery{\n\t\tconfig: c.config,\n\t}\n}" ]
[ "0.6844605", "0.6386516", "0.6365745", "0.6336232", "0.633054", "0.6273085", "0.62604946", "0.6215902", "0.617524", "0.61749214", "0.61247945", "0.60988927", "0.60833377", "0.60833377", "0.6081326", "0.60571", "0.60317844", "0.60167766", "0.6016607", "0.6014825", "0.6007511", "0.6005302", "0.59966445", "0.59966445", "0.5986024", "0.5977666", "0.5971043", "0.5961242", "0.5953259", "0.59430194", "0.59430194", "0.59430194", "0.59430194", "0.59430194", "0.59430194", "0.59430194", "0.59430194", "0.59430194", "0.59430194", "0.59430194", "0.59430194", "0.59430194", "0.59430194", "0.59430194", "0.59430194", "0.59430194", "0.59430194", "0.59430194", "0.59430194", "0.59430194", "0.59430194", "0.59430194", "0.59430194", "0.59430194", "0.59430194", "0.59430194", "0.59430194", "0.59430194", "0.59430194", "0.59430194", "0.59430194", "0.59430194", "0.59430194", "0.59430194", "0.59430194", "0.59430194", "0.59430194", "0.59430194", "0.59430194", "0.59430194", "0.59430194", "0.59430194", "0.59430194", "0.59430194", "0.59430194", "0.59430194", "0.59430194", "0.59430194", "0.59430194", "0.59430194", "0.59430194", "0.59430194", "0.59430194", "0.59430194", "0.59430194", "0.59430194", "0.59430194", "0.59430194", "0.59430194", "0.5936336", "0.59313905", "0.59277374", "0.590055", "0.5891466", "0.58790284", "0.58037204", "0.5799208", "0.5775946", "0.57724357", "0.57724357" ]
0.76344746
0
Get returns a Admin entity by its id.
func (c *AdminClient) Get(ctx context.Context, id int) (*Admin, error) { return c.Query().Where(admin.ID(id)).Only(ctx) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func GetAdmin(w http.ResponseWriter, r *http.Request) {\n\tid := chi.URLParam(r, \"id\")\n\n\tadm, ok := mustAuthority(r.Context()).LoadAdminByID(id)\n\tif !ok {\n\t\trender.Error(w, admin.NewError(admin.ErrorNotFoundType,\n\t\t\t\"admin %s not found\", id))\n\t\treturn\n\t}\n\trender.ProtoJSON(w, adm)\n}", "func getAdmin(e echo.Context) error {\n\tdb := e.Get(\"database\").(*mgo.Database)\n\tif db == nil {\n\t\treturn fmt.Errorf(\"Bad database session\")\n\t}\n\n\tvar id bson.ObjectId\n\tif idParam := e.QueryParam(\"id\"); idParam != \"\" && bson.IsObjectIdHex(idParam) {\n\t\tid = bson.ObjectIdHex(idParam)\n\t}\n\tuuid, err := uuid.FromString(e.QueryParam(\"uuid\"))\n\tif !id.Valid() && err != nil {\n\t\treturn fmt.Errorf(\"Bad parameters\")\n\t}\n\n\ta := models.Admin{}\n\tif id.Valid() {\n\t\terr = db.C(\"Admins\").FindId(id).One(&a)\n\t} else {\n\t\terr = db.C(\"Admins\").Find(bson.M{\"adminUuid\": uuid}).One(&a)\n\t}\n\tif err != nil {\n\t\treturn e.NoContent(http.StatusNotFound)\n\t}\n\treturn e.JSON(http.StatusOK, a)\n}", "func (c *AdminSessionClient) Get(ctx context.Context, id int) (*AdminSession, error) {\n\treturn c.Query().Where(adminsession.ID(id)).Only(ctx)\n}", "func (c *Admin) Get(params cmap.CMap) (data Admin, err error) {\n\tcrud.Params(gt.Data(&data))\n\tif err = crud.Get(params).Error(); err != nil {\n\t\treturn\n\t}\n\treturn\n}", "func (service *AdminService) GetAdmin(requestedadmin *models.User) error {\n\tufw := repository.NewUnitOfWork(service.DB, true)\n\tvar authadmin models.User\n\terr := service.Repository.GetByField(ufw, requestedadmin.GetID(), \"id\", &authadmin, []string{})\n\tif (err != nil || authadmin.GetID() == uuid.UUID{}) {\n\t\treturn web.NewValidationError(\"user\", map[string]string{\"error\": \"Invalid User\"})\n\t}\n\n\t*requestedadmin = authadmin\n\treturn nil\n}", "func (s *rpcServer) GetAdmin(ctx context.Context, req *api.GetAdminRequest) (*api.GetAdminResponse, error) {\n\tadmin, err := admin.ByID(req.AdminId)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &api.GetAdminResponse{\n\t\tAdmin: &api.Admin{\n\t\t\tId: admin.ID,\n\t\t\tName: admin.Name,\n\t\t\tEmail: admin.Email,\n\t\t\tACL: admin.ACL,\n\t\t},\n\t}, nil\n}", "func getAdminByID(oid primitive.ObjectID) *mongo.SingleResult {\n\treturn adminCollection.FindOne(context.TODO(), bson.M{\n\t\t\"_id\": oid,\n\t})\n}", "func (c *LevelOfDangerousClient) Get(ctx context.Context, id int) (*LevelOfDangerous, error) {\n\treturn c.Query().Where(levelofdangerous.ID(id)).Only(ctx)\n}", "func (adminrepo *AdminRepo) GetAdminByID(id string) (*entity.Admin, error) {\n\tadmin := &entity.Admin{}\n\toid , er := primitive.ObjectIDFromHex(id)\n\tif er != nil {\n\t\treturn nil , er \n\t}\n\ter = adminrepo.DB.Collection(entity.ADMIN).FindOne( context.TODO() , bson.D{{ \"_id\", oid }} ).Decode(admin)\n\treturn admin , er \n}", "func (res Resource) GetAdmin() *Admin {\n\treturn res.admin\n}", "func get_admin (stub shim.ChaincodeStubInterface) (*Admin, error) {\n var admin Admin\n row_was_found,err := util.GetTableRow(stub, CONFIG_TABLE, []string{\"Admin\"}, &admin, util.FAIL_IF_MISSING)\n if err != nil {\n return nil,fmt.Errorf(\"Could not retrieve Admin; error was %v\", err.Error())\n }\n if !row_was_found {\n return nil,fmt.Errorf(\"Admin entry in %s not found\", CONFIG_TABLE)\n }\n return &admin,nil\n}", "func (u DomainDao) Get(id int) model.Domain {\n\tvar domain model.Domain\n\tdb := GetDb()\n\tdb.Where(\"id = ?\", id).First(&domain)\n\treturn domain\n}", "func (c *FoodmenuClient) Get(ctx context.Context, id int) (*Foodmenu, error) {\n\treturn c.Query().Where(foodmenu.ID(id)).Only(ctx)\n}", "func (m *defaultEntityManager) Get(id string) (entity *Entity) {\n\tfor _, e := range m.entities {\n\t\tif e.ID() == id {\n\t\t\treturn e\n\t\t}\n\t}\n\treturn\n}", "func (m *EntityManager) Get(id string) (entity *Entity) {\n\tfor _, e := range m.entities {\n\t\tif e.ID() == id {\n\t\t\treturn e\n\t\t}\n\t}\n\treturn\n}", "func (dao *UserDAO) Get(id uint) (*models.User, error) {\n\tvar user models.User\n\n\terr := config.Config.DB.Where(\"id = ?\", id).First(&user).Error\n\n\treturn &user, err\n}", "func (c *RoomdetailClient) Get(ctx context.Context, id int) (*Roomdetail, error) {\n\treturn c.Query().Where(roomdetail.ID(id)).Only(ctx)\n}", "func (c *DentistClient) Get(ctx context.Context, id int) (*Dentist, error) {\n\treturn c.Query().Where(dentist.ID(id)).Only(ctx)\n}", "func GetAdminPermissionById(id int) (v *AdminPermission, err error) {\n\to := orm.NewOrm()\n\tv = &AdminPermission{}\n\terr = o.QueryTable(new(AdminPermission)).Filter(\"Id\", id).RelatedSel().One(v)\n\tif err == nil {\n\t\treturn v, nil\n\t}\n\treturn nil, err\n}", "func (c *RoomuseClient) Get(ctx context.Context, id int) (*Roomuse, error) {\n\treturn c.Query().Where(roomuse.ID(id)).Only(ctx)\n}", "func (db *DB) GetAdminByID(ctx context.Context, id string) (*studynook.Admin, error) {\n\tquery := `SELECT id, email, password_hash FROM admins WHERE id = $1`\n\tadmin := &studynook.Admin{}\n\terr := db.Conn.QueryRow(ctx, query, id).Scan(&admin.ID, &admin.Email, &admin.PasswordHash)\n\tif err != nil {\n\t\treturn admin, err\n\t}\n\treturn admin, nil\n}", "func (api AdminResource) Get() (int, interface{}) {\n\treturn http.StatusOK, nil\n}", "func (c *LeaseClient) Get(ctx context.Context, id int) (*Lease, error) {\n\treturn c.Query().Where(lease.ID(id)).Only(ctx)\n}", "func (c *DoctorClient) Get(ctx context.Context, id int) (*Doctor, error) {\n\treturn c.Query().Where(doctor.ID(id)).Only(ctx)\n}", "func (c *PharmacistClient) Get(ctx context.Context, id int) (*Pharmacist, error) {\n\treturn c.Query().Where(pharmacist.ID(id)).Only(ctx)\n}", "func (l *levelDBRepo) Get(tenantID, id []byte) (Model, error) {\n\tkey := getKey(tenantID, id)\n\tdata, err := l.db.Get(key, nil)\n\tif err != nil {\n\t\treturn nil, errors.NewTypedError(ErrDocumentRepositoryModelNotFound, errors.New(\"document missing: %v\", err))\n\t}\n\n\tv := new(value)\n\terr = json.Unmarshal(data, v)\n\tif err != nil {\n\t\treturn nil, errors.NewTypedError(ErrDocumentRepositorySerialisation, errors.New(\"failed to unmarshal value: %v\", err))\n\t}\n\n\tl.mu.RLock()\n\tdefer l.mu.RUnlock()\n\tnm, err := l.getModel(v.Type)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\terr = nm.FromJSON([]byte(v.Data))\n\tif err != nil {\n\t\treturn nil, errors.NewTypedError(ErrDocumentRepositorySerialisation, errors.New(\"failed to unmarshal to model: %v\", err))\n\t}\n\n\treturn nm, nil\n}", "func (ad *Admin) Get(email, uid string) error {\n\tif ad.dbCollection == nil {\n\t\treturn errors.New(\"Uninitialized Object Admin\")\n\t}\n\tif email == \"\" { //use uid\n\t\treturn ad.dbCollection.Find(bson.M{\"uid\": uid}).One(ad)\n\t}\n\treturn ad.dbCollection.Find(bson.M{\"email\": email}).One(ad)\n\n}", "func (m *manager) Get(ctx context.Context, id int) (*models.User, error) {\n\tusers, err := m.dao.List(ctx, q.New(q.KeyWords{\"user_id\": id}))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tif len(users) == 0 {\n\t\treturn nil, errors.NotFoundError(nil).WithMessage(\"user %d not found\", id)\n\t}\n\n\treturn users[0], nil\n}", "func (dao *UserDAO) Get(id uint) (*models.User, error) {\n\tvar user models.User\n\n\t// Query Database here...\n\n\t//user = models.User{\n\t//\tModel: models.Model{ID: 1},\n\t//\tFirstName: \"Martin\",\n\t//\tLastName: \"Heinz\",\n\t//\tAddress: \"Not gonna tell you\",\n\t//\tEmail: \"[email protected]\"}\n\n\t// if using Gorm:\n\terr := config.Config.DB.Where(\"id = ?\", id).\n\t\tFirst(&user).\n\t\tError\n\n\treturn &user, err\n}", "func (c *MedicineClient) Get(ctx context.Context, id int) (*Medicine, error) {\n\treturn c.Query().Where(medicine.ID(id)).Only(ctx)\n}", "func (t *Tenants) Get(id string) (*Tenant, error) {\n\tvalue, err := t.store.Get(id)\n\tif err != nil {\n\t\treturn &Tenant{}, err\n\t}\n\tr := bytes.NewReader([]byte(value))\n\treturn Decode(r)\n}", "func (c *ModuleClient) Get(ctx context.Context, id int) (*Module, error) {\n\treturn c.Query().Where(module.ID(id)).Only(ctx)\n}", "func (c *EmployeeClient) Get(ctx context.Context, id int) (*Employee, error) {\n\treturn c.Query().Where(employee.ID(id)).Only(ctx)\n}", "func (c *EmployeeClient) Get(ctx context.Context, id int) (*Employee, error) {\n\treturn c.Query().Where(employee.ID(id)).Only(ctx)\n}", "func (c *EmployeeClient) Get(ctx context.Context, id int) (*Employee, error) {\n\treturn c.Query().Where(employee.ID(id)).Only(ctx)\n}", "func (c *ExaminationroomClient) Get(ctx context.Context, id int) (*Examinationroom, error) {\n\treturn c.Query().Where(examinationroom.ID(id)).Only(ctx)\n}", "func (s MyEntityManager) Get(id uint64) ecs.Entity {\n\treturn *s.items[id].entity\n}", "func (c *AdminClient) GetX(ctx context.Context, id int) *Admin {\n\tobj, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn obj\n}", "func (c *UserClient) Get(ctx context.Context, id uuid.UUID) (*User, error) {\n\treturn c.Query().Where(user.ID(id)).Only(ctx)\n}", "func (c *UserClient) Get(ctx context.Context, id uuid.UUID) (*User, error) {\n\treturn c.Query().Where(user.ID(id)).Only(ctx)\n}", "func (c *PhysicianClient) Get(ctx context.Context, id int) (*Physician, error) {\n\treturn c.Query().Where(physician.ID(id)).Only(ctx)\n}", "func (c *PhysicianClient) Get(ctx context.Context, id int) (*Physician, error) {\n\treturn c.Query().Where(physician.ID(id)).Only(ctx)\n}", "func (c *UserClient) Get(ctx context.Context, id int64) (*User, error) {\n\treturn c.Query().Where(user.ID(id)).Only(ctx)\n}", "func (c *UserClient) Get(ctx context.Context, id int) (*User, error) {\n\treturn c.Query().Where(user.ID(id)).Only(ctx)\n}", "func (c *UserClient) Get(ctx context.Context, id int) (*User, error) {\n\treturn c.Query().Where(user.ID(id)).Only(ctx)\n}", "func (c *UserClient) Get(ctx context.Context, id int) (*User, error) {\n\treturn c.Query().Where(user.ID(id)).Only(ctx)\n}", "func (c *UserClient) Get(ctx context.Context, id int) (*User, error) {\n\treturn c.Query().Where(user.ID(id)).Only(ctx)\n}", "func (c *UserClient) Get(ctx context.Context, id int) (*User, error) {\n\treturn c.Query().Where(user.ID(id)).Only(ctx)\n}", "func (c *UserClient) Get(ctx context.Context, id int) (*User, error) {\n\treturn c.Query().Where(user.ID(id)).Only(ctx)\n}", "func (c *UserClient) Get(ctx context.Context, id int) (*User, error) {\n\treturn c.Query().Where(user.ID(id)).Only(ctx)\n}", "func (c *UserClient) Get(ctx context.Context, id int) (*User, error) {\n\treturn c.Query().Where(user.ID(id)).Only(ctx)\n}", "func (m *Manager) Get(id string) (*Organization, error) {\n\tvar organization Organization\n\n\tobjectID := bson.ObjectIdHex(id)\n\n\tif err := m.collection.FindId(objectID).One(&organization); err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn &organization, nil\n}", "func Get(id int64) (User, error) {\n\tvar u User\n\tstmt, err := db.Prepare(\"select id, name, age, created from user where id = ? \")\n\tdefer stmt.Close()\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t\treturn u, err\n\t}\n\terr = stmt.QueryRow(id).Scan(&u.ID, &u.Name, &u.Age, &u.Created)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t\treturn u, err\n\t}\n\treturn u, nil\n}", "func (c *RoomClient) Get(ctx context.Context, id int) (*Room, error) {\n\treturn c.Query().Where(room.ID(id)).Only(ctx)\n}", "func (c *RoomClient) Get(ctx context.Context, id int) (*Room, error) {\n\treturn c.Query().Where(room.ID(id)).Only(ctx)\n}", "func (c *VeterinarianClient) Get(ctx context.Context, id uuid.UUID) (*Veterinarian, error) {\n\treturn c.Query().Where(veterinarian.ID(id)).Only(ctx)\n}", "func (c *UnitOfMedicineClient) Get(ctx context.Context, id int) (*UnitOfMedicine, error) {\n\treturn c.Query().Where(unitofmedicine.ID(id)).Only(ctx)\n}", "func (c *BuildingClient) Get(ctx context.Context, id int) (*Building, error) {\n\treturn c.Query().Where(building.ID(id)).Only(ctx)\n}", "func (s *AdmAccountStore) Get(id int) (*pwdless.Account, error) {\n\ta := pwdless.Account{ID: id}\n\terr := s.db.Select(&a)\n\treturn &a, err\n}", "func (a *V0alpha0ApiService) AdminGetIdentity(ctx context.Context, id string) V0alpha0ApiApiAdminGetIdentityRequest {\n\treturn V0alpha0ApiApiAdminGetIdentityRequest{\n\t\tApiService: a,\n\t\tctx: ctx,\n\t\tid: id,\n\t}\n}", "func (o *Organization) Get(id int64) error {\n\tdb, err := sqlx.Connect(settings.Settings.Database.DriverName, settings.Settings.GetDbConn())\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\tdefer db.Close()\n\n\terr = db.Get(&o, \"SELECT * FROM organization WHERE id=$1\", id)\n\tif err == sql.ErrNoRows {\n\t\treturn ErrOrganizationNotFound\n\t} else if err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "func (g OrganizationGetter) Get(_ context.Context, id uint) (auth.Organization, error) {\n\torg := auth.Organization{\n\t\tID: id,\n\t}\n\tif err := g.db.Where(&org).Find(&org).Error; err != nil {\n\t\treturn org, errors.WrapIf(err, \"failed to load organization from database\")\n\t}\n\treturn org, nil\n}", "func (c *PatientroomClient) Get(ctx context.Context, id int) (*Patientroom, error) {\n\treturn c.Query().Where(patientroom.ID(id)).Only(ctx)\n}", "func (c *CleaningroomClient) Get(ctx context.Context, id int) (*Cleaningroom, error) {\n\treturn c.Query().Where(cleaningroom.ID(id)).Only(ctx)\n}", "func (u *Role) Get(db *gorm.DB, roleid string) (*schemago.RespRole, error) {\n\tvar role = new(schemago.SRole)\n\tvar rolemenu = new(schemago.SRoleMenus)\n\tif err := db.Where(\"recid = ?\", roleid).Find(&role).Error; err != nil {\n\t\treturn nil, err\n\t}\n\tif err := db.Where(\"roleId = ?\", roleid).Find(&rolemenu).Error; err != nil {\n\t\treturn nil, err\n\t}\n\tresprole := role.ToRespondRole()\n\tresprole.Menus = rolemenu.ToRespondRoleMenus()\n\treturn resprole, nil\n}", "func (v AdminsResource) New(c buffalo.Context) error {\n\treturn c.Render(200, r.JSON(&models.Admin{}))\n}", "func (*AdminInfoService) FindInfoById(id int) (*entities.AdminInfo, error) {\n\tadm := new(entities.AdminInfo)\n\t_, err := entities.SlaveEngine.Id(id).Get(adm)\n\treturn adm, err\n}", "func (c *DeviceClient) Get(ctx context.Context, id int) (*Device, error) {\n\treturn c.Query().Where(device.ID(id)).Only(ctx)\n}", "func (r repository) Get(ctx context.Context, id string) (entity.Link, error) {\n\tvar link entity.Link\n\terr := r.db.With(ctx).Select().Model(id, &link)\n\treturn link, err\n}", "func GetByID(w http.ResponseWriter, r *http.Request, DB *gorm.DB) {\n\tvar dbUser User\n\tparams := mux.Vars(r)\n\tuserID := params[\"id\"]\n\t//Need to make sure that the user that is requesting user info is either the user or an admin user\n\ttoken := r.Header.Get(\"Authorization\")\n\tresult, ID := utils.VerifyJWT(token)\n\tmyID := strconv.FormatUint(uint64(ID), 10)\n\t//results := utils.IsAdmin(token, DB)\n\t//fmt.Printf(\"%v\", results)\n\tif (result && userID == myID) || isAdmin(token, DB) {\n\t\tDB.Where(\"ID = ?\", userID).First(&dbUser)\n\t\tw.Header().Set(\"Content-Type\", \"application/json\")\n\t\tw.WriteHeader(http.StatusOK)\n\t\tjson.NewEncoder(w).Encode(dbUser)\n\t} else {\n\t\tnotauthorizedResponse := response.JsonResponse(\"Not authorized\", 409)\n\t\tw.Header().Set(\"Content-Type\", \"application/json\")\n\t\tw.WriteHeader(http.StatusUnauthorized)\n\t\tjson.NewEncoder(w).Encode(notauthorizedResponse)\n\t}\n\n}", "func (c *DispenseMedicineClient) Get(ctx context.Context, id int) (*DispenseMedicine, error) {\n\treturn c.Query().Where(dispensemedicine.ID(id)).Only(ctx)\n}", "func (c *MealplanClient) Get(ctx context.Context, id int) (*Mealplan, error) {\n\treturn c.Query().Where(mealplan.ID(id)).Only(ctx)\n}", "func (d *Dosen) Get(db *sql.DB) error {\n\tif d.ID == \"\" {\n\t\treturn fmt.Errorf(\"id tidak bolehh kosong\")\n\t}\n\tquery := \"Select * FROM dosen where id = $1\"\n\treturn db.QueryRow(query, &d.ID).Scan(&d.ID, &d.NamaDosen)\n}", "func (c *DepartmentClient) Get(ctx context.Context, id int) (*Department, error) {\n\treturn c.Query().Where(department.ID(id)).Only(ctx)\n}", "func (c *ModuleVersionClient) Get(ctx context.Context, id int) (*ModuleVersion, error) {\n\treturn c.Query().Where(moduleversion.ID(id)).Only(ctx)\n}", "func (s MockStore) Get(id int) (u User, err error) {\n\tu, ok := s.id[id]\n\tif !ok {\n\t\terr = errors.New(\"User not found in memory store.\")\n\t}\n\n\treturn u, err\n}", "func Get(c echo.Context) error {\n\tctx := ServerContext(c)\n\n\tid := c.Param(\"id\")\n\tif id == \"\" {\n\t\treturn AddError(ctx, c, gruff.NewNotFoundError(\"Not Found\"))\n\t}\n\n\tresult, err := loadItem(c, id)\n\tif err != nil {\n\t\treturn AddError(ctx, c, err)\n\t}\n\n\tif gruff.IsRestrictor(ctx.Type) {\n\t\tr := result.(gruff.Restrictor)\n\t\tcanView, err := r.UserCanView(ctx)\n\t\tif err != nil {\n\t\t\treturn AddError(ctx, c, err)\n\t\t}\n\t\tif !canView {\n\t\t\treturn AddError(ctx, c, gruff.NewPermissionError(\"You do not have permission to view this item\"))\n\t\t}\n\n\t}\n\n\treturn c.JSON(http.StatusOK, result)\n}", "func (adminrepo *AdminRepo) GetAdminByEmail(email string) (*entity.Admin , error){\n\tfilter := bson.D{{\"email\", email },}\n\tadmin := &entity.Admin{}\n\tera := adminrepo.DB.Collection(entity.ADMIN).FindOne(context.TODO(), filter).Decode(admin)\n\treturn admin, era\n}", "func (c *StatusdClient) Get(ctx context.Context, id int) (*Statusd, error) {\n\treturn c.Query().Where(statusd.ID(id)).Only(ctx)\n}", "func (c *UserDatabaseClient) GetUser(id string) (*entity.UserDao, error) {\n\n\tvar entity entity.UserDao\n\n\tcollection := c.db.Collection(\"users\")\n\tdbResource := collection.FindOne(context.Background(), bson.M{\"_id\": id})\n\n\terr := dbResource.Err()\n\tif err != nil {\n\t\tif err == mongo.ErrNoDocuments {\n\t\t\treturn nil, nil\n\t\t}\n\t\treturn nil, err\n\t}\n\n\terr = dbResource.Decode(&entity)\n\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn &entity, nil\n}", "func (c *OperativerecordClient) Get(ctx context.Context, id int) (*Operativerecord, error) {\n\treturn c.Query().Where(operativerecord.ID(id)).Only(ctx)\n}", "func (list *List) Get(id ID) (*Entity, error) {\n\tif err := list.checkBoundaries(id); err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn list.entities[id], nil\n}", "func (a Author) Get(cfg *config.Config, id string) (Author, error) {\n\tvar author Author\n\tsession := cfg.Session.Copy()\n\tif err := cfg.Database.C(AuthorCollection).Find(bson.M{\"_id\": id}).One(&author); err != nil {\n\t\treturn author, err\n\t}\n\tdefer session.Close()\n\treturn author, nil\n}", "func (c *BedtypeClient) Get(ctx context.Context, id int) (*Bedtype, error) {\n\treturn c.Query().Where(bedtype.ID(id)).Only(ctx)\n}", "func (m *MockActivityHandler) AdminGetByID(w http.ResponseWriter, r *http.Request) {\n\tm.ctrl.T.Helper()\n\tm.ctrl.Call(m, \"AdminGetByID\", w, r)\n}", "func (c *CleanernameClient) Get(ctx context.Context, id int) (*Cleanername, error) {\n\treturn c.Query().Where(cleanername.ID(id)).Only(ctx)\n}", "func (c *StatustClient) Get(ctx context.Context, id int) (*Statust, error) {\n\treturn c.Query().Where(statust.ID(id)).Only(ctx)\n}", "func (s *Sharding) Admin() *One {\n\treturn s.one\n}", "func (u *UserDAO) Get(id int) User {\n\tstmt, err := db.Instance().Prepare(\"select uid, username, password from userinfo where uid=$1\")\n\tdb.CheckErr(err)\n\n\trows, err := stmt.Query(id)\n\n\tvar usr User\n\tfor rows.Next() {\n\t\tvar uid int\n\t\tvar username string\n\t\tvar password string\n\t\terr = rows.Scan(&uid, &username, &password)\n\t\tdb.CheckErr(err)\n\t\tusr.Id = uid\n\t\tusr.Name = username\n\t\tusr.Pwd = password\n\t}\n\n\treturn usr\n}", "func (s *permisoService) GetByID(id string) (*model.Permiso, error) {\n\t// return s.service.GetByID(id)\n\n\treturn repo.GetByID(id)\n}", "func (u *User) Get(id string) error {\n\tsession := mongoSession.Clone()\n\tdefer session.Close()\n\tcollection := session.DB(mongoDialInfo.Database).C(usersCollectionName)\n\t// TODO: handle error\n\tif !bson.IsObjectIdHex(id) {\n\t\treturn errors.New(\"Invalid Object ID\")\n\t}\n\tobjectID := bson.ObjectIdHex(id)\n\terr := collection.FindId(objectID).One(u)\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "func (admin *Admin) FindAdminByID(db *gorm.DB, id string) (*Admin, error) {\n\n\terr := db.Debug().Model(Admin{}).Where(\"id = ?\", id).Take(&admin).Error\n\tif gorm.IsRecordNotFoundError(err) {\n\t\treturn &Admin{}, errors.New(\"Admin not found\")\n\t}\n\n\tif err != nil {\n\t\treturn &Admin{}, err\n\t}\n\n\tif admin.ShopID.String() != \"00000000-0000-0000-0000-000000000000\" {\n\t\tshop := &Shop{}\n\t\terr = db.Debug().Model(Shop{}).Where(\"id = ?\", admin.ShopID.String()).Take(&shop).Error\n\t\tif err != nil {\n\t\t\treturn admin, errors.New(\"Shop associated with this admin not found\")\n\t\t}\n\t\tadmin.Shop = *shop\n\t}\n\n\treturn admin, nil\n}", "func (c *PlanetClient) Get(ctx context.Context, id int) (*Planet, error) {\n\treturn c.Query().Where(planet.ID(id)).Only(ctx)\n}", "func (us *Users) Get(id int64) (*User, error) {\n\texp := fmt.Sprintf(\"user_id=%v\", id)\n\n\treturn getUserWhere(exp)\n}", "func GetAdmin(c fab.FabricClient, orgPath string, orgName string) (ca.User, error) {\n\tkeyDir := fmt.Sprintf(\"peerOrganizations/%s.example.com/users/Admin@%s.example.com/msp/keystore\", orgPath, orgPath)\n\tcertDir := fmt.Sprintf(\"peerOrganizations/%s.example.com/users/Admin@%s.example.com/msp/signcerts\", orgPath, orgPath)\n\tusername := fmt.Sprintf(\"peer%sAdmin\", orgPath)\n\treturn getDefaultImplPreEnrolledUser(c, keyDir, certDir, username, orgName)\n}", "func (e *Store) Get(id string) *Config {\n\te.RLock()\n\tres := e.commands[id]\n\te.RUnlock()\n\treturn res\n}", "func (d *MongoUserDao) Get(id int) (*s.User, error) {\n\tresult := []s.User{}\n\n\tsession := d.Session.Clone()\n\tdefer session.Close()\n\n\tcollection := session.DB(d.DatabaseName).C(collectionName)\n\terr := collection.Find(bson.M{\n\t\t\"_id\": id,\n\t}).All(&result)\n\tif err != nil {\n\t\tlogger.Logf(\"ERROR %s\", err)\n\t\treturn nil, err\n\t}\n\n\tif len(result) == 0 {\n\t\treturn nil, nil\n\t}\n\n\treturn &result[0], nil\n}", "func (u *User) GetById(id interface{}) error {\n\tif err := DB().Where(\"id = ?\", id).First(&u).Error; err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "func (c *DomainsClient) Get(ctx context.Context, id string) (*models.Domain, int, error) {\n\tvar status int\n\tresp, status, _, err := c.BaseClient.Get(ctx, base.GetHttpRequestInput{\n\t\tValidStatusCodes: []int{http.StatusOK},\n\t\tUri: base.Uri{\n\t\t\tEntity: fmt.Sprintf(\"/domains/%s\", id),\n\t\t\tHasTenantId: true,\n\t\t},\n\t})\n\tif err != nil {\n\t\treturn nil, status, err\n\t}\n\tdefer resp.Body.Close()\n\trespBody, _ := ioutil.ReadAll(resp.Body)\n\tvar domain models.Domain\n\tif err := json.Unmarshal(respBody, &domain); err != nil {\n\t\treturn nil, status, err\n\t}\n\treturn &domain, status, nil\n}", "func (m *TagManager) Get(name string) (AdminTag, error) {\n\tvar tag AdminTag\n\tif name == \"\" {\n\t\treturn tag, fmt.Errorf(\"empty tag\")\n\t}\n\tif err := m.DB.Where(\"name = ?\", name).First(&tag).Error; err != nil {\n\t\treturn tag, err\n\t}\n\treturn tag, nil\n}" ]
[ "0.73351026", "0.7071261", "0.6711905", "0.67033774", "0.6643475", "0.6390452", "0.620847", "0.61023146", "0.60675824", "0.60571176", "0.6054145", "0.60371095", "0.60078704", "0.5912111", "0.58916056", "0.5889112", "0.58600634", "0.58217096", "0.5807368", "0.5801978", "0.57797545", "0.5772822", "0.57225585", "0.57075804", "0.5658496", "0.56530404", "0.5647085", "0.563671", "0.5628924", "0.5610582", "0.5609118", "0.5598097", "0.55928814", "0.55928814", "0.55928814", "0.5588856", "0.5568674", "0.5550355", "0.5539238", "0.5539238", "0.55357265", "0.55357265", "0.5534681", "0.552863", "0.552863", "0.552863", "0.552863", "0.552863", "0.552863", "0.552863", "0.552863", "0.55054617", "0.5502378", "0.5498731", "0.5498731", "0.5495804", "0.54897463", "0.54886436", "0.5487519", "0.5485915", "0.54752773", "0.54660934", "0.5465923", "0.54600006", "0.5458842", "0.54504365", "0.5445045", "0.5443175", "0.5422175", "0.5413456", "0.5402953", "0.5390767", "0.53895986", "0.53768134", "0.5356133", "0.53557086", "0.53517014", "0.53458077", "0.5338578", "0.5338407", "0.5336195", "0.53323215", "0.5322774", "0.53159475", "0.52963877", "0.52935976", "0.52911663", "0.5289406", "0.5279784", "0.52764326", "0.5274226", "0.52739835", "0.5267705", "0.5266261", "0.52624285", "0.52610487", "0.5249066", "0.5232186", "0.5231657", "0.5217918" ]
0.8285677
0
GetX is like Get, but panics if an error occurs.
func (c *AdminClient) GetX(ctx context.Context, id int) *Admin { obj, err := c.Get(ctx, id) if err != nil { panic(err) } return obj }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (c *StatustClient) GetX(ctx context.Context, id int) *Statust {\n\ts, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn s\n}", "func (c *OperativeClient) GetX(ctx context.Context, id int) *Operative {\n\to, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn o\n}", "func (c *StaytypeClient) GetX(ctx context.Context, id int) *Staytype {\n\ts, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn s\n}", "func (c *LevelOfDangerousClient) GetX(ctx context.Context, id int) *LevelOfDangerous {\n\tlod, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn lod\n}", "func (c *DentistClient) GetX(ctx context.Context, id int) *Dentist {\n\td, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn d\n}", "func (c *ToolClient) GetX(ctx context.Context, id int) *Tool {\n\tt, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn t\n}", "func (c *IPClient) GetX(ctx context.Context, id uuid.UUID) *IP {\n\tobj, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn obj\n}", "func (c *BeerClient) GetX(ctx context.Context, id int) *Beer {\n\tobj, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn obj\n}", "func (c *PhysicianClient) GetX(ctx context.Context, id int) *Physician {\n\tph, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn ph\n}", "func (c *PhysicianClient) GetX(ctx context.Context, id int) *Physician {\n\tph, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn ph\n}", "func (c *PharmacistClient) GetX(ctx context.Context, id int) *Pharmacist {\n\tph, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn ph\n}", "func (c *EmptyClient) GetX(ctx context.Context, id int) *Empty {\n\tobj, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn obj\n}", "func (c *OperationClient) GetX(ctx context.Context, id uuid.UUID) *Operation {\n\tobj, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn obj\n}", "func (c *NurseClient) GetX(ctx context.Context, id int) *Nurse {\n\tn, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn n\n}", "func (c *PatientInfoClient) GetX(ctx context.Context, id int) *PatientInfo {\n\tpi, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn pi\n}", "func (c *ClinicClient) GetX(ctx context.Context, id uuid.UUID) *Clinic {\n\tobj, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn obj\n}", "func (c *LeaseClient) GetX(ctx context.Context, id int) *Lease {\n\tl, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn l\n}", "func (c *ModuleVersionClient) GetX(ctx context.Context, id int) *ModuleVersion {\n\tmv, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn mv\n}", "func (c *PetruleClient) GetX(ctx context.Context, id int) *Petrule {\n\tpe, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn pe\n}", "func (c *KeyStoreClient) GetX(ctx context.Context, id int32) *KeyStore {\n\tobj, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn obj\n}", "func (c *SituationClient) GetX(ctx context.Context, id int) *Situation {\n\ts, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn s\n}", "func (c *MedicineClient) GetX(ctx context.Context, id int) *Medicine {\n\tm, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn m\n}", "func (c *RepairinvoiceClient) GetX(ctx context.Context, id int) *Repairinvoice {\n\tr, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn r\n}", "func (c *BillClient) GetX(ctx context.Context, id int) *Bill {\n\tb, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn b\n}", "func (c *BillClient) GetX(ctx context.Context, id int) *Bill {\n\tb, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn b\n}", "func (c *BillClient) GetX(ctx context.Context, id int) *Bill {\n\tb, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn b\n}", "func (c *OperativerecordClient) GetX(ctx context.Context, id int) *Operativerecord {\n\to, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn o\n}", "func (c *ReturninvoiceClient) GetX(ctx context.Context, id int) *Returninvoice {\n\tr, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn r\n}", "func (c *CleanernameClient) GetX(ctx context.Context, id int) *Cleanername {\n\tcl, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn cl\n}", "func (c *RepairInvoiceClient) GetX(ctx context.Context, id int) *RepairInvoice {\n\tri, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn ri\n}", "func (c *ComplaintClient) GetX(ctx context.Context, id int) *Complaint {\n\tco, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn co\n}", "func (c *DNSBLQueryClient) GetX(ctx context.Context, id uuid.UUID) *DNSBLQuery {\n\tobj, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn obj\n}", "func (c *ModuleClient) GetX(ctx context.Context, id int) *Module {\n\tm, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn m\n}", "func (c *MedicineTypeClient) GetX(ctx context.Context, id int) *MedicineType {\n\tmt, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn mt\n}", "func (c *BuildingClient) GetX(ctx context.Context, id int) *Building {\n\tb, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn b\n}", "func (c *DeviceClient) GetX(ctx context.Context, id int) *Device {\n\td, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn d\n}", "func (c *PatientClient) GetX(ctx context.Context, id int) *Patient {\n\tpa, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn pa\n}", "func (c *PatientClient) GetX(ctx context.Context, id int) *Patient {\n\tpa, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn pa\n}", "func (c *PatientClient) GetX(ctx context.Context, id int) *Patient {\n\tpa, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn pa\n}", "func (c *RoomuseClient) GetX(ctx context.Context, id int) *Roomuse {\n\tr, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn r\n}", "func (c *UserClient) GetX(ctx context.Context, id int) *User {\n\tu, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn u\n}", "func (c *UserClient) GetX(ctx context.Context, id int) *User {\n\tu, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn u\n}", "func (c *UserClient) GetX(ctx context.Context, id int) *User {\n\tu, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn u\n}", "func (c *UserClient) GetX(ctx context.Context, id int) *User {\n\tu, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn u\n}", "func (c *UserClient) GetX(ctx context.Context, id int) *User {\n\tu, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn u\n}", "func (c *UserClient) GetX(ctx context.Context, id int) *User {\n\tu, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn u\n}", "func (c *StatusdClient) GetX(ctx context.Context, id int) *Statusd {\n\ts, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn s\n}", "func (c *UserClient) GetX(ctx context.Context, id int64) *User {\n\tobj, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn obj\n}", "func (c *PlanetClient) GetX(ctx context.Context, id int) *Planet {\n\tpl, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn pl\n}", "func (c *PurposeClient) GetX(ctx context.Context, id int) *Purpose {\n\tpu, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn pu\n}", "func (c *TransactionClient) GetX(ctx context.Context, id int32) *Transaction {\n\tobj, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn obj\n}", "func (c *LengthtimeClient) GetX(ctx context.Context, id int) *Lengthtime {\n\tl, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn l\n}", "func (c *VeterinarianClient) GetX(ctx context.Context, id uuid.UUID) *Veterinarian {\n\tobj, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn obj\n}", "func (c *UserClient) GetX(ctx context.Context, id int) *User {\n\tobj, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn obj\n}", "func (c *UserClient) GetX(ctx context.Context, id int) *User {\n\tobj, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn obj\n}", "func (c *UsertypeClient) GetX(ctx context.Context, id int) *Usertype {\n\tu, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn u\n}", "func (c *PrescriptionClient) GetX(ctx context.Context, id int) *Prescription {\n\tpr, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn pr\n}", "func (c *PaymentClient) GetX(ctx context.Context, id int) *Payment {\n\tpa, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn pa\n}", "func (c *PaymentClient) GetX(ctx context.Context, id int) *Payment {\n\tpa, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn pa\n}", "func (c *WorkExperienceClient) GetX(ctx context.Context, id int) *WorkExperience {\n\tobj, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn obj\n}", "func (c *DNSBLResponseClient) GetX(ctx context.Context, id uuid.UUID) *DNSBLResponse {\n\tobj, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn obj\n}", "func (c *UserClient) GetX(ctx context.Context, id uuid.UUID) *User {\n\tobj, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn obj\n}", "func (c *UserClient) GetX(ctx context.Context, id uuid.UUID) *User {\n\tobj, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn obj\n}", "func (c *OperationroomClient) GetX(ctx context.Context, id int) *Operationroom {\n\to, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn o\n}", "func (c *PatientofphysicianClient) GetX(ctx context.Context, id int) *Patientofphysician {\n\tpa, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn pa\n}", "func (c *PositionInPharmacistClient) GetX(ctx context.Context, id int) *PositionInPharmacist {\n\tpip, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn pip\n}", "func (c *CleaningroomClient) GetX(ctx context.Context, id int) *Cleaningroom {\n\tcl, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn cl\n}", "func (c *DoctorClient) GetX(ctx context.Context, id int) *Doctor {\n\td, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn d\n}", "func (c *StatusRClient) GetX(ctx context.Context, id int) *StatusR {\n\ts, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn s\n}", "func (c *SymptomClient) GetX(ctx context.Context, id int) *Symptom {\n\ts, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn s\n}", "func (c *TagClient) GetX(ctx context.Context, id int) *Tag {\n\tobj, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn obj\n}", "func (c *CoinInfoClient) GetX(ctx context.Context, id int32) *CoinInfo {\n\tobj, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn obj\n}", "func (c *WifiClient) GetX(ctx context.Context, id int) *Wifi {\n\tw, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn w\n}", "func (c *UnitOfMedicineClient) GetX(ctx context.Context, id int) *UnitOfMedicine {\n\tuom, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn uom\n}", "func (c *EmployeeClient) GetX(ctx context.Context, id int) *Employee {\n\te, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn e\n}", "func (c *EmployeeClient) GetX(ctx context.Context, id int) *Employee {\n\te, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn e\n}", "func (c *EmployeeClient) GetX(ctx context.Context, id int) *Employee {\n\te, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn e\n}", "func (c *YearClient) GetX(ctx context.Context, id int) *Year {\n\ty, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn y\n}", "func (x *V) Get(params ...interface{}) (*V, error) {\n\tif false == x.initialized {\n\t\treturn nil, errNotInitialized\n\t}\n\tif 0 == len(params) {\n\t\treturn nil, errNilParameter\n\t}\n\treturn x.getOrCreate(false, params...)\n}", "func (c *OrderClient) GetX(ctx context.Context, id int) *Order {\n\to, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn o\n}", "func (c *FoodmenuClient) GetX(ctx context.Context, id int) *Foodmenu {\n\tf, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn f\n}", "func (c *DispenseMedicineClient) GetX(ctx context.Context, id int) *DispenseMedicine {\n\tdm, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn dm\n}", "func (c *SkillClient) GetX(ctx context.Context, id int) *Skill {\n\tobj, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn obj\n}", "func (c *TitleClient) GetX(ctx context.Context, id int) *Title {\n\tt, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn t\n}", "func (c *CustomerClient) GetX(ctx context.Context, id uuid.UUID) *Customer {\n\tobj, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn obj\n}", "func Get(ctx *grumble.Context) error {\n\tclient, execCtx, cancel := newClientAndCtx(ctx, 5*time.Second)\n\tdefer cancel()\n\tval, err := client.Get(execCtx, &ldProto.Key{Key: ctx.Args.String(\"key\")})\n\tif err != nil || val.Key == \"\" {\n\t\treturn err\n\t}\n\treturn exec(ctx, handleKeyValueReturned(val))\n}", "func (_HelloWorld *HelloWorldCaller) Get(opts *bind.CallOpts) (string, error) {\n\tvar (\n\t\tret0 = new(string)\n\t)\n\tout := ret0\n\terr := _HelloWorld.contract.Call(opts, out, \"get\")\n\treturn *ret0, err\n}", "func (c *PostClient) GetX(ctx context.Context, id int) *Post {\n\tobj, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn obj\n}", "func (c *BillingstatusClient) GetX(ctx context.Context, id int) *Billingstatus {\n\tb, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn b\n}", "func (c *RentalstatusClient) GetX(ctx context.Context, id int) *Rentalstatus {\n\tr, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn r\n}", "func (c *UserWalletClient) GetX(ctx context.Context, id int64) *UserWallet {\n\tobj, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn obj\n}", "func (c *SessionClient) GetX(ctx context.Context, id int) *Session {\n\ts, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn s\n}", "func (c *ReviewClient) GetX(ctx context.Context, id int32) *Review {\n\tobj, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn obj\n}", "func (c *BookingClient) GetX(ctx context.Context, id int) *Booking {\n\tb, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn b\n}", "func (c *RoomdetailClient) GetX(ctx context.Context, id int) *Roomdetail {\n\tr, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn r\n}", "func (c *EventClient) GetX(ctx context.Context, id int) *Event {\n\tobj, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn obj\n}", "func (c *PositionassingmentClient) GetX(ctx context.Context, id int) *Positionassingment {\n\tpo, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn po\n}", "func (c *PatientroomClient) GetX(ctx context.Context, id int) *Patientroom {\n\tpa, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn pa\n}", "func (c *PetClient) GetX(ctx context.Context, id uuid.UUID) *Pet {\n\tobj, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn obj\n}", "func (c *CompanyClient) GetX(ctx context.Context, id int) *Company {\n\tobj, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn obj\n}" ]
[ "0.66496724", "0.66252446", "0.6615732", "0.6588074", "0.65865564", "0.6579172", "0.6565792", "0.6544459", "0.65345156", "0.65345156", "0.6532471", "0.65085334", "0.6506574", "0.6491457", "0.6471564", "0.6469912", "0.6469408", "0.6466656", "0.645947", "0.6424143", "0.63988686", "0.637982", "0.6379801", "0.63662297", "0.63662297", "0.63662297", "0.63648087", "0.6345202", "0.63387924", "0.6315565", "0.63152325", "0.6307725", "0.63036525", "0.629203", "0.62886506", "0.62833667", "0.6282534", "0.6282534", "0.6282534", "0.6279849", "0.62784874", "0.62784874", "0.62784874", "0.62784874", "0.62784874", "0.62784874", "0.62607205", "0.6258848", "0.6245166", "0.62447625", "0.62445724", "0.6242281", "0.6242096", "0.62413293", "0.62413293", "0.6238969", "0.62387156", "0.6236871", "0.6236871", "0.62318987", "0.62232995", "0.6204355", "0.6204355", "0.6203673", "0.6202973", "0.6202917", "0.6202815", "0.6199118", "0.61942714", "0.6192401", "0.6189043", "0.61758024", "0.6165914", "0.6165194", "0.61619186", "0.61619186", "0.61619186", "0.6155354", "0.61457276", "0.6131832", "0.613054", "0.6127511", "0.61234546", "0.6113966", "0.60981816", "0.6097482", "0.6084122", "0.6083127", "0.60767865", "0.6063842", "0.60482377", "0.6042763", "0.60408664", "0.6039773", "0.6035943", "0.6019771", "0.60111755", "0.60078114", "0.60033286", "0.59983164" ]
0.6316006
29
QuerySessions queries the sessions edge of a Admin.
func (c *AdminClient) QuerySessions(a *Admin) *AdminSessionQuery { query := &AdminSessionQuery{config: c.config} query.path = func(ctx context.Context) (fromV *sql.Selector, _ error) { id := a.ID step := sqlgraph.NewStep( sqlgraph.From(admin.Table, admin.FieldID, id), sqlgraph.To(adminsession.Table, adminsession.FieldID), sqlgraph.Edge(sqlgraph.O2M, false, admin.SessionsTable, admin.SessionsColumn), ) fromV = sqlgraph.Neighbors(a.driver.Dialect(), step) return fromV, nil } return query }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (c *AdminSessionClient) Query() *AdminSessionQuery {\n\treturn &AdminSessionQuery{\n\t\tconfig: c.config,\n\t}\n}", "func (c *AdminSessionClient) Get(ctx context.Context, id int) (*AdminSession, error) {\n\treturn c.Query().Where(adminsession.ID(id)).Only(ctx)\n}", "func List(db services.DB, req *GetRequest) (*Session, error) {\n\tif req.ID < 1 && len(req.SessionString) < 1 {\n\t\treturn nil, nil\n\t}\n\n\tq := util.Sq.\n\t\tSelect(\"id\", \"user_id\", \"session_string\", \"inserted_at\", \"google_users_id\").\n\t\tFrom(\"sessions\")\n\n\tif req.ID > 0 {\n\t\tq = q.Where(sq.Eq{\"id\": req.ID})\n\t}\n\n\tif len(req.SessionString) > 0 {\n\t\tq = q.Where(sq.Eq{\"session_string\": req.SessionString})\n\t}\n\n\tquery, args, err := q.ToSql()\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"error building get session sql\")\n\t}\n\n\trow := db.QueryRow(query, args...)\n\n\tvar (\n\t\tsess Session\n\t\tuserID sql.NullInt64\n\t\tgoogleUsersID sql.NullInt64\n\t)\n\terr = row.Scan(&sess.ID, &userID, &sess.SessionString, &sess.InsertedAt, &googleUsersID)\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"error scanning session row\")\n\t}\n\n\tif userID.Valid {\n\t\tsess.UserID = uint64(userID.Int64)\n\t}\n\n\tif googleUsersID.Valid {\n\t\tsess.GoogleUsersID = uint64(googleUsersID.Int64)\n\t}\n\n\treturn &sess, nil\n}", "func (b *Blog) QueryAdmins() *UserQuery {\n\treturn NewBlogClient(b.config).QueryAdmins(b)\n}", "func (k Keeper) Sessions(c context.Context, req *types.SessionsRequest) (*types.SessionsResponse, error) {\n\tdefer telemetry.MeasureSince(time.Now(), types.ModuleName, \"query\", \"Sessions\")\n\tif req == nil {\n\t\treturn nil, status.Error(codes.InvalidArgument, \"empty request\")\n\t}\n\n\tretval := types.SessionsResponse{Request: req}\n\n\tctx := sdk.UnwrapSDKContext(c)\n\n\tvar scopeAddr, sessionAddr, recordAddr types.MetadataAddress\n\n\tif len(req.ScopeId) > 0 {\n\t\tvar err error\n\t\tscopeAddr, err = ParseScopeID(req.ScopeId)\n\t\tif err != nil {\n\t\t\treturn &retval, status.Error(codes.InvalidArgument, err.Error())\n\t\t}\n\t}\n\tif len(req.RecordAddr) > 0 {\n\t\tvar err error\n\t\trecordAddr, err = ParseRecordAddr(req.RecordAddr)\n\t\tif err != nil {\n\t\t\treturn &retval, status.Error(codes.InvalidArgument, err.Error())\n\t\t}\n\t\tscopeAddr2 := recordAddr.MustGetAsScopeAddress()\n\t\tif scopeAddr.Empty() {\n\t\t\tscopeAddr = scopeAddr2\n\t\t} else if !scopeAddr.Equals(scopeAddr2) {\n\t\t\treturn &retval, status.Errorf(codes.InvalidArgument, \"record %s is not part of scope %s\", recordAddr, scopeAddr)\n\t\t}\n\t}\n\tif len(req.SessionId) > 0 {\n\t\tvar err error\n\t\tscopeIDForParsing := req.ScopeId\n\t\tif len(scopeIDForParsing) == 0 && !scopeAddr.Empty() {\n\t\t\tscopeIDForParsing = scopeAddr.String()\n\t\t}\n\t\tsessionAddr, err = ParseSessionID(scopeIDForParsing, req.SessionId)\n\t\tif err != nil {\n\t\t\treturn &retval, status.Error(codes.InvalidArgument, err.Error())\n\t\t}\n\t\t// ParseSessionID ensures that this will not return an error.\n\t\tscopeAddr2 := sessionAddr.MustGetAsScopeAddress()\n\t\tswitch {\n\t\tcase !recordAddr.Empty():\n\t\t\t// This assumes that we have checked and set scopeAddr while processing the recordAddr.\n\t\t\tscopeAddr3 := recordAddr.MustGetAsScopeAddress()\n\t\t\tif !scopeAddr2.Equals(scopeAddr3) {\n\t\t\t\treturn &retval, status.Errorf(codes.InvalidArgument, \"session %s and record %s are not associated with the same scope\", sessionAddr, recordAddr)\n\t\t\t}\n\t\tcase scopeAddr.Empty():\n\t\t\tscopeAddr = scopeAddr2\n\t\tcase !scopeAddr.Equals(scopeAddr2):\n\t\t\treturn &retval, status.Errorf(codes.InvalidArgument, \"session %s is not part of scope %s\", recordAddr, scopeAddr)\n\t\t}\n\t}\n\tif len(req.RecordName) > 0 {\n\t\tif scopeAddr.Empty() {\n\t\t\t// assumes scopeAddr is set previously while parsing other input.\n\t\t\treturn &retval, status.Error(codes.InvalidArgument, \"a scope is required to look up sessions by record name\")\n\t\t}\n\t\t// We know that scopeAddr is legit, and that we have a name. So this won't give an error.\n\t\trecordAddr2 := scopeAddr.MustGetAsRecordAddress(req.RecordName)\n\t\tif recordAddr.Empty() {\n\t\t\trecordAddr = recordAddr2\n\t\t} else if !recordAddr.Equals(recordAddr2) {\n\t\t\treturn &retval, status.Errorf(codes.InvalidArgument, \"record %s does not have name %s\", recordAddr, req.RecordName)\n\t\t}\n\t}\n\n\t// If a record was identified in the search, we need to get it and either use it to set the sessionAddr,\n\t// or make sure the provided sessionAddr matches what the record has.\n\tif !recordAddr.Empty() {\n\t\trecord, found := k.GetRecord(ctx, recordAddr)\n\t\tswitch {\n\t\tcase !found:\n\t\t\treturn &retval, status.Errorf(codes.InvalidArgument, \"record %s does not exist\", recordAddr)\n\t\tcase !sessionAddr.Empty():\n\t\t\tif !sessionAddr.Equals(record.SessionId) {\n\t\t\t\treturn &retval, status.Errorf(codes.InvalidArgument, \"record %s belongs to session %s (not %s)\",\n\t\t\t\t\trecordAddr, record.SessionId, sessionAddr)\n\t\t\t}\n\t\tdefault:\n\t\t\tsessionAddr = record.SessionId\n\t\t}\n\t}\n\n\t// Get all the sessions based on the input, and set things up for extra info.\n\tswitch {\n\tcase !sessionAddr.Empty():\n\t\tsession, found := k.GetSession(ctx, sessionAddr)\n\t\tif found {\n\t\t\tretval.Sessions = append(retval.Sessions, types.WrapSession(&session))\n\t\t} else {\n\t\t\tretval.Sessions = append(retval.Sessions, types.WrapSessionNotFound(sessionAddr))\n\t\t}\n\tcase !scopeAddr.Empty():\n\t\titErr := k.IterateSessions(ctx, scopeAddr, func(s types.Session) (stop bool) {\n\t\t\tretval.Sessions = append(retval.Sessions, types.WrapSession(&s))\n\t\t\treturn false\n\t\t})\n\t\tif itErr != nil {\n\t\t\treturn &retval, status.Error(codes.Unavailable, fmt.Sprintf(\"error getting sessions for scope with address %s\", scopeAddr))\n\t\t}\n\tdefault:\n\t\treturn &retval, status.Error(codes.InvalidArgument, \"empty request parameters\")\n\t}\n\n\tif req.IncludeScope {\n\t\tscope, found := k.GetScope(ctx, scopeAddr)\n\t\tif found {\n\t\t\tretval.Scope = types.WrapScope(&scope)\n\t\t} else {\n\t\t\tretval.Scope = types.WrapScopeNotFound(scopeAddr)\n\t\t}\n\t}\n\n\tif req.IncludeRecords {\n\t\t// Get all the session ids\n\t\tsessionAddrs := []types.MetadataAddress{}\n\t\tfor _, s := range retval.Sessions {\n\t\t\tif s.Session != nil {\n\t\t\t\tsessionAddrs = append(sessionAddrs, s.Session.SessionId)\n\t\t\t}\n\t\t}\n\t\t// Iterate the records for the whole scope, and just keep the ones for our sessions.\n\t\terr := k.IterateRecords(ctx, scopeAddr, func(r types.Record) (stop bool) {\n\t\t\tkeep := false\n\t\t\tfor _, a := range sessionAddrs {\n\t\t\t\tif r.SessionId.Equals(a) {\n\t\t\t\t\tkeep = true\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t}\n\t\t\tif keep {\n\t\t\t\tretval.Records = append(retval.Records, types.WrapRecord(&r))\n\t\t\t}\n\t\t\treturn false\n\t\t})\n\t\tif err != nil {\n\t\t\treturn &retval, status.Errorf(codes.Unavailable, \"error iterating scope [%s] records: %s\", scopeAddr, err.Error())\n\t\t}\n\t}\n\n\treturn &retval, nil\n}", "func (s *userState) Sessions() map[string]string {\n\treturn s.sessions\n}", "func Admin(w http.ResponseWriter, r *http.Request) {\n\ttype Country struct {\n\t\tFlag, Name string\n\t\tGolfers int\n\t\tPercent float64\n\t}\n\n\ttype Session struct {\n\t\tGolfer string\n\t\tLastUsed time.Time\n\t}\n\n\ttype Table struct {\n\t\tName sql.NullString\n\t\tRows, Size int\n\t}\n\n\tdata := struct {\n\t\tCountries []Country\n\t\tSessions []Session\n\t\tTables []Table\n\t}{}\n\n\tdb := session.Database(r)\n\n\trows, err := db.Query(\n\t\t` SELECT login, MAX(last_used)\n\t\t FROM sessions JOIN users ON user_id = users.id\n\t\t WHERE user_id != $1\n\t\t AND last_used > TIMEZONE('UTC', NOW()) - INTERVAL '1 day'\n\t\tGROUP BY login\n\t\tORDER BY max DESC`,\n\t\tsession.Golfer(r).ID,\n\t)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\tdefer rows.Close()\n\n\tfor rows.Next() {\n\t\tvar session Session\n\n\t\tif err := rows.Scan(&session.Golfer, &session.LastUsed); err != nil {\n\t\t\tpanic(err)\n\t\t}\n\n\t\tdata.Sessions = append(data.Sessions, session)\n\t}\n\n\tif err := rows.Err(); err != nil {\n\t\tpanic(err)\n\t}\n\n\trows, err = db.Query(\n\t\t` SELECT relname,\n\t\t CASE WHEN relkind = 'i' THEN 0 ELSE reltuples END,\n\t\t PG_TOTAL_RELATION_SIZE(c.oid)\n\t\t FROM pg_class c\n\t\t JOIN pg_namespace n\n\t\t ON n.oid = relnamespace\n\t\t AND nspname = 'public'\n\t\t WHERE reltuples != 0\n\t\t UNION\n\t\t SELECT NULL, 0, PG_DATABASE_SIZE('code-golf')\n\t\tORDER BY relname`,\n\t)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\tdefer rows.Close()\n\n\tfor rows.Next() {\n\t\tvar table Table\n\n\t\tif err := rows.Scan(&table.Name, &table.Rows, &table.Size); err != nil {\n\t\t\tpanic(err)\n\t\t}\n\n\t\tdata.Tables = append(data.Tables, table)\n\t}\n\n\tif err := rows.Err(); err != nil {\n\t\tpanic(err)\n\t}\n\n\trows, err = db.Query(\n\t\t`SELECT COALESCE(country, ''), COUNT(*), COUNT(*) / SUM(COUNT(*)) OVER () * 100\n\t\t FROM users GROUP BY COALESCE(country, '')`,\n\t)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\tdefer rows.Close()\n\n\tfor rows.Next() {\n\t\tvar c Country\n\t\tvar id string\n\n\t\tif err := rows.Scan(&id, &c.Golfers, &c.Percent); err != nil {\n\t\t\tpanic(err)\n\t\t}\n\n\t\tif country, ok := config.CountryByID[id]; ok {\n\t\t\tc.Flag = country.Flag\n\t\t\tc.Name = country.Name\n\t\t}\n\n\t\tdata.Countries = append(data.Countries, c)\n\t}\n\n\tsort.Slice(data.Countries, func(i, j int) bool {\n\t\tif data.Countries[i].Golfers != data.Countries[j].Golfers {\n\t\t\treturn data.Countries[i].Golfers > data.Countries[j].Golfers\n\t\t}\n\n\t\treturn data.Countries[i].Name < data.Countries[j].Name\n\t})\n\n\tif err := rows.Err(); err != nil {\n\t\tpanic(err)\n\t}\n\n\trender(w, r, \"admin/info\", data, \"Admin Info\")\n}", "func (e *EndpointSessions) listSessions(writer http.ResponseWriter, request *http.Request) {\n\tsess, usr := GetSessionAndUser(e.sessions, e.users, writer, request)\n\tif usr == nil {\n\t\treturn\n\t}\n\n\t//only admin users are allowed to view all sessions\n\tif sess.User != user.ADMIN {\n\t\thttp.Error(writer, \"user must be admin\", http.StatusForbidden)\n\t\treturn\n\t}\n\n\tsessions, err := e.sessions.List()\n\tif err != nil {\n\t\thttp.Error(writer, err.Error(), http.StatusInternalServerError)\n\t\treturn\n\t}\n\n\tWriteJSONBody(writer, sessions)\n}", "func (ss *SessionServiceImpl) Sessions() ([]entities.Session, []error) {\n\treturn ss.sessionRepo.Sessions()\n}", "func (w *Warp) CientSessions(\n\tctx context.Context,\n) []*Session {\n\tsessions := []*Session{}\n\tw.mutex.Lock()\n\tfor _, user := range w.clients {\n\t\tfor _, c := range user.sessions {\n\t\t\tsessions = append(sessions, c)\n\t\t}\n\t}\n\t// The host user's shell client sessions, if any.\n\tfor _, c := range w.host.UserState.sessions {\n\t\tsessions = append(sessions, c)\n\t}\n\tw.mutex.Unlock()\n\treturn sessions\n}", "func (c *Cluster) GetSessions() []*Session {\n\treturn c.sessionManager.GetSessions()\n}", "func (m *ExactMatchDataStore) GetSessions()([]ExactMatchSessionable) {\n val, err := m.GetBackingStore().Get(\"sessions\")\n if err != nil {\n panic(err)\n }\n if val != nil {\n return val.([]ExactMatchSessionable)\n }\n return nil\n}", "func ListSessions() []Session {\n\tconst q = `SELECT * FROM Sessions WHERE expires > now() ORDER BY createdAt`\n\n\tsessions := make([]Session, 0)\n\terr := database.Select(&sessions, q)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\treturn sessions\n}", "func (s *Session) QueryEvents() *EventQuery {\n\treturn (&SessionClient{config: s.config}).QueryEvents(s)\n}", "func (c *SessionClient) Query() *SessionQuery {\n\treturn &SessionQuery{config: c.config}\n}", "func Sessions(cmd *cobra.Command) (session.State, func(), error) {\n\tvar sessionHandler session.Handler = session.Offline\n\n\tif offline, err := cmd.Flags().GetBool(\"offline\"); err == nil && !offline {\n\t\tsessionHandler = session.CreateOrJoinHandler\n\t}\n\n\toptions, err := ToOptions(cmd.Flags())\n\tif err != nil {\n\t\treturn session.State{}, nil, err\n\t}\n\treturn sessionHandler(options)\n}", "func AllSessions(tenantID string) ([]Session, error) {\n\tvar sessions []Session\n\tif err := mongo.Execute(\"monotonic\", SessionCollectionName(tenantID),\n\t\tfunc(collection *mgo.Collection) error {\n\t\t\treturn collection.Find(nil).All(&sessions)\n\t\t}); err != nil {\n\t\treturn sessions, fmt.Errorf(\"Error[%s] while getting all sessions\", err)\n\t}\n\treturn sessions, nil\n}", "func getAdmins(e echo.Context) error {\n\tdb := e.Get(\"database\").(*mgo.Database)\n\tif db == nil {\n\t\treturn fmt.Errorf(\"Bad database session\")\n\t}\n\n\tuuid, err := uuid.FromString(e.QueryParam(\"siteUuid\"))\n\tif err != nil {\n\t\treturn fmt.Errorf(\"Bad parameters\")\n\t}\n\n\ta := models.Admins{\n\t\tAdmins: []models.Admin{},\n\t}\n\n\terr = db.C(\"Admins\").Find(bson.M{\"adminSiteUuid\": uuid}).All(&a.Admins)\n\tif err != nil {\n\t\treturn e.NoContent(http.StatusNotFound)\n\t}\n\treturn e.JSON(http.StatusOK, a)\n}", "func (st *State) Sessions() []*cache.Session {\n\tvar sessions []*cache.Session\n\tfor _, client := range st.Clients() {\n\t\tsessions = append(sessions, client.Session)\n\t}\n\treturn sessions\n}", "func NewAdminSessionClient(c config) *AdminSessionClient {\n\treturn &AdminSessionClient{config: c}\n}", "func (store *SessionSQL) Get(ctx context.Context, opts ...GetOpt) (out []Session, err error) {\n\tq := sq.Select(`s.id, s.client_id, s.user_agent, device, os.name, os.version, browser.name, browser.version, s.updated_at, s.meta, user.id, user.name, user.email`).\n\t\tFrom(\"sessions s\").\n\t\tJoin(\"users user ON s.user_id = user.id\").\n\t\tJoin(\"browsers browser ON s.id = browser.session_id\").\n\t\tJoin(\"oses os ON s.id = os.session_id\").\n\t\tOrderBy(\"s.updated_at DESC\")\n\tfor _, opt := range opts {\n\t\topt(&q)\n\t}\n\n\tsql, params, err := q.ToSql()\n\tstore.log.WithFields(logrus.Fields{\n\t\t\"sql\": sql,\n\t\t\"params\": params,\n\t}).Debug(\"query\")\n\tif err != nil {\n\t\treturn out, err\n\t}\n\n\trows, err := store.db.QueryContext(ctx, sql, params...)\n\tif err != nil {\n\t\treturn out, err\n\t}\n\tdefer rows.Close()\n\n\tfor rows.Next() {\n\t\tres, err := scanSession(rows)\n\t\tif err != nil {\n\t\t\treturn out, err\n\t\t}\n\n\t\tout = append(out, res)\n\t}\n\n\treturn out, nil\n}", "func (ua *UserAPI) ListSessions(w http.ResponseWriter, r *http.Request) {\n\tkey := r.Header.Get(\"X-Hydrocarbon-Key\")\n\tif key == \"\" {\n\t\twriteErr(w, errors.New(\"no api key present\"))\n\t\treturn\n\t}\n\n\tsess, err := ua.s.ListSessions(r.Context(), key, 0)\n\tif err != nil {\n\t\twriteErr(w, err)\n\t\treturn\n\t}\n\n\terr = json.NewEncoder(w).Encode(sess)\n\tif err != nil {\n\t\twriteErr(w, err)\n\t\treturn\n\t}\n}", "func (k Keeper) SessionsAll(c context.Context, req *types.SessionsAllRequest) (*types.SessionsAllResponse, error) {\n\tdefer telemetry.MeasureSince(time.Now(), types.ModuleName, \"query\", \"SessionsAll\")\n\tretval := types.SessionsAllResponse{Request: req}\n\n\tpageRequest := getPageRequest(req)\n\n\tctx := sdk.UnwrapSDKContext(c)\n\tkvStore := ctx.KVStore(k.storeKey)\n\tprefixStore := prefix.NewStore(kvStore, types.SessionKeyPrefix)\n\n\tpageRes, err := query.Paginate(prefixStore, pageRequest, func(key, value []byte) error {\n\t\tvar session types.Session\n\t\tvErr := session.Unmarshal(value)\n\t\tif vErr == nil {\n\t\t\tretval.Sessions = append(retval.Sessions, types.WrapSession(&session))\n\t\t\treturn nil\n\t\t}\n\t\t// Something's wrong. Let's do what we can to give indications of it.\n\t\tvar addr types.MetadataAddress\n\t\tkErr := addr.Unmarshal(key)\n\t\tif kErr == nil {\n\t\t\tk.Logger(ctx).Error(\"failed to unmarshal session\", \"address\", addr, \"error\", vErr)\n\t\t\tretval.Sessions = append(retval.Sessions, types.WrapSessionNotFound(addr))\n\t\t} else {\n\t\t\tk64 := b64.StdEncoding.EncodeToString(key)\n\t\t\tk.Logger(ctx).Error(\"failed to unmarshal session key and value\",\n\t\t\t\t\"key error\", kErr, \"value error\", vErr, \"key (base64)\", k64)\n\t\t\tretval.Sessions = append(retval.Sessions, &types.SessionWrapper{})\n\t\t}\n\t\treturn nil // Still want to move on to the next.\n\t})\n\tif err != nil {\n\t\treturn &retval, status.Error(codes.Unavailable, err.Error())\n\t}\n\tretval.Pagination = pageRes\n\treturn &retval, nil\n}", "func (t *Terminal) GetSessions(r *kite.Request) (interface{}, error) {\n\tuser, err := user.Current()\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"Could not get user: %s\", err)\n\t}\n\n\tsessions := screenSessions(user.Username)\n\tif len(sessions) == 0 {\n\t\treturn nil, errors.New(\"no sessions available\")\n\t}\n\n\treturn sessions, nil\n}", "func (_ECC *ECCSession) Admins(arg0 common.Address) (bool, error) {\n\treturn _ECC.Contract.Admins(&_ECC.CallOpts, arg0)\n}", "func (b *GetParticipantsQueryBuilder) Admins() *GetParticipantsQueryBuilder {\n\tb.req.Filter = &tg.ChannelParticipantsAdmins{}\n\treturn b\n}", "func (m *ExactMatchDataStoresExactMatchDataStoreItemRequestBuilder) Sessions()(*ExactMatchDataStoresItemSessionsRequestBuilder) {\n return NewExactMatchDataStoresItemSessionsRequestBuilderInternal(m.BaseRequestBuilder.PathParameters, m.BaseRequestBuilder.RequestAdapter)\n}", "func (c *AdminClient) Query() *AdminQuery {\n\treturn &AdminQuery{\n\t\tconfig: c.config,\n\t}\n}", "func (_ECC *ECCCallerSession) Admins(arg0 common.Address) (bool, error) {\n\treturn _ECC.Contract.Admins(&_ECC.CallOpts, arg0)\n}", "func (me *GJUser) StartSession(){\n\tme.qreq(\"sessions/open\",\"\")\n}", "func (o *StatusAzureServiceBus) GetSessions() map[string]StatusAzureServiceBusSession {\n\tif o == nil || IsNil(o.Sessions) {\n\t\tvar ret map[string]StatusAzureServiceBusSession\n\t\treturn ret\n\t}\n\treturn *o.Sessions\n}", "func (db *DB) ListSessions(ctx context.Context, key string, page int) ([]*Session, error) {\n\trows, err := db.sql.QueryContext(ctx, `SELECT created_at, user_agent, ip, active\n\t\t\t\t\t\t\tFROM sessions\n\t\t\t\t\t\t\tWHERE user_id = (SELECT user_id FROM sessions WHERE key = $1)\n\t\t\t\t\t\t\tLIMIT 25\n\t\t\t\t\t\t\tOFFSET $2`, key, page)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer rows.Close()\n\n\tvar out []*Session\n\tfor rows.Next() {\n\t\tvar s Session\n\t\terr = rows.Scan(&s.CreatedAt, &s.UserAgent, &s.IP, &s.Active)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tout = append(out, &s)\n\t}\n\n\treturn out, nil\n}", "func (acmd *AdminCommand) QueryUsers(conn *Connection, policy *AdminPolicy) ([]*UserRoles, Error) {\n\tacmd.writeHeader(_QUERY_USERS, 0)\n\tlist, err := acmd.readUsers(conn, policy)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn list, nil\n}", "func (a *Client) GetSessions(params *GetSessionsParams) (*GetSessionsOK, error) {\n\t// TODO: Validate the params before sending\n\tif params == nil {\n\t\tparams = NewGetSessionsParams()\n\t}\n\n\tresult, err := a.transport.Submit(&runtime.ClientOperation{\n\t\tID: \"getSessions\",\n\t\tMethod: \"GET\",\n\t\tPathPattern: \"/SessionService/Sessions\",\n\t\tProducesMediaTypes: []string{\"application/json\"},\n\t\tConsumesMediaTypes: []string{\"application/json\"},\n\t\tSchemes: []string{\"http\", \"https\"},\n\t\tParams: params,\n\t\tReader: &GetSessionsReader{formats: a.formats},\n\t\tContext: params.Context,\n\t\tClient: params.HTTPClient,\n\t})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn result.(*GetSessionsOK), nil\n\n}", "func GetAllAdmins(session *mgo.Session) ([]Admin, error) {\n\tcollection := session.DB(\"system_users\").C(\"admins\")\n\tvar admins []Admin\n\treturn admins, collection.Find(nil).All(&admins)\n\n}", "func (user *User) Session() (session Session, err error) {\n\tsession = Session{}\n\terr = db.Db.QueryRow(\"select id,uuid,email,user_id,created_at from sessions where user_id=?\", user.Id).\n\t\tScan(&session.Id, &session.Uuid, &session.Email, &session.UserId, &session.CreatedAt)\n\treturn\n}", "func (client BastionClient) listSessions(ctx context.Context, request common.OCIRequest) (common.OCIResponse, error) {\n\thttpRequest, err := request.HTTPRequest(http.MethodGet, \"/sessions\")\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar response ListSessionsResponse\n\tvar httpResponse *http.Response\n\thttpResponse, err = client.Call(ctx, &httpRequest)\n\tdefer common.CloseBodyIfValid(httpResponse)\n\tresponse.RawResponse = httpResponse\n\tif err != nil {\n\t\treturn response, err\n\t}\n\n\terr = common.UnmarshalResponse(httpResponse, &response)\n\treturn response, err\n}", "func (db *Db) Session() *gocql.Session {\n\treturn db.session\n}", "func (pdr *ProviderMySQL) SessionAll() ([]string, error) {\n\tc := pdr.connectInit()\n\tdefer func() {\n\t\terr := c.Close()\n\t\tif err != nil {\n\t\t\tsession.SLogger.Println(err)\n\t\t}\n\t}()\n\n\trows, err := c.Query(\"select session_key from \" + TableName)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer func() {\n\t\terr := rows.Close()\n\t\tif err != nil {\n\t\t\tsession.SLogger.Println(err)\n\t\t}\n\t}()\n\n\tvar sids []string\n\tfor rows.Next() {\n\t\tvar sid string\n\t\terr = rows.Scan(&sid)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tsids = append(sids, sid)\n\t}\n\n\treturn sids, nil\n}", "func (me *GJUser) OpenSession(){\n\tme.qreq(\"sessions/open\",\"\")\n}", "func (h *SessionHandler) GetSessions(w http.ResponseWriter, r *http.Request) {\n\tsessions, err := h.SessionCore.GetSessions()\n\tswitch {\n\tcase err == nil:\n\t\tjson.NewEncoder(w).Encode(&sessions)\n\tcase errors.Is(err, core.ErrSessionNotFound):\n\t\thttp.Error(w, err.Error(), http.StatusNotFound)\n\tdefault:\n\t\thttp.Error(w, err.Error(), http.StatusInternalServerError)\n\t}\n}", "func AllSessions(ctx iris.Context) (string, string) {\n\tsession := GetSession(ctx)\n\tid := session.GetString(\"id\")\n\tusername := session.GetString(\"username\")\n\treturn id, username\n}", "func ListSessions() (Sessions, error) {\n\tresult, err := Run(\"list-sessions\", \"-F\", \"'#{session_name}'\")\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tnames := strings.Split(result, \"\\n\")\n\n\tsessions := make([]*Session, 0, len(names))\n\tfor _, name := range names {\n\t\tname = strings.Trim(name, \"'\")\n\t\tsessions = append(sessions, &Session{\n\t\t\tName: name,\n\t\t})\n\t}\n\n\treturn sessions, nil\n}", "func (h *WebDriverHub) GetActiveSessions() []string {\n\tresult := []string{}\n\th.mu.RLock()\n\tdefer h.mu.RUnlock()\n\tfor id := range h.sessions {\n\t\tresult = append(result, id)\n\t}\n\treturn result\n}", "func (p *Plex) GetSessions() (currentSessions, error) {\n\tacceptType := requestInfo.headers.Accept\n\n\trequestInfo.headers.Token = p.token\n\t// Don't request json\n\trequestInfo.headers.Accept = \"\"\n\n\tquery := fmt.Sprintf(\"%s/status/sessions\", p.URL)\n\n\tresp, respErr := requestInfo.get(query)\n\n\tif respErr != nil {\n\t\treturn currentSessions{}, respErr\n\t}\n\n\t// Return value to what it was before we touched it\n\trequestInfo.headers.Accept = acceptType\n\n\tdefer resp.Body.Close()\n\n\tif resp.StatusCode != 200 {\n\t\treturn currentSessions{}, errors.New(resp.Status)\n\t}\n\n\tvar result currentSessions\n\n\tif err := xml.NewDecoder(resp.Body).Decode(&result); err != nil {\n\t\treturn currentSessions{}, err\n\t}\n\n\treturn result, nil\n}", "func (c *AdminSessionClient) QueryUser(as *AdminSession) *AdminQuery {\n\tquery := &AdminQuery{config: c.config}\n\tquery.path = func(ctx context.Context) (fromV *sql.Selector, _ error) {\n\t\tid := as.ID\n\t\tstep := sqlgraph.NewStep(\n\t\t\tsqlgraph.From(adminsession.Table, adminsession.FieldID, id),\n\t\t\tsqlgraph.To(admin.Table, admin.FieldID),\n\t\t\tsqlgraph.Edge(sqlgraph.M2O, true, adminsession.UserTable, adminsession.UserColumn),\n\t\t)\n\t\tfromV = sqlgraph.Neighbors(as.driver.Dialect(), step)\n\t\treturn fromV, nil\n\t}\n\treturn query\n}", "func (l *Log) SearchSessionEvents(ctx context.Context, req events.SearchSessionEventsRequest) ([]apievents.AuditEvent, string, error) {\n\tfilter := searchEventsFilter{eventTypes: []string{events.SessionEndEvent, events.WindowsDesktopSessionEndEvent}}\n\tif req.Cond != nil {\n\t\tparams := condFilterParams{attrValues: make(map[string]interface{}), attrNames: make(map[string]string)}\n\t\texpr, err := fromWhereExpr(req.Cond, &params)\n\t\tif err != nil {\n\t\t\treturn nil, \"\", trace.Wrap(err)\n\t\t}\n\t\tfilter.condExpr = expr\n\t\tfilter.condParams = params\n\t}\n\treturn l.searchEventsWithFilter(ctx, req.From, req.To, apidefaults.Namespace, req.Limit, req.Order, req.StartKey, filter, req.SessionID)\n}", "func DumpSessions() {\n\tfmt.Printf(\"\\nDIRECTORY INTERNAL SESSION TABLE\\n\")\n\ti := 0\n\tfor _, v := range Sessions {\n\t\tfmt.Printf(\"%2d. %s\\n\", i, v.ToString())\n\t\ti++\n\t}\n\tfmt.Printf(\"END\\n\")\n\n}", "func (f *aclFilter) filterSessions(sessions *structs.Sessions) {\n\ts := *sessions\n\tfor i := 0; i < len(s); i++ {\n\t\tsession := s[i]\n\t\tif f.allowSession(session.Node) {\n\t\t\tcontinue\n\t\t}\n\t\tf.logger.Printf(\"[DEBUG] consul: dropping session %q from result due to ACLs\", session.ID)\n\t\ts = append(s[:i], s[i+1:]...)\n\t\ti--\n\t}\n\t*sessions = s\n}", "func GetOutdatedSessions(sessions *[]Session) error {\n\tdb := GetDB()\n\n\tif err := db.Debug().Unscoped().Where(\"(deleted_at != null OR session_end_at <= ?) AND state = ?\", time.Now(), \"running\").Find(sessions).Error; err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "func (s *SessionHandler) ListSessionsHandler(w http.ResponseWriter, r *http.Request) {\n\tutils.WriteJSON(w, s.SessionManager.GetAllSessions())\n}", "func (m *UserMutation) SessionIDs() (ids []int) {\n\tif id := m.session; id != nil {\n\t\tids = append(ids, *id)\n\t}\n\treturn\n}", "func (q *InfluxQuery) GetAll(dateStart string) []Session {\n\n\t// Getting all activities\n\tdriveSessions := q.GetDrives(dateStart)\n\tchargeSessions := q.GetCharges(dateStart)\n\tsleepSessions := q.GetSleeps(dateStart)\n\n\ttotalSession := driveSessions\n\ttotalSession = append(totalSession, chargeSessions...)\n\ttotalSession = append(totalSession, sleepSessions...)\n\tsort.Slice(totalSession, func(i, j int) bool { return totalSession[i].Start < totalSession[j].Start })\n\n\t// Getting idle sessions\n\tvar lastEnd time.Time\n\tvar returnSession []Session\n\tfor i, v := range totalSession {\n\n\t\tstart, _ := time.Parse(time.RFC3339, v.Start)\n\t\tend, _ := time.Parse(time.RFC3339, v.End)\n\n\t\tv.Start = start.Format(\"15:04:05\")\n\t\tv.End = end.Format(\"15:04:05\")\n\n\t\tif len(totalSession) > i+1 {\n\n\t\t\tnextStart, _ := time.Parse(time.RFC3339, totalSession[i+1].Start)\n\n\t\t\tif nextStart.After(end.Add(time.Minute * 2)) {\n\n\t\t\t\treturnSession = append(returnSession, Session{\n\n\t\t\t\t\tType: \"idle\",\n\t\t\t\t\tStart: end.Format(\"15:04:05\"),\n\t\t\t\t\tEnd: nextStart.Format(\"15:04:05\"),\n\t\t\t\t\tData: q.getIdleData(end.Format(time.RFC3339), nextStart.Format(time.RFC3339)),\n\t\t\t\t})\n\t\t\t}\n\t\t}\n\n\t\treturnSession = append(returnSession, v)\n\t\tlastEnd = end\n\t}\n\n\tloc, err := time.LoadLocation(q.TimeZone)\n\tif err != nil {\n\t\tlog.Println(err)\n\t}\n\tnow := time.Now().In(loc)\n\n\tif dateStart == now.Format(\"2006-01-02\") {\n\n\t\tif lastEnd.Add(time.Minute).Before(now) {\n\n\t\t\treturnSession = append(returnSession, Session{\n\t\t\t\tType: \"idle\",\n\t\t\t\tStart: lastEnd.Format(\"15:04:05\"),\n\t\t\t\tEnd: now.Format(\"15:04:05\"),\n\t\t\t\tData: q.getIdleData(lastEnd.Format(time.RFC3339), time.Now().Format(time.RFC3339)),\n\t\t\t})\n\t\t}\n\t}\n\n\t// Ordering and returning data\n\tsort.Slice(returnSession, func(i, j int) bool { return returnSession[i].Start < returnSession[j].Start })\n\treturn returnSession\n}", "func getAdmin(e echo.Context) error {\n\tdb := e.Get(\"database\").(*mgo.Database)\n\tif db == nil {\n\t\treturn fmt.Errorf(\"Bad database session\")\n\t}\n\n\tvar id bson.ObjectId\n\tif idParam := e.QueryParam(\"id\"); idParam != \"\" && bson.IsObjectIdHex(idParam) {\n\t\tid = bson.ObjectIdHex(idParam)\n\t}\n\tuuid, err := uuid.FromString(e.QueryParam(\"uuid\"))\n\tif !id.Valid() && err != nil {\n\t\treturn fmt.Errorf(\"Bad parameters\")\n\t}\n\n\ta := models.Admin{}\n\tif id.Valid() {\n\t\terr = db.C(\"Admins\").FindId(id).One(&a)\n\t} else {\n\t\terr = db.C(\"Admins\").Find(bson.M{\"adminUuid\": uuid}).One(&a)\n\t}\n\tif err != nil {\n\t\treturn e.NoContent(http.StatusNotFound)\n\t}\n\treturn e.JSON(http.StatusOK, a)\n}", "func (ss *SessionServiceImpl) Session(sessionID string) (*entities.Session, []error) {\n\treturn ss.sessionRepo.Session(sessionID)\n}", "func findDashboardSession(username string) (bson.M, error) {\n\n\tlog.Debugf(\"find dashboard session for user %s\", username)\n\tre, err := mongo.FindOneDocument(mongo.STRATUS_DASHBOARD_SESSIONS_COLL,\n\t\tbson.M{\"username\": username})\n\n\tif err != nil {\n\t\tlog.Errorf(\"Failed to find dashboard session. %v\", err)\n\t\treturn nil, err\n\t}\n\n\treturn re, err\n}", "func (m *ExactMatchDataStore) SetSessions(value []ExactMatchSessionable)() {\n err := m.GetBackingStore().Set(\"sessions\", value)\n if err != nil {\n panic(err)\n }\n}", "func (client BastionClient) ListSessions(ctx context.Context, request ListSessionsRequest) (response ListSessionsResponse, err error) {\n\tvar ociResponse common.OCIResponse\n\tpolicy := common.NoRetryPolicy()\n\tif client.RetryPolicy() != nil {\n\t\tpolicy = *client.RetryPolicy()\n\t}\n\tif request.RetryPolicy() != nil {\n\t\tpolicy = *request.RetryPolicy()\n\t}\n\tociResponse, err = common.Retry(ctx, request, client.listSessions, policy)\n\tif err != nil {\n\t\tif ociResponse != nil {\n\t\t\tif httpResponse := ociResponse.HTTPResponse(); httpResponse != nil {\n\t\t\t\topcRequestId := httpResponse.Header.Get(\"opc-request-id\")\n\t\t\t\tresponse = ListSessionsResponse{RawResponse: httpResponse, OpcRequestId: &opcRequestId}\n\t\t\t} else {\n\t\t\t\tresponse = ListSessionsResponse{}\n\t\t\t}\n\t\t}\n\t\treturn\n\t}\n\tif convertedResponse, ok := ociResponse.(ListSessionsResponse); ok {\n\t\tresponse = convertedResponse\n\t} else {\n\t\terr = fmt.Errorf(\"failed to convert OCIResponse into ListSessionsResponse\")\n\t}\n\treturn\n}", "func Session() HandlerFunc {\n\treturn func(c *Context) {\n\t\tif sessionManager == nil {\n\t\t\tpanic(\"please call gow.InitSession()\")\n\t\t}\n\t\tsessionID = sessionManager.Start(c.Writer, c.Req)\n\t\tsessionManager.Extension(c.Writer, c.Req)\n\t\tc.Next()\n\t}\n}", "func NewSessions(c config.Cookie, conn sol.Conn) *SessionManager {\n\treturn &SessionManager{\n\t\tconn: conn,\n\t\tcookie: c,\n\t\tkeyFunc: RandomKey,\n\t\tnowFunc: func() time.Time { return time.Now().In(time.UTC) },\n\t}\n}", "func (s *Session) IsAdminUser() bool {\n\treturn s.AdminUserID != uuid.Nil\n}", "func NewSessionQuery() *SessionQuery {\n\treturn &SessionQuery{\n\t\tBaseQuery: kallax.NewBaseQuery(Schema.Session.BaseSchema),\n\t}\n}", "func getSession(config Config) (*mgo.Session, error) {\n\tinfo := mgo.DialInfo{\n\t\tAddrs: []string{config.Host},\n\t\tTimeout: 60 * time.Second,\n\t\tDatabase: config.AuthDB,\n\t\tUsername: config.User,\n\t\tPassword: config.Password,\n\t}\n\n\t// Create a session which maintains a pool of socket connections\n\t// to our MongoDB.\n\tses, err := mgo.DialWithInfo(&info)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tses.SetMode(mgo.Monotonic, true)\n\n\treturn ses, nil\n}", "func (_TellorMesosphere *TellorMesosphereSession) IsAdmin(_admin_address common.Address) (bool, error) {\n\treturn _TellorMesosphere.Contract.IsAdmin(&_TellorMesosphere.CallOpts, _admin_address)\n}", "func SessionDelete(s *Session) {\n\tfmt.Printf(\"Session being deleted: %s\\n\", s.ToString())\n\t// fmt.Printf(\"sess.Sessions before delete:\\n\")\n\t// DumpSessions()\n\n\tif err := db.DeleteSessionCookie(s.Token); err != nil {\n\t\tlib.Ulog(\"Error deleting session cookie: %s\\n\", err.Error())\n\t}\n\n\tss := make(map[string]*Session, 0)\n\n\tSessionManager.ReqSessionMem <- 1 // ask to access the shared mem, blocks until granted\n\t<-SessionManager.ReqSessionMemAck // make sure we got it\n\tfor k, v := range Sessions {\n\t\tif s.Token != k {\n\t\t\tss[k] = v\n\t\t}\n\t}\n\tSessions = ss\n\tSessionManager.ReqSessionMemAck <- 1 // tell SessionDispatcher we're done with the data\n\t// fmt.Printf(\"sess.Sessions after delete:\\n\")\n\t// DumpSessions()\n}", "func (c *AdminSessionClient) Delete() *AdminSessionDelete {\n\tmutation := newAdminSessionMutation(c.config, OpDelete)\n\treturn &AdminSessionDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (m *manager) List(ctx context.Context, query *q.Query) (models.Users, error) {\n\tquery = q.MustClone(query)\n\tif query.Sorting == \"\" {\n\t\tquery.Sorting = \"username\"\n\t}\n\n\texcludeAdmin := true\n\tfor key := range query.Keywords {\n\t\tstr := strings.ToLower(key)\n\t\tif str == \"user_id__in\" {\n\t\t\texcludeAdmin = false\n\t\t\tbreak\n\t\t} else if str == \"user_id\" {\n\t\t\texcludeAdmin = false\n\t\t\tbreak\n\t\t}\n\t}\n\n\tif excludeAdmin {\n\t\t// Exclude admin account when not filter by UserIDs, see https://github.com/goharbor/harbor/issues/2527\n\t\tquery.Keywords[\"user_id__gt\"] = 1\n\t}\n\n\treturn m.dao.List(ctx, query)\n}", "func (s *BoltState) GetContainerExecSessions(ctr *Container) ([]string, error) {\n\tif !s.valid {\n\t\treturn nil, define.ErrDBClosed\n\t}\n\n\tif !ctr.valid {\n\t\treturn nil, define.ErrCtrRemoved\n\t}\n\n\tdb, err := s.getDBCon()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer s.deferredCloseDBCon(db)\n\n\tctrID := []byte(ctr.ID())\n\tsessions := []string{}\n\terr = db.View(func(tx *bolt.Tx) error {\n\t\tctrBucket, err := getCtrBucket(tx)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tdbCtr := ctrBucket.Bucket(ctrID)\n\t\tif dbCtr == nil {\n\t\t\tctr.valid = false\n\t\t\treturn define.ErrNoSuchCtr\n\t\t}\n\n\t\tctrExecSessions := dbCtr.Bucket(execBkt)\n\t\tif ctrExecSessions == nil {\n\t\t\treturn nil\n\t\t}\n\n\t\treturn ctrExecSessions.ForEach(func(id, unused []byte) error {\n\t\t\tsessions = append(sessions, string(id))\n\t\t\treturn nil\n\t\t})\n\t})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn sessions, nil\n}", "func GetAllSessionKeys() ([]string, *errors.Error) {\n\tconnPool, err := GetDBConnectionFunc(sessionStore)\n\tif err != nil {\n\t\treturn nil, errors.PackError(err.ErrNo(), \"error while trying to connecting to DB: \", err.Error())\n\t}\n\tsessionIDs, err := connPool.GetAllDetails(\"session\")\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn sessionIDs, nil\n}", "func (mgr *SessionMgr) GetSessionIDlist() (sessionIDList []string) {\n\tmgr.Lock.Lock()\n\tdefer mgr.Lock.Unlock()\n\tfor k, _ := range mgr.Sessions {\n\t\tsessionIDList = append(sessionIDList, k)\n\t}\n\treturn\n}", "func (s *Subscribe) GetAdmins() []*Subscriber {\n\tvar subs []*Subscriber\n\n\tfor _, sub := range s.Subscribers {\n\t\tif sub.Admin {\n\t\t\tsubs = append(subs, sub)\n\t\t}\n\t}\n\n\treturn subs\n}", "func GetSessions() []*sessions.Session {\n\t// Lock the mutex.\n\tactiveSessionsMutex.Lock()\n\tdefer activeSessionsMutex.Unlock()\n\n\t// Create the slice.\n\tl := make([]*sessions.Session, len(activeSessions))\n\n\ti := 0\n\tfor _, s := range activeSessions {\n\t\tl[i] = s\n\t\ti++\n\t}\n\n\treturn l\n}", "func session(w http.ResponseWriter, r *http.Request) (sess data.Session, err error) {\n\t\n\t// リクエストからクッキーを取得\n\tcookie, err := r.Cookie(\"_cookie\")\n\t// ユーザーがログインしているならクッキーがあるはず\n\tif err == nil {\n\t\t// データベースを検索\n\t\t// ユニークIDが存在してるか?\n\t\tsess = data.Session{ Uuid: cookie.Value }\n\t\t\n\t\tif ok, _ := sess.Check(); !ok {\n\t\t\terr = errors.New(\"Invalid session\")\n\t\t}\n\t}\n\treturn\n}", "func (s *Session) IsAdminApp() bool {\n\treturn s.ApplicationName.IsAdminApp()\n}", "func (o *EnvironmentUsageDto) GetMobileSessions() int64 {\n\tif o == nil || o.MobileSessions == nil {\n\t\tvar ret int64\n\t\treturn ret\n\t}\n\treturn *o.MobileSessions\n}", "func (c *SessionClient) Get(ctx context.Context, id int) (*Session, error) {\n\treturn c.Query().Where(session.ID(id)).Only(ctx)\n}", "func StartSession(w http.ResponseWriter, r *http.Request, u GSUser) {\n\tuID, _ := uuid.NewV4()\n\tcookie, err := r.Cookie(\"session\")\n\tif err == nil {\n\t\t//Value of cookie which named session, is checking\n\t\t_, err := uuid.FromString(cookie.Value)\n\t\tif err != nil {\n\t\t\t//invalid uuid(Cookie/Session Value) is detected by *Satori* and value is changed\n\t\t\tdelMaps(cookie.Value, u)\n\t\t\tcookie.Value = uID.String()\n\t\t\tcookie.MaxAge = SessionTime\n\t\t\thttp.SetCookie(w, cookie)\n\t\t}\n\t\t//System already have a session now. Checking harmony between uuid and RAM(dbUsers, dbSessions)\n\t\tif !checkDatabases(cookie.Value) {\n\t\t\t//RAM is cleared, now system have a cookie but RAM cleared by 'checkDatabases'(internal command)\n\t\t\t//fmt.Println(\"içerideyiz\", uID.String())\n\t\t\tcookie.Value = uID.String()\n\t\t\tcookie.MaxAge = SessionTime\n\t\t\thttp.SetCookie(w, cookie)\n\t\t\taddMaps(cookie.Value, u)\n\t\t\t//OK, everything is fine. Session value(uuid) is valid and RAM and Session are pointed by each other.\n\t\t} else {\n\t\t\t//OK, everything is fine. Session value(uuid) is valid and RAM and Session are pointed by each other.\n\t\t}\n\t} else {\n\t\t//System has no any cookie which named session and everything is created from A to Z\n\t\t//In this command, RAM isn't check because 1 session can point 1 user object.\n\t\t//but\n\t\t//1 user object can pointed more than one session(uuid)\n\t\t//\n\t\t//Why?: User have mobile, desktop, tablet devices which can login by.\n\t\tcreateSessionCookie(w, r, uID.String())\n\t\taddMaps(uID.String(), u)\n\t\t//OK, everything is fine. Session value(uuid) is valid and RAM and Session are pointed by each other.\n\t}\n}", "func (s *State) ExpireSessions(moment time.Time) {\n\ts.mu.Lock()\n\tdefer s.mu.Unlock()\n\n\tfor id, sess := range s.sessions {\n\t\tif sess.LastMarked.Before(moment) {\n\t\t\ts.unlockedRemoveSession(id)\n\t\t}\n\t}\n}", "func (_TellorMesosphere *TellorMesosphereCallerSession) IsAdmin(_admin_address common.Address) (bool, error) {\n\treturn _TellorMesosphere.Contract.IsAdmin(&_TellorMesosphere.CallOpts, _admin_address)\n}", "func (c *Client) AdminSearch(ctx context.Context, p *AdminSearchPayload) (res *PageOfStations, err error) {\n\tvar ires interface{}\n\tires, err = c.AdminSearchEndpoint(ctx, p)\n\tif err != nil {\n\t\treturn\n\t}\n\treturn ires.(*PageOfStations), nil\n}", "func (s Session) Public() Session {\n\ts.AdminID = \"\" // sanitize session\n\treturn s\n}", "func GetAdminUsers() []models.AdminUser {\n\tvar users []models.AdminUser\n\tif err := db.Get().Find(&users).Error; err != nil {\n\t\treturn []models.AdminUser{}\n\t}\n\treturn users\n}", "func (store *SessionSQL) Delete(ctx context.Context, ids ...string) error {\n\tq := sq.Delete(\"sessions\").Where(sq.Eq{\"id\": ids})\n\tsql, params, err := q.ToSql()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t_, err = store.db.ExecContext(ctx, sql, params...)\n\treturn err\n}", "func (u *UserStats) GetAdminUsers() int {\n\tif u == nil || u.AdminUsers == nil {\n\t\treturn 0\n\t}\n\treturn *u.AdminUsers\n}", "func (user *UserObject) Query(database *sqlx.DB, criteria map[string]string) *[]Access {\n\tobjects := make([]Access, 0)\n\trestrictions := getCriteria(criteria)\n\n\tquery := fmt.Sprintf(queryMany, userTableName, restrictions)\n\n\tresults, err := database.Queryx(query)\n\tif err != nil {\n\t\treturn nil\n\t}\n\tfor results.Next() {\n\t\tvar userObj = UserObject{}\n\t\terr = results.StructScan(&userObj)\n\t\tif err == nil {\n\t\t\tobjects = append(objects, &userObj)\n\t\t}\n\t}\n\n\treturn &objects\n}", "func (manager *SessionManager) GetActiveSession() int {\n\treturn manager.provider.SessionAll()\n}", "func (w *Worker) Session() *Session {\n\tw.mu.RLock()\n\tdefer w.mu.RUnlock()\n\n\treturn w.s\n}", "func GetAdmins(w http.ResponseWriter, r *http.Request) {\n\tcursor, limit, err := api.ParseCursor(r)\n\tif err != nil {\n\t\trender.Error(w, admin.WrapError(admin.ErrorBadRequestType, err,\n\t\t\t\"error parsing cursor and limit from query params\"))\n\t\treturn\n\t}\n\n\tadmins, nextCursor, err := mustAuthority(r.Context()).GetAdmins(cursor, limit)\n\tif err != nil {\n\t\trender.Error(w, admin.WrapErrorISE(err, \"error retrieving paginated admins\"))\n\t\treturn\n\t}\n\trender.JSON(w, &GetAdminsResponse{\n\t\tAdmins: admins,\n\t\tNextCursor: nextCursor,\n\t})\n}", "func GetLoggedIn(w http.ResponseWriter, r *http.Request, db *sqlx.DB) {\n\tvar err error\n\n\tsession, err := store.Get(r, \"auth\")\n\tif err != nil {\n\t\tw.Header().Set(\"Content-Type\", \"application/json; charset=UTF-8\")\n\t\tw.WriteHeader(http.StatusOK)\n\n\t\tif err := json.NewEncoder(w).Encode(\"access denied\"); err != nil {\n\t\t\tpanic(err)\n\t\t}\n\t} else {\n\t\t// Convert our session data into an instance of User\n\t\tuser := User{}\n\t\tuser, _ = session.Values[\"user\"].(User)\n\n\t\tif user.Username != \"\" && user.AccessLevel == \"admin\" {\n\t\t\tw.Header().Set(\"Content-Type\", \"application/json; charset=UTF-8\")\n\t\t\tw.WriteHeader(http.StatusOK)\n\n\t\t\tif err := json.NewEncoder(w).Encode(user); err != nil {\n\t\t\t\tpanic(err)\n\t\t\t}\n\t\t} else {\n\t\t\tw.Header().Set(\"Content-Type\", \"application/json; charset=UTF-8\")\n\t\t\tw.WriteHeader(http.StatusOK)\n\n\t\t\tif err := json.NewEncoder(w).Encode(\"access denied\"); err != nil {\n\t\t\t\tpanic(err)\n\t\t\t}\n\t\t}\n\t}\n\n\tlogRequest(r)\n}", "func RetrieveSessionList(c *gin.Context) {\n\tsessions, err := GetSessionList()\n\tif err != nil {\n\t\tc.JSON(http.StatusInternalServerError, common.NewError(\"sessions\", errors.New(\"Problem fetching sessions\")))\n\t\treturn\n\t}\n\n\tc.JSON(http.StatusCreated, sessions)\n}", "func ClearSessions(db AutoscopeDB, duration int64) error {\n\t//TODO\n\treturn nil\n}", "func (pder *MemProvider) SessionUpdate(sid string) error {\n\treturn (*session.MemProvider)(pder).SessionUpdate(context.Background(), sid)\n}", "func RemoveSessions() {\n\tus := models.UserSession{}\n\tc := dbSession.Find(bson.M{}).Iter()\n\tfor c.Next(&us) {\n\t\tif time.Now().Sub(us.CreatedAt).Seconds() >= 3600 {\n\t\t\tdbSession.Remove(struct{ UUID string }{UUID: string(us.UUID)})\n\t\t\tfmt.Println(\"dropping sessions...\")\n\t\t}\n\t}\n\tif err := c.Close(); err != nil {\n\t\tfmt.Println(\"Iterations completed\")\n\t\treturn\n\t}\n\tfmt.Println(\"Closed successfully\")\n}", "func (s *server) Query(c context.Context, req *logdog.QueryRequest) (*logdog.QueryResponse, error) {\n\t// Non-admin users may not request purged results.\n\tcanSeePurged := true\n\tswitch yes, err := coordinator.CheckAdminUser(c); {\n\tcase err != nil:\n\t\treturn nil, status.Error(codes.Internal, \"internal server error\")\n\tcase !yes:\n\t\tcanSeePurged = false\n\t\tif req.Purged == logdog.QueryRequest_YES {\n\t\t\tlog.Errorf(c, \"Non-superuser requested to see purged logs. Denying.\")\n\t\t\treturn nil, status.Errorf(codes.InvalidArgument, \"non-admin user cannot request purged log streams\")\n\t\t}\n\t}\n\n\t// Scale the maximum number of results based on the number of queries in this\n\t// request. If the user specified a maximum result count of zero, use the\n\t// default maximum.\n\t//\n\t// If this scaling results in a limit that is <1 per request, we will return\n\t// back a BadRequest error.\n\tlimit := s.resultLimit\n\tif limit == 0 {\n\t\tlimit = queryResultLimit\n\t}\n\n\t// Execute our queries in parallel.\n\tresp := logdog.QueryResponse{}\n\te := &queryRunner{\n\t\tctx: log.SetField(c, \"path\", req.Path),\n\t\treq: req,\n\t\tcanSeePurged: canSeePurged,\n\t\tlimit: limit,\n\t}\n\n\tstartTime := clock.Now(c)\n\tif err := e.runQuery(&resp); err != nil {\n\t\t// Transient errors would be handled at the \"execute\" level, so these are\n\t\t// specific failure errors. We must escalate individual errors to the user.\n\t\t// We will choose the most severe of the resulting errors.\n\t\tlog.WithError(err).Errorf(c, \"Failed to execute query.\")\n\t\treturn nil, err\n\t}\n\tlog.Infof(c, \"Query took: %s\", clock.Now(c).Sub(startTime))\n\treturn &resp, nil\n}", "func outputSessions(cmd *cobra.Command, scopeID, sessionID, recordID, recordName string) error {\n\tclientCtx, err := client.GetClientQueryContext(cmd)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treq := types.SessionsRequest{\n\t\tScopeId: scopeID,\n\t\tSessionId: sessionID,\n\t\tRecordAddr: recordID,\n\t\tRecordName: recordName,\n\t\tIncludeScope: includeScope,\n\t\tIncludeRecords: includeRecords,\n\t}\n\n\tqueryClient := types.NewQueryClient(clientCtx)\n\tres, err := queryClient.Sessions(context.Background(), &req)\n\tif err != nil {\n\t\treturn err\n\t}\n\tif res == nil || res.Sessions == nil || len(res.Sessions) == 0 {\n\t\treturn errors.New(\"no sessions found\")\n\t}\n\n\tif !includeRequest {\n\t\tres.Request = nil\n\t}\n\n\treturn clientCtx.PrintProto(res)\n}", "func (dao UserDao) Query(db *sql.DB, clause string) ([]User, error) {\n\tvar users []User\n\tvar err error\n\n\tstmt := fmt.Sprintf(\"%s where %s\", dao.CreateQuery(\"users\"), clause)\n\n\tlog.Info(\"stmt: %s\\n\", stmt)\n\n\treturn users, err\n}", "func (s *Db) GetSessionsByOrg(orgID string, areaID string) ([]*userquery.Session, error) {\n\n\t// We retrieve it from the database\n\tvars := make(map[string]interface{})\n\tvars[\"orgID\"] = orgID\n\tvars[\"areaID\"] = areaID\n\n\tresult, err := s.ExecuteSessionQuery(\"FOR s IN Session FILTER s.orgID==@orgID AND s.areaID==@areaID RETURN s\", vars)\n\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn result, nil\n}", "func GetAdminUsers() ([]*Admin, error) {\n\tadmins := make([]*Admin, 0)\n\terr := database.Conn.\n\t\tWhere(\"role = ?\", \"Admin\").\n\t\tFind(&admins).\n\t\tError\n\n\treturn admins, err\n}", "func (sr *SessionGormRepo) Session(sessionID string) (*entity.Session, []error) {\n\tsession := entity.Session{}\n\terrs := sr.conn.Find(&session, \"uuid=?\", sessionID).GetErrors()\n\tif len(errs) > 0 {\n\t\treturn nil, errs\n\t}\n\treturn &session, errs\n}", "func (d *Domus) GetWithSession(resource string, queries map[string]string) (*http.Response, error) {\n\t// Login if it was never done before\n\tif d.SessionKey() == \"\" {\n\t\t//return nil, errors.New(\"DevicesInRoom: session key is not set, login first\")\n\t\terr := d.Login()\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\t// Attempt the GET\n\tq := map[string]string{\n\t\t\"session_key\": string(d.SessionKey()),\n\t}\n\tfor k, v := range queries {\n\t\tq[k] = v\n\t}\n\tresp, err := d.Get(resource, q)\n\tif resp.StatusCode != 200 {\n\t\te := jsonError(resp)\n\t\tif e.Error() == \"INVALID_SESSION\" {\n\t\t\t// make a second attempt after logging in again to refresh sessionKey\n\t\t\tif d.Debug {\n\t\t\t\tlog.Println(\"Refreshing session\")\n\t\t\t}\n\t\t\terr := d.Login()\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t\tq[\"session_key\"] = string(d.SessionKey())\n\t\t\tresp, err = d.Get(resource, q)\n\t\t} else {\n\t\t\treturn nil, e\n\t\t}\n\t}\n\treturn resp, err\n}" ]
[ "0.6411572", "0.5887349", "0.58869445", "0.578034", "0.57064223", "0.56592524", "0.55375546", "0.5531621", "0.54073644", "0.53982526", "0.5361902", "0.5358868", "0.53425926", "0.53054756", "0.5297823", "0.5286315", "0.5256231", "0.5227942", "0.5225915", "0.5185705", "0.5166908", "0.5145995", "0.5143778", "0.508908", "0.49812156", "0.49811935", "0.49587017", "0.49546576", "0.491836", "0.48872495", "0.48795927", "0.48616025", "0.484548", "0.48255193", "0.4817747", "0.48167095", "0.4804568", "0.48016733", "0.47765374", "0.47538358", "0.47426555", "0.47388968", "0.47253105", "0.4724481", "0.4717395", "0.47106302", "0.46994638", "0.46695238", "0.4665924", "0.46372613", "0.46358484", "0.4629275", "0.46281186", "0.46119383", "0.4598853", "0.45963135", "0.45910224", "0.45868137", "0.45790437", "0.45628425", "0.45610797", "0.45552474", "0.4550808", "0.45498815", "0.45441094", "0.45408753", "0.45386484", "0.45263135", "0.45196086", "0.44945216", "0.44923216", "0.4490771", "0.44899526", "0.44797057", "0.44744357", "0.44731972", "0.44723767", "0.44700083", "0.44659683", "0.44586897", "0.4452127", "0.44440973", "0.44437635", "0.44418487", "0.44403413", "0.44392833", "0.4437556", "0.4435914", "0.4434283", "0.44248015", "0.44237933", "0.44204813", "0.4417807", "0.44148967", "0.4414177", "0.44044918", "0.43947202", "0.4390149", "0.43805885", "0.4380558" ]
0.807153
0
QueryPosts queries the posts edge of a Admin.
func (c *AdminClient) QueryPosts(a *Admin) *PostQuery { query := &PostQuery{config: c.config} query.path = func(ctx context.Context) (fromV *sql.Selector, _ error) { id := a.ID step := sqlgraph.NewStep( sqlgraph.From(admin.Table, admin.FieldID, id), sqlgraph.To(post.Table, post.FieldID), sqlgraph.Edge(sqlgraph.O2M, false, admin.PostsTable, admin.PostsColumn), ) fromV = sqlgraph.Neighbors(a.driver.Dialect(), step) return fromV, nil } return query }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (c *CategoryClient) QueryPosts(ca *Category) *PostQuery {\n\tquery := &PostQuery{config: c.config}\n\tquery.path = func(ctx context.Context) (fromV *sql.Selector, _ error) {\n\t\tid := ca.ID\n\t\tstep := sqlgraph.NewStep(\n\t\t\tsqlgraph.From(category.Table, category.FieldID, id),\n\t\t\tsqlgraph.To(post.Table, post.FieldID),\n\t\t\tsqlgraph.Edge(sqlgraph.O2M, false, category.PostsTable, category.PostsColumn),\n\t\t)\n\t\tfromV = sqlgraph.Neighbors(ca.driver.Dialect(), step)\n\t\treturn fromV, nil\n\t}\n\treturn query\n}", "func (u *User) QueryPosts() *ExperienceQuery {\n\treturn (&UserClient{config: u.config}).QueryPosts(u)\n}", "func (c *Category) QueryPosts() *PostQuery {\n\treturn (&CategoryClient{config: c.config}).QueryPosts(c)\n}", "func Posts(mods ...qm.QueryMod) postQuery {\n\tmods = append(mods, qm.From(\"\\\"posts\\\"\"))\n\treturn postQuery{NewQuery(mods...)}\n}", "func (b *Blog) QueryAdmins() *UserQuery {\n\treturn NewBlogClient(b.config).QueryAdmins(b)\n}", "func (k Keeper) Posts(goCtx context.Context, req *types.QueryPostsRequest) (*types.QueryPostsResponse, error) {\n\tvar posts []types.Post\n\tctx := sdk.UnwrapSDKContext(goCtx)\n\n\tif !subspacestypes.IsValidSubspace(req.SubspaceId) {\n\t\treturn nil, sdkerrors.Wrapf(subspacestypes.ErrInvalidSubspaceID, req.SubspaceId)\n\t}\n\n\tstore := ctx.KVStore(k.storeKey)\n\tpostsStore := prefix.NewStore(store, types.SubspacePostsPrefix(req.SubspaceId))\n\n\tpageRes, err := query.Paginate(postsStore, req.Pagination, func(key []byte, value []byte) error {\n\t\tstore := ctx.KVStore(k.storeKey)\n\t\tbz := store.Get(types.PostStoreKey(string(value)))\n\n\t\tvar post types.Post\n\t\tif err := k.cdc.UnmarshalBinaryBare(bz, &post); err != nil {\n\t\t\treturn status.Error(codes.Internal, err.Error())\n\t\t}\n\n\t\tposts = append(posts, post)\n\t\treturn nil\n\t})\n\n\tif err != nil {\n\t\treturn nil, status.Error(codes.Internal, err.Error())\n\t}\n\n\treturn &types.QueryPostsResponse{Posts: posts, Pagination: pageRes}, nil\n}", "func (c *PostThumbnailClient) QueryPost(pt *PostThumbnail) *PostQuery {\n\tquery := &PostQuery{config: c.config}\n\tquery.path = func(ctx context.Context) (fromV *sql.Selector, _ error) {\n\t\tid := pt.ID\n\t\tstep := sqlgraph.NewStep(\n\t\t\tsqlgraph.From(postthumbnail.Table, postthumbnail.FieldID, id),\n\t\t\tsqlgraph.To(post.Table, post.FieldID),\n\t\t\tsqlgraph.Edge(sqlgraph.O2O, true, postthumbnail.PostTable, postthumbnail.PostColumn),\n\t\t)\n\t\tfromV = sqlgraph.Neighbors(pt.driver.Dialect(), step)\n\t\treturn fromV, nil\n\t}\n\treturn query\n}", "func (r *queryResolver) Posts(ctx context.Context, after *entgql.Cursor[int], first *int, before *entgql.Cursor[int], last *int, orderBy *ent.PostOrder, where *ent.PostWhereInput) (*ent.PostConnection, error) {\n\tconn, err := ent.FromContext(ctx).Post.Query().Paginate(\n\t\tctx, after, first, before, last,\n\t\tent.WithPostOrder(orderBy),\n\t\tent.WithPostFilter(where.Filter),\n\t)\n\n\tif err == nil && conn.TotalCount == 1 {\n\t\tpost := conn.Edges[0].Node\n\n\t\tif post.ContentHTML == \"\" {\n\t\t\treturn conn, nil\n\t\t}\n\n\t\tgo database.PostViewCounter(ctx, post)\n\t}\n\n\treturn conn, err\n}", "func (c *AdminClient) QueryUnsavedPosts(a *Admin) *UnsavedPostQuery {\n\tquery := &UnsavedPostQuery{config: c.config}\n\tquery.path = func(ctx context.Context) (fromV *sql.Selector, _ error) {\n\t\tid := a.ID\n\t\tstep := sqlgraph.NewStep(\n\t\t\tsqlgraph.From(admin.Table, admin.FieldID, id),\n\t\t\tsqlgraph.To(unsavedpost.Table, unsavedpost.FieldID),\n\t\t\tsqlgraph.Edge(sqlgraph.O2M, false, admin.UnsavedPostsTable, admin.UnsavedPostsColumn),\n\t\t)\n\t\tfromV = sqlgraph.Neighbors(a.driver.Dialect(), step)\n\t\treturn fromV, nil\n\t}\n\treturn query\n}", "func (c *PostAttachmentClient) QueryPost(pa *PostAttachment) *PostQuery {\n\tquery := &PostQuery{config: c.config}\n\tquery.path = func(ctx context.Context) (fromV *sql.Selector, _ error) {\n\t\tid := pa.ID\n\t\tstep := sqlgraph.NewStep(\n\t\t\tsqlgraph.From(postattachment.Table, postattachment.FieldID, id),\n\t\t\tsqlgraph.To(post.Table, post.FieldID),\n\t\t\tsqlgraph.Edge(sqlgraph.M2O, true, postattachment.PostTable, postattachment.PostColumn),\n\t\t)\n\t\tfromV = sqlgraph.Neighbors(pa.driver.Dialect(), step)\n\t\treturn fromV, nil\n\t}\n\treturn query\n}", "func (c *PostImageClient) QueryPost(pi *PostImage) *PostQuery {\n\tquery := &PostQuery{config: c.config}\n\tquery.path = func(ctx context.Context) (fromV *sql.Selector, _ error) {\n\t\tid := pi.ID\n\t\tstep := sqlgraph.NewStep(\n\t\t\tsqlgraph.From(postimage.Table, postimage.FieldID, id),\n\t\t\tsqlgraph.To(post.Table, post.FieldID),\n\t\t\tsqlgraph.Edge(sqlgraph.M2O, true, postimage.PostTable, postimage.PostColumn),\n\t\t)\n\t\tfromV = sqlgraph.Neighbors(pi.driver.Dialect(), step)\n\t\treturn fromV, nil\n\t}\n\treturn query\n}", "func (c *PostVideoClient) QueryPost(pv *PostVideo) *PostQuery {\n\tquery := &PostQuery{config: c.config}\n\tquery.path = func(ctx context.Context) (fromV *sql.Selector, _ error) {\n\t\tid := pv.ID\n\t\tstep := sqlgraph.NewStep(\n\t\t\tsqlgraph.From(postvideo.Table, postvideo.FieldID, id),\n\t\t\tsqlgraph.To(post.Table, post.FieldID),\n\t\t\tsqlgraph.Edge(sqlgraph.M2O, true, postvideo.PostTable, postvideo.PostColumn),\n\t\t)\n\t\tfromV = sqlgraph.Neighbors(pv.driver.Dialect(), step)\n\t\treturn fromV, nil\n\t}\n\treturn query\n}", "func posts(w http.ResponseWriter, r *http.Request, _ httprouter.Params) {\n\tdb, err := db()\n\tif err != nil {\n\t\tlog.Println(\"Database was not properly opened\")\n\t\tsendErr(w, err, \"Database was not properly opened\", http.StatusInternalServerError)\n\t\treturn\n\t}\n\n\trows, err := db.Query(`\nSELECT p.id, p.name, p.content, p.permalink, p.visible, p.created_at, IFNULL(likes.likes, 0), p.cover\nFROM post p LEFT OUTER JOIN (SELECT post_id, COUNT(ip) AS likes\n FROM liker\n GROUP BY post_id) likes ON p.id = likes.post_id\nORDER BY created_at;\n\t`)\n\tif err != nil {\n\t\tlog.Println(\"Error in statement\")\n\t\tsendErr(w, err, \"Error in query blog\", http.StatusInternalServerError)\n\t\treturn\n\t}\n\n\tvar posts []Post\n\tfor rows.Next() {\n\t\tvar post Post\n\t\t// getting a post\n\t\tvar coverID sql.NullInt64\n\t\terr = rows.Scan(&post.ID, &post.Name, &post.Content, &post.Permalink,\n\t\t\t&post.Visible, &post.CreatedAt, &post.Likes, &coverID)\n\t\tif err != nil {\n\t\t\tlog.Println(\"Error while scanning at home handler\")\n\t\t\tsendErr(w, err, \"Error while scanning blog\", http.StatusInternalServerError)\n\t\t\treturn\n\t\t}\n\t\t// Adding a cover if neded\n\t\tif coverID.Valid {\n\t\t\trow := db.QueryRow(`\nSELECT id, url\nFROM image\nWHERE id = ?\n`, coverID)\n\t\t\tvar image Image\n\t\t\terr := row.Scan(&image.ID, &image.Url)\n\t\t\tif err != nil {\n\t\t\t\tsendErr(w, err, \"Error while trying to get an image for a post\", http.StatusInternalServerError)\n\t\t\t\treturn\n\t\t\t}\n\t\t\tpost.Cover = image\n\t\t}\n\n\t\t// Adding tags\n\t\ttagRows, err := db.Query(`\nSELECT t.id, t.name \nFROM post_tag pt INNER JOIN tag t ON pt.tag_id = t.id\nWHERE pt.post_id = ?;\n\t\t`, post.ID)\n\t\tif err != nil {\n\t\t\tlog.Println(\"Error while scanning at home handler\")\n\t\t\tsendErr(w, err, \"Error while scanning blog\", http.StatusInternalServerError)\n\t\t\treturn\n\t\t}\n\t\tvar tagsIDs []string\n\t\tvar tags []Tag\n\t\tfor tagRows.Next() {\n\t\t\tvar tag Tag\n\t\t\ttagRows.Scan(&tag.ID, &tag.Name)\n\t\t\ttags = append(tags, tag)\n\t\t\ttagsIDs = append(tagsIDs, tag.ID)\n\t\t}\n\t\tpost.TagsIDs = tagsIDs\n\t\tpost.Tags = tags\n\t\t// Append to []Post\n\t\tposts = append(posts, post)\n\t}\n\tdb.Close()\n\tjsn, err := jsonapi.Marshal(posts)\n\tsend(w, jsn)\n}", "func (u *User)Posts() Posts{\n\treturn u.posts\n}", "func (s *ServerState) getPosts(c *gin.Context) {\n\tquery := `select u.name, u.username , p.description, p.timestamp, p.total_campaign_snapshot, co.name, co.cost, sc.name\n\tfrom ht.post p, ht.campaign ca, ht.course co, ht.organisation sc, ht.user u\n\twhere p.campaign_id = ca.id AND ca.course_id = co.id AND co.organisation_id = sc.id AND ca.user_id = u.id;`\n\n\t//curl --header \"Content-Type: application/json\" --request GET http://localhost:8080/posts/\n\n\tvar posts []Post\n\n\terr := s.DB.Select(&posts, query)\n\tif err != nil {\n\t\tc.JSON(500, gin.H{\"status\": err})\n\t\treturn\n\t}\n\tfmt.Println(posts)\n\n\tc.JSON(http.StatusOK, gin.H{\"status\": posts})\n}", "func Posts(r *mux.Router) {\n\tfmt.Println(\"Post route registered...\")\n\ts := r.PathPrefix(\"/posts\").Subrouter()\n\n\t// create post\n\ts.HandleFunc(\"\",\n\t\tmiddleware.Auth(\n\t\t\tmiddleware.UserType(\n\t\t\t\tposts.CreatePost,\n\t\t\t\tusertype.Admin,\n\t\t\t\tusertype.Publisher,\n\t\t\t),\n\t\t),\n\t).\n\t\tMethods(\"POST\")\n\n\ts.HandleFunc(\"\",\n\t\tmiddleware.Auth(\n\t\t\tposts.GetAllPost,\n\t\t),\n\t).\n\t\tMethods(\"GET\")\n\n\ts.HandleFunc(\"/{id}\",\n\t\tmiddleware.Auth(\n\t\t\tmiddleware.Owner(\n\t\t\t\tposts.DisablePost,\n\t\t\t\townerarea.Post,\n\t\t\t),\n\t\t),\n\t).\n\t\tMethods(\"DELETE\")\n\n\ts.HandleFunc(\"/{id}\",\n\t\tmiddleware.Auth(\n\t\t\tmiddleware.Owner(\n\t\t\t\tposts.UpdateOne,\n\t\t\t\townerarea.Post,\n\t\t\t),\n\t\t),\n\t).\n\t\tMethods(\"PUT\")\n\n\ts.HandleFunc(\"/{id}\",\n\t\tmiddleware.Auth(\n\t\t\tposts.GetOnePost,\n\t\t),\n\t).\n\t\tMethods(\"GET\")\n\n\ts.HandleFunc(\"/{id}/addlike\",\n\t\tmiddleware.Auth(\n\t\t\tposts.AddLike,\n\t\t),\n\t).Methods(\"POST\")\n\n\ts.HandleFunc(\"/{id}/removelike\",\n\t\tmiddleware.Auth(\n\t\t\tposts.RemoveLike,\n\t\t),\n\t).Methods(\"POST\")\n\n\ts.HandleFunc(\"/{id}/comments\",\n\t\tmiddleware.Auth(\n\t\t\tposts.GetComments,\n\t\t),\n\t).Methods(\"GET\")\n\n\ts.HandleFunc(\"/{id}/enquiry\",\n\t\tmiddleware.Auth(\n\t\t\tposts.CreateEnquiry,\n\t\t),\n\t).Methods(\"POST\")\n\n\ts.HandleFunc(\"/{id}/enquiry\",\n\t\tmiddleware.Auth(\n\t\t\tposts.GetEnquiry,\n\t\t),\n\t).Methods(\"GET\")\n\n}", "func (p *_Posts) Query(db database.DB, models ...*Post) *postsQueryBuilder {\n\tvar queryModels []mapping.Model\n\tif len(models) > 0 {\n\t\tqueryModels = make([]mapping.Model, len(models))\n\t\tfor i, model := range models {\n\t\t\tqueryModels[i] = model\n\t\t}\n\t}\n\tbuilder := db.Query(p.Model, queryModels...)\n\treturn &postsQueryBuilder{builder: builder}\n}", "func (c *Client) Posts(opts ListOptions) *PostIterator {\n\tif opts.Limit <= 0 {\n\t\topts.Limit = 100\n\t}\n\tit := &PostIterator{\n\t\tIncludeCount: opts.IncludeCount,\n\t\tLimit: opts.Limit,\n\t\tPage: opts.Page,\n\t\tc: c,\n\t\tlookupCache: &iteratorCache{\n\t\t\tauthors: make(map[string]*Author),\n\t\t\tcategorys: make(map[string]*Category),\n\t\t\tposts: make(map[string]*Post),\n\t\t},\n\t}\n\treturn it\n}", "func ListPost(c buffalo.Context) error {\n\n\tdb := c.Value(\"tx\").(*pop.Connection)\n\n\tposts := &models.Posts{}\n\n\tquery := db.PaginateFromParams(c.Params())\n\n\tif err := query.Order(\"created_at desc\").Eager().All(posts); err != nil {\n\n\t\terrorResponse := utils.NewErrorResponse(http.StatusInternalServerError, \"user\", \"There is a problem while loading the relationship user\")\n\t\treturn c.Render(http.StatusInternalServerError, r.JSON(errorResponse))\n\t}\n\n\tresponse := PostsResponse{\n\t\tCode: fmt.Sprintf(\"%d\", http.StatusOK),\n\t\tData: *posts,\n\t\tMeta: *query.Paginator,\n\t}\n\tc.Logger().Debug(c.Value(\"email\"))\n\treturn c.Render(http.StatusOK, r.JSON(response))\n}", "func (env *Env) GetPosts(w http.ResponseWriter, r *http.Request) {\n\tstart, err := strconv.Atoi(r.URL.Query().Get(\"s\"))\n\tif err != nil {\n\t\tstart = 0\n\t}\n\tend, err := strconv.Atoi(r.URL.Query().Get(\"e\"))\n\tif err != nil {\n\t\tend = 10\n\t}\n\tp, err := env.DB.GetPosts(start, end)\n\tif err != nil {\n\t\tenv.log(r, err)\n\t\tw.WriteHeader(http.StatusNotFound)\n\t\treturn\n\t}\n\tw.Header().Set(\"Content-Type\", \"application/json\")\n\tw.WriteHeader(http.StatusOK)\n\tjson.NewEncoder(w).Encode(p)\n}", "func Posts(c *gin.Context) {\r\n\tlimit, _ := strconv.Atoi(c.DefaultQuery(\"limit\", \"10\"))\r\n\toffset, _ := strconv.Atoi(c.DefaultQuery(\"offset\", \"0\"))\r\n\r\n\tvar posts []Post\r\n\tdb.Limit(limit).Offset(offset).Find(&posts)\r\n\tc.JSON(http.StatusOK, gin.H{\r\n\t\t\"messege\": \"\",\r\n\t\t\"data\": posts,\r\n\t})\r\n}", "func (controller *PostQueryController) GetPosts(w http.ResponseWriter, r *http.Request) {\n\tres, err := controller.DiscussionQueryServiceInterface.GetPosts(context.TODO())\n\tif err != nil {\n\t\tvar httpCode int\n\t\tvar errorMsg string\n\n\t\tswitch err.Error() {\n\t\tcase errors.MissingRecord:\n\t\t\thttpCode = http.StatusNotFound\n\t\t\terrorMsg = \"No records found.\"\n\t\tdefault:\n\t\t\thttpCode = http.StatusInternalServerError\n\t\t\terrorMsg = \"Please contact technical support.\"\n\t\t}\n\n\t\tresponse := viewmodels.HTTPResponseVM{\n\t\t\tStatus: httpCode,\n\t\t\tSuccess: false,\n\t\t\tMessage: errorMsg,\n\t\t\tErrorCode: err.Error(),\n\t\t}\n\n\t\tresponse.JSON(w)\n\t\treturn\n\t}\n\n\tvar posts []types.PostResponse\n\n\tfor _, post := range res {\n\t\tposts = append(posts, types.PostResponse{\n\t\t\tID: post.ID,\n\t\t\tContent: post.Content,\n\t\t\tCreatedAt: post.CreatedAt.Unix(),\n\t\t\tUpdatedAt: post.UpdatedAt.Unix(),\n\t\t})\n\t}\n\tresponse := viewmodels.HTTPResponseVM{\n\t\tStatus: http.StatusOK,\n\t\tSuccess: true,\n\t\tMessage: \"Successfully fetched post data.\",\n\t\tData: posts,\n\t}\n\n\tresponse.JSON(w)\n}", "func GetAdmin(offset int64, number int64) (total int64, comments []Admin, err error) {\n\tdefer errors.Wrapper(&err)\n\n\tcommentsDB := make([]AdminDB, 0)\n\n\tpipeline := []bson.M{\n\t\t{\n\t\t\t\"$set\": bson.M{\n\t\t\t\t\"link\": bson.M{\n\t\t\t\t\t\"$arrayElemAt\": []interface{}{\n\t\t\t\t\t\tbson.M{\"$split\": []string{\"$url\", \"/post/\"}}, 1,\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\t\"$lookup\": bson.M{\n\t\t\t\t\"from\": \"posts\",\n\t\t\t\t\"localField\": \"link\",\n\t\t\t\t\"foreignField\": \"url\",\n\t\t\t\t\"as\": \"post\",\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\t\"$lookup\": bson.M{\n\t\t\t\t\"from\": \"comments\",\n\t\t\t\t\"localField\": \"reply\",\n\t\t\t\t\"foreignField\": \"_id\",\n\t\t\t\t\"as\": \"reply_comment\",\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\t\"$set\": bson.M{\"reply_comment\": bson.M{\"$arrayElemAt\": []interface{}{\"$reply_comment\", 0}}},\n\t\t},\n\t\t{\n\t\t\t\"$set\": bson.M{\"post\": bson.M{\"$arrayElemAt\": []interface{}{\"$post\", 0}}},\n\t\t},\n\t\t{\n\t\t\t\"$set\": bson.M{\n\t\t\t\t\"title\": \"$post.title\",\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\t\"$project\": bson.M{\n\t\t\t\t\"post\": 0,\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\t\"$sort\": bson.M{\"time\": -1},\n\t\t},\n\t}\n\tif number > 0 {\n\t\tpipeline = append(pipeline, mongo.AggregateOffset(offset, number)...)\n\t}\n\ttotal, err = mongo.Aggregate(\n\t\tDatabaseName,\n\t\tCollectionName,\n\t\tpipeline,\n\t\tnil,\n\t\t&commentsDB,\n\t)\n\tif err != nil {\n\t\treturn\n\t}\n\n\tcomments = make([]Admin, len(commentsDB))\n\tfor idx, commentDB := range commentsDB {\n\t\tcomments[idx] = *commentDB.ToAdmin()\n\t}\n\treturn\n}", "func (m *UserMutation) ClearPosts() {\n\tm.clearedposts = true\n}", "func (b *ConversationThreadRequestBuilder) Posts() *ConversationThreadPostsCollectionRequestBuilder {\n\tbb := &ConversationThreadPostsCollectionRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}\n\tbb.baseURL += \"/posts\"\n\treturn bb\n}", "func (u *User)GetPosts()(e error){\n\trows,e := db.Query(\"select * from posts where user_id = ? order by date desc \",u.Id)\n\tif e != nil {\n\t\treturn\n\t}\n\tfor rows.Next() {\n\t\tc := &Post{}\n\t\trows.Scan(&c.Id,&c.Title,&c.Topic,&c.Content,&c.Date,&c.CommunityId,&c.UserId)\n\t\tu.posts = append(u.posts,c)\n\t}\n\treturn\n}", "func (r *Resolver) PostQueryResolver(params graphql.ResolveParams) (interface{}, error) {\n\t// Strip the id from arguments and assert type\n\tid, ok := params.Args[\"id\"].(int)\n\tif ok {\n\t\tposts, err := r.Repository.GetByID(id)\n\t\treturn posts, err\n\t}\n\n\t// We didn't get a valid ID as a param, so we return all the posts\n\treturn r.Repository.GetAllPosts()\n}", "func (a App) Posts(res http.ResponseWriter, req *http.Request, _ httprouter.Params) {\n\n\t// easier to do\n\ttmpl := buildView(\"posts\")\n\n\t// Loop through rows using only one struct\n\trows, err := db.Query(\"SELECT * FROM posts\")\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\tdefer rows.Close()\n\n\tfor rows.Next() {\n\t\tvar p Post\n\n\t\tif err := rows.Scan(&p.Id, &p.Title, &p.Body); err != nil {\n\t\t\tlog.Println(err.Error())\n\t\t}\n\n\t\tposts = append(posts, p)\n\t}\n\n\t//////\n\tpd := PageData{\n\t\tPageTitle: \"Hello Gophercon!\",\n\t\tPosts: posts,\n\t}\n\n\t// easier to understand what's going on??\n\terr = tmpl.ExecuteTemplate(res, \"layout\", pd)\n\tif err != nil {\n\t\thttp.Error(res, err.Error(), http.StatusInternalServerError)\n\t}\n\n}", "func (p *PostsController) GetPosts(limit int, cursor string, userId int) ([]models.Post, bool) {\n\tvar posts []models.Post\n\tif limit > 50 {\n\t\tlimit = 50\n\t}\n\tlimit++\n\n\tif cursor != \"\" {\n\t\tp.db.Raw(`\n\t\t\tSELECT p.*,\n\t\t\t(SELECT \"value\" from \"likes\" \n\t\t\tWHERE \"user_id\" = ? and \"post_id\" = p.id) as \"StateValue\",\n\t\t\t(SELECT username FROM \"profiles\"\n\t\t\tWHERE user_id = p.user_id) as \"Creator\"\n\t\t\tFROM posts p\n\t\t\tWHERE p.created_at < ?\n\t\t\tORDER BY p.created_at DESC\n\t\t\tLIMIT ?\n\t\t`, userId, cursor, limit).Find(&posts)\n\t} else {\n\t\tp.db.Raw(`\n\t\t\tSELECT p.*,\n\t\t\t( SELECT \"value\" from \"likes\" \n\t\t\tWHERE \"user_id\" = ? and \"post_id\" = p.id) as \"StateValue\",\n\t\t\t(SELECT \"username\" FROM \"profiles\"\n\t\t\tWHERE user_id = p.user_id) as \"Creator\"\n\t\t\tFROM posts p\n\t\t\tORDER BY p.created_at DESC\n\t\t\tLIMIT ?\n\t\t`, userId, limit).Find(&posts)\n\t}\n\tif len(posts) == 0 {\n\t\treturn nil, false\n\t}\n\tif len(posts) == limit {\n\t\treturn posts[0 : limit-1], true\n\t}\n\n\treturn posts, false\n}", "func (o *Post) PostReads(mods ...qm.QueryMod) postReadQuery {\n\tvar queryMods []qm.QueryMod\n\tif len(mods) != 0 {\n\t\tqueryMods = append(queryMods, mods...)\n\t}\n\n\tqueryMods = append(queryMods,\n\t\tqm.Where(\"\\\"post_reads\\\".\\\"post_id\\\"=?\", o.ID),\n\t)\n\n\tquery := PostReads(queryMods...)\n\tqueries.SetFrom(query.Query, \"\\\"post_reads\\\"\")\n\n\tif len(queries.GetSelect(query.Query)) == 0 {\n\t\tqueries.SetSelect(query.Query, []string{\"\\\"post_reads\\\".*\"})\n\t}\n\n\treturn query\n}", "func NewPosts() *DBPosts {\n\treturn &DBPosts{\n\t\tDB: DB,\n\t\tLg: Lg,\n\t\tError: Error{Lg: Lg},\n\t\tDBQueries: *NewDBQueries(),\n\t}\n}", "func (c *CategoryClient) QueryUnsavedPosts(ca *Category) *UnsavedPostQuery {\n\tquery := &UnsavedPostQuery{config: c.config}\n\tquery.path = func(ctx context.Context) (fromV *sql.Selector, _ error) {\n\t\tid := ca.ID\n\t\tstep := sqlgraph.NewStep(\n\t\t\tsqlgraph.From(category.Table, category.FieldID, id),\n\t\t\tsqlgraph.To(unsavedpost.Table, unsavedpost.FieldID),\n\t\t\tsqlgraph.Edge(sqlgraph.O2M, false, category.UnsavedPostsTable, category.UnsavedPostsColumn),\n\t\t)\n\t\tfromV = sqlgraph.Neighbors(ca.driver.Dialect(), step)\n\t\treturn fromV, nil\n\t}\n\treturn query\n}", "func (h *userHandler) ListPost(w http.ResponseWriter, r *http.Request) {\r\n\th.store.RLock()\r\n\tposts := make([]post, 0, len(h.store.m))\r\n\tfor _, v := range h.store.m {\r\n\t\tposts = append(users, v)\r\n\t}\r\n\th.store.RUnlock()\r\n\tjsonBytes, err := json.Marshal(posts)\r\n\tif err != nil {\r\n\t\tinternalServerError(w, r)\r\n\t\treturn\r\n\t}\r\n\tw.WriteHeader(http.StatusOK)\r\n\tw.Write(jsonBytes)\r\n}", "func (k Keeper) GetPosts(ctx sdk.Context) []types.Post {\n\tvar posts []types.Post\n\tk.IteratePosts(ctx, func(_ int64, post types.Post) (stop bool) {\n\t\tposts = append(posts, post)\n\t\treturn false\n\t})\n\n\treturn posts\n}", "func HasPosts() predicate.User {\n\treturn predicate.User(func(s *sql.Selector) {\n\t\tstep := sqlgraph.NewStep(\n\t\t\tsqlgraph.From(Table, FieldID),\n\t\t\tsqlgraph.Edge(sqlgraph.O2M, false, PostsTable, PostsColumn),\n\t\t)\n\t\tsqlgraph.HasNeighbors(s, step)\n\t})\n}", "func GetAllPost(w http.ResponseWriter, r *http.Request) {\n\tpage := r.URL.Query()[\"page\"]\n\tuserID := r.URL.Query()[\"user\"]\n\n\tfilter := bson.M{}\n\tfilter[\"status\"] = bson.M{\n\t\t\"$ne\": poststatus.Deleted,\n\t}\n\n\tif len(userID) > 0 {\n\t\tuID, err := primitive.ObjectIDFromHex(userID[0])\n\t\tif err != nil {\n\t\t\tresponse.Error(w, http.StatusUnprocessableEntity, err.Error())\n\t\t\treturn\n\t\t}\n\t\tfilter[\"user_id\"] = uID\n\t}\n\n\tvar count int\n\n\tif len(page) > 0 {\n\t\tfmt.Println(\"STUFF\", len(page))\n\t\tnum, err := strconv.Atoi(page[0])\n\t\tif err != nil {\n\t\t\tresponse.Error(w, http.StatusUnprocessableEntity, err.Error())\n\t\t\treturn\n\t\t}\n\t\tcount = num\n\t} else {\n\t\tcount = 0\n\t}\n\n\tposts, err := GetAll(filter, count)\n\n\tif err != nil {\n\t\tresponse.Error(w, http.StatusUnprocessableEntity, err.Error())\n\t\treturn\n\t}\n\n\tif posts == nil {\n\t\tposts = []GetPostStruct{}\n\t}\n\n\tresponse.Success(w, r,\n\t\thttp.StatusOK,\n\t\tposts,\n\t)\n\treturn\n}", "func (s *service) PostList(params map[string][]string) ([]*model.Post, int64, error) {\n\tfilters, options, err := s.BuildFiltersAndOptions(params)\n\tif err != nil {\n\t\treturn nil, -1, err\n\t}\n\n\titems, totalItems, err := s.db.PostList(filters, options)\n\tif err != nil {\n\t\treturn nil, -1, err\n\t}\n\n\treturn items, totalItems, nil\n}", "func queryUserPosts(ctx sdk.Context, path []string, req abci.RequestQuery, keeper Keeper) ([]byte, error) {\n\towner, from, limit, err := extractCommonGetParameters(path)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tp := keeper.ListUserPosts(ctx, owner, from, limit)\n\n\tres, err := codec.MarshalJSONIndent(keeper.cdc, postsToQuerierPosts(p))\n\tif err != nil {\n\t\treturn nil, sdkerrors.Wrap(sdkerrors.ErrJSONMarshal, err.Error())\n\t}\n\n\treturn res, nil\n}", "func (c *Category) QueryUnsavedPosts() *UnsavedPostQuery {\n\treturn (&CategoryClient{config: c.config}).QueryUnsavedPosts(c)\n}", "func (u *App) List(c echo.Context, p *model.Pagination) ([]model.Post, string, string, int64, int64, error) {\n\tau := u.rbac.User(c)\n\tq, err := query.List(au, model.ResourcePost)\n\tif err != nil {\n\t\treturn nil, \"\", \"\", 0, 0, err\n\t}\n\n\tif c.QueryString() != \"\" {\n\t\tp.PostQuery = &model.Post{}\n\t\tparams := c.QueryParams()\n\n\t\tp.PostQuery.Status = params.Get(\"status\")\n\t\tp.SearchQuery = params.Get(\"s\")\n\t}\n\n\treturn u.udb.List(u.db, q, p)\n}", "func (s *Site) Posts() []Page {\n\tfor _, c := range s.Collections {\n\t\tif c.Name == \"posts\" {\n\t\t\treturn c.Pages()\n\t\t}\n\t}\n\treturn nil\n}", "func GetPosts(w http.ResponseWriter, r *http.Request) {\n\n\tposts := []m.Post{}\n\n\tdb, err := sqlx.Connect(\"postgres\", connStr)\n\tif err != nil {\n\t\tfmt.Println(err)\n\t}\n\n\tw.Header().Set(\"Content-Type\", \"application/json\")\n\n\tdb.Select(&posts, \"select id, title, content, created from posts\")\n\n\tjson.NewEncoder(w).Encode(posts)\n}", "func (k Keeper) Post(goCtx context.Context, req *types.QueryPostRequest) (*types.QueryPostResponse, error) {\n\tif !types.IsValidPostID(req.PostId) {\n\t\treturn nil, sdkerrors.Wrapf(sdkerrors.ErrInvalidRequest, \"invalid post id: %s\", req.PostId)\n\t}\n\n\tctx := sdk.UnwrapSDKContext(goCtx)\n\tpost, found := k.GetPost(ctx, req.PostId)\n\tif !found {\n\t\treturn nil, sdkerrors.Wrapf(sdkerrors.ErrInvalidRequest, \"post with id %s not found\", req.PostId)\n\t}\n\treturn &types.QueryPostResponse{Post: post}, nil\n}", "func (c *PostClient) QueryImages(po *Post) *PostImageQuery {\n\tquery := &PostImageQuery{config: c.config}\n\tquery.path = func(ctx context.Context) (fromV *sql.Selector, _ error) {\n\t\tid := po.ID\n\t\tstep := sqlgraph.NewStep(\n\t\t\tsqlgraph.From(post.Table, post.FieldID, id),\n\t\t\tsqlgraph.To(postimage.Table, postimage.FieldID),\n\t\t\tsqlgraph.Edge(sqlgraph.O2M, false, post.ImagesTable, post.ImagesColumn),\n\t\t)\n\t\tfromV = sqlgraph.Neighbors(po.driver.Dialect(), step)\n\t\treturn fromV, nil\n\t}\n\treturn query\n}", "func (client *ClientImpl) QueryPublishers(ctx context.Context, args QueryPublishersArgs) (*PublishersQuery, error) {\n\tif args.Query == nil {\n\t\treturn nil, &azuredevops.ArgumentNilError{ArgumentName: \"args.Query\"}\n\t}\n\tbody, marshalErr := json.Marshal(*args.Query)\n\tif marshalErr != nil {\n\t\treturn nil, marshalErr\n\t}\n\tlocationId, _ := uuid.Parse(\"99b44a8a-65a8-4670-8f3e-e7f7842cce64\")\n\tresp, err := client.Client.Send(ctx, http.MethodPost, locationId, \"7.1-preview.1\", nil, nil, bytes.NewReader(body), \"application/json\", \"application/json\", nil)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar responseValue PublishersQuery\n\terr = client.Client.UnmarshalBody(resp, &responseValue)\n\treturn &responseValue, err\n}", "func (repo *feedRepository) GetPosts(f *feed.Feed, sort feed.Sorting, limit, offset int) ([]*feed.Post, error) {\n\tvar err error\n\n\tvar rows *sql.Rows\n\tswitch sort {\n\t// TODO test queries with actual posts\n\tcase feed.SortNew:\n\t\trows, err = repo.db.Query(`\n\t\tSELECT id\n\t\tFROM\t(SELECT id, creation_time\n\t\t\t\t FROM (\n\t\t\t\t SELECT channel_username\n\t\t\t\t FROM feed_subscriptions\n\t\t\t\t WHERE feed_id = $1\n\t\t\t\t ) AS C (channel_from)\n\t\t\t\t NATURAL JOIN\n\t\t\t\t posts\n\t\t\t\t ) AS P\n\t\tORDER BY creation_time DESC NULLS LAST LIMIT $2 OFFSET $3`, f.ID, limit, offset)\n\tcase feed.SortHot:\n\t\trows, err = repo.db.Query(`\n\t\tSELECT post_id\n\t\tFROM(SELECT LP.post_id, comment_count\n\t\t\tFROM(\n\t\t\t SELECT *\n\t\t\t\tFROM (SELECT id, creation_time\n\t\t\t\t FROM (\n\t\t\t\t SELECT channel_username\n\t\t\t\t FROM feed_subscriptions\n\t\t\t\t WHERE feed_id = $1\n\t\t\t\t ) AS C (channel_from)\n\t\t\t\t NATURAL JOIN\n\t\t\t\t posts\n\t\t\t\t ) AS P\n\t\t\t\tORDER BY creation_time DESC NULLS LAST\n\t\t\t\t) AS LP (post_id)\n\t\t\t\tLEFT JOIN\n\t\t\t\t(SELECT post_from, COALESCE(COUNT(*), 0)\n\t\t\t\t FROM comments\n\t\t\t\t GROUP BY post_from\n\t\t\t\t) AS PS (post_id, comment_count) ON LP.post_id = PS.post_id\n\t\t\tORDER BY creation_time DESC\n\t\t) AS F ORDER BY comment_count DESC NULLS LAST \n\t\tLIMIT $2 OFFSET $3`, f.ID, limit, offset)\n\tcase feed.NotSet:\n\t\tfallthrough\n\tcase feed.SortTop:\n\t\tfallthrough\n\tdefault:\n\t\trows, err = repo.db.Query(`\n\t\tSELECT post_id\n\t\tFROM(SELECT Lp.post_id, total_star_count\n\t\t\tFROM(\n\t\t\t SELECT *\n\t\t\t\tFROM (SELECT id, creation_time\n\t\t\t\t FROM (\n\t\t\t\t SELECT channel_username\n\t\t\t\t FROM feed_subscriptions\n\t\t\t\t WHERE feed_id = $1\n\t\t\t\t ) AS C (channel_from)\n\t\t\t\t NATURAL JOIN\n\t\t\t\t posts\n\t\t\t\t ) AS P\n\t\t\t\tORDER BY creation_time DESC NULLS LAST\n\t\t\t\t) AS LP (post_id)\n\t\t\t\tLEFT JOIN\n\t\t\t\t(SELECT post_id,SUM(star_count)\n\t\t\t\t FROM post_stars\n\t\t\t\t GROUP BY post_id\n\t\t\t\t) AS PS (post_id, total_star_count) ON LP.post_id = PS.post_id\n\t\t\tORDER BY creation_time DESC\n\t\t) AS F ORDER BY total_star_count DESC NULLS LAST \n\t\tLIMIT $2 OFFSET $3`, f.ID, limit, offset)\n\t}\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"querying for feed_subscriptions failed because of: %s\", err.Error())\n\t}\n\tdefer rows.Close()\n\n\tvar id int\n\tposts := make([]*feed.Post, 0)\n\n\tfor rows.Next() {\n\t\terr := rows.Scan(&id)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"scanning from rows failed because: %s\", err.Error())\n\t\t}\n\t\tposts = append(posts, &feed.Post{ID: id})\n\t}\n\terr = rows.Err()\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"scanning from rows faulty because: %s\", err.Error())\n\t}\n\n\treturn posts, nil\n}", "func (m *UserMutation) ResetPosts() {\n\tm.posts = nil\n\tm.clearedposts = false\n\tm.removedposts = nil\n}", "func (r Repository) Posts(categoryName string, topic string) ([]DbPost, string) {\n\tthreads := r.Threads(categoryName)\n\tthread := filter(threads, func(t DbThread) bool {\n\t\treturn t.Topic == topic\n\t})\n\treturn thread[0].Posts, thread[0].Description\n}", "func (c *PostClient) QueryAuthor(po *Post) *AdminQuery {\n\tquery := &AdminQuery{config: c.config}\n\tquery.path = func(ctx context.Context) (fromV *sql.Selector, _ error) {\n\t\tid := po.ID\n\t\tstep := sqlgraph.NewStep(\n\t\t\tsqlgraph.From(post.Table, post.FieldID, id),\n\t\t\tsqlgraph.To(admin.Table, admin.FieldID),\n\t\t\tsqlgraph.Edge(sqlgraph.M2O, true, post.AuthorTable, post.AuthorColumn),\n\t\t)\n\t\tfromV = sqlgraph.Neighbors(po.driver.Dialect(), step)\n\t\treturn fromV, nil\n\t}\n\treturn query\n}", "func (b *blogsQueryBuilder) RemovePosts() (int64, error) {\n\tif b.err != nil {\n\t\treturn 0, b.err\n\t}\n\trelation, err := NRN_Blogs.Model.RelationByIndex(3)\n\tif err != nil {\n\t\treturn 0, errors.Wrapf(mapping.ErrInternal, \"getting 'Posts' relation by index for model 'Blog' failed: %v\", err)\n\t}\n\treturn b.builder.RemoveRelations(relation)\n}", "func (p *DBPosts) GetPosts(id string) error {\n\tvar rows *sql.Rows\n\tvar err error\n\tif id != \"\" {\n\t\trows, err = p.DB.Query(p.QGetOnePost, id)\n\t} else {\n\t\trows, err = p.DB.Query(p.QGetAllPosts)\n\t}\n\tdefer rows.Close()\n\tif err != nil {\n\t\treturn fmt.Errorf(\"error in db.query: %v\", err)\n\t}\n\tfor rows.Next() {\n\t\tpost := Post{}\n\t\terr = rows.Scan(&post.ID, &post.Title, &post.Summary, &post.Body, &post.Date)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"error in row.scan: %v\", err)\n\t\t}\n\t\tp.Posts = append(p.Posts, post)\n\t}\n\tif len(p.Posts) == 0 {\n\t\treturn fmt.Errorf(\"post not found: %s\", id)\n\t}\n\treturn nil\n}", "func (env *Env) GetPublishedPosts(w http.ResponseWriter, r *http.Request) {\n\tstart, err := strconv.Atoi(r.URL.Query().Get(\"s\"))\n\tif err != nil {\n\t\tstart = 0\n\t}\n\tend, err := strconv.Atoi(r.URL.Query().Get(\"e\"))\n\tif err != nil {\n\t\tend = 10\n\t}\n\tp, err := env.DB.PublishedPosts(start, end)\n\tif err != nil {\n\t\tenv.log(r, err)\n\t\tw.WriteHeader(http.StatusNotFound)\n\t\treturn\n\t}\n\tw.Header().Set(\"Content-Type\", \"application/json\")\n\tw.WriteHeader(http.StatusOK)\n\tjson.NewEncoder(w).Encode(p)\n}", "func ReadPosts(res render.Render) {\n\tvar post Post\n\tpublished := make([]Post, 0)\n\tposts, err := post.GetAll()\n\tif err != nil {\n\t\tlog.Println(err)\n\t\tres.JSON(500, map[string]interface{}{\"error\": \"Internal server error\"})\n\t\treturn\n\t}\n\tfor _, post := range posts {\n\t\tif post.Published {\n\t\t\tpublished = append(published, post)\n\t\t}\n\t}\n\tres.JSON(200, published)\n}", "func (db *Database) GetAllPosts() ([]models.Post, error) {\n\tvar posts []models.Post\n\terr := db.DB.Model(&posts).Select()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn posts, nil\n}", "func (o *Post) PostLikes(mods ...qm.QueryMod) postLikeQuery {\n\tvar queryMods []qm.QueryMod\n\tif len(mods) != 0 {\n\t\tqueryMods = append(queryMods, mods...)\n\t}\n\n\tqueryMods = append(queryMods,\n\t\tqm.Where(\"\\\"post_likes\\\".\\\"post_id\\\"=?\", o.ID),\n\t)\n\n\tquery := PostLikes(queryMods...)\n\tqueries.SetFrom(query.Query, \"\\\"post_likes\\\"\")\n\n\tif len(queries.GetSelect(query.Query)) == 0 {\n\t\tqueries.SetSelect(query.Query, []string{\"\\\"post_likes\\\".*\"})\n\t}\n\n\treturn query\n}", "func (bot *bot) dmAdmins(format string, args ...interface{}) error {\n\tfor _, id := range strings.Split(bot.AdminUserIDs, \",\") {\n\t\t_, err := bot.dm(id, &model.Post{\n\t\t\tMessage: fmt.Sprintf(format, args...),\n\t\t})\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\treturn nil\n}", "func (m *UserMutation) PostsCleared() bool {\n\treturn m.clearedposts\n}", "func (s *MysqlSender) AddPosts(posts []*database.Post) int {\n\tcount := 0\n\tfor _, post := range posts {\n\t\tif s.AddPost(post) {\n\t\t\tcount++\n\t\t}\n\t}\n\treturn count\n}", "func (u *MockUserRecord) NumPosts() int { return 0 }", "func (o *InlineResponse20082) SetPosts(v []InlineResponse20082Posts) {\n\to.Posts = &v\n}", "func (app *App) Post(path string, endpoint http.HandlerFunc, queries ...string) {\r\n\tapp.Router.HandleFunc(path, endpoint).Methods(\"POST\").Queries(queries...)\r\n}", "func ShowPostsHandler(w http.ResponseWriter, r *http.Request) {\n\tfmt.Fprintf(w, \"showing posts\")\n}", "func (api *Api) Post(path string, endpoint http.HandlerFunc, queries ...string) {\n\tapi.Router.HandleFunc(path, endpoint).Methods(\"POST\").Queries(queries...)\n}", "func queryPostHandlerFn(cliCtx context.CLIContext) http.HandlerFunc {\n\treturn func(w http.ResponseWriter, r *http.Request) {\n\t\tvars := mux.Vars(r)\n\t\tpostID := vars[\"postID\"]\n\n\t\troute := fmt.Sprintf(\"custom/%s/%s/%s\", types.QuerierRoute, types.QueryPost, postID)\n\t\tres, height, err := cliCtx.QueryWithData(route, nil)\n\t\tif err != nil {\n\t\t\trest.WriteErrorResponse(w, http.StatusNotFound, err.Error())\n\t\t\treturn\n\t\t}\n\n\t\tcliCtx, ok := rest.ParseQueryHeightOrReturnBadRequest(w, cliCtx, r)\n\t\tif !ok {\n\t\t\treturn\n\t\t}\n\n\t\tcliCtx = cliCtx.WithHeight(height)\n\t\trest.PostProcessResponse(w, cliCtx, res)\n\t}\n}", "func getPosts(w http.ResponseWriter, r *http.Request) {\n\tw.Header().Set(\"Content-Type\", \"application/json\")\n\tw.Header().Set(\"Access-Control-Allow-Origin\", \"*\")\n\tw.Header().Set(\"Access-Control-Allow-Methods\", \"POST, GET, OPTIONS, PUT, DELETE\")\n\tw.Header().Set(\"Access-Control-Allow-Headers\", \"Accept, Content-Type, Content-Length, Accept-Encoding, X-CSRF-Token, Authorization\")\n\tvar posts []Post\n\tresult, err := db.Query(\"SELECT id, title, text from posts\")\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tdefer result.Close()\n\tfor result.Next() {\n\t\tvar post Post\n\t\terr := result.Scan(&post.ID, &post.Title, &post.Text)\n\t\tif err != nil {\n\t\t\tpanic(err.Error())\n\t\t}\n\t\tposts = append(posts, post)\n\t}\n\tjson.NewEncoder(w).Encode(posts)\n}", "func (mgr *ConverterManager) ReadPosts() ([]os.FileInfo, error) {\n\tfiles, err := ioutil.ReadDir(mgr.MediumPostsPath)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn files, nil\n}", "func ShowPost(c buffalo.Context) error {\n\tdatabase := c.Value(\"tx\").(*pop.Connection)\n\n\tpost := &models.Post{}\n\n\tif txErr := database.Eager().Find(post, c.Param(\"post_id\")); txErr != nil {\n\n\t\tnotFoundResponse := utils.NewErrorResponse(\n\t\t\thttp.StatusNotFound,\n\t\t\t\"post_id\",\n\t\t\tfmt.Sprintf(\"The requested post %s is removed or move to somewhere else.\", c.Param(\"post_id\")),\n\t\t)\n\t\treturn c.Render(http.StatusNotFound, r.JSON(notFoundResponse))\n\t}\n\n\tpostResponse := PostResponse{\n\t\tCode: fmt.Sprintf(\"%d\", http.StatusOK),\n\t\tData: post,\n\t}\n\treturn c.Render(http.StatusOK, r.JSON(postResponse))\n}", "func FindAllPosts() ([]models.Post, error) {\n\tvar data []models.Post\n\tctx := context.Background()\n\tclient, err := firestore.NewClient(ctx, os.Getenv(\"PROJECT_ID\"))\n\tif err != nil {\n\t\tlog.Fatalf(\"Failed to create a Firestore Client: %v\", err)\n\t\treturn nil, err\n\t}\n\n\tdefer client.Close()\n\n\titer := client.Collection(collectionPosts).Documents(ctx)\n\tfor {\n\t\tdoc, err := iter.Next()\n\t\tif err == iterator.Done {\n\t\t\tbreak\n\t\t}\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tresult := models.Post{\n\t\t\tID: doc.Ref.ID,\n\t\t\tTitle: doc.Data()[\"title\"].(string),\n\t\t\tText: doc.Data()[\"text\"].(string),\n\t\t\tDate: doc.Data()[\"date\"].(time.Time),\n\t\t\tPrice: doc.Data()[\"price\"].(int64),\n\t\t\tAuthors: doc.Data()[\"authors\"].([]interface{}),\n\t\t\tPublished: doc.Data()[\"published\"].(bool),\n\t\t}\n\n\t\tdata = append(data, result)\n\t}\n\treturn data, nil\n}", "func ReactionListPost(\n\tconnections connection.Service,\n\tevents event.Service,\n\tobjects object.Service,\n\treactions reaction.Service,\n\tusers user.Service,\n) ReactionListPostFunc {\n\treturn func(\n\t\tcurrentApp *app.App,\n\t\torigin, postID uint64,\n\t\topts reaction.QueryOptions,\n\t) (*ReactionFeed, error) {\n\t\tp, err := PostFetch(objects)(currentApp, postID)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tif err := isPostVisible(connections, currentApp, p.Object, origin); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\trs, err := reactions.Query(currentApp.Namespace(), reaction.QueryOptions{\n\t\t\tBefore: opts.Before,\n\t\t\tDeleted: &defaultDeleted,\n\t\t\tLimit: opts.Limit,\n\t\t\tObjectIDs: []uint64{\n\t\t\t\tpostID,\n\t\t\t},\n\t\t})\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tum, err := user.MapFromIDs(users, currentApp.Namespace(), append(rs.OwnerIDs(), p.OwnerID)...)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tfor _, u := range um {\n\t\t\terr := enrichRelation(connections, currentApp, origin, u)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t}\n\n\t\terr = enrichCounts(objects, reactions, currentApp, PostList{p})\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\treturn &ReactionFeed{\n\t\t\tPostMap: PostMap{\n\t\t\t\tp.ID: p,\n\t\t\t},\n\t\t\tReactions: rs,\n\t\t\tUserMap: um,\n\t\t}, nil\n\t}\n}", "func AllPosts() ([]*PostMessage, error) {\n\trows, err := db.Query(\"SELECT * FROM posts\")\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer rows.Close()\n\n\tposts := make([]*PostMessage, 0)\n\tfor rows.Next() {\n\t\tpost := new(PostMessage)\n\t\terr := rows.Scan(&post.URL, &post.Text)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tposts = append(posts, post)\n\t}\n\tif err = rows.Err(); err != nil {\n\t\treturn nil, err\n\t}\n\treturn posts, nil\n}", "func DeletePosts(Id int) *ResponseModel {\n\tRes := &ResponseModel{500, \"Internal Server Error\"}\n\tdb, err := driver.Connect()\n\n\tif err != nil {\n\t\tfmt.Println(err.Error())\n\t\treturn Res\n\t}\n\n\tdefer db.Close()\n\n\t_, err = db.Exec(\"delete from posts where id = ?\", Id)\n\tif err != nil {\n\t\tfmt.Println(err.Error())\n\t\tRes = &ResponseModel{400, \"Failed save Data\"}\n\t\treturn Res\n\t}\n\tfmt.Println(\"Delete success!\")\n\tRes = &ResponseModel{200, \"Success delete Data\"}\n\treturn Res\n}", "func (c *PostClient) QueryAttachments(po *Post) *PostAttachmentQuery {\n\tquery := &PostAttachmentQuery{config: c.config}\n\tquery.path = func(ctx context.Context) (fromV *sql.Selector, _ error) {\n\t\tid := po.ID\n\t\tstep := sqlgraph.NewStep(\n\t\t\tsqlgraph.From(post.Table, post.FieldID, id),\n\t\t\tsqlgraph.To(postattachment.Table, postattachment.FieldID),\n\t\t\tsqlgraph.Edge(sqlgraph.O2M, false, post.AttachmentsTable, post.AttachmentsColumn),\n\t\t)\n\t\tfromV = sqlgraph.Neighbors(po.driver.Dialect(), step)\n\t\treturn fromV, nil\n\t}\n\treturn query\n}", "func (Post) Edges() []ent.Edge {\n\treturn []ent.Edge{\n\t\tedge.From(\"author\", User.Type).\n\t\t\tRef(\"posts\").\n\t\t\tUnique(),\n\t}\n}", "func (env *Env) GetUnpublishedPosts(w http.ResponseWriter, r *http.Request) {\n\tctx := r.Context()\n\tuser := ctx.Value(contextUser).(*models.User)\n\t// Just a double check - should we remove?\n\tif user.Role != \"ADMIN\" {\n\t\tw.WriteHeader(http.StatusForbidden)\n\t}\n\tp, err := env.DB.UnpublishedPosts()\n\tif err != nil {\n\t\tenv.log(r, err)\n\t\tw.WriteHeader(http.StatusNotFound)\n\t\treturn\n\t}\n\tw.Header().Set(\"Content-Type\", \"application/json\")\n\tw.WriteHeader(http.StatusOK)\n\tjson.NewEncoder(w).Encode(p)\n}", "func (b *_Blogs) GetPosts(ctx context.Context, db database.DB, model *Blog, relationFieldset ...string) ([]*Post, error) {\n\tif model == nil {\n\t\treturn nil, errors.Wrap(query.ErrNoModels, \"provided nil model\")\n\t}\n\t// Check if primary key has zero value.\n\tif model.IsPrimaryKeyZero() {\n\t\treturn nil, errors.Wrap(mapping.ErrFieldValue, \"model's: 'Blog' primary key value has zero value\")\n\t}\n\trelationField, err := b.Model.RelationByIndex(3)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar fields []*mapping.StructField\n\trelationModel := relationField.Relationship().RelatedModelStruct()\n\tif len(relationFieldset) == 0 {\n\t\tfields = relationModel.Fields()\n\t} else {\n\t\tfor _, field := range relationFieldset {\n\t\t\tsField, ok := relationModel.FieldByName(field)\n\t\t\tif !ok {\n\t\t\t\treturn nil, errors.Wrapf(mapping.ErrInvalidModelField, \"no field: '%s' found for the model: 'Post'\", field)\n\t\t\t}\n\t\t\tfields = append(fields, sField)\n\t\t}\n\t}\n\n\trelations, err := db.GetRelations(ctx, b.Model, []mapping.Model{model}, relationField, fields...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif len(relations) == 0 {\n\t\treturn []*Post{}, nil\n\t}\n\tresult := make([]*Post, len(relations))\n\tfor i, relation := range relations {\n\t\tresult[i] = relation.(*Post)\n\t}\n\treturn result, nil\n}", "func PostsRouter() *chi.Mux {\n\tr := chi.NewRouter()\n\tr.Use(render.SetContentType(render.ContentTypeJSON))\n\tr.Group(func(r chi.Router) {\n\t\tr.Use(jwttoken.GetVerifier())\n\t\tr.Use(jwttoken.AppAuthenticator)\n\t\tr.Get(\"/all\", listHandler)\n\t\tr.Post(\"/{postID}\", add)\n\t\tr.Get(\"/{postID}\", get)\n\t})\n\n\treturn r\n}", "func (o *Post) PostUploadFiles(mods ...qm.QueryMod) postUploadFileQuery {\n\tvar queryMods []qm.QueryMod\n\tif len(mods) != 0 {\n\t\tqueryMods = append(queryMods, mods...)\n\t}\n\n\tqueryMods = append(queryMods,\n\t\tqm.Where(\"\\\"post_upload_files\\\".\\\"post_id\\\"=?\", o.ID),\n\t)\n\n\tquery := PostUploadFiles(queryMods...)\n\tqueries.SetFrom(query.Query, \"\\\"post_upload_files\\\"\")\n\n\tif len(queries.GetSelect(query.Query)) == 0 {\n\t\tqueries.SetSelect(query.Query, []string{\"\\\"post_upload_files\\\".*\"})\n\t}\n\n\treturn query\n}", "func (s *PostSvc) FndPosts(ctx context.Context, req *pb.FndPostsReq) (*pb.PostsResp, error) {\n\treturn s.db.FndPosts(ctx, req)\n}", "func NewPosts(posts map[graphql.ID]*models.Post) *Posts {\n\treturn &Posts{posts}\n}", "func (posts *Posts) GetPostList(page, size int64, isPage bool, onlyPublished bool, orderBy string) (*utils.Pager, error) {\n\tvar pager *utils.Pager\n\tcount, err := GetNumberOfPosts(isPage, onlyPublished)\n\tpager = utils.NewPager(page, size, count)\n\n\tif !pager.IsValid {\n\t\treturn pager, fmt.Errorf(\"Page not found\")\n\t}\n\n\tsafeOrderBy := getSafeOrderByStmt(orderBy)\n\n\tsession := postSession.Clone()\n\n\tif onlyPublished {\n\t\terr = session.DB(DBName).C(\"posts\").Find(bson.M{\"ispage\": isPage, \"ispublished\": true}).Sort(safeOrderBy).Skip(int(pager.Begin)).Limit(int(size)).All(posts)\n\t} else {\n\t\terr = session.DB(DBName).C(\"posts\").Find(bson.M{\"ispage\": isPage}).Sort(safeOrderBy).Skip(int(pager.Begin)).Limit(int(size)).All(posts)\n\t}\n\n\treturn pager, err\n}", "func (o *Post) PostTemplate(mods ...qm.QueryMod) postTemplateQuery {\n\tqueryMods := []qm.QueryMod{\n\t\tqm.Where(\"post_id=?\", o.ID),\n\t}\n\n\tqueryMods = append(queryMods, mods...)\n\n\tquery := PostTemplates(queryMods...)\n\tqueries.SetFrom(query.Query, \"\\\"post_templates\\\"\")\n\n\treturn query\n}", "func (c *PostClient) Query() *PostQuery {\n\treturn &PostQuery{\n\t\tconfig: c.config,\n\t}\n}", "func FetchPosts(c *gin.Context) {\n\tid, err := utils.GetSessionID(c)\n\tif err != nil || id != \"CEO\" {\n\t\tc.String(http.StatusForbidden, \"Only the CEO can access this.\")\n\t\treturn\n\t}\n\n\tposts, err := ElectionDb.GetPosts()\n\tif err != nil {\n\t\tc.String(http.StatusInternalServerError, \"Error while fetching posts.\")\n\t\treturn\n\t}\n\tc.JSON(http.StatusOK, &posts)\n}", "func AllPosts(db *gorm.DB) ([]model.PostOutput, string) {\n\n\tvar posts []model.Post\n\terr := db.Preload(\"Author\").Preload(\"Comments\").Preload(\"Comments.Author\").Preload(\"Likes\").Preload(\"Likes.Author\").Find(&posts).Error\n\tuser := true\n\tcomment := 1\n\tresult := postsToPostOutput(posts, user, comment)\n\n\tif err == nil {\n\t\treturn result, \"\"\n\t}\n\treturn result, err.Error()\n}", "func (bav *UtxoView) GetAllPosts() (_corePosts []*PostEntry, _commentsByPostHash map[BlockHash][]*PostEntry, _err error) {\n\t// Start by fetching all the posts we have in the db.\n\t//\n\t// TODO(performance): This currently fetches all posts. We should implement\n\t// some kind of pagination instead though.\n\t_, _, dbPostEntries, err := DBGetAllPostsByTstamp(bav.Handle, true /*fetchEntries*/)\n\tif err != nil {\n\t\treturn nil, nil, errors.Wrapf(err, \"GetAllPosts: Problem fetching PostEntry's from db: \")\n\t}\n\n\t// Iterate through the entries found in the db and force the view to load them.\n\t// This fills in any gaps in the view so that, after this, the view should contain\n\t// the union of what it had before plus what was in the db.\n\tfor _, dbPostEntry := range dbPostEntries {\n\t\tbav.GetPostEntryForPostHash(dbPostEntry.PostHash)\n\t}\n\n\t// Do one more pass to load all the comments from the DB.\n\tfor _, postEntry := range bav.PostHashToPostEntry {\n\t\t// Ignore deleted or rolled-back posts.\n\t\tif postEntry.isDeleted {\n\t\t\tcontinue\n\t\t}\n\n\t\t// If we have a post in the view and if that post is not a comment\n\t\t// then fetch its attached comments from the db. We need to do this\n\t\t// because the tstamp index above only fetches \"core\" posts not\n\t\t// comments.\n\n\t\tif len(postEntry.ParentStakeID) == 0 {\n\t\t\t_, dbCommentHashes, _, err := DBGetCommentPostHashesForParentStakeID(\n\t\t\t\tbav.Handle, postEntry.ParentStakeID, false /*fetchEntries*/)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, nil, errors.Wrapf(err, \"GetAllPosts: Problem fetching comment PostEntry's from db: \")\n\t\t\t}\n\t\t\tfor _, commentHash := range dbCommentHashes {\n\t\t\t\tbav.GetPostEntryForPostHash(commentHash)\n\t\t\t}\n\t\t}\n\t}\n\n\tallCorePosts := []*PostEntry{}\n\tcommentsByPostHash := make(map[BlockHash][]*PostEntry)\n\tfor _, postEntry := range bav.PostHashToPostEntry {\n\t\t// Ignore deleted or rolled-back posts.\n\t\tif postEntry.isDeleted {\n\t\t\tcontinue\n\t\t}\n\n\t\t// Every post is either a core post or a comment. If it has a stake ID\n\t\t// its a comment, and if it doesn't then it's a core post.\n\t\tif len(postEntry.ParentStakeID) == 0 {\n\t\t\tallCorePosts = append(allCorePosts, postEntry)\n\t\t} else {\n\t\t\t// Add the comment to our map.\n\t\t\tcommentsForPost := commentsByPostHash[*StakeIDToHash(postEntry.ParentStakeID)]\n\t\t\tcommentsForPost = append(commentsForPost, postEntry)\n\t\t\tcommentsByPostHash[*StakeIDToHash(postEntry.ParentStakeID)] = commentsForPost\n\t\t}\n\t}\n\t// Sort all the comment lists as well. Here we put the latest comment at the\n\t// end.\n\tfor _, commentList := range commentsByPostHash {\n\t\tsort.Slice(commentList, func(ii, jj int) bool {\n\t\t\treturn commentList[ii].TimestampNanos < commentList[jj].TimestampNanos\n\t\t})\n\t}\n\n\treturn allCorePosts, commentsByPostHash, nil\n}", "func (p *Posts) GetAllPostList(isPage bool, onlyPublished bool, orderBy string) error {\n\tsession := postSession.Clone()\n\n\tvar err error\n\n\tsafeOrderBy := getSafeOrderByStmt(orderBy)\n\n\tif onlyPublished {\n\t\terr = session.DB(DBName).C(\"posts\").Find(bson.M{\"ispage\": isPage, \"ispublished\": true}).Sort(safeOrderBy).All(p)\n\t} else {\n\t\terr = session.DB(DBName).C(\"posts\").Find(bson.M{\"ispage\": isPage}).Sort(safeOrderBy).All(p)\n\t}\n\n\treturn err\n}", "func GetPosts() (posts []Post, err error) {\n\trows, err := Db.Query(\"select * from posts\")\n\tif err != nil {\n\t\treturn\n\t}\n\n\tfor rows.Next() {\n\t\tpost := Post{}\n\t\terr = rows.Scan(&post.ID, &post.Title, &post.Body, &post.CreatedAt)\n\t\tif err != nil {\n\t\t\treturn\n\t\t}\n\t\tposts = append(posts, post)\n\t}\n\trows.Close()\n\treturn\n}", "func ReadPostsPublish() []models.PostsModel {\n\tdb, err := driver.Connect()\n\n\tif err != nil {\n\t\tfmt.Println(err.Error())\n\t\treturn nil\n\t}\n\n\tdefer db.Close()\n\n\tvar result []models.PostsModel\n\n\titems, err := db.Query(\"select id, title, content, category, status from posts where status='publish'\")\n\tif err != nil {\n\t\tfmt.Println(err.Error())\n\t\treturn nil\n\t}\n\n\tfmt.Printf(\"%T\\n\", items)\n\n\tfor items.Next() {\n\t\tvar each = models.PostsModel{}\n\t\tvar err = items.Scan(&each.Id, &each.Title, &each.Content, &each.Category, &each.Status)\n\n\t\tif err != nil {\n\t\t\tfmt.Println(err.Error())\n\t\t\treturn nil\n\t\t}\n\n\t\tresult = append(result, each)\n\n\t}\n\n\tif err = items.Err(); err != nil {\n\t\tfmt.Println(err.Error())\n\t\treturn nil\n\t}\n\n\treturn result\n}", "func (*controller) GetPosts(w http.ResponseWriter, r *http.Request) {\n\tw.Header().Set(\"Content-type\", \"application/json\")\n\tposts, err := postService.FindAll()\n\tif err != nil {\n\t\tw.WriteHeader(http.StatusInternalServerError)\n\t\tjson.NewEncoder(w).Encode(errors.ServiceError{Message: \"Failed to load posts\"})\n\t\treturn\n\t}\n\tw.WriteHeader(http.StatusOK)\n\tjson.NewEncoder(w).Encode(posts)\n\n}", "func AllPosts() ([]Post, error) {\n\tconfig.Session.Refresh()\n\tcurrentSession := config.Session.Copy()\n\tdefer currentSession.Close()\n\n\tposts := make([]Post, 0)\n\tif err := config.Posts.Find(bson.M{}).All(&posts); err != nil {\n\t\treturn nil, errors.Wrap(err, \"find all posts\")\n\t}\n\n\treverse(posts)\n\n\treturn posts, nil\n}", "func (bl *postBusiness) GetAll() (*models.Posts, *apperror.AppError) {\n\treturn bl.service.GetAll()\n}", "func GetAllPosts() ([]Post, error) {\n\tvar res []Post\n\tdb := DBCon()\n\n\t// Execute the query which takes all posts from Wordpress database and order by New to Old\n\tresults, err := db.Query(\"SELECT post.ID as post_id, post.post_title as post_title, post.guid as post_url, \" +\n\t\t\"p.guid as post_poster, post.post_excerpt as post_description, post.post_modified_gmt \" +\n\t\t\"FROM wp_posts AS post JOIN wp_postmeta AS postmeta ON postmeta.post_id = post.ID \" +\n\t\t\"JOIN wp_posts AS p ON p.ID = postmeta.meta_value \" +\n\t\t\"WHERE post.post_type = 'post' AND post.post_status = 'publish' AND postmeta.meta_key = '_thumbnail_id' \" +\n\t\t\"ORDER BY post.post_modified DESC;\")\n\tif err != nil {\n\t\tlog.Fatal(\"(ERR) Cannot query the database: \", err)\n\t}\n\n\t// Iterate through results\n\tfor results.Next() {\n\t\tvar eachRes = new(Post)\n\t\t// for each row of the data, scan into structure\n\t\terr = results.Scan(&eachRes.PostID, &eachRes.PostTitle, &eachRes.PostUrl, &eachRes.PostPoster,\n\t\t\t&eachRes.PostDescription, &eachRes.PostModifiedGMT)\n\t\tif err != nil {\n\t\t\tlog.Println(\"(ERR) Problem while reading data from database: \", err)\n\t\t}\n\n\t\tres = append(res, *eachRes)\n\t}\n\tdefer db.Close()\n\n\treturn res, err\n}", "func CountPosts(c echo.Context) error {\n\treturn c.JSON(http.StatusOK, model.CountPosts())\n}", "func (c *UnsavedPostClient) QueryAuthor(up *UnsavedPost) *AdminQuery {\n\tquery := &AdminQuery{config: c.config}\n\tquery.path = func(ctx context.Context) (fromV *sql.Selector, _ error) {\n\t\tid := up.ID\n\t\tstep := sqlgraph.NewStep(\n\t\t\tsqlgraph.From(unsavedpost.Table, unsavedpost.FieldID, id),\n\t\t\tsqlgraph.To(admin.Table, admin.FieldID),\n\t\t\tsqlgraph.Edge(sqlgraph.M2O, true, unsavedpost.AuthorTable, unsavedpost.AuthorColumn),\n\t\t)\n\t\tfromV = sqlgraph.Neighbors(up.driver.Dialect(), step)\n\t\treturn fromV, nil\n\t}\n\treturn query\n}", "func (k Keeper) IteratePosts(ctx sdk.Context, fn func(index int64, post types.Post) (stop bool)) {\n\tstore := ctx.KVStore(k.StoreKey)\n\titerator := sdk.KVStorePrefixIterator(store, types.PostStorePrefix)\n\tdefer iterator.Close()\n\ti := int64(0)\n\tfor ; iterator.Valid(); iterator.Next() {\n\t\tvar post types.Post\n\t\tk.Cdc.MustUnmarshalBinaryBare(iterator.Value(), &post)\n\t\tstop := fn(i, post)\n\t\tif stop {\n\t\t\tbreak\n\t\t}\n\t\ti++\n\t}\n}", "func (b *blogsQueryBuilder) AddPosts(_posts ...*Post) error {\n\tif b.err != nil {\n\t\treturn b.err\n\t}\n\trelation, err := NRN_Blogs.Model.RelationByIndex(3)\n\tif err != nil {\n\t\treturn errors.Wrapf(mapping.ErrInternal, \"getting 'Posts' relation by index for model 'Blog' failed: %v\", err)\n\t}\n\tmodels := make([]mapping.Model, len(_posts))\n\tfor i := range _posts {\n\t\tmodels[i] = _posts[i]\n\t}\n\treturn b.builder.AddRelations(relation, models...)\n}", "func getUserPostsHandler(res http.ResponseWriter, req *http.Request) {\n\tres.Header().Add(\"content-type\", \"application/json\")\n\tparams := mux.Vars(req)\n\tid, _ := primitive.ObjectIDFromHex(params[\"id\"])\n\tfmt.Println(id)\n\tvar posts []MongoPostSchema\n\tpostsCol := client.Database(\"Aviroop_Nandy_Appointy\").Collection(\"posts\")\n\tctx, _ := context.WithTimeout(context.Background(), 10*time.Second)\n\tcursor, err := postsCol.Find(ctx, bson.M{})\n\n\tif err != nil {\n\t\tres.WriteHeader(http.StatusInternalServerError)\n\t\tres.Write([]byte(`{\"Error message\":\"` + err.Error() + `\"}`))\n\t\treturn\n\t}\n\n\tdefer cursor.Close(ctx)\n\tfor cursor.Next(ctx) {\n\t\tvar post MongoPostSchema\n\t\tcursor.Decode(&post)\n\t\tposts = append(posts, post)\n\t}\n\n\tif err := cursor.Err(); err != nil {\n\t\tres.WriteHeader(http.StatusInternalServerError)\n\t\tres.Write([]byte(`{\"message\":\"` + err.Error() + `\"}`))\n\t\treturn\n\t}\n\tjson.NewEncoder(res).Encode(posts)\n}", "func (b *blogsQueryBuilder) IncludePosts(postsFieldset ...string) *blogsQueryBuilder {\n\tif b.err != nil {\n\t\treturn b\n\t}\n\trelation, err := NRN_Blogs.Model.RelationByIndex(3)\n\tif err != nil {\n\t\tb.err = errors.Wrapf(mapping.ErrInternal, \"Getting 'Posts' by index for model 'Blog' failed: %v\", err)\n\t\treturn b\n\t}\n\t// check the fieldset for the relation.\n\tvar relationFields []*mapping.StructField\n\tfor _, field := range postsFieldset {\n\t\tstructField, ok := relation.ModelStruct().FieldByName(field)\n\t\tif !ok {\n\t\t\tb.err = errors.Wrapf(mapping.ErrInvalidModelField, \"field: '%s' is not found for the 'Post' model\", field)\n\t\t\treturn b\n\t\t}\n\t\trelationFields = append(relationFields, structField)\n\t}\n\tb.builder.Include(relation, relationFields...)\n\treturn b\n}", "func (i *InstaClient) GetPosts(userID string, options map[string]string) (*UserFeed, error) {\n\tif len(userID) == 0 {\n\t\treturn nil, errors.New(\"User ID cannot be empty\")\n\t}\n\n\tfeed := new(UserFeed)\n\terr := i.getRequest(fmt.Sprintf(base+\"/users/%s/media/recent\", userID), options, feed)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn feed, nil\n}", "func GetAllPostsofaUserEndpoint(response http.ResponseWriter, request *http.Request) {\n\n\tlock.Lock()\n\tdefer lock.Unlock()\n\n\tvar slicePost []Post\n\tresponse.Header().Add(\"content-type\", \"application/json\")\n\tparams := mux.Vars(request)\n\tid, _ := (params[\"id\"])\n\tvar post Post\n\tcollection := client.Database(\"Instagram\").Collection(\"post\")\n\tctx, _ := context.WithTimeout(context.Background(), 10*time.Second)\n\tcur, err := collection.Find(ctx, bson.M{\"userId\": id})\n\tif err != nil {\n\t\tresponse.WriteHeader(http.StatusInternalServerError)\n\t\tresponse.Write([]byte(`{\"message\": \"` + err.Error() + `\"}`))\n\t\treturn\n\t}\n\n\tfor cur.Next(ctx) {\n\t\terr := cur.Decode(&post)\n\t\tif err != nil {\n\t\t\tresponse.WriteHeader(http.StatusInternalServerError)\n\t\t\tresponse.Write([]byte(`{\"message\": \"` + err.Error() + `\"}`))\n\t\t\treturn\n\t\t}\n\t\tslicePost = append(slicePost, post)\n\t}\n\tfor _, item := range slicePost {\n\t\tif item.UserID == id {\n\t\t\tfmt.Println(item.ID)\n\t\t\tfmt.Println(item.Caption)\n\t\t\tjson.NewEncoder(response).Encode(item)\n\t\t}\n\t}\n\n\ttime.Sleep(1 * time.Second)\n}" ]
[ "0.6985911", "0.6921517", "0.6899582", "0.67357093", "0.6309072", "0.61621636", "0.6007832", "0.6003749", "0.59770525", "0.5897395", "0.57997346", "0.5780568", "0.571718", "0.569018", "0.5658456", "0.5644201", "0.5637845", "0.56044555", "0.5596861", "0.5594278", "0.558915", "0.5565086", "0.5555962", "0.5552564", "0.5527583", "0.5521705", "0.5519191", "0.5413871", "0.5395329", "0.53568244", "0.5323037", "0.53113425", "0.5302265", "0.5275858", "0.5260588", "0.5253274", "0.5249367", "0.52491593", "0.52295065", "0.52255005", "0.52153903", "0.52047145", "0.5189942", "0.51679164", "0.5146605", "0.5126564", "0.5106747", "0.51028115", "0.5094576", "0.5084", "0.5055372", "0.5024086", "0.501813", "0.50087714", "0.5006991", "0.4994166", "0.49930605", "0.49711406", "0.49672177", "0.49655566", "0.49588007", "0.4943723", "0.4931297", "0.4930824", "0.49026322", "0.48994622", "0.48817223", "0.4878595", "0.48686844", "0.48661146", "0.48258388", "0.48246926", "0.481866", "0.4816486", "0.47926834", "0.47853026", "0.47788018", "0.47763744", "0.47738385", "0.4771183", "0.47702375", "0.47633502", "0.47598752", "0.4749043", "0.4747505", "0.4744009", "0.474346", "0.47347105", "0.47268918", "0.4723054", "0.47183388", "0.47155955", "0.47105873", "0.47089687", "0.47055718", "0.47055376", "0.46969151", "0.46929693", "0.46893817", "0.46881217" ]
0.81031495
0
QueryUnsavedPosts queries the unsaved_posts edge of a Admin.
func (c *AdminClient) QueryUnsavedPosts(a *Admin) *UnsavedPostQuery { query := &UnsavedPostQuery{config: c.config} query.path = func(ctx context.Context) (fromV *sql.Selector, _ error) { id := a.ID step := sqlgraph.NewStep( sqlgraph.From(admin.Table, admin.FieldID, id), sqlgraph.To(unsavedpost.Table, unsavedpost.FieldID), sqlgraph.Edge(sqlgraph.O2M, false, admin.UnsavedPostsTable, admin.UnsavedPostsColumn), ) fromV = sqlgraph.Neighbors(a.driver.Dialect(), step) return fromV, nil } return query }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (c *Category) QueryUnsavedPosts() *UnsavedPostQuery {\n\treturn (&CategoryClient{config: c.config}).QueryUnsavedPosts(c)\n}", "func (c *CategoryClient) QueryUnsavedPosts(ca *Category) *UnsavedPostQuery {\n\tquery := &UnsavedPostQuery{config: c.config}\n\tquery.path = func(ctx context.Context) (fromV *sql.Selector, _ error) {\n\t\tid := ca.ID\n\t\tstep := sqlgraph.NewStep(\n\t\t\tsqlgraph.From(category.Table, category.FieldID, id),\n\t\t\tsqlgraph.To(unsavedpost.Table, unsavedpost.FieldID),\n\t\t\tsqlgraph.Edge(sqlgraph.O2M, false, category.UnsavedPostsTable, category.UnsavedPostsColumn),\n\t\t)\n\t\tfromV = sqlgraph.Neighbors(ca.driver.Dialect(), step)\n\t\treturn fromV, nil\n\t}\n\treturn query\n}", "func (c *UnsavedPostAttachmentClient) QueryUnsavedPost(upa *UnsavedPostAttachment) *UnsavedPostQuery {\n\tquery := &UnsavedPostQuery{config: c.config}\n\tquery.path = func(ctx context.Context) (fromV *sql.Selector, _ error) {\n\t\tid := upa.ID\n\t\tstep := sqlgraph.NewStep(\n\t\t\tsqlgraph.From(unsavedpostattachment.Table, unsavedpostattachment.FieldID, id),\n\t\t\tsqlgraph.To(unsavedpost.Table, unsavedpost.FieldID),\n\t\t\tsqlgraph.Edge(sqlgraph.M2O, true, unsavedpostattachment.UnsavedPostTable, unsavedpostattachment.UnsavedPostColumn),\n\t\t)\n\t\tfromV = sqlgraph.Neighbors(upa.driver.Dialect(), step)\n\t\treturn fromV, nil\n\t}\n\treturn query\n}", "func (c *UnsavedPostImageClient) QueryUnsavedPost(upi *UnsavedPostImage) *UnsavedPostQuery {\n\tquery := &UnsavedPostQuery{config: c.config}\n\tquery.path = func(ctx context.Context) (fromV *sql.Selector, _ error) {\n\t\tid := upi.ID\n\t\tstep := sqlgraph.NewStep(\n\t\t\tsqlgraph.From(unsavedpostimage.Table, unsavedpostimage.FieldID, id),\n\t\t\tsqlgraph.To(unsavedpost.Table, unsavedpost.FieldID),\n\t\t\tsqlgraph.Edge(sqlgraph.M2O, true, unsavedpostimage.UnsavedPostTable, unsavedpostimage.UnsavedPostColumn),\n\t\t)\n\t\tfromV = sqlgraph.Neighbors(upi.driver.Dialect(), step)\n\t\treturn fromV, nil\n\t}\n\treturn query\n}", "func (c *UnsavedPostThumbnailClient) QueryUnsavedPost(upt *UnsavedPostThumbnail) *UnsavedPostQuery {\n\tquery := &UnsavedPostQuery{config: c.config}\n\tquery.path = func(ctx context.Context) (fromV *sql.Selector, _ error) {\n\t\tid := upt.ID\n\t\tstep := sqlgraph.NewStep(\n\t\t\tsqlgraph.From(unsavedpostthumbnail.Table, unsavedpostthumbnail.FieldID, id),\n\t\t\tsqlgraph.To(unsavedpost.Table, unsavedpost.FieldID),\n\t\t\tsqlgraph.Edge(sqlgraph.O2O, true, unsavedpostthumbnail.UnsavedPostTable, unsavedpostthumbnail.UnsavedPostColumn),\n\t\t)\n\t\tfromV = sqlgraph.Neighbors(upt.driver.Dialect(), step)\n\t\treturn fromV, nil\n\t}\n\treturn query\n}", "func (c *UnsavedPostVideoClient) QueryUnsavedPost(upv *UnsavedPostVideo) *UnsavedPostQuery {\n\tquery := &UnsavedPostQuery{config: c.config}\n\tquery.path = func(ctx context.Context) (fromV *sql.Selector, _ error) {\n\t\tid := upv.ID\n\t\tstep := sqlgraph.NewStep(\n\t\t\tsqlgraph.From(unsavedpostvideo.Table, unsavedpostvideo.FieldID, id),\n\t\t\tsqlgraph.To(unsavedpost.Table, unsavedpost.FieldID),\n\t\t\tsqlgraph.Edge(sqlgraph.M2O, true, unsavedpostvideo.UnsavedPostTable, unsavedpostvideo.UnsavedPostColumn),\n\t\t)\n\t\tfromV = sqlgraph.Neighbors(upv.driver.Dialect(), step)\n\t\treturn fromV, nil\n\t}\n\treturn query\n}", "func (c *AdminClient) QueryPosts(a *Admin) *PostQuery {\n\tquery := &PostQuery{config: c.config}\n\tquery.path = func(ctx context.Context) (fromV *sql.Selector, _ error) {\n\t\tid := a.ID\n\t\tstep := sqlgraph.NewStep(\n\t\t\tsqlgraph.From(admin.Table, admin.FieldID, id),\n\t\t\tsqlgraph.To(post.Table, post.FieldID),\n\t\t\tsqlgraph.Edge(sqlgraph.O2M, false, admin.PostsTable, admin.PostsColumn),\n\t\t)\n\t\tfromV = sqlgraph.Neighbors(a.driver.Dialect(), step)\n\t\treturn fromV, nil\n\t}\n\treturn query\n}", "func (e CategoryEdges) UnsavedPostsOrErr() ([]*UnsavedPost, error) {\n\tif e.loadedTypes[1] {\n\t\treturn e.UnsavedPosts, nil\n\t}\n\treturn nil, &NotLoadedError{edge: \"unsaved_posts\"}\n}", "func (env *Env) GetUnpublishedPosts(w http.ResponseWriter, r *http.Request) {\n\tctx := r.Context()\n\tuser := ctx.Value(contextUser).(*models.User)\n\t// Just a double check - should we remove?\n\tif user.Role != \"ADMIN\" {\n\t\tw.WriteHeader(http.StatusForbidden)\n\t}\n\tp, err := env.DB.UnpublishedPosts()\n\tif err != nil {\n\t\tenv.log(r, err)\n\t\tw.WriteHeader(http.StatusNotFound)\n\t\treturn\n\t}\n\tw.Header().Set(\"Content-Type\", \"application/json\")\n\tw.WriteHeader(http.StatusOK)\n\tjson.NewEncoder(w).Encode(p)\n}", "func (upq *UnsavedPostQuery) All(ctx context.Context) ([]*UnsavedPost, error) {\n\tif err := upq.prepareQuery(ctx); err != nil {\n\t\treturn nil, err\n\t}\n\treturn upq.sqlAll(ctx)\n}", "func (m *UserMutation) ClearPosts() {\n\tm.clearedposts = true\n}", "func (c *UnsavedPostClient) Query() *UnsavedPostQuery {\n\treturn &UnsavedPostQuery{\n\t\tconfig: c.config,\n\t}\n}", "func (b *Blog) QueryAdmins() *UserQuery {\n\treturn NewBlogClient(b.config).QueryAdmins(b)\n}", "func (u *User) QueryPosts() *ExperienceQuery {\n\treturn (&UserClient{config: u.config}).QueryPosts(u)\n}", "func Posts(mods ...qm.QueryMod) postQuery {\n\tmods = append(mods, qm.From(\"\\\"posts\\\"\"))\n\treturn postQuery{NewQuery(mods...)}\n}", "func (m *UserMutation) ResetPosts() {\n\tm.posts = nil\n\tm.clearedposts = false\n\tm.removedposts = nil\n}", "func (m *UserMutation) PostsCleared() bool {\n\treturn m.clearedposts\n}", "func (c *UnsavedPostClient) Get(ctx context.Context, id int) (*UnsavedPost, error) {\n\treturn c.Query().Where(unsavedpost.ID(id)).Only(ctx)\n}", "func (upq *UnsavedPostQuery) Clone() *UnsavedPostQuery {\n\tif upq == nil {\n\t\treturn nil\n\t}\n\treturn &UnsavedPostQuery{\n\t\tconfig: upq.config,\n\t\tlimit: upq.limit,\n\t\toffset: upq.offset,\n\t\torder: append([]OrderFunc{}, upq.order...),\n\t\tpredicates: append([]predicate.UnsavedPost{}, upq.predicates...),\n\t\twithAuthor: upq.withAuthor.Clone(),\n\t\twithCategory: upq.withCategory.Clone(),\n\t\twithThumbnail: upq.withThumbnail.Clone(),\n\t\twithImages: upq.withImages.Clone(),\n\t\twithVideos: upq.withVideos.Clone(),\n\t\twithAttachments: upq.withAttachments.Clone(),\n\t\t// clone intermediate query.\n\t\tsql: upq.sql.Clone(),\n\t\tpath: upq.path,\n\t}\n}", "func (upq *UnsavedPostQuery) QueryImages() *UnsavedPostImageQuery {\n\tquery := &UnsavedPostImageQuery{config: upq.config}\n\tquery.path = func(ctx context.Context) (fromU *sql.Selector, err error) {\n\t\tif err := upq.prepareQuery(ctx); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tselector := upq.sqlQuery(ctx)\n\t\tif err := selector.Err(); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tstep := sqlgraph.NewStep(\n\t\t\tsqlgraph.From(unsavedpost.Table, unsavedpost.FieldID, selector),\n\t\t\tsqlgraph.To(unsavedpostimage.Table, unsavedpostimage.FieldID),\n\t\t\tsqlgraph.Edge(sqlgraph.O2M, false, unsavedpost.ImagesTable, unsavedpost.ImagesColumn),\n\t\t)\n\t\tfromU = sqlgraph.SetNeighbors(upq.driver.Dialect(), step)\n\t\treturn fromU, nil\n\t}\n\treturn query\n}", "func (c *UnsavedPostClient) QueryAttachments(up *UnsavedPost) *UnsavedPostAttachmentQuery {\n\tquery := &UnsavedPostAttachmentQuery{config: c.config}\n\tquery.path = func(ctx context.Context) (fromV *sql.Selector, _ error) {\n\t\tid := up.ID\n\t\tstep := sqlgraph.NewStep(\n\t\t\tsqlgraph.From(unsavedpost.Table, unsavedpost.FieldID, id),\n\t\t\tsqlgraph.To(unsavedpostattachment.Table, unsavedpostattachment.FieldID),\n\t\t\tsqlgraph.Edge(sqlgraph.O2M, false, unsavedpost.AttachmentsTable, unsavedpost.AttachmentsColumn),\n\t\t)\n\t\tfromV = sqlgraph.Neighbors(up.driver.Dialect(), step)\n\t\treturn fromV, nil\n\t}\n\treturn query\n}", "func (upq *UnsavedPostQuery) QueryAttachments() *UnsavedPostAttachmentQuery {\n\tquery := &UnsavedPostAttachmentQuery{config: upq.config}\n\tquery.path = func(ctx context.Context) (fromU *sql.Selector, err error) {\n\t\tif err := upq.prepareQuery(ctx); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tselector := upq.sqlQuery(ctx)\n\t\tif err := selector.Err(); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tstep := sqlgraph.NewStep(\n\t\t\tsqlgraph.From(unsavedpost.Table, unsavedpost.FieldID, selector),\n\t\t\tsqlgraph.To(unsavedpostattachment.Table, unsavedpostattachment.FieldID),\n\t\t\tsqlgraph.Edge(sqlgraph.O2M, false, unsavedpost.AttachmentsTable, unsavedpost.AttachmentsColumn),\n\t\t)\n\t\tfromU = sqlgraph.SetNeighbors(upq.driver.Dialect(), step)\n\t\treturn fromU, nil\n\t}\n\treturn query\n}", "func (m *IGApiManager) GetSavedPosts() (items []IGItem, err error) {\n\tb, err := getHTTPResponse(urlSaved, m.dsUserId, m.sessionid, m.csrftoken)\n\tif err != nil {\n\t\treturn\n\t}\n\n\tspp := savedPostsResp{}\n\terr = json.Unmarshal(b, &spp)\n\tif err != nil {\n\t\treturn\n\t}\n\tfor _, item := range spp.Items {\n\t\titems = append(items, item.Item)\n\t}\n\n\tfor spp.MoreAvailable {\n\t\turl := urlSaved + \"?max_id=\" + spp.NextMaxId\n\t\tb, err = getHTTPResponse(url, m.dsUserId, m.sessionid, m.csrftoken)\n\t\tif err != nil {\n\t\t\treturn\n\t\t}\n\t\tspp = savedPostsResp{}\n\t\terr = json.Unmarshal(b, &spp)\n\t\tif err != nil {\n\t\t\treturn\n\t\t}\n\t\tfor _, item := range spp.Items {\n\t\t\titems = append(items, item.Item)\n\t\t}\n\t\tlog.Println(\"fetched\", len(items), \"items\")\n\t\t// sleep 500ms to prevent http 429\n\t\ttime.Sleep(500 * time.Millisecond)\n\t}\n\n\treturn\n}", "func (b *blogsQueryBuilder) RemovePosts() (int64, error) {\n\tif b.err != nil {\n\t\treturn 0, b.err\n\t}\n\trelation, err := NRN_Blogs.Model.RelationByIndex(3)\n\tif err != nil {\n\t\treturn 0, errors.Wrapf(mapping.ErrInternal, \"getting 'Posts' relation by index for model 'Blog' failed: %v\", err)\n\t}\n\treturn b.builder.RemoveRelations(relation)\n}", "func (upq *UnsavedPostQuery) Where(ps ...predicate.UnsavedPost) *UnsavedPostQuery {\n\tupq.predicates = append(upq.predicates, ps...)\n\treturn upq\n}", "func (c *UnsavedPostClient) QueryImages(up *UnsavedPost) *UnsavedPostImageQuery {\n\tquery := &UnsavedPostImageQuery{config: c.config}\n\tquery.path = func(ctx context.Context) (fromV *sql.Selector, _ error) {\n\t\tid := up.ID\n\t\tstep := sqlgraph.NewStep(\n\t\t\tsqlgraph.From(unsavedpost.Table, unsavedpost.FieldID, id),\n\t\t\tsqlgraph.To(unsavedpostimage.Table, unsavedpostimage.FieldID),\n\t\t\tsqlgraph.Edge(sqlgraph.O2M, false, unsavedpost.ImagesTable, unsavedpost.ImagesColumn),\n\t\t)\n\t\tfromV = sqlgraph.Neighbors(up.driver.Dialect(), step)\n\t\treturn fromV, nil\n\t}\n\treturn query\n}", "func ReadPostsDraft() []models.PostsModel {\n\tdb, err := driver.Connect()\n\n\tif err != nil {\n\t\tfmt.Println(err.Error())\n\t\treturn nil\n\t}\n\n\tdefer db.Close()\n\n\tvar result []models.PostsModel\n\n\titems, err := db.Query(\"select id, title, content, category, status from posts where status='Draft'\")\n\tif err != nil {\n\t\tfmt.Println(err.Error())\n\t\treturn nil\n\t}\n\n\tfmt.Printf(\"%T\\n\", items)\n\n\tfor items.Next() {\n\t\tvar each = models.PostsModel{}\n\t\tvar err = items.Scan(&each.Id, &each.Title, &each.Content, &each.Category, &each.Status)\n\n\t\tif err != nil {\n\t\t\tfmt.Println(err.Error())\n\t\t\treturn nil\n\t\t}\n\n\t\tresult = append(result, each)\n\n\t}\n\n\tif err = items.Err(); err != nil {\n\t\tfmt.Println(err.Error())\n\t\treturn nil\n\t}\n\n\treturn result\n}", "func (c *CategoryClient) QueryPosts(ca *Category) *PostQuery {\n\tquery := &PostQuery{config: c.config}\n\tquery.path = func(ctx context.Context) (fromV *sql.Selector, _ error) {\n\t\tid := ca.ID\n\t\tstep := sqlgraph.NewStep(\n\t\t\tsqlgraph.From(category.Table, category.FieldID, id),\n\t\t\tsqlgraph.To(post.Table, post.FieldID),\n\t\t\tsqlgraph.Edge(sqlgraph.O2M, false, category.PostsTable, category.PostsColumn),\n\t\t)\n\t\tfromV = sqlgraph.Neighbors(ca.driver.Dialect(), step)\n\t\treturn fromV, nil\n\t}\n\treturn query\n}", "func (c *Category) QueryPosts() *PostQuery {\n\treturn (&CategoryClient{config: c.config}).QueryPosts(c)\n}", "func ReadPostsTrash() []models.PostsModel {\n\tdb, err := driver.Connect()\n\n\tif err != nil {\n\t\tfmt.Println(err.Error())\n\t\treturn nil\n\t}\n\n\tdefer db.Close()\n\n\tvar result []models.PostsModel\n\n\titems, err := db.Query(\"select id, title, content, category, status from posts where status='Trash'\")\n\tif err != nil {\n\t\tfmt.Println(err.Error())\n\t\treturn nil\n\t}\n\n\tfmt.Printf(\"%T\\n\", items)\n\n\tfor items.Next() {\n\t\tvar each = models.PostsModel{}\n\t\tvar err = items.Scan(&each.Id, &each.Title, &each.Content, &each.Category, &each.Status)\n\n\t\tif err != nil {\n\t\t\tfmt.Println(err.Error())\n\t\t\treturn nil\n\t\t}\n\n\t\tresult = append(result, each)\n\n\t}\n\n\tif err = items.Err(); err != nil {\n\t\tfmt.Println(err.Error())\n\t\treturn nil\n\t}\n\n\treturn result\n}", "func (p *_Posts) Query(db database.DB, models ...*Post) *postsQueryBuilder {\n\tvar queryModels []mapping.Model\n\tif len(models) > 0 {\n\t\tqueryModels = make([]mapping.Model, len(models))\n\t\tfor i, model := range models {\n\t\t\tqueryModels[i] = model\n\t\t}\n\t}\n\tbuilder := db.Query(p.Model, queryModels...)\n\treturn &postsQueryBuilder{builder: builder}\n}", "func (upq *UnsavedPostQuery) QueryAuthor() *AdminQuery {\n\tquery := &AdminQuery{config: upq.config}\n\tquery.path = func(ctx context.Context) (fromU *sql.Selector, err error) {\n\t\tif err := upq.prepareQuery(ctx); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tselector := upq.sqlQuery(ctx)\n\t\tif err := selector.Err(); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tstep := sqlgraph.NewStep(\n\t\t\tsqlgraph.From(unsavedpost.Table, unsavedpost.FieldID, selector),\n\t\t\tsqlgraph.To(admin.Table, admin.FieldID),\n\t\t\tsqlgraph.Edge(sqlgraph.M2O, true, unsavedpost.AuthorTable, unsavedpost.AuthorColumn),\n\t\t)\n\t\tfromU = sqlgraph.SetNeighbors(upq.driver.Dialect(), step)\n\t\treturn fromU, nil\n\t}\n\treturn query\n}", "func (c *UnsavedPostClient) QueryAuthor(up *UnsavedPost) *AdminQuery {\n\tquery := &AdminQuery{config: c.config}\n\tquery.path = func(ctx context.Context) (fromV *sql.Selector, _ error) {\n\t\tid := up.ID\n\t\tstep := sqlgraph.NewStep(\n\t\t\tsqlgraph.From(unsavedpost.Table, unsavedpost.FieldID, id),\n\t\t\tsqlgraph.To(admin.Table, admin.FieldID),\n\t\t\tsqlgraph.Edge(sqlgraph.M2O, true, unsavedpost.AuthorTable, unsavedpost.AuthorColumn),\n\t\t)\n\t\tfromV = sqlgraph.Neighbors(up.driver.Dialect(), step)\n\t\treturn fromV, nil\n\t}\n\treturn query\n}", "func GetReadyToSendPosts(app *state.AppState) ([]Post, error) {\n\tsession := app.MgoSession.Clone()\n\tdefer session.Close()\n\tvar posts []Post\n\tquery := bson.M{\"isSent\": false, \"sentDate\": bson.M{\"$lt\": Now()}}\n\terr := session.DB(dbName).C(\"posts\").Find(query).All(&posts)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn posts, nil\n}", "func (u *User)GetPosts()(e error){\n\trows,e := db.Query(\"select * from posts where user_id = ? order by date desc \",u.Id)\n\tif e != nil {\n\t\treturn\n\t}\n\tfor rows.Next() {\n\t\tc := &Post{}\n\t\trows.Scan(&c.Id,&c.Title,&c.Topic,&c.Content,&c.Date,&c.CommunityId,&c.UserId)\n\t\tu.posts = append(u.posts,c)\n\t}\n\treturn\n}", "func UnpublishPost(shorturl string) (types.Post, error) {\n\tdb := database.GetMySQLInstance()\n\tdefer db.Close()\n\tvar post types.Post\n\terr := db.Where(\"shorturl LIKE ?\", shorturl).First(&post).Error\n\tif err != nil && err == gorm.ErrRecordNotFound {\n\t\treturn post, errors.New(\"post not found\")\n\t}\n\n\terr = db.Model(&post).Updates(map[string]interface{}{\"published\": false}).Error\n\tif err != nil {\n\t\treturn post, err\n\t}\n\tpost.Published = false\n\treturn post, nil\n}", "func (o *Post) PostHistories(mods ...qm.QueryMod) postHistoryQuery {\n\tvar queryMods []qm.QueryMod\n\tif len(mods) != 0 {\n\t\tqueryMods = append(queryMods, mods...)\n\t}\n\n\tqueryMods = append(queryMods,\n\t\tqm.Where(\"\\\"post_histories\\\".\\\"post_id\\\"=?\", o.ID),\n\t)\n\n\tquery := PostHistories(queryMods...)\n\tqueries.SetFrom(query.Query, \"\\\"post_histories\\\"\")\n\n\tif len(queries.GetSelect(query.Query)) == 0 {\n\t\tqueries.SetSelect(query.Query, []string{\"\\\"post_histories\\\".*\"})\n\t}\n\n\treturn query\n}", "func (c *UnsavedPostAttachmentClient) Query() *UnsavedPostAttachmentQuery {\n\treturn &UnsavedPostAttachmentQuery{\n\t\tconfig: c.config,\n\t}\n}", "func (c *PostAttachmentClient) QueryPost(pa *PostAttachment) *PostQuery {\n\tquery := &PostQuery{config: c.config}\n\tquery.path = func(ctx context.Context) (fromV *sql.Selector, _ error) {\n\t\tid := pa.ID\n\t\tstep := sqlgraph.NewStep(\n\t\t\tsqlgraph.From(postattachment.Table, postattachment.FieldID, id),\n\t\t\tsqlgraph.To(post.Table, post.FieldID),\n\t\t\tsqlgraph.Edge(sqlgraph.M2O, true, postattachment.PostTable, postattachment.PostColumn),\n\t\t)\n\t\tfromV = sqlgraph.Neighbors(pa.driver.Dialect(), step)\n\t\treturn fromV, nil\n\t}\n\treturn query\n}", "func (upvc *UnsavedPostVideoCreate) SetUnsavedPost(u *UnsavedPost) *UnsavedPostVideoCreate {\n\treturn upvc.SetUnsavedPostID(u.ID)\n}", "func (q postQuery) DeleteAll(ctx context.Context, exec boil.ContextExecutor) (int64, error) {\n\tif q.Query == nil {\n\t\treturn 0, errors.New(\"orm: no postQuery provided for delete all\")\n\t}\n\n\tqueries.SetDelete(q.Query)\n\n\tresult, err := q.Query.ExecContext(ctx, exec)\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"orm: unable to delete all from posts\")\n\t}\n\n\trowsAff, err := result.RowsAffected()\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"orm: failed to get rows affected by deleteall for posts\")\n\t}\n\n\treturn rowsAff, nil\n}", "func (upu *UnsavedPostUpdate) Where(ps ...predicate.UnsavedPost) *UnsavedPostUpdate {\n\tupu.mutation.predicates = append(upu.mutation.predicates, ps...)\n\treturn upu\n}", "func (upu *UnsavedPostUpdate) ClearImages() *UnsavedPostUpdate {\n\tupu.mutation.ClearImages()\n\treturn upu\n}", "func (db *Database) GetAllPosts() ([]models.Post, error) {\n\tvar posts []models.Post\n\terr := db.DB.Model(&posts).Select()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn posts, nil\n}", "func (u *App) List(c echo.Context, p *model.Pagination) ([]model.Post, string, string, int64, int64, error) {\n\tau := u.rbac.User(c)\n\tq, err := query.List(au, model.ResourcePost)\n\tif err != nil {\n\t\treturn nil, \"\", \"\", 0, 0, err\n\t}\n\n\tif c.QueryString() != \"\" {\n\t\tp.PostQuery = &model.Post{}\n\t\tparams := c.QueryParams()\n\n\t\tp.PostQuery.Status = params.Get(\"status\")\n\t\tp.SearchQuery = params.Get(\"s\")\n\t}\n\n\treturn u.udb.List(u.db, q, p)\n}", "func (r *Resolver) PostQueryResolver(params graphql.ResolveParams) (interface{}, error) {\n\t// Strip the id from arguments and assert type\n\tid, ok := params.Args[\"id\"].(int)\n\tif ok {\n\t\tposts, err := r.Repository.GetByID(id)\n\t\treturn posts, err\n\t}\n\n\t// We didn't get a valid ID as a param, so we return all the posts\n\treturn r.Repository.GetAllPosts()\n}", "func (c *UnsavedPostClient) Hooks() []Hook {\n\treturn c.hooks.UnsavedPost\n}", "func (upq *UnsavedPostQuery) AllX(ctx context.Context) []*UnsavedPost {\n\tnodes, err := upq.All(ctx)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn nodes\n}", "func (u *User)Posts() Posts{\n\treturn u.posts\n}", "func RecentAdminEvents(n int) db.Q {\n\tfilter := ResourceTypeKeyIs(ResourceTypeAdmin)\n\tfilter[ResourceIdKey] = \"\"\n\n\treturn db.Query(filter).Sort([]string{\"-\" + TimestampKey}).Limit(n)\n}", "func (b *_Blogs) ClearPostsRelation(ctx context.Context, db database.DB, models ...*Blog) (int64, error) {\n\trelation, err := b.Model.RelationByIndex(3)\n\tif err != nil {\n\t\treturn 0, err\n\t}\n\tmodelInterfaces := make([]mapping.Model, len(models))\n\tfor i := range models {\n\t\tmodelInterfaces[i] = models[i]\n\t}\n\ts := query.NewScope(b.Model, modelInterfaces...)\n\trelationClearer, ok := db.(database.QueryRelationClearer)\n\tif !ok {\n\t\treturn 0, errors.WrapDetf(query.ErrInternal, \"DB doesn't implement QueryRelationAdder interface - %T\", db)\n\t}\n\treturn relationClearer.QueryClearRelations(ctx, s, relation)\n}", "func ListPost(c buffalo.Context) error {\n\n\tdb := c.Value(\"tx\").(*pop.Connection)\n\n\tposts := &models.Posts{}\n\n\tquery := db.PaginateFromParams(c.Params())\n\n\tif err := query.Order(\"created_at desc\").Eager().All(posts); err != nil {\n\n\t\terrorResponse := utils.NewErrorResponse(http.StatusInternalServerError, \"user\", \"There is a problem while loading the relationship user\")\n\t\treturn c.Render(http.StatusInternalServerError, r.JSON(errorResponse))\n\t}\n\n\tresponse := PostsResponse{\n\t\tCode: fmt.Sprintf(\"%d\", http.StatusOK),\n\t\tData: *posts,\n\t\tMeta: *query.Paginator,\n\t}\n\tc.Logger().Debug(c.Value(\"email\"))\n\treturn c.Render(http.StatusOK, r.JSON(response))\n}", "func (c *UnsavedPostImageClient) Query() *UnsavedPostImageQuery {\n\treturn &UnsavedPostImageQuery{\n\t\tconfig: c.config,\n\t}\n}", "func GetRecentPostMediaNoLogin(username string) (medias []IGMedia, err error) {\n\tui, err := GetUserInfoNoLogin(username)\n\tif err != nil {\n\t\treturn\n\t}\n\n\tfor _, node := range ui.EdgeOwnerToTimelineMedia.Edges {\n\t\tmedias = append(medias, node.Node)\n\t}\n\treturn\n}", "func (c *PostThumbnailClient) QueryPost(pt *PostThumbnail) *PostQuery {\n\tquery := &PostQuery{config: c.config}\n\tquery.path = func(ctx context.Context) (fromV *sql.Selector, _ error) {\n\t\tid := pt.ID\n\t\tstep := sqlgraph.NewStep(\n\t\t\tsqlgraph.From(postthumbnail.Table, postthumbnail.FieldID, id),\n\t\t\tsqlgraph.To(post.Table, post.FieldID),\n\t\t\tsqlgraph.Edge(sqlgraph.O2O, true, postthumbnail.PostTable, postthumbnail.PostColumn),\n\t\t)\n\t\tfromV = sqlgraph.Neighbors(pt.driver.Dialect(), step)\n\t\treturn fromV, nil\n\t}\n\treturn query\n}", "func (p *_Posts) Refresh(ctx context.Context, db database.DB, models ...*Post) error {\n\tvar queryModels []mapping.Model\n\tif len(models) == 0 {\n\t\treturn errors.Wrap(query.ErrNoModels, \"nothing to refresh\")\n\t}\n\tqueryModels = make([]mapping.Model, len(models))\n\tfor i, model := range models {\n\t\tqueryModels[i] = model\n\t}\n\treturn db.Refresh(ctx, p.Model, queryModels...)\n}", "func UnpublishBlogPost(ctx context.Context, id string) error {\n\tq := datastore.NewQuery(blogPostVersionKind).\n\t\tFilter(\"PostID=\", id).\n\t\tFilter(\"Published=\", true)\n\n\tvar posts []BlogPostVersion\n\tk, err := q.GetAll(ctx, &posts)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tfor i := range posts {\n\t\tposts[i].Published = false\n\t}\n\n\t_, err = datastore.PutMulti(ctx, k, posts)\n\treturn err\n}", "func (bl *postBusiness) GetAll() (*models.Posts, *apperror.AppError) {\n\treturn bl.service.GetAll()\n}", "func NewUnsavedPostClient(c config) *UnsavedPostClient {\n\treturn &UnsavedPostClient{config: c}\n}", "func (c *UnsavedPostThumbnailClient) Query() *UnsavedPostThumbnailQuery {\n\treturn &UnsavedPostThumbnailQuery{\n\t\tconfig: c.config,\n\t}\n}", "func (c *PostVideoClient) QueryPost(pv *PostVideo) *PostQuery {\n\tquery := &PostQuery{config: c.config}\n\tquery.path = func(ctx context.Context) (fromV *sql.Selector, _ error) {\n\t\tid := pv.ID\n\t\tstep := sqlgraph.NewStep(\n\t\t\tsqlgraph.From(postvideo.Table, postvideo.FieldID, id),\n\t\t\tsqlgraph.To(post.Table, post.FieldID),\n\t\t\tsqlgraph.Edge(sqlgraph.M2O, true, postvideo.PostTable, postvideo.PostColumn),\n\t\t)\n\t\tfromV = sqlgraph.Neighbors(pv.driver.Dialect(), step)\n\t\treturn fromV, nil\n\t}\n\treturn query\n}", "func (u *MockUserRecord) NumPosts() int { return 0 }", "func (o *Post) PostReads(mods ...qm.QueryMod) postReadQuery {\n\tvar queryMods []qm.QueryMod\n\tif len(mods) != 0 {\n\t\tqueryMods = append(queryMods, mods...)\n\t}\n\n\tqueryMods = append(queryMods,\n\t\tqm.Where(\"\\\"post_reads\\\".\\\"post_id\\\"=?\", o.ID),\n\t)\n\n\tquery := PostReads(queryMods...)\n\tqueries.SetFrom(query.Query, \"\\\"post_reads\\\"\")\n\n\tif len(queries.GetSelect(query.Query)) == 0 {\n\t\tqueries.SetSelect(query.Query, []string{\"\\\"post_reads\\\".*\"})\n\t}\n\n\treturn query\n}", "func GetAllPost(w http.ResponseWriter, r *http.Request) {\n\tpage := r.URL.Query()[\"page\"]\n\tuserID := r.URL.Query()[\"user\"]\n\n\tfilter := bson.M{}\n\tfilter[\"status\"] = bson.M{\n\t\t\"$ne\": poststatus.Deleted,\n\t}\n\n\tif len(userID) > 0 {\n\t\tuID, err := primitive.ObjectIDFromHex(userID[0])\n\t\tif err != nil {\n\t\t\tresponse.Error(w, http.StatusUnprocessableEntity, err.Error())\n\t\t\treturn\n\t\t}\n\t\tfilter[\"user_id\"] = uID\n\t}\n\n\tvar count int\n\n\tif len(page) > 0 {\n\t\tfmt.Println(\"STUFF\", len(page))\n\t\tnum, err := strconv.Atoi(page[0])\n\t\tif err != nil {\n\t\t\tresponse.Error(w, http.StatusUnprocessableEntity, err.Error())\n\t\t\treturn\n\t\t}\n\t\tcount = num\n\t} else {\n\t\tcount = 0\n\t}\n\n\tposts, err := GetAll(filter, count)\n\n\tif err != nil {\n\t\tresponse.Error(w, http.StatusUnprocessableEntity, err.Error())\n\t\treturn\n\t}\n\n\tif posts == nil {\n\t\tposts = []GetPostStruct{}\n\t}\n\n\tresponse.Success(w, r,\n\t\thttp.StatusOK,\n\t\tposts,\n\t)\n\treturn\n}", "func GetAdmin(offset int64, number int64) (total int64, comments []Admin, err error) {\n\tdefer errors.Wrapper(&err)\n\n\tcommentsDB := make([]AdminDB, 0)\n\n\tpipeline := []bson.M{\n\t\t{\n\t\t\t\"$set\": bson.M{\n\t\t\t\t\"link\": bson.M{\n\t\t\t\t\t\"$arrayElemAt\": []interface{}{\n\t\t\t\t\t\tbson.M{\"$split\": []string{\"$url\", \"/post/\"}}, 1,\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\t\"$lookup\": bson.M{\n\t\t\t\t\"from\": \"posts\",\n\t\t\t\t\"localField\": \"link\",\n\t\t\t\t\"foreignField\": \"url\",\n\t\t\t\t\"as\": \"post\",\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\t\"$lookup\": bson.M{\n\t\t\t\t\"from\": \"comments\",\n\t\t\t\t\"localField\": \"reply\",\n\t\t\t\t\"foreignField\": \"_id\",\n\t\t\t\t\"as\": \"reply_comment\",\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\t\"$set\": bson.M{\"reply_comment\": bson.M{\"$arrayElemAt\": []interface{}{\"$reply_comment\", 0}}},\n\t\t},\n\t\t{\n\t\t\t\"$set\": bson.M{\"post\": bson.M{\"$arrayElemAt\": []interface{}{\"$post\", 0}}},\n\t\t},\n\t\t{\n\t\t\t\"$set\": bson.M{\n\t\t\t\t\"title\": \"$post.title\",\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\t\"$project\": bson.M{\n\t\t\t\t\"post\": 0,\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\t\"$sort\": bson.M{\"time\": -1},\n\t\t},\n\t}\n\tif number > 0 {\n\t\tpipeline = append(pipeline, mongo.AggregateOffset(offset, number)...)\n\t}\n\ttotal, err = mongo.Aggregate(\n\t\tDatabaseName,\n\t\tCollectionName,\n\t\tpipeline,\n\t\tnil,\n\t\t&commentsDB,\n\t)\n\tif err != nil {\n\t\treturn\n\t}\n\n\tcomments = make([]Admin, len(commentsDB))\n\tfor idx, commentDB := range commentsDB {\n\t\tcomments[idx] = *commentDB.ToAdmin()\n\t}\n\treturn\n}", "func (p *_Posts) Delete(ctx context.Context, db database.DB, models ...*Post) (int64, error) {\n\tif len(models) == 0 {\n\t\treturn 0, errors.Wrap(query.ErrNoModels, \"nothing to insert\")\n\t}\n\tqueryModels := make([]mapping.Model, len(models))\n\tfor i, model := range models {\n\t\tqueryModels[i] = model\n\t}\n\treturn db.Delete(ctx, p.Model, queryModels...)\n}", "func AllPosts() ([]*PostMessage, error) {\n\trows, err := db.Query(\"SELECT * FROM posts\")\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer rows.Close()\n\n\tposts := make([]*PostMessage, 0)\n\tfor rows.Next() {\n\t\tpost := new(PostMessage)\n\t\terr := rows.Scan(&post.URL, &post.Text)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tposts = append(posts, post)\n\t}\n\tif err = rows.Err(); err != nil {\n\t\treturn nil, err\n\t}\n\treturn posts, nil\n}", "func (postL) LoadPostHistories(ctx context.Context, e boil.ContextExecutor, singular bool, maybePost interface{}, mods queries.Applicator) error {\n\tvar slice []*Post\n\tvar object *Post\n\n\tif singular {\n\t\tobject = maybePost.(*Post)\n\t} else {\n\t\tslice = *maybePost.(*[]*Post)\n\t}\n\n\targs := make([]interface{}, 0, 1)\n\tif singular {\n\t\tif object.R == nil {\n\t\t\tobject.R = &postR{}\n\t\t}\n\t\targs = append(args, object.ID)\n\t} else {\n\tOuter:\n\t\tfor _, obj := range slice {\n\t\t\tif obj.R == nil {\n\t\t\t\tobj.R = &postR{}\n\t\t\t}\n\n\t\t\tfor _, a := range args {\n\t\t\t\tif a == obj.ID {\n\t\t\t\t\tcontinue Outer\n\t\t\t\t}\n\t\t\t}\n\n\t\t\targs = append(args, obj.ID)\n\t\t}\n\t}\n\n\tquery := NewQuery(qm.From(`post_histories`), qm.WhereIn(`post_id in ?`, args...))\n\tif mods != nil {\n\t\tmods.Apply(query)\n\t}\n\n\tresults, err := query.QueryContext(ctx, e)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"failed to eager load post_histories\")\n\t}\n\n\tvar resultSlice []*PostHistory\n\tif err = queries.Bind(results, &resultSlice); err != nil {\n\t\treturn errors.Wrap(err, \"failed to bind eager loaded slice post_histories\")\n\t}\n\n\tif err = results.Close(); err != nil {\n\t\treturn errors.Wrap(err, \"failed to close results in eager load on post_histories\")\n\t}\n\tif err = results.Err(); err != nil {\n\t\treturn errors.Wrap(err, \"error occurred during iteration of eager loaded relations for post_histories\")\n\t}\n\n\tif len(postHistoryAfterSelectHooks) != 0 {\n\t\tfor _, obj := range resultSlice {\n\t\t\tif err := obj.doAfterSelectHooks(ctx, e); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\tif singular {\n\t\tobject.R.PostHistories = resultSlice\n\t\tfor _, foreign := range resultSlice {\n\t\t\tif foreign.R == nil {\n\t\t\t\tforeign.R = &postHistoryR{}\n\t\t\t}\n\t\t\tforeign.R.Post = object\n\t\t}\n\t\treturn nil\n\t}\n\n\tfor _, foreign := range resultSlice {\n\t\tfor _, local := range slice {\n\t\t\tif local.ID == foreign.PostID {\n\t\t\t\tlocal.R.PostHistories = append(local.R.PostHistories, foreign)\n\t\t\t\tif foreign.R == nil {\n\t\t\t\t\tforeign.R = &postHistoryR{}\n\t\t\t\t}\n\t\t\t\tforeign.R.Post = local\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t}\n\n\treturn nil\n}", "func (r *queryResolver) Posts(ctx context.Context, after *entgql.Cursor[int], first *int, before *entgql.Cursor[int], last *int, orderBy *ent.PostOrder, where *ent.PostWhereInput) (*ent.PostConnection, error) {\n\tconn, err := ent.FromContext(ctx).Post.Query().Paginate(\n\t\tctx, after, first, before, last,\n\t\tent.WithPostOrder(orderBy),\n\t\tent.WithPostFilter(where.Filter),\n\t)\n\n\tif err == nil && conn.TotalCount == 1 {\n\t\tpost := conn.Edges[0].Node\n\n\t\tif post.ContentHTML == \"\" {\n\t\t\treturn conn, nil\n\t\t}\n\n\t\tgo database.PostViewCounter(ctx, post)\n\t}\n\n\treturn conn, err\n}", "func AllPosts() ([]Post, error) {\n\tconfig.Session.Refresh()\n\tcurrentSession := config.Session.Copy()\n\tdefer currentSession.Close()\n\n\tposts := make([]Post, 0)\n\tif err := config.Posts.Find(bson.M{}).All(&posts); err != nil {\n\t\treturn nil, errors.Wrap(err, \"find all posts\")\n\t}\n\n\treverse(posts)\n\n\treturn posts, nil\n}", "func (h *userHandler) ListPost(w http.ResponseWriter, r *http.Request) {\r\n\th.store.RLock()\r\n\tposts := make([]post, 0, len(h.store.m))\r\n\tfor _, v := range h.store.m {\r\n\t\tposts = append(users, v)\r\n\t}\r\n\th.store.RUnlock()\r\n\tjsonBytes, err := json.Marshal(posts)\r\n\tif err != nil {\r\n\t\tinternalServerError(w, r)\r\n\t\treturn\r\n\t}\r\n\tw.WriteHeader(http.StatusOK)\r\n\tw.Write(jsonBytes)\r\n}", "func (c *PostImageClient) QueryPost(pi *PostImage) *PostQuery {\n\tquery := &PostQuery{config: c.config}\n\tquery.path = func(ctx context.Context) (fromV *sql.Selector, _ error) {\n\t\tid := pi.ID\n\t\tstep := sqlgraph.NewStep(\n\t\t\tsqlgraph.From(postimage.Table, postimage.FieldID, id),\n\t\t\tsqlgraph.To(post.Table, post.FieldID),\n\t\t\tsqlgraph.Edge(sqlgraph.M2O, true, postimage.PostTable, postimage.PostColumn),\n\t\t)\n\t\tfromV = sqlgraph.Neighbors(pi.driver.Dialect(), step)\n\t\treturn fromV, nil\n\t}\n\treturn query\n}", "func RecentAdminEvents(n int) db.Q {\n\treturn db.Query(bson.M{\n\t\tDataKey + \".\" + ResourceTypeKey: ResourceTypeAdmin,\n\t\tResourceIdKey: \"\",\n\t}).Sort([]string{\"-\" + TimestampKey}).Limit(n)\n}", "func (upq *UnsavedPostQuery) IDs(ctx context.Context) ([]int, error) {\n\tvar ids []int\n\tif err := upq.Select(unsavedpost.FieldID).Scan(ctx, &ids); err != nil {\n\t\treturn nil, err\n\t}\n\treturn ids, nil\n}", "func (upu *UnsavedPostUpdate) ClearAttachments() *UnsavedPostUpdate {\n\tupu.mutation.ClearAttachments()\n\treturn upu\n}", "func (upq *UnsavedPostQuery) WithAuthor(opts ...func(*AdminQuery)) *UnsavedPostQuery {\n\tquery := &AdminQuery{config: upq.config}\n\tfor _, opt := range opts {\n\t\topt(query)\n\t}\n\tupq.withAuthor = query\n\treturn upq\n}", "func (bav *UtxoView) GetAllPosts() (_corePosts []*PostEntry, _commentsByPostHash map[BlockHash][]*PostEntry, _err error) {\n\t// Start by fetching all the posts we have in the db.\n\t//\n\t// TODO(performance): This currently fetches all posts. We should implement\n\t// some kind of pagination instead though.\n\t_, _, dbPostEntries, err := DBGetAllPostsByTstamp(bav.Handle, true /*fetchEntries*/)\n\tif err != nil {\n\t\treturn nil, nil, errors.Wrapf(err, \"GetAllPosts: Problem fetching PostEntry's from db: \")\n\t}\n\n\t// Iterate through the entries found in the db and force the view to load them.\n\t// This fills in any gaps in the view so that, after this, the view should contain\n\t// the union of what it had before plus what was in the db.\n\tfor _, dbPostEntry := range dbPostEntries {\n\t\tbav.GetPostEntryForPostHash(dbPostEntry.PostHash)\n\t}\n\n\t// Do one more pass to load all the comments from the DB.\n\tfor _, postEntry := range bav.PostHashToPostEntry {\n\t\t// Ignore deleted or rolled-back posts.\n\t\tif postEntry.isDeleted {\n\t\t\tcontinue\n\t\t}\n\n\t\t// If we have a post in the view and if that post is not a comment\n\t\t// then fetch its attached comments from the db. We need to do this\n\t\t// because the tstamp index above only fetches \"core\" posts not\n\t\t// comments.\n\n\t\tif len(postEntry.ParentStakeID) == 0 {\n\t\t\t_, dbCommentHashes, _, err := DBGetCommentPostHashesForParentStakeID(\n\t\t\t\tbav.Handle, postEntry.ParentStakeID, false /*fetchEntries*/)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, nil, errors.Wrapf(err, \"GetAllPosts: Problem fetching comment PostEntry's from db: \")\n\t\t\t}\n\t\t\tfor _, commentHash := range dbCommentHashes {\n\t\t\t\tbav.GetPostEntryForPostHash(commentHash)\n\t\t\t}\n\t\t}\n\t}\n\n\tallCorePosts := []*PostEntry{}\n\tcommentsByPostHash := make(map[BlockHash][]*PostEntry)\n\tfor _, postEntry := range bav.PostHashToPostEntry {\n\t\t// Ignore deleted or rolled-back posts.\n\t\tif postEntry.isDeleted {\n\t\t\tcontinue\n\t\t}\n\n\t\t// Every post is either a core post or a comment. If it has a stake ID\n\t\t// its a comment, and if it doesn't then it's a core post.\n\t\tif len(postEntry.ParentStakeID) == 0 {\n\t\t\tallCorePosts = append(allCorePosts, postEntry)\n\t\t} else {\n\t\t\t// Add the comment to our map.\n\t\t\tcommentsForPost := commentsByPostHash[*StakeIDToHash(postEntry.ParentStakeID)]\n\t\t\tcommentsForPost = append(commentsForPost, postEntry)\n\t\t\tcommentsByPostHash[*StakeIDToHash(postEntry.ParentStakeID)] = commentsForPost\n\t\t}\n\t}\n\t// Sort all the comment lists as well. Here we put the latest comment at the\n\t// end.\n\tfor _, commentList := range commentsByPostHash {\n\t\tsort.Slice(commentList, func(ii, jj int) bool {\n\t\t\treturn commentList[ii].TimestampNanos < commentList[jj].TimestampNanos\n\t\t})\n\t}\n\n\treturn allCorePosts, commentsByPostHash, nil\n}", "func (s *service) PostList(params map[string][]string) ([]*model.Post, int64, error) {\n\tfilters, options, err := s.BuildFiltersAndOptions(params)\n\tif err != nil {\n\t\treturn nil, -1, err\n\t}\n\n\titems, totalItems, err := s.db.PostList(filters, options)\n\tif err != nil {\n\t\treturn nil, -1, err\n\t}\n\n\treturn items, totalItems, nil\n}", "func (k Keeper) Posts(goCtx context.Context, req *types.QueryPostsRequest) (*types.QueryPostsResponse, error) {\n\tvar posts []types.Post\n\tctx := sdk.UnwrapSDKContext(goCtx)\n\n\tif !subspacestypes.IsValidSubspace(req.SubspaceId) {\n\t\treturn nil, sdkerrors.Wrapf(subspacestypes.ErrInvalidSubspaceID, req.SubspaceId)\n\t}\n\n\tstore := ctx.KVStore(k.storeKey)\n\tpostsStore := prefix.NewStore(store, types.SubspacePostsPrefix(req.SubspaceId))\n\n\tpageRes, err := query.Paginate(postsStore, req.Pagination, func(key []byte, value []byte) error {\n\t\tstore := ctx.KVStore(k.storeKey)\n\t\tbz := store.Get(types.PostStoreKey(string(value)))\n\n\t\tvar post types.Post\n\t\tif err := k.cdc.UnmarshalBinaryBare(bz, &post); err != nil {\n\t\t\treturn status.Error(codes.Internal, err.Error())\n\t\t}\n\n\t\tposts = append(posts, post)\n\t\treturn nil\n\t})\n\n\tif err != nil {\n\t\treturn nil, status.Error(codes.Internal, err.Error())\n\t}\n\n\treturn &types.QueryPostsResponse{Posts: posts, Pagination: pageRes}, nil\n}", "func (pc PostsController) deleteposts(response http.ResponseWriter, request *http.Request, parameters httprouter.Params) {\n\tresponse.Header().Add(\"content-type\", \"application/json\")\n\n\tctx, _ := context.WithTimeout(context.Background(), 10*time.Second)\n\tpc.postscollection.Drop(ctx)\n}", "func (o *Post) PostUploadFiles(mods ...qm.QueryMod) postUploadFileQuery {\n\tvar queryMods []qm.QueryMod\n\tif len(mods) != 0 {\n\t\tqueryMods = append(queryMods, mods...)\n\t}\n\n\tqueryMods = append(queryMods,\n\t\tqm.Where(\"\\\"post_upload_files\\\".\\\"post_id\\\"=?\", o.ID),\n\t)\n\n\tquery := PostUploadFiles(queryMods...)\n\tqueries.SetFrom(query.Query, \"\\\"post_upload_files\\\"\")\n\n\tif len(queries.GetSelect(query.Query)) == 0 {\n\t\tqueries.SetSelect(query.Query, []string{\"\\\"post_upload_files\\\".*\"})\n\t}\n\n\treturn query\n}", "func (c *UnsavedPostClient) Delete() *UnsavedPostDelete {\n\tmutation := newUnsavedPostMutation(c.config, OpDelete)\n\treturn &UnsavedPostDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (upvc *UnsavedPostVideoCreate) SetUnsavedPostID(id int) *UnsavedPostVideoCreate {\n\tupvc.mutation.SetUnsavedPostID(id)\n\treturn upvc\n}", "func (s *MockStore) GetRecentPosts(limit int) (ps []Post, err error) {\n\tfor i := s.serial - 1; i > 0; i-- {\n\t\tif len(ps) == limit {\n\t\t\tbreak\n\t\t}\n\t\tp, ok := s.mem[i]\n\t\tif ok {\n\t\t\tps = append(ps, p)\n\t\t}\n\t}\n\treturn ps, err\n}", "func (p *postsQueryBuilder) Refresh() error {\n\tif p.err != nil {\n\t\treturn p.err\n\t}\n\treturn p.builder.Refresh()\n}", "func (m *IGApiManager) GetRecentPostMedia(username string) (medias []IGMedia, err error) {\n\tui, err := m.GetUserInfo(username)\n\tif err != nil {\n\t\treturn\n\t}\n\n\tfor _, node := range ui.EdgeOwnerToTimelineMedia.Edges {\n\t\tmedias = append(medias, node.Node)\n\t}\n\treturn\n}", "func (s *ServerState) getPosts(c *gin.Context) {\n\tquery := `select u.name, u.username , p.description, p.timestamp, p.total_campaign_snapshot, co.name, co.cost, sc.name\n\tfrom ht.post p, ht.campaign ca, ht.course co, ht.organisation sc, ht.user u\n\twhere p.campaign_id = ca.id AND ca.course_id = co.id AND co.organisation_id = sc.id AND ca.user_id = u.id;`\n\n\t//curl --header \"Content-Type: application/json\" --request GET http://localhost:8080/posts/\n\n\tvar posts []Post\n\n\terr := s.DB.Select(&posts, query)\n\tif err != nil {\n\t\tc.JSON(500, gin.H{\"status\": err})\n\t\treturn\n\t}\n\tfmt.Println(posts)\n\n\tc.JSON(http.StatusOK, gin.H{\"status\": posts})\n}", "func Unseed() {\n\tseedUser := models.User{}\n\tseedUserRoles := []models.UserRole{}\n\tdb.DB.Model(&models.User{}).Find(&seedUser, \"username = ?\", \"admin\")\n\tdb.DB.Model(&seedUser).Related(&seedUserRoles)\n\n\tfor _, v := range seedUserRoles {\n\t\tdb.DB.Unscoped().Delete(models.RolePermission{}, \"role_id = ?\", v.RoleID)\n\t\tdb.DB.Unscoped().Delete(v)\n\t}\n\tdb.DB.Unscoped().Delete(models.Permission{}, \"value = ?\", \"all\")\n\tdb.DB.Unscoped().Delete(models.Role{}, \"name = ?\", \"Admin\")\n\tdb.DB.Unscoped().Delete(models.Client{}, \"key = ?\", \"clientkey\")\n\tdb.DB.Unscoped().Delete(models.User{}, \"username = ?\", \"admin\")\n}", "func AllPosts(db *gorm.DB) ([]model.PostOutput, string) {\n\n\tvar posts []model.Post\n\terr := db.Preload(\"Author\").Preload(\"Comments\").Preload(\"Comments.Author\").Preload(\"Likes\").Preload(\"Likes.Author\").Find(&posts).Error\n\tuser := true\n\tcomment := 1\n\tresult := postsToPostOutput(posts, user, comment)\n\n\tif err == nil {\n\t\treturn result, \"\"\n\t}\n\treturn result, err.Error()\n}", "func (p *PostsController) GetPosts(limit int, cursor string, userId int) ([]models.Post, bool) {\n\tvar posts []models.Post\n\tif limit > 50 {\n\t\tlimit = 50\n\t}\n\tlimit++\n\n\tif cursor != \"\" {\n\t\tp.db.Raw(`\n\t\t\tSELECT p.*,\n\t\t\t(SELECT \"value\" from \"likes\" \n\t\t\tWHERE \"user_id\" = ? and \"post_id\" = p.id) as \"StateValue\",\n\t\t\t(SELECT username FROM \"profiles\"\n\t\t\tWHERE user_id = p.user_id) as \"Creator\"\n\t\t\tFROM posts p\n\t\t\tWHERE p.created_at < ?\n\t\t\tORDER BY p.created_at DESC\n\t\t\tLIMIT ?\n\t\t`, userId, cursor, limit).Find(&posts)\n\t} else {\n\t\tp.db.Raw(`\n\t\t\tSELECT p.*,\n\t\t\t( SELECT \"value\" from \"likes\" \n\t\t\tWHERE \"user_id\" = ? and \"post_id\" = p.id) as \"StateValue\",\n\t\t\t(SELECT \"username\" FROM \"profiles\"\n\t\t\tWHERE user_id = p.user_id) as \"Creator\"\n\t\t\tFROM posts p\n\t\t\tORDER BY p.created_at DESC\n\t\t\tLIMIT ?\n\t\t`, userId, limit).Find(&posts)\n\t}\n\tif len(posts) == 0 {\n\t\treturn nil, false\n\t}\n\tif len(posts) == limit {\n\t\treturn posts[0 : limit-1], true\n\t}\n\n\treturn posts, false\n}", "func (s *MockStore) DelPost(id int) error {\n\t_, err := s.GetPost(id)\n\tdelete(s.mem, id)\n\n\treturn err\n}", "func posts(w http.ResponseWriter, r *http.Request, _ httprouter.Params) {\n\tdb, err := db()\n\tif err != nil {\n\t\tlog.Println(\"Database was not properly opened\")\n\t\tsendErr(w, err, \"Database was not properly opened\", http.StatusInternalServerError)\n\t\treturn\n\t}\n\n\trows, err := db.Query(`\nSELECT p.id, p.name, p.content, p.permalink, p.visible, p.created_at, IFNULL(likes.likes, 0), p.cover\nFROM post p LEFT OUTER JOIN (SELECT post_id, COUNT(ip) AS likes\n FROM liker\n GROUP BY post_id) likes ON p.id = likes.post_id\nORDER BY created_at;\n\t`)\n\tif err != nil {\n\t\tlog.Println(\"Error in statement\")\n\t\tsendErr(w, err, \"Error in query blog\", http.StatusInternalServerError)\n\t\treturn\n\t}\n\n\tvar posts []Post\n\tfor rows.Next() {\n\t\tvar post Post\n\t\t// getting a post\n\t\tvar coverID sql.NullInt64\n\t\terr = rows.Scan(&post.ID, &post.Name, &post.Content, &post.Permalink,\n\t\t\t&post.Visible, &post.CreatedAt, &post.Likes, &coverID)\n\t\tif err != nil {\n\t\t\tlog.Println(\"Error while scanning at home handler\")\n\t\t\tsendErr(w, err, \"Error while scanning blog\", http.StatusInternalServerError)\n\t\t\treturn\n\t\t}\n\t\t// Adding a cover if neded\n\t\tif coverID.Valid {\n\t\t\trow := db.QueryRow(`\nSELECT id, url\nFROM image\nWHERE id = ?\n`, coverID)\n\t\t\tvar image Image\n\t\t\terr := row.Scan(&image.ID, &image.Url)\n\t\t\tif err != nil {\n\t\t\t\tsendErr(w, err, \"Error while trying to get an image for a post\", http.StatusInternalServerError)\n\t\t\t\treturn\n\t\t\t}\n\t\t\tpost.Cover = image\n\t\t}\n\n\t\t// Adding tags\n\t\ttagRows, err := db.Query(`\nSELECT t.id, t.name \nFROM post_tag pt INNER JOIN tag t ON pt.tag_id = t.id\nWHERE pt.post_id = ?;\n\t\t`, post.ID)\n\t\tif err != nil {\n\t\t\tlog.Println(\"Error while scanning at home handler\")\n\t\t\tsendErr(w, err, \"Error while scanning blog\", http.StatusInternalServerError)\n\t\t\treturn\n\t\t}\n\t\tvar tagsIDs []string\n\t\tvar tags []Tag\n\t\tfor tagRows.Next() {\n\t\t\tvar tag Tag\n\t\t\ttagRows.Scan(&tag.ID, &tag.Name)\n\t\t\ttags = append(tags, tag)\n\t\t\ttagsIDs = append(tagsIDs, tag.ID)\n\t\t}\n\t\tpost.TagsIDs = tagsIDs\n\t\tpost.Tags = tags\n\t\t// Append to []Post\n\t\tposts = append(posts, post)\n\t}\n\tdb.Close()\n\tjsn, err := jsonapi.Marshal(posts)\n\tsend(w, jsn)\n}", "func WhereDraft(q *query.Query) *query.Query {\n\treturn q.Where(\"status = ?\", Draft)\n}", "func NewPosts() *DBPosts {\n\treturn &DBPosts{\n\t\tDB: DB,\n\t\tLg: Lg,\n\t\tError: Error{Lg: Lg},\n\t\tDBQueries: *NewDBQueries(),\n\t}\n}", "func (upu *UnsavedPostUpdate) Mutation() *UnsavedPostMutation {\n\treturn upu.mutation\n}", "func (p *Posts) GetAllPostList(isPage bool, onlyPublished bool, orderBy string) error {\n\tsession := postSession.Clone()\n\n\tvar err error\n\n\tsafeOrderBy := getSafeOrderByStmt(orderBy)\n\n\tif onlyPublished {\n\t\terr = session.DB(DBName).C(\"posts\").Find(bson.M{\"ispage\": isPage, \"ispublished\": true}).Sort(safeOrderBy).All(p)\n\t} else {\n\t\terr = session.DB(DBName).C(\"posts\").Find(bson.M{\"ispage\": isPage}).Sort(safeOrderBy).All(p)\n\t}\n\n\treturn err\n}", "func (k Keeper) GetPosts(ctx sdk.Context) []types.Post {\n\tvar posts []types.Post\n\tk.IteratePosts(ctx, func(_ int64, post types.Post) (stop bool) {\n\t\tposts = append(posts, post)\n\t\treturn false\n\t})\n\n\treturn posts\n}", "func (s *Site) Posts() []Page {\n\tfor _, c := range s.Collections {\n\t\tif c.Name == \"posts\" {\n\t\t\treturn c.Pages()\n\t\t}\n\t}\n\treturn nil\n}", "func (upq *UnsavedPostQuery) QueryThumbnail() *UnsavedPostThumbnailQuery {\n\tquery := &UnsavedPostThumbnailQuery{config: upq.config}\n\tquery.path = func(ctx context.Context) (fromU *sql.Selector, err error) {\n\t\tif err := upq.prepareQuery(ctx); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tselector := upq.sqlQuery(ctx)\n\t\tif err := selector.Err(); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tstep := sqlgraph.NewStep(\n\t\t\tsqlgraph.From(unsavedpost.Table, unsavedpost.FieldID, selector),\n\t\t\tsqlgraph.To(unsavedpostthumbnail.Table, unsavedpostthumbnail.FieldID),\n\t\t\tsqlgraph.Edge(sqlgraph.O2O, false, unsavedpost.ThumbnailTable, unsavedpost.ThumbnailColumn),\n\t\t)\n\t\tfromU = sqlgraph.SetNeighbors(upq.driver.Dialect(), step)\n\t\treturn fromU, nil\n\t}\n\treturn query\n}", "func GetPostsFromQuery(context appengine.Context, query *datastore.Query) (*[]Post, error) {\n\n\tvar posts []Post\n\tkeys, err := query.GetAll(context, &posts)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tfor i, key := range keys {\n\t\tposts[i].Id = key.IntID()\n\t}\n\treturn &posts, nil\n}" ]
[ "0.7493257", "0.7263583", "0.65827465", "0.64788586", "0.64571905", "0.62409276", "0.59348726", "0.5779742", "0.5701797", "0.5656285", "0.52574015", "0.5219839", "0.51315534", "0.50913966", "0.5049358", "0.5008051", "0.49826306", "0.49571186", "0.49247116", "0.48670572", "0.4825843", "0.4801177", "0.47937536", "0.47900024", "0.47884196", "0.47655103", "0.47482905", "0.47275564", "0.4722456", "0.47164175", "0.46456614", "0.46010774", "0.45866403", "0.45828357", "0.4536744", "0.45176804", "0.45175868", "0.45114264", "0.4509084", "0.45052817", "0.4502608", "0.44934487", "0.44570816", "0.44373125", "0.4433426", "0.44026116", "0.4398114", "0.43856508", "0.43837914", "0.43615443", "0.43520245", "0.4347665", "0.43407118", "0.4319845", "0.4308445", "0.43083268", "0.43013474", "0.4300882", "0.429814", "0.429292", "0.42731395", "0.425122", "0.42399326", "0.42296365", "0.42277637", "0.42134997", "0.42000234", "0.41800946", "0.41728562", "0.4170169", "0.416789", "0.41589886", "0.41548017", "0.41435438", "0.41315636", "0.41312963", "0.4120683", "0.4114637", "0.4099292", "0.4095503", "0.40938172", "0.40852544", "0.40808377", "0.40786645", "0.40768635", "0.4074834", "0.40724066", "0.4065", "0.40642035", "0.40611714", "0.40543228", "0.4053291", "0.40412992", "0.40411282", "0.4036786", "0.4036705", "0.40339", "0.40304494", "0.4020978", "0.40209368" ]
0.8034919
0
Hooks returns the client hooks.
func (c *AdminClient) Hooks() []Hook { return c.hooks.Admin }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (c *OperationClient) Hooks() []Hook {\n\treturn c.hooks.Operation\n}", "func (c *ToolClient) Hooks() []Hook {\n\treturn c.hooks.Tool\n}", "func (c *TagClient) Hooks() []Hook {\n\treturn c.hooks.Tag\n}", "func (c *ComplaintClient) Hooks() []Hook {\n\treturn c.hooks.Complaint\n}", "func (c *PostClient) Hooks() []Hook {\n\treturn c.hooks.Post\n}", "func (c *ClubapplicationClient) Hooks() []Hook {\n\treturn c.hooks.Clubapplication\n}", "func (c *ClinicClient) Hooks() []Hook {\n\treturn c.hooks.Clinic\n}", "func (c *EventClient) Hooks() []Hook {\n\treturn c.hooks.Event\n}", "func (c *BuildingClient) Hooks() []Hook {\n\treturn c.hooks.Building\n}", "func (c *OperativeClient) Hooks() []Hook {\n\treturn c.hooks.Operative\n}", "func (c *SituationClient) Hooks() []Hook {\n\treturn c.hooks.Situation\n}", "func (c *AppointmentClient) Hooks() []Hook {\n\treturn c.hooks.Appointment\n}", "func (c *RentalstatusClient) Hooks() []Hook {\n\treturn c.hooks.Rentalstatus\n}", "func (c *LeaseClient) Hooks() []Hook {\n\treturn c.hooks.Lease\n}", "func (c *ReturninvoiceClient) Hooks() []Hook {\n\treturn c.hooks.Returninvoice\n}", "func (c *ClubappStatusClient) Hooks() []Hook {\n\treturn c.hooks.ClubappStatus\n}", "func (c *ReviewClient) Hooks() []Hook {\n\treturn c.hooks.Review\n}", "func (c *EmployeeClient) Hooks() []Hook {\n\treturn c.hooks.Employee\n}", "func (c *EmployeeClient) Hooks() []Hook {\n\treturn c.hooks.Employee\n}", "func (c *EmployeeClient) Hooks() []Hook {\n\treturn c.hooks.Employee\n}", "func (c *WorkExperienceClient) Hooks() []Hook {\n\treturn c.hooks.WorkExperience\n}", "func (c *PartClient) Hooks() []Hook {\n\treturn c.hooks.Part\n}", "func (c *CleanernameClient) Hooks() []Hook {\n\treturn c.hooks.Cleanername\n}", "func (c *BeerClient) Hooks() []Hook {\n\treturn c.hooks.Beer\n}", "func (c *FoodmenuClient) Hooks() []Hook {\n\treturn c.hooks.Foodmenu\n}", "func (c *RepairinvoiceClient) Hooks() []Hook {\n\treturn c.hooks.Repairinvoice\n}", "func (c *StatusdClient) Hooks() []Hook {\n\treturn c.hooks.Statusd\n}", "func (c *EmptyClient) Hooks() []Hook {\n\treturn c.hooks.Empty\n}", "func (c *BillClient) Hooks() []Hook {\n\treturn c.hooks.Bill\n}", "func (c *BillClient) Hooks() []Hook {\n\treturn c.hooks.Bill\n}", "func (c *BillClient) Hooks() []Hook {\n\treturn c.hooks.Bill\n}", "func (c *CompanyClient) Hooks() []Hook {\n\treturn c.hooks.Company\n}", "func (c *CompanyClient) Hooks() []Hook {\n\treturn c.hooks.Company\n}", "func (c *IPClient) Hooks() []Hook {\n\treturn c.hooks.IP\n}", "func (c *VeterinarianClient) Hooks() []Hook {\n\treturn c.hooks.Veterinarian\n}", "func (c *MedicineClient) Hooks() []Hook {\n\treturn c.hooks.Medicine\n}", "func (c *PrescriptionClient) Hooks() []Hook {\n\treturn c.hooks.Prescription\n}", "func (c *TransactionClient) Hooks() []Hook {\n\treturn c.hooks.Transaction\n}", "func (c *CategoryClient) Hooks() []Hook {\n\treturn c.hooks.Category\n}", "func (c *KeyStoreClient) Hooks() []Hook {\n\treturn c.hooks.KeyStore\n}", "func (c *PetruleClient) Hooks() []Hook {\n\treturn c.hooks.Petrule\n}", "func (c *LevelOfDangerousClient) Hooks() []Hook {\n\treturn c.hooks.LevelOfDangerous\n}", "func (c *JobClient) Hooks() []Hook {\n\treturn c.hooks.Job\n}", "func (c *OrderClient) Hooks() []Hook {\n\treturn c.hooks.Order\n}", "func (c *PetClient) Hooks() []Hook {\n\treturn c.hooks.Pet\n}", "func (c *MealplanClient) Hooks() []Hook {\n\treturn c.hooks.Mealplan\n}", "func (c *DNSBLResponseClient) Hooks() []Hook {\n\treturn c.hooks.DNSBLResponse\n}", "func (c *RepairInvoiceClient) Hooks() []Hook {\n\treturn c.hooks.RepairInvoice\n}", "func (c *DoctorClient) Hooks() []Hook {\n\treturn c.hooks.Doctor\n}", "func (c *StatustClient) Hooks() []Hook {\n\treturn c.hooks.Statust\n}", "func (c *EatinghistoryClient) Hooks() []Hook {\n\treturn c.hooks.Eatinghistory\n}", "func (c *StaytypeClient) Hooks() []Hook {\n\treturn c.hooks.Staytype\n}", "func (c *CustomerClient) Hooks() []Hook {\n\treturn c.hooks.Customer\n}", "func (c *StatusRClient) Hooks() []Hook {\n\treturn c.hooks.StatusR\n}", "func (c *UserClient) Hooks() []Hook {\n\treturn c.hooks.User\n}", "func (c *UserClient) Hooks() []Hook {\n\treturn c.hooks.User\n}", "func (c *UserClient) Hooks() []Hook {\n\treturn c.hooks.User\n}", "func (c *UserClient) Hooks() []Hook {\n\treturn c.hooks.User\n}", "func (c *UserClient) Hooks() []Hook {\n\treturn c.hooks.User\n}", "func (c *UserClient) Hooks() []Hook {\n\treturn c.hooks.User\n}", "func (c *UserClient) Hooks() []Hook {\n\treturn c.hooks.User\n}", "func (c *UserClient) Hooks() []Hook {\n\treturn c.hooks.User\n}", "func (c *UserClient) Hooks() []Hook {\n\treturn c.hooks.User\n}", "func (c *UserClient) Hooks() []Hook {\n\treturn c.hooks.User\n}", "func (c *UserClient) Hooks() []Hook {\n\treturn c.hooks.User\n}", "func (c *UnitOfMedicineClient) Hooks() []Hook {\n\treturn c.hooks.UnitOfMedicine\n}", "func (c *YearClient) Hooks() []Hook {\n\treturn c.hooks.Year\n}", "func (c *ClubClient) Hooks() []Hook {\n\treturn c.hooks.Club\n}", "func (c *PaymentClient) Hooks() []Hook {\n\treturn c.hooks.Payment\n}", "func (c *PaymentClient) Hooks() []Hook {\n\treturn c.hooks.Payment\n}", "func (c *DentistClient) Hooks() []Hook {\n\treturn c.hooks.Dentist\n}", "func (c *BookingClient) Hooks() []Hook {\n\treturn c.hooks.Booking\n}", "func (c *DisciplineClient) Hooks() []Hook {\n\treturn c.hooks.Discipline\n}", "func (c *PlanetClient) Hooks() []Hook {\n\treturn c.hooks.Planet\n}", "func (c *OperationroomClient) Hooks() []Hook {\n\treturn c.hooks.Operationroom\n}", "func (c *LengthtimeClient) Hooks() []Hook {\n\treturn c.hooks.Lengthtime\n}", "func (c *DispenseMedicineClient) Hooks() []Hook {\n\treturn c.hooks.DispenseMedicine\n}", "func (c *PartorderClient) Hooks() []Hook {\n\treturn c.hooks.Partorder\n}", "func (c *PatientInfoClient) Hooks() []Hook {\n\treturn c.hooks.PatientInfo\n}", "func (c *SkillClient) Hooks() []Hook {\n\treturn c.hooks.Skill\n}", "func (c *PharmacistClient) Hooks() []Hook {\n\treturn c.hooks.Pharmacist\n}", "func (c *TitleClient) Hooks() []Hook {\n\treturn c.hooks.Title\n}", "func (c *DepositClient) Hooks() []Hook {\n\treturn c.hooks.Deposit\n}", "func (c *SessionClient) Hooks() []Hook {\n\treturn c.hooks.Session\n}", "func (c *PostImageClient) Hooks() []Hook {\n\treturn c.hooks.PostImage\n}", "func (c *DrugAllergyClient) Hooks() []Hook {\n\treturn c.hooks.DrugAllergy\n}", "func (c *TimerClient) Hooks() []Hook {\n\treturn c.hooks.Timer\n}", "func (c *PostAttachmentClient) Hooks() []Hook {\n\treturn c.hooks.PostAttachment\n}", "func (c *PhysicianClient) Hooks() []Hook {\n\treturn c.hooks.Physician\n}", "func (c *PhysicianClient) Hooks() []Hook {\n\treturn c.hooks.Physician\n}", "func (c *PatientClient) Hooks() []Hook {\n\treturn c.hooks.Patient\n}", "func (c *PatientClient) Hooks() []Hook {\n\treturn c.hooks.Patient\n}", "func (c *PatientClient) Hooks() []Hook {\n\treturn c.hooks.Patient\n}", "func (c *PostThumbnailClient) Hooks() []Hook {\n\treturn c.hooks.PostThumbnail\n}", "func (c *BedtypeClient) Hooks() []Hook {\n\treturn c.hooks.Bedtype\n}", "func (c *CoinInfoClient) Hooks() []Hook {\n\treturn c.hooks.CoinInfo\n}", "func (c *OperativerecordClient) Hooks() []Hook {\n\treturn c.hooks.Operativerecord\n}", "func (c *ActivitiesClient) Hooks() []Hook {\n\treturn c.hooks.Activities\n}", "func (c *AdminSessionClient) Hooks() []Hook {\n\treturn c.hooks.AdminSession\n}", "func (c *MedicineTypeClient) Hooks() []Hook {\n\treturn c.hooks.MedicineType\n}" ]
[ "0.80325735", "0.790398", "0.78864676", "0.78840053", "0.78618014", "0.78288174", "0.7817571", "0.7800003", "0.77909994", "0.77634746", "0.7746418", "0.77408934", "0.7737971", "0.77244073", "0.77163273", "0.771004", "0.76985544", "0.7696134", "0.7696134", "0.7696134", "0.76921564", "0.76725936", "0.76697093", "0.7666844", "0.76660186", "0.765927", "0.7627814", "0.7619907", "0.7617588", "0.7617588", "0.7617588", "0.7613897", "0.7613897", "0.76138216", "0.760849", "0.7607455", "0.76074445", "0.7601674", "0.75984216", "0.75958437", "0.75944996", "0.7589656", "0.75841326", "0.75812864", "0.7569302", "0.7560664", "0.75604796", "0.75519186", "0.75509745", "0.7532829", "0.7532022", "0.75310445", "0.7526489", "0.75222003", "0.75040776", "0.75040776", "0.75040776", "0.75040776", "0.75040776", "0.75040776", "0.75040776", "0.75040776", "0.75040776", "0.75040776", "0.75040776", "0.75038844", "0.750118", "0.74977213", "0.7493581", "0.7493581", "0.7492812", "0.7492088", "0.7490202", "0.7483538", "0.7482547", "0.74728894", "0.7463062", "0.74548906", "0.74490273", "0.7446456", "0.74431694", "0.74349844", "0.7420574", "0.7416939", "0.74114937", "0.74111134", "0.7409104", "0.7395227", "0.7395143", "0.7395143", "0.73937327", "0.73937327", "0.73937327", "0.73888427", "0.7388035", "0.73768663", "0.7369236", "0.7357418", "0.73540497", "0.7353824" ]
0.7585323
42
NewAdminSessionClient returns a client for the AdminSession from the given config.
func NewAdminSessionClient(c config) *AdminSessionClient { return &AdminSessionClient{config: c} }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func NewAdminClient(c config) *AdminClient {\n\treturn &AdminClient{config: c}\n}", "func NewAdminClient(conf *ConfigMap) (*AdminClient, error) {\n\n\terr := versionCheck()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\ta := &AdminClient{}\n\ta.handle = &handle{}\n\n\t// Convert ConfigMap to librdkafka conf_t\n\tcConf, err := conf.convert()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tcErrstr := (*C.char)(C.malloc(C.size_t(256)))\n\tdefer C.free(unsafe.Pointer(cErrstr))\n\n\tC.rd_kafka_conf_set_events(cConf, C.RD_KAFKA_EVENT_STATS|C.RD_KAFKA_EVENT_ERROR|C.RD_KAFKA_EVENT_OAUTHBEARER_TOKEN_REFRESH)\n\n\t// Create librdkafka producer instance. The Producer is somewhat cheaper than\n\t// the consumer, but any instance type can be used for Admin APIs.\n\ta.handle.rk = C.rd_kafka_new(C.RD_KAFKA_PRODUCER, cConf, cErrstr, 256)\n\tif a.handle.rk == nil {\n\t\treturn nil, newErrorFromCString(C.RD_KAFKA_RESP_ERR__INVALID_ARG, cErrstr)\n\t}\n\n\ta.isDerived = false\n\ta.handle.setup()\n\n\ta.isClosed = 0\n\n\treturn a, nil\n}", "func (m *MockedKafkaAdminClient) NewAdminClient(conf *kafka.ConfigMap) (*kafka.AdminClient, error) {\n\targs := m.Called(conf)\n\treturn args.Get(0).(*kafka.AdminClient), args.Error(1)\n}", "func NewAdminClient(ctx context.Context, project, instance string, opts ...option.ClientOption) (*AdminClient, error) {\n\to, err := btopt.DefaultClientOptions(adminAddr, AdminScope, clientUserAgent)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\to = append(o, opts...)\n\tconn, err := transport.DialGRPC(ctx, o...)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"dialing: %v\", err)\n\t}\n\treturn &AdminClient{\n\t\tconn: conn,\n\t\ttClient: btapb.NewBigtableTableAdminClient(conn),\n\t\tproject: project,\n\t\tinstance: instance,\n\t\tmd: metadata.Pairs(resourcePrefixHeader, fmt.Sprintf(\"projects/%s/instances/%s\", project, instance)),\n\t}, nil\n}", "func NewClient(cfg Config, l *logrus.Logger) (*Client, error) {\n\tctx := context.Background()\n\tkClient := gocloak.NewClient(cfg.Host)\n\tadmin, err := kClient.Login(ctx, adminClientID, cfg.AdminSecret, cfg.AdminRealm, cfg.AdminUser, cfg.AdminPassword)\n\tif err != nil {\n\t\tl.Errorf(\"NewClient\", err, \"failed to log admin user in\")\n\t\treturn nil, err\n\t}\n\tclients, err := kClient.GetClients(ctx, admin.AccessToken, cfg.ClientRealm, gocloak.GetClientsParams{ClientID: &cfg.ClientID})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif len(clients) == 0 {\n\t\treturn nil, ErrClientNotFound\n\t}\n\n\treturn &Client{\n\t\tcfg: cfg,\n\t\tctx: ctx,\n\t\tkc: kClient,\n\t\tac: &adminClient{\n\t\t\tadmin: admin,\n\t\t\taccessExpiry: time.Now().Add(time.Second * time.Duration(admin.ExpiresIn)),\n\t\t\trefreshExpiry: time.Now().Add(time.Second * time.Duration(admin.RefreshExpiresIn)),\n\t\t},\n\t\tclient: keycloakClient{\n\t\t\tid: *clients[0].ID,\n\t\t\tclientID: *clients[0].ClientID,\n\t\t},\n\t\trealm: cfg.ClientRealm,\n\t\tiss: cfg.Host + \"/auth/realms/\" + cfg.ClientRealm,\n\t\tl: l,\n\t}, nil\n}", "func GetAdminClient() (pb.AdminClient, error) {\n\tpeerClient, err := NewPeerClientFromEnv()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn peerClient.Admin()\n}", "func GetClient(config Config) (*client.Client, error) {\n\topts := []client.Option{\n\t\tclient.WithNamespace(config.GetNamespace()),\n\t\tclient.WithScope(config.GetScope()),\n\t}\n\tmember := config.GetMember()\n\thost := config.GetHost()\n\tif host != \"\" {\n\t\topts = append(opts, client.WithPeerHost(config.GetHost()))\n\t\topts = append(opts, client.WithPeerPort(config.GetPort()))\n\t\tfor _, s := range serviceRegistry.services {\n\t\t\tservice := func(service cluster.Service) func(peer.ID, *grpc.Server) {\n\t\t\t\treturn func(id peer.ID, server *grpc.Server) {\n\t\t\t\t\tservice(cluster.NodeID(id), server)\n\t\t\t\t}\n\t\t\t}(s)\n\t\t\topts = append(opts, client.WithPeerService(service))\n\t\t}\n\t}\n\tif member != \"\" {\n\t\topts = append(opts, client.WithMemberID(config.GetMember()))\n\t} else if host != \"\" {\n\t\topts = append(opts, client.WithMemberID(config.GetHost()))\n\t}\n\n\treturn client.New(config.GetController(), opts...)\n}", "func NewAdminClient(rslvr resolver.Interface, opts ...Option) (AdminClient, error) {\n\tc := &adminClient{\n\t\tr: rslvr,\n\t}\n\n\tfor _, o := range opts {\n\t\to(c)\n\t}\n\n\tif err := c.connect(\"\"); err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn c, nil\n}", "func NewClient(config *Config) (c *Client, err error) {\n\tc = &Client{Config: config, volume: 15}\n\n\t// Check if Matrix and Telegram aren't enabled at the same time.\n\tif config.Telegram != nil && config.Matrix != nil {\n\t\treturn nil, fmt.Errorf(\"both Telegram and Matrix may not be configured at the same time\")\n\t}\n\n\t// Telegram\n\tif config.Telegram != nil {\n\t\tc.Telegram, err = telegram.NewClient(config.Telegram.Token, config.Telegram.Target)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"connecting to Telegram: %w\", err)\n\t\t}\n\t\tgo c.Telegram.Start()\n\t}\n\n\t// Matrix\n\tif config.Matrix != nil {\n\t\tc.Matrix, err = matrix.NewClient(config.Matrix.Server, config.Matrix.User, config.Matrix.Token, config.Matrix.Room)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"connecting to Matrix: %w\", err)\n\t\t}\n\t}\n\n\t// Mumble\n\tc.Mumble, err = mumble.NewClient(config.Mumble.Server, config.Mumble.User)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"connecting to Mumble: %w\", err)\n\t}\n\n\treturn\n}", "func NewClient(config *Config) (c *Client, err error) {\n\tif config == nil {\n\t\treturn nil, errClientConfigNil\n\t}\n\n\tc = &Client{\n\t\trevocationTransport: http.DefaultTransport,\n\t}\n\n\tif c.transport, err = ghinstallation.NewAppsTransport(\n\t\thttp.DefaultTransport,\n\t\tint64(config.AppID),\n\t\t[]byte(config.PrvKey),\n\t); err != nil {\n\t\treturn nil, err\n\t}\n\n\tif c.url, err = url.ParseRequestURI(fmt.Sprintf(\n\t\t\"%s/app/installations/%v/access_tokens\",\n\t\tstrings.TrimSuffix(fmt.Sprint(config.BaseURL), \"/\"),\n\t\tconfig.InsID,\n\t)); err != nil {\n\t\treturn nil, err\n\t}\n\n\tif c.revocationURL, err = url.ParseRequestURI(fmt.Sprintf(\n\t\t\"%s/installation/token\",\n\t\tstrings.TrimSuffix(fmt.Sprint(config.BaseURL), \"/\"),\n\t)); err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn c, nil\n}", "func NewWithConfig(config *aws.Config) (*Client, error) {\n\tsess, err := session.NewSession(config)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn NewFromSession(sess), nil\n}", "func NewClient(config *config.RedisConfig) (*Client, error) {\n\tif config == nil {\n\t\treturn nil, errors.New(\"db config is not exist\")\n\t}\n\tclient := redis.NewClient(&redis.Options{\n\t\tAddr: config.Host,\n\t\tPassword: config.Password,\n\t\tDB: config.Name,\n\t})\n\t_, err := client.Ping().Result()\n\tif err != nil {\n\t\tlog.Fatalf(\"redis connection failed\")\n\t}\n\treturn &Client{client, nil, nil}, nil\n}", "func (b *clientFactory) ServerAdminClient(c *cli.Context) serverAdmin.Interface {\n\tb.ensureDispatcher(c)\n\treturn serverAdmin.New(b.dispatcher.ClientConfig(cadenceFrontendService))\n}", "func NewClient(config *Config) (client *Client, err error) {\n\t// bootstrap the config\n\tdefConfig := DefaultConfig()\n\n\tif len(config.ApiAddress) == 0 {\n\t\tconfig.ApiAddress = defConfig.ApiAddress\n\t}\n\n\tif len(config.Username) == 0 {\n\t\tconfig.Username = defConfig.Username\n\t}\n\n\tif len(config.Password) == 0 {\n\t\tconfig.Password = defConfig.Password\n\t}\n\n\tif len(config.Token) == 0 {\n\t\tconfig.Token = defConfig.Token\n\t}\n\n\tif len(config.UserAgent) == 0 {\n\t\tconfig.UserAgent = defConfig.UserAgent\n\t}\n\n\tif config.HttpClient == nil {\n\t\tconfig.HttpClient = defConfig.HttpClient\n\t}\n\n\tif config.HttpClient.Transport == nil {\n\t\tconfig.HttpClient.Transport = shallowDefaultTransport()\n\t}\n\n\tvar tp *http.Transport\n\n\tswitch t := config.HttpClient.Transport.(type) {\n\tcase *http.Transport:\n\t\ttp = t\n\tcase *oauth2.Transport:\n\t\tif bt, ok := t.Base.(*http.Transport); ok {\n\t\t\ttp = bt\n\t\t}\n\t}\n\n\tif tp != nil {\n\t\tif tp.TLSClientConfig == nil {\n\t\t\ttp.TLSClientConfig = &tls.Config{}\n\t\t}\n\t\ttp.TLSClientConfig.InsecureSkipVerify = config.SkipSslValidation\n\t}\n\n\tconfig.ApiAddress = strings.TrimRight(config.ApiAddress, \"/\")\n\n\tclient = &Client{\n\t\tConfig: *config,\n\t}\n\n\tif err := client.refreshEndpoint(); err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn client, nil\n}", "func NewClient(config Config) Client {\n\ttyp := config.Type()\n\n\tswitch typ {\n\tcase Bolt:\n\t\tbe := NewBoltBackend(config.(*BoltConfig))\n\t\t// TODO: Return an error instead of panicking.\n\t\tif err := be.Open(); err != nil {\n\t\t\tpanic(fmt.Errorf(\"Opening bolt backend: %s\", err))\n\t\t}\n\t\tq := NewBoltQueue(be.db)\n\t\treturn newKVClient(be, q)\n\n\tcase Rocks:\n\t\t// MORE TEMPORARY UGLINESS TO MAKE IT WORK FOR NOW:\n\t\tif err := os.MkdirAll(config.(*RocksConfig).Dir, os.FileMode(int(0700))); err != nil {\n\t\t\tpanic(fmt.Errorf(\"Creating rocks directory %q: %s\", config.(*RocksConfig).Dir, err))\n\t\t}\n\t\tbe := NewRocksBackend(config.(*RocksConfig))\n\t\tqueueFile := filepath.Join(config.(*RocksConfig).Dir, DefaultBoltQueueFilename)\n\t\tdb, err := bolt.Open(queueFile, 0600, NewBoltConfig(\"\").BoltOptions)\n\t\tif err != nil {\n\t\t\tpanic(fmt.Errorf(\"Creating bolt queue: %s\", err))\n\t\t}\n\t\tq := NewBoltQueue(db)\n\t\treturn newKVClient(be, q)\n\n\tcase Postgres:\n\t\tbe := NewPostgresBackend(config.(*PostgresConfig))\n\t\tq := NewPostgresQueue(config.(*PostgresConfig))\n\t\treturn newKVClient(be, q)\n\n\tdefault:\n\t\tpanic(fmt.Errorf(\"no client constructor available for db configuration type: %v\", typ))\n\t}\n}", "func NewForConfig(config clientcmd.ClientConfig) (client *Client, err error) {\n\tif config == nil {\n\t\t// initialize client-go clients\n\t\tloadingRules := clientcmd.NewDefaultClientConfigLoadingRules()\n\t\tconfigOverrides := &clientcmd.ConfigOverrides{}\n\t\tconfig = clientcmd.NewNonInteractiveDeferredLoadingClientConfig(loadingRules, configOverrides)\n\t}\n\n\tclient = new(Client)\n\tclient.KubeConfig = config\n\n\tclient.KubeClientConfig, err = client.KubeConfig.ClientConfig()\n\tif err != nil {\n\t\treturn nil, errors.Wrapf(err, errorMsg)\n\t}\n\n\tclient.KubeClient, err = kubernetes.NewForConfig(client.KubeClientConfig)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tclient.Namespace, _, err = client.KubeConfig.Namespace()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tclient.OperatorClient, err = operatorsclientset.NewForConfig(client.KubeClientConfig)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tclient.DynamicClient, err = dynamic.NewForConfig(client.KubeClientConfig)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tclient.appsClient, err = appsclientset.NewForConfig(client.KubeClientConfig)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tclient.serviceCatalogClient, err = servicecatalogclienset.NewForConfig(client.KubeClientConfig)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tclient.discoveryClient, err = discovery.NewDiscoveryClientForConfig(client.KubeClientConfig)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tclient.checkIngressSupports = true\n\n\tclient.userClient, err = userclientset.NewForConfig(client.KubeClientConfig)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tclient.projectClient, err = projectclientset.NewForConfig(client.KubeClientConfig)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tclient.routeClient, err = routeclientset.NewForConfig(client.KubeClientConfig)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn client, nil\n}", "func NewClient(config Config) *Client {\n\treturn &Client{Config: config}\n}", "func Client(conn io.ReadWriteCloser, config *Config) (*Session, error) {\n\treturn New(conn, true, config)\n}", "func NewClient(config *Config) *Client {\n\ttr := config.Transport()\n\n\treturn &Client{\n\t\tconfig: config.Clone(),\n\t\ttr: tr,\n\t\tclient: &http.Client{Transport: tr},\n\t}\n}", "func NewClient(config *Config) *Client {\n\treturn &Client{\n\t\tchanged: make(chan struct{}),\n\t\tclosing: make(chan struct{}),\n\t\tcacheData: &Data{},\n\t\tlogger: log.New(os.Stderr, \"[metaclient] \", log.LstdFlags),\n\t\tpath: config.Dir,\n\t\tretentionAutoCreate: config.RetentionAutoCreate,\n\t\tconfig: config,\n\t}\n}", "func NewSessionClient(c config) *SessionClient {\n\treturn &SessionClient{config: c}\n}", "func clientFromConfig(config *runner.ConfigFile) (graphql.Client, error) {\n\tgclient, err := graphql.NewClient(config.CustomerID, \"\", \"\", api.BackendURL(api.GraphService, config.Channel))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tgclient.SetHeader(\"Authorization\", config.APIKey)\n\n\treturn gclient, nil\n}", "func (c *SiteReplicationSys) getAdminClient(ctx context.Context, deploymentID string) (*madmin.AdminClient, error) {\n\tcreds, err := c.getPeerCreds()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tpeer, ok := c.state.Peers[deploymentID]\n\tif !ok {\n\t\treturn nil, errSRPeerNotFound\n\t}\n\n\treturn getAdminClient(peer.Endpoint, creds.AccessKey, creds.SecretKey)\n}", "func NewClient(ctx context.Context, config *ClientConfig, httpClient auth.HTTPClient) Client {\n\tif httpClient != nil {\n\t\treturn &serviceManagerClient{Context: ctx, Config: config, HTTPClient: httpClient}\n\t}\n\tccConfig := &clientcredentials.Config{\n\t\tClientID: config.ClientID,\n\t\tClientSecret: config.ClientSecret,\n\t\tTokenURL: config.TokenURL + tokenURLSuffix,\n\t\tAuthStyle: oauth2.AuthStyleInParams,\n\t}\n\n\tauthClient := auth.NewAuthClient(ccConfig, config.SSLDisabled)\n\treturn &serviceManagerClient{Context: ctx, Config: config, HTTPClient: authClient}\n}", "func NewClientFromConfig() *Client {\n\treturn &Client{\n\t\tregistry: config.GlobalConfig.Registry,\n\t\torganization: config.GlobalConfig.Organization,\n\t\tusername: config.GlobalConfig.Username,\n\t\tpassword: config.GlobalConfig.Password,\n\t\tcopyTimeoutSeconds: config.GlobalConfig.ImageCopyTimeoutSeconds,\n\t\ttransport: defaultSkopeoTransport,\n\t}\n}", "func NewClient(kubeconfig, configContext string) (*Client, error) {\n\tconfig, err := defaultRestConfig(kubeconfig, configContext)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\trestClient, err := rest.RESTClientFor(config)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &Client{config, restClient}, nil\n}", "func NewClient(kubeconfig, configContext string) (*Client, error) {\n\tconfig, err := defaultRestConfig(kubeconfig, configContext)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\trestClient, err := rest.RESTClientFor(config)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &Client{config, restClient}, nil\n}", "func NewClient(config Config) Client {\n\treturn DefaultClient{\n\t\tconfig: config,\n\t}\n}", "func NewClient(config *Config) *Client {\n\treturn &Client{\n\t\tconfig: config,\n\t}\n}", "func NewClient(c *Config) *Client {\n\treturn &Client{\n\t\tBaseURL: BaseURLV1,\n\t\tUname: c.Username,\n\t\tPword: c.Password,\n\t\tHTTPClient: &http.Client{\n\t\t\tTimeout: time.Minute,\n\t\t},\n\t}\n}", "func NewWithConfig(conf Config) (Client, error) {\n\tvar err error\n\tvar c client\n\n\tclusters := strings.Split(conf.Hosts, \",\")\n\tclusterConfig := gocql.NewCluster(clusters...)\n\tclusterConfig.Consistency = gocql.LocalOne\n\tclusterConfig.ProtoVersion = 3\n\tclusterConfig.Keyspace = conf.Keyspace\n\tclusterConfig.Port = conf.Port\n\n\tif c.driver, err = clusterConfig.CreateSession(); err != nil {\n\t\treturn nil, err\n\t}\n\treturn &c, nil\n}", "func NewClient(config ClientConfig) (*Client, error) {\n\tvar baseURLToUse *url.URL\n\tvar err error\n\tif config.BaseURL == \"\" {\n\t\tbaseURLToUse, err = url.Parse(defaultBaseURL)\n\t} else {\n\t\tbaseURLToUse, err = url.Parse(config.BaseURL)\n\t}\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tc := &Client{\n\t\temail: config.Username,\n\t\tpassword: config.Password,\n\t\tbaseURL: baseURLToUse.String(),\n\t}\n\tc.client = http.DefaultClient\n\tc.InvitationService = &InvitationService{client: c}\n\tc.ActiveUserService = &ActiveUserService{client: c}\n\tc.UserService = &UserService{\n\t\tActiveUserService: c.ActiveUserService,\n\t\tInvitationService: c.InvitationService,\n\t}\n\treturn c, nil\n}", "func NewClient(conf *Config, auth *AuthConfig) (*Client, error) {\n\tconfig := DefaultConfig\n\tif conf != nil {\n\t\tconfig = *conf\n\t}\n\n\tauthConf := DefaultAuth\n\tif auth != nil {\n\t\tauthConf = *auth\n\t}\n\n\tlogger, _ := zap.NewProduction()\n\tc := &Client{\n\t\tlog: logger.Sugar(),\n\t\tconfig: config,\n\t\tauthConfig: authConf,\n\t}\n\n\tvar err error\n\tc.TokenService = &TokenService{client: c}\n\tif c.IfNeedAuth() {\n\t\tc.authConfig.JWT, err = c.TokenService.GetNew()\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\tc.Company = &CompanyService{client: c}\n\tc.Device = &DeviceService{client: c}\n\tc.DeviceGroup = &DeviceGroupService{client: c}\n\tc.Parameter = &ParameterService{client: c}\n\tc.User = &UserService{client: c}\n\tc.Location = &LocationService{client: c}\n\tc.Role = &RoleService{client: c}\n\tc.Subscription = &SubscriptionService{client: c}\n\tc.Manufacturer = &ManufacturerService{client: c}\n\tc.DeviceModel = &DeviceModelService{client: c}\n\tc.Event = &EventService{client: c}\n\tc.EventsSession = &EventsSessionService{client: c}\n\n\treturn c, nil\n}", "func NewClient(sess *session.Session) SecretsManagerAPI {\n\treturn secretsmanager.New(sess)\n}", "func NewClient(config *Configuration) (*Client, error) {\n\t// Check that authorization values are defined at all\n\tif config.AuthorizationHeaderToken == \"\" {\n\t\treturn nil, fmt.Errorf(\"No authorization is defined. You need AuthorizationHeaderToken\")\n\t}\n\n\tif config.ApplicationID == \"\" {\n\t\treturn nil, fmt.Errorf(\"ApplicationID is required - this is the only way to identify your requests in highwinds logs\")\n\t}\n\n\t// Configure the client from final configuration\n\tc := &Client{\n\t\tc: http.DefaultClient,\n\t\tDebug: config.Debug,\n\t\tApplicationID: config.ApplicationID,\n\t\tIdentity: &identity.Identification{\n\t\t\tAuthorizationHeaderToken: config.AuthorizationHeaderToken,\n\t\t},\n\t}\n\n\t// TODO eventually instantiate a custom client but not ready for that yet\n\n\t// Configure timeout on default client\n\tif config.Timeout == 0 {\n\t\tc.c.Timeout = time.Second * 10\n\t} else {\n\t\tc.c.Timeout = time.Second * time.Duration(config.Timeout)\n\t}\n\n\t// Set default headers\n\tc.Headers = c.GetHeaders()\n\treturn c, nil\n}", "func newM3adminClient() m3admin.Client {\n\tretry := retryhttp.NewClient()\n\tretry.RetryMax = 0\n\n\treturn m3admin.NewClient(m3admin.WithHTTPClient(retry))\n}", "func newConfigManagedClient(mgr manager.Manager) (runtimeclient.Client, manager.Runnable, error) {\n\tcacheOpts := cache.Options{\n\t\tScheme: mgr.GetScheme(),\n\t\tMapper: mgr.GetRESTMapper(),\n\t\tNamespace: alibabacloudClient.KubeCloudConfigNamespace,\n\t}\n\n\tc, err := cache.New(mgr.GetConfig(), cacheOpts)\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\n\tclientOpts := runtimeclient.Options{\n\t\tScheme: mgr.GetScheme(),\n\t\tMapper: mgr.GetRESTMapper(),\n\t}\n\n\tcachedClient, err := cluster.DefaultNewClient(c, config.GetConfigOrDie(), clientOpts)\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\n\treturn cachedClient, c, nil\n}", "func ProductionNewAdminClientWrapper(ctx context.Context, brokers []string, config *sarama.Config, adminClientType types.AdminClientType) (types.AdminClientInterface, error) {\n\tswitch adminClientType {\n\tcase types.Kafka:\n\t\treturn kafka.NewAdminClient(ctx, brokers, config)\n\tcase types.EventHub:\n\t\treturn eventhub.NewAdminClient(ctx, config) // Config Must Contain EventHub Namespace ConnectionString In Net.SASL.Password Field !\n\tcase types.Custom:\n\t\treturn custom.NewAdminClient(ctx)\n\tcase types.Unknown:\n\t\treturn nil, fmt.Errorf(\"received unknown AdminClientType\") // Should Never Happen But...\n\tdefault:\n\t\treturn nil, fmt.Errorf(\"received unsupported AdminClientType of %d\", adminClientType)\n\t}\n}", "func NewClient(config *Config) (*Client, error) {\n\tdefConfig := DefaultConfig()\n\n\tif len(config.Address) == 0 {\n\t\tconfig.Address = defConfig.Address\n\t}\n\n\tif len(config.Scheme) == 0 {\n\t\tconfig.Scheme = defConfig.Scheme\n\t}\n\n\tif config.HTTPClient == nil {\n\t\tconfig.HTTPClient = defConfig.HTTPClient\n\t}\n\n\tclient := &Client{\n\t\tConfig: *config,\n\t}\n\treturn client, nil\n}", "func NewClient(config *Config, token string) (Client, error) {\n\tif config == nil {\n\t\tconfig = &Config{Config: api.DefaultConfig()}\n\t}\n\tclient, err := api.NewClient(config.Config)\n\tif err != nil {\n\t\treturn Client{}, err\n\t}\n\n\tif config.Namespace != \"\" {\n\t\tclient.SetNamespace(config.Namespace)\n\t}\n\n\tclient.SetToken(token)\n\tlog.Entry().Debugf(\"Login to Vault %s in namespace %s successfull\", config.Address, config.Namespace)\n\treturn Client{client.Logical(), config}, nil\n}", "func NewHTTPClientFromConfig(cfg *config.Config) (*HTTPClient, error) {\n\t// get clients\n\tordererClients, err := getOrdererHTTPClients(cfg)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tpeerClients, err := getPeerHTTPClients(cfg)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn &HTTPClient{\n\t\tordererHTTPClients: ordererClients,\n\t\tpeerHTTPClients: peerClients,\n\t\tprivKey: cfg.KeyStore.Privs[0],\n\t}, nil\n}", "func NewClient(config ClientConfig) (Client, error) {\n\t// raise error on client creation if the url is invalid\n\tneturl, err := url.Parse(config.URL)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\thttpClient := http.DefaultClient\n\n\tif config.TLSInsecureSkipVerify {\n\t\thttpClient.Transport = &http.Transport{TLSClientConfig: &tls.Config{InsecureSkipVerify: true}}\n\t}\n\n\tc := &client{\n\t\tclient: httpClient,\n\t\trawurl: neturl.String(),\n\t\tusername: config.Username,\n\t\tpassword: config.Password,\n\t}\n\n\t// create a single service object and reuse it for each API service\n\tc.service.client = c\n\tc.knowledge = (*knowledgeService)(&c.service)\n\n\treturn c, nil\n}", "func NewClient(s *discordgo.Session, conf *Config) *Client {\n\tif conf == nil {\n\t\tconf = NewConfig()\n\t}\n\tc := &Client{\n\t\tCli: s,\n\t\tConf: conf,\n\t\tUnreadChannels: map[string]map[string]int{},\n\t}\n\tc.addHandlers()\n\treturn c\n}", "func NewClient(ctx context.Context, config *ClientConfig) (*Client, error) {\n\tc := &Client{\n\t\tconfig: config,\n\t}\n\tif err := c.Reconnect(ctx); err != nil {\n\t\treturn nil, err\n\t}\n\treturn c, nil\n}", "func NewConfigClient() api.ConfigClient {\n\treturn &configClientImpl{}\n}", "func NewClient(log logr.Logger, config *rest.Config) (*Client, error) {\n\tdiscoveryClient, err := discovery.NewDiscoveryClientForConfig(config)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &Client{\n\t\tdiscovery: discoveryClient,\n\t\tlog: log,\n\t\ttimeout: defaultTimeout,\n\t}, nil\n}", "func NewClient(c Config) Client {\n\treturn &client{config: c}\n}", "func NewClientWithConfig(config *vaultapi.Config, vaultCfg *Config, gcpCfg *GCPBackendConfig) (*Client, error) {\n\tvar clientToken string\n\tvar err error\n\trawClient, err := vaultapi.NewClient(config)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tlogical := rawClient.Logical()\n\tclient := &Client{Client: rawClient, Logical: logical}\n\n\tswitch vaultCfg.Backend {\n\tcase \"gcp\":\n\t\tclientToken, err = GCPBackendLogin(client, gcpCfg, vaultCfg)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\tdefault:\n\t\tjwt, err := GetServiceAccountToken(vaultCfg.TokenPath)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tclientToken, err = KubernetesBackendLogin(client, vaultCfg.Role, jwt)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\tif err == nil {\n\t\trawClient.SetToken(string(clientToken))\n\t} else {\n\t\treturn nil, err\n\t}\n\treturn client, nil\n}", "func NewPinnedAdminClient(url string, opts ...Option) (AdminClient, error) {\n\tc := &adminClient{}\n\n\tfor _, o := range opts {\n\t\to(c)\n\t}\n\n\tif err := c.connect(url); err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn c, nil\n}", "func New(c *Config) Client {\n\treturn newClient(c)\n}", "func NewClient(config *Config) (*Client, error) {\n\tclient := new(Client)\n\terr := client.Init(config)\n\treturn client, err\n}", "func NewClient(config *Config) (*Client, error) {\n\tclient := new(Client)\n\terr := client.Init(config)\n\treturn client, err\n}", "func NewClient(config *Config) (*Client, error) {\n\tclient := new(Client)\n\terr := client.Init(config)\n\treturn client, err\n}", "func NewClient(config *Config) (*Client, error) {\n\tclient := new(Client)\n\terr := client.Init(config)\n\treturn client, err\n}", "func NewClient(config *Config) (*Client, error) {\n\tclient := new(Client)\n\terr := client.Init(config)\n\treturn client, err\n}", "func NewClient(config *Config) (*Client, error) {\n\tclient := new(Client)\n\terr := client.Init(config)\n\treturn client, err\n}", "func NewClient(config Config) (*Client, error) {\n\tclient := &Client{\n\t\tuserAgent: \"GoGenderize/\" + Version,\n\t\tapiKey: config.APIKey,\n\t\thttpClient: http.DefaultClient,\n\t}\n\n\tif config.UserAgent != \"\" {\n\t\tclient.userAgent = config.UserAgent\n\t}\n\n\tif config.HTTPClient != nil {\n\t\tclient.httpClient = config.HTTPClient\n\t}\n\n\tserver := defaultServer\n\tif config.Server != \"\" {\n\t\tserver = config.Server\n\t}\n\tapiURL, err := url.Parse(server)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tclient.apiURL = apiURL\n\n\treturn client, nil\n}", "func New(endpoint string, accessKeyID, secretAccessKey string, secure bool) (*AdminClient, error) {\n\tclnt, err := privateNew(endpoint, accessKeyID, secretAccessKey, secure)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn clnt, nil\n}", "func NewClient(config *core.Config) (c *Client, err error) {\n\t// create client\n\tc = &Client{\n\t\tconfig: config,\n\t\tdone: make(chan bool, 2),\n\t}\n\n\t// create cipher\n\tif c.cipher, err = core.NewCipher(c.config.Cipher, c.config.Passwd); err != nil {\n\t\tlogln(\"core: failed to initialize cipher:\", err)\n\t\treturn\n\t}\n\n\t// create managed net\n\tif c.net, err = nat.NewNetFromCIDR(DefaultClientSubnet); err != nil {\n\t\tlogln(\"nat: failed to create managed subnet:\", err)\n\t\treturn\n\t}\n\n\t// assign a localIP\n\tif c.localIP, err = c.net.Take(); err != nil {\n\t\tlogln(\"nat: faield to assign a localIP:\", err)\n\t\treturn\n\t}\n\n\treturn\n}", "func TestCreateAdminClientCustom(t *testing.T) {\n\n\t// Test Data\n\tcommontesting.SetTestEnvironment(t)\n\tctx := context.WithValue(context.TODO(), env.Key{}, &env.Environment{SystemNamespace: system.Namespace()})\n\tclientId := \"TestClientId\"\n\tadminClientType := Custom\n\tmockAdminClient = &MockAdminClient{}\n\n\t// Replace the NewPluginAdminClientWrapper To Provide Mock AdminClient & Defer Reset\n\tNewCustomAdminClientWrapperRef := NewCustomAdminClientWrapper\n\tNewCustomAdminClientWrapper = func(ctxArg context.Context, namespaceArg string) (AdminClientInterface, error) {\n\t\tassert.Equal(t, ctx, ctxArg)\n\t\tassert.Equal(t, system.Namespace(), namespaceArg)\n\t\tassert.Equal(t, adminClientType, adminClientType)\n\t\treturn mockAdminClient, nil\n\t}\n\tdefer func() { NewCustomAdminClientWrapper = NewCustomAdminClientWrapperRef }()\n\n\tsaramaConfig, err := client.NewConfigBuilder().\n\t\tWithDefaults().\n\t\tFromYaml(commontesting.SaramaDefaultConfigYaml).\n\t\tBuild()\n\tassert.Nil(t, err)\n\n\t// Perform The Test\n\tadminClient, err := CreateAdminClient(ctx, saramaConfig, clientId, adminClientType)\n\n\t// Verify The Results\n\tassert.Nil(t, err)\n\tassert.NotNil(t, adminClient)\n\tassert.Equal(t, mockAdminClient, adminClient)\n}", "func NewClient(kubeconfig string) (client versioned.Interface, err error) {\n\tvar config *rest.Config\n\tconfig, err = getConfig(kubeconfig)\n\tif err != nil {\n\t\treturn\n\t}\n\treturn versioned.NewForConfig(config)\n}", "func NewClient(config *Config) (*Client, error) {\n\t// bootstrap the config\n\tdefConfig := DefaultConfig()\n\n\tif config.Address == \"\" {\n\t\tconfig.Address = defConfig.Address\n\t} else if _, err := url.Parse(config.Address); err != nil {\n\t\treturn nil, fmt.Errorf(\"invalid address '%s': %v\", config.Address, err)\n\t}\n\n\thttpClient := config.HttpClient\n\tif httpClient == nil {\n\t\thttpClient = defaultHttpClient()\n\t\tif err := ConfigureTLS(httpClient, config.TLSConfig); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\tclient := &Client{\n\t\tconfig: *config,\n\t\thttpClient: httpClient,\n\t}\n\treturn client, nil\n}", "func NewClient(c Config) (Client, error) {\n\tif len(c.Endpoint) == 0 {\n\t\tc.Endpoint = EndpointProduction\n\t}\n\n\treturn &client{\n\t\tapikey: c.APIKey,\n\t\tendpoint: c.Endpoint,\n\t\torganizationid: c.OrganizationID,\n\t\thttpClient: http.DefaultClient,\n\t}, nil\n}", "func NewMockConfigAdminServiceClient(ctrl *gomock.Controller) *MockConfigAdminServiceClient {\n\tmock := &MockConfigAdminServiceClient{ctrl: ctrl}\n\tmock.recorder = &MockConfigAdminServiceClientMockRecorder{mock}\n\treturn mock\n}", "func NewClient(ctx context.Context, cfg ClientConfig) (*Client, error) {\n\tconfig := &tfe.Config{\n\t\tToken: cfg.Token,\n\t}\n\ttfeClient, err := tfe.NewClient(config)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"could not create a new TFE tfeClient: %w\", err)\n\t}\n\n\tw, err := tfeClient.Workspaces.Read(ctx, cfg.Organization, cfg.Workspace)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"could not retrieve workspace '%v/%v': %w\", cfg.Organization, cfg.Workspace, err)\n\t}\n\n\tc := Client{\n\t\tclient: tfeClient,\n\t\tworkspace: w,\n\t}\n\treturn &c, nil\n}", "func NewClient(config *Config) Client {\n\tendpoint := net.JoinHostPort(config.Hostname, strconv.Itoa(config.port()))\n\tif !strings.Contains(endpoint, \"//\") {\n\t\tendpoint = \"http://\" + endpoint\n\t}\n\n\topts := &jsonrpc.RPCClientOpts{\n\t\tCustomHeaders: map[string]string{\n\t\t\t\"Authorization\": \"Basic \" + base64.StdEncoding.EncodeToString([]byte(config.Username+\":\"+config.Password)),\n\t\t},\n\t}\n\n\treturn &client{\n\t\tRPCClient: jsonrpc.NewClientWithOpts(endpoint, opts),\n\t}\n}", "func NewClient(config *Config) *Client {\n\tc := &Client{config: defaultConfig.Merge(config)}\n\n\treturn c\n}", "func NewClient(inClusterConfig bool, kubeconfig string) (kubernetes.Interface, error) {\n\tvar k8sconfig *rest.Config\n\tif inClusterConfig {\n\t\tvar err error\n\t\tk8sconfig, err = rest.InClusterConfig()\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"kubeconfig in-cluster configuration error. %+v\", err)\n\t\t}\n\t} else {\n\t\tvar kubeconfig string\n\t\t// Try to fallback to the `KUBECONFIG` env var\n\t\tif kubeconfig == \"\" {\n\t\t\tkubeconfig = os.Getenv(\"KUBECONFIG\")\n\t\t}\n\t\t// If the `KUBECONFIG` is empty, default to home dir default kube config path\n\t\tif kubeconfig == \"\" {\n\t\t\thome, err := homedir.Dir()\n\t\t\tif err != nil {\n\t\t\t\treturn nil, fmt.Errorf(\"kubeconfig unable to get home dir. %+v\", err)\n\t\t\t}\n\t\t\tkubeconfig = filepath.Join(home, \".kube\", \"config\")\n\t\t}\n\t\tvar err error\n\t\t// This will simply use the current context in the kubeconfig\n\t\tk8sconfig, err = clientcmd.BuildConfigFromFlags(\"\", kubeconfig)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"kubeconfig out-of-cluster configuration (%s) error. %+v\", kubeconfig, err)\n\t\t}\n\t}\n\n\t// Create the clientset\n\tclientset, err := kubernetes.NewForConfig(k8sconfig)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"kubernetes new client error. %+v\", err)\n\t}\n\treturn clientset, nil\n}", "func NewClient(config Config) VTM {\n\t// if no http client, set to default\n\tif config.HTTPClient == nil {\n\t\tconfig.HTTPClient = http.DefaultClient\n\t}\n\n\tdebugLogOutput := config.LogOutput\n\tif debugLogOutput == nil {\n\t\tdebugLogOutput = ioutil.Discard\n\t}\n\n\treturn &vtmClient{\n\t\tconfig: config,\n\t\thttpClient: config.HTTPClient,\n\t\tdebugLog: log.New(debugLogOutput, \"\", 0),\n\t}\n}", "func NewClient(config Config) (Client, error) {\n\tuuid.SetNodeID([]byte(fmt.Sprintf(\"%s:%s\", config.AppID, config.InstanceID)))\n\tconns := connection.NewManager()\n\tsubConn, err := conns.Connect(fmt.Sprintf(\"%s:%d\", config.SubscriptionService.GetHost(), config.SubscriptionService.GetPort()))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\te2tConn, err := conns.Connect(fmt.Sprintf(\"%s:%d\", config.E2TService.GetHost(), config.E2TService.GetPort()))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &e2Client{\n\t\tconfig: config,\n\t\tepClient: endpoint.NewClient(subConn),\n\t\tsubClient: subscription.NewClient(subConn),\n\t\ttaskClient: subscriptiontask.NewClient(subConn),\n\t\tterminationClient: termination.NewClient(e2tConn),\n\t\tconns: conns,\n\t}, nil\n}", "func NewClient(config *Config) Client {\n\tendpoint := net.JoinHostPort(config.hostname(), strconv.Itoa(config.port()))\n\tif !strings.Contains(endpoint, \"//\") {\n\t\tendpoint = \"http://\" + endpoint\n\t}\n\n\topts := &jsonrpc.RPCClientOpts{\n\t\tCustomHeaders: map[string]string{\n\t\t\t\"Authorization\": \"Basic \" + base64.StdEncoding.EncodeToString([]byte(config.username()+\":\"+config.password())),\n\t\t},\n\t}\n\n\treturn &client{\n\t\tRPCClient: jsonrpc.NewClientWithOpts(endpoint, opts),\n\t}\n}", "func NewClient(config Config) ClientInterface {\n\tcontext := ctx.Background()\n\tif config.GitHubToken == \"\" {\n\t\treturn Client{\n\t\t\tClient: github.NewClient(nil),\n\t\t\tContext: context,\n\t\t\tConfig: config,\n\t\t}\n\t}\n\toauth2Client := oauth2.NewClient(context, oauth2.StaticTokenSource(\n\t\t&oauth2.Token{AccessToken: config.GitHubToken},\n\t))\n\treturn Client{\n\t\tClient: github.NewClient(oauth2Client),\n\t\tContext: context,\n\t\tConfig: config,\n\t}\n}", "func NewClient(cfg config.StanConfig, logger *zap.Logger) (*Client, error) {\n\tconn, err := stan.Connect(cfg.ClusterID, \"backend-client\",\n\t\tstan.Pings(pingInterval, pingAttempts),\n\t\tstan.NatsURL(cfg.Addr),\n\t\tstan.SetConnectionLostHandler(func(_ stan.Conn, reason error) {\n\t\t\tlogger.Fatal(\"connection lost, reason\", zap.Error(reason))\n\t\t}))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn &Client{conn: conn}, nil\n}", "func NewClient(configMode string) (client AzureClient) {\n\tvar configload Config\n\tif configMode == \"metadata\" {\n\t\tconfigload = LoadConfig()\n\t} else if configMode == \"environment\" {\n\t\tconfigload = EnvLoadConfig()\n\t} else {\n\t\tlog.Print(\"Invalid config Mode\")\n\t}\n\n\tclient = AzureClient{\n\t\tconfigload,\n\t\tGetVMClient(configload),\n\t\tGetNicClient(configload),\n\t\tGetLbClient(configload),\n\t}\n\treturn\n}", "func NewClient(ipAddress, username, password, apiVersion string, waitOnJobs, isTenant bool) (*GroupMgmtClient, error) {\n\tif apiVersion != \"v1\" {\n\t\treturn nil, fmt.Errorf(\"API version \\\"%s\\\" is not recognized\", apiVersion)\n\t}\n\n\t// Get resty client\n\tgroupMgmtClient := newGroupMgmtClient(ipAddress, username, password, apiVersion, waitOnJobs, isTenant)\n\n\t// Get session token\n\tsessionToken, err := groupMgmtClient.login(username, password)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tgroupMgmtClient.SessionToken = sessionToken\n\n\t// Add retryCondition\n\t// This flag is set during a relogin attempt to prevent retry recursion\n\treloginInProgress := false\n\n\t// Add a retry condition to perform a relogin if the session has expired\n\tgroupMgmtClient.Client.\n\t\tAddRetryCondition(\n\t\t\tfunc(resp *resty.Response, err error) bool {\n\t\t\t\t// Attempt relogin on an authorization error if relogin is not already in progress\n\t\t\t\tif err == nil && resp.StatusCode() == 401 && !reloginInProgress {\n\t\t\t\t\treloginInProgress = true\n\t\t\t\t\tsessionToken, err = groupMgmtClient.login(username, password)\n\t\t\t\t\treloginInProgress = false\n\t\t\t\t\tif err != nil {\n\t\t\t\t\t\treturn false\n\t\t\t\t\t}\n\n\t\t\t\t\t// replace the original client session token with new session token\n\t\t\t\t\tgroupMgmtClient.SessionToken = sessionToken\n\t\t\t\t\tresp.Request.SetHeader(\"X-Auth-Token\", groupMgmtClient.SessionToken)\n\t\t\t\t\treturn true\n\t\t\t\t}\n\t\t\t\treturn false\n\t\t\t},\n\t\t).SetRetryCount(maxLoginRetries)\n\treturn groupMgmtClient, nil\n}", "func NewClient(config *Config) (*Client, error) {\n\tif !(config.Dimensionality > 0) {\n\t\treturn nil, fmt.Errorf(\"dimensionality must be >0\")\n\t}\n\n\treturn &Client{\n\t\tcoord: NewCoordinate(config),\n\t\torigin: NewCoordinate(config),\n\t\tconfig: config,\n\t\tadjustmentIndex: 0,\n\t\tadjustmentSamples: make([]float64, config.AdjustmentWindowSize),\n\t\tlatencyFilterSamples: make(map[string][]float64),\n\t}, nil\n}", "func (pc *PeerClient) Admin() (pb.AdminClient, error) {\n\tconn, err := pc.commonClient.NewConnection(pc.address, pc.sn)\n\tif err != nil {\n\t\treturn nil, errors.WithMessage(err,\n\t\t\tfmt.Sprintf(\"admin client failed to connect to %s\", pc.address))\n\t}\n\treturn pb.NewAdminClient(conn), nil\n}", "func newClient(ctx context.Context, cfg oconf.Config) (*client, error) {\n\tc := &client{\n\t\texportTimeout: cfg.Metrics.Timeout,\n\t\trequestFunc: cfg.RetryConfig.RequestFunc(retryable),\n\t\tconn: cfg.GRPCConn,\n\t}\n\n\tif len(cfg.Metrics.Headers) > 0 {\n\t\tc.metadata = metadata.New(cfg.Metrics.Headers)\n\t}\n\n\tif c.conn == nil {\n\t\t// If the caller did not provide a ClientConn when the client was\n\t\t// created, create one using the configuration they did provide.\n\t\tconn, err := grpc.DialContext(ctx, cfg.Metrics.Endpoint, cfg.DialOptions...)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\t// Keep track that we own the lifecycle of this conn and need to close\n\t\t// it on Shutdown.\n\t\tc.ourConn = true\n\t\tc.conn = conn\n\t}\n\n\tc.msc = colmetricpb.NewMetricsServiceClient(c.conn)\n\n\treturn c, nil\n}", "func NewClient() (*Client, error) {\n\tconfig, err := rest.InClusterConfig()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\ttypes := runtime.NewScheme()\n\tschemeBuilder := runtime.NewSchemeBuilder(\n\t\tfunc(scheme *runtime.Scheme) error {\n\t\t\treturn nil\n\t\t})\n\n\terr = schemeBuilder.AddToScheme(types)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tclient, err := newClientForAPI(config, v1alpha1.GroupVersion, types)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &Client{\n\t\tclient: client,\n\t}, err\n}", "func NewClient(c *Config) (*Client, error) {\n\tdef := DefaultConfig()\n\tif def == nil {\n\t\treturn nil, fmt.Errorf(\"could not create/read default configuration\")\n\t}\n\tif def.Error != nil {\n\t\treturn nil, errwrap.Wrapf(\"error encountered setting up default configuration: {{err}}\", def.Error)\n\t}\n\n\tif c == nil {\n\t\tc = def\n\t}\n\n\tc.modifyLock.Lock()\n\tdefer c.modifyLock.Unlock()\n\n\tif c.MinRetryWait == 0 {\n\t\tc.MinRetryWait = def.MinRetryWait\n\t}\n\n\tif c.MaxRetryWait == 0 {\n\t\tc.MaxRetryWait = def.MaxRetryWait\n\t}\n\n\tif c.HttpClient == nil {\n\t\tc.HttpClient = def.HttpClient\n\t}\n\tif c.HttpClient.Transport == nil {\n\t\tc.HttpClient.Transport = def.HttpClient.Transport\n\t}\n\n\taddress := c.Address\n\tif c.AgentAddress != \"\" {\n\t\taddress = c.AgentAddress\n\t}\n\n\tu, err := c.ParseAddress(address)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tclient := &Client{\n\t\taddr: u,\n\t\tconfig: c,\n\t\theaders: make(http.Header),\n\t}\n\n\tif c.ReadYourWrites {\n\t\tclient.replicationStateStore = &replicationStateStore{}\n\t}\n\n\t// Add the VaultRequest SSRF protection header\n\tclient.headers[RequestHeaderName] = []string{\"true\"}\n\n\tif token := os.Getenv(EnvVaultToken); token != \"\" {\n\t\tclient.token = token\n\t}\n\n\tif namespace := os.Getenv(EnvVaultNamespace); namespace != \"\" {\n\t\tclient.setNamespace(namespace)\n\t}\n\n\treturn client, nil\n}", "func newClient(conf config) (*storage.Client, error) {\n\tdb, err := storage.NewDBClient(conf.MongoURI, conf.DBName, conf.MongoMICol, conf.MongoAgCol)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"error creating DB client: %q\", err)\n\t}\n\tdb.Collection(conf.MongoMICol)\n\tbc := storage.NewCloudClient(conf.SwiftUsername, conf.SwiftAPIKey, conf.SwiftAuthURL, conf.SwiftDomain, conf.SwiftContainer)\n\tclient, err := storage.NewClient(db, bc)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"error creating storage.client: %q\", err)\n\t}\n\treturn client, nil\n}", "func NewClient(kubeConfig *rest.Config) (client.Client, error) {\n\thttpClient, err := rest.HTTPClientFor(kubeConfig)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to create http client: %v\", err)\n\t}\n\tmapper, err := apiutil.NewDiscoveryRESTMapper(kubeConfig, httpClient)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to discover api rest mapper: %v\", err)\n\t}\n\tkubeClient, err := client.New(kubeConfig, client.Options{\n\t\tScheme: scheme,\n\t\tMapper: mapper,\n\t})\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to create kube client: %v\", err)\n\t}\n\treturn kubeClient, nil\n}", "func NewClient(config *config.Config, httpClient *http.Client) *Client {\n\treturn &Client{\n\t\tGetter: NewGetter(config, httpClient),\n\t}\n}", "func New(ctx context.Context, config Config) (*Client, error) {\n\terr := config.checkAndSetDefaults()\n\tif err != nil {\n\t\treturn nil, trace.Wrap(err)\n\t}\n\tc := &Client{Config: config}\n\tclient, err := c.connect(ctx)\n\tif err != nil {\n\t\treturn nil, trace.Wrap(err)\n\t}\n\tc.client = client\n\tc.addTerminationHandler()\n\treturn c, nil\n}", "func NewClient(config *ClientConfig) *Client {\n\tvar httpClient *http.Client\n\tvar logger LeveledLoggerInterface\n\n\tif config.HTTPClient == nil {\n\t\thttpClient = &http.Client{}\n\t} else {\n\t\thttpClient = config.HTTPClient\n\t}\n\n\tif config.Logger == nil {\n\t\tlogger = &LeveledLogger{Level: LevelError}\n\t} else {\n\t\tlogger = config.Logger\n\t}\n\n\treturn &Client{\n\t\tAPIToken: config.APIToken,\n\t\tLogger: logger,\n\n\t\tbaseURL: WaniKaniAPIURL,\n\t\thttpClient: httpClient,\n\t}\n}", "func (kc *KClient) Admin() sarama.ClusterAdmin {\n\tca, err := sarama.NewClusterAdminFromClient(kc.cl)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn ca\n}", "func NewHTTPClient() (client.Client, error) {\n\taddr := Settings.Config.URL.String()\n\tc, err := client.NewHTTPClient(client.HTTPConfig{\n\t\tAddr: addr,\n\t\tUsername: Settings.Config.Username,\n\t\tPassword: Settings.Config.Password,\n\t\tTimeout: Settings.Config.Timeout,\n\t})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tlog.Debugf(\"action=NewHTTPClient addr=%s username=%s\", addr, Settings.Config.Username)\n\treturn c, nil\n}", "func NewClient(ctx context.Context, cfg *Config, bc *bclient.Client, db *db.Database) (*Client, error) {\n\twg := &sync.WaitGroup{}\n\n\tfor _, watcher := range cfg.Watchers {\n\t\twg.Add(1)\n\t\tgo func(discToken, token0, token1 string) {\n\t\t\tdefer wg.Done()\n\t\t\tdg, err := discordgo.New(\"Bot \" + discToken)\n\t\t\tif err != nil {\n\t\t\t\tlog.Println(\"failed to start watcher: \", err)\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tif err := dg.Open(); err != nil {\n\t\t\t\tlog.Println(\"failed to start watcher: \", err)\n\t\t\t\treturn\n\t\t\t}\n\t\t}(watcher.DiscordToken, watcher.Token0Address, watcher.Token1Address)\n\t}\n\n\tclient := &Client{bc: bc, wg: wg, db: db}\n\n\tlog.Println(\"bot is now running\")\n\treturn client, nil\n}", "func New(db *gorm.DB, prefix, cookiesecret string) *Admin {\n\tadminpath := filepath.Join(prefix, \"/admin\")\n\ta := Admin{\n\t\tdb: db,\n\t\tprefix: prefix,\n\t\tadminpath: adminpath,\n\t\tauth: auth{\n\t\t\tdb: db,\n\t\t\tpaths: pathConfig{\n\t\t\t\tadmin: adminpath,\n\t\t\t\tlogin: filepath.Join(prefix, \"/login\"),\n\t\t\t\tlogout: filepath.Join(prefix, \"/logout\"),\n\t\t\t},\n\t\t\tsession: sessionConfig{\n\t\t\t\tkey: \"userid\",\n\t\t\t\tname: \"admsession\",\n\t\t\t\tstore: cookie.NewStore([]byte(cookiesecret)),\n\t\t\t},\n\t\t},\n\t}\n\ta.adm = admin.New(&admin.AdminConfig{\n\t\tSiteName: \"My Admin Interface\",\n\t\tDB: db,\n\t\tAuth: a.auth,\n\t\tAssetFS: bindatafs.AssetFS.NameSpace(\"admin\"),\n\t})\n\taddUser(a.adm)\n\tresources.AddProduct(a.adm)\n\treturn &a\n}", "func NewForConfig(c *rest.Config) (*KudzuV1alpha1Client, error) {\n\tconfig := *c\n\tif err := setConfigDefaults(&config); err != nil {\n\t\treturn nil, err\n\t}\n\tclient, err := rest.RESTClientFor(&config)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &KudzuV1alpha1Client{client}, nil\n}", "func GetClient(config *oauth2.Config) *http.Client {\n\t// The file token.json stores the user's access and refresh tokens, and is\n\t// created automatically when the authorization flow completes for the first\n\t// time.\n\ttokFile := \"token.json\"\n\ttok, err := TokenFromFile(tokFile)\n\tif err != nil {\n\t\ttok = GetTokenFromWeb(config)\n\t\tSaveToken(tokFile, tok)\n\t}\n\treturn config.Client(context.Background(), tok)\n}", "func NewClient(logger log.Logger, endpoint string, debug bool) Client {\n\tconf := watchman.NewConfiguration()\n\tconf.BasePath = \"http://localhost\" + bind.HTTP(\"watchman\")\n\tconf.Debug = debug\n\n\tif k8s.Inside() {\n\t\tconf.BasePath = \"http://watchman.apps.svc.cluster.local:8080\"\n\t}\n\tif endpoint != \"\" {\n\t\tconf.BasePath = endpoint // override from provided Watchman_ENDPOINT env variable\n\t}\n\n\tlogger = logger.WithKeyValue(\"package\", \"watchman\")\n\tlogger.Log(fmt.Sprintf(\"using %s for Watchman address\", conf.BasePath))\n\n\treturn &moovWatchmanClient{\n\t\tunderlying: watchman.NewAPIClient(conf),\n\t\tlogger: logger,\n\t}\n}", "func NewClient(kubeConfig string) (client *Client, err error) {\n\tconfig, err := GetClientConfig(kubeConfig)\n\tif err != nil {\n\t\treturn nil, trace.Wrap(err)\n\t}\n\n\tclientset, err := kubernetes.NewForConfig(config)\n\tif err != nil {\n\t\treturn nil, trace.Wrap(err)\n\t}\n\n\textClientset, err := apiextensionsclientset.NewForConfig(config)\n\tif err != nil {\n\t\treturn nil, trace.Wrap(err)\n\t}\n\n\treturn &Client{\n\t\tClient: clientset,\n\t\tExtClient: extClientset,\n\t}, nil\n}", "func NewClient(ctx context.Context, dInfo *backend.DataSourceInstanceSettings) (*Client, error) {\n\tc := Client{}\n\tvar err error\n\tc.dataSourceData, err = newDataSourceData(dInfo)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tconf := clientcredentials.Config{\n\t\tClientID: c.ClientID,\n\t\tClientSecret: c.Secret,\n\t\tTokenURL: microsoft.AzureADEndpoint(c.TenantID).TokenURL,\n\t\tScopes: []string{\"https://kusto.kusto.windows.net/.default\"},\n\t}\n\n\t// I hope this correct? The goal is to have a timeout for the\n\t// the client that talks to the actual Data explorer API.\n\t// One can attach a a variable, oauth2.HTTPClient, to the context of conf.Client(),\n\t// but that is the timeout for the token retrieval I believe.\n\t// https://github.com/golang/oauth2/issues/206\n\t// https://github.com/golang/oauth2/issues/368\n\tauthClient := oauth2.NewClient(ctx, conf.TokenSource(ctx))\n\n\tc.Client = &http.Client{\n\t\tTransport: authClient.Transport,\n\t\t// We add five seconds to the timeout so the client does not timeout before the server.\n\t\t// This is because the QueryTimeout property is used to set the server execution timeout\n\t\t// for queries. The server execution timeout does not apply to retrieving data, so when\n\t\t// a query returns a large amount of data, timeouts will still occur while the data is\n\t\t// being downloaded.\n\t\t// In the future, if we get the timeout value from Grafana's data source proxy setting, we\n\t\t// may have to flip this to subtract time.\n\t\tTimeout: c.dataSourceData.QueryTimeout + 5*time.Second,\n\t}\n\n\treturn &c, nil\n}", "func NewClient(config *triton.ClientConfig) (*StorageClient, error) {\n\t// TODO: Utilize config interface within the function itself\n\tclient, err := client.New(config.TritonURL, config.MantaURL, config.AccountName, config.Signers...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn newStorageClient(client), nil\n}", "func NewClient(appID int, appHash string, opt Options) *Client {\n\topt.setDefaults()\n\n\tmode := manager.ConnModeUpdates\n\tif opt.NoUpdates {\n\t\tmode = manager.ConnModeData\n\t}\n\tclient := &Client{\n\t\trand: opt.Random,\n\t\tlog: opt.Logger,\n\t\tappID: appID,\n\t\tappHash: appHash,\n\t\tupdateHandler: opt.UpdateHandler,\n\t\tsession: pool.NewSyncSession(pool.Session{\n\t\t\tDC: opt.DC,\n\t\t}),\n\t\tdomains: opt.DCList.Domains,\n\t\ttestDC: opt.DCList.Test,\n\t\tcfg: manager.NewAtomicConfig(tg.Config{\n\t\t\tDCOptions: opt.DCList.Options,\n\t\t}),\n\t\tcreate: defaultConstructor(),\n\t\tresolver: opt.Resolver,\n\t\tdefaultMode: mode,\n\t\tconnBackoff: opt.ReconnectionBackoff,\n\t\tclock: opt.Clock,\n\t\tdevice: opt.Device,\n\t\tmigrationTimeout: opt.MigrationTimeout,\n\t\tnoUpdatesMode: opt.NoUpdates,\n\t\tmw: opt.Middlewares,\n\t}\n\tif opt.TracerProvider != nil {\n\t\tclient.tracer = opt.TracerProvider.Tracer(oteltg.Name)\n\t}\n\tclient.init()\n\n\t// Including version into client logger to help with debugging.\n\tif v := version.GetVersion(); v != \"\" {\n\t\tclient.log = client.log.With(zap.String(\"v\", v))\n\t}\n\n\tif opt.SessionStorage != nil {\n\t\tclient.storage = &session.Loader{\n\t\t\tStorage: opt.SessionStorage,\n\t\t}\n\t}\n\n\tclient.opts = mtproto.Options{\n\t\tPublicKeys: opt.PublicKeys,\n\t\tRandom: opt.Random,\n\t\tLogger: opt.Logger,\n\t\tAckBatchSize: opt.AckBatchSize,\n\t\tAckInterval: opt.AckInterval,\n\t\tRetryInterval: opt.RetryInterval,\n\t\tMaxRetries: opt.MaxRetries,\n\t\tCompressThreshold: opt.CompressThreshold,\n\t\tMessageID: opt.MessageID,\n\t\tExchangeTimeout: opt.ExchangeTimeout,\n\t\tDialTimeout: opt.DialTimeout,\n\t\tClock: opt.Clock,\n\n\t\tTypes: getTypesMapping(),\n\n\t\tTracer: client.tracer,\n\t}\n\tclient.conn = client.createPrimaryConn(nil)\n\n\treturn client\n}", "func NewClient(config Config) (engine.AWSClient, error) {\n\tsvc, err := session.NewSession(&aws.Config{\n\t\tCredentials: credentials.NewStaticCredentials(\n\t\t\tconfig.AccessKey,\n\t\t\tconfig.AccessSecret,\n\t\t\t\"\",\n\t\t),\n\t})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn &awsClient{\n\t\tsvc: svc,\n\t\ts3Bucket: config.S3Bucket,\n\t\ts3Region: config.S3Region,\n\t\tsesRegion: config.SESRegion,\n\t\tmailFrom: mail.Address{\n\t\t\tName: \"scvl\",\n\t\t\tAddress: config.MailFrom,\n\t\t},\n\t\tmailBccAddresses: []*string{aws.String(config.MailBCCAddress)},\n\t\tmainDomain: config.MainDomain,\n\t\tfileDomain: config.FileDomain,\n\t}, nil\n}", "func NewClient(config *latest.Config, kubeClient kubectl.Client, dockerClient docker.Client, log log.Logger) Client {\n\treturn &client{\n\t\tconfig: config,\n\t\tkubeClient: kubeClient,\n\t\tdockerClient: dockerClient,\n\t\tlog: log,\n\t}\n}", "func NewClient(log logr.Logger, config *helmv1alpha1.Configuration) (*Client, error) {\n\tociClient, err := oci.NewClient(log, oci.WithConfiguration(config.OCI))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn &Client{\n\t\toci: ociClient,\n\t}, nil\n}", "func (j *joinData) Client() (clientset.Interface, error) {\n\tif j.client != nil {\n\t\treturn j.client, nil\n\t}\n\tpath := filepath.Join(j.KubeConfigDir(), kubeadmconstants.AdminKubeConfigFileName)\n\n\tclient, err := kubeconfigutil.ClientSetFromFile(path)\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"[preflight] couldn't create Kubernetes client\")\n\t}\n\tj.client = client\n\treturn client, nil\n}" ]
[ "0.73209894", "0.6839122", "0.6624568", "0.6368612", "0.6343806", "0.62199086", "0.6187589", "0.6140372", "0.60473835", "0.59915686", "0.5954231", "0.59464794", "0.5941888", "0.5929465", "0.59010786", "0.5897852", "0.5872431", "0.5853092", "0.5830711", "0.5823237", "0.5822983", "0.5820364", "0.5805189", "0.5781687", "0.57595384", "0.5757468", "0.5757468", "0.5737721", "0.57241726", "0.5723194", "0.5714403", "0.57125473", "0.57077247", "0.57031584", "0.5700916", "0.56933963", "0.5687163", "0.5684926", "0.5652323", "0.56411684", "0.5640295", "0.56358385", "0.5631938", "0.5618275", "0.5608227", "0.55971813", "0.5587031", "0.55826783", "0.55816144", "0.55769897", "0.55586165", "0.55586165", "0.55586165", "0.55586165", "0.55586165", "0.55586165", "0.5552894", "0.5531063", "0.5527524", "0.5524949", "0.552269", "0.5521214", "0.55173266", "0.55153126", "0.5505666", "0.55035114", "0.55034614", "0.5500746", "0.55001235", "0.5494079", "0.5483577", "0.547898", "0.54767424", "0.54715574", "0.54562956", "0.5453481", "0.5442007", "0.5440843", "0.54392356", "0.54360837", "0.542835", "0.54194134", "0.5417007", "0.540693", "0.54064125", "0.54003626", "0.5400159", "0.53974277", "0.53949964", "0.5392832", "0.5388523", "0.5388106", "0.5383817", "0.53819185", "0.5380132", "0.5374682", "0.53711873", "0.53662497", "0.53627414", "0.5356723" ]
0.7972845
0
Use adds a list of mutation hooks to the hooks stack. A call to `Use(f, g, h)` equals to `adminsession.Hooks(f(g(h())))`.
func (c *AdminSessionClient) Use(hooks ...Hook) { c.hooks.AdminSession = append(c.hooks.AdminSession, hooks...) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (c *AdminClient) Use(hooks ...Hook) {\n\tc.hooks.Admin = append(c.hooks.Admin, hooks...)\n}", "func (em *entityManager) Use(mw ...MiddlewareFunc) {\n\tem.mwStack = append(em.mwStack, mw...)\n}", "func (c *EatinghistoryClient) Use(hooks ...Hook) {\n\tc.hooks.Eatinghistory = append(c.hooks.Eatinghistory, hooks...)\n}", "func (c *FoodmenuClient) Use(hooks ...Hook) {\n\tc.hooks.Foodmenu = append(c.hooks.Foodmenu, hooks...)\n}", "func (c *StatustClient) Use(hooks ...Hook) {\n\tc.hooks.Statust = append(c.hooks.Statust, hooks...)\n}", "func (c *LevelOfDangerousClient) Use(hooks ...Hook) {\n\tc.hooks.LevelOfDangerous = append(c.hooks.LevelOfDangerous, hooks...)\n}", "func (c *WalletNodeClient) Use(hooks ...Hook) {\n\tc.hooks.WalletNode = append(c.hooks.WalletNode, hooks...)\n}", "func (c *MealplanClient) Use(hooks ...Hook) {\n\tc.hooks.Mealplan = append(c.hooks.Mealplan, hooks...)\n}", "func (c *WorkExperienceClient) Use(hooks ...Hook) {\n\tc.hooks.WorkExperience = append(c.hooks.WorkExperience, hooks...)\n}", "func (c *TagClient) Use(hooks ...Hook) {\n\tc.hooks.Tag = append(c.hooks.Tag, hooks...)\n}", "func (c *OperativeClient) Use(hooks ...Hook) {\n\tc.hooks.Operative = append(c.hooks.Operative, hooks...)\n}", "func (c *SituationClient) Use(hooks ...Hook) {\n\tc.hooks.Situation = append(c.hooks.Situation, hooks...)\n}", "func (ms *MiddlewareStack) Use(mw ...MiddlewareFunc) {\n\tms.stack = append(ms.stack, mw...)\n}", "func (ms *MiddlewareStack) Use(mw ...MiddlewareFunc) {\n\tms.stack = append(ms.stack, mw...)\n}", "func (c *ToolClient) Use(hooks ...Hook) {\n\tc.hooks.Tool = append(c.hooks.Tool, hooks...)\n}", "func (f *Flame) Use(handlers ...Handler) {\n\tvalidateAndWrapHandlers(handlers, nil)\n\tf.handlers = append(f.handlers, handlers...)\n}", "func (c *SymptomClient) Use(hooks ...Hook) {\n\tc.hooks.Symptom = append(c.hooks.Symptom, hooks...)\n}", "func (c *PharmacistClient) Use(hooks ...Hook) {\n\tc.hooks.Pharmacist = append(c.hooks.Pharmacist, hooks...)\n}", "func (c *PhysicianClient) Use(hooks ...Hook) {\n\tc.hooks.Physician = append(c.hooks.Physician, hooks...)\n}", "func (c *PhysicianClient) Use(hooks ...Hook) {\n\tc.hooks.Physician = append(c.hooks.Physician, hooks...)\n}", "func (c *TransactionClient) Use(hooks ...Hook) {\n\tc.hooks.Transaction = append(c.hooks.Transaction, hooks...)\n}", "func (c *BranchClient) Use(hooks ...Hook) {\n\tc.hooks.Branch = append(c.hooks.Branch, hooks...)\n}", "func (c *EventClient) Use(hooks ...Hook) {\n\tc.hooks.Event = append(c.hooks.Event, hooks...)\n}", "func (c *DentistClient) Use(hooks ...Hook) {\n\tc.hooks.Dentist = append(c.hooks.Dentist, hooks...)\n}", "func (c *OperationClient) Use(hooks ...Hook) {\n\tc.hooks.Operation = append(c.hooks.Operation, hooks...)\n}", "func (c *PetruleClient) Use(hooks ...Hook) {\n\tc.hooks.Petrule = append(c.hooks.Petrule, hooks...)\n}", "func (c *VeterinarianClient) Use(hooks ...Hook) {\n\tc.hooks.Veterinarian = append(c.hooks.Veterinarian, hooks...)\n}", "func (c *UserWalletClient) Use(hooks ...Hook) {\n\tc.hooks.UserWallet = append(c.hooks.UserWallet, hooks...)\n}", "func (c *ClubClient) Use(hooks ...Hook) {\n\tc.hooks.Club = append(c.hooks.Club, hooks...)\n}", "func (c *PositionClient) Use(hooks ...Hook) {\n\tc.hooks.Position = append(c.hooks.Position, hooks...)\n}", "func (c *PositionClient) Use(hooks ...Hook) {\n\tc.hooks.Position = append(c.hooks.Position, hooks...)\n}", "func (c *PositionClient) Use(hooks ...Hook) {\n\tc.hooks.Position = append(c.hooks.Position, hooks...)\n}", "func (c *UserClient) Use(hooks ...Hook) {\n\tc.hooks.User = append(c.hooks.User, hooks...)\n}", "func (c *UserClient) Use(hooks ...Hook) {\n\tc.hooks.User = append(c.hooks.User, hooks...)\n}", "func (c *UserClient) Use(hooks ...Hook) {\n\tc.hooks.User = append(c.hooks.User, hooks...)\n}", "func (c *UserClient) Use(hooks ...Hook) {\n\tc.hooks.User = append(c.hooks.User, hooks...)\n}", "func (c *UserClient) Use(hooks ...Hook) {\n\tc.hooks.User = append(c.hooks.User, hooks...)\n}", "func (c *UserClient) Use(hooks ...Hook) {\n\tc.hooks.User = append(c.hooks.User, hooks...)\n}", "func (c *UserClient) Use(hooks ...Hook) {\n\tc.hooks.User = append(c.hooks.User, hooks...)\n}", "func (c *UserClient) Use(hooks ...Hook) {\n\tc.hooks.User = append(c.hooks.User, hooks...)\n}", "func (c *UserClient) Use(hooks ...Hook) {\n\tc.hooks.User = append(c.hooks.User, hooks...)\n}", "func (c *UserClient) Use(hooks ...Hook) {\n\tc.hooks.User = append(c.hooks.User, hooks...)\n}", "func (c *UserClient) Use(hooks ...Hook) {\n\tc.hooks.User = append(c.hooks.User, hooks...)\n}", "func (c *FacultyClient) Use(hooks ...Hook) {\n\tc.hooks.Faculty = append(c.hooks.Faculty, hooks...)\n}", "func (c *ClubBranchClient) Use(hooks ...Hook) {\n\tc.hooks.ClubBranch = append(c.hooks.ClubBranch, hooks...)\n}", "func (c *EmployeeClient) Use(hooks ...Hook) {\n\tc.hooks.Employee = append(c.hooks.Employee, hooks...)\n}", "func (c *EmployeeClient) Use(hooks ...Hook) {\n\tc.hooks.Employee = append(c.hooks.Employee, hooks...)\n}", "func (c *EmployeeClient) Use(hooks ...Hook) {\n\tc.hooks.Employee = append(c.hooks.Employee, hooks...)\n}", "func (c *ComplaintClient) Use(hooks ...Hook) {\n\tc.hooks.Complaint = append(c.hooks.Complaint, hooks...)\n}", "func (c *BeerClient) Use(hooks ...Hook) {\n\tc.hooks.Beer = append(c.hooks.Beer, hooks...)\n}", "func (c *PositionassingmentClient) Use(hooks ...Hook) {\n\tc.hooks.Positionassingment = append(c.hooks.Positionassingment, hooks...)\n}", "func (c *CleanernameClient) Use(hooks ...Hook) {\n\tc.hooks.Cleanername = append(c.hooks.Cleanername, hooks...)\n}", "func (c *BillClient) Use(hooks ...Hook) {\n\tc.hooks.Bill = append(c.hooks.Bill, hooks...)\n}", "func (c *BillClient) Use(hooks ...Hook) {\n\tc.hooks.Bill = append(c.hooks.Bill, hooks...)\n}", "func (c *BillClient) Use(hooks ...Hook) {\n\tc.hooks.Bill = append(c.hooks.Bill, hooks...)\n}", "func (c *PurposeClient) Use(hooks ...Hook) {\n\tc.hooks.Purpose = append(c.hooks.Purpose, hooks...)\n}", "func (c *ReviewClient) Use(hooks ...Hook) {\n\tc.hooks.Review = append(c.hooks.Review, hooks...)\n}", "func (c *PlanetClient) Use(hooks ...Hook) {\n\tc.hooks.Planet = append(c.hooks.Planet, hooks...)\n}", "func (c *SkillClient) Use(hooks ...Hook) {\n\tc.hooks.Skill = append(c.hooks.Skill, hooks...)\n}", "func (c *PositionInPharmacistClient) Use(hooks ...Hook) {\n\tc.hooks.PositionInPharmacist = append(c.hooks.PositionInPharmacist, hooks...)\n}", "func (c *MedicineClient) Use(hooks ...Hook) {\n\tc.hooks.Medicine = append(c.hooks.Medicine, hooks...)\n}", "func (c *ClubTypeClient) Use(hooks ...Hook) {\n\tc.hooks.ClubType = append(c.hooks.ClubType, hooks...)\n}", "func (c *PetClient) Use(hooks ...Hook) {\n\tc.hooks.Pet = append(c.hooks.Pet, hooks...)\n}", "func (c *GenderClient) Use(hooks ...Hook) {\n\tc.hooks.Gender = append(c.hooks.Gender, hooks...)\n}", "func (c *GenderClient) Use(hooks ...Hook) {\n\tc.hooks.Gender = append(c.hooks.Gender, hooks...)\n}", "func (c *PatientClient) Use(hooks ...Hook) {\n\tc.hooks.Patient = append(c.hooks.Patient, hooks...)\n}", "func (c *PatientClient) Use(hooks ...Hook) {\n\tc.hooks.Patient = append(c.hooks.Patient, hooks...)\n}", "func (c *PatientClient) Use(hooks ...Hook) {\n\tc.hooks.Patient = append(c.hooks.Patient, hooks...)\n}", "func (c *UnitOfMedicineClient) Use(hooks ...Hook) {\n\tc.hooks.UnitOfMedicine = append(c.hooks.UnitOfMedicine, hooks...)\n}", "func (c *TasteClient) Use(hooks ...Hook) {\n\tc.hooks.Taste = append(c.hooks.Taste, hooks...)\n}", "func (c *BedtypeClient) Use(hooks ...Hook) {\n\tc.hooks.Bedtype = append(c.hooks.Bedtype, hooks...)\n}", "func (c *PostClient) Use(hooks ...Hook) {\n\tc.hooks.Post = append(c.hooks.Post, hooks...)\n}", "func (c *BuildingClient) Use(hooks ...Hook) {\n\tc.hooks.Building = append(c.hooks.Building, hooks...)\n}", "func (c *PlaylistClient) Use(hooks ...Hook) {\n\tc.hooks.Playlist = append(c.hooks.Playlist, hooks...)\n}", "func (c *Client) Use(hooks ...Hook) {\n\tc.Eatinghistory.Use(hooks...)\n\tc.Foodmenu.Use(hooks...)\n\tc.Mealplan.Use(hooks...)\n\tc.Taste.Use(hooks...)\n\tc.User.Use(hooks...)\n}", "func (c *DepositClient) Use(hooks ...Hook) {\n\tc.hooks.Deposit = append(c.hooks.Deposit, hooks...)\n}", "func (c *Client) Use(hooks ...Hook) {\n\tc.Admin.Use(hooks...)\n\tc.AdminSession.Use(hooks...)\n\tc.Category.Use(hooks...)\n\tc.Post.Use(hooks...)\n\tc.PostAttachment.Use(hooks...)\n\tc.PostImage.Use(hooks...)\n\tc.PostThumbnail.Use(hooks...)\n\tc.PostVideo.Use(hooks...)\n\tc.UnsavedPost.Use(hooks...)\n\tc.UnsavedPostAttachment.Use(hooks...)\n\tc.UnsavedPostImage.Use(hooks...)\n\tc.UnsavedPostThumbnail.Use(hooks...)\n\tc.UnsavedPostVideo.Use(hooks...)\n}", "func (c *PaymentClient) Use(hooks ...Hook) {\n\tc.hooks.Payment = append(c.hooks.Payment, hooks...)\n}", "func (c *PaymentClient) Use(hooks ...Hook) {\n\tc.hooks.Payment = append(c.hooks.Payment, hooks...)\n}", "func (c *OrderClient) Use(hooks ...Hook) {\n\tc.hooks.Order = append(c.hooks.Order, hooks...)\n}", "func (c *DoctorClient) Use(hooks ...Hook) {\n\tc.hooks.Doctor = append(c.hooks.Doctor, hooks...)\n}", "func (c *MedicineTypeClient) Use(hooks ...Hook) {\n\tc.hooks.MedicineType = append(c.hooks.MedicineType, hooks...)\n}", "func (c *ClubapplicationClient) Use(hooks ...Hook) {\n\tc.hooks.Clubapplication = append(c.hooks.Clubapplication, hooks...)\n}", "func (c *PledgeClient) Use(hooks ...Hook) {\n\tc.hooks.Pledge = append(c.hooks.Pledge, hooks...)\n}", "func (c *CategoryClient) Use(hooks ...Hook) {\n\tc.hooks.Category = append(c.hooks.Category, hooks...)\n}", "func (c *UsertypeClient) Use(hooks ...Hook) {\n\tc.hooks.Usertype = append(c.hooks.Usertype, hooks...)\n}", "func (c *DrugAllergyClient) Use(hooks ...Hook) {\n\tc.hooks.DrugAllergy = append(c.hooks.DrugAllergy, hooks...)\n}", "func (c *JobpositionClient) Use(hooks ...Hook) {\n\tc.hooks.Jobposition = append(c.hooks.Jobposition, hooks...)\n}", "func (c *UserStatusClient) Use(hooks ...Hook) {\n\tc.hooks.UserStatus = append(c.hooks.UserStatus, hooks...)\n}", "func (c *PatientInfoClient) Use(hooks ...Hook) {\n\tc.hooks.PatientInfo = append(c.hooks.PatientInfo, hooks...)\n}", "func (c *ClubappStatusClient) Use(hooks ...Hook) {\n\tc.hooks.ClubappStatus = append(c.hooks.ClubappStatus, hooks...)\n}", "func (c *PartClient) Use(hooks ...Hook) {\n\tc.hooks.Part = append(c.hooks.Part, hooks...)\n}", "func withHooks[V Value, M any, PM interface {\n\t*M\n\tMutation\n}](ctx context.Context, exec func(context.Context) (V, error), mutation PM, hooks []Hook) (value V, err error) {\n\tif len(hooks) == 0 {\n\t\treturn exec(ctx)\n\t}\n\tvar mut Mutator = MutateFunc(func(ctx context.Context, m Mutation) (Value, error) {\n\t\tmutationT, ok := m.(PM)\n\t\tif !ok {\n\t\t\treturn nil, fmt.Errorf(\"unexpected mutation type %T\", m)\n\t\t}\n\t\t// Set the mutation to the builder.\n\t\t*mutation = *mutationT\n\t\treturn exec(ctx)\n\t})\n\tfor i := len(hooks) - 1; i >= 0; i-- {\n\t\tif hooks[i] == nil {\n\t\t\treturn value, fmt.Errorf(\"ent: uninitialized hook (forgotten import ent/runtime?)\")\n\t\t}\n\t\tmut = hooks[i](mut)\n\t}\n\tv, err := mut.Mutate(ctx, mutation)\n\tif err != nil {\n\t\treturn value, err\n\t}\n\tnv, ok := v.(V)\n\tif !ok {\n\t\treturn value, fmt.Errorf(\"unexpected node type %T returned from %T\", v, mutation)\n\t}\n\treturn nv, nil\n}", "func (c *PrescriptionClient) Use(hooks ...Hook) {\n\tc.hooks.Prescription = append(c.hooks.Prescription, hooks...)\n}", "func (c *Client) Use(hooks ...Hook) {\n\tc.Event.Use(hooks...)\n\tc.Tag.Use(hooks...)\n}", "func (User) Hooks() []ent.Hook {\n\treturn []ent.Hook{\n\t\thook.If(\n\t\t\tfunc(next ent.Mutator) ent.Mutator {\n\t\t\t\treturn hook.UserFunc(func(ctx context.Context, m *gen.UserMutation) (gen.Value, error) {\n\t\t\t\t\tv, ok := m.Name()\n\t\t\t\t\tif !ok || v == \"\" {\n\t\t\t\t\t\treturn nil, errors.New(\"unexpected 'name' value\")\n\t\t\t\t\t}\n\t\t\t\t\tc, err := m.SecretsKeeper.Encrypt(ctx, []byte(v))\n\t\t\t\t\tif err != nil {\n\t\t\t\t\t\treturn nil, err\n\t\t\t\t\t}\n\t\t\t\t\tm.SetName(hex.EncodeToString(c))\n\t\t\t\t\tu, err := next.Mutate(ctx, m)\n\t\t\t\t\tif err != nil {\n\t\t\t\t\t\treturn nil, err\n\t\t\t\t\t}\n\t\t\t\t\tif u, ok := u.(*gen.User); ok {\n\t\t\t\t\t\t// Another option, is to assign `u.Name = v` here.\n\t\t\t\t\t\terr = decrypt(ctx, m.SecretsKeeper, u)\n\t\t\t\t\t}\n\t\t\t\t\treturn u, err\n\t\t\t\t})\n\t\t\t},\n\t\t\thook.HasFields(\"name\"),\n\t\t),\n\t}\n}", "func (c *ExaminationroomClient) Use(hooks ...Hook) {\n\tc.hooks.Examinationroom = append(c.hooks.Examinationroom, hooks...)\n}", "func (c *ActivitiesClient) Use(hooks ...Hook) {\n\tc.hooks.Activities = append(c.hooks.Activities, hooks...)\n}", "func (c *ComplaintTypeClient) Use(hooks ...Hook) {\n\tc.hooks.ComplaintType = append(c.hooks.ComplaintType, hooks...)\n}", "func (c *PartorderClient) Use(hooks ...Hook) {\n\tc.hooks.Partorder = append(c.hooks.Partorder, hooks...)\n}" ]
[ "0.72392154", "0.69364417", "0.6759705", "0.67455095", "0.6743306", "0.6650604", "0.6635697", "0.65960044", "0.6576177", "0.6569118", "0.65428495", "0.65388393", "0.65333825", "0.65333825", "0.65332985", "0.65323704", "0.65017503", "0.64964974", "0.64940006", "0.64940006", "0.64923733", "0.64862823", "0.6484851", "0.6484124", "0.6482883", "0.64785457", "0.6468592", "0.6454551", "0.6435506", "0.6427764", "0.6427764", "0.6427764", "0.64225143", "0.64225143", "0.64225143", "0.64225143", "0.64225143", "0.64225143", "0.64225143", "0.64225143", "0.64225143", "0.64225143", "0.64225143", "0.6416668", "0.6398007", "0.6382136", "0.6382136", "0.6382136", "0.6375049", "0.63666224", "0.6361996", "0.63527304", "0.6351567", "0.6351567", "0.6351567", "0.63515085", "0.63448745", "0.63442326", "0.63418376", "0.6332038", "0.6329554", "0.630474", "0.6303363", "0.62954086", "0.62954086", "0.62936056", "0.62936056", "0.62936056", "0.62762964", "0.6254982", "0.62536114", "0.6235295", "0.6232612", "0.62325174", "0.6230002", "0.62280047", "0.621809", "0.6214448", "0.6214448", "0.6207747", "0.6205952", "0.6190797", "0.61854976", "0.6174027", "0.61723155", "0.6164372", "0.6164272", "0.6163345", "0.6149417", "0.6130638", "0.61263007", "0.6126084", "0.6122146", "0.6118288", "0.61132866", "0.61094326", "0.61084", "0.608907", "0.60628116", "0.6056913" ]
0.6542983
10
Create returns a create builder for AdminSession.
func (c *AdminSessionClient) Create() *AdminSessionCreate { mutation := newAdminSessionMutation(c.config, OpCreate) return &AdminSessionCreate{config: c.config, hooks: c.Hooks(), mutation: mutation} }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (c *AdminClient) Create() *AdminCreate {\n\tmutation := newAdminMutation(c.config, OpCreate)\n\treturn &AdminCreate{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func New(db *gorm.DB, prefix, cookiesecret string) *Admin {\n\tadminpath := filepath.Join(prefix, \"/admin\")\n\ta := Admin{\n\t\tdb: db,\n\t\tprefix: prefix,\n\t\tadminpath: adminpath,\n\t\tauth: auth{\n\t\t\tdb: db,\n\t\t\tpaths: pathConfig{\n\t\t\t\tadmin: adminpath,\n\t\t\t\tlogin: filepath.Join(prefix, \"/login\"),\n\t\t\t\tlogout: filepath.Join(prefix, \"/logout\"),\n\t\t\t},\n\t\t\tsession: sessionConfig{\n\t\t\t\tkey: \"userid\",\n\t\t\t\tname: \"admsession\",\n\t\t\t\tstore: cookie.NewStore([]byte(cookiesecret)),\n\t\t\t},\n\t\t},\n\t}\n\ta.adm = admin.New(&admin.AdminConfig{\n\t\tSiteName: \"My Admin Interface\",\n\t\tDB: db,\n\t\tAuth: a.auth,\n\t\tAssetFS: bindatafs.AssetFS.NameSpace(\"admin\"),\n\t})\n\taddUser(a.adm)\n\tresources.AddProduct(a.adm)\n\treturn &a\n}", "func AdminCreate(w http.ResponseWriter, data interface{}) {\n\trender(tpAdminCreate, w, data)\n}", "func AdminCreate(w http.ResponseWriter, data interface{}) {\n\trender(tpAdminCreate, w, data)\n}", "func (ct *customer) CreateAdmin(c echo.Context) error {\n\tpanic(\"implement me later on\")\n}", "func (c *SessionClient) Create() *SessionCreate {\n\tmutation := newSessionMutation(c.config, OpCreate)\n\treturn &SessionCreate{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func CreateAdmin(w http.ResponseWriter, r *http.Request) {\n\tvar body CreateAdminRequest\n\tif err := read.JSON(r.Body, &body); err != nil {\n\t\trender.Error(w, admin.WrapError(admin.ErrorBadRequestType, err, \"error reading request body\"))\n\t\treturn\n\t}\n\n\tif err := body.Validate(); err != nil {\n\t\trender.Error(w, err)\n\t\treturn\n\t}\n\n\tauth := mustAuthority(r.Context())\n\tp, err := auth.LoadProvisionerByName(body.Provisioner)\n\tif err != nil {\n\t\trender.Error(w, admin.WrapErrorISE(err, \"error loading provisioner %s\", body.Provisioner))\n\t\treturn\n\t}\n\tadm := &linkedca.Admin{\n\t\tProvisionerId: p.GetID(),\n\t\tSubject: body.Subject,\n\t\tType: body.Type,\n\t}\n\t// Store to authority collection.\n\tif err := auth.StoreAdmin(r.Context(), adm, p); err != nil {\n\t\trender.Error(w, admin.WrapErrorISE(err, \"error storing admin\"))\n\t\treturn\n\t}\n\n\trender.ProtoJSONStatus(w, adm, http.StatusCreated)\n}", "func (a *Admin) Create(c *gin.Context) {\n\n\tflash := helper.GetFlash(c)\n\n\tc.HTML(http.StatusOK, \"admin/create\", gin.H{\n\t\t\"title\": \"创建管理员\",\n\t\t\"flash\": flash,\n\t})\n}", "func (app *accessBuilder) Create() AccessBuilder {\n\treturn createAccessBuilder()\n}", "func (v AdminsResource) Create(c buffalo.Context) error {\n\t// Allocate an empty Admin\n\tadmin := &models.Admin{}\n\n\t// Bind admin to the html form elements\n\tif err := c.Bind(admin); err != nil {\n\t\treturn errors.WithStack(err)\n\t}\n\n\t// Get the DB connection from the context\n\ttx, ok := c.Value(\"tx\").(*pop.Connection)\n\tif !ok {\n\t\treturn errors.WithStack(errors.New(\"no transaction found\"))\n\t}\n\n\th, err := generatePasswordHash(admin.Password)\n\tif err != nil {\n\t\treturn err\n\t}\n\tadmin.Password = h\n\t// Validate the data from the html form\n\tverrs, err := tx.ValidateAndCreate(admin)\n\tif err != nil {\n\t\treturn errors.WithStack(err)\n\t}\n\n\tif verrs.HasAny() {\n\t\t// Make the errors available inside the response\n\t\tc.Set(\"errors\", verrs)\n\n\t\treturn c.Render(422, r.JSON(admin))\n\t}\n\n\treturn c.Render(201, r.JSON(admin))\n}", "func (orm *ORM) CreateAdmin(ctx context.Context, name string, email string, password string, role string, createdBy *string, phone *string) (*models.Admin, error) {\n\t_Admin := models.Admin{\n\t\tFullName: name,\n\t\tEmail: email,\n\t\tPassword: password,\n\t\tPhone: phone,\n\t\tRole: role,\n\t\tCreatedByID: createdBy,\n\t}\n\t_Result := orm.DB.DB.Select(\"FullName\", \"Email\", \"Password\", \"Phone\", \"Role\", \"CreatedByID\").Create(&_Admin)\n\tif _Result.Error != nil {\n\t\treturn nil, _Result.Error\n\t}\n\treturn &_Admin, nil\n}", "func CreateAdmin(a AdminRegForm) (*mongo.InsertOneResult, error) {\n\tnewAdmin := Admin{\n\t\tID: primitive.NewObjectID(),\n\t\tFrasUsername: a.FrasUsername,\n\t\tPassword: a.Password,\n\t\tInstID: a.InstID,\n\t\tModifiedAt: time.Now(),\n\t}\n\treturn adminCollection.InsertOne(context.TODO(), newAdmin)\n}", "func (s *rpcServer) CreateAdmin(ctx context.Context, req *api.CreateAdminRequest) (*api.CreateAdminResponse, error) {\n\tlogger := log.GetLogger(ctx)\n\ta, _ := admin.ByEmail(req.Email)\n\tif a != nil {\n\t\treturn nil, fmt.Errorf(\"email %s already exists\", req.Email)\n\t}\n\ta = admin.New(req.Name, req.Email, req.PasswordPlainText)\n\tif err := a.Register(); err != nil {\n\t\tlogger.Errorf(\"error while registering admin: %v\", err)\n\t\treturn nil, err\n\t}\n\tlogger.Debugf(\"%+v\", a)\n\treturn &api.CreateAdminResponse{\n\t\tAdmin: &api.Admin{\n\t\t\tId: a.ID,\n\t\t\tName: a.Name,\n\t\t\tEmail: a.Email,\n\t\t\tACL: a.ACL,\n\t\t},\n\t}, nil\n}", "func (m *GraphBaseServiceClient) Admin()(*i7c9d1b36ac198368c1d8bed014b43e2a518b170ee45bf02c8bbe64544a50539a.AdminRequestBuilder) {\n return i7c9d1b36ac198368c1d8bed014b43e2a518b170ee45bf02c8bbe64544a50539a.NewAdminRequestBuilderInternal(m.pathParameters, m.requestAdapter);\n}", "func (m *GraphBaseServiceClient) Admin()(*i7c9d1b36ac198368c1d8bed014b43e2a518b170ee45bf02c8bbe64544a50539a.AdminRequestBuilder) {\n return i7c9d1b36ac198368c1d8bed014b43e2a518b170ee45bf02c8bbe64544a50539a.NewAdminRequestBuilderInternal(m.pathParameters, m.requestAdapter);\n}", "func (c *RoomuseClient) Create() *RoomuseCreate {\n\tmutation := newRoomuseMutation(c.config, OpCreate)\n\treturn &RoomuseCreate{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *MealplanClient) Create() *MealplanCreate {\n\tmutation := newMealplanMutation(c.config, OpCreate)\n\treturn &MealplanCreate{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (admin *Admin) CreateAdmin(db *gorm.DB) (*Admin, error) {\n\n\terr := db.Debug().Create(&admin).Error\n\tif err != nil {\n\t\treturn &Admin{}, err\n\t}\n\n\treturn admin, nil\n}", "func (c *PatientroomClient) Create() *PatientroomCreate {\n\tmutation := newPatientroomMutation(c.config, OpCreate)\n\treturn &PatientroomCreate{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (app *builder) Create() Builder {\n\treturn createBuilder(\n\t\tapp.hashAdapter,\n\t\tapp.pkAdapter,\n\t)\n}", "func (c *RoomClient) Create() *RoomCreate {\n\tmutation := newRoomMutation(c.config, OpCreate)\n\treturn &RoomCreate{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *RoomClient) Create() *RoomCreate {\n\tmutation := newRoomMutation(c.config, OpCreate)\n\treturn &RoomCreate{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *RoomdetailClient) Create() *RoomdetailCreate {\n\tmutation := newRoomdetailMutation(c.config, OpCreate)\n\treturn &RoomdetailCreate{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (us *UserAppSession) Create() error {\n\tif err := db().Create(&us).Error; err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "func (c *CleaningroomClient) Create() *CleaningroomCreate {\n\tmutation := newCleaningroomMutation(c.config, OpCreate)\n\treturn &CleaningroomCreate{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *DeviceClient) Create() *DeviceCreate {\n\tmutation := newDeviceMutation(c.config, OpCreate)\n\treturn &DeviceCreate{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *DoctorClient) Create() *DoctorCreate {\n\tmutation := newDoctorMutation(c.config, OpCreate)\n\treturn &DoctorCreate{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (app *builder) Create() Builder {\n\treturn createBuilder()\n}", "func (app *builder) Create() Builder {\n\treturn createBuilder()\n}", "func (ad *Admin) Create() error {\n\tif ad.dbCollection == nil {\n\t\treturn errors.New(\"Uninitialized Object Admin\")\n\t}\n\ttz, _ := utils.GetTimeZone()\n\tad.Timestamp = time.Now().In(tz).Format(time.ANSIC)\n\treturn ad.dbCollection.Insert(ad)\n}", "func (c *PhysicianClient) Create() *PhysicianCreate {\n\tmutation := newPhysicianMutation(c.config, OpCreate)\n\treturn &PhysicianCreate{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *PhysicianClient) Create() *PhysicianCreate {\n\tmutation := newPhysicianMutation(c.config, OpCreate)\n\treturn &PhysicianCreate{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *ExaminationroomClient) Create() *ExaminationroomCreate {\n\tmutation := newExaminationroomMutation(c.config, OpCreate)\n\treturn &ExaminationroomCreate{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (app *builder) Create() Builder {\n\treturn createBuilder(app.hashAdapter, app.immutableBuilder)\n}", "func (adminrepo *AdminRepo) CreateAdmin(admin *entity.Admin) (*entity.Admin, error) {\n\tinsertOneResult, era := adminrepo.DB.Collection(entity.ADMIN).InsertOne(context.TODO(), admin)\n\tif era != nil {\n\t\treturn admin, era\n\t}\n\tresult := Helper.ObjectIDFromInsertResult(insertOneResult)\n\tif result != \"\" {\n\t\tadmin.ID = result\n\t}\n\treturn admin, nil\n}", "func (c *FoodmenuClient) Create() *FoodmenuCreate {\n\tmutation := newFoodmenuMutation(c.config, OpCreate)\n\treturn &FoodmenuCreate{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *LevelOfDangerousClient) Create() *LevelOfDangerousCreate {\n\tmutation := newLevelOfDangerousMutation(c.config, OpCreate)\n\treturn &LevelOfDangerousCreate{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (a *Admin) Create() (*mongo.InsertOneResult, error) {\n\ta.CreatedAt = variable.DateTimeNowPtr()\n\ta.ModifiedAt = variable.DateTimeNowPtr()\n\treturn a.Collection().InsertOne(context.Background(), *a)\n}", "func (app *builder) Create() Builder {\n\treturn createBuilder(app.hashAdapter, app.minPubKeysInOwner)\n}", "func (c *BuildingClient) Create() *BuildingCreate {\n\tmutation := newBuildingMutation(c.config, OpCreate)\n\treturn &BuildingCreate{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (app *builder) Create() Builder {\n\treturn createBuilder(app.immutableBuilder)\n}", "func (app *builder) Create() Builder {\n\treturn createBuilder(app.immutableBuilder)\n}", "func (c *OperativeClient) Create() *OperativeCreate {\n\tmutation := newOperativeMutation(c.config, OpCreate)\n\treturn &OperativeCreate{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (app *builder) Create() Builder {\n\treturn createBuilder(app.hashAdapter)\n}", "func (app *builder) Create() Builder {\n\treturn createBuilder(app.hashAdapter)\n}", "func (c *BedtypeClient) Create() *BedtypeCreate {\n\tmutation := newBedtypeMutation(c.config, OpCreate)\n\treturn &BedtypeCreate{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *MedicineTypeClient) Create() *MedicineTypeCreate {\n\tmutation := newMedicineTypeMutation(c.config, OpCreate)\n\treturn &MedicineTypeCreate{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (app *adapterBuilder) Create() AdapterBuilder {\n\treturn createAdapterBuilder()\n}", "func (c *OperationroomClient) Create() *OperationroomCreate {\n\tmutation := newOperationroomMutation(c.config, OpCreate)\n\treturn &OperationroomCreate{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func Create(c echo.Context, userInfo *multi_tenant.UserInfo) error {\n\ts, _ := Get(c)\n\n\ts.Options = &sessions.Options{\n\t\tPath: \"/\",\n\t\tMaxAge: 0,\n\t\tHttpOnly: true,\n\t\tSecure: true,\n\t\t// SameSite: http.SameSiteLaxMode,\n\t}\n\n\ts.Values[\"authenticated\"] = true\n\ts.Values[\"username\"] = userInfo.Username\n\ts.Values[\"userinfo\"] = *userInfo\n\ts.Values[\"customer\"] = userInfo.Customer\n\n\terr := s.Save(c.Request(), c.Response())\n\tif err != nil {\n\t\tglog.Errorf(\"Failed to save session: %v\", err)\n\t\treturn c.NoContent(http.StatusInternalServerError)\n\t}\n\n\treturn nil\n}", "func (c *UnitOfMedicineClient) Create() *UnitOfMedicineCreate {\n\tmutation := newUnitOfMedicineMutation(c.config, OpCreate)\n\treturn &UnitOfMedicineCreate{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (s *SecretStore) Admin() *AdminStore {\n\treturn &AdminStore{secretStore: s}\n}", "func (s *Session) Create(name string, cfg ...DataSourceCfg) error {\n\tnameC := C.CString(name)\n\tdefer C.free(unsafe.Pointer(nameC))\n\tcfgC := configC(cfg)\n\tif r := C.wt_session_create(s.s, nameC, cfgC); r != 0 {\n\t\treturn wtError(r)\n\t}\n\treturn nil\n}", "func (app *builder) Create() Builder {\n\treturn createBuilder(app.eventsAdapter)\n}", "func (v AdminsResource) New(c buffalo.Context) error {\n\treturn c.Render(200, r.JSON(&models.Admin{}))\n}", "func New(c *conf.Config) (dao *Dao) {\n\tdao = &Dao{\n\t\tc: c,\n\t\tRoomApi: room_api.New(getConf(\"room\")),\n\t\tUserApi: user_api.New(getConf(\"user\")),\n\t\tRelationApi: relation_api.New(getConf(\"relation\")),\n\t\tFansMedalApi: fans_medal_api.New(getConf(\"fans_medal\")),\n\t\tHttpCli: bm.NewClient(c.HttpClient),\n\t}\n\tMemberCli, err := member_cli.NewClient(c.GrpcCli)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tdao.memberCli = MemberCli\n\n\tTitansCli, errTitans := resource_cli.NewClient(c.GrpcCli)\n\tif errTitans != nil {\n\t\tpanic(err)\n\t}\n\tdao.titansCli = TitansCli\n\treturn\n}", "func (c *AdminSessionClient) CreateBulk(builders ...*AdminSessionCreate) *AdminSessionCreateBulk {\n\treturn &AdminSessionCreateBulk{config: c.config, builders: builders}\n}", "func (c *MedicineClient) Create() *MedicineCreate {\n\tmutation := newMedicineMutation(c.config, OpCreate)\n\treturn &MedicineCreate{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *UserClient) Create() *UserCreate {\n\tmutation := newUserMutation(c.config, OpCreate)\n\treturn &UserCreate{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *UserClient) Create() *UserCreate {\n\tmutation := newUserMutation(c.config, OpCreate)\n\treturn &UserCreate{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *UserClient) Create() *UserCreate {\n\tmutation := newUserMutation(c.config, OpCreate)\n\treturn &UserCreate{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *UserClient) Create() *UserCreate {\n\tmutation := newUserMutation(c.config, OpCreate)\n\treturn &UserCreate{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *UserClient) Create() *UserCreate {\n\tmutation := newUserMutation(c.config, OpCreate)\n\treturn &UserCreate{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *UserClient) Create() *UserCreate {\n\tmutation := newUserMutation(c.config, OpCreate)\n\treturn &UserCreate{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *UserClient) Create() *UserCreate {\n\tmutation := newUserMutation(c.config, OpCreate)\n\treturn &UserCreate{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *UserClient) Create() *UserCreate {\n\tmutation := newUserMutation(c.config, OpCreate)\n\treturn &UserCreate{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *UserClient) Create() *UserCreate {\n\tmutation := newUserMutation(c.config, OpCreate)\n\treturn &UserCreate{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *UserClient) Create() *UserCreate {\n\tmutation := newUserMutation(c.config, OpCreate)\n\treturn &UserCreate{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *UserClient) Create() *UserCreate {\n\tmutation := newUserMutation(c.config, OpCreate)\n\treturn &UserCreate{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func CreateSessionBuilder(apiKeyID, secretAPIKey, integrator string) (*communicator.SessionBuilder, error) {\n\tconfiguration, err := CreateConfiguration(apiKeyID, secretAPIKey, integrator)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn CreateSessionBuilderFromConfiguration(configuration)\n}", "func (a *AdminStore) CreateOrUpdate(c *cephclient.ClusterInfo) error {\n\tkeyring := fmt.Sprintf(adminKeyringTemplate, c.CephCred.Secret)\n\treturn a.secretStore.CreateOrUpdate(adminKeyringResourceName, keyring)\n}", "func (*AdminInfoService) NewAdmin(id int, pwd string, name string) *entities.AdminInfo {\n\tadmin := &entities.AdminInfo{\n\t\tAdminId: id,\n\t\tAdminPwd: pwd,\n\t\tAdminName: name,\n\t}\n\treturn admin\n}", "func (s *Session) Create(q db.Queryable) error {\n\tif s == nil {\n\t\treturn apperror.NewServerError(\"session is nil\")\n\t}\n\n\tif s.ID != \"\" {\n\t\treturn apperror.NewServerError(\"sessions cannot be updated\")\n\t}\n\n\tif s.UserID == \"\" {\n\t\treturn apperror.NewServerError(\"cannot save a session with no user id\")\n\t}\n\n\treturn s.doCreate(q)\n}", "func (c *ClubapplicationClient) Create() *ClubapplicationCreate {\n\tmutation := newClubapplicationMutation(c.config, OpCreate)\n\treturn &ClubapplicationCreate{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func NewAdmin(opts *ServerOptions) (string, *elton.Elton) {\n\tcfg := opts.cfg\n\tadminConfig, _ := cfg.GetAdmin()\n\tif adminConfig == nil {\n\t\treturn \"\", nil\n\t}\n\tadminPath := defaultAdminPath\n\tif adminConfig.Prefix != \"\" {\n\t\tadminPath = adminConfig.Prefix\n\t}\n\n\te := elton.New()\n\n\tif adminConfig != nil {\n\t\te.Use(newAdminValidateMiddlewares(adminConfig)...)\n\t}\n\tcompressConfig := middleware.NewCompressConfig(\n\t\tnew(compress.BrCompressor),\n\t\tnew(middleware.GzipCompressor),\n\t)\n\te.Use(middleware.NewCompress(compressConfig))\n\n\te.Use(middleware.NewDefaultFresh())\n\te.Use(middleware.NewDefaultETag())\n\n\te.Use(middleware.NewDefaultError())\n\te.Use(middleware.NewDefaultResponder())\n\te.Use(middleware.NewDefaultBodyParser())\n\n\tg := elton.NewGroup(adminPath)\n\n\t// 按分类获取配置\n\tg.GET(\"/configs/{category}\", newGetConfigHandler(cfg))\n\t// 添加与更新使用相同处理\n\tg.POST(\"/configs/{category}\", newCreateOrUpdateConfigHandler(cfg))\n\t// 删除配置\n\tg.DELETE(\"/configs/{category}/{name}\", newDeleteConfigHandler(cfg))\n\n\tfiles := new(assetFiles)\n\n\tg.GET(\"/\", func(c *elton.Context) (err error) {\n\t\tfile := \"index.html\"\n\t\tbuf, err := files.Get(file)\n\t\tif err != nil {\n\t\t\treturn\n\t\t}\n\t\tc.SetContentTypeByExt(file)\n\t\tc.BodyBuffer = bytes.NewBuffer(buf)\n\t\treturn\n\t})\n\n\ticons := []string{\n\t\t\"favicon.ico\",\n\t\t\"logo.png\",\n\t}\n\thandleIcon := func(icon string) {\n\t\tg.GET(\"/\"+icon, func(c *elton.Context) (err error) {\n\t\t\tbuf, err := application.DefaultAsset().Find(icon)\n\t\t\tif err != nil {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tc.SetContentTypeByExt(icon)\n\t\t\tc.Body = buf\n\t\t\treturn\n\t\t})\n\t}\n\tfor _, icon := range icons {\n\t\thandleIcon(icon)\n\t}\n\n\tg.GET(\"/static/*\", middleware.NewStaticServe(files, middleware.StaticServeConfig{\n\t\tPath: \"/static\",\n\t\t// 客户端缓存一年\n\t\tMaxAge: 365 * 24 * 3600,\n\t\t// 缓存服务器缓存一个小时\n\t\tSMaxAge: 60 * 60,\n\t\tDenyQueryString: true,\n\t\tDisableLastModified: true,\n\t}))\n\n\t// 获取应用状态\n\tg.GET(\"/application\", func(c *elton.Context) error {\n\t\tc.Body = application.Default()\n\t\treturn nil\n\t})\n\n\t// 获取upstream的状态\n\tg.GET(\"/upstreams\", func(c *elton.Context) error {\n\t\tc.Body = opts.upstreams.Status()\n\t\treturn nil\n\t})\n\n\t// 上传\n\tg.POST(\"/upload\", func(c *elton.Context) (err error) {\n\t\tfile, fileHeader, err := c.Request.FormFile(\"file\")\n\t\tif err != nil {\n\t\t\treturn\n\t\t}\n\t\tbuf, err := ioutil.ReadAll(file)\n\t\tif err != nil {\n\t\t\treturn\n\t\t}\n\t\tc.Body = map[string]string{\n\t\t\t\"contentType\": fileHeader.Header.Get(\"Content-Type\"),\n\t\t\t\"data\": base64.StdEncoding.EncodeToString(buf),\n\t\t}\n\t\treturn\n\t})\n\t// alarm 测试\n\tg.POST(\"/alarms/{name}/try\", func(c *elton.Context) (err error) {\n\t\tname := c.Param(\"name\")\n\t\talarms, err := cfg.GetAlarms()\n\t\tif err != nil {\n\t\t\treturn\n\t\t}\n\t\talarm := alarms.Get(name)\n\t\tif alarm == nil {\n\t\t\terr = hes.New(\"alarm is nil, please check the alarm configs\")\n\t\t\treturn\n\t\t}\n\t\terr = alarmHandle(alarm, nil)\n\t\tif err != nil {\n\t\t\treturn\n\t\t}\n\t\tc.NoContent()\n\t\treturn\n\t})\n\n\t// list caches 获取缓存列表\n\tg.GET(\"/caches/{name}\", func(c *elton.Context) (err error) {\n\t\tdisp := opts.dispatchers.Get(c.Param(\"name\"))\n\t\tif disp == nil {\n\t\t\terr = hes.New(\"cache not found\")\n\t\t\treturn\n\t\t}\n\t\tstatus, _ := strconv.Atoi(c.QueryParam(\"status\"))\n\t\tlimit, _ := strconv.Atoi(c.QueryParam(\"limit\"))\n\t\tif status <= 0 {\n\t\t\tstatus = cache.StatusCacheable\n\t\t}\n\t\tif limit <= 0 {\n\t\t\tlimit = 100\n\t\t}\n\n\t\tc.Body = disp.List(status, limit, c.QueryParam(\"keyword\"))\n\t\treturn\n\t})\n\t// delete cache 删除缓存\n\tg.DELETE(\"/caches/{name}\", func(c *elton.Context) (err error) {\n\t\tdisp := opts.dispatchers.Get(c.Param(\"name\"))\n\t\tif disp == nil {\n\t\t\terr = hes.New(\"cache not found\")\n\t\t\treturn\n\t\t}\n\t\tdisp.Remove([]byte(c.QueryParam(\"key\")))\n\t\tc.NoContent()\n\t\treturn\n\t})\n\n\te.AddGroup(g)\n\treturn adminPath, e\n}", "func (_CrToken *CrTokenSession) Admin() (common.Address, error) {\n\treturn _CrToken.Contract.Admin(&_CrToken.CallOpts)\n}", "func (c *FacultyClient) Create() *FacultyCreate {\n\tmutation := newFacultyMutation(c.config, OpCreate)\n\treturn &FacultyCreate{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (_Cakevault *CakevaultCallerSession) Admin() (common.Address, error) {\n\treturn _Cakevault.Contract.Admin(&_Cakevault.CallOpts)\n}", "func (_Cakevault *CakevaultSession) Admin() (common.Address, error) {\n\treturn _Cakevault.Contract.Admin(&_Cakevault.CallOpts)\n}", "func (c *PharmacistClient) Create() *PharmacistCreate {\n\tmutation := newPharmacistMutation(c.config, OpCreate)\n\treturn &PharmacistCreate{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (_TellorMesosphere *TellorMesosphereTransactorSession) AddAdmin(_admin_address common.Address) (*types.Transaction, error) {\n\treturn _TellorMesosphere.Contract.AddAdmin(&_TellorMesosphere.TransactOpts, _admin_address)\n}", "func (_TellorMesosphere *TellorMesosphereSession) AddAdmin(_admin_address common.Address) (*types.Transaction, error) {\n\treturn _TellorMesosphere.Contract.AddAdmin(&_TellorMesosphere.TransactOpts, _admin_address)\n}", "func NewAdminReportSettings()(*AdminReportSettings) {\n m := &AdminReportSettings{\n Entity: *NewEntity(),\n }\n return m\n}", "func (c *PatientClient) Create() *PatientCreate {\n\tmutation := newPatientMutation(c.config, OpCreate)\n\treturn &PatientCreate{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *PatientClient) Create() *PatientCreate {\n\tmutation := newPatientMutation(c.config, OpCreate)\n\treturn &PatientCreate{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *PatientClient) Create() *PatientCreate {\n\tmutation := newPatientMutation(c.config, OpCreate)\n\treturn &PatientCreate{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *BeerClient) Create() *BeerCreate {\n\tmutation := newBeerMutation(c.config, OpCreate)\n\treturn &BeerCreate{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func NewCreateanewAdminRequestWithBody(server string, contentType string, body io.Reader) (*http.Request, error) {\n\tvar err error\n\n\tqueryUrl, err := url.Parse(server)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tbasePath := fmt.Sprintf(\"/admins\")\n\tif basePath[0] == '/' {\n\t\tbasePath = basePath[1:]\n\t}\n\n\tqueryUrl, err = queryUrl.Parse(basePath)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treq, err := http.NewRequest(\"POST\", queryUrl.String(), body)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treq.Header.Add(\"Content-Type\", contentType)\n\treturn req, nil\n}", "func (app *folderNameBuilder) Create() FolderNameBuilder {\n\treturn createFolderNameBuilder()\n}", "func (c *UsertypeClient) Create() *UsertypeCreate {\n\tmutation := newUsertypeMutation(c.config, OpCreate)\n\treturn &UsertypeCreate{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *PatientofphysicianClient) Create() *PatientofphysicianCreate {\n\tmutation := newPatientofphysicianMutation(c.config, OpCreate)\n\treturn &PatientofphysicianCreate{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (app *externalBuilder) Create() ExternalBuilder {\n\treturn createExternalBuilder()\n}", "func (app *updateBuilder) Create() UpdateBuilder {\n\treturn createUpdateBuilder()\n}", "func (_CrToken *CrTokenCallerSession) Admin() (common.Address, error) {\n\treturn _CrToken.Contract.Admin(&_CrToken.CallOpts)\n}", "func (fac *BuilderFactory) Create() met.Builder {\n\tout := createBuilder()\n\treturn out\n}", "func NewCreateanewAdminRequest(server string, body CreateanewAdminJSONRequestBody) (*http.Request, error) {\n\tvar bodyReader io.Reader\n\tbuf, err := json.Marshal(body)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tbodyReader = bytes.NewReader(buf)\n\treturn NewCreateanewAdminRequestWithBody(server, \"application/json\", bodyReader)\n}", "func (c *DepartmentClient) Create() *DepartmentCreate {\n\tmutation := newDepartmentMutation(c.config, OpCreate)\n\treturn &DepartmentCreate{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *EmployeeClient) Create() *EmployeeCreate {\n\tmutation := newEmployeeMutation(c.config, OpCreate)\n\treturn &EmployeeCreate{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *EmployeeClient) Create() *EmployeeCreate {\n\tmutation := newEmployeeMutation(c.config, OpCreate)\n\treturn &EmployeeCreate{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *EmployeeClient) Create() *EmployeeCreate {\n\tmutation := newEmployeeMutation(c.config, OpCreate)\n\treturn &EmployeeCreate{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}" ]
[ "0.6767567", "0.6493836", "0.5939498", "0.5939498", "0.58978933", "0.5886645", "0.58576316", "0.5851143", "0.5770013", "0.5679461", "0.56770587", "0.556578", "0.5468564", "0.54221374", "0.54221374", "0.54126585", "0.54118323", "0.53448564", "0.5296831", "0.5290115", "0.5282211", "0.5282211", "0.5243839", "0.5232128", "0.5222793", "0.5204449", "0.5196711", "0.5180917", "0.5180917", "0.51759315", "0.5164481", "0.5164481", "0.5156372", "0.5155615", "0.5129022", "0.5100055", "0.5097491", "0.5087028", "0.5086341", "0.5064672", "0.5063495", "0.5063495", "0.5056725", "0.5049569", "0.5049569", "0.5048897", "0.50411564", "0.5040553", "0.50394434", "0.5037102", "0.50366795", "0.5031763", "0.50316477", "0.5029724", "0.50294226", "0.5004279", "0.500131", "0.49957395", "0.49916244", "0.49916244", "0.49916244", "0.49916244", "0.49916244", "0.49916244", "0.49916244", "0.49916244", "0.49916244", "0.49916244", "0.49916244", "0.49789914", "0.49686784", "0.49642032", "0.49531442", "0.49425632", "0.4933629", "0.49242026", "0.49215493", "0.4918632", "0.4911964", "0.49049413", "0.49031118", "0.4903055", "0.4899168", "0.48742312", "0.48742312", "0.48742312", "0.48541978", "0.48465097", "0.48442483", "0.48424944", "0.4839217", "0.48363277", "0.48337868", "0.48335114", "0.48236564", "0.48188618", "0.48029265", "0.4799026", "0.4799026", "0.4799026" ]
0.73330593
0
CreateBulk returns a builder for creating a bulk of AdminSession entities.
func (c *AdminSessionClient) CreateBulk(builders ...*AdminSessionCreate) *AdminSessionCreateBulk { return &AdminSessionCreateBulk{config: c.config, builders: builders} }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (c *AdminClient) CreateBulk(builders ...*AdminCreate) *AdminCreateBulk {\n\treturn &AdminCreateBulk{config: c.config, builders: builders}\n}", "func (c *TransactionClient) CreateBulk(builders ...*TransactionCreate) *TransactionCreateBulk {\n\treturn &TransactionCreateBulk{config: c.config, builders: builders}\n}", "func (c *OperationClient) CreateBulk(builders ...*OperationCreate) *OperationCreateBulk {\n\treturn &OperationCreateBulk{config: c.config, builders: builders}\n}", "func (c *UserClient) CreateBulk(builders ...*UserCreate) *UserCreateBulk {\n\treturn &UserCreateBulk{config: c.config, builders: builders}\n}", "func (c *UserClient) CreateBulk(builders ...*UserCreate) *UserCreateBulk {\n\treturn &UserCreateBulk{config: c.config, builders: builders}\n}", "func (c *UserClient) CreateBulk(builders ...*UserCreate) *UserCreateBulk {\n\treturn &UserCreateBulk{config: c.config, builders: builders}\n}", "func (c *UserClient) CreateBulk(builders ...*UserCreate) *UserCreateBulk {\n\treturn &UserCreateBulk{config: c.config, builders: builders}\n}", "func (c *UserClient) CreateBulk(builders ...*UserCreate) *UserCreateBulk {\n\treturn &UserCreateBulk{config: c.config, builders: builders}\n}", "func (c *UserWalletClient) CreateBulk(builders ...*UserWalletCreate) *UserWalletCreateBulk {\n\treturn &UserWalletCreateBulk{config: c.config, builders: builders}\n}", "func (c *WalletNodeClient) CreateBulk(builders ...*WalletNodeCreate) *WalletNodeCreateBulk {\n\treturn &WalletNodeCreateBulk{config: c.config, builders: builders}\n}", "func (c *KeyStoreClient) CreateBulk(builders ...*KeyStoreCreate) *KeyStoreCreateBulk {\n\treturn &KeyStoreCreateBulk{config: c.config, builders: builders}\n}", "func (c *SkillClient) CreateBulk(builders ...*SkillCreate) *SkillCreateBulk {\n\treturn &SkillCreateBulk{config: c.config, builders: builders}\n}", "func (c *DNSBLQueryClient) CreateBulk(builders ...*DNSBLQueryCreate) *DNSBLQueryCreateBulk {\n\treturn &DNSBLQueryCreateBulk{config: c.config, builders: builders}\n}", "func (c *EmptyClient) CreateBulk(builders ...*EmptyCreate) *EmptyCreateBulk {\n\treturn &EmptyCreateBulk{config: c.config, builders: builders}\n}", "func (c *VeterinarianClient) CreateBulk(builders ...*VeterinarianCreate) *VeterinarianCreateBulk {\n\treturn &VeterinarianCreateBulk{config: c.config, builders: builders}\n}", "func (c *CustomerClient) CreateBulk(builders ...*CustomerCreate) *CustomerCreateBulk {\n\treturn &CustomerCreateBulk{config: c.config, builders: builders}\n}", "func (c *BeerClient) CreateBulk(builders ...*BeerCreate) *BeerCreateBulk {\n\treturn &BeerCreateBulk{config: c.config, builders: builders}\n}", "func (c *AppointmentClient) CreateBulk(builders ...*AppointmentCreate) *AppointmentCreateBulk {\n\treturn &AppointmentCreateBulk{config: c.config, builders: builders}\n}", "func (c *JobClient) CreateBulk(builders ...*JobCreate) *JobCreateBulk {\n\treturn &JobCreateBulk{config: c.config, builders: builders}\n}", "func (c *WorkExperienceClient) CreateBulk(builders ...*WorkExperienceCreate) *WorkExperienceCreateBulk {\n\treturn &WorkExperienceCreateBulk{config: c.config, builders: builders}\n}", "func (c *PostClient) CreateBulk(builders ...*PostCreate) *PostCreateBulk {\n\treturn &PostCreateBulk{config: c.config, builders: builders}\n}", "func (c *CompanyClient) CreateBulk(builders ...*CompanyCreate) *CompanyCreateBulk {\n\treturn &CompanyCreateBulk{config: c.config, builders: builders}\n}", "func (c *CategoryClient) CreateBulk(builders ...*CategoryCreate) *CategoryCreateBulk {\n\treturn &CategoryCreateBulk{config: c.config, builders: builders}\n}", "func (c *TagClient) CreateBulk(builders ...*TagCreate) *TagCreateBulk {\n\treturn &TagCreateBulk{config: c.config, builders: builders}\n}", "func (c *EventClient) CreateBulk(builders ...*EventCreate) *EventCreateBulk {\n\treturn &EventCreateBulk{config: c.config, builders: builders}\n}", "func (c *UnsavedPostClient) CreateBulk(builders ...*UnsavedPostCreate) *UnsavedPostCreateBulk {\n\treturn &UnsavedPostCreateBulk{config: c.config, builders: builders}\n}", "func (c *IPClient) CreateBulk(builders ...*IPCreate) *IPCreateBulk {\n\treturn &IPCreateBulk{config: c.config, builders: builders}\n}", "func (c *PetClient) CreateBulk(builders ...*PetCreate) *PetCreateBulk {\n\treturn &PetCreateBulk{config: c.config, builders: builders}\n}", "func (c *UserCardClient) CreateBulk(builders ...*UserCardCreate) *UserCardCreateBulk {\n\treturn &UserCardCreateBulk{config: c.config, builders: builders}\n}", "func (c *ClinicClient) CreateBulk(builders ...*ClinicCreate) *ClinicCreateBulk {\n\treturn &ClinicCreateBulk{config: c.config, builders: builders}\n}", "func (c *BinaryFileClient) CreateBulk(builders ...*BinaryFileCreate) *BinaryFileCreateBulk {\n\treturn &BinaryFileCreateBulk{config: c.config, builders: builders}\n}", "func (c *PlaylistClient) CreateBulk(builders ...*PlaylistCreate) *PlaylistCreateBulk {\n\treturn &PlaylistCreateBulk{config: c.config, builders: builders}\n}", "func (c *CardScanClient) CreateBulk(builders ...*CardScanCreate) *CardScanCreateBulk {\n\treturn &CardScanCreateBulk{config: c.config, builders: builders}\n}", "func (c *CoinInfoClient) CreateBulk(builders ...*CoinInfoCreate) *CoinInfoCreateBulk {\n\treturn &CoinInfoCreateBulk{config: c.config, builders: builders}\n}", "func (c *DNSBLResponseClient) CreateBulk(builders ...*DNSBLResponseCreate) *DNSBLResponseCreateBulk {\n\treturn &DNSBLResponseCreateBulk{config: c.config, builders: builders}\n}", "func (c *CardClient) CreateBulk(builders ...*CardCreate) *CardCreateBulk {\n\treturn &CardCreateBulk{config: c.config, builders: builders}\n}", "func (c *MediaClient) CreateBulk(builders ...*MediaCreate) *MediaCreateBulk {\n\treturn &MediaCreateBulk{config: c.config, builders: builders}\n}", "func (c *ReviewClient) CreateBulk(builders ...*ReviewCreate) *ReviewCreateBulk {\n\treturn &ReviewCreateBulk{config: c.config, builders: builders}\n}", "func (c *PostImageClient) CreateBulk(builders ...*PostImageCreate) *PostImageCreateBulk {\n\treturn &PostImageCreateBulk{config: c.config, builders: builders}\n}", "func (c *UnsavedPostImageClient) CreateBulk(builders ...*UnsavedPostImageCreate) *UnsavedPostImageCreateBulk {\n\treturn &UnsavedPostImageCreateBulk{config: c.config, builders: builders}\n}", "func (c *PostAttachmentClient) CreateBulk(builders ...*PostAttachmentCreate) *PostAttachmentCreateBulk {\n\treturn &PostAttachmentCreateBulk{config: c.config, builders: builders}\n}", "func (c *UnsavedPostAttachmentClient) CreateBulk(builders ...*UnsavedPostAttachmentCreate) *UnsavedPostAttachmentCreateBulk {\n\treturn &UnsavedPostAttachmentCreateBulk{config: c.config, builders: builders}\n}", "func (c *PostVideoClient) CreateBulk(builders ...*PostVideoCreate) *PostVideoCreateBulk {\n\treturn &PostVideoCreateBulk{config: c.config, builders: builders}\n}", "func (c *PostThumbnailClient) CreateBulk(builders ...*PostThumbnailCreate) *PostThumbnailCreateBulk {\n\treturn &PostThumbnailCreateBulk{config: c.config, builders: builders}\n}", "func (m *Manager) BulkCreate(obj interface{}) error {\n\treturn m.Query(m.Insert().Values(obj).Returning(), obj)\n}", "func (c *UnsavedPostThumbnailClient) CreateBulk(builders ...*UnsavedPostThumbnailCreate) *UnsavedPostThumbnailCreateBulk {\n\treturn &UnsavedPostThumbnailCreateBulk{config: c.config, builders: builders}\n}", "func (c *UnsavedPostVideoClient) CreateBulk(builders ...*UnsavedPostVideoCreate) *UnsavedPostVideoCreateBulk {\n\treturn &UnsavedPostVideoCreateBulk{config: c.config, builders: builders}\n}", "func (scb *SessionCreateBulk) Save(ctx context.Context) ([]*Session, error) {\n\tspecs := make([]*sqlgraph.CreateSpec, len(scb.builders))\n\tnodes := make([]*Session, len(scb.builders))\n\tmutators := make([]Mutator, len(scb.builders))\n\tfor i := range scb.builders {\n\t\tfunc(i int, root context.Context) {\n\t\t\tbuilder := scb.builders[i]\n\t\t\tbuilder.defaults()\n\t\t\tvar mut Mutator = MutateFunc(func(ctx context.Context, m Mutation) (Value, error) {\n\t\t\t\tmutation, ok := m.(*SessionMutation)\n\t\t\t\tif !ok {\n\t\t\t\t\treturn nil, fmt.Errorf(\"unexpected mutation type %T\", m)\n\t\t\t\t}\n\t\t\t\tif err := builder.check(); err != nil {\n\t\t\t\t\treturn nil, err\n\t\t\t\t}\n\t\t\t\tbuilder.mutation = mutation\n\t\t\t\tnodes[i], specs[i] = builder.createSpec()\n\t\t\t\tvar err error\n\t\t\t\tif i < len(mutators)-1 {\n\t\t\t\t\t_, err = mutators[i+1].Mutate(root, scb.builders[i+1].mutation)\n\t\t\t\t} else {\n\t\t\t\t\tspec := &sqlgraph.BatchCreateSpec{Nodes: specs}\n\t\t\t\t\t// Invoke the actual operation on the latest mutation in the chain.\n\t\t\t\t\tif err = sqlgraph.BatchCreate(ctx, scb.driver, spec); err != nil {\n\t\t\t\t\t\tif sqlgraph.IsConstraintError(err) {\n\t\t\t\t\t\t\terr = &ConstraintError{msg: err.Error(), wrap: err}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn nil, err\n\t\t\t\t}\n\t\t\t\tmutation.id = &nodes[i].ID\n\t\t\t\tif specs[i].ID.Value != nil && nodes[i].ID == 0 {\n\t\t\t\t\tid := specs[i].ID.Value.(int64)\n\t\t\t\t\tnodes[i].ID = int32(id)\n\t\t\t\t}\n\t\t\t\tmutation.done = true\n\t\t\t\treturn nodes[i], nil\n\t\t\t})\n\t\t\tfor i := len(builder.hooks) - 1; i >= 0; i-- {\n\t\t\t\tmut = builder.hooks[i](mut)\n\t\t\t}\n\t\t\tmutators[i] = mut\n\t\t}(i, ctx)\n\t}\n\tif len(mutators) > 0 {\n\t\tif _, err := mutators[0].Mutate(ctx, scb.builders[0].mutation); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\treturn nodes, nil\n}", "func (a *DefaultApiService) BulkCreate(ctx _context.Context) ApiBulkCreateRequest {\n\treturn ApiBulkCreateRequest{\n\t\tApiService: a,\n\t\tctx: ctx,\n\t}\n}", "func (a *BulkApiService) CreateBulkExport(ctx context.Context) ApiCreateBulkExportRequest {\n\treturn ApiCreateBulkExportRequest{\n\t\tApiService: a,\n\t\tctx: ctx,\n\t}\n}", "func (client *Client) CreateBulkTransaction(txn []*CreateTransaction) (_ *Response, err error) {\n\tpath := \"/transaction_bulk\"\n\turi := fmt.Sprintf(\"%s%s\", client.apiBaseURL, path)\n\n\tif len(txn) > MaxBulkPutSize {\n\t\treturn nil, ErrMaxBulkSizeExceeded\n\t}\n\n\ttxnBytes, err := json.Marshal(txn)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treq, err := http.NewRequest(http.MethodPost, uri, bytes.NewBuffer(txnBytes))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tresp, err := client.performRequest(req, string(txnBytes))\n\treturn resp, err\n}", "func (bcb *BulkCreateBulk) Save(ctx context.Context) ([]*Bulk, error) {\n\tspecs := make([]*sqlgraph.CreateSpec, len(bcb.builders))\n\tnodes := make([]*Bulk, len(bcb.builders))\n\tmutators := make([]Mutator, len(bcb.builders))\n\tfor i := range bcb.builders {\n\t\tfunc(i int, root context.Context) {\n\t\t\tbuilder := bcb.builders[i]\n\t\t\tvar mut Mutator = MutateFunc(func(ctx context.Context, m Mutation) (Value, error) {\n\t\t\t\tmutation, ok := m.(*BulkMutation)\n\t\t\t\tif !ok {\n\t\t\t\t\treturn nil, fmt.Errorf(\"unexpected mutation type %T\", m)\n\t\t\t\t}\n\t\t\t\tif err := builder.check(); err != nil {\n\t\t\t\t\treturn nil, err\n\t\t\t\t}\n\t\t\t\tbuilder.mutation = mutation\n\t\t\t\tnodes[i], specs[i] = builder.createSpec()\n\t\t\t\tvar err error\n\t\t\t\tif i < len(mutators)-1 {\n\t\t\t\t\t_, err = mutators[i+1].Mutate(root, bcb.builders[i+1].mutation)\n\t\t\t\t} else {\n\t\t\t\t\t// Invoke the actual operation on the latest mutation in the chain.\n\t\t\t\t\tif err = sqlgraph.BatchCreate(ctx, bcb.driver, &sqlgraph.BatchCreateSpec{Nodes: specs}); err != nil {\n\t\t\t\t\t\tif cerr, ok := isSQLConstraintError(err); ok {\n\t\t\t\t\t\t\terr = cerr\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tmutation.done = true\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn nil, err\n\t\t\t\t}\n\t\t\t\tif nodes[i].ID == 0 {\n\t\t\t\t\tid := specs[i].ID.Value.(int64)\n\t\t\t\t\tnodes[i].ID = int(id)\n\t\t\t\t}\n\t\t\t\treturn nodes[i], nil\n\t\t\t})\n\t\t\tfor i := len(builder.hooks) - 1; i >= 0; i-- {\n\t\t\t\tmut = builder.hooks[i](mut)\n\t\t\t}\n\t\t\tmutators[i] = mut\n\t\t}(i, ctx)\n\t}\n\tif len(mutators) > 0 {\n\t\tif _, err := mutators[0].Mutate(ctx, bcb.builders[0].mutation); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\treturn nodes, nil\n}", "func (ccb *CampaignCreateBulk) Save(ctx context.Context) ([]*Campaign, error) {\n\tspecs := make([]*sqlgraph.CreateSpec, len(ccb.builders))\n\tnodes := make([]*Campaign, len(ccb.builders))\n\tmutators := make([]Mutator, len(ccb.builders))\n\tfor i := range ccb.builders {\n\t\tfunc(i int, root context.Context) {\n\t\t\tbuilder := ccb.builders[i]\n\t\t\tbuilder.defaults()\n\t\t\tvar mut Mutator = MutateFunc(func(ctx context.Context, m Mutation) (Value, error) {\n\t\t\t\tmutation, ok := m.(*CampaignMutation)\n\t\t\t\tif !ok {\n\t\t\t\t\treturn nil, fmt.Errorf(\"unexpected mutation type %T\", m)\n\t\t\t\t}\n\t\t\t\tif err := builder.check(); err != nil {\n\t\t\t\t\treturn nil, err\n\t\t\t\t}\n\t\t\t\tbuilder.mutation = mutation\n\t\t\t\tnodes[i], specs[i] = builder.createSpec()\n\t\t\t\tvar err error\n\t\t\t\tif i < len(mutators)-1 {\n\t\t\t\t\t_, err = mutators[i+1].Mutate(root, ccb.builders[i+1].mutation)\n\t\t\t\t} else {\n\t\t\t\t\t// Invoke the actual operation on the latest mutation in the chain.\n\t\t\t\t\tif err = sqlgraph.BatchCreate(ctx, ccb.driver, &sqlgraph.BatchCreateSpec{Nodes: specs}); err != nil {\n\t\t\t\t\t\tif cerr, ok := isSQLConstraintError(err); ok {\n\t\t\t\t\t\t\terr = cerr\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tmutation.done = true\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn nil, err\n\t\t\t\t}\n\t\t\t\treturn nodes[i], nil\n\t\t\t})\n\t\t\tfor i := len(builder.hooks) - 1; i >= 0; i-- {\n\t\t\t\tmut = builder.hooks[i](mut)\n\t\t\t}\n\t\t\tmutators[i] = mut\n\t\t}(i, ctx)\n\t}\n\tif len(mutators) > 0 {\n\t\tif _, err := mutators[0].Mutate(ctx, ccb.builders[0].mutation); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\treturn nodes, nil\n}", "func (a *BulkApiService) CreateBulkMoMerger(ctx context.Context) ApiCreateBulkMoMergerRequest {\n\treturn ApiCreateBulkMoMergerRequest{\n\t\tApiService: a,\n\t\tctx: ctx,\n\t}\n}", "func (ocb *OAuth2ClientCreateBulk) Save(ctx context.Context) ([]*OAuth2Client, error) {\n\tspecs := make([]*sqlgraph.CreateSpec, len(ocb.builders))\n\tnodes := make([]*OAuth2Client, len(ocb.builders))\n\tmutators := make([]Mutator, len(ocb.builders))\n\tfor i := range ocb.builders {\n\t\tfunc(i int, root context.Context) {\n\t\t\tbuilder := ocb.builders[i]\n\t\t\tvar mut Mutator = MutateFunc(func(ctx context.Context, m Mutation) (Value, error) {\n\t\t\t\tmutation, ok := m.(*OAuth2ClientMutation)\n\t\t\t\tif !ok {\n\t\t\t\t\treturn nil, fmt.Errorf(\"unexpected mutation type %T\", m)\n\t\t\t\t}\n\t\t\t\tif err := builder.check(); err != nil {\n\t\t\t\t\treturn nil, err\n\t\t\t\t}\n\t\t\t\tbuilder.mutation = mutation\n\t\t\t\tvar err error\n\t\t\t\tnodes[i], specs[i] = builder.createSpec()\n\t\t\t\tif i < len(mutators)-1 {\n\t\t\t\t\t_, err = mutators[i+1].Mutate(root, ocb.builders[i+1].mutation)\n\t\t\t\t} else {\n\t\t\t\t\tspec := &sqlgraph.BatchCreateSpec{Nodes: specs}\n\t\t\t\t\t// Invoke the actual operation on the latest mutation in the chain.\n\t\t\t\t\tif err = sqlgraph.BatchCreate(ctx, ocb.driver, spec); err != nil {\n\t\t\t\t\t\tif sqlgraph.IsConstraintError(err) {\n\t\t\t\t\t\t\terr = &ConstraintError{msg: err.Error(), wrap: err}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn nil, err\n\t\t\t\t}\n\t\t\t\tmutation.id = &nodes[i].ID\n\t\t\t\tmutation.done = true\n\t\t\t\treturn nodes[i], nil\n\t\t\t})\n\t\t\tfor i := len(builder.hooks) - 1; i >= 0; i-- {\n\t\t\t\tmut = builder.hooks[i](mut)\n\t\t\t}\n\t\t\tmutators[i] = mut\n\t\t}(i, ctx)\n\t}\n\tif len(mutators) > 0 {\n\t\tif _, err := mutators[0].Mutate(ctx, ocb.builders[0].mutation); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\treturn nodes, nil\n}", "func (m *MessagesController) CreateBulk(ctx *gin.Context) {\n\tmessagesIn := &tat.MessagesJSONIn{}\n\tctx.Bind(messagesIn)\n\tvar msgs []*tat.MessageJSONOut\n\tfor _, messageIn := range messagesIn.Messages {\n\t\tm, code, err := m.createSingle(ctx, messageIn)\n\t\tif err != nil {\n\t\t\tctx.JSON(code, gin.H{\"error\": err.Error()})\n\t\t\treturn\n\t\t}\n\t\tmsgs = append(msgs, m)\n\t}\n\tctx.JSON(http.StatusCreated, msgs)\n}", "func (a *BulkApiService) CreateBulkRequest(ctx context.Context) ApiCreateBulkRequestRequest {\n\treturn ApiCreateBulkRequestRequest{\n\t\tApiService: a,\n\t\tctx: ctx,\n\t}\n}", "func NewBulk(data []byte) *EncodeData {\n\tans := &EncodeData{}\n\tans.Type = TypeBulk\n\tans.Value = data\n\treturn ans\n}", "func NewAdminDeleteBulkGameSessionsForbidden() *AdminDeleteBulkGameSessionsForbidden {\n\treturn &AdminDeleteBulkGameSessionsForbidden{}\n}", "func (a *BulkApiService) CreateBulkMoCloner(ctx context.Context) ApiCreateBulkMoClonerRequest {\n\treturn ApiCreateBulkMoClonerRequest{\n\t\tApiService: a,\n\t\tctx: ctx,\n\t}\n}", "func (ucb *UserCreateBulk) Save(ctx context.Context) ([]*User, error) {\n\tspecs := make([]*sqlgraph.CreateSpec, len(ucb.builders))\n\tnodes := make([]*User, len(ucb.builders))\n\tmutators := make([]Mutator, len(ucb.builders))\n\tfor i := range ucb.builders {\n\t\tfunc(i int, root context.Context) {\n\t\t\tbuilder := ucb.builders[i]\n\t\t\tvar mut Mutator = MutateFunc(func(ctx context.Context, m Mutation) (Value, error) {\n\t\t\t\tif err := builder.preSave(); err != nil {\n\t\t\t\t\treturn nil, err\n\t\t\t\t}\n\t\t\t\tmutation, ok := m.(*UserMutation)\n\t\t\t\tif !ok {\n\t\t\t\t\treturn nil, fmt.Errorf(\"unexpected mutation type %T\", m)\n\t\t\t\t}\n\t\t\t\tbuilder.mutation = mutation\n\t\t\t\tnodes[i], specs[i] = builder.createSpec()\n\t\t\t\tvar err error\n\t\t\t\tif i < len(mutators)-1 {\n\t\t\t\t\t_, err = mutators[i+1].Mutate(root, ucb.builders[i+1].mutation)\n\t\t\t\t} else {\n\t\t\t\t\t// Invoke the actual operation on the latest mutation in the chain.\n\t\t\t\t\tif err = sqlgraph.BatchCreate(ctx, ucb.driver, &sqlgraph.BatchCreateSpec{Nodes: specs}); err != nil {\n\t\t\t\t\t\tif cerr, ok := isSQLConstraintError(err); ok {\n\t\t\t\t\t\t\terr = cerr\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tmutation.done = true\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn nil, err\n\t\t\t\t}\n\t\t\t\treturn nodes[i], nil\n\t\t\t})\n\t\t\tfor i := len(builder.hooks) - 1; i >= 0; i-- {\n\t\t\t\tmut = builder.hooks[i](mut)\n\t\t\t}\n\t\t\tmutators[i] = mut\n\t\t}(i, ctx)\n\t}\n\tif len(mutators) > 0 {\n\t\tif _, err := mutators[0].Mutate(ctx, ucb.builders[0].mutation); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\treturn nodes, nil\n}", "func (drcb *DeviceRequestCreateBulk) Save(ctx context.Context) ([]*DeviceRequest, error) {\n\tspecs := make([]*sqlgraph.CreateSpec, len(drcb.builders))\n\tnodes := make([]*DeviceRequest, len(drcb.builders))\n\tmutators := make([]Mutator, len(drcb.builders))\n\tfor i := range drcb.builders {\n\t\tfunc(i int, root context.Context) {\n\t\t\tbuilder := drcb.builders[i]\n\t\t\tvar mut Mutator = MutateFunc(func(ctx context.Context, m Mutation) (Value, error) {\n\t\t\t\tmutation, ok := m.(*DeviceRequestMutation)\n\t\t\t\tif !ok {\n\t\t\t\t\treturn nil, fmt.Errorf(\"unexpected mutation type %T\", m)\n\t\t\t\t}\n\t\t\t\tif err := builder.check(); err != nil {\n\t\t\t\t\treturn nil, err\n\t\t\t\t}\n\t\t\t\tbuilder.mutation = mutation\n\t\t\t\tvar err error\n\t\t\t\tnodes[i], specs[i] = builder.createSpec()\n\t\t\t\tif i < len(mutators)-1 {\n\t\t\t\t\t_, err = mutators[i+1].Mutate(root, drcb.builders[i+1].mutation)\n\t\t\t\t} else {\n\t\t\t\t\tspec := &sqlgraph.BatchCreateSpec{Nodes: specs}\n\t\t\t\t\t// Invoke the actual operation on the latest mutation in the chain.\n\t\t\t\t\tif err = sqlgraph.BatchCreate(ctx, drcb.driver, spec); err != nil {\n\t\t\t\t\t\tif sqlgraph.IsConstraintError(err) {\n\t\t\t\t\t\t\terr = &ConstraintError{msg: err.Error(), wrap: err}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn nil, err\n\t\t\t\t}\n\t\t\t\tmutation.id = &nodes[i].ID\n\t\t\t\tif specs[i].ID.Value != nil {\n\t\t\t\t\tid := specs[i].ID.Value.(int64)\n\t\t\t\t\tnodes[i].ID = int(id)\n\t\t\t\t}\n\t\t\t\tmutation.done = true\n\t\t\t\treturn nodes[i], nil\n\t\t\t})\n\t\t\tfor i := len(builder.hooks) - 1; i >= 0; i-- {\n\t\t\t\tmut = builder.hooks[i](mut)\n\t\t\t}\n\t\t\tmutators[i] = mut\n\t\t}(i, ctx)\n\t}\n\tif len(mutators) > 0 {\n\t\tif _, err := mutators[0].Mutate(ctx, drcb.builders[0].mutation); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\treturn nodes, nil\n}", "func (scb *SessionCreateBulk) Exec(ctx context.Context) error {\n\t_, err := scb.Save(ctx)\n\treturn err\n}", "func (ucb *UserCreateBulk) Save(ctx context.Context) ([]*User, error) {\n\tspecs := make([]*sqlgraph.CreateSpec, len(ucb.builders))\n\tnodes := make([]*User, len(ucb.builders))\n\tmutators := make([]Mutator, len(ucb.builders))\n\tfor i := range ucb.builders {\n\t\tfunc(i int, root context.Context) {\n\t\t\tbuilder := ucb.builders[i]\n\t\t\tvar mut Mutator = MutateFunc(func(ctx context.Context, m Mutation) (Value, error) {\n\t\t\t\tmutation, ok := m.(*UserMutation)\n\t\t\t\tif !ok {\n\t\t\t\t\treturn nil, fmt.Errorf(\"unexpected mutation type %T\", m)\n\t\t\t\t}\n\t\t\t\tif err := builder.check(); err != nil {\n\t\t\t\t\treturn nil, err\n\t\t\t\t}\n\t\t\t\tbuilder.mutation = mutation\n\t\t\t\tnodes[i], specs[i] = builder.createSpec()\n\t\t\t\tvar err error\n\t\t\t\tif i < len(mutators)-1 {\n\t\t\t\t\t_, err = mutators[i+1].Mutate(root, ucb.builders[i+1].mutation)\n\t\t\t\t} else {\n\t\t\t\t\t// Invoke the actual operation on the latest mutation in the chain.\n\t\t\t\t\tif err = sqlgraph.BatchCreate(ctx, ucb.driver, &sqlgraph.BatchCreateSpec{Nodes: specs}); err != nil {\n\t\t\t\t\t\tif cerr, ok := isSQLConstraintError(err); ok {\n\t\t\t\t\t\t\terr = cerr\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tmutation.done = true\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn nil, err\n\t\t\t\t}\n\t\t\t\tid := specs[i].ID.Value.(int64)\n\t\t\t\tnodes[i].ID = int(id)\n\t\t\t\treturn nodes[i], nil\n\t\t\t})\n\t\t\tfor i := len(builder.hooks) - 1; i >= 0; i-- {\n\t\t\t\tmut = builder.hooks[i](mut)\n\t\t\t}\n\t\t\tmutators[i] = mut\n\t\t}(i, ctx)\n\t}\n\tif len(mutators) > 0 {\n\t\tif _, err := mutators[0].Mutate(ctx, ucb.builders[0].mutation); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\treturn nodes, nil\n}", "func (ucb *UserCreateBulk) Save(ctx context.Context) ([]*User, error) {\n\tspecs := make([]*sqlgraph.CreateSpec, len(ucb.builders))\n\tnodes := make([]*User, len(ucb.builders))\n\tmutators := make([]Mutator, len(ucb.builders))\n\tfor i := range ucb.builders {\n\t\tfunc(i int, root context.Context) {\n\t\t\tbuilder := ucb.builders[i]\n\t\t\tvar mut Mutator = MutateFunc(func(ctx context.Context, m Mutation) (Value, error) {\n\t\t\t\tif err := builder.preSave(); err != nil {\n\t\t\t\t\treturn nil, err\n\t\t\t\t}\n\t\t\t\tmutation, ok := m.(*UserMutation)\n\t\t\t\tif !ok {\n\t\t\t\t\treturn nil, fmt.Errorf(\"unexpected mutation type %T\", m)\n\t\t\t\t}\n\t\t\t\tbuilder.mutation = mutation\n\t\t\t\tnodes[i], specs[i] = builder.createSpec()\n\t\t\t\tvar err error\n\t\t\t\tif i < len(mutators)-1 {\n\t\t\t\t\t_, err = mutators[i+1].Mutate(root, ucb.builders[i+1].mutation)\n\t\t\t\t} else {\n\t\t\t\t\t// Invoke the actual operation on the latest mutation in the chain.\n\t\t\t\t\tif err = sqlgraph.BatchCreate(ctx, ucb.driver, &sqlgraph.BatchCreateSpec{Nodes: specs}); err != nil {\n\t\t\t\t\t\tif cerr, ok := isSQLConstraintError(err); ok {\n\t\t\t\t\t\t\terr = cerr\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tmutation.done = true\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn nil, err\n\t\t\t\t}\n\t\t\t\tid := specs[i].ID.Value.(int64)\n\t\t\t\tnodes[i].ID = int(id)\n\t\t\t\treturn nodes[i], nil\n\t\t\t})\n\t\t\tfor i := len(builder.hooks) - 1; i >= 0; i-- {\n\t\t\t\tmut = builder.hooks[i](mut)\n\t\t\t}\n\t\t\tmutators[i] = mut\n\t\t}(i, ctx)\n\t}\n\tif len(mutators) > 0 {\n\t\tif _, err := mutators[0].Mutate(ctx, ucb.builders[0].mutation); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\treturn nodes, nil\n}", "func (icb *InstanceCreateBulk) Save(ctx context.Context) ([]*Instance, error) {\n\tspecs := make([]*sqlgraph.CreateSpec, len(icb.builders))\n\tnodes := make([]*Instance, len(icb.builders))\n\tmutators := make([]Mutator, len(icb.builders))\n\tfor i := range icb.builders {\n\t\tfunc(i int, root context.Context) {\n\t\t\tbuilder := icb.builders[i]\n\t\t\tbuilder.defaults()\n\t\t\tvar mut Mutator = MutateFunc(func(ctx context.Context, m Mutation) (Value, error) {\n\t\t\t\tmutation, ok := m.(*InstanceMutation)\n\t\t\t\tif !ok {\n\t\t\t\t\treturn nil, fmt.Errorf(\"unexpected mutation type %T\", m)\n\t\t\t\t}\n\t\t\t\tif err := builder.check(); err != nil {\n\t\t\t\t\treturn nil, err\n\t\t\t\t}\n\t\t\t\tbuilder.mutation = mutation\n\t\t\t\tnodes[i], specs[i] = builder.createSpec()\n\t\t\t\tvar err error\n\t\t\t\tif i < len(mutators)-1 {\n\t\t\t\t\t_, err = mutators[i+1].Mutate(root, icb.builders[i+1].mutation)\n\t\t\t\t} else {\n\t\t\t\t\tspec := &sqlgraph.BatchCreateSpec{Nodes: specs}\n\t\t\t\t\t// Invoke the actual operation on the latest mutation in the chain.\n\t\t\t\t\tif err = sqlgraph.BatchCreate(ctx, icb.driver, spec); err != nil {\n\t\t\t\t\t\tif sqlgraph.IsConstraintError(err) {\n\t\t\t\t\t\t\terr = &ConstraintError{err.Error(), err}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn nil, err\n\t\t\t\t}\n\t\t\t\tmutation.id = &nodes[i].ID\n\t\t\t\tmutation.done = true\n\t\t\t\treturn nodes[i], nil\n\t\t\t})\n\t\t\tfor i := len(builder.hooks) - 1; i >= 0; i-- {\n\t\t\t\tmut = builder.hooks[i](mut)\n\t\t\t}\n\t\t\tmutators[i] = mut\n\t\t}(i, ctx)\n\t}\n\tif len(mutators) > 0 {\n\t\tif _, err := mutators[0].Mutate(ctx, icb.builders[0].mutation); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\treturn nodes, nil\n}", "func (ocb *OrganizationCreateBulk) Save(ctx context.Context) ([]*Organization, error) {\n\tspecs := make([]*sqlgraph.CreateSpec, len(ocb.builders))\n\tnodes := make([]*Organization, len(ocb.builders))\n\tmutators := make([]Mutator, len(ocb.builders))\n\tfor i := range ocb.builders {\n\t\tfunc(i int, root context.Context) {\n\t\t\tbuilder := ocb.builders[i]\n\t\t\tbuilder.defaults()\n\t\t\tvar mut Mutator = MutateFunc(func(ctx context.Context, m Mutation) (Value, error) {\n\t\t\t\tmutation, ok := m.(*OrganizationMutation)\n\t\t\t\tif !ok {\n\t\t\t\t\treturn nil, fmt.Errorf(\"unexpected mutation type %T\", m)\n\t\t\t\t}\n\t\t\t\tif err := builder.check(); err != nil {\n\t\t\t\t\treturn nil, err\n\t\t\t\t}\n\t\t\t\tbuilder.mutation = mutation\n\t\t\t\tnodes[i], specs[i] = builder.createSpec()\n\t\t\t\tvar err error\n\t\t\t\tif i < len(mutators)-1 {\n\t\t\t\t\t_, err = mutators[i+1].Mutate(root, ocb.builders[i+1].mutation)\n\t\t\t\t} else {\n\t\t\t\t\tspec := &sqlgraph.BatchCreateSpec{Nodes: specs}\n\t\t\t\t\tspec.OnConflict = ocb.conflict\n\t\t\t\t\t// Invoke the actual operation on the latest mutation in the chain.\n\t\t\t\t\tif err = sqlgraph.BatchCreate(ctx, ocb.driver, spec); err != nil {\n\t\t\t\t\t\tif sqlgraph.IsConstraintError(err) {\n\t\t\t\t\t\t\terr = &ConstraintError{err.Error(), err}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn nil, err\n\t\t\t\t}\n\t\t\t\tmutation.id = &nodes[i].ID\n\t\t\t\tmutation.done = true\n\t\t\t\tif specs[i].ID.Value != nil {\n\t\t\t\t\tid := specs[i].ID.Value.(int64)\n\t\t\t\t\tnodes[i].ID = int(id)\n\t\t\t\t}\n\t\t\t\treturn nodes[i], nil\n\t\t\t})\n\t\t\tfor i := len(builder.hooks) - 1; i >= 0; i-- {\n\t\t\t\tmut = builder.hooks[i](mut)\n\t\t\t}\n\t\t\tmutators[i] = mut\n\t\t}(i, ctx)\n\t}\n\tif len(mutators) > 0 {\n\t\tif _, err := mutators[0].Mutate(ctx, ocb.builders[0].mutation); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\treturn nodes, nil\n}", "func (c *queryClient) Bulk(args []*RequestBody) (io.ReadCloser, error) {\n\tbody := RequestBody{\n\t\tType: \"bulk\",\n\t\tArgs: args,\n\t}\n\n\treturn c.Send(body)\n}", "func (acb *AppCreateBulk) Save(ctx context.Context) ([]*App, error) {\n\tspecs := make([]*sqlgraph.CreateSpec, len(acb.builders))\n\tnodes := make([]*App, len(acb.builders))\n\tmutators := make([]Mutator, len(acb.builders))\n\tfor i := range acb.builders {\n\t\tfunc(i int, root context.Context) {\n\t\t\tbuilder := acb.builders[i]\n\t\t\tvar mut Mutator = MutateFunc(func(ctx context.Context, m Mutation) (Value, error) {\n\t\t\t\tif err := builder.preSave(); err != nil {\n\t\t\t\t\treturn nil, err\n\t\t\t\t}\n\t\t\t\tmutation, ok := m.(*AppMutation)\n\t\t\t\tif !ok {\n\t\t\t\t\treturn nil, fmt.Errorf(\"unexpected mutation type %T\", m)\n\t\t\t\t}\n\t\t\t\tbuilder.mutation = mutation\n\t\t\t\tnodes[i], specs[i] = builder.createSpec()\n\t\t\t\tvar err error\n\t\t\t\tif i < len(mutators)-1 {\n\t\t\t\t\t_, err = mutators[i+1].Mutate(root, acb.builders[i+1].mutation)\n\t\t\t\t} else {\n\t\t\t\t\t// Invoke the actual operation on the latest mutation in the chain.\n\t\t\t\t\tif err = sqlgraph.BatchCreate(ctx, acb.driver, &sqlgraph.BatchCreateSpec{Nodes: specs}); err != nil {\n\t\t\t\t\t\tif cerr, ok := isSQLConstraintError(err); ok {\n\t\t\t\t\t\t\terr = cerr\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tmutation.done = true\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn nil, err\n\t\t\t\t}\n\t\t\t\tid := specs[i].ID.Value.(int64)\n\t\t\t\tnodes[i].ID = int(id)\n\t\t\t\treturn nodes[i], nil\n\t\t\t})\n\t\t\tfor i := len(builder.hooks) - 1; i >= 0; i-- {\n\t\t\t\tmut = builder.hooks[i](mut)\n\t\t\t}\n\t\t\tmutators[i] = mut\n\t\t}(i, ctx)\n\t}\n\tif len(mutators) > 0 {\n\t\tif _, err := mutators[0].Mutate(ctx, acb.builders[0].mutation); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\treturn nodes, nil\n}", "func (ccb *CustomerCreateBulk) Save(ctx context.Context) ([]*Customer, error) {\n\tspecs := make([]*sqlgraph.CreateSpec, len(ccb.builders))\n\tnodes := make([]*Customer, len(ccb.builders))\n\tmutators := make([]Mutator, len(ccb.builders))\n\tfor i := range ccb.builders {\n\t\tfunc(i int, root context.Context) {\n\t\t\tbuilder := ccb.builders[i]\n\t\t\tbuilder.defaults()\n\t\t\tvar mut Mutator = MutateFunc(func(ctx context.Context, m Mutation) (Value, error) {\n\t\t\t\tmutation, ok := m.(*CustomerMutation)\n\t\t\t\tif !ok {\n\t\t\t\t\treturn nil, fmt.Errorf(\"unexpected mutation type %T\", m)\n\t\t\t\t}\n\t\t\t\tif err := builder.check(); err != nil {\n\t\t\t\t\treturn nil, err\n\t\t\t\t}\n\t\t\t\tbuilder.mutation = mutation\n\t\t\t\tnodes[i], specs[i] = builder.createSpec()\n\t\t\t\tvar err error\n\t\t\t\tif i < len(mutators)-1 {\n\t\t\t\t\t_, err = mutators[i+1].Mutate(root, ccb.builders[i+1].mutation)\n\t\t\t\t} else {\n\t\t\t\t\t// Invoke the actual operation on the latest mutation in the chain.\n\t\t\t\t\tif err = sqlgraph.BatchCreate(ctx, ccb.driver, &sqlgraph.BatchCreateSpec{Nodes: specs}); err != nil {\n\t\t\t\t\t\tif cerr, ok := isSQLConstraintError(err); ok {\n\t\t\t\t\t\t\terr = cerr\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tmutation.done = true\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn nil, err\n\t\t\t\t}\n\t\t\t\tid := specs[i].ID.Value.(int64)\n\t\t\t\tnodes[i].ID = int(id)\n\t\t\t\treturn nodes[i], nil\n\t\t\t})\n\t\t\tfor i := len(builder.hooks) - 1; i >= 0; i-- {\n\t\t\t\tmut = builder.hooks[i](mut)\n\t\t\t}\n\t\t\tmutators[i] = mut\n\t\t}(i, ctx)\n\t}\n\tif len(mutators) > 0 {\n\t\tif _, err := mutators[0].Mutate(ctx, ccb.builders[0].mutation); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\treturn nodes, nil\n}", "func (wcb *WalletCreateBulk) Save(ctx context.Context) ([]*Wallet, error) {\n\tspecs := make([]*sqlgraph.CreateSpec, len(wcb.builders))\n\tnodes := make([]*Wallet, len(wcb.builders))\n\tmutators := make([]Mutator, len(wcb.builders))\n\tfor i := range wcb.builders {\n\t\tfunc(i int, root context.Context) {\n\t\t\tbuilder := wcb.builders[i]\n\t\t\tbuilder.defaults()\n\t\t\tvar mut Mutator = MutateFunc(func(ctx context.Context, m Mutation) (Value, error) {\n\t\t\t\tmutation, ok := m.(*WalletMutation)\n\t\t\t\tif !ok {\n\t\t\t\t\treturn nil, fmt.Errorf(\"unexpected mutation type %T\", m)\n\t\t\t\t}\n\t\t\t\tif err := builder.check(); err != nil {\n\t\t\t\t\treturn nil, err\n\t\t\t\t}\n\t\t\t\tbuilder.mutation = mutation\n\t\t\t\tnodes[i], specs[i] = builder.createSpec()\n\t\t\t\tvar err error\n\t\t\t\tif i < len(mutators)-1 {\n\t\t\t\t\t_, err = mutators[i+1].Mutate(root, wcb.builders[i+1].mutation)\n\t\t\t\t} else {\n\t\t\t\t\tspec := &sqlgraph.BatchCreateSpec{Nodes: specs}\n\t\t\t\t\t// Invoke the actual operation on the latest mutation in the chain.\n\t\t\t\t\tif err = sqlgraph.BatchCreate(ctx, wcb.driver, spec); err != nil {\n\t\t\t\t\t\tif sqlgraph.IsConstraintError(err) {\n\t\t\t\t\t\t\terr = &ConstraintError{msg: err.Error(), wrap: err}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn nil, err\n\t\t\t\t}\n\t\t\t\tmutation.id = &nodes[i].ID\n\t\t\t\tmutation.done = true\n\t\t\t\treturn nodes[i], nil\n\t\t\t})\n\t\t\tfor i := len(builder.hooks) - 1; i >= 0; i-- {\n\t\t\t\tmut = builder.hooks[i](mut)\n\t\t\t}\n\t\t\tmutators[i] = mut\n\t\t}(i, ctx)\n\t}\n\tif len(mutators) > 0 {\n\t\tif _, err := mutators[0].Mutate(ctx, wcb.builders[0].mutation); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\treturn nodes, nil\n}", "func NewMultiBulk(array []*EncodeData) *EncodeData {\n\tans := &EncodeData{}\n\tans.Type = TypeMultiBulk\n\tans.Array = array\n\treturn ans\n}", "func (r *AssetRepository) CreateBulk(assets []assetEntity.Asset) (int, error) {\n\terr := r.restore()\n\tif err != nil {\n\t\treturn 0, err\n\t}\n\n\tn, err := r.repository.CreateBulk(assets)\n\tif err != nil {\n\t\treturn n, fmt.Errorf(\"assets bulk create failed: %w\", err)\n\t}\n\terr = r.dump()\n\treturn n, err\n}", "func (dscb *DataSourceCreateBulk) Save(ctx context.Context) ([]*DataSource, error) {\n\tspecs := make([]*sqlgraph.CreateSpec, len(dscb.builders))\n\tnodes := make([]*DataSource, len(dscb.builders))\n\tmutators := make([]Mutator, len(dscb.builders))\n\tfor i := range dscb.builders {\n\t\tfunc(i int, root context.Context) {\n\t\t\tbuilder := dscb.builders[i]\n\t\t\tbuilder.defaults()\n\t\t\tvar mut Mutator = MutateFunc(func(ctx context.Context, m Mutation) (Value, error) {\n\t\t\t\tmutation, ok := m.(*DataSourceMutation)\n\t\t\t\tif !ok {\n\t\t\t\t\treturn nil, fmt.Errorf(\"unexpected mutation type %T\", m)\n\t\t\t\t}\n\t\t\t\tif err := builder.check(); err != nil {\n\t\t\t\t\treturn nil, err\n\t\t\t\t}\n\t\t\t\tbuilder.mutation = mutation\n\t\t\t\tnodes[i], specs[i] = builder.createSpec()\n\t\t\t\tvar err error\n\t\t\t\tif i < len(mutators)-1 {\n\t\t\t\t\t_, err = mutators[i+1].Mutate(root, dscb.builders[i+1].mutation)\n\t\t\t\t} else {\n\t\t\t\t\tspec := &sqlgraph.BatchCreateSpec{Nodes: specs}\n\t\t\t\t\t// Invoke the actual operation on the latest mutation in the chain.\n\t\t\t\t\tif err = sqlgraph.BatchCreate(ctx, dscb.driver, spec); err != nil {\n\t\t\t\t\t\tif sqlgraph.IsConstraintError(err) {\n\t\t\t\t\t\t\terr = &ConstraintError{msg: err.Error(), wrap: err}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn nil, err\n\t\t\t\t}\n\t\t\t\tmutation.id = &nodes[i].ID\n\t\t\t\tif specs[i].ID.Value != nil {\n\t\t\t\t\tid := specs[i].ID.Value.(int64)\n\t\t\t\t\tnodes[i].ID = int(id)\n\t\t\t\t}\n\t\t\t\tmutation.done = true\n\t\t\t\treturn nodes[i], nil\n\t\t\t})\n\t\t\tfor i := len(builder.hooks) - 1; i >= 0; i-- {\n\t\t\t\tmut = builder.hooks[i](mut)\n\t\t\t}\n\t\t\tmutators[i] = mut\n\t\t}(i, ctx)\n\t}\n\tif len(mutators) > 0 {\n\t\tif _, err := mutators[0].Mutate(ctx, dscb.builders[0].mutation); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\treturn nodes, nil\n}", "func (c *myClient) batchCreateUserAndAuthorizations(userList ...User) (resultsList []map[string]interface{}, err error) {\n\tfor _, v := range userList {\n\t\tif action, err := c.createUserAndAuthorizations(v, true); action != nil && err == nil {\n\t\t\tresultsList = append(resultsList, action)\n\t\t} else if err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\treturn resultsList, err\n}", "func (s *CampaignNegativeKeywordService) CreateBulk(ctx context.Context, campaignID int64, data []*NegativeKeyword) ([]*NegativeKeyword, *Response, error) {\n\tif campaignID == 0 {\n\t\treturn nil, nil, fmt.Errorf(\"campaignID can not be 0\")\n\t}\n\tu := fmt.Sprintf(\"campaigns/%d/negativekeywords/bulk\", campaignID)\n\treq, err := s.client.NewRequest(\"POST\", u, data)\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\tnegativekeywords := []*NegativeKeyword{}\n\tresp, err := s.client.Do(ctx, req, &negativekeywords)\n\tif err != nil {\n\t\treturn nil, resp, err\n\t}\n\treturn negativekeywords, resp, nil\n}", "func (arcb *AppointmentResultsCreateBulk) Save(ctx context.Context) ([]*AppointmentResults, error) {\n\tspecs := make([]*sqlgraph.CreateSpec, len(arcb.builders))\n\tnodes := make([]*AppointmentResults, len(arcb.builders))\n\tmutators := make([]Mutator, len(arcb.builders))\n\tfor i := range arcb.builders {\n\t\tfunc(i int, root context.Context) {\n\t\t\tbuilder := arcb.builders[i]\n\t\t\tbuilder.defaults()\n\t\t\tvar mut Mutator = MutateFunc(func(ctx context.Context, m Mutation) (Value, error) {\n\t\t\t\tmutation, ok := m.(*AppointmentResultsMutation)\n\t\t\t\tif !ok {\n\t\t\t\t\treturn nil, fmt.Errorf(\"unexpected mutation type %T\", m)\n\t\t\t\t}\n\t\t\t\tif err := builder.check(); err != nil {\n\t\t\t\t\treturn nil, err\n\t\t\t\t}\n\t\t\t\tbuilder.mutation = mutation\n\t\t\t\tnodes[i], specs[i] = builder.createSpec()\n\t\t\t\tvar err error\n\t\t\t\tif i < len(mutators)-1 {\n\t\t\t\t\t_, err = mutators[i+1].Mutate(root, arcb.builders[i+1].mutation)\n\t\t\t\t} else {\n\t\t\t\t\t// Invoke the actual operation on the latest mutation in the chain.\n\t\t\t\t\tif err = sqlgraph.BatchCreate(ctx, arcb.driver, &sqlgraph.BatchCreateSpec{Nodes: specs}); err != nil {\n\t\t\t\t\t\tif cerr, ok := isSQLConstraintError(err); ok {\n\t\t\t\t\t\t\terr = cerr\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tmutation.done = true\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn nil, err\n\t\t\t\t}\n\t\t\t\tid := specs[i].ID.Value.(int64)\n\t\t\t\tnodes[i].ID = int(id)\n\t\t\t\treturn nodes[i], nil\n\t\t\t})\n\t\t\tfor i := len(builder.hooks) - 1; i >= 0; i-- {\n\t\t\t\tmut = builder.hooks[i](mut)\n\t\t\t}\n\t\t\tmutators[i] = mut\n\t\t}(i, ctx)\n\t}\n\tif len(mutators) > 0 {\n\t\tif _, err := mutators[0].Mutate(ctx, arcb.builders[0].mutation); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\treturn nodes, nil\n}", "func (lcb *LoggerCreateBulk) Save(ctx context.Context) ([]*Logger, error) {\n\tspecs := make([]*sqlgraph.CreateSpec, len(lcb.builders))\n\tnodes := make([]*Logger, len(lcb.builders))\n\tmutators := make([]Mutator, len(lcb.builders))\n\tfor i := range lcb.builders {\n\t\tfunc(i int, root context.Context) {\n\t\t\tbuilder := lcb.builders[i]\n\t\t\tbuilder.defaults()\n\t\t\tvar mut Mutator = MutateFunc(func(ctx context.Context, m Mutation) (Value, error) {\n\t\t\t\tmutation, ok := m.(*LoggerMutation)\n\t\t\t\tif !ok {\n\t\t\t\t\treturn nil, fmt.Errorf(\"unexpected mutation type %T\", m)\n\t\t\t\t}\n\t\t\t\tif err := builder.check(); err != nil {\n\t\t\t\t\treturn nil, err\n\t\t\t\t}\n\t\t\t\tbuilder.mutation = mutation\n\t\t\t\tnodes[i], specs[i] = builder.createSpec()\n\t\t\t\tvar err error\n\t\t\t\tif i < len(mutators)-1 {\n\t\t\t\t\t_, err = mutators[i+1].Mutate(root, lcb.builders[i+1].mutation)\n\t\t\t\t} else {\n\t\t\t\t\t// Invoke the actual operation on the latest mutation in the chain.\n\t\t\t\t\tif err = sqlgraph.BatchCreate(ctx, lcb.driver, &sqlgraph.BatchCreateSpec{Nodes: specs}); err != nil {\n\t\t\t\t\t\tif cerr, ok := isSQLConstraintError(err); ok {\n\t\t\t\t\t\t\terr = cerr\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tmutation.done = true\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn nil, err\n\t\t\t\t}\n\t\t\t\tif nodes[i].ID == 0 {\n\t\t\t\t\tid := specs[i].ID.Value.(int64)\n\t\t\t\t\tnodes[i].ID = int(id)\n\t\t\t\t}\n\t\t\t\treturn nodes[i], nil\n\t\t\t})\n\t\t\tfor i := len(builder.hooks) - 1; i >= 0; i-- {\n\t\t\t\tmut = builder.hooks[i](mut)\n\t\t\t}\n\t\t\tmutators[i] = mut\n\t\t}(i, ctx)\n\t}\n\tif len(mutators) > 0 {\n\t\tif _, err := mutators[0].Mutate(ctx, lcb.builders[0].mutation); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\treturn nodes, nil\n}", "func (ocb *OAuth2ClientCreateBulk) Exec(ctx context.Context) error {\n\t_, err := ocb.Save(ctx)\n\treturn err\n}", "func (wcb *WritelogCreateBulk) Save(ctx context.Context) ([]*Writelog, error) {\n\tspecs := make([]*sqlgraph.CreateSpec, len(wcb.builders))\n\tnodes := make([]*Writelog, len(wcb.builders))\n\tmutators := make([]Mutator, len(wcb.builders))\n\tfor i := range wcb.builders {\n\t\tfunc(i int, root context.Context) {\n\t\t\tbuilder := wcb.builders[i]\n\t\t\tvar mut Mutator = MutateFunc(func(ctx context.Context, m Mutation) (Value, error) {\n\t\t\t\tmutation, ok := m.(*WritelogMutation)\n\t\t\t\tif !ok {\n\t\t\t\t\treturn nil, fmt.Errorf(\"unexpected mutation type %T\", m)\n\t\t\t\t}\n\t\t\t\tif err := builder.check(); err != nil {\n\t\t\t\t\treturn nil, err\n\t\t\t\t}\n\t\t\t\tbuilder.mutation = mutation\n\t\t\t\tnodes[i], specs[i] = builder.createSpec()\n\t\t\t\tvar err error\n\t\t\t\tif i < len(mutators)-1 {\n\t\t\t\t\t_, err = mutators[i+1].Mutate(root, wcb.builders[i+1].mutation)\n\t\t\t\t} else {\n\t\t\t\t\t// Invoke the actual operation on the latest mutation in the chain.\n\t\t\t\t\tif err = sqlgraph.BatchCreate(ctx, wcb.driver, &sqlgraph.BatchCreateSpec{Nodes: specs}); err != nil {\n\t\t\t\t\t\tif cerr, ok := isSQLConstraintError(err); ok {\n\t\t\t\t\t\t\terr = cerr\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tmutation.done = true\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn nil, err\n\t\t\t\t}\n\t\t\t\tif nodes[i].ID == 0 {\n\t\t\t\t\tid := specs[i].ID.Value.(int64)\n\t\t\t\t\tnodes[i].ID = int(id)\n\t\t\t\t}\n\t\t\t\treturn nodes[i], nil\n\t\t\t})\n\t\t\tfor i := len(builder.hooks) - 1; i >= 0; i-- {\n\t\t\t\tmut = builder.hooks[i](mut)\n\t\t\t}\n\t\t\tmutators[i] = mut\n\t\t}(i, ctx)\n\t}\n\tif len(mutators) > 0 {\n\t\tif _, err := mutators[0].Mutate(ctx, wcb.builders[0].mutation); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\treturn nodes, nil\n}", "func (s *AdGroupNegativeKeywordService) CreateBulk(ctx context.Context, campaignID int64, adGroupID int64, data []*NegativeKeyword) ([]*NegativeKeyword, *Response, error) {\n\tif campaignID == 0 {\n\t\treturn nil, nil, fmt.Errorf(\"campaignID can not be 0\")\n\t}\n\tif adGroupID == 0 {\n\t\treturn nil, nil, fmt.Errorf(\"adGroupID can not be 0\")\n\t}\n\tu := fmt.Sprintf(\"campaigns/%d/adgroups/%d/negativekeywords/bulk\", campaignID, adGroupID)\n\treq, err := s.client.NewRequest(\"POST\", u, data)\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\tnegativekeywords := []*NegativeKeyword{}\n\tresp, err := s.client.Do(ctx, req, &negativekeywords)\n\tif err != nil {\n\t\treturn nil, resp, err\n\t}\n\n\treturn negativekeywords, resp, nil\n}", "func (m *MockSubjectRoleManager) BulkCreate(roles []dao.SubjectRole) error {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"BulkCreate\", roles)\n\tret0, _ := ret[0].(error)\n\treturn ret0\n}", "func (a *BulkApiService) CreateBulkMoDeepCloner(ctx context.Context) ApiCreateBulkMoDeepClonerRequest {\n\treturn ApiCreateBulkMoDeepClonerRequest{\n\t\tApiService: a,\n\t\tctx: ctx,\n\t}\n}", "func (iv IndexView) CreateMany(ctx context.Context, models []IndexModel, opts ...*options.CreateIndexesOptions) ([]string, error) {\n\tnames := make([]string, 0, len(models))\n\n\tvar indexes bsoncore.Document\n\taidx, indexes := bsoncore.AppendArrayStart(indexes)\n\n\tfor i, model := range models {\n\t\tif model.Keys == nil {\n\t\t\treturn nil, fmt.Errorf(\"index model keys cannot be nil\")\n\t\t}\n\n\t\tif isUnorderedMap(model.Keys) {\n\t\t\treturn nil, ErrMapForOrderedArgument{\"keys\"}\n\t\t}\n\n\t\tkeys, err := marshal(model.Keys, iv.coll.bsonOpts, iv.coll.registry)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tname, err := getOrGenerateIndexName(keys, model)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tnames = append(names, name)\n\n\t\tvar iidx int32\n\t\tiidx, indexes = bsoncore.AppendDocumentElementStart(indexes, strconv.Itoa(i))\n\t\tindexes = bsoncore.AppendDocumentElement(indexes, \"key\", keys)\n\n\t\tif model.Options == nil {\n\t\t\tmodel.Options = options.Index()\n\t\t}\n\t\tmodel.Options.SetName(name)\n\n\t\toptsDoc, err := iv.createOptionsDoc(model.Options)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tindexes = bsoncore.AppendDocument(indexes, optsDoc)\n\n\t\tindexes, err = bsoncore.AppendDocumentEnd(indexes, iidx)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\tindexes, err := bsoncore.AppendArrayEnd(indexes, aidx)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tsess := sessionFromContext(ctx)\n\n\tif sess == nil && iv.coll.client.sessionPool != nil {\n\t\tsess = session.NewImplicitClientSession(iv.coll.client.sessionPool, iv.coll.client.id)\n\t\tdefer sess.EndSession()\n\t}\n\n\terr = iv.coll.client.validSession(sess)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\twc := iv.coll.writeConcern\n\tif sess.TransactionRunning() {\n\t\twc = nil\n\t}\n\tif !writeconcern.AckWrite(wc) {\n\t\tsess = nil\n\t}\n\n\tselector := makePinnedSelector(sess, iv.coll.writeSelector)\n\n\toption := options.MergeCreateIndexesOptions(opts...)\n\n\top := operation.NewCreateIndexes(indexes).\n\t\tSession(sess).WriteConcern(wc).ClusterClock(iv.coll.client.clock).\n\t\tDatabase(iv.coll.db.name).Collection(iv.coll.name).CommandMonitor(iv.coll.client.monitor).\n\t\tDeployment(iv.coll.client.deployment).ServerSelector(selector).ServerAPI(iv.coll.client.serverAPI).\n\t\tTimeout(iv.coll.client.timeout).MaxTime(option.MaxTime)\n\tif option.CommitQuorum != nil {\n\t\tcommitQuorum, err := marshalValue(option.CommitQuorum, iv.coll.bsonOpts, iv.coll.registry)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\top.CommitQuorum(commitQuorum)\n\t}\n\n\terr = op.Execute(ctx)\n\tif err != nil {\n\t\t_, err = processWriteError(err)\n\t\treturn nil, err\n\t}\n\n\treturn names, nil\n}", "func (etcb *ExportTaskCreateBulk) Save(ctx context.Context) ([]*ExportTask, error) {\n\tspecs := make([]*sqlgraph.CreateSpec, len(etcb.builders))\n\tnodes := make([]*ExportTask, len(etcb.builders))\n\tmutators := make([]Mutator, len(etcb.builders))\n\tfor i := range etcb.builders {\n\t\tfunc(i int, root context.Context) {\n\t\t\tbuilder := etcb.builders[i]\n\t\t\tbuilder.defaults()\n\t\t\tvar mut Mutator = MutateFunc(func(ctx context.Context, m Mutation) (Value, error) {\n\t\t\t\tmutation, ok := m.(*ExportTaskMutation)\n\t\t\t\tif !ok {\n\t\t\t\t\treturn nil, fmt.Errorf(\"unexpected mutation type %T\", m)\n\t\t\t\t}\n\t\t\t\tif err := builder.check(); err != nil {\n\t\t\t\t\treturn nil, err\n\t\t\t\t}\n\t\t\t\tbuilder.mutation = mutation\n\t\t\t\tnodes[i], specs[i] = builder.createSpec()\n\t\t\t\tvar err error\n\t\t\t\tif i < len(mutators)-1 {\n\t\t\t\t\t_, err = mutators[i+1].Mutate(root, etcb.builders[i+1].mutation)\n\t\t\t\t} else {\n\t\t\t\t\t// Invoke the actual operation on the latest mutation in the chain.\n\t\t\t\t\tif err = sqlgraph.BatchCreate(ctx, etcb.driver, &sqlgraph.BatchCreateSpec{Nodes: specs}); err != nil {\n\t\t\t\t\t\tif cerr, ok := isSQLConstraintError(err); ok {\n\t\t\t\t\t\t\terr = cerr\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tmutation.done = true\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn nil, err\n\t\t\t\t}\n\t\t\t\tid := specs[i].ID.Value.(int64)\n\t\t\t\tnodes[i].ID = int(id)\n\t\t\t\treturn nodes[i], nil\n\t\t\t})\n\t\t\tfor i := len(builder.hooks) - 1; i >= 0; i-- {\n\t\t\t\tmut = builder.hooks[i](mut)\n\t\t\t}\n\t\t\tmutators[i] = mut\n\t\t}(i, ctx)\n\t}\n\tif len(mutators) > 0 {\n\t\tif _, err := mutators[0].Mutate(ctx, etcb.builders[0].mutation); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\treturn nodes, nil\n}", "func NewAdminDeleteBulkGameSessionsOK() *AdminDeleteBulkGameSessionsOK {\n\treturn &AdminDeleteBulkGameSessionsOK{}\n}", "func (ai *AppInteractor) CreateBatch(apps []domain.App) ([]string, error) {\n\treturn ai.AppRepository.CreateBatch(apps)\n}", "func (ccb *CompanyCreateBulk) Save(ctx context.Context) ([]*Company, error) {\n\tspecs := make([]*sqlgraph.CreateSpec, len(ccb.builders))\n\tnodes := make([]*Company, len(ccb.builders))\n\tmutators := make([]Mutator, len(ccb.builders))\n\tfor i := range ccb.builders {\n\t\tfunc(i int, root context.Context) {\n\t\t\tbuilder := ccb.builders[i]\n\t\t\tbuilder.defaults()\n\t\t\tvar mut Mutator = MutateFunc(func(ctx context.Context, m Mutation) (Value, error) {\n\t\t\t\tmutation, ok := m.(*CompanyMutation)\n\t\t\t\tif !ok {\n\t\t\t\t\treturn nil, fmt.Errorf(\"unexpected mutation type %T\", m)\n\t\t\t\t}\n\t\t\t\tif err := builder.check(); err != nil {\n\t\t\t\t\treturn nil, err\n\t\t\t\t}\n\t\t\t\tbuilder.mutation = mutation\n\t\t\t\tnodes[i], specs[i] = builder.createSpec()\n\t\t\t\tvar err error\n\t\t\t\tif i < len(mutators)-1 {\n\t\t\t\t\t_, err = mutators[i+1].Mutate(root, ccb.builders[i+1].mutation)\n\t\t\t\t} else {\n\t\t\t\t\t// Invoke the actual operation on the latest mutation in the chain.\n\t\t\t\t\tif err = sqlgraph.BatchCreate(ctx, ccb.driver, &sqlgraph.BatchCreateSpec{Nodes: specs}); err != nil {\n\t\t\t\t\t\tif sqlgraph.IsConstraintError(err) {\n\t\t\t\t\t\t\terr = &ConstraintError{err.Error(), err}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn nil, err\n\t\t\t\t}\n\t\t\t\tmutation.id = &nodes[i].ID\n\t\t\t\tmutation.done = true\n\t\t\t\tid := specs[i].ID.Value.(int64)\n\t\t\t\tnodes[i].ID = int(id)\n\t\t\t\treturn nodes[i], nil\n\t\t\t})\n\t\t\tfor i := len(builder.hooks) - 1; i >= 0; i-- {\n\t\t\t\tmut = builder.hooks[i](mut)\n\t\t\t}\n\t\t\tmutators[i] = mut\n\t\t}(i, ctx)\n\t}\n\tif len(mutators) > 0 {\n\t\tif _, err := mutators[0].Mutate(ctx, ccb.builders[0].mutation); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\treturn nodes, nil\n}", "func (ctcb *ClinicalTrialCreateBulk) Save(ctx context.Context) ([]*ClinicalTrial, error) {\n\tspecs := make([]*sqlgraph.CreateSpec, len(ctcb.builders))\n\tnodes := make([]*ClinicalTrial, len(ctcb.builders))\n\tmutators := make([]Mutator, len(ctcb.builders))\n\tfor i := range ctcb.builders {\n\t\tfunc(i int, root context.Context) {\n\t\t\tbuilder := ctcb.builders[i]\n\t\t\tvar mut Mutator = MutateFunc(func(ctx context.Context, m Mutation) (Value, error) {\n\t\t\t\tmutation, ok := m.(*ClinicalTrialMutation)\n\t\t\t\tif !ok {\n\t\t\t\t\treturn nil, fmt.Errorf(\"unexpected mutation type %T\", m)\n\t\t\t\t}\n\t\t\t\tif err := builder.check(); err != nil {\n\t\t\t\t\treturn nil, err\n\t\t\t\t}\n\t\t\t\tbuilder.mutation = mutation\n\t\t\t\tnodes[i], specs[i] = builder.createSpec()\n\t\t\t\tvar err error\n\t\t\t\tif i < len(mutators)-1 {\n\t\t\t\t\t_, err = mutators[i+1].Mutate(root, ctcb.builders[i+1].mutation)\n\t\t\t\t} else {\n\t\t\t\t\tspec := &sqlgraph.BatchCreateSpec{Nodes: specs}\n\t\t\t\t\t// Invoke the actual operation on the latest mutation in the chain.\n\t\t\t\t\tif err = sqlgraph.BatchCreate(ctx, ctcb.driver, spec); err != nil {\n\t\t\t\t\t\tif sqlgraph.IsConstraintError(err) {\n\t\t\t\t\t\t\terr = &ConstraintError{err.Error(), err}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn nil, err\n\t\t\t\t}\n\t\t\t\tmutation.id = &nodes[i].ID\n\t\t\t\tmutation.done = true\n\t\t\t\tif specs[i].ID.Value != nil {\n\t\t\t\t\tid := specs[i].ID.Value.(int64)\n\t\t\t\t\tnodes[i].ID = int(id)\n\t\t\t\t}\n\t\t\t\treturn nodes[i], nil\n\t\t\t})\n\t\t\tfor i := len(builder.hooks) - 1; i >= 0; i-- {\n\t\t\t\tmut = builder.hooks[i](mut)\n\t\t\t}\n\t\t\tmutators[i] = mut\n\t\t}(i, ctx)\n\t}\n\tif len(mutators) > 0 {\n\t\tif _, err := mutators[0].Mutate(ctx, ctcb.builders[0].mutation); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\treturn nodes, nil\n}", "func (rcb *RentalCreateBulk) Save(ctx context.Context) ([]*Rental, error) {\n\tspecs := make([]*sqlgraph.CreateSpec, len(rcb.builders))\n\tnodes := make([]*Rental, len(rcb.builders))\n\tmutators := make([]Mutator, len(rcb.builders))\n\tfor i := range rcb.builders {\n\t\tfunc(i int, root context.Context) {\n\t\t\tbuilder := rcb.builders[i]\n\t\t\tbuilder.defaults()\n\t\t\tvar mut Mutator = MutateFunc(func(ctx context.Context, m Mutation) (Value, error) {\n\t\t\t\tmutation, ok := m.(*RentalMutation)\n\t\t\t\tif !ok {\n\t\t\t\t\treturn nil, fmt.Errorf(\"unexpected mutation type %T\", m)\n\t\t\t\t}\n\t\t\t\tif err := builder.check(); err != nil {\n\t\t\t\t\treturn nil, err\n\t\t\t\t}\n\t\t\t\tbuilder.mutation = mutation\n\t\t\t\tnodes[i], specs[i] = builder.createSpec()\n\t\t\t\tvar err error\n\t\t\t\tif i < len(mutators)-1 {\n\t\t\t\t\t_, err = mutators[i+1].Mutate(root, rcb.builders[i+1].mutation)\n\t\t\t\t} else {\n\t\t\t\t\tspec := &sqlgraph.BatchCreateSpec{Nodes: specs}\n\t\t\t\t\t// Invoke the actual operation on the latest mutation in the chain.\n\t\t\t\t\tif err = sqlgraph.BatchCreate(ctx, rcb.driver, spec); err != nil {\n\t\t\t\t\t\tif sqlgraph.IsConstraintError(err) {\n\t\t\t\t\t\t\terr = &ConstraintError{msg: err.Error(), wrap: err}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn nil, err\n\t\t\t\t}\n\t\t\t\tmutation.id = &nodes[i].ID\n\t\t\t\tif specs[i].ID.Value != nil {\n\t\t\t\t\tid := specs[i].ID.Value.(int64)\n\t\t\t\t\tnodes[i].ID = int(id)\n\t\t\t\t}\n\t\t\t\tmutation.done = true\n\t\t\t\treturn nodes[i], nil\n\t\t\t})\n\t\t\tfor i := len(builder.hooks) - 1; i >= 0; i-- {\n\t\t\t\tmut = builder.hooks[i](mut)\n\t\t\t}\n\t\t\tmutators[i] = mut\n\t\t}(i, ctx)\n\t}\n\tif len(mutators) > 0 {\n\t\tif _, err := mutators[0].Mutate(ctx, rcb.builders[0].mutation); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\treturn nodes, nil\n}", "func (dcb *DatasourceCreateBulk) Save(ctx context.Context) ([]*Datasource, error) {\n\tspecs := make([]*sqlgraph.CreateSpec, len(dcb.builders))\n\tnodes := make([]*Datasource, len(dcb.builders))\n\tmutators := make([]Mutator, len(dcb.builders))\n\tfor i := range dcb.builders {\n\t\tfunc(i int, root context.Context) {\n\t\t\tbuilder := dcb.builders[i]\n\t\t\tbuilder.defaults()\n\t\t\tvar mut Mutator = MutateFunc(func(ctx context.Context, m Mutation) (Value, error) {\n\t\t\t\tmutation, ok := m.(*DatasourceMutation)\n\t\t\t\tif !ok {\n\t\t\t\t\treturn nil, fmt.Errorf(\"unexpected mutation type %T\", m)\n\t\t\t\t}\n\t\t\t\tif err := builder.check(); err != nil {\n\t\t\t\t\treturn nil, err\n\t\t\t\t}\n\t\t\t\tbuilder.mutation = mutation\n\t\t\t\tnodes[i], specs[i] = builder.createSpec()\n\t\t\t\tvar err error\n\t\t\t\tif i < len(mutators)-1 {\n\t\t\t\t\t_, err = mutators[i+1].Mutate(root, dcb.builders[i+1].mutation)\n\t\t\t\t} else {\n\t\t\t\t\t// Invoke the actual operation on the latest mutation in the chain.\n\t\t\t\t\tif err = sqlgraph.BatchCreate(ctx, dcb.driver, &sqlgraph.BatchCreateSpec{Nodes: specs}); err != nil {\n\t\t\t\t\t\tif cerr, ok := isSQLConstraintError(err); ok {\n\t\t\t\t\t\t\terr = cerr\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tmutation.done = true\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn nil, err\n\t\t\t\t}\n\t\t\t\tif nodes[i].ID == 0 {\n\t\t\t\t\tid := specs[i].ID.Value.(int64)\n\t\t\t\t\tnodes[i].ID = int64(id)\n\t\t\t\t}\n\t\t\t\treturn nodes[i], nil\n\t\t\t})\n\t\t\tfor i := len(builder.hooks) - 1; i >= 0; i-- {\n\t\t\t\tmut = builder.hooks[i](mut)\n\t\t\t}\n\t\t\tmutators[i] = mut\n\t\t}(i, ctx)\n\t}\n\tif len(mutators) > 0 {\n\t\tif _, err := mutators[0].Mutate(ctx, dcb.builders[0].mutation); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\treturn nodes, nil\n}", "func NewAdminDeleteBulkGameSessionsUnauthorized() *AdminDeleteBulkGameSessionsUnauthorized {\n\treturn &AdminDeleteBulkGameSessionsUnauthorized{}\n}", "func (ccb *ConstructionCreateBulk) Save(ctx context.Context) ([]*Construction, error) {\n\tspecs := make([]*sqlgraph.CreateSpec, len(ccb.builders))\n\tnodes := make([]*Construction, len(ccb.builders))\n\tmutators := make([]Mutator, len(ccb.builders))\n\tfor i := range ccb.builders {\n\t\tfunc(i int, root context.Context) {\n\t\t\tbuilder := ccb.builders[i]\n\t\t\tbuilder.defaults()\n\t\t\tvar mut Mutator = MutateFunc(func(ctx context.Context, m Mutation) (Value, error) {\n\t\t\t\tmutation, ok := m.(*ConstructionMutation)\n\t\t\t\tif !ok {\n\t\t\t\t\treturn nil, fmt.Errorf(\"unexpected mutation type %T\", m)\n\t\t\t\t}\n\t\t\t\tif err := builder.check(); err != nil {\n\t\t\t\t\treturn nil, err\n\t\t\t\t}\n\t\t\t\tbuilder.mutation = mutation\n\t\t\t\tnodes[i], specs[i] = builder.createSpec()\n\t\t\t\tvar err error\n\t\t\t\tif i < len(mutators)-1 {\n\t\t\t\t\t_, err = mutators[i+1].Mutate(root, ccb.builders[i+1].mutation)\n\t\t\t\t} else {\n\t\t\t\t\t// Invoke the actual operation on the latest mutation in the chain.\n\t\t\t\t\tif err = sqlgraph.BatchCreate(ctx, ccb.driver, &sqlgraph.BatchCreateSpec{Nodes: specs}); err != nil {\n\t\t\t\t\t\tif cerr, ok := isSQLConstraintError(err); ok {\n\t\t\t\t\t\t\terr = cerr\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tmutation.done = true\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn nil, err\n\t\t\t\t}\n\t\t\t\tid := specs[i].ID.Value.(int64)\n\t\t\t\tnodes[i].ID = int(id)\n\t\t\t\treturn nodes[i], nil\n\t\t\t})\n\t\t\tfor i := len(builder.hooks) - 1; i >= 0; i-- {\n\t\t\t\tmut = builder.hooks[i](mut)\n\t\t\t}\n\t\t\tmutators[i] = mut\n\t\t}(i, ctx)\n\t}\n\tif len(mutators) > 0 {\n\t\tif _, err := mutators[0].Mutate(ctx, ccb.builders[0].mutation); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\treturn nodes, nil\n}", "func (a *Client) BulkCreatePacketGenerators(params *BulkCreatePacketGeneratorsParams, opts ...ClientOption) (*BulkCreatePacketGeneratorsOK, error) {\n\t// TODO: Validate the params before sending\n\tif params == nil {\n\t\tparams = NewBulkCreatePacketGeneratorsParams()\n\t}\n\top := &runtime.ClientOperation{\n\t\tID: \"BulkCreatePacketGenerators\",\n\t\tMethod: \"POST\",\n\t\tPathPattern: \"/packet/generators/x/bulk-create\",\n\t\tProducesMediaTypes: []string{\"application/json\"},\n\t\tConsumesMediaTypes: []string{\"application/json\"},\n\t\tSchemes: []string{\"http\", \"https\"},\n\t\tParams: params,\n\t\tReader: &BulkCreatePacketGeneratorsReader{formats: a.formats},\n\t\tContext: params.Context,\n\t\tClient: params.HTTPClient,\n\t}\n\tfor _, opt := range opts {\n\t\topt(op)\n\t}\n\n\tresult, err := a.transport.Submit(op)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tsuccess, ok := result.(*BulkCreatePacketGeneratorsOK)\n\tif ok {\n\t\treturn success, nil\n\t}\n\t// unexpected success response\n\t// safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue\n\tmsg := fmt.Sprintf(\"unexpected success response for BulkCreatePacketGenerators: API contract not enforced by server. Client expected to get an error, but got: %T\", result)\n\tpanic(msg)\n}", "func (rcb *RestaurantCreateBulk) Save(ctx context.Context) ([]*Restaurant, error) {\n\tspecs := make([]*sqlgraph.CreateSpec, len(rcb.builders))\n\tnodes := make([]*Restaurant, len(rcb.builders))\n\tmutators := make([]Mutator, len(rcb.builders))\n\tfor i := range rcb.builders {\n\t\tfunc(i int, root context.Context) {\n\t\t\tbuilder := rcb.builders[i]\n\t\t\tvar mut Mutator = MutateFunc(func(ctx context.Context, m Mutation) (Value, error) {\n\t\t\t\tmutation, ok := m.(*RestaurantMutation)\n\t\t\t\tif !ok {\n\t\t\t\t\treturn nil, fmt.Errorf(\"unexpected mutation type %T\", m)\n\t\t\t\t}\n\t\t\t\tif err := builder.check(); err != nil {\n\t\t\t\t\treturn nil, err\n\t\t\t\t}\n\t\t\t\tbuilder.mutation = mutation\n\t\t\t\tnodes[i], specs[i] = builder.createSpec()\n\t\t\t\tvar err error\n\t\t\t\tif i < len(mutators)-1 {\n\t\t\t\t\t_, err = mutators[i+1].Mutate(root, rcb.builders[i+1].mutation)\n\t\t\t\t} else {\n\t\t\t\t\t// Invoke the actual operation on the latest mutation in the chain.\n\t\t\t\t\tif err = sqlgraph.BatchCreate(ctx, rcb.driver, &sqlgraph.BatchCreateSpec{Nodes: specs}); err != nil {\n\t\t\t\t\t\tif sqlgraph.IsConstraintError(err) {\n\t\t\t\t\t\t\terr = &ConstraintError{err.Error(), err}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn nil, err\n\t\t\t\t}\n\t\t\t\tmutation.id = &nodes[i].ID\n\t\t\t\tmutation.done = true\n\t\t\t\tid := specs[i].ID.Value.(int64)\n\t\t\t\tnodes[i].ID = int(id)\n\t\t\t\treturn nodes[i], nil\n\t\t\t})\n\t\t\tfor i := len(builder.hooks) - 1; i >= 0; i-- {\n\t\t\t\tmut = builder.hooks[i](mut)\n\t\t\t}\n\t\t\tmutators[i] = mut\n\t\t}(i, ctx)\n\t}\n\tif len(mutators) > 0 {\n\t\tif _, err := mutators[0].Mutate(ctx, rcb.builders[0].mutation); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\treturn nodes, nil\n}", "func (epcb *EntryPointCreateBulk) Save(ctx context.Context) ([]*EntryPoint, error) {\n\tspecs := make([]*sqlgraph.CreateSpec, len(epcb.builders))\n\tnodes := make([]*EntryPoint, len(epcb.builders))\n\tmutators := make([]Mutator, len(epcb.builders))\n\tfor i := range epcb.builders {\n\t\tfunc(i int, root context.Context) {\n\t\t\tbuilder := epcb.builders[i]\n\t\t\tbuilder.defaults()\n\t\t\tvar mut Mutator = MutateFunc(func(ctx context.Context, m Mutation) (Value, error) {\n\t\t\t\tmutation, ok := m.(*EntryPointMutation)\n\t\t\t\tif !ok {\n\t\t\t\t\treturn nil, fmt.Errorf(\"unexpected mutation type %T\", m)\n\t\t\t\t}\n\t\t\t\tif err := builder.check(); err != nil {\n\t\t\t\t\treturn nil, err\n\t\t\t\t}\n\t\t\t\tbuilder.mutation = mutation\n\t\t\t\tnodes[i], specs[i] = builder.createSpec()\n\t\t\t\tvar err error\n\t\t\t\tif i < len(mutators)-1 {\n\t\t\t\t\t_, err = mutators[i+1].Mutate(root, epcb.builders[i+1].mutation)\n\t\t\t\t} else {\n\t\t\t\t\t// Invoke the actual operation on the latest mutation in the chain.\n\t\t\t\t\tif err = sqlgraph.BatchCreate(ctx, epcb.driver, &sqlgraph.BatchCreateSpec{Nodes: specs}); err != nil {\n\t\t\t\t\t\tif cerr, ok := isSQLConstraintError(err); ok {\n\t\t\t\t\t\t\terr = cerr\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tmutation.done = true\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn nil, err\n\t\t\t\t}\n\t\t\t\tid := specs[i].ID.Value.(int64)\n\t\t\t\tnodes[i].ID = int(id)\n\t\t\t\treturn nodes[i], nil\n\t\t\t})\n\t\t\tfor i := len(builder.hooks) - 1; i >= 0; i-- {\n\t\t\t\tmut = builder.hooks[i](mut)\n\t\t\t}\n\t\t\tmutators[i] = mut\n\t\t}(i, ctx)\n\t}\n\tif len(mutators) > 0 {\n\t\tif _, err := mutators[0].Mutate(ctx, epcb.builders[0].mutation); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\treturn nodes, nil\n}", "func (accb *AccessControlCreateBulk) Save(ctx context.Context) ([]*AccessControl, error) {\n\tspecs := make([]*sqlgraph.CreateSpec, len(accb.builders))\n\tnodes := make([]*AccessControl, len(accb.builders))\n\tmutators := make([]Mutator, len(accb.builders))\n\tfor i := range accb.builders {\n\t\tfunc(i int, root context.Context) {\n\t\t\tbuilder := accb.builders[i]\n\t\t\tvar mut Mutator = MutateFunc(func(ctx context.Context, m Mutation) (Value, error) {\n\t\t\t\tmutation, ok := m.(*AccessControlMutation)\n\t\t\t\tif !ok {\n\t\t\t\t\treturn nil, fmt.Errorf(\"unexpected mutation type %T\", m)\n\t\t\t\t}\n\t\t\t\tif err := builder.check(); err != nil {\n\t\t\t\t\treturn nil, err\n\t\t\t\t}\n\t\t\t\tbuilder.mutation = mutation\n\t\t\t\tnodes[i], specs[i] = builder.createSpec()\n\t\t\t\tvar err error\n\t\t\t\tif i < len(mutators)-1 {\n\t\t\t\t\t_, err = mutators[i+1].Mutate(root, accb.builders[i+1].mutation)\n\t\t\t\t} else {\n\t\t\t\t\t// Invoke the actual operation on the latest mutation in the chain.\n\t\t\t\t\tif err = sqlgraph.BatchCreate(ctx, accb.driver, &sqlgraph.BatchCreateSpec{Nodes: specs}); err != nil {\n\t\t\t\t\t\tif cerr, ok := isSQLConstraintError(err); ok {\n\t\t\t\t\t\t\terr = cerr\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tmutation.done = true\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn nil, err\n\t\t\t\t}\n\t\t\t\tif nodes[i].ID == 0 {\n\t\t\t\t\tid := specs[i].ID.Value.(int64)\n\t\t\t\t\tnodes[i].ID = int64(id)\n\t\t\t\t}\n\t\t\t\treturn nodes[i], nil\n\t\t\t})\n\t\t\tfor i := len(builder.hooks) - 1; i >= 0; i-- {\n\t\t\t\tmut = builder.hooks[i](mut)\n\t\t\t}\n\t\t\tmutators[i] = mut\n\t\t}(i, ctx)\n\t}\n\tif len(mutators) > 0 {\n\t\tif _, err := mutators[0].Mutate(ctx, accb.builders[0].mutation); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\treturn nodes, nil\n}", "func (icb *ItemCreateBulk) Save(ctx context.Context) ([]*Item, error) {\n\tspecs := make([]*sqlgraph.CreateSpec, len(icb.builders))\n\tnodes := make([]*Item, len(icb.builders))\n\tmutators := make([]Mutator, len(icb.builders))\n\tfor i := range icb.builders {\n\t\tfunc(i int, root context.Context) {\n\t\t\tbuilder := icb.builders[i]\n\t\t\tbuilder.defaults()\n\t\t\tvar mut Mutator = MutateFunc(func(ctx context.Context, m Mutation) (Value, error) {\n\t\t\t\tmutation, ok := m.(*ItemMutation)\n\t\t\t\tif !ok {\n\t\t\t\t\treturn nil, fmt.Errorf(\"unexpected mutation type %T\", m)\n\t\t\t\t}\n\t\t\t\tif err := builder.check(); err != nil {\n\t\t\t\t\treturn nil, err\n\t\t\t\t}\n\t\t\t\tbuilder.mutation = mutation\n\t\t\t\tnodes[i], specs[i] = builder.createSpec()\n\t\t\t\tvar err error\n\t\t\t\tif i < len(mutators)-1 {\n\t\t\t\t\t_, err = mutators[i+1].Mutate(root, icb.builders[i+1].mutation)\n\t\t\t\t} else {\n\t\t\t\t\tspec := &sqlgraph.BatchCreateSpec{Nodes: specs}\n\t\t\t\t\tspec.OnConflict = icb.conflict\n\t\t\t\t\t// Invoke the actual operation on the latest mutation in the chain.\n\t\t\t\t\tif err = sqlgraph.BatchCreate(ctx, icb.driver, spec); err != nil {\n\t\t\t\t\t\tif sqlgraph.IsConstraintError(err) {\n\t\t\t\t\t\t\terr = &ConstraintError{msg: err.Error(), wrap: err}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn nil, err\n\t\t\t\t}\n\t\t\t\tmutation.id = &nodes[i].ID\n\t\t\t\tmutation.done = true\n\t\t\t\treturn nodes[i], nil\n\t\t\t})\n\t\t\tfor i := len(builder.hooks) - 1; i >= 0; i-- {\n\t\t\t\tmut = builder.hooks[i](mut)\n\t\t\t}\n\t\t\tmutators[i] = mut\n\t\t}(i, ctx)\n\t}\n\tif len(mutators) > 0 {\n\t\tif _, err := mutators[0].Mutate(ctx, icb.builders[0].mutation); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\treturn nodes, nil\n}", "func (bcb *BeerCreateBulk) Save(ctx context.Context) ([]*Beer, error) {\n\tspecs := make([]*sqlgraph.CreateSpec, len(bcb.builders))\n\tnodes := make([]*Beer, len(bcb.builders))\n\tmutators := make([]Mutator, len(bcb.builders))\n\tfor i := range bcb.builders {\n\t\tfunc(i int, root context.Context) {\n\t\t\tbuilder := bcb.builders[i]\n\t\t\tbuilder.defaults()\n\t\t\tvar mut Mutator = MutateFunc(func(ctx context.Context, m Mutation) (Value, error) {\n\t\t\t\tmutation, ok := m.(*BeerMutation)\n\t\t\t\tif !ok {\n\t\t\t\t\treturn nil, fmt.Errorf(\"unexpected mutation type %T\", m)\n\t\t\t\t}\n\t\t\t\tif err := builder.check(); err != nil {\n\t\t\t\t\treturn nil, err\n\t\t\t\t}\n\t\t\t\tbuilder.mutation = mutation\n\t\t\t\tnodes[i], specs[i] = builder.createSpec()\n\t\t\t\tvar err error\n\t\t\t\tif i < len(mutators)-1 {\n\t\t\t\t\t_, err = mutators[i+1].Mutate(root, bcb.builders[i+1].mutation)\n\t\t\t\t} else {\n\t\t\t\t\t// Invoke the actual operation on the latest mutation in the chain.\n\t\t\t\t\tif err = sqlgraph.BatchCreate(ctx, bcb.driver, &sqlgraph.BatchCreateSpec{Nodes: specs}); err != nil {\n\t\t\t\t\t\tif cerr, ok := isSQLConstraintError(err); ok {\n\t\t\t\t\t\t\terr = cerr\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tmutation.done = true\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn nil, err\n\t\t\t\t}\n\t\t\t\tif nodes[i].ID == 0 {\n\t\t\t\t\tid := specs[i].ID.Value.(int64)\n\t\t\t\t\tnodes[i].ID = int64(id)\n\t\t\t\t}\n\t\t\t\treturn nodes[i], nil\n\t\t\t})\n\t\t\tfor i := len(builder.hooks) - 1; i >= 0; i-- {\n\t\t\t\tmut = builder.hooks[i](mut)\n\t\t\t}\n\t\t\tmutators[i] = mut\n\t\t}(i, ctx)\n\t}\n\tif len(mutators) > 0 {\n\t\tif _, err := mutators[0].Mutate(ctx, bcb.builders[0].mutation); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\treturn nodes, nil\n}", "func (uccb *UseCaseCreateBulk) Save(ctx context.Context) ([]*UseCase, error) {\n\tspecs := make([]*sqlgraph.CreateSpec, len(uccb.builders))\n\tnodes := make([]*UseCase, len(uccb.builders))\n\tmutators := make([]Mutator, len(uccb.builders))\n\tfor i := range uccb.builders {\n\t\tfunc(i int, root context.Context) {\n\t\t\tbuilder := uccb.builders[i]\n\t\t\tvar mut Mutator = MutateFunc(func(ctx context.Context, m Mutation) (Value, error) {\n\t\t\t\tmutation, ok := m.(*UseCaseMutation)\n\t\t\t\tif !ok {\n\t\t\t\t\treturn nil, fmt.Errorf(\"unexpected mutation type %T\", m)\n\t\t\t\t}\n\t\t\t\tif err := builder.check(); err != nil {\n\t\t\t\t\treturn nil, err\n\t\t\t\t}\n\t\t\t\tbuilder.mutation = mutation\n\t\t\t\tnodes[i], specs[i] = builder.createSpec()\n\t\t\t\tvar err error\n\t\t\t\tif i < len(mutators)-1 {\n\t\t\t\t\t_, err = mutators[i+1].Mutate(root, uccb.builders[i+1].mutation)\n\t\t\t\t} else {\n\t\t\t\t\tspec := &sqlgraph.BatchCreateSpec{Nodes: specs}\n\t\t\t\t\t// Invoke the actual operation on the latest mutation in the chain.\n\t\t\t\t\tif err = sqlgraph.BatchCreate(ctx, uccb.driver, spec); err != nil {\n\t\t\t\t\t\tif sqlgraph.IsConstraintError(err) {\n\t\t\t\t\t\t\terr = &ConstraintError{err.Error(), err}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn nil, err\n\t\t\t\t}\n\t\t\t\tmutation.id = &nodes[i].ID\n\t\t\t\tmutation.done = true\n\t\t\t\tif specs[i].ID.Value != nil {\n\t\t\t\t\tid := specs[i].ID.Value.(int64)\n\t\t\t\t\tnodes[i].ID = int(id)\n\t\t\t\t}\n\t\t\t\treturn nodes[i], nil\n\t\t\t})\n\t\t\tfor i := len(builder.hooks) - 1; i >= 0; i-- {\n\t\t\t\tmut = builder.hooks[i](mut)\n\t\t\t}\n\t\t\tmutators[i] = mut\n\t\t}(i, ctx)\n\t}\n\tif len(mutators) > 0 {\n\t\tif _, err := mutators[0].Mutate(ctx, uccb.builders[0].mutation); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\treturn nodes, nil\n}" ]
[ "0.7377255", "0.699056", "0.67902356", "0.67629045", "0.67629045", "0.67629045", "0.67629045", "0.67629045", "0.67545164", "0.6677241", "0.66657", "0.66168404", "0.6615641", "0.65874684", "0.6580366", "0.6561537", "0.6553391", "0.6532369", "0.6529623", "0.6502928", "0.6446125", "0.64314544", "0.64257693", "0.636808", "0.63665235", "0.6363439", "0.6309784", "0.6266891", "0.6264383", "0.6247307", "0.62057686", "0.6192169", "0.6122605", "0.60990596", "0.60987186", "0.6072529", "0.6013642", "0.5965088", "0.5930215", "0.5923877", "0.5884767", "0.585519", "0.5800612", "0.57431436", "0.57316715", "0.5717841", "0.5708662", "0.5666147", "0.5628188", "0.5288585", "0.51198864", "0.5098965", "0.5072711", "0.5051706", "0.504865", "0.5035745", "0.50219506", "0.50197333", "0.50021535", "0.49942937", "0.4978839", "0.4968059", "0.49545327", "0.49480954", "0.4926082", "0.4908084", "0.49042302", "0.48672912", "0.48555815", "0.48406383", "0.4803936", "0.47893915", "0.47644827", "0.4742417", "0.4740946", "0.4729203", "0.4725376", "0.4715857", "0.47092736", "0.46902543", "0.4668466", "0.46611768", "0.46411672", "0.4635091", "0.46309304", "0.46223566", "0.46159333", "0.46046272", "0.46019825", "0.46006998", "0.4591299", "0.45875055", "0.458351", "0.45795223", "0.45784578", "0.45212865", "0.45109144", "0.45078284", "0.44804224", "0.44487834" ]
0.818071
0
Update returns an update builder for AdminSession.
func (c *AdminSessionClient) Update() *AdminSessionUpdate { mutation := newAdminSessionMutation(c.config, OpUpdate) return &AdminSessionUpdate{config: c.config, hooks: c.Hooks(), mutation: mutation} }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (c *AdminClient) Update() *AdminUpdate {\n\tmutation := newAdminMutation(c.config, OpUpdate)\n\treturn &AdminUpdate{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func UpdateAdmin(w http.ResponseWriter, r *http.Request) {\n\tvar body UpdateAdminRequest\n\tif err := read.JSON(r.Body, &body); err != nil {\n\t\trender.Error(w, admin.WrapError(admin.ErrorBadRequestType, err, \"error reading request body\"))\n\t\treturn\n\t}\n\n\tif err := body.Validate(); err != nil {\n\t\trender.Error(w, err)\n\t\treturn\n\t}\n\n\tid := chi.URLParam(r, \"id\")\n\tauth := mustAuthority(r.Context())\n\tadm, err := auth.UpdateAdmin(r.Context(), id, &linkedca.Admin{Type: body.Type})\n\tif err != nil {\n\t\trender.Error(w, admin.WrapErrorISE(err, \"error updating admin %s\", id))\n\t\treturn\n\t}\n\n\trender.ProtoJSON(w, adm)\n}", "func (c *MealplanClient) Update() *MealplanUpdate {\n\tmutation := newMealplanMutation(c.config, OpUpdate)\n\treturn &MealplanUpdate{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (m *manager) AdminUpdate(ctx context.Context) error {\n\ttoRun := m.adminUpdate()\n\treturn m.runSteps(ctx, toRun, \"adminUpdate\")\n}", "func (a *Admin) Update() (*mongo.UpdateResult, error) {\n\ta.ModifiedAt = variable.DateTimeNowPtr()\n\n\tupdate := bson.M{\"$set\": *a}\n\treturn a.Collection().UpdateOne(context.Background(), bson.M{\"_id\": a.ID}, update)\n}", "func (d *UpdateBuilder) UpdateBuilder(setMap map[string]interface{}) squirrel.UpdateBuilder {\n\tqry := squirrel.Update(d.table).SetMap(setMap)\n\tif d.HasJoins() {\n\t\twith, where := d.preparePrefixExprForCondition()\n\t\tqry = qry.PrefixExpr(with).Where(where)\n\t} else {\n\t\tparams := d.generateConditionOptionPreprocessParams()\n\t\tqry = ApplyPaging(d.StatementBuilder, qry)\n\t\tqry = ApplySort(d.StatementBuilder, params, qry)\n\t\tqry = ApplyConditions(d.Where, params, qry)\n\t}\n\treturn qry\n}", "func (g guildMemberQueryBuilder) UpdateBuilder() UpdateGuildMemberBuilder {\n\tbuilder := &updateGuildMemberBuilder{}\n\tbuilder.r.itemFactory = func() interface{} {\n\t\treturn &Member{\n\t\t\tGuildID: g.gid,\n\t\t\tUserID: g.uid,\n\t\t}\n\t}\n\tbuilder.r.flags = g.flags\n\tbuilder.r.setup(g.client.req, &httd.Request{\n\t\tMethod: http.MethodPatch,\n\t\tCtx: g.ctx,\n\t\tEndpoint: endpoint.GuildMember(g.gid, g.uid),\n\t\tContentType: httd.ContentTypeJSON,\n\t}, nil)\n\n\t// TODO: cache member changes\n\treturn builder\n}", "func (c *SessionClient) Update() *SessionUpdate {\n\tmutation := newSessionMutation(c.config, OpUpdate)\n\treturn &SessionUpdate{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *BuildingClient) Update() *BuildingUpdate {\n\tmutation := newBuildingMutation(c.config, OpUpdate)\n\treturn &BuildingUpdate{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *ModuleClient) Update() *ModuleUpdate {\n\treturn &ModuleUpdate{config: c.config}\n}", "func (c *RoomuseClient) Update() *RoomuseUpdate {\n\tmutation := newRoomuseMutation(c.config, OpUpdate)\n\treturn &RoomuseUpdate{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (svc *AdminSvcService) Update(s *library.Service) (*library.Service, *Response, error) {\n\t// set the API endpoint path we send the request to\n\tu := \"/api/v1/admin/service\"\n\n\t// library Service type we want to return\n\tv := new(library.Service)\n\n\t// send request using client\n\tresp, err := svc.client.Call(\"PUT\", u, s, v)\n\n\treturn v, resp, err\n}", "func (c *PatientroomClient) Update() *PatientroomUpdate {\n\tmutation := newPatientroomMutation(c.config, OpUpdate)\n\treturn &PatientroomUpdate{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *CleaningroomClient) Update() *CleaningroomUpdate {\n\tmutation := newCleaningroomMutation(c.config, OpUpdate)\n\treturn &CleaningroomUpdate{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (svc *AdminUserService) Update(u *library.User) (*library.User, *Response, error) {\n\t// set the API endpoint path we send the request to\n\turl := \"/api/v1/admin/user\"\n\n\t// library User type we want to return\n\tv := new(library.User)\n\n\t// send request using client\n\tresp, err := svc.client.Call(\"PUT\", url, u, v)\n\n\treturn v, resp, err\n}", "func (ad *Admin) Update() error {\n\tif ad.dbCollection == nil {\n\t\treturn errors.New(\"Uninitialized Object Admin\")\n\t}\n\tquery := bson.M{\"uid\": ad.UID}\n\tchange := bson.M{\"$set\": ad}\n\treturn ad.dbCollection.Update(query, change)\n}", "func (c *OperationroomClient) Update() *OperationroomUpdate {\n\tmutation := newOperationroomMutation(c.config, OpUpdate)\n\treturn &OperationroomUpdate{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (svc *AdminSecretService) Update(s *library.Secret) (*library.Secret, *Response, error) {\n\t// set the API endpoint path we send the request to\n\tu := \"/api/v1/admin/secret\"\n\n\t// library Secret type we want to return\n\tv := new(library.Secret)\n\n\t// send request using client\n\tresp, err := svc.client.Call(\"PUT\", u, s, v)\n\n\treturn v, resp, err\n}", "func (c *RoomdetailClient) Update() *RoomdetailUpdate {\n\tmutation := newRoomdetailMutation(c.config, OpUpdate)\n\treturn &RoomdetailUpdate{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *RoomClient) Update() *RoomUpdate {\n\tmutation := newRoomMutation(c.config, OpUpdate)\n\treturn &RoomUpdate{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *RoomClient) Update() *RoomUpdate {\n\tmutation := newRoomMutation(c.config, OpUpdate)\n\treturn &RoomUpdate{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (svc *AdminBuildService) Update(b *library.Build) (*library.Build, *Response, error) {\n\t// set the API endpoint path we send the request to\n\tu := \"/api/v1/admin/build\"\n\n\t// library Build type we want to return\n\tv := new(library.Build)\n\n\t// send request using client\n\tresp, err := svc.client.Call(\"PUT\", u, b, v)\n\n\treturn v, resp, err\n}", "func (u *Session) Update() error {\n\treturn DB.UpdateSession(u)\n}", "func (c *BedtypeClient) Update() *BedtypeUpdate {\n\tmutation := newBedtypeMutation(c.config, OpUpdate)\n\treturn &BedtypeUpdate{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *PhysicianClient) Update() *PhysicianUpdate {\n\tmutation := newPhysicianMutation(c.config, OpUpdate)\n\treturn &PhysicianUpdate{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *PhysicianClient) Update() *PhysicianUpdate {\n\tmutation := newPhysicianMutation(c.config, OpUpdate)\n\treturn &PhysicianUpdate{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (s *Session) Update() *SessionUpdateOne {\n\treturn (&SessionClient{config: s.config}).UpdateOne(s)\n}", "func (c *DoctorClient) Update() *DoctorUpdate {\n\tmutation := newDoctorMutation(c.config, OpUpdate)\n\treturn &DoctorUpdate{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *ExaminationroomClient) Update() *ExaminationroomUpdate {\n\tmutation := newExaminationroomMutation(c.config, OpUpdate)\n\treturn &ExaminationroomUpdate{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (m *GraphBaseServiceClient) Admin()(*i7c9d1b36ac198368c1d8bed014b43e2a518b170ee45bf02c8bbe64544a50539a.AdminRequestBuilder) {\n return i7c9d1b36ac198368c1d8bed014b43e2a518b170ee45bf02c8bbe64544a50539a.NewAdminRequestBuilderInternal(m.pathParameters, m.requestAdapter);\n}", "func (m *GraphBaseServiceClient) Admin()(*i7c9d1b36ac198368c1d8bed014b43e2a518b170ee45bf02c8bbe64544a50539a.AdminRequestBuilder) {\n return i7c9d1b36ac198368c1d8bed014b43e2a518b170ee45bf02c8bbe64544a50539a.NewAdminRequestBuilderInternal(m.pathParameters, m.requestAdapter);\n}", "func (c *OperativeClient) Update() *OperativeUpdate {\n\tmutation := newOperativeMutation(c.config, OpUpdate)\n\treturn &OperativeUpdate{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (session *Session) ForUpdate() *Session {\n\tsession.Session = session.Session.ForUpdate()\n\treturn session\n}", "func (_Bindings *BindingsSession) Admin() (common.Address, error) {\n\treturn _Bindings.Contract.Admin(&_Bindings.CallOpts)\n}", "func (c *LevelOfDangerousClient) Update() *LevelOfDangerousUpdate {\n\tmutation := newLevelOfDangerousMutation(c.config, OpUpdate)\n\treturn &LevelOfDangerousUpdate{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func NewUpdateBuilder() *UpdateBuilder {\n\treturn &UpdateBuilder{}\n}", "func (c *AdminSessionClient) UpdateOne(as *AdminSession) *AdminSessionUpdateOne {\n\tmutation := newAdminSessionMutation(c.config, OpUpdateOne, withAdminSession(as))\n\treturn &AdminSessionUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *ModuleVersionClient) Update() *ModuleVersionUpdate {\n\treturn &ModuleVersionUpdate{config: c.config}\n}", "func Update(table string) *UpdateBuilder {\n\treturn NewUpdateBuilder(table)\n}", "func (svc *AdminStepService) Update(s *library.Step) (*library.Step, *Response, error) {\n\t// set the API endpoint path we send the request to\n\tu := \"/api/v1/admin/step\"\n\n\t// library Step type we want to return\n\tv := new(library.Step)\n\n\t// send request using client\n\tresp, err := svc.client.Call(\"PUT\", u, s, v)\n\n\treturn v, resp, err\n}", "func (_Bindings *BindingsCallerSession) Admin() (common.Address, error) {\n\treturn _Bindings.Contract.Admin(&_Bindings.CallOpts)\n}", "func (orm *ORM) UpdateAdmin(ctx context.Context, adminID string, fullname *string, email *string, phone *string) (bool, error) {\n\tvar _Admin models.Admin\n\n\terr := orm.DB.DB.First(&_Admin, \"id = ?\", adminID).Error\n\tif errors.Is(err, gorm.ErrRecordNotFound) {\n\t\treturn false, errors.New(\"AdminNotFound\")\n\t}\n\n\tif fullname != nil {\n\t\t_Admin.FullName = *fullname\n\t}\n\tif email != nil {\n\t\t_Admin.Email = *email\n\t}\n\tif phone != nil {\n\t\t_Admin.Phone = phone\n\t}\n\torm.DB.DB.Save(&_Admin)\n\treturn true, nil\n\n}", "func (s *rpcServer) UpdateAdmin(ctx context.Context, req *api.UpdateAdminRequest) (*api.UpdateAdminResponse, error) {\n\tlogger := log.GetLogger(ctx)\n\tlogger.Debugf(\"%+v\", req)\n\tadmin, err := admin.ByID(req.AdminId)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\t// Update all the fields\n\tadmin.Name = req.Admin.Name\n\tadmin.Email = req.Admin.Email\n\tadmin.ACL = req.Admin.ACL\n\tif err := admin.Save(); err != nil {\n\t\treturn nil, errors.Wrap(err, \"error while saving admin to db\")\n\t}\n\treturn &api.UpdateAdminResponse{\n\t\tAdmin: &api.Admin{\n\t\t\tId: admin.ID,\n\t\t\tName: admin.Name,\n\t\t\tEmail: admin.Email,\n\t\t\tACL: admin.ACL,\n\t\t},\n\t}, nil\n}", "func (c *UnitOfMedicineClient) Update() *UnitOfMedicineUpdate {\n\tmutation := newUnitOfMedicineMutation(c.config, OpUpdate)\n\treturn &UnitOfMedicineUpdate{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (m *Module) Update() (*Module, error) {\n\tif err := database.BackendDB.DB.Save(m).Error; err != nil {\n\t\tlog.Print(err)\n\t\treturn nil, err\n\t}\n\treturn m, nil\n}", "func (c *AppointmentClient) Update() *AppointmentUpdate {\n\tmutation := newAppointmentMutation(c.config, OpUpdate)\n\treturn &AppointmentUpdate{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (_obj *Apichannels) Channels_editAdmin(params *TLchannels_editAdmin, _opt ...map[string]string) (ret Updates, err error) {\n\n\tvar length int32\n\tvar have bool\n\tvar ty byte\n\t_os := codec.NewBuffer()\n\terr = params.WriteBlock(_os, 1)\n\tif err != nil {\n\t\treturn ret, err\n\t}\n\n\tvar _status map[string]string\n\tvar _context map[string]string\n\tif len(_opt) == 1 {\n\t\t_context = _opt[0]\n\t} else if len(_opt) == 2 {\n\t\t_context = _opt[0]\n\t\t_status = _opt[1]\n\t}\n\t_resp := new(requestf.ResponsePacket)\n\ttarsCtx := context.Background()\n\n\terr = _obj.s.Tars_invoke(tarsCtx, 0, \"channels_editAdmin\", _os.ToBytes(), _status, _context, _resp)\n\tif err != nil {\n\t\treturn ret, err\n\t}\n\n\t_is := codec.NewReader(tools.Int8ToByte(_resp.SBuffer))\n\terr = ret.ReadBlock(_is, 0, true)\n\tif err != nil {\n\t\treturn ret, err\n\t}\n\n\tif len(_opt) == 1 {\n\t\tfor k := range _context {\n\t\t\tdelete(_context, k)\n\t\t}\n\t\tfor k, v := range _resp.Context {\n\t\t\t_context[k] = v\n\t\t}\n\t} else if len(_opt) == 2 {\n\t\tfor k := range _context {\n\t\t\tdelete(_context, k)\n\t\t}\n\t\tfor k, v := range _resp.Context {\n\t\t\t_context[k] = v\n\t\t}\n\t\tfor k := range _status {\n\t\t\tdelete(_status, k)\n\t\t}\n\t\tfor k, v := range _resp.Status {\n\t\t\t_status[k] = v\n\t\t}\n\n\t}\n\t_ = length\n\t_ = have\n\t_ = ty\n\treturn ret, nil\n}", "func (c *ClubapplicationClient) Update() *ClubapplicationUpdate {\n\tmutation := newClubapplicationMutation(c.config, OpUpdate)\n\treturn &ClubapplicationUpdate{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (r *DeviceAppManagementRequest) Update(ctx context.Context, reqObj *DeviceAppManagement) error {\n\treturn r.JSONRequest(ctx, \"PATCH\", \"\", reqObj, nil)\n}", "func (svc *AdminDeploymentService) Update(d *library.Deployment) (*library.Deployment, *Response, error) {\n\t// set the API endpoint path we send the request to\n\tu := \"/api/v1/admin/deployment\"\n\n\t// library Deployment type we want to return\n\tv := new(library.Deployment)\n\n\t// send request using client\n\tresp, err := svc.client.Call(\"PUT\", u, d, v)\n\n\treturn v, resp, err\n}", "func (c *MedicineClient) Update() *MedicineUpdate {\n\tmutation := newMedicineMutation(c.config, OpUpdate)\n\treturn &MedicineUpdate{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (r *DeviceManagementComplexSettingInstanceRequest) Update(ctx context.Context, reqObj *DeviceManagementComplexSettingInstance) error {\n\treturn r.JSONRequest(ctx, \"PATCH\", \"\", reqObj, nil)\n}", "func (_EtherDelta *EtherDeltaSession) Admin() (common.Address, error) {\n\treturn _EtherDelta.Contract.Admin(&_EtherDelta.CallOpts)\n}", "func (c *BeerClient) Update() *BeerUpdate {\n\tmutation := newBeerMutation(c.config, OpUpdate)\n\treturn &BeerUpdate{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *FoodmenuClient) Update() *FoodmenuUpdate {\n\tmutation := newFoodmenuMutation(c.config, OpUpdate)\n\treturn &FoodmenuUpdate{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (*AdminInfoService) UpdateInfo(id int, pwd string) error {\n\tadm := new(entities.AdminInfo)\n\tadm.AdminPwd = pwd\n\n\t_, err := entities.MasterEngine.Id(id).Update(adm)\n\n\treturn err\n}", "func (_Contract *ContractSession) Admin() (common.Address, error) {\n\treturn _Contract.Contract.Admin(&_Contract.CallOpts)\n}", "func (e *Event) Update(c echo.Context, req *Update) (*takrib.Event, error) {\n\t// if err := e.rbac.EnforceEvent(c, req.ID); err != nil {\n\t// \treturn nil, err\n\t// }\n\n\tevent, err := e.udb.View(e.db, req.ID)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tstructs.Merge(event, req)\n\tif err := e.udb.Update(e.db, event); err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn event, nil\n}", "func (s *Session) Update() error {\n\ttReq := &Request{\n\t\tMethod: \"session-get\",\n\t}\n\tr := &Response{Arguments: s}\n\n\terr := s.Client.request(tReq, r)\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "func (c *PharmacistClient) Update() *PharmacistUpdate {\n\tmutation := newPharmacistMutation(c.config, OpUpdate)\n\treturn &PharmacistUpdate{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (_EtherDelta *EtherDeltaCallerSession) Admin() (common.Address, error) {\n\treturn _EtherDelta.Contract.Admin(&_EtherDelta.CallOpts)\n}", "func (c *DeviceClient) Update() *DeviceUpdate {\n\tmutation := newDeviceMutation(c.config, OpUpdate)\n\treturn &DeviceUpdate{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (qs ControlQS) Update() ControlUpdateQS {\n\treturn ControlUpdateQS{condFragments: qs.condFragments}\n}", "func (au *AdminUpdate) Where(ps ...predicate.Admin) *AdminUpdate {\n\tau.mutation.predicates = append(au.mutation.predicates, ps...)\n\treturn au\n}", "func (_Cakevault *CakevaultSession) Admin() (common.Address, error) {\n\treturn _Cakevault.Contract.Admin(&_Cakevault.CallOpts)\n}", "func (_obj *Apichannels) Channels_editAdminWithContext(tarsCtx context.Context, params *TLchannels_editAdmin, _opt ...map[string]string) (ret Updates, err error) {\n\n\tvar length int32\n\tvar have bool\n\tvar ty byte\n\t_os := codec.NewBuffer()\n\terr = params.WriteBlock(_os, 1)\n\tif err != nil {\n\t\treturn ret, err\n\t}\n\n\tvar _status map[string]string\n\tvar _context map[string]string\n\tif len(_opt) == 1 {\n\t\t_context = _opt[0]\n\t} else if len(_opt) == 2 {\n\t\t_context = _opt[0]\n\t\t_status = _opt[1]\n\t}\n\t_resp := new(requestf.ResponsePacket)\n\n\terr = _obj.s.Tars_invoke(tarsCtx, 0, \"channels_editAdmin\", _os.ToBytes(), _status, _context, _resp)\n\tif err != nil {\n\t\treturn ret, err\n\t}\n\n\t_is := codec.NewReader(tools.Int8ToByte(_resp.SBuffer))\n\terr = ret.ReadBlock(_is, 0, true)\n\tif err != nil {\n\t\treturn ret, err\n\t}\n\n\tif len(_opt) == 1 {\n\t\tfor k := range _context {\n\t\t\tdelete(_context, k)\n\t\t}\n\t\tfor k, v := range _resp.Context {\n\t\t\t_context[k] = v\n\t\t}\n\t} else if len(_opt) == 2 {\n\t\tfor k := range _context {\n\t\t\tdelete(_context, k)\n\t\t}\n\t\tfor k, v := range _resp.Context {\n\t\t\t_context[k] = v\n\t\t}\n\t\tfor k := range _status {\n\t\t\tdelete(_status, k)\n\t\t}\n\t\tfor k, v := range _resp.Status {\n\t\t\t_status[k] = v\n\t\t}\n\n\t}\n\t_ = length\n\t_ = have\n\t_ = ty\n\treturn ret, nil\n}", "func (c *EmployeeClient) Update() *EmployeeUpdate {\n\tmutation := newEmployeeMutation(c.config, OpUpdate)\n\treturn &EmployeeUpdate{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *EmployeeClient) Update() *EmployeeUpdate {\n\tmutation := newEmployeeMutation(c.config, OpUpdate)\n\treturn &EmployeeUpdate{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *EmployeeClient) Update() *EmployeeUpdate {\n\tmutation := newEmployeeMutation(c.config, OpUpdate)\n\treturn &EmployeeUpdate{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (r *DeviceManagementAbstractComplexSettingInstanceRequest) Update(ctx context.Context, reqObj *DeviceManagementAbstractComplexSettingInstance) error {\n\treturn r.JSONRequest(ctx, \"PATCH\", \"\", reqObj, nil)\n}", "func (c *UsertypeClient) Update() *UsertypeUpdate {\n\tmutation := newUsertypeMutation(c.config, OpUpdate)\n\treturn &UsertypeUpdate{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *StatusdClient) Update() *StatusdUpdate {\n\tmutation := newStatusdMutation(c.config, OpUpdate)\n\treturn &StatusdUpdate{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (svc *AdminRepoService) Update(r *library.Repo) (*library.Repo, *Response, error) {\n\t// set the API endpoint path we send the request to\n\tu := \"/api/v1/admin/repo\"\n\n\t// library Repo type we want to return\n\tv := new(library.Repo)\n\n\t// send request using client\n\tresp, err := svc.client.Call(\"PUT\", u, r, v)\n\n\treturn v, resp, err\n}", "func (c *PatientofphysicianClient) Update() *PatientofphysicianUpdate {\n\tmutation := newPatientofphysicianMutation(c.config, OpUpdate)\n\treturn &PatientofphysicianUpdate{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (_Cakevault *CakevaultCallerSession) Admin() (common.Address, error) {\n\treturn _Cakevault.Contract.Admin(&_Cakevault.CallOpts)\n}", "func (a *Agentkyc) Update() *AgentkycUpdateOne {\n\treturn (&AgentkycClient{config: a.config}).UpdateOne(a)\n}", "func (aaa *ThirdPartyService) AdminUpdateThirdPartyConfig(input *third_party.AdminUpdateThirdPartyConfigParams) (*lobbyclientmodels.ModelsUpdateConfigResponse, error) {\n\ttoken, err := aaa.TokenRepository.GetToken()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tok, badRequest, unauthorized, forbidden, internalServerError, err := aaa.Client.ThirdParty.AdminUpdateThirdPartyConfig(input, client.BearerToken(*token.AccessToken))\n\tif badRequest != nil {\n\t\treturn nil, badRequest\n\t}\n\tif unauthorized != nil {\n\t\treturn nil, unauthorized\n\t}\n\tif forbidden != nil {\n\t\treturn nil, forbidden\n\t}\n\tif internalServerError != nil {\n\t\treturn nil, internalServerError\n\t}\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn ok.GetPayload(), nil\n}", "func (c *MedicineTypeClient) Update() *MedicineTypeUpdate {\n\tmutation := newMedicineTypeMutation(c.config, OpUpdate)\n\treturn &MedicineTypeUpdate{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *FacultyClient) Update() *FacultyUpdate {\n\tmutation := newFacultyMutation(c.config, OpUpdate)\n\treturn &FacultyUpdate{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *PatientClient) Update() *PatientUpdate {\n\tmutation := newPatientMutation(c.config, OpUpdate)\n\treturn &PatientUpdate{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *PatientClient) Update() *PatientUpdate {\n\tmutation := newPatientMutation(c.config, OpUpdate)\n\treturn &PatientUpdate{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *PatientClient) Update() *PatientUpdate {\n\tmutation := newPatientMutation(c.config, OpUpdate)\n\treturn &PatientUpdate{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (w *Wrapper) Update(data interface{}) (err error) {\n\tw.query = w.buildUpdate(data)\n\t_, err = w.executeQuery()\n\treturn\n}", "func (u SysDBUpdater) Update() error {\n\treturn u.db.Updates(u.fields).Error\n}", "func (c *ToolClient) Update() *ToolUpdate {\n\tmutation := newToolMutation(c.config, OpUpdate)\n\treturn &ToolUpdate{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func Update(table string) *UpdateBuilder {\n\treturn DefaultFlavor.NewUpdateBuilder().Update(table)\n}", "func (c *PurposeClient) Update() *PurposeUpdate {\n\tmutation := newPurposeMutation(c.config, OpUpdate)\n\treturn &PurposeUpdate{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (r *RoleManagementRequest) Update(ctx context.Context, reqObj *RoleManagement) error {\n\treturn r.JSONRequest(ctx, \"PATCH\", \"\", reqObj, nil)\n}", "func (c *PartorderClient) Update() *PartorderUpdate {\n\tmutation := newPartorderMutation(c.config, OpUpdate)\n\treturn &PartorderUpdate{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func NewUpdateBuilder() *UpdateBuilder {\n\treturn DefaultFlavor.NewUpdateBuilder()\n}", "func (r *DeviceManagementRequest) Update(ctx context.Context, reqObj *DeviceManagement) error {\n\treturn r.JSONRequest(ctx, \"PATCH\", \"\", reqObj, nil)\n}", "func (au *AdministratorUpdate) Where(ps ...predicate.Administrator) *AdministratorUpdate {\n\tau.mutation.predicates = append(au.mutation.predicates, ps...)\n\treturn au\n}", "func (c *DepartmentClient) Update() *DepartmentUpdate {\n\tmutation := newDepartmentMutation(c.config, OpUpdate)\n\treturn &DepartmentUpdate{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (b *Builder) Update(updates ...Eq) *Builder {\r\n\tb.updates = updates\r\n\tb.optype = updateType\r\n\treturn b\r\n}", "func (dau *DdgAdminUser) Update(ctx context.Context, key ...interface{}) error {\n\tvar err error\n\tvar dbConn *sql.DB\n\n\t// if deleted, bail\n\tif dau._deleted {\n\t\treturn errors.New(\"update failed: marked for deletion\")\n\t}\n\n\ttx, err := components.M.GetConnFromCtx(ctx)\n\tif err != nil {\n\t\tdbConn, err = components.M.GetMasterConn()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\ttableName, err := GetDdgAdminUserTableName(key...)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// sql query\n\tsqlstr := `UPDATE ` + tableName + ` SET ` +\n\t\t`name = ?, account = ?, password = ?, permission_ids = ?, status = ?` +\n\t\t` WHERE id = ?`\n\n\t// run query\n\tutils.GetTraceLog(ctx).Debug(\"DB\", zap.String(\"SQL\", fmt.Sprint(sqlstr, dau.Name, dau.Account, dau.Password, dau.PermissionIds, dau.Status, dau.ID)))\n\tif tx != nil {\n\t\t_, err = tx.Exec(sqlstr, dau.Name, dau.Account, dau.Password, dau.PermissionIds, dau.Status, dau.ID)\n\t} else {\n\t\t_, err = dbConn.Exec(sqlstr, dau.Name, dau.Account, dau.Password, dau.PermissionIds, dau.Status, dau.ID)\n\t}\n\treturn err\n}", "func (_Contract *ContractCallerSession) Admin() (common.Address, error) {\n\treturn _Contract.Contract.Admin(&_Contract.CallOpts)\n}", "func (c *DNSBLQueryClient) Update() *DNSBLQueryUpdate {\n\tmutation := newDNSBLQueryMutation(c.config, OpUpdate)\n\treturn &DNSBLQueryUpdate{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (o *DesktopApp) Update() (*restapi.GenericMapResponse, error) {\n\tif o.ID == \"\" {\n\t\treturn nil, errors.New(\"error: ID is empty\")\n\t}\n\tvar queryArg = make(map[string]interface{})\n\tqueryArg, err := generateRequestMap(o)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tqueryArg[\"_RowKey\"] = o.ID\n\n\tLogD.Printf(\"Generated Map for Update(): %+v\", queryArg)\n\n\tresp, err := o.client.CallGenericMapAPI(o.apiUpdate, queryArg)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif !resp.Success {\n\t\treturn nil, errors.New(resp.Message)\n\t}\n\n\treturn resp, nil\n}", "func (c *UserClient) Update() *UserUpdate {\n\tmutation := newUserMutation(c.config, OpUpdate)\n\treturn &UserUpdate{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *UserClient) Update() *UserUpdate {\n\tmutation := newUserMutation(c.config, OpUpdate)\n\treturn &UserUpdate{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}" ]
[ "0.6594194", "0.6322235", "0.598717", "0.5960622", "0.5846746", "0.5826112", "0.5811864", "0.5804149", "0.57580245", "0.5660917", "0.5660261", "0.56280833", "0.5571868", "0.5561991", "0.5547265", "0.5546196", "0.5534856", "0.552704", "0.552389", "0.5499594", "0.5499594", "0.54978377", "0.54672897", "0.54660004", "0.54566586", "0.54566586", "0.5438423", "0.5428911", "0.5409052", "0.5407755", "0.5407755", "0.54068077", "0.5404904", "0.53991187", "0.5393153", "0.5388809", "0.53830546", "0.538082", "0.5369799", "0.5363803", "0.53605586", "0.5360267", "0.53507227", "0.5316665", "0.5304462", "0.53002673", "0.52785206", "0.52777034", "0.52702975", "0.5269138", "0.52619654", "0.5257868", "0.5254411", "0.5231312", "0.52210456", "0.51983804", "0.51972723", "0.51964885", "0.51861495", "0.5185245", "0.51760346", "0.51694155", "0.51684916", "0.51640844", "0.51585215", "0.51570666", "0.5152143", "0.5152143", "0.5152143", "0.51509", "0.514352", "0.5143334", "0.51407224", "0.5128512", "0.5124184", "0.5122897", "0.5122228", "0.51209664", "0.5120113", "0.5118728", "0.5118728", "0.5118728", "0.5118103", "0.5116956", "0.5100462", "0.5097338", "0.50958765", "0.5095328", "0.5094498", "0.50850403", "0.50848067", "0.5079252", "0.50768554", "0.5076085", "0.5074276", "0.5069758", "0.5061331", "0.5057089", "0.5053027", "0.5053027" ]
0.69243103
0
UpdateOne returns an update builder for the given entity.
func (c *AdminSessionClient) UpdateOne(as *AdminSession) *AdminSessionUpdateOne { mutation := newAdminSessionMutation(c.config, OpUpdateOne, withAdminSession(as)) return &AdminSessionUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation} }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (c *BuildingClient) UpdateOne(b *Building) *BuildingUpdateOne {\n\tmutation := newBuildingMutation(c.config, OpUpdateOne, withBuilding(b))\n\treturn &BuildingUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *BedtypeClient) UpdateOne(b *Bedtype) *BedtypeUpdateOne {\n\tmutation := newBedtypeMutation(c.config, OpUpdateOne, withBedtype(b))\n\treturn &BedtypeUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *EmptyClient) UpdateOne(e *Empty) *EmptyUpdateOne {\n\tmutation := newEmptyMutation(c.config, OpUpdateOne, withEmpty(e))\n\treturn &EmptyUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *DentistClient) UpdateOne(d *Dentist) *DentistUpdateOne {\n\tmutation := newDentistMutation(c.config, OpUpdateOne, withDentist(d))\n\treturn &DentistUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *BeerClient) UpdateOne(b *Beer) *BeerUpdateOne {\n\tmutation := newBeerMutation(c.config, OpUpdateOne, withBeer(b))\n\treturn &BeerUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *BillClient) UpdateOne(b *Bill) *BillUpdateOne {\n\tmutation := newBillMutation(c.config, OpUpdateOne, withBill(b))\n\treturn &BillUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *BillClient) UpdateOne(b *Bill) *BillUpdateOne {\n\tmutation := newBillMutation(c.config, OpUpdateOne, withBill(b))\n\treturn &BillUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *BillClient) UpdateOne(b *Bill) *BillUpdateOne {\n\tmutation := newBillMutation(c.config, OpUpdateOne, withBill(b))\n\treturn &BillUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *OperationClient) UpdateOne(o *Operation) *OperationUpdateOne {\n\tmutation := newOperationMutation(c.config, OpUpdateOne, withOperation(o))\n\treturn &OperationUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *PostAttachmentClient) UpdateOne(pa *PostAttachment) *PostAttachmentUpdateOne {\n\tmutation := newPostAttachmentMutation(c.config, OpUpdateOne, withPostAttachment(pa))\n\treturn &PostAttachmentUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *CleaningroomClient) UpdateOne(cl *Cleaningroom) *CleaningroomUpdateOne {\n\tmutation := newCleaningroomMutation(c.config, OpUpdateOne, withCleaningroom(cl))\n\treturn &CleaningroomUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *CompanyClient) UpdateOne(co *Company) *CompanyUpdateOne {\n\tmutation := newCompanyMutation(c.config, OpUpdateOne, withCompany(co))\n\treturn &CompanyUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *CompanyClient) UpdateOne(co *Company) *CompanyUpdateOne {\n\tmutation := newCompanyMutation(c.config, OpUpdateOne, withCompany(co))\n\treturn &CompanyUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *EventClient) UpdateOne(e *Event) *EventUpdateOne {\n\tmutation := newEventMutation(c.config, OpUpdateOne, withEvent(e))\n\treturn &EventUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *PostClient) UpdateOne(po *Post) *PostUpdateOne {\n\tmutation := newPostMutation(c.config, OpUpdateOne, withPost(po))\n\treturn &PostUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *DeviceClient) UpdateOne(d *Device) *DeviceUpdateOne {\n\tmutation := newDeviceMutation(c.config, OpUpdateOne, withDevice(d))\n\treturn &DeviceUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *OperationroomClient) UpdateOne(o *Operationroom) *OperationroomUpdateOne {\n\tmutation := newOperationroomMutation(c.config, OpUpdateOne, withOperationroom(o))\n\treturn &OperationroomUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *UnsavedPostAttachmentClient) UpdateOne(upa *UnsavedPostAttachment) *UnsavedPostAttachmentUpdateOne {\n\tmutation := newUnsavedPostAttachmentMutation(c.config, OpUpdateOne, withUnsavedPostAttachment(upa))\n\treturn &UnsavedPostAttachmentUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *DrugAllergyClient) UpdateOne(da *DrugAllergy) *DrugAllergyUpdateOne {\n\tmutation := newDrugAllergyMutation(c.config, OpUpdateOne, withDrugAllergy(da))\n\treturn &DrugAllergyUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *MealplanClient) UpdateOne(m *Mealplan) *MealplanUpdateOne {\n\tmutation := newMealplanMutation(c.config, OpUpdateOne, withMealplan(m))\n\treturn &MealplanUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *PhysicianClient) UpdateOne(ph *Physician) *PhysicianUpdateOne {\n\tmutation := newPhysicianMutation(c.config, OpUpdateOne, withPhysician(ph))\n\treturn &PhysicianUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *PhysicianClient) UpdateOne(ph *Physician) *PhysicianUpdateOne {\n\tmutation := newPhysicianMutation(c.config, OpUpdateOne, withPhysician(ph))\n\treturn &PhysicianUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *RoomdetailClient) UpdateOne(r *Roomdetail) *RoomdetailUpdateOne {\n\tmutation := newRoomdetailMutation(c.config, OpUpdateOne, withRoomdetail(r))\n\treturn &RoomdetailUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *OperativerecordClient) UpdateOne(o *Operativerecord) *OperativerecordUpdateOne {\n\tmutation := newOperativerecordMutation(c.config, OpUpdateOne, withOperativerecord(o))\n\treturn &OperativerecordUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *PatientroomClient) UpdateOne(pa *Patientroom) *PatientroomUpdateOne {\n\tmutation := newPatientroomMutation(c.config, OpUpdateOne, withPatientroom(pa))\n\treturn &PatientroomUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *AppointmentClient) UpdateOne(a *Appointment) *AppointmentUpdateOne {\n\tmutation := newAppointmentMutation(c.config, OpUpdateOne, withAppointment(a))\n\treturn &AppointmentUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *ToolClient) UpdateOne(t *Tool) *ToolUpdateOne {\n\tmutation := newToolMutation(c.config, OpUpdateOne, withTool(t))\n\treturn &ToolUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *UnsavedPostClient) UpdateOne(up *UnsavedPost) *UnsavedPostUpdateOne {\n\tmutation := newUnsavedPostMutation(c.config, OpUpdateOne, withUnsavedPost(up))\n\treturn &UnsavedPostUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *WorkExperienceClient) UpdateOne(we *WorkExperience) *WorkExperienceUpdateOne {\n\tmutation := newWorkExperienceMutation(c.config, OpUpdateOne, withWorkExperience(we))\n\treturn &WorkExperienceUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *TransactionClient) UpdateOne(t *Transaction) *TransactionUpdateOne {\n\tmutation := newTransactionMutation(c.config, OpUpdateOne, withTransaction(t))\n\treturn &TransactionUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *RoomuseClient) UpdateOne(r *Roomuse) *RoomuseUpdateOne {\n\tmutation := newRoomuseMutation(c.config, OpUpdateOne, withRoomuse(r))\n\treturn &RoomuseUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *DispenseMedicineClient) UpdateOne(dm *DispenseMedicine) *DispenseMedicineUpdateOne {\n\tmutation := newDispenseMedicineMutation(c.config, OpUpdateOne, withDispenseMedicine(dm))\n\treturn &DispenseMedicineUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *OrderClient) UpdateOne(o *Order) *OrderUpdateOne {\n\tmutation := newOrderMutation(c.config, OpUpdateOne, withOrder(o))\n\treturn &OrderUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *PharmacistClient) UpdateOne(ph *Pharmacist) *PharmacistUpdateOne {\n\tmutation := newPharmacistMutation(c.config, OpUpdateOne, withPharmacist(ph))\n\treturn &PharmacistUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *BookingClient) UpdateOne(b *Booking) *BookingUpdateOne {\n\tmutation := newBookingMutation(c.config, OpUpdateOne, withBooking(b))\n\treturn &BookingUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *AdminClient) UpdateOne(a *Admin) *AdminUpdateOne {\n\tmutation := newAdminMutation(c.config, OpUpdateOne, withAdmin(a))\n\treturn &AdminUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *MedicineClient) UpdateOne(m *Medicine) *MedicineUpdateOne {\n\tmutation := newMedicineMutation(c.config, OpUpdateOne, withMedicine(m))\n\treturn &MedicineUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *MedicineTypeClient) UpdateOne(mt *MedicineType) *MedicineTypeUpdateOne {\n\tmutation := newMedicineTypeMutation(c.config, OpUpdateOne, withMedicineType(mt))\n\treturn &MedicineTypeUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *DoctorClient) UpdateOne(d *Doctor) *DoctorUpdateOne {\n\tmutation := newDoctorMutation(c.config, OpUpdateOne, withDoctor(d))\n\treturn &DoctorUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *PatientofphysicianClient) UpdateOne(pa *Patientofphysician) *PatientofphysicianUpdateOne {\n\tmutation := newPatientofphysicianMutation(c.config, OpUpdateOne, withPatientofphysician(pa))\n\treturn &PatientofphysicianUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *ActivityTypeClient) UpdateOne(at *ActivityType) *ActivityTypeUpdateOne {\n\tmutation := newActivityTypeMutation(c.config, OpUpdateOne, withActivityType(at))\n\treturn &ActivityTypeUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *DNSBLQueryClient) UpdateOne(dq *DNSBLQuery) *DNSBLQueryUpdateOne {\n\tmutation := newDNSBLQueryMutation(c.config, OpUpdateOne, withDNSBLQuery(dq))\n\treturn &DNSBLQueryUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *OperativeClient) UpdateOne(o *Operative) *OperativeUpdateOne {\n\tmutation := newOperativeMutation(c.config, OpUpdateOne, withOperative(o))\n\treturn &OperativeUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *PatientClient) UpdateOne(pa *Patient) *PatientUpdateOne {\n\tmutation := newPatientMutation(c.config, OpUpdateOne, withPatient(pa))\n\treturn &PatientUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *PatientClient) UpdateOne(pa *Patient) *PatientUpdateOne {\n\tmutation := newPatientMutation(c.config, OpUpdateOne, withPatient(pa))\n\treturn &PatientUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *PatientClient) UpdateOne(pa *Patient) *PatientUpdateOne {\n\tmutation := newPatientMutation(c.config, OpUpdateOne, withPatient(pa))\n\treturn &PatientUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *FoodmenuClient) UpdateOne(f *Foodmenu) *FoodmenuUpdateOne {\n\tmutation := newFoodmenuMutation(c.config, OpUpdateOne, withFoodmenu(f))\n\treturn &FoodmenuUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *StaytypeClient) UpdateOne(s *Staytype) *StaytypeUpdateOne {\n\tmutation := newStaytypeMutation(c.config, OpUpdateOne, withStaytype(s))\n\treturn &StaytypeUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *LevelOfDangerousClient) UpdateOne(lod *LevelOfDangerous) *LevelOfDangerousUpdateOne {\n\tmutation := newLevelOfDangerousMutation(c.config, OpUpdateOne, withLevelOfDangerous(lod))\n\treturn &LevelOfDangerousUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (su *PostUseCase) UpdateOne(id string, request data.Post) error {\n\tpost := &models.Post{ID: id}\n\terr := post.Get()\n\tif err != nil {\n\t\treturn err\n\t}\n\tpost.Post = request\n\terr = post.Update()\n\treturn err\n}", "func UpdateOne(query interface{}, update interface{}) error {\n\treturn db.Update(Collection, query, update)\n}", "func (c *PartorderClient) UpdateOne(pa *Partorder) *PartorderUpdateOne {\n\tmutation := newPartorderMutation(c.config, OpUpdateOne, withPartorder(pa))\n\treturn &PartorderUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *UnitOfMedicineClient) UpdateOne(uom *UnitOfMedicine) *UnitOfMedicineUpdateOne {\n\tmutation := newUnitOfMedicineMutation(c.config, OpUpdateOne, withUnitOfMedicine(uom))\n\treturn &UnitOfMedicineUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *PurposeClient) UpdateOne(pu *Purpose) *PurposeUpdateOne {\n\tmutation := newPurposeMutation(c.config, OpUpdateOne, withPurpose(pu))\n\treturn &PurposeUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *ExaminationroomClient) UpdateOne(e *Examinationroom) *ExaminationroomUpdateOne {\n\tmutation := newExaminationroomMutation(c.config, OpUpdateOne, withExaminationroom(e))\n\treturn &ExaminationroomUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *PaymentClient) UpdateOne(pa *Payment) *PaymentUpdateOne {\n\tmutation := newPaymentMutation(c.config, OpUpdateOne, withPayment(pa))\n\treturn &PaymentUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *PaymentClient) UpdateOne(pa *Payment) *PaymentUpdateOne {\n\tmutation := newPaymentMutation(c.config, OpUpdateOne, withPayment(pa))\n\treturn &PaymentUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *StatustClient) UpdateOne(s *Statust) *StatustUpdateOne {\n\tmutation := newStatustMutation(c.config, OpUpdateOne, withStatust(s))\n\treturn &StatustUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *TagClient) UpdateOne(t *Tag) *TagUpdateOne {\n\tmutation := newTagMutation(c.config, OpUpdateOne, withTag(t))\n\treturn &TagUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *RepairinvoiceClient) UpdateOne(r *Repairinvoice) *RepairinvoiceUpdateOne {\n\tmutation := newRepairinvoiceMutation(c.config, OpUpdateOne, withRepairinvoice(r))\n\treturn &RepairinvoiceUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *DepositClient) UpdateOne(d *Deposit) *DepositUpdateOne {\n\tmutation := newDepositMutation(c.config, OpUpdateOne, withDeposit(d))\n\treturn &DepositUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *EmployeeClient) UpdateOne(e *Employee) *EmployeeUpdateOne {\n\tmutation := newEmployeeMutation(c.config, OpUpdateOne, withEmployee(e))\n\treturn &EmployeeUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *EmployeeClient) UpdateOne(e *Employee) *EmployeeUpdateOne {\n\tmutation := newEmployeeMutation(c.config, OpUpdateOne, withEmployee(e))\n\treturn &EmployeeUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *EmployeeClient) UpdateOne(e *Employee) *EmployeeUpdateOne {\n\tmutation := newEmployeeMutation(c.config, OpUpdateOne, withEmployee(e))\n\treturn &EmployeeUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *RoomClient) UpdateOne(r *Room) *RoomUpdateOne {\n\tmutation := newRoomMutation(c.config, OpUpdateOne, withRoom(r))\n\treturn &RoomUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *RoomClient) UpdateOne(r *Room) *RoomUpdateOne {\n\tmutation := newRoomMutation(c.config, OpUpdateOne, withRoom(r))\n\treturn &RoomUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *BillingstatusClient) UpdateOne(b *Billingstatus) *BillingstatusUpdateOne {\n\tmutation := newBillingstatusMutation(c.config, OpUpdateOne, withBillingstatus(b))\n\treturn &BillingstatusUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *EatinghistoryClient) UpdateOne(e *Eatinghistory) *EatinghistoryUpdateOne {\n\tmutation := newEatinghistoryMutation(c.config, OpUpdateOne, withEatinghistory(e))\n\treturn &EatinghistoryUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *StatusdClient) UpdateOne(s *Statusd) *StatusdUpdateOne {\n\tmutation := newStatusdMutation(c.config, OpUpdateOne, withStatusd(s))\n\treturn &StatusdUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (b *Bill) Update() *BillUpdateOne {\n\treturn (&BillClient{config: b.config}).UpdateOne(b)\n}", "func (c *AnnotationClient) UpdateOne(a *Annotation) *AnnotationUpdateOne {\n\tmutation := newAnnotationMutation(c.config, OpUpdateOne, withAnnotation(a))\n\treturn &AnnotationUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func UpdateOne(ctx context.Context, tx pgx.Tx, sb sq.UpdateBuilder) error {\n\tq, vs, err := sb.ToSql()\n\tif err != nil {\n\t\treturn err\n\t}\n\ttag, err := tx.Exec(ctx, q, vs...)\n\tif err != nil {\n\t\treturn err\n\t}\n\tif tag.RowsAffected() != 1 {\n\t\treturn ErrNoRowsAffected\n\t}\n\treturn nil\n}", "func (c *CleanernameClient) UpdateOne(cl *Cleanername) *CleanernameUpdateOne {\n\tmutation := newCleanernameMutation(c.config, OpUpdateOne, withCleanername(cl))\n\treturn &CleanernameUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *LeaseClient) UpdateOne(l *Lease) *LeaseUpdateOne {\n\tmutation := newLeaseMutation(c.config, OpUpdateOne, withLease(l))\n\treturn &LeaseUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *BinaryFileClient) UpdateOne(bf *BinaryFile) *BinaryFileUpdateOne {\n\tmutation := newBinaryFileMutation(c.config, OpUpdateOne, withBinaryFile(bf))\n\treturn &BinaryFileUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *JobClient) UpdateOne(j *Job) *JobUpdateOne {\n\tmutation := newJobMutation(c.config, OpUpdateOne, withJob(j))\n\treturn &JobUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *ActivitiesClient) UpdateOne(a *Activities) *ActivitiesUpdateOne {\n\tmutation := newActivitiesMutation(c.config, OpUpdateOne, withActivities(a))\n\treturn &ActivitiesUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *UnsavedPostImageClient) UpdateOne(upi *UnsavedPostImage) *UnsavedPostImageUpdateOne {\n\tmutation := newUnsavedPostImageMutation(c.config, OpUpdateOne, withUnsavedPostImage(upi))\n\treturn &UnsavedPostImageUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *ClubapplicationClient) UpdateOne(cl *Clubapplication) *ClubapplicationUpdateOne {\n\tmutation := newClubapplicationMutation(c.config, OpUpdateOne, withClubapplication(cl))\n\treturn &ClubapplicationUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *SkillClient) UpdateOne(s *Skill) *SkillUpdateOne {\n\tmutation := newSkillMutation(c.config, OpUpdateOne, withSkill(s))\n\treturn &SkillUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *RentalstatusClient) UpdateOne(r *Rentalstatus) *RentalstatusUpdateOne {\n\tmutation := newRentalstatusMutation(c.config, OpUpdateOne, withRentalstatus(r))\n\treturn &RentalstatusUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *UsertypeClient) UpdateOne(u *Usertype) *UsertypeUpdateOne {\n\tmutation := newUsertypeMutation(c.config, OpUpdateOne, withUsertype(u))\n\treturn &UsertypeUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *TasteClient) UpdateOne(t *Taste) *TasteUpdateOne {\n\tmutation := newTasteMutation(c.config, OpUpdateOne, withTaste(t))\n\treturn &TasteUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *PositionassingmentClient) UpdateOne(po *Positionassingment) *PositionassingmentUpdateOne {\n\tmutation := newPositionassingmentMutation(c.config, OpUpdateOne, withPositionassingment(po))\n\treturn &PositionassingmentUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *SymptomClient) UpdateOne(s *Symptom) *SymptomUpdateOne {\n\tmutation := newSymptomMutation(c.config, OpUpdateOne, withSymptom(s))\n\treturn &SymptomUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *PartClient) UpdateOne(pa *Part) *PartUpdateOne {\n\tmutation := newPartMutation(c.config, OpUpdateOne, withPart(pa))\n\treturn &PartUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func NewUpdateOneModel() *UpdateOneModel {\n\treturn &UpdateOneModel{}\n}", "func (c *DepartmentClient) UpdateOne(d *Department) *DepartmentUpdateOne {\n\tmutation := newDepartmentMutation(c.config, OpUpdateOne, withDepartment(d))\n\treturn &DepartmentUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *SituationClient) UpdateOne(s *Situation) *SituationUpdateOne {\n\tmutation := newSituationMutation(c.config, OpUpdateOne, withSituation(s))\n\treturn &SituationUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *ComplaintClient) UpdateOne(co *Complaint) *ComplaintUpdateOne {\n\tmutation := newComplaintMutation(c.config, OpUpdateOne, withComplaint(co))\n\treturn &ComplaintUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (t *Todo) Update() *TodoUpdateOne {\n\treturn (&TodoClient{t.config}).UpdateOne(t)\n}", "func (c *QueueClient) UpdateOne(q *Queue) *QueueUpdateOne {\n\tmutation := newQueueMutation(c.config, OpUpdateOne, withQueue(q))\n\treturn &QueueUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *UserWalletClient) UpdateOne(uw *UserWallet) *UserWalletUpdateOne {\n\tmutation := newUserWalletMutation(c.config, OpUpdateOne, withUserWallet(uw))\n\treturn &UserWalletUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *BranchClient) UpdateOne(b *Branch) *BranchUpdateOne {\n\tmutation := newBranchMutation(c.config, OpUpdateOne, withBranch(b))\n\treturn &BranchUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *ReturninvoiceClient) UpdateOne(r *Returninvoice) *ReturninvoiceUpdateOne {\n\tmutation := newReturninvoiceMutation(c.config, OpUpdateOne, withReturninvoice(r))\n\treturn &ReturninvoiceUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *PatientInfoClient) UpdateOne(pi *PatientInfo) *PatientInfoUpdateOne {\n\tmutation := newPatientInfoMutation(c.config, OpUpdateOne, withPatientInfo(pi))\n\treturn &PatientInfoUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *UserClient) UpdateOne(u *User) *UserUpdateOne {\n\tmutation := newUserMutation(c.config, OpUpdateOne, withUser(u))\n\treturn &UserUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *UserClient) UpdateOne(u *User) *UserUpdateOne {\n\tmutation := newUserMutation(c.config, OpUpdateOne, withUser(u))\n\treturn &UserUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *UserClient) UpdateOne(u *User) *UserUpdateOne {\n\tmutation := newUserMutation(c.config, OpUpdateOne, withUser(u))\n\treturn &UserUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *UserClient) UpdateOne(u *User) *UserUpdateOne {\n\tmutation := newUserMutation(c.config, OpUpdateOne, withUser(u))\n\treturn &UserUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *UserClient) UpdateOne(u *User) *UserUpdateOne {\n\tmutation := newUserMutation(c.config, OpUpdateOne, withUser(u))\n\treturn &UserUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}" ]
[ "0.69773513", "0.6700239", "0.66991323", "0.66772205", "0.66711056", "0.65891296", "0.65891296", "0.65891296", "0.6529943", "0.651992", "0.6517249", "0.6488436", "0.6488436", "0.6461467", "0.64580745", "0.6444564", "0.6440813", "0.64263475", "0.6407116", "0.64044094", "0.6402244", "0.6402244", "0.6401924", "0.63997734", "0.63976485", "0.63883317", "0.63816136", "0.6380565", "0.6370969", "0.63709646", "0.6364213", "0.6363832", "0.6348345", "0.6335132", "0.6330745", "0.63263464", "0.6325927", "0.63202494", "0.631989", "0.6319132", "0.6316663", "0.6287886", "0.6282346", "0.62710464", "0.62710464", "0.62710464", "0.6258297", "0.62548864", "0.6243332", "0.6216176", "0.62148726", "0.6214705", "0.6211075", "0.62070787", "0.6187787", "0.6186292", "0.6186292", "0.618427", "0.61778814", "0.6174648", "0.61743003", "0.61704266", "0.61704266", "0.61704266", "0.6158959", "0.6158959", "0.6158523", "0.615801", "0.61553144", "0.6135769", "0.6133886", "0.6126848", "0.610412", "0.6084781", "0.6083719", "0.607597", "0.60747206", "0.6073408", "0.60694623", "0.6044985", "0.6041846", "0.6037389", "0.60345656", "0.6029807", "0.60198456", "0.6018794", "0.60022384", "0.59993756", "0.59894186", "0.59838474", "0.5975079", "0.59639263", "0.59572136", "0.5950218", "0.5949224", "0.5938023", "0.5934483", "0.5934483", "0.5934483", "0.5934483", "0.5934483" ]
0.0
-1
UpdateOneID returns an update builder for the given id.
func (c *AdminSessionClient) UpdateOneID(id int) *AdminSessionUpdateOne { mutation := newAdminSessionMutation(c.config, OpUpdateOne, withAdminSessionID(id)) return &AdminSessionUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation} }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (c *BuildingClient) UpdateOneID(id int) *BuildingUpdateOne {\n\tmutation := newBuildingMutation(c.config, OpUpdateOne, withBuildingID(id))\n\treturn &BuildingUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *BedtypeClient) UpdateOneID(id int) *BedtypeUpdateOne {\n\tmutation := newBedtypeMutation(c.config, OpUpdateOne, withBedtypeID(id))\n\treturn &BedtypeUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *ModuleClient) UpdateOneID(id int) *ModuleUpdateOne {\n\treturn &ModuleUpdateOne{config: c.config, id: id}\n}", "func (c *ModuleVersionClient) UpdateOneID(id int) *ModuleVersionUpdateOne {\n\treturn &ModuleVersionUpdateOne{config: c.config, id: id}\n}", "func (c *BillClient) UpdateOneID(id int) *BillUpdateOne {\n\tmutation := newBillMutation(c.config, OpUpdateOne, withBillID(id))\n\treturn &BillUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *BillClient) UpdateOneID(id int) *BillUpdateOne {\n\tmutation := newBillMutation(c.config, OpUpdateOne, withBillID(id))\n\treturn &BillUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *BillClient) UpdateOneID(id int) *BillUpdateOne {\n\tmutation := newBillMutation(c.config, OpUpdateOne, withBillID(id))\n\treturn &BillUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *MealplanClient) UpdateOneID(id int) *MealplanUpdateOne {\n\tmutation := newMealplanMutation(c.config, OpUpdateOne, withMealplanID(id))\n\treturn &MealplanUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *BeerClient) UpdateOneID(id int) *BeerUpdateOne {\n\tmutation := newBeerMutation(c.config, OpUpdateOne, withBeerID(id))\n\treturn &BeerUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *RoomuseClient) UpdateOneID(id int) *RoomuseUpdateOne {\n\tmutation := newRoomuseMutation(c.config, OpUpdateOne, withRoomuseID(id))\n\treturn &RoomuseUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *BookingClient) UpdateOneID(id int) *BookingUpdateOne {\n\tmutation := newBookingMutation(c.config, OpUpdateOne, withBookingID(id))\n\treturn &BookingUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *CleaningroomClient) UpdateOneID(id int) *CleaningroomUpdateOne {\n\tmutation := newCleaningroomMutation(c.config, OpUpdateOne, withCleaningroomID(id))\n\treturn &CleaningroomUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *LengthtimeClient) UpdateOneID(id int) *LengthtimeUpdateOne {\n\tmutation := newLengthtimeMutation(c.config, OpUpdateOne, withLengthtimeID(id))\n\treturn &LengthtimeUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *ToolClient) UpdateOneID(id int) *ToolUpdateOne {\n\tmutation := newToolMutation(c.config, OpUpdateOne, withToolID(id))\n\treturn &ToolUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *StatustClient) UpdateOneID(id int) *StatustUpdateOne {\n\tmutation := newStatustMutation(c.config, OpUpdateOne, withStatustID(id))\n\treturn &StatustUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *DrugAllergyClient) UpdateOneID(id int) *DrugAllergyUpdateOne {\n\tmutation := newDrugAllergyMutation(c.config, OpUpdateOne, withDrugAllergyID(id))\n\treturn &DrugAllergyUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *ClubapplicationClient) UpdateOneID(id int) *ClubapplicationUpdateOne {\n\tmutation := newClubapplicationMutation(c.config, OpUpdateOne, withClubapplicationID(id))\n\treturn &ClubapplicationUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *AppointmentClient) UpdateOneID(id uuid.UUID) *AppointmentUpdateOne {\n\tmutation := newAppointmentMutation(c.config, OpUpdateOne, withAppointmentID(id))\n\treturn &AppointmentUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *EmptyClient) UpdateOneID(id int) *EmptyUpdateOne {\n\tmutation := newEmptyMutation(c.config, OpUpdateOne, withEmptyID(id))\n\treturn &EmptyUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *AdminClient) UpdateOneID(id int) *AdminUpdateOne {\n\tmutation := newAdminMutation(c.config, OpUpdateOne, withAdminID(id))\n\treturn &AdminUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *OperationroomClient) UpdateOneID(id int) *OperationroomUpdateOne {\n\tmutation := newOperationroomMutation(c.config, OpUpdateOne, withOperationroomID(id))\n\treturn &OperationroomUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *BinaryFileClient) UpdateOneID(id int) *BinaryFileUpdateOne {\n\tmutation := newBinaryFileMutation(c.config, OpUpdateOne, withBinaryFileID(id))\n\treturn &BinaryFileUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *PhysicianClient) UpdateOneID(id int) *PhysicianUpdateOne {\n\tmutation := newPhysicianMutation(c.config, OpUpdateOne, withPhysicianID(id))\n\treturn &PhysicianUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *PhysicianClient) UpdateOneID(id int) *PhysicianUpdateOne {\n\tmutation := newPhysicianMutation(c.config, OpUpdateOne, withPhysicianID(id))\n\treturn &PhysicianUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *RoomdetailClient) UpdateOneID(id int) *RoomdetailUpdateOne {\n\tmutation := newRoomdetailMutation(c.config, OpUpdateOne, withRoomdetailID(id))\n\treturn &RoomdetailUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *OperativeClient) UpdateOneID(id int) *OperativeUpdateOne {\n\tmutation := newOperativeMutation(c.config, OpUpdateOne, withOperativeID(id))\n\treturn &OperativeUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *DoctorClient) UpdateOneID(id int) *DoctorUpdateOne {\n\tmutation := newDoctorMutation(c.config, OpUpdateOne, withDoctorID(id))\n\treturn &DoctorUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *DentistClient) UpdateOneID(id int) *DentistUpdateOne {\n\tmutation := newDentistMutation(c.config, OpUpdateOne, withDentistID(id))\n\treturn &DentistUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *UnitOfMedicineClient) UpdateOneID(id int) *UnitOfMedicineUpdateOne {\n\tmutation := newUnitOfMedicineMutation(c.config, OpUpdateOne, withUnitOfMedicineID(id))\n\treturn &UnitOfMedicineUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *LeaseClient) UpdateOneID(id int) *LeaseUpdateOne {\n\tmutation := newLeaseMutation(c.config, OpUpdateOne, withLeaseID(id))\n\treturn &LeaseUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *RoomClient) UpdateOneID(id int) *RoomUpdateOne {\n\tmutation := newRoomMutation(c.config, OpUpdateOne, withRoomID(id))\n\treturn &RoomUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *RoomClient) UpdateOneID(id int) *RoomUpdateOne {\n\tmutation := newRoomMutation(c.config, OpUpdateOne, withRoomID(id))\n\treturn &RoomUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *PatientroomClient) UpdateOneID(id int) *PatientroomUpdateOne {\n\tmutation := newPatientroomMutation(c.config, OpUpdateOne, withPatientroomID(id))\n\treturn &PatientroomUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *JobClient) UpdateOneID(id int) *JobUpdateOne {\n\tmutation := newJobMutation(c.config, OpUpdateOne, withJobID(id))\n\treturn &JobUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *StatusdClient) UpdateOneID(id int) *StatusdUpdateOne {\n\tmutation := newStatusdMutation(c.config, OpUpdateOne, withStatusdID(id))\n\treturn &StatusdUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *MedicineClient) UpdateOneID(id int) *MedicineUpdateOne {\n\tmutation := newMedicineMutation(c.config, OpUpdateOne, withMedicineID(id))\n\treturn &MedicineUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *BuildingClient) UpdateOne(b *Building) *BuildingUpdateOne {\n\tmutation := newBuildingMutation(c.config, OpUpdateOne, withBuilding(b))\n\treturn &BuildingUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *CleanernameClient) UpdateOneID(id int) *CleanernameUpdateOne {\n\tmutation := newCleanernameMutation(c.config, OpUpdateOne, withCleanernameID(id))\n\treturn &CleanernameUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *DeviceClient) UpdateOneID(id int) *DeviceUpdateOne {\n\tmutation := newDeviceMutation(c.config, OpUpdateOne, withDeviceID(id))\n\treturn &DeviceUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *BillingstatusClient) UpdateOneID(id int) *BillingstatusUpdateOne {\n\tmutation := newBillingstatusMutation(c.config, OpUpdateOne, withBillingstatusID(id))\n\treturn &BillingstatusUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *PaymentClient) UpdateOneID(id int) *PaymentUpdateOne {\n\tmutation := newPaymentMutation(c.config, OpUpdateOne, withPaymentID(id))\n\treturn &PaymentUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *PaymentClient) UpdateOneID(id int) *PaymentUpdateOne {\n\tmutation := newPaymentMutation(c.config, OpUpdateOne, withPaymentID(id))\n\treturn &PaymentUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *LevelOfDangerousClient) UpdateOneID(id int) *LevelOfDangerousUpdateOne {\n\tmutation := newLevelOfDangerousMutation(c.config, OpUpdateOne, withLevelOfDangerousID(id))\n\treturn &LevelOfDangerousUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *FoodmenuClient) UpdateOneID(id int) *FoodmenuUpdateOne {\n\tmutation := newFoodmenuMutation(c.config, OpUpdateOne, withFoodmenuID(id))\n\treturn &FoodmenuUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *PostClient) UpdateOneID(id int) *PostUpdateOne {\n\tmutation := newPostMutation(c.config, OpUpdateOne, withPostID(id))\n\treturn &PostUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *PharmacistClient) UpdateOneID(id int) *PharmacistUpdateOne {\n\tmutation := newPharmacistMutation(c.config, OpUpdateOne, withPharmacistID(id))\n\treturn &PharmacistUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *ExaminationroomClient) UpdateOneID(id int) *ExaminationroomUpdateOne {\n\tmutation := newExaminationroomMutation(c.config, OpUpdateOne, withExaminationroomID(id))\n\treturn &ExaminationroomUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *KeyStoreClient) UpdateOneID(id int32) *KeyStoreUpdateOne {\n\tmutation := newKeyStoreMutation(c.config, OpUpdateOne, withKeyStoreID(id))\n\treturn &KeyStoreUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *ActivitiesClient) UpdateOneID(id int) *ActivitiesUpdateOne {\n\tmutation := newActivitiesMutation(c.config, OpUpdateOne, withActivitiesID(id))\n\treturn &ActivitiesUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *PatientofphysicianClient) UpdateOneID(id int) *PatientofphysicianUpdateOne {\n\tmutation := newPatientofphysicianMutation(c.config, OpUpdateOne, withPatientofphysicianID(id))\n\treturn &PatientofphysicianUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *PostAttachmentClient) UpdateOneID(id int) *PostAttachmentUpdateOne {\n\tmutation := newPostAttachmentMutation(c.config, OpUpdateOne, withPostAttachmentID(id))\n\treturn &PostAttachmentUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *SkillClient) UpdateOneID(id int) *SkillUpdateOne {\n\tmutation := newSkillMutation(c.config, OpUpdateOne, withSkillID(id))\n\treturn &SkillUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *QueueClient) UpdateOneID(id int) *QueueUpdateOne {\n\tmutation := newQueueMutation(c.config, OpUpdateOne, withQueueID(id))\n\treturn &QueueUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *EventClient) UpdateOneID(id int) *EventUpdateOne {\n\tmutation := newEventMutation(c.config, OpUpdateOne, withEventID(id))\n\treturn &EventUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *DNSBLQueryClient) UpdateOneID(id uuid.UUID) *DNSBLQueryUpdateOne {\n\tmutation := newDNSBLQueryMutation(c.config, OpUpdateOne, withDNSBLQueryID(id))\n\treturn &DNSBLQueryUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *SymptomClient) UpdateOneID(id int) *SymptomUpdateOne {\n\tmutation := newSymptomMutation(c.config, OpUpdateOne, withSymptomID(id))\n\treturn &SymptomUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *PatientClient) UpdateOneID(id int) *PatientUpdateOne {\n\tmutation := newPatientMutation(c.config, OpUpdateOne, withPatientID(id))\n\treturn &PatientUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *PatientClient) UpdateOneID(id int) *PatientUpdateOne {\n\tmutation := newPatientMutation(c.config, OpUpdateOne, withPatientID(id))\n\treturn &PatientUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *PatientClient) UpdateOneID(id int) *PatientUpdateOne {\n\tmutation := newPatientMutation(c.config, OpUpdateOne, withPatientID(id))\n\treturn &PatientUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *NurseClient) UpdateOneID(id int) *NurseUpdateOne {\n\tmutation := newNurseMutation(c.config, OpUpdateOne, withNurseID(id))\n\treturn &NurseUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *PurposeClient) UpdateOneID(id int) *PurposeUpdateOne {\n\tmutation := newPurposeMutation(c.config, OpUpdateOne, withPurposeID(id))\n\treturn &PurposeUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *OrderClient) UpdateOneID(id int) *OrderUpdateOne {\n\tmutation := newOrderMutation(c.config, OpUpdateOne, withOrderID(id))\n\treturn &OrderUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *DepositClient) UpdateOneID(id int) *DepositUpdateOne {\n\tmutation := newDepositMutation(c.config, OpUpdateOne, withDepositID(id))\n\treturn &DepositUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *DispenseMedicineClient) UpdateOneID(id int) *DispenseMedicineUpdateOne {\n\tmutation := newDispenseMedicineMutation(c.config, OpUpdateOne, withDispenseMedicineID(id))\n\treturn &DispenseMedicineUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *PartorderClient) UpdateOneID(id int) *PartorderUpdateOne {\n\tmutation := newPartorderMutation(c.config, OpUpdateOne, withPartorderID(id))\n\treturn &PartorderUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *PlanetClient) UpdateOneID(id int) *PlanetUpdateOne {\n\tmutation := newPlanetMutation(c.config, OpUpdateOne)\n\tmutation.id = &id\n\treturn &PlanetUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *StaytypeClient) UpdateOneID(id int) *StaytypeUpdateOne {\n\tmutation := newStaytypeMutation(c.config, OpUpdateOne, withStaytypeID(id))\n\treturn &StaytypeUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *UsertypeClient) UpdateOneID(id int) *UsertypeUpdateOne {\n\tmutation := newUsertypeMutation(c.config, OpUpdateOne, withUsertypeID(id))\n\treturn &UsertypeUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *RentalstatusClient) UpdateOneID(id int) *RentalstatusUpdateOne {\n\tmutation := newRentalstatusMutation(c.config, OpUpdateOne, withRentalstatusID(id))\n\treturn &RentalstatusUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *PetruleClient) UpdateOneID(id int) *PetruleUpdateOne {\n\tmutation := newPetruleMutation(c.config, OpUpdateOne, withPetruleID(id))\n\treturn &PetruleUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *ActivityTypeClient) UpdateOneID(id int) *ActivityTypeUpdateOne {\n\tmutation := newActivityTypeMutation(c.config, OpUpdateOne, withActivityTypeID(id))\n\treturn &ActivityTypeUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *WorkExperienceClient) UpdateOneID(id int) *WorkExperienceUpdateOne {\n\tmutation := newWorkExperienceMutation(c.config, OpUpdateOne, withWorkExperienceID(id))\n\treturn &WorkExperienceUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *TasteClient) UpdateOneID(id int) *TasteUpdateOne {\n\tmutation := newTasteMutation(c.config, OpUpdateOne, withTasteID(id))\n\treturn &TasteUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *OperativerecordClient) UpdateOneID(id int) *OperativerecordUpdateOne {\n\tmutation := newOperativerecordMutation(c.config, OpUpdateOne, withOperativerecordID(id))\n\treturn &OperativerecordUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *OperationClient) UpdateOneID(id uuid.UUID) *OperationUpdateOne {\n\tmutation := newOperationMutation(c.config, OpUpdateOne, withOperationID(id))\n\treturn &OperationUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *UserClient) UpdateOneID(id int) *UserUpdateOne {\n\tmutation := newUserMutation(c.config, OpUpdateOne, withUserID(id))\n\treturn &UserUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *UserClient) UpdateOneID(id int) *UserUpdateOne {\n\tmutation := newUserMutation(c.config, OpUpdateOne, withUserID(id))\n\treturn &UserUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *UserClient) UpdateOneID(id int) *UserUpdateOne {\n\tmutation := newUserMutation(c.config, OpUpdateOne, withUserID(id))\n\treturn &UserUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *UserClient) UpdateOneID(id int) *UserUpdateOne {\n\tmutation := newUserMutation(c.config, OpUpdateOne, withUserID(id))\n\treturn &UserUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *UserClient) UpdateOneID(id int) *UserUpdateOne {\n\tmutation := newUserMutation(c.config, OpUpdateOne, withUserID(id))\n\treturn &UserUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *UserClient) UpdateOneID(id int) *UserUpdateOne {\n\tmutation := newUserMutation(c.config, OpUpdateOne, withUserID(id))\n\treturn &UserUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *UserClient) UpdateOneID(id int) *UserUpdateOne {\n\tmutation := newUserMutation(c.config, OpUpdateOne, withUserID(id))\n\treturn &UserUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *FacultyClient) UpdateOneID(id int) *FacultyUpdateOne {\n\tmutation := newFacultyMutation(c.config, OpUpdateOne, withFacultyID(id))\n\treturn &FacultyUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *MedicineTypeClient) UpdateOneID(id int) *MedicineTypeUpdateOne {\n\tmutation := newMedicineTypeMutation(c.config, OpUpdateOne, withMedicineTypeID(id))\n\treturn &MedicineTypeUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *TransactionClient) UpdateOneID(id int32) *TransactionUpdateOne {\n\tmutation := newTransactionMutation(c.config, OpUpdateOne, withTransactionID(id))\n\treturn &TransactionUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *UnsavedPostAttachmentClient) UpdateOneID(id int) *UnsavedPostAttachmentUpdateOne {\n\tmutation := newUnsavedPostAttachmentMutation(c.config, OpUpdateOne, withUnsavedPostAttachmentID(id))\n\treturn &UnsavedPostAttachmentUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *EatinghistoryClient) UpdateOneID(id int) *EatinghistoryUpdateOne {\n\tmutation := newEatinghistoryMutation(c.config, OpUpdateOne, withEatinghistoryID(id))\n\treturn &EatinghistoryUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *UnsavedPostClient) UpdateOneID(id int) *UnsavedPostUpdateOne {\n\tmutation := newUnsavedPostMutation(c.config, OpUpdateOne, withUnsavedPostID(id))\n\treturn &UnsavedPostUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *UserWalletClient) UpdateOneID(id int64) *UserWalletUpdateOne {\n\tmutation := newUserWalletMutation(c.config, OpUpdateOne, withUserWalletID(id))\n\treturn &UserWalletUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *RepairinvoiceClient) UpdateOneID(id int) *RepairinvoiceUpdateOne {\n\tmutation := newRepairinvoiceMutation(c.config, OpUpdateOne, withRepairinvoiceID(id))\n\treturn &RepairinvoiceUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *ClubappStatusClient) UpdateOneID(id int) *ClubappStatusUpdateOne {\n\tmutation := newClubappStatusMutation(c.config, OpUpdateOne, withClubappStatusID(id))\n\treturn &ClubappStatusUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *UserClient) UpdateOneID(id int64) *UserUpdateOne {\n\tmutation := newUserMutation(c.config, OpUpdateOne, withUserID(id))\n\treturn &UserUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *PledgeClient) UpdateOneID(id int) *PledgeUpdateOne {\n\tmutation := newPledgeMutation(c.config, OpUpdateOne, withPledgeID(id))\n\treturn &PledgeUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *AnnotationClient) UpdateOneID(id int) *AnnotationUpdateOne {\n\tmutation := newAnnotationMutation(c.config, OpUpdateOne, withAnnotationID(id))\n\treturn &AnnotationUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *ComplaintClient) UpdateOneID(id int) *ComplaintUpdateOne {\n\tmutation := newComplaintMutation(c.config, OpUpdateOne, withComplaintID(id))\n\treturn &ComplaintUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *PatientInfoClient) UpdateOneID(id int) *PatientInfoUpdateOne {\n\tmutation := newPatientInfoMutation(c.config, OpUpdateOne, withPatientInfoID(id))\n\treturn &PatientInfoUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *BillClient) UpdateOne(b *Bill) *BillUpdateOne {\n\tmutation := newBillMutation(c.config, OpUpdateOne, withBill(b))\n\treturn &BillUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *BillClient) UpdateOne(b *Bill) *BillUpdateOne {\n\tmutation := newBillMutation(c.config, OpUpdateOne, withBill(b))\n\treturn &BillUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *BillClient) UpdateOne(b *Bill) *BillUpdateOne {\n\tmutation := newBillMutation(c.config, OpUpdateOne, withBill(b))\n\treturn &BillUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *BranchClient) UpdateOneID(id int) *BranchUpdateOne {\n\tmutation := newBranchMutation(c.config, OpUpdateOne, withBranchID(id))\n\treturn &BranchUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}" ]
[ "0.71615124", "0.70216423", "0.7010951", "0.6987627", "0.69720626", "0.69720626", "0.69720626", "0.6954614", "0.689346", "0.68728864", "0.6870293", "0.6866837", "0.6832452", "0.6766731", "0.6758887", "0.6757431", "0.6731577", "0.67303044", "0.6728446", "0.6724985", "0.67239785", "0.67209023", "0.6718119", "0.6718119", "0.67104286", "0.67062783", "0.6697794", "0.66902477", "0.6682167", "0.66768026", "0.6674605", "0.6674605", "0.66745573", "0.66642433", "0.66625804", "0.6657183", "0.6656204", "0.66550183", "0.66548914", "0.66531366", "0.66450125", "0.66450125", "0.6636786", "0.66309714", "0.66269386", "0.6623951", "0.66233176", "0.66004527", "0.6579094", "0.6575504", "0.65677005", "0.65592045", "0.65578675", "0.65515816", "0.65495205", "0.6520618", "0.65140945", "0.65140945", "0.65140945", "0.65092254", "0.65040284", "0.64891744", "0.6477931", "0.64730316", "0.64712715", "0.6469642", "0.646921", "0.6461148", "0.645715", "0.64520925", "0.64469784", "0.6446611", "0.6440331", "0.64351696", "0.642902", "0.64275914", "0.64275914", "0.64275914", "0.64275914", "0.64275914", "0.64275914", "0.64275914", "0.6426236", "0.642493", "0.6423476", "0.6420463", "0.6419567", "0.6415439", "0.64131147", "0.6409662", "0.6407158", "0.64018244", "0.63964146", "0.63946825", "0.6385547", "0.63830286", "0.6376113", "0.6376113", "0.6376113", "0.6372358" ]
0.6423679
84
Delete returns a delete builder for AdminSession.
func (c *AdminSessionClient) Delete() *AdminSessionDelete { mutation := newAdminSessionMutation(c.config, OpDelete) return &AdminSessionDelete{config: c.config, hooks: c.Hooks(), mutation: mutation} }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (c *AdminClient) Delete() *AdminDelete {\n\tmutation := newAdminMutation(c.config, OpDelete)\n\treturn &AdminDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *BuildingClient) Delete() *BuildingDelete {\n\tmutation := newBuildingMutation(c.config, OpDelete)\n\treturn &BuildingDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *DoctorClient) Delete() *DoctorDelete {\n\tmutation := newDoctorMutation(c.config, OpDelete)\n\treturn &DoctorDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *CleaningroomClient) Delete() *CleaningroomDelete {\n\tmutation := newCleaningroomMutation(c.config, OpDelete)\n\treturn &CleaningroomDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *BedtypeClient) Delete() *BedtypeDelete {\n\tmutation := newBedtypeMutation(c.config, OpDelete)\n\treturn &BedtypeDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *OperativeClient) Delete() *OperativeDelete {\n\tmutation := newOperativeMutation(c.config, OpDelete)\n\treturn &OperativeDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *PhysicianClient) Delete() *PhysicianDelete {\n\tmutation := newPhysicianMutation(c.config, OpDelete)\n\treturn &PhysicianDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *PhysicianClient) Delete() *PhysicianDelete {\n\tmutation := newPhysicianMutation(c.config, OpDelete)\n\treturn &PhysicianDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *MealplanClient) Delete() *MealplanDelete {\n\tmutation := newMealplanMutation(c.config, OpDelete)\n\treturn &MealplanDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *PatientroomClient) Delete() *PatientroomDelete {\n\tmutation := newPatientroomMutation(c.config, OpDelete)\n\treturn &PatientroomDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *SessionClient) Delete() *SessionDelete {\n\tmutation := newSessionMutation(c.config, OpDelete)\n\treturn &SessionDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *DeviceClient) Delete() *DeviceDelete {\n\tmutation := newDeviceMutation(c.config, OpDelete)\n\treturn &DeviceDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *RoomuseClient) Delete() *RoomuseDelete {\n\tmutation := newRoomuseMutation(c.config, OpDelete)\n\treturn &RoomuseDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func NewDeleteBuilder() *DeleteBuilder {\n\treturn &DeleteBuilder{}\n}", "func (c *RoomdetailClient) Delete() *RoomdetailDelete {\n\tmutation := newRoomdetailMutation(c.config, OpDelete)\n\treturn &RoomdetailDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (ad *Admin) Delete() error {\n\tif ad.dbCollection == nil {\n\t\treturn errors.New(\"Uninitialized Object Admin\")\n\t}\n\treturn ad.dbCollection.RemoveId(ad.Id)\n}", "func (c *BeerClient) Delete() *BeerDelete {\n\tmutation := newBeerMutation(c.config, OpDelete)\n\treturn &BeerDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *Admin) Delete(id string) error {\n\n\treturn crud.Delete(id).Error()\n}", "func (c *FoodmenuClient) Delete() *FoodmenuDelete {\n\tmutation := newFoodmenuMutation(c.config, OpDelete)\n\treturn &FoodmenuDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *PharmacistClient) Delete() *PharmacistDelete {\n\tmutation := newPharmacistMutation(c.config, OpDelete)\n\treturn &PharmacistDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *OperationroomClient) Delete() *OperationroomDelete {\n\tmutation := newOperationroomMutation(c.config, OpDelete)\n\treturn &OperationroomDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *RoomClient) Delete() *RoomDelete {\n\tmutation := newRoomMutation(c.config, OpDelete)\n\treturn &RoomDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *RoomClient) Delete() *RoomDelete {\n\tmutation := newRoomMutation(c.config, OpDelete)\n\treturn &RoomDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (s *rpcServer) DeleteAdmin(ctx context.Context, req *api.DeleteAdminRequest) (*api.DeleteAdminResponse, error) {\n\treturn &api.DeleteAdminResponse{}, nil\n}", "func (c *DentistClient) Delete() *DentistDelete {\n\tmutation := newDentistMutation(c.config, OpDelete)\n\treturn &DentistDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *LevelOfDangerousClient) Delete() *LevelOfDangerousDelete {\n\tmutation := newLevelOfDangerousMutation(c.config, OpDelete)\n\treturn &LevelOfDangerousDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *MedicineClient) Delete() *MedicineDelete {\n\tmutation := newMedicineMutation(c.config, OpDelete)\n\treturn &MedicineDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *StatusdClient) Delete() *StatusdDelete {\n\tmutation := newStatusdMutation(c.config, OpDelete)\n\treturn &StatusdDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *PatientClient) Delete() *PatientDelete {\n\tmutation := newPatientMutation(c.config, OpDelete)\n\treturn &PatientDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *PatientClient) Delete() *PatientDelete {\n\tmutation := newPatientMutation(c.config, OpDelete)\n\treturn &PatientDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *PatientClient) Delete() *PatientDelete {\n\tmutation := newPatientMutation(c.config, OpDelete)\n\treturn &PatientDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *PatientofphysicianClient) Delete() *PatientofphysicianDelete {\n\tmutation := newPatientofphysicianMutation(c.config, OpDelete)\n\treturn &PatientofphysicianDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *UnitOfMedicineClient) Delete() *UnitOfMedicineDelete {\n\tmutation := newUnitOfMedicineMutation(c.config, OpDelete)\n\treturn &UnitOfMedicineDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *OperativerecordClient) Delete() *OperativerecordDelete {\n\tmutation := newOperativerecordMutation(c.config, OpDelete)\n\treturn &OperativerecordDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *MedicineTypeClient) Delete() *MedicineTypeDelete {\n\tmutation := newMedicineTypeMutation(c.config, OpDelete)\n\treturn &MedicineTypeDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *DNSBLQueryClient) Delete() *DNSBLQueryDelete {\n\tmutation := newDNSBLQueryMutation(c.config, OpDelete)\n\treturn &DNSBLQueryDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (b *QueryBuilder) Delete() {\n}", "func (c *ToolClient) Delete() *ToolDelete {\n\tmutation := newToolMutation(c.config, OpDelete)\n\treturn &ToolDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *OperationClient) Delete() *OperationDelete {\n\tmutation := newOperationMutation(c.config, OpDelete)\n\treturn &OperationDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *CleanernameClient) Delete() *CleanernameDelete {\n\tmutation := newCleanernameMutation(c.config, OpDelete)\n\treturn &CleanernameDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *ExaminationroomClient) Delete() *ExaminationroomDelete {\n\tmutation := newExaminationroomMutation(c.config, OpDelete)\n\treturn &ExaminationroomDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *StatustClient) Delete() *StatustDelete {\n\tmutation := newStatustMutation(c.config, OpDelete)\n\treturn &StatustDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *DispenseMedicineClient) Delete() *DispenseMedicineDelete {\n\tmutation := newDispenseMedicineMutation(c.config, OpDelete)\n\treturn &DispenseMedicineDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (self Accessor) Delete(expr interface{}) *DeleteManager {\n\treturn Deletion(self.Relation()).Delete(expr)\n}", "func (c *ClubapplicationClient) Delete() *ClubapplicationDelete {\n\tmutation := newClubapplicationMutation(c.config, OpDelete)\n\treturn &ClubapplicationDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *OrderClient) Delete() *OrderDelete {\n\tmutation := newOrderMutation(c.config, OpDelete)\n\treturn &OrderDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *FacultyClient) Delete() *FacultyDelete {\n\tmutation := newFacultyMutation(c.config, OpDelete)\n\treturn &FacultyDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func NewDeleteaspecificAdminRequest(server string, id string) (*http.Request, error) {\n\tvar err error\n\n\tvar pathParam0 string\n\n\tpathParam0, err = runtime.StyleParam(\"simple\", false, \"id\", id)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tqueryUrl, err := url.Parse(server)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tbasePath := fmt.Sprintf(\"/admins/%s\", pathParam0)\n\tif basePath[0] == '/' {\n\t\tbasePath = basePath[1:]\n\t}\n\n\tqueryUrl, err = queryUrl.Parse(basePath)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treq, err := http.NewRequest(\"DELETE\", queryUrl.String(), nil)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn req, nil\n}", "func (c *DepartmentClient) Delete() *DepartmentDelete {\n\tmutation := newDepartmentMutation(c.config, OpDelete)\n\treturn &DepartmentDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *DrugAllergyClient) Delete() *DrugAllergyDelete {\n\tmutation := newDrugAllergyMutation(c.config, OpDelete)\n\treturn &DrugAllergyDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *TransactionClient) Delete() *TransactionDelete {\n\tmutation := newTransactionMutation(c.config, OpDelete)\n\treturn &TransactionDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *CustomerClient) Delete() *CustomerDelete {\n\tmutation := newCustomerMutation(c.config, OpDelete)\n\treturn &CustomerDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *DepositClient) Delete() *DepositDelete {\n\tmutation := newDepositMutation(c.config, OpDelete)\n\treturn &DepositDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *EventClient) Delete() *EventDelete {\n\tmutation := newEventMutation(c.config, OpDelete)\n\treturn &EventDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *PatientInfoClient) Delete() *PatientInfoDelete {\n\tmutation := newPatientInfoMutation(c.config, OpDelete)\n\treturn &PatientInfoDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *UsertypeClient) Delete() *UsertypeDelete {\n\tmutation := newUsertypeMutation(c.config, OpDelete)\n\treturn &UsertypeDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *EmptyClient) Delete() *EmptyDelete {\n\tmutation := newEmptyMutation(c.config, OpDelete)\n\treturn &EmptyDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *PurposeClient) Delete() *PurposeDelete {\n\tmutation := newPurposeMutation(c.config, OpDelete)\n\treturn &PurposeDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *ModuleClient) Delete() *ModuleDelete {\n\treturn &ModuleDelete{config: c.config}\n}", "func (c *SymptomClient) Delete() *SymptomDelete {\n\tmutation := newSymptomMutation(c.config, OpDelete)\n\treturn &SymptomDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *PostClient) Delete() *PostDelete {\n\tmutation := newPostMutation(c.config, OpDelete)\n\treturn &PostDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *GenderClient) Delete() *GenderDelete {\n\tmutation := newGenderMutation(c.config, OpDelete)\n\treturn &GenderDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *GenderClient) Delete() *GenderDelete {\n\tmutation := newGenderMutation(c.config, OpDelete)\n\treturn &GenderDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (m *GraphBaseServiceClient) Admin()(*i7c9d1b36ac198368c1d8bed014b43e2a518b170ee45bf02c8bbe64544a50539a.AdminRequestBuilder) {\n return i7c9d1b36ac198368c1d8bed014b43e2a518b170ee45bf02c8bbe64544a50539a.NewAdminRequestBuilderInternal(m.pathParameters, m.requestAdapter);\n}", "func (m *GraphBaseServiceClient) Admin()(*i7c9d1b36ac198368c1d8bed014b43e2a518b170ee45bf02c8bbe64544a50539a.AdminRequestBuilder) {\n return i7c9d1b36ac198368c1d8bed014b43e2a518b170ee45bf02c8bbe64544a50539a.NewAdminRequestBuilderInternal(m.pathParameters, m.requestAdapter);\n}", "func (c *QueueClient) Delete() *QueueDelete {\n\tmutation := newQueueMutation(c.config, OpDelete)\n\treturn &QueueDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (d *cephobject) Delete(op *operations.Operation) error {\n\tif shared.IsTrue(d.config[\"volatile.pool.pristine\"]) {\n\t\terr := d.radosgwadminUserDelete(context.TODO(), cephobjectRadosgwAdminUser)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"Failed deleting admin user %q: %w\", cephobjectRadosgwAdminUser, err)\n\t\t}\n\t}\n\n\treturn nil\n}", "func (c *PartorderClient) Delete() *PartorderDelete {\n\tmutation := newPartorderMutation(c.config, OpDelete)\n\treturn &PartorderDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *WalletNodeClient) Delete() *WalletNodeDelete {\n\tmutation := newWalletNodeMutation(c.config, OpDelete)\n\treturn &WalletNodeDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *RentalstatusClient) Delete() *RentalstatusDelete {\n\tmutation := newRentalstatusMutation(c.config, OpDelete)\n\treturn &RentalstatusDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *NurseClient) Delete() *NurseDelete {\n\tmutation := newNurseMutation(c.config, OpDelete)\n\treturn &NurseDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (sec *DatabaseSecurity) DeleteAdmin(login string) error {\n\tif err := sec.db.GetSecurity(sec); err != nil {\n\t\treturn err\n\t}\n\tsec.UpdateAdmins(login, true)\n\tif err := sec.db.SetSecurity(sec); err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "func (c *UserClient) Delete() *UserDelete {\n\tmutation := newUserMutation(c.config, OpDelete)\n\treturn &UserDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *UserClient) Delete() *UserDelete {\n\tmutation := newUserMutation(c.config, OpDelete)\n\treturn &UserDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *UserClient) Delete() *UserDelete {\n\tmutation := newUserMutation(c.config, OpDelete)\n\treturn &UserDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *UserClient) Delete() *UserDelete {\n\tmutation := newUserMutation(c.config, OpDelete)\n\treturn &UserDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *UserClient) Delete() *UserDelete {\n\tmutation := newUserMutation(c.config, OpDelete)\n\treturn &UserDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *UserClient) Delete() *UserDelete {\n\tmutation := newUserMutation(c.config, OpDelete)\n\treturn &UserDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *UserClient) Delete() *UserDelete {\n\tmutation := newUserMutation(c.config, OpDelete)\n\treturn &UserDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *UserClient) Delete() *UserDelete {\n\tmutation := newUserMutation(c.config, OpDelete)\n\treturn &UserDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *UserClient) Delete() *UserDelete {\n\tmutation := newUserMutation(c.config, OpDelete)\n\treturn &UserDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *UserClient) Delete() *UserDelete {\n\tmutation := newUserMutation(c.config, OpDelete)\n\treturn &UserDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *UserClient) Delete() *UserDelete {\n\tmutation := newUserMutation(c.config, OpDelete)\n\treturn &UserDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (b *Executor) Delete() (err error) {\n\tif b.builder != nil {\n\t\terr = b.builder.Delete()\n\t\tb.builder = nil\n\t}\n\treturn err\n}", "func (c *BillingstatusClient) Delete() *BillingstatusDelete {\n\tmutation := newBillingstatusMutation(c.config, OpDelete)\n\treturn &BillingstatusDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *LeaseClient) Delete() *LeaseDelete {\n\tmutation := newLeaseMutation(c.config, OpDelete)\n\treturn &LeaseDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *VeterinarianClient) Delete() *VeterinarianDelete {\n\tmutation := newVeterinarianMutation(c.config, OpDelete)\n\treturn &VeterinarianDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (dsl *PutDSL) Delete() linux.DeleteDSL {\n\treturn &DeleteDSL{dsl.parent, dsl.vppPut.Delete()}\n}", "func (dsl *PutDSL) Delete() linux.DeleteDSL {\n\treturn &DeleteDSL{dsl.parent, dsl.vppPut.Delete()}\n}", "func (c *SituationClient) Delete() *SituationDelete {\n\tmutation := newSituationMutation(c.config, OpDelete)\n\treturn &SituationDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *BillClient) Delete() *BillDelete {\n\tmutation := newBillMutation(c.config, OpDelete)\n\treturn &BillDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *BillClient) Delete() *BillDelete {\n\tmutation := newBillMutation(c.config, OpDelete)\n\treturn &BillDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *BillClient) Delete() *BillDelete {\n\tmutation := newBillMutation(c.config, OpDelete)\n\treturn &BillDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *ClubTypeClient) Delete() *ClubTypeDelete {\n\tmutation := newClubTypeMutation(c.config, OpDelete)\n\treturn &ClubTypeDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *AppointmentClient) Delete() *AppointmentDelete {\n\tmutation := newAppointmentMutation(c.config, OpDelete)\n\treturn &AppointmentDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (b *JoinBuilder) Delete(tables ...*Table) *DeleteBuilder {\n\treturn makeDeleteBuilder(b, tables...)\n}", "func (c *ShortcutController) Delete() {\n\n\to := orm.NewOrm()\n\ttoken := c.Ctx.Input.Header(\"Authorization\")\n\t_auth := models.Auths{Token: token}\n\tif err := o.Read(&_auth, \"Token\"); err != nil {\n\t\tc.Data[\"json\"] = utils.ResponseError(c.Ctx, \"登录已失效!\", nil)\n\t\tc.ServeJSON()\n\t\treturn\n\t}\n\t_admin := models.Admin{ID: _auth.UID}\n\t_ = o.Read(&_admin)\n\n\tid, _ := strconv.ParseInt(c.Ctx.Input.Param(\":id\"), 10, 64)\n\n\tshortcut := models.Shortcut{ID: id}\n\n\t// exist\n\tif err := o.Read(&shortcut); err != nil || shortcut.UID != _admin.ID {\n\t\tc.Data[\"json\"] = utils.ResponseError(c.Ctx, \"删除失败,内容不存在!\", nil)\n\t\tc.ServeJSON()\n\t\treturn\n\t}\n\n\tif num, err := o.Delete(&shortcut); err != nil {\n\t\tlogs.Error(err)\n\t\tc.Data[\"json\"] = utils.ResponseError(c.Ctx, \"删除失败!\", nil)\n\t} else {\n\t\tc.Data[\"json\"] = utils.ResponseSuccess(c.Ctx, \"删除成功!\", &num)\n\t}\n\tc.ServeJSON()\n}", "func (controller *EchoController) Delete(context *qhttp.Context) {\n\tcontroller.Get(context)\n}", "func (m *ZebraFotaConnectorRequestBuilder) Delete(ctx context.Context, requestConfiguration *ZebraFotaConnectorRequestBuilderDeleteRequestConfiguration)(error) {\n requestInfo, err := m.ToDeleteRequestInformation(ctx, requestConfiguration);\n if err != nil {\n return err\n }\n errorMapping := i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.ErrorMappings {\n \"4XX\": i20a3050780ee0b0cde0a884a4f35429a20d60067e3bcda382ec5400079147459.CreateODataErrorFromDiscriminatorValue,\n \"5XX\": i20a3050780ee0b0cde0a884a4f35429a20d60067e3bcda382ec5400079147459.CreateODataErrorFromDiscriminatorValue,\n }\n err = m.BaseRequestBuilder.RequestAdapter.SendNoContent(ctx, requestInfo, errorMapping)\n if err != nil {\n return err\n }\n return nil\n}", "func (c *JobClient) Delete() *JobDelete {\n\tmutation := newJobMutation(c.config, OpDelete)\n\treturn &JobDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}" ]
[ "0.743134", "0.6523809", "0.6275099", "0.62566036", "0.6253586", "0.61980623", "0.6177253", "0.6177253", "0.61732906", "0.6155471", "0.6135574", "0.61336935", "0.61263937", "0.61031675", "0.6083456", "0.6079106", "0.6061378", "0.6037252", "0.6025797", "0.59962714", "0.5966486", "0.59658164", "0.59658164", "0.59616977", "0.5935952", "0.59307176", "0.59301734", "0.59051174", "0.58770746", "0.58770746", "0.58770746", "0.5854543", "0.58247155", "0.58221", "0.5779746", "0.57647306", "0.57548916", "0.5750068", "0.5738305", "0.57327265", "0.5727977", "0.57237107", "0.5719081", "0.56742424", "0.56693083", "0.56670105", "0.5652026", "0.5638905", "0.5631327", "0.56282234", "0.5624531", "0.5618353", "0.559724", "0.55817837", "0.5580955", "0.5567996", "0.55666137", "0.555735", "0.5555106", "0.55532837", "0.5543686", "0.5543428", "0.5543428", "0.5540035", "0.5540035", "0.5529449", "0.55231553", "0.55209035", "0.55070114", "0.54868233", "0.5483618", "0.54673594", "0.54559946", "0.54559946", "0.54559946", "0.54559946", "0.54559946", "0.54559946", "0.54559946", "0.54559946", "0.54559946", "0.54559946", "0.54559946", "0.54518676", "0.54455656", "0.5443909", "0.54388106", "0.5438063", "0.5438063", "0.5437029", "0.54329574", "0.54329574", "0.54329574", "0.54279774", "0.5426488", "0.5421238", "0.54211926", "0.542013", "0.54050946", "0.5403894" ]
0.7212077
1
DeleteOne returns a delete builder for the given entity.
func (c *AdminSessionClient) DeleteOne(as *AdminSession) *AdminSessionDeleteOne { return c.DeleteOneID(as.ID) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (c *BuildingClient) DeleteOne(b *Building) *BuildingDeleteOne {\n\treturn c.DeleteOneID(b.ID)\n}", "func (c *DeviceClient) DeleteOne(d *Device) *DeviceDeleteOne {\n\treturn c.DeleteOneID(d.ID)\n}", "func (c *EmptyClient) DeleteOne(e *Empty) *EmptyDeleteOne {\n\treturn c.DeleteOneID(e.ID)\n}", "func (c *DentistClient) DeleteOne(d *Dentist) *DentistDeleteOne {\n\treturn c.DeleteOneID(d.ID)\n}", "func (c *BedtypeClient) DeleteOne(b *Bedtype) *BedtypeDeleteOne {\n\treturn c.DeleteOneID(b.ID)\n}", "func (c *OperativerecordClient) DeleteOne(o *Operativerecord) *OperativerecordDeleteOne {\n\treturn c.DeleteOneID(o.ID)\n}", "func (c *OperationClient) DeleteOne(o *Operation) *OperationDeleteOne {\n\treturn c.DeleteOneID(o.ID)\n}", "func (c *DNSBLQueryClient) DeleteOne(dq *DNSBLQuery) *DNSBLQueryDeleteOne {\n\treturn c.DeleteOneID(dq.ID)\n}", "func (c *DispenseMedicineClient) DeleteOne(dm *DispenseMedicine) *DispenseMedicineDeleteOne {\n\treturn c.DeleteOneID(dm.ID)\n}", "func (c *Command) DeleteOne() (int64, error) {\n\tclient := c.set.gom.GetClient()\n\n\tcollection := client.Database(c.set.gom.GetDatabase()).Collection(c.set.tableName)\n\n\tif len(c.set.filter.(bson.M)) == 0 {\n\t\treturn 0, errors.New(\"filter can't be empty\")\n\t}\n\n\tctx, cancelFunc := c.set.GetContext()\n\tdefer cancelFunc()\n\n\tres, err := collection.DeleteOne(ctx, c.set.filter)\n\n\tif err != nil {\n\t\treturn 0, err\n\t}\n\n\treturn res.DeletedCount, nil\n}", "func (c *DoctorClient) DeleteOne(d *Doctor) *DoctorDeleteOne {\n\treturn c.DeleteOneID(d.ID)\n}", "func NewDeleteOneModel() *DeleteOneModel {\n\treturn &DeleteOneModel{}\n}", "func (c *DrugAllergyClient) DeleteOne(da *DrugAllergy) *DrugAllergyDeleteOne {\n\treturn c.DeleteOneID(da.ID)\n}", "func (c *BeerClient) DeleteOne(b *Beer) *BeerDeleteOne {\n\treturn c.DeleteOneID(b.ID)\n}", "func (d *Demo) DeleteOne(g *gom.Gom) {\n\ttoolkit.Println(\"===== Delete One =====\")\n\n\tvar err error\n\tif d.useParams {\n\t\t_, err = g.Set(&gom.SetParams{\n\t\t\tTableName: \"hero\",\n\t\t\tFilter: gom.Eq(\"Name\", \"Batman\"),\n\t\t\tTimeout: 10,\n\t\t}).Cmd().DeleteOne()\n\t} else {\n\t\t_, err = g.Set(nil).Table(\"hero\").Timeout(10).Filter(gom.Eq(\"Name\", \"Batman\")).Cmd().DeleteOne()\n\t}\n\n\tif err != nil {\n\t\ttoolkit.Println(err.Error())\n\t\treturn\n\t}\n}", "func (c *OrderClient) DeleteOne(o *Order) *OrderDeleteOne {\n\treturn c.DeleteOneID(o.ID)\n}", "func (c *AdminClient) DeleteOne(a *Admin) *AdminDeleteOne {\n\treturn c.DeleteOneID(a.ID)\n}", "func (c *PharmacistClient) DeleteOne(ph *Pharmacist) *PharmacistDeleteOne {\n\treturn c.DeleteOneID(ph.ID)\n}", "func (c *FoodmenuClient) DeleteOne(f *Foodmenu) *FoodmenuDeleteOne {\n\treturn c.DeleteOneID(f.ID)\n}", "func (c *CleaningroomClient) DeleteOne(cl *Cleaningroom) *CleaningroomDeleteOne {\n\treturn c.DeleteOneID(cl.ID)\n}", "func (c *PatientClient) DeleteOne(pa *Patient) *PatientDeleteOne {\n\treturn c.DeleteOneID(pa.ID)\n}", "func (c *PatientClient) DeleteOne(pa *Patient) *PatientDeleteOne {\n\treturn c.DeleteOneID(pa.ID)\n}", "func (c *PatientClient) DeleteOne(pa *Patient) *PatientDeleteOne {\n\treturn c.DeleteOneID(pa.ID)\n}", "func (c *PostClient) DeleteOne(po *Post) *PostDeleteOne {\n\treturn c.DeleteOneID(po.ID)\n}", "func (c *CompanyClient) DeleteOne(co *Company) *CompanyDeleteOne {\n\treturn c.DeleteOneID(co.ID)\n}", "func (c *CompanyClient) DeleteOne(co *Company) *CompanyDeleteOne {\n\treturn c.DeleteOneID(co.ID)\n}", "func (c *DepositClient) DeleteOne(d *Deposit) *DepositDeleteOne {\n\treturn c.DeleteOneID(d.ID)\n}", "func (c *OperativeClient) DeleteOne(o *Operative) *OperativeDeleteOne {\n\treturn c.DeleteOneID(o.ID)\n}", "func (c *EventClient) DeleteOne(e *Event) *EventDeleteOne {\n\treturn c.DeleteOneID(e.ID)\n}", "func (c *UnsavedPostClient) DeleteOne(up *UnsavedPost) *UnsavedPostDeleteOne {\n\treturn c.DeleteOneID(up.ID)\n}", "func (c *BedtypeClient) DeleteOneID(id int) *BedtypeDeleteOne {\n\tbuilder := c.Delete().Where(bedtype.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &BedtypeDeleteOne{builder}\n}", "func (c *MedicineClient) DeleteOne(m *Medicine) *MedicineDeleteOne {\n\treturn c.DeleteOneID(m.ID)\n}", "func (c *OperativerecordClient) DeleteOneID(id int) *OperativerecordDeleteOne {\n\tbuilder := c.Delete().Where(operativerecord.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &OperativerecordDeleteOne{builder}\n}", "func (c *PatientofphysicianClient) DeleteOne(pa *Patientofphysician) *PatientofphysicianDeleteOne {\n\treturn c.DeleteOneID(pa.ID)\n}", "func (c *PhysicianClient) DeleteOne(ph *Physician) *PhysicianDeleteOne {\n\treturn c.DeleteOneID(ph.ID)\n}", "func (c *PhysicianClient) DeleteOne(ph *Physician) *PhysicianDeleteOne {\n\treturn c.DeleteOneID(ph.ID)\n}", "func DeleteOne(ctx context.Context, tx pgx.Tx, sb sq.DeleteBuilder) error {\n\tq, vs, err := sb.ToSql()\n\tif err != nil {\n\t\treturn err\n\t}\n\ttag, err := tx.Exec(ctx, q, vs...)\n\tif err != nil {\n\t\treturn err\n\t}\n\tif tag.RowsAffected() != 1 {\n\t\treturn ErrNoRowsAffected\n\t}\n\treturn nil\n}", "func (c *TransactionClient) DeleteOne(t *Transaction) *TransactionDeleteOne {\n\treturn c.DeleteOneID(t.ID)\n}", "func (c *LevelOfDangerousClient) DeleteOne(lod *LevelOfDangerous) *LevelOfDangerousDeleteOne {\n\treturn c.DeleteOneID(lod.ID)\n}", "func (c *BillClient) DeleteOne(b *Bill) *BillDeleteOne {\n\treturn c.DeleteOneID(b.ID)\n}", "func (c *BillClient) DeleteOne(b *Bill) *BillDeleteOne {\n\treturn c.DeleteOneID(b.ID)\n}", "func (c *BillClient) DeleteOne(b *Bill) *BillDeleteOne {\n\treturn c.DeleteOneID(b.ID)\n}", "func (c *PaymentClient) DeleteOne(pa *Payment) *PaymentDeleteOne {\n\treturn c.DeleteOneID(pa.ID)\n}", "func (c *PaymentClient) DeleteOne(pa *Payment) *PaymentDeleteOne {\n\treturn c.DeleteOneID(pa.ID)\n}", "func (c *CleanernameClient) DeleteOne(cl *Cleanername) *CleanernameDeleteOne {\n\treturn c.DeleteOneID(cl.ID)\n}", "func (d *DBRepository) deleteOne(ctx context.Context, id string) error {\n\tobjectId, err := primitive.ObjectIDFromHex(id)\n\tif err != nil {\n\t\treturn err\n\t}\n\tif _, err := d.Collection.DeleteOne(ctx, bson.M{\"_id\": objectId}); err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "func (c *MedicineTypeClient) DeleteOne(mt *MedicineType) *MedicineTypeDeleteOne {\n\treturn c.DeleteOneID(mt.ID)\n}", "func (c *StatusdClient) DeleteOne(s *Statusd) *StatusdDeleteOne {\n\treturn c.DeleteOneID(s.ID)\n}", "func (c *ToolClient) DeleteOne(t *Tool) *ToolDeleteOne {\n\treturn c.DeleteOneID(t.ID)\n}", "func (c *ActivityTypeClient) DeleteOne(at *ActivityType) *ActivityTypeDeleteOne {\n\treturn c.DeleteOneID(at.ID)\n}", "func (c *LevelOfDangerousClient) DeleteOneID(id int) *LevelOfDangerousDeleteOne {\n\tbuilder := c.Delete().Where(levelofdangerous.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &LevelOfDangerousDeleteOne{builder}\n}", "func (c *OperationroomClient) DeleteOne(o *Operationroom) *OperationroomDeleteOne {\n\treturn c.DeleteOneID(o.ID)\n}", "func (c *TagClient) DeleteOne(t *Tag) *TagDeleteOne {\n\treturn c.DeleteOneID(t.ID)\n}", "func (c *DentistClient) DeleteOneID(id int) *DentistDeleteOne {\n\tbuilder := c.Delete().Where(dentist.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &DentistDeleteOne{builder}\n}", "func (c *OperativeClient) DeleteOneID(id int) *OperativeDeleteOne {\n\tbuilder := c.Delete().Where(operative.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &OperativeDeleteOne{builder}\n}", "func NewDeleteOneNoContent() *DeleteOneNoContent {\n\treturn &DeleteOneNoContent{}\n}", "func (c *UnsavedPostClient) DeleteOneID(id int) *UnsavedPostDeleteOne {\n\tbuilder := c.Delete().Where(unsavedpost.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &UnsavedPostDeleteOne{builder}\n}", "func (c *StaytypeClient) DeleteOne(s *Staytype) *StaytypeDeleteOne {\n\treturn c.DeleteOneID(s.ID)\n}", "func (c *OrderClient) DeleteOneID(id int) *OrderDeleteOne {\n\tbuilder := c.Delete().Where(order.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &OrderDeleteOne{builder}\n}", "func (c *BuildingClient) DeleteOneID(id int) *BuildingDeleteOne {\n\tbuilder := c.Delete().Where(building.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &BuildingDeleteOne{builder}\n}", "func (c *PostClient) DeleteOneID(id int) *PostDeleteOne {\n\tbuilder := c.Delete().Where(post.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &PostDeleteOne{builder}\n}", "func (c *PatientroomClient) DeleteOne(pa *Patientroom) *PatientroomDeleteOne {\n\treturn c.DeleteOneID(pa.ID)\n}", "func (c *EventClient) DeleteOneID(id int) *EventDeleteOne {\n\tbuilder := c.Delete().Where(event.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &EventDeleteOne{builder}\n}", "func NewDeleteOneDefault(code int) *DeleteOneDefault {\n\treturn &DeleteOneDefault{\n\t\t_statusCode: code,\n\t}\n}", "func (c *UnsavedPostAttachmentClient) DeleteOne(upa *UnsavedPostAttachment) *UnsavedPostAttachmentDeleteOne {\n\treturn c.DeleteOneID(upa.ID)\n}", "func (c *UnitOfMedicineClient) DeleteOne(uom *UnitOfMedicine) *UnitOfMedicineDeleteOne {\n\treturn c.DeleteOneID(uom.ID)\n}", "func (c *FoodmenuClient) DeleteOneID(id int) *FoodmenuDeleteOne {\n\tbuilder := c.Delete().Where(foodmenu.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &FoodmenuDeleteOne{builder}\n}", "func (c *PostAttachmentClient) DeleteOne(pa *PostAttachment) *PostAttachmentDeleteOne {\n\treturn c.DeleteOneID(pa.ID)\n}", "func (c *DeviceClient) DeleteOneID(id int) *DeviceDeleteOne {\n\tbuilder := c.Delete().Where(device.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &DeviceDeleteOne{builder}\n}", "func (c *ToolClient) DeleteOneID(id int) *ToolDeleteOne {\n\tbuilder := c.Delete().Where(tool.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &ToolDeleteOne{builder}\n}", "func (c *AppointmentClient) DeleteOne(a *Appointment) *AppointmentDeleteOne {\n\treturn c.DeleteOneID(a.ID)\n}", "func (c *EmptyClient) DeleteOneID(id int) *EmptyDeleteOne {\n\tbuilder := c.Delete().Where(empty.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &EmptyDeleteOne{builder}\n}", "func (c *PurposeClient) DeleteOne(pu *Purpose) *PurposeDeleteOne {\n\treturn c.DeleteOneID(pu.ID)\n}", "func (c *AdminClient) DeleteOneID(id int) *AdminDeleteOne {\n\tbuilder := c.Delete().Where(admin.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &AdminDeleteOne{builder}\n}", "func (c *CleaningroomClient) DeleteOneID(id int) *CleaningroomDeleteOne {\n\tbuilder := c.Delete().Where(cleaningroom.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &CleaningroomDeleteOne{builder}\n}", "func (c *LengthtimeClient) DeleteOneID(id int) *LengthtimeDeleteOne {\n\tbuilder := c.Delete().Where(lengthtime.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &LengthtimeDeleteOne{builder}\n}", "func (c *DepartmentClient) DeleteOne(d *Department) *DepartmentDeleteOne {\n\treturn c.DeleteOneID(d.ID)\n}", "func (c *UnsavedPostAttachmentClient) DeleteOneID(id int) *UnsavedPostAttachmentDeleteOne {\n\tbuilder := c.Delete().Where(unsavedpostattachment.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &UnsavedPostAttachmentDeleteOne{builder}\n}", "func (c *PhysicianClient) DeleteOneID(id int) *PhysicianDeleteOne {\n\tbuilder := c.Delete().Where(physician.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &PhysicianDeleteOne{builder}\n}", "func (c *PhysicianClient) DeleteOneID(id int) *PhysicianDeleteOne {\n\tbuilder := c.Delete().Where(physician.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &PhysicianDeleteOne{builder}\n}", "func (c *DoctorClient) DeleteOneID(id int) *DoctorDeleteOne {\n\tbuilder := c.Delete().Where(doctor.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &DoctorDeleteOne{builder}\n}", "func (c *MealplanClient) DeleteOne(m *Mealplan) *MealplanDeleteOne {\n\treturn c.DeleteOneID(m.ID)\n}", "func (c *CleanernameClient) DeleteOneID(id int) *CleanernameDeleteOne {\n\tbuilder := c.Delete().Where(cleanername.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &CleanernameDeleteOne{builder}\n}", "func (c *ComplaintClient) DeleteOne(co *Complaint) *ComplaintDeleteOne {\n\treturn c.DeleteOneID(co.ID)\n}", "func (c *StatustClient) DeleteOneID(id int) *StatustDeleteOne {\n\tbuilder := c.Delete().Where(statust.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &StatustDeleteOne{builder}\n}", "func (c *PartorderClient) DeleteOne(pa *Partorder) *PartorderDeleteOne {\n\treturn c.DeleteOneID(pa.ID)\n}", "func (c *StaytypeClient) DeleteOneID(id int) *StaytypeDeleteOne {\n\tbuilder := c.Delete().Where(staytype.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &StaytypeDeleteOne{builder}\n}", "func (c *PatientofphysicianClient) DeleteOneID(id int) *PatientofphysicianDeleteOne {\n\tbuilder := c.Delete().Where(patientofphysician.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &PatientofphysicianDeleteOne{builder}\n}", "func (c *RoomdetailClient) DeleteOne(r *Roomdetail) *RoomdetailDeleteOne {\n\treturn c.DeleteOneID(r.ID)\n}", "func (c *BranchClient) DeleteOne(b *Branch) *BranchDeleteOne {\n\treturn c.DeleteOneID(b.ID)\n}", "func (c *UnitOfMedicineClient) DeleteOneID(id int) *UnitOfMedicineDeleteOne {\n\tbuilder := c.Delete().Where(unitofmedicine.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &UnitOfMedicineDeleteOne{builder}\n}", "func (c *TitleClient) DeleteOne(t *Title) *TitleDeleteOne {\n\treturn c.DeleteOneID(t.ID)\n}", "func (c *WorkExperienceClient) DeleteOne(we *WorkExperience) *WorkExperienceDeleteOne {\n\treturn c.DeleteOneID(we.ID)\n}", "func (c *AnnotationClient) DeleteOne(a *Annotation) *AnnotationDeleteOne {\n\treturn c.DeleteOneID(a.ID)\n}", "func (c *UnsavedPostImageClient) DeleteOne(upi *UnsavedPostImage) *UnsavedPostImageDeleteOne {\n\treturn c.DeleteOneID(upi.ID)\n}", "func (c *DispenseMedicineClient) DeleteOneID(id int) *DispenseMedicineDeleteOne {\n\tbuilder := c.Delete().Where(dispensemedicine.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &DispenseMedicineDeleteOne{builder}\n}", "func (c *DepositClient) DeleteOneID(id int) *DepositDeleteOne {\n\tbuilder := c.Delete().Where(deposit.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &DepositDeleteOne{builder}\n}", "func (c *PharmacistClient) DeleteOneID(id int) *PharmacistDeleteOne {\n\tbuilder := c.Delete().Where(pharmacist.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &PharmacistDeleteOne{builder}\n}", "func (c *PositionassingmentClient) DeleteOne(po *Positionassingment) *PositionassingmentDeleteOne {\n\treturn c.DeleteOneID(po.ID)\n}", "func (c *KeyStoreClient) DeleteOneID(id int32) *KeyStoreDeleteOne {\n\tbuilder := c.Delete().Where(keystore.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &KeyStoreDeleteOne{builder}\n}", "func (c *PaymentClient) DeleteOneID(id int) *PaymentDeleteOne {\n\tbuilder := c.Delete().Where(payment.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &PaymentDeleteOne{builder}\n}" ]
[ "0.6756587", "0.6709248", "0.6703961", "0.670318", "0.66553116", "0.66148186", "0.6572149", "0.6557555", "0.6552272", "0.65237635", "0.65061617", "0.6499291", "0.6434074", "0.6432293", "0.64267963", "0.64205337", "0.6398103", "0.6385286", "0.6372697", "0.63663584", "0.63654643", "0.63654643", "0.63654643", "0.6362657", "0.63574296", "0.63574296", "0.6353369", "0.6339299", "0.6336179", "0.63301015", "0.6321808", "0.63174367", "0.6303661", "0.62972194", "0.62863207", "0.62863207", "0.6279139", "0.6275199", "0.6270237", "0.6268455", "0.6268455", "0.6268455", "0.6263539", "0.6263539", "0.626228", "0.62493193", "0.62488425", "0.6247898", "0.6235509", "0.62336886", "0.62264526", "0.622629", "0.6222045", "0.6213431", "0.62110764", "0.6203543", "0.61965996", "0.61887383", "0.618642", "0.6182131", "0.617503", "0.6174455", "0.61586386", "0.6158026", "0.6154386", "0.6149794", "0.6145806", "0.61379576", "0.6136323", "0.61348855", "0.61171746", "0.6115592", "0.611266", "0.61089367", "0.61029077", "0.6100578", "0.6095522", "0.6094066", "0.60936314", "0.60936314", "0.6091636", "0.60897076", "0.6088863", "0.60813314", "0.60789454", "0.60780084", "0.60720104", "0.6066409", "0.606525", "0.60645807", "0.60624427", "0.6055795", "0.60554683", "0.60463685", "0.6039845", "0.6039164", "0.6036367", "0.6023885", "0.6022439", "0.6019607", "0.60158646" ]
0.0
-1
DeleteOneID returns a delete builder for the given id.
func (c *AdminSessionClient) DeleteOneID(id int) *AdminSessionDeleteOne { builder := c.Delete().Where(adminsession.ID(id)) builder.mutation.id = &id builder.mutation.op = OpDeleteOne return &AdminSessionDeleteOne{builder} }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (c *BedtypeClient) DeleteOneID(id int) *BedtypeDeleteOne {\n\tbuilder := c.Delete().Where(bedtype.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &BedtypeDeleteOne{builder}\n}", "func (c *BuildingClient) DeleteOneID(id int) *BuildingDeleteOne {\n\tbuilder := c.Delete().Where(building.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &BuildingDeleteOne{builder}\n}", "func (c *LengthtimeClient) DeleteOneID(id int) *LengthtimeDeleteOne {\n\tbuilder := c.Delete().Where(lengthtime.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &LengthtimeDeleteOne{builder}\n}", "func (c *CleanernameClient) DeleteOneID(id int) *CleanernameDeleteOne {\n\tbuilder := c.Delete().Where(cleanername.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &CleanernameDeleteOne{builder}\n}", "func (c *ToolClient) DeleteOneID(id int) *ToolDeleteOne {\n\tbuilder := c.Delete().Where(tool.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &ToolDeleteOne{builder}\n}", "func (c *OperativeClient) DeleteOneID(id int) *OperativeDeleteOne {\n\tbuilder := c.Delete().Where(operative.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &OperativeDeleteOne{builder}\n}", "func (c *FoodmenuClient) DeleteOneID(id int) *FoodmenuDeleteOne {\n\tbuilder := c.Delete().Where(foodmenu.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &FoodmenuDeleteOne{builder}\n}", "func (c *CleaningroomClient) DeleteOneID(id int) *CleaningroomDeleteOne {\n\tbuilder := c.Delete().Where(cleaningroom.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &CleaningroomDeleteOne{builder}\n}", "func (c *DoctorClient) DeleteOneID(id int) *DoctorDeleteOne {\n\tbuilder := c.Delete().Where(doctor.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &DoctorDeleteOne{builder}\n}", "func (c *MealplanClient) DeleteOneID(id int) *MealplanDeleteOne {\n\tbuilder := c.Delete().Where(mealplan.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &MealplanDeleteOne{builder}\n}", "func (c *DentistClient) DeleteOneID(id int) *DentistDeleteOne {\n\tbuilder := c.Delete().Where(dentist.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &DentistDeleteOne{builder}\n}", "func (c *OperativerecordClient) DeleteOneID(id int) *OperativerecordDeleteOne {\n\tbuilder := c.Delete().Where(operativerecord.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &OperativerecordDeleteOne{builder}\n}", "func (c *LevelOfDangerousClient) DeleteOneID(id int) *LevelOfDangerousDeleteOne {\n\tbuilder := c.Delete().Where(levelofdangerous.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &LevelOfDangerousDeleteOne{builder}\n}", "func (c *PhysicianClient) DeleteOneID(id int) *PhysicianDeleteOne {\n\tbuilder := c.Delete().Where(physician.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &PhysicianDeleteOne{builder}\n}", "func (c *PhysicianClient) DeleteOneID(id int) *PhysicianDeleteOne {\n\tbuilder := c.Delete().Where(physician.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &PhysicianDeleteOne{builder}\n}", "func (c *BillClient) DeleteOneID(id int) *BillDeleteOne {\n\tbuilder := c.Delete().Where(bill.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &BillDeleteOne{builder}\n}", "func (c *BillClient) DeleteOneID(id int) *BillDeleteOne {\n\tbuilder := c.Delete().Where(bill.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &BillDeleteOne{builder}\n}", "func (c *BillClient) DeleteOneID(id int) *BillDeleteOne {\n\tbuilder := c.Delete().Where(bill.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &BillDeleteOne{builder}\n}", "func (c *DeviceClient) DeleteOneID(id int) *DeviceDeleteOne {\n\tbuilder := c.Delete().Where(device.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &DeviceDeleteOne{builder}\n}", "func (c *UnitOfMedicineClient) DeleteOneID(id int) *UnitOfMedicineDeleteOne {\n\tbuilder := c.Delete().Where(unitofmedicine.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &UnitOfMedicineDeleteOne{builder}\n}", "func (c *AdminClient) DeleteOneID(id int) *AdminDeleteOne {\n\tbuilder := c.Delete().Where(admin.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &AdminDeleteOne{builder}\n}", "func (c *DrugAllergyClient) DeleteOneID(id int) *DrugAllergyDeleteOne {\n\tbuilder := c.Delete().Where(drugallergy.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &DrugAllergyDeleteOne{builder}\n}", "func (c *RoomuseClient) DeleteOneID(id int) *RoomuseDeleteOne {\n\tbuilder := c.Delete().Where(roomuse.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &RoomuseDeleteOne{builder}\n}", "func (c *PatientofphysicianClient) DeleteOneID(id int) *PatientofphysicianDeleteOne {\n\tbuilder := c.Delete().Where(patientofphysician.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &PatientofphysicianDeleteOne{builder}\n}", "func (c *OrderClient) DeleteOneID(id int) *OrderDeleteOne {\n\tbuilder := c.Delete().Where(order.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &OrderDeleteOne{builder}\n}", "func (c *MedicineClient) DeleteOneID(id int) *MedicineDeleteOne {\n\tbuilder := c.Delete().Where(medicine.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &MedicineDeleteOne{builder}\n}", "func (c *EmptyClient) DeleteOneID(id int) *EmptyDeleteOne {\n\tbuilder := c.Delete().Where(empty.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &EmptyDeleteOne{builder}\n}", "func (c *MedicineTypeClient) DeleteOneID(id int) *MedicineTypeDeleteOne {\n\tbuilder := c.Delete().Where(medicinetype.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &MedicineTypeDeleteOne{builder}\n}", "func (c *BeerClient) DeleteOneID(id int) *BeerDeleteOne {\n\tbuilder := c.Delete().Where(beer.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &BeerDeleteOne{builder}\n}", "func (c *RoomdetailClient) DeleteOneID(id int) *RoomdetailDeleteOne {\n\tbuilder := c.Delete().Where(roomdetail.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &RoomdetailDeleteOne{builder}\n}", "func (c *StatustClient) DeleteOneID(id int) *StatustDeleteOne {\n\tbuilder := c.Delete().Where(statust.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &StatustDeleteOne{builder}\n}", "func (c *BookingClient) DeleteOneID(id int) *BookingDeleteOne {\n\tbuilder := c.Delete().Where(booking.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &BookingDeleteOne{builder}\n}", "func (c *BinaryFileClient) DeleteOneID(id int) *BinaryFileDeleteOne {\n\tbuilder := c.Delete().Where(binaryfile.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &BinaryFileDeleteOne{builder}\n}", "func (c *PharmacistClient) DeleteOneID(id int) *PharmacistDeleteOne {\n\tbuilder := c.Delete().Where(pharmacist.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &PharmacistDeleteOne{builder}\n}", "func (c *KeyStoreClient) DeleteOneID(id int32) *KeyStoreDeleteOne {\n\tbuilder := c.Delete().Where(keystore.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &KeyStoreDeleteOne{builder}\n}", "func (c *LeaseClient) DeleteOneID(id int) *LeaseDeleteOne {\n\tbuilder := c.Delete().Where(lease.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &LeaseDeleteOne{builder}\n}", "func (c *PaymentClient) DeleteOneID(id int) *PaymentDeleteOne {\n\tbuilder := c.Delete().Where(payment.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &PaymentDeleteOne{builder}\n}", "func (c *PaymentClient) DeleteOneID(id int) *PaymentDeleteOne {\n\tbuilder := c.Delete().Where(payment.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &PaymentDeleteOne{builder}\n}", "func (c *DispenseMedicineClient) DeleteOneID(id int) *DispenseMedicineDeleteOne {\n\tbuilder := c.Delete().Where(dispensemedicine.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &DispenseMedicineDeleteOne{builder}\n}", "func (c *DepositClient) DeleteOneID(id int) *DepositDeleteOne {\n\tbuilder := c.Delete().Where(deposit.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &DepositDeleteOne{builder}\n}", "func (c *StaytypeClient) DeleteOneID(id int) *StaytypeDeleteOne {\n\tbuilder := c.Delete().Where(staytype.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &StaytypeDeleteOne{builder}\n}", "func (c *OperationroomClient) DeleteOneID(id int) *OperationroomDeleteOne {\n\tbuilder := c.Delete().Where(operationroom.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &OperationroomDeleteOne{builder}\n}", "func (c *NurseClient) DeleteOneID(id int) *NurseDeleteOne {\n\tbuilder := c.Delete().Where(nurse.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &NurseDeleteOne{builder}\n}", "func (c *QueueClient) DeleteOneID(id int) *QueueDeleteOne {\n\tbuilder := c.Delete().Where(queue.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &QueueDeleteOne{builder}\n}", "func (c *OperationClient) DeleteOneID(id uuid.UUID) *OperationDeleteOne {\n\tbuilder := c.Delete().Where(operation.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &OperationDeleteOne{builder}\n}", "func (c *PostClient) DeleteOneID(id int) *PostDeleteOne {\n\tbuilder := c.Delete().Where(post.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &PostDeleteOne{builder}\n}", "func (c *ComplaintClient) DeleteOneID(id int) *ComplaintDeleteOne {\n\tbuilder := c.Delete().Where(complaint.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &ComplaintDeleteOne{builder}\n}", "func (c *PatientroomClient) DeleteOneID(id int) *PatientroomDeleteOne {\n\tbuilder := c.Delete().Where(patientroom.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &PatientroomDeleteOne{builder}\n}", "func (c *ModuleClient) DeleteOneID(id int) *ModuleDeleteOne {\n\treturn &ModuleDeleteOne{c.Delete().Where(module.ID(id))}\n}", "func (c *ComplaintTypeClient) DeleteOneID(id int) *ComplaintTypeDeleteOne {\n\tbuilder := c.Delete().Where(complainttype.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &ComplaintTypeDeleteOne{builder}\n}", "func (c *PurposeClient) DeleteOneID(id int) *PurposeDeleteOne {\n\tbuilder := c.Delete().Where(purpose.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &PurposeDeleteOne{builder}\n}", "func (c *StatusdClient) DeleteOneID(id int) *StatusdDeleteOne {\n\tbuilder := c.Delete().Where(statusd.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &StatusdDeleteOne{builder}\n}", "func (c *DNSBLQueryClient) DeleteOneID(id uuid.UUID) *DNSBLQueryDeleteOne {\n\tbuilder := c.Delete().Where(dnsblquery.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &DNSBLQueryDeleteOne{builder}\n}", "func (c *PetruleClient) DeleteOneID(id int) *PetruleDeleteOne {\n\tbuilder := c.Delete().Where(petrule.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &PetruleDeleteOne{builder}\n}", "func (c *EventClient) DeleteOneID(id int) *EventDeleteOne {\n\tbuilder := c.Delete().Where(event.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &EventDeleteOne{builder}\n}", "func (c *ClubapplicationClient) DeleteOneID(id int) *ClubapplicationDeleteOne {\n\tbuilder := c.Delete().Where(clubapplication.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &ClubapplicationDeleteOne{builder}\n}", "func (c *DisciplineClient) DeleteOneID(id int) *DisciplineDeleteOne {\n\tbuilder := c.Delete().Where(discipline.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &DisciplineDeleteOne{builder}\n}", "func (c *RoomClient) DeleteOneID(id int) *RoomDeleteOne {\n\tbuilder := c.Delete().Where(room.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &RoomDeleteOne{builder}\n}", "func (c *RoomClient) DeleteOneID(id int) *RoomDeleteOne {\n\tbuilder := c.Delete().Where(room.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &RoomDeleteOne{builder}\n}", "func (c *PledgeClient) DeleteOneID(id int) *PledgeDeleteOne {\n\tbuilder := c.Delete().Where(pledge.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &PledgeDeleteOne{builder}\n}", "func (c *CardClient) DeleteOneID(id int) *CardDeleteOne {\n\tbuilder := c.Delete().Where(card.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &CardDeleteOne{builder}\n}", "func (c *BillingstatusClient) DeleteOneID(id int) *BillingstatusDeleteOne {\n\tbuilder := c.Delete().Where(billingstatus.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &BillingstatusDeleteOne{builder}\n}", "func (c *SymptomClient) DeleteOneID(id int) *SymptomDeleteOne {\n\tbuilder := c.Delete().Where(symptom.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &SymptomDeleteOne{builder}\n}", "func (c *PatientClient) DeleteOneID(id int) *PatientDeleteOne {\n\tbuilder := c.Delete().Where(patient.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &PatientDeleteOne{builder}\n}", "func (c *PatientClient) DeleteOneID(id int) *PatientDeleteOne {\n\tbuilder := c.Delete().Where(patient.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &PatientDeleteOne{builder}\n}", "func (c *PatientClient) DeleteOneID(id int) *PatientDeleteOne {\n\tbuilder := c.Delete().Where(patient.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &PatientDeleteOne{builder}\n}", "func (c *TasteClient) DeleteOneID(id int) *TasteDeleteOne {\n\tbuilder := c.Delete().Where(taste.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &TasteDeleteOne{builder}\n}", "func (c *UnsavedPostClient) DeleteOneID(id int) *UnsavedPostDeleteOne {\n\tbuilder := c.Delete().Where(unsavedpost.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &UnsavedPostDeleteOne{builder}\n}", "func (c *JobClient) DeleteOneID(id int) *JobDeleteOne {\n\tbuilder := c.Delete().Where(job.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &JobDeleteOne{builder}\n}", "func (c *ExaminationroomClient) DeleteOneID(id int) *ExaminationroomDeleteOne {\n\tbuilder := c.Delete().Where(examinationroom.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &ExaminationroomDeleteOne{builder}\n}", "func (c *PlanetClient) DeleteOneID(id int) *PlanetDeleteOne {\n\tbuilder := c.Delete().Where(planet.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &PlanetDeleteOne{builder}\n}", "func (c *PrescriptionClient) DeleteOneID(id int) *PrescriptionDeleteOne {\n\tbuilder := c.Delete().Where(prescription.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &PrescriptionDeleteOne{builder}\n}", "func (c *TransactionClient) DeleteOneID(id int32) *TransactionDeleteOne {\n\tbuilder := c.Delete().Where(transaction.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &TransactionDeleteOne{builder}\n}", "func (c *SessionClient) DeleteOneID(id int) *SessionDeleteOne {\n\tbuilder := c.Delete().Where(session.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &SessionDeleteOne{builder}\n}", "func (c *TitleClient) DeleteOneID(id int) *TitleDeleteOne {\n\tbuilder := c.Delete().Where(title.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &TitleDeleteOne{builder}\n}", "func (c *PatientInfoClient) DeleteOneID(id int) *PatientInfoDeleteOne {\n\tbuilder := c.Delete().Where(patientinfo.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &PatientInfoDeleteOne{builder}\n}", "func (c *EatinghistoryClient) DeleteOneID(id int) *EatinghistoryDeleteOne {\n\tbuilder := c.Delete().Where(eatinghistory.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &EatinghistoryDeleteOne{builder}\n}", "func (c *WifiClient) DeleteOneID(id int) *WifiDeleteOne {\n\tbuilder := c.Delete().Where(wifi.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &WifiDeleteOne{builder}\n}", "func (c *FacultyClient) DeleteOneID(id int) *FacultyDeleteOne {\n\tbuilder := c.Delete().Where(faculty.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &FacultyDeleteOne{builder}\n}", "func (c *WalletNodeClient) DeleteOneID(id int32) *WalletNodeDeleteOne {\n\tbuilder := c.Delete().Where(walletnode.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &WalletNodeDeleteOne{builder}\n}", "func (c *ClubTypeClient) DeleteOneID(id int) *ClubTypeDeleteOne {\n\tbuilder := c.Delete().Where(clubtype.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &ClubTypeDeleteOne{builder}\n}", "func (c *AppointmentClient) DeleteOneID(id uuid.UUID) *AppointmentDeleteOne {\n\tbuilder := c.Delete().Where(appointment.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &AppointmentDeleteOne{builder}\n}", "func (c *PartorderClient) DeleteOneID(id int) *PartorderDeleteOne {\n\tbuilder := c.Delete().Where(partorder.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &PartorderDeleteOne{builder}\n}", "func (c *ClubClient) DeleteOneID(id int) *ClubDeleteOne {\n\tbuilder := c.Delete().Where(club.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &ClubDeleteOne{builder}\n}", "func (c *CoinInfoClient) DeleteOneID(id int32) *CoinInfoDeleteOne {\n\tbuilder := c.Delete().Where(coininfo.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &CoinInfoDeleteOne{builder}\n}", "func (c *ClinicClient) DeleteOneID(id uuid.UUID) *ClinicDeleteOne {\n\tbuilder := c.Delete().Where(clinic.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &ClinicDeleteOne{builder}\n}", "func (c *TimerClient) DeleteOneID(id int) *TimerDeleteOne {\n\tbuilder := c.Delete().Where(timer.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &TimerDeleteOne{builder}\n}", "func (c *ClubappStatusClient) DeleteOneID(id int) *ClubappStatusDeleteOne {\n\tbuilder := c.Delete().Where(clubappstatus.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &ClubappStatusDeleteOne{builder}\n}", "func (c *ActivityTypeClient) DeleteOneID(id int) *ActivityTypeDeleteOne {\n\tbuilder := c.Delete().Where(activitytype.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &ActivityTypeDeleteOne{builder}\n}", "func (c *ModuleVersionClient) DeleteOneID(id int) *ModuleVersionDeleteOne {\n\treturn &ModuleVersionDeleteOne{c.Delete().Where(moduleversion.ID(id))}\n}", "func (c *UsertypeClient) DeleteOneID(id int) *UsertypeDeleteOne {\n\tbuilder := c.Delete().Where(usertype.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &UsertypeDeleteOne{builder}\n}", "func (c *ActivitiesClient) DeleteOneID(id int) *ActivitiesDeleteOne {\n\tbuilder := c.Delete().Where(activities.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &ActivitiesDeleteOne{builder}\n}", "func (c *SituationClient) DeleteOneID(id int) *SituationDeleteOne {\n\tbuilder := c.Delete().Where(situation.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &SituationDeleteOne{builder}\n}", "func (c *SkillClient) DeleteOneID(id int) *SkillDeleteOne {\n\tbuilder := c.Delete().Where(skill.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &SkillDeleteOne{builder}\n}", "func (c *RentalstatusClient) DeleteOneID(id int) *RentalstatusDeleteOne {\n\tbuilder := c.Delete().Where(rentalstatus.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &RentalstatusDeleteOne{builder}\n}", "func (c *BranchClient) DeleteOneID(id int) *BranchDeleteOne {\n\tbuilder := c.Delete().Where(branch.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &BranchDeleteOne{builder}\n}", "func (c *YearClient) DeleteOneID(id int) *YearDeleteOne {\n\tbuilder := c.Delete().Where(year.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &YearDeleteOne{builder}\n}", "func (c *PartClient) DeleteOneID(id int) *PartDeleteOne {\n\tbuilder := c.Delete().Where(part.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &PartDeleteOne{builder}\n}", "func (c *TagClient) DeleteOneID(id int) *TagDeleteOne {\n\tbuilder := c.Delete().Where(tag.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &TagDeleteOne{builder}\n}", "func (c *RepairinvoiceClient) DeleteOneID(id int) *RepairinvoiceDeleteOne {\n\tbuilder := c.Delete().Where(repairinvoice.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &RepairinvoiceDeleteOne{builder}\n}" ]
[ "0.76778156", "0.75968426", "0.75511706", "0.7541144", "0.7539394", "0.7526723", "0.74882805", "0.7487795", "0.74769074", "0.74767685", "0.74631363", "0.74613", "0.7458024", "0.745116", "0.745116", "0.7442616", "0.7442616", "0.7442616", "0.743347", "0.7425805", "0.7422992", "0.74197966", "0.7418542", "0.7399402", "0.7396725", "0.73856103", "0.73840207", "0.7375385", "0.735778", "0.73571473", "0.73506707", "0.73470324", "0.7346839", "0.7345604", "0.7343301", "0.73415756", "0.7339983", "0.7339983", "0.73328143", "0.7330048", "0.7329202", "0.7325914", "0.7323134", "0.7313714", "0.7307478", "0.7304015", "0.72893864", "0.7282448", "0.72806984", "0.72796077", "0.7279311", "0.7277576", "0.7277483", "0.72763735", "0.72697914", "0.7263448", "0.72509044", "0.7238351", "0.7238351", "0.7237803", "0.72373664", "0.723381", "0.72292316", "0.7228588", "0.7228588", "0.7228588", "0.72245425", "0.72225535", "0.72206736", "0.72152764", "0.7205751", "0.7203806", "0.72032803", "0.71952355", "0.7193382", "0.7190719", "0.7189693", "0.7165575", "0.71655035", "0.71611136", "0.7160824", "0.7160091", "0.7155872", "0.71474624", "0.7144856", "0.71436256", "0.71384954", "0.7131519", "0.712696", "0.7125728", "0.71234626", "0.7122792", "0.71096176", "0.7108689", "0.71075124", "0.7105292", "0.7104324", "0.7101526", "0.7095171", "0.7091349" ]
0.72784746
51
Query returns a query builder for AdminSession.
func (c *AdminSessionClient) Query() *AdminSessionQuery { return &AdminSessionQuery{ config: c.config, } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (c *AdminClient) Query() *AdminQuery {\n\treturn &AdminQuery{\n\t\tconfig: c.config,\n\t}\n}", "func (c *CleaningroomClient) Query() *CleaningroomQuery {\n\treturn &CleaningroomQuery{config: c.config}\n}", "func (c *SessionClient) Query() *SessionQuery {\n\treturn &SessionQuery{config: c.config}\n}", "func (c *RoomuseClient) Query() *RoomuseQuery {\n\treturn &RoomuseQuery{config: c.config}\n}", "func (c *BuildingClient) Query() *BuildingQuery {\n\treturn &BuildingQuery{config: c.config}\n}", "func (c *RoomdetailClient) Query() *RoomdetailQuery {\n\treturn &RoomdetailQuery{config: c.config}\n}", "func (c *MealplanClient) Query() *MealplanQuery {\n\treturn &MealplanQuery{config: c.config}\n}", "func (c *PatientroomClient) Query() *PatientroomQuery {\n\treturn &PatientroomQuery{config: c.config}\n}", "func (c *RoomClient) Query() *RoomQuery {\n\treturn &RoomQuery{config: c.config}\n}", "func (c *RoomClient) Query() *RoomQuery {\n\treturn &RoomQuery{config: c.config}\n}", "func (c *UnitOfMedicineClient) Query() *UnitOfMedicineQuery {\n\treturn &UnitOfMedicineQuery{config: c.config}\n}", "func (c *LevelOfDangerousClient) Query() *LevelOfDangerousQuery {\n\treturn &LevelOfDangerousQuery{config: c.config}\n}", "func (b *Blog) QueryAdmins() *UserQuery {\n\treturn NewBlogClient(b.config).QueryAdmins(b)\n}", "func (c *MedicineClient) Query() *MedicineQuery {\n\treturn &MedicineQuery{config: c.config}\n}", "func (c *ModuleClient) Query() *ModuleQuery {\n\treturn &ModuleQuery{config: c.config}\n}", "func (c *ModuleVersionClient) Query() *ModuleVersionQuery {\n\treturn &ModuleVersionQuery{config: c.config}\n}", "func (c *OperativerecordClient) Query() *OperativerecordQuery {\n\treturn &OperativerecordQuery{config: c.config}\n}", "func (c *OperationroomClient) Query() *OperationroomQuery {\n\treturn &OperationroomQuery{config: c.config}\n}", "func (c *ExaminationroomClient) Query() *ExaminationroomQuery {\n\treturn &ExaminationroomQuery{config: c.config}\n}", "func (c *AdminClient) QuerySessions(a *Admin) *AdminSessionQuery {\n\tquery := &AdminSessionQuery{config: c.config}\n\tquery.path = func(ctx context.Context) (fromV *sql.Selector, _ error) {\n\t\tid := a.ID\n\t\tstep := sqlgraph.NewStep(\n\t\t\tsqlgraph.From(admin.Table, admin.FieldID, id),\n\t\t\tsqlgraph.To(adminsession.Table, adminsession.FieldID),\n\t\t\tsqlgraph.Edge(sqlgraph.O2M, false, admin.SessionsTable, admin.SessionsColumn),\n\t\t)\n\t\tfromV = sqlgraph.Neighbors(a.driver.Dialect(), step)\n\t\treturn fromV, nil\n\t}\n\treturn query\n}", "func (c *BeerClient) Query() *BeerQuery {\n\treturn &BeerQuery{\n\t\tconfig: c.config,\n\t}\n}", "func (c *DoctorClient) Query() *DoctorQuery {\n\treturn &DoctorQuery{config: c.config}\n}", "func (c *MedicineTypeClient) Query() *MedicineTypeQuery {\n\treturn &MedicineTypeQuery{config: c.config}\n}", "func (c *BedtypeClient) Query() *BedtypeQuery {\n\treturn &BedtypeQuery{config: c.config}\n}", "func (c *DispenseMedicineClient) Query() *DispenseMedicineQuery {\n\treturn &DispenseMedicineQuery{config: c.config}\n}", "func (c *PharmacistClient) Query() *PharmacistQuery {\n\treturn &PharmacistQuery{config: c.config}\n}", "func (c *UserClient) Query() *UserQuery {\n\treturn &UserQuery{config: c.config}\n}", "func (c *UserClient) Query() *UserQuery {\n\treturn &UserQuery{config: c.config}\n}", "func (c *UserClient) Query() *UserQuery {\n\treturn &UserQuery{config: c.config}\n}", "func (c *UserClient) Query() *UserQuery {\n\treturn &UserQuery{config: c.config}\n}", "func (c *UserClient) Query() *UserQuery {\n\treturn &UserQuery{config: c.config}\n}", "func (c *UserClient) Query() *UserQuery {\n\treturn &UserQuery{config: c.config}\n}", "func (c *UserClient) Query() *UserQuery {\n\treturn &UserQuery{config: c.config}\n}", "func (c *UserClient) Query() *UserQuery {\n\treturn &UserQuery{config: c.config}\n}", "func (c *UserClient) Query() *UserQuery {\n\treturn &UserQuery{\n\t\tconfig: c.config,\n\t}\n}", "func (c *UserClient) Query() *UserQuery {\n\treturn &UserQuery{\n\t\tconfig: c.config,\n\t}\n}", "func (c *UserClient) Query() *UserQuery {\n\treturn &UserQuery{\n\t\tconfig: c.config,\n\t}\n}", "func (c *OperativeClient) Query() *OperativeQuery {\n\treturn &OperativeQuery{config: c.config}\n}", "func (c *ClubapplicationClient) Query() *ClubapplicationQuery {\n\treturn &ClubapplicationQuery{config: c.config}\n}", "func (c *StatusdClient) Query() *StatusdQuery {\n\treturn &StatusdQuery{config: c.config}\n}", "func (c *RentalstatusClient) Query() *RentalstatusQuery {\n\treturn &RentalstatusQuery{config: c.config}\n}", "func (c *CleanernameClient) Query() *CleanernameQuery {\n\treturn &CleanernameQuery{config: c.config}\n}", "func (c *AppointmentClient) Query() *AppointmentQuery {\n\treturn &AppointmentQuery{config: c.config}\n}", "func (c *PhysicianClient) Query() *PhysicianQuery {\n\treturn &PhysicianQuery{config: c.config}\n}", "func (c *PhysicianClient) Query() *PhysicianQuery {\n\treturn &PhysicianQuery{config: c.config}\n}", "func (builder *QueryBuilder[K, F]) Query() Query[K, F] {\n\tif len(builder.query.Conditions) == 0 {\n\t\tbuilder.Where(defaultFilter[K, F]{})\n\t}\n\tif len(builder.query.Aggregators) == 0 {\n\t\tbuilder.Aggregate(defaultAggregator[K, F]{})\n\t}\n\tbuilder.query.results = &Result[K, F]{\n\t\tentries: make(map[ResultKey]*ResultEntry[K, F]),\n\t}\n\treturn builder.query\n}", "func (c Combinator) Query() cqr.CommonQueryRepresentation {\n\treturn c.Clause.Query\n}", "func (c *FoodmenuClient) Query() *FoodmenuQuery {\n\treturn &FoodmenuQuery{config: c.config}\n}", "func (c *PatientClient) Query() *PatientQuery {\n\treturn &PatientQuery{config: c.config}\n}", "func (c *PatientClient) Query() *PatientQuery {\n\treturn &PatientQuery{config: c.config}\n}", "func (c *PatientClient) Query() *PatientQuery {\n\treturn &PatientQuery{config: c.config}\n}", "func (b *SqliteBuilder) QueryBuilder() QueryBuilder {\n\treturn b.qb\n}", "func (c *ClubappStatusClient) Query() *ClubappStatusQuery {\n\treturn &ClubappStatusQuery{config: c.config}\n}", "func (c *EmptyClient) Query() *EmptyQuery {\n\treturn &EmptyQuery{\n\t\tconfig: c.config,\n\t}\n}", "func (t *Template) QueryCreator() *AdminQuery {\n\treturn (&TemplateClient{config: t.config}).QueryCreator(t)\n}", "func (c *BillingstatusClient) Query() *BillingstatusQuery {\n\treturn &BillingstatusQuery{config: c.config}\n}", "func Query() Sequence {\n\treturn New().Query()\n}", "func (action *LedgerShowAction) Query() db.LedgerBySequenceQuery {\n\treturn db.LedgerBySequenceQuery{\n\t\tSqlQuery: action.App.HistoryQuery(),\n\t\tSequence: action.GetInt32(\"id\"),\n\t}\n}", "func (r *Resolver) Query() exec.QueryResolver { return &queryResolver{r} }", "func (c *PrescriptionClient) Query() *PrescriptionQuery {\n\treturn &PrescriptionQuery{config: c.config}\n}", "func (c *PositionassingmentClient) Query() *PositionassingmentQuery {\n\treturn &PositionassingmentQuery{config: c.config}\n}", "func (c *DentistClient) Query() *DentistQuery {\n\treturn &DentistQuery{config: c.config}\n}", "func (c *DepositClient) Query() *DepositQuery {\n\treturn &DepositQuery{config: c.config}\n}", "func (c *CustomerClient) Query() *CustomerQuery {\n\treturn &CustomerQuery{config: c.config}\n}", "func (c *SituationClient) Query() *SituationQuery {\n\treturn &SituationQuery{config: c.config}\n}", "func (r *Resolver) Query() gqlhandler.QueryResolver { return &queryResolver{r} }", "func (c *DeviceClient) Query() *DeviceQuery {\n\treturn &DeviceQuery{config: c.config}\n}", "func (c *NurseClient) Query() *NurseQuery {\n\treturn &NurseQuery{config: c.config}\n}", "func (c *TransactionClient) Query() *TransactionQuery {\n\treturn &TransactionQuery{\n\t\tconfig: c.config,\n\t}\n}", "func (c *PatientInfoClient) Query() *PatientInfoQuery {\n\treturn &PatientInfoQuery{config: c.config}\n}", "func (c *EmployeeClient) Query() *EmployeeQuery {\n\treturn &EmployeeQuery{config: c.config}\n}", "func (c *EmployeeClient) Query() *EmployeeQuery {\n\treturn &EmployeeQuery{config: c.config}\n}", "func (c *EmployeeClient) Query() *EmployeeQuery {\n\treturn &EmployeeQuery{config: c.config}\n}", "func (c *FacultyClient) Query() *FacultyQuery {\n\treturn &FacultyQuery{config: c.config}\n}", "func (c *DNSBLQueryClient) Query() *DNSBLQueryQuery {\n\treturn &DNSBLQueryQuery{config: c.config}\n}", "func (c *UsertypeClient) Query() *UsertypeQuery {\n\treturn &UsertypeQuery{config: c.config}\n}", "func (c *EatinghistoryClient) Query() *EatinghistoryQuery {\n\treturn &EatinghistoryQuery{config: c.config}\n}", "func (c *UserStatusClient) Query() *UserStatusQuery {\n\treturn &UserStatusQuery{config: c.config}\n}", "func (c *PatientofphysicianClient) Query() *PatientofphysicianQuery {\n\treturn &PatientofphysicianQuery{config: c.config}\n}", "func (qs *Querier) QueryBuilder() *Query {\n\treturn &Query{\n\t\tPath: qs.DBPath,\n\t\t// range \"nil\" represents all time-series as querying\n\t\tRange: nil,\n\t\tType: qs.Type,\n\t}\n}", "func (c *DepartmentClient) Query() *DepartmentQuery {\n\treturn &DepartmentQuery{config: c.config}\n}", "func (c *DrugAllergyClient) Query() *DrugAllergyQuery {\n\treturn &DrugAllergyQuery{config: c.config}\n}", "func (c *BillClient) Query() *BillQuery {\n\treturn &BillQuery{config: c.config}\n}", "func (c *BillClient) Query() *BillQuery {\n\treturn &BillQuery{config: c.config}\n}", "func (c *BillClient) Query() *BillQuery {\n\treturn &BillQuery{config: c.config}\n}", "func (c *ToolClient) Query() *ToolQuery {\n\treturn &ToolQuery{config: c.config}\n}", "func (c *OrderClient) Query() *OrderQuery {\n\treturn &OrderQuery{config: c.config}\n}", "func (c *LeaseClient) Query() *LeaseQuery {\n\treturn &LeaseQuery{config: c.config}\n}", "func (dqlx *dqlx) Query(rootFn *FilterFn) QueryBuilder {\n\treturn Query(rootFn).WithDClient(dqlx.dgraph)\n}", "func (c *StatustClient) Query() *StatustQuery {\n\treturn &StatustQuery{config: c.config}\n}", "func (c *GenderClient) Query() *GenderQuery {\n\treturn &GenderQuery{config: c.config}\n}", "func (c *GenderClient) Query() *GenderQuery {\n\treturn &GenderQuery{config: c.config}\n}", "func Query() error {\n\tvar user TbUser\n\terr := orm.Where(\"name=$1\", \"viney\").Limit(1).Find(&user)\n\tif err == nil {\n\t\tfmt.Println(user)\n\t\treturn nil\n\t}\n\n\treturn err\n}", "func (c *AdminSessionClient) QueryUser(as *AdminSession) *AdminQuery {\n\tquery := &AdminQuery{config: c.config}\n\tquery.path = func(ctx context.Context) (fromV *sql.Selector, _ error) {\n\t\tid := as.ID\n\t\tstep := sqlgraph.NewStep(\n\t\t\tsqlgraph.From(adminsession.Table, adminsession.FieldID, id),\n\t\t\tsqlgraph.To(admin.Table, admin.FieldID),\n\t\t\tsqlgraph.Edge(sqlgraph.M2O, true, adminsession.UserTable, adminsession.UserColumn),\n\t\t)\n\t\tfromV = sqlgraph.Neighbors(as.driver.Dialect(), step)\n\t\treturn fromV, nil\n\t}\n\treturn query\n}", "func (c *UserWalletClient) Query() *UserWalletQuery {\n\treturn &UserWalletQuery{\n\t\tconfig: c.config,\n\t}\n}", "func (r *Resolver) Query() generated.QueryResolver { return &queryResolver{r} }", "func (r *Resolver) Query() generated.QueryResolver { return &queryResolver{r} }", "func (r *Resolver) Query() generated.QueryResolver { return &queryResolver{r} }", "func (r *Resolver) Query() generated.QueryResolver { return &queryResolver{r} }", "func (r *Resolver) Query() generated.QueryResolver { return &queryResolver{r} }" ]
[ "0.7559959", "0.6459468", "0.6456865", "0.64021826", "0.6368654", "0.63244516", "0.6275777", "0.6232993", "0.62189054", "0.62189054", "0.61560595", "0.6147474", "0.61452425", "0.6133651", "0.61314636", "0.6070209", "0.6067544", "0.605625", "0.60501856", "0.6020989", "0.6003855", "0.5992733", "0.5987622", "0.5987432", "0.59751374", "0.5953406", "0.5916662", "0.5916662", "0.5916662", "0.5916662", "0.5916662", "0.5916662", "0.5916662", "0.5916662", "0.59154516", "0.59154516", "0.59154516", "0.59137666", "0.59096444", "0.5885943", "0.58858216", "0.58638424", "0.5862393", "0.5859346", "0.5859346", "0.5845354", "0.5840693", "0.5828801", "0.58137447", "0.58137447", "0.58137447", "0.579303", "0.5789423", "0.57583725", "0.5757962", "0.5753339", "0.57383835", "0.57349336", "0.5724519", "0.5719848", "0.5706312", "0.5705981", "0.5704141", "0.57031375", "0.5698857", "0.56966203", "0.56908214", "0.56894934", "0.5684064", "0.5681435", "0.5680672", "0.5680672", "0.5680672", "0.56755996", "0.56697255", "0.56676626", "0.5667293", "0.5664177", "0.564975", "0.5647955", "0.56416243", "0.56314814", "0.5619135", "0.5619135", "0.5619135", "0.56168807", "0.56105036", "0.5597413", "0.55930966", "0.5587009", "0.558424", "0.558424", "0.5583534", "0.5575323", "0.5565081", "0.5561611", "0.5561611", "0.5561611", "0.5561611", "0.5561611" ]
0.7758577
0
Get returns a AdminSession entity by its id.
func (c *AdminSessionClient) Get(ctx context.Context, id int) (*AdminSession, error) { return c.Query().Where(adminsession.ID(id)).Only(ctx) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (c *AdminClient) Get(ctx context.Context, id int) (*Admin, error) {\n\treturn c.Query().Where(admin.ID(id)).Only(ctx)\n}", "func (c *SessionClient) Get(ctx context.Context, id int) (*Session, error) {\n\treturn c.Query().Where(session.ID(id)).Only(ctx)\n}", "func getAdmin(e echo.Context) error {\n\tdb := e.Get(\"database\").(*mgo.Database)\n\tif db == nil {\n\t\treturn fmt.Errorf(\"Bad database session\")\n\t}\n\n\tvar id bson.ObjectId\n\tif idParam := e.QueryParam(\"id\"); idParam != \"\" && bson.IsObjectIdHex(idParam) {\n\t\tid = bson.ObjectIdHex(idParam)\n\t}\n\tuuid, err := uuid.FromString(e.QueryParam(\"uuid\"))\n\tif !id.Valid() && err != nil {\n\t\treturn fmt.Errorf(\"Bad parameters\")\n\t}\n\n\ta := models.Admin{}\n\tif id.Valid() {\n\t\terr = db.C(\"Admins\").FindId(id).One(&a)\n\t} else {\n\t\terr = db.C(\"Admins\").Find(bson.M{\"adminUuid\": uuid}).One(&a)\n\t}\n\tif err != nil {\n\t\treturn e.NoContent(http.StatusNotFound)\n\t}\n\treturn e.JSON(http.StatusOK, a)\n}", "func (s *Store) Get(clientID string) (*entities.Session, error) {\n\ts.mu.Lock()\n\tdefer s.mu.Unlock()\n\treturn s.sess[clientID], nil\n}", "func GetAdmin(w http.ResponseWriter, r *http.Request) {\n\tid := chi.URLParam(r, \"id\")\n\n\tadm, ok := mustAuthority(r.Context()).LoadAdminByID(id)\n\tif !ok {\n\t\trender.Error(w, admin.NewError(admin.ErrorNotFoundType,\n\t\t\t\"admin %s not found\", id))\n\t\treturn\n\t}\n\trender.ProtoJSON(w, adm)\n}", "func Get() *discordgo.Session {\n\treturn &session\n}", "func (dao *UserDAO) Get(id uint) (*models.User, error) {\n\tvar user models.User\n\n\terr := config.Config.DB.Where(\"id = ?\", id).First(&user).Error\n\n\treturn &user, err\n}", "func (c *cache) Get(id string) (*Session, error) {\n\tc.Lock()\n\tdefer c.Unlock()\n\n\t// Do we have a cached session?\n\tsession, ok := c.sessions[id]\n\tif !ok {\n\t\t// Not cached. Query the persistence layer for a session.\n\t\tvar err error\n\t\tsession, err = Persistence.LoadSession(id)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tif session != nil {\n\t\t\t// Save it in the cache.\n\t\t\tif MaxSessionCacheSize != 0 {\n\t\t\t\tc.compact(1)\n\t\t\t\tc.sessions[id] = session\n\t\t\t}\n\n\t\t\t// Store ID.\n\t\t\tsession.Lock()\n\t\t\tsession.id = id\n\t\t\tsession.Unlock()\n\t\t}\n\t}\n\n\treturn session, nil\n}", "func (c *RoomuseClient) Get(ctx context.Context, id int) (*Roomuse, error) {\n\treturn c.Query().Where(roomuse.ID(id)).Only(ctx)\n}", "func (*adminCtrl) findSessionByID(c *elton.Context) (err error) {\n\tstore := cache.GetRedisSession()\n\tdata, err := store.Get(c.Param(\"id\"))\n\tif err != nil {\n\t\treturn\n\t}\n\tc.Body = &findSessionResp{\n\t\tData: string(data),\n\t}\n\treturn\n}", "func (s MockStore) Get(id int) (u User, err error) {\n\tu, ok := s.id[id]\n\tif !ok {\n\t\terr = errors.New(\"User not found in memory store.\")\n\t}\n\n\treturn u, err\n}", "func getSession(ctx context.Context, id string) (middleware.Session, error) {\n\tsessionUUID, err := uuid.FromString(id)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tsession, err := loader.Loader.GetSession(ctx, sessionUUID)\n\n\treturn Session{Row: session}, err\n}", "func (c *AdminSessionClient) GetX(ctx context.Context, id int) *AdminSession {\n\tobj, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn obj\n}", "func Get(ctx context.Context) *Session {\n\t// TODO maybe check this\n\treturn ctx.Value(sessionContextKey{}).(*Session)\n}", "func (sm *SessionManager) Get(w http.ResponseWriter, r *http.Request, log httpway.Logger) httpway.Session {\n\tsessionId := \"\"\n\n\tcook, err := r.Cookie(\"_s\")\n\tif err == nil {\n\t\tsessionId = cook.Value\n\t}\n\n\treturn sm.GetById(sessionId, w, r, log)\n}", "func (store *SessionSQL) GetByID(ctx context.Context, id string) (out Session, err error) {\n\tres, err := store.Get(ctx, WithSearchFilter(\"s.id = ?\", []interface{}{id}))\n\tif err != nil || len(res) == 0 {\n\t\treturn Session{}, err\n\t}\n\treturn res[0], nil\n}", "func (c *RoomdetailClient) Get(ctx context.Context, id int) (*Roomdetail, error) {\n\treturn c.Query().Where(roomdetail.ID(id)).Only(ctx)\n}", "func (service *AdminService) GetAdmin(requestedadmin *models.User) error {\n\tufw := repository.NewUnitOfWork(service.DB, true)\n\tvar authadmin models.User\n\terr := service.Repository.GetByField(ufw, requestedadmin.GetID(), \"id\", &authadmin, []string{})\n\tif (err != nil || authadmin.GetID() == uuid.UUID{}) {\n\t\treturn web.NewValidationError(\"user\", map[string]string{\"error\": \"Invalid User\"})\n\t}\n\n\t*requestedadmin = authadmin\n\treturn nil\n}", "func (s *SessionStore) GetByID(id string) (*Session, error) {\n\tsession := Session{\n\t\tID: id,\n\t\tstore: s,\n\t\tData: make(map[string]interface{})}\n\n\tok, err := s.provider.Get(id, &session.Data)\n\n\tif err != nil {\n\t\tlog.Println(err)\n\t\treturn nil, err\n\t}\n\n\tif !ok && s.autoCreateWhenMissing {\n\t\t// Session doesn't exist in memcache.\n\t\t// Generate a new ID (New session)\n\t\tsession.ID = generateSessionID()\n\t\tsession.Save()\n\t} else if !ok {\n\t\treturn nil, nil\n\t}\n\n\treturn &session, nil\n}", "func (c *PatientroomClient) Get(ctx context.Context, id int) (*Patientroom, error) {\n\treturn c.Query().Where(patientroom.ID(id)).Only(ctx)\n}", "func (c *Admin) Get(params cmap.CMap) (data Admin, err error) {\n\tcrud.Params(gt.Data(&data))\n\tif err = crud.Get(params).Error(); err != nil {\n\t\treturn\n\t}\n\treturn\n}", "func (d *MongoUserDao) Get(id int) (*s.User, error) {\n\tresult := []s.User{}\n\n\tsession := d.Session.Clone()\n\tdefer session.Close()\n\n\tcollection := session.DB(d.DatabaseName).C(collectionName)\n\terr := collection.Find(bson.M{\n\t\t\"_id\": id,\n\t}).All(&result)\n\tif err != nil {\n\t\tlogger.Logf(\"ERROR %s\", err)\n\t\treturn nil, err\n\t}\n\n\tif len(result) == 0 {\n\t\treturn nil, nil\n\t}\n\n\treturn &result[0], nil\n}", "func (c *DeviceClient) Get(ctx context.Context, id int) (*Device, error) {\n\treturn c.Query().Where(device.ID(id)).Only(ctx)\n}", "func (s *inMemorySessionStore) Get(id string) *USSDSession {\n\ts.lock.Lock()\n\tdefer s.lock.Unlock()\n\te := s.store[id]\n\tif e != nil {\n\t\ts.gcList.MoveToFront(e)\n\t\tif session, ok := e.Value.(*USSDSession); ok {\n\t\t\treturn session\n\t\t} else {\n\t\t\tpanic(\"Data Store corrupted: non-string key value in garbage collector\")\n\t\t\treturn nil\n\t\t}\n\t}\n\treturn nil\n}", "func (c *UserClient) Get(ctx context.Context, id int64) (*User, error) {\n\treturn c.Query().Where(user.ID(id)).Only(ctx)\n}", "func (c *UserClient) Get(ctx context.Context, id int) (*User, error) {\n\treturn c.Query().Where(user.ID(id)).Only(ctx)\n}", "func (c *UserClient) Get(ctx context.Context, id int) (*User, error) {\n\treturn c.Query().Where(user.ID(id)).Only(ctx)\n}", "func (c *UserClient) Get(ctx context.Context, id int) (*User, error) {\n\treturn c.Query().Where(user.ID(id)).Only(ctx)\n}", "func (c *UserClient) Get(ctx context.Context, id int) (*User, error) {\n\treturn c.Query().Where(user.ID(id)).Only(ctx)\n}", "func (c *UserClient) Get(ctx context.Context, id int) (*User, error) {\n\treturn c.Query().Where(user.ID(id)).Only(ctx)\n}", "func (c *UserClient) Get(ctx context.Context, id int) (*User, error) {\n\treturn c.Query().Where(user.ID(id)).Only(ctx)\n}", "func (c *UserClient) Get(ctx context.Context, id int) (*User, error) {\n\treturn c.Query().Where(user.ID(id)).Only(ctx)\n}", "func (c *UserClient) Get(ctx context.Context, id int) (*User, error) {\n\treturn c.Query().Where(user.ID(id)).Only(ctx)\n}", "func Get(c echo.Context) (*sessions.Session, error) {\n\tsess, err := session.Get(sessionStr, c)\n\treturn sess, err\n}", "func (c *RoomClient) Get(ctx context.Context, id int) (*Room, error) {\n\treturn c.Query().Where(room.ID(id)).Only(ctx)\n}", "func (c *RoomClient) Get(ctx context.Context, id int) (*Room, error) {\n\treturn c.Query().Where(room.ID(id)).Only(ctx)\n}", "func (c *UserClient) Get(ctx context.Context, id uuid.UUID) (*User, error) {\n\treturn c.Query().Where(user.ID(id)).Only(ctx)\n}", "func (c *UserClient) Get(ctx context.Context, id uuid.UUID) (*User, error) {\n\treturn c.Query().Where(user.ID(id)).Only(ctx)\n}", "func (dao *UserDAO) Get(id uint) (*models.User, error) {\n\tvar user models.User\n\n\t// Query Database here...\n\n\t//user = models.User{\n\t//\tModel: models.Model{ID: 1},\n\t//\tFirstName: \"Martin\",\n\t//\tLastName: \"Heinz\",\n\t//\tAddress: \"Not gonna tell you\",\n\t//\tEmail: \"[email protected]\"}\n\n\t// if using Gorm:\n\terr := config.Config.DB.Where(\"id = ?\", id).\n\t\tFirst(&user).\n\t\tError\n\n\treturn &user, err\n}", "func (t *Tenants) Get(id string) (*Tenant, error) {\n\tvalue, err := t.store.Get(id)\n\tif err != nil {\n\t\treturn &Tenant{}, err\n\t}\n\tr := bytes.NewReader([]byte(value))\n\treturn Decode(r)\n}", "func (c *Client) Get(ctx context.Context, id string) (*ngrok.TunnelSession, error) {\n\targ := &ngrok.Item{ID: id}\n\n\tvar res ngrok.TunnelSession\n\tvar path bytes.Buffer\n\tif err := template.Must(template.New(\"get_path\").Parse(\"/tunnel_sessions/{{ .ID }}\")).Execute(&path, arg); err != nil {\n\t\tpanic(err)\n\t}\n\targ.ID = \"\"\n\tvar (\n\t\tapiURL = &url.URL{Path: path.String()}\n\t\tbodyArg interface{}\n\t)\n\tapiURL.Path = path.String()\n\n\tif err := c.apiClient.Do(ctx, \"GET\", apiURL, bodyArg, &res); err != nil {\n\t\treturn nil, err\n\t}\n\treturn &res, nil\n}", "func (m *EntityManager) Get(id string) (entity *Entity) {\n\tfor _, e := range m.entities {\n\t\tif e.ID() == id {\n\t\t\treturn e\n\t\t}\n\t}\n\treturn\n}", "func (c *PharmacistClient) Get(ctx context.Context, id int) (*Pharmacist, error) {\n\treturn c.Query().Where(pharmacist.ID(id)).Only(ctx)\n}", "func (u DomainDao) Get(id int) model.Domain {\n\tvar domain model.Domain\n\tdb := GetDb()\n\tdb.Where(\"id = ?\", id).First(&domain)\n\treturn domain\n}", "func (s *Sessions) Get(r *http.Request) (*Session, error) {\n\n\t// Getting SessID from cookie\n\tcookie, err := r.Cookie(cfg.SessionIDKey)\n\tif err != nil {\n\t\treturn nil, errNoSessionID\n\t}\n\tsessionID := cookie.Value\n\n\t// Make it atomic\n\ts.RLock()\n\tdefer s.RUnlock()\n\n\t// Check for session exist\n\tsess, ok := s.sessions[sessionID]\n\tif !ok {\n\t\treturn nil, errNoSessionWithID\n\t}\n\n\t// Check session IP and client IP if StrictIP on\n\tif cfg.StrictIP {\n\t\tif sess.IP != strings.Split(r.RemoteAddr, \":\")[0] {\n\t\t\treturn nil, errIP\n\t\t}\n\t}\n\n\treturn deepcopy.Iface(&sess).(*Session), nil\n}", "func (m *SessionManager) Get(key string) (session Session) {\n\tstmt := Sessions.Select().Where(Sessions.C(\"key\").Equals(key))\n\tm.conn.Query(stmt, &session)\n\treturn\n}", "func (c *ExaminationroomClient) Get(ctx context.Context, id int) (*Examinationroom, error) {\n\treturn c.Query().Where(examinationroom.ID(id)).Only(ctx)\n}", "func (m *MemoryCache) Get(id string) (*Session, error) {\n\tm.mx.RLock()\n\ts, ok := m.store[id]\n\tif !ok {\n\t\tm.mx.RUnlock()\n\t\treturn nil, ErrNotFound\n\t}\n\tif !s.Valid() {\n\t\t// We have to upgrade the lock. There's no harm in a yield between.\n\t\tm.mx.RUnlock()\n\t\tm.mx.Lock()\n\t\tdelete(m.store, id)\n\t\tm.mx.Unlock()\n\t\treturn nil, ErrExpired\n\t}\n\tm.mx.RUnlock()\n\treturn s, nil\n}", "func (c *OperativeClient) Get(ctx context.Context, id int) (*Operative, error) {\n\treturn c.Query().Where(operative.ID(id)).Only(ctx)\n}", "func (m *manager) Get(ctx context.Context, id int) (*models.User, error) {\n\tusers, err := m.dao.List(ctx, q.New(q.KeyWords{\"user_id\": id}))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tif len(users) == 0 {\n\t\treturn nil, errors.NotFoundError(nil).WithMessage(\"user %d not found\", id)\n\t}\n\n\treturn users[0], nil\n}", "func (c *FoodmenuClient) Get(ctx context.Context, id int) (*Foodmenu, error) {\n\treturn c.Query().Where(foodmenu.ID(id)).Only(ctx)\n}", "func (r *SmscSessionRepository) FindById(ID string) (*openapi.SmscSession, error) {\n\tentity := openapi.NewSmscSessionWithDefaults()\n\terr := app.BuntDBInMemory.View(func(tx *buntdb.Tx) error {\n\t\tvalue, err := tx.Get(SMSC_SESSION_PREFIX + ID)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif err := json.Unmarshal([]byte(value), entity); err != nil {\n\t\t\treturn err\n\t\t}\n\t\treturn nil\n\t})\n\treturn entity, err\n}", "func (e *Store) Get(id string) *Config {\n\te.RLock()\n\tres := e.commands[id]\n\te.RUnlock()\n\treturn res\n}", "func (u *User) Get(id string) error {\n\tsession := mongoSession.Clone()\n\tdefer session.Close()\n\tcollection := session.DB(mongoDialInfo.Database).C(usersCollectionName)\n\t// TODO: handle error\n\tif !bson.IsObjectIdHex(id) {\n\t\treturn errors.New(\"Invalid Object ID\")\n\t}\n\tobjectID := bson.ObjectIdHex(id)\n\terr := collection.FindId(objectID).One(u)\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "func (c *PhysicianClient) Get(ctx context.Context, id int) (*Physician, error) {\n\treturn c.Query().Where(physician.ID(id)).Only(ctx)\n}", "func (c *PhysicianClient) Get(ctx context.Context, id int) (*Physician, error) {\n\treturn c.Query().Where(physician.ID(id)).Only(ctx)\n}", "func (m *defaultEntityManager) Get(id string) (entity *Entity) {\n\tfor _, e := range m.entities {\n\t\tif e.ID() == id {\n\t\t\treturn e\n\t\t}\n\t}\n\treturn\n}", "func (dba *DBAccess) GetSessionByID(id string) (*model.Session, error) {\n\n\tc := dba.Session.DB(\"athenadb\").C(\"session\")\n\tvar result model.Session\n\n\tbsonID := bson.ObjectIdHex(id)\n\n\tif err := c.Find(bson.M{\"_id\": bsonID}).One(&result); err == nil {\n\t\treturn &result, nil\n\t} else {\n\t\treturn nil, err\n\t}\n}", "func Get(id int64) (User, error) {\n\tvar u User\n\tstmt, err := db.Prepare(\"select id, name, age, created from user where id = ? \")\n\tdefer stmt.Close()\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t\treturn u, err\n\t}\n\terr = stmt.QueryRow(id).Scan(&u.ID, &u.Name, &u.Age, &u.Created)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t\treturn u, err\n\t}\n\treturn u, nil\n}", "func (u *UserDAO) Get(id int) User {\n\tstmt, err := db.Instance().Prepare(\"select uid, username, password from userinfo where uid=$1\")\n\tdb.CheckErr(err)\n\n\trows, err := stmt.Query(id)\n\n\tvar usr User\n\tfor rows.Next() {\n\t\tvar uid int\n\t\tvar username string\n\t\tvar password string\n\t\terr = rows.Scan(&uid, &username, &password)\n\t\tdb.CheckErr(err)\n\t\tusr.Id = uid\n\t\tusr.Name = username\n\t\tusr.Pwd = password\n\t}\n\n\treturn usr\n}", "func (s *AdmAccountStore) Get(id int) (*pwdless.Account, error) {\n\ta := pwdless.Account{ID: id}\n\terr := s.db.Select(&a)\n\treturn &a, err\n}", "func (s *DatastoreStore) Get(r *http.Request, name string) (*sessions.Session,\n\terror) {\n\treturn sessions.GetRegistry(r).Get(s, name)\n}", "func (c *CleaningroomClient) Get(ctx context.Context, id int) (*Cleaningroom, error) {\n\treturn c.Query().Where(cleaningroom.ID(id)).Only(ctx)\n}", "func (c *DentistClient) Get(ctx context.Context, id int) (*Dentist, error) {\n\treturn c.Query().Where(dentist.ID(id)).Only(ctx)\n}", "func (s *rpcServer) GetAdmin(ctx context.Context, req *api.GetAdminRequest) (*api.GetAdminResponse, error) {\n\tadmin, err := admin.ByID(req.AdminId)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &api.GetAdminResponse{\n\t\tAdmin: &api.Admin{\n\t\t\tId: admin.ID,\n\t\t\tName: admin.Name,\n\t\t\tEmail: admin.Email,\n\t\t\tACL: admin.ACL,\n\t\t},\n\t}, nil\n}", "func (c *PatientClient) Get(ctx context.Context, id int) (*Patient, error) {\n\treturn c.Query().Where(patient.ID(id)).Only(ctx)\n}", "func (c *PatientClient) Get(ctx context.Context, id int) (*Patient, error) {\n\treturn c.Query().Where(patient.ID(id)).Only(ctx)\n}", "func (c *PatientClient) Get(ctx context.Context, id int) (*Patient, error) {\n\treturn c.Query().Where(patient.ID(id)).Only(ctx)\n}", "func (c *MedicineClient) Get(ctx context.Context, id int) (*Medicine, error) {\n\treturn c.Query().Where(medicine.ID(id)).Only(ctx)\n}", "func (us *Users) Get(id int64) (*User, error) {\n\texp := fmt.Sprintf(\"user_id=%v\", id)\n\n\treturn getUserWhere(exp)\n}", "func (c *StatusdClient) Get(ctx context.Context, id int) (*Statusd, error) {\n\treturn c.Query().Where(statusd.ID(id)).Only(ctx)\n}", "func (c *LevelOfDangerousClient) Get(ctx context.Context, id int) (*LevelOfDangerous, error) {\n\treturn c.Query().Where(levelofdangerous.ID(id)).Only(ctx)\n}", "func (c *DispenseMedicineClient) Get(ctx context.Context, id int) (*DispenseMedicine, error) {\n\treturn c.Query().Where(dispensemedicine.ID(id)).Only(ctx)\n}", "func (manager *Manager) GetSession(id string) *Player {\n\t// lock for read\n\tmanager.lock.RLock()\n\tdefer manager.lock.RUnlock()\n\n\tplayer, ok := manager.sessions[id]\n\tif !ok {\n\t\treturn nil\n\t}\n\treturn player\n}", "func (store *KapacitorStore) Get(ctx context.Context, id int) (chronograf.Server, error) {\n\tif store.Kapacitor == nil || store.Kapacitor.ID != id {\n\t\treturn chronograf.Server{}, fmt.Errorf(\"unable to find Kapacitor with id %d\", id)\n\t}\n\treturn *store.Kapacitor, nil\n}", "func (o *Organization) Get(id int64) error {\n\tdb, err := sqlx.Connect(settings.Settings.Database.DriverName, settings.Settings.GetDbConn())\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\tdefer db.Close()\n\n\terr = db.Get(&o, \"SELECT * FROM organization WHERE id=$1\", id)\n\tif err == sql.ErrNoRows {\n\t\treturn ErrOrganizationNotFound\n\t} else if err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "func (s MyEntityManager) Get(id uint64) ecs.Entity {\n\treturn *s.items[id].entity\n}", "func (h *WebDriverHub) GetSession(id string) *WebDriverSession {\n\th.mu.RLock()\n\tdefer h.mu.RUnlock()\n\treturn h.sessions[id]\n}", "func (m *Manager) Get(id string) (*Organization, error) {\n\tvar organization Organization\n\n\tobjectID := bson.ObjectIdHex(id)\n\n\tif err := m.collection.FindId(objectID).One(&organization); err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn &organization, nil\n}", "func (c *EmployeeClient) Get(ctx context.Context, id int) (*Employee, error) {\n\treturn c.Query().Where(employee.ID(id)).Only(ctx)\n}", "func (c *EmployeeClient) Get(ctx context.Context, id int) (*Employee, error) {\n\treturn c.Query().Where(employee.ID(id)).Only(ctx)\n}", "func (c *EmployeeClient) Get(ctx context.Context, id int) (*Employee, error) {\n\treturn c.Query().Where(employee.ID(id)).Only(ctx)\n}", "func (c *DoctorClient) Get(ctx context.Context, id int) (*Doctor, error) {\n\treturn c.Query().Where(doctor.ID(id)).Only(ctx)\n}", "func (c *SymptomClient) Get(ctx context.Context, id int) (*Symptom, error) {\n\treturn c.Query().Where(symptom.ID(id)).Only(ctx)\n}", "func getAdminByID(oid primitive.ObjectID) *mongo.SingleResult {\n\treturn adminCollection.FindOne(context.TODO(), bson.M{\n\t\t\"_id\": oid,\n\t})\n}", "func (c *StatustClient) Get(ctx context.Context, id int) (*Statust, error) {\n\treturn c.Query().Where(statust.ID(id)).Only(ctx)\n}", "func (s Sessions) Get(userID string) (*session.Session, error) {\n\tdefer s.Log.Emit(sinks.Info(\"Get Existing Session\").WithFields(sink.Fields{\n\t\t\"user_id\": userID,\n\t}).Trace(\"Sessions.Get\").End())\n\n\tvar existingSession session.Session\n\n\t// Attempt to retrieve session from db if we still have an outstanding non-expired session.\n\tif err := s.DB.Get(s.TableIdentity, &existingSession, session.UniqueIndex, userID); err != nil {\n\t\ts.Log.Emit(sinks.Error(\"Failed to retrieve session from db: %+q\", err).WithFields(sink.Fields{\"user_id\": userID}))\n\t\treturn nil, err\n\t}\n\n\treturn &existingSession, nil\n}", "func (s *DgraphStore) Get(r *http.Request, name string) (*sessions.Session, error) {\n\treturn sessions.GetRegistry(r).Get(s, name)\n}", "func (r *Role) Get(transaction *DbTransaction, id int64) (bool, error) {\n\treturn isFound(GetDB(transaction).Where(\"id = ?\", id).First(r))\n}", "func (u *userService) Get(id string) (*domain.User, error) {\n\treturn u.storage.Get(id)\n}", "func (m *MemoryRoomStorage) Get(id int) (rooms.Room, error) {\n\tvar room rooms.Room\n\n\tfor _, r := range m.rooms {\n\t\tif r.ID == id {\n\t\t\treturn r, nil\n\t\t}\n\t}\n\n\treturn room, rooms.ErrNotFound\n}", "func (u *User) GetById(id interface{}) error {\n\tif err := DB().Where(\"id = ?\", id).First(&u).Error; err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "func (c *ModuleClient) Get(ctx context.Context, id int) (*Module, error) {\n\treturn c.Query().Where(module.ID(id)).Only(ctx)\n}", "func (m *Session) Get(ctx context.Context, req *proto.SessionRequest, rsp *proto.SessionResponse) error {\n\ts, err := service.GetSession(&model.Account{\n\t\tUsername: req.Account,\n\t\tPassword: req.Password,\n\t})\n\tif err != nil {\n\t\tlog.Println(err)\n\t\treturn err\n\t}\n\trsp.Account = s.GetInsta().Account.Username\n\treturn nil\n}", "func (c *UnitOfMedicineClient) Get(ctx context.Context, id int) (*UnitOfMedicine, error) {\n\treturn c.Query().Where(unitofmedicine.ID(id)).Only(ctx)\n}", "func GetSessionByID(id int64) (session Session, err error) {\n\terr = database.DB.QueryRow(`SELECT id, uuid, fname, lname, email, usr_id, created_at FROM sessions \n\t\tWHERE id = ?`, id).Scan(&session.ID, &session.UUID, &session.FName, &session.LName, &session.Email,\n\t\t&session.UserID, &session.Created)\n\tif err != nil {\n\t\tlog.Println(\"Get session by id query failed\", err)\n\t\treturn\n\t}else {\n\t\tlog.Println(\"Session retrieved by id successfully\")\n\t}\n\treturn\n}", "func (s Store) Get(id []byte) (perm.AccessControl, error) {\n\treturn accessControl{}, nil\n}", "func (srv *server) Session(id string) Session {\n\tsrv.mu.Lock()\n\tdefer srv.mu.Unlock()\n\n\treturn srv.s[id]\n}", "func (this *DBDao) GetSession() *Session {\n\treturn this.Engine.NewSession()\n}", "func (c *OperativerecordClient) Get(ctx context.Context, id int) (*Operativerecord, error) {\n\treturn c.Query().Where(operativerecord.ID(id)).Only(ctx)\n}" ]
[ "0.73146147", "0.7118918", "0.63738644", "0.60855037", "0.6034582", "0.6023528", "0.6008974", "0.59900236", "0.59848386", "0.5866095", "0.5850457", "0.58478045", "0.5818412", "0.580949", "0.5806461", "0.57847893", "0.57846856", "0.57784504", "0.5729701", "0.5720089", "0.5718466", "0.5673864", "0.56639487", "0.5656941", "0.5646251", "0.56342906", "0.56342906", "0.56342906", "0.56342906", "0.56342906", "0.56342906", "0.56342906", "0.56342906", "0.5632768", "0.56307995", "0.56307995", "0.5612422", "0.5612422", "0.56083465", "0.5604972", "0.5604769", "0.5599775", "0.5591109", "0.55785346", "0.5542048", "0.55393744", "0.55379444", "0.55362344", "0.5532329", "0.55316937", "0.55035317", "0.54970664", "0.5490751", "0.54864454", "0.5480275", "0.5480275", "0.54724854", "0.5471295", "0.5460446", "0.5459766", "0.5450008", "0.5434091", "0.54219747", "0.5374718", "0.53624374", "0.5362028", "0.5362028", "0.5362028", "0.5360626", "0.53601795", "0.53601664", "0.53569764", "0.5339179", "0.532885", "0.5327902", "0.53236413", "0.5322736", "0.53217715", "0.53188735", "0.5309674", "0.5309674", "0.5309674", "0.5306551", "0.5297783", "0.529693", "0.5283903", "0.52782834", "0.52762324", "0.5273682", "0.5260656", "0.52581", "0.5255552", "0.525275", "0.52493906", "0.5247604", "0.52463603", "0.52385235", "0.5231175", "0.5225286", "0.5222107" ]
0.84693193
0
GetX is like Get, but panics if an error occurs.
func (c *AdminSessionClient) GetX(ctx context.Context, id int) *AdminSession { obj, err := c.Get(ctx, id) if err != nil { panic(err) } return obj }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (c *StatustClient) GetX(ctx context.Context, id int) *Statust {\n\ts, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn s\n}", "func (c *OperativeClient) GetX(ctx context.Context, id int) *Operative {\n\to, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn o\n}", "func (c *StaytypeClient) GetX(ctx context.Context, id int) *Staytype {\n\ts, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn s\n}", "func (c *LevelOfDangerousClient) GetX(ctx context.Context, id int) *LevelOfDangerous {\n\tlod, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn lod\n}", "func (c *DentistClient) GetX(ctx context.Context, id int) *Dentist {\n\td, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn d\n}", "func (c *ToolClient) GetX(ctx context.Context, id int) *Tool {\n\tt, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn t\n}", "func (c *IPClient) GetX(ctx context.Context, id uuid.UUID) *IP {\n\tobj, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn obj\n}", "func (c *BeerClient) GetX(ctx context.Context, id int) *Beer {\n\tobj, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn obj\n}", "func (c *PhysicianClient) GetX(ctx context.Context, id int) *Physician {\n\tph, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn ph\n}", "func (c *PhysicianClient) GetX(ctx context.Context, id int) *Physician {\n\tph, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn ph\n}", "func (c *PharmacistClient) GetX(ctx context.Context, id int) *Pharmacist {\n\tph, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn ph\n}", "func (c *EmptyClient) GetX(ctx context.Context, id int) *Empty {\n\tobj, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn obj\n}", "func (c *OperationClient) GetX(ctx context.Context, id uuid.UUID) *Operation {\n\tobj, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn obj\n}", "func (c *NurseClient) GetX(ctx context.Context, id int) *Nurse {\n\tn, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn n\n}", "func (c *PatientInfoClient) GetX(ctx context.Context, id int) *PatientInfo {\n\tpi, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn pi\n}", "func (c *ClinicClient) GetX(ctx context.Context, id uuid.UUID) *Clinic {\n\tobj, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn obj\n}", "func (c *LeaseClient) GetX(ctx context.Context, id int) *Lease {\n\tl, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn l\n}", "func (c *ModuleVersionClient) GetX(ctx context.Context, id int) *ModuleVersion {\n\tmv, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn mv\n}", "func (c *PetruleClient) GetX(ctx context.Context, id int) *Petrule {\n\tpe, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn pe\n}", "func (c *KeyStoreClient) GetX(ctx context.Context, id int32) *KeyStore {\n\tobj, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn obj\n}", "func (c *SituationClient) GetX(ctx context.Context, id int) *Situation {\n\ts, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn s\n}", "func (c *RepairinvoiceClient) GetX(ctx context.Context, id int) *Repairinvoice {\n\tr, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn r\n}", "func (c *MedicineClient) GetX(ctx context.Context, id int) *Medicine {\n\tm, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn m\n}", "func (c *BillClient) GetX(ctx context.Context, id int) *Bill {\n\tb, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn b\n}", "func (c *BillClient) GetX(ctx context.Context, id int) *Bill {\n\tb, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn b\n}", "func (c *BillClient) GetX(ctx context.Context, id int) *Bill {\n\tb, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn b\n}", "func (c *OperativerecordClient) GetX(ctx context.Context, id int) *Operativerecord {\n\to, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn o\n}", "func (c *ReturninvoiceClient) GetX(ctx context.Context, id int) *Returninvoice {\n\tr, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn r\n}", "func (c *CleanernameClient) GetX(ctx context.Context, id int) *Cleanername {\n\tcl, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn cl\n}", "func (c *AdminClient) GetX(ctx context.Context, id int) *Admin {\n\tobj, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn obj\n}", "func (c *RepairInvoiceClient) GetX(ctx context.Context, id int) *RepairInvoice {\n\tri, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn ri\n}", "func (c *ComplaintClient) GetX(ctx context.Context, id int) *Complaint {\n\tco, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn co\n}", "func (c *DNSBLQueryClient) GetX(ctx context.Context, id uuid.UUID) *DNSBLQuery {\n\tobj, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn obj\n}", "func (c *ModuleClient) GetX(ctx context.Context, id int) *Module {\n\tm, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn m\n}", "func (c *MedicineTypeClient) GetX(ctx context.Context, id int) *MedicineType {\n\tmt, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn mt\n}", "func (c *BuildingClient) GetX(ctx context.Context, id int) *Building {\n\tb, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn b\n}", "func (c *DeviceClient) GetX(ctx context.Context, id int) *Device {\n\td, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn d\n}", "func (c *PatientClient) GetX(ctx context.Context, id int) *Patient {\n\tpa, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn pa\n}", "func (c *PatientClient) GetX(ctx context.Context, id int) *Patient {\n\tpa, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn pa\n}", "func (c *PatientClient) GetX(ctx context.Context, id int) *Patient {\n\tpa, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn pa\n}", "func (c *RoomuseClient) GetX(ctx context.Context, id int) *Roomuse {\n\tr, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn r\n}", "func (c *UserClient) GetX(ctx context.Context, id int) *User {\n\tu, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn u\n}", "func (c *UserClient) GetX(ctx context.Context, id int) *User {\n\tu, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn u\n}", "func (c *UserClient) GetX(ctx context.Context, id int) *User {\n\tu, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn u\n}", "func (c *UserClient) GetX(ctx context.Context, id int) *User {\n\tu, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn u\n}", "func (c *UserClient) GetX(ctx context.Context, id int) *User {\n\tu, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn u\n}", "func (c *UserClient) GetX(ctx context.Context, id int) *User {\n\tu, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn u\n}", "func (c *StatusdClient) GetX(ctx context.Context, id int) *Statusd {\n\ts, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn s\n}", "func (c *UserClient) GetX(ctx context.Context, id int64) *User {\n\tobj, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn obj\n}", "func (c *PlanetClient) GetX(ctx context.Context, id int) *Planet {\n\tpl, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn pl\n}", "func (c *TransactionClient) GetX(ctx context.Context, id int32) *Transaction {\n\tobj, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn obj\n}", "func (c *PurposeClient) GetX(ctx context.Context, id int) *Purpose {\n\tpu, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn pu\n}", "func (c *LengthtimeClient) GetX(ctx context.Context, id int) *Lengthtime {\n\tl, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn l\n}", "func (c *VeterinarianClient) GetX(ctx context.Context, id uuid.UUID) *Veterinarian {\n\tobj, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn obj\n}", "func (c *UserClient) GetX(ctx context.Context, id int) *User {\n\tobj, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn obj\n}", "func (c *UserClient) GetX(ctx context.Context, id int) *User {\n\tobj, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn obj\n}", "func (c *UsertypeClient) GetX(ctx context.Context, id int) *Usertype {\n\tu, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn u\n}", "func (c *PrescriptionClient) GetX(ctx context.Context, id int) *Prescription {\n\tpr, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn pr\n}", "func (c *PaymentClient) GetX(ctx context.Context, id int) *Payment {\n\tpa, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn pa\n}", "func (c *PaymentClient) GetX(ctx context.Context, id int) *Payment {\n\tpa, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn pa\n}", "func (c *WorkExperienceClient) GetX(ctx context.Context, id int) *WorkExperience {\n\tobj, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn obj\n}", "func (c *DNSBLResponseClient) GetX(ctx context.Context, id uuid.UUID) *DNSBLResponse {\n\tobj, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn obj\n}", "func (c *UserClient) GetX(ctx context.Context, id uuid.UUID) *User {\n\tobj, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn obj\n}", "func (c *UserClient) GetX(ctx context.Context, id uuid.UUID) *User {\n\tobj, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn obj\n}", "func (c *OperationroomClient) GetX(ctx context.Context, id int) *Operationroom {\n\to, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn o\n}", "func (c *CleaningroomClient) GetX(ctx context.Context, id int) *Cleaningroom {\n\tcl, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn cl\n}", "func (c *PatientofphysicianClient) GetX(ctx context.Context, id int) *Patientofphysician {\n\tpa, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn pa\n}", "func (c *PositionInPharmacistClient) GetX(ctx context.Context, id int) *PositionInPharmacist {\n\tpip, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn pip\n}", "func (c *DoctorClient) GetX(ctx context.Context, id int) *Doctor {\n\td, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn d\n}", "func (c *StatusRClient) GetX(ctx context.Context, id int) *StatusR {\n\ts, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn s\n}", "func (c *SymptomClient) GetX(ctx context.Context, id int) *Symptom {\n\ts, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn s\n}", "func (c *TagClient) GetX(ctx context.Context, id int) *Tag {\n\tobj, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn obj\n}", "func (c *CoinInfoClient) GetX(ctx context.Context, id int32) *CoinInfo {\n\tobj, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn obj\n}", "func (c *WifiClient) GetX(ctx context.Context, id int) *Wifi {\n\tw, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn w\n}", "func (c *UnitOfMedicineClient) GetX(ctx context.Context, id int) *UnitOfMedicine {\n\tuom, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn uom\n}", "func (c *EmployeeClient) GetX(ctx context.Context, id int) *Employee {\n\te, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn e\n}", "func (c *EmployeeClient) GetX(ctx context.Context, id int) *Employee {\n\te, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn e\n}", "func (c *EmployeeClient) GetX(ctx context.Context, id int) *Employee {\n\te, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn e\n}", "func (c *YearClient) GetX(ctx context.Context, id int) *Year {\n\ty, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn y\n}", "func (x *V) Get(params ...interface{}) (*V, error) {\n\tif false == x.initialized {\n\t\treturn nil, errNotInitialized\n\t}\n\tif 0 == len(params) {\n\t\treturn nil, errNilParameter\n\t}\n\treturn x.getOrCreate(false, params...)\n}", "func (c *OrderClient) GetX(ctx context.Context, id int) *Order {\n\to, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn o\n}", "func (c *FoodmenuClient) GetX(ctx context.Context, id int) *Foodmenu {\n\tf, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn f\n}", "func (c *DispenseMedicineClient) GetX(ctx context.Context, id int) *DispenseMedicine {\n\tdm, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn dm\n}", "func (c *SkillClient) GetX(ctx context.Context, id int) *Skill {\n\tobj, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn obj\n}", "func (c *TitleClient) GetX(ctx context.Context, id int) *Title {\n\tt, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn t\n}", "func Get(ctx *grumble.Context) error {\n\tclient, execCtx, cancel := newClientAndCtx(ctx, 5*time.Second)\n\tdefer cancel()\n\tval, err := client.Get(execCtx, &ldProto.Key{Key: ctx.Args.String(\"key\")})\n\tif err != nil || val.Key == \"\" {\n\t\treturn err\n\t}\n\treturn exec(ctx, handleKeyValueReturned(val))\n}", "func (c *CustomerClient) GetX(ctx context.Context, id uuid.UUID) *Customer {\n\tobj, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn obj\n}", "func (_HelloWorld *HelloWorldCaller) Get(opts *bind.CallOpts) (string, error) {\n\tvar (\n\t\tret0 = new(string)\n\t)\n\tout := ret0\n\terr := _HelloWorld.contract.Call(opts, out, \"get\")\n\treturn *ret0, err\n}", "func (c *PostClient) GetX(ctx context.Context, id int) *Post {\n\tobj, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn obj\n}", "func (c *BillingstatusClient) GetX(ctx context.Context, id int) *Billingstatus {\n\tb, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn b\n}", "func (c *RentalstatusClient) GetX(ctx context.Context, id int) *Rentalstatus {\n\tr, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn r\n}", "func (c *UserWalletClient) GetX(ctx context.Context, id int64) *UserWallet {\n\tobj, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn obj\n}", "func (c *SessionClient) GetX(ctx context.Context, id int) *Session {\n\ts, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn s\n}", "func (c *ReviewClient) GetX(ctx context.Context, id int32) *Review {\n\tobj, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn obj\n}", "func (c *BookingClient) GetX(ctx context.Context, id int) *Booking {\n\tb, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn b\n}", "func (c *RoomdetailClient) GetX(ctx context.Context, id int) *Roomdetail {\n\tr, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn r\n}", "func (c *EventClient) GetX(ctx context.Context, id int) *Event {\n\tobj, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn obj\n}", "func (c *PositionassingmentClient) GetX(ctx context.Context, id int) *Positionassingment {\n\tpo, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn po\n}", "func (c *PatientroomClient) GetX(ctx context.Context, id int) *Patientroom {\n\tpa, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn pa\n}", "func (c *PetClient) GetX(ctx context.Context, id uuid.UUID) *Pet {\n\tobj, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn obj\n}", "func (c *CompanyClient) GetX(ctx context.Context, id int) *Company {\n\tobj, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn obj\n}" ]
[ "0.6648088", "0.66232616", "0.6614234", "0.65871096", "0.65850157", "0.65770745", "0.65643096", "0.6542851", "0.65330243", "0.65330243", "0.65308136", "0.650719", "0.6504791", "0.6490283", "0.646992", "0.6468367", "0.64682376", "0.64650553", "0.6458181", "0.6422355", "0.63974655", "0.6378646", "0.6378526", "0.6364793", "0.6364793", "0.6364793", "0.6363413", "0.6343908", "0.6337061", "0.6314544", "0.6314414", "0.6313774", "0.6306085", "0.6301973", "0.62907875", "0.6286949", "0.62817043", "0.62810564", "0.62810564", "0.62810564", "0.6278438", "0.6277063", "0.6277063", "0.6277063", "0.6277063", "0.6277063", "0.6277063", "0.6259341", "0.62574685", "0.624377", "0.6243153", "0.62430567", "0.62414294", "0.624061", "0.62399554", "0.62399554", "0.62374806", "0.62366956", "0.62356126", "0.62356126", "0.6230102", "0.6222115", "0.62028795", "0.62028795", "0.62019604", "0.6201459", "0.6201417", "0.6201218", "0.6197682", "0.6193074", "0.6190794", "0.61871403", "0.6174177", "0.6164113", "0.6163691", "0.6160635", "0.6160635", "0.6160635", "0.6154522", "0.6145612", "0.61301714", "0.61289114", "0.61262417", "0.61218536", "0.6111986", "0.609726", "0.60963184", "0.6083303", "0.60821086", "0.6075694", "0.60629153", "0.6046808", "0.60413235", "0.60396445", "0.60389733", "0.6034747", "0.601842", "0.60099", "0.60064715", "0.60018194", "0.5997112" ]
0.0
-1
QueryUser queries the user edge of a AdminSession.
func (c *AdminSessionClient) QueryUser(as *AdminSession) *AdminQuery { query := &AdminQuery{config: c.config} query.path = func(ctx context.Context) (fromV *sql.Selector, _ error) { id := as.ID step := sqlgraph.NewStep( sqlgraph.From(adminsession.Table, adminsession.FieldID, id), sqlgraph.To(admin.Table, admin.FieldID), sqlgraph.Edge(sqlgraph.M2O, true, adminsession.UserTable, adminsession.UserColumn), ) fromV = sqlgraph.Neighbors(as.driver.Dialect(), step) return fromV, nil } return query }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (c *Client) QueryUser(q string) (*QueryResult, error) {\n\treturn c.query(\"user\", q)\n}", "func (acmd *AdminCommand) QueryUser(conn *Connection, policy *AdminPolicy, user string) (*UserRoles, Error) {\n\tacmd.writeHeader(_QUERY_USERS, 1)\n\tacmd.writeFieldStr(_USER, user)\n\tlist, err := acmd.readUsers(conn, policy)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tif len(list) > 0 {\n\t\treturn list[0], nil\n\t}\n\n\treturn nil, nil\n}", "func (oc *OAuthConnection) QueryUser() *UserQuery {\n\treturn (&OAuthConnectionClient{config: oc.config}).QueryUser(oc)\n}", "func (c *EatinghistoryClient) QueryUser(e *Eatinghistory) *UserQuery {\n\tquery := &UserQuery{config: c.config}\n\tquery.path = func(ctx context.Context) (fromV *sql.Selector, _ error) {\n\t\tid := e.ID\n\t\tstep := sqlgraph.NewStep(\n\t\t\tsqlgraph.From(eatinghistory.Table, eatinghistory.FieldID, id),\n\t\t\tsqlgraph.To(user.Table, user.FieldID),\n\t\t\tsqlgraph.Edge(sqlgraph.M2O, true, eatinghistory.UserTable, eatinghistory.UserColumn),\n\t\t)\n\t\tfromV = sqlgraph.Neighbors(e.driver.Dialect(), step)\n\t\treturn fromV, nil\n\t}\n\treturn query\n}", "func (d *Drug) QueryUser() *UserQuery {\n\treturn (&DrugClient{config: d.config}).QueryUser(d)\n}", "func (c *VeterinarianClient) QueryUser(v *Veterinarian) *UserQuery {\n\tquery := &UserQuery{config: c.config}\n\tquery.path = func(ctx context.Context) (fromV *sql.Selector, _ error) {\n\t\tid := v.ID\n\t\tstep := sqlgraph.NewStep(\n\t\t\tsqlgraph.From(veterinarian.Table, veterinarian.FieldID, id),\n\t\t\tsqlgraph.To(user.Table, user.FieldID),\n\t\t\tsqlgraph.Edge(sqlgraph.O2O, true, veterinarian.UserTable, veterinarian.UserColumn),\n\t\t)\n\t\tfromV = sqlgraph.Neighbors(v.driver.Dialect(), step)\n\t\treturn fromV, nil\n\t}\n\treturn query\n}", "func (c *PositionassingmentClient) QueryUser(po *Positionassingment) *PhysicianQuery {\n\tquery := &PhysicianQuery{config: c.config}\n\tquery.path = func(ctx context.Context) (fromV *sql.Selector, _ error) {\n\t\tid := po.ID\n\t\tstep := sqlgraph.NewStep(\n\t\t\tsqlgraph.From(positionassingment.Table, positionassingment.FieldID, id),\n\t\t\tsqlgraph.To(physician.Table, physician.FieldID),\n\t\t\tsqlgraph.Edge(sqlgraph.O2O, true, positionassingment.UserTable, positionassingment.UserColumn),\n\t\t)\n\t\tfromV = sqlgraph.Neighbors(po.driver.Dialect(), step)\n\t\treturn fromV, nil\n\t}\n\treturn query\n}", "func (d *Dialog) QueryUser() *UserQuery {\n\treturn (&DialogClient{config: d.config}).QueryUser(d)\n}", "func (c *UserWalletClient) QueryUser(uw *UserWallet) *UserQuery {\n\tquery := &UserQuery{config: c.config}\n\tquery.path = func(ctx context.Context) (fromV *sql.Selector, _ error) {\n\t\tid := uw.ID\n\t\tstep := sqlgraph.NewStep(\n\t\t\tsqlgraph.From(userwallet.Table, userwallet.FieldID, id),\n\t\t\tsqlgraph.To(user.Table, user.FieldID),\n\t\t\tsqlgraph.Edge(sqlgraph.M2O, true, userwallet.UserTable, userwallet.UserColumn),\n\t\t)\n\t\tfromV = sqlgraph.Neighbors(uw.driver.Dialect(), step)\n\t\treturn fromV, nil\n\t}\n\treturn query\n}", "func (u *User) Query(c echo.Context, req *schemago.ReqUser) ([]schemago.RespUser, int, error) {\n\treturn u.udb.Query(u.db, req)\n}", "func (a *Address) QueryUser() *UserQuery {\n\treturn (&AddressClient{config: a.config}).QueryUser(a)\n}", "func (c *CustomerClient) QueryUser(cu *Customer) *UserQuery {\n\tquery := &UserQuery{config: c.config}\n\tquery.path = func(ctx context.Context) (fromV *sql.Selector, _ error) {\n\t\tid := cu.ID\n\t\tstep := sqlgraph.NewStep(\n\t\t\tsqlgraph.From(customer.Table, customer.FieldID, id),\n\t\t\tsqlgraph.To(user.Table, user.FieldID),\n\t\t\tsqlgraph.Edge(sqlgraph.O2O, true, customer.UserTable, customer.UserColumn),\n\t\t)\n\t\tfromV = sqlgraph.Neighbors(cu.driver.Dialect(), step)\n\t\treturn fromV, nil\n\t}\n\treturn query\n}", "func (c *UsertypeClient) QueryUser(u *Usertype) *UserQuery {\n\tquery := &UserQuery{config: c.config}\n\tquery.path = func(ctx context.Context) (fromV *sql.Selector, _ error) {\n\t\tid := u.ID\n\t\tstep := sqlgraph.NewStep(\n\t\t\tsqlgraph.From(usertype.Table, usertype.FieldID, id),\n\t\t\tsqlgraph.To(user.Table, user.FieldID),\n\t\t\tsqlgraph.Edge(sqlgraph.O2M, false, usertype.UserTable, usertype.UserColumn),\n\t\t)\n\t\tfromV = sqlgraph.Neighbors(u.driver.Dialect(), step)\n\t\treturn fromV, nil\n\t}\n\treturn query\n}", "func (c *RepairInvoiceClient) QueryUser(ri *RepairInvoice) *UserQuery {\n\tquery := &UserQuery{config: c.config}\n\tquery.path = func(ctx context.Context) (fromV *sql.Selector, _ error) {\n\t\tid := ri.ID\n\t\tstep := sqlgraph.NewStep(\n\t\t\tsqlgraph.From(repairinvoice.Table, repairinvoice.FieldID, id),\n\t\t\tsqlgraph.To(user.Table, user.FieldID),\n\t\t\tsqlgraph.Edge(sqlgraph.M2O, true, repairinvoice.UserTable, repairinvoice.UserColumn),\n\t\t)\n\t\tfromV = sqlgraph.Neighbors(ri.driver.Dialect(), step)\n\t\treturn fromV, nil\n\t}\n\treturn query\n}", "func (c *ClubClient) QueryUser(cl *Club) *UserQuery {\n\tquery := &UserQuery{config: c.config}\n\tquery.path = func(ctx context.Context) (fromV *sql.Selector, _ error) {\n\t\tid := cl.ID\n\t\tstep := sqlgraph.NewStep(\n\t\t\tsqlgraph.From(club.Table, club.FieldID, id),\n\t\t\tsqlgraph.To(user.Table, user.FieldID),\n\t\t\tsqlgraph.Edge(sqlgraph.M2O, true, club.UserTable, club.UserColumn),\n\t\t)\n\t\tfromV = sqlgraph.Neighbors(cl.driver.Dialect(), step)\n\t\treturn fromV, nil\n\t}\n\treturn query\n}", "func (tq *TweetQuery) QueryUser() *UserQuery {\n\tquery := (&UserClient{config: tq.config}).Query()\n\tquery.path = func(ctx context.Context) (fromU *sql.Selector, err error) {\n\t\tif err := tq.prepareQuery(ctx); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tselector := tq.sqlQuery(ctx)\n\t\tif err := selector.Err(); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tstep := sqlgraph.NewStep(\n\t\t\tsqlgraph.From(tweet.Table, tweet.FieldID, selector),\n\t\t\tsqlgraph.To(user.Table, user.FieldID),\n\t\t\tsqlgraph.Edge(sqlgraph.M2M, true, tweet.UserTable, tweet.UserPrimaryKey...),\n\t\t)\n\t\tfromU = sqlgraph.SetNeighbors(tq.driver.Dialect(), step)\n\t\treturn fromU, nil\n\t}\n\treturn query\n}", "func (c *UserCardClient) QueryUser(uc *UserCard) *UserQuery {\n\tquery := &UserQuery{config: c.config}\n\tquery.path = func(ctx context.Context) (fromV *sql.Selector, _ error) {\n\t\tid := uc.ID\n\t\tstep := sqlgraph.NewStep(\n\t\t\tsqlgraph.From(usercard.Table, usercard.FieldID, id),\n\t\t\tsqlgraph.To(user.Table, user.FieldID),\n\t\t\tsqlgraph.Edge(sqlgraph.M2O, true, usercard.UserTable, usercard.UserColumn),\n\t\t)\n\t\tfromV = sqlgraph.Neighbors(uc.driver.Dialect(), step)\n\t\treturn fromV, nil\n\t}\n\treturn query\n}", "func QueryUser(email string) (bool, models.Account) {\n\n\tvar user models.Account\n\t// Println(email)\n\tsqlStatement := \"SELECT email,name,password,role FROM account WHERE email=?\"\n\terr = db.QueryRow(sqlStatement, email).\n\t\tScan(&user.Email, &user.Name, &user.Password, &user.Role)\n\tif err == sql.ErrNoRows {\n\t\treturn false, user\n\t}\n\treturn true, user\n\n}", "func (b *Blog) QueryAdmins() *UserQuery {\n\treturn NewBlogClient(b.config).QueryAdmins(b)\n}", "func (u *User) Query(s Storage) error {\n\tu.Name, u.Password, u.Salt = \"\", []byte{}, []byte{}\n\treturn s.QueryUser(u)\n}", "func Query() error {\n\tuser := &Users{}\n\tb, err := engine.Id(1).Get(user)\n\tif err == nil {\n\t\treturn nil\n\t} else if !b {\n\t\treturn errors.New(\"查询失败\")\n\t}\n\n\tfmt.Println(\"Query: \", user)\n\n\treturn nil\n}", "func (c *UserClient) Query() *UserQuery {\n\treturn &UserQuery{\n\t\tconfig: c.config,\n\t}\n}", "func (c *UserClient) Query() *UserQuery {\n\treturn &UserQuery{\n\t\tconfig: c.config,\n\t}\n}", "func (c *UserClient) Query() *UserQuery {\n\treturn &UserQuery{\n\t\tconfig: c.config,\n\t}\n}", "func (c *UserClient) Query() *UserQuery {\n\treturn &UserQuery{config: c.config}\n}", "func (c *UserClient) Query() *UserQuery {\n\treturn &UserQuery{config: c.config}\n}", "func (c *UserClient) Query() *UserQuery {\n\treturn &UserQuery{config: c.config}\n}", "func (c *UserClient) Query() *UserQuery {\n\treturn &UserQuery{config: c.config}\n}", "func (c *UserClient) Query() *UserQuery {\n\treturn &UserQuery{config: c.config}\n}", "func (c *UserClient) Query() *UserQuery {\n\treturn &UserQuery{config: c.config}\n}", "func (c *UserClient) Query() *UserQuery {\n\treturn &UserQuery{config: c.config}\n}", "func (c *UserClient) Query() *UserQuery {\n\treturn &UserQuery{config: c.config}\n}", "func (o *AuthToken) User(exec boil.Executor, mods ...qm.QueryMod) userQuery {\n\tqueryMods := []qm.QueryMod{\n\t\tqm.Where(\"id=?\", o.UserID),\n\t}\n\n\tqueryMods = append(queryMods, mods...)\n\n\tquery := Users(exec, queryMods...)\n\tqueries.SetFrom(query.Query, \"\\\"users\\\"\")\n\n\treturn query\n}", "func (r *Resolver) UserQuery() runtime.UserQueryResolver { return &userQueryResolver{r} }", "func (u *User) QueryUserstatus() *UserstatusQuery {\n\treturn (&UserClient{config: u.config}).QueryUserstatus(u)\n}", "func (rq *RentQuery) QueryRentUser() *UserQuery {\n\tquery := &UserQuery{config: rq.config}\n\tquery.path = func(ctx context.Context) (fromU *sql.Selector, err error) {\n\t\tif err := rq.prepareQuery(ctx); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tstep := sqlgraph.NewStep(\n\t\t\tsqlgraph.From(rent.Table, rent.FieldID, rq.sqlQuery()),\n\t\t\tsqlgraph.To(user.Table, user.FieldID),\n\t\t\tsqlgraph.Edge(sqlgraph.M2O, true, rent.RentUserTable, rent.RentUserColumn),\n\t\t)\n\t\tfromU = sqlgraph.SetNeighbors(rq.driver.Dialect(), step)\n\t\treturn fromU, nil\n\t}\n\treturn query\n}", "func (o *AuthUserUserPermission) User(exec boil.Executor, mods ...qm.QueryMod) authUserQuery {\n\tqueryMods := []qm.QueryMod{\n\t\tqm.Where(\"id=?\", o.UserID),\n\t}\n\n\tqueryMods = append(queryMods, mods...)\n\n\tquery := AuthUsers(exec, queryMods...)\n\tqueries.SetFrom(query.Query, \"`auth_user`\")\n\n\treturn query\n}", "func (c *AdminSessionClient) Query() *AdminSessionQuery {\n\treturn &AdminSessionQuery{\n\t\tconfig: c.config,\n\t}\n}", "func (s *Session) QueryUser(ID int, args ...string) (user *User, err error) {\n\tvar userID string\n\tif ID != 0 {\n\t\tuserID = strconv.Itoa(ID)\n\t}\n\n\tvar selections string\n\tfor _, arg := range args {\n\t\tselections += arg + \",\"\n\t}\n\tselections = strings.TrimSuffix(selections, \",\")\n\n\tdata, err := s.callAPI(apiUser+endpoint(userID), map[string]string{\"selections\": selections})\n\tif err != nil {\n\t\treturn\n\t}\n\tuser = &User{}\n\tjson.Unmarshal(data, user)\n\treturn\n}", "func (u *User) QueryRequest() *RequestQuery {\n\treturn NewUserClient(u.config).QueryRequest(u)\n}", "func (c *GenderClient) QueryUsers(ge *Gender) *UserQuery {\n\tquery := &UserQuery{config: c.config}\n\tquery.path = func(ctx context.Context) (fromV *sql.Selector, _ error) {\n\t\tid := ge.ID\n\t\tstep := sqlgraph.NewStep(\n\t\t\tsqlgraph.From(gender.Table, gender.FieldID, id),\n\t\t\tsqlgraph.To(user.Table, user.FieldID),\n\t\t\tsqlgraph.Edge(sqlgraph.O2M, false, gender.UsersTable, gender.UsersColumn),\n\t\t)\n\t\tfromV = sqlgraph.Neighbors(ge.driver.Dialect(), step)\n\t\treturn fromV, nil\n\t}\n\treturn query\n}", "func (c *GenderClient) QueryUsers(ge *Gender) *UserQuery {\n\tquery := &UserQuery{config: c.config}\n\tquery.path = func(ctx context.Context) (fromV *sql.Selector, _ error) {\n\t\tid := ge.ID\n\t\tstep := sqlgraph.NewStep(\n\t\t\tsqlgraph.From(gender.Table, gender.FieldID, id),\n\t\t\tsqlgraph.To(user.Table, user.FieldID),\n\t\t\tsqlgraph.Edge(sqlgraph.O2M, false, gender.UsersTable, gender.UsersColumn),\n\t\t)\n\t\tfromV = sqlgraph.Neighbors(ge.driver.Dialect(), step)\n\t\treturn fromV, nil\n\t}\n\treturn query\n}", "func QueryUser(username string) user {\n\tvar users = user{}\n\terr = db.QueryRow(`\n\t\tSELECT id, \n\t\tusername, \n\t\tfirst_name, \n\t\tlast_name, \n\t\tpassword \n\t\tFROM users WHERE username=?\n\t\t`, username).\n\t\tScan(\n\t\t\t&users.ID,\n\t\t\t&users.Username,\n\t\t\t&users.FirstName,\n\t\t\t&users.LastName,\n\t\t\t&users.Password,\n\t\t)\n\treturn users\n}", "func (o *Stock) User(exec boil.Executor, mods ...qm.QueryMod) userQuery {\n\tqueryMods := []qm.QueryMod{\n\t\tqm.Where(\"user_id=?\", o.UserID),\n\t}\n\n\tqueryMods = append(queryMods, mods...)\n\n\tquery := Users(exec, queryMods...)\n\tqueries.SetFrom(query.Query, \"`users`\")\n\n\treturn query\n}", "func (o GetUsersUserOutput) AdminUser() pulumi.BoolOutput {\n\treturn o.ApplyT(func(v GetUsersUser) bool { return v.AdminUser }).(pulumi.BoolOutput)\n}", "func (o *Transaction) User(exec boil.Executor, mods ...qm.QueryMod) userQuery {\n\tqueryMods := []qm.QueryMod{\n\t\tqm.Where(\"user_id=?\", o.UserID),\n\t}\n\n\tqueryMods = append(queryMods, mods...)\n\n\tquery := Users(exec, queryMods...)\n\tqueries.SetFrom(query.Query, \"`users`\")\n\n\treturn query\n}", "func (c *DisciplineClient) QueryUsers(d *Discipline) *UserQuery {\n\tquery := &UserQuery{config: c.config}\n\tquery.path = func(ctx context.Context) (fromV *sql.Selector, _ error) {\n\t\tid := d.ID\n\t\tstep := sqlgraph.NewStep(\n\t\t\tsqlgraph.From(discipline.Table, discipline.FieldID, id),\n\t\t\tsqlgraph.To(user.Table, user.FieldID),\n\t\t\tsqlgraph.Edge(sqlgraph.O2M, false, discipline.UsersTable, discipline.UsersColumn),\n\t\t)\n\t\tfromV = sqlgraph.Neighbors(d.driver.Dialect(), step)\n\t\treturn fromV, nil\n\t}\n\treturn query\n}", "func (m *Model) QueryUsers(ctx context.Context, sort *dto.SortData, itemsRange *dto.RangeData, filter *dto.FilterData) (int64, []*dto.User, error) {\n\treturn m.userDAO.Query(ctx, sort, itemsRange, filter)\n}", "func (c *UserClient) QueryUserstatus(u *User) *UserStatusQuery {\n\tquery := &UserStatusQuery{config: c.config}\n\tquery.path = func(ctx context.Context) (fromV *sql.Selector, _ error) {\n\t\tid := u.ID\n\t\tstep := sqlgraph.NewStep(\n\t\t\tsqlgraph.From(user.Table, user.FieldID, id),\n\t\t\tsqlgraph.To(userstatus.Table, userstatus.FieldID),\n\t\t\tsqlgraph.Edge(sqlgraph.M2O, true, user.UserstatusTable, user.UserstatusColumn),\n\t\t)\n\t\tfromV = sqlgraph.Neighbors(u.driver.Dialect(), step)\n\t\treturn fromV, nil\n\t}\n\treturn query\n}", "func (o *AuthMessage) User(exec boil.Executor, mods ...qm.QueryMod) authUserQuery {\n\tqueryMods := []qm.QueryMod{\n\t\tqm.Where(\"id=?\", o.UserID),\n\t}\n\n\tqueryMods = append(queryMods, mods...)\n\n\tquery := AuthUsers(exec, queryMods...)\n\tqueries.SetFrom(query.Query, \"`auth_user`\")\n\n\treturn query\n}", "func (acmd *AdminCommand) QueryUsers(conn *Connection, policy *AdminPolicy) ([]*UserRoles, Error) {\n\tacmd.writeHeader(_QUERY_USERS, 0)\n\tlist, err := acmd.readUsers(conn, policy)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn list, nil\n}", "func (c *UserStatusClient) Query() *UserStatusQuery {\n\treturn &UserStatusQuery{config: c.config}\n}", "func (c *RoomuseClient) QueryUsers(r *Roomuse) *UserQuery {\n\tquery := &UserQuery{config: c.config}\n\tquery.path = func(ctx context.Context) (fromV *sql.Selector, _ error) {\n\t\tid := r.ID\n\t\tstep := sqlgraph.NewStep(\n\t\t\tsqlgraph.From(roomuse.Table, roomuse.FieldID, id),\n\t\t\tsqlgraph.To(user.Table, user.FieldID),\n\t\t\tsqlgraph.Edge(sqlgraph.M2O, true, roomuse.UsersTable, roomuse.UsersColumn),\n\t\t)\n\t\tfromV = sqlgraph.Neighbors(r.driver.Dialect(), step)\n\t\treturn fromV, nil\n\t}\n\treturn query\n}", "func (c *AdminClient) Query() *AdminQuery {\n\treturn &AdminQuery{\n\t\tconfig: c.config,\n\t}\n}", "func (dao UserDao) Query(db *sql.DB, clause string) ([]User, error) {\n\tvar users []User\n\tvar err error\n\n\tstmt := fmt.Sprintf(\"%s where %s\", dao.CreateQuery(\"users\"), clause)\n\n\tlog.Info(\"stmt: %s\\n\", stmt)\n\n\treturn users, err\n}", "func (c *PositionClient) QueryUsers(po *Position) *UserQuery {\n\tquery := &UserQuery{config: c.config}\n\tquery.path = func(ctx context.Context) (fromV *sql.Selector, _ error) {\n\t\tid := po.ID\n\t\tstep := sqlgraph.NewStep(\n\t\t\tsqlgraph.From(position.Table, position.FieldID, id),\n\t\t\tsqlgraph.To(user.Table, user.FieldID),\n\t\t\tsqlgraph.Edge(sqlgraph.O2M, false, position.UsersTable, position.UsersColumn),\n\t\t)\n\t\tfromV = sqlgraph.Neighbors(po.driver.Dialect(), step)\n\t\treturn fromV, nil\n\t}\n\treturn query\n}", "func (c *PositionClient) QueryUsers(po *Position) *UserQuery {\n\tquery := &UserQuery{config: c.config}\n\tquery.path = func(ctx context.Context) (fromV *sql.Selector, _ error) {\n\t\tid := po.ID\n\t\tstep := sqlgraph.NewStep(\n\t\t\tsqlgraph.From(position.Table, position.FieldID, id),\n\t\t\tsqlgraph.To(user.Table, user.FieldID),\n\t\t\tsqlgraph.Edge(sqlgraph.O2M, false, position.UsersTable, position.UsersColumn),\n\t\t)\n\t\tfromV = sqlgraph.Neighbors(po.driver.Dialect(), step)\n\t\treturn fromV, nil\n\t}\n\treturn query\n}", "func (tq *TweetQuery) QueryTweetUser() *UserTweetQuery {\n\tquery := (&UserTweetClient{config: tq.config}).Query()\n\tquery.path = func(ctx context.Context) (fromU *sql.Selector, err error) {\n\t\tif err := tq.prepareQuery(ctx); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tselector := tq.sqlQuery(ctx)\n\t\tif err := selector.Err(); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tstep := sqlgraph.NewStep(\n\t\t\tsqlgraph.From(tweet.Table, tweet.FieldID, selector),\n\t\t\tsqlgraph.To(usertweet.Table, usertweet.FieldID),\n\t\t\tsqlgraph.Edge(sqlgraph.O2M, true, tweet.TweetUserTable, tweet.TweetUserColumn),\n\t\t)\n\t\tfromU = sqlgraph.SetNeighbors(tq.driver.Dialect(), step)\n\t\treturn fromU, nil\n\t}\n\treturn query\n}", "func (u *User) QueryGroupUser() *GroupQuery {\n\treturn NewUserClient(u.config).QueryGroupUser(u)\n}", "func (qs SysDBQuerySet) UserEq(user string) SysDBQuerySet {\n\treturn qs.w(qs.db.Where(\"user = ?\", user))\n}", "func (c *UserStatusClient) QueryUsers(us *UserStatus) *UserQuery {\n\tquery := &UserQuery{config: c.config}\n\tquery.path = func(ctx context.Context) (fromV *sql.Selector, _ error) {\n\t\tid := us.ID\n\t\tstep := sqlgraph.NewStep(\n\t\t\tsqlgraph.From(userstatus.Table, userstatus.FieldID, id),\n\t\t\tsqlgraph.To(user.Table, user.FieldID),\n\t\t\tsqlgraph.Edge(sqlgraph.O2M, false, userstatus.UsersTable, userstatus.UsersColumn),\n\t\t)\n\t\tfromV = sqlgraph.Neighbors(us.driver.Dialect(), step)\n\t\treturn fromV, nil\n\t}\n\treturn query\n}", "func AdminSearchUserPath() string {\n\treturn \"/admin/users/search\"\n}", "func (o GetUsersUserOutput) AuthAdminUser() pulumi.BoolOutput {\n\treturn o.ApplyT(func(v GetUsersUser) bool { return v.AuthAdminUser }).(pulumi.BoolOutput)\n}", "func (c *RoomClient) QueryUserInformations(r *Room) *UserQuery {\n\tquery := &UserQuery{config: c.config}\n\tquery.path = func(ctx context.Context) (fromV *sql.Selector, _ error) {\n\t\tid := r.ID\n\t\tstep := sqlgraph.NewStep(\n\t\t\tsqlgraph.From(room.Table, room.FieldID, id),\n\t\t\tsqlgraph.To(user.Table, user.FieldID),\n\t\t\tsqlgraph.Edge(sqlgraph.O2M, false, room.UserInformationsTable, room.UserInformationsColumn),\n\t\t)\n\t\tfromV = sqlgraph.Neighbors(r.driver.Dialect(), step)\n\t\treturn fromV, nil\n\t}\n\treturn query\n}", "func (c *BuildingClient) QueryUserInformations(b *Building) *UserQuery {\n\tquery := &UserQuery{config: c.config}\n\tquery.path = func(ctx context.Context) (fromV *sql.Selector, _ error) {\n\t\tid := b.ID\n\t\tstep := sqlgraph.NewStep(\n\t\t\tsqlgraph.From(building.Table, building.FieldID, id),\n\t\t\tsqlgraph.To(user.Table, user.FieldID),\n\t\t\tsqlgraph.Edge(sqlgraph.O2M, false, building.UserInformationsTable, building.UserInformationsColumn),\n\t\t)\n\t\tfromV = sqlgraph.Neighbors(b.driver.Dialect(), step)\n\t\treturn fromV, nil\n\t}\n\treturn query\n}", "func (c *TitleClient) QueryUsers(t *Title) *UserQuery {\n\tquery := &UserQuery{config: c.config}\n\tquery.path = func(ctx context.Context) (fromV *sql.Selector, _ error) {\n\t\tid := t.ID\n\t\tstep := sqlgraph.NewStep(\n\t\t\tsqlgraph.From(title.Table, title.FieldID, id),\n\t\t\tsqlgraph.To(user.Table, user.FieldID),\n\t\t\tsqlgraph.Edge(sqlgraph.O2M, false, title.UsersTable, title.UsersColumn),\n\t\t)\n\t\tfromV = sqlgraph.Neighbors(t.driver.Dialect(), step)\n\t\treturn fromV, nil\n\t}\n\treturn query\n}", "func (f UserUserQueryRuleFunc) EvalQuery(ctx context.Context, q ent.Query) error {\n\tif q, ok := q.(*ent.UserUserQuery); ok {\n\t\treturn f(ctx, q)\n\t}\n\treturn Denyf(\"ent/privacy: unexpected query type %T, expect *ent.UserUserQuery\", q)\n}", "func (service *AdminService) GetAdmin(requestedadmin *models.User) error {\n\tufw := repository.NewUnitOfWork(service.DB, true)\n\tvar authadmin models.User\n\terr := service.Repository.GetByField(ufw, requestedadmin.GetID(), \"id\", &authadmin, []string{})\n\tif (err != nil || authadmin.GetID() == uuid.UUID{}) {\n\t\treturn web.NewValidationError(\"user\", map[string]string{\"error\": \"Invalid User\"})\n\t}\n\n\t*requestedadmin = authadmin\n\treturn nil\n}", "func (gr *Group) QueryUsers() *UserQuery {\n\treturn (&GroupClient{config: gr.config}).QueryUsers(gr)\n}", "func (s *Session) IsAdminUser() bool {\n\treturn s.AdminUserID != uuid.Nil\n}", "func IsUserAdmin(user *auth.User) bool {\n\treturn user.Admin\n}", "func (o *AuthUserUserPermission) UserG(mods ...qm.QueryMod) authUserQuery {\n\treturn o.User(boil.GetDB(), mods...)\n}", "func (o *Project) User(mods ...qm.QueryMod) userQuery {\n\tqueryMods := []qm.QueryMod{\n\t\tqm.Where(\"`ID` = ?\", o.UserID),\n\t}\n\n\tqueryMods = append(queryMods, mods...)\n\n\tquery := Users(queryMods...)\n\tqueries.SetFrom(query.Query, \"`user`\")\n\n\treturn query\n}", "func (c *ClubClient) QueryUserclub(cl *Club) *UserQuery {\n\tquery := &UserQuery{config: c.config}\n\tquery.path = func(ctx context.Context) (fromV *sql.Selector, _ error) {\n\t\tid := cl.ID\n\t\tstep := sqlgraph.NewStep(\n\t\t\tsqlgraph.From(club.Table, club.FieldID, id),\n\t\t\tsqlgraph.To(user.Table, user.FieldID),\n\t\t\tsqlgraph.Edge(sqlgraph.O2M, false, club.UserclubTable, club.UserclubColumn),\n\t\t)\n\t\tfromV = sqlgraph.Neighbors(cl.driver.Dialect(), step)\n\t\treturn fromV, nil\n\t}\n\treturn query\n}", "func (c *ComplaintClient) QueryComplaintToUser(co *Complaint) *UserQuery {\n\tquery := &UserQuery{config: c.config}\n\tquery.path = func(ctx context.Context) (fromV *sql.Selector, _ error) {\n\t\tid := co.ID\n\t\tstep := sqlgraph.NewStep(\n\t\t\tsqlgraph.From(complaint.Table, complaint.FieldID, id),\n\t\t\tsqlgraph.To(user.Table, user.FieldID),\n\t\t\tsqlgraph.Edge(sqlgraph.M2O, true, complaint.ComplaintToUserTable, complaint.ComplaintToUserColumn),\n\t\t)\n\t\tfromV = sqlgraph.Neighbors(co.driver.Dialect(), step)\n\t\treturn fromV, nil\n\t}\n\treturn query\n}", "func Query() error {\n\tvar user TbUser\n\terr := orm.Where(\"name=$1\", \"viney\").Limit(1).Find(&user)\n\tif err == nil {\n\t\tfmt.Println(user)\n\t\treturn nil\n\t}\n\n\treturn err\n}", "func (m *Merchant) QueryMOrder() *UserQuery {\n\treturn (&MerchantClient{config: m.config}).QueryMOrder(m)\n}", "func (o *BraceletPhoto) User(exec boil.Executor, mods ...qm.QueryMod) authUserQuery {\n\tqueryMods := []qm.QueryMod{\n\t\tqm.Where(\"id=?\", o.UserID),\n\t}\n\n\tqueryMods = append(queryMods, mods...)\n\n\tquery := AuthUsers(exec, queryMods...)\n\tqueries.SetFrom(query.Query, \"`auth_user`\")\n\n\treturn query\n}", "func UserIsAdmin(r *http.Request) bool {\n\tval := r.Context().Value(request.CtxAccess)\n\tif val == nil {\n\t\treturn false\n\t}\n\n\tua := val.(*UserAccess)\n\treturn ua.Admin\n}", "func (c *BranchClient) QueryUserInformations(b *Branch) *UserQuery {\n\tquery := &UserQuery{config: c.config}\n\tquery.path = func(ctx context.Context) (fromV *sql.Selector, _ error) {\n\t\tid := b.ID\n\t\tstep := sqlgraph.NewStep(\n\t\t\tsqlgraph.From(branch.Table, branch.FieldID, id),\n\t\t\tsqlgraph.To(user.Table, user.FieldID),\n\t\t\tsqlgraph.Edge(sqlgraph.O2M, false, branch.UserInformationsTable, branch.UserInformationsColumn),\n\t\t)\n\t\tfromV = sqlgraph.Neighbors(b.driver.Dialect(), step)\n\t\treturn fromV, nil\n\t}\n\treturn query\n}", "func (c *UserWalletClient) Query() *UserWalletQuery {\n\treturn &UserWalletQuery{\n\t\tconfig: c.config,\n\t}\n}", "func (c *AdminClient) QuerySessions(a *Admin) *AdminSessionQuery {\n\tquery := &AdminSessionQuery{config: c.config}\n\tquery.path = func(ctx context.Context) (fromV *sql.Selector, _ error) {\n\t\tid := a.ID\n\t\tstep := sqlgraph.NewStep(\n\t\t\tsqlgraph.From(admin.Table, admin.FieldID, id),\n\t\t\tsqlgraph.To(adminsession.Table, adminsession.FieldID),\n\t\t\tsqlgraph.Edge(sqlgraph.O2M, false, admin.SessionsTable, admin.SessionsColumn),\n\t\t)\n\t\tfromV = sqlgraph.Neighbors(a.driver.Dialect(), step)\n\t\treturn fromV, nil\n\t}\n\treturn query\n}", "func (c *UserStore) Get(ctx context.Context, q chronograf.UserQuery) (*chronograf.User, error) {\n\tif q.Name == nil {\n\t\treturn nil, fmt.Errorf(\"query must specify name\")\n\t}\n\tu, err := c.Ctrl.User(ctx, *q.Name)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tur, err := c.Ctrl.UserRoles(ctx)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\trole := ur[*q.Name]\n\tcr := role.ToChronograf()\n\t// For now we are removing all users from a role being returned.\n\tfor i, r := range cr {\n\t\tr.Users = []chronograf.User{}\n\t\tcr[i] = r\n\t}\n\treturn &chronograf.User{\n\t\tName: u.Name,\n\t\tPermissions: ToChronograf(u.Permissions),\n\t\tRoles: cr,\n\t}, nil\n}", "func (tq *TeamQuery) QueryUsers() *UserQuery {\n\tquery := (&UserClient{config: tq.config}).Query()\n\tquery.path = func(ctx context.Context) (fromU *sql.Selector, err error) {\n\t\tif err := tq.prepareQuery(ctx); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tselector := tq.sqlQuery(ctx)\n\t\tif err := selector.Err(); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tstep := sqlgraph.NewStep(\n\t\t\tsqlgraph.From(team.Table, team.FieldID, selector),\n\t\t\tsqlgraph.To(user.Table, user.FieldID),\n\t\t\tsqlgraph.Edge(sqlgraph.M2M, true, team.UsersTable, team.UsersPrimaryKey...),\n\t\t)\n\t\tfromU = sqlgraph.SetNeighbors(tq.driver.Dialect(), step)\n\t\treturn fromU, nil\n\t}\n\treturn query\n}", "func (c *Client) AdminGetUser(ctx context.Context, params *AdminGetUserInput, optFns ...func(*Options)) (*AdminGetUserOutput, error) {\n\tif params == nil {\n\t\tparams = &AdminGetUserInput{}\n\t}\n\n\tresult, metadata, err := c.invokeOperation(ctx, \"AdminGetUser\", params, optFns, addOperationAdminGetUserMiddlewares)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tout := result.(*AdminGetUserOutput)\n\tout.ResultMetadata = metadata\n\treturn out, nil\n}", "func (u *User) QueryChildren() *UserQuery {\n\treturn (&UserClient{config: u.config}).QueryChildren(u)\n}", "func (pr *Preemption) QueryUserID() *UserQuery {\n\treturn (&PreemptionClient{config: pr.config}).QueryUserID(pr)\n}", "func NewUserQuery() *UserQuery {\n\treturn &UserQuery{\n\t\tBaseQuery: kallax.NewBaseQuery(Schema.User.BaseSchema),\n\t}\n}", "func (u *User) QuerySettings() *UserSettingsQuery {\n\treturn (&UserClient{config: u.config}).QuerySettings(u)\n}", "func (c *Client) AdminDeleteUser(ctx context.Context, params *AdminDeleteUserInput, optFns ...func(*Options)) (*AdminDeleteUserOutput, error) {\n\tif params == nil {\n\t\tparams = &AdminDeleteUserInput{}\n\t}\n\n\tresult, metadata, err := c.invokeOperation(ctx, \"AdminDeleteUser\", params, optFns, addOperationAdminDeleteUserMiddlewares)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tout := result.(*AdminDeleteUserOutput)\n\tout.ResultMetadata = metadata\n\treturn out, nil\n}", "func (u *User) QueryRequestTarget() *RequestTargetQuery {\n\treturn NewUserClient(u.config).QueryRequestTarget(u)\n}", "func (c *YearClient) QueryUsers(y *Year) *UserQuery {\n\tquery := &UserQuery{config: c.config}\n\tquery.path = func(ctx context.Context) (fromV *sql.Selector, _ error) {\n\t\tid := y.ID\n\t\tstep := sqlgraph.NewStep(\n\t\t\tsqlgraph.From(year.Table, year.FieldID, id),\n\t\t\tsqlgraph.To(user.Table, user.FieldID),\n\t\t\tsqlgraph.Edge(sqlgraph.O2M, false, year.UsersTable, year.UsersColumn),\n\t\t)\n\t\tfromV = sqlgraph.Neighbors(y.driver.Dialect(), step)\n\t\treturn fromV, nil\n\t}\n\treturn query\n}", "func (user *UserObject) Query(database *sqlx.DB, criteria map[string]string) *[]Access {\n\tobjects := make([]Access, 0)\n\trestrictions := getCriteria(criteria)\n\n\tquery := fmt.Sprintf(queryMany, userTableName, restrictions)\n\n\tresults, err := database.Queryx(query)\n\tif err != nil {\n\t\treturn nil\n\t}\n\tfor results.Next() {\n\t\tvar userObj = UserObject{}\n\t\terr = results.StructScan(&userObj)\n\t\tif err == nil {\n\t\t\tobjects = append(objects, &userObj)\n\t\t}\n\t}\n\n\treturn &objects\n}", "func (c *PhysicianClient) QueryFormuser(ph *Physician) *PositionassingmentQuery {\n\tquery := &PositionassingmentQuery{config: c.config}\n\tquery.path = func(ctx context.Context) (fromV *sql.Selector, _ error) {\n\t\tid := ph.ID\n\t\tstep := sqlgraph.NewStep(\n\t\t\tsqlgraph.From(physician.Table, physician.FieldID, id),\n\t\t\tsqlgraph.To(positionassingment.Table, positionassingment.FieldID),\n\t\t\tsqlgraph.Edge(sqlgraph.O2O, false, physician.FormuserTable, physician.FormuserColumn),\n\t\t)\n\t\tfromV = sqlgraph.Neighbors(ph.driver.Dialect(), step)\n\t\treturn fromV, nil\n\t}\n\treturn query\n}", "func (c *FacultyClient) QueryUserInformations(f *Faculty) *UserQuery {\n\tquery := &UserQuery{config: c.config}\n\tquery.path = func(ctx context.Context) (fromV *sql.Selector, _ error) {\n\t\tid := f.ID\n\t\tstep := sqlgraph.NewStep(\n\t\t\tsqlgraph.From(faculty.Table, faculty.FieldID, id),\n\t\t\tsqlgraph.To(user.Table, user.FieldID),\n\t\t\tsqlgraph.Edge(sqlgraph.O2M, false, faculty.UserInformationsTable, faculty.UserInformationsColumn),\n\t\t)\n\t\tfromV = sqlgraph.Neighbors(f.driver.Dialect(), step)\n\t\treturn fromV, nil\n\t}\n\treturn query\n}", "func (o *AuthToken) UserG(mods ...qm.QueryMod) userQuery {\n\treturn o.User(boil.GetDB(), mods...)\n}", "func (action *Action) OrgAdminUser(orgID string) (apifabclient.User, error) {\n\tuserName := cliconfig.Config().UserName()\n\tif userName == \"\" {\n\t\tuserName = adminUser\n\t}\n\treturn action.OrgUser(orgID, userName)\n}", "func (o *AuthMessage) UserG(mods ...qm.QueryMod) authUserQuery {\n\treturn o.User(boil.GetDB(), mods...)\n}", "func (f UserQueryRuleFunc) EvalQuery(ctx context.Context, q ent.Query) error {\n\tif q, ok := q.(*ent.UserQuery); ok {\n\t\treturn f(ctx, q)\n\t}\n\treturn Denyf(\"ent/privacy: unexpected query type %T, expect *ent.UserQuery\", q)\n}", "func (f UserQueryRuleFunc) EvalQuery(ctx context.Context, q ent.Query) error {\n\tif q, ok := q.(*ent.UserQuery); ok {\n\t\treturn f(ctx, q)\n\t}\n\treturn Denyf(\"ent/privacy: unexpected query type %T, expect *ent.UserQuery\", q)\n}" ]
[ "0.7148358", "0.7130055", "0.70221746", "0.7010187", "0.70077676", "0.69046146", "0.68179107", "0.6810479", "0.68079084", "0.6805754", "0.6753027", "0.6710847", "0.66584694", "0.66029114", "0.6555724", "0.65144414", "0.6474184", "0.6292588", "0.62850386", "0.6228506", "0.62080735", "0.6168986", "0.6168986", "0.6168986", "0.61525315", "0.61525315", "0.61525315", "0.61525315", "0.61525315", "0.61525315", "0.61525315", "0.61525315", "0.61249346", "0.6124118", "0.61213815", "0.60763055", "0.6056942", "0.6011233", "0.59766334", "0.5951753", "0.5946187", "0.5946187", "0.5928557", "0.59240067", "0.59113693", "0.5895753", "0.58939546", "0.58689934", "0.5819735", "0.5813614", "0.5809988", "0.5806602", "0.57828605", "0.57406425", "0.57094127", "0.5702815", "0.5702815", "0.56947535", "0.5668833", "0.56556267", "0.56518203", "0.5611308", "0.5588977", "0.5578418", "0.5562377", "0.55437386", "0.5532374", "0.5518668", "0.55121446", "0.55101854", "0.5478019", "0.5445338", "0.5441622", "0.544132", "0.5439231", "0.543581", "0.54036653", "0.5398881", "0.5379944", "0.5368513", "0.5357818", "0.5353157", "0.5346195", "0.53161526", "0.52739847", "0.5261798", "0.5248094", "0.51960397", "0.51847535", "0.51795423", "0.51786834", "0.5175317", "0.51687455", "0.5159919", "0.5152358", "0.5140301", "0.5133041", "0.51233995", "0.51151234", "0.51151234" ]
0.8049206
0
Hooks returns the client hooks.
func (c *AdminSessionClient) Hooks() []Hook { return c.hooks.AdminSession }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (c *OperationClient) Hooks() []Hook {\n\treturn c.hooks.Operation\n}", "func (c *ToolClient) Hooks() []Hook {\n\treturn c.hooks.Tool\n}", "func (c *TagClient) Hooks() []Hook {\n\treturn c.hooks.Tag\n}", "func (c *ComplaintClient) Hooks() []Hook {\n\treturn c.hooks.Complaint\n}", "func (c *PostClient) Hooks() []Hook {\n\treturn c.hooks.Post\n}", "func (c *ClubapplicationClient) Hooks() []Hook {\n\treturn c.hooks.Clubapplication\n}", "func (c *ClinicClient) Hooks() []Hook {\n\treturn c.hooks.Clinic\n}", "func (c *EventClient) Hooks() []Hook {\n\treturn c.hooks.Event\n}", "func (c *BuildingClient) Hooks() []Hook {\n\treturn c.hooks.Building\n}", "func (c *OperativeClient) Hooks() []Hook {\n\treturn c.hooks.Operative\n}", "func (c *SituationClient) Hooks() []Hook {\n\treturn c.hooks.Situation\n}", "func (c *AppointmentClient) Hooks() []Hook {\n\treturn c.hooks.Appointment\n}", "func (c *RentalstatusClient) Hooks() []Hook {\n\treturn c.hooks.Rentalstatus\n}", "func (c *LeaseClient) Hooks() []Hook {\n\treturn c.hooks.Lease\n}", "func (c *ReturninvoiceClient) Hooks() []Hook {\n\treturn c.hooks.Returninvoice\n}", "func (c *ClubappStatusClient) Hooks() []Hook {\n\treturn c.hooks.ClubappStatus\n}", "func (c *ReviewClient) Hooks() []Hook {\n\treturn c.hooks.Review\n}", "func (c *EmployeeClient) Hooks() []Hook {\n\treturn c.hooks.Employee\n}", "func (c *EmployeeClient) Hooks() []Hook {\n\treturn c.hooks.Employee\n}", "func (c *EmployeeClient) Hooks() []Hook {\n\treturn c.hooks.Employee\n}", "func (c *WorkExperienceClient) Hooks() []Hook {\n\treturn c.hooks.WorkExperience\n}", "func (c *PartClient) Hooks() []Hook {\n\treturn c.hooks.Part\n}", "func (c *CleanernameClient) Hooks() []Hook {\n\treturn c.hooks.Cleanername\n}", "func (c *BeerClient) Hooks() []Hook {\n\treturn c.hooks.Beer\n}", "func (c *FoodmenuClient) Hooks() []Hook {\n\treturn c.hooks.Foodmenu\n}", "func (c *RepairinvoiceClient) Hooks() []Hook {\n\treturn c.hooks.Repairinvoice\n}", "func (c *StatusdClient) Hooks() []Hook {\n\treturn c.hooks.Statusd\n}", "func (c *EmptyClient) Hooks() []Hook {\n\treturn c.hooks.Empty\n}", "func (c *BillClient) Hooks() []Hook {\n\treturn c.hooks.Bill\n}", "func (c *BillClient) Hooks() []Hook {\n\treturn c.hooks.Bill\n}", "func (c *BillClient) Hooks() []Hook {\n\treturn c.hooks.Bill\n}", "func (c *CompanyClient) Hooks() []Hook {\n\treturn c.hooks.Company\n}", "func (c *CompanyClient) Hooks() []Hook {\n\treturn c.hooks.Company\n}", "func (c *IPClient) Hooks() []Hook {\n\treturn c.hooks.IP\n}", "func (c *VeterinarianClient) Hooks() []Hook {\n\treturn c.hooks.Veterinarian\n}", "func (c *MedicineClient) Hooks() []Hook {\n\treturn c.hooks.Medicine\n}", "func (c *PrescriptionClient) Hooks() []Hook {\n\treturn c.hooks.Prescription\n}", "func (c *TransactionClient) Hooks() []Hook {\n\treturn c.hooks.Transaction\n}", "func (c *CategoryClient) Hooks() []Hook {\n\treturn c.hooks.Category\n}", "func (c *KeyStoreClient) Hooks() []Hook {\n\treturn c.hooks.KeyStore\n}", "func (c *PetruleClient) Hooks() []Hook {\n\treturn c.hooks.Petrule\n}", "func (c *LevelOfDangerousClient) Hooks() []Hook {\n\treturn c.hooks.LevelOfDangerous\n}", "func (c *AdminClient) Hooks() []Hook {\n\treturn c.hooks.Admin\n}", "func (c *JobClient) Hooks() []Hook {\n\treturn c.hooks.Job\n}", "func (c *OrderClient) Hooks() []Hook {\n\treturn c.hooks.Order\n}", "func (c *PetClient) Hooks() []Hook {\n\treturn c.hooks.Pet\n}", "func (c *DNSBLResponseClient) Hooks() []Hook {\n\treturn c.hooks.DNSBLResponse\n}", "func (c *MealplanClient) Hooks() []Hook {\n\treturn c.hooks.Mealplan\n}", "func (c *RepairInvoiceClient) Hooks() []Hook {\n\treturn c.hooks.RepairInvoice\n}", "func (c *DoctorClient) Hooks() []Hook {\n\treturn c.hooks.Doctor\n}", "func (c *StatustClient) Hooks() []Hook {\n\treturn c.hooks.Statust\n}", "func (c *EatinghistoryClient) Hooks() []Hook {\n\treturn c.hooks.Eatinghistory\n}", "func (c *StaytypeClient) Hooks() []Hook {\n\treturn c.hooks.Staytype\n}", "func (c *CustomerClient) Hooks() []Hook {\n\treturn c.hooks.Customer\n}", "func (c *StatusRClient) Hooks() []Hook {\n\treturn c.hooks.StatusR\n}", "func (c *UserClient) Hooks() []Hook {\n\treturn c.hooks.User\n}", "func (c *UserClient) Hooks() []Hook {\n\treturn c.hooks.User\n}", "func (c *UserClient) Hooks() []Hook {\n\treturn c.hooks.User\n}", "func (c *UserClient) Hooks() []Hook {\n\treturn c.hooks.User\n}", "func (c *UserClient) Hooks() []Hook {\n\treturn c.hooks.User\n}", "func (c *UserClient) Hooks() []Hook {\n\treturn c.hooks.User\n}", "func (c *UserClient) Hooks() []Hook {\n\treturn c.hooks.User\n}", "func (c *UserClient) Hooks() []Hook {\n\treturn c.hooks.User\n}", "func (c *UserClient) Hooks() []Hook {\n\treturn c.hooks.User\n}", "func (c *UserClient) Hooks() []Hook {\n\treturn c.hooks.User\n}", "func (c *UserClient) Hooks() []Hook {\n\treturn c.hooks.User\n}", "func (c *UnitOfMedicineClient) Hooks() []Hook {\n\treturn c.hooks.UnitOfMedicine\n}", "func (c *YearClient) Hooks() []Hook {\n\treturn c.hooks.Year\n}", "func (c *ClubClient) Hooks() []Hook {\n\treturn c.hooks.Club\n}", "func (c *DentistClient) Hooks() []Hook {\n\treturn c.hooks.Dentist\n}", "func (c *PaymentClient) Hooks() []Hook {\n\treturn c.hooks.Payment\n}", "func (c *PaymentClient) Hooks() []Hook {\n\treturn c.hooks.Payment\n}", "func (c *BookingClient) Hooks() []Hook {\n\treturn c.hooks.Booking\n}", "func (c *DisciplineClient) Hooks() []Hook {\n\treturn c.hooks.Discipline\n}", "func (c *PlanetClient) Hooks() []Hook {\n\treturn c.hooks.Planet\n}", "func (c *OperationroomClient) Hooks() []Hook {\n\treturn c.hooks.Operationroom\n}", "func (c *LengthtimeClient) Hooks() []Hook {\n\treturn c.hooks.Lengthtime\n}", "func (c *DispenseMedicineClient) Hooks() []Hook {\n\treturn c.hooks.DispenseMedicine\n}", "func (c *PartorderClient) Hooks() []Hook {\n\treturn c.hooks.Partorder\n}", "func (c *PatientInfoClient) Hooks() []Hook {\n\treturn c.hooks.PatientInfo\n}", "func (c *SkillClient) Hooks() []Hook {\n\treturn c.hooks.Skill\n}", "func (c *PharmacistClient) Hooks() []Hook {\n\treturn c.hooks.Pharmacist\n}", "func (c *TitleClient) Hooks() []Hook {\n\treturn c.hooks.Title\n}", "func (c *DepositClient) Hooks() []Hook {\n\treturn c.hooks.Deposit\n}", "func (c *SessionClient) Hooks() []Hook {\n\treturn c.hooks.Session\n}", "func (c *PostImageClient) Hooks() []Hook {\n\treturn c.hooks.PostImage\n}", "func (c *DrugAllergyClient) Hooks() []Hook {\n\treturn c.hooks.DrugAllergy\n}", "func (c *TimerClient) Hooks() []Hook {\n\treturn c.hooks.Timer\n}", "func (c *PhysicianClient) Hooks() []Hook {\n\treturn c.hooks.Physician\n}", "func (c *PhysicianClient) Hooks() []Hook {\n\treturn c.hooks.Physician\n}", "func (c *PostAttachmentClient) Hooks() []Hook {\n\treturn c.hooks.PostAttachment\n}", "func (c *PatientClient) Hooks() []Hook {\n\treturn c.hooks.Patient\n}", "func (c *PatientClient) Hooks() []Hook {\n\treturn c.hooks.Patient\n}", "func (c *PatientClient) Hooks() []Hook {\n\treturn c.hooks.Patient\n}", "func (c *PostThumbnailClient) Hooks() []Hook {\n\treturn c.hooks.PostThumbnail\n}", "func (c *BedtypeClient) Hooks() []Hook {\n\treturn c.hooks.Bedtype\n}", "func (c *CoinInfoClient) Hooks() []Hook {\n\treturn c.hooks.CoinInfo\n}", "func (c *OperativerecordClient) Hooks() []Hook {\n\treturn c.hooks.Operativerecord\n}", "func (c *ActivitiesClient) Hooks() []Hook {\n\treturn c.hooks.Activities\n}", "func (c *MedicineTypeClient) Hooks() []Hook {\n\treturn c.hooks.MedicineType\n}" ]
[ "0.80317485", "0.79030067", "0.7886111", "0.78830385", "0.7861127", "0.7827846", "0.78169984", "0.7799408", "0.7789961", "0.7762907", "0.774616", "0.77400076", "0.77377117", "0.7723144", "0.7715899", "0.77091956", "0.76981485", "0.7695239", "0.7695239", "0.7695239", "0.7691411", "0.76718473", "0.7669308", "0.76659566", "0.76649994", "0.7658629", "0.76272875", "0.7619314", "0.7616328", "0.7616328", "0.7616328", "0.7613535", "0.7613535", "0.7612722", "0.7607983", "0.76073736", "0.76072484", "0.7600732", "0.7597693", "0.75947726", "0.7593981", "0.75886565", "0.75843227", "0.7583164", "0.7580412", "0.7568908", "0.7559808", "0.75595653", "0.75512165", "0.75502926", "0.7532545", "0.75314486", "0.7530887", "0.75256604", "0.7522074", "0.75039285", "0.75039285", "0.75039285", "0.75039285", "0.75039285", "0.75039285", "0.75039285", "0.75039285", "0.75039285", "0.75039285", "0.75039285", "0.7503626", "0.75009644", "0.74971604", "0.74927765", "0.74925745", "0.74925745", "0.7490701", "0.7489253", "0.748288", "0.748131", "0.74717736", "0.74631125", "0.74541014", "0.7448737", "0.7445493", "0.74428546", "0.74352837", "0.7419495", "0.7416624", "0.7410944", "0.7410398", "0.74081314", "0.73945314", "0.73945314", "0.7394305", "0.7393659", "0.7393659", "0.7393659", "0.73885626", "0.7386602", "0.7375832", "0.73689777", "0.73569894", "0.73537123" ]
0.7353203
100
NewCategoryClient returns a client for the Category from the given config.
func NewCategoryClient(c config) *CategoryClient { return &CategoryClient{config: c} }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func NewCatClient(args config.Args) (*CatClient, error) {\n\tif args.RegexStr != \"\" {\n\t\treturn nil, errors.New(\"Can't use regex with 'cat' operating mode\")\n\t}\n\targs.Mode = omode.CatClient\n\n\tc := CatClient{\n\t\tbaseClient: baseClient{\n\t\t\tArgs: args,\n\t\t\tthrottleCh: make(chan struct{}, args.ConnectionsPerCPU*runtime.NumCPU()),\n\t\t\tretry: false,\n\t\t},\n\t}\n\n\tc.init()\n\tc.makeConnections(c)\n\treturn &c, nil\n}", "func NewCatClient(args Args) (*CatClient, error) {\n\tif args.Regex != \"\" {\n\t\treturn nil, errors.New(\"Can't use regex with 'cat' operating mode\")\n\t}\n\n\targs.Regex = \".\"\n\targs.Mode = omode.CatClient\n\n\tc := CatClient{\n\t\tbaseClient: baseClient{\n\t\t\tArgs: args,\n\t\t\tstop: make(chan struct{}),\n\t\t\tstopped: make(chan struct{}),\n\t\t\tthrottleCh: make(chan struct{}, args.ConnectionsPerCPU*runtime.NumCPU()),\n\t\t\tretry: false,\n\t\t},\n\t}\n\n\tc.init(c)\n\n\treturn &c, nil\n}", "func NewClient(config ClientConfig) (Client, error) {\n\t// raise error on client creation if the url is invalid\n\tneturl, err := url.Parse(config.URL)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\thttpClient := http.DefaultClient\n\n\tif config.TLSInsecureSkipVerify {\n\t\thttpClient.Transport = &http.Transport{TLSClientConfig: &tls.Config{InsecureSkipVerify: true}}\n\t}\n\n\tc := &client{\n\t\tclient: httpClient,\n\t\trawurl: neturl.String(),\n\t\tusername: config.Username,\n\t\tpassword: config.Password,\n\t}\n\n\t// create a single service object and reuse it for each API service\n\tc.service.client = c\n\tc.knowledge = (*knowledgeService)(&c.service)\n\n\treturn c, nil\n}", "func NewClient(c Config) Client {\n\treturn &client{config: c}\n}", "func NewClient(config Config) *Client {\n\treturn &Client{Config: config}\n}", "func NewClient(kubeconfig, configContext string) (*Client, error) {\n\tconfig, err := defaultRestConfig(kubeconfig, configContext)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\trestClient, err := rest.RESTClientFor(config)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &Client{config, restClient}, nil\n}", "func NewClient(kubeconfig, configContext string) (*Client, error) {\n\tconfig, err := defaultRestConfig(kubeconfig, configContext)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\trestClient, err := rest.RESTClientFor(config)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &Client{config, restClient}, nil\n}", "func NewClient(cfg *api.Config, address, name string, port int) (Client, error) {\n\n\tc, err := api.NewClient(cfg)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tfmt.Println(\">>> Started a new Consul client.\")\n\treturn &client{\n\t\tclient: c,\n\t\tname: name,\n\t\taddress: address,\n\t\tport: port,\n\t}, nil\n}", "func NewClient(config Config) (*Client, error) {\n\tclient := &Client{\n\t\tuserAgent: \"GoGenderize/\" + Version,\n\t\tapiKey: config.APIKey,\n\t\thttpClient: http.DefaultClient,\n\t}\n\n\tif config.UserAgent != \"\" {\n\t\tclient.userAgent = config.UserAgent\n\t}\n\n\tif config.HTTPClient != nil {\n\t\tclient.httpClient = config.HTTPClient\n\t}\n\n\tserver := defaultServer\n\tif config.Server != \"\" {\n\t\tserver = config.Server\n\t}\n\tapiURL, err := url.Parse(server)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tclient.apiURL = apiURL\n\n\treturn client, nil\n}", "func NewClient(config *Config) *Client {\n\treturn &Client{\n\t\tchanged: make(chan struct{}),\n\t\tclosing: make(chan struct{}),\n\t\tcacheData: &Data{},\n\t\tlogger: log.New(os.Stderr, \"[metaclient] \", log.LstdFlags),\n\t\tpath: config.Dir,\n\t\tretentionAutoCreate: config.RetentionAutoCreate,\n\t\tconfig: config,\n\t}\n}", "func NewClient(config *Config) *Client {\n\treturn &Client{\n\t\tconfig: config,\n\t}\n}", "func NewClient(c *Config) (*Client, error) {\n\th := cleanhttp.DefaultClient()\n\n\tclient := &Client{\n\t\tconfig: *c,\n\t\thttpClient: h,\n\t}\n\treturn client, nil\n}", "func CreateClusterConfigClient(kubeconfig string) (*crdClient.CRDClient, error) {\n\tvar config *rest.Config\n\tvar err error\n\n\tif err = AddToScheme(scheme.Scheme); err != nil {\n\t\tpanic(err)\n\t}\n\n\tcrdClient.AddToRegistry(\"clusterconfigs\", &ClusterConfig{}, &ClusterConfigList{}, Keyer, GroupResource)\n\n\tconfig, err = crdClient.NewKubeconfig(kubeconfig, &GroupVersion)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\tclientSet, err := crdClient.NewFromConfig(config)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tstore, stop, err := crdClient.WatchResources(clientSet,\n\t\t\"clusterconfigs\",\n\t\t\"\",\n\t\t0,\n\t\tcache.ResourceEventHandlerFuncs{},\n\t\tmetav1.ListOptions{})\n\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tclientSet.Store = store\n\tclientSet.Stop = stop\n\n\treturn clientSet, nil\n}", "func NewClient(c Config) (Client, error) {\n\tif len(c.Endpoint) == 0 {\n\t\tc.Endpoint = EndpointProduction\n\t}\n\n\treturn &client{\n\t\tapikey: c.APIKey,\n\t\tendpoint: c.Endpoint,\n\t\torganizationid: c.OrganizationID,\n\t\thttpClient: http.DefaultClient,\n\t}, nil\n}", "func NewClient(config Config) Client {\n\treturn DefaultClient{\n\t\tconfig: config,\n\t}\n}", "func New(kubeconfig string, clusterContextOptions ...string) (*Client, error) {\n\tvar clusterCtxName string\n\tif len(clusterContextOptions) > 0 {\n\t\tclusterCtxName = clusterContextOptions[0]\n\t}\n\n\t// creating cfg for each client type because each\n\t// setup needs its own cfg default which may not be compatible\n\tdynCfg, err := makeRESTConfig(kubeconfig, clusterCtxName)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tclient, err := dynamic.NewForConfig(dynCfg)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tdiscoCfg, err := makeRESTConfig(kubeconfig, clusterCtxName)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdisco, err := discovery.NewDiscoveryClientForConfig(discoCfg)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tresources, err := restmapper.GetAPIGroupResources(disco)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tmapper := restmapper.NewDiscoveryRESTMapper(resources)\n\n\trestCfg, err := makeRESTConfig(kubeconfig, clusterCtxName)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tsetCoreDefaultConfig(restCfg)\n\trestc, err := rest.RESTClientFor(restCfg)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn &Client{Client: client, Disco: disco, CoreRest: restc, Mapper: mapper}, nil\n}", "func New(c *Config) Client {\n\treturn newClient(c)\n}", "func NewClient(ctx context.Context, cfg ClientConfig) (*Client, error) {\n\tconfig := &tfe.Config{\n\t\tToken: cfg.Token,\n\t}\n\ttfeClient, err := tfe.NewClient(config)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"could not create a new TFE tfeClient: %w\", err)\n\t}\n\n\tw, err := tfeClient.Workspaces.Read(ctx, cfg.Organization, cfg.Workspace)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"could not retrieve workspace '%v/%v': %w\", cfg.Organization, cfg.Workspace, err)\n\t}\n\n\tc := Client{\n\t\tclient: tfeClient,\n\t\tworkspace: w,\n\t}\n\treturn &c, nil\n}", "func NewClient(config *Config) (*Client, error) {\n\tif !(config.Dimensionality > 0) {\n\t\treturn nil, fmt.Errorf(\"dimensionality must be >0\")\n\t}\n\n\treturn &Client{\n\t\tcoord: NewCoordinate(config),\n\t\torigin: NewCoordinate(config),\n\t\tconfig: config,\n\t\tadjustmentIndex: 0,\n\t\tadjustmentSamples: make([]float64, config.AdjustmentWindowSize),\n\t\tlatencyFilterSamples: make(map[string][]float64),\n\t}, nil\n}", "func (c *CategoryClient) Create() *CategoryCreate {\n\tmutation := newCategoryMutation(c.config, OpCreate)\n\treturn &CategoryCreate{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func NewClient(config *Config) *Client {\n\tc := &Client{config: defaultConfig.Merge(config)}\n\n\treturn c\n}", "func NewClient(config *config.Config, httpClient *http.Client) *Client {\n\treturn &Client{\n\t\tGetter: NewGetter(config, httpClient),\n\t}\n}", "func NewClient(config *Config) (*Client, error) {\n\tdefConfig := DefaultConfig()\n\n\tif len(config.Address) == 0 {\n\t\tconfig.Address = defConfig.Address\n\t}\n\n\tif len(config.Scheme) == 0 {\n\t\tconfig.Scheme = defConfig.Scheme\n\t}\n\n\tif config.HTTPClient == nil {\n\t\tconfig.HTTPClient = defConfig.HTTPClient\n\t}\n\n\tclient := &Client{\n\t\tConfig: *config,\n\t}\n\treturn client, nil\n}", "func NewClient(config *Configuration) (*Client, error) {\n\t// Check that authorization values are defined at all\n\tif config.AuthorizationHeaderToken == \"\" {\n\t\treturn nil, fmt.Errorf(\"No authorization is defined. You need AuthorizationHeaderToken\")\n\t}\n\n\tif config.ApplicationID == \"\" {\n\t\treturn nil, fmt.Errorf(\"ApplicationID is required - this is the only way to identify your requests in highwinds logs\")\n\t}\n\n\t// Configure the client from final configuration\n\tc := &Client{\n\t\tc: http.DefaultClient,\n\t\tDebug: config.Debug,\n\t\tApplicationID: config.ApplicationID,\n\t\tIdentity: &identity.Identification{\n\t\t\tAuthorizationHeaderToken: config.AuthorizationHeaderToken,\n\t\t},\n\t}\n\n\t// TODO eventually instantiate a custom client but not ready for that yet\n\n\t// Configure timeout on default client\n\tif config.Timeout == 0 {\n\t\tc.c.Timeout = time.Second * 10\n\t} else {\n\t\tc.c.Timeout = time.Second * time.Duration(config.Timeout)\n\t}\n\n\t// Set default headers\n\tc.Headers = c.GetHeaders()\n\treturn c, nil\n}", "func NewClient(kubeConfig *rest.Config) (client.Client, error) {\n\thttpClient, err := rest.HTTPClientFor(kubeConfig)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to create http client: %v\", err)\n\t}\n\tmapper, err := apiutil.NewDiscoveryRESTMapper(kubeConfig, httpClient)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to discover api rest mapper: %v\", err)\n\t}\n\tkubeClient, err := client.New(kubeConfig, client.Options{\n\t\tScheme: scheme,\n\t\tMapper: mapper,\n\t})\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to create kube client: %v\", err)\n\t}\n\treturn kubeClient, nil\n}", "func NewClient(config *ClientConfig) *Client {\n\tvar httpClient *http.Client\n\tvar logger LeveledLoggerInterface\n\n\tif config.HTTPClient == nil {\n\t\thttpClient = &http.Client{}\n\t} else {\n\t\thttpClient = config.HTTPClient\n\t}\n\n\tif config.Logger == nil {\n\t\tlogger = &LeveledLogger{Level: LevelError}\n\t} else {\n\t\tlogger = config.Logger\n\t}\n\n\treturn &Client{\n\t\tAPIToken: config.APIToken,\n\t\tLogger: logger,\n\n\t\tbaseURL: WaniKaniAPIURL,\n\t\thttpClient: httpClient,\n\t}\n}", "func NewClient(kubeconfig []byte) (Client, error) {\n\tc, err := NewClientset(kubeconfig)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed creating kubernetes clientset: %w\", err)\n\t}\n\n\treturn &client{c}, nil\n}", "func NewClient(cfg *Config) *Client {\n\treturn &Client{\n\t\tcfg: cfg,\n\t}\n}", "func NewClient(ctx context.Context, config *ClientConfig) (*Client, error) {\n\tc := &Client{\n\t\tconfig: config,\n\t}\n\tif err := c.Reconnect(ctx); err != nil {\n\t\treturn nil, err\n\t}\n\treturn c, nil\n}", "func NewClient(cfg Config) (*Client, error) {\n\tvar (\n\t\tc Client\n\t\tv *validator.Validate\n\t\terr error\n\t)\n\n\tv = validator.New()\n\n\terr = v.Struct(cfg)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tc.cfg = cfg\n\tc.clntCredCfg = clientcredentials.Config{\n\t\tClientID: cfg.ClientID,\n\t\tClientSecret: cfg.ClientSecret,\n\t}\n\n\tc.oauth = OAuth{\n\t\tClientID: cfg.ClientID,\n\t\tClientSecret: cfg.ClientSecret,\n\t}\n\n\terr = c.SetRegionParameters(cfg.Region, cfg.Locale)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn &c, nil\n}", "func NewClient(inClusterConfig bool, kubeconfig string) (kubernetes.Interface, error) {\n\tvar k8sconfig *rest.Config\n\tif inClusterConfig {\n\t\tvar err error\n\t\tk8sconfig, err = rest.InClusterConfig()\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"kubeconfig in-cluster configuration error. %+v\", err)\n\t\t}\n\t} else {\n\t\tvar kubeconfig string\n\t\t// Try to fallback to the `KUBECONFIG` env var\n\t\tif kubeconfig == \"\" {\n\t\t\tkubeconfig = os.Getenv(\"KUBECONFIG\")\n\t\t}\n\t\t// If the `KUBECONFIG` is empty, default to home dir default kube config path\n\t\tif kubeconfig == \"\" {\n\t\t\thome, err := homedir.Dir()\n\t\t\tif err != nil {\n\t\t\t\treturn nil, fmt.Errorf(\"kubeconfig unable to get home dir. %+v\", err)\n\t\t\t}\n\t\t\tkubeconfig = filepath.Join(home, \".kube\", \"config\")\n\t\t}\n\t\tvar err error\n\t\t// This will simply use the current context in the kubeconfig\n\t\tk8sconfig, err = clientcmd.BuildConfigFromFlags(\"\", kubeconfig)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"kubeconfig out-of-cluster configuration (%s) error. %+v\", kubeconfig, err)\n\t\t}\n\t}\n\n\t// Create the clientset\n\tclientset, err := kubernetes.NewForConfig(k8sconfig)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"kubernetes new client error. %+v\", err)\n\t}\n\treturn clientset, nil\n}", "func NewClient(ctx context.Context, config *ClientConfig, httpClient auth.HTTPClient) Client {\n\tif httpClient != nil {\n\t\treturn &serviceManagerClient{Context: ctx, Config: config, HTTPClient: httpClient}\n\t}\n\tccConfig := &clientcredentials.Config{\n\t\tClientID: config.ClientID,\n\t\tClientSecret: config.ClientSecret,\n\t\tTokenURL: config.TokenURL + tokenURLSuffix,\n\t\tAuthStyle: oauth2.AuthStyleInParams,\n\t}\n\n\tauthClient := auth.NewAuthClient(ccConfig, config.SSLDisabled)\n\treturn &serviceManagerClient{Context: ctx, Config: config, HTTPClient: authClient}\n}", "func NewClient(code string, clientID string, clientSecret string, redirectURL string) *Kounta {\n\treturn &Kounta{\n\t\tStoreCode: code,\n\t\tTimeout: defaultSendTimeout,\n\t\tRedirectURL: redirectURL,\n\t\tClientID: clientID,\n\t\tClientSecret: clientSecret,\n\t}\n}", "func NewClient(config *Config) (*Client, error) {\n\n\tconfig = DefaultConfig().Merge(config)\n\n\tif !strings.HasPrefix(config.Address, \"http\") {\n\t\tconfig.Address = \"http://\" + config.Address\n\t}\n\n\tif err := config.Validate(); err != nil {\n\t\treturn nil, err\n\t}\n\n\tclient := &Client{\n\t\tconfig: *config,\n\t\theaders: map[string]string{},\n\t\thttpClient: cleanhttp.DefaultClient(),\n\t}\n\n\treturn client, nil\n}", "func NewClient(config ClientConfig) (*Client, error) {\n\tvar baseURLToUse *url.URL\n\tvar err error\n\tif config.BaseURL == \"\" {\n\t\tbaseURLToUse, err = url.Parse(defaultBaseURL)\n\t} else {\n\t\tbaseURLToUse, err = url.Parse(config.BaseURL)\n\t}\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tc := &Client{\n\t\temail: config.Username,\n\t\tpassword: config.Password,\n\t\tbaseURL: baseURLToUse.String(),\n\t}\n\tc.client = http.DefaultClient\n\tc.InvitationService = &InvitationService{client: c}\n\tc.ActiveUserService = &ActiveUserService{client: c}\n\tc.UserService = &UserService{\n\t\tActiveUserService: c.ActiveUserService,\n\t\tInvitationService: c.InvitationService,\n\t}\n\treturn c, nil\n}", "func NewClient(cc ClientConfig, opts ...Option[http.Client]) (*http.Client, error) {\n\treturn NewClientCustom(cc, opts...)\n}", "func NewClient(config *Config) (*Client, error) {\n\tclient := new(Client)\n\terr := client.Init(config)\n\treturn client, err\n}", "func NewClient(config *Config) (*Client, error) {\n\tclient := new(Client)\n\terr := client.Init(config)\n\treturn client, err\n}", "func NewClient(config *Config) (*Client, error) {\n\tclient := new(Client)\n\terr := client.Init(config)\n\treturn client, err\n}", "func NewClient(config *Config) (*Client, error) {\n\tclient := new(Client)\n\terr := client.Init(config)\n\treturn client, err\n}", "func NewClient(config *Config) (*Client, error) {\n\tclient := new(Client)\n\terr := client.Init(config)\n\treturn client, err\n}", "func NewClient(config *Config) (*Client, error) {\n\tclient := new(Client)\n\terr := client.Init(config)\n\treturn client, err\n}", "func New(ctx context.Context, config Config) (*Client, error) {\n\terr := config.checkAndSetDefaults()\n\tif err != nil {\n\t\treturn nil, trace.Wrap(err)\n\t}\n\tc := &Client{Config: config}\n\tclient, err := c.connect(ctx)\n\tif err != nil {\n\t\treturn nil, trace.Wrap(err)\n\t}\n\tc.client = client\n\tc.addTerminationHandler()\n\treturn c, nil\n}", "func NewClient(config *Config) (c *Client, err error) {\n\tif config == nil {\n\t\treturn nil, errClientConfigNil\n\t}\n\n\tc = &Client{\n\t\trevocationTransport: http.DefaultTransport,\n\t}\n\n\tif c.transport, err = ghinstallation.NewAppsTransport(\n\t\thttp.DefaultTransport,\n\t\tint64(config.AppID),\n\t\t[]byte(config.PrvKey),\n\t); err != nil {\n\t\treturn nil, err\n\t}\n\n\tif c.url, err = url.ParseRequestURI(fmt.Sprintf(\n\t\t\"%s/app/installations/%v/access_tokens\",\n\t\tstrings.TrimSuffix(fmt.Sprint(config.BaseURL), \"/\"),\n\t\tconfig.InsID,\n\t)); err != nil {\n\t\treturn nil, err\n\t}\n\n\tif c.revocationURL, err = url.ParseRequestURI(fmt.Sprintf(\n\t\t\"%s/installation/token\",\n\t\tstrings.TrimSuffix(fmt.Sprint(config.BaseURL), \"/\"),\n\t)); err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn c, nil\n}", "func NewForConfig(config clientcmd.ClientConfig) (client *Client, err error) {\n\tif config == nil {\n\t\t// initialize client-go clients\n\t\tloadingRules := clientcmd.NewDefaultClientConfigLoadingRules()\n\t\tconfigOverrides := &clientcmd.ConfigOverrides{}\n\t\tconfig = clientcmd.NewNonInteractiveDeferredLoadingClientConfig(loadingRules, configOverrides)\n\t}\n\n\tclient = new(Client)\n\tclient.KubeConfig = config\n\n\tclient.KubeClientConfig, err = client.KubeConfig.ClientConfig()\n\tif err != nil {\n\t\treturn nil, errors.Wrapf(err, errorMsg)\n\t}\n\n\tclient.KubeClient, err = kubernetes.NewForConfig(client.KubeClientConfig)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tclient.Namespace, _, err = client.KubeConfig.Namespace()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tclient.OperatorClient, err = operatorsclientset.NewForConfig(client.KubeClientConfig)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tclient.DynamicClient, err = dynamic.NewForConfig(client.KubeClientConfig)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tclient.appsClient, err = appsclientset.NewForConfig(client.KubeClientConfig)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tclient.serviceCatalogClient, err = servicecatalogclienset.NewForConfig(client.KubeClientConfig)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tclient.discoveryClient, err = discovery.NewDiscoveryClientForConfig(client.KubeClientConfig)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tclient.checkIngressSupports = true\n\n\tclient.userClient, err = userclientset.NewForConfig(client.KubeClientConfig)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tclient.projectClient, err = projectclientset.NewForConfig(client.KubeClientConfig)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tclient.routeClient, err = routeclientset.NewForConfig(client.KubeClientConfig)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn client, nil\n}", "func GetClient(config Config) (*client.Client, error) {\n\topts := []client.Option{\n\t\tclient.WithNamespace(config.GetNamespace()),\n\t\tclient.WithScope(config.GetScope()),\n\t}\n\tmember := config.GetMember()\n\thost := config.GetHost()\n\tif host != \"\" {\n\t\topts = append(opts, client.WithPeerHost(config.GetHost()))\n\t\topts = append(opts, client.WithPeerPort(config.GetPort()))\n\t\tfor _, s := range serviceRegistry.services {\n\t\t\tservice := func(service cluster.Service) func(peer.ID, *grpc.Server) {\n\t\t\t\treturn func(id peer.ID, server *grpc.Server) {\n\t\t\t\t\tservice(cluster.NodeID(id), server)\n\t\t\t\t}\n\t\t\t}(s)\n\t\t\topts = append(opts, client.WithPeerService(service))\n\t\t}\n\t}\n\tif member != \"\" {\n\t\topts = append(opts, client.WithMemberID(config.GetMember()))\n\t} else if host != \"\" {\n\t\topts = append(opts, client.WithMemberID(config.GetHost()))\n\t}\n\n\treturn client.New(config.GetController(), opts...)\n}", "func NewClient(log logr.Logger, config *rest.Config) (*Client, error) {\n\tdiscoveryClient, err := discovery.NewDiscoveryClientForConfig(config)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &Client{\n\t\tdiscovery: discoveryClient,\n\t\tlog: log,\n\t\ttimeout: defaultTimeout,\n\t}, nil\n}", "func NewConsulClient(config types.ServiceConfig) (*consulClient, error) {\n\n\tclient := consulClient{\n\t\tconsulUrl: config.GetUrl(),\n\t\tconfigBasePath: config.BasePath,\n\t}\n\n\tif len(client.configBasePath) > 0 && client.configBasePath[len(client.configBasePath)-1:] != \"/\" {\n\t\tclient.configBasePath = client.configBasePath + \"/\"\n\t}\n\n\tvar err error\n\n\tclient.consulConfig = consulapi.DefaultConfig()\n\tclient.consulConfig.Token = config.AccessToken\n\tclient.consulConfig.Address = client.consulUrl\n\tclient.consulClient, err = consulapi.NewClient(client.consulConfig)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"unable for create new Consul Client for %s: %v\", client.consulUrl, err)\n\t}\n\n\treturn &client, nil\n}", "func NewClient(cfg *Config) *Client {\n\tcfg.init()\n\n\tc := Client{\n\t\tclient: &client{\n\t\t\tbaseClient: baseClient{\n\t\t\t\tcfg: cfg,\n\t\t\t\tconnPool: newConnPool(cfg),\n\t\t\t},\n\t\t},\n\t\tctx: context.Background(),\n\t}\n\tc.init()\n\n\treturn &c\n}", "func NewClient(httpClient *http.Client, c ClientConfig) Client {\n\treturn Client{\n\t\thttpClient: *httpClient,\n\t\tconfig: c,\n\t}\n}", "func NewClient() (*Client, error) {\n\tconfig, err := rest.InClusterConfig()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\ttypes := runtime.NewScheme()\n\tschemeBuilder := runtime.NewSchemeBuilder(\n\t\tfunc(scheme *runtime.Scheme) error {\n\t\t\treturn nil\n\t\t})\n\n\terr = schemeBuilder.AddToScheme(types)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tclient, err := newClientForAPI(config, v1alpha1.GroupVersion, types)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &Client{\n\t\tclient: client,\n\t}, err\n}", "func NewClient(config Config) (*Client, error) {\n\n\tswitch {\n\tcase config.URL == \"\":\n\t\treturn &Client{}, ErrNoAPIURL\n\tcase config.OAPIKey == \"\":\n\t\treturn &Client{}, ErrNoOAPIKey\n\tcase config.OAPISecret == \"\":\n\t\treturn &Client{}, ErrNoOAPISecret\n\tcase config.AuthKey == \"\":\n\t\treturn &Client{}, ErrNoAuthKey\n\tcase config.AuthSecret == \"\":\n\t\treturn &Client{}, ErrNoAuthSecret\n\tcase config.ComplianceDate == \"\":\n\t\treturn &Client{}, ErrNoComplianceDate\n\tcase !regexp.MustCompile(`^\\d{8}$`).MatchString(config.ComplianceDate):\n\t\treturn &Client{}, ErrNoComplianceDate\n\t}\n\n\t_, err := url.ParseRequestURI(config.URL)\n\tif err != nil {\n\t\treturn &Client{}, ErrInvalidURL\n\t}\n\n\tparts := strings.Split(config.URL, \"//\")\n\tif len(parts) < 2 {\n\t\treturn &Client{}, ErrInvalidURL\n\t}\n\n\tconfig.OAPIURL = fmt.Sprintf(\"%s//%s:%s@%s\",\n\t\tparts[0], config.OAPIKey, config.OAPISecret, parts[1],\n\t)\n\n\treturn &Client{\n\t\tclient: &API{\n\t\t\tConfig: config,\n\t\t},\n\t}, nil\n}", "func NewClient(cfg *restclient.Config) (Client, error) {\n\tresult := &client{}\n\tc, err := dynamic.NewForConfig(cfg)\n\tif err != nil {\n\t\tmsg := fmt.Sprintf(\"Failed to create client, with error: %v\", err)\n\t\tlog.Printf(\"[Error] %s\", msg)\n\t\treturn nil, fmt.Errorf(msg)\n\t}\n\tresult.dynamicClient = c\n\treturn result, nil\n}", "func New(cfg client.Config) (client.Client, error) {\n\treturn client.New(cfg)\n}", "func NewClient(kubeConfig string) (client *Client, err error) {\n\tconfig, err := GetClientConfig(kubeConfig)\n\tif err != nil {\n\t\treturn nil, trace.Wrap(err)\n\t}\n\n\tclientset, err := kubernetes.NewForConfig(config)\n\tif err != nil {\n\t\treturn nil, trace.Wrap(err)\n\t}\n\n\textClientset, err := apiextensionsclientset.NewForConfig(config)\n\tif err != nil {\n\t\treturn nil, trace.Wrap(err)\n\t}\n\n\treturn &Client{\n\t\tClient: clientset,\n\t\tExtClient: extClientset,\n\t}, nil\n}", "func New(masterUrl,kubeconfig string)(*Client,error){\n // use the current context in kubeconfig\n config, err := clientcmd.BuildConfigFromFlags(masterUrl, kubeconfig)\n if err != nil {\n\t return nil,err\n }\n\n // create the clientset\n clientset, err := kubernetes.NewForConfig(config)\n if err!=nil{\n\t\treturn nil,err\n }\n return &Client{cset:clientset},nil\n}", "func newClient(ctx context.Context, cfg oconf.Config) (*client, error) {\n\tc := &client{\n\t\texportTimeout: cfg.Metrics.Timeout,\n\t\trequestFunc: cfg.RetryConfig.RequestFunc(retryable),\n\t\tconn: cfg.GRPCConn,\n\t}\n\n\tif len(cfg.Metrics.Headers) > 0 {\n\t\tc.metadata = metadata.New(cfg.Metrics.Headers)\n\t}\n\n\tif c.conn == nil {\n\t\t// If the caller did not provide a ClientConn when the client was\n\t\t// created, create one using the configuration they did provide.\n\t\tconn, err := grpc.DialContext(ctx, cfg.Metrics.Endpoint, cfg.DialOptions...)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\t// Keep track that we own the lifecycle of this conn and need to close\n\t\t// it on Shutdown.\n\t\tc.ourConn = true\n\t\tc.conn = conn\n\t}\n\n\tc.msc = colmetricpb.NewMetricsServiceClient(c.conn)\n\n\treturn c, nil\n}", "func NewClient(config *latest.Config, kubeClient kubectl.Client, dockerClient docker.Client, log log.Logger) Client {\n\treturn &client{\n\t\tconfig: config,\n\t\tkubeClient: kubeClient,\n\t\tdockerClient: dockerClient,\n\t\tlog: log,\n\t}\n}", "func NewClient(config *Config) *Client {\n\tif config == nil {\n\t\tc := defaultConfig\n\t\tconfig = &c\n\t}\n\tif config.httpClient == nil {\n\t\tconfig.httpClient = http.DefaultClient\n\t}\n\tbaseURL, _ := url.Parse(defaultBaseURL)\n\n\tc := &Client{\n\t\tconfig: config,\n\t\tbaseURL: baseURL,\n\t\tuserAgent: userAgent,\n\t}\n\n\tc.common.client = c\n\tc.Candidates = (*CandidatesService)(&c.common)\n\treturn c\n}", "func NewClient(kubeConfig string, opts ...ClientOption) (*Client, error) {\n\toptions := clientOptions{ // Default options\n\t\tNamespace: \"default\",\n\t\tDriver: \"secrets\",\n\t\tDebugLog: func(format string, v ...interface{}) {},\n\t}\n\tfor _, opt := range opts {\n\t\topt.apply(&options)\n\t}\n\t// Create actionConfig, which will be used for all actions of this helm client.\n\tactionConfig := new(action.Configuration)\n\tclientGetter := &restClientGetter{\n\t\tNamespace: options.Namespace,\n\t\tKubeConfig: kubeConfig,\n\t}\n\tif err := actionConfig.Init(clientGetter, options.Namespace, options.Driver, options.DebugLog); err != nil {\n\t\treturn nil, err\n\t}\n\tc := &Client{\n\t\tkubeConfig: kubeConfig,\n\t\toptions: options,\n\t\tactionConfig: actionConfig,\n\t\trepoFile: repo.NewFile(),\n\t}\n\tif err := c.setupDirs(); err != nil {\n\t\tc.Close()\n\t\treturn nil, err\n\t}\n\treturn c, nil\n}", "func NewClient(consulAddr, consulPort, consulToken string) (Consul *api.Client, err error) {\n\tconfig := api.DefaultConfig()\n\tconfig.Address = consulAddr + \":\" + consulPort\n\tconfig.Token = consulToken\n\tconsul, err := api.NewClient(config)\n\tif err != nil {\n\t\tfmt.Println(\"error connecting to consul \", err)\n\t}\n\treturn consul, err\n}", "func NewClient(config *Config) *Client {\n\ttr := config.Transport()\n\n\treturn &Client{\n\t\tconfig: config.Clone(),\n\t\ttr: tr,\n\t\tclient: &http.Client{Transport: tr},\n\t}\n}", "func NewClient(config *ClientConfig) (client *Client, err error) {\n\n\tclient = &Client{\n\t\tconnection: &connectionTracker{\n\t\t\tstate: INITIAL,\n\t\t\thostPortStr: net.JoinHostPort(config.DNSOrIPAddr, fmt.Sprintf(\"%d\", config.Port)),\n\t\t},\n\t\tcb: config.Callbacks,\n\t\tkeepAlivePeriod: config.KeepAlivePeriod,\n\t\tdeadlineIO: config.DeadlineIO,\n\t\tlogger: config.Logger,\n\t}\n\n\tif client.logger == nil {\n\t\tvar logBuf bytes.Buffer\n\t\tclient.logger = log.New(&logBuf, \"\", 0)\n\t}\n\n\tclient.outstandingRequest = make(map[requestID]*reqCtx)\n\tclient.bt = btree.New(2)\n\n\tif config.RootCAx509CertificatePEM == nil {\n\t\tclient.connection.useTLS = false\n\t\tclient.connection.tlsConn = nil\n\t\tclient.connection.x509CertPool = nil\n\t} else {\n\t\tclient.connection.useTLS = true\n\t\tclient.connection.netConn = nil\n\t\t// Add cert for root CA to our pool\n\t\tclient.connection.x509CertPool = x509.NewCertPool()\n\t\tok := client.connection.x509CertPool.AppendCertsFromPEM(config.RootCAx509CertificatePEM)\n\t\tif !ok {\n\t\t\terr = fmt.Errorf(\"x509CertPool.AppendCertsFromPEM() returned !ok\")\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\treturn client, err\n}", "func NewClient(kubeconfig string) (*Client, error) {\n\tconfig, err := clientcmd.BuildConfigFromFlags(\"\", kubeconfig)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tclient, err := kubernetes.NewForConfig(config)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn client, nil\n}", "func New(cfg *Config) *Client {\n\treturn &Client{\n\t\tcfg: cfg,\n\t}\n}", "func NewClient(cfg *Config) (*Client, error) {\r\n\tBaseURL := new(url.URL)\r\n\tvar err error\r\n\r\n\tviper.SetEnvPrefix(\"TS\")\r\n\tviper.BindEnv(\"LOG\")\r\n\r\n\tswitch l := viper.Get(\"LOG\"); l {\r\n\tcase \"trace\":\r\n\t\tlog.SetLevel(log.TraceLevel)\r\n\tcase \"debug\":\r\n\t\tlog.SetLevel(log.DebugLevel)\r\n\tcase \"info\":\r\n\t\tlog.SetLevel(log.InfoLevel)\r\n\tcase \"warn\":\r\n\t\tlog.SetLevel(log.WarnLevel)\r\n\tcase \"fatal\":\r\n\t\tlog.SetLevel(log.FatalLevel)\r\n\tcase \"panic\":\r\n\t\tlog.SetLevel(log.PanicLevel)\r\n\t}\r\n\r\n\tif cfg.BaseURL != \"\" {\r\n\t\tBaseURL, err = url.Parse(cfg.BaseURL)\r\n\t\tif err != nil {\r\n\t\t\treturn nil, err\r\n\t\t}\r\n\t} else {\r\n\t\tBaseURL, err = url.Parse(defaultBaseURL)\r\n\t\tif err != nil {\r\n\t\t\treturn nil, err\r\n\t\t}\r\n\t}\r\n\r\n\tnewClient := &Client{\r\n\t\tBaseURL: BaseURL,\r\n\t\tclient: http.DefaultClient,\r\n\t\tcreds: &Credentials{\r\n\t\t\tAPIKey: cfg.APIKey,\r\n\t\t\tOrganizationID: cfg.OrganizationID,\r\n\t\t\tUserID: cfg.UserID,\r\n\t\t},\r\n\t}\r\n\r\n\tnewClient.Rulesets = &RulesetService{newClient}\r\n\tnewClient.Rules = &RuleService{newClient}\r\n\r\n\treturn newClient, nil\r\n}", "func NewClient(c *Config) *Client {\n\treturn &Client{\n\t\tBaseURL: BaseURLV1,\n\t\tUname: c.Username,\n\t\tPword: c.Password,\n\t\tHTTPClient: &http.Client{\n\t\t\tTimeout: time.Minute,\n\t\t},\n\t}\n}", "func NewClient(cfg clients.Config, hc *http.Client) (Client, error) {\n\treturn clients.NewClient(cfg, hc)\n}", "func NewClient(cfg clients.Config, hc *http.Client) (Client, error) {\n\treturn clients.NewClient(cfg, hc)\n}", "func NewCFClient(config *models.Configuration) (*cfclient.Client, error) {\n\tclientConf := &cfclient.Config{\n\t\tApiAddress: config.CFAPIAddr,\n\t\tUsername: config.CFUsername,\n\t\tPassword: config.CFPassword,\n\t\tHttpClient: cleanhttp.DefaultClient(),\n\t}\n\trootCAs, err := x509.SystemCertPool()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif rootCAs == nil {\n\t\trootCAs = x509.NewCertPool()\n\t}\n\tfor _, certificate := range config.CFAPICertificates {\n\t\tif ok := rootCAs.AppendCertsFromPEM([]byte(certificate)); !ok {\n\t\t\treturn nil, fmt.Errorf(\"couldn't append CF API cert to trust: %s\", certificate)\n\t\t}\n\t}\n\ttlsConfig := &tls.Config{\n\t\tRootCAs: rootCAs,\n\t}\n\tclientConf.HttpClient.Transport = &http.Transport{TLSClientConfig: tlsConfig}\n\treturn cfclient.NewClient(clientConf)\n}", "func New(config *rest.Config) (Client, error) {\n\tkubeset, err := kubernetes.NewForConfig(config)\n\tif err != nil {\n\t\treturn Client{}, err\n\t}\n\treturn Client{\n\t\tkubeset: kubeset,\n\t}, nil\n}", "func NewClient(cfg *Config, args ...interface{}) (endpoint.Connector, error) {\n\treturn cfg.newClient(args)\n}", "func NewComplaintTypeClient(c config) *ComplaintTypeClient {\n\treturn &ComplaintTypeClient{config: c}\n}", "func NewClient(config *Config, token string) (Client, error) {\n\tif config == nil {\n\t\tconfig = &Config{Config: api.DefaultConfig()}\n\t}\n\tclient, err := api.NewClient(config.Config)\n\tif err != nil {\n\t\treturn Client{}, err\n\t}\n\n\tif config.Namespace != \"\" {\n\t\tclient.SetNamespace(config.Namespace)\n\t}\n\n\tclient.SetToken(token)\n\tlog.Entry().Debugf(\"Login to Vault %s in namespace %s successfull\", config.Address, config.Namespace)\n\treturn Client{client.Logical(), config}, nil\n}", "func (c *Config) NewClient(database string) *Client {\n\treturn &Client{\n\t\tconfig: *c,\n\t\tdatabaseName: database,\n\t}\n}", "func NewClient(cfg *ClientConfig) (*Client, error) {\n\tclient := cfg.Client\n\n\tif client == nil {\n\t\tclient = http.DefaultClient\n\t}\n\n\tendpointURL, err := url.Parse(cfg.URL)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"malformed URL\")\n\t}\n\n\tif endpointURL.Scheme == \"\" {\n\t\treturn nil, fmt.Errorf(\"missing URL scheme\")\n\t}\n\n\tif endpointURL.Host == \"\" {\n\t\treturn nil, fmt.Errorf(\"missing URL host\")\n\t}\n\n\tendpointURL.User = nil\n\tendpointURL.RawQuery = \"\"\n\tendpointURL.Fragment = \"\"\n\n\treturn &Client{\n\t\turl: endpointURL.String(),\n\t\tclient: client,\n\t}, nil\n}", "func (c Config) NewClient(tok oauth2.Token) *Client {\n\tts := tokenSource{\n\t\ttoken: tok,\n\t\tconfig: c,\n\t}\n\t_ = ts\n\tb, _ := url.Parse(c.BaseURL)\n\treturn &Client{\n\t\tTokenSource: ts,\n\t\tClient: http.Client{\n\t\t\tTransport: &oauth2.Transport{\n\t\t\t\tBase: &Transport{BaseURL: b},\n\t\t\t\tSource: ts,\n\t\t\t},\n\t\t},\n\t}\n}", "func NewClient(config *Settings) (*PlatformClient, error) {\n\tif err := config.Validate(); err != nil {\n\t\treturn nil, err\n\t}\n\tcfClient, err := config.CF.CFClientProvider(&config.CF.Config)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn &PlatformClient{\n\t\tclient: cfClient,\n\t\tsettings: config,\n\t\tplanResolver: NewPlanResolver(),\n\t}, nil\n}", "func NewClient(config *Config) (*Client, error) {\n\t// bootstrap the config\n\tdefConfig := DefaultConfig()\n\n\tif config.Address == \"\" {\n\t\tconfig.Address = defConfig.Address\n\t} else if _, err := url.Parse(config.Address); err != nil {\n\t\treturn nil, fmt.Errorf(\"invalid address '%s': %v\", config.Address, err)\n\t}\n\n\thttpClient := config.HttpClient\n\tif httpClient == nil {\n\t\thttpClient = defaultHttpClient()\n\t\tif err := ConfigureTLS(httpClient, config.TLSConfig); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\tclient := &Client{\n\t\tconfig: *config,\n\t\thttpClient: httpClient,\n\t}\n\treturn client, nil\n}", "func NewClinicClient(c config) *ClinicClient {\n\treturn &ClinicClient{config: c}\n}", "func NewClient(config Config) Client {\n\ttyp := config.Type()\n\n\tswitch typ {\n\tcase Bolt:\n\t\tbe := NewBoltBackend(config.(*BoltConfig))\n\t\t// TODO: Return an error instead of panicking.\n\t\tif err := be.Open(); err != nil {\n\t\t\tpanic(fmt.Errorf(\"Opening bolt backend: %s\", err))\n\t\t}\n\t\tq := NewBoltQueue(be.db)\n\t\treturn newKVClient(be, q)\n\n\tcase Rocks:\n\t\t// MORE TEMPORARY UGLINESS TO MAKE IT WORK FOR NOW:\n\t\tif err := os.MkdirAll(config.(*RocksConfig).Dir, os.FileMode(int(0700))); err != nil {\n\t\t\tpanic(fmt.Errorf(\"Creating rocks directory %q: %s\", config.(*RocksConfig).Dir, err))\n\t\t}\n\t\tbe := NewRocksBackend(config.(*RocksConfig))\n\t\tqueueFile := filepath.Join(config.(*RocksConfig).Dir, DefaultBoltQueueFilename)\n\t\tdb, err := bolt.Open(queueFile, 0600, NewBoltConfig(\"\").BoltOptions)\n\t\tif err != nil {\n\t\t\tpanic(fmt.Errorf(\"Creating bolt queue: %s\", err))\n\t\t}\n\t\tq := NewBoltQueue(db)\n\t\treturn newKVClient(be, q)\n\n\tcase Postgres:\n\t\tbe := NewPostgresBackend(config.(*PostgresConfig))\n\t\tq := NewPostgresQueue(config.(*PostgresConfig))\n\t\treturn newKVClient(be, q)\n\n\tdefault:\n\t\tpanic(fmt.Errorf(\"no client constructor available for db configuration type: %v\", typ))\n\t}\n}", "func NewComplaintClient(c config) *ComplaintClient {\n\treturn &ComplaintClient{config: c}\n}", "func NewClient(config *cfg.ProxyConfig, cancel context.CancelFunc) (client *proxy.Client) {\n\tclient, _ = proxy.NewClient(config, ns, cancel)\n\treturn\n}", "func NewClient(config *cfg.ProxyConfig, cancel context.CancelFunc) (client *proxy.Client) {\n\tclient, _ = proxy.NewClient(config, ns, cancel)\n\treturn\n}", "func NewConsulClient(config *ConsulConfig) (IRegistry, error) {\n\tclient, err := api.NewClient(&config.Config)\n\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn &ConsulClient{\n\t\tclient: client,\n\t}, nil\n}", "func NewClient(config ClientConfig) (Client, error) {\n\tvar restConfig *rest.Config\n\tif config.Server == \"\" && config.Kubeconfig == \"\" {\n\t\t// If no API server address or kubeconfig was provided, assume we are running\n\t\t// inside a pod. Try to connect to the API server through its\n\t\t// Service environment variables, using the default Service\n\t\t// Account Token.\n\t\tvar err error\n\t\tif restConfig, err = rest.InClusterConfig(); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t} else {\n\t\tvar err error\n\t\trestConfig, err = clientcmd.NewNonInteractiveDeferredLoadingClientConfig(\n\t\t\t&clientcmd.ClientConfigLoadingRules{ExplicitPath: config.Kubeconfig},\n\t\t\t&clientcmd.ConfigOverrides{\n\t\t\t\tAuthInfo: clientcmdapi.AuthInfo{\n\t\t\t\t\tClientCertificate: config.ClientCertificate,\n\t\t\t\t\tClientKey: config.ClientKey,\n\t\t\t\t\tToken: config.Token,\n\t\t\t\t\tUsername: config.Username,\n\t\t\t\t\tPassword: config.Password,\n\t\t\t\t},\n\t\t\t\tClusterInfo: clientcmdapi.Cluster{\n\t\t\t\t\tServer: config.Server,\n\t\t\t\t\tInsecureSkipTLSVerify: config.Insecure,\n\t\t\t\t\tCertificateAuthority: config.CertificateAuthority,\n\t\t\t\t},\n\t\t\t\tContext: clientcmdapi.Context{\n\t\t\t\t\tCluster: config.Cluster,\n\t\t\t\t\tAuthInfo: config.User,\n\t\t\t\t},\n\t\t\t\tCurrentContext: config.Context,\n\t\t\t},\n\t\t).ClientConfig()\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\tlog.Infof(\"kubernetes: targeting api server %s\", restConfig.Host)\n\n\tc, err := kubernetes.NewForConfig(restConfig)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tsc, err := snapshot.NewForConfig(restConfig)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tmc, err := mayaclient.NewForConfig(restConfig)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tcsc, err := csisnapshot.NewForConfig(restConfig)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tcc, err := cstorclient.NewForConfig(restConfig)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tresult := &client{\n\t\tquit: make(chan struct{}),\n\t\tclient: c,\n\t\tsnapshotClient: sc,\n\t\tmayaClient: mc,\n\t\tcsiSnapshotClient: csc,\n\t\tcstorClient: cc,\n\t}\n\n\tresult.podStore = NewEventStore(result.triggerPodWatches, cache.MetaNamespaceKeyFunc)\n\tresult.runReflectorUntil(\"pods\", result.podStore)\n\n\tresult.serviceStore = result.setupStore(\"services\")\n\tresult.nodeStore = result.setupStore(\"nodes\")\n\tresult.namespaceStore = result.setupStore(\"namespaces\")\n\tresult.deploymentStore = result.setupStore(\"deployments\")\n\tresult.daemonSetStore = result.setupStore(\"daemonsets\")\n\tresult.jobStore = result.setupStore(\"jobs\")\n\tresult.statefulSetStore = result.setupStore(\"statefulsets\")\n\tresult.cronJobStore = result.setupStore(\"cronjobs\")\n\tresult.persistentVolumeStore = result.setupStore(\"persistentvolumes\")\n\tresult.persistentVolumeClaimStore = result.setupStore(\"persistentvolumeclaims\")\n\tresult.storageClassStore = result.setupStore(\"storageclasses\")\n\tresult.volumeSnapshotStore = result.setupStore(\"volumesnapshots\")\n\tresult.volumeSnapshotDataStore = result.setupStore(\"volumesnapshotdatas\")\n\tresult.diskStore = result.setupStore(\"disks\")\n\tresult.storagePoolClaimStore = result.setupStore(\"storagepoolclaims\")\n\tresult.cStorvolumeStore = result.setupStore(\"cstorvolumes\")\n\tresult.cStorvolumeReplicaStore = result.setupStore(\"cstorvolumereplicas\")\n\tresult.cStorPoolStore = result.setupStore(\"cstorpools\")\n\tresult.blockDeviceStore = result.setupStore(\"blockdevices\")\n\tresult.blockDeviceClaimStore = result.setupStore(\"blockdeviceclaims\")\n\tresult.cStorPoolClusterStore = result.setupStore(\"cstorpoolclusters\")\n\tresult.cStorPoolInstanceStore = result.setupStore(\"cstorpoolinstances\")\n\tresult.csiVolumeSnapshotStore = result.setupStore(\"csivolumesnapshots\")\n\tresult.volumeSnapshotClassStore = result.setupStore(\"volumesnapshotclasses\")\n\tresult.volumeSnapshotContentStore = result.setupStore(\"volumesnapshotcontents\")\n\n\treturn result, nil\n}", "func CreateNewConfigClient(endpoints []string, appKey string, env ServerEnvironmentType, org ConfigStructureType) (*ConfigClient, error) {\n\tvar err error\n\n\tw := ConfigClient{\n\t\tEndpoints: endpoints,\n\t\tAppKey: appKey,\n\t\tEnv: env,\n\t\tOrg: org,\n\t\tshutdown: make(chan struct{}),\n\t\tshutdownInvoked: false,\n\t\taddCh: make(chan *watcherInfo),\n\t\tremoveCh: make(chan string),\n\t}\n\n\tw.etcd, err = clientv3.New(clientv3.Config{\n\t\tEndpoints: endpoints,\n\t\tDialTimeout: etcdServiceDialTimeout,\n\t})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tconn := w.etcd.ActiveConnection()\n\tif conn == nil {\n\t\treturn nil, errors.New(\"no active connection\")\n\t}\n\n\tconn.GetState()\n\n\tgo w.runLoop()\n\n\treturn &w, nil\n}", "func New(c Config) pkg.HelmClient {\n\treturn &Client{\n\t\tconf: &c,\n\t\tcli: httpclient.NewHttpClient(),\n\t}\n}", "func NewClient(c Config) *Client {\n\tif c.Timeout == 0 {\n\t\tc.Timeout = defaultReqTimeout\n\t}\n\n\treturn &Client{\n\t\tconf: c,\n\t}\n}", "func NewClient(config *Config, client *http.Client, authType cauth.IAuth) (*Client, error) {\n\t// set up the transport layer\n\t// allow 100 concurrent connection in the connection pool\n\tif client.Transport == nil {\n\t\tt := http.Transport{}\n\t\tclient.Transport = &t\n\t}\n\tt := client.Transport.(*http.Transport).Clone()\n\tt.MaxIdleConns = maxIdleConns\n\tt.MaxConnsPerHost = maxConnsPerHost\n\tt.MaxIdleConnsPerHost = maxIdleConnsPerHost\n\t// override transport\n\tclient.Transport = t\n\n\tif config == nil {\n\t\treturn nil, errors.New(\"config is empty\")\n\t}\n\tif authType == nil {\n\t\treturn nil, errors.New(\"auth type is not defined\")\n\t}\n\treturn &Client{client: *client, config: config, authType: authType}, nil\n}", "func NewClient(kubeconfig string) (client versioned.Interface, err error) {\n\tvar config *rest.Config\n\tconfig, err = getConfig(kubeconfig)\n\tif err != nil {\n\t\treturn\n\t}\n\treturn versioned.NewForConfig(config)\n}", "func NewClient(cfg *config.Configuration) (*Client, error) {\n\trc, err := rest.New(Url)\n\tif err != nil {\n\t\treturn &Client{}, err\n\t}\n\n\tclient := &Client{\n\t\tconfig: cfg,\n\t\tclient: rc,\n\t\tlimiter: rate.NewLimiter(30, 5),\n\t}\n\n\treturn client, nil\n}", "func NewClient(config Config, opts ...Option) (*Client, error) {\n\tconfig.applyDefaults()\n\tif !path.IsAbs(config.RootDirectory) {\n\t\treturn nil, errors.New(\"invalid config: root_directory must be absolute path\")\n\t}\n\tpather, err := namepath.New(config.RootDirectory, config.NamePath)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"namepath: %s\", err)\n\t}\n\twebhdfs, err := webhdfs.NewClient(config.WebHDFS, config.NameNodes, config.UserName)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tclient := &Client{config, pather, webhdfs}\n\tfor _, opt := range opts {\n\t\topt(client)\n\t}\n\treturn client, nil\n}", "func NewClient(sclient SClientFactory, kclient servicecatalogclient.Interface) ClientInterface {\n\treturn &Client{\n\t\tcreateSvcatClient: sclient,\n\t\tkclient: kclient,\n\t}\n}", "func CategoryNew(c *gin.Context) {\n\th := helpers.DefaultH(c)\n\th[\"Title\"] = \"New Category\"\n\th[\"Active\"] = \"categories\"\n\tsession := sessions.Default(c)\n\th[\"Flash\"] = session.Flashes()\n\tsession.Save()\n\n\tc.HTML(http.StatusOK, \"admin/categories/form\", h)\n}", "func NewClient(registry *syncbase.Registry, dispatcher orchestrator.Dispatcher) ConfigClient {\n\treturn &client{\n\t\tregistry: registry,\n\t\tdispatcher: dispatcher,\n\t}\n}", "func New(config *rest.Config, options Options) (c Client, err error) {\n\tc, err = newClient(config, options)\n\tif err == nil && options.DryRun != nil && *options.DryRun {\n\t\tc = NewDryRunClient(c)\n\t}\n\treturn c, err\n}", "func New(config ClientConfig) (Client, error) {\n\tvar err error\n\n\tclient := Client{collections: make(map[string]*mongo.Collection)}\n\tclientOptions := options.Client().ApplyURI(config.url())\n\n\t// Connect to MongoDB\n\tif client.client, err = mongo.Connect(context.TODO(), clientOptions); err != nil {\n\t\treturn client, err\n\t}\n\n\t// Check the connection\n\tif err = client.client.Ping(context.TODO(), nil); err != nil {\n\t\treturn client, err\n\t}\n\n\tclient.database = client.client.Database(config.Database)\n\n\treturn client, nil\n}", "func NewClientFromConfig() *Client {\n\treturn &Client{\n\t\tregistry: config.GlobalConfig.Registry,\n\t\torganization: config.GlobalConfig.Organization,\n\t\tusername: config.GlobalConfig.Username,\n\t\tpassword: config.GlobalConfig.Password,\n\t\tcopyTimeoutSeconds: config.GlobalConfig.ImageCopyTimeoutSeconds,\n\t\ttransport: defaultSkopeoTransport,\n\t}\n}", "func NewClient(cfg Config, l *logrus.Logger) (*Client, error) {\n\tctx := context.Background()\n\tkClient := gocloak.NewClient(cfg.Host)\n\tadmin, err := kClient.Login(ctx, adminClientID, cfg.AdminSecret, cfg.AdminRealm, cfg.AdminUser, cfg.AdminPassword)\n\tif err != nil {\n\t\tl.Errorf(\"NewClient\", err, \"failed to log admin user in\")\n\t\treturn nil, err\n\t}\n\tclients, err := kClient.GetClients(ctx, admin.AccessToken, cfg.ClientRealm, gocloak.GetClientsParams{ClientID: &cfg.ClientID})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif len(clients) == 0 {\n\t\treturn nil, ErrClientNotFound\n\t}\n\n\treturn &Client{\n\t\tcfg: cfg,\n\t\tctx: ctx,\n\t\tkc: kClient,\n\t\tac: &adminClient{\n\t\t\tadmin: admin,\n\t\t\taccessExpiry: time.Now().Add(time.Second * time.Duration(admin.ExpiresIn)),\n\t\t\trefreshExpiry: time.Now().Add(time.Second * time.Duration(admin.RefreshExpiresIn)),\n\t\t},\n\t\tclient: keycloakClient{\n\t\t\tid: *clients[0].ID,\n\t\t\tclientID: *clients[0].ClientID,\n\t\t},\n\t\trealm: cfg.ClientRealm,\n\t\tiss: cfg.Host + \"/auth/realms/\" + cfg.ClientRealm,\n\t\tl: l,\n\t}, nil\n}" ]
[ "0.6733464", "0.66675985", "0.6077329", "0.60282415", "0.5987572", "0.5937696", "0.5937696", "0.5856731", "0.5856616", "0.5805806", "0.5798859", "0.57917327", "0.5790162", "0.5780621", "0.57736504", "0.57537186", "0.5664101", "0.5651375", "0.56501037", "0.56478727", "0.56322944", "0.5612411", "0.5604905", "0.55969095", "0.5592021", "0.55870044", "0.5581318", "0.5569875", "0.5559578", "0.554897", "0.55427605", "0.5500956", "0.5496735", "0.54819816", "0.5471753", "0.5426049", "0.54255676", "0.54255676", "0.54255676", "0.54255676", "0.54255676", "0.54255676", "0.5413715", "0.5404944", "0.5402855", "0.5401196", "0.5398011", "0.53943896", "0.5394145", "0.53927076", "0.5392374", "0.5375557", "0.53709763", "0.53704697", "0.5360725", "0.53594613", "0.535698", "0.53530747", "0.533519", "0.53213537", "0.53175235", "0.5309512", "0.5308153", "0.53074557", "0.52983284", "0.52936804", "0.5289678", "0.5288967", "0.5288967", "0.5286541", "0.5283426", "0.5277471", "0.5276884", "0.5269332", "0.5266256", "0.5263614", "0.52579814", "0.5257668", "0.5256901", "0.5254283", "0.52442735", "0.5237415", "0.52364504", "0.52364504", "0.52337235", "0.52329385", "0.5225414", "0.5218537", "0.521494", "0.52080077", "0.5194208", "0.5191509", "0.51905555", "0.5190262", "0.5189582", "0.51873213", "0.5183083", "0.51809525", "0.5179309", "0.51736313" ]
0.7370588
0
Use adds a list of mutation hooks to the hooks stack. A call to `Use(f, g, h)` equals to `category.Hooks(f(g(h())))`.
func (c *CategoryClient) Use(hooks ...Hook) { c.hooks.Category = append(c.hooks.Category, hooks...) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (ms *MiddlewareStack) Use(mw ...MiddlewareFunc) {\n\tms.stack = append(ms.stack, mw...)\n}", "func (ms *MiddlewareStack) Use(mw ...MiddlewareFunc) {\n\tms.stack = append(ms.stack, mw...)\n}", "func (c *StatustClient) Use(hooks ...Hook) {\n\tc.hooks.Statust = append(c.hooks.Statust, hooks...)\n}", "func (em *entityManager) Use(mw ...MiddlewareFunc) {\n\tem.mwStack = append(em.mwStack, mw...)\n}", "func (c *TagClient) Use(hooks ...Hook) {\n\tc.hooks.Tag = append(c.hooks.Tag, hooks...)\n}", "func (c *FoodmenuClient) Use(hooks ...Hook) {\n\tc.hooks.Foodmenu = append(c.hooks.Foodmenu, hooks...)\n}", "func (f *Flame) Use(handlers ...Handler) {\n\tvalidateAndWrapHandlers(handlers, nil)\n\tf.handlers = append(f.handlers, handlers...)\n}", "func (c *EatinghistoryClient) Use(hooks ...Hook) {\n\tc.hooks.Eatinghistory = append(c.hooks.Eatinghistory, hooks...)\n}", "func (c *ToolClient) Use(hooks ...Hook) {\n\tc.hooks.Tool = append(c.hooks.Tool, hooks...)\n}", "func (c *AdminClient) Use(hooks ...Hook) {\n\tc.hooks.Admin = append(c.hooks.Admin, hooks...)\n}", "func (c *BranchClient) Use(hooks ...Hook) {\n\tc.hooks.Branch = append(c.hooks.Branch, hooks...)\n}", "func (c *SituationClient) Use(hooks ...Hook) {\n\tc.hooks.Situation = append(c.hooks.Situation, hooks...)\n}", "func (c *WorkExperienceClient) Use(hooks ...Hook) {\n\tc.hooks.WorkExperience = append(c.hooks.WorkExperience, hooks...)\n}", "func (c *LevelOfDangerousClient) Use(hooks ...Hook) {\n\tc.hooks.LevelOfDangerous = append(c.hooks.LevelOfDangerous, hooks...)\n}", "func (c *ComplaintClient) Use(hooks ...Hook) {\n\tc.hooks.Complaint = append(c.hooks.Complaint, hooks...)\n}", "func (c *OperativeClient) Use(hooks ...Hook) {\n\tc.hooks.Operative = append(c.hooks.Operative, hooks...)\n}", "func (c *OperationClient) Use(hooks ...Hook) {\n\tc.hooks.Operation = append(c.hooks.Operation, hooks...)\n}", "func (c *PetruleClient) Use(hooks ...Hook) {\n\tc.hooks.Petrule = append(c.hooks.Petrule, hooks...)\n}", "func (c *ClubBranchClient) Use(hooks ...Hook) {\n\tc.hooks.ClubBranch = append(c.hooks.ClubBranch, hooks...)\n}", "func (c *MealplanClient) Use(hooks ...Hook) {\n\tc.hooks.Mealplan = append(c.hooks.Mealplan, hooks...)\n}", "func (c *WalletNodeClient) Use(hooks ...Hook) {\n\tc.hooks.WalletNode = append(c.hooks.WalletNode, hooks...)\n}", "func (c *PharmacistClient) Use(hooks ...Hook) {\n\tc.hooks.Pharmacist = append(c.hooks.Pharmacist, hooks...)\n}", "func (c *DentistClient) Use(hooks ...Hook) {\n\tc.hooks.Dentist = append(c.hooks.Dentist, hooks...)\n}", "func (c *PetClient) Use(hooks ...Hook) {\n\tc.hooks.Pet = append(c.hooks.Pet, hooks...)\n}", "func (c *EventClient) Use(hooks ...Hook) {\n\tc.hooks.Event = append(c.hooks.Event, hooks...)\n}", "func (c *ClubClient) Use(hooks ...Hook) {\n\tc.hooks.Club = append(c.hooks.Club, hooks...)\n}", "func (c *PhysicianClient) Use(hooks ...Hook) {\n\tc.hooks.Physician = append(c.hooks.Physician, hooks...)\n}", "func (c *PhysicianClient) Use(hooks ...Hook) {\n\tc.hooks.Physician = append(c.hooks.Physician, hooks...)\n}", "func (c *ReviewClient) Use(hooks ...Hook) {\n\tc.hooks.Review = append(c.hooks.Review, hooks...)\n}", "func (c *VeterinarianClient) Use(hooks ...Hook) {\n\tc.hooks.Veterinarian = append(c.hooks.Veterinarian, hooks...)\n}", "func (c *PurposeClient) Use(hooks ...Hook) {\n\tc.hooks.Purpose = append(c.hooks.Purpose, hooks...)\n}", "func (c *FacultyClient) Use(hooks ...Hook) {\n\tc.hooks.Faculty = append(c.hooks.Faculty, hooks...)\n}", "func (c *BeerClient) Use(hooks ...Hook) {\n\tc.hooks.Beer = append(c.hooks.Beer, hooks...)\n}", "func (c *SkillClient) Use(hooks ...Hook) {\n\tc.hooks.Skill = append(c.hooks.Skill, hooks...)\n}", "func (c *SymptomClient) Use(hooks ...Hook) {\n\tc.hooks.Symptom = append(c.hooks.Symptom, hooks...)\n}", "func (c *TasteClient) Use(hooks ...Hook) {\n\tc.hooks.Taste = append(c.hooks.Taste, hooks...)\n}", "func (c *ClubTypeClient) Use(hooks ...Hook) {\n\tc.hooks.ClubType = append(c.hooks.ClubType, hooks...)\n}", "func (c *PlanetClient) Use(hooks ...Hook) {\n\tc.hooks.Planet = append(c.hooks.Planet, hooks...)\n}", "func (c *CleanernameClient) Use(hooks ...Hook) {\n\tc.hooks.Cleanername = append(c.hooks.Cleanername, hooks...)\n}", "func (c *GenderClient) Use(hooks ...Hook) {\n\tc.hooks.Gender = append(c.hooks.Gender, hooks...)\n}", "func (c *GenderClient) Use(hooks ...Hook) {\n\tc.hooks.Gender = append(c.hooks.Gender, hooks...)\n}", "func (c *PositionClient) Use(hooks ...Hook) {\n\tc.hooks.Position = append(c.hooks.Position, hooks...)\n}", "func (c *PositionClient) Use(hooks ...Hook) {\n\tc.hooks.Position = append(c.hooks.Position, hooks...)\n}", "func (c *PositionClient) Use(hooks ...Hook) {\n\tc.hooks.Position = append(c.hooks.Position, hooks...)\n}", "func (c *TransactionClient) Use(hooks ...Hook) {\n\tc.hooks.Transaction = append(c.hooks.Transaction, hooks...)\n}", "func (c *BuildingClient) Use(hooks ...Hook) {\n\tc.hooks.Building = append(c.hooks.Building, hooks...)\n}", "func (c *Client) Use(hooks ...Hook) {\n\tc.Event.Use(hooks...)\n\tc.Tag.Use(hooks...)\n}", "func (c *BedtypeClient) Use(hooks ...Hook) {\n\tc.hooks.Bedtype = append(c.hooks.Bedtype, hooks...)\n}", "func (c *EmployeeClient) Use(hooks ...Hook) {\n\tc.hooks.Employee = append(c.hooks.Employee, hooks...)\n}", "func (c *EmployeeClient) Use(hooks ...Hook) {\n\tc.hooks.Employee = append(c.hooks.Employee, hooks...)\n}", "func (c *EmployeeClient) Use(hooks ...Hook) {\n\tc.hooks.Employee = append(c.hooks.Employee, hooks...)\n}", "func (c *PostClient) Use(hooks ...Hook) {\n\tc.hooks.Post = append(c.hooks.Post, hooks...)\n}", "func (c *UserWalletClient) Use(hooks ...Hook) {\n\tc.hooks.UserWallet = append(c.hooks.UserWallet, hooks...)\n}", "func (c *Client) Use(hooks ...Hook) {\n\tc.Eatinghistory.Use(hooks...)\n\tc.Foodmenu.Use(hooks...)\n\tc.Mealplan.Use(hooks...)\n\tc.Taste.Use(hooks...)\n\tc.User.Use(hooks...)\n}", "func (c *BillClient) Use(hooks ...Hook) {\n\tc.hooks.Bill = append(c.hooks.Bill, hooks...)\n}", "func (c *BillClient) Use(hooks ...Hook) {\n\tc.hooks.Bill = append(c.hooks.Bill, hooks...)\n}", "func (c *BillClient) Use(hooks ...Hook) {\n\tc.hooks.Bill = append(c.hooks.Bill, hooks...)\n}", "func (c *ComplaintTypeClient) Use(hooks ...Hook) {\n\tc.hooks.ComplaintType = append(c.hooks.ComplaintType, hooks...)\n}", "func (c *MedicineClient) Use(hooks ...Hook) {\n\tc.hooks.Medicine = append(c.hooks.Medicine, hooks...)\n}", "func (c *UserClient) Use(hooks ...Hook) {\n\tc.hooks.User = append(c.hooks.User, hooks...)\n}", "func (c *UserClient) Use(hooks ...Hook) {\n\tc.hooks.User = append(c.hooks.User, hooks...)\n}", "func (c *UserClient) Use(hooks ...Hook) {\n\tc.hooks.User = append(c.hooks.User, hooks...)\n}", "func (c *UserClient) Use(hooks ...Hook) {\n\tc.hooks.User = append(c.hooks.User, hooks...)\n}", "func (c *UserClient) Use(hooks ...Hook) {\n\tc.hooks.User = append(c.hooks.User, hooks...)\n}", "func (c *UserClient) Use(hooks ...Hook) {\n\tc.hooks.User = append(c.hooks.User, hooks...)\n}", "func (c *UserClient) Use(hooks ...Hook) {\n\tc.hooks.User = append(c.hooks.User, hooks...)\n}", "func (c *UserClient) Use(hooks ...Hook) {\n\tc.hooks.User = append(c.hooks.User, hooks...)\n}", "func (c *UserClient) Use(hooks ...Hook) {\n\tc.hooks.User = append(c.hooks.User, hooks...)\n}", "func (c *UserClient) Use(hooks ...Hook) {\n\tc.hooks.User = append(c.hooks.User, hooks...)\n}", "func (c *UserClient) Use(hooks ...Hook) {\n\tc.hooks.User = append(c.hooks.User, hooks...)\n}", "func (c *PositionassingmentClient) Use(hooks ...Hook) {\n\tc.hooks.Positionassingment = append(c.hooks.Positionassingment, hooks...)\n}", "func (c *DoctorClient) Use(hooks ...Hook) {\n\tc.hooks.Doctor = append(c.hooks.Doctor, hooks...)\n}", "func (c *DrugAllergyClient) Use(hooks ...Hook) {\n\tc.hooks.DrugAllergy = append(c.hooks.DrugAllergy, hooks...)\n}", "func (c *ActivityTypeClient) Use(hooks ...Hook) {\n\tc.hooks.ActivityType = append(c.hooks.ActivityType, hooks...)\n}", "func (c *PatientClient) Use(hooks ...Hook) {\n\tc.hooks.Patient = append(c.hooks.Patient, hooks...)\n}", "func (c *PatientClient) Use(hooks ...Hook) {\n\tc.hooks.Patient = append(c.hooks.Patient, hooks...)\n}", "func (c *PatientClient) Use(hooks ...Hook) {\n\tc.hooks.Patient = append(c.hooks.Patient, hooks...)\n}", "func (c *PositionInPharmacistClient) Use(hooks ...Hook) {\n\tc.hooks.PositionInPharmacist = append(c.hooks.PositionInPharmacist, hooks...)\n}", "func (c *CoinInfoClient) Use(hooks ...Hook) {\n\tc.hooks.CoinInfo = append(c.hooks.CoinInfo, hooks...)\n}", "func (c *PaymentClient) Use(hooks ...Hook) {\n\tc.hooks.Payment = append(c.hooks.Payment, hooks...)\n}", "func (c *PaymentClient) Use(hooks ...Hook) {\n\tc.hooks.Payment = append(c.hooks.Payment, hooks...)\n}", "func (c *DepositClient) Use(hooks ...Hook) {\n\tc.hooks.Deposit = append(c.hooks.Deposit, hooks...)\n}", "func (c *UnitOfMedicineClient) Use(hooks ...Hook) {\n\tc.hooks.UnitOfMedicine = append(c.hooks.UnitOfMedicine, hooks...)\n}", "func (c *ActivitiesClient) Use(hooks ...Hook) {\n\tc.hooks.Activities = append(c.hooks.Activities, hooks...)\n}", "func (c *ClubapplicationClient) Use(hooks ...Hook) {\n\tc.hooks.Clubapplication = append(c.hooks.Clubapplication, hooks...)\n}", "func (c *MedicineTypeClient) Use(hooks ...Hook) {\n\tc.hooks.MedicineType = append(c.hooks.MedicineType, hooks...)\n}", "func (c *PledgeClient) Use(hooks ...Hook) {\n\tc.hooks.Pledge = append(c.hooks.Pledge, hooks...)\n}", "func (c *UsertypeClient) Use(hooks ...Hook) {\n\tc.hooks.Usertype = append(c.hooks.Usertype, hooks...)\n}", "func (c *Client) Use(hooks ...Hook) {\n\tc.Admin.Use(hooks...)\n\tc.AdminSession.Use(hooks...)\n\tc.Category.Use(hooks...)\n\tc.Post.Use(hooks...)\n\tc.PostAttachment.Use(hooks...)\n\tc.PostImage.Use(hooks...)\n\tc.PostThumbnail.Use(hooks...)\n\tc.PostVideo.Use(hooks...)\n\tc.UnsavedPost.Use(hooks...)\n\tc.UnsavedPostAttachment.Use(hooks...)\n\tc.UnsavedPostImage.Use(hooks...)\n\tc.UnsavedPostThumbnail.Use(hooks...)\n\tc.UnsavedPostVideo.Use(hooks...)\n}", "func (c *ClubappStatusClient) Use(hooks ...Hook) {\n\tc.hooks.ClubappStatus = append(c.hooks.ClubappStatus, hooks...)\n}", "func (c *PatientInfoClient) Use(hooks ...Hook) {\n\tc.hooks.PatientInfo = append(c.hooks.PatientInfo, hooks...)\n}", "func (c *PlaylistClient) Use(hooks ...Hook) {\n\tc.hooks.Playlist = append(c.hooks.Playlist, hooks...)\n}", "func (c *JobpositionClient) Use(hooks ...Hook) {\n\tc.hooks.Jobposition = append(c.hooks.Jobposition, hooks...)\n}", "func (c *AnnotationClient) Use(hooks ...Hook) {\n\tc.hooks.Annotation = append(c.hooks.Annotation, hooks...)\n}", "func (c *Client) Use(hooks ...Hook) {\n\tc.Gender.Use(hooks...)\n\tc.Position.Use(hooks...)\n\tc.Title.Use(hooks...)\n\tc.User.Use(hooks...)\n}", "func (c *OrderClient) Use(hooks ...Hook) {\n\tc.hooks.Order = append(c.hooks.Order, hooks...)\n}", "func (c *Context) Use(h ...Handler) {\n if h != nil {\n for _, e := range h {\n c.pipeline = c.pipeline.Add(e)\n }\n }\n}", "func (c *YearClient) Use(hooks ...Hook) {\n\tc.hooks.Year = append(c.hooks.Year, hooks...)\n}", "func (c *Client) Use(hooks ...Hook) {\n\tc.Dentist.Use(hooks...)\n\tc.Employee.Use(hooks...)\n\tc.Patient.Use(hooks...)\n\tc.Queue.Use(hooks...)\n}", "func (c *CompanyClient) Use(hooks ...Hook) {\n\tc.hooks.Company = append(c.hooks.Company, hooks...)\n}" ]
[ "0.6819038", "0.6819038", "0.67990625", "0.6791961", "0.67903596", "0.6730625", "0.6719106", "0.6718098", "0.6653304", "0.66412956", "0.66386014", "0.6613358", "0.66048265", "0.66003954", "0.6561657", "0.65577734", "0.65466505", "0.65183383", "0.6511281", "0.6509478", "0.65018874", "0.6497549", "0.6486733", "0.64788467", "0.64668703", "0.6463768", "0.64622396", "0.64622396", "0.64615524", "0.6453177", "0.64504075", "0.6432911", "0.643193", "0.64310294", "0.64307946", "0.64051145", "0.640265", "0.6401196", "0.6388403", "0.6387532", "0.6387532", "0.63805795", "0.63805795", "0.63805795", "0.6324665", "0.63014823", "0.62975687", "0.6292447", "0.6291453", "0.6291453", "0.6291453", "0.6291053", "0.62821305", "0.6271846", "0.6267307", "0.6267307", "0.6267307", "0.62648815", "0.6264803", "0.62550986", "0.62550986", "0.62550986", "0.62550986", "0.62550986", "0.62550986", "0.62550986", "0.62550986", "0.62550986", "0.62550986", "0.62550986", "0.6254298", "0.62517136", "0.6228985", "0.62269545", "0.6226756", "0.6226756", "0.6226756", "0.6218952", "0.62120557", "0.62101084", "0.62101084", "0.62100196", "0.62085307", "0.6192441", "0.6177652", "0.61696887", "0.6156211", "0.6154025", "0.6153058", "0.6132657", "0.6130026", "0.6127339", "0.61060286", "0.6099754", "0.60836595", "0.60754", "0.60647017", "0.605881", "0.60546184", "0.60368294" ]
0.6639737
10
Create returns a create builder for Category.
func (c *CategoryClient) Create() *CategoryCreate { mutation := newCategoryMutation(c.config, OpCreate) return &CategoryCreate{config: c.config, hooks: c.Hooks(), mutation: mutation} }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (s *CategoryService) Create(rs app.RequestScope, model *models.Category) (*models.Category, error) {\n\tif err := model.Validate(); err != nil {\n\t\treturn nil, err\n\t}\n\tif err := s.dao.Create(rs, model); err != nil {\n\t\treturn nil, err\n\t}\n\treturn s.dao.Get(rs, model.Id)\n}", "func (z *Category) Create(tx Querier) error {\n\treturn nil\n}", "func CreateCategory(w http.ResponseWriter, req *http.Request) {\n\t// esta variable es el body de categoria, como todos los campos que tenga\n\tvar body domain.Category\n\n\t// comprueba que lo que le hemos pasado tiene los campos que corresponde\n\tif err := parseBody(req, &body); err != nil {\n\t\trespondWithError(w, http.StatusBadRequest, err.Error())\n\t\treturn\n\t}\n\t_, err := domain.InsertCaterogy(body)\n\tif err != nil {\n\t\tbadRequest(w, err.Error())\n\t\treturn\n\t}\n\n\trespondWithJSON(w, http.StatusOK, body)\n}", "func CreateCategory (w http.ResponseWriter, r *http.Request) {\n\tvar newCategory Category\n\n\t//get the information containing in request's body\n\t//or report an error\n\treqBody, err := ioutil.ReadAll(r.Body)\n\tif err != nil {\n\t\tfmt.Fprintf(w, \"Kindly enter data with the category name and description only in order to update\")\n\t\tlog.Fatal(err.Error())\n\t}\n\n\t//generate unique categoryID\n\tnewCategory.CategoryID = xid.New().String()\n\t//unmarshal the information from JSON into the Category instance\n\t//or report an error\n\tif err = json.Unmarshal(reqBody, &newCategory); err != nil {\n\t\tlog.Printf(\"Body parse error, %v\", err.Error())\n\t\tw.WriteHeader(400)\n\t\treturn\n\t}\n\n\t//CategoryName is required field\n\tif len(newCategory.CategoryName) == 0 {\n\t\tw.WriteHeader(422)\n\t\tfmt.Fprintf(w, \"Kindly enter data with the category name in order to create new category\")\n\t\treturn\n\t}\n\n\t//append the new category to the slice\n\tCategories = append(Categories, newCategory)\n\tw.WriteHeader(http.StatusCreated)\n\n\t//return the category in response\n\t//or report an error\n\tif err = json.NewEncoder(w).Encode(newCategory); err != nil {\n\t\tlog.Printf(err.Error())\n\t\tw.WriteHeader(500)\n\t\treturn\n\t}\n}", "func (_Mcapscontroller *McapscontrollerTransactor) CreateCategory(opts *bind.TransactOpts, metadataHash [32]byte) (*types.Transaction, error) {\n\treturn _Mcapscontroller.contract.Transact(opts, \"createCategory\", metadataHash)\n}", "func (service *Service) CreateCategory(req *CreateRequest) (*CreateResponse, error) {\n\tcategoryExists, err := service.repo.CheckCategoryNameExists(req.Name)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif categoryExists {\n\t\treturn nil, errors.New(utils.CategoryExistsError)\n\t}\n\tcategory, err := service.repo.CreateCategory(req)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn category, nil\n}", "func (h *CategoryHandler) Create(ctx iris.Context) {\n\tvar cat entity.Category\n\tif err := ctx.ReadJSON(&cat); err != nil {\n\t\treturn\n\t}\n\n\tid, err := h.service.Insert(ctx.Request().Context(), cat)\n\tif err != nil {\n\t\tif err == sql.ErrUnprocessable {\n\t\t\tctx.StopWithJSON(iris.StatusUnprocessableEntity, newError(iris.StatusUnprocessableEntity, ctx.Request().Method, ctx.Path(), \"required fields are missing\"))\n\t\t\treturn\n\t\t}\n\n\t\tdebugf(\"CategoryHandler.Create(DB): %v\", err)\n\t\twriteInternalServerError(ctx)\n\t\treturn\n\t}\n\n\t// Send 201 with body of {\"id\":$last_inserted_id\"}.\n\tctx.StatusCode(iris.StatusCreated)\n\tctx.JSON(iris.Map{cat.PrimaryKey(): id})\n}", "func CategoryCreate(c *gin.Context) {\n\tCategory := &models.Category{}\n\tif err := c.Bind(Category); err != nil {\n\t\tsession := sessions.Default(c)\n\t\tsession.AddFlash(err.Error())\n\t\tsession.Save()\n\t\tc.Redirect(http.StatusSeeOther, \"/admin/new_Category\")\n\t\treturn\n\t}\n\n\tif err := Category.Insert(); err != nil {\n\t\tc.HTML(http.StatusInternalServerError, \"errors/500\", nil)\n\t\tlogrus.Error(err)\n\t\treturn\n\t}\n\tc.Redirect(http.StatusFound, \"/admin/categories\")\n}", "func (categories *Categories) CreateCategory(category Category, language string) (Category, error) {\n\texistsCategories, err := categories.ReadCategoriesByName(category.Name, language)\n\tif err != nil && err != ErrCategoriesByNameNotFound {\n\t\tlog.Println(err)\n\t\treturn category, ErrCategoryCanNotBeCreated\n\t}\n\tif existsCategories != nil {\n\t\treturn existsCategories[0], ErrCategoryAlreadyExist\n\t}\n\n\ttransaction := categories.storage.Client.NewTxn()\n\n\tcategory.IsActive = true\n\tencodedCategory, err := json.Marshal(category)\n\tif err != nil {\n\t\tlog.Println(err)\n\t\treturn category, ErrCategoryCanNotBeCreated\n\t}\n\n\tmutation := &dataBaseAPI.Mutation{\n\t\tSetJson: encodedCategory,\n\t\tCommitNow: true}\n\n\tassigned, err := transaction.Mutate(context.Background(), mutation)\n\tif err != nil {\n\t\tlog.Println(err)\n\t\treturn category, ErrCategoryCanNotBeCreated\n\t}\n\n\tcategory.ID = assigned.Uids[\"blank-0\"]\n\tif category.ID == \"\" {\n\t\treturn category, ErrCategoryCanNotBeCreated\n\t}\n\n\terr = categories.AddLanguageOfCategoryName(category.ID, category.Name, language)\n\tif err != nil {\n\t\treturn category, err\n\t}\n\n\tcreatedCategory, err := categories.ReadCategoryByID(category.ID, language)\n\tif err != nil {\n\t\treturn category, err\n\t}\n\n\treturn createdCategory, nil\n}", "func (service *Service) CreateCategory(request *restful.Request, response *restful.Response) {\n\tvar req models.CategoryRequest\n\tif err := request.ReadEntity(&req); err != nil {\n\t\trespondErr(response, http.StatusBadRequest, messageBadRequest,\n\t\t\t\"unable parse request body\")\n\n\t\tlogrus.WithFields(logrus.Fields{\"module\": \"service\", \"resp\": http.StatusBadRequest}).\n\t\t\tError(\"Unable to parse request body:\", err)\n\n\t\treturn\n\t}\n\n\tnewUUID, err := uuid.NewRandom()\n\tif err != nil {\n\t\trespondErr(response, http.StatusInternalServerError, messageServerError,\n\t\t\t\"unable to create uuid\")\n\n\t\tlogrus.WithFields(logrus.Fields{\"module\": \"service\", \"resp\": http.StatusInternalServerError}).\n\t\t\tError(\"Unable to create uuid:\", err)\n\n\t\treturn\n\t}\n\n\tcategory := models.Category{\n\t\tCategoryID: newUUID.String(),\n\t\tName: req.Name,\n\t\tImage: req.Image,\n\t}\n\n\tcreatedCategory, err := service.server.CreateCategory(category)\n\tif err != nil {\n\t\trespondErr(response, http.StatusInternalServerError, messageDatabaseError,\n\t\t\t\"unable to create category\")\n\n\t\tlogrus.WithFields(logrus.Fields{\"module\": \"service\", \"resp\": http.StatusInternalServerError}).\n\t\t\tError(\"Unable to create category:\", err)\n\n\t\treturn\n\t}\n\n\tresult := &models.CreateCategoryResponse{\n\t\tResult: *createdCategory,\n\t}\n\n\twriteResponse(response, http.StatusCreated, result)\n}", "func (_Mcapscontroller *McapscontrollerSession) CreateCategory(metadataHash [32]byte) (*types.Transaction, error) {\n\treturn _Mcapscontroller.Contract.CreateCategory(&_Mcapscontroller.TransactOpts, metadataHash)\n}", "func (_Mcapscontroller *McapscontrollerTransactorSession) CreateCategory(metadataHash [32]byte) (*types.Transaction, error) {\n\treturn _Mcapscontroller.Contract.CreateCategory(&_Mcapscontroller.TransactOpts, metadataHash)\n}", "func createCat() *Cat {\n\treturn NewCat(\"Mike\")\n}", "func (c *Category) Create(db *sql.DB) (err error) {\n\terr = db.QueryRow(\"INSERT INTO category (name) VALUES($1) RETURNING id\",\n\t\tc.Name).Scan(&c.ID)\n\treturn err\n}", "func (t *TrackingCategories) Create(provider xerogolang.IProvider, session goth.Session) (*TrackingCategories, error) {\n\tadditionalHeaders := map[string]string{\n\t\t\"Accept\": \"application/json\",\n\t\t\"Content-Type\": \"application/xml\",\n\t}\n\n\tbody, err := xml.MarshalIndent(t, \" \", \"\t\")\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\ttrackingCategoryResponseBytes, err := provider.Create(session, \"TrackingCategories\", additionalHeaders, body)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn unmarshalTrackingCategory(trackingCategoryResponseBytes)\n}", "func (w *ServerInterfaceWrapper) CreateCategory(ctx echo.Context) error {\n\tvar err error\n\n\t// Invoke the callback with all the unmarshalled arguments\n\terr = w.Handler.CreateCategory(ctx)\n\treturn err\n}", "func CreateCategory(db *sql.DB, name string) (Category, error) {\n\tvar category Category\n\terr := db.QueryRow(`INSERT INTO category(name)\n\t\tVALUES\n\t\t(UPPER($1))\n\t\tRETURNING id, name`, name).Scan(&category.ID, &category.Name)\n\n\tif err != nil {\n\t\treturn category, err\n\t}\n\n\treturn category, nil\n}", "func CreateCategories(c *gin.Context) {\n\t// Validate input\n\tvar input CreateCategoriesInput\n\tif err := c.ShouldBindJSON(&input); err != nil {\n\t\tc.JSON(http.StatusBadRequest, gin.H{\"error\": err.Error()})\n\t\treturn\n\t}\n\n\t// Create categories\n\tcategories := models.Categories{Name: input.Name}\n\tmodels.DB.Create(&categories)\n\n\tc.JSON(http.StatusOK, gin.H{\"data\": categories})\n}", "func CategoryNew(c *gin.Context) {\n\th := helpers.DefaultH(c)\n\th[\"Title\"] = \"New Category\"\n\th[\"Active\"] = \"categories\"\n\tsession := sessions.Default(c)\n\th[\"Flash\"] = session.Flashes()\n\tsession.Save()\n\n\tc.HTML(http.StatusOK, \"admin/categories/form\", h)\n}", "func CreateCategory(category Category) (Province, error) {\n\tvar (\n\t\terr error\n\t)\n\n\tc := newCategoryCollection()\n\tdefer c.Close()\n\n\tcategory.ID = bson.NewObjectId()\n\tcategoty.CreatedOn = time.Now()\n\n\terr = c.Session.Insert(&category)\n\tif err != nil {\n\t\treturn category, err\n\t}\n\n\treturn category, err\n}", "func (c CategoryLanguageController) Create(ctx *fasthttp.RequestCtx) {\n\tvar err error\n\tcategoryID, err := strconv.ParseInt(phi.URLParam(ctx, \"categoryID\"), 10, 64)\n\tif err != nil {\n\t\tc.JSONResponse(ctx, model.ResponseError{\n\t\t\tDetail: fasthttp.StatusMessage(fasthttp.StatusBadRequest),\n\t\t}, fasthttp.StatusBadRequest)\n\t\treturn\n\t}\n\n\tcategoryLanguage := new(model2.CategoryLanguage)\n\tc.JSONBody(ctx, &categoryLanguage)\n\tcategoryLanguage.CategoryID = categoryID\n\tcategoryLanguage.SourceUserID.SetValid(c.GetAuthContext(ctx).ID)\n\tif errs, err := database.ValidateStruct(categoryLanguage); err != nil {\n\t\tc.JSONResponse(ctx, model.ResponseError{\n\t\t\tErrors: errs,\n\t\t\tDetail: fasthttp.StatusMessage(fasthttp.StatusUnprocessableEntity),\n\t\t}, fasthttp.StatusUnprocessableEntity)\n\t\treturn\n\t}\n\n\tcategoryLanguage.Slug = slug.Make(categoryLanguage.Title)\n\n\terrs := make(map[string]string)\n\tc.GetDB().Transaction(func(tx *database.Tx) error {\n\t\tcatLang := new(model2.CategoryLanguage)\n\t\tresult := tx.DB.QueryRow(fmt.Sprintf(`\n\t\t\tSELECT cl.* FROM %s AS cl\n\t\t\tLEFT OUTER JOIN %s AS cl2 ON cl.language_id = cl2.language_id AND cl.id < cl2.id\n\t\t\tWHERE cl2.id IS NULL AND cl.slug = $1 AND cl.language_id = $2\n\t\t`, catLang.TableName(), catLang.TableName()),\n\t\t\tcategoryLanguage.Slug,\n\t\t\tcategoryLanguage.LanguageID)\n\t\tif result.Count > 0 {\n\t\t\terr = errors.New(\"slug has been already taken\")\n\t\t\terrs[\"slug\"] = \"has been already taken\"\n\t\t\treturn err\n\t\t}\n\n\t\terr = c.GetDB().Insert(new(model2.CategoryLanguage), categoryLanguage,\n\t\t\t\"id\", \"inserted_at\")\n\t\tif errs, err = database.ValidateConstraint(err, categoryLanguage); err != nil {\n\t\t\treturn err\n\t\t}\n\t\treturn nil\n\t})\n\n\tif err != nil {\n\t\tc.JSONResponse(ctx, model.ResponseError{\n\t\t\tErrors: errs,\n\t\t\tDetail: fasthttp.StatusMessage(fasthttp.StatusUnprocessableEntity),\n\t\t}, fasthttp.StatusUnprocessableEntity)\n\t\treturn\n\t}\n\n\tc.GetCache().SAdd(fmt.Sprintf(\"%s:%d\",\n\t\tcmn.GetRedisKey(\"category\", \"languages\"),\n\t\tcategoryID), categoryLanguage.ToJSON())\n\n\tc.JSONResponse(ctx, model.ResponseSuccessOne{\n\t\tData: categoryLanguage,\n\t}, fasthttp.StatusCreated)\n}", "func CategoriesCreatePOST(c *gin.Context) {\n\tcategory := models.Category{}\n\tcategory.Name = c.PostForm(\"name\")\n\tcategory.Intro = c.PostForm(\"intro\")\n\tcategory.Content = c.PostForm(\"content\")\n\tcategory.Title = c.PostForm(\"title\")\n\tcategory.Description = c.PostForm(\"description\")\n\tcategory.Type = c.PostForm(\"type\")\n\tfile, _ := c.FormFile(\"image\")\n\tif file != nil {\n\t\tif _, err := os.Stat(\"public/upload/\" + category.Type); os.IsNotExist(err) {\n\t\t\tfmt.Println(\"create folder\")\n\t\t\tos.Mkdir(\"public/upload/\"+category.Type, 0755)\n\t\t}\n\t\tc.SaveUploadedFile(file, \"public/upload/\"+category.Type)\n\n\t\tcategory.Image = file.Filename\n\t}\n\tc.JSON(http.StatusBadRequest, gin.H{\"error\": category})\n}", "func NewCategory(name string) *Category {\n\treturn &Category{\n\t\tName: name,\n\t\tTokens: make(map[string]int),\n\t\tTally: 0,\n\t\tProbNotInCat: 0.0,\n\t\tProbInCat: 0.0,\n\t}\n}", "func NewCategory(title string) *Category {\n\treturn &Category{nil, title, Categorify(title)}\n}", "func NewCategory(name, description string) *Category {\n\treturn &Category{\n\t\tID: 1,\n\t\tName: name,\n\t\tDescription: description,\n\t}\n}", "func (m *CategoryCreate) Validate(formats strfmt.Registry) error {\n\tvar res []error\n\n\tif err := m.validateCategoryPath(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "func (soca *SongCategory) New() item.Item {\n\treturn item.Item(NewSongCategory())\n}", "func CreateCategory(category *entities.CategoryProduct) (err error) {\n\tdb, _ := db.Conexion()\n\n\tresults, err := db.Exec(\"INSERT INTO category_product(name) VALUES(?)\", category.Name)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tcategory.ID, err = results.LastInsertId()\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "func NewCreateCategoryCreated() *CreateCategoryCreated {\n\treturn &CreateCategoryCreated{}\n}", "func (c *Client) NewCreateCategoriesRequest(ctx context.Context, path string, payload *CreateCategoriesPayload, contentType string) (*http.Request, error) {\n\tvar body bytes.Buffer\n\tif contentType == \"\" {\n\t\tcontentType = \"*/*\" // Use default encoder\n\t}\n\terr := c.Encoder.Encode(payload, &body, contentType)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to encode body: %s\", err)\n\t}\n\tscheme := c.Scheme\n\tif scheme == \"\" {\n\t\tscheme = \"http\"\n\t}\n\tu := url.URL{Host: c.Host, Scheme: scheme, Path: path}\n\treq, err := http.NewRequest(\"POST\", u.String(), &body)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\theader := req.Header\n\tif contentType == \"*/*\" {\n\t\theader.Set(\"Content-Type\", \"application/json\")\n\t} else {\n\t\theader.Set(\"Content-Type\", contentType)\n\t}\n\tif c.JWTSecSigner != nil {\n\t\tif err := c.JWTSecSigner.Sign(req); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\treturn req, nil\n}", "func NewDeviceCategory()(*DeviceCategory) {\n m := &DeviceCategory{\n Entity: *NewEntity(),\n }\n return m\n}", "func SetCategory(c *gin.Context) {\n\tvar reqBody api.Category\n\n\terr := c.ShouldBindJSON(&reqBody)\n\tif err != nil {\n\t\tc.JSON(http.StatusBadRequest, gin.H{\n\t\t\t\"Code\": http.StatusBadRequest,\n\t\t\t\"Success\": false,\n\t\t\t\"Data\": \"Incorrect request body.\",\n\t\t})\n\t\treturn\n\t}\n\n\tdb := data.ConnectDB()\n\tdb.Create(&dbTable.Category{\n\t\tTitle: reqBody.Title,\n\t})\n\n\tvar category api.Category\n\tdb.Last(&category)\n\tdb.Commit()\n\n\tc.JSON(http.StatusOK, gin.H{\n\t\t\"Code\": http.StatusOK,\n\t\t\"Success\": true,\n\t\t\"Data\": category.ID,\n\t})\n}", "func Store(category *models.Category) (*models.Category, error) {\n\tif err := db.DB.Create(&category).Error; err != nil {\n\t\treturn category, err\n\t}\n\treturn category, nil\n}", "func (mr *MockStorageMockRecorder) CreateCategory(ctx, category interface{}) *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"CreateCategory\", reflect.TypeOf((*MockStorage)(nil).CreateCategory), ctx, category)\n}", "func AddCategory(c *fiber.Ctx) error {\n\tcat := new(models.Category)\n\tdb := database.DBConn\n\tstmt, createTableError := db.Prepare(\"CREATE TABLE IF NOT EXISTS categories (id INTEGER PRIMARY KEY, name TEXT)\")\n\n\tif createTableError != nil {\n\t\treturn createTableError\n\t}\n\tstmt.Exec()\n\n\tif err := c.BodyParser(cat); err != nil {\n\t\treturn err\n\t}\n\n\tstmt, insertingError := database.DBConn.Prepare(\"INSERT INTO categories (name) VALUES (?)\")\n\n\tdefer stmt.Close()\n\n\tif insertingError != nil {\n\t\treturn insertingError\n\t}\n\tif _, err := stmt.Exec(cat.Name); err != nil {\n\t\treturn err\n\t}\n\treturn c.Status(201).SendString(\"Category created successfully\")\n}", "func CategoriesCreateGET(c *gin.Context) {\n\ttypeMethod := c.Param(\"type\")\n\tCategory := strings.Title(strings.Replace(typeMethod, \"-\", \" \", -1))\n\trepo := dataservice.NewCategoriesRepo()\n\tlistCategory := repo.GetListCategories(typeMethod)\n\tTitle := \"Create Category \" + Category\n\tc.HTML(http.StatusOK, \"CategoriesCreate\", gin.H{\"Title\": Title, \"typeMethod\": typeMethod, \"Category\": Category, \"listCategory\": listCategory})\n}", "func (data *CategoryDetailRequest) Save(ctx context.Context) (*model.Category, error) {\n // The model we will be creating.\n var category model.Category\n\n // Create our `User` object in our database.\n category = model.Category {\n Name: data.Name,\n ShortDescription: data.ShortDescription,\n LongDescription: data.LongDescription,\n OrganizationID: data.OrganizationID,\n }\n\n // Get our database connection.\n dao := database.Instance()\n db := dao.GetORM()\n\n // Create our object in the database.\n db.Create(&category)\n\n return &category, nil\n}", "func (m *ManagedDeviceItemRequestBuilder) DeviceCategory()(*id96b7ae916d8c8e465b8a821c2fe41d4d020ec0a7610953b779987f93a48d88e.DeviceCategoryRequestBuilder) {\n return id96b7ae916d8c8e465b8a821c2fe41d4d020ec0a7610953b779987f93a48d88e.NewDeviceCategoryRequestBuilderInternal(m.pathParameters, m.requestAdapter);\n}", "func (productCategory ProductCategory) create() (Entity, error) {\n\n\ten := productCategory\n\n\tif err := db.Create(&en).Error; err != nil {\n\t\treturn nil, err\n\t}\n\n\terr := en.GetPreloadDb(false, false, nil).First(&en, en.Id).Error\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tAsyncFire(NewEvent(\"ProductCategoryCreated\", map[string]interface{}{\"account_id\":en.AccountId, \"product_category_id\":en.Id}))\n\n\tvar newItem Entity = &en\n\n\treturn newItem, nil\n}", "func (c *CategoryClient) CreateBulk(builders ...*CategoryCreate) *CategoryCreateBulk {\n\treturn &CategoryCreateBulk{config: c.config, builders: builders}\n}", "func (fc *FileCreate) SetCategory(s string) *FileCreate {\n\tfc.mutation.SetCategory(s)\n\treturn fc\n}", "func (m *MockStorage) CreateCategory(ctx context.Context, category model.Category) (model.Category, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"CreateCategory\", ctx, category)\n\tret0, _ := ret[0].(model.Category)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "func (c *FoodmenuClient) Create() *FoodmenuCreate {\n\tmutation := newFoodmenuMutation(c.config, OpCreate)\n\treturn &FoodmenuCreate{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *MealplanClient) Create() *MealplanCreate {\n\tmutation := newMealplanMutation(c.config, OpCreate)\n\treturn &MealplanCreate{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *ClassificationsController) Create(ctx *app.CreateClassificationsContext) error {\n\t// ClassificationsController_Create: start_implement\n\tm, err := c.fm()\n\tif err != nil {\n\t\tgoa.ContextLogger(ctx).Error(`unable to get model`, `error`, err.Error())\n\t\treturn ctx.ServiceUnavailable()\n\t}\n\tdefer func() { m.Close() }()\n\n\t_, err = m.InsertClassification(ctx.SeriesID, ctx.Payload.ClassID)\n\tif err != nil {\n\t\tgoa.ContextLogger(ctx).Error(`failed to insert classification`, `error`, err.Error())\n\t\tswitch err {\n\t\tcase model.ErrDuplicateKey:\n\t\t\treturn ctx.UnprocessableEntity()\n\t\tcase model.ErrInvalidID:\n\t\t\treturn ctx.UnprocessableEntity()\n\t\tdefault:\n\t\t\treturn ctx.InternalServerError()\n\t\t}\n\t}\n\n\tctx.ResponseData.Header().Set(\"Location\", app.ClassificationsHref(ctx.SeriesID, ctx.Payload.ClassID))\n\treturn ctx.Created()\n\t// ClassificationsController_Create: end_implement\n}", "func (c CheckboxCreator) Create(ctx context.Context, parent page.ControlI) page.ControlI {\n\tctrl := NewCheckbox(parent, c.ID)\n\tif c.Text != \"\" {\n\t\tctrl.SetText(c.Text)\n\t}\n\tif c.LabelMode != html.LabelDefault {\n\t\tctrl.LabelMode = c.LabelMode\n\t}\n\tif c.LabelAttributes != nil {\n\t\tctrl.LabelAttributes().Merge(c.LabelAttributes)\n\t}\n\n\tctrl.ApplyOptions(ctx, c.ControlOptions)\n\tif c.SaveState {\n\t\tctrl.SaveState(ctx, c.SaveState)\n\t}\n\tif c.Inline {\n\t\tctrl.SetInline(c.Inline)\n\t}\n\treturn ctrl\n}", "func (c *BranchClient) Create() *BranchCreate {\n\tmutation := newBranchMutation(c.config, OpCreate)\n\treturn &BranchCreate{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (d UserData) CreateCategories(related m.PartnerCategoryData) m.UserData {\n\td.ModelData.Create(models.NewFieldName(\"Categories\", \"category_ids\"), related.Underlying())\n\treturn d\n}", "func TestCreateCategory(t *testing.T) {\n\t//initial length of []Categories\n\tinitialLen := len(Categories)\n\t//parameters passed to request body\n\trequestBody := &Category{\n\t\tCategoryName: \t\t\"Super Cool Category\",\n\t\tCategoryDescription: \"Brand new cool Category\",\n\t}\n\tjsonCategory, _ := json.Marshal(requestBody)\n\t//Create a request to pass to the handler with request body as a third parameter\n\treq, err := http.NewRequest(\"POST\", \"/categories/new\", bytes.NewBuffer(jsonCategory))\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\trr := httptest.NewRecorder()\n\thandler := http.HandlerFunc(CreateCategory)\n\n\thandler.ServeHTTP(rr, req)\n\n\tassert.Equal(t, 201, rr.Code, \"Created response is expected\")\n\t//the length of []Categories should increase after creating new category\n\tassert.NotEqual(t, initialLen, len(Categories), \"Expected length to increase after creating new Category\")\n}", "func (c *MedicineTypeClient) Create() *MedicineTypeCreate {\n\tmutation := newMedicineTypeMutation(c.config, OpCreate)\n\treturn &MedicineTypeCreate{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (dc DevCat) Category() Category {\n\treturn Category(dc[0])\n}", "func (c *ClubTypeClient) Create() *ClubTypeCreate {\n\tmutation := newClubTypeMutation(c.config, OpCreate)\n\treturn &ClubTypeCreate{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *TermsService) Category() *TermsTaxonomyService {\n\treturn &TermsTaxonomyService{\n\t\tclient: c.Client,\n\t\turl: fmt.Sprintf(\"%v/category\", \"terms\"),\n\t\ttaxonomyBase: \"category\",\n\t}\n}", "func NewAddCategory(r *http.Request) (*Category, error) {\n\tvar category Category\n\terr := json.NewDecoder(r.Body).Decode(&category)\n\tif err != nil {\n\t\treturn nil, ErrInvalidJSON\n\t}\n\terr = category.validateCategory()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &category, nil\n}", "func (c *BuildingClient) Create() *BuildingCreate {\n\tmutation := newBuildingMutation(c.config, OpCreate)\n\treturn &BuildingCreate{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (m *EducationAssignmentItemRequestBuilder) Categories()(*i7b1c280606a6564228514ab9e1b7f963f46c753907436ec516230878d54adc8f.CategoriesRequestBuilder) {\n return i7b1c280606a6564228514ab9e1b7f963f46c753907436ec516230878d54adc8f.NewCategoriesRequestBuilderInternal(m.pathParameters, m.requestAdapter);\n}", "func (c *DisciplineClient) Create() *DisciplineCreate {\n\tmutation := newDisciplineMutation(c.config, OpCreate)\n\treturn &DisciplineCreate{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *DepartmentClient) Create() *DepartmentCreate {\n\tmutation := newDepartmentMutation(c.config, OpCreate)\n\treturn &DepartmentCreate{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (app *folderNameBuilder) Create() FolderNameBuilder {\n\treturn createFolderNameBuilder()\n}", "func (c *ClubBranchClient) Create() *ClubBranchCreate {\n\tmutation := newClubBranchMutation(c.config, OpCreate)\n\treturn &ClubBranchCreate{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (app *operationBuilder) Create() OperationBuilder {\n\treturn createOperationBuilder()\n}", "func (a *Client) PostCategories(params *PostCategoriesParams) (*PostCategoriesCreated, error) {\n\t// TODO: Validate the params before sending\n\tif params == nil {\n\t\tparams = NewPostCategoriesParams()\n\t}\n\n\tresult, err := a.transport.Submit(&runtime.ClientOperation{\n\t\tID: \"post_categories\",\n\t\tMethod: \"POST\",\n\t\tPathPattern: \"/api/rest/v1/categories\",\n\t\tProducesMediaTypes: []string{\"application/json\"},\n\t\tConsumesMediaTypes: []string{\"application/json\"},\n\t\tSchemes: []string{\"http\"},\n\t\tParams: params,\n\t\tReader: &PostCategoriesReader{formats: a.formats},\n\t\tContext: params.Context,\n\t\tClient: params.HTTPClient,\n\t})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tsuccess, ok := result.(*PostCategoriesCreated)\n\tif ok {\n\t\treturn success, nil\n\t}\n\t// unexpected success response\n\t// safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue\n\tmsg := fmt.Sprintf(\"unexpected success response for post_categories: API contract not enforced by server. Client expected to get an error, but got: %T\", result)\n\tpanic(msg)\n}", "func (c *ActivityTypeClient) Create() *ActivityTypeCreate {\n\tmutation := newActivityTypeMutation(c.config, OpCreate)\n\treturn &ActivityTypeCreate{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func CreateCategoriesPath() string {\n\n\treturn fmt.Sprintf(\"/categories\")\n}", "func (app *ruleSectionBuilder) Create() RuleSectionBuilder {\n\treturn createRuleSectionBuilder()\n}", "func (o *SLOCorrectionCreateRequestAttributes) SetCategory(v SLOCorrectionCategory) {\n\to.Category = v\n}", "func (client *Client) AddCategoryWithOptions(request *AddCategoryRequest, runtime *util.RuntimeOptions) (_result *AddCategoryResponse, _err error) {\n\t_err = util.ValidateModel(request)\n\tif _err != nil {\n\t\treturn _result, _err\n\t}\n\tquery := map[string]interface{}{}\n\tif !tea.BoolValue(util.IsUnset(request.CateName)) {\n\t\tquery[\"CateName\"] = request.CateName\n\t}\n\n\tif !tea.BoolValue(util.IsUnset(request.ParentId)) {\n\t\tquery[\"ParentId\"] = request.ParentId\n\t}\n\n\tif !tea.BoolValue(util.IsUnset(request.Type)) {\n\t\tquery[\"Type\"] = request.Type\n\t}\n\n\treq := &openapi.OpenApiRequest{\n\t\tQuery: openapiutil.Query(query),\n\t}\n\tparams := &openapi.Params{\n\t\tAction: tea.String(\"AddCategory\"),\n\t\tVersion: tea.String(\"2017-03-21\"),\n\t\tProtocol: tea.String(\"HTTPS\"),\n\t\tPathname: tea.String(\"/\"),\n\t\tMethod: tea.String(\"POST\"),\n\t\tAuthType: tea.String(\"AK\"),\n\t\tStyle: tea.String(\"RPC\"),\n\t\tReqBodyType: tea.String(\"formData\"),\n\t\tBodyType: tea.String(\"json\"),\n\t}\n\t_result = &AddCategoryResponse{}\n\t_body, _err := client.CallApi(params, req, runtime)\n\tif _err != nil {\n\t\treturn _result, _err\n\t}\n\t_err = tea.Convert(_body, &_result)\n\treturn _result, _err\n}", "func (c *CleaningroomClient) Create() *CleaningroomCreate {\n\tmutation := newCleaningroomMutation(c.config, OpCreate)\n\treturn &CleaningroomCreate{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *DoctorClient) Create() *DoctorCreate {\n\tmutation := newDoctorMutation(c.config, OpCreate)\n\treturn &DoctorCreate{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *ComplaintTypeClient) Create() *ComplaintTypeCreate {\n\tmutation := newComplaintTypeMutation(c.config, OpCreate)\n\treturn &ComplaintTypeCreate{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func NewCreateCategoryConflict() *CreateCategoryConflict {\n\treturn &CreateCategoryConflict{}\n}", "func (rb *ByProjectKeyCategoriesImportContainersByImportContainerKeyRequestBuilder) Post(body CategoryImportRequest) *ByProjectKeyCategoriesImportContainersByImportContainerKeyRequestMethodPost {\n\treturn &ByProjectKeyCategoriesImportContainersByImportContainerKeyRequestMethodPost{\n\t\tbody: body,\n\t\turl: fmt.Sprintf(\"/%s/categories/import-containers/%s\", rb.projectKey, rb.importContainerKey),\n\t\tclient: rb.client,\n\t}\n}", "func (c *BedtypeClient) Create() *BedtypeCreate {\n\tmutation := newBedtypeMutation(c.config, OpCreate)\n\treturn &BedtypeCreate{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (fac *BuilderFactory) Create() met.Builder {\n\tout := createBuilder()\n\treturn out\n}", "func (k *Kategorie) ValidateCreate(tx *pop.Connection) (*validate.Errors, error) {\n\treturn validate.NewErrors(), nil\n}", "func (u *App) Create(c echo.Context, req *Create) (*model.Course, error) {\n\tif err := u.rbac.EnforceRole(c, model.AdminRole); err != nil {\n\t\treturn nil, err\n\t}\n\n\tid, err := util.GenerateUUID()\n\tif err = zaplog.ZLog(err); err != nil {\n\t\treturn nil, err\n\t}\n\n\tschoolName := \"\"\n\tvar school model.Organization\n\tif err := u.db.Model(&model.Organization{}).Where(\"uuid = ?\", req.School).First(&school).Error; err == nil {\n\t\tschoolName = school.Name\n\t}\n\n\tcourse := model.Course{\n\t\tBase: model.Base{ID: id},\n\t\tName: req.Name,\n\t\tSchool: req.School,\n\t\tSchoolName: schoolName,\n\t\tDepartment: req.Department,\n\t\tDomain: req.Domain,\n\t\tCluster: req.Cluster,\n\t\tType: req.Type,\n\t\tLevel: req.Level,\n\t}\n\n\tvar domain model.CourseDomain\n\tif err := u.db.Model(&model.CourseDomain{}).Where(\"uuid = ?\", req.Domain).First(&domain).Error; err == nil {\n\t\tcourse.DomainName = domain.Name\n\t\tfor _, cluster := range domain.Clusters {\n\t\t\tif course.Cluster == cluster.ID {\n\t\t\t\tcourse.ClusterName = cluster.Name\n\t\t\t}\n\t\t}\n\t}\n\n\treturn u.udb.Create(u.db, course)\n}", "func NewCreateCategoryNotFound() *CreateCategoryNotFound {\n\treturn &CreateCategoryNotFound{}\n}", "func (c *SeriesController) Create(ctx *app.CreateSeriesContext) error {\n\t// SeriesController_Create: start_implement\n\tm, err := c.fm()\n\tif err != nil {\n\t\tgoa.ContextLogger(ctx).Error(`unable to get model`, `error`, err.Error())\n\t\treturn ctx.ServiceUnavailable()\n\t}\n\tdefer func() { m.Close() }()\n\n\tv, err := m.InsertSeries(ctx.Payload.SeriesName, ctx.Payload.CategoryID)\n\tif err != nil {\n\t\tgoa.ContextLogger(ctx).Error(`failed to insert series`, `error`, err.Error())\n\t\tswitch err {\n\t\tcase model.ErrDuplicateKey:\n\t\t\treturn ctx.UnprocessableEntity()\n\t\tcase model.ErrInvalidID:\n\t\t\treturn ctx.UnprocessableEntity()\n\t\tdefault:\n\t\t\treturn ctx.InternalServerError()\n\t\t}\n\t}\n\n\tctx.ResponseData.Header().Set(\"Location\", app.SeriesHref(v.ID))\n\treturn ctx.Created()\n\t// SeriesController_Create: end_implement\n}", "func (c *PostClient) Create() *PostCreate {\n\tmutation := newPostMutation(c.config, OpCreate)\n\treturn &PostCreate{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func Create(c *golangsdk.ServiceClient, opts CreateOptsBuilder, cluster_id string) (r CreateResult) {\n\tb, err := opts.ToAddonCreateMap()\n\tif err != nil {\n\t\tr.Err = err\n\t\treturn\n\t}\n\treqOpt := &golangsdk.RequestOpts{OkCodes: []int{201}}\n\t_, r.Err = c.Post(rootURL(c, cluster_id), b, &r.Body, reqOpt)\n\treturn\n}", "func (c *PortfolioController) CreatePortfolioAssetCategoryMapping(db *sqlx.DB) http.HandlerFunc {\n\treturn func(w http.ResponseWriter, r *http.Request) {\n\t\tvar pacm *models.PortfolioAssetCategoryMapping\n\t\terr := json.NewDecoder(r.Body).Decode(&pacm)\n\t\tif err != nil {\n\t\t\tbadRequestModel(w, portfolioAssetCategoryMapping, err)\n\t\t\treturn\n\t\t}\n\n\t\tpacm.ID = uuid.New()\n\t\tpacmIDs, err := portfolioRepo.CreatePortfolioAssetCategoryMappings(db, []*models.PortfolioAssetCategoryMapping{pacm})\n\t\tif err != nil {\n\t\t\terrorCreating(w, portfolioAssetCategoryMapping, err)\n\t\t\treturn\n\t\t}\n\t\tcreated(w, pacmIDs[0])\n\t}\n}", "func (o *CreateSubCategoryCreated) WithPayload(payload *models.SubCategory) *CreateSubCategoryCreated {\n\to.Payload = payload\n\treturn o\n}", "func (c *MedicineClient) Create() *MedicineCreate {\n\tmutation := newMedicineMutation(c.config, OpCreate)\n\treturn &MedicineCreate{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (repo *PostAttributeRepository) Create(newAttribute *entity.PostAttribute, tableName string) error {\n\n\tvar prefix string\n\n\tswitch tableName {\n\tcase \"post_categories\":\n\t\tprefix = \"CATEGORY\"\n\t}\n\n\ttotalNumOfMembers := tools.CountMembers(tableName, repo.conn)\n\tnewAttribute.ID = fmt.Sprintf(prefix+\"-%s%d\", tools.GenerateRandomString(7), totalNumOfMembers+1)\n\n\tfor !tools.IsUnique(\"id\", newAttribute.ID, tableName, repo.conn) {\n\t\ttotalNumOfMembers++\n\t\tnewAttribute.ID = fmt.Sprintf(prefix+\"-%s%d\", tools.GenerateRandomString(7), totalNumOfMembers+1)\n\t}\n\n\terr := repo.conn.Table(tableName).Create(newAttribute).Error\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "func (c *DepositClient) Create() *DepositCreate {\n\tmutation := newDepositMutation(c.config, OpCreate)\n\treturn &DepositCreate{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (a *AdminApiService) PostCategories(ctx _context.Context, localVarOptionals *PostCategoriesOpts) (Category, *_nethttp.Response, error) {\n\tvar (\n\t\tlocalVarHTTPMethod = _nethttp.MethodPost\n\t\tlocalVarPostBody interface{}\n\t\tlocalVarFormFileName string\n\t\tlocalVarFileName string\n\t\tlocalVarFileBytes []byte\n\t\tlocalVarReturnValue Category\n\t)\n\n\t// create path and map variables\n\tlocalVarPath := a.client.cfg.BasePath + \"/categories\"\n\tlocalVarHeaderParams := make(map[string]string)\n\tlocalVarQueryParams := _neturl.Values{}\n\tlocalVarFormParams := _neturl.Values{}\n\n\t// to determine the Content-Type header\n\tlocalVarHTTPContentTypes := []string{\"application/json\"}\n\n\t// set Content-Type header\n\tlocalVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)\n\tif localVarHTTPContentType != \"\" {\n\t\tlocalVarHeaderParams[\"Content-Type\"] = localVarHTTPContentType\n\t}\n\n\t// to determine the Accept header\n\tlocalVarHTTPHeaderAccepts := []string{\"application/json\"}\n\n\t// set Accept header\n\tlocalVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)\n\tif localVarHTTPHeaderAccept != \"\" {\n\t\tlocalVarHeaderParams[\"Accept\"] = localVarHTTPHeaderAccept\n\t}\n\t// body params\n\tif localVarOptionals != nil && localVarOptionals.Category.IsSet() {\n\t\tlocalVarOptionalCategory, localVarOptionalCategoryok := localVarOptionals.Category.Value().(Category)\n\t\tif !localVarOptionalCategoryok {\n\t\t\treturn localVarReturnValue, nil, reportError(\"category should be Category\")\n\t\t}\n\t\tlocalVarPostBody = &localVarOptionalCategory\n\t}\n\n\tr, err := a.client.prepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)\n\tif err != nil {\n\t\treturn localVarReturnValue, nil, err\n\t}\n\n\tlocalVarHTTPResponse, err := a.client.callAPI(r)\n\tif err != nil || localVarHTTPResponse == nil {\n\t\treturn localVarReturnValue, localVarHTTPResponse, err\n\t}\n\n\tlocalVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body)\n\tlocalVarHTTPResponse.Body.Close()\n\tif err != nil {\n\t\treturn localVarReturnValue, localVarHTTPResponse, err\n\t}\n\n\tif localVarHTTPResponse.StatusCode >= 300 {\n\t\tnewErr := GenericOpenAPIError{\n\t\t\tbody: localVarBody,\n\t\t\terror: localVarHTTPResponse.Status,\n\t\t}\n\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t}\n\n\terr = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\tif err != nil {\n\t\tnewErr := GenericOpenAPIError{\n\t\t\tbody: localVarBody,\n\t\t\terror: err.Error(),\n\t\t}\n\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t}\n\n\treturn localVarReturnValue, localVarHTTPResponse, nil\n}", "func (c *CompanyClient) Create() *CompanyCreate {\n\tmutation := newCompanyMutation(c.config, OpCreate)\n\treturn &CompanyCreate{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *CompanyClient) Create() *CompanyCreate {\n\tmutation := newCompanyMutation(c.config, OpCreate)\n\treturn &CompanyCreate{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c Category) Validate() error {\n\treturn validation.ValidateStruct(&c,\n\t\tvalidation.Field(&c.ID, validation.Required, validation.By(helpers.CheckObjectID)),\n\t\tvalidation.Field(&c.Title, validation.Required, validation.RuneLength(5, 55)),\n\t\tvalidation.Field(&c.Subtitle, validation.Required, validation.RuneLength(25, 255)),\n\t\tvalidation.Field(&c.MetaDesc, validation.Required, validation.RuneLength(50, 255)),\n\t\tvalidation.Field(&c.Slug, validation.Required),\n\t)\n}", "func (c *CleanernameClient) Create() *CleanernameCreate {\n\tmutation := newCleanernameMutation(c.config, OpCreate)\n\treturn &CleanernameCreate{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func newCategoryMutation(c config, op Op, opts ...categoryOption) *CategoryMutation {\n\tm := &CategoryMutation{\n\t\tconfig: c,\n\t\top: op,\n\t\ttyp: TypeCategory,\n\t\tclearedFields: make(map[string]struct{}),\n\t}\n\tfor _, opt := range opts {\n\t\topt(m)\n\t}\n\treturn m\n}", "func newCategoryMutation(c config, op Op, opts ...categoryOption) *CategoryMutation {\n\tm := &CategoryMutation{\n\t\tconfig: c,\n\t\top: op,\n\t\ttyp: TypeCategory,\n\t\tclearedFields: make(map[string]struct{}),\n\t}\n\tfor _, opt := range opts {\n\t\topt(m)\n\t}\n\treturn m\n}", "func NewCreateCategoryBadRequest() *CreateCategoryBadRequest {\n\treturn &CreateCategoryBadRequest{}\n}", "func (etc *EquipmentTypeCreate) SetCategory(e *EquipmentCategory) *EquipmentTypeCreate {\n\treturn etc.SetCategoryID(e.ID)\n}", "func Create(\n\tcontext contexts.Contextable,\n\tlogger *logger.Logger,\n\tconnection *golastic.Connection,\n\tqueue *notifications.Queue,\n\tctx context.Context,\n) (Actionable, error) {\n\taction, err := build(context.Action())\n\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tif err := action.Init(context, logger, connection, queue, ctx); err != nil {\n\t\treturn nil, err\n\t}\n\n\tif err := action.ApplyOptions().ApplyFilters(); err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn action, nil\n}", "func (c *FacultyClient) Create() *FacultyCreate {\n\tmutation := newFacultyMutation(c.config, OpCreate)\n\treturn &FacultyCreate{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *ActivitiesClient) Create() *ActivitiesCreate {\n\tmutation := newActivitiesMutation(c.config, OpCreate)\n\treturn &ActivitiesCreate{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (m *DeviceManagementRequestBuilder) DeviceCategories()(*i06eed0fc70646ea797036b22a3bd208dcf64b957f60fbda2b7ac9d010b7feed0.DeviceCategoriesRequestBuilder) {\n return i06eed0fc70646ea797036b22a3bd208dcf64b957f60fbda2b7ac9d010b7feed0.NewDeviceCategoriesRequestBuilderInternal(m.pathParameters, m.requestAdapter);\n}", "func (c *NurseClient) Create() *NurseCreate {\n\tmutation := newNurseMutation(c.config, OpCreate)\n\treturn &NurseCreate{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *TagClient) Create() *TagCreate {\n\tmutation := newTagMutation(c.config, OpCreate)\n\treturn &TagCreate{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}" ]
[ "0.7239934", "0.69258577", "0.6759301", "0.6588614", "0.65840375", "0.652369", "0.6505667", "0.63871133", "0.6378166", "0.62658453", "0.625471", "0.6242942", "0.6108228", "0.60346276", "0.6030446", "0.59619284", "0.59250337", "0.5856199", "0.5780549", "0.5732623", "0.5707823", "0.5701927", "0.56925297", "0.5692299", "0.55777043", "0.5509388", "0.5489229", "0.548326", "0.5387967", "0.5358282", "0.53094816", "0.5264632", "0.52553344", "0.52056795", "0.519871", "0.5163485", "0.51624876", "0.51310176", "0.5109815", "0.5101222", "0.5074228", "0.5069969", "0.5068459", "0.5044562", "0.5032856", "0.5025539", "0.5025152", "0.49870163", "0.4983135", "0.49688324", "0.49541515", "0.49414554", "0.49378803", "0.49304822", "0.491696", "0.49010614", "0.48874983", "0.48859048", "0.4885848", "0.48795763", "0.48778582", "0.48768166", "0.4862569", "0.48619017", "0.4846193", "0.48416677", "0.48413986", "0.482948", "0.48286504", "0.48244503", "0.48157072", "0.48067242", "0.4806494", "0.47955096", "0.47917822", "0.47895142", "0.4787396", "0.47613344", "0.4748644", "0.47441974", "0.4740782", "0.4740112", "0.4731021", "0.4730361", "0.4716887", "0.47140622", "0.47115213", "0.47115213", "0.47087312", "0.4706741", "0.46941513", "0.46941513", "0.46758455", "0.46744925", "0.46734127", "0.46657822", "0.46647137", "0.46603906", "0.46583903", "0.46473804" ]
0.75432396
0
CreateBulk returns a builder for creating a bulk of Category entities.
func (c *CategoryClient) CreateBulk(builders ...*CategoryCreate) *CategoryCreateBulk { return &CategoryCreateBulk{config: c.config, builders: builders} }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (c *CompanyClient) CreateBulk(builders ...*CompanyCreate) *CompanyCreateBulk {\n\treturn &CompanyCreateBulk{config: c.config, builders: builders}\n}", "func (c *DNSBLQueryClient) CreateBulk(builders ...*DNSBLQueryCreate) *DNSBLQueryCreateBulk {\n\treturn &DNSBLQueryCreateBulk{config: c.config, builders: builders}\n}", "func (c *OperationClient) CreateBulk(builders ...*OperationCreate) *OperationCreateBulk {\n\treturn &OperationCreateBulk{config: c.config, builders: builders}\n}", "func (c *TagClient) CreateBulk(builders ...*TagCreate) *TagCreateBulk {\n\treturn &TagCreateBulk{config: c.config, builders: builders}\n}", "func (c *PostClient) CreateBulk(builders ...*PostCreate) *PostCreateBulk {\n\treturn &PostCreateBulk{config: c.config, builders: builders}\n}", "func (c *VeterinarianClient) CreateBulk(builders ...*VeterinarianCreate) *VeterinarianCreateBulk {\n\treturn &VeterinarianCreateBulk{config: c.config, builders: builders}\n}", "func (c *TransactionClient) CreateBulk(builders ...*TransactionCreate) *TransactionCreateBulk {\n\treturn &TransactionCreateBulk{config: c.config, builders: builders}\n}", "func (c *JobClient) CreateBulk(builders ...*JobCreate) *JobCreateBulk {\n\treturn &JobCreateBulk{config: c.config, builders: builders}\n}", "func (c *BeerClient) CreateBulk(builders ...*BeerCreate) *BeerCreateBulk {\n\treturn &BeerCreateBulk{config: c.config, builders: builders}\n}", "func (c *SkillClient) CreateBulk(builders ...*SkillCreate) *SkillCreateBulk {\n\treturn &SkillCreateBulk{config: c.config, builders: builders}\n}", "func (c *ClinicClient) CreateBulk(builders ...*ClinicCreate) *ClinicCreateBulk {\n\treturn &ClinicCreateBulk{config: c.config, builders: builders}\n}", "func (c *UnsavedPostClient) CreateBulk(builders ...*UnsavedPostCreate) *UnsavedPostCreateBulk {\n\treturn &UnsavedPostCreateBulk{config: c.config, builders: builders}\n}", "func (c *AdminClient) CreateBulk(builders ...*AdminCreate) *AdminCreateBulk {\n\treturn &AdminCreateBulk{config: c.config, builders: builders}\n}", "func (c *PetClient) CreateBulk(builders ...*PetCreate) *PetCreateBulk {\n\treturn &PetCreateBulk{config: c.config, builders: builders}\n}", "func (c *CustomerClient) CreateBulk(builders ...*CustomerCreate) *CustomerCreateBulk {\n\treturn &CustomerCreateBulk{config: c.config, builders: builders}\n}", "func (c *EmptyClient) CreateBulk(builders ...*EmptyCreate) *EmptyCreateBulk {\n\treturn &EmptyCreateBulk{config: c.config, builders: builders}\n}", "func (c *BinaryFileClient) CreateBulk(builders ...*BinaryFileCreate) *BinaryFileCreateBulk {\n\treturn &BinaryFileCreateBulk{config: c.config, builders: builders}\n}", "func (c *PostImageClient) CreateBulk(builders ...*PostImageCreate) *PostImageCreateBulk {\n\treturn &PostImageCreateBulk{config: c.config, builders: builders}\n}", "func (c *CardClient) CreateBulk(builders ...*CardCreate) *CardCreateBulk {\n\treturn &CardCreateBulk{config: c.config, builders: builders}\n}", "func (c *WorkExperienceClient) CreateBulk(builders ...*WorkExperienceCreate) *WorkExperienceCreateBulk {\n\treturn &WorkExperienceCreateBulk{config: c.config, builders: builders}\n}", "func (c *CoinInfoClient) CreateBulk(builders ...*CoinInfoCreate) *CoinInfoCreateBulk {\n\treturn &CoinInfoCreateBulk{config: c.config, builders: builders}\n}", "func (c *KeyStoreClient) CreateBulk(builders ...*KeyStoreCreate) *KeyStoreCreateBulk {\n\treturn &KeyStoreCreateBulk{config: c.config, builders: builders}\n}", "func (c *DNSBLResponseClient) CreateBulk(builders ...*DNSBLResponseCreate) *DNSBLResponseCreateBulk {\n\treturn &DNSBLResponseCreateBulk{config: c.config, builders: builders}\n}", "func (c *UnsavedPostImageClient) CreateBulk(builders ...*UnsavedPostImageCreate) *UnsavedPostImageCreateBulk {\n\treturn &UnsavedPostImageCreateBulk{config: c.config, builders: builders}\n}", "func (c *AppointmentClient) CreateBulk(builders ...*AppointmentCreate) *AppointmentCreateBulk {\n\treturn &AppointmentCreateBulk{config: c.config, builders: builders}\n}", "func (c *ReviewClient) CreateBulk(builders ...*ReviewCreate) *ReviewCreateBulk {\n\treturn &ReviewCreateBulk{config: c.config, builders: builders}\n}", "func (c *WalletNodeClient) CreateBulk(builders ...*WalletNodeCreate) *WalletNodeCreateBulk {\n\treturn &WalletNodeCreateBulk{config: c.config, builders: builders}\n}", "func (c *PostAttachmentClient) CreateBulk(builders ...*PostAttachmentCreate) *PostAttachmentCreateBulk {\n\treturn &PostAttachmentCreateBulk{config: c.config, builders: builders}\n}", "func (c *IPClient) CreateBulk(builders ...*IPCreate) *IPCreateBulk {\n\treturn &IPCreateBulk{config: c.config, builders: builders}\n}", "func (c *CardScanClient) CreateBulk(builders ...*CardScanCreate) *CardScanCreateBulk {\n\treturn &CardScanCreateBulk{config: c.config, builders: builders}\n}", "func (c *PlaylistClient) CreateBulk(builders ...*PlaylistCreate) *PlaylistCreateBulk {\n\treturn &PlaylistCreateBulk{config: c.config, builders: builders}\n}", "func (c *UserCardClient) CreateBulk(builders ...*UserCardCreate) *UserCardCreateBulk {\n\treturn &UserCardCreateBulk{config: c.config, builders: builders}\n}", "func (c *PostThumbnailClient) CreateBulk(builders ...*PostThumbnailCreate) *PostThumbnailCreateBulk {\n\treturn &PostThumbnailCreateBulk{config: c.config, builders: builders}\n}", "func (c *UserWalletClient) CreateBulk(builders ...*UserWalletCreate) *UserWalletCreateBulk {\n\treturn &UserWalletCreateBulk{config: c.config, builders: builders}\n}", "func (c *UserClient) CreateBulk(builders ...*UserCreate) *UserCreateBulk {\n\treturn &UserCreateBulk{config: c.config, builders: builders}\n}", "func (c *UserClient) CreateBulk(builders ...*UserCreate) *UserCreateBulk {\n\treturn &UserCreateBulk{config: c.config, builders: builders}\n}", "func (c *UserClient) CreateBulk(builders ...*UserCreate) *UserCreateBulk {\n\treturn &UserCreateBulk{config: c.config, builders: builders}\n}", "func (c *UserClient) CreateBulk(builders ...*UserCreate) *UserCreateBulk {\n\treturn &UserCreateBulk{config: c.config, builders: builders}\n}", "func (c *UserClient) CreateBulk(builders ...*UserCreate) *UserCreateBulk {\n\treturn &UserCreateBulk{config: c.config, builders: builders}\n}", "func (c *UnsavedPostAttachmentClient) CreateBulk(builders ...*UnsavedPostAttachmentCreate) *UnsavedPostAttachmentCreateBulk {\n\treturn &UnsavedPostAttachmentCreateBulk{config: c.config, builders: builders}\n}", "func (c *UnsavedPostThumbnailClient) CreateBulk(builders ...*UnsavedPostThumbnailCreate) *UnsavedPostThumbnailCreateBulk {\n\treturn &UnsavedPostThumbnailCreateBulk{config: c.config, builders: builders}\n}", "func (c *EventClient) CreateBulk(builders ...*EventCreate) *EventCreateBulk {\n\treturn &EventCreateBulk{config: c.config, builders: builders}\n}", "func (c *AdminSessionClient) CreateBulk(builders ...*AdminSessionCreate) *AdminSessionCreateBulk {\n\treturn &AdminSessionCreateBulk{config: c.config, builders: builders}\n}", "func (s *CampaignNegativeKeywordService) CreateBulk(ctx context.Context, campaignID int64, data []*NegativeKeyword) ([]*NegativeKeyword, *Response, error) {\n\tif campaignID == 0 {\n\t\treturn nil, nil, fmt.Errorf(\"campaignID can not be 0\")\n\t}\n\tu := fmt.Sprintf(\"campaigns/%d/negativekeywords/bulk\", campaignID)\n\treq, err := s.client.NewRequest(\"POST\", u, data)\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\tnegativekeywords := []*NegativeKeyword{}\n\tresp, err := s.client.Do(ctx, req, &negativekeywords)\n\tif err != nil {\n\t\treturn nil, resp, err\n\t}\n\treturn negativekeywords, resp, nil\n}", "func (a *DefaultApiService) BulkCreate(ctx _context.Context) ApiBulkCreateRequest {\n\treturn ApiBulkCreateRequest{\n\t\tApiService: a,\n\t\tctx: ctx,\n\t}\n}", "func (c *MediaClient) CreateBulk(builders ...*MediaCreate) *MediaCreateBulk {\n\treturn &MediaCreateBulk{config: c.config, builders: builders}\n}", "func (c *PostVideoClient) CreateBulk(builders ...*PostVideoCreate) *PostVideoCreateBulk {\n\treturn &PostVideoCreateBulk{config: c.config, builders: builders}\n}", "func (s *AdGroupNegativeKeywordService) CreateBulk(ctx context.Context, campaignID int64, adGroupID int64, data []*NegativeKeyword) ([]*NegativeKeyword, *Response, error) {\n\tif campaignID == 0 {\n\t\treturn nil, nil, fmt.Errorf(\"campaignID can not be 0\")\n\t}\n\tif adGroupID == 0 {\n\t\treturn nil, nil, fmt.Errorf(\"adGroupID can not be 0\")\n\t}\n\tu := fmt.Sprintf(\"campaigns/%d/adgroups/%d/negativekeywords/bulk\", campaignID, adGroupID)\n\treq, err := s.client.NewRequest(\"POST\", u, data)\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\tnegativekeywords := []*NegativeKeyword{}\n\tresp, err := s.client.Do(ctx, req, &negativekeywords)\n\tif err != nil {\n\t\treturn nil, resp, err\n\t}\n\n\treturn negativekeywords, resp, nil\n}", "func (m *Manager) BulkCreate(obj interface{}) error {\n\treturn m.Query(m.Insert().Values(obj).Returning(), obj)\n}", "func (c *UnsavedPostVideoClient) CreateBulk(builders ...*UnsavedPostVideoCreate) *UnsavedPostVideoCreateBulk {\n\treturn &UnsavedPostVideoCreateBulk{config: c.config, builders: builders}\n}", "func (m *MessagesController) CreateBulk(ctx *gin.Context) {\n\tmessagesIn := &tat.MessagesJSONIn{}\n\tctx.Bind(messagesIn)\n\tvar msgs []*tat.MessageJSONOut\n\tfor _, messageIn := range messagesIn.Messages {\n\t\tm, code, err := m.createSingle(ctx, messageIn)\n\t\tif err != nil {\n\t\t\tctx.JSON(code, gin.H{\"error\": err.Error()})\n\t\t\treturn\n\t\t}\n\t\tmsgs = append(msgs, m)\n\t}\n\tctx.JSON(http.StatusCreated, msgs)\n}", "func (r *AssetRepository) CreateBulk(assets []assetEntity.Asset) (int, error) {\n\terr := r.restore()\n\tif err != nil {\n\t\treturn 0, err\n\t}\n\n\tn, err := r.repository.CreateBulk(assets)\n\tif err != nil {\n\t\treturn n, fmt.Errorf(\"assets bulk create failed: %w\", err)\n\t}\n\terr = r.dump()\n\treturn n, err\n}", "func NewBulk(data []byte) *EncodeData {\n\tans := &EncodeData{}\n\tans.Type = TypeBulk\n\tans.Value = data\n\treturn ans\n}", "func (d UserData) CreateCategories(related m.PartnerCategoryData) m.UserData {\n\td.ModelData.Create(models.NewFieldName(\"Categories\", \"category_ids\"), related.Underlying())\n\treturn d\n}", "func (a *BulkApiService) CreateBulkRequest(ctx context.Context) ApiCreateBulkRequestRequest {\n\treturn ApiCreateBulkRequestRequest{\n\t\tApiService: a,\n\t\tctx: ctx,\n\t}\n}", "func (ccb *CampaignCreateBulk) Save(ctx context.Context) ([]*Campaign, error) {\n\tspecs := make([]*sqlgraph.CreateSpec, len(ccb.builders))\n\tnodes := make([]*Campaign, len(ccb.builders))\n\tmutators := make([]Mutator, len(ccb.builders))\n\tfor i := range ccb.builders {\n\t\tfunc(i int, root context.Context) {\n\t\t\tbuilder := ccb.builders[i]\n\t\t\tbuilder.defaults()\n\t\t\tvar mut Mutator = MutateFunc(func(ctx context.Context, m Mutation) (Value, error) {\n\t\t\t\tmutation, ok := m.(*CampaignMutation)\n\t\t\t\tif !ok {\n\t\t\t\t\treturn nil, fmt.Errorf(\"unexpected mutation type %T\", m)\n\t\t\t\t}\n\t\t\t\tif err := builder.check(); err != nil {\n\t\t\t\t\treturn nil, err\n\t\t\t\t}\n\t\t\t\tbuilder.mutation = mutation\n\t\t\t\tnodes[i], specs[i] = builder.createSpec()\n\t\t\t\tvar err error\n\t\t\t\tif i < len(mutators)-1 {\n\t\t\t\t\t_, err = mutators[i+1].Mutate(root, ccb.builders[i+1].mutation)\n\t\t\t\t} else {\n\t\t\t\t\t// Invoke the actual operation on the latest mutation in the chain.\n\t\t\t\t\tif err = sqlgraph.BatchCreate(ctx, ccb.driver, &sqlgraph.BatchCreateSpec{Nodes: specs}); err != nil {\n\t\t\t\t\t\tif cerr, ok := isSQLConstraintError(err); ok {\n\t\t\t\t\t\t\terr = cerr\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tmutation.done = true\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn nil, err\n\t\t\t\t}\n\t\t\t\treturn nodes[i], nil\n\t\t\t})\n\t\t\tfor i := len(builder.hooks) - 1; i >= 0; i-- {\n\t\t\t\tmut = builder.hooks[i](mut)\n\t\t\t}\n\t\t\tmutators[i] = mut\n\t\t}(i, ctx)\n\t}\n\tif len(mutators) > 0 {\n\t\tif _, err := mutators[0].Mutate(ctx, ccb.builders[0].mutation); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\treturn nodes, nil\n}", "func NewMultiBulk(array []*EncodeData) *EncodeData {\n\tans := &EncodeData{}\n\tans.Type = TypeMultiBulk\n\tans.Array = array\n\treturn ans\n}", "func (client *Client) CreateBulkTransaction(txn []*CreateTransaction) (_ *Response, err error) {\n\tpath := \"/transaction_bulk\"\n\turi := fmt.Sprintf(\"%s%s\", client.apiBaseURL, path)\n\n\tif len(txn) > MaxBulkPutSize {\n\t\treturn nil, ErrMaxBulkSizeExceeded\n\t}\n\n\ttxnBytes, err := json.Marshal(txn)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treq, err := http.NewRequest(http.MethodPost, uri, bytes.NewBuffer(txnBytes))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tresp, err := client.performRequest(req, string(txnBytes))\n\treturn resp, err\n}", "func CreateCategories(c *gin.Context) {\n\t// Validate input\n\tvar input CreateCategoriesInput\n\tif err := c.ShouldBindJSON(&input); err != nil {\n\t\tc.JSON(http.StatusBadRequest, gin.H{\"error\": err.Error()})\n\t\treturn\n\t}\n\n\t// Create categories\n\tcategories := models.Categories{Name: input.Name}\n\tmodels.DB.Create(&categories)\n\n\tc.JSON(http.StatusOK, gin.H{\"data\": categories})\n}", "func (a *BulkApiService) CreateBulkMoCloner(ctx context.Context) ApiCreateBulkMoClonerRequest {\n\treturn ApiCreateBulkMoClonerRequest{\n\t\tApiService: a,\n\t\tctx: ctx,\n\t}\n}", "func (bcb *BulkCreateBulk) Save(ctx context.Context) ([]*Bulk, error) {\n\tspecs := make([]*sqlgraph.CreateSpec, len(bcb.builders))\n\tnodes := make([]*Bulk, len(bcb.builders))\n\tmutators := make([]Mutator, len(bcb.builders))\n\tfor i := range bcb.builders {\n\t\tfunc(i int, root context.Context) {\n\t\t\tbuilder := bcb.builders[i]\n\t\t\tvar mut Mutator = MutateFunc(func(ctx context.Context, m Mutation) (Value, error) {\n\t\t\t\tmutation, ok := m.(*BulkMutation)\n\t\t\t\tif !ok {\n\t\t\t\t\treturn nil, fmt.Errorf(\"unexpected mutation type %T\", m)\n\t\t\t\t}\n\t\t\t\tif err := builder.check(); err != nil {\n\t\t\t\t\treturn nil, err\n\t\t\t\t}\n\t\t\t\tbuilder.mutation = mutation\n\t\t\t\tnodes[i], specs[i] = builder.createSpec()\n\t\t\t\tvar err error\n\t\t\t\tif i < len(mutators)-1 {\n\t\t\t\t\t_, err = mutators[i+1].Mutate(root, bcb.builders[i+1].mutation)\n\t\t\t\t} else {\n\t\t\t\t\t// Invoke the actual operation on the latest mutation in the chain.\n\t\t\t\t\tif err = sqlgraph.BatchCreate(ctx, bcb.driver, &sqlgraph.BatchCreateSpec{Nodes: specs}); err != nil {\n\t\t\t\t\t\tif cerr, ok := isSQLConstraintError(err); ok {\n\t\t\t\t\t\t\terr = cerr\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tmutation.done = true\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn nil, err\n\t\t\t\t}\n\t\t\t\tif nodes[i].ID == 0 {\n\t\t\t\t\tid := specs[i].ID.Value.(int64)\n\t\t\t\t\tnodes[i].ID = int(id)\n\t\t\t\t}\n\t\t\t\treturn nodes[i], nil\n\t\t\t})\n\t\t\tfor i := len(builder.hooks) - 1; i >= 0; i-- {\n\t\t\t\tmut = builder.hooks[i](mut)\n\t\t\t}\n\t\t\tmutators[i] = mut\n\t\t}(i, ctx)\n\t}\n\tif len(mutators) > 0 {\n\t\tif _, err := mutators[0].Mutate(ctx, bcb.builders[0].mutation); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\treturn nodes, nil\n}", "func (a *BulkApiService) CreateBulkMoDeepCloner(ctx context.Context) ApiCreateBulkMoDeepClonerRequest {\n\treturn ApiCreateBulkMoDeepClonerRequest{\n\t\tApiService: a,\n\t\tctx: ctx,\n\t}\n}", "func (a *BulkApiService) CreateBulkExport(ctx context.Context) ApiCreateBulkExportRequest {\n\treturn ApiCreateBulkExportRequest{\n\t\tApiService: a,\n\t\tctx: ctx,\n\t}\n}", "func (ccb *CompanyCreateBulk) Save(ctx context.Context) ([]*Company, error) {\n\tspecs := make([]*sqlgraph.CreateSpec, len(ccb.builders))\n\tnodes := make([]*Company, len(ccb.builders))\n\tmutators := make([]Mutator, len(ccb.builders))\n\tfor i := range ccb.builders {\n\t\tfunc(i int, root context.Context) {\n\t\t\tbuilder := ccb.builders[i]\n\t\t\tbuilder.defaults()\n\t\t\tvar mut Mutator = MutateFunc(func(ctx context.Context, m Mutation) (Value, error) {\n\t\t\t\tmutation, ok := m.(*CompanyMutation)\n\t\t\t\tif !ok {\n\t\t\t\t\treturn nil, fmt.Errorf(\"unexpected mutation type %T\", m)\n\t\t\t\t}\n\t\t\t\tif err := builder.check(); err != nil {\n\t\t\t\t\treturn nil, err\n\t\t\t\t}\n\t\t\t\tbuilder.mutation = mutation\n\t\t\t\tnodes[i], specs[i] = builder.createSpec()\n\t\t\t\tvar err error\n\t\t\t\tif i < len(mutators)-1 {\n\t\t\t\t\t_, err = mutators[i+1].Mutate(root, ccb.builders[i+1].mutation)\n\t\t\t\t} else {\n\t\t\t\t\t// Invoke the actual operation on the latest mutation in the chain.\n\t\t\t\t\tif err = sqlgraph.BatchCreate(ctx, ccb.driver, &sqlgraph.BatchCreateSpec{Nodes: specs}); err != nil {\n\t\t\t\t\t\tif sqlgraph.IsConstraintError(err) {\n\t\t\t\t\t\t\terr = &ConstraintError{err.Error(), err}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn nil, err\n\t\t\t\t}\n\t\t\t\tmutation.id = &nodes[i].ID\n\t\t\t\tmutation.done = true\n\t\t\t\tid := specs[i].ID.Value.(int64)\n\t\t\t\tnodes[i].ID = int(id)\n\t\t\t\treturn nodes[i], nil\n\t\t\t})\n\t\t\tfor i := len(builder.hooks) - 1; i >= 0; i-- {\n\t\t\t\tmut = builder.hooks[i](mut)\n\t\t\t}\n\t\t\tmutators[i] = mut\n\t\t}(i, ctx)\n\t}\n\tif len(mutators) > 0 {\n\t\tif _, err := mutators[0].Mutate(ctx, ccb.builders[0].mutation); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\treturn nodes, nil\n}", "func (a *BulkApiService) CreateBulkMoMerger(ctx context.Context) ApiCreateBulkMoMergerRequest {\n\treturn ApiCreateBulkMoMergerRequest{\n\t\tApiService: a,\n\t\tctx: ctx,\n\t}\n}", "func (c *CategoryClient) Create() *CategoryCreate {\n\tmutation := newCategoryMutation(c.config, OpCreate)\n\treturn &CategoryCreate{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func CreateCategory(w http.ResponseWriter, req *http.Request) {\n\t// esta variable es el body de categoria, como todos los campos que tenga\n\tvar body domain.Category\n\n\t// comprueba que lo que le hemos pasado tiene los campos que corresponde\n\tif err := parseBody(req, &body); err != nil {\n\t\trespondWithError(w, http.StatusBadRequest, err.Error())\n\t\treturn\n\t}\n\t_, err := domain.InsertCaterogy(body)\n\tif err != nil {\n\t\tbadRequest(w, err.Error())\n\t\treturn\n\t}\n\n\trespondWithJSON(w, http.StatusOK, body)\n}", "func (ccb *ConstructionCreateBulk) Save(ctx context.Context) ([]*Construction, error) {\n\tspecs := make([]*sqlgraph.CreateSpec, len(ccb.builders))\n\tnodes := make([]*Construction, len(ccb.builders))\n\tmutators := make([]Mutator, len(ccb.builders))\n\tfor i := range ccb.builders {\n\t\tfunc(i int, root context.Context) {\n\t\t\tbuilder := ccb.builders[i]\n\t\t\tbuilder.defaults()\n\t\t\tvar mut Mutator = MutateFunc(func(ctx context.Context, m Mutation) (Value, error) {\n\t\t\t\tmutation, ok := m.(*ConstructionMutation)\n\t\t\t\tif !ok {\n\t\t\t\t\treturn nil, fmt.Errorf(\"unexpected mutation type %T\", m)\n\t\t\t\t}\n\t\t\t\tif err := builder.check(); err != nil {\n\t\t\t\t\treturn nil, err\n\t\t\t\t}\n\t\t\t\tbuilder.mutation = mutation\n\t\t\t\tnodes[i], specs[i] = builder.createSpec()\n\t\t\t\tvar err error\n\t\t\t\tif i < len(mutators)-1 {\n\t\t\t\t\t_, err = mutators[i+1].Mutate(root, ccb.builders[i+1].mutation)\n\t\t\t\t} else {\n\t\t\t\t\t// Invoke the actual operation on the latest mutation in the chain.\n\t\t\t\t\tif err = sqlgraph.BatchCreate(ctx, ccb.driver, &sqlgraph.BatchCreateSpec{Nodes: specs}); err != nil {\n\t\t\t\t\t\tif cerr, ok := isSQLConstraintError(err); ok {\n\t\t\t\t\t\t\terr = cerr\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tmutation.done = true\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn nil, err\n\t\t\t\t}\n\t\t\t\tid := specs[i].ID.Value.(int64)\n\t\t\t\tnodes[i].ID = int(id)\n\t\t\t\treturn nodes[i], nil\n\t\t\t})\n\t\t\tfor i := len(builder.hooks) - 1; i >= 0; i-- {\n\t\t\t\tmut = builder.hooks[i](mut)\n\t\t\t}\n\t\t\tmutators[i] = mut\n\t\t}(i, ctx)\n\t}\n\tif len(mutators) > 0 {\n\t\tif _, err := mutators[0].Mutate(ctx, ccb.builders[0].mutation); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\treturn nodes, nil\n}", "func (_Mcapscontroller *McapscontrollerTransactor) CreateCategory(opts *bind.TransactOpts, metadataHash [32]byte) (*types.Transaction, error) {\n\treturn _Mcapscontroller.contract.Transact(opts, \"createCategory\", metadataHash)\n}", "func (dscb *DataSourceCreateBulk) Save(ctx context.Context) ([]*DataSource, error) {\n\tspecs := make([]*sqlgraph.CreateSpec, len(dscb.builders))\n\tnodes := make([]*DataSource, len(dscb.builders))\n\tmutators := make([]Mutator, len(dscb.builders))\n\tfor i := range dscb.builders {\n\t\tfunc(i int, root context.Context) {\n\t\t\tbuilder := dscb.builders[i]\n\t\t\tbuilder.defaults()\n\t\t\tvar mut Mutator = MutateFunc(func(ctx context.Context, m Mutation) (Value, error) {\n\t\t\t\tmutation, ok := m.(*DataSourceMutation)\n\t\t\t\tif !ok {\n\t\t\t\t\treturn nil, fmt.Errorf(\"unexpected mutation type %T\", m)\n\t\t\t\t}\n\t\t\t\tif err := builder.check(); err != nil {\n\t\t\t\t\treturn nil, err\n\t\t\t\t}\n\t\t\t\tbuilder.mutation = mutation\n\t\t\t\tnodes[i], specs[i] = builder.createSpec()\n\t\t\t\tvar err error\n\t\t\t\tif i < len(mutators)-1 {\n\t\t\t\t\t_, err = mutators[i+1].Mutate(root, dscb.builders[i+1].mutation)\n\t\t\t\t} else {\n\t\t\t\t\tspec := &sqlgraph.BatchCreateSpec{Nodes: specs}\n\t\t\t\t\t// Invoke the actual operation on the latest mutation in the chain.\n\t\t\t\t\tif err = sqlgraph.BatchCreate(ctx, dscb.driver, spec); err != nil {\n\t\t\t\t\t\tif sqlgraph.IsConstraintError(err) {\n\t\t\t\t\t\t\terr = &ConstraintError{msg: err.Error(), wrap: err}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn nil, err\n\t\t\t\t}\n\t\t\t\tmutation.id = &nodes[i].ID\n\t\t\t\tif specs[i].ID.Value != nil {\n\t\t\t\t\tid := specs[i].ID.Value.(int64)\n\t\t\t\t\tnodes[i].ID = int(id)\n\t\t\t\t}\n\t\t\t\tmutation.done = true\n\t\t\t\treturn nodes[i], nil\n\t\t\t})\n\t\t\tfor i := len(builder.hooks) - 1; i >= 0; i-- {\n\t\t\t\tmut = builder.hooks[i](mut)\n\t\t\t}\n\t\t\tmutators[i] = mut\n\t\t}(i, ctx)\n\t}\n\tif len(mutators) > 0 {\n\t\tif _, err := mutators[0].Mutate(ctx, dscb.builders[0].mutation); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\treturn nodes, nil\n}", "func (c *queryClient) Bulk(args []*RequestBody) (io.ReadCloser, error) {\n\tbody := RequestBody{\n\t\tType: \"bulk\",\n\t\tArgs: args,\n\t}\n\n\treturn c.Send(body)\n}", "func (a *APIGen) BulkCreateIndexPattern(ctx context.Context, indexPatterns []IndexPattern) error {\n\tpanic(\"Should Not Be Called from Gen Pattern.\")\n}", "func (wcb *WordCreateBulk) Save(ctx context.Context) ([]*Word, error) {\n\tspecs := make([]*sqlgraph.CreateSpec, len(wcb.builders))\n\tnodes := make([]*Word, len(wcb.builders))\n\tmutators := make([]Mutator, len(wcb.builders))\n\tfor i := range wcb.builders {\n\t\tfunc(i int, root context.Context) {\n\t\t\tbuilder := wcb.builders[i]\n\t\t\tbuilder.defaults()\n\t\t\tvar mut Mutator = MutateFunc(func(ctx context.Context, m Mutation) (Value, error) {\n\t\t\t\tmutation, ok := m.(*WordMutation)\n\t\t\t\tif !ok {\n\t\t\t\t\treturn nil, fmt.Errorf(\"unexpected mutation type %T\", m)\n\t\t\t\t}\n\t\t\t\tif err := builder.check(); err != nil {\n\t\t\t\t\treturn nil, err\n\t\t\t\t}\n\t\t\t\tbuilder.mutation = mutation\n\t\t\t\tnodes[i], specs[i] = builder.createSpec()\n\t\t\t\tvar err error\n\t\t\t\tif i < len(mutators)-1 {\n\t\t\t\t\t_, err = mutators[i+1].Mutate(root, wcb.builders[i+1].mutation)\n\t\t\t\t} else {\n\t\t\t\t\t// Invoke the actual operation on the latest mutation in the chain.\n\t\t\t\t\tif err = sqlgraph.BatchCreate(ctx, wcb.driver, &sqlgraph.BatchCreateSpec{Nodes: specs}); err != nil {\n\t\t\t\t\t\tif cerr, ok := isSQLConstraintError(err); ok {\n\t\t\t\t\t\t\terr = cerr\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tmutation.done = true\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn nil, err\n\t\t\t\t}\n\t\t\t\tid := specs[i].ID.Value.(int64)\n\t\t\t\tnodes[i].ID = int(id)\n\t\t\t\treturn nodes[i], nil\n\t\t\t})\n\t\t\tfor i := len(builder.hooks) - 1; i >= 0; i-- {\n\t\t\t\tmut = builder.hooks[i](mut)\n\t\t\t}\n\t\t\tmutators[i] = mut\n\t\t}(i, ctx)\n\t}\n\tif len(mutators) > 0 {\n\t\tif _, err := mutators[0].Mutate(ctx, wcb.builders[0].mutation); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\treturn nodes, nil\n}", "func CreateClassification(params types.ContextParams, clientSet apimachinery.ClientSetInterface, clsItems []metadata.Classification) []Classification {\n\tresults := make([]Classification, 0)\n\tfor _, cls := range clsItems {\n\n\t\tresults = append(results, &classification{\n\t\t\tcls: cls,\n\t\t\tparams: params,\n\t\t\tclientSet: clientSet,\n\t\t})\n\t}\n\n\treturn results\n}", "func (uccb *UseCaseCreateBulk) Save(ctx context.Context) ([]*UseCase, error) {\n\tspecs := make([]*sqlgraph.CreateSpec, len(uccb.builders))\n\tnodes := make([]*UseCase, len(uccb.builders))\n\tmutators := make([]Mutator, len(uccb.builders))\n\tfor i := range uccb.builders {\n\t\tfunc(i int, root context.Context) {\n\t\t\tbuilder := uccb.builders[i]\n\t\t\tvar mut Mutator = MutateFunc(func(ctx context.Context, m Mutation) (Value, error) {\n\t\t\t\tmutation, ok := m.(*UseCaseMutation)\n\t\t\t\tif !ok {\n\t\t\t\t\treturn nil, fmt.Errorf(\"unexpected mutation type %T\", m)\n\t\t\t\t}\n\t\t\t\tif err := builder.check(); err != nil {\n\t\t\t\t\treturn nil, err\n\t\t\t\t}\n\t\t\t\tbuilder.mutation = mutation\n\t\t\t\tnodes[i], specs[i] = builder.createSpec()\n\t\t\t\tvar err error\n\t\t\t\tif i < len(mutators)-1 {\n\t\t\t\t\t_, err = mutators[i+1].Mutate(root, uccb.builders[i+1].mutation)\n\t\t\t\t} else {\n\t\t\t\t\tspec := &sqlgraph.BatchCreateSpec{Nodes: specs}\n\t\t\t\t\t// Invoke the actual operation on the latest mutation in the chain.\n\t\t\t\t\tif err = sqlgraph.BatchCreate(ctx, uccb.driver, spec); err != nil {\n\t\t\t\t\t\tif sqlgraph.IsConstraintError(err) {\n\t\t\t\t\t\t\terr = &ConstraintError{err.Error(), err}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn nil, err\n\t\t\t\t}\n\t\t\t\tmutation.id = &nodes[i].ID\n\t\t\t\tmutation.done = true\n\t\t\t\tif specs[i].ID.Value != nil {\n\t\t\t\t\tid := specs[i].ID.Value.(int64)\n\t\t\t\t\tnodes[i].ID = int(id)\n\t\t\t\t}\n\t\t\t\treturn nodes[i], nil\n\t\t\t})\n\t\t\tfor i := len(builder.hooks) - 1; i >= 0; i-- {\n\t\t\t\tmut = builder.hooks[i](mut)\n\t\t\t}\n\t\t\tmutators[i] = mut\n\t\t}(i, ctx)\n\t}\n\tif len(mutators) > 0 {\n\t\tif _, err := mutators[0].Mutate(ctx, uccb.builders[0].mutation); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\treturn nodes, nil\n}", "func (c *Client) CreateBatch(data *CreateBatchParams) (*xendit.BatchDisbursement, *xendit.Error) {\n\treturn c.CreateBatchWithContext(context.Background(), data)\n}", "func (dcb *DatasourceCreateBulk) Save(ctx context.Context) ([]*Datasource, error) {\n\tspecs := make([]*sqlgraph.CreateSpec, len(dcb.builders))\n\tnodes := make([]*Datasource, len(dcb.builders))\n\tmutators := make([]Mutator, len(dcb.builders))\n\tfor i := range dcb.builders {\n\t\tfunc(i int, root context.Context) {\n\t\t\tbuilder := dcb.builders[i]\n\t\t\tbuilder.defaults()\n\t\t\tvar mut Mutator = MutateFunc(func(ctx context.Context, m Mutation) (Value, error) {\n\t\t\t\tmutation, ok := m.(*DatasourceMutation)\n\t\t\t\tif !ok {\n\t\t\t\t\treturn nil, fmt.Errorf(\"unexpected mutation type %T\", m)\n\t\t\t\t}\n\t\t\t\tif err := builder.check(); err != nil {\n\t\t\t\t\treturn nil, err\n\t\t\t\t}\n\t\t\t\tbuilder.mutation = mutation\n\t\t\t\tnodes[i], specs[i] = builder.createSpec()\n\t\t\t\tvar err error\n\t\t\t\tif i < len(mutators)-1 {\n\t\t\t\t\t_, err = mutators[i+1].Mutate(root, dcb.builders[i+1].mutation)\n\t\t\t\t} else {\n\t\t\t\t\t// Invoke the actual operation on the latest mutation in the chain.\n\t\t\t\t\tif err = sqlgraph.BatchCreate(ctx, dcb.driver, &sqlgraph.BatchCreateSpec{Nodes: specs}); err != nil {\n\t\t\t\t\t\tif cerr, ok := isSQLConstraintError(err); ok {\n\t\t\t\t\t\t\terr = cerr\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tmutation.done = true\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn nil, err\n\t\t\t\t}\n\t\t\t\tif nodes[i].ID == 0 {\n\t\t\t\t\tid := specs[i].ID.Value.(int64)\n\t\t\t\t\tnodes[i].ID = int64(id)\n\t\t\t\t}\n\t\t\t\treturn nodes[i], nil\n\t\t\t})\n\t\t\tfor i := len(builder.hooks) - 1; i >= 0; i-- {\n\t\t\t\tmut = builder.hooks[i](mut)\n\t\t\t}\n\t\t\tmutators[i] = mut\n\t\t}(i, ctx)\n\t}\n\tif len(mutators) > 0 {\n\t\tif _, err := mutators[0].Mutate(ctx, dcb.builders[0].mutation); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\treturn nodes, nil\n}", "func (bcb *BouncerCreateBulk) Save(ctx context.Context) ([]*Bouncer, error) {\n\tspecs := make([]*sqlgraph.CreateSpec, len(bcb.builders))\n\tnodes := make([]*Bouncer, len(bcb.builders))\n\tmutators := make([]Mutator, len(bcb.builders))\n\tfor i := range bcb.builders {\n\t\tfunc(i int, root context.Context) {\n\t\t\tbuilder := bcb.builders[i]\n\t\t\tbuilder.defaults()\n\t\t\tvar mut Mutator = MutateFunc(func(ctx context.Context, m Mutation) (Value, error) {\n\t\t\t\tmutation, ok := m.(*BouncerMutation)\n\t\t\t\tif !ok {\n\t\t\t\t\treturn nil, fmt.Errorf(\"unexpected mutation type %T\", m)\n\t\t\t\t}\n\t\t\t\tif err := builder.check(); err != nil {\n\t\t\t\t\treturn nil, err\n\t\t\t\t}\n\t\t\t\tbuilder.mutation = mutation\n\t\t\t\tnodes[i], specs[i] = builder.createSpec()\n\t\t\t\tvar err error\n\t\t\t\tif i < len(mutators)-1 {\n\t\t\t\t\t_, err = mutators[i+1].Mutate(root, bcb.builders[i+1].mutation)\n\t\t\t\t} else {\n\t\t\t\t\tspec := &sqlgraph.BatchCreateSpec{Nodes: specs}\n\t\t\t\t\t// Invoke the actual operation on the latest mutation in the chain.\n\t\t\t\t\tif err = sqlgraph.BatchCreate(ctx, bcb.driver, spec); err != nil {\n\t\t\t\t\t\tif sqlgraph.IsConstraintError(err) {\n\t\t\t\t\t\t\terr = &ConstraintError{msg: err.Error(), wrap: err}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn nil, err\n\t\t\t\t}\n\t\t\t\tmutation.id = &nodes[i].ID\n\t\t\t\tif specs[i].ID.Value != nil {\n\t\t\t\t\tid := specs[i].ID.Value.(int64)\n\t\t\t\t\tnodes[i].ID = int(id)\n\t\t\t\t}\n\t\t\t\tmutation.done = true\n\t\t\t\treturn nodes[i], nil\n\t\t\t})\n\t\t\tfor i := len(builder.hooks) - 1; i >= 0; i-- {\n\t\t\t\tmut = builder.hooks[i](mut)\n\t\t\t}\n\t\t\tmutators[i] = mut\n\t\t}(i, ctx)\n\t}\n\tif len(mutators) > 0 {\n\t\tif _, err := mutators[0].Mutate(ctx, bcb.builders[0].mutation); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\treturn nodes, nil\n}", "func (ccb *CustomerCreateBulk) Save(ctx context.Context) ([]*Customer, error) {\n\tspecs := make([]*sqlgraph.CreateSpec, len(ccb.builders))\n\tnodes := make([]*Customer, len(ccb.builders))\n\tmutators := make([]Mutator, len(ccb.builders))\n\tfor i := range ccb.builders {\n\t\tfunc(i int, root context.Context) {\n\t\t\tbuilder := ccb.builders[i]\n\t\t\tbuilder.defaults()\n\t\t\tvar mut Mutator = MutateFunc(func(ctx context.Context, m Mutation) (Value, error) {\n\t\t\t\tmutation, ok := m.(*CustomerMutation)\n\t\t\t\tif !ok {\n\t\t\t\t\treturn nil, fmt.Errorf(\"unexpected mutation type %T\", m)\n\t\t\t\t}\n\t\t\t\tif err := builder.check(); err != nil {\n\t\t\t\t\treturn nil, err\n\t\t\t\t}\n\t\t\t\tbuilder.mutation = mutation\n\t\t\t\tnodes[i], specs[i] = builder.createSpec()\n\t\t\t\tvar err error\n\t\t\t\tif i < len(mutators)-1 {\n\t\t\t\t\t_, err = mutators[i+1].Mutate(root, ccb.builders[i+1].mutation)\n\t\t\t\t} else {\n\t\t\t\t\t// Invoke the actual operation on the latest mutation in the chain.\n\t\t\t\t\tif err = sqlgraph.BatchCreate(ctx, ccb.driver, &sqlgraph.BatchCreateSpec{Nodes: specs}); err != nil {\n\t\t\t\t\t\tif cerr, ok := isSQLConstraintError(err); ok {\n\t\t\t\t\t\t\terr = cerr\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tmutation.done = true\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn nil, err\n\t\t\t\t}\n\t\t\t\tid := specs[i].ID.Value.(int64)\n\t\t\t\tnodes[i].ID = int(id)\n\t\t\t\treturn nodes[i], nil\n\t\t\t})\n\t\t\tfor i := len(builder.hooks) - 1; i >= 0; i-- {\n\t\t\t\tmut = builder.hooks[i](mut)\n\t\t\t}\n\t\t\tmutators[i] = mut\n\t\t}(i, ctx)\n\t}\n\tif len(mutators) > 0 {\n\t\tif _, err := mutators[0].Mutate(ctx, ccb.builders[0].mutation); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\treturn nodes, nil\n}", "func (z *Category) Create(tx Querier) error {\n\treturn nil\n}", "func BuildBulkPayload(collectionBulkBody string) (*collection.BulkPayload, error) {\n\tvar err error\n\tvar body BulkRequestBody\n\t{\n\t\terr = json.Unmarshal([]byte(collectionBulkBody), &body)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"invalid JSON for body, \\nerror: %s, \\nexample of valid JSON:\\n%s\", err, \"'{\\n \\\"operation\\\": \\\"cancel\\\",\\n \\\"size\\\": 1,\\n \\\"status\\\": \\\"in progress\\\"\\n }'\")\n\t\t}\n\t\tif !(body.Operation == \"retry\" || body.Operation == \"cancel\" || body.Operation == \"abandon\") {\n\t\t\terr = goa.MergeErrors(err, goa.InvalidEnumValueError(\"body.operation\", body.Operation, []any{\"retry\", \"cancel\", \"abandon\"}))\n\t\t}\n\t\tif !(body.Status == \"new\" || body.Status == \"in progress\" || body.Status == \"done\" || body.Status == \"error\" || body.Status == \"unknown\" || body.Status == \"queued\" || body.Status == \"pending\" || body.Status == \"abandoned\") {\n\t\t\terr = goa.MergeErrors(err, goa.InvalidEnumValueError(\"body.status\", body.Status, []any{\"new\", \"in progress\", \"done\", \"error\", \"unknown\", \"queued\", \"pending\", \"abandoned\"}))\n\t\t}\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\tv := &collection.BulkPayload{\n\t\tOperation: body.Operation,\n\t\tStatus: body.Status,\n\t\tSize: body.Size,\n\t}\n\t{\n\t\tvar zero uint\n\t\tif v.Size == zero {\n\t\t\tv.Size = 100\n\t\t}\n\t}\n\n\treturn v, nil\n}", "func (ccb *CommentCreateBulk) Save(ctx context.Context) ([]*Comment, error) {\n\tspecs := make([]*sqlgraph.CreateSpec, len(ccb.builders))\n\tnodes := make([]*Comment, len(ccb.builders))\n\tmutators := make([]Mutator, len(ccb.builders))\n\tfor i := range ccb.builders {\n\t\tfunc(i int, root context.Context) {\n\t\t\tbuilder := ccb.builders[i]\n\t\t\tbuilder.defaults()\n\t\t\tvar mut Mutator = MutateFunc(func(ctx context.Context, m Mutation) (Value, error) {\n\t\t\t\tmutation, ok := m.(*CommentMutation)\n\t\t\t\tif !ok {\n\t\t\t\t\treturn nil, fmt.Errorf(\"unexpected mutation type %T\", m)\n\t\t\t\t}\n\t\t\t\tif err := builder.check(); err != nil {\n\t\t\t\t\treturn nil, err\n\t\t\t\t}\n\t\t\t\tbuilder.mutation = mutation\n\t\t\t\tnodes[i], specs[i] = builder.createSpec()\n\t\t\t\tvar err error\n\t\t\t\tif i < len(mutators)-1 {\n\t\t\t\t\t_, err = mutators[i+1].Mutate(root, ccb.builders[i+1].mutation)\n\t\t\t\t} else {\n\t\t\t\t\t// Invoke the actual operation on the latest mutation in the chain.\n\t\t\t\t\tif err = sqlgraph.BatchCreate(ctx, ccb.driver, &sqlgraph.BatchCreateSpec{Nodes: specs}); err != nil {\n\t\t\t\t\t\tif cerr, ok := isSQLConstraintError(err); ok {\n\t\t\t\t\t\t\terr = cerr\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tmutation.done = true\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn nil, err\n\t\t\t\t}\n\t\t\t\tid := specs[i].ID.Value.(int64)\n\t\t\t\tnodes[i].ID = int(id)\n\t\t\t\treturn nodes[i], nil\n\t\t\t})\n\t\t\tfor i := len(builder.hooks) - 1; i >= 0; i-- {\n\t\t\t\tmut = builder.hooks[i](mut)\n\t\t\t}\n\t\t\tmutators[i] = mut\n\t\t}(i, ctx)\n\t}\n\tif len(mutators) > 0 {\n\t\tif _, err := mutators[0].Mutate(ctx, ccb.builders[0].mutation); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\treturn nodes, nil\n}", "func (icb *InstanceCreateBulk) Save(ctx context.Context) ([]*Instance, error) {\n\tspecs := make([]*sqlgraph.CreateSpec, len(icb.builders))\n\tnodes := make([]*Instance, len(icb.builders))\n\tmutators := make([]Mutator, len(icb.builders))\n\tfor i := range icb.builders {\n\t\tfunc(i int, root context.Context) {\n\t\t\tbuilder := icb.builders[i]\n\t\t\tbuilder.defaults()\n\t\t\tvar mut Mutator = MutateFunc(func(ctx context.Context, m Mutation) (Value, error) {\n\t\t\t\tmutation, ok := m.(*InstanceMutation)\n\t\t\t\tif !ok {\n\t\t\t\t\treturn nil, fmt.Errorf(\"unexpected mutation type %T\", m)\n\t\t\t\t}\n\t\t\t\tif err := builder.check(); err != nil {\n\t\t\t\t\treturn nil, err\n\t\t\t\t}\n\t\t\t\tbuilder.mutation = mutation\n\t\t\t\tnodes[i], specs[i] = builder.createSpec()\n\t\t\t\tvar err error\n\t\t\t\tif i < len(mutators)-1 {\n\t\t\t\t\t_, err = mutators[i+1].Mutate(root, icb.builders[i+1].mutation)\n\t\t\t\t} else {\n\t\t\t\t\tspec := &sqlgraph.BatchCreateSpec{Nodes: specs}\n\t\t\t\t\t// Invoke the actual operation on the latest mutation in the chain.\n\t\t\t\t\tif err = sqlgraph.BatchCreate(ctx, icb.driver, spec); err != nil {\n\t\t\t\t\t\tif sqlgraph.IsConstraintError(err) {\n\t\t\t\t\t\t\terr = &ConstraintError{err.Error(), err}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn nil, err\n\t\t\t\t}\n\t\t\t\tmutation.id = &nodes[i].ID\n\t\t\t\tmutation.done = true\n\t\t\t\treturn nodes[i], nil\n\t\t\t})\n\t\t\tfor i := len(builder.hooks) - 1; i >= 0; i-- {\n\t\t\t\tmut = builder.hooks[i](mut)\n\t\t\t}\n\t\t\tmutators[i] = mut\n\t\t}(i, ctx)\n\t}\n\tif len(mutators) > 0 {\n\t\tif _, err := mutators[0].Mutate(ctx, icb.builders[0].mutation); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\treturn nodes, nil\n}", "func (bbcb *BasicBannerCreateBulk) Save(ctx context.Context) ([]*BasicBanner, error) {\n\tspecs := make([]*sqlgraph.CreateSpec, len(bbcb.builders))\n\tnodes := make([]*BasicBanner, len(bbcb.builders))\n\tmutators := make([]Mutator, len(bbcb.builders))\n\tfor i := range bbcb.builders {\n\t\tfunc(i int, root context.Context) {\n\t\t\tbuilder := bbcb.builders[i]\n\t\t\tbuilder.defaults()\n\t\t\tvar mut Mutator = MutateFunc(func(ctx context.Context, m Mutation) (Value, error) {\n\t\t\t\tmutation, ok := m.(*BasicBannerMutation)\n\t\t\t\tif !ok {\n\t\t\t\t\treturn nil, fmt.Errorf(\"unexpected mutation type %T\", m)\n\t\t\t\t}\n\t\t\t\tif err := builder.check(); err != nil {\n\t\t\t\t\treturn nil, err\n\t\t\t\t}\n\t\t\t\tbuilder.mutation = mutation\n\t\t\t\tnodes[i], specs[i] = builder.createSpec()\n\t\t\t\tvar err error\n\t\t\t\tif i < len(mutators)-1 {\n\t\t\t\t\t_, err = mutators[i+1].Mutate(root, bbcb.builders[i+1].mutation)\n\t\t\t\t} else {\n\t\t\t\t\t// Invoke the actual operation on the latest mutation in the chain.\n\t\t\t\t\tif err = sqlgraph.BatchCreate(ctx, bbcb.driver, &sqlgraph.BatchCreateSpec{Nodes: specs}); err != nil {\n\t\t\t\t\t\tif cerr, ok := isSQLConstraintError(err); ok {\n\t\t\t\t\t\t\terr = cerr\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tmutation.done = true\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn nil, err\n\t\t\t\t}\n\t\t\t\tid := specs[i].ID.Value.(int64)\n\t\t\t\tnodes[i].ID = int(id)\n\t\t\t\treturn nodes[i], nil\n\t\t\t})\n\t\t\tfor i := len(builder.hooks) - 1; i >= 0; i-- {\n\t\t\t\tmut = builder.hooks[i](mut)\n\t\t\t}\n\t\t\tmutators[i] = mut\n\t\t}(i, ctx)\n\t}\n\tif len(mutators) > 0 {\n\t\tif _, err := mutators[0].Mutate(ctx, bbcb.builders[0].mutation); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\treturn nodes, nil\n}", "func (t *TrackingCategories) Create(provider xerogolang.IProvider, session goth.Session) (*TrackingCategories, error) {\n\tadditionalHeaders := map[string]string{\n\t\t\"Accept\": \"application/json\",\n\t\t\"Content-Type\": \"application/xml\",\n\t}\n\n\tbody, err := xml.MarshalIndent(t, \" \", \"\t\")\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\ttrackingCategoryResponseBytes, err := provider.Create(session, \"TrackingCategories\", additionalHeaders, body)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn unmarshalTrackingCategory(trackingCategoryResponseBytes)\n}", "func (ai *AppInteractor) CreateBatch(apps []domain.App) ([]string, error) {\n\treturn ai.AppRepository.CreateBatch(apps)\n}", "func NewBatch(docs []doc.Metadata, opts ...BatchOption) Batch {\n\tb := Batch{Docs: docs}\n\n\tfor _, opt := range opts {\n\t\tb = opt.apply(b)\n\t}\n\n\treturn b\n}", "func (ctcb *ClinicalTrialCreateBulk) Save(ctx context.Context) ([]*ClinicalTrial, error) {\n\tspecs := make([]*sqlgraph.CreateSpec, len(ctcb.builders))\n\tnodes := make([]*ClinicalTrial, len(ctcb.builders))\n\tmutators := make([]Mutator, len(ctcb.builders))\n\tfor i := range ctcb.builders {\n\t\tfunc(i int, root context.Context) {\n\t\t\tbuilder := ctcb.builders[i]\n\t\t\tvar mut Mutator = MutateFunc(func(ctx context.Context, m Mutation) (Value, error) {\n\t\t\t\tmutation, ok := m.(*ClinicalTrialMutation)\n\t\t\t\tif !ok {\n\t\t\t\t\treturn nil, fmt.Errorf(\"unexpected mutation type %T\", m)\n\t\t\t\t}\n\t\t\t\tif err := builder.check(); err != nil {\n\t\t\t\t\treturn nil, err\n\t\t\t\t}\n\t\t\t\tbuilder.mutation = mutation\n\t\t\t\tnodes[i], specs[i] = builder.createSpec()\n\t\t\t\tvar err error\n\t\t\t\tif i < len(mutators)-1 {\n\t\t\t\t\t_, err = mutators[i+1].Mutate(root, ctcb.builders[i+1].mutation)\n\t\t\t\t} else {\n\t\t\t\t\tspec := &sqlgraph.BatchCreateSpec{Nodes: specs}\n\t\t\t\t\t// Invoke the actual operation on the latest mutation in the chain.\n\t\t\t\t\tif err = sqlgraph.BatchCreate(ctx, ctcb.driver, spec); err != nil {\n\t\t\t\t\t\tif sqlgraph.IsConstraintError(err) {\n\t\t\t\t\t\t\terr = &ConstraintError{err.Error(), err}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn nil, err\n\t\t\t\t}\n\t\t\t\tmutation.id = &nodes[i].ID\n\t\t\t\tmutation.done = true\n\t\t\t\tif specs[i].ID.Value != nil {\n\t\t\t\t\tid := specs[i].ID.Value.(int64)\n\t\t\t\t\tnodes[i].ID = int(id)\n\t\t\t\t}\n\t\t\t\treturn nodes[i], nil\n\t\t\t})\n\t\t\tfor i := len(builder.hooks) - 1; i >= 0; i-- {\n\t\t\t\tmut = builder.hooks[i](mut)\n\t\t\t}\n\t\t\tmutators[i] = mut\n\t\t}(i, ctx)\n\t}\n\tif len(mutators) > 0 {\n\t\tif _, err := mutators[0].Mutate(ctx, ctcb.builders[0].mutation); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\treturn nodes, nil\n}", "func (crcb *CasbinRuleCreateBulk) Save(ctx context.Context) ([]*CasbinRule, error) {\n\tspecs := make([]*sqlgraph.CreateSpec, len(crcb.builders))\n\tnodes := make([]*CasbinRule, len(crcb.builders))\n\tmutators := make([]Mutator, len(crcb.builders))\n\tfor i := range crcb.builders {\n\t\tfunc(i int, root context.Context) {\n\t\t\tbuilder := crcb.builders[i]\n\t\t\tvar mut Mutator = MutateFunc(func(ctx context.Context, m Mutation) (Value, error) {\n\t\t\t\tmutation, ok := m.(*CasbinRuleMutation)\n\t\t\t\tif !ok {\n\t\t\t\t\treturn nil, fmt.Errorf(\"unexpected mutation type %T\", m)\n\t\t\t\t}\n\t\t\t\tif err := builder.check(); err != nil {\n\t\t\t\t\treturn nil, err\n\t\t\t\t}\n\t\t\t\tbuilder.mutation = mutation\n\t\t\t\tnodes[i], specs[i] = builder.createSpec()\n\t\t\t\tvar err error\n\t\t\t\tif i < len(mutators)-1 {\n\t\t\t\t\t_, err = mutators[i+1].Mutate(root, crcb.builders[i+1].mutation)\n\t\t\t\t} else {\n\t\t\t\t\t// Invoke the actual operation on the latest mutation in the chain.\n\t\t\t\t\tif err = sqlgraph.BatchCreate(ctx, crcb.driver, &sqlgraph.BatchCreateSpec{Nodes: specs}); err != nil {\n\t\t\t\t\t\tif cerr, ok := isSQLConstraintError(err); ok {\n\t\t\t\t\t\t\terr = cerr\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tmutation.done = true\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn nil, err\n\t\t\t\t}\n\t\t\t\tid := specs[i].ID.Value.(int64)\n\t\t\t\tnodes[i].ID = int(id)\n\t\t\t\treturn nodes[i], nil\n\t\t\t})\n\t\t\tfor i := len(builder.hooks) - 1; i >= 0; i-- {\n\t\t\t\tmut = builder.hooks[i](mut)\n\t\t\t}\n\t\t\tmutators[i] = mut\n\t\t}(i, ctx)\n\t}\n\tif len(mutators) > 0 {\n\t\tif _, err := mutators[0].Mutate(ctx, crcb.builders[0].mutation); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\treturn nodes, nil\n}", "func (ftcb *FileTypeCreateBulk) Save(ctx context.Context) ([]*FileType, error) {\n\tspecs := make([]*sqlgraph.CreateSpec, len(ftcb.builders))\n\tnodes := make([]*FileType, len(ftcb.builders))\n\tmutators := make([]Mutator, len(ftcb.builders))\n\tfor i := range ftcb.builders {\n\t\tfunc(i int, root context.Context) {\n\t\t\tbuilder := ftcb.builders[i]\n\t\t\tbuilder.defaults()\n\t\t\tvar mut Mutator = MutateFunc(func(ctx context.Context, m Mutation) (Value, error) {\n\t\t\t\tmutation, ok := m.(*FileTypeMutation)\n\t\t\t\tif !ok {\n\t\t\t\t\treturn nil, fmt.Errorf(\"unexpected mutation type %T\", m)\n\t\t\t\t}\n\t\t\t\tif err := builder.check(); err != nil {\n\t\t\t\t\treturn nil, err\n\t\t\t\t}\n\t\t\t\tbuilder.mutation = mutation\n\t\t\t\tnodes[i], specs[i] = builder.createSpec()\n\t\t\t\tvar err error\n\t\t\t\tif i < len(mutators)-1 {\n\t\t\t\t\t_, err = mutators[i+1].Mutate(root, ftcb.builders[i+1].mutation)\n\t\t\t\t} else {\n\t\t\t\t\tspec := &sqlgraph.BatchCreateSpec{Nodes: specs}\n\t\t\t\t\tspec.OnConflict = ftcb.conflict\n\t\t\t\t\t// Invoke the actual operation on the latest mutation in the chain.\n\t\t\t\t\tif err = sqlgraph.BatchCreate(ctx, ftcb.driver, spec); err != nil {\n\t\t\t\t\t\tif sqlgraph.IsConstraintError(err) {\n\t\t\t\t\t\t\terr = &ConstraintError{msg: err.Error(), wrap: err}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn nil, err\n\t\t\t\t}\n\t\t\t\tmutation.id = &nodes[i].ID\n\t\t\t\tif specs[i].ID.Value != nil {\n\t\t\t\t\tid := specs[i].ID.Value.(int64)\n\t\t\t\t\tnodes[i].ID = int(id)\n\t\t\t\t}\n\t\t\t\tmutation.done = true\n\t\t\t\treturn nodes[i], nil\n\t\t\t})\n\t\t\tfor i := len(builder.hooks) - 1; i >= 0; i-- {\n\t\t\t\tmut = builder.hooks[i](mut)\n\t\t\t}\n\t\t\tmutators[i] = mut\n\t\t}(i, ctx)\n\t}\n\tif len(mutators) > 0 {\n\t\tif _, err := mutators[0].Mutate(ctx, ftcb.builders[0].mutation); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\treturn nodes, nil\n}", "func (ocb *OAuth2ClientCreateBulk) Save(ctx context.Context) ([]*OAuth2Client, error) {\n\tspecs := make([]*sqlgraph.CreateSpec, len(ocb.builders))\n\tnodes := make([]*OAuth2Client, len(ocb.builders))\n\tmutators := make([]Mutator, len(ocb.builders))\n\tfor i := range ocb.builders {\n\t\tfunc(i int, root context.Context) {\n\t\t\tbuilder := ocb.builders[i]\n\t\t\tvar mut Mutator = MutateFunc(func(ctx context.Context, m Mutation) (Value, error) {\n\t\t\t\tmutation, ok := m.(*OAuth2ClientMutation)\n\t\t\t\tif !ok {\n\t\t\t\t\treturn nil, fmt.Errorf(\"unexpected mutation type %T\", m)\n\t\t\t\t}\n\t\t\t\tif err := builder.check(); err != nil {\n\t\t\t\t\treturn nil, err\n\t\t\t\t}\n\t\t\t\tbuilder.mutation = mutation\n\t\t\t\tvar err error\n\t\t\t\tnodes[i], specs[i] = builder.createSpec()\n\t\t\t\tif i < len(mutators)-1 {\n\t\t\t\t\t_, err = mutators[i+1].Mutate(root, ocb.builders[i+1].mutation)\n\t\t\t\t} else {\n\t\t\t\t\tspec := &sqlgraph.BatchCreateSpec{Nodes: specs}\n\t\t\t\t\t// Invoke the actual operation on the latest mutation in the chain.\n\t\t\t\t\tif err = sqlgraph.BatchCreate(ctx, ocb.driver, spec); err != nil {\n\t\t\t\t\t\tif sqlgraph.IsConstraintError(err) {\n\t\t\t\t\t\t\terr = &ConstraintError{msg: err.Error(), wrap: err}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn nil, err\n\t\t\t\t}\n\t\t\t\tmutation.id = &nodes[i].ID\n\t\t\t\tmutation.done = true\n\t\t\t\treturn nodes[i], nil\n\t\t\t})\n\t\t\tfor i := len(builder.hooks) - 1; i >= 0; i-- {\n\t\t\t\tmut = builder.hooks[i](mut)\n\t\t\t}\n\t\t\tmutators[i] = mut\n\t\t}(i, ctx)\n\t}\n\tif len(mutators) > 0 {\n\t\tif _, err := mutators[0].Mutate(ctx, ocb.builders[0].mutation); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\treturn nodes, nil\n}", "func createBatch(xs []*storobj.Object) indexedBatch {\n\tvar bi indexedBatch\n\tbi.Data = xs\n\tbi.Index = make([]int, len(xs))\n\tfor i := 0; i < len(xs); i++ {\n\t\tbi.Index[i] = i\n\t}\n\treturn bi\n}", "func (rcb *RentalCreateBulk) Save(ctx context.Context) ([]*Rental, error) {\n\tspecs := make([]*sqlgraph.CreateSpec, len(rcb.builders))\n\tnodes := make([]*Rental, len(rcb.builders))\n\tmutators := make([]Mutator, len(rcb.builders))\n\tfor i := range rcb.builders {\n\t\tfunc(i int, root context.Context) {\n\t\t\tbuilder := rcb.builders[i]\n\t\t\tbuilder.defaults()\n\t\t\tvar mut Mutator = MutateFunc(func(ctx context.Context, m Mutation) (Value, error) {\n\t\t\t\tmutation, ok := m.(*RentalMutation)\n\t\t\t\tif !ok {\n\t\t\t\t\treturn nil, fmt.Errorf(\"unexpected mutation type %T\", m)\n\t\t\t\t}\n\t\t\t\tif err := builder.check(); err != nil {\n\t\t\t\t\treturn nil, err\n\t\t\t\t}\n\t\t\t\tbuilder.mutation = mutation\n\t\t\t\tnodes[i], specs[i] = builder.createSpec()\n\t\t\t\tvar err error\n\t\t\t\tif i < len(mutators)-1 {\n\t\t\t\t\t_, err = mutators[i+1].Mutate(root, rcb.builders[i+1].mutation)\n\t\t\t\t} else {\n\t\t\t\t\tspec := &sqlgraph.BatchCreateSpec{Nodes: specs}\n\t\t\t\t\t// Invoke the actual operation on the latest mutation in the chain.\n\t\t\t\t\tif err = sqlgraph.BatchCreate(ctx, rcb.driver, spec); err != nil {\n\t\t\t\t\t\tif sqlgraph.IsConstraintError(err) {\n\t\t\t\t\t\t\terr = &ConstraintError{msg: err.Error(), wrap: err}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn nil, err\n\t\t\t\t}\n\t\t\t\tmutation.id = &nodes[i].ID\n\t\t\t\tif specs[i].ID.Value != nil {\n\t\t\t\t\tid := specs[i].ID.Value.(int64)\n\t\t\t\t\tnodes[i].ID = int(id)\n\t\t\t\t}\n\t\t\t\tmutation.done = true\n\t\t\t\treturn nodes[i], nil\n\t\t\t})\n\t\t\tfor i := len(builder.hooks) - 1; i >= 0; i-- {\n\t\t\t\tmut = builder.hooks[i](mut)\n\t\t\t}\n\t\t\tmutators[i] = mut\n\t\t}(i, ctx)\n\t}\n\tif len(mutators) > 0 {\n\t\tif _, err := mutators[0].Mutate(ctx, rcb.builders[0].mutation); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\treturn nodes, nil\n}", "func (icb *ItemCreateBulk) Save(ctx context.Context) ([]*Item, error) {\n\tspecs := make([]*sqlgraph.CreateSpec, len(icb.builders))\n\tnodes := make([]*Item, len(icb.builders))\n\tmutators := make([]Mutator, len(icb.builders))\n\tfor i := range icb.builders {\n\t\tfunc(i int, root context.Context) {\n\t\t\tbuilder := icb.builders[i]\n\t\t\tbuilder.defaults()\n\t\t\tvar mut Mutator = MutateFunc(func(ctx context.Context, m Mutation) (Value, error) {\n\t\t\t\tmutation, ok := m.(*ItemMutation)\n\t\t\t\tif !ok {\n\t\t\t\t\treturn nil, fmt.Errorf(\"unexpected mutation type %T\", m)\n\t\t\t\t}\n\t\t\t\tif err := builder.check(); err != nil {\n\t\t\t\t\treturn nil, err\n\t\t\t\t}\n\t\t\t\tbuilder.mutation = mutation\n\t\t\t\tnodes[i], specs[i] = builder.createSpec()\n\t\t\t\tvar err error\n\t\t\t\tif i < len(mutators)-1 {\n\t\t\t\t\t_, err = mutators[i+1].Mutate(root, icb.builders[i+1].mutation)\n\t\t\t\t} else {\n\t\t\t\t\tspec := &sqlgraph.BatchCreateSpec{Nodes: specs}\n\t\t\t\t\tspec.OnConflict = icb.conflict\n\t\t\t\t\t// Invoke the actual operation on the latest mutation in the chain.\n\t\t\t\t\tif err = sqlgraph.BatchCreate(ctx, icb.driver, spec); err != nil {\n\t\t\t\t\t\tif sqlgraph.IsConstraintError(err) {\n\t\t\t\t\t\t\terr = &ConstraintError{msg: err.Error(), wrap: err}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn nil, err\n\t\t\t\t}\n\t\t\t\tmutation.id = &nodes[i].ID\n\t\t\t\tmutation.done = true\n\t\t\t\treturn nodes[i], nil\n\t\t\t})\n\t\t\tfor i := len(builder.hooks) - 1; i >= 0; i-- {\n\t\t\t\tmut = builder.hooks[i](mut)\n\t\t\t}\n\t\t\tmutators[i] = mut\n\t\t}(i, ctx)\n\t}\n\tif len(mutators) > 0 {\n\t\tif _, err := mutators[0].Mutate(ctx, icb.builders[0].mutation); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\treturn nodes, nil\n}", "func GetAllCategory(c * gin.Context){\n\tdb := database.DBConn()\n\trows, err := db.Query(\"SELECT * FROM category\")\n\tif err != nil{\n\t\tc.JSON(500, gin.H{\n\t\t\t\"messages\" : \"Story not found\",\n\t\t});\n\t}\n\tpost := DTO.CategoryDTO{}\n\tlist := [] DTO.CategoryDTO{}\n\tfor rows.Next(){\n\t\tvar id, types int\n\t\tvar name string\n\t\terr = rows.Scan(&id, &name, &types)\n\t\tif err != nil {\n\t\t\tpanic(err.Error())\n\t\t}\n\t\tpost.Id = id\n\t\tpost.Name = name\n\t\tpost.Type = types\n\t\tlist = append(list,post);\n\t}\n\tc.JSON(200, list)\n\tdefer db.Close()\n}", "func New(conn *pgx.Conn, size int64, tableName string, columnNames []string) *Batcher {\n\treturn &Batcher{\n\t\tconn: conn,\n\t\tsize: size,\n\t\ttableName: tableName,\n\t\tcolumnNames: columnNames,\n\t}\n}", "func (fcb *FeedCreateBulk) Save(ctx context.Context) ([]*Feed, error) {\n\tspecs := make([]*sqlgraph.CreateSpec, len(fcb.builders))\n\tnodes := make([]*Feed, len(fcb.builders))\n\tmutators := make([]Mutator, len(fcb.builders))\n\tfor i := range fcb.builders {\n\t\tfunc(i int, root context.Context) {\n\t\t\tbuilder := fcb.builders[i]\n\t\t\tvar mut Mutator = MutateFunc(func(ctx context.Context, m Mutation) (Value, error) {\n\t\t\t\tif err := builder.preSave(); err != nil {\n\t\t\t\t\treturn nil, err\n\t\t\t\t}\n\t\t\t\tmutation, ok := m.(*FeedMutation)\n\t\t\t\tif !ok {\n\t\t\t\t\treturn nil, fmt.Errorf(\"unexpected mutation type %T\", m)\n\t\t\t\t}\n\t\t\t\tbuilder.mutation = mutation\n\t\t\t\tnodes[i], specs[i] = builder.createSpec()\n\t\t\t\tvar err error\n\t\t\t\tif i < len(mutators)-1 {\n\t\t\t\t\t_, err = mutators[i+1].Mutate(root, fcb.builders[i+1].mutation)\n\t\t\t\t} else {\n\t\t\t\t\t// Invoke the actual operation on the latest mutation in the chain.\n\t\t\t\t\tif err = sqlgraph.BatchCreate(ctx, fcb.driver, &sqlgraph.BatchCreateSpec{Nodes: specs}); err != nil {\n\t\t\t\t\t\tif cerr, ok := isSQLConstraintError(err); ok {\n\t\t\t\t\t\t\terr = cerr\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tmutation.done = true\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn nil, err\n\t\t\t\t}\n\t\t\t\tif nodes[i].ID == 0 {\n\t\t\t\t\tid := specs[i].ID.Value.(int64)\n\t\t\t\t\tnodes[i].ID = int64(id)\n\t\t\t\t}\n\t\t\t\treturn nodes[i], nil\n\t\t\t})\n\t\t\tfor i := len(builder.hooks) - 1; i >= 0; i-- {\n\t\t\t\tmut = builder.hooks[i](mut)\n\t\t\t}\n\t\t\tmutators[i] = mut\n\t\t}(i, ctx)\n\t}\n\tif len(mutators) > 0 {\n\t\tif _, err := mutators[0].Mutate(ctx, fcb.builders[0].mutation); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\treturn nodes, nil\n}", "func (ocb *OrganizationCreateBulk) Save(ctx context.Context) ([]*Organization, error) {\n\tspecs := make([]*sqlgraph.CreateSpec, len(ocb.builders))\n\tnodes := make([]*Organization, len(ocb.builders))\n\tmutators := make([]Mutator, len(ocb.builders))\n\tfor i := range ocb.builders {\n\t\tfunc(i int, root context.Context) {\n\t\t\tbuilder := ocb.builders[i]\n\t\t\tbuilder.defaults()\n\t\t\tvar mut Mutator = MutateFunc(func(ctx context.Context, m Mutation) (Value, error) {\n\t\t\t\tmutation, ok := m.(*OrganizationMutation)\n\t\t\t\tif !ok {\n\t\t\t\t\treturn nil, fmt.Errorf(\"unexpected mutation type %T\", m)\n\t\t\t\t}\n\t\t\t\tif err := builder.check(); err != nil {\n\t\t\t\t\treturn nil, err\n\t\t\t\t}\n\t\t\t\tbuilder.mutation = mutation\n\t\t\t\tnodes[i], specs[i] = builder.createSpec()\n\t\t\t\tvar err error\n\t\t\t\tif i < len(mutators)-1 {\n\t\t\t\t\t_, err = mutators[i+1].Mutate(root, ocb.builders[i+1].mutation)\n\t\t\t\t} else {\n\t\t\t\t\tspec := &sqlgraph.BatchCreateSpec{Nodes: specs}\n\t\t\t\t\tspec.OnConflict = ocb.conflict\n\t\t\t\t\t// Invoke the actual operation on the latest mutation in the chain.\n\t\t\t\t\tif err = sqlgraph.BatchCreate(ctx, ocb.driver, spec); err != nil {\n\t\t\t\t\t\tif sqlgraph.IsConstraintError(err) {\n\t\t\t\t\t\t\terr = &ConstraintError{err.Error(), err}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn nil, err\n\t\t\t\t}\n\t\t\t\tmutation.id = &nodes[i].ID\n\t\t\t\tmutation.done = true\n\t\t\t\tif specs[i].ID.Value != nil {\n\t\t\t\t\tid := specs[i].ID.Value.(int64)\n\t\t\t\t\tnodes[i].ID = int(id)\n\t\t\t\t}\n\t\t\t\treturn nodes[i], nil\n\t\t\t})\n\t\t\tfor i := len(builder.hooks) - 1; i >= 0; i-- {\n\t\t\t\tmut = builder.hooks[i](mut)\n\t\t\t}\n\t\t\tmutators[i] = mut\n\t\t}(i, ctx)\n\t}\n\tif len(mutators) > 0 {\n\t\tif _, err := mutators[0].Mutate(ctx, ocb.builders[0].mutation); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\treturn nodes, nil\n}", "func (rcb *RestaurantCreateBulk) Save(ctx context.Context) ([]*Restaurant, error) {\n\tspecs := make([]*sqlgraph.CreateSpec, len(rcb.builders))\n\tnodes := make([]*Restaurant, len(rcb.builders))\n\tmutators := make([]Mutator, len(rcb.builders))\n\tfor i := range rcb.builders {\n\t\tfunc(i int, root context.Context) {\n\t\t\tbuilder := rcb.builders[i]\n\t\t\tvar mut Mutator = MutateFunc(func(ctx context.Context, m Mutation) (Value, error) {\n\t\t\t\tmutation, ok := m.(*RestaurantMutation)\n\t\t\t\tif !ok {\n\t\t\t\t\treturn nil, fmt.Errorf(\"unexpected mutation type %T\", m)\n\t\t\t\t}\n\t\t\t\tif err := builder.check(); err != nil {\n\t\t\t\t\treturn nil, err\n\t\t\t\t}\n\t\t\t\tbuilder.mutation = mutation\n\t\t\t\tnodes[i], specs[i] = builder.createSpec()\n\t\t\t\tvar err error\n\t\t\t\tif i < len(mutators)-1 {\n\t\t\t\t\t_, err = mutators[i+1].Mutate(root, rcb.builders[i+1].mutation)\n\t\t\t\t} else {\n\t\t\t\t\t// Invoke the actual operation on the latest mutation in the chain.\n\t\t\t\t\tif err = sqlgraph.BatchCreate(ctx, rcb.driver, &sqlgraph.BatchCreateSpec{Nodes: specs}); err != nil {\n\t\t\t\t\t\tif sqlgraph.IsConstraintError(err) {\n\t\t\t\t\t\t\terr = &ConstraintError{err.Error(), err}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn nil, err\n\t\t\t\t}\n\t\t\t\tmutation.id = &nodes[i].ID\n\t\t\t\tmutation.done = true\n\t\t\t\tid := specs[i].ID.Value.(int64)\n\t\t\t\tnodes[i].ID = int(id)\n\t\t\t\treturn nodes[i], nil\n\t\t\t})\n\t\t\tfor i := len(builder.hooks) - 1; i >= 0; i-- {\n\t\t\t\tmut = builder.hooks[i](mut)\n\t\t\t}\n\t\t\tmutators[i] = mut\n\t\t}(i, ctx)\n\t}\n\tif len(mutators) > 0 {\n\t\tif _, err := mutators[0].Mutate(ctx, rcb.builders[0].mutation); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\treturn nodes, nil\n}", "func NewBatchWriter(table string, columns []string, bulkItems int, ticker time.Duration) (*BatchWriter, error) {\n\n\tif bulkItems <= 1 {\n\t\treturn nil, fmt.Errorf(\"Bulk must be greater than 1. Have %d\", bulkItems)\n\t}\n\tif len(columns) == 0 {\n\t\treturn nil, fmt.Errorf(\"No columns for request\")\n\t}\n\n\tbw := new(BatchWriter)\n\tbw.columns = columns\n\tbw.bulkItems = bulkItems\n\tbw.ticker = ticker\n\tbw.table = table\n\tbw.closeFlag = new(int32)\n\tatomic.StoreInt32(bw.closeFlag, 1)\n\n\tbw.work = make(chan clickhouse.Row, bulkItems)\n\tbw.done = make(chan bool)\n\n\twg.Add(1)\n\n\t// TODO: this is unsafe\n\tworkers[bw] = true\n\n\tgo bw.worker(ticker, &wg)\n\n\treturn bw, nil\n\n}" ]
[ "0.6926651", "0.68936455", "0.68571854", "0.6801855", "0.6794223", "0.6789312", "0.6738356", "0.6708962", "0.66646916", "0.6652712", "0.66283643", "0.6612294", "0.6574002", "0.6565094", "0.6563574", "0.6562476", "0.63937384", "0.6376385", "0.6366158", "0.63619465", "0.63187766", "0.629574", "0.62692267", "0.6264757", "0.62490875", "0.6233371", "0.6209533", "0.6205852", "0.6202197", "0.619894", "0.61684626", "0.6144989", "0.6138786", "0.6118469", "0.6113726", "0.6113726", "0.6113726", "0.6113726", "0.6113726", "0.60894", "0.60472274", "0.60275155", "0.59952366", "0.5904474", "0.5807143", "0.58011204", "0.57914937", "0.576284", "0.57332873", "0.55604494", "0.55182105", "0.5452242", "0.5385568", "0.5331223", "0.5324999", "0.5281528", "0.5266787", "0.52610373", "0.52365357", "0.5220763", "0.52161705", "0.5141859", "0.5120082", "0.5074151", "0.5014846", "0.4992983", "0.49570686", "0.4936044", "0.48592263", "0.4828555", "0.48249242", "0.4815737", "0.4802972", "0.48001122", "0.47990587", "0.47950435", "0.47888154", "0.476629", "0.47588935", "0.47418946", "0.47161233", "0.4703436", "0.46963364", "0.4681229", "0.4679854", "0.4665217", "0.46624178", "0.46585524", "0.464858", "0.46369445", "0.46273038", "0.46267027", "0.4602964", "0.46018827", "0.4597659", "0.45547834", "0.45533136", "0.4546673", "0.45175597", "0.4514345" ]
0.8107647
0
Update returns an update builder for Category.
func (c *CategoryClient) Update() *CategoryUpdate { mutation := newCategoryMutation(c.config, OpUpdate) return &CategoryUpdate{config: c.config, hooks: c.Hooks(), mutation: mutation} }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (c *Category) Update() *CategoryUpdateOne {\n\treturn (&CategoryClient{config: c.config}).UpdateOne(c)\n}", "func Update(c *gin.Context){\n\tca := Category{}\n\terr := c.BindJSON(&ca)\n\tif err != nil {\n\t\tresponese.Error(c, err, nil)\n\t\treturn\n\t}\n\terr = ca.Update()\n\tif err != nil {\n\t\tresponese.Error(c, err, nil)\n\t\treturn\n\t}\n\tresponese.Success(c, \"updated\", nil)\n}", "func (s *CategoryService) Update(rs app.RequestScope, id int, model *models.Category) (*models.Category, error) {\n\tif err := model.Validate(); err != nil {\n\t\treturn nil, err\n\t}\n\tif err := s.dao.Update(rs, id, model); err != nil {\n\t\treturn nil, err\n\t}\n\treturn s.dao.Get(rs, id)\n}", "func UpdateCategory(p providers.CategoryProvider) func(c *fiber.Ctx) error {\n\treturn func(c *fiber.Ctx) error { \n\t\tcat := new(models.Category)\n\n\t\tif err := c.BodyParser(cat); err != nil {\n\t\t\treturn err\n\t\t}\n\t\tcategoryID, _ := strconv.Atoi(c.Params(\"id\"))\n\t\terr := p.CategoryUpdate(cat, categoryID)\n\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tresult := make([]*models.Category, 0)\n\t\treturn c.Render(\"category\", result)\n\t}\n}", "func (r *DeviceManagementSettingCategoryRequest) Update(ctx context.Context, reqObj *DeviceManagementSettingCategory) error {\n\treturn r.JSONRequest(ctx, \"PATCH\", \"\", reqObj, nil)\n}", "func (r *DeviceCategoryRequest) Update(ctx context.Context, reqObj *DeviceCategory) error {\n\treturn r.JSONRequest(ctx, \"PATCH\", \"\", reqObj, nil)\n}", "func UpdateCategory (w http.ResponseWriter, r *http.Request) {\n\t//get category id from the link\n\tcategoryID := mux.Vars(r)[\"id\"]\n\tvar updateCategory Category\n\n\t//get the information containing in request's body\n\t//or report an error\n\treqBody, err := ioutil.ReadAll(r.Body)\n\tif err != nil {\n\t\tfmt.Fprintf(w, \"Kindly enter data with the category name and description only in order to update\")\n\t}\n\n\t//unmarshal the information from JSON into the Category instance\n\t//or report an error\n\tif err = json.Unmarshal(reqBody, &updateCategory); err != nil {\n\t\tlog.Printf(\"Body parse error, %v\", err.Error())\n\t\tw.WriteHeader(400)\n\t\treturn\n\t}\n\n\t//find the given Category in the slice by id\n\tfor i, singleCategory := range Categories {\n\t\tif singleCategory.CategoryID == categoryID {\n\t\t\t//change the fields\n\t\t\tsingleCategory.CategoryName = updateCategory.CategoryName\n\t\t\tsingleCategory.CategoryDescription = updateCategory.CategoryDescription\n\n\t\t\tCategories = append(Categories[:i], singleCategory)\n\t\t\t//return the Category in response\n\t\t\t//or report an error\n\t\t\tif err = json.NewEncoder(w).Encode(singleCategory); err != nil {\n\t\t\t\tlog.Printf(err.Error())\n\t\t\t\tw.WriteHeader(500)\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t}\n}", "func (h *CategoryHandler) Update(ctx iris.Context) {\n\tvar cat entity.Category\n\tif err := ctx.ReadJSON(&cat); err != nil {\n\t\treturn\n\t}\n\n\taffected, err := h.service.Update(ctx.Request().Context(), cat)\n\tif err != nil {\n\t\tif err == sql.ErrUnprocessable {\n\t\t\tctx.StopWithJSON(iris.StatusUnprocessableEntity, newError(iris.StatusUnprocessableEntity, ctx.Request().Method, ctx.Path(), \"required fields are missing\"))\n\t\t\treturn\n\t\t}\n\n\t\tdebugf(\"CategoryHandler.Update(DB): %v\", err)\n\t\twriteInternalServerError(ctx)\n\t\treturn\n\t}\n\n\tstatus := iris.StatusOK\n\tif affected == 0 {\n\t\tstatus = iris.StatusNotModified\n\t}\n\n\tctx.StatusCode(status)\n}", "func (r *DeviceManagementIntentSettingCategoryRequest) Update(ctx context.Context, reqObj *DeviceManagementIntentSettingCategory) error {\n\treturn r.JSONRequest(ctx, \"PATCH\", \"\", reqObj, nil)\n}", "func Update(w http.ResponseWriter, r *http.Request) {\n\tparams := mux.Vars(r)\n\tcategory := &models.Category{Slug: r.FormValue(\"slug\"), Title: r.FormValue(\"title\")}\n\tresult, err := categoryrepository.UpdateByID(params[\"id\"], category)\n\tif err != nil {\n\t\thandler.RespondError(w, http.StatusInternalServerError, err.Error())\n\t\treturn\n\t}\n\thandler.RespondJSON(w, http.StatusOK, result)\n}", "func (r *DeviceManagementTemplateSettingCategoryRequest) Update(ctx context.Context, reqObj *DeviceManagementTemplateSettingCategory) error {\n\treturn r.JSONRequest(ctx, \"PATCH\", \"\", reqObj, nil)\n}", "func (cRepo *CategoryGormRepo) UpdateCategory(category *entity.Category) (*entity.Category, []error) {\n\tcat := category\n\terrs := cRepo.conn.Save(cat).GetErrors()\n\tif len(errs) > 0 {\n\t\treturn nil, errs\n\t}\n\treturn cat, errs\n}", "func (categories *Categories) UpdateCategory(category Category) (Category, error) {\n\tif category.ID == \"\" {\n\t\treturn category, ErrCategoryCanNotBeWithoutID\n\t}\n\n\ttransaction := categories.storage.Client.NewTxn()\n\n\tencodedCategory, err := json.Marshal(category)\n\tif err != nil {\n\t\tlog.Println(err)\n\t\treturn category, ErrCategoryCanNotBeUpdated\n\t}\n\n\tmutation := &dataBaseAPI.Mutation{\n\t\tSetJson: encodedCategory,\n\t\tCommitNow: true}\n\n\t_, err = transaction.Mutate(context.Background(), mutation)\n\tif err != nil {\n\t\tlog.Println(err)\n\t\treturn category, ErrCategoryCanNotBeUpdated\n\t}\n\n\tupdatedCategory, err := categories.ReadCategoryByID(category.ID, \".\")\n\tif err != nil {\n\t\tlog.Println(err)\n\t\treturn category, ErrCategoryCanNotBeUpdated\n\t}\n\n\treturn updatedCategory, nil\n}", "func (rc *RecommendationsCategory) Update() *RecommendationsCategoryUpdateOne {\n\treturn (&RecommendationsCategoryClient{config: rc.config}).UpdateOne(rc)\n}", "func (service *Service) UpdateCategory(request *restful.Request, response *restful.Response) {\n\tvar req models.CategoryRequest\n\tif err := request.ReadEntity(&req); err != nil {\n\t\trespondErr(response, http.StatusBadRequest, messageBadRequest,\n\t\t\t\"unable parse request body\")\n\n\t\tlogrus.WithFields(logrus.Fields{\"module\": \"service\", \"resp\": http.StatusBadRequest}).\n\t\t\tError(\"Unable to parse request body:\", err)\n\n\t\treturn\n\t}\n\n\tcategory := models.Category(req)\n\n\tupdatedCategory, err := service.server.UpdateCategory(category)\n\tif err == dao.ErrRecordNotFound {\n\t\trespondErr(response, http.StatusBadRequest, messageBadRequest,\n\t\t\t\"category not found\")\n\n\t\tlogrus.WithFields(logrus.Fields{\"module\": \"service\", \"resp\": http.StatusBadRequest}).\n\t\t\tError(\"Unable to update category:\", err)\n\n\t\treturn\n\t}\n\tif err != nil {\n\t\trespondErr(response, http.StatusInternalServerError, messageDatabaseError,\n\t\t\t\"unable to update category\")\n\n\t\tlogrus.WithFields(logrus.Fields{\"module\": \"service\", \"resp\": http.StatusInternalServerError}).\n\t\t\tError(\"Unable to update category:\", err)\n\n\t\treturn\n\t}\n\n\tresult := &models.UpdateCategoryResponse{\n\t\tResult: *updatedCategory,\n\t}\n\n\twriteResponse(response, http.StatusAccepted, result)\n}", "func (c *Category) Update(db *sql.DB) (err error) {\n\tres, err := db.Exec(`UPDATE category SET name=$1 WHERE id=$2`,\n\t\tc.Name, c.ID)\n\tif err != nil {\n\t\treturn err\n\t}\n\tcount, err := res.RowsAffected()\n\tif err != nil {\n\t\treturn err\n\t}\n\tif count != 1 {\n\t\treturn errors.New(\"Catégorie introuvable\")\n\t}\n\treturn err\n}", "func (e Endpoints) UpdateCategory(ctx context.Context, category io.TodoCategory) (c io.TodoCategory, error error) {\n\trequest := UpdateCategoryRequest{Category: category}\n\tresponse, err := e.UpdateCategoryEndpoint(ctx, request)\n\tif err != nil {\n\t\treturn\n\t}\n\treturn response.(UpdateCategoryResponse).C, response.(UpdateCategoryResponse).Error\n}", "func (category Category) UpdateCategory(categoryParam Category) (Category, error) {\n\tvar (\n\t\terr error\n\t)\n\n\t//Get province collection\n\tc := newCategoryCollection()\n\tdefer c.Close()\n\n\t//update province\n\terr = c.Session.Update(bson.M{\n\t\t\"_id\": category.ID,\n\t}, bson.M{\n\t\t\"$set\": bson.M{\n\t\t\t\"name\": categoryParam.Name,\n\t\t\t\"intro\": categoryParam.Intro,\n\t\t\t\"content\": categoryParam.Content,\n\t\t\t\"cover_image\": categoryParam.CoverImage,\n\t\t\t\"type\": categoryParam.Type,\n\t\t\t\"created_on\": categoryParam.CreatedOn,\n\t\t\t\"updated_on\": time.Now(),\n\t\t},\n\t})\n\n\tif err != nil {\n\t\treturn category, err\n\t}\n\n\treturn category, err\n}", "func UpdateCategory(filter bson.M, category structure.Category) error {\n\tsession := mgoSession.Copy()\n\tdefer session.Close()\n\n\t// set safe mode to return ErrNotFound if a document isn't found\n\tsession.SetSafe(&mgo.Safe{})\n\tc := session.DB(dbName).C(\"categories\")\n\n\terr := c.Update(\n\t\tfilter,\n\t\tbson.M{\n\t\t\t\"$set\": category,\n\t\t},\n\t)\n\tif err != nil && err == mgo.ErrNotFound {\n\t\treturn ErrNoCategory\n\t}\n\n\treturn err\n}", "func (oc *OutcomeCategory) Update() *OutcomeCategoryUpdateOne {\n\treturn (&OutcomeCategoryClient{config: oc.config}).UpdateOne(oc)\n}", "func (service *Service) UpdateCategory(request *UpdateRequest) error {\n\tisExist, err := service.repo.IsCategoryIDExists(request.CategoryID)\n\tif err != nil {\n\t\treturn err\n\t}\n\tif !isExist {\n\t\treturn errors.New(utils.InvalidCategoryID)\n\t}\n\tif len(request.Name) <= 0 && request.ParentID == 0 {\n\t\treturn errors.New(utils.NothingToUpdateInCategory)\n\t}\n\tcategoryExists, err := service.repo.CheckCategoryNameExists(request.Name)\n\tif err != nil {\n\t\treturn err\n\t}\n\tif categoryExists {\n\t\treturn errors.New(utils.CategoryExistsError)\n\t}\n\treturn service.repo.UpdateCategory(request)\n}", "func (t *TrackingCategories) Update(provider xerogolang.IProvider, session goth.Session) (*TrackingCategories, error) {\n\tadditionalHeaders := map[string]string{\n\t\t\"Accept\": \"application/json\",\n\t\t\"Content-Type\": \"application/xml\",\n\t}\n\n\tbody, err := xml.MarshalIndent(t, \" \", \"\t\")\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\ttrackingCategoryResponseBytes, err := provider.Update(session, \"TrackingCategories/\"+t.TrackingCategories[0].TrackingCategoryID, additionalHeaders, body)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn unmarshalTrackingCategory(trackingCategoryResponseBytes)\n}", "func (p PostgresPersister) UpdateCategory(id string, in model.CategoryIn) (model.Category, error) {\n\tvar dbid int32\n\tfmt.Sscanf(id, p.pathPrefix+model.CategoryIDFormat, &dbid)\n\tvar cat model.Category\n\terr := p.db.QueryRow(\"UPDATE category SET body = $1, last_update_time = CURRENT_TIMESTAMP WHERE id = $2 RETURNING id, body, insert_time, last_update_time\", in, dbid).\n\t\tScan(\n\t\t\t&dbid,\n\t\t\t&cat.CategoryBody,\n\t\t\t&cat.InsertTime,\n\t\t\t&cat.LastUpdateTime,\n\t\t)\n\tcat.ID = p.pathPrefix + fmt.Sprintf(model.CategoryIDFormat, dbid)\n\tcat.Type = \"category\"\n\treturn cat, translateError(err)\n}", "func (cri *CategoryRepositoryImpl) UpdateCategory(c entity.Category) error {\n\n\t_, err := cri.conn.Exec(\"UPDATE categories SET name=$1,description=$2, image=$3 WHERE id=$4\", c.Name, c.Description, c.Image, c.ID)\n\tif err != nil {\n\t\treturn errors.New(\"Update has failed\")\n\t}\n\n\treturn nil\n}", "func (o *BookCategory) Update(ctx context.Context, exec boil.ContextExecutor, columns boil.Columns) (int64, error) {\n\tvar err error\n\tif err = o.doBeforeUpdateHooks(ctx, exec); err != nil {\n\t\treturn 0, err\n\t}\n\tkey := makeCacheKey(columns, nil)\n\tbookCategoryUpdateCacheMut.RLock()\n\tcache, cached := bookCategoryUpdateCache[key]\n\tbookCategoryUpdateCacheMut.RUnlock()\n\n\tif !cached {\n\t\twl := columns.UpdateColumnSet(\n\t\t\tbookCategoryAllColumns,\n\t\t\tbookCategoryPrimaryKeyColumns,\n\t\t)\n\n\t\tif len(wl) == 0 {\n\t\t\treturn 0, errors.New(\"models: unable to update book_category, could not build whitelist\")\n\t\t}\n\n\t\tcache.query = fmt.Sprintf(\"UPDATE `book_category` SET %s WHERE %s\",\n\t\t\tstrmangle.SetParamNames(\"`\", \"`\", 0, wl),\n\t\t\tstrmangle.WhereClause(\"`\", \"`\", 0, bookCategoryPrimaryKeyColumns),\n\t\t)\n\t\tcache.valueMapping, err = queries.BindMapping(bookCategoryType, bookCategoryMapping, append(wl, bookCategoryPrimaryKeyColumns...))\n\t\tif err != nil {\n\t\t\treturn 0, err\n\t\t}\n\t}\n\n\tvalues := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(o)), cache.valueMapping)\n\n\tif boil.DebugMode {\n\t\tfmt.Fprintln(boil.DebugWriter, cache.query)\n\t\tfmt.Fprintln(boil.DebugWriter, values)\n\t}\n\n\tvar result sql.Result\n\tresult, err = exec.ExecContext(ctx, cache.query, values...)\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: unable to update book_category row\")\n\t}\n\n\trowsAff, err := result.RowsAffected()\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: failed to get rows affected by update for book_category\")\n\t}\n\n\tif !cached {\n\t\tbookCategoryUpdateCacheMut.Lock()\n\t\tbookCategoryUpdateCache[key] = cache\n\t\tbookCategoryUpdateCacheMut.Unlock()\n\t}\n\n\treturn rowsAff, o.doAfterUpdateHooks(ctx, exec)\n}", "func (d *Database) MutateCategory(\n\tid int64,\n\tfn func(*structs.Category) structs.EntityUpdate) (*structs.Category, error) {\n\td.lock.Lock()\n\tdefer d.lock.Unlock()\n\n\tif err := d.checkClosed(); err != nil {\n\t\tlog.Error(err)\n\t\treturn nil, err\n\t}\n\n\ttx, err := d.db.Begin()\n\tif err != nil {\n\t\tlog.Error(err)\n\t\treturn nil, err\n\t}\n\tdefer tx.Rollback()\n\n\tc, err := getCategory(tx, id)\n\tif err != nil {\n\t\tlog.Error(err)\n\t\treturn nil, err\n\t}\n\n\tupdate := fn(c)\n\tif update.Noop() {\n\t\terr = tx.Commit()\n\t\treturn c, err\n\t}\n\n\terr = updateEntity(tx, update)\n\tif err != nil {\n\t\tlog.Error(err)\n\t\treturn nil, err\n\t}\n\n\tnewC, err := getCategory(tx, id)\n\tif err != nil {\n\t\tlog.Error(err)\n\t\treturn nil, err\n\t}\n\n\terr = tx.Commit()\n\tif err != nil {\n\t\tlog.Error(err)\n\t\treturn nil, err\n\t}\n\n\treturn newC, nil\n}", "func (sc *ScCategory) Update(db XODB) error {\n\tvar err error\n\n\t// if doesn't exist, bail\n\tif !sc._exists {\n\t\treturn errors.New(\"update failed: does not exist\")\n\t}\n\n\t// if deleted, bail\n\tif sc._deleted {\n\t\treturn errors.New(\"update failed: marked for deletion\")\n\t}\n\n\t// sql query\n\tconst sqlstr = `UPDATE emind_software_center.sc_category SET ` +\n\t\t`category_name = ?` +\n\t\t` WHERE ID = ?`\n\n\t// run query\n\tXOLog(sqlstr, sc.CategoryName, sc.ID)\n\t_, err = db.Exec(sqlstr, sc.CategoryName, sc.ID)\n\treturn err\n}", "func (c *MongoCatalog) Update(cat models.Cat) error {\n\topts := options.FindOneAndUpdate().SetUpsert(true)\n\tfilter := bson.D{{Key: \"id\", Value: cat.ID}}\n\tupd := bson.D{primitive.E{Key: \"$set\", Value: bson.D{\n\t\tprimitive.E{Key: \"id\", Value: cat.ID},\n\t\tprimitive.E{Key: \"name\", Value: cat.Name},\n\t\tprimitive.E{Key: \"breed\", Value: cat.Breed},\n\t\tprimitive.E{Key: \"color\", Value: cat.Color},\n\t\tprimitive.E{Key: \"age\", Value: cat.Age},\n\t\tprimitive.E{Key: \"price\", Value: cat.Price},\n\t}}}\n\tlog.Print(cat.ID)\n\tupdated := models.Cat{}\n\terr := c.collection.FindOneAndUpdate(context.Background(), filter, upd, opts).Decode(&updated)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func (r *repository) UpdateCategory(categoryName string, subpath string, thum string, id uint) error {\n\tu, err := r.FindCategory(id)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif categoryName != \"\" {\n\t\tu.Name = categoryName\n\t}\n\tif subpath != \"\" {\n\t\tu.SubPath = subpath\n\t}\n\n\tif thum != \"\" {\n\t\tu.Thumbnail = thum\n\t}\n\n\treturn r.db.Save(&u).Error\n}", "func (m *MacOSSoftwareUpdateStateSummary) SetUpdateCategory(value *MacOSSoftwareUpdateCategory)() {\n err := m.GetBackingStore().Set(\"updateCategory\", value)\n if err != nil {\n panic(err)\n }\n}", "func (r *ContentCategoriesService) Update(profileId int64, contentcategory *ContentCategory) *ContentCategoriesUpdateCall {\n\tc := &ContentCategoriesUpdateCall{s: r.s, urlParams_: make(gensupport.URLParams)}\n\tc.profileId = profileId\n\tc.contentcategory = contentcategory\n\treturn c\n}", "func (c *CategoryClient) UpdateOne(ca *Category) *CategoryUpdateOne {\n\tmutation := newCategoryMutation(c.config, OpUpdateOne, withCategory(ca))\n\treturn &CategoryUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func TestUpdateCategory(t *testing.T) {\n\t//initial length of []products\n\tinitialLen := len(Categories)\n\t//parameters passed to request body\n\trequestBody := &Category{\n\t\tCategoryName: \t\t\"Super Cool Category\",\n\t\tCategoryDescription: \"Brand new cool Category\",\n\t}\n\tjsonProduct, _ := json.Marshal(requestBody)\n\treq, err := http.NewRequest(\"PATCH\", \"/categories/bq4fasj7jhfi127rimlg\", bytes.NewBuffer(jsonProduct))\n\treq = mux.SetURLVars(req, map[string]string{\"id\": \"bq4fasj7jhfi127rimlg\"})\n\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\n\trr := httptest.NewRecorder()\n\thandler := http.HandlerFunc(UpdateCategory)\n\n\thandler.ServeHTTP(rr, req)\n\n\tassert.Equal(t, 200, rr.Code, \"OK response is expected\")\n\tassert.Equal(t, initialLen, len(Categories), \"Expected length to stay the same after creating new product\")\n}", "func UpdateCategories(c *gin.Context) {\n\t// Get model if exist\n\tvar categories models.Categories\n\tif err := models.DB.Where(\"id = ?\", c.Param(\"id\")).First(&categories).Error; err != nil {\n\t\tc.JSON(http.StatusBadRequest, gin.H{\"error\": \"Record not found!\"})\n\t\treturn\n\t}\n\n\t// Validate input\n\tvar input UpdateCategoriesInput\n\tif err := c.ShouldBindJSON(&input); err != nil {\n\t\tc.JSON(http.StatusBadRequest, gin.H{\"error\": err.Error()})\n\t\treturn\n\t}\n\n\tmodels.DB.Model(&categories).Updates(input)\n\n\tc.JSON(http.StatusOK, gin.H{\"data\": categories})\n}", "func (gc *GoodsCategory) Update(ctx context.Context, key ...interface{}) error {\n\tvar err error\n\tvar dbConn *sql.DB\n\n\t// if deleted, bail\n\tif gc._deleted {\n\t\treturn errors.New(\"update failed: marked for deletion\")\n\t}\n\n\ttx, err := components.M.GetConnFromCtx(ctx)\n\tif err != nil {\n\t\tdbConn, err = components.M.GetMasterConn()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\ttableName, err := GetGoodsCategoryTableName(key...)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// sql query\n\tsqlstr := `UPDATE ` + tableName + ` SET ` +\n\t\t`title = ?, description = ?, keywords = ?, seq = ?, slug = ?, pid = ?, status = ?, mid_admin_id = ?, mid_admin_name = ?, image = ?, created_at = ?, updated_at = ?` +\n\t\t` WHERE gcid = ?`\n\n\t// run query\n\tutils.GetTraceLog(ctx).Debug(\"DB\", zap.String(\"SQL\", fmt.Sprint(sqlstr, gc.Title, gc.Description, gc.Keywords, gc.Seq, gc.Slug, gc.Pid, gc.Status, gc.MidAdminID, gc.MidAdminName, gc.Image, gc.CreatedAt, gc.UpdatedAt, gc.Gcid)))\n\tif tx != nil {\n\t\t_, err = tx.Exec(sqlstr, gc.Title, gc.Description, gc.Keywords, gc.Seq, gc.Slug, gc.Pid, gc.Status, gc.MidAdminID, gc.MidAdminName, gc.Image, gc.CreatedAt, gc.UpdatedAt, gc.Gcid)\n\t} else {\n\t\t_, err = dbConn.Exec(sqlstr, gc.Title, gc.Description, gc.Keywords, gc.Seq, gc.Slug, gc.Pid, gc.Status, gc.MidAdminID, gc.MidAdminName, gc.Image, gc.CreatedAt, gc.UpdatedAt, gc.Gcid)\n\t}\n\treturn err\n}", "func (categoria *Categoria) UpdateCategoria(db *gorm.DB, codCategoria uint32) (*Categoria, error) {\n\n\t//\tPermite a atualizacao dos campos indicados\n\tdb = db.Debug().Exec(\"UPDATE categoria SET descricao = ? WHERE cod_categoria = ?\", categoria.Descricao, codCategoria)\n\tif db.Error != nil {\n\t\treturn &Categoria{}, db.Error\n\t}\n\n\t//\tBusca um elemento no banco de dados a partir de sua chave primaria\n\terr := db.Debug().Model(&Categoria{}).Where(\"cod_categoria = ?\", codCategoria).Take(&categoria).Error\n\tif err != nil {\n\t\treturn &Categoria{}, err\n\t}\n\n\treturn categoria, err\n}", "func (m *MockStorage) UpdateCategory(ctx context.Context, category model.Category) error {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"UpdateCategory\", ctx, category)\n\tret0, _ := ret[0].(error)\n\treturn ret0\n}", "func MakeUpdateCategoryEndpoint(s service.TodoService) endpoint.Endpoint {\n\treturn func(ctx context.Context, request interface{}) (interface{}, error) {\n\t\treq := request.(UpdateCategoryRequest)\n\t\tc, error := s.UpdateCategory(ctx, req.Category)\n\t\treturn UpdateCategoryResponse{\n\t\t\tC: c,\n\t\t\tError: error,\n\t\t}, nil\n\t}\n}", "func (upu *UnsavedPostUpdate) ClearCategory() *UnsavedPostUpdate {\n\tupu.mutation.ClearCategory()\n\treturn upu\n}", "func (upuo *UnsavedPostUpdateOne) ClearCategory() *UnsavedPostUpdateOne {\n\tupuo.mutation.ClearCategory()\n\treturn upuo\n}", "func (c *MealplanClient) Update() *MealplanUpdate {\n\tmutation := newMealplanMutation(c.config, OpUpdate)\n\treturn &MealplanUpdate{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func EditCategory(db *sql.DB, c Category) (Category, error) {\n\tvar category Category\n\terr := db.QueryRow(`UPDATE category\n\t\tSET name = UPPER($1)\n\t\tWHERE id = $2\n\t\tRETURNING id, name`, c.Name, c.ID).Scan(&category.ID, &category.Name)\n\n\tif err != nil {\n\t\treturn category, err\n\t}\n\n\treturn category, nil\n}", "func SetCategory(c *gin.Context) {\n\tvar reqBody api.Category\n\n\terr := c.ShouldBindJSON(&reqBody)\n\tif err != nil {\n\t\tc.JSON(http.StatusBadRequest, gin.H{\n\t\t\t\"Code\": http.StatusBadRequest,\n\t\t\t\"Success\": false,\n\t\t\t\"Data\": \"Incorrect request body.\",\n\t\t})\n\t\treturn\n\t}\n\n\tdb := data.ConnectDB()\n\tdb.Create(&dbTable.Category{\n\t\tTitle: reqBody.Title,\n\t})\n\n\tvar category api.Category\n\tdb.Last(&category)\n\tdb.Commit()\n\n\tc.JSON(http.StatusOK, gin.H{\n\t\t\"Code\": http.StatusOK,\n\t\t\"Success\": true,\n\t\t\"Data\": category.ID,\n\t})\n}", "func (c *Client) NewUpdateCategoriesRequest(ctx context.Context, path string, payload *UpdateCategoriesPayload, contentType string) (*http.Request, error) {\n\tvar body bytes.Buffer\n\tif contentType == \"\" {\n\t\tcontentType = \"*/*\" // Use default encoder\n\t}\n\terr := c.Encoder.Encode(payload, &body, contentType)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to encode body: %s\", err)\n\t}\n\tscheme := c.Scheme\n\tif scheme == \"\" {\n\t\tscheme = \"http\"\n\t}\n\tu := url.URL{Host: c.Host, Scheme: scheme, Path: path}\n\treq, err := http.NewRequest(\"PUT\", u.String(), &body)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\theader := req.Header\n\tif contentType == \"*/*\" {\n\t\theader.Set(\"Content-Type\", \"application/json\")\n\t} else {\n\t\theader.Set(\"Content-Type\", contentType)\n\t}\n\tif c.JWTSecSigner != nil {\n\t\tif err := c.JWTSecSigner.Sign(req); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\treturn req, nil\n}", "func (tu *TimingUpdate) SetCategory(s string) *TimingUpdate {\n\ttu.mutation.SetCategory(s)\n\treturn tu\n}", "func (tuo *TimingUpdateOne) SetCategory(s string) *TimingUpdateOne {\n\ttuo.mutation.SetCategory(s)\n\treturn tuo\n}", "func (mr *MockStorageMockRecorder) UpdateCategory(ctx, category interface{}) *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"UpdateCategory\", reflect.TypeOf((*MockStorage)(nil).UpdateCategory), ctx, category)\n}", "func (_Mcapscontroller *McapscontrollerTransactor) UpdateCategoryPrices(opts *bind.TransactOpts, categoryID *big.Int) (*types.Transaction, error) {\n\treturn _Mcapscontroller.contract.Transact(opts, \"updateCategoryPrices\", categoryID)\n}", "func (b *blogsQueryBuilder) Update() (int64, error) {\n\tif b.err != nil {\n\t\treturn 0, b.err\n\t}\n\treturn b.builder.Update()\n}", "func (c *commentsQueryBuilder) Update() (int64, error) {\n\tif c.err != nil {\n\t\treturn 0, c.err\n\t}\n\treturn c.builder.Update()\n}", "func withCategory(node *Category) categoryOption {\n\treturn func(m *CategoryMutation) {\n\t\tm.oldValue = func(context.Context) (*Category, error) {\n\t\t\treturn node, nil\n\t\t}\n\t\tm.id = &node.ID\n\t}\n}", "func withCategory(node *Category) categoryOption {\n\treturn func(m *CategoryMutation) {\n\t\tm.oldValue = func(context.Context) (*Category, error) {\n\t\t\treturn node, nil\n\t\t}\n\t\tm.id = &node.ID\n\t}\n}", "func (es *EventService) UpdateAwardCategory(eventID string, a *AwardCategory) error {\n\t// PUT: /event/:eventId/awardcategory/:awardcategoryId\n\tif a == nil {\n\t\treturn fmt.Errorf(\"nil AwardCategory\")\n\t}\n\treq, err := es.c.NewRequest(\"PUT\", fmt.Sprintf(\"/event/%s/awardcategory/%d\", eventID, a.ID), a)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn es.c.Do(req, nil)\n}", "func Update(table string) *UpdateBuilder {\n\treturn NewUpdateBuilder(table)\n}", "func (r *DeviceManagementCollectionSettingInstanceRequest) Update(ctx context.Context, reqObj *DeviceManagementCollectionSettingInstance) error {\n\treturn r.JSONRequest(ctx, \"PATCH\", \"\", reqObj, nil)\n}", "func (c *BuildingClient) Update() *BuildingUpdate {\n\tmutation := newBuildingMutation(c.config, OpUpdate)\n\treturn &BuildingUpdate{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (k *Kategorie) ValidateUpdate(tx *pop.Connection) (*validate.Errors, error) {\n\treturn validate.NewErrors(), nil\n}", "func Update(table string) *UpdateBuilder {\n\treturn DefaultFlavor.NewUpdateBuilder().Update(table)\n}", "func (c *BedtypeClient) Update() *BedtypeUpdate {\n\tmutation := newBedtypeMutation(c.config, OpUpdate)\n\treturn &BedtypeUpdate{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (h *CategoryHandler) PartialUpdate(ctx iris.Context) {\n\tid := ctx.Params().GetInt64Default(\"id\", 0)\n\n\tvar attrs map[string]interface{}\n\tif err := ctx.ReadJSON(&attrs); err != nil {\n\t\treturn\n\t}\n\n\taffected, err := h.service.PartialUpdate(ctx.Request().Context(), id, attrs)\n\tif err != nil {\n\t\tif err == sql.ErrUnprocessable {\n\t\t\tctx.StopWithJSON(iris.StatusUnprocessableEntity, newError(iris.StatusUnprocessableEntity, ctx.Request().Method, ctx.Path(), \"unsupported value(s)\"))\n\t\t\treturn\n\t\t}\n\n\t\tdebugf(\"CategoryHandler.PartialUpdate(DB): %v\", err)\n\t\twriteInternalServerError(ctx)\n\t\treturn\n\t}\n\n\tstatus := iris.StatusOK\n\tif affected == 0 {\n\t\tstatus = iris.StatusNotModified\n\t}\n\n\tctx.StatusCode(status)\n}", "func (m *ThreatAssessmentRequest) SetCategory(value *ThreatCategory)() {\n m.category = value\n}", "func (qs ControlQS) Update() ControlUpdateQS {\n\treturn ControlUpdateQS{condFragments: qs.condFragments}\n}", "func (m *ThreatAssessmentRequest) SetCategory(value *ThreatCategory)() {\n err := m.GetBackingStore().Set(\"category\", value)\n if err != nil {\n panic(err)\n }\n}", "func (u *App) Update(c echo.Context, r *Update) (result *model.Course, err error) {\n\tif err = u.rbac.EnforceRole(c, model.AdminRole); err != nil {\n\t\treturn\n\t}\n\n\tschoolName := \"\"\n\tvar school model.Organization\n\tif err := u.db.Model(&model.Organization{}).Where(\"uuid = ?\", r.School).First(&school).Error; err == nil {\n\t\tschoolName = school.Name\n\t}\n\n\tupdate := model.Course{\n\t\tBase: model.Base{ID: r.ID},\n\t\tName: r.Name,\n\t\tDomain: r.Domain,\n\t\tCluster: r.Cluster,\n\t\tType: r.Type,\n\t\tLevel: r.Level,\n\t\tSchool: r.School,\n\t\tSchoolName: schoolName,\n\t}\n\n\tif err = u.udb.Update(u.db, &update); err != nil {\n\t\treturn\n\t}\n\treturn u.udb.View(u.db, r.ID)\n}", "func (c *Client) UpdateCategories(ctx context.Context, path string, payload *UpdateCategoriesPayload, contentType string) (*http.Response, error) {\n\treq, err := c.NewUpdateCategoriesRequest(ctx, path, payload, contentType)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn c.Client.Do(ctx, req)\n}", "func (m *GroupPolicyDefinitionsItemNextVersionDefinitionPreviousVersionDefinitionRequestBuilder) Category()(*GroupPolicyDefinitionsItemNextVersionDefinitionPreviousVersionDefinitionCategoryRequestBuilder) {\n return NewGroupPolicyDefinitionsItemNextVersionDefinitionPreviousVersionDefinitionCategoryRequestBuilderInternal(m.BaseRequestBuilder.PathParameters, m.BaseRequestBuilder.RequestAdapter)\n}", "func EditCat(catInfo models.Category, catid uint32) error {\n\n\terr := DB.Where(\"id = ?\", catid).Updates(catInfo).Error\n\tif err != nil {\n\t\tlog.Warning.Println(err)\n\t\treturn ErrInternal\n\t}\n\treturn nil\n}", "func (c *CleaningroomClient) Update() *CleaningroomUpdate {\n\tmutation := newCleaningroomMutation(c.config, OpUpdate)\n\treturn &CleaningroomUpdate{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *ActivityTypeClient) Update() *ActivityTypeUpdate {\n\tmutation := newActivityTypeMutation(c.config, OpUpdate)\n\treturn &ActivityTypeUpdate{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (m *MacOSSoftwareUpdateStateSummary) GetUpdateCategory()(*MacOSSoftwareUpdateCategory) {\n val, err := m.GetBackingStore().Get(\"updateCategory\")\n if err != nil {\n panic(err)\n }\n if val != nil {\n return val.(*MacOSSoftwareUpdateCategory)\n }\n return nil\n}", "func (v *VersionData) UpdateCategoriesRecord(categoriesData CategoryUnitCollection) {\n\tts := GetMillionSecondTimestamp()\n\ttmp := SentencesUnitCollection{}\n\tfor _, c := range categoriesData {\n\t\tif unit, ok := v.Sentences.Find(c.Key); !ok || unit.Name != c.Name || unit.Path != c.Path {\n\t\t\ttmp = append(tmp, SentencesUnit{\n\t\t\t\tName: c.Name,\n\t\t\t\tKey: c.Key,\n\t\t\t\tPath: c.Path,\n\t\t\t\tTimestamp: ts,\n\t\t\t})\n\t\t} else {\n\t\t\ttmp = append(tmp, *unit)\n\t\t}\n\t}\n\tv.Sentences = tmp\n\tv.Categories.Timestamp = ts\n\tv.UpdatedAt = ts\n}", "func (h *Handlers) handleUpdateProductCategory(response http.ResponseWriter, request *http.Request) {\n\tproductCategory := ProductCategory{}\n\n\tidStr, status := mux.Vars(request)[\"id\"]\n\tif !status {\n\t\tproductCategoryHandlerLogging.Printlog(\"product category HandleUpdateproductCategory; Error getting productCategory id:\", \"Could not get id\")\n\t\tformat.Send(response, http.StatusInternalServerError, format.Message(false, \"Error occured while converting string to int\", nil))\n\t\treturn\n\t}\n\n\tid, err := strconv.ParseInt(idStr, 10, 64)\n\tif err != nil {\n\t\tproductCategoryHandlerLogging.Printlog(\"product category HandleUpdateproductCategory; Error while converting string to int:\", err.Error())\n\t\tformat.Send(response, http.StatusInternalServerError, format.Message(false, \"Error occured while converting string to int\", nil))\n\t\treturn\n\t}\n\tproductCategory.ID = id\n\n\terr = parseBody(&productCategory, request)\n\tif err != nil {\n\t\tformat.Send(response, http.StatusInternalServerError, format.Message(false, \"Error occured while decoding body\", nil))\n\t\treturn\n\t}\n\terr = productCategoryService.UpdateProductCategory(&productCategory)\n\tif err != nil {\n\t\tformat.Send(response, http.StatusInternalServerError, format.Message(false, \"Error occured while updating product category\", nil))\n\t\treturn\n\t}\n\tformat.Send(response, http.StatusOK, format.Message(true, \"product category updated\", nil))\n\n}", "func (o *BookCategoryAssign) Update(ctx context.Context, exec boil.ContextExecutor, columns boil.Columns) (int64, error) {\n\tvar err error\n\tif err = o.doBeforeUpdateHooks(ctx, exec); err != nil {\n\t\treturn 0, err\n\t}\n\tkey := makeCacheKey(columns, nil)\n\tbookCategoryAssignUpdateCacheMut.RLock()\n\tcache, cached := bookCategoryAssignUpdateCache[key]\n\tbookCategoryAssignUpdateCacheMut.RUnlock()\n\n\tif !cached {\n\t\twl := columns.UpdateColumnSet(\n\t\t\tbookCategoryAssignAllColumns,\n\t\t\tbookCategoryAssignPrimaryKeyColumns,\n\t\t)\n\n\t\tif len(wl) == 0 {\n\t\t\treturn 0, errors.New(\"models: unable to update book_category_assign, could not build whitelist\")\n\t\t}\n\n\t\tcache.query = fmt.Sprintf(\"UPDATE `book_category_assign` SET %s WHERE %s\",\n\t\t\tstrmangle.SetParamNames(\"`\", \"`\", 0, wl),\n\t\t\tstrmangle.WhereClause(\"`\", \"`\", 0, bookCategoryAssignPrimaryKeyColumns),\n\t\t)\n\t\tcache.valueMapping, err = queries.BindMapping(bookCategoryAssignType, bookCategoryAssignMapping, append(wl, bookCategoryAssignPrimaryKeyColumns...))\n\t\tif err != nil {\n\t\t\treturn 0, err\n\t\t}\n\t}\n\n\tvalues := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(o)), cache.valueMapping)\n\n\tif boil.DebugMode {\n\t\tfmt.Fprintln(boil.DebugWriter, cache.query)\n\t\tfmt.Fprintln(boil.DebugWriter, values)\n\t}\n\n\tvar result sql.Result\n\tresult, err = exec.ExecContext(ctx, cache.query, values...)\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: unable to update book_category_assign row\")\n\t}\n\n\trowsAff, err := result.RowsAffected()\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: failed to get rows affected by update for book_category_assign\")\n\t}\n\n\tif !cached {\n\t\tbookCategoryAssignUpdateCacheMut.Lock()\n\t\tbookCategoryAssignUpdateCache[key] = cache\n\t\tbookCategoryAssignUpdateCacheMut.Unlock()\n\t}\n\n\treturn rowsAff, o.doAfterUpdateHooks(ctx, exec)\n}", "func (clusterRequest *KibanaRequest) Update(object client.Object) error {\n\treturn clusterRequest.client.Update(context.TODO(), object)\n}", "func (mfgcsc *MidFactoryGoodsCategoryServiceCharge) Update(ctx context.Context, key ...interface{}) error {\n\tvar err error\n\tvar dbConn *sql.DB\n\n\t// if deleted, bail\n\tif mfgcsc._deleted {\n\t\treturn errors.New(\"update failed: marked for deletion\")\n\t}\n\n\ttx, err := components.M.GetConnFromCtx(ctx)\n\tif err != nil {\n\t\tdbConn, err = components.M.GetMasterConn()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\ttableName, err := GetMidFactoryGoodsCategoryServiceChargeTableName(key...)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// sql query\n\tsqlstr := `UPDATE ` + tableName + ` SET ` +\n\t\t`factory_id = ?, goods_category_id = ?, service_charge = ?, mid_admin_id = ?, mid_admin_name = ?, status = ?, created_at = ?, updated_at = ?` +\n\t\t` WHERE id = ?`\n\n\t// run query\n\tutils.GetTraceLog(ctx).Debug(\"DB\", zap.String(\"SQL\", fmt.Sprint(sqlstr, mfgcsc.FactoryID, mfgcsc.GoodsCategoryID, mfgcsc.ServiceCharge, mfgcsc.MidAdminID, mfgcsc.MidAdminName, mfgcsc.Status, mfgcsc.CreatedAt, mfgcsc.UpdatedAt, mfgcsc.ID)))\n\tif tx != nil {\n\t\t_, err = tx.Exec(sqlstr, mfgcsc.FactoryID, mfgcsc.GoodsCategoryID, mfgcsc.ServiceCharge, mfgcsc.MidAdminID, mfgcsc.MidAdminName, mfgcsc.Status, mfgcsc.CreatedAt, mfgcsc.UpdatedAt, mfgcsc.ID)\n\t} else {\n\t\t_, err = dbConn.Exec(sqlstr, mfgcsc.FactoryID, mfgcsc.GoodsCategoryID, mfgcsc.ServiceCharge, mfgcsc.MidAdminID, mfgcsc.MidAdminName, mfgcsc.Status, mfgcsc.CreatedAt, mfgcsc.UpdatedAt, mfgcsc.ID)\n\t}\n\treturn err\n}", "func (t *PgAttributeType) Update() *qb.UpdateBuilder {\n\treturn t.table.Update()\n}", "func (qs DaytypeQS) Update() DaytypeUpdateQS {\n\treturn DaytypeUpdateQS{condFragments: qs.condFragments}\n}", "func (c *Course) Update() *CourseUpdateOne {\n\treturn (&CourseClient{config: c.config}).UpdateOne(c)\n}", "func (c *Course) Update() *CourseUpdateOne {\n\treturn (&CourseClient{config: c.config}).UpdateOne(c)\n}", "func (us *ClusterStore) Update(u *model.Cluster) error {\n\treturn us.db.Save(u).Error\n}", "func (c *ComplaintTypeClient) Update() *ComplaintTypeUpdate {\n\tmutation := newComplaintTypeMutation(c.config, OpUpdate)\n\treturn &ComplaintTypeUpdate{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *DisciplineClient) Update() *DisciplineUpdate {\n\tmutation := newDisciplineMutation(c.config, OpUpdate)\n\treturn &DisciplineUpdate{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *StatusdClient) Update() *StatusdUpdate {\n\tmutation := newStatusdMutation(c.config, OpUpdate)\n\treturn &StatusdUpdate{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *FoodmenuClient) Update() *FoodmenuUpdate {\n\tmutation := newFoodmenuMutation(c.config, OpUpdate)\n\treturn &FoodmenuUpdate{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *ConsulStore) Update(root string, key Key, tag string, data interface{}) error {\n\treturn c.Create(root, key, tag, data)\n}", "func Update(updates ...Eq) *Builder {\r\n\tbuilder := &Builder{cond: NewCond()}\r\n\treturn builder.Update(updates...)\r\n}", "func (c *DoctorClient) Update() *DoctorUpdate {\n\tmutation := newDoctorMutation(c.config, OpUpdate)\n\treturn &DoctorUpdate{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *ClubTypeClient) Update() *ClubTypeUpdate {\n\tmutation := newClubTypeMutation(c.config, OpUpdate)\n\treturn &ClubTypeUpdate{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (r *DeviceManagementComplexSettingInstanceRequest) Update(ctx context.Context, reqObj *DeviceManagementComplexSettingInstance) error {\n\treturn r.JSONRequest(ctx, \"PATCH\", \"\", reqObj, nil)\n}", "func (c *UsertypeClient) Update() *UsertypeUpdate {\n\tmutation := newUsertypeMutation(c.config, OpUpdate)\n\treturn &UsertypeUpdate{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (r *DeviceManagementAbstractComplexSettingInstanceRequest) Update(ctx context.Context, reqObj *DeviceManagementAbstractComplexSettingInstance) error {\n\treturn r.JSONRequest(ctx, \"PATCH\", \"\", reqObj, nil)\n}", "func (w *ClusterDynamicClient) Update(obj *unstructured.Unstructured, options metav1.UpdateOptions, subresources ...string) (*unstructured.Unstructured, error) {\n\treturn w.dClient.Resource(w.resource).Namespace(w.namespace).Update(w.ctx, obj, options, subresources...)\n}", "func (v *Filter) Update() error {\n\treturn nil\n}", "func EditCategoryByID(w http.ResponseWriter, req *http.Request) {\n\n\tvars := mux.Vars(req)\n\n\tCategoryIDStr := vars[\"cid\"]\n\tCategoryID, err := strconv.ParseUint(CategoryIDStr, 10, 64)\n\tif err != nil {\n\t\trespondWithError(w, http.StatusBadRequest, fmt.Sprintf(\"Invalid CategoryID %v\", CategoryID))\n\t\treturn\n\t}\n\n\tvar body domain.Category\n\n\tif err := parseBody(req, &body); err != nil {\n\t\trespondWithError(w, http.StatusBadRequest, err.Error())\n\t\treturn\n\t}\n\n\tbody.CID = CategoryID\n\n\tif _, err := domain.UpdateCategoryByID(body); err != nil {\n\t\trespondWithError(w, http.StatusBadRequest, err.Error())\n\t\treturn\n\t}\n\n\trespondWithJSON(w, http.StatusOK, body)\n\n}", "func (c *MedicineTypeClient) Update() *MedicineTypeUpdate {\n\tmutation := newMedicineTypeMutation(c.config, OpUpdate)\n\treturn &MedicineTypeUpdate{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *DepartmentClient) Update() *DepartmentUpdate {\n\tmutation := newDepartmentMutation(c.config, OpUpdate)\n\treturn &DepartmentUpdate{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (m *ChannelModeKinds) Update(address, always, onset, none string) {\n\tm.kinds = parseChannelModeKinds(address, always, onset, none)\n}", "func (c *PortfolioController) UpdatePortfolioAssetCategoryMapping(db *sqlx.DB) http.HandlerFunc {\n\treturn func(w http.ResponseWriter, r *http.Request) {\n\t\tpacmID, err := getID(r)\n\t\tif err != nil {\n\t\t\tbadRequestID(w, err)\n\t\t\treturn\n\t\t}\n\n\t\tvar pacm *models.PortfolioAssetCategoryMapping\n\t\terr = json.NewDecoder(r.Body).Decode(&pacm)\n\t\tif err != nil {\n\t\t\tbadRequestModel(w, portfolioAssetCategoryMapping, err)\n\t\t\treturn\n\t\t}\n\n\t\tpacm.ID = pacmID\n\t\terr = portfolioRepo.UpdatePortfolioAssetCategoryMapping(db, pacm)\n\t\tif err != nil {\n\t\t\terrorExecuting(w, portfolioAssetCategoryMapping, err)\n\t\t\treturn\n\t\t}\n\t\tupdated(w, pacm.ID)\n\t}\n}", "func withCategoryID(id int) categoryOption {\n\treturn func(m *CategoryMutation) {\n\t\tvar (\n\t\t\terr error\n\t\t\tonce sync.Once\n\t\t\tvalue *Category\n\t\t)\n\t\tm.oldValue = func(ctx context.Context) (*Category, error) {\n\t\t\tonce.Do(func() {\n\t\t\t\tif m.done {\n\t\t\t\t\terr = fmt.Errorf(\"querying old values post mutation is not allowed\")\n\t\t\t\t} else {\n\t\t\t\t\tvalue, err = m.Client().Category.Get(ctx, id)\n\t\t\t\t}\n\t\t\t})\n\t\t\treturn value, err\n\t\t}\n\t\tm.id = &id\n\t}\n}", "func withCategoryID(id int) categoryOption {\n\treturn func(m *CategoryMutation) {\n\t\tvar (\n\t\t\terr error\n\t\t\tonce sync.Once\n\t\t\tvalue *Category\n\t\t)\n\t\tm.oldValue = func(ctx context.Context) (*Category, error) {\n\t\t\tonce.Do(func() {\n\t\t\t\tif m.done {\n\t\t\t\t\terr = fmt.Errorf(\"querying old values post mutation is not allowed\")\n\t\t\t\t} else {\n\t\t\t\t\tvalue, err = m.Client().Category.Get(ctx, id)\n\t\t\t\t}\n\t\t\t})\n\t\t\treturn value, err\n\t\t}\n\t\tm.id = &id\n\t}\n}" ]
[ "0.7105891", "0.70402557", "0.69978875", "0.69257987", "0.68424714", "0.67681736", "0.67585695", "0.67015105", "0.66391236", "0.6598553", "0.6506826", "0.63802105", "0.6366406", "0.632163", "0.6308798", "0.6271442", "0.6265068", "0.6119429", "0.607324", "0.6060598", "0.6058299", "0.60545045", "0.60244375", "0.60008067", "0.5919897", "0.5803991", "0.57317597", "0.5728419", "0.5673782", "0.56179345", "0.56080246", "0.55848527", "0.5561318", "0.551697", "0.5469814", "0.5429766", "0.53249943", "0.5270915", "0.52266926", "0.522297", "0.51729023", "0.5168757", "0.5160358", "0.5148117", "0.51297075", "0.5126054", "0.50568074", "0.5048568", "0.503722", "0.50356233", "0.50347507", "0.50347507", "0.49885386", "0.49808487", "0.49801266", "0.49759093", "0.4962192", "0.49444136", "0.49388233", "0.4926141", "0.49173868", "0.49143216", "0.49133575", "0.49130738", "0.49086684", "0.48931265", "0.48910314", "0.48839712", "0.48724198", "0.48721552", "0.48693386", "0.48554036", "0.48461872", "0.48438257", "0.48396906", "0.48259506", "0.48238462", "0.48221707", "0.48221707", "0.48188356", "0.48168597", "0.48137692", "0.48068058", "0.4802939", "0.48021773", "0.47965986", "0.47941443", "0.47910166", "0.47827163", "0.47775084", "0.47682992", "0.47629055", "0.47592726", "0.47576237", "0.47554544", "0.47521883", "0.47410712", "0.47336677", "0.4731418", "0.4731418" ]
0.73050445
0
UpdateOne returns an update builder for the given entity.
func (c *CategoryClient) UpdateOne(ca *Category) *CategoryUpdateOne { mutation := newCategoryMutation(c.config, OpUpdateOne, withCategory(ca)) return &CategoryUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation} }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (c *BuildingClient) UpdateOne(b *Building) *BuildingUpdateOne {\n\tmutation := newBuildingMutation(c.config, OpUpdateOne, withBuilding(b))\n\treturn &BuildingUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *BedtypeClient) UpdateOne(b *Bedtype) *BedtypeUpdateOne {\n\tmutation := newBedtypeMutation(c.config, OpUpdateOne, withBedtype(b))\n\treturn &BedtypeUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *EmptyClient) UpdateOne(e *Empty) *EmptyUpdateOne {\n\tmutation := newEmptyMutation(c.config, OpUpdateOne, withEmpty(e))\n\treturn &EmptyUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *DentistClient) UpdateOne(d *Dentist) *DentistUpdateOne {\n\tmutation := newDentistMutation(c.config, OpUpdateOne, withDentist(d))\n\treturn &DentistUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *BeerClient) UpdateOne(b *Beer) *BeerUpdateOne {\n\tmutation := newBeerMutation(c.config, OpUpdateOne, withBeer(b))\n\treturn &BeerUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *BillClient) UpdateOne(b *Bill) *BillUpdateOne {\n\tmutation := newBillMutation(c.config, OpUpdateOne, withBill(b))\n\treturn &BillUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *BillClient) UpdateOne(b *Bill) *BillUpdateOne {\n\tmutation := newBillMutation(c.config, OpUpdateOne, withBill(b))\n\treturn &BillUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *BillClient) UpdateOne(b *Bill) *BillUpdateOne {\n\tmutation := newBillMutation(c.config, OpUpdateOne, withBill(b))\n\treturn &BillUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *OperationClient) UpdateOne(o *Operation) *OperationUpdateOne {\n\tmutation := newOperationMutation(c.config, OpUpdateOne, withOperation(o))\n\treturn &OperationUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *PostAttachmentClient) UpdateOne(pa *PostAttachment) *PostAttachmentUpdateOne {\n\tmutation := newPostAttachmentMutation(c.config, OpUpdateOne, withPostAttachment(pa))\n\treturn &PostAttachmentUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *CleaningroomClient) UpdateOne(cl *Cleaningroom) *CleaningroomUpdateOne {\n\tmutation := newCleaningroomMutation(c.config, OpUpdateOne, withCleaningroom(cl))\n\treturn &CleaningroomUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *CompanyClient) UpdateOne(co *Company) *CompanyUpdateOne {\n\tmutation := newCompanyMutation(c.config, OpUpdateOne, withCompany(co))\n\treturn &CompanyUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *CompanyClient) UpdateOne(co *Company) *CompanyUpdateOne {\n\tmutation := newCompanyMutation(c.config, OpUpdateOne, withCompany(co))\n\treturn &CompanyUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *EventClient) UpdateOne(e *Event) *EventUpdateOne {\n\tmutation := newEventMutation(c.config, OpUpdateOne, withEvent(e))\n\treturn &EventUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *PostClient) UpdateOne(po *Post) *PostUpdateOne {\n\tmutation := newPostMutation(c.config, OpUpdateOne, withPost(po))\n\treturn &PostUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *DeviceClient) UpdateOne(d *Device) *DeviceUpdateOne {\n\tmutation := newDeviceMutation(c.config, OpUpdateOne, withDevice(d))\n\treturn &DeviceUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *OperationroomClient) UpdateOne(o *Operationroom) *OperationroomUpdateOne {\n\tmutation := newOperationroomMutation(c.config, OpUpdateOne, withOperationroom(o))\n\treturn &OperationroomUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *UnsavedPostAttachmentClient) UpdateOne(upa *UnsavedPostAttachment) *UnsavedPostAttachmentUpdateOne {\n\tmutation := newUnsavedPostAttachmentMutation(c.config, OpUpdateOne, withUnsavedPostAttachment(upa))\n\treturn &UnsavedPostAttachmentUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *DrugAllergyClient) UpdateOne(da *DrugAllergy) *DrugAllergyUpdateOne {\n\tmutation := newDrugAllergyMutation(c.config, OpUpdateOne, withDrugAllergy(da))\n\treturn &DrugAllergyUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *MealplanClient) UpdateOne(m *Mealplan) *MealplanUpdateOne {\n\tmutation := newMealplanMutation(c.config, OpUpdateOne, withMealplan(m))\n\treturn &MealplanUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *PhysicianClient) UpdateOne(ph *Physician) *PhysicianUpdateOne {\n\tmutation := newPhysicianMutation(c.config, OpUpdateOne, withPhysician(ph))\n\treturn &PhysicianUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *PhysicianClient) UpdateOne(ph *Physician) *PhysicianUpdateOne {\n\tmutation := newPhysicianMutation(c.config, OpUpdateOne, withPhysician(ph))\n\treturn &PhysicianUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *RoomdetailClient) UpdateOne(r *Roomdetail) *RoomdetailUpdateOne {\n\tmutation := newRoomdetailMutation(c.config, OpUpdateOne, withRoomdetail(r))\n\treturn &RoomdetailUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *OperativerecordClient) UpdateOne(o *Operativerecord) *OperativerecordUpdateOne {\n\tmutation := newOperativerecordMutation(c.config, OpUpdateOne, withOperativerecord(o))\n\treturn &OperativerecordUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *PatientroomClient) UpdateOne(pa *Patientroom) *PatientroomUpdateOne {\n\tmutation := newPatientroomMutation(c.config, OpUpdateOne, withPatientroom(pa))\n\treturn &PatientroomUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *AppointmentClient) UpdateOne(a *Appointment) *AppointmentUpdateOne {\n\tmutation := newAppointmentMutation(c.config, OpUpdateOne, withAppointment(a))\n\treturn &AppointmentUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *ToolClient) UpdateOne(t *Tool) *ToolUpdateOne {\n\tmutation := newToolMutation(c.config, OpUpdateOne, withTool(t))\n\treturn &ToolUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *UnsavedPostClient) UpdateOne(up *UnsavedPost) *UnsavedPostUpdateOne {\n\tmutation := newUnsavedPostMutation(c.config, OpUpdateOne, withUnsavedPost(up))\n\treturn &UnsavedPostUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *WorkExperienceClient) UpdateOne(we *WorkExperience) *WorkExperienceUpdateOne {\n\tmutation := newWorkExperienceMutation(c.config, OpUpdateOne, withWorkExperience(we))\n\treturn &WorkExperienceUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *TransactionClient) UpdateOne(t *Transaction) *TransactionUpdateOne {\n\tmutation := newTransactionMutation(c.config, OpUpdateOne, withTransaction(t))\n\treturn &TransactionUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *RoomuseClient) UpdateOne(r *Roomuse) *RoomuseUpdateOne {\n\tmutation := newRoomuseMutation(c.config, OpUpdateOne, withRoomuse(r))\n\treturn &RoomuseUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *DispenseMedicineClient) UpdateOne(dm *DispenseMedicine) *DispenseMedicineUpdateOne {\n\tmutation := newDispenseMedicineMutation(c.config, OpUpdateOne, withDispenseMedicine(dm))\n\treturn &DispenseMedicineUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *OrderClient) UpdateOne(o *Order) *OrderUpdateOne {\n\tmutation := newOrderMutation(c.config, OpUpdateOne, withOrder(o))\n\treturn &OrderUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *PharmacistClient) UpdateOne(ph *Pharmacist) *PharmacistUpdateOne {\n\tmutation := newPharmacistMutation(c.config, OpUpdateOne, withPharmacist(ph))\n\treturn &PharmacistUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *BookingClient) UpdateOne(b *Booking) *BookingUpdateOne {\n\tmutation := newBookingMutation(c.config, OpUpdateOne, withBooking(b))\n\treturn &BookingUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *AdminClient) UpdateOne(a *Admin) *AdminUpdateOne {\n\tmutation := newAdminMutation(c.config, OpUpdateOne, withAdmin(a))\n\treturn &AdminUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *MedicineClient) UpdateOne(m *Medicine) *MedicineUpdateOne {\n\tmutation := newMedicineMutation(c.config, OpUpdateOne, withMedicine(m))\n\treturn &MedicineUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *MedicineTypeClient) UpdateOne(mt *MedicineType) *MedicineTypeUpdateOne {\n\tmutation := newMedicineTypeMutation(c.config, OpUpdateOne, withMedicineType(mt))\n\treturn &MedicineTypeUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *DoctorClient) UpdateOne(d *Doctor) *DoctorUpdateOne {\n\tmutation := newDoctorMutation(c.config, OpUpdateOne, withDoctor(d))\n\treturn &DoctorUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *PatientofphysicianClient) UpdateOne(pa *Patientofphysician) *PatientofphysicianUpdateOne {\n\tmutation := newPatientofphysicianMutation(c.config, OpUpdateOne, withPatientofphysician(pa))\n\treturn &PatientofphysicianUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *ActivityTypeClient) UpdateOne(at *ActivityType) *ActivityTypeUpdateOne {\n\tmutation := newActivityTypeMutation(c.config, OpUpdateOne, withActivityType(at))\n\treturn &ActivityTypeUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *DNSBLQueryClient) UpdateOne(dq *DNSBLQuery) *DNSBLQueryUpdateOne {\n\tmutation := newDNSBLQueryMutation(c.config, OpUpdateOne, withDNSBLQuery(dq))\n\treturn &DNSBLQueryUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *OperativeClient) UpdateOne(o *Operative) *OperativeUpdateOne {\n\tmutation := newOperativeMutation(c.config, OpUpdateOne, withOperative(o))\n\treturn &OperativeUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *PatientClient) UpdateOne(pa *Patient) *PatientUpdateOne {\n\tmutation := newPatientMutation(c.config, OpUpdateOne, withPatient(pa))\n\treturn &PatientUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *PatientClient) UpdateOne(pa *Patient) *PatientUpdateOne {\n\tmutation := newPatientMutation(c.config, OpUpdateOne, withPatient(pa))\n\treturn &PatientUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *PatientClient) UpdateOne(pa *Patient) *PatientUpdateOne {\n\tmutation := newPatientMutation(c.config, OpUpdateOne, withPatient(pa))\n\treturn &PatientUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *FoodmenuClient) UpdateOne(f *Foodmenu) *FoodmenuUpdateOne {\n\tmutation := newFoodmenuMutation(c.config, OpUpdateOne, withFoodmenu(f))\n\treturn &FoodmenuUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *StaytypeClient) UpdateOne(s *Staytype) *StaytypeUpdateOne {\n\tmutation := newStaytypeMutation(c.config, OpUpdateOne, withStaytype(s))\n\treturn &StaytypeUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *LevelOfDangerousClient) UpdateOne(lod *LevelOfDangerous) *LevelOfDangerousUpdateOne {\n\tmutation := newLevelOfDangerousMutation(c.config, OpUpdateOne, withLevelOfDangerous(lod))\n\treturn &LevelOfDangerousUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (su *PostUseCase) UpdateOne(id string, request data.Post) error {\n\tpost := &models.Post{ID: id}\n\terr := post.Get()\n\tif err != nil {\n\t\treturn err\n\t}\n\tpost.Post = request\n\terr = post.Update()\n\treturn err\n}", "func UpdateOne(query interface{}, update interface{}) error {\n\treturn db.Update(Collection, query, update)\n}", "func (c *PartorderClient) UpdateOne(pa *Partorder) *PartorderUpdateOne {\n\tmutation := newPartorderMutation(c.config, OpUpdateOne, withPartorder(pa))\n\treturn &PartorderUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *UnitOfMedicineClient) UpdateOne(uom *UnitOfMedicine) *UnitOfMedicineUpdateOne {\n\tmutation := newUnitOfMedicineMutation(c.config, OpUpdateOne, withUnitOfMedicine(uom))\n\treturn &UnitOfMedicineUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *PurposeClient) UpdateOne(pu *Purpose) *PurposeUpdateOne {\n\tmutation := newPurposeMutation(c.config, OpUpdateOne, withPurpose(pu))\n\treturn &PurposeUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *ExaminationroomClient) UpdateOne(e *Examinationroom) *ExaminationroomUpdateOne {\n\tmutation := newExaminationroomMutation(c.config, OpUpdateOne, withExaminationroom(e))\n\treturn &ExaminationroomUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *PaymentClient) UpdateOne(pa *Payment) *PaymentUpdateOne {\n\tmutation := newPaymentMutation(c.config, OpUpdateOne, withPayment(pa))\n\treturn &PaymentUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *PaymentClient) UpdateOne(pa *Payment) *PaymentUpdateOne {\n\tmutation := newPaymentMutation(c.config, OpUpdateOne, withPayment(pa))\n\treturn &PaymentUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *StatustClient) UpdateOne(s *Statust) *StatustUpdateOne {\n\tmutation := newStatustMutation(c.config, OpUpdateOne, withStatust(s))\n\treturn &StatustUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *TagClient) UpdateOne(t *Tag) *TagUpdateOne {\n\tmutation := newTagMutation(c.config, OpUpdateOne, withTag(t))\n\treturn &TagUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *RepairinvoiceClient) UpdateOne(r *Repairinvoice) *RepairinvoiceUpdateOne {\n\tmutation := newRepairinvoiceMutation(c.config, OpUpdateOne, withRepairinvoice(r))\n\treturn &RepairinvoiceUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *DepositClient) UpdateOne(d *Deposit) *DepositUpdateOne {\n\tmutation := newDepositMutation(c.config, OpUpdateOne, withDeposit(d))\n\treturn &DepositUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *EmployeeClient) UpdateOne(e *Employee) *EmployeeUpdateOne {\n\tmutation := newEmployeeMutation(c.config, OpUpdateOne, withEmployee(e))\n\treturn &EmployeeUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *EmployeeClient) UpdateOne(e *Employee) *EmployeeUpdateOne {\n\tmutation := newEmployeeMutation(c.config, OpUpdateOne, withEmployee(e))\n\treturn &EmployeeUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *EmployeeClient) UpdateOne(e *Employee) *EmployeeUpdateOne {\n\tmutation := newEmployeeMutation(c.config, OpUpdateOne, withEmployee(e))\n\treturn &EmployeeUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *RoomClient) UpdateOne(r *Room) *RoomUpdateOne {\n\tmutation := newRoomMutation(c.config, OpUpdateOne, withRoom(r))\n\treturn &RoomUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *RoomClient) UpdateOne(r *Room) *RoomUpdateOne {\n\tmutation := newRoomMutation(c.config, OpUpdateOne, withRoom(r))\n\treturn &RoomUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *BillingstatusClient) UpdateOne(b *Billingstatus) *BillingstatusUpdateOne {\n\tmutation := newBillingstatusMutation(c.config, OpUpdateOne, withBillingstatus(b))\n\treturn &BillingstatusUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *EatinghistoryClient) UpdateOne(e *Eatinghistory) *EatinghistoryUpdateOne {\n\tmutation := newEatinghistoryMutation(c.config, OpUpdateOne, withEatinghistory(e))\n\treturn &EatinghistoryUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *StatusdClient) UpdateOne(s *Statusd) *StatusdUpdateOne {\n\tmutation := newStatusdMutation(c.config, OpUpdateOne, withStatusd(s))\n\treturn &StatusdUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (b *Bill) Update() *BillUpdateOne {\n\treturn (&BillClient{config: b.config}).UpdateOne(b)\n}", "func (c *AnnotationClient) UpdateOne(a *Annotation) *AnnotationUpdateOne {\n\tmutation := newAnnotationMutation(c.config, OpUpdateOne, withAnnotation(a))\n\treturn &AnnotationUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func UpdateOne(ctx context.Context, tx pgx.Tx, sb sq.UpdateBuilder) error {\n\tq, vs, err := sb.ToSql()\n\tif err != nil {\n\t\treturn err\n\t}\n\ttag, err := tx.Exec(ctx, q, vs...)\n\tif err != nil {\n\t\treturn err\n\t}\n\tif tag.RowsAffected() != 1 {\n\t\treturn ErrNoRowsAffected\n\t}\n\treturn nil\n}", "func (c *CleanernameClient) UpdateOne(cl *Cleanername) *CleanernameUpdateOne {\n\tmutation := newCleanernameMutation(c.config, OpUpdateOne, withCleanername(cl))\n\treturn &CleanernameUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *LeaseClient) UpdateOne(l *Lease) *LeaseUpdateOne {\n\tmutation := newLeaseMutation(c.config, OpUpdateOne, withLease(l))\n\treturn &LeaseUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *BinaryFileClient) UpdateOne(bf *BinaryFile) *BinaryFileUpdateOne {\n\tmutation := newBinaryFileMutation(c.config, OpUpdateOne, withBinaryFile(bf))\n\treturn &BinaryFileUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *JobClient) UpdateOne(j *Job) *JobUpdateOne {\n\tmutation := newJobMutation(c.config, OpUpdateOne, withJob(j))\n\treturn &JobUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *ActivitiesClient) UpdateOne(a *Activities) *ActivitiesUpdateOne {\n\tmutation := newActivitiesMutation(c.config, OpUpdateOne, withActivities(a))\n\treturn &ActivitiesUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *UnsavedPostImageClient) UpdateOne(upi *UnsavedPostImage) *UnsavedPostImageUpdateOne {\n\tmutation := newUnsavedPostImageMutation(c.config, OpUpdateOne, withUnsavedPostImage(upi))\n\treturn &UnsavedPostImageUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *ClubapplicationClient) UpdateOne(cl *Clubapplication) *ClubapplicationUpdateOne {\n\tmutation := newClubapplicationMutation(c.config, OpUpdateOne, withClubapplication(cl))\n\treturn &ClubapplicationUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *SkillClient) UpdateOne(s *Skill) *SkillUpdateOne {\n\tmutation := newSkillMutation(c.config, OpUpdateOne, withSkill(s))\n\treturn &SkillUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *RentalstatusClient) UpdateOne(r *Rentalstatus) *RentalstatusUpdateOne {\n\tmutation := newRentalstatusMutation(c.config, OpUpdateOne, withRentalstatus(r))\n\treturn &RentalstatusUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *UsertypeClient) UpdateOne(u *Usertype) *UsertypeUpdateOne {\n\tmutation := newUsertypeMutation(c.config, OpUpdateOne, withUsertype(u))\n\treturn &UsertypeUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *TasteClient) UpdateOne(t *Taste) *TasteUpdateOne {\n\tmutation := newTasteMutation(c.config, OpUpdateOne, withTaste(t))\n\treturn &TasteUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *PositionassingmentClient) UpdateOne(po *Positionassingment) *PositionassingmentUpdateOne {\n\tmutation := newPositionassingmentMutation(c.config, OpUpdateOne, withPositionassingment(po))\n\treturn &PositionassingmentUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *SymptomClient) UpdateOne(s *Symptom) *SymptomUpdateOne {\n\tmutation := newSymptomMutation(c.config, OpUpdateOne, withSymptom(s))\n\treturn &SymptomUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *PartClient) UpdateOne(pa *Part) *PartUpdateOne {\n\tmutation := newPartMutation(c.config, OpUpdateOne, withPart(pa))\n\treturn &PartUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func NewUpdateOneModel() *UpdateOneModel {\n\treturn &UpdateOneModel{}\n}", "func (c *DepartmentClient) UpdateOne(d *Department) *DepartmentUpdateOne {\n\tmutation := newDepartmentMutation(c.config, OpUpdateOne, withDepartment(d))\n\treturn &DepartmentUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *SituationClient) UpdateOne(s *Situation) *SituationUpdateOne {\n\tmutation := newSituationMutation(c.config, OpUpdateOne, withSituation(s))\n\treturn &SituationUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *ComplaintClient) UpdateOne(co *Complaint) *ComplaintUpdateOne {\n\tmutation := newComplaintMutation(c.config, OpUpdateOne, withComplaint(co))\n\treturn &ComplaintUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (t *Todo) Update() *TodoUpdateOne {\n\treturn (&TodoClient{t.config}).UpdateOne(t)\n}", "func (c *QueueClient) UpdateOne(q *Queue) *QueueUpdateOne {\n\tmutation := newQueueMutation(c.config, OpUpdateOne, withQueue(q))\n\treturn &QueueUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *UserWalletClient) UpdateOne(uw *UserWallet) *UserWalletUpdateOne {\n\tmutation := newUserWalletMutation(c.config, OpUpdateOne, withUserWallet(uw))\n\treturn &UserWalletUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *BranchClient) UpdateOne(b *Branch) *BranchUpdateOne {\n\tmutation := newBranchMutation(c.config, OpUpdateOne, withBranch(b))\n\treturn &BranchUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *ReturninvoiceClient) UpdateOne(r *Returninvoice) *ReturninvoiceUpdateOne {\n\tmutation := newReturninvoiceMutation(c.config, OpUpdateOne, withReturninvoice(r))\n\treturn &ReturninvoiceUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *PatientInfoClient) UpdateOne(pi *PatientInfo) *PatientInfoUpdateOne {\n\tmutation := newPatientInfoMutation(c.config, OpUpdateOne, withPatientInfo(pi))\n\treturn &PatientInfoUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *UserClient) UpdateOne(u *User) *UserUpdateOne {\n\tmutation := newUserMutation(c.config, OpUpdateOne, withUser(u))\n\treturn &UserUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *UserClient) UpdateOne(u *User) *UserUpdateOne {\n\tmutation := newUserMutation(c.config, OpUpdateOne, withUser(u))\n\treturn &UserUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *UserClient) UpdateOne(u *User) *UserUpdateOne {\n\tmutation := newUserMutation(c.config, OpUpdateOne, withUser(u))\n\treturn &UserUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *UserClient) UpdateOne(u *User) *UserUpdateOne {\n\tmutation := newUserMutation(c.config, OpUpdateOne, withUser(u))\n\treturn &UserUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *UserClient) UpdateOne(u *User) *UserUpdateOne {\n\tmutation := newUserMutation(c.config, OpUpdateOne, withUser(u))\n\treturn &UserUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}" ]
[ "0.69773513", "0.6700239", "0.66991323", "0.66772205", "0.66711056", "0.65891296", "0.65891296", "0.65891296", "0.6529943", "0.651992", "0.6517249", "0.6488436", "0.6488436", "0.6461467", "0.64580745", "0.6444564", "0.6440813", "0.64263475", "0.6407116", "0.64044094", "0.6402244", "0.6402244", "0.6401924", "0.63997734", "0.63976485", "0.63883317", "0.63816136", "0.6380565", "0.6370969", "0.63709646", "0.6364213", "0.6363832", "0.6348345", "0.6335132", "0.6330745", "0.63263464", "0.6325927", "0.63202494", "0.631989", "0.6319132", "0.6316663", "0.6287886", "0.6282346", "0.62710464", "0.62710464", "0.62710464", "0.6258297", "0.62548864", "0.6243332", "0.6216176", "0.62148726", "0.6214705", "0.6211075", "0.62070787", "0.6187787", "0.6186292", "0.6186292", "0.618427", "0.61778814", "0.6174648", "0.61743003", "0.61704266", "0.61704266", "0.61704266", "0.6158959", "0.6158959", "0.6158523", "0.615801", "0.61553144", "0.6135769", "0.6133886", "0.6126848", "0.610412", "0.6084781", "0.6083719", "0.607597", "0.60747206", "0.6073408", "0.60694623", "0.6044985", "0.6041846", "0.6037389", "0.60345656", "0.6029807", "0.60198456", "0.6018794", "0.60022384", "0.59993756", "0.59894186", "0.59838474", "0.5975079", "0.59639263", "0.59572136", "0.5950218", "0.5949224", "0.5938023", "0.5934483", "0.5934483", "0.5934483", "0.5934483", "0.5934483" ]
0.0
-1
UpdateOneID returns an update builder for the given id.
func (c *CategoryClient) UpdateOneID(id int) *CategoryUpdateOne { mutation := newCategoryMutation(c.config, OpUpdateOne, withCategoryID(id)) return &CategoryUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation} }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (c *BuildingClient) UpdateOneID(id int) *BuildingUpdateOne {\n\tmutation := newBuildingMutation(c.config, OpUpdateOne, withBuildingID(id))\n\treturn &BuildingUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *BedtypeClient) UpdateOneID(id int) *BedtypeUpdateOne {\n\tmutation := newBedtypeMutation(c.config, OpUpdateOne, withBedtypeID(id))\n\treturn &BedtypeUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *ModuleClient) UpdateOneID(id int) *ModuleUpdateOne {\n\treturn &ModuleUpdateOne{config: c.config, id: id}\n}", "func (c *ModuleVersionClient) UpdateOneID(id int) *ModuleVersionUpdateOne {\n\treturn &ModuleVersionUpdateOne{config: c.config, id: id}\n}", "func (c *BillClient) UpdateOneID(id int) *BillUpdateOne {\n\tmutation := newBillMutation(c.config, OpUpdateOne, withBillID(id))\n\treturn &BillUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *BillClient) UpdateOneID(id int) *BillUpdateOne {\n\tmutation := newBillMutation(c.config, OpUpdateOne, withBillID(id))\n\treturn &BillUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *BillClient) UpdateOneID(id int) *BillUpdateOne {\n\tmutation := newBillMutation(c.config, OpUpdateOne, withBillID(id))\n\treturn &BillUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *MealplanClient) UpdateOneID(id int) *MealplanUpdateOne {\n\tmutation := newMealplanMutation(c.config, OpUpdateOne, withMealplanID(id))\n\treturn &MealplanUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *BeerClient) UpdateOneID(id int) *BeerUpdateOne {\n\tmutation := newBeerMutation(c.config, OpUpdateOne, withBeerID(id))\n\treturn &BeerUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *RoomuseClient) UpdateOneID(id int) *RoomuseUpdateOne {\n\tmutation := newRoomuseMutation(c.config, OpUpdateOne, withRoomuseID(id))\n\treturn &RoomuseUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *BookingClient) UpdateOneID(id int) *BookingUpdateOne {\n\tmutation := newBookingMutation(c.config, OpUpdateOne, withBookingID(id))\n\treturn &BookingUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *CleaningroomClient) UpdateOneID(id int) *CleaningroomUpdateOne {\n\tmutation := newCleaningroomMutation(c.config, OpUpdateOne, withCleaningroomID(id))\n\treturn &CleaningroomUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *LengthtimeClient) UpdateOneID(id int) *LengthtimeUpdateOne {\n\tmutation := newLengthtimeMutation(c.config, OpUpdateOne, withLengthtimeID(id))\n\treturn &LengthtimeUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *ToolClient) UpdateOneID(id int) *ToolUpdateOne {\n\tmutation := newToolMutation(c.config, OpUpdateOne, withToolID(id))\n\treturn &ToolUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *StatustClient) UpdateOneID(id int) *StatustUpdateOne {\n\tmutation := newStatustMutation(c.config, OpUpdateOne, withStatustID(id))\n\treturn &StatustUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *DrugAllergyClient) UpdateOneID(id int) *DrugAllergyUpdateOne {\n\tmutation := newDrugAllergyMutation(c.config, OpUpdateOne, withDrugAllergyID(id))\n\treturn &DrugAllergyUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *ClubapplicationClient) UpdateOneID(id int) *ClubapplicationUpdateOne {\n\tmutation := newClubapplicationMutation(c.config, OpUpdateOne, withClubapplicationID(id))\n\treturn &ClubapplicationUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *AppointmentClient) UpdateOneID(id uuid.UUID) *AppointmentUpdateOne {\n\tmutation := newAppointmentMutation(c.config, OpUpdateOne, withAppointmentID(id))\n\treturn &AppointmentUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *EmptyClient) UpdateOneID(id int) *EmptyUpdateOne {\n\tmutation := newEmptyMutation(c.config, OpUpdateOne, withEmptyID(id))\n\treturn &EmptyUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *AdminClient) UpdateOneID(id int) *AdminUpdateOne {\n\tmutation := newAdminMutation(c.config, OpUpdateOne, withAdminID(id))\n\treturn &AdminUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *OperationroomClient) UpdateOneID(id int) *OperationroomUpdateOne {\n\tmutation := newOperationroomMutation(c.config, OpUpdateOne, withOperationroomID(id))\n\treturn &OperationroomUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *BinaryFileClient) UpdateOneID(id int) *BinaryFileUpdateOne {\n\tmutation := newBinaryFileMutation(c.config, OpUpdateOne, withBinaryFileID(id))\n\treturn &BinaryFileUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *PhysicianClient) UpdateOneID(id int) *PhysicianUpdateOne {\n\tmutation := newPhysicianMutation(c.config, OpUpdateOne, withPhysicianID(id))\n\treturn &PhysicianUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *PhysicianClient) UpdateOneID(id int) *PhysicianUpdateOne {\n\tmutation := newPhysicianMutation(c.config, OpUpdateOne, withPhysicianID(id))\n\treturn &PhysicianUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *RoomdetailClient) UpdateOneID(id int) *RoomdetailUpdateOne {\n\tmutation := newRoomdetailMutation(c.config, OpUpdateOne, withRoomdetailID(id))\n\treturn &RoomdetailUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *OperativeClient) UpdateOneID(id int) *OperativeUpdateOne {\n\tmutation := newOperativeMutation(c.config, OpUpdateOne, withOperativeID(id))\n\treturn &OperativeUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *DoctorClient) UpdateOneID(id int) *DoctorUpdateOne {\n\tmutation := newDoctorMutation(c.config, OpUpdateOne, withDoctorID(id))\n\treturn &DoctorUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *DentistClient) UpdateOneID(id int) *DentistUpdateOne {\n\tmutation := newDentistMutation(c.config, OpUpdateOne, withDentistID(id))\n\treturn &DentistUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *UnitOfMedicineClient) UpdateOneID(id int) *UnitOfMedicineUpdateOne {\n\tmutation := newUnitOfMedicineMutation(c.config, OpUpdateOne, withUnitOfMedicineID(id))\n\treturn &UnitOfMedicineUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *LeaseClient) UpdateOneID(id int) *LeaseUpdateOne {\n\tmutation := newLeaseMutation(c.config, OpUpdateOne, withLeaseID(id))\n\treturn &LeaseUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *PatientroomClient) UpdateOneID(id int) *PatientroomUpdateOne {\n\tmutation := newPatientroomMutation(c.config, OpUpdateOne, withPatientroomID(id))\n\treturn &PatientroomUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *RoomClient) UpdateOneID(id int) *RoomUpdateOne {\n\tmutation := newRoomMutation(c.config, OpUpdateOne, withRoomID(id))\n\treturn &RoomUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *RoomClient) UpdateOneID(id int) *RoomUpdateOne {\n\tmutation := newRoomMutation(c.config, OpUpdateOne, withRoomID(id))\n\treturn &RoomUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *JobClient) UpdateOneID(id int) *JobUpdateOne {\n\tmutation := newJobMutation(c.config, OpUpdateOne, withJobID(id))\n\treturn &JobUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *StatusdClient) UpdateOneID(id int) *StatusdUpdateOne {\n\tmutation := newStatusdMutation(c.config, OpUpdateOne, withStatusdID(id))\n\treturn &StatusdUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *BuildingClient) UpdateOne(b *Building) *BuildingUpdateOne {\n\tmutation := newBuildingMutation(c.config, OpUpdateOne, withBuilding(b))\n\treturn &BuildingUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *MedicineClient) UpdateOneID(id int) *MedicineUpdateOne {\n\tmutation := newMedicineMutation(c.config, OpUpdateOne, withMedicineID(id))\n\treturn &MedicineUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *DeviceClient) UpdateOneID(id int) *DeviceUpdateOne {\n\tmutation := newDeviceMutation(c.config, OpUpdateOne, withDeviceID(id))\n\treturn &DeviceUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *CleanernameClient) UpdateOneID(id int) *CleanernameUpdateOne {\n\tmutation := newCleanernameMutation(c.config, OpUpdateOne, withCleanernameID(id))\n\treturn &CleanernameUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *BillingstatusClient) UpdateOneID(id int) *BillingstatusUpdateOne {\n\tmutation := newBillingstatusMutation(c.config, OpUpdateOne, withBillingstatusID(id))\n\treturn &BillingstatusUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *PaymentClient) UpdateOneID(id int) *PaymentUpdateOne {\n\tmutation := newPaymentMutation(c.config, OpUpdateOne, withPaymentID(id))\n\treturn &PaymentUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *PaymentClient) UpdateOneID(id int) *PaymentUpdateOne {\n\tmutation := newPaymentMutation(c.config, OpUpdateOne, withPaymentID(id))\n\treturn &PaymentUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *LevelOfDangerousClient) UpdateOneID(id int) *LevelOfDangerousUpdateOne {\n\tmutation := newLevelOfDangerousMutation(c.config, OpUpdateOne, withLevelOfDangerousID(id))\n\treturn &LevelOfDangerousUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *FoodmenuClient) UpdateOneID(id int) *FoodmenuUpdateOne {\n\tmutation := newFoodmenuMutation(c.config, OpUpdateOne, withFoodmenuID(id))\n\treturn &FoodmenuUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *PostClient) UpdateOneID(id int) *PostUpdateOne {\n\tmutation := newPostMutation(c.config, OpUpdateOne, withPostID(id))\n\treturn &PostUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *PharmacistClient) UpdateOneID(id int) *PharmacistUpdateOne {\n\tmutation := newPharmacistMutation(c.config, OpUpdateOne, withPharmacistID(id))\n\treturn &PharmacistUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *ExaminationroomClient) UpdateOneID(id int) *ExaminationroomUpdateOne {\n\tmutation := newExaminationroomMutation(c.config, OpUpdateOne, withExaminationroomID(id))\n\treturn &ExaminationroomUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *KeyStoreClient) UpdateOneID(id int32) *KeyStoreUpdateOne {\n\tmutation := newKeyStoreMutation(c.config, OpUpdateOne, withKeyStoreID(id))\n\treturn &KeyStoreUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *ActivitiesClient) UpdateOneID(id int) *ActivitiesUpdateOne {\n\tmutation := newActivitiesMutation(c.config, OpUpdateOne, withActivitiesID(id))\n\treturn &ActivitiesUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *PatientofphysicianClient) UpdateOneID(id int) *PatientofphysicianUpdateOne {\n\tmutation := newPatientofphysicianMutation(c.config, OpUpdateOne, withPatientofphysicianID(id))\n\treturn &PatientofphysicianUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *PostAttachmentClient) UpdateOneID(id int) *PostAttachmentUpdateOne {\n\tmutation := newPostAttachmentMutation(c.config, OpUpdateOne, withPostAttachmentID(id))\n\treturn &PostAttachmentUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *SkillClient) UpdateOneID(id int) *SkillUpdateOne {\n\tmutation := newSkillMutation(c.config, OpUpdateOne, withSkillID(id))\n\treturn &SkillUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *QueueClient) UpdateOneID(id int) *QueueUpdateOne {\n\tmutation := newQueueMutation(c.config, OpUpdateOne, withQueueID(id))\n\treturn &QueueUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *EventClient) UpdateOneID(id int) *EventUpdateOne {\n\tmutation := newEventMutation(c.config, OpUpdateOne, withEventID(id))\n\treturn &EventUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *DNSBLQueryClient) UpdateOneID(id uuid.UUID) *DNSBLQueryUpdateOne {\n\tmutation := newDNSBLQueryMutation(c.config, OpUpdateOne, withDNSBLQueryID(id))\n\treturn &DNSBLQueryUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *SymptomClient) UpdateOneID(id int) *SymptomUpdateOne {\n\tmutation := newSymptomMutation(c.config, OpUpdateOne, withSymptomID(id))\n\treturn &SymptomUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *PatientClient) UpdateOneID(id int) *PatientUpdateOne {\n\tmutation := newPatientMutation(c.config, OpUpdateOne, withPatientID(id))\n\treturn &PatientUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *PatientClient) UpdateOneID(id int) *PatientUpdateOne {\n\tmutation := newPatientMutation(c.config, OpUpdateOne, withPatientID(id))\n\treturn &PatientUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *PatientClient) UpdateOneID(id int) *PatientUpdateOne {\n\tmutation := newPatientMutation(c.config, OpUpdateOne, withPatientID(id))\n\treturn &PatientUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *NurseClient) UpdateOneID(id int) *NurseUpdateOne {\n\tmutation := newNurseMutation(c.config, OpUpdateOne, withNurseID(id))\n\treturn &NurseUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *PurposeClient) UpdateOneID(id int) *PurposeUpdateOne {\n\tmutation := newPurposeMutation(c.config, OpUpdateOne, withPurposeID(id))\n\treturn &PurposeUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *OrderClient) UpdateOneID(id int) *OrderUpdateOne {\n\tmutation := newOrderMutation(c.config, OpUpdateOne, withOrderID(id))\n\treturn &OrderUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *DepositClient) UpdateOneID(id int) *DepositUpdateOne {\n\tmutation := newDepositMutation(c.config, OpUpdateOne, withDepositID(id))\n\treturn &DepositUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *DispenseMedicineClient) UpdateOneID(id int) *DispenseMedicineUpdateOne {\n\tmutation := newDispenseMedicineMutation(c.config, OpUpdateOne, withDispenseMedicineID(id))\n\treturn &DispenseMedicineUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *PartorderClient) UpdateOneID(id int) *PartorderUpdateOne {\n\tmutation := newPartorderMutation(c.config, OpUpdateOne, withPartorderID(id))\n\treturn &PartorderUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *PlanetClient) UpdateOneID(id int) *PlanetUpdateOne {\n\tmutation := newPlanetMutation(c.config, OpUpdateOne)\n\tmutation.id = &id\n\treturn &PlanetUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *StaytypeClient) UpdateOneID(id int) *StaytypeUpdateOne {\n\tmutation := newStaytypeMutation(c.config, OpUpdateOne, withStaytypeID(id))\n\treturn &StaytypeUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *UsertypeClient) UpdateOneID(id int) *UsertypeUpdateOne {\n\tmutation := newUsertypeMutation(c.config, OpUpdateOne, withUsertypeID(id))\n\treturn &UsertypeUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *RentalstatusClient) UpdateOneID(id int) *RentalstatusUpdateOne {\n\tmutation := newRentalstatusMutation(c.config, OpUpdateOne, withRentalstatusID(id))\n\treturn &RentalstatusUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *PetruleClient) UpdateOneID(id int) *PetruleUpdateOne {\n\tmutation := newPetruleMutation(c.config, OpUpdateOne, withPetruleID(id))\n\treturn &PetruleUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *ActivityTypeClient) UpdateOneID(id int) *ActivityTypeUpdateOne {\n\tmutation := newActivityTypeMutation(c.config, OpUpdateOne, withActivityTypeID(id))\n\treturn &ActivityTypeUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *WorkExperienceClient) UpdateOneID(id int) *WorkExperienceUpdateOne {\n\tmutation := newWorkExperienceMutation(c.config, OpUpdateOne, withWorkExperienceID(id))\n\treturn &WorkExperienceUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *TasteClient) UpdateOneID(id int) *TasteUpdateOne {\n\tmutation := newTasteMutation(c.config, OpUpdateOne, withTasteID(id))\n\treturn &TasteUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *OperativerecordClient) UpdateOneID(id int) *OperativerecordUpdateOne {\n\tmutation := newOperativerecordMutation(c.config, OpUpdateOne, withOperativerecordID(id))\n\treturn &OperativerecordUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *OperationClient) UpdateOneID(id uuid.UUID) *OperationUpdateOne {\n\tmutation := newOperationMutation(c.config, OpUpdateOne, withOperationID(id))\n\treturn &OperationUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *UserClient) UpdateOneID(id int) *UserUpdateOne {\n\tmutation := newUserMutation(c.config, OpUpdateOne, withUserID(id))\n\treturn &UserUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *UserClient) UpdateOneID(id int) *UserUpdateOne {\n\tmutation := newUserMutation(c.config, OpUpdateOne, withUserID(id))\n\treturn &UserUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *UserClient) UpdateOneID(id int) *UserUpdateOne {\n\tmutation := newUserMutation(c.config, OpUpdateOne, withUserID(id))\n\treturn &UserUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *UserClient) UpdateOneID(id int) *UserUpdateOne {\n\tmutation := newUserMutation(c.config, OpUpdateOne, withUserID(id))\n\treturn &UserUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *UserClient) UpdateOneID(id int) *UserUpdateOne {\n\tmutation := newUserMutation(c.config, OpUpdateOne, withUserID(id))\n\treturn &UserUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *UserClient) UpdateOneID(id int) *UserUpdateOne {\n\tmutation := newUserMutation(c.config, OpUpdateOne, withUserID(id))\n\treturn &UserUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *UserClient) UpdateOneID(id int) *UserUpdateOne {\n\tmutation := newUserMutation(c.config, OpUpdateOne, withUserID(id))\n\treturn &UserUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *FacultyClient) UpdateOneID(id int) *FacultyUpdateOne {\n\tmutation := newFacultyMutation(c.config, OpUpdateOne, withFacultyID(id))\n\treturn &FacultyUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *MedicineTypeClient) UpdateOneID(id int) *MedicineTypeUpdateOne {\n\tmutation := newMedicineTypeMutation(c.config, OpUpdateOne, withMedicineTypeID(id))\n\treturn &MedicineTypeUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *TransactionClient) UpdateOneID(id int32) *TransactionUpdateOne {\n\tmutation := newTransactionMutation(c.config, OpUpdateOne, withTransactionID(id))\n\treturn &TransactionUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *AdminSessionClient) UpdateOneID(id int) *AdminSessionUpdateOne {\n\tmutation := newAdminSessionMutation(c.config, OpUpdateOne, withAdminSessionID(id))\n\treturn &AdminSessionUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *UnsavedPostAttachmentClient) UpdateOneID(id int) *UnsavedPostAttachmentUpdateOne {\n\tmutation := newUnsavedPostAttachmentMutation(c.config, OpUpdateOne, withUnsavedPostAttachmentID(id))\n\treturn &UnsavedPostAttachmentUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *EatinghistoryClient) UpdateOneID(id int) *EatinghistoryUpdateOne {\n\tmutation := newEatinghistoryMutation(c.config, OpUpdateOne, withEatinghistoryID(id))\n\treturn &EatinghistoryUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *UnsavedPostClient) UpdateOneID(id int) *UnsavedPostUpdateOne {\n\tmutation := newUnsavedPostMutation(c.config, OpUpdateOne, withUnsavedPostID(id))\n\treturn &UnsavedPostUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *UserWalletClient) UpdateOneID(id int64) *UserWalletUpdateOne {\n\tmutation := newUserWalletMutation(c.config, OpUpdateOne, withUserWalletID(id))\n\treturn &UserWalletUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *RepairinvoiceClient) UpdateOneID(id int) *RepairinvoiceUpdateOne {\n\tmutation := newRepairinvoiceMutation(c.config, OpUpdateOne, withRepairinvoiceID(id))\n\treturn &RepairinvoiceUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *ClubappStatusClient) UpdateOneID(id int) *ClubappStatusUpdateOne {\n\tmutation := newClubappStatusMutation(c.config, OpUpdateOne, withClubappStatusID(id))\n\treturn &ClubappStatusUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *UserClient) UpdateOneID(id int64) *UserUpdateOne {\n\tmutation := newUserMutation(c.config, OpUpdateOne, withUserID(id))\n\treturn &UserUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *PledgeClient) UpdateOneID(id int) *PledgeUpdateOne {\n\tmutation := newPledgeMutation(c.config, OpUpdateOne, withPledgeID(id))\n\treturn &PledgeUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *AnnotationClient) UpdateOneID(id int) *AnnotationUpdateOne {\n\tmutation := newAnnotationMutation(c.config, OpUpdateOne, withAnnotationID(id))\n\treturn &AnnotationUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *ComplaintClient) UpdateOneID(id int) *ComplaintUpdateOne {\n\tmutation := newComplaintMutation(c.config, OpUpdateOne, withComplaintID(id))\n\treturn &ComplaintUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *PatientInfoClient) UpdateOneID(id int) *PatientInfoUpdateOne {\n\tmutation := newPatientInfoMutation(c.config, OpUpdateOne, withPatientInfoID(id))\n\treturn &PatientInfoUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *BillClient) UpdateOne(b *Bill) *BillUpdateOne {\n\tmutation := newBillMutation(c.config, OpUpdateOne, withBill(b))\n\treturn &BillUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *BillClient) UpdateOne(b *Bill) *BillUpdateOne {\n\tmutation := newBillMutation(c.config, OpUpdateOne, withBill(b))\n\treturn &BillUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *BillClient) UpdateOne(b *Bill) *BillUpdateOne {\n\tmutation := newBillMutation(c.config, OpUpdateOne, withBill(b))\n\treturn &BillUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *BedtypeClient) UpdateOne(b *Bedtype) *BedtypeUpdateOne {\n\tmutation := newBedtypeMutation(c.config, OpUpdateOne, withBedtype(b))\n\treturn &BedtypeUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}" ]
[ "0.7161348", "0.7021795", "0.70109475", "0.6987695", "0.6971843", "0.6971843", "0.6971843", "0.6955421", "0.6893299", "0.6873468", "0.686999", "0.6867514", "0.68326384", "0.67677706", "0.676005", "0.67582935", "0.67317337", "0.6730868", "0.6728914", "0.6725172", "0.67245674", "0.67212975", "0.67189515", "0.67189515", "0.67102355", "0.6707127", "0.669769", "0.6690616", "0.66827035", "0.66774124", "0.6675087", "0.66744506", "0.66744506", "0.66643935", "0.6663119", "0.6659082", "0.6657644", "0.6655289", "0.6655261", "0.6653554", "0.66460645", "0.66460645", "0.663756", "0.6631523", "0.6627142", "0.6624707", "0.6623987", "0.6601843", "0.65797526", "0.6576547", "0.6568908", "0.65603995", "0.6557924", "0.6552158", "0.6549937", "0.6521825", "0.65147156", "0.65147156", "0.65147156", "0.65099955", "0.65054363", "0.648952", "0.6478015", "0.6473789", "0.6471547", "0.6471048", "0.6470727", "0.6462047", "0.6457952", "0.64534163", "0.64484423", "0.6447777", "0.6440799", "0.6436213", "0.64297175", "0.6427824", "0.6427824", "0.6427824", "0.6427824", "0.6427824", "0.6427824", "0.6427824", "0.6426412", "0.64258724", "0.6424467", "0.6424315", "0.64222825", "0.64198", "0.6416395", "0.6413874", "0.64108914", "0.640751", "0.6402095", "0.63971955", "0.6396155", "0.63862425", "0.63839704", "0.6378773", "0.6378773", "0.6378773", "0.6374693" ]
0.0
-1
Delete returns a delete builder for Category.
func (c *CategoryClient) Delete() *CategoryDelete { mutation := newCategoryMutation(c.config, OpDelete) return &CategoryDelete{config: c.config, hooks: c.Hooks(), mutation: mutation} }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (r *DeviceCategoryRequest) Delete(ctx context.Context) error {\n\treturn r.JSONRequest(ctx, \"DELETE\", \"\", nil, nil)\n}", "func (r *DeviceManagementSettingCategoryRequest) Delete(ctx context.Context) error {\n\treturn r.JSONRequest(ctx, \"DELETE\", \"\", nil, nil)\n}", "func (m *GroupPolicyCategoriesGroupPolicyCategoryItemRequestBuilder) Delete(ctx context.Context, requestConfiguration *GroupPolicyCategoriesGroupPolicyCategoryItemRequestBuilderDeleteRequestConfiguration)(error) {\n requestInfo, err := m.ToDeleteRequestInformation(ctx, requestConfiguration);\n if err != nil {\n return err\n }\n errorMapping := i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.ErrorMappings {\n \"4XX\": i20a3050780ee0b0cde0a884a4f35429a20d60067e3bcda382ec5400079147459.CreateODataErrorFromDiscriminatorValue,\n \"5XX\": i20a3050780ee0b0cde0a884a4f35429a20d60067e3bcda382ec5400079147459.CreateODataErrorFromDiscriminatorValue,\n }\n err = m.BaseRequestBuilder.RequestAdapter.SendNoContent(ctx, requestInfo, errorMapping)\n if err != nil {\n return err\n }\n return nil\n}", "func Delete(c *gin.Context){\n\tidStr := c.Query(\"id\")\n\tid, err := strconv.Atoi(idStr)\n\tif err != nil {\n\t\tresponese.Error(c, err, nil)\n\t\treturn\n\t}\n\tca := Category{ID:id}\n\terr = ca.Delete()\n\tif err != nil {\n\t\tresponese.Error(c, err, nil)\n\t\treturn\n\t}\n\tresponese.Success(c, \"deleted\", nil)\n}", "func DeleteCategory(p providers.CategoryProvider) func(c *fiber.Ctx) error {\n\treturn func(c *fiber.Ctx) error {\n\t\tcategoryID, _ := strconv.Atoi(c.Params(\"id\"))\n\t\terr := p.CategoryDelete(categoryID)\n\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tresult := make([]*models.Category, 0)\n\t\treturn c.Render(\"category\", result)\n\t}\n}", "func (c *Category) Delete(db *sql.DB) (err error) {\n\tres, err := db.Exec(\"DELETE FROM category WHERE id = $1\", c.ID)\n\tif err != nil {\n\t\treturn err\n\t}\n\tcount, err := res.RowsAffected()\n\tif err != nil {\n\t\treturn err\n\t}\n\tif count != 1 {\n\t\treturn errors.New(\"Catégorie introuvable\")\n\t}\n\treturn nil\n}", "func CategoryDelete(c *gin.Context) {\n\tCategory, _ := models.GetCategory(c.Param(\"name\"))\n\tif err := Category.Delete(); err != nil {\n\t\tc.HTML(http.StatusInternalServerError, \"errors/500\", nil)\n\t\tlogrus.Error(err)\n\t\treturn\n\t}\n\tc.Redirect(http.StatusFound, \"/admin/categories\")\n}", "func (r *DeviceManagementTemplateSettingCategoryRequest) Delete(ctx context.Context) error {\n\treturn r.JSONRequest(ctx, \"DELETE\", \"\", nil, nil)\n}", "func (s *CategoryService) Delete(rs app.RequestScope, id int) (*models.Category, error) {\n\tcategory, err := s.dao.Get(rs, id)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\terr = s.dao.Delete(rs, id)\n\treturn category, err\n}", "func (c *BuildingClient) Delete() *BuildingDelete {\n\tmutation := newBuildingMutation(c.config, OpDelete)\n\treturn &BuildingDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (m *ComanagedDevicesItemDeviceCategoryRequestBuilder) Delete(ctx context.Context, requestConfiguration *ComanagedDevicesItemDeviceCategoryRequestBuilderDeleteRequestConfiguration)(error) {\n requestInfo, err := m.ToDeleteRequestInformation(ctx, requestConfiguration);\n if err != nil {\n return err\n }\n errorMapping := i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.ErrorMappings {\n \"4XX\": i20a3050780ee0b0cde0a884a4f35429a20d60067e3bcda382ec5400079147459.CreateODataErrorFromDiscriminatorValue,\n \"5XX\": i20a3050780ee0b0cde0a884a4f35429a20d60067e3bcda382ec5400079147459.CreateODataErrorFromDiscriminatorValue,\n }\n err = m.BaseRequestBuilder.RequestAdapter.SendNoContent(ctx, requestInfo, errorMapping)\n if err != nil {\n return err\n }\n return nil\n}", "func (r *DeviceManagementIntentSettingCategoryRequest) Delete(ctx context.Context) error {\n\treturn r.JSONRequest(ctx, \"DELETE\", \"\", nil, nil)\n}", "func (c *DoctorClient) Delete() *DoctorDelete {\n\tmutation := newDoctorMutation(c.config, OpDelete)\n\treturn &DoctorDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (m *TemplatesItemCategoriesDeviceManagementTemplateSettingCategoryItemRequestBuilder) Delete(ctx context.Context, requestConfiguration *TemplatesItemCategoriesDeviceManagementTemplateSettingCategoryItemRequestBuilderDeleteRequestConfiguration)(error) {\n requestInfo, err := m.ToDeleteRequestInformation(ctx, requestConfiguration);\n if err != nil {\n return err\n }\n errorMapping := i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.ErrorMappings {\n \"4XX\": i20a3050780ee0b0cde0a884a4f35429a20d60067e3bcda382ec5400079147459.CreateODataErrorFromDiscriminatorValue,\n \"5XX\": i20a3050780ee0b0cde0a884a4f35429a20d60067e3bcda382ec5400079147459.CreateODataErrorFromDiscriminatorValue,\n }\n err = m.BaseRequestBuilder.RequestAdapter.SendNoContent(ctx, requestInfo, errorMapping)\n if err != nil {\n return err\n }\n return nil\n}", "func NewDeleteCategory(r *http.Request) (*int, error) {\n\n\tcategoryID, err := strconv.Atoi(chi.URLParam(r, \"category_id\"))\n\tif err != nil {\n\t\treturn nil, ErrInvalidCategoryID\n\t}\n\n\treturn &categoryID, nil\n}", "func (h *CategoryHandler) Delete(ctx iris.Context) {\n\tid := ctx.Params().GetInt64Default(\"id\", 0)\n\n\taffected, err := h.service.DeleteByID(ctx.Request().Context(), id)\n\tif err != nil {\n\t\tif err == sql.ErrNoRows {\n\t\t\twriteEntityNotFound(ctx)\n\t\t\treturn\n\t\t}\n\n\t\tdebugf(\"CategoryHandler.Delete(DB): %v\", err)\n\t\twriteInternalServerError(ctx)\n\t\treturn\n\t}\n\n\tstatus := iris.StatusOK // StatusNoContent\n\tif affected == 0 {\n\t\tstatus = iris.StatusNotModified\n\t}\n\n\tctx.StatusCode(status)\n}", "func (c *BedtypeClient) Delete() *BedtypeDelete {\n\tmutation := newBedtypeMutation(c.config, OpDelete)\n\treturn &BedtypeDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *FoodmenuClient) Delete() *FoodmenuDelete {\n\tmutation := newFoodmenuMutation(c.config, OpDelete)\n\treturn &FoodmenuDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (m *CompaniesItemItemCategoriesItemCategoryItemRequestBuilder) Delete(ctx context.Context, requestConfiguration *CompaniesItemItemCategoriesItemCategoryItemRequestBuilderDeleteRequestConfiguration)(error) {\n requestInfo, err := m.ToDeleteRequestInformation(ctx, requestConfiguration);\n if err != nil {\n return err\n }\n errorMapping := i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.ErrorMappings {\n \"4XX\": i20a3050780ee0b0cde0a884a4f35429a20d60067e3bcda382ec5400079147459.CreateODataErrorFromDiscriminatorValue,\n \"5XX\": i20a3050780ee0b0cde0a884a4f35429a20d60067e3bcda382ec5400079147459.CreateODataErrorFromDiscriminatorValue,\n }\n err = m.BaseRequestBuilder.RequestAdapter.SendNoContent(ctx, requestInfo, errorMapping)\n if err != nil {\n return err\n }\n return nil\n}", "func (c *CleaningroomClient) Delete() *CleaningroomDelete {\n\tmutation := newCleaningroomMutation(c.config, OpDelete)\n\treturn &CleaningroomDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *OperationClient) Delete() *OperationDelete {\n\tmutation := newOperationMutation(c.config, OpDelete)\n\treturn &OperationDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *StatusdClient) Delete() *StatusdDelete {\n\tmutation := newStatusdMutation(c.config, OpDelete)\n\treturn &StatusdDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (o *BookCategory) Delete(ctx context.Context, exec boil.ContextExecutor) (int64, error) {\n\tif o == nil {\n\t\treturn 0, errors.New(\"models: no BookCategory provided for delete\")\n\t}\n\n\tif err := o.doBeforeDeleteHooks(ctx, exec); err != nil {\n\t\treturn 0, err\n\t}\n\n\targs := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(o)), bookCategoryPrimaryKeyMapping)\n\tsql := \"DELETE FROM `book_category` WHERE `id`=?\"\n\n\tif boil.DebugMode {\n\t\tfmt.Fprintln(boil.DebugWriter, sql)\n\t\tfmt.Fprintln(boil.DebugWriter, args...)\n\t}\n\n\tresult, err := exec.ExecContext(ctx, sql, args...)\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: unable to delete from book_category\")\n\t}\n\n\trowsAff, err := result.RowsAffected()\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: failed to get rows affected by delete for book_category\")\n\t}\n\n\tif err := o.doAfterDeleteHooks(ctx, exec); err != nil {\n\t\treturn 0, err\n\t}\n\n\treturn rowsAff, nil\n}", "func (c *TagClient) Delete() *TagDelete {\n\tmutation := newTagMutation(c.config, OpDelete)\n\treturn &TagDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c SQLCategoryRepo) Delete(id int) error {\n\tquery := c.DB.Where(\"id = ?\", id).Delete(&Category{})\n\tif query.Error != nil {\n\t\treturn query.Error\n\t}\n\n\tif query.RowsAffected == 0 {\n\t\treturn fmt.Errorf(\"sql category delete: %w\", ErrRecordNotFound)\n\t}\n\n\treturn nil\n}", "func (c *MealplanClient) Delete() *MealplanDelete {\n\tmutation := newMealplanMutation(c.config, OpDelete)\n\treturn &MealplanDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *DepartmentClient) Delete() *DepartmentDelete {\n\tmutation := newDepartmentMutation(c.config, OpDelete)\n\treturn &DepartmentDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *AdminClient) Delete() *AdminDelete {\n\tmutation := newAdminMutation(c.config, OpDelete)\n\treturn &AdminDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func NewCmdCategoriesTreeDelete() *cobra.Command {\n\tcfgs, curCfg, err := configmgr.GetCurrentConfig()\n\tif err != nil {\n\t\tfmt.Fprintf(os.Stderr, \"%+v\\n\", err)\n\t\tos.Exit(1)\n\t}\n\tvar cmd = &cobra.Command{\n\t\tUse: \"delete\",\n\t\tShort: \"Delete the categories tree\",\n\t\tRun: func(cmd *cobra.Command, args []string) {\n\t\t\tcurrent := cfgs.Configurations[curCfg]\n\t\t\tclient := eclient.New(current.Endpoint)\n\t\t\tif err := client.SetToken(&current); err != nil {\n\t\t\t\tfmt.Fprintf(os.Stderr, \"%+v\\n\", err)\n\t\t\t\tos.Exit(1)\n\t\t\t}\n\t\t\tif err := client.PurgeCatalog(); err != nil {\n\t\t\t\tfmt.Fprintf(os.Stderr, \"%v\\n\", err)\n\t\t\t\tos.Exit(1)\n\t\t\t}\n\t\t\tos.Exit(0)\n\t\t},\n\t}\n\treturn cmd\n}", "func (c *PostClient) Delete() *PostDelete {\n\tmutation := newPostMutation(c.config, OpDelete)\n\treturn &PostDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func DeleteCategory (w http.ResponseWriter, r *http.Request) {\n\t//get category id from the link\n\tcategoryID := mux.Vars(r)[\"id\"]\n\t//to define if some category was found in slice and deleted\n\tcategoriesLength := len(Categories)\n\n\t//find the category with the given id and remove from the slice\n\tfor i, singleCategory := range Categories {\n\t\tif singleCategory.CategoryID == categoryID {\n\t\t\tCategories = append(Categories[:i], Categories[i+1:]...)\n\t\t\tfmt.Fprintf(w, \"The category with ID %v has been deleted successfully\", categoryID)\n\t\t}\n\t}\n\n\t//report category with the given id not exists\n\tif categoriesLength == len(Categories) {\n\t\tw.WriteHeader(412)\n\t\tfmt.Fprintf(w, \"Category with ID %s not found\", categoryID)\n\t}\n}", "func (a *App) deleteCategory(w http.ResponseWriter, req *http.Request) {\n\tenableCors(&w)\n\tvars := mux.Vars(req)\n\t// id, err := strconv.Atoi(vars[\"category_id\"])\n\t// if err != nil {\n\t// \trespondWithError(w, http.StatusBadRequest, \"Invalid category ID\")\n\t// \treturn\n\t// }\n\n\tid := vars[\"category_id\"]\n\n\tc := category{Category_ID: id}\n\tif err := c.deleteCategoryTasks(a.DB); err != nil {\n\t\trespondWithError(w, http.StatusInternalServerError, err.Error())\n\t\treturn\n\t}\n\tif err := c.deleteCategory(a.DB); err != nil {\n\t\trespondWithError(w, http.StatusInternalServerError, err.Error())\n\t\treturn\n\t}\n\n\trespondWithJSON(w, http.StatusOK, map[string]string{\"result\": \"success\"})\n}", "func (c *BranchClient) Delete() *BranchDelete {\n\tmutation := newBranchMutation(c.config, OpDelete)\n\treturn &BranchDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func Delete(conds ...Cond) *Builder {\r\n\tbuilder := &Builder{cond: NewCond()}\r\n\treturn builder.Delete(conds...)\r\n}", "func (m *ClassesItemAssignmentSettingsGradingCategoriesEducationGradingCategoryItemRequestBuilder) Delete(ctx context.Context, requestConfiguration *ClassesItemAssignmentSettingsGradingCategoriesEducationGradingCategoryItemRequestBuilderDeleteRequestConfiguration)(error) {\n requestInfo, err := m.ToDeleteRequestInformation(ctx, requestConfiguration);\n if err != nil {\n return err\n }\n errorMapping := i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.ErrorMappings {\n \"4XX\": i20a3050780ee0b0cde0a884a4f35429a20d60067e3bcda382ec5400079147459.CreateODataErrorFromDiscriminatorValue,\n \"5XX\": i20a3050780ee0b0cde0a884a4f35429a20d60067e3bcda382ec5400079147459.CreateODataErrorFromDiscriminatorValue,\n }\n err = m.BaseRequestBuilder.RequestAdapter.SendNoContent(ctx, requestInfo, errorMapping)\n if err != nil {\n return err\n }\n return nil\n}", "func NewDeleteBuilder() *DeleteBuilder {\n\treturn &DeleteBuilder{}\n}", "func (c *DepositClient) Delete() *DepositDelete {\n\tmutation := newDepositMutation(c.config, OpDelete)\n\treturn &DepositDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *BeerClient) Delete() *BeerDelete {\n\tmutation := newBeerMutation(c.config, OpDelete)\n\treturn &BeerDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (service *Service) DeleteCategory(request *restful.Request, response *restful.Response) {\n\tvar req models.CategoryRequest\n\tif err := request.ReadEntity(&req); err != nil {\n\t\trespondErr(response, http.StatusBadRequest, messageBadRequest,\n\t\t\t\"unable parse request body\")\n\n\t\tlogrus.WithFields(logrus.Fields{\"module\": \"service\", \"resp\": http.StatusBadRequest}).\n\t\t\tError(\"Unable to parse request body:\", err)\n\n\t\treturn\n\t}\n\n\tcategory := models.Category(req)\n\n\terr := service.server.DeleteCategory(category)\n\tif err == dao.ErrRecordNotFound {\n\t\trespondErr(response, http.StatusBadRequest, messageBadRequest,\n\t\t\t\"category not found\")\n\n\t\tlogrus.WithFields(logrus.Fields{\"module\": \"service\", \"resp\": http.StatusBadRequest}).\n\t\t\tError(\"Unable to update category:\", err)\n\n\t\treturn\n\t}\n\tif err != nil {\n\t\trespondErr(response, http.StatusInternalServerError, messageDatabaseError,\n\t\t\t\"unable to update category\")\n\n\t\tlogrus.WithFields(logrus.Fields{\"module\": \"service\", \"resp\": http.StatusInternalServerError}).\n\t\t\tError(\"Unable to update category:\", err)\n\n\t\treturn\n\t}\n\n\tresult := &models.DeleteCategoryResponse{\n\t\tResult: models.CategoryResponse{},\n\t}\n\n\twriteResponse(response, http.StatusNoContent, result)\n}", "func (c *MedicineTypeClient) Delete() *MedicineTypeDelete {\n\tmutation := newMedicineTypeMutation(c.config, OpDelete)\n\treturn &MedicineTypeDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (sc *ScCategory) Delete(db XODB) error {\n\tvar err error\n\n\t// if doesn't exist, bail\n\tif !sc._exists {\n\t\treturn nil\n\t}\n\n\t// if deleted, bail\n\tif sc._deleted {\n\t\treturn nil\n\t}\n\n\t// sql query\n\tconst sqlstr = `DELETE FROM emind_software_center.sc_category WHERE ID = ?`\n\n\t// run query\n\tXOLog(sqlstr, sc.ID)\n\t_, err = db.Exec(sqlstr, sc.ID)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// set deleted\n\tsc._deleted = true\n\n\treturn nil\n}", "func (c *DisciplineClient) Delete() *DisciplineDelete {\n\tmutation := newDisciplineMutation(c.config, OpDelete)\n\treturn &DisciplineDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *DentistClient) Delete() *DentistDelete {\n\tmutation := newDentistMutation(c.config, OpDelete)\n\treturn &DentistDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (m *LabelsCategoriesItemSubCategoriesSubCategoryTemplateItemRequestBuilder) Delete(ctx context.Context, requestConfiguration *LabelsCategoriesItemSubCategoriesSubCategoryTemplateItemRequestBuilderDeleteRequestConfiguration)(error) {\n requestInfo, err := m.ToDeleteRequestInformation(ctx, requestConfiguration);\n if err != nil {\n return err\n }\n errorMapping := i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.ErrorMappings {\n \"4XX\": i20a3050780ee0b0cde0a884a4f35429a20d60067e3bcda382ec5400079147459.CreateODataErrorFromDiscriminatorValue,\n \"5XX\": i20a3050780ee0b0cde0a884a4f35429a20d60067e3bcda382ec5400079147459.CreateODataErrorFromDiscriminatorValue,\n }\n err = m.BaseRequestBuilder.RequestAdapter.SendNoContent(ctx, requestInfo, errorMapping)\n if err != nil {\n return err\n }\n return nil\n}", "func (c *MedicineClient) Delete() *MedicineDelete {\n\tmutation := newMedicineMutation(c.config, OpDelete)\n\treturn &MedicineDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *GenderClient) Delete() *GenderDelete {\n\tmutation := newGenderMutation(c.config, OpDelete)\n\treturn &GenderDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *GenderClient) Delete() *GenderDelete {\n\tmutation := newGenderMutation(c.config, OpDelete)\n\treturn &GenderDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *DNSBLQueryClient) Delete() *DNSBLQueryDelete {\n\tmutation := newDNSBLQueryMutation(c.config, OpDelete)\n\treturn &DNSBLQueryDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func DeleteCategory(id string) error {\n\tcid, err := strconv.ParseInt(id, 10, 64)\n\tfmt.Println(\"DeleteCategory\")\n\tfmt.Println(id)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\to := orm.NewOrm()\n\tcate := &Category{Id: cid}\n\t_, err = o.Delete(cate)\n\n\treturn err\n}", "func (c *Controller) Delete(typ, name, namespace string) error {\n\treturn errUnsupported\n}", "func (c *DeviceClient) Delete() *DeviceDelete {\n\tmutation := newDeviceMutation(c.config, OpDelete)\n\treturn &DeviceDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *CleanernameClient) Delete() *CleanernameDelete {\n\tmutation := newCleanernameMutation(c.config, OpDelete)\n\treturn &CleanernameDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (b *Builder) Delete(conds ...Cond) *Builder {\r\n\tb.cond = b.cond.And(conds...)\r\n\tb.optype = deleteType\r\n\treturn b\r\n}", "func (c *ActivityTypeClient) Delete() *ActivityTypeDelete {\n\tmutation := newActivityTypeMutation(c.config, OpDelete)\n\treturn &ActivityTypeDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (b *QueryBuilder) Delete() {\n}", "func (c *ComplaintClient) Delete() *ComplaintDelete {\n\tmutation := newComplaintMutation(c.config, OpDelete)\n\treturn &ComplaintDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *OperativeClient) Delete() *OperativeDelete {\n\tmutation := newOperativeMutation(c.config, OpDelete)\n\treturn &OperativeDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *ToolClient) Delete() *ToolDelete {\n\tmutation := newToolMutation(c.config, OpDelete)\n\treturn &ToolDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *commentsQueryBuilder) Delete() (int64, error) {\n\tif c.err != nil {\n\t\treturn 0, c.err\n\t}\n\treturn c.builder.Delete()\n}", "func (m *TermStoreRequestBuilder) Delete(ctx context.Context, requestConfiguration *TermStoreRequestBuilderDeleteRequestConfiguration)(error) {\n requestInfo, err := m.CreateDeleteRequestInformation(ctx, requestConfiguration);\n if err != nil {\n return err\n }\n errorMapping := i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.ErrorMappings {\n \"4XX\": ia572726a95efa92ddd544552cd950653dc691023836923576b2f4bf716cf204a.CreateODataErrorFromDiscriminatorValue,\n \"5XX\": ia572726a95efa92ddd544552cd950653dc691023836923576b2f4bf716cf204a.CreateODataErrorFromDiscriminatorValue,\n }\n err = m.requestAdapter.SendNoContentAsync(ctx, requestInfo, errorMapping)\n if err != nil {\n return err\n }\n return nil\n}", "func (c *OperationroomClient) Delete() *OperationroomDelete {\n\tmutation := newOperationroomMutation(c.config, OpDelete)\n\treturn &OperationroomDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *ComplaintTypeClient) Delete() *ComplaintTypeDelete {\n\tmutation := newComplaintTypeMutation(c.config, OpDelete)\n\treturn &ComplaintTypeDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *ClubTypeClient) Delete() *ClubTypeDelete {\n\tmutation := newClubTypeMutation(c.config, OpDelete)\n\treturn &ClubTypeDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *CompanyClient) Delete() *CompanyDelete {\n\tmutation := newCompanyMutation(c.config, OpDelete)\n\treturn &CompanyDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *CompanyClient) Delete() *CompanyDelete {\n\tmutation := newCompanyMutation(c.config, OpDelete)\n\treturn &CompanyDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *FacultyClient) Delete() *FacultyDelete {\n\tmutation := newFacultyMutation(c.config, OpDelete)\n\treturn &FacultyDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (categories *Categories) DeleteCategory(category Category) (string, error) {\n\n\tif category.ID == \"\" {\n\t\treturn \"\", ErrCategoryCanNotBeWithoutID\n\t}\n\n\tdeleteCategoryData, _ := json.Marshal(map[string]string{\"uid\": category.ID})\n\n\tmutation := dataBaseAPI.Mutation{\n\t\tDeleteJson: deleteCategoryData,\n\t\tCommitNow: true,\n\t\tIgnoreIndexConflict: true}\n\n\ttransaction := categories.storage.Client.NewTxn()\n\n\tvar err error\n\t_, err = transaction.Mutate(context.Background(), &mutation)\n\tif err != nil {\n\t\tlog.Println(err)\n\t\treturn category.ID, ErrCategoryCanNotBeDeleted\n\t}\n\n\treturn category.ID, nil\n}", "func (c *PatientroomClient) Delete() *PatientroomDelete {\n\tmutation := newPatientroomMutation(c.config, OpDelete)\n\treturn &PatientroomDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *TransactionClient) Delete() *TransactionDelete {\n\tmutation := newTransactionMutation(c.config, OpDelete)\n\treturn &TransactionDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func MakeDeleteCategoryEndpoint(s service.TodoService) endpoint.Endpoint {\n\treturn func(ctx context.Context, request interface{}) (interface{}, error) {\n\t\treq := request.(DeleteCategoryRequest)\n\t\terror := s.DeleteCategory(ctx, req.Id)\n\t\treturn DeleteCategoryResponse{Error: error}, nil\n\t}\n}", "func (op *DeleteOp) Delete(val string) *DeleteOp {\n\tif op != nil {\n\t\top.QueryOpts.Set(\"delete\", val)\n\t}\n\treturn op\n}", "func (c *NurseClient) Delete() *NurseDelete {\n\tmutation := newNurseMutation(c.config, OpDelete)\n\treturn &NurseDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *ActivitiesClient) Delete() *ActivitiesDelete {\n\tmutation := newActivitiesMutation(c.config, OpDelete)\n\treturn &ActivitiesDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *TitleClient) Delete() *TitleDelete {\n\tmutation := newTitleMutation(c.config, OpDelete)\n\treturn &TitleDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *PatientClient) Delete() *PatientDelete {\n\tmutation := newPatientMutation(c.config, OpDelete)\n\treturn &PatientDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *PatientClient) Delete() *PatientDelete {\n\tmutation := newPatientMutation(c.config, OpDelete)\n\treturn &PatientDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *PatientClient) Delete() *PatientDelete {\n\tmutation := newPatientMutation(c.config, OpDelete)\n\treturn &PatientDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *ReviewClient) Delete() *ReviewDelete {\n\tmutation := newReviewMutation(c.config, OpDelete)\n\treturn &ReviewDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *RoomdetailClient) Delete() *RoomdetailDelete {\n\tmutation := newRoomdetailMutation(c.config, OpDelete)\n\treturn &RoomdetailDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *JobClient) Delete() *JobDelete {\n\tmutation := newJobMutation(c.config, OpDelete)\n\treturn &JobDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (sd *SelectDataset) Delete() *DeleteDataset {\n\td := newDeleteDataset(sd.dialect.Dialect(), sd.queryFactory).\n\t\tPrepared(sd.isPrepared)\n\tif sd.clauses.HasSources() {\n\t\td = d.From(sd.clauses.From().Columns()[0])\n\t}\n\tc := d.clauses\n\tfor _, ce := range sd.clauses.CommonTables() {\n\t\tc = c.CommonTablesAppend(ce)\n\t}\n\tif sd.clauses.Where() != nil {\n\t\tc = c.WhereAppend(sd.clauses.Where())\n\t}\n\tif sd.clauses.HasLimit() {\n\t\tc = c.SetLimit(sd.clauses.Limit())\n\t}\n\tif sd.clauses.HasOrder() {\n\t\tfor _, oe := range sd.clauses.Order().Columns() {\n\t\t\tc = c.OrderAppend(oe.(exp.OrderedExpression))\n\t\t}\n\t}\n\td.clauses = c\n\treturn d\n}", "func (c *CustomerClient) Delete() *CustomerDelete {\n\tmutation := newCustomerMutation(c.config, OpDelete)\n\treturn &CustomerDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (client *Client) DeleteCategoryWithOptions(request *DeleteCategoryRequest, runtime *util.RuntimeOptions) (_result *DeleteCategoryResponse, _err error) {\n\t_err = util.ValidateModel(request)\n\tif _err != nil {\n\t\treturn _result, _err\n\t}\n\tquery := map[string]interface{}{}\n\tif !tea.BoolValue(util.IsUnset(request.CateId)) {\n\t\tquery[\"CateId\"] = request.CateId\n\t}\n\n\treq := &openapi.OpenApiRequest{\n\t\tQuery: openapiutil.Query(query),\n\t}\n\tparams := &openapi.Params{\n\t\tAction: tea.String(\"DeleteCategory\"),\n\t\tVersion: tea.String(\"2017-03-21\"),\n\t\tProtocol: tea.String(\"HTTPS\"),\n\t\tPathname: tea.String(\"/\"),\n\t\tMethod: tea.String(\"POST\"),\n\t\tAuthType: tea.String(\"AK\"),\n\t\tStyle: tea.String(\"RPC\"),\n\t\tReqBodyType: tea.String(\"formData\"),\n\t\tBodyType: tea.String(\"json\"),\n\t}\n\t_result = &DeleteCategoryResponse{}\n\t_body, _err := client.CallApi(params, req, runtime)\n\tif _err != nil {\n\t\treturn _result, _err\n\t}\n\t_err = tea.Convert(_body, &_result)\n\treturn _result, _err\n}", "func (c *PetClient) Delete() *PetDelete {\n\tmutation := newPetMutation(c.config, OpDelete)\n\treturn &PetDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *DrugAllergyClient) Delete() *DrugAllergyDelete {\n\tmutation := newDrugAllergyMutation(c.config, OpDelete)\n\treturn &DrugAllergyDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (t *PgAttributeType) Delete(c1 qb.Condition, c ...qb.Condition) qb.Query {\n\treturn t.table.Delete(c1, c...)\n}", "func (c *UsertypeClient) Delete() *UsertypeDelete {\n\tmutation := newUsertypeMutation(c.config, OpDelete)\n\treturn &UsertypeDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (m *DirectoryRequestBuilder) Delete(ctx context.Context, requestConfiguration *DirectoryRequestBuilderDeleteRequestConfiguration)(error) {\n requestInfo, err := m.CreateDeleteRequestInformation(ctx, requestConfiguration);\n if err != nil {\n return err\n }\n errorMapping := i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.ErrorMappings {\n \"4XX\": ia572726a95efa92ddd544552cd950653dc691023836923576b2f4bf716cf204a.CreateODataErrorFromDiscriminatorValue,\n \"5XX\": ia572726a95efa92ddd544552cd950653dc691023836923576b2f4bf716cf204a.CreateODataErrorFromDiscriminatorValue,\n }\n err = m.requestAdapter.SendNoContentAsync(ctx, requestInfo, errorMapping)\n if err != nil {\n return err\n }\n return nil\n}", "func (m *ManagedDeviceItemRequestBuilder) DeviceCategory()(*id96b7ae916d8c8e465b8a821c2fe41d4d020ec0a7610953b779987f93a48d88e.DeviceCategoryRequestBuilder) {\n return id96b7ae916d8c8e465b8a821c2fe41d4d020ec0a7610953b779987f93a48d88e.NewDeviceCategoryRequestBuilderInternal(m.pathParameters, m.requestAdapter);\n}", "func (upuo *UnsavedPostUpdateOne) ClearCategory() *UnsavedPostUpdateOne {\n\tupuo.mutation.ClearCategory()\n\treturn upuo\n}", "func (c *BookingClient) Delete() *BookingDelete {\n\tmutation := newBookingMutation(c.config, OpDelete)\n\treturn &BookingDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *RentalstatusClient) Delete() *RentalstatusDelete {\n\tmutation := newRentalstatusMutation(c.config, OpDelete)\n\treturn &RentalstatusDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (gc *GoodsCategory) Delete(ctx context.Context, key ...interface{}) error {\n\tvar err error\n\tvar dbConn *sql.DB\n\n\t// if deleted, bail\n\tif gc._deleted {\n\t\treturn nil\n\t}\n\n\ttx, err := components.M.GetConnFromCtx(ctx)\n\tif err != nil {\n\t\tdbConn, err = components.M.GetMasterConn()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\ttableName, err := GetGoodsCategoryTableName(key...)\n\tif err != nil {\n\t\treturn err\n\t}\n\t//1\n\n\t// sql query with composite primary key\n\tsqlstr := `UPDATE ` + tableName + ` SET is_del = 1 WHERE gcid = ?`\n\n\t// run query\n\tutils.GetTraceLog(ctx).Debug(\"DB\", zap.String(\"SQL\", fmt.Sprint(sqlstr, gc.Gcid)))\n\tif tx != nil {\n\t\t_, err = tx.Exec(sqlstr, gc.Gcid)\n\t} else {\n\t\t_, err = dbConn.Exec(sqlstr, gc.Gcid)\n\t}\n\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// set deleted\n\tgc._deleted = true\n\n\treturn nil\n}", "func (c *LevelOfDangerousClient) Delete() *LevelOfDangerousDelete {\n\tmutation := newLevelOfDangerousMutation(c.config, OpDelete)\n\treturn &LevelOfDangerousDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (b *DeleteBuilder) Build(opts ...interface{}) (string, []interface{}) {\n\tif b.Flavor == sql.FlavorCosmosDb {\n\t\topts = removeOptTableAlias(opts...)\n\t}\n\ttableAlias := extractOptTableAlias(opts...)\n\tif tableAlias != \"\" {\n\t\tif reTblNameWithAlias.MatchString(b.Table) {\n\t\t\ttableAlias = \"\"\n\t\t} else {\n\t\t\ttableAlias = \" \" + tableAlias[:len(tableAlias)-1]\n\t\t}\n\t}\n\tif b.Filter != nil {\n\t\tnewOpts := append([]interface{}{OptDbFlavor{Flavor: b.Flavor}}, opts...)\n\t\twhereClause, values := b.Filter.Build(b.PlaceholderGenerator, newOpts...)\n\t\tsql := fmt.Sprintf(\"DELETE FROM %s%s WHERE %s\", b.Table, tableAlias, whereClause)\n\t\treturn sql, values\n\t}\n\tsql := fmt.Sprintf(\"DELETE FROM %s%s\", b.Table, tableAlias)\n\treturn sql, make([]interface{}, 0)\n}", "func (c *ClinicClient) Delete() *ClinicDelete {\n\tmutation := newClinicMutation(c.config, OpDelete)\n\treturn &ClinicDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (b *Builder) Delete(url string) *Builder {\n\tb.Url = url\n\tb.Method = http.MethodDelete\n\treturn b\n}", "func TestDeleteCategory(t *testing.T) {\n\t//initial length of []products\n\tinitialLen := len(Categories)\n\n\treq, err := http.NewRequest(\"DELETE\", \"/categories/bq4fasj7jhfi127rimlg\", nil)\n\treq = mux.SetURLVars(req, map[string]string{\"id\": \"bq4fasj7jhfi127rimlg\"})\n\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\n\trr := httptest.NewRecorder()\n\thandler := http.HandlerFunc(DeleteCategory)\n\n\thandler.ServeHTTP(rr, req)\n\n\tassert.Equal(t, 200, rr.Code, \"OK response is expected\")\n\t//the length of []Categories should decrease after deleting category\n\tassert.NotEqual(t, initialLen, len(Categories), \"Expected length to decrease after deleting new Category\")\n}", "func (c *Client) NewDeleteCategoriesRequest(ctx context.Context, path string) (*http.Request, error) {\n\tscheme := c.Scheme\n\tif scheme == \"\" {\n\t\tscheme = \"http\"\n\t}\n\tu := url.URL{Host: c.Host, Scheme: scheme, Path: path}\n\treq, err := http.NewRequest(\"DELETE\", u.String(), nil)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif c.JWTSecSigner != nil {\n\t\tif err := c.JWTSecSigner.Sign(req); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\treturn req, nil\n}", "func (c *EatinghistoryClient) Delete() *EatinghistoryDelete {\n\tmutation := newEatinghistoryMutation(c.config, OpDelete)\n\treturn &EatinghistoryDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}" ]
[ "0.66444135", "0.6284912", "0.6254072", "0.6236705", "0.61085075", "0.6079266", "0.60717326", "0.60501254", "0.60351574", "0.6033871", "0.60144675", "0.5954239", "0.5852815", "0.58207524", "0.5804354", "0.5799656", "0.57971007", "0.5793845", "0.5790986", "0.57386583", "0.5709172", "0.56678706", "0.56637985", "0.5656351", "0.5640807", "0.5638014", "0.5599596", "0.55971366", "0.55917", "0.55879325", "0.55864334", "0.5570701", "0.55654186", "0.556047", "0.5522697", "0.5518334", "0.5501224", "0.548619", "0.5483653", "0.5481067", "0.54761875", "0.5453178", "0.5443106", "0.54416114", "0.5438528", "0.5425405", "0.5425405", "0.5421398", "0.54189545", "0.5418117", "0.5408023", "0.540078", "0.54004735", "0.53901327", "0.5388496", "0.53835255", "0.5378834", "0.5374098", "0.53649503", "0.53644097", "0.535612", "0.5354677", "0.53519243", "0.53480333", "0.53480333", "0.5342759", "0.53353876", "0.53315836", "0.53280604", "0.5327072", "0.5313787", "0.53053874", "0.53014195", "0.52885604", "0.5268028", "0.5268028", "0.5268028", "0.5267842", "0.52617615", "0.52600795", "0.5251854", "0.52486175", "0.52429724", "0.52425504", "0.52248657", "0.52237445", "0.52199274", "0.52066535", "0.520651", "0.520191", "0.5200685", "0.5200227", "0.5199874", "0.51947933", "0.5188682", "0.5188537", "0.5182236", "0.51790947", "0.51782835", "0.5177911" ]
0.7468108
0
DeleteOne returns a delete builder for the given entity.
func (c *CategoryClient) DeleteOne(ca *Category) *CategoryDeleteOne { return c.DeleteOneID(ca.ID) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (c *BuildingClient) DeleteOne(b *Building) *BuildingDeleteOne {\n\treturn c.DeleteOneID(b.ID)\n}", "func (c *DeviceClient) DeleteOne(d *Device) *DeviceDeleteOne {\n\treturn c.DeleteOneID(d.ID)\n}", "func (c *EmptyClient) DeleteOne(e *Empty) *EmptyDeleteOne {\n\treturn c.DeleteOneID(e.ID)\n}", "func (c *DentistClient) DeleteOne(d *Dentist) *DentistDeleteOne {\n\treturn c.DeleteOneID(d.ID)\n}", "func (c *BedtypeClient) DeleteOne(b *Bedtype) *BedtypeDeleteOne {\n\treturn c.DeleteOneID(b.ID)\n}", "func (c *OperativerecordClient) DeleteOne(o *Operativerecord) *OperativerecordDeleteOne {\n\treturn c.DeleteOneID(o.ID)\n}", "func (c *OperationClient) DeleteOne(o *Operation) *OperationDeleteOne {\n\treturn c.DeleteOneID(o.ID)\n}", "func (c *DNSBLQueryClient) DeleteOne(dq *DNSBLQuery) *DNSBLQueryDeleteOne {\n\treturn c.DeleteOneID(dq.ID)\n}", "func (c *DispenseMedicineClient) DeleteOne(dm *DispenseMedicine) *DispenseMedicineDeleteOne {\n\treturn c.DeleteOneID(dm.ID)\n}", "func (c *Command) DeleteOne() (int64, error) {\n\tclient := c.set.gom.GetClient()\n\n\tcollection := client.Database(c.set.gom.GetDatabase()).Collection(c.set.tableName)\n\n\tif len(c.set.filter.(bson.M)) == 0 {\n\t\treturn 0, errors.New(\"filter can't be empty\")\n\t}\n\n\tctx, cancelFunc := c.set.GetContext()\n\tdefer cancelFunc()\n\n\tres, err := collection.DeleteOne(ctx, c.set.filter)\n\n\tif err != nil {\n\t\treturn 0, err\n\t}\n\n\treturn res.DeletedCount, nil\n}", "func (c *DoctorClient) DeleteOne(d *Doctor) *DoctorDeleteOne {\n\treturn c.DeleteOneID(d.ID)\n}", "func NewDeleteOneModel() *DeleteOneModel {\n\treturn &DeleteOneModel{}\n}", "func (c *DrugAllergyClient) DeleteOne(da *DrugAllergy) *DrugAllergyDeleteOne {\n\treturn c.DeleteOneID(da.ID)\n}", "func (c *BeerClient) DeleteOne(b *Beer) *BeerDeleteOne {\n\treturn c.DeleteOneID(b.ID)\n}", "func (d *Demo) DeleteOne(g *gom.Gom) {\n\ttoolkit.Println(\"===== Delete One =====\")\n\n\tvar err error\n\tif d.useParams {\n\t\t_, err = g.Set(&gom.SetParams{\n\t\t\tTableName: \"hero\",\n\t\t\tFilter: gom.Eq(\"Name\", \"Batman\"),\n\t\t\tTimeout: 10,\n\t\t}).Cmd().DeleteOne()\n\t} else {\n\t\t_, err = g.Set(nil).Table(\"hero\").Timeout(10).Filter(gom.Eq(\"Name\", \"Batman\")).Cmd().DeleteOne()\n\t}\n\n\tif err != nil {\n\t\ttoolkit.Println(err.Error())\n\t\treturn\n\t}\n}", "func (c *OrderClient) DeleteOne(o *Order) *OrderDeleteOne {\n\treturn c.DeleteOneID(o.ID)\n}", "func (c *AdminClient) DeleteOne(a *Admin) *AdminDeleteOne {\n\treturn c.DeleteOneID(a.ID)\n}", "func (c *PharmacistClient) DeleteOne(ph *Pharmacist) *PharmacistDeleteOne {\n\treturn c.DeleteOneID(ph.ID)\n}", "func (c *FoodmenuClient) DeleteOne(f *Foodmenu) *FoodmenuDeleteOne {\n\treturn c.DeleteOneID(f.ID)\n}", "func (c *CleaningroomClient) DeleteOne(cl *Cleaningroom) *CleaningroomDeleteOne {\n\treturn c.DeleteOneID(cl.ID)\n}", "func (c *PatientClient) DeleteOne(pa *Patient) *PatientDeleteOne {\n\treturn c.DeleteOneID(pa.ID)\n}", "func (c *PatientClient) DeleteOne(pa *Patient) *PatientDeleteOne {\n\treturn c.DeleteOneID(pa.ID)\n}", "func (c *PatientClient) DeleteOne(pa *Patient) *PatientDeleteOne {\n\treturn c.DeleteOneID(pa.ID)\n}", "func (c *PostClient) DeleteOne(po *Post) *PostDeleteOne {\n\treturn c.DeleteOneID(po.ID)\n}", "func (c *CompanyClient) DeleteOne(co *Company) *CompanyDeleteOne {\n\treturn c.DeleteOneID(co.ID)\n}", "func (c *CompanyClient) DeleteOne(co *Company) *CompanyDeleteOne {\n\treturn c.DeleteOneID(co.ID)\n}", "func (c *DepositClient) DeleteOne(d *Deposit) *DepositDeleteOne {\n\treturn c.DeleteOneID(d.ID)\n}", "func (c *OperativeClient) DeleteOne(o *Operative) *OperativeDeleteOne {\n\treturn c.DeleteOneID(o.ID)\n}", "func (c *EventClient) DeleteOne(e *Event) *EventDeleteOne {\n\treturn c.DeleteOneID(e.ID)\n}", "func (c *UnsavedPostClient) DeleteOne(up *UnsavedPost) *UnsavedPostDeleteOne {\n\treturn c.DeleteOneID(up.ID)\n}", "func (c *BedtypeClient) DeleteOneID(id int) *BedtypeDeleteOne {\n\tbuilder := c.Delete().Where(bedtype.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &BedtypeDeleteOne{builder}\n}", "func (c *MedicineClient) DeleteOne(m *Medicine) *MedicineDeleteOne {\n\treturn c.DeleteOneID(m.ID)\n}", "func (c *OperativerecordClient) DeleteOneID(id int) *OperativerecordDeleteOne {\n\tbuilder := c.Delete().Where(operativerecord.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &OperativerecordDeleteOne{builder}\n}", "func (c *PatientofphysicianClient) DeleteOne(pa *Patientofphysician) *PatientofphysicianDeleteOne {\n\treturn c.DeleteOneID(pa.ID)\n}", "func (c *PhysicianClient) DeleteOne(ph *Physician) *PhysicianDeleteOne {\n\treturn c.DeleteOneID(ph.ID)\n}", "func (c *PhysicianClient) DeleteOne(ph *Physician) *PhysicianDeleteOne {\n\treturn c.DeleteOneID(ph.ID)\n}", "func DeleteOne(ctx context.Context, tx pgx.Tx, sb sq.DeleteBuilder) error {\n\tq, vs, err := sb.ToSql()\n\tif err != nil {\n\t\treturn err\n\t}\n\ttag, err := tx.Exec(ctx, q, vs...)\n\tif err != nil {\n\t\treturn err\n\t}\n\tif tag.RowsAffected() != 1 {\n\t\treturn ErrNoRowsAffected\n\t}\n\treturn nil\n}", "func (c *TransactionClient) DeleteOne(t *Transaction) *TransactionDeleteOne {\n\treturn c.DeleteOneID(t.ID)\n}", "func (c *LevelOfDangerousClient) DeleteOne(lod *LevelOfDangerous) *LevelOfDangerousDeleteOne {\n\treturn c.DeleteOneID(lod.ID)\n}", "func (c *BillClient) DeleteOne(b *Bill) *BillDeleteOne {\n\treturn c.DeleteOneID(b.ID)\n}", "func (c *BillClient) DeleteOne(b *Bill) *BillDeleteOne {\n\treturn c.DeleteOneID(b.ID)\n}", "func (c *BillClient) DeleteOne(b *Bill) *BillDeleteOne {\n\treturn c.DeleteOneID(b.ID)\n}", "func (c *PaymentClient) DeleteOne(pa *Payment) *PaymentDeleteOne {\n\treturn c.DeleteOneID(pa.ID)\n}", "func (c *PaymentClient) DeleteOne(pa *Payment) *PaymentDeleteOne {\n\treturn c.DeleteOneID(pa.ID)\n}", "func (c *CleanernameClient) DeleteOne(cl *Cleanername) *CleanernameDeleteOne {\n\treturn c.DeleteOneID(cl.ID)\n}", "func (d *DBRepository) deleteOne(ctx context.Context, id string) error {\n\tobjectId, err := primitive.ObjectIDFromHex(id)\n\tif err != nil {\n\t\treturn err\n\t}\n\tif _, err := d.Collection.DeleteOne(ctx, bson.M{\"_id\": objectId}); err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "func (c *MedicineTypeClient) DeleteOne(mt *MedicineType) *MedicineTypeDeleteOne {\n\treturn c.DeleteOneID(mt.ID)\n}", "func (c *StatusdClient) DeleteOne(s *Statusd) *StatusdDeleteOne {\n\treturn c.DeleteOneID(s.ID)\n}", "func (c *ToolClient) DeleteOne(t *Tool) *ToolDeleteOne {\n\treturn c.DeleteOneID(t.ID)\n}", "func (c *ActivityTypeClient) DeleteOne(at *ActivityType) *ActivityTypeDeleteOne {\n\treturn c.DeleteOneID(at.ID)\n}", "func (c *LevelOfDangerousClient) DeleteOneID(id int) *LevelOfDangerousDeleteOne {\n\tbuilder := c.Delete().Where(levelofdangerous.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &LevelOfDangerousDeleteOne{builder}\n}", "func (c *OperationroomClient) DeleteOne(o *Operationroom) *OperationroomDeleteOne {\n\treturn c.DeleteOneID(o.ID)\n}", "func (c *TagClient) DeleteOne(t *Tag) *TagDeleteOne {\n\treturn c.DeleteOneID(t.ID)\n}", "func (c *DentistClient) DeleteOneID(id int) *DentistDeleteOne {\n\tbuilder := c.Delete().Where(dentist.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &DentistDeleteOne{builder}\n}", "func (c *OperativeClient) DeleteOneID(id int) *OperativeDeleteOne {\n\tbuilder := c.Delete().Where(operative.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &OperativeDeleteOne{builder}\n}", "func NewDeleteOneNoContent() *DeleteOneNoContent {\n\treturn &DeleteOneNoContent{}\n}", "func (c *UnsavedPostClient) DeleteOneID(id int) *UnsavedPostDeleteOne {\n\tbuilder := c.Delete().Where(unsavedpost.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &UnsavedPostDeleteOne{builder}\n}", "func (c *StaytypeClient) DeleteOne(s *Staytype) *StaytypeDeleteOne {\n\treturn c.DeleteOneID(s.ID)\n}", "func (c *OrderClient) DeleteOneID(id int) *OrderDeleteOne {\n\tbuilder := c.Delete().Where(order.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &OrderDeleteOne{builder}\n}", "func (c *BuildingClient) DeleteOneID(id int) *BuildingDeleteOne {\n\tbuilder := c.Delete().Where(building.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &BuildingDeleteOne{builder}\n}", "func (c *PostClient) DeleteOneID(id int) *PostDeleteOne {\n\tbuilder := c.Delete().Where(post.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &PostDeleteOne{builder}\n}", "func (c *PatientroomClient) DeleteOne(pa *Patientroom) *PatientroomDeleteOne {\n\treturn c.DeleteOneID(pa.ID)\n}", "func (c *EventClient) DeleteOneID(id int) *EventDeleteOne {\n\tbuilder := c.Delete().Where(event.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &EventDeleteOne{builder}\n}", "func NewDeleteOneDefault(code int) *DeleteOneDefault {\n\treturn &DeleteOneDefault{\n\t\t_statusCode: code,\n\t}\n}", "func (c *UnsavedPostAttachmentClient) DeleteOne(upa *UnsavedPostAttachment) *UnsavedPostAttachmentDeleteOne {\n\treturn c.DeleteOneID(upa.ID)\n}", "func (c *UnitOfMedicineClient) DeleteOne(uom *UnitOfMedicine) *UnitOfMedicineDeleteOne {\n\treturn c.DeleteOneID(uom.ID)\n}", "func (c *FoodmenuClient) DeleteOneID(id int) *FoodmenuDeleteOne {\n\tbuilder := c.Delete().Where(foodmenu.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &FoodmenuDeleteOne{builder}\n}", "func (c *PostAttachmentClient) DeleteOne(pa *PostAttachment) *PostAttachmentDeleteOne {\n\treturn c.DeleteOneID(pa.ID)\n}", "func (c *DeviceClient) DeleteOneID(id int) *DeviceDeleteOne {\n\tbuilder := c.Delete().Where(device.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &DeviceDeleteOne{builder}\n}", "func (c *ToolClient) DeleteOneID(id int) *ToolDeleteOne {\n\tbuilder := c.Delete().Where(tool.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &ToolDeleteOne{builder}\n}", "func (c *AppointmentClient) DeleteOne(a *Appointment) *AppointmentDeleteOne {\n\treturn c.DeleteOneID(a.ID)\n}", "func (c *EmptyClient) DeleteOneID(id int) *EmptyDeleteOne {\n\tbuilder := c.Delete().Where(empty.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &EmptyDeleteOne{builder}\n}", "func (c *PurposeClient) DeleteOne(pu *Purpose) *PurposeDeleteOne {\n\treturn c.DeleteOneID(pu.ID)\n}", "func (c *AdminClient) DeleteOneID(id int) *AdminDeleteOne {\n\tbuilder := c.Delete().Where(admin.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &AdminDeleteOne{builder}\n}", "func (c *CleaningroomClient) DeleteOneID(id int) *CleaningroomDeleteOne {\n\tbuilder := c.Delete().Where(cleaningroom.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &CleaningroomDeleteOne{builder}\n}", "func (c *LengthtimeClient) DeleteOneID(id int) *LengthtimeDeleteOne {\n\tbuilder := c.Delete().Where(lengthtime.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &LengthtimeDeleteOne{builder}\n}", "func (c *DepartmentClient) DeleteOne(d *Department) *DepartmentDeleteOne {\n\treturn c.DeleteOneID(d.ID)\n}", "func (c *UnsavedPostAttachmentClient) DeleteOneID(id int) *UnsavedPostAttachmentDeleteOne {\n\tbuilder := c.Delete().Where(unsavedpostattachment.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &UnsavedPostAttachmentDeleteOne{builder}\n}", "func (c *PhysicianClient) DeleteOneID(id int) *PhysicianDeleteOne {\n\tbuilder := c.Delete().Where(physician.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &PhysicianDeleteOne{builder}\n}", "func (c *PhysicianClient) DeleteOneID(id int) *PhysicianDeleteOne {\n\tbuilder := c.Delete().Where(physician.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &PhysicianDeleteOne{builder}\n}", "func (c *DoctorClient) DeleteOneID(id int) *DoctorDeleteOne {\n\tbuilder := c.Delete().Where(doctor.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &DoctorDeleteOne{builder}\n}", "func (c *MealplanClient) DeleteOne(m *Mealplan) *MealplanDeleteOne {\n\treturn c.DeleteOneID(m.ID)\n}", "func (c *CleanernameClient) DeleteOneID(id int) *CleanernameDeleteOne {\n\tbuilder := c.Delete().Where(cleanername.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &CleanernameDeleteOne{builder}\n}", "func (c *ComplaintClient) DeleteOne(co *Complaint) *ComplaintDeleteOne {\n\treturn c.DeleteOneID(co.ID)\n}", "func (c *StatustClient) DeleteOneID(id int) *StatustDeleteOne {\n\tbuilder := c.Delete().Where(statust.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &StatustDeleteOne{builder}\n}", "func (c *PartorderClient) DeleteOne(pa *Partorder) *PartorderDeleteOne {\n\treturn c.DeleteOneID(pa.ID)\n}", "func (c *StaytypeClient) DeleteOneID(id int) *StaytypeDeleteOne {\n\tbuilder := c.Delete().Where(staytype.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &StaytypeDeleteOne{builder}\n}", "func (c *PatientofphysicianClient) DeleteOneID(id int) *PatientofphysicianDeleteOne {\n\tbuilder := c.Delete().Where(patientofphysician.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &PatientofphysicianDeleteOne{builder}\n}", "func (c *RoomdetailClient) DeleteOne(r *Roomdetail) *RoomdetailDeleteOne {\n\treturn c.DeleteOneID(r.ID)\n}", "func (c *BranchClient) DeleteOne(b *Branch) *BranchDeleteOne {\n\treturn c.DeleteOneID(b.ID)\n}", "func (c *UnitOfMedicineClient) DeleteOneID(id int) *UnitOfMedicineDeleteOne {\n\tbuilder := c.Delete().Where(unitofmedicine.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &UnitOfMedicineDeleteOne{builder}\n}", "func (c *TitleClient) DeleteOne(t *Title) *TitleDeleteOne {\n\treturn c.DeleteOneID(t.ID)\n}", "func (c *WorkExperienceClient) DeleteOne(we *WorkExperience) *WorkExperienceDeleteOne {\n\treturn c.DeleteOneID(we.ID)\n}", "func (c *AnnotationClient) DeleteOne(a *Annotation) *AnnotationDeleteOne {\n\treturn c.DeleteOneID(a.ID)\n}", "func (c *DispenseMedicineClient) DeleteOneID(id int) *DispenseMedicineDeleteOne {\n\tbuilder := c.Delete().Where(dispensemedicine.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &DispenseMedicineDeleteOne{builder}\n}", "func (c *UnsavedPostImageClient) DeleteOne(upi *UnsavedPostImage) *UnsavedPostImageDeleteOne {\n\treturn c.DeleteOneID(upi.ID)\n}", "func (c *DepositClient) DeleteOneID(id int) *DepositDeleteOne {\n\tbuilder := c.Delete().Where(deposit.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &DepositDeleteOne{builder}\n}", "func (c *PharmacistClient) DeleteOneID(id int) *PharmacistDeleteOne {\n\tbuilder := c.Delete().Where(pharmacist.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &PharmacistDeleteOne{builder}\n}", "func (c *PositionassingmentClient) DeleteOne(po *Positionassingment) *PositionassingmentDeleteOne {\n\treturn c.DeleteOneID(po.ID)\n}", "func (c *KeyStoreClient) DeleteOneID(id int32) *KeyStoreDeleteOne {\n\tbuilder := c.Delete().Where(keystore.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &KeyStoreDeleteOne{builder}\n}", "func (c *PaymentClient) DeleteOneID(id int) *PaymentDeleteOne {\n\tbuilder := c.Delete().Where(payment.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &PaymentDeleteOne{builder}\n}" ]
[ "0.6754239", "0.67072296", "0.67016196", "0.67011034", "0.6653609", "0.66129434", "0.6570163", "0.6555882", "0.6550148", "0.6522204", "0.6504479", "0.6499032", "0.64316624", "0.6429749", "0.64246684", "0.6418696", "0.6396313", "0.63832575", "0.6371247", "0.63639766", "0.63630384", "0.63630384", "0.63630384", "0.6360122", "0.6355269", "0.6355269", "0.6351107", "0.63370615", "0.6333473", "0.6327508", "0.63201904", "0.63149154", "0.6302125", "0.6295902", "0.6284729", "0.6284729", "0.6276979", "0.62732875", "0.62684214", "0.6266123", "0.6266123", "0.6266123", "0.62612474", "0.62612474", "0.626064", "0.62476856", "0.6246732", "0.62460977", "0.62330806", "0.6232218", "0.6224974", "0.62241215", "0.62202203", "0.6211777", "0.6209366", "0.6203329", "0.6194709", "0.61866176", "0.6185029", "0.61803836", "0.6173257", "0.61721545", "0.61568314", "0.6156593", "0.61521", "0.6147634", "0.61444926", "0.61355424", "0.61347204", "0.6133231", "0.6115534", "0.611403", "0.611028", "0.6107552", "0.6100868", "0.60994744", "0.609352", "0.6092299", "0.60922116", "0.60922116", "0.60901564", "0.6088162", "0.608726", "0.60788137", "0.60774815", "0.6075914", "0.6070514", "0.60651606", "0.6063153", "0.6062919", "0.6060779", "0.6053847", "0.6052841", "0.6044668", "0.60371774", "0.603689", "0.6034605", "0.6022237", "0.60202974", "0.6018651", "0.60141647" ]
0.0
-1
DeleteOneID returns a delete builder for the given id.
func (c *CategoryClient) DeleteOneID(id int) *CategoryDeleteOne { builder := c.Delete().Where(category.ID(id)) builder.mutation.id = &id builder.mutation.op = OpDeleteOne return &CategoryDeleteOne{builder} }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (c *BedtypeClient) DeleteOneID(id int) *BedtypeDeleteOne {\n\tbuilder := c.Delete().Where(bedtype.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &BedtypeDeleteOne{builder}\n}", "func (c *BuildingClient) DeleteOneID(id int) *BuildingDeleteOne {\n\tbuilder := c.Delete().Where(building.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &BuildingDeleteOne{builder}\n}", "func (c *LengthtimeClient) DeleteOneID(id int) *LengthtimeDeleteOne {\n\tbuilder := c.Delete().Where(lengthtime.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &LengthtimeDeleteOne{builder}\n}", "func (c *CleanernameClient) DeleteOneID(id int) *CleanernameDeleteOne {\n\tbuilder := c.Delete().Where(cleanername.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &CleanernameDeleteOne{builder}\n}", "func (c *ToolClient) DeleteOneID(id int) *ToolDeleteOne {\n\tbuilder := c.Delete().Where(tool.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &ToolDeleteOne{builder}\n}", "func (c *OperativeClient) DeleteOneID(id int) *OperativeDeleteOne {\n\tbuilder := c.Delete().Where(operative.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &OperativeDeleteOne{builder}\n}", "func (c *FoodmenuClient) DeleteOneID(id int) *FoodmenuDeleteOne {\n\tbuilder := c.Delete().Where(foodmenu.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &FoodmenuDeleteOne{builder}\n}", "func (c *CleaningroomClient) DeleteOneID(id int) *CleaningroomDeleteOne {\n\tbuilder := c.Delete().Where(cleaningroom.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &CleaningroomDeleteOne{builder}\n}", "func (c *DoctorClient) DeleteOneID(id int) *DoctorDeleteOne {\n\tbuilder := c.Delete().Where(doctor.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &DoctorDeleteOne{builder}\n}", "func (c *MealplanClient) DeleteOneID(id int) *MealplanDeleteOne {\n\tbuilder := c.Delete().Where(mealplan.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &MealplanDeleteOne{builder}\n}", "func (c *DentistClient) DeleteOneID(id int) *DentistDeleteOne {\n\tbuilder := c.Delete().Where(dentist.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &DentistDeleteOne{builder}\n}", "func (c *OperativerecordClient) DeleteOneID(id int) *OperativerecordDeleteOne {\n\tbuilder := c.Delete().Where(operativerecord.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &OperativerecordDeleteOne{builder}\n}", "func (c *LevelOfDangerousClient) DeleteOneID(id int) *LevelOfDangerousDeleteOne {\n\tbuilder := c.Delete().Where(levelofdangerous.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &LevelOfDangerousDeleteOne{builder}\n}", "func (c *PhysicianClient) DeleteOneID(id int) *PhysicianDeleteOne {\n\tbuilder := c.Delete().Where(physician.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &PhysicianDeleteOne{builder}\n}", "func (c *PhysicianClient) DeleteOneID(id int) *PhysicianDeleteOne {\n\tbuilder := c.Delete().Where(physician.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &PhysicianDeleteOne{builder}\n}", "func (c *BillClient) DeleteOneID(id int) *BillDeleteOne {\n\tbuilder := c.Delete().Where(bill.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &BillDeleteOne{builder}\n}", "func (c *BillClient) DeleteOneID(id int) *BillDeleteOne {\n\tbuilder := c.Delete().Where(bill.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &BillDeleteOne{builder}\n}", "func (c *BillClient) DeleteOneID(id int) *BillDeleteOne {\n\tbuilder := c.Delete().Where(bill.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &BillDeleteOne{builder}\n}", "func (c *DeviceClient) DeleteOneID(id int) *DeviceDeleteOne {\n\tbuilder := c.Delete().Where(device.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &DeviceDeleteOne{builder}\n}", "func (c *UnitOfMedicineClient) DeleteOneID(id int) *UnitOfMedicineDeleteOne {\n\tbuilder := c.Delete().Where(unitofmedicine.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &UnitOfMedicineDeleteOne{builder}\n}", "func (c *AdminClient) DeleteOneID(id int) *AdminDeleteOne {\n\tbuilder := c.Delete().Where(admin.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &AdminDeleteOne{builder}\n}", "func (c *DrugAllergyClient) DeleteOneID(id int) *DrugAllergyDeleteOne {\n\tbuilder := c.Delete().Where(drugallergy.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &DrugAllergyDeleteOne{builder}\n}", "func (c *RoomuseClient) DeleteOneID(id int) *RoomuseDeleteOne {\n\tbuilder := c.Delete().Where(roomuse.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &RoomuseDeleteOne{builder}\n}", "func (c *PatientofphysicianClient) DeleteOneID(id int) *PatientofphysicianDeleteOne {\n\tbuilder := c.Delete().Where(patientofphysician.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &PatientofphysicianDeleteOne{builder}\n}", "func (c *OrderClient) DeleteOneID(id int) *OrderDeleteOne {\n\tbuilder := c.Delete().Where(order.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &OrderDeleteOne{builder}\n}", "func (c *MedicineClient) DeleteOneID(id int) *MedicineDeleteOne {\n\tbuilder := c.Delete().Where(medicine.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &MedicineDeleteOne{builder}\n}", "func (c *EmptyClient) DeleteOneID(id int) *EmptyDeleteOne {\n\tbuilder := c.Delete().Where(empty.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &EmptyDeleteOne{builder}\n}", "func (c *MedicineTypeClient) DeleteOneID(id int) *MedicineTypeDeleteOne {\n\tbuilder := c.Delete().Where(medicinetype.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &MedicineTypeDeleteOne{builder}\n}", "func (c *BeerClient) DeleteOneID(id int) *BeerDeleteOne {\n\tbuilder := c.Delete().Where(beer.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &BeerDeleteOne{builder}\n}", "func (c *RoomdetailClient) DeleteOneID(id int) *RoomdetailDeleteOne {\n\tbuilder := c.Delete().Where(roomdetail.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &RoomdetailDeleteOne{builder}\n}", "func (c *StatustClient) DeleteOneID(id int) *StatustDeleteOne {\n\tbuilder := c.Delete().Where(statust.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &StatustDeleteOne{builder}\n}", "func (c *BookingClient) DeleteOneID(id int) *BookingDeleteOne {\n\tbuilder := c.Delete().Where(booking.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &BookingDeleteOne{builder}\n}", "func (c *BinaryFileClient) DeleteOneID(id int) *BinaryFileDeleteOne {\n\tbuilder := c.Delete().Where(binaryfile.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &BinaryFileDeleteOne{builder}\n}", "func (c *PharmacistClient) DeleteOneID(id int) *PharmacistDeleteOne {\n\tbuilder := c.Delete().Where(pharmacist.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &PharmacistDeleteOne{builder}\n}", "func (c *KeyStoreClient) DeleteOneID(id int32) *KeyStoreDeleteOne {\n\tbuilder := c.Delete().Where(keystore.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &KeyStoreDeleteOne{builder}\n}", "func (c *LeaseClient) DeleteOneID(id int) *LeaseDeleteOne {\n\tbuilder := c.Delete().Where(lease.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &LeaseDeleteOne{builder}\n}", "func (c *PaymentClient) DeleteOneID(id int) *PaymentDeleteOne {\n\tbuilder := c.Delete().Where(payment.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &PaymentDeleteOne{builder}\n}", "func (c *PaymentClient) DeleteOneID(id int) *PaymentDeleteOne {\n\tbuilder := c.Delete().Where(payment.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &PaymentDeleteOne{builder}\n}", "func (c *DispenseMedicineClient) DeleteOneID(id int) *DispenseMedicineDeleteOne {\n\tbuilder := c.Delete().Where(dispensemedicine.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &DispenseMedicineDeleteOne{builder}\n}", "func (c *DepositClient) DeleteOneID(id int) *DepositDeleteOne {\n\tbuilder := c.Delete().Where(deposit.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &DepositDeleteOne{builder}\n}", "func (c *StaytypeClient) DeleteOneID(id int) *StaytypeDeleteOne {\n\tbuilder := c.Delete().Where(staytype.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &StaytypeDeleteOne{builder}\n}", "func (c *OperationroomClient) DeleteOneID(id int) *OperationroomDeleteOne {\n\tbuilder := c.Delete().Where(operationroom.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &OperationroomDeleteOne{builder}\n}", "func (c *NurseClient) DeleteOneID(id int) *NurseDeleteOne {\n\tbuilder := c.Delete().Where(nurse.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &NurseDeleteOne{builder}\n}", "func (c *QueueClient) DeleteOneID(id int) *QueueDeleteOne {\n\tbuilder := c.Delete().Where(queue.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &QueueDeleteOne{builder}\n}", "func (c *OperationClient) DeleteOneID(id uuid.UUID) *OperationDeleteOne {\n\tbuilder := c.Delete().Where(operation.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &OperationDeleteOne{builder}\n}", "func (c *PostClient) DeleteOneID(id int) *PostDeleteOne {\n\tbuilder := c.Delete().Where(post.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &PostDeleteOne{builder}\n}", "func (c *ComplaintClient) DeleteOneID(id int) *ComplaintDeleteOne {\n\tbuilder := c.Delete().Where(complaint.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &ComplaintDeleteOne{builder}\n}", "func (c *PatientroomClient) DeleteOneID(id int) *PatientroomDeleteOne {\n\tbuilder := c.Delete().Where(patientroom.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &PatientroomDeleteOne{builder}\n}", "func (c *ModuleClient) DeleteOneID(id int) *ModuleDeleteOne {\n\treturn &ModuleDeleteOne{c.Delete().Where(module.ID(id))}\n}", "func (c *ComplaintTypeClient) DeleteOneID(id int) *ComplaintTypeDeleteOne {\n\tbuilder := c.Delete().Where(complainttype.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &ComplaintTypeDeleteOne{builder}\n}", "func (c *PurposeClient) DeleteOneID(id int) *PurposeDeleteOne {\n\tbuilder := c.Delete().Where(purpose.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &PurposeDeleteOne{builder}\n}", "func (c *AdminSessionClient) DeleteOneID(id int) *AdminSessionDeleteOne {\n\tbuilder := c.Delete().Where(adminsession.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &AdminSessionDeleteOne{builder}\n}", "func (c *StatusdClient) DeleteOneID(id int) *StatusdDeleteOne {\n\tbuilder := c.Delete().Where(statusd.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &StatusdDeleteOne{builder}\n}", "func (c *DNSBLQueryClient) DeleteOneID(id uuid.UUID) *DNSBLQueryDeleteOne {\n\tbuilder := c.Delete().Where(dnsblquery.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &DNSBLQueryDeleteOne{builder}\n}", "func (c *PetruleClient) DeleteOneID(id int) *PetruleDeleteOne {\n\tbuilder := c.Delete().Where(petrule.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &PetruleDeleteOne{builder}\n}", "func (c *EventClient) DeleteOneID(id int) *EventDeleteOne {\n\tbuilder := c.Delete().Where(event.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &EventDeleteOne{builder}\n}", "func (c *ClubapplicationClient) DeleteOneID(id int) *ClubapplicationDeleteOne {\n\tbuilder := c.Delete().Where(clubapplication.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &ClubapplicationDeleteOne{builder}\n}", "func (c *DisciplineClient) DeleteOneID(id int) *DisciplineDeleteOne {\n\tbuilder := c.Delete().Where(discipline.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &DisciplineDeleteOne{builder}\n}", "func (c *RoomClient) DeleteOneID(id int) *RoomDeleteOne {\n\tbuilder := c.Delete().Where(room.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &RoomDeleteOne{builder}\n}", "func (c *RoomClient) DeleteOneID(id int) *RoomDeleteOne {\n\tbuilder := c.Delete().Where(room.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &RoomDeleteOne{builder}\n}", "func (c *PledgeClient) DeleteOneID(id int) *PledgeDeleteOne {\n\tbuilder := c.Delete().Where(pledge.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &PledgeDeleteOne{builder}\n}", "func (c *CardClient) DeleteOneID(id int) *CardDeleteOne {\n\tbuilder := c.Delete().Where(card.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &CardDeleteOne{builder}\n}", "func (c *BillingstatusClient) DeleteOneID(id int) *BillingstatusDeleteOne {\n\tbuilder := c.Delete().Where(billingstatus.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &BillingstatusDeleteOne{builder}\n}", "func (c *SymptomClient) DeleteOneID(id int) *SymptomDeleteOne {\n\tbuilder := c.Delete().Where(symptom.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &SymptomDeleteOne{builder}\n}", "func (c *PatientClient) DeleteOneID(id int) *PatientDeleteOne {\n\tbuilder := c.Delete().Where(patient.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &PatientDeleteOne{builder}\n}", "func (c *PatientClient) DeleteOneID(id int) *PatientDeleteOne {\n\tbuilder := c.Delete().Where(patient.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &PatientDeleteOne{builder}\n}", "func (c *PatientClient) DeleteOneID(id int) *PatientDeleteOne {\n\tbuilder := c.Delete().Where(patient.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &PatientDeleteOne{builder}\n}", "func (c *TasteClient) DeleteOneID(id int) *TasteDeleteOne {\n\tbuilder := c.Delete().Where(taste.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &TasteDeleteOne{builder}\n}", "func (c *UnsavedPostClient) DeleteOneID(id int) *UnsavedPostDeleteOne {\n\tbuilder := c.Delete().Where(unsavedpost.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &UnsavedPostDeleteOne{builder}\n}", "func (c *JobClient) DeleteOneID(id int) *JobDeleteOne {\n\tbuilder := c.Delete().Where(job.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &JobDeleteOne{builder}\n}", "func (c *ExaminationroomClient) DeleteOneID(id int) *ExaminationroomDeleteOne {\n\tbuilder := c.Delete().Where(examinationroom.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &ExaminationroomDeleteOne{builder}\n}", "func (c *PlanetClient) DeleteOneID(id int) *PlanetDeleteOne {\n\tbuilder := c.Delete().Where(planet.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &PlanetDeleteOne{builder}\n}", "func (c *PrescriptionClient) DeleteOneID(id int) *PrescriptionDeleteOne {\n\tbuilder := c.Delete().Where(prescription.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &PrescriptionDeleteOne{builder}\n}", "func (c *TransactionClient) DeleteOneID(id int32) *TransactionDeleteOne {\n\tbuilder := c.Delete().Where(transaction.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &TransactionDeleteOne{builder}\n}", "func (c *SessionClient) DeleteOneID(id int) *SessionDeleteOne {\n\tbuilder := c.Delete().Where(session.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &SessionDeleteOne{builder}\n}", "func (c *TitleClient) DeleteOneID(id int) *TitleDeleteOne {\n\tbuilder := c.Delete().Where(title.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &TitleDeleteOne{builder}\n}", "func (c *PatientInfoClient) DeleteOneID(id int) *PatientInfoDeleteOne {\n\tbuilder := c.Delete().Where(patientinfo.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &PatientInfoDeleteOne{builder}\n}", "func (c *EatinghistoryClient) DeleteOneID(id int) *EatinghistoryDeleteOne {\n\tbuilder := c.Delete().Where(eatinghistory.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &EatinghistoryDeleteOne{builder}\n}", "func (c *WifiClient) DeleteOneID(id int) *WifiDeleteOne {\n\tbuilder := c.Delete().Where(wifi.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &WifiDeleteOne{builder}\n}", "func (c *FacultyClient) DeleteOneID(id int) *FacultyDeleteOne {\n\tbuilder := c.Delete().Where(faculty.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &FacultyDeleteOne{builder}\n}", "func (c *WalletNodeClient) DeleteOneID(id int32) *WalletNodeDeleteOne {\n\tbuilder := c.Delete().Where(walletnode.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &WalletNodeDeleteOne{builder}\n}", "func (c *ClubTypeClient) DeleteOneID(id int) *ClubTypeDeleteOne {\n\tbuilder := c.Delete().Where(clubtype.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &ClubTypeDeleteOne{builder}\n}", "func (c *AppointmentClient) DeleteOneID(id uuid.UUID) *AppointmentDeleteOne {\n\tbuilder := c.Delete().Where(appointment.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &AppointmentDeleteOne{builder}\n}", "func (c *PartorderClient) DeleteOneID(id int) *PartorderDeleteOne {\n\tbuilder := c.Delete().Where(partorder.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &PartorderDeleteOne{builder}\n}", "func (c *ClubClient) DeleteOneID(id int) *ClubDeleteOne {\n\tbuilder := c.Delete().Where(club.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &ClubDeleteOne{builder}\n}", "func (c *CoinInfoClient) DeleteOneID(id int32) *CoinInfoDeleteOne {\n\tbuilder := c.Delete().Where(coininfo.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &CoinInfoDeleteOne{builder}\n}", "func (c *ClinicClient) DeleteOneID(id uuid.UUID) *ClinicDeleteOne {\n\tbuilder := c.Delete().Where(clinic.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &ClinicDeleteOne{builder}\n}", "func (c *TimerClient) DeleteOneID(id int) *TimerDeleteOne {\n\tbuilder := c.Delete().Where(timer.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &TimerDeleteOne{builder}\n}", "func (c *ClubappStatusClient) DeleteOneID(id int) *ClubappStatusDeleteOne {\n\tbuilder := c.Delete().Where(clubappstatus.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &ClubappStatusDeleteOne{builder}\n}", "func (c *ActivityTypeClient) DeleteOneID(id int) *ActivityTypeDeleteOne {\n\tbuilder := c.Delete().Where(activitytype.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &ActivityTypeDeleteOne{builder}\n}", "func (c *ModuleVersionClient) DeleteOneID(id int) *ModuleVersionDeleteOne {\n\treturn &ModuleVersionDeleteOne{c.Delete().Where(moduleversion.ID(id))}\n}", "func (c *UsertypeClient) DeleteOneID(id int) *UsertypeDeleteOne {\n\tbuilder := c.Delete().Where(usertype.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &UsertypeDeleteOne{builder}\n}", "func (c *ActivitiesClient) DeleteOneID(id int) *ActivitiesDeleteOne {\n\tbuilder := c.Delete().Where(activities.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &ActivitiesDeleteOne{builder}\n}", "func (c *SituationClient) DeleteOneID(id int) *SituationDeleteOne {\n\tbuilder := c.Delete().Where(situation.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &SituationDeleteOne{builder}\n}", "func (c *SkillClient) DeleteOneID(id int) *SkillDeleteOne {\n\tbuilder := c.Delete().Where(skill.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &SkillDeleteOne{builder}\n}", "func (c *RentalstatusClient) DeleteOneID(id int) *RentalstatusDeleteOne {\n\tbuilder := c.Delete().Where(rentalstatus.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &RentalstatusDeleteOne{builder}\n}", "func (c *BranchClient) DeleteOneID(id int) *BranchDeleteOne {\n\tbuilder := c.Delete().Where(branch.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &BranchDeleteOne{builder}\n}", "func (c *YearClient) DeleteOneID(id int) *YearDeleteOne {\n\tbuilder := c.Delete().Where(year.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &YearDeleteOne{builder}\n}", "func (c *PartClient) DeleteOneID(id int) *PartDeleteOne {\n\tbuilder := c.Delete().Where(part.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &PartDeleteOne{builder}\n}", "func (c *TagClient) DeleteOneID(id int) *TagDeleteOne {\n\tbuilder := c.Delete().Where(tag.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &TagDeleteOne{builder}\n}", "func (c *RepairinvoiceClient) DeleteOneID(id int) *RepairinvoiceDeleteOne {\n\tbuilder := c.Delete().Where(repairinvoice.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &RepairinvoiceDeleteOne{builder}\n}" ]
[ "0.76778156", "0.75968426", "0.75511706", "0.7541144", "0.7539394", "0.7526723", "0.74882805", "0.7487795", "0.74769074", "0.74767685", "0.74631363", "0.74613", "0.7458024", "0.745116", "0.745116", "0.7442616", "0.7442616", "0.7442616", "0.743347", "0.7425805", "0.7422992", "0.74197966", "0.7418542", "0.7399402", "0.7396725", "0.73856103", "0.73840207", "0.7375385", "0.735778", "0.73571473", "0.73506707", "0.73470324", "0.7346839", "0.7345604", "0.7343301", "0.73415756", "0.7339983", "0.7339983", "0.73328143", "0.7330048", "0.7329202", "0.7325914", "0.7323134", "0.7313714", "0.7307478", "0.7304015", "0.72893864", "0.7282448", "0.72806984", "0.72796077", "0.7279311", "0.72784746", "0.7277576", "0.7277483", "0.72763735", "0.72697914", "0.7263448", "0.72509044", "0.7238351", "0.7238351", "0.7237803", "0.72373664", "0.723381", "0.72292316", "0.7228588", "0.7228588", "0.7228588", "0.72245425", "0.72225535", "0.72206736", "0.72152764", "0.7205751", "0.7203806", "0.72032803", "0.71952355", "0.7193382", "0.7190719", "0.7189693", "0.7165575", "0.71655035", "0.71611136", "0.7160824", "0.7160091", "0.7155872", "0.71474624", "0.7144856", "0.71436256", "0.71384954", "0.7131519", "0.712696", "0.7125728", "0.71234626", "0.7122792", "0.71096176", "0.7108689", "0.71075124", "0.7105292", "0.7104324", "0.7101526", "0.7095171", "0.7091349" ]
0.0
-1
Query returns a query builder for Category.
func (c *CategoryClient) Query() *CategoryQuery { return &CategoryQuery{ config: c.config, } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (s *CategoryService) Query(rs app.RequestScope, offset, limit int) ([]models.Category, error) {\n\treturn s.dao.Query(rs, offset, limit)\n}", "func (t *Tool) QueryCategory() *CategoryQuery {\n\treturn (&ToolClient{config: t.config}).QueryCategory(t)\n}", "func (upq *UnsavedPostQuery) QueryCategory() *CategoryQuery {\n\tquery := &CategoryQuery{config: upq.config}\n\tquery.path = func(ctx context.Context) (fromU *sql.Selector, err error) {\n\t\tif err := upq.prepareQuery(ctx); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tselector := upq.sqlQuery(ctx)\n\t\tif err := selector.Err(); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tstep := sqlgraph.NewStep(\n\t\t\tsqlgraph.From(unsavedpost.Table, unsavedpost.FieldID, selector),\n\t\t\tsqlgraph.To(category.Table, category.FieldID),\n\t\t\tsqlgraph.Edge(sqlgraph.M2O, true, unsavedpost.CategoryTable, unsavedpost.CategoryColumn),\n\t\t)\n\t\tfromU = sqlgraph.SetNeighbors(upq.driver.Dialect(), step)\n\t\treturn fromU, nil\n\t}\n\treturn query\n}", "func (c *UnsavedPostClient) QueryCategory(up *UnsavedPost) *CategoryQuery {\n\tquery := &CategoryQuery{config: c.config}\n\tquery.path = func(ctx context.Context) (fromV *sql.Selector, _ error) {\n\t\tid := up.ID\n\t\tstep := sqlgraph.NewStep(\n\t\t\tsqlgraph.From(unsavedpost.Table, unsavedpost.FieldID, id),\n\t\t\tsqlgraph.To(category.Table, category.FieldID),\n\t\t\tsqlgraph.Edge(sqlgraph.M2O, true, unsavedpost.CategoryTable, unsavedpost.CategoryColumn),\n\t\t)\n\t\tfromV = sqlgraph.Neighbors(up.driver.Dialect(), step)\n\t\treturn fromV, nil\n\t}\n\treturn query\n}", "func (c *PostClient) QueryCategory(po *Post) *CategoryQuery {\n\tquery := &CategoryQuery{config: c.config}\n\tquery.path = func(ctx context.Context) (fromV *sql.Selector, _ error) {\n\t\tid := po.ID\n\t\tstep := sqlgraph.NewStep(\n\t\t\tsqlgraph.From(post.Table, post.FieldID, id),\n\t\t\tsqlgraph.To(category.Table, category.FieldID),\n\t\t\tsqlgraph.Edge(sqlgraph.M2O, true, post.CategoryTable, post.CategoryColumn),\n\t\t)\n\t\tfromV = sqlgraph.Neighbors(po.driver.Dialect(), step)\n\t\treturn fromV, nil\n\t}\n\treturn query\n}", "func (db RepoCategorys) Query(title string, code string, ComId uint32, pag Pagination) (*[]models.Categorys, error) {\r\n\tvar args []interface{}\r\n\r\n\tvar where string\r\n\targs = append(args, ComId)\r\n\tif title != \"\" {\r\n\t\twhere += \" AND REGEXP_LIKE(T.CTT_TITLE, :CTT_TITLE, 'i')\"\r\n\t\targs = append(args, title)\r\n\t}\r\n\r\n\tif code != \"\" {\r\n\t\twhere += \" AND REGEXP_LIKE(N.CTT_CODE, :CTT_CODE, 'i')\"\r\n\t\targs = append(args, code)\r\n\t}\r\n\r\n\tstrpag := pag.pag()\r\n\r\n\trows, err := db.conn.QueryContext(\r\n\t\t*db.ctx,\r\n\t\t`SELECT T.CTT_ID, T.CTT_TITLE, NVL(T.CTT_FATHER,0), LISTAGG(N.CNN_CODE, ', ')\r\n\t\t FROM CATEGORYS_TITLES T, CATEGORYS_NICKNAMES N\r\n\t\t WHERE T.CTT_ID = N.CTT_ID(+)\r\n\t\t AND N.COM_ID IS NULL OR N.COM_ID = :COM_ID`+where+\r\n\t\t\t` GROUP BY T.CTT_ID, T.CTT_TITLE, T.CTT_FATHER`+strpag, args...,\r\n\t)\r\n\tif err != nil {\r\n\t\treturn nil, err\r\n\t}\r\n\r\n\tdefer rows.Close()\r\n\r\n\tvar categorys []models.Categorys\r\n\tfor rows.Next() {\r\n\t\tvar category models.Categorys\r\n\t\terr = rows.Scan(&category.CTT_ID, &category.Title, &category.Father, &category.Code)\r\n\t\tcategorys = append(categorys, category)\r\n\t}\r\n\treturn &categorys, nil\r\n}", "func (t *tagStorage) QueryCategories() ([]model.CategoryInfo, error) {\n\tvar cs []model.CategoryInfo\n\n\terr := t.db.Table(model.CateTableName()).Where(\"del_flag = ?\", 0).Find(&cs)\n\treturn cs, err\n}", "func NewCategoryQueryInMemory(db map[int]*model.Category) CategoryQuery {\n\treturn &categoryQueryInMemory{db}\n}", "func (o *BookCategoryAssign) Category(mods ...qm.QueryMod) bookCategoryQuery {\n\tqueryMods := []qm.QueryMod{\n\t\tqm.Where(\"id=?\", o.CategoryID),\n\t}\n\n\tqueryMods = append(queryMods, mods...)\n\n\tquery := BookCategories(queryMods...)\n\tqueries.SetFrom(query.Query, \"`book_category`\")\n\n\treturn query\n}", "func GetAllCategory(c * gin.Context){\n\tdb := database.DBConn()\n\trows, err := db.Query(\"SELECT * FROM category\")\n\tif err != nil{\n\t\tc.JSON(500, gin.H{\n\t\t\t\"messages\" : \"Story not found\",\n\t\t});\n\t}\n\tpost := DTO.CategoryDTO{}\n\tlist := [] DTO.CategoryDTO{}\n\tfor rows.Next(){\n\t\tvar id, types int\n\t\tvar name string\n\t\terr = rows.Scan(&id, &name, &types)\n\t\tif err != nil {\n\t\t\tpanic(err.Error())\n\t\t}\n\t\tpost.Id = id\n\t\tpost.Name = name\n\t\tpost.Type = types\n\t\tlist = append(list,post);\n\t}\n\tc.JSON(200, list)\n\tdefer db.Close()\n}", "func Categories(filter bson.M) ([]structure.Category, error) {\n\tvar categories []structure.Category\n\n\tsession := mgoSession.Copy()\n\tdefer session.Close()\n\n\tc := session.DB(dbName).C(\"categories\")\n\n\tpipeline := []bson.M{\n\t\tbson.M{\n\t\t\t\"$match\": filter,\n\t\t},\n\t\tbson.M{\n\t\t\t\"$project\": bson.M{\n\t\t\t\t\"_id\": 1,\n\t\t\t\t\"name\": 1,\n\t\t\t},\n\t\t},\n\t}\n\n\terr := c.Pipe(pipeline).All(&categories)\n\n\treturn categories, err\n}", "func (q bookCategoryQuery) All(ctx context.Context, exec boil.ContextExecutor) (BookCategorySlice, error) {\n\tvar o []*BookCategory\n\n\terr := q.Bind(ctx, exec, &o)\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"models: failed to assign all query results to BookCategory slice\")\n\t}\n\n\tif len(bookCategoryAfterSelectHooks) != 0 {\n\t\tfor _, obj := range o {\n\t\t\tif err := obj.doAfterSelectHooks(ctx, exec); err != nil {\n\t\t\t\treturn o, err\n\t\t\t}\n\t\t}\n\t}\n\n\treturn o, nil\n}", "func (c *ClubTypeClient) Query() *ClubTypeQuery {\n\treturn &ClubTypeQuery{config: c.config}\n}", "func (dao *ArticleDAO) Query(rs app.RequestScope, offset, limit, categoryId int, sorting, filter string) ([]models.Article, error) {\n\tarticles := []models.Article{}\n\tq := rs.Tx().Select().OrderBy(\"id\")\n\tif categoryId != 0 {\n\t\tq.Where(dbx.HashExp{\"category_id\": categoryId})\n\t}\n\tif filter != \"\" {\n\t\tq.AndWhere(dbx.Like(\"title\", filter))\n\t}\n\tif sorting == \"asc\" {\n\t\tq.OrderBy(\"id ASC\")\n\t} else {\n\t\tq.OrderBy(\"id DESC\")\n\t}\n\terr := q.Offset(int64(offset)).Limit(int64(limit)).All(&articles)\n\treturn articles, err\n}", "func (c *CleaningroomClient) Query() *CleaningroomQuery {\n\treturn &CleaningroomQuery{config: c.config}\n}", "func (c Category) GetAll(ctx iris.Context) {\n\n\tpage := middleware.GetPage(ctx)\n\n\tdatas, err := models.Category{}.GetAll(&page)\n\tif err != nil {\n\t\tresponse.JSONError(ctx, err.Error())\n\t\treturn\n\t}\n\n\tresponse.JSONPage(ctx, datas, page)\n}", "func GetAllCategories() ([]*Category, error) {\n\to := orm.NewOrm()\n\n\tcates := make([]*Category, 0)\n\n\tqs := o.QueryTable(\"category\")\n\t_, err := qs.All(&cates)\n\n\treturn cates, err\n}", "func (ct *Categories) ToDBQuery() (string, []interface{}) {\n\tvar args []interface{}\n\tif len(*ct) > 0 {\n\t\tconditionsOr := make([]string, len(*ct))\n\t\tfor key, val := range *ct {\n\t\t\tif val.IsMainSet() {\n\t\t\t\tconditionsOr[key] += \"category = ?\"\n\t\t\t\targs = append(args, val.Main)\n\t\t\t\tif val.IsSubSet() {\n\t\t\t\t\tconditionsOr[key] += \" AND sub_category = ?\"\n\t\t\t\t\targs = append(args, val.Sub)\n\t\t\t\t}\n\t\t\t\tif len(*ct) > 1 {\n\t\t\t\t\tconditionsOr[key] = \"(\" + conditionsOr[key] + \")\"\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn strings.Join(conditionsOr, \" OR \"), args\n\t}\n\treturn \"\", args\n}", "func (q *Query) Build() (qry string) {\n\tvar queryBuilder string\n\n\tif len(q.Categories) > 0 && len(q.Qry) > 0 {\n\t\tqueryBuilder = q.buildQuery() + \" | \" + q.buildCategories()\n\t} else if len(q.Categories) > 0 && len(q.Qry) == 0 {\n\t\tqueryBuilder = q.buildCategories()\n\t} else if len(q.Qry) > 0 && len(q.Categories) == 0 {\n\t\tqueryBuilder = q.buildQuery()\n\t}\n\n\treturn queryBuilder\n}", "func (c Combinator) Query() cqr.CommonQueryRepresentation {\n\treturn c.Clause.Query\n}", "func CategoryGet(c *gin.Context) {\n\tCategory, err := models.GetCategory(c.Param(\"name\"))\n\tif err != nil {\n\t\tc.HTML(http.StatusNotFound, \"errors/404\", nil)\n\t\treturn\n\t}\n\tvar filter models.DaoFilter\n\tfilter.Category.Name = Category.Name\n\tcount,_ := filter.GetPostsCount()\n\tcurrentPage, _ := strconv.Atoi(c.DefaultQuery(\"p\",\"1\"))\n\tlimit := 10\n\tPagination := helpers.NewPaginator(c,limit,count)\n\tlist, err := filter.GetPostsByPage(currentPage,limit)\n\tif err != nil {\n\t\tc.HTML(http.StatusNotFound, \"errors/404\", nil)\n\t\treturn\n\t}\n\n\th := helpers.DefaultH(c)\n\th[\"Title\"] = Category.Name\n\th[\"Category\"] = Category\n\th[\"Active\"] = \"categories\"\n\th[\"List\"] = list\n\th[\"Pagination\"] = Pagination\n\tc.HTML(http.StatusOK, \"categories/show\", h)\n}", "func (c *BranchClient) Query() *BranchQuery {\n\treturn &BranchQuery{config: c.config}\n}", "func (c *GenderClient) Query() *GenderQuery {\n\treturn &GenderQuery{config: c.config}\n}", "func (c *GenderClient) Query() *GenderQuery {\n\treturn &GenderQuery{config: c.config}\n}", "func (c *CompanyClient) Query() *CompanyQuery {\n\treturn &CompanyQuery{config: c.config}\n}", "func (c *CompanyClient) Query() *CompanyQuery {\n\treturn &CompanyQuery{\n\t\tconfig: c.config,\n\t}\n}", "func (c *BuildingClient) Query() *BuildingQuery {\n\treturn &BuildingQuery{config: c.config}\n}", "func (c *ClubBranchClient) Query() *ClubBranchQuery {\n\treturn &ClubBranchQuery{config: c.config}\n}", "func (c *_Comments) Query(db database.DB, models ...*Comment) *commentsQueryBuilder {\n\tvar queryModels []mapping.Model\n\tif len(models) > 0 {\n\t\tqueryModels = make([]mapping.Model, len(models))\n\t\tfor i, model := range models {\n\t\t\tqueryModels[i] = model\n\t\t}\n\t}\n\tbuilder := db.Query(c.Model, queryModels...)\n\treturn &commentsQueryBuilder{builder: builder}\n}", "func GetAllCategories() ([]Category, error) {\n\t// resultados es el array de categorias\n\tresult := []Category{}\n\t// la consulta que le paso luego al select\n\tquery := `SELECT * FROM category`\n\t// el select tiene recibe la direccion de memoria de result y la query\n\tif err := DB.Select(&result, query); err != nil {\n\t\treturn nil, err\n\t}\n\t// devuelve el resultado\n\treturn result, nil\n}", "func (s *Repository) GetAll(ctx context.Context) ([]Category, error) {\n\tconst limit = 20\n\n\trows, err := s.pool.Query(\n\t\tctx,\n\t\t`select \"ID\", \"name\", \"logo\" from category\n\t\t limit $1`,\n\t\tlimit)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tdefer rows.Close()\n\n\tbuffer := make([]Category, limit)\n\ti := 0\n\n\tfor rows.Next() {\n\t\tvar c Category\n\n\t\terr := rows.Scan(\n\t\t\t&c.ID,\n\t\t\t&c.Name,\n\t\t\t&c.Logo)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tbuffer[i] = c\n\n\t\ti++\n\t}\n\n\tresult := make([]Category, i)\n\tcopy(result, buffer)\n\n\treturn result, nil\n}", "func (c *ActivityTypeClient) Query() *ActivityTypeQuery {\n\treturn &ActivityTypeQuery{config: c.config}\n}", "func BookCategories(mods ...qm.QueryMod) bookCategoryQuery {\n\tmods = append(mods, qm.From(\"`book_category`\"))\n\treturn bookCategoryQuery{NewQuery(mods...)}\n}", "func Query(ds datastore.Datastore, sqlClause string) ([]CPD, error) {\n\treturn cpdQuery(ds, sqlClause)\n}", "func (c *MedicineTypeClient) Query() *MedicineTypeQuery {\n\treturn &MedicineTypeQuery{config: c.config}\n}", "func (dc DevCat) Category() Category {\n\treturn Category(dc[0])\n}", "func (c *ComplaintTypeClient) Query() *ComplaintTypeQuery {\n\treturn &ComplaintTypeQuery{config: c.config}\n}", "func (c *ClubappStatusClient) Query() *ClubappStatusQuery {\n\treturn &ClubappStatusQuery{config: c.config}\n}", "func (c *ClubClient) Query() *ClubQuery {\n\treturn &ClubQuery{config: c.config}\n}", "func (q *categoryQueryInMemory) FindAll() <-chan QueryResult {\n\toutput := make(chan QueryResult)\n\tgo func() {\n\t\tdefer close(output)\n\n\t\tvar categories model.Categories\n\t\tfor _, v := range q.db {\n\t\t\tcategories = append(categories, *v)\n\t\t}\n\n\t\toutput <- QueryResult{Result: categories}\n\t}()\n\treturn output\n}", "func (c SQLCategoryRepo) FindAll() ([]Category, error) {\n\tvar result []Category\n\terr := c.DB.Find(&result).Error\n\n\treturn result, err\n}", "func (c *ClubapplicationClient) Query() *ClubapplicationQuery {\n\treturn &ClubapplicationQuery{config: c.config}\n}", "func (bcq *BaselineClassQuery) QueryBaselineCategoryList() *BaselineCategoryQuery {\n\tquery := &BaselineCategoryQuery{config: bcq.config}\n\tquery.path = func(ctx context.Context) (fromU *sql.Selector, err error) {\n\t\tif err := bcq.prepareQuery(ctx); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tselector := bcq.sqlQuery(ctx)\n\t\tif err := selector.Err(); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tstep := sqlgraph.NewStep(\n\t\t\tsqlgraph.From(baselineclass.Table, baselineclass.FieldID, selector),\n\t\t\tsqlgraph.To(baselinecategory.Table, baselinecategory.FieldID),\n\t\t\tsqlgraph.Edge(sqlgraph.O2M, false, baselineclass.BaselineCategoryListTable, baselineclass.BaselineCategoryListColumn),\n\t\t)\n\t\tfromU = sqlgraph.SetNeighbors(bcq.driver.Dialect(), step)\n\t\treturn fromU, nil\n\t}\n\treturn query\n}", "func (c *Client) Category(ctx context.Context, category TorrentCategory, opts *CategoryOptions) ([]*Torrent, error) {\n\tif opts == nil {\n\t\topts = &CategoryOptions{\n\t\t\tPage: 0,\n\t\t}\n\t}\n\tquery := fmt.Sprintf(\"category:%d:%d\", category, opts.Page)\n\tv := url.Values{}\n\tv.Add(\"q\", query)\n\tpath := \"/q.php?\" + v.Encode()\n\treturn c.fetchTorrents(ctx, path)\n}", "func (c *MealplanClient) Query() *MealplanQuery {\n\treturn &MealplanQuery{config: c.config}\n}", "func (db RepoCategorys) QueryNiks(title string, code string, comID uint32, pag Pagination) (*[]models.Categorys, error) {\r\n\tvar args []interface{}\r\n\r\n\targs = append(args, comID)\r\n\tvar where string\r\n\tif title != \"\" {\r\n\t\twhere += \" AND REGEXP_LIKE(T.CTT_TITLE, :CTT_TITLE, 'i')\"\r\n\t\targs = append(args, title)\r\n\t}\r\n\r\n\tif code != \"\" {\r\n\t\twhere += \" AND REGEXP_LIKE(N.CTT_CODE, :CTT_CODE, 'i')\"\r\n\t\targs = append(args, code)\r\n\t}\r\n\r\n\tstrpag := pag.pag()\r\n\r\n\trows, err := db.conn.QueryContext(\r\n\t\t*db.ctx,\r\n\t\t`SELECT T.CTT_ID, T.CTT_TITLE, N.CNN_CODE\r\n\t\tFROM CATEGORYS_TITLES T, CATEGORYS_NICKNAMES N\r\n\t WHERE T.CTT_ID = N.CTT_ID \r\n\t AND COM_ID = :COM_ID`+where+strpag, args...,\r\n\t)\r\n\tif err != nil {\r\n\t\treturn nil, err\r\n\t}\r\n\r\n\tdefer rows.Close()\r\n\r\n\tvar categorys []models.Categorys\r\n\r\n\tfor rows.Next() {\r\n\t\tvar category models.Categorys\r\n\t\trows.Scan(&category.CTT_ID, &category.Title, &category.Code)\r\n\t\tcategorys = append(categorys, category)\r\n\t}\r\n\treturn &categorys, nil\r\n}", "func (c *CategoryClient) Get(ctx context.Context, id int) (*Category, error) {\n\treturn c.Query().Where(category.ID(id)).Only(ctx)\n}", "func Category() string {\n\treturn category\n}", "func (c *DisciplineClient) Query() *DisciplineQuery {\n\treturn &DisciplineQuery{config: c.config}\n}", "func (dqlx *dqlx) Query(rootFn *FilterFn) QueryBuilder {\n\treturn Query(rootFn).WithDClient(dqlx.dgraph)\n}", "func (s BmCategoryStorage) GetAll(r api2go.Request, skip int, take int) []*BmModel.Category {\n\tin := BmModel.Category{}\n\tvar out []BmModel.Category\n\terr := s.db.FindMulti(r, &in, &out, skip, take)\n\tif err == nil {\n\t\tvar tmp []*BmModel.Category\n\t\t//tmp := make(map[string]*BmModel.Category)\n\t\tfor _, iter := range out {\n\t\t\ts.db.ResetIdWithId_(&iter)\n\t\t\ttmp = append(tmp, &iter)\n\t\t\t//tmp[iter.ID] = &iter\n\t\t}\n\t\treturn tmp\n\t} else {\n\t\treturn nil //make(map[string]*BmModel.Category)\n\t}\n}", "func (d *DbBackendCouch) Query(params dragonfruit.QueryParams) (dragonfruit.Container, error) {\n\n\tnum, result, err := d.queryView(params)\n\tif err != nil {\n\t\treturn dragonfruit.Container{}, err\n\t}\n\n\treturnType := makeTypeName(params.Path)\n\n\tc := dragonfruit.Container{}\n\tc.Meta.Count = len(result.Rows)\n\tc.Meta.Total = num\n\tc.Meta.Offset = result.Offset\n\tc.Meta.ResponseCode = 200\n\tc.Meta.ResponseMessage = \"Ok.\"\n\tc.ContainerType = strings.Title(returnType + strings.Title(dragonfruit.ContainerName))\n\tc.Results = make([]interface{}, 0)\n\tfor _, row := range result.Rows {\n\t\toutRow, err := sanitizeDoc(row.Value)\n\t\tif err != nil {\n\t\t\treturn c, err\n\t\t}\n\t\tc.Results = append(c.Results, outRow)\n\t}\n\n\treturn c, err\n}", "func (c *FoodmenuClient) Query() *FoodmenuQuery {\n\treturn &FoodmenuQuery{config: c.config}\n}", "func (c *BedtypeClient) Query() *BedtypeQuery {\n\treturn &BedtypeQuery{config: c.config}\n}", "func (c *ActivitiesClient) Query() *ActivitiesQuery {\n\treturn &ActivitiesQuery{config: c.config}\n}", "func (builder *QueryBuilder[K, F]) Query() Query[K, F] {\n\tif len(builder.query.Conditions) == 0 {\n\t\tbuilder.Where(defaultFilter[K, F]{})\n\t}\n\tif len(builder.query.Aggregators) == 0 {\n\t\tbuilder.Aggregate(defaultAggregator[K, F]{})\n\t}\n\tbuilder.query.results = &Result[K, F]{\n\t\tentries: make(map[ResultKey]*ResultEntry[K, F]),\n\t}\n\treturn builder.query\n}", "func (cRepo *CategoryGormRepo) Category(id uint) (*entity.Category, []error) {\n\tctg := entity.Category{}\n\terrs := cRepo.conn.First(&ctg, id).GetErrors()\n\tif len(errs) > 0 {\n\t\treturn nil, errs\n\t}\n\treturn &ctg, errs\n}", "func (c *DepositClient) Query() *DepositQuery {\n\treturn &DepositQuery{config: c.config}\n}", "func (m *IntentsDeviceManagementIntentItemRequestBuilder) Categories()(*IntentsItemCategoriesRequestBuilder) {\n return NewIntentsItemCategoriesRequestBuilderInternal(m.BaseRequestBuilder.PathParameters, m.BaseRequestBuilder.RequestAdapter)\n}", "func (q bookCategoryQuery) AllG(ctx context.Context) (BookCategorySlice, error) {\n\treturn q.All(ctx, boil.GetContextDB())\n}", "func (s *NewsService) Query(rs app.RequestScope, offset, limit int) ([]models.News, error) {\n\treturn s.dao.Query(rs, offset, limit)\n}", "func (c Controller) Category(id int) (*model.Category, error) {\n\treturn c.CategoriesRepository.Get(id, \"\")\n}", "func (q *Query) buildCategories() (qry string) {\n\tvar queryBuilder string\n\n\tqueryBuilder = strings.TrimLeft(q.Categories, \" \")\n\tqueryBuilder = strings.TrimRight(queryBuilder, \" \")\n\n\tarray := strings.Split(queryBuilder, \" \")\n\n\tfor i, value := range array {\n\t\tif i == 0 {\n\t\t\tqueryBuilder = value\n\t\t} else {\n\t\t\tqueryBuilder += \" | \" + value\n\t\t}\n\t}\n\n\treturn queryBuilder\n}", "func (e *Education) GetAllByCategory(ctx context.Context) interface{} {\n\treturn e.GetAll(ctx)\n}", "func (service *Service) GetAllCategory(request *restful.Request, response *restful.Response) {\n\tdbResult, err := service.server.GetAllCategory()\n\tif err != nil {\n\t\trespondErr(response, http.StatusInternalServerError, messageDatabaseError,\n\t\t\t\"unable to get all category\")\n\n\t\tlogrus.WithFields(logrus.Fields{\"module\": \"service\", \"resp\": http.StatusInternalServerError}).\n\t\t\tError(\"Unable to get all category:\", err)\n\n\t\treturn\n\t}\n\n\tresult := &models.GetCategoriesResponse{\n\t\tResult: dbResult,\n\t}\n\n\twriteResponse(response, http.StatusOK, result)\n}", "func GetCategory(response http.ResponseWriter, request *http.Request) {\n\t//var results TCategory\n\tvar errorResponse = ErrorResponse{\n\t\tCode: http.StatusInternalServerError, Message: \"Internal Server Error.\",\n\t}\n\n\tcollection := Client.Database(\"msdb\").Collection(\"t_cat_mg\")\n\tctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)\n\tcursor, err := collection.Find(ctx, bson.M{})\n\tvar results []bson.M\n\terr = cursor.All(ctx, &results)\n\n\tdefer cancel()\n\n\tif err != nil {\n\t\terrorResponse.Message = \"Document not found\"\n\t\treturnErrorResponse(response, request, errorResponse)\n\t} else {\n\t\tvar successResponse = SuccessResponse{\n\t\t\tCode: http.StatusOK,\n\t\t\tMessage: \"Success\",\n\t\t\tResponse: results,\n\t\t}\n\n\t\tsuccessJSONResponse, jsonError := json.Marshal(successResponse)\n\n\t\tif jsonError != nil {\n\t\t\treturnErrorResponse(response, request, errorResponse)\n\t\t}\n\t\tresponse.Header().Set(\"Content-Type\", \"application/json\")\n\t\tresponse.Write(successJSONResponse)\n\t}\n\n}", "func GetAllCategories(db *sql.DB) ([]Category, error) {\n\trows, err := db.Query(`SELECT c.id, c.name FROM category c`)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar categories []Category\n\tfor rows.Next() {\n\t\tvar category Category\n\t\terr := rows.Scan(\n\t\t\t&category.ID,\n\t\t\t&category.Name,\n\t\t)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tcategories = append(categories, category)\n\t}\n\n\treturn categories, nil\n\n}", "func (cri *CategoryRepositoryImpl) Categories() ([]entity.Category, error) {\n\n\trows, err := cri.conn.Query(\"SELECT * FROM categories;\")\n\tif err != nil {\n\t\treturn nil, errors.New(\"Could not query the database\")\n\t}\n\tdefer rows.Close()\n\n\tctgs := []entity.Category{}\n\n\tfor rows.Next() {\n\t\tcategory := entity.Category{}\n\t\terr = rows.Scan(&category.ID, &category.Name, &category.Description, &category.Image)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tctgs = append(ctgs, category)\n\t}\n\n\treturn ctgs, nil\n}", "func (c *CleanernameClient) QueryCleaningrooms(cl *Cleanername) *CleaningroomQuery {\n\tquery := &CleaningroomQuery{config: c.config}\n\tquery.path = func(ctx context.Context) (fromV *sql.Selector, _ error) {\n\t\tid := cl.ID\n\t\tstep := sqlgraph.NewStep(\n\t\t\tsqlgraph.From(cleanername.Table, cleanername.FieldID, id),\n\t\t\tsqlgraph.To(cleaningroom.Table, cleaningroom.FieldID),\n\t\t\tsqlgraph.Edge(sqlgraph.O2M, false, cleanername.CleaningroomsTable, cleanername.CleaningroomsColumn),\n\t\t)\n\t\tfromV = sqlgraph.Neighbors(cl.driver.Dialect(), step)\n\t\treturn fromV, nil\n\t}\n\treturn query\n}", "func (c *MedicineClient) Query() *MedicineQuery {\n\treturn &MedicineQuery{config: c.config}\n}", "func (r Repository) Categories() []DbCategory {\n\tsession, _ := mgo.Dial(r.ipAddress)\n\tdefer session.Close()\n\tsession.SetMode(mgo.Monotonic, true)\n\n\tcategories := []DbCategory{}\n\tcollection := session.DB(\"u-talk\").C(\"forum\")\n\terr := collection.Find(nil).All(&categories)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\treturn categories\n}", "func (cRepo *CategoryGormRepo) Categories() ([]entity.Category, []error) {\n\tctgs := []entity.Category{}\n\terrs := cRepo.conn.Find(&ctgs).GetErrors()\n\tif len(errs) > 0 {\n\t\treturn nil, errs\n\t}\n\treturn ctgs, errs\n}", "func (c *CustomerClient) Query() *CustomerQuery {\n\treturn &CustomerQuery{config: c.config}\n}", "func (c *AppointmentClient) Query() *AppointmentQuery {\n\treturn &AppointmentQuery{config: c.config}\n}", "func (m *GroupPolicyDefinitionsItemNextVersionDefinitionPreviousVersionDefinitionRequestBuilder) Category()(*GroupPolicyDefinitionsItemNextVersionDefinitionPreviousVersionDefinitionCategoryRequestBuilder) {\n return NewGroupPolicyDefinitionsItemNextVersionDefinitionPreviousVersionDefinitionCategoryRequestBuilderInternal(m.BaseRequestBuilder.PathParameters, m.BaseRequestBuilder.RequestAdapter)\n}", "func (c *CleanernameClient) Query() *CleanernameQuery {\n\treturn &CleanernameQuery{config: c.config}\n}", "func (c *RoomClient) Query() *RoomQuery {\n\treturn &RoomQuery{config: c.config}\n}", "func (c *RoomClient) Query() *RoomQuery {\n\treturn &RoomQuery{config: c.config}\n}", "func (s *CategoryService) Get(rs app.RequestScope, id int) (*models.Category, error) {\n\treturn s.dao.Get(rs, id)\n}", "func (c *BookingClient) Query() *BookingQuery {\n\treturn &BookingQuery{config: c.config}\n}", "func (categoria *Categoria) FindAllCategoria(db *gorm.DB) (*[]Categoria, error) {\n\n\tallCategoria := []Categoria{}\n\n\t// Busca todos elementos contidos no banco de dados\n\terr := db.Debug().Model(&Categoria{}).Find(&allCategoria).Error\n\tif err != nil {\n\t\treturn &[]Categoria{}, err\n\t}\n\n\treturn &allCategoria, err\n}", "func (c *ComplaintClient) Query() *ComplaintQuery {\n\treturn &ComplaintQuery{config: c.config}\n}", "func (c *ClinicClient) Query() *ClinicQuery {\n\treturn &ClinicQuery{config: c.config}\n}", "func (c *AcademicYearClient) Query() *AcademicYearQuery {\n\treturn &AcademicYearQuery{config: c.config}\n}", "func (c *DepartmentClient) Query() *DepartmentQuery {\n\treturn &DepartmentQuery{config: c.config}\n}", "func (s *RepositoryService) Query(rs app.RequestScope, offset, limit int) ([]*models.Repository, error) {\n\treturn s.dao.Query(rs.DB(), offset, limit)\n}", "func (c *PatientroomClient) Query() *PatientroomQuery {\n\treturn &PatientroomQuery{config: c.config}\n}", "func (g *Goods) Category(c Context) {\n\t// TODO\n\tc.String(http.StatusOK, \"get goods category\")\n}", "func (q bookCategoryQuery) Count(ctx context.Context, exec boil.ContextExecutor) (int64, error) {\n\tvar count int64\n\n\tqueries.SetSelect(q.Query, nil)\n\tqueries.SetCount(q.Query)\n\n\terr := q.Query.QueryRowContext(ctx, exec).Scan(&count)\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: failed to count book_category rows\")\n\t}\n\n\treturn count, nil\n}", "func GetAllCat(userid uint32) ([]models.Category, error) {\n\tvar cats []models.Category\n\terr := DB.Where(\"user_id = ?\", userid).Find(&cats).Error\n\tif err != nil {\n\t\tlog.Warning.Println(err)\n\t\treturn nil, ErrInternal\n\t}\n\treturn cats, nil\n}", "func (g *Game) Categories(filter *CategoryFilter, sort *Sorting, embeds string) (*CategoryCollection, *Error) {\n\tif g.CategoriesData == nil {\n\t\treturn fetchCategoriesLink(firstLink(g, \"categories\"), filter, sort, embeds)\n\t}\n\n\treturn toCategoryCollection(g.CategoriesData), nil\n}", "func GetCategories(c *fiber.Ctx) error {\n\tdb := database.DBConn\n\n\trows, err := db.Query(\"SELECT * FROM categories\")\n\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tvar category models.Category\n\tvar categories []models.Category\n\n\tfor rows.Next() {\n\t\tif err := rows.Scan(&category.ID, &category.Name); err != nil {\n\t\t\treturn err\n\t\t}\n\t\tcategories = append(categories, category)\n\t}\n\treturn c.Render(\"category\", categories)\n}", "func (b *_Blogs) Query(db database.DB, models ...*Blog) *blogsQueryBuilder {\n\tvar queryModels []mapping.Model\n\tif len(models) > 0 {\n\t\tqueryModels = make([]mapping.Model, len(models))\n\t\tfor i, model := range models {\n\t\t\tqueryModels[i] = model\n\t\t}\n\t}\n\tbuilder := db.Query(b.Model, queryModels...)\n\treturn &blogsQueryBuilder{builder: builder}\n}", "func (api *Client) Categories() (*CategoriesContainer, error) {\n\tcategories := &CategoriesContainer{}\n\terr := get(api, \"/categories?lang=ja\", categories)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn categories, nil\n}", "func (c *DoctorClient) Query() *DoctorQuery {\n\treturn &DoctorQuery{config: c.config}\n}", "func (c *RoomuseClient) Query() *RoomuseQuery {\n\treturn &RoomuseQuery{config: c.config}\n}", "func (c *YearClient) Query() *YearQuery {\n\treturn &YearQuery{config: c.config}\n}", "func (c *NurseClient) Query() *NurseQuery {\n\treturn &NurseQuery{config: c.config}\n}", "func (q ConstantScoreQuery) Query(query Query) ConstantScoreQuery {\n\tq.query = query\n\tq.filter = nil\n\treturn q\n}", "func (q bookCategoryQuery) One(ctx context.Context, exec boil.ContextExecutor) (*BookCategory, error) {\n\to := &BookCategory{}\n\n\tqueries.SetLimit(q.Query, 1)\n\n\terr := q.Bind(ctx, exec, o)\n\tif err != nil {\n\t\tif errors.Cause(err) == sql.ErrNoRows {\n\t\t\treturn nil, sql.ErrNoRows\n\t\t}\n\t\treturn nil, errors.Wrap(err, \"models: failed to execute a one query for book_category\")\n\t}\n\n\tif err := o.doAfterSelectHooks(ctx, exec); err != nil {\n\t\treturn o, err\n\t}\n\n\treturn o, nil\n}" ]
[ "0.7489099", "0.71321267", "0.67537475", "0.67226964", "0.65766364", "0.65229815", "0.62090784", "0.58004063", "0.5753492", "0.56815994", "0.54617006", "0.5448311", "0.54411", "0.5428136", "0.54185134", "0.54170203", "0.5369139", "0.5360647", "0.5339984", "0.53156716", "0.5301229", "0.5300864", "0.5246625", "0.5246625", "0.5220853", "0.52144", "0.52034616", "0.52002317", "0.51833045", "0.5173921", "0.51710457", "0.5154971", "0.5147119", "0.51428735", "0.5135839", "0.5124395", "0.5112821", "0.50831676", "0.50740373", "0.50714314", "0.50704396", "0.5064032", "0.50532305", "0.50523895", "0.50481254", "0.5043766", "0.50395435", "0.50327784", "0.5006708", "0.49944162", "0.49865207", "0.4981542", "0.49645916", "0.4958659", "0.49535447", "0.49509582", "0.49476117", "0.49467444", "0.49428505", "0.49419147", "0.49400008", "0.4934114", "0.49223638", "0.49094906", "0.4907697", "0.49041262", "0.48894954", "0.48748004", "0.48579887", "0.48572072", "0.48545814", "0.48541853", "0.48433027", "0.48328653", "0.48306957", "0.48202404", "0.48118946", "0.48118946", "0.48113164", "0.4806945", "0.4806654", "0.48038945", "0.48019487", "0.47971493", "0.47884947", "0.47882193", "0.4778482", "0.47739047", "0.47720873", "0.47647357", "0.47592124", "0.47581744", "0.4756677", "0.4745867", "0.4742795", "0.47294125", "0.47228318", "0.4722162", "0.47195825", "0.47167686" ]
0.7303433
1
Get returns a Category entity by its id.
func (c *CategoryClient) Get(ctx context.Context, id int) (*Category, error) { return c.Query().Where(category.ID(id)).Only(ctx) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (s *CategoryService) Get(rs app.RequestScope, id int) (*models.Category, error) {\n\treturn s.dao.Get(rs, id)\n}", "func (cm *CategoryMap) Get(id int) (c *Category) {\n\treturn cm.cats[id]\n}", "func Get(c *gin.Context){\n\tidStr := c.Query(\"id\")\n\tid, err := strconv.Atoi(idStr)\n\tif err != nil {\n\t\tresponese.Error(c, err, nil)\n\t\treturn\n\t}\n\tca := Category{ID:id}\n\terr = ca.Read()\n\tif err != nil {\n\t\tresponese.Error(c, err, nil)\n\t\treturn\n\t}\n\tresponese.Success(c, \"successed\", &ca)\n}", "func GetCategory(id bson.ObjectId) (Category, error) {\n\tvar (\n\t\terr error\n\t\tcategory Category\n\t)\n\n\tc := newCategoryCollection()\n\tdefer c.Close()\n\n\terr = c.Session.FindId(id).One(&category)\n\tif err != nil {\n\t\treturn category, err\n\t}\n\n\treturn category, err\n}", "func GetCategory(db *sql.DB, id int) (Category, error) {\n\tvar category Category\n\terr := db.QueryRow(`SELECT c.id, c.name FROM category c WHERE id = ($1)`,\n\t\tid).Scan(&category.ID, &category.Name)\n\n\tif err != nil {\n\t\treturn category, err\n\t}\n\n\treturn category, nil\n\n}", "func (c Controller) Category(id int) (*model.Category, error) {\n\treturn c.CategoriesRepository.Get(id, \"\")\n}", "func (a Category) GetByID(id string) (Category, error) {\n\tvar (\n\t\tdata Category\n\t\terr error\n\t)\n\n\ttx := gorm.MysqlConn().Begin()\n\tif err = tx.Find(&data, \"id = ?\", id).Error; err != nil {\n\t\ttx.Rollback()\n\t\treturn data, err\n\t}\n\ttx.Commit()\n\n\treturn data, err\n}", "func (h *CategoryHandler) GetByID(ctx iris.Context) {\n\tid := ctx.Params().GetInt64Default(\"id\", 0)\n\n\tvar cat entity.Category\n\terr := h.service.GetByID(ctx.Request().Context(), &cat, id)\n\tif err != nil {\n\t\tif err == sql.ErrNoRows {\n\t\t\twriteEntityNotFound(ctx)\n\t\t\treturn\n\t\t}\n\n\t\tdebugf(\"CategoryHandler.GetByID(id=%d): %v\", id, err)\n\t\twriteInternalServerError(ctx)\n\t\treturn\n\t}\n\n\tctx.JSON(cat)\n}", "func (c *MongoCatalog) Get(id uuid.UUID) (cat models.Cat, err error) {\n\terr = c.collection.FindOne(context.Background(), bson.M{\"id\": id}).Decode(&cat)\n\tif err != nil {\n\t\treturn models.Cat{}, err\n\t}\n\n\treturn cat, nil\n}", "func (r *ContentCategoriesService) Get(profileId int64, id int64) *ContentCategoriesGetCall {\n\tc := &ContentCategoriesGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}\n\tc.profileId = profileId\n\tc.id = id\n\treturn c\n}", "func GetCategoryById (w http.ResponseWriter, r *http.Request) {\n\t//get category id from the link\n\tcategoryID := mux.Vars(r)[\"id\"]\n\n\t//find the category with the given id in the slice\n\tvar givenCategory Category\n\tfor _, singleCategory := range Categories {\n\t\tif singleCategory.CategoryID == categoryID {\n\t\t\tgivenCategory = singleCategory\n\t\t}\n\t}\n\n\t//return the Category information to ResponseWriter\n\t//or log the encoding error\n\tif givenCategory.CategoryID == categoryID {\n\t\tif err := json.NewEncoder(w).Encode(givenCategory); err != nil {\n\t\t\tlog.Printf(err.Error())\n\t\t\tw.WriteHeader(500)\n\t\t\treturn\n\t\t}\n\t} else {\n\t\tw.WriteHeader(412)\n\t\tfmt.Fprintf(w, \"Category with ID %s not found\", categoryID)\n\t}\n}", "func (a *Adapter) Get(ctx context.Context, categoryCode string) (categoryDomain.Category, error) {\n\tt, err := a.categoryRepository.Category(ctx, categoryCode)\n\tif err == categoryDomain.ErrNotFound {\n\t\ta.logger.Warn(err)\n\t\treturn t, err\n\t}\n\tif err != nil {\n\t\ta.logger.Error(err)\n\t}\n\treturn t, err\n}", "func (cRepo *CategoryGormRepo) Category(id uint) (*entity.Category, []error) {\n\tctg := entity.Category{}\n\terrs := cRepo.conn.First(&ctg, id).GetErrors()\n\tif len(errs) > 0 {\n\t\treturn nil, errs\n\t}\n\treturn &ctg, errs\n}", "func (cri *CategoryRepositoryImpl) Category(id int) (entity.Category, error) {\n\n\trow := cri.conn.QueryRow(\"SELECT * FROM categories WHERE id = $1\", id)\n\n\tc := entity.Category{}\n\n\terr := row.Scan(&c.ID, &c.Name, &c.Description, &c.Image)\n\tif err != nil {\n\t\treturn c, err\n\t}\n\n\treturn c, nil\n}", "func GetCategorytByID(id uint64) (*Category, error) {\n\tvar result Category\n\n\tquery := `SELECT * FROM category WHERE cid=?`\n\n\tif err := DB.Get(&result, query, id); err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn &result, nil\n}", "func GetCat(catid uint32) (models.Category, error) {\n\tvar catInfo models.Category\n\n\terr := DB.Where(\"id = ?\", catid).First(&catInfo).Error\n\n\tif err == gorm.ErrRecordNotFound {\n\t\tlog.Info.Println(err)\n\t\treturn catInfo, ErrNotFound\n\t} else if err != nil {\n\t\tlog.Warning.Println(err)\n\t\treturn catInfo, ErrInternal\n\t}\n\treturn catInfo, nil\n}", "func GetSingleCategory(id string) (ModuleCategory.Category, error) {\n\n\tdb := Database.CreateConnection()\n\tdefer db.Close()\n\n\tvar category ModuleCategory.Category\n\n\t// create the select sql query\n\tsqlStatement := `select\n\tcategory_id,\n\tcategory_name,\n\tcategory_description,\n\tcategory_logo,\n\tmodule_id\nfrom\n\tapp_category\nwhere\n\tcategory_id = $1`\n\n\t// execute the sql statement\n\trow := db.QueryRow(sqlStatement, id)\n\n\t// unmarshal the row object to user\n\terr := row.Scan(&category.Catid, &category.Name, &category.Description, &category.Logo, &category.Modid)\n\n\tswitch err {\n\tcase sql.ErrNoRows:\n\t\terr = errors.New(\"Нет данных\")\n\tcase nil:\n\t\treturn category, nil\n\tdefault:\n\t\tlog.Error(err)\n\t\terr = errors.New(\"Ошибка запроса\")\n\t}\n\n\t// return empty module on error\n\treturn category, err\n\n}", "func GetCategory(p providers.CategoryProvider) func(c *fiber.Ctx) error {\n\treturn func(c *fiber.Ctx) error {\n\t\tcategoryID, _ := strconv.Atoi(c.Params(\"id\"))\n\t\tcategory, err := p.CategoryGet(categoryID)\n\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\t// wrapped into array to it works in the template\n\t\tresult := make([]*models.Category, 0)\n\t\tresult = append(result, category)\n\t\treturn c.Render(\"category\", result)\n\t}\n}", "func (service *Service) GetCategoryByCategoryID(request *restful.Request, response *restful.Response) {\n\tcategoryID := request.PathParameter(\"categoryid\")\n\n\tdbResult, err := service.server.GetCategoryByCategoryID(categoryID)\n\tif err == dao.ErrRecordNotFound {\n\t\trespondErr(response, http.StatusNotFound, messageDatabaseError,\n\t\t\t\"unable to retrieve category\")\n\n\t\tlogrus.WithFields(logrus.Fields{\"module\": \"service\", \"resp\": http.StatusNotFound}).\n\t\t\tError(\"Unable to retrieve category:\", err)\n\n\t\treturn\n\t}\n\tif err != nil {\n\t\trespondErr(response, http.StatusInternalServerError, messageDatabaseError,\n\t\t\t\"unable to retrieve category\")\n\n\t\tlogrus.WithFields(logrus.Fields{\"module\": \"service\", \"resp\": http.StatusInternalServerError}).\n\t\t\tError(\"Unable to retrieve category:\", err)\n\n\t\treturn\n\t}\n\n\tresult := &models.GetCategoryResponse{\n\t\tResult: *dbResult,\n\t}\n\n\twriteResponse(response, http.StatusOK, result)\n}", "func (ps CategoryService) FindByID(ID string) *model.Category {\n\treturn ps.Repo.FindByID(ID)\n}", "func GetOne(w http.ResponseWriter, r *http.Request) {\n\tparams := mux.Vars(r)\n\tcategory := categoryrepository.GetByIDWithPosts(params[\"id\"])\n\thandler.RespondJSON(w, http.StatusOK, category)\n}", "func GetCat(catsService service.Cats) echo.HandlerFunc {\n\treturn func(ctx echo.Context) error {\n\t\tidParam := ctx.Param(\"id\")\n\t\tid, err := uuid.Parse(idParam)\n\t\tif err != nil {\n\t\t\treturn echo.NewHTTPError(http.StatusBadRequest)\n\t\t}\n\n\t\tcat, err := catsService.GetOne(ctx.Request().Context(), id)\n\t\tif errors.Is(err, repository.ErrNotFound) {\n\t\t\treturn echo.NewHTTPError(http.StatusNotFound)\n\t\t} else if err != nil {\n\t\t\treturn echo.NewHTTPError(http.StatusInternalServerError, err.Error())\n\t\t}\n\n\t\tresponse := GetCatResponse(mapCat(cat))\n\t\treturn ctx.JSON(http.StatusOK, response)\n\t}\n}", "func CategoryGet(c *gin.Context) {\n\tCategory, err := models.GetCategory(c.Param(\"name\"))\n\tif err != nil {\n\t\tc.HTML(http.StatusNotFound, \"errors/404\", nil)\n\t\treturn\n\t}\n\tvar filter models.DaoFilter\n\tfilter.Category.Name = Category.Name\n\tcount,_ := filter.GetPostsCount()\n\tcurrentPage, _ := strconv.Atoi(c.DefaultQuery(\"p\",\"1\"))\n\tlimit := 10\n\tPagination := helpers.NewPaginator(c,limit,count)\n\tlist, err := filter.GetPostsByPage(currentPage,limit)\n\tif err != nil {\n\t\tc.HTML(http.StatusNotFound, \"errors/404\", nil)\n\t\treturn\n\t}\n\n\th := helpers.DefaultH(c)\n\th[\"Title\"] = Category.Name\n\th[\"Category\"] = Category\n\th[\"Active\"] = \"categories\"\n\th[\"List\"] = list\n\th[\"Pagination\"] = Pagination\n\tc.HTML(http.StatusOK, \"categories/show\", h)\n}", "func (c *CategoryServiceFixed) Get(ctx context.Context, categoryCode string) (domain.Category, error) {\n\tif cat, ok := c.mappedCategories[categoryCode]; ok {\n\t\treturn cat, nil\n\t}\n\treturn nil, domain.ErrNotFound\n}", "func FindCategoriesById(c *gin.Context) {\n\t// Get model if exist\n\tvar categories models.Categories\n\tif err := models.DB.Where(\"id = ?\", c.Param(\"id\")).First(&categories).Error; err != nil {\n\t\tc.JSON(http.StatusBadRequest, gin.H{\"error\": \"Record not found!\"})\n\t\treturn\n\t}\n\n\tc.JSON(http.StatusOK, gin.H{\"data\": categories})\n}", "func (c *BranchClient) Get(ctx context.Context, id int) (*Branch, error) {\n\treturn c.Query().Where(branch.ID(id)).Only(ctx)\n}", "func (o *InlineObject26) GetCategory() MessageCategoriesIdJsonCategory {\n\tif o == nil {\n\t\tvar ret MessageCategoriesIdJsonCategory\n\t\treturn ret\n\t}\n\n\treturn o.Category\n}", "func (m *Model) GetCategoryByID(id int) (*model.Category, error) {\n\treturn m.getCategory(qryGetCategoryByID, id)\n}", "func GetByIDWithPosts(id string) models.Category {\n\tdb.DB.Where(\"id = ?\", id).Preload(\"Posts\").First(&category)\n\treturn category\n}", "func (c *ClinicClient) Get(ctx context.Context, id uuid.UUID) (*Clinic, error) {\n\treturn c.Query().Where(clinic.ID(id)).Only(ctx)\n}", "func (s *CatsService) GetCat(ctx context.Context, request *pb.GetCatRequest) (*pb.GetCatResponse, error) {\n\tid, err := uuid.Parse(request.Id)\n\tif err != nil {\n\t\treturn nil, status.Error(codes.InvalidArgument, err.Error())\n\t}\n\tcat, err := s.service.GetOne(ctx, id)\n\tif errors.Is(err, repository.ErrNotFound) {\n\t\treturn nil, status.Error(codes.NotFound, err.Error())\n\t} else if err != nil {\n\t\treturn nil, status.Error(codes.Internal, err.Error())\n\t}\n\n\tresponse := &pb.GetCatResponse{\n\t\tCat: mapCat(cat),\n\t}\n\treturn response, nil\n}", "func (r *DeviceCategoryRequest) Get(ctx context.Context) (resObj *DeviceCategory, err error) {\n\tvar query string\n\tif r.query != nil {\n\t\tquery = \"?\" + r.query.Encode()\n\t}\n\terr = r.JSONRequest(ctx, \"GET\", query, nil, &resObj)\n\treturn\n}", "func (c *CategoryClient) GetX(ctx context.Context, id int) *Category {\n\tobj, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn obj\n}", "func (c *CitiesManagerImpl) Get(id int32) *api.City {\n\treturn c.cities[id]\n}", "func (categories *Categories) ReadCategoryByID(categoryID, language string) (Category, error) {\n\n\tvariables := struct {\n\t\tCategoryID string\n\t\tLanguage string\n\t}{\n\t\tCategoryID: categoryID,\n\t\tLanguage: language}\n\n\tqueryTemplate, err := template.New(\"ReadCategoryByID\").Parse(`{\n\t\t\t\tcategories(func: uid(\"{{.CategoryID}}\")) @filter(has(categoryName)) {\n\t\t\t\t\tuid\n\t\t\t\t\tcategoryName: categoryName@{{.Language}}\n\t\t\t\t\tcategoryIsActive\n\t\t\t\t\tbelongs_to_company @filter(eq(companyIsActive, true)) {\n\t\t\t\t\t\tuid\n\t\t\t\t\t\tcompanyName: companyName@{{.Language}}\n\t\t\t\t\t\tcompanyIsActive\n\t\t\t\t\t\thas_category @filter(eq(categoryIsActive, true)) {\n\t\t\t\t\t\t\tuid\n\t\t\t\t\t\t\tcategoryName: categoryName@{{.Language}}\n\t\t\t\t\t\t\tcategoryIsActive\n\t\t\t\t\t\t\tbelong_to_company @filter(eq(companyIsActive, true)) {\n\t\t\t\t\t\t\t\tuid\n\t\t\t\t\t\t\t\tcompanyName: companyName@{{.Language}}\n\t\t\t\t\t\t\t\tcompanyIsActive\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\thas_product @filter(eq(productIsActive, true)) {\n\t\t\t\t\t\tuid\n\t\t\t\t\t\tproductName: productName@{{.Language}}\n\t\t\t\t\t\tproductIri\n\t\t\t\t\t\tpreviewImageLink\n\t\t\t\t\t\tproductIsActive\n\t\t\t\t\t\tbelongs_to_category @filter(eq(categoryIsActive, true)) {\n\t\t\t\t\t\t\tuid\n\t\t\t\t\t\t\tcategoryName: categoryName@{{.Language}}\n\t\t\t\t\t\t\tcategoryIsActive\n\t\t\t\t\t\t}\n\t\t\t\t\t\tbelongs_to_company @filter(eq(companyIsActive, true)) {\n\t\t\t\t\t\t\tuid\n\t\t\t\t\t\t\tcompanyName: companyName@{{.Language}}\n\t\t\t\t\t\t\tcompanyIsActive\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}`)\n\n\tcategory := Category{ID: categoryID}\n\n\tif err != nil {\n\t\tlog.Println(err)\n\t\treturn category, ErrCategoryByIDCanNotBeFound\n\t}\n\n\tqueryBuf := bytes.Buffer{}\n\terr = queryTemplate.Execute(&queryBuf, variables)\n\tif err != nil {\n\t\tlog.Println(err)\n\t\treturn category, ErrCategoryByIDCanNotBeFound\n\t}\n\n\ttransaction := categories.storage.Client.NewTxn()\n\tresponse, err := transaction.Query(context.Background(), queryBuf.String())\n\tif err != nil {\n\t\tlog.Println(err)\n\t\treturn category, ErrCategoryByIDCanNotBeFound\n\t}\n\n\ttype categoriesInStore struct {\n\t\tCategories []Category `json:\"categories\"`\n\t}\n\n\tvar foundedCategories categoriesInStore\n\n\terr = json.Unmarshal(response.GetJson(), &foundedCategories)\n\tif err != nil {\n\t\tlog.Println(err)\n\t\treturn category, ErrCategoryByIDCanNotBeFound\n\t}\n\n\tif len(foundedCategories.Categories) == 0 {\n\t\treturn category, ErrCategoryDoesNotExist\n\t}\n\n\treturn foundedCategories.Categories[0], nil\n}", "func (c *ComplaintClient) Get(ctx context.Context, id int) (*Complaint, error) {\n\treturn c.Query().Where(complaint.ID(id)).Only(ctx)\n}", "func (r *DeviceManagementSettingCategoryRequest) Get(ctx context.Context) (resObj *DeviceManagementSettingCategory, err error) {\n\tvar query string\n\tif r.query != nil {\n\t\tquery = \"?\" + r.query.Encode()\n\t}\n\terr = r.JSONRequest(ctx, \"GET\", query, nil, &resObj)\n\treturn\n}", "func Get(id string) (*Course, error) {\n\tcourseBytes, err := db.GetFromBucket([]byte(db.Courses), []byte(id))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tcourse := &Course{}\n\tif err := json.Unmarshal(courseBytes, course); err != nil {\n\t\treturn nil, err\n\t}\n\treturn course, nil\n}", "func (c *FoodmenuClient) Get(ctx context.Context, id int) (*Foodmenu, error) {\n\treturn c.Query().Where(foodmenu.ID(id)).Only(ctx)\n}", "func (p PostgresPersister) SelectOneCategory(id string) (model.Category, error) {\n\tvar dbid int32\n\tfmt.Sscanf(id, p.pathPrefix+model.CategoryIDFormat, &dbid)\n\tvar cat model.Category\n\tlog.Printf(\"[DEBUG] id: %s, dbid: %d\", id, dbid)\n\terr := p.db.QueryRow(\"SELECT id, body, insert_time, last_update_time FROM category WHERE id=$1\", dbid).Scan(\n\t\t&dbid,\n\t\t&cat.CategoryBody,\n\t\t&cat.InsertTime,\n\t\t&cat.LastUpdateTime,\n\t)\n\tif err != nil {\n\t\treturn cat, translateError(err)\n\t}\n\tcat.ID = p.pathPrefix + fmt.Sprintf(model.CategoryIDFormat, dbid)\n\tcat.Type = \"category\"\n\treturn cat, nil\n}", "func (c *DisciplineClient) Get(ctx context.Context, id int) (*Discipline, error) {\n\treturn c.Query().Where(discipline.ID(id)).Only(ctx)\n}", "func (s *CategoryService) Delete(rs app.RequestScope, id int) (*models.Category, error) {\n\tcategory, err := s.dao.Get(rs, id)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\terr = s.dao.Delete(rs, id)\n\treturn category, err\n}", "func (c *DoctorClient) Get(ctx context.Context, id int) (*Doctor, error) {\n\treturn c.Query().Where(doctor.ID(id)).Only(ctx)\n}", "func (c *ClubClient) Get(ctx context.Context, id int) (*Club, error) {\n\treturn c.Query().Where(club.ID(id)).Only(ctx)\n}", "func (repository *CategoryRepositoryMock) FindById(id string) *entity.Category {\n\n\t// bikin program untuk si mock nya\n\t// panggil Mocknya dan masukkan parameter sesuai dengan parameter yang ada di function yang dibuatkan mock\n\t// balikannya adalah argument\n\targuments := repository.Mock.Called(id)\n\n\t// karena balikannya bisa nil, maka kita harus cek dulu\n\tif arguments.Get(0) == nil {\n\t\treturn nil\n\t} else {\n\t\t// jika return nya tidak sama dengan nil, maka kita balikkan data category nya\n\t\tcategory := arguments.Get(0).(entity.Category)\n\t\t// karena category ini adalah pointer, maka kita tambahkan &\n\t\treturn &category\n\t}\n\n}", "func (c *CompanyClient) Get(ctx context.Context, id int) (*Company, error) {\n\treturn c.Query().Where(company.ID(id)).Only(ctx)\n}", "func (c *CompanyClient) Get(ctx context.Context, id int) (*Company, error) {\n\treturn c.Query().Where(company.ID(id)).Only(ctx)\n}", "func (c *Crawler) Get(id string) error {\n\tsession := mongoSession.Clone()\n\tdefer session.Close()\n\tcollection := session.DB(mongoDialInfo.Database).C(crawlersCollectionName)\n\t// TODO: handle error\n\tif !bson.IsObjectIdHex(id) {\n\t\treturn errors.New(\"Invalid Object ID\")\n\t}\n\tobjectID := bson.ObjectIdHex(id)\n\terr := collection.FindId(objectID).One(c)\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "func (cs *CoverService) Get(id int, opts ...Option) (*Cover, error) {\n\tif id < 0 {\n\t\treturn nil, ErrNegativeID\n\t}\n\n\tvar cov []*Cover\n\n\topts = append(opts, SetFilter(\"id\", OpEquals, strconv.Itoa(id)))\n\terr := cs.client.post(cs.end, &cov, opts...)\n\tif err != nil {\n\t\treturn nil, errors.Wrapf(err, \"cannot get Cover with ID %v\", id)\n\t}\n\n\treturn cov[0], nil\n}", "func (m *ThreatAssessmentRequest) GetCategory()(*ThreatCategory) {\n val, err := m.GetBackingStore().Get(\"category\")\n if err != nil {\n panic(err)\n }\n if val != nil {\n return val.(*ThreatCategory)\n }\n return nil\n}", "func (c *ClubBranchClient) Get(ctx context.Context, id int) (*ClubBranch, error) {\n\treturn c.Query().Where(clubbranch.ID(id)).Only(ctx)\n}", "func (r *DeviceManagementIntentSettingCategoryRequest) Get(ctx context.Context) (resObj *DeviceManagementIntentSettingCategory, err error) {\n\tvar query string\n\tif r.query != nil {\n\t\tquery = \"?\" + r.query.Encode()\n\t}\n\terr = r.JSONRequest(ctx, \"GET\", query, nil, &resObj)\n\treturn\n}", "func (c *DentistClient) Get(ctx context.Context, id int) (*Dentist, error) {\n\treturn c.Query().Where(dentist.ID(id)).Only(ctx)\n}", "func (r *ClassificationRepo) Get(ctx context.Context, id strfmt.UUID) (*models.Classification, error) {\n\tres, err := r.client.Get(ctx, classificationKeyFromID(id))\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"could not retrieve key '%s' from etcd: %v\",\n\t\t\tclassificationKeyFromID(id), err)\n\t}\n\n\tswitch k := len(res.Kvs); {\n\tcase k == 0:\n\t\treturn nil, nil\n\tcase k == 1:\n\t\treturn r.unmarshalClassification(res.Kvs[0].Value)\n\tdefault:\n\t\treturn nil, fmt.Errorf(\"unexpected number of results for key '%s', \"+\n\t\t\t\"expected to have 0 or 1, but got %d: %#v\", classificationKeyFromID(id),\n\t\t\tlen(res.Kvs), res.Kvs)\n\t}\n}", "func (clgCtl *CatalogueController) GetByID(w http.ResponseWriter, r *http.Request) {\n\tparams := mux.Vars(r)\n\tcode := params[\"id\"]\n\n\tlog.Printf(\"Retrieving Catalogue '%v'.\\n\", code)\n\n\tclgRepo := cataloguerepository.NewCatalogueRepository()\n\tresult, err := clgRepo.GetByID(r.Context(), code)\n\tif err != nil {\n\t\tclgCtl.WriteResponse(w, http.StatusInternalServerError, false, nil, err.Error())\n\t\treturn\n\t}\n\n\tclgCtl.WriteResponse(w, http.StatusOK, true, result, \"\")\n}", "func (m ComicsModel) Get(id int64) (*Comics, error) {\n\tif id < 1 {\n\t\treturn nil, ErrRecordNotFound\n\t}\n\tquery := `SELECT id, created_at, title, year, pages, version\n\t\t\tFROM comics\n\t\t\tWHERE id = $1`\n\n\tvar comics Comics\n\tctx, cancel := context.WithTimeout(context.Background(), 3*time.Second)\n\n\tdefer cancel()\n\n\terr := m.DB.QueryRowContext(ctx, query, id).Scan(\n\t\t&comics.ID,\n\t\t&comics.CreatedAt,\n\t\t&comics.Title,\n\t\t&comics.Year,\n\t\t&comics.Pages,\n\t\t&comics.Version,\n\t)\n\tif err != nil {\n\t\tswitch {\n\t\tcase errors.Is(err, sql.ErrNoRows):\n\t\t\treturn nil, ErrRecordNotFound\n\t\tdefault:\n\t\t\treturn nil, err\n\t\t}\n\t}\n\treturn &comics, nil\n}", "func GetCategoryById(category string) int {\n\tstmt := \"select id from category where name=?\"\n\trows := database.query(stmt, category)\n\tvar categoryID int\n\n\tfor rows.Next() {\n\t\terr := rows.Scan(&categoryID)\n\t\tif err != nil {\n\t\t\tlog.Println(err)\n\t\t}\n\t}\n\treturn categoryID\n}", "func (m *MockIDb) GetCategoryById(id int64) (*model.Category, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"GetCategoryById\", id)\n\tret0, _ := ret[0].(*model.Category)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "func (h *ProductHandler) GetByID(w http.ResponseWriter, r *http.Request) {\n\tparams := r.URL.Query()\n\tid, err := strconv.ParseInt(params.Get(\"id\"), 0, 64)\n\n\tif err != nil {\n\t\tutils.Error(w, http.StatusBadRequest, err.Error())\n\t\treturn\n\t}\n\n\tctx := r.Context()\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\n\tproduct, err := h.ProductUsecase.GetByID(ctx, id)\n\tcats := make([]*models.Category, 0)\n\n\tif err != nil {\n\t\tutils.Error(w, http.StatusBadRequest, err.Error())\n\t\treturn\n\t}\n\n\tpCats, err := h.ProductCatUsecase.GetByProductID(ctx, product.ID)\n\n\tif err != nil {\n\t\tutils.Error(w, http.StatusBadRequest, err.Error())\n\t\treturn\n\t}\n\n\tfor _, pCat := range pCats {\n\t\tcat, err := h.CategoryUsecase.GetByID(ctx, pCat.CategoryID)\n\t\tif err != nil {\n\t\t\tcontinue\n\t\t}\n\n\t\tcats = append(cats, cat)\n\t}\n\n\tresult := t.Product{\n\t\tID: product.ID,\n\t\tName: product.Name,\n\t\tSKU: product.SKU,\n\t\tCategory: cats,\n\t}\n\n\tutils.JSON(w, http.StatusOK, result)\n}", "func (a Author) Get(cfg *config.Config, id string) (Author, error) {\n\tvar author Author\n\tsession := cfg.Session.Copy()\n\tif err := cfg.Database.C(AuthorCollection).Find(bson.M{\"_id\": id}).One(&author); err != nil {\n\t\treturn author, err\n\t}\n\tdefer session.Close()\n\treturn author, nil\n}", "func (c *CardClient) Get(ctx context.Context, id int) (*Card, error) {\n\treturn c.Query().Where(card.ID(id)).Only(ctx)\n}", "func (r *CategoryRepository) CategoryByID(id string) (*product.Category, error) {\n\tvar (\n\t\tname string\n\t)\n\terr := r.db.QueryRow(\"SELECT name FROM categories WHERE id = ?\", id).Scan(&name)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn product.NewCategory(id, name)\n}", "func (e Endpoints) GetCategory(ctx context.Context) (c []io.TodoCategory, error error) {\n\trequest := GetCategoryRequest{}\n\tresponse, err := e.GetCategoryEndpoint(ctx, request)\n\tif err != nil {\n\t\treturn\n\t}\n\treturn response.(GetCategoryResponse).C, response.(GetCategoryResponse).Error\n}", "func (c *StatusdClient) Get(ctx context.Context, id int) (*Statusd, error) {\n\treturn c.Query().Where(statusd.ID(id)).Only(ctx)\n}", "func (c *TagClient) Get(ctx context.Context, id int) (*Tag, error) {\n\treturn c.Query().Where(tag.ID(id)).Only(ctx)\n}", "func (r *DeviceManagementTemplateSettingCategoryRequest) Get(ctx context.Context) (resObj *DeviceManagementTemplateSettingCategory, err error) {\n\tvar query string\n\tif r.query != nil {\n\t\tquery = \"?\" + r.query.Encode()\n\t}\n\terr = r.JSONRequest(ctx, \"GET\", query, nil, &resObj)\n\treturn\n}", "func (c *DepositClient) Get(ctx context.Context, id int) (*Deposit, error) {\n\treturn c.Query().Where(deposit.ID(id)).Only(ctx)\n}", "func (c *CleaningroomClient) Get(ctx context.Context, id int) (*Cleaningroom, error) {\n\treturn c.Query().Where(cleaningroom.ID(id)).Only(ctx)\n}", "func (c *ClubTypeClient) Get(ctx context.Context, id int) (*ClubType, error) {\n\treturn c.Query().Where(clubtype.ID(id)).Only(ctx)\n}", "func (a *Client) GetForCategory(params *GetForCategoryParams, authInfo runtime.ClientAuthInfoWriter) (*GetForCategoryOK, error) {\n\t// TODO: Validate the params before sending\n\tif params == nil {\n\t\tparams = NewGetForCategoryParams()\n\t}\n\n\tresult, err := a.transport.Submit(&runtime.ClientOperation{\n\t\tID: \"GetForCategory\",\n\t\tMethod: \"GET\",\n\t\tPathPattern: \"/api/v1/UsageCost/resellerCustomer/{resellerCustomerId}/subscription/{subscriptionId}/category/{category}/currency/{currencyCode}\",\n\t\tProducesMediaTypes: []string{\"application/json\", \"text/json\", \"text/plain\"},\n\t\tConsumesMediaTypes: []string{\"application/json\"},\n\t\tSchemes: []string{\"https\"},\n\t\tParams: params,\n\t\tReader: &GetForCategoryReader{formats: a.formats},\n\t\tAuthInfo: authInfo,\n\t\tContext: params.Context,\n\t\tClient: params.HTTPClient,\n\t})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tsuccess, ok := result.(*GetForCategoryOK)\n\tif ok {\n\t\treturn success, nil\n\t}\n\t// unexpected success response\n\t// safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue\n\tmsg := fmt.Sprintf(\"unexpected success response for GetForCategory: API contract not enforced by server. Client expected to get an error, but got: %T\", result)\n\tpanic(msg)\n}", "func (Samarium) GetCategory() string {\n\tvar c categoryType = lanthanoid\n\treturn c.get()\n}", "func (Lawrencium) GetCategory() string {\n\tvar c categoryType = actinoid\n\treturn c.get()\n}", "func (Tellurium) GetCategory() string {\n\tvar c categoryType = metalloid\n\treturn c.get()\n}", "func (o *SoftwarerepositoryCategoryMapper) GetCategory() string {\n\tif o == nil || o.Category == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\treturn *o.Category\n}", "func (c *FacultyClient) Get(ctx context.Context, id int) (*Faculty, error) {\n\treturn c.Query().Where(faculty.ID(id)).Only(ctx)\n}", "func (c *ComplaintTypeClient) Get(ctx context.Context, id int) (*ComplaintType, error) {\n\treturn c.Query().Where(complainttype.ID(id)).Only(ctx)\n}", "func (o *BulletinDTO) GetCategory() string {\n\tif o == nil || o.Category == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\treturn *o.Category\n}", "func (c *TitleClient) Get(ctx context.Context, id int) (*Title, error) {\n\treturn c.Query().Where(title.ID(id)).Only(ctx)\n}", "func (c *CleanernameClient) Get(ctx context.Context, id int) (*Cleanername, error) {\n\treturn c.Query().Where(cleanername.ID(id)).Only(ctx)\n}", "func (r repository) Get(ctx context.Context, id string) (entity.Link, error) {\n\tvar link entity.Link\n\terr := r.db.With(ctx).Select().Model(id, &link)\n\treturn link, err\n}", "func (c *_NetworkCategoryCache) Get() networkcategory.NetworkCategory {\n\tnetworkCategory, ok := c.neverDirectRW_atomic_networkCategory.Load().(networkcategory.NetworkCategory)\n\t// Just use cache if it is valid\n\tif ok && networkCategory != \"\" {\n\t\treturn networkCategory\n\t}\n\n\t// Otherwise, return value in networkcategory module\n\treturn networkcategory.Get()\n}", "func (c *ConversationsRepo) GetByID(id string) (*models.Conversation, error) {\n conversation := models.Conversation{}\n err := c.DB.Model(&conversation).Where(\"id = ?\", id).Select()\n if err != nil {\n return nil, err\n }\n return &conversation, nil\n}", "func (Fermium) GetCategory() string {\n\tvar c categoryType = actinoid\n\treturn c.get()\n}", "func (c *PostClient) Get(ctx context.Context, id int) (*Post, error) {\n\treturn c.Query().Where(post.ID(id)).Only(ctx)\n}", "func (u DomainDao) Get(id int) model.Domain {\n\tvar domain model.Domain\n\tdb := GetDb()\n\tdb.Where(\"id = ?\", id).First(&domain)\n\treturn domain\n}", "func (c *DispenseMedicineClient) Get(ctx context.Context, id int) (*DispenseMedicine, error) {\n\treturn c.Query().Where(dispensemedicine.ID(id)).Only(ctx)\n}", "func (c *BuildingClient) Get(ctx context.Context, id int) (*Building, error) {\n\treturn c.Query().Where(building.ID(id)).Only(ctx)\n}", "func (c *CoinInfoClient) Get(ctx context.Context, id int32) (*CoinInfo, error) {\n\treturn c.Query().Where(coininfo.ID(id)).Only(ctx)\n}", "func (t *TopicService) Get(id string) (*Topic, error) {\n\tquery := `\n\tquery ($id: ID){\n\t\ttopic(id: $id){\n\t\t\tid,\n\t\t\tname,\n\t\t\tdescription,\n\t\t\tposts{id, title},\n\t\t\thierarchy,\n\t\t\tparent{id},\n\t\t\tancestors{id},\n\t\t\tchildren{id},\n\t\t\tinsertedAt,\n\t\t\tupdatedAt\n\t\t}\n\t}`\n\tvar resp struct {\n\t\tTopic *Topic `json:\"topic\"`\n\t}\n\tvars := map[string]interface{}{\"id\": id}\n\terr := t.client.Do(context.Background(), query, vars, &resp)\n\treturn resp.Topic, err\n}", "func (m newsManager) Get(id int) News {\n\treturn getOneNews(\"Some news\", \"Some text\")\n}", "func (c *SituationClient) Get(ctx context.Context, id int) (*Situation, error) {\n\treturn c.Query().Where(situation.ID(id)).Only(ctx)\n}", "func (c *MedicineClient) Get(ctx context.Context, id int) (*Medicine, error) {\n\treturn c.Query().Where(medicine.ID(id)).Only(ctx)\n}", "func Get(recipe *models.RecipeModel, id string) (err error) {\n\tif err = Config.DB.Where(\"id = ?\", id).First(recipe).Error; err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "func (s *CategoryService) Update(rs app.RequestScope, id int, model *models.Category) (*models.Category, error) {\n\tif err := model.Validate(); err != nil {\n\t\treturn nil, err\n\t}\n\tif err := s.dao.Update(rs, id, model); err != nil {\n\t\treturn nil, err\n\t}\n\treturn s.dao.Get(rs, id)\n}", "func (c *ActivitiesClient) Get(ctx context.Context, id int) (*Activities, error) {\n\treturn c.Query().Where(activities.ID(id)).Only(ctx)\n}", "func (s Store) Get(id []byte) (perm.AccessControl, error) {\n\treturn accessControl{}, nil\n}", "func (client *Client) GetCategory(alias string, request CategoriesSearchParam) (response CategoryDetailResponse, err error) {\n\turl := fmt.Sprintf(\"/categories/%s\", alias)\n\n\tif err := client.query(url, &request, &response); err != nil {\n\t\treturn response, err\n\t}\n\treturn response, nil\n\n}", "func (i ID) Category() Category {\n\treturn Category((i.Raw() & CategoryMask) >> BitwidthReserved)\n}", "func (s ArticleService) Get(ctx context.Context, id string) (*Article, error) {\n\tstat := `SELECT id, title, description, content FROM articles WHERE id = ?;`\n\tif s.DB == nil {\n\t\tpanic(\"no existing database\")\n\t}\n\trows, err := s.DB.QueryContext(ctx, stat, id)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer rows.Close()\n\n\tvar article Article\n\tif rows.Next() {\n\t\terr := rows.Scan(&article.ID, &article.Title, &article.Desc, &article.Content)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\treturn &article, err\n}", "func (soca *SongCategory) GetId() dna.Int {\n\treturn 0\n}" ]
[ "0.84463114", "0.77075183", "0.7542808", "0.741544", "0.7215322", "0.71161306", "0.70049906", "0.70000917", "0.6990766", "0.6986258", "0.69820666", "0.69241387", "0.68801886", "0.6801657", "0.66955495", "0.66810966", "0.65194285", "0.6449452", "0.6431924", "0.63842183", "0.6358032", "0.6264058", "0.6153773", "0.6106529", "0.6088429", "0.6081366", "0.6069858", "0.60584754", "0.60457397", "0.6026446", "0.6013674", "0.59971535", "0.59736663", "0.59231174", "0.59040666", "0.589298", "0.5887382", "0.58758706", "0.58543587", "0.5848926", "0.58163667", "0.5813778", "0.57653403", "0.57254505", "0.5714337", "0.57057935", "0.57057935", "0.568942", "0.5683251", "0.567977", "0.56599253", "0.5644302", "0.5634306", "0.5617435", "0.5601293", "0.55813205", "0.5575029", "0.5570141", "0.55671465", "0.55593365", "0.554351", "0.5541728", "0.5526207", "0.552045", "0.5515496", "0.5499868", "0.54950225", "0.54949737", "0.5476995", "0.54748875", "0.546331", "0.5459833", "0.54573166", "0.5454355", "0.5452986", "0.5451819", "0.54485697", "0.54285896", "0.540289", "0.54004085", "0.53990054", "0.53698707", "0.53625655", "0.53481174", "0.534739", "0.5345721", "0.5338705", "0.5336481", "0.53358406", "0.53250283", "0.53177446", "0.53128386", "0.53083074", "0.53077996", "0.52996075", "0.52917415", "0.5282933", "0.5279685", "0.5277136", "0.5276637" ]
0.83796114
1
GetX is like Get, but panics if an error occurs.
func (c *CategoryClient) GetX(ctx context.Context, id int) *Category { obj, err := c.Get(ctx, id) if err != nil { panic(err) } return obj }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (c *StatustClient) GetX(ctx context.Context, id int) *Statust {\n\ts, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn s\n}", "func (c *OperativeClient) GetX(ctx context.Context, id int) *Operative {\n\to, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn o\n}", "func (c *StaytypeClient) GetX(ctx context.Context, id int) *Staytype {\n\ts, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn s\n}", "func (c *LevelOfDangerousClient) GetX(ctx context.Context, id int) *LevelOfDangerous {\n\tlod, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn lod\n}", "func (c *DentistClient) GetX(ctx context.Context, id int) *Dentist {\n\td, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn d\n}", "func (c *ToolClient) GetX(ctx context.Context, id int) *Tool {\n\tt, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn t\n}", "func (c *IPClient) GetX(ctx context.Context, id uuid.UUID) *IP {\n\tobj, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn obj\n}", "func (c *BeerClient) GetX(ctx context.Context, id int) *Beer {\n\tobj, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn obj\n}", "func (c *PhysicianClient) GetX(ctx context.Context, id int) *Physician {\n\tph, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn ph\n}", "func (c *PhysicianClient) GetX(ctx context.Context, id int) *Physician {\n\tph, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn ph\n}", "func (c *PharmacistClient) GetX(ctx context.Context, id int) *Pharmacist {\n\tph, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn ph\n}", "func (c *EmptyClient) GetX(ctx context.Context, id int) *Empty {\n\tobj, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn obj\n}", "func (c *OperationClient) GetX(ctx context.Context, id uuid.UUID) *Operation {\n\tobj, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn obj\n}", "func (c *NurseClient) GetX(ctx context.Context, id int) *Nurse {\n\tn, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn n\n}", "func (c *PatientInfoClient) GetX(ctx context.Context, id int) *PatientInfo {\n\tpi, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn pi\n}", "func (c *ClinicClient) GetX(ctx context.Context, id uuid.UUID) *Clinic {\n\tobj, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn obj\n}", "func (c *LeaseClient) GetX(ctx context.Context, id int) *Lease {\n\tl, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn l\n}", "func (c *ModuleVersionClient) GetX(ctx context.Context, id int) *ModuleVersion {\n\tmv, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn mv\n}", "func (c *PetruleClient) GetX(ctx context.Context, id int) *Petrule {\n\tpe, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn pe\n}", "func (c *KeyStoreClient) GetX(ctx context.Context, id int32) *KeyStore {\n\tobj, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn obj\n}", "func (c *SituationClient) GetX(ctx context.Context, id int) *Situation {\n\ts, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn s\n}", "func (c *MedicineClient) GetX(ctx context.Context, id int) *Medicine {\n\tm, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn m\n}", "func (c *RepairinvoiceClient) GetX(ctx context.Context, id int) *Repairinvoice {\n\tr, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn r\n}", "func (c *BillClient) GetX(ctx context.Context, id int) *Bill {\n\tb, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn b\n}", "func (c *BillClient) GetX(ctx context.Context, id int) *Bill {\n\tb, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn b\n}", "func (c *BillClient) GetX(ctx context.Context, id int) *Bill {\n\tb, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn b\n}", "func (c *OperativerecordClient) GetX(ctx context.Context, id int) *Operativerecord {\n\to, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn o\n}", "func (c *ReturninvoiceClient) GetX(ctx context.Context, id int) *Returninvoice {\n\tr, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn r\n}", "func (c *CleanernameClient) GetX(ctx context.Context, id int) *Cleanername {\n\tcl, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn cl\n}", "func (c *AdminClient) GetX(ctx context.Context, id int) *Admin {\n\tobj, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn obj\n}", "func (c *RepairInvoiceClient) GetX(ctx context.Context, id int) *RepairInvoice {\n\tri, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn ri\n}", "func (c *ComplaintClient) GetX(ctx context.Context, id int) *Complaint {\n\tco, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn co\n}", "func (c *DNSBLQueryClient) GetX(ctx context.Context, id uuid.UUID) *DNSBLQuery {\n\tobj, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn obj\n}", "func (c *ModuleClient) GetX(ctx context.Context, id int) *Module {\n\tm, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn m\n}", "func (c *MedicineTypeClient) GetX(ctx context.Context, id int) *MedicineType {\n\tmt, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn mt\n}", "func (c *BuildingClient) GetX(ctx context.Context, id int) *Building {\n\tb, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn b\n}", "func (c *DeviceClient) GetX(ctx context.Context, id int) *Device {\n\td, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn d\n}", "func (c *PatientClient) GetX(ctx context.Context, id int) *Patient {\n\tpa, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn pa\n}", "func (c *PatientClient) GetX(ctx context.Context, id int) *Patient {\n\tpa, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn pa\n}", "func (c *PatientClient) GetX(ctx context.Context, id int) *Patient {\n\tpa, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn pa\n}", "func (c *RoomuseClient) GetX(ctx context.Context, id int) *Roomuse {\n\tr, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn r\n}", "func (c *UserClient) GetX(ctx context.Context, id int) *User {\n\tu, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn u\n}", "func (c *UserClient) GetX(ctx context.Context, id int) *User {\n\tu, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn u\n}", "func (c *UserClient) GetX(ctx context.Context, id int) *User {\n\tu, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn u\n}", "func (c *UserClient) GetX(ctx context.Context, id int) *User {\n\tu, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn u\n}", "func (c *UserClient) GetX(ctx context.Context, id int) *User {\n\tu, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn u\n}", "func (c *UserClient) GetX(ctx context.Context, id int) *User {\n\tu, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn u\n}", "func (c *StatusdClient) GetX(ctx context.Context, id int) *Statusd {\n\ts, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn s\n}", "func (c *UserClient) GetX(ctx context.Context, id int64) *User {\n\tobj, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn obj\n}", "func (c *PlanetClient) GetX(ctx context.Context, id int) *Planet {\n\tpl, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn pl\n}", "func (c *PurposeClient) GetX(ctx context.Context, id int) *Purpose {\n\tpu, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn pu\n}", "func (c *TransactionClient) GetX(ctx context.Context, id int32) *Transaction {\n\tobj, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn obj\n}", "func (c *LengthtimeClient) GetX(ctx context.Context, id int) *Lengthtime {\n\tl, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn l\n}", "func (c *VeterinarianClient) GetX(ctx context.Context, id uuid.UUID) *Veterinarian {\n\tobj, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn obj\n}", "func (c *UserClient) GetX(ctx context.Context, id int) *User {\n\tobj, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn obj\n}", "func (c *UserClient) GetX(ctx context.Context, id int) *User {\n\tobj, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn obj\n}", "func (c *UsertypeClient) GetX(ctx context.Context, id int) *Usertype {\n\tu, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn u\n}", "func (c *PrescriptionClient) GetX(ctx context.Context, id int) *Prescription {\n\tpr, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn pr\n}", "func (c *PaymentClient) GetX(ctx context.Context, id int) *Payment {\n\tpa, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn pa\n}", "func (c *PaymentClient) GetX(ctx context.Context, id int) *Payment {\n\tpa, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn pa\n}", "func (c *WorkExperienceClient) GetX(ctx context.Context, id int) *WorkExperience {\n\tobj, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn obj\n}", "func (c *DNSBLResponseClient) GetX(ctx context.Context, id uuid.UUID) *DNSBLResponse {\n\tobj, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn obj\n}", "func (c *UserClient) GetX(ctx context.Context, id uuid.UUID) *User {\n\tobj, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn obj\n}", "func (c *UserClient) GetX(ctx context.Context, id uuid.UUID) *User {\n\tobj, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn obj\n}", "func (c *OperationroomClient) GetX(ctx context.Context, id int) *Operationroom {\n\to, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn o\n}", "func (c *PatientofphysicianClient) GetX(ctx context.Context, id int) *Patientofphysician {\n\tpa, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn pa\n}", "func (c *PositionInPharmacistClient) GetX(ctx context.Context, id int) *PositionInPharmacist {\n\tpip, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn pip\n}", "func (c *CleaningroomClient) GetX(ctx context.Context, id int) *Cleaningroom {\n\tcl, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn cl\n}", "func (c *DoctorClient) GetX(ctx context.Context, id int) *Doctor {\n\td, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn d\n}", "func (c *StatusRClient) GetX(ctx context.Context, id int) *StatusR {\n\ts, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn s\n}", "func (c *SymptomClient) GetX(ctx context.Context, id int) *Symptom {\n\ts, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn s\n}", "func (c *TagClient) GetX(ctx context.Context, id int) *Tag {\n\tobj, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn obj\n}", "func (c *CoinInfoClient) GetX(ctx context.Context, id int32) *CoinInfo {\n\tobj, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn obj\n}", "func (c *WifiClient) GetX(ctx context.Context, id int) *Wifi {\n\tw, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn w\n}", "func (c *UnitOfMedicineClient) GetX(ctx context.Context, id int) *UnitOfMedicine {\n\tuom, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn uom\n}", "func (c *EmployeeClient) GetX(ctx context.Context, id int) *Employee {\n\te, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn e\n}", "func (c *EmployeeClient) GetX(ctx context.Context, id int) *Employee {\n\te, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn e\n}", "func (c *EmployeeClient) GetX(ctx context.Context, id int) *Employee {\n\te, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn e\n}", "func (c *YearClient) GetX(ctx context.Context, id int) *Year {\n\ty, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn y\n}", "func (x *V) Get(params ...interface{}) (*V, error) {\n\tif false == x.initialized {\n\t\treturn nil, errNotInitialized\n\t}\n\tif 0 == len(params) {\n\t\treturn nil, errNilParameter\n\t}\n\treturn x.getOrCreate(false, params...)\n}", "func (c *OrderClient) GetX(ctx context.Context, id int) *Order {\n\to, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn o\n}", "func (c *FoodmenuClient) GetX(ctx context.Context, id int) *Foodmenu {\n\tf, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn f\n}", "func (c *DispenseMedicineClient) GetX(ctx context.Context, id int) *DispenseMedicine {\n\tdm, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn dm\n}", "func (c *SkillClient) GetX(ctx context.Context, id int) *Skill {\n\tobj, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn obj\n}", "func (c *TitleClient) GetX(ctx context.Context, id int) *Title {\n\tt, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn t\n}", "func (c *CustomerClient) GetX(ctx context.Context, id uuid.UUID) *Customer {\n\tobj, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn obj\n}", "func Get(ctx *grumble.Context) error {\n\tclient, execCtx, cancel := newClientAndCtx(ctx, 5*time.Second)\n\tdefer cancel()\n\tval, err := client.Get(execCtx, &ldProto.Key{Key: ctx.Args.String(\"key\")})\n\tif err != nil || val.Key == \"\" {\n\t\treturn err\n\t}\n\treturn exec(ctx, handleKeyValueReturned(val))\n}", "func (_HelloWorld *HelloWorldCaller) Get(opts *bind.CallOpts) (string, error) {\n\tvar (\n\t\tret0 = new(string)\n\t)\n\tout := ret0\n\terr := _HelloWorld.contract.Call(opts, out, \"get\")\n\treturn *ret0, err\n}", "func (c *PostClient) GetX(ctx context.Context, id int) *Post {\n\tobj, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn obj\n}", "func (c *BillingstatusClient) GetX(ctx context.Context, id int) *Billingstatus {\n\tb, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn b\n}", "func (c *RentalstatusClient) GetX(ctx context.Context, id int) *Rentalstatus {\n\tr, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn r\n}", "func (c *UserWalletClient) GetX(ctx context.Context, id int64) *UserWallet {\n\tobj, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn obj\n}", "func (c *SessionClient) GetX(ctx context.Context, id int) *Session {\n\ts, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn s\n}", "func (c *ReviewClient) GetX(ctx context.Context, id int32) *Review {\n\tobj, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn obj\n}", "func (c *BookingClient) GetX(ctx context.Context, id int) *Booking {\n\tb, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn b\n}", "func (c *RoomdetailClient) GetX(ctx context.Context, id int) *Roomdetail {\n\tr, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn r\n}", "func (c *EventClient) GetX(ctx context.Context, id int) *Event {\n\tobj, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn obj\n}", "func (c *PositionassingmentClient) GetX(ctx context.Context, id int) *Positionassingment {\n\tpo, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn po\n}", "func (c *PatientroomClient) GetX(ctx context.Context, id int) *Patientroom {\n\tpa, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn pa\n}", "func (c *PetClient) GetX(ctx context.Context, id uuid.UUID) *Pet {\n\tobj, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn obj\n}", "func (c *CompanyClient) GetX(ctx context.Context, id int) *Company {\n\tobj, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn obj\n}" ]
[ "0.66496724", "0.66252446", "0.6615732", "0.6588074", "0.65865564", "0.6579172", "0.6565792", "0.6544459", "0.65345156", "0.65345156", "0.6532471", "0.65085334", "0.6506574", "0.6491457", "0.6471564", "0.6469912", "0.6469408", "0.6466656", "0.645947", "0.6424143", "0.63988686", "0.637982", "0.6379801", "0.63662297", "0.63662297", "0.63662297", "0.63648087", "0.6345202", "0.63387924", "0.6316006", "0.6315565", "0.63152325", "0.6307725", "0.63036525", "0.629203", "0.62886506", "0.62833667", "0.6282534", "0.6282534", "0.6282534", "0.6279849", "0.62784874", "0.62784874", "0.62784874", "0.62784874", "0.62784874", "0.62784874", "0.62607205", "0.6258848", "0.6245166", "0.62447625", "0.62445724", "0.6242281", "0.6242096", "0.62413293", "0.62413293", "0.6238969", "0.62387156", "0.6236871", "0.6236871", "0.62318987", "0.62232995", "0.6204355", "0.6204355", "0.6203673", "0.6202973", "0.6202917", "0.6202815", "0.6199118", "0.61942714", "0.6192401", "0.6189043", "0.61758024", "0.6165914", "0.6165194", "0.61619186", "0.61619186", "0.61619186", "0.6155354", "0.61457276", "0.6131832", "0.613054", "0.6127511", "0.61234546", "0.6113966", "0.60981816", "0.6097482", "0.6084122", "0.6083127", "0.60767865", "0.6063842", "0.60482377", "0.6042763", "0.60408664", "0.6039773", "0.6035943", "0.6019771", "0.60111755", "0.60078114", "0.60033286", "0.59983164" ]
0.0
-1
QueryPosts queries the posts edge of a Category.
func (c *CategoryClient) QueryPosts(ca *Category) *PostQuery { query := &PostQuery{config: c.config} query.path = func(ctx context.Context) (fromV *sql.Selector, _ error) { id := ca.ID step := sqlgraph.NewStep( sqlgraph.From(category.Table, category.FieldID, id), sqlgraph.To(post.Table, post.FieldID), sqlgraph.Edge(sqlgraph.O2M, false, category.PostsTable, category.PostsColumn), ) fromV = sqlgraph.Neighbors(ca.driver.Dialect(), step) return fromV, nil } return query }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (c *Category) QueryPosts() *PostQuery {\n\treturn (&CategoryClient{config: c.config}).QueryPosts(c)\n}", "func (c *AdminClient) QueryPosts(a *Admin) *PostQuery {\n\tquery := &PostQuery{config: c.config}\n\tquery.path = func(ctx context.Context) (fromV *sql.Selector, _ error) {\n\t\tid := a.ID\n\t\tstep := sqlgraph.NewStep(\n\t\t\tsqlgraph.From(admin.Table, admin.FieldID, id),\n\t\t\tsqlgraph.To(post.Table, post.FieldID),\n\t\t\tsqlgraph.Edge(sqlgraph.O2M, false, admin.PostsTable, admin.PostsColumn),\n\t\t)\n\t\tfromV = sqlgraph.Neighbors(a.driver.Dialect(), step)\n\t\treturn fromV, nil\n\t}\n\treturn query\n}", "func (u *User) QueryPosts() *ExperienceQuery {\n\treturn (&UserClient{config: u.config}).QueryPosts(u)\n}", "func (k Keeper) Posts(goCtx context.Context, req *types.QueryPostsRequest) (*types.QueryPostsResponse, error) {\n\tvar posts []types.Post\n\tctx := sdk.UnwrapSDKContext(goCtx)\n\n\tif !subspacestypes.IsValidSubspace(req.SubspaceId) {\n\t\treturn nil, sdkerrors.Wrapf(subspacestypes.ErrInvalidSubspaceID, req.SubspaceId)\n\t}\n\n\tstore := ctx.KVStore(k.storeKey)\n\tpostsStore := prefix.NewStore(store, types.SubspacePostsPrefix(req.SubspaceId))\n\n\tpageRes, err := query.Paginate(postsStore, req.Pagination, func(key []byte, value []byte) error {\n\t\tstore := ctx.KVStore(k.storeKey)\n\t\tbz := store.Get(types.PostStoreKey(string(value)))\n\n\t\tvar post types.Post\n\t\tif err := k.cdc.UnmarshalBinaryBare(bz, &post); err != nil {\n\t\t\treturn status.Error(codes.Internal, err.Error())\n\t\t}\n\n\t\tposts = append(posts, post)\n\t\treturn nil\n\t})\n\n\tif err != nil {\n\t\treturn nil, status.Error(codes.Internal, err.Error())\n\t}\n\n\treturn &types.QueryPostsResponse{Posts: posts, Pagination: pageRes}, nil\n}", "func (r *queryResolver) Posts(ctx context.Context, after *entgql.Cursor[int], first *int, before *entgql.Cursor[int], last *int, orderBy *ent.PostOrder, where *ent.PostWhereInput) (*ent.PostConnection, error) {\n\tconn, err := ent.FromContext(ctx).Post.Query().Paginate(\n\t\tctx, after, first, before, last,\n\t\tent.WithPostOrder(orderBy),\n\t\tent.WithPostFilter(where.Filter),\n\t)\n\n\tif err == nil && conn.TotalCount == 1 {\n\t\tpost := conn.Edges[0].Node\n\n\t\tif post.ContentHTML == \"\" {\n\t\t\treturn conn, nil\n\t\t}\n\n\t\tgo database.PostViewCounter(ctx, post)\n\t}\n\n\treturn conn, err\n}", "func (c *PostClient) QueryCategory(po *Post) *CategoryQuery {\n\tquery := &CategoryQuery{config: c.config}\n\tquery.path = func(ctx context.Context) (fromV *sql.Selector, _ error) {\n\t\tid := po.ID\n\t\tstep := sqlgraph.NewStep(\n\t\t\tsqlgraph.From(post.Table, post.FieldID, id),\n\t\t\tsqlgraph.To(category.Table, category.FieldID),\n\t\t\tsqlgraph.Edge(sqlgraph.M2O, true, post.CategoryTable, post.CategoryColumn),\n\t\t)\n\t\tfromV = sqlgraph.Neighbors(po.driver.Dialect(), step)\n\t\treturn fromV, nil\n\t}\n\treturn query\n}", "func (c *UnsavedPostClient) QueryCategory(up *UnsavedPost) *CategoryQuery {\n\tquery := &CategoryQuery{config: c.config}\n\tquery.path = func(ctx context.Context) (fromV *sql.Selector, _ error) {\n\t\tid := up.ID\n\t\tstep := sqlgraph.NewStep(\n\t\t\tsqlgraph.From(unsavedpost.Table, unsavedpost.FieldID, id),\n\t\t\tsqlgraph.To(category.Table, category.FieldID),\n\t\t\tsqlgraph.Edge(sqlgraph.M2O, true, unsavedpost.CategoryTable, unsavedpost.CategoryColumn),\n\t\t)\n\t\tfromV = sqlgraph.Neighbors(up.driver.Dialect(), step)\n\t\treturn fromV, nil\n\t}\n\treturn query\n}", "func Posts(mods ...qm.QueryMod) postQuery {\n\tmods = append(mods, qm.From(\"\\\"posts\\\"\"))\n\treturn postQuery{NewQuery(mods...)}\n}", "func (r Repository) Posts(categoryName string, topic string) ([]DbPost, string) {\n\tthreads := r.Threads(categoryName)\n\tthread := filter(threads, func(t DbThread) bool {\n\t\treturn t.Topic == topic\n\t})\n\treturn thread[0].Posts, thread[0].Description\n}", "func (c *CategoryClient) QueryUnsavedPosts(ca *Category) *UnsavedPostQuery {\n\tquery := &UnsavedPostQuery{config: c.config}\n\tquery.path = func(ctx context.Context) (fromV *sql.Selector, _ error) {\n\t\tid := ca.ID\n\t\tstep := sqlgraph.NewStep(\n\t\t\tsqlgraph.From(category.Table, category.FieldID, id),\n\t\t\tsqlgraph.To(unsavedpost.Table, unsavedpost.FieldID),\n\t\t\tsqlgraph.Edge(sqlgraph.O2M, false, category.UnsavedPostsTable, category.UnsavedPostsColumn),\n\t\t)\n\t\tfromV = sqlgraph.Neighbors(ca.driver.Dialect(), step)\n\t\treturn fromV, nil\n\t}\n\treturn query\n}", "func (c *Category) QueryUnsavedPosts() *UnsavedPostQuery {\n\treturn (&CategoryClient{config: c.config}).QueryUnsavedPosts(c)\n}", "func (upq *UnsavedPostQuery) QueryCategory() *CategoryQuery {\n\tquery := &CategoryQuery{config: upq.config}\n\tquery.path = func(ctx context.Context) (fromU *sql.Selector, err error) {\n\t\tif err := upq.prepareQuery(ctx); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tselector := upq.sqlQuery(ctx)\n\t\tif err := selector.Err(); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tstep := sqlgraph.NewStep(\n\t\t\tsqlgraph.From(unsavedpost.Table, unsavedpost.FieldID, selector),\n\t\t\tsqlgraph.To(category.Table, category.FieldID),\n\t\t\tsqlgraph.Edge(sqlgraph.M2O, true, unsavedpost.CategoryTable, unsavedpost.CategoryColumn),\n\t\t)\n\t\tfromU = sqlgraph.SetNeighbors(upq.driver.Dialect(), step)\n\t\treturn fromU, nil\n\t}\n\treturn query\n}", "func (controller *PostQueryController) GetPosts(w http.ResponseWriter, r *http.Request) {\n\tres, err := controller.DiscussionQueryServiceInterface.GetPosts(context.TODO())\n\tif err != nil {\n\t\tvar httpCode int\n\t\tvar errorMsg string\n\n\t\tswitch err.Error() {\n\t\tcase errors.MissingRecord:\n\t\t\thttpCode = http.StatusNotFound\n\t\t\terrorMsg = \"No records found.\"\n\t\tdefault:\n\t\t\thttpCode = http.StatusInternalServerError\n\t\t\terrorMsg = \"Please contact technical support.\"\n\t\t}\n\n\t\tresponse := viewmodels.HTTPResponseVM{\n\t\t\tStatus: httpCode,\n\t\t\tSuccess: false,\n\t\t\tMessage: errorMsg,\n\t\t\tErrorCode: err.Error(),\n\t\t}\n\n\t\tresponse.JSON(w)\n\t\treturn\n\t}\n\n\tvar posts []types.PostResponse\n\n\tfor _, post := range res {\n\t\tposts = append(posts, types.PostResponse{\n\t\t\tID: post.ID,\n\t\t\tContent: post.Content,\n\t\t\tCreatedAt: post.CreatedAt.Unix(),\n\t\t\tUpdatedAt: post.UpdatedAt.Unix(),\n\t\t})\n\t}\n\tresponse := viewmodels.HTTPResponseVM{\n\t\tStatus: http.StatusOK,\n\t\tSuccess: true,\n\t\tMessage: \"Successfully fetched post data.\",\n\t\tData: posts,\n\t}\n\n\tresponse.JSON(w)\n}", "func (c *Client) Posts(opts ListOptions) *PostIterator {\n\tif opts.Limit <= 0 {\n\t\topts.Limit = 100\n\t}\n\tit := &PostIterator{\n\t\tIncludeCount: opts.IncludeCount,\n\t\tLimit: opts.Limit,\n\t\tPage: opts.Page,\n\t\tc: c,\n\t\tlookupCache: &iteratorCache{\n\t\t\tauthors: make(map[string]*Author),\n\t\t\tcategorys: make(map[string]*Category),\n\t\t\tposts: make(map[string]*Post),\n\t\t},\n\t}\n\treturn it\n}", "func (c *PostThumbnailClient) QueryPost(pt *PostThumbnail) *PostQuery {\n\tquery := &PostQuery{config: c.config}\n\tquery.path = func(ctx context.Context) (fromV *sql.Selector, _ error) {\n\t\tid := pt.ID\n\t\tstep := sqlgraph.NewStep(\n\t\t\tsqlgraph.From(postthumbnail.Table, postthumbnail.FieldID, id),\n\t\t\tsqlgraph.To(post.Table, post.FieldID),\n\t\t\tsqlgraph.Edge(sqlgraph.O2O, true, postthumbnail.PostTable, postthumbnail.PostColumn),\n\t\t)\n\t\tfromV = sqlgraph.Neighbors(pt.driver.Dialect(), step)\n\t\treturn fromV, nil\n\t}\n\treturn query\n}", "func (repo *feedRepository) GetPosts(f *feed.Feed, sort feed.Sorting, limit, offset int) ([]*feed.Post, error) {\n\tvar err error\n\n\tvar rows *sql.Rows\n\tswitch sort {\n\t// TODO test queries with actual posts\n\tcase feed.SortNew:\n\t\trows, err = repo.db.Query(`\n\t\tSELECT id\n\t\tFROM\t(SELECT id, creation_time\n\t\t\t\t FROM (\n\t\t\t\t SELECT channel_username\n\t\t\t\t FROM feed_subscriptions\n\t\t\t\t WHERE feed_id = $1\n\t\t\t\t ) AS C (channel_from)\n\t\t\t\t NATURAL JOIN\n\t\t\t\t posts\n\t\t\t\t ) AS P\n\t\tORDER BY creation_time DESC NULLS LAST LIMIT $2 OFFSET $3`, f.ID, limit, offset)\n\tcase feed.SortHot:\n\t\trows, err = repo.db.Query(`\n\t\tSELECT post_id\n\t\tFROM(SELECT LP.post_id, comment_count\n\t\t\tFROM(\n\t\t\t SELECT *\n\t\t\t\tFROM (SELECT id, creation_time\n\t\t\t\t FROM (\n\t\t\t\t SELECT channel_username\n\t\t\t\t FROM feed_subscriptions\n\t\t\t\t WHERE feed_id = $1\n\t\t\t\t ) AS C (channel_from)\n\t\t\t\t NATURAL JOIN\n\t\t\t\t posts\n\t\t\t\t ) AS P\n\t\t\t\tORDER BY creation_time DESC NULLS LAST\n\t\t\t\t) AS LP (post_id)\n\t\t\t\tLEFT JOIN\n\t\t\t\t(SELECT post_from, COALESCE(COUNT(*), 0)\n\t\t\t\t FROM comments\n\t\t\t\t GROUP BY post_from\n\t\t\t\t) AS PS (post_id, comment_count) ON LP.post_id = PS.post_id\n\t\t\tORDER BY creation_time DESC\n\t\t) AS F ORDER BY comment_count DESC NULLS LAST \n\t\tLIMIT $2 OFFSET $3`, f.ID, limit, offset)\n\tcase feed.NotSet:\n\t\tfallthrough\n\tcase feed.SortTop:\n\t\tfallthrough\n\tdefault:\n\t\trows, err = repo.db.Query(`\n\t\tSELECT post_id\n\t\tFROM(SELECT Lp.post_id, total_star_count\n\t\t\tFROM(\n\t\t\t SELECT *\n\t\t\t\tFROM (SELECT id, creation_time\n\t\t\t\t FROM (\n\t\t\t\t SELECT channel_username\n\t\t\t\t FROM feed_subscriptions\n\t\t\t\t WHERE feed_id = $1\n\t\t\t\t ) AS C (channel_from)\n\t\t\t\t NATURAL JOIN\n\t\t\t\t posts\n\t\t\t\t ) AS P\n\t\t\t\tORDER BY creation_time DESC NULLS LAST\n\t\t\t\t) AS LP (post_id)\n\t\t\t\tLEFT JOIN\n\t\t\t\t(SELECT post_id,SUM(star_count)\n\t\t\t\t FROM post_stars\n\t\t\t\t GROUP BY post_id\n\t\t\t\t) AS PS (post_id, total_star_count) ON LP.post_id = PS.post_id\n\t\t\tORDER BY creation_time DESC\n\t\t) AS F ORDER BY total_star_count DESC NULLS LAST \n\t\tLIMIT $2 OFFSET $3`, f.ID, limit, offset)\n\t}\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"querying for feed_subscriptions failed because of: %s\", err.Error())\n\t}\n\tdefer rows.Close()\n\n\tvar id int\n\tposts := make([]*feed.Post, 0)\n\n\tfor rows.Next() {\n\t\terr := rows.Scan(&id)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"scanning from rows failed because: %s\", err.Error())\n\t\t}\n\t\tposts = append(posts, &feed.Post{ID: id})\n\t}\n\terr = rows.Err()\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"scanning from rows faulty because: %s\", err.Error())\n\t}\n\n\treturn posts, nil\n}", "func (b *ConversationThreadRequestBuilder) Posts() *ConversationThreadPostsCollectionRequestBuilder {\n\tbb := &ConversationThreadPostsCollectionRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}\n\tbb.baseURL += \"/posts\"\n\treturn bb\n}", "func (p *_Posts) Query(db database.DB, models ...*Post) *postsQueryBuilder {\n\tvar queryModels []mapping.Model\n\tif len(models) > 0 {\n\t\tqueryModels = make([]mapping.Model, len(models))\n\t\tfor i, model := range models {\n\t\t\tqueryModels[i] = model\n\t\t}\n\t}\n\tbuilder := db.Query(p.Model, queryModels...)\n\treturn &postsQueryBuilder{builder: builder}\n}", "func (k Keeper) GetPosts(ctx sdk.Context) []types.Post {\n\tvar posts []types.Post\n\tk.IteratePosts(ctx, func(_ int64, post types.Post) (stop bool) {\n\t\tposts = append(posts, post)\n\t\treturn false\n\t})\n\n\treturn posts\n}", "func (k Keeper) IteratePosts(ctx sdk.Context, fn func(index int64, post types.Post) (stop bool)) {\n\tstore := ctx.KVStore(k.StoreKey)\n\titerator := sdk.KVStorePrefixIterator(store, types.PostStorePrefix)\n\tdefer iterator.Close()\n\ti := int64(0)\n\tfor ; iterator.Valid(); iterator.Next() {\n\t\tvar post types.Post\n\t\tk.Cdc.MustUnmarshalBinaryBare(iterator.Value(), &post)\n\t\tstop := fn(i, post)\n\t\tif stop {\n\t\t\tbreak\n\t\t}\n\t\ti++\n\t}\n}", "func posts(w http.ResponseWriter, r *http.Request, _ httprouter.Params) {\n\tdb, err := db()\n\tif err != nil {\n\t\tlog.Println(\"Database was not properly opened\")\n\t\tsendErr(w, err, \"Database was not properly opened\", http.StatusInternalServerError)\n\t\treturn\n\t}\n\n\trows, err := db.Query(`\nSELECT p.id, p.name, p.content, p.permalink, p.visible, p.created_at, IFNULL(likes.likes, 0), p.cover\nFROM post p LEFT OUTER JOIN (SELECT post_id, COUNT(ip) AS likes\n FROM liker\n GROUP BY post_id) likes ON p.id = likes.post_id\nORDER BY created_at;\n\t`)\n\tif err != nil {\n\t\tlog.Println(\"Error in statement\")\n\t\tsendErr(w, err, \"Error in query blog\", http.StatusInternalServerError)\n\t\treturn\n\t}\n\n\tvar posts []Post\n\tfor rows.Next() {\n\t\tvar post Post\n\t\t// getting a post\n\t\tvar coverID sql.NullInt64\n\t\terr = rows.Scan(&post.ID, &post.Name, &post.Content, &post.Permalink,\n\t\t\t&post.Visible, &post.CreatedAt, &post.Likes, &coverID)\n\t\tif err != nil {\n\t\t\tlog.Println(\"Error while scanning at home handler\")\n\t\t\tsendErr(w, err, \"Error while scanning blog\", http.StatusInternalServerError)\n\t\t\treturn\n\t\t}\n\t\t// Adding a cover if neded\n\t\tif coverID.Valid {\n\t\t\trow := db.QueryRow(`\nSELECT id, url\nFROM image\nWHERE id = ?\n`, coverID)\n\t\t\tvar image Image\n\t\t\terr := row.Scan(&image.ID, &image.Url)\n\t\t\tif err != nil {\n\t\t\t\tsendErr(w, err, \"Error while trying to get an image for a post\", http.StatusInternalServerError)\n\t\t\t\treturn\n\t\t\t}\n\t\t\tpost.Cover = image\n\t\t}\n\n\t\t// Adding tags\n\t\ttagRows, err := db.Query(`\nSELECT t.id, t.name \nFROM post_tag pt INNER JOIN tag t ON pt.tag_id = t.id\nWHERE pt.post_id = ?;\n\t\t`, post.ID)\n\t\tif err != nil {\n\t\t\tlog.Println(\"Error while scanning at home handler\")\n\t\t\tsendErr(w, err, \"Error while scanning blog\", http.StatusInternalServerError)\n\t\t\treturn\n\t\t}\n\t\tvar tagsIDs []string\n\t\tvar tags []Tag\n\t\tfor tagRows.Next() {\n\t\t\tvar tag Tag\n\t\t\ttagRows.Scan(&tag.ID, &tag.Name)\n\t\t\ttags = append(tags, tag)\n\t\t\ttagsIDs = append(tagsIDs, tag.ID)\n\t\t}\n\t\tpost.TagsIDs = tagsIDs\n\t\tpost.Tags = tags\n\t\t// Append to []Post\n\t\tposts = append(posts, post)\n\t}\n\tdb.Close()\n\tjsn, err := jsonapi.Marshal(posts)\n\tsend(w, jsn)\n}", "func (s *Store) FindAllPosts(filter bson.M, opts ...*options.FindOptions) ([]models.Post, error) {\n\tvar ctx, cancel = context.WithTimeout(context.Background(), 10*time.Second)\n\tdefer cancel()\n\n\tdb := s.db.Database(dbName)\n\tcol := db.Collection(\"posts\")\n\tcur, err := col.Find(ctx, filter, opts...)\n\t// cur, err := col.Find(ctx, bson.M{\"categoryurl\": \"/category/news\", \"deleted\": false}, opts...)\n\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tposts := make([]models.Post, 0)\n\n\terr = cur.All(ctx, &posts)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn posts, nil\n}", "func (p *PostsController) GetPosts(limit int, cursor string, userId int) ([]models.Post, bool) {\n\tvar posts []models.Post\n\tif limit > 50 {\n\t\tlimit = 50\n\t}\n\tlimit++\n\n\tif cursor != \"\" {\n\t\tp.db.Raw(`\n\t\t\tSELECT p.*,\n\t\t\t(SELECT \"value\" from \"likes\" \n\t\t\tWHERE \"user_id\" = ? and \"post_id\" = p.id) as \"StateValue\",\n\t\t\t(SELECT username FROM \"profiles\"\n\t\t\tWHERE user_id = p.user_id) as \"Creator\"\n\t\t\tFROM posts p\n\t\t\tWHERE p.created_at < ?\n\t\t\tORDER BY p.created_at DESC\n\t\t\tLIMIT ?\n\t\t`, userId, cursor, limit).Find(&posts)\n\t} else {\n\t\tp.db.Raw(`\n\t\t\tSELECT p.*,\n\t\t\t( SELECT \"value\" from \"likes\" \n\t\t\tWHERE \"user_id\" = ? and \"post_id\" = p.id) as \"StateValue\",\n\t\t\t(SELECT \"username\" FROM \"profiles\"\n\t\t\tWHERE user_id = p.user_id) as \"Creator\"\n\t\t\tFROM posts p\n\t\t\tORDER BY p.created_at DESC\n\t\t\tLIMIT ?\n\t\t`, userId, limit).Find(&posts)\n\t}\n\tif len(posts) == 0 {\n\t\treturn nil, false\n\t}\n\tif len(posts) == limit {\n\t\treturn posts[0 : limit-1], true\n\t}\n\n\treturn posts, false\n}", "func (c *PostVideoClient) QueryPost(pv *PostVideo) *PostQuery {\n\tquery := &PostQuery{config: c.config}\n\tquery.path = func(ctx context.Context) (fromV *sql.Selector, _ error) {\n\t\tid := pv.ID\n\t\tstep := sqlgraph.NewStep(\n\t\t\tsqlgraph.From(postvideo.Table, postvideo.FieldID, id),\n\t\t\tsqlgraph.To(post.Table, post.FieldID),\n\t\t\tsqlgraph.Edge(sqlgraph.M2O, true, postvideo.PostTable, postvideo.PostColumn),\n\t\t)\n\t\tfromV = sqlgraph.Neighbors(pv.driver.Dialect(), step)\n\t\treturn fromV, nil\n\t}\n\treturn query\n}", "func (c *PostImageClient) QueryPost(pi *PostImage) *PostQuery {\n\tquery := &PostQuery{config: c.config}\n\tquery.path = func(ctx context.Context) (fromV *sql.Selector, _ error) {\n\t\tid := pi.ID\n\t\tstep := sqlgraph.NewStep(\n\t\t\tsqlgraph.From(postimage.Table, postimage.FieldID, id),\n\t\t\tsqlgraph.To(post.Table, post.FieldID),\n\t\t\tsqlgraph.Edge(sqlgraph.M2O, true, postimage.PostTable, postimage.PostColumn),\n\t\t)\n\t\tfromV = sqlgraph.Neighbors(pi.driver.Dialect(), step)\n\t\treturn fromV, nil\n\t}\n\treturn query\n}", "func PostsByCategory(categoryEng string) ([]Post, error) {\n\tconfig.Session.Refresh()\n\tcurrentSession := config.Session.Copy()\n\tdefer currentSession.Close()\n\n\tposts := []Post{}\n\tif err := config.Posts.Find(bson.M{\"categoryeng\": categoryEng}).All(&posts); err != nil {\n\t\treturn nil, errors.Wrapf(err, \"find posts by category [%s]\", categoryEng)\n\t}\n\n\treverse(posts)\n\n\treturn posts, nil\n}", "func (c *PostAttachmentClient) QueryPost(pa *PostAttachment) *PostQuery {\n\tquery := &PostQuery{config: c.config}\n\tquery.path = func(ctx context.Context) (fromV *sql.Selector, _ error) {\n\t\tid := pa.ID\n\t\tstep := sqlgraph.NewStep(\n\t\t\tsqlgraph.From(postattachment.Table, postattachment.FieldID, id),\n\t\t\tsqlgraph.To(post.Table, post.FieldID),\n\t\t\tsqlgraph.Edge(sqlgraph.M2O, true, postattachment.PostTable, postattachment.PostColumn),\n\t\t)\n\t\tfromV = sqlgraph.Neighbors(pa.driver.Dialect(), step)\n\t\treturn fromV, nil\n\t}\n\treturn query\n}", "func (r *Resolver) PostQueryResolver(params graphql.ResolveParams) (interface{}, error) {\n\t// Strip the id from arguments and assert type\n\tid, ok := params.Args[\"id\"].(int)\n\tif ok {\n\t\tposts, err := r.Repository.GetByID(id)\n\t\treturn posts, err\n\t}\n\n\t// We didn't get a valid ID as a param, so we return all the posts\n\treturn r.Repository.GetAllPosts()\n}", "func FindAllPosts() ([]models.Post, error) {\n\tvar data []models.Post\n\tctx := context.Background()\n\tclient, err := firestore.NewClient(ctx, os.Getenv(\"PROJECT_ID\"))\n\tif err != nil {\n\t\tlog.Fatalf(\"Failed to create a Firestore Client: %v\", err)\n\t\treturn nil, err\n\t}\n\n\tdefer client.Close()\n\n\titer := client.Collection(collectionPosts).Documents(ctx)\n\tfor {\n\t\tdoc, err := iter.Next()\n\t\tif err == iterator.Done {\n\t\t\tbreak\n\t\t}\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tresult := models.Post{\n\t\t\tID: doc.Ref.ID,\n\t\t\tTitle: doc.Data()[\"title\"].(string),\n\t\t\tText: doc.Data()[\"text\"].(string),\n\t\t\tDate: doc.Data()[\"date\"].(time.Time),\n\t\t\tPrice: doc.Data()[\"price\"].(int64),\n\t\t\tAuthors: doc.Data()[\"authors\"].([]interface{}),\n\t\t\tPublished: doc.Data()[\"published\"].(bool),\n\t\t}\n\n\t\tdata = append(data, result)\n\t}\n\treturn data, nil\n}", "func (p *DBPosts) GetPosts(id string) error {\n\tvar rows *sql.Rows\n\tvar err error\n\tif id != \"\" {\n\t\trows, err = p.DB.Query(p.QGetOnePost, id)\n\t} else {\n\t\trows, err = p.DB.Query(p.QGetAllPosts)\n\t}\n\tdefer rows.Close()\n\tif err != nil {\n\t\treturn fmt.Errorf(\"error in db.query: %v\", err)\n\t}\n\tfor rows.Next() {\n\t\tpost := Post{}\n\t\terr = rows.Scan(&post.ID, &post.Title, &post.Summary, &post.Body, &post.Date)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"error in row.scan: %v\", err)\n\t\t}\n\t\tp.Posts = append(p.Posts, post)\n\t}\n\tif len(p.Posts) == 0 {\n\t\treturn fmt.Errorf(\"post not found: %s\", id)\n\t}\n\treturn nil\n}", "func (s *ServerState) getPosts(c *gin.Context) {\n\tquery := `select u.name, u.username , p.description, p.timestamp, p.total_campaign_snapshot, co.name, co.cost, sc.name\n\tfrom ht.post p, ht.campaign ca, ht.course co, ht.organisation sc, ht.user u\n\twhere p.campaign_id = ca.id AND ca.course_id = co.id AND co.organisation_id = sc.id AND ca.user_id = u.id;`\n\n\t//curl --header \"Content-Type: application/json\" --request GET http://localhost:8080/posts/\n\n\tvar posts []Post\n\n\terr := s.DB.Select(&posts, query)\n\tif err != nil {\n\t\tc.JSON(500, gin.H{\"status\": err})\n\t\treturn\n\t}\n\tfmt.Println(posts)\n\n\tc.JSON(http.StatusOK, gin.H{\"status\": posts})\n}", "func (db *Database) GetAllPosts() ([]models.Post, error) {\n\tvar posts []models.Post\n\terr := db.DB.Model(&posts).Select()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn posts, nil\n}", "func (c CategoryPostController) Index(ctx *fasthttp.RequestCtx) {\n\tpaginate, _, _ := c.Paginate(ctx, \"id\", \"inserted_at\", \"updated_at\")\n\n\tvar posts []model.PostDEP\n\tvar postSlug model.PostSlug\n\tvar postDetail model.PostDetail\n\tvar postCategoryAssignment model.PostCategoryAssignment\n\tvar category model.Category\n\tvar user model.User\n\tc.GetDB().QueryWithModel(fmt.Sprintf(`\n\t\tSELECT \n\t\t\tp.id as id, p.author_id as author_id, u.username as author_username, \n\t\t\tp.inserted_at as inserted_at, ps.slug as slug, pd.title as title, \n\t\t\tpd.description as description, pd.content as content\n\t\tFROM %s AS p\n\t\tLEFT OUTER JOIN %s AS ps ON p.id = ps.post_id\n\t\tLEFT OUTER JOIN %s AS ps2 ON ps.post_id = ps2.post_id AND ps.id < ps2.id\n\t\tINNER JOIN %s AS pd ON p.id = pd.post_id\n\t\tLEFT OUTER JOIN %s AS pd2 ON pd.post_id = pd2.post_id AND pd.id < pd2.id\n\t\tINNER JOIN %s AS u ON p.author_id = u.id\n\t\tINNER JOIN %s AS pca ON p.id = pca.post_id\n\t\tINNER JOIN %s AS c ON pca.category_id = c.id\n\t\tWHERE ps2.id IS NULL AND pd2.id IS NULL AND (c.id::text = $1::text OR c.slug = $1)\n\t\tORDER BY %s %s\n\t\tLIMIT $2 OFFSET $3\n\t`, c.Model.TableName(), postSlug.TableName(), postSlug.TableName(), postDetail.TableName(),\n\t\tpostDetail.TableName(), user.TableName(), postCategoryAssignment.TableName(), category.TableName(),\n\t\tpaginate.OrderField,\n\t\tpaginate.OrderBy),\n\t\t&posts,\n\t\tphi.URLParam(ctx, \"categoryID\"),\n\t\tpaginate.Limit,\n\t\tpaginate.Offset)\n\n\tvar count int64\n\tcount, _ = c.App.Cache.Get(cmn.GetRedisKey(\"post\", \"count\")).Int64()\n\tif count == 0 {\n\t\tc.GetDB().DB.Get(&count, fmt.Sprintf(`\n\t\t\tSELECT count(p.id) FROM %s AS p\n\t\t\tINNER JOIN %s AS pd ON p.id = pd.post_id\n\t\t\tLEFT OUTER JOIN %s AS pd2 ON pd.post_id = pd2.post_id AND pd.id < pd2.id\n\t\t\tWHERE pd2.id IS NULL\n\t\t`, c.Model.TableName(), postDetail.TableName(), postDetail.TableName()))\n\t}\n\n\tc.JSONResponse(ctx, model2.ResponseSuccess{\n\t\tData: posts,\n\t\tTotalCount: count,\n\t}, fasthttp.StatusOK)\n}", "func (c *PostClient) QueryImages(po *Post) *PostImageQuery {\n\tquery := &PostImageQuery{config: c.config}\n\tquery.path = func(ctx context.Context) (fromV *sql.Selector, _ error) {\n\t\tid := po.ID\n\t\tstep := sqlgraph.NewStep(\n\t\t\tsqlgraph.From(post.Table, post.FieldID, id),\n\t\t\tsqlgraph.To(postimage.Table, postimage.FieldID),\n\t\t\tsqlgraph.Edge(sqlgraph.O2M, false, post.ImagesTable, post.ImagesColumn),\n\t\t)\n\t\tfromV = sqlgraph.Neighbors(po.driver.Dialect(), step)\n\t\treturn fromV, nil\n\t}\n\treturn query\n}", "func (env *Env) GetPosts(w http.ResponseWriter, r *http.Request) {\n\tstart, err := strconv.Atoi(r.URL.Query().Get(\"s\"))\n\tif err != nil {\n\t\tstart = 0\n\t}\n\tend, err := strconv.Atoi(r.URL.Query().Get(\"e\"))\n\tif err != nil {\n\t\tend = 10\n\t}\n\tp, err := env.DB.GetPosts(start, end)\n\tif err != nil {\n\t\tenv.log(r, err)\n\t\tw.WriteHeader(http.StatusNotFound)\n\t\treturn\n\t}\n\tw.Header().Set(\"Content-Type\", \"application/json\")\n\tw.WriteHeader(http.StatusOK)\n\tjson.NewEncoder(w).Encode(p)\n}", "func (m *UserMutation) ClearPosts() {\n\tm.clearedposts = true\n}", "func (r *ConversationThreadPostsCollectionRequest) Get(ctx context.Context) ([]Post, error) {\n\tvar query string\n\tif r.query != nil {\n\t\tquery = \"?\" + r.query.Encode()\n\t}\n\treturn r.Paging(ctx, \"GET\", query, nil)\n}", "func NewPosts() *DBPosts {\n\treturn &DBPosts{\n\t\tDB: DB,\n\t\tLg: Lg,\n\t\tError: Error{Lg: Lg},\n\t\tDBQueries: *NewDBQueries(),\n\t}\n}", "func (c *AdminClient) QueryUnsavedPosts(a *Admin) *UnsavedPostQuery {\n\tquery := &UnsavedPostQuery{config: c.config}\n\tquery.path = func(ctx context.Context) (fromV *sql.Selector, _ error) {\n\t\tid := a.ID\n\t\tstep := sqlgraph.NewStep(\n\t\t\tsqlgraph.From(admin.Table, admin.FieldID, id),\n\t\t\tsqlgraph.To(unsavedpost.Table, unsavedpost.FieldID),\n\t\t\tsqlgraph.Edge(sqlgraph.O2M, false, admin.UnsavedPostsTable, admin.UnsavedPostsColumn),\n\t\t)\n\t\tfromV = sqlgraph.Neighbors(a.driver.Dialect(), step)\n\t\treturn fromV, nil\n\t}\n\treturn query\n}", "func (s *Site) Posts() []Page {\n\tfor _, c := range s.Collections {\n\t\tif c.Name == \"posts\" {\n\t\t\treturn c.Pages()\n\t\t}\n\t}\n\treturn nil\n}", "func (s *PostSvc) FndPosts(ctx context.Context, req *pb.FndPostsReq) (*pb.PostsResp, error) {\n\treturn s.db.FndPosts(ctx, req)\n}", "func AllPosts() ([]*PostMessage, error) {\n\trows, err := db.Query(\"SELECT * FROM posts\")\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer rows.Close()\n\n\tposts := make([]*PostMessage, 0)\n\tfor rows.Next() {\n\t\tpost := new(PostMessage)\n\t\terr := rows.Scan(&post.URL, &post.Text)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tposts = append(posts, post)\n\t}\n\tif err = rows.Err(); err != nil {\n\t\treturn nil, err\n\t}\n\treturn posts, nil\n}", "func (b *blogsQueryBuilder) RemovePosts() (int64, error) {\n\tif b.err != nil {\n\t\treturn 0, b.err\n\t}\n\trelation, err := NRN_Blogs.Model.RelationByIndex(3)\n\tif err != nil {\n\t\treturn 0, errors.Wrapf(mapping.ErrInternal, \"getting 'Posts' relation by index for model 'Blog' failed: %v\", err)\n\t}\n\treturn b.builder.RemoveRelations(relation)\n}", "func CountPosts(c echo.Context) error {\n\treturn c.JSON(http.StatusOK, model.CountPosts())\n}", "func (a App) Posts(res http.ResponseWriter, req *http.Request, _ httprouter.Params) {\n\n\t// easier to do\n\ttmpl := buildView(\"posts\")\n\n\t// Loop through rows using only one struct\n\trows, err := db.Query(\"SELECT * FROM posts\")\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\tdefer rows.Close()\n\n\tfor rows.Next() {\n\t\tvar p Post\n\n\t\tif err := rows.Scan(&p.Id, &p.Title, &p.Body); err != nil {\n\t\t\tlog.Println(err.Error())\n\t\t}\n\n\t\tposts = append(posts, p)\n\t}\n\n\t//////\n\tpd := PageData{\n\t\tPageTitle: \"Hello Gophercon!\",\n\t\tPosts: posts,\n\t}\n\n\t// easier to understand what's going on??\n\terr = tmpl.ExecuteTemplate(res, \"layout\", pd)\n\tif err != nil {\n\t\thttp.Error(res, err.Error(), http.StatusInternalServerError)\n\t}\n\n}", "func Posts(c *gin.Context) {\r\n\tlimit, _ := strconv.Atoi(c.DefaultQuery(\"limit\", \"10\"))\r\n\toffset, _ := strconv.Atoi(c.DefaultQuery(\"offset\", \"0\"))\r\n\r\n\tvar posts []Post\r\n\tdb.Limit(limit).Offset(offset).Find(&posts)\r\n\tc.JSON(http.StatusOK, gin.H{\r\n\t\t\"messege\": \"\",\r\n\t\t\"data\": posts,\r\n\t})\r\n}", "func (s *Store) CountAllPosts(opts ...*options.CountOptions) (int64, error) {\n\tvar ctx, cancel = context.WithTimeout(context.Background(), 10*time.Second)\n\tdefer cancel()\n\n\tdb := s.db.Database(dbName)\n\tcol := db.Collection(\"posts\")\n\tcnt, err := col.CountDocuments(ctx, bson.M{\"deleted\": false}, opts...)\n\n\tif err != nil {\n\t\treturn -1, err\n\t}\n\n\tif err != nil {\n\t\treturn -1, err\n\t}\n\n\treturn cnt, nil\n}", "func GetPosts() (posts []Post, err error) {\n\trows, err := Db.Query(\"select * from posts\")\n\tif err != nil {\n\t\treturn\n\t}\n\n\tfor rows.Next() {\n\t\tpost := Post{}\n\t\terr = rows.Scan(&post.ID, &post.Title, &post.Body, &post.CreatedAt)\n\t\tif err != nil {\n\t\t\treturn\n\t\t}\n\t\tposts = append(posts, post)\n\t}\n\trows.Close()\n\treturn\n}", "func (b *blogsQueryBuilder) AddPosts(_posts ...*Post) error {\n\tif b.err != nil {\n\t\treturn b.err\n\t}\n\trelation, err := NRN_Blogs.Model.RelationByIndex(3)\n\tif err != nil {\n\t\treturn errors.Wrapf(mapping.ErrInternal, \"getting 'Posts' relation by index for model 'Blog' failed: %v\", err)\n\t}\n\tmodels := make([]mapping.Model, len(_posts))\n\tfor i := range _posts {\n\t\tmodels[i] = _posts[i]\n\t}\n\treturn b.builder.AddRelations(relation, models...)\n}", "func (env *Env) GetPublishedPosts(w http.ResponseWriter, r *http.Request) {\n\tstart, err := strconv.Atoi(r.URL.Query().Get(\"s\"))\n\tif err != nil {\n\t\tstart = 0\n\t}\n\tend, err := strconv.Atoi(r.URL.Query().Get(\"e\"))\n\tif err != nil {\n\t\tend = 10\n\t}\n\tp, err := env.DB.PublishedPosts(start, end)\n\tif err != nil {\n\t\tenv.log(r, err)\n\t\tw.WriteHeader(http.StatusNotFound)\n\t\treturn\n\t}\n\tw.Header().Set(\"Content-Type\", \"application/json\")\n\tw.WriteHeader(http.StatusOK)\n\tjson.NewEncoder(w).Encode(p)\n}", "func (p *_Posts) QueryCtx(ctx context.Context, db database.DB, models ...*Post) *postsQueryBuilder {\n\tvar queryModels []mapping.Model\n\tif len(models) > 0 {\n\t\tqueryModels = make([]mapping.Model, len(models))\n\t\tfor i, model := range models {\n\t\t\tqueryModels[i] = model\n\t\t}\n\t}\n\tbuilder := db.QueryCtx(ctx, p.Model, queryModels...)\n\treturn &postsQueryBuilder{builder: builder}\n}", "func (t *TopicService) ListWithPosts() (*[]Topic, error) {\n\tquery := `{\n\t\torganization {\n\t\t\ttopics{\n\t\t\t\tid,\n\t\t\t\tname,\n\t\t\t\tdescription,\n\t\t\t\tposts{id, title},\n\t\t\t\thierarchy,\n\t\t\t\tparent{id},\n\t\t\t\tancestors{id},\n\t\t\t\tchildren{id},\n\t\t\t\tinsertedAt,\n\t\t\t\tupdatedAt\n\t\t\t}\n\t\t}\n\t}`\n\tvar resp struct {\n\t\tOrganization *Organization `json:\"organization\"`\n\t}\n\terr := t.client.Do(context.Background(), query, nil, &resp)\n\tif resp.Organization != nil {\n\t\treturn resp.Organization.Topics, err\n\t}\n\treturn nil, err\n}", "func HasPosts() predicate.User {\n\treturn predicate.User(func(s *sql.Selector) {\n\t\tstep := sqlgraph.NewStep(\n\t\t\tsqlgraph.From(Table, FieldID),\n\t\t\tsqlgraph.Edge(sqlgraph.O2M, false, PostsTable, PostsColumn),\n\t\t)\n\t\tsqlgraph.HasNeighbors(s, step)\n\t})\n}", "func (bav *UtxoView) GetAllPosts() (_corePosts []*PostEntry, _commentsByPostHash map[BlockHash][]*PostEntry, _err error) {\n\t// Start by fetching all the posts we have in the db.\n\t//\n\t// TODO(performance): This currently fetches all posts. We should implement\n\t// some kind of pagination instead though.\n\t_, _, dbPostEntries, err := DBGetAllPostsByTstamp(bav.Handle, true /*fetchEntries*/)\n\tif err != nil {\n\t\treturn nil, nil, errors.Wrapf(err, \"GetAllPosts: Problem fetching PostEntry's from db: \")\n\t}\n\n\t// Iterate through the entries found in the db and force the view to load them.\n\t// This fills in any gaps in the view so that, after this, the view should contain\n\t// the union of what it had before plus what was in the db.\n\tfor _, dbPostEntry := range dbPostEntries {\n\t\tbav.GetPostEntryForPostHash(dbPostEntry.PostHash)\n\t}\n\n\t// Do one more pass to load all the comments from the DB.\n\tfor _, postEntry := range bav.PostHashToPostEntry {\n\t\t// Ignore deleted or rolled-back posts.\n\t\tif postEntry.isDeleted {\n\t\t\tcontinue\n\t\t}\n\n\t\t// If we have a post in the view and if that post is not a comment\n\t\t// then fetch its attached comments from the db. We need to do this\n\t\t// because the tstamp index above only fetches \"core\" posts not\n\t\t// comments.\n\n\t\tif len(postEntry.ParentStakeID) == 0 {\n\t\t\t_, dbCommentHashes, _, err := DBGetCommentPostHashesForParentStakeID(\n\t\t\t\tbav.Handle, postEntry.ParentStakeID, false /*fetchEntries*/)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, nil, errors.Wrapf(err, \"GetAllPosts: Problem fetching comment PostEntry's from db: \")\n\t\t\t}\n\t\t\tfor _, commentHash := range dbCommentHashes {\n\t\t\t\tbav.GetPostEntryForPostHash(commentHash)\n\t\t\t}\n\t\t}\n\t}\n\n\tallCorePosts := []*PostEntry{}\n\tcommentsByPostHash := make(map[BlockHash][]*PostEntry)\n\tfor _, postEntry := range bav.PostHashToPostEntry {\n\t\t// Ignore deleted or rolled-back posts.\n\t\tif postEntry.isDeleted {\n\t\t\tcontinue\n\t\t}\n\n\t\t// Every post is either a core post or a comment. If it has a stake ID\n\t\t// its a comment, and if it doesn't then it's a core post.\n\t\tif len(postEntry.ParentStakeID) == 0 {\n\t\t\tallCorePosts = append(allCorePosts, postEntry)\n\t\t} else {\n\t\t\t// Add the comment to our map.\n\t\t\tcommentsForPost := commentsByPostHash[*StakeIDToHash(postEntry.ParentStakeID)]\n\t\t\tcommentsForPost = append(commentsForPost, postEntry)\n\t\t\tcommentsByPostHash[*StakeIDToHash(postEntry.ParentStakeID)] = commentsForPost\n\t\t}\n\t}\n\t// Sort all the comment lists as well. Here we put the latest comment at the\n\t// end.\n\tfor _, commentList := range commentsByPostHash {\n\t\tsort.Slice(commentList, func(ii, jj int) bool {\n\t\t\treturn commentList[ii].TimestampNanos < commentList[jj].TimestampNanos\n\t\t})\n\t}\n\n\treturn allCorePosts, commentsByPostHash, nil\n}", "func NewPosts(posts map[graphql.ID]*models.Post) *Posts {\n\treturn &Posts{posts}\n}", "func (b *_Blogs) GetPosts(ctx context.Context, db database.DB, model *Blog, relationFieldset ...string) ([]*Post, error) {\n\tif model == nil {\n\t\treturn nil, errors.Wrap(query.ErrNoModels, \"provided nil model\")\n\t}\n\t// Check if primary key has zero value.\n\tif model.IsPrimaryKeyZero() {\n\t\treturn nil, errors.Wrap(mapping.ErrFieldValue, \"model's: 'Blog' primary key value has zero value\")\n\t}\n\trelationField, err := b.Model.RelationByIndex(3)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar fields []*mapping.StructField\n\trelationModel := relationField.Relationship().RelatedModelStruct()\n\tif len(relationFieldset) == 0 {\n\t\tfields = relationModel.Fields()\n\t} else {\n\t\tfor _, field := range relationFieldset {\n\t\t\tsField, ok := relationModel.FieldByName(field)\n\t\t\tif !ok {\n\t\t\t\treturn nil, errors.Wrapf(mapping.ErrInvalidModelField, \"no field: '%s' found for the model: 'Post'\", field)\n\t\t\t}\n\t\t\tfields = append(fields, sField)\n\t\t}\n\t}\n\n\trelations, err := db.GetRelations(ctx, b.Model, []mapping.Model{model}, relationField, fields...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif len(relations) == 0 {\n\t\treturn []*Post{}, nil\n\t}\n\tresult := make([]*Post, len(relations))\n\tfor i, relation := range relations {\n\t\tresult[i] = relation.(*Post)\n\t}\n\treturn result, nil\n}", "func (o *InlineResponse20082) SetPosts(v []InlineResponse20082Posts) {\n\to.Posts = &v\n}", "func (o *Post) PostsTags(mods ...qm.QueryMod) postsTagQuery {\n\tvar queryMods []qm.QueryMod\n\tif len(mods) != 0 {\n\t\tqueryMods = append(queryMods, mods...)\n\t}\n\n\tqueryMods = append(queryMods,\n\t\tqm.Where(\"\\\"posts_tags\\\".\\\"post_id\\\"=?\", o.ID),\n\t)\n\n\tquery := PostsTags(queryMods...)\n\tqueries.SetFrom(query.Query, \"\\\"posts_tags\\\"\")\n\n\tif len(queries.GetSelect(query.Query)) == 0 {\n\t\tqueries.SetSelect(query.Query, []string{\"\\\"posts_tags\\\".*\"})\n\t}\n\n\treturn query\n}", "func GetPostsFromQuery(context appengine.Context, query *datastore.Query) (*[]Post, error) {\n\n\tvar posts []Post\n\tkeys, err := query.GetAll(context, &posts)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tfor i, key := range keys {\n\t\tposts[i].Id = key.IntID()\n\t}\n\treturn &posts, nil\n}", "func FetchPosts(c *gin.Context) {\n\tid, err := utils.GetSessionID(c)\n\tif err != nil || id != \"CEO\" {\n\t\tc.String(http.StatusForbidden, \"Only the CEO can access this.\")\n\t\treturn\n\t}\n\n\tposts, err := ElectionDb.GetPosts()\n\tif err != nil {\n\t\tc.String(http.StatusInternalServerError, \"Error while fetching posts.\")\n\t\treturn\n\t}\n\tc.JSON(http.StatusOK, &posts)\n}", "func queryUserPosts(ctx sdk.Context, path []string, req abci.RequestQuery, keeper Keeper) ([]byte, error) {\n\towner, from, limit, err := extractCommonGetParameters(path)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tp := keeper.ListUserPosts(ctx, owner, from, limit)\n\n\tres, err := codec.MarshalJSONIndent(keeper.cdc, postsToQuerierPosts(p))\n\tif err != nil {\n\t\treturn nil, sdkerrors.Wrap(sdkerrors.ErrJSONMarshal, err.Error())\n\t}\n\n\treturn res, nil\n}", "func GetPosts(w http.ResponseWriter, r *http.Request) {\n\n\tposts := []m.Post{}\n\n\tdb, err := sqlx.Connect(\"postgres\", connStr)\n\tif err != nil {\n\t\tfmt.Println(err)\n\t}\n\n\tw.Header().Set(\"Content-Type\", \"application/json\")\n\n\tdb.Select(&posts, \"select id, title, content, created from posts\")\n\n\tjson.NewEncoder(w).Encode(posts)\n}", "func ByPosts(term sql.OrderTerm, terms ...sql.OrderTerm) OrderOption {\n\treturn func(s *sql.Selector) {\n\t\tsqlgraph.OrderByNeighborTerms(s, newPostsStep(), append([]sql.OrderTerm{term}, terms...)...)\n\t}\n}", "func GetAllPosts() ([]Post, error) {\n\tvar res []Post\n\tdb := DBCon()\n\n\t// Execute the query which takes all posts from Wordpress database and order by New to Old\n\tresults, err := db.Query(\"SELECT post.ID as post_id, post.post_title as post_title, post.guid as post_url, \" +\n\t\t\"p.guid as post_poster, post.post_excerpt as post_description, post.post_modified_gmt \" +\n\t\t\"FROM wp_posts AS post JOIN wp_postmeta AS postmeta ON postmeta.post_id = post.ID \" +\n\t\t\"JOIN wp_posts AS p ON p.ID = postmeta.meta_value \" +\n\t\t\"WHERE post.post_type = 'post' AND post.post_status = 'publish' AND postmeta.meta_key = '_thumbnail_id' \" +\n\t\t\"ORDER BY post.post_modified DESC;\")\n\tif err != nil {\n\t\tlog.Fatal(\"(ERR) Cannot query the database: \", err)\n\t}\n\n\t// Iterate through results\n\tfor results.Next() {\n\t\tvar eachRes = new(Post)\n\t\t// for each row of the data, scan into structure\n\t\terr = results.Scan(&eachRes.PostID, &eachRes.PostTitle, &eachRes.PostUrl, &eachRes.PostPoster,\n\t\t\t&eachRes.PostDescription, &eachRes.PostModifiedGMT)\n\t\tif err != nil {\n\t\t\tlog.Println(\"(ERR) Problem while reading data from database: \", err)\n\t\t}\n\n\t\tres = append(res, *eachRes)\n\t}\n\tdefer db.Close()\n\n\treturn res, err\n}", "func AllPosts() ([]Post, error) {\n\tconfig.Session.Refresh()\n\tcurrentSession := config.Session.Copy()\n\tdefer currentSession.Close()\n\n\tposts := make([]Post, 0)\n\tif err := config.Posts.Find(bson.M{}).All(&posts); err != nil {\n\t\treturn nil, errors.Wrap(err, \"find all posts\")\n\t}\n\n\treverse(posts)\n\n\treturn posts, nil\n}", "func GetPostsFromQueryPerPage(context appengine.Context, query *datastore.Query, page int) (*[]Post, bool, error) {\n\n\tcnt, _ := query.Count(context)\n\toffset := (page - 1) * postPerPage\n\thasOlder := offset+postPerPage < cnt\n\n\tqry := query.Limit(postPerPage).Offset(offset)\n\n\tposts, err := GetPostsFromQuery(context, qry)\n\n\treturn posts, hasOlder, err\n}", "func GetAllPost(w http.ResponseWriter, r *http.Request) {\n\tpage := r.URL.Query()[\"page\"]\n\tuserID := r.URL.Query()[\"user\"]\n\n\tfilter := bson.M{}\n\tfilter[\"status\"] = bson.M{\n\t\t\"$ne\": poststatus.Deleted,\n\t}\n\n\tif len(userID) > 0 {\n\t\tuID, err := primitive.ObjectIDFromHex(userID[0])\n\t\tif err != nil {\n\t\t\tresponse.Error(w, http.StatusUnprocessableEntity, err.Error())\n\t\t\treturn\n\t\t}\n\t\tfilter[\"user_id\"] = uID\n\t}\n\n\tvar count int\n\n\tif len(page) > 0 {\n\t\tfmt.Println(\"STUFF\", len(page))\n\t\tnum, err := strconv.Atoi(page[0])\n\t\tif err != nil {\n\t\t\tresponse.Error(w, http.StatusUnprocessableEntity, err.Error())\n\t\t\treturn\n\t\t}\n\t\tcount = num\n\t} else {\n\t\tcount = 0\n\t}\n\n\tposts, err := GetAll(filter, count)\n\n\tif err != nil {\n\t\tresponse.Error(w, http.StatusUnprocessableEntity, err.Error())\n\t\treturn\n\t}\n\n\tif posts == nil {\n\t\tposts = []GetPostStruct{}\n\t}\n\n\tresponse.Success(w, r,\n\t\thttp.StatusOK,\n\t\tposts,\n\t)\n\treturn\n}", "func (b *blogsQueryBuilder) IncludePosts(postsFieldset ...string) *blogsQueryBuilder {\n\tif b.err != nil {\n\t\treturn b\n\t}\n\trelation, err := NRN_Blogs.Model.RelationByIndex(3)\n\tif err != nil {\n\t\tb.err = errors.Wrapf(mapping.ErrInternal, \"Getting 'Posts' by index for model 'Blog' failed: %v\", err)\n\t\treturn b\n\t}\n\t// check the fieldset for the relation.\n\tvar relationFields []*mapping.StructField\n\tfor _, field := range postsFieldset {\n\t\tstructField, ok := relation.ModelStruct().FieldByName(field)\n\t\tif !ok {\n\t\t\tb.err = errors.Wrapf(mapping.ErrInvalidModelField, \"field: '%s' is not found for the 'Post' model\", field)\n\t\t\treturn b\n\t\t}\n\t\trelationFields = append(relationFields, structField)\n\t}\n\tb.builder.Include(relation, relationFields...)\n\treturn b\n}", "func (t *tagStorage) QueryCategories() ([]model.CategoryInfo, error) {\n\tvar cs []model.CategoryInfo\n\n\terr := t.db.Table(model.CateTableName()).Where(\"del_flag = ?\", 0).Find(&cs)\n\treturn cs, err\n}", "func (u *User)GetPosts()(e error){\n\trows,e := db.Query(\"select * from posts where user_id = ? order by date desc \",u.Id)\n\tif e != nil {\n\t\treturn\n\t}\n\tfor rows.Next() {\n\t\tc := &Post{}\n\t\trows.Scan(&c.Id,&c.Title,&c.Topic,&c.Content,&c.Date,&c.CommunityId,&c.UserId)\n\t\tu.posts = append(u.posts,c)\n\t}\n\treturn\n}", "func FetchPosts(c appengine.Context, n int) ([]Post, error) {\n\tall, err := fetchPosts(c, n, nil)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tmine, err := fetchPosts(c, n, userKey(c))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tm := []Post{}\n\tmergePosts(&m, mine, all, n)\n\n\t// We fetch the comments for all posts concurrently.\n\terrc := make(chan error, len(m))\n\tfor i := range m {\n\t\tgo func(p *Post) {\n\t\t\terrc <- p.FetchComments(c)\n\t\t}(&m[i])\n\t}\n\tfor _ = range m {\n\t\tif err := <-errc; err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\treturn m, nil\n}", "func (s *MysqlSender) AddPosts(posts []*database.Post) int {\n\tcount := 0\n\tfor _, post := range posts {\n\t\tif s.AddPost(post) {\n\t\t\tcount++\n\t\t}\n\t}\n\treturn count\n}", "func (p *postsQueryBuilder) Count() (int64, error) {\n\tif p.err != nil {\n\t\treturn 0, p.err\n\t}\n\treturn p.builder.Count()\n}", "func (r Repository) AddPost(post *datastructures.Post, topic string, categoryName string) {\n\tsession, _ := mgo.Dial(r.ipAddress)\n\tdefer session.Close()\n\tsession.SetMode(mgo.Monotonic, true)\n\tcollection := session.DB(\"u-talk\").C(\"forum\")\n\tquery := bson.M{\"name\": categoryName, \"threads.topic\": topic}\n\tupdate := bson.M{\"$push\": bson.M{\"threads.$.posts\": bson.M{\"author\": post.Author(), \"content\": post.Content(), \"edited\": post.WasEdited(), \"created\": post.Created()}}}\n\terr := collection.Update(query, update)\n\tif err != nil {\n\t\tfmt.Println(err)\n\n\t}\n}", "func getPosts(w http.ResponseWriter, r *http.Request) {\n\tw.Header().Set(\"Content-Type\", \"application/json\")\n\tw.Header().Set(\"Access-Control-Allow-Origin\", \"*\")\n\tw.Header().Set(\"Access-Control-Allow-Methods\", \"POST, GET, OPTIONS, PUT, DELETE\")\n\tw.Header().Set(\"Access-Control-Allow-Headers\", \"Accept, Content-Type, Content-Length, Accept-Encoding, X-CSRF-Token, Authorization\")\n\tvar posts []Post\n\tresult, err := db.Query(\"SELECT id, title, text from posts\")\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tdefer result.Close()\n\tfor result.Next() {\n\t\tvar post Post\n\t\terr := result.Scan(&post.ID, &post.Title, &post.Text)\n\t\tif err != nil {\n\t\t\tpanic(err.Error())\n\t\t}\n\t\tposts = append(posts, post)\n\t}\n\tjson.NewEncoder(w).Encode(posts)\n}", "func ReadPosts(res render.Render) {\n\tvar post Post\n\tpublished := make([]Post, 0)\n\tposts, err := post.GetAll()\n\tif err != nil {\n\t\tlog.Println(err)\n\t\tres.JSON(500, map[string]interface{}{\"error\": \"Internal server error\"})\n\t\treturn\n\t}\n\tfor _, post := range posts {\n\t\tif post.Published {\n\t\t\tpublished = append(published, post)\n\t\t}\n\t}\n\tres.JSON(200, published)\n}", "func (b *_Blogs) AddPosts(ctx context.Context, db database.DB, model *Blog, relations ...*Post) error {\n\tif model == nil {\n\t\treturn errors.Wrap(query.ErrNoModels, \"provided nil model\")\n\t}\n\tif len(relations) == 0 {\n\t\treturn errors.Wrap(query.ErrNoModels, \"no relation models provided\")\n\t}\n\trelationField, err := b.Model.RelationByIndex(3)\n\tif err != nil {\n\t\treturn err\n\t}\n\trelationModels := make([]mapping.Model, len(relations))\n\tfor i := range relations {\n\t\trelationModels[i] = relations[i]\n\t}\n\tq := query.NewScope(b.Model, model)\n\trelationAdder, ok := db.(database.QueryRelationAdder)\n\tif !ok {\n\t\treturn errors.WrapDetf(query.ErrInternal, \"DB doesn't implement QueryRelationAdder interface - %T\", db)\n\t}\n\treturn relationAdder.QueryAddRelations(ctx, q, relationField, relationModels...)\n}", "func (k Keeper) Post(goCtx context.Context, req *types.QueryPostRequest) (*types.QueryPostResponse, error) {\n\tif !types.IsValidPostID(req.PostId) {\n\t\treturn nil, sdkerrors.Wrapf(sdkerrors.ErrInvalidRequest, \"invalid post id: %s\", req.PostId)\n\t}\n\n\tctx := sdk.UnwrapSDKContext(goCtx)\n\tpost, found := k.GetPost(ctx, req.PostId)\n\tif !found {\n\t\treturn nil, sdkerrors.Wrapf(sdkerrors.ErrInvalidRequest, \"post with id %s not found\", req.PostId)\n\t}\n\treturn &types.QueryPostResponse{Post: post}, nil\n}", "func (b *blogsQueryBuilder) SetPosts(_posts ...*Post) error {\n\tif b.err != nil {\n\t\treturn b.err\n\t}\n\trelation, err := NRN_Blogs.Model.RelationByIndex(3)\n\tif err != nil {\n\t\treturn errors.Wrapf(mapping.ErrInternal, \"getting 'Posts' relation by index for model 'Blog' failed: %v\", err)\n\t}\n\tmodels := make([]mapping.Model, len(_posts))\n\tfor i := range _posts {\n\t\tmodels[i] = _posts[i]\n\t}\n\treturn b.builder.SetRelations(relation, models...)\n}", "func (mgr *ConverterManager) ReadPosts() ([]os.FileInfo, error) {\n\tfiles, err := ioutil.ReadDir(mgr.MediumPostsPath)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn files, nil\n}", "func (bl *postBusiness) GetAll() (*models.Posts, *apperror.AppError) {\n\treturn bl.service.GetAll()\n}", "func (o *Post) PostReads(mods ...qm.QueryMod) postReadQuery {\n\tvar queryMods []qm.QueryMod\n\tif len(mods) != 0 {\n\t\tqueryMods = append(queryMods, mods...)\n\t}\n\n\tqueryMods = append(queryMods,\n\t\tqm.Where(\"\\\"post_reads\\\".\\\"post_id\\\"=?\", o.ID),\n\t)\n\n\tquery := PostReads(queryMods...)\n\tqueries.SetFrom(query.Query, \"\\\"post_reads\\\"\")\n\n\tif len(queries.GetSelect(query.Query)) == 0 {\n\t\tqueries.SetSelect(query.Query, []string{\"\\\"post_reads\\\".*\"})\n\t}\n\n\treturn query\n}", "func ListPost(c buffalo.Context) error {\n\n\tdb := c.Value(\"tx\").(*pop.Connection)\n\n\tposts := &models.Posts{}\n\n\tquery := db.PaginateFromParams(c.Params())\n\n\tif err := query.Order(\"created_at desc\").Eager().All(posts); err != nil {\n\n\t\terrorResponse := utils.NewErrorResponse(http.StatusInternalServerError, \"user\", \"There is a problem while loading the relationship user\")\n\t\treturn c.Render(http.StatusInternalServerError, r.JSON(errorResponse))\n\t}\n\n\tresponse := PostsResponse{\n\t\tCode: fmt.Sprintf(\"%d\", http.StatusOK),\n\t\tData: *posts,\n\t\tMeta: *query.Paginator,\n\t}\n\tc.Logger().Debug(c.Value(\"email\"))\n\treturn c.Render(http.StatusOK, r.JSON(response))\n}", "func (p *PostsController) GetUserPosts(limit, userId, profileId int, cursor string) ([]models.Post, bool) {\n\tvar posts []models.Post\n\n\tif limit > 50 {\n\t\tlimit = 50\n\t}\n\tlimit++\n\n\tif cursor != \"\" {\n\t\tp.db.Raw(`\n\t\t\tSELECT p.*,\n\t\t\t( SELECT \"value\" from \"likes\" \n\t\t\tWHERE \"user_id\" = ? and \"post_id\" = p.id) as \"StateValue\"\n\t\t\tFROM posts p\n\t\t\tWHERE user_id = ?\n\t\t\tAND p.created_at < ?\n\t\t\tORDER BY p.created_at DESC\n\t\t\tLIMIT ?\n\t\t`, userId, profileId, cursor, limit).Find(&posts)\n\t} else {\n\t\tp.db.Raw(`\n\t\t\tSELECT p.*,\n\t\t\t( SELECT \"value\" from \"likes\" \n\t\t\tWHERE \"user_id\" = ? and \"post_id\" = p.id) as \"StateValue\"\n\t\t\tFROM posts p\n\t\t\tWHERE user_id = ?\n\t\t\tORDER BY p.created_at DESC\n\t\t\tLIMIT ?\n\t\t`, userId, profileId, limit).Find(&posts)\n\t}\n\tif len(posts) == 0 {\n\t\treturn nil, false\n\t}\n\tif len(posts) == limit {\n\t\treturn posts[0 : limit-1], true\n\t}\n\n\treturn posts, false\n}", "func (s *CategoryService) Query(rs app.RequestScope, offset, limit int) ([]models.Category, error) {\n\treturn s.dao.Query(rs, offset, limit)\n}", "func (u *User)Posts() Posts{\n\treturn u.posts\n}", "func (sc *SourceCreate) AddPosts(p ...*Post) *SourceCreate {\n\tids := make([]int, len(p))\n\tfor i := range p {\n\t\tids[i] = p[i].ID\n\t}\n\treturn sc.AddPostIDs(ids...)\n}", "func GetAllCategory(c * gin.Context){\n\tdb := database.DBConn()\n\trows, err := db.Query(\"SELECT * FROM category\")\n\tif err != nil{\n\t\tc.JSON(500, gin.H{\n\t\t\t\"messages\" : \"Story not found\",\n\t\t});\n\t}\n\tpost := DTO.CategoryDTO{}\n\tlist := [] DTO.CategoryDTO{}\n\tfor rows.Next(){\n\t\tvar id, types int\n\t\tvar name string\n\t\terr = rows.Scan(&id, &name, &types)\n\t\tif err != nil {\n\t\t\tpanic(err.Error())\n\t\t}\n\t\tpost.Id = id\n\t\tpost.Name = name\n\t\tpost.Type = types\n\t\tlist = append(list,post);\n\t}\n\tc.JSON(200, list)\n\tdefer db.Close()\n}", "func (pc PostsController) getPosts(response http.ResponseWriter, request *http.Request, parameters httprouter.Params) {\n\tresponse.Header().Add(\"content-type\", \"application/json\")\n\tvar postArray []Posts\n\tctx, _ := context.WithTimeout(context.Background(), 10*time.Second)\n\tcursor, err := pc.postscollection.Find(ctx, bson.M{})\n\tif err != nil {\n\t\tresponse.WriteHeader(http.StatusInternalServerError)\n\t\tresponse.Write([]byte(`{\"message: \"` + err.Error() + `\"}\"`))\n\t\treturn\n\t}\n\tdefer cursor.Close(ctx)\n\n\tfor cursor.Next(ctx) {\n\t\tvar post Posts\n\t\tcursor.Decode(&post)\n\t\tpostArray = append(postArray, post)\n\t}\n\n\tif err := cursor.Err(); err != nil {\n\t\tresponse.WriteHeader(http.StatusInternalServerError)\n\t\tresponse.Write([]byte(`{\"message: \"` + err.Error() + `\"}\"`))\n\t\treturn\n\t}\n\tjson.NewEncoder(response).Encode(postArray)\n}", "func (c *UnsavedPostClient) QueryImages(up *UnsavedPost) *UnsavedPostImageQuery {\n\tquery := &UnsavedPostImageQuery{config: c.config}\n\tquery.path = func(ctx context.Context) (fromV *sql.Selector, _ error) {\n\t\tid := up.ID\n\t\tstep := sqlgraph.NewStep(\n\t\t\tsqlgraph.From(unsavedpost.Table, unsavedpost.FieldID, id),\n\t\t\tsqlgraph.To(unsavedpostimage.Table, unsavedpostimage.FieldID),\n\t\t\tsqlgraph.Edge(sqlgraph.O2M, false, unsavedpost.ImagesTable, unsavedpost.ImagesColumn),\n\t\t)\n\t\tfromV = sqlgraph.Neighbors(up.driver.Dialect(), step)\n\t\treturn fromV, nil\n\t}\n\treturn query\n}", "func (db *MysqlDB) GetPosts(num, offset int) ([]Post, error) {\n\n\tposts := make([]Post, 0, 10)\n\n\trows, err := db.Conn.Query(\n\t\t`SELECT p.id, p.Title, p.Description, p.ImageURL, p.Annotation, p.PostText,\n u.Name AS AuthorName,\n p.CreatedAt, p.UpdatedAt\n FROM Posts p INNER JOIN Users u ON p.Author = u.id\n ORDER BY id desc\n LIMIT ? OFFSET ?;`,\n\t\tnum, offset)\n\tif err != nil {\n\t\treturn posts, err\n\t}\n\tdefer rows.Close()\n\n\tfor rows.Next() {\n\t\tvar ID int64\n\t\tvar Title string\n\t\tvar Description string\n\t\tvar ImageURL string\n\t\tvar Annotation string\n\t\tvar Text string\n\t\tvar Author string\n\t\tvar CreatedAt time.Time\n\t\tvar UpdatedAt time.Time\n\n\t\terr = rows.Scan(&ID, &Title, &Description, &ImageURL, &Annotation, &Text, &Author, &CreatedAt, &UpdatedAt)\n\t\tif err != nil {\n\t\t\tlog.Printf(\"Error in row scan inside DBGetPosts: %v\\n\", err)\n\t\t}\n\t\tpost := &Post{ID: ID,\n\t\t\tTitle: template.HTML(Title),\n\t\t\tDescription: template.HTML(Description),\n\t\t\tImageURL: ImageURL,\n\t\t\tAnnotation: template.HTML(Annotation),\n\t\t\tText: template.HTML(Text),\n\t\t\tAuthor: Author,\n\t\t\tCreatedAt: CreatedAt,\n\t\t\tUpdatedAt: UpdatedAt}\n\n\t\tposts = append(posts, *post)\n\t}\n\n\treturn posts, nil\n}", "func GetPosts(index, number int) []blog.Post {\n\tstmt, err := db.Prepare(\"SELECT id, post, author, title, timestamp FROM blogposts ORDER BY id DESC LIMIT ? OFFSET ?\")\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\trows, err := stmt.Query(number, index)\n\tif err != nil {\n\t\tif err == sql.ErrNoRows {\n\t\t} else {\n\t\t\tlog.Fatal(err)\n\t\t}\n\t}\n\tdefer rows.Close()\n\n\tposts := make([]blog.Post, 0)\n\tfor rows.Next() {\n\t\tvar post blog.Post\n\t\terr := rows.Scan(&post.ID, &post.Post, &post.Author, &post.Title, &post.Timestamp)\n\t\tif err != nil {\n\t\t\tlog.Fatal(err)\n\t\t\tcontinue\n\t\t}\n\t\tpost.Tags = GetTagsByPostId(post.ID)\n\t\tposts = append(posts, post)\n\t}\n\treturn posts\n}", "func (t *Tool) QueryCategory() *CategoryQuery {\n\treturn (&ToolClient{config: t.config}).QueryCategory(t)\n}", "func (s *MessagesSponsoredMessages) SetPostsBetween(value int) {\n\ts.Flags.Set(0)\n\ts.PostsBetween = value\n}", "func (o *Post) PostHistories(mods ...qm.QueryMod) postHistoryQuery {\n\tvar queryMods []qm.QueryMod\n\tif len(mods) != 0 {\n\t\tqueryMods = append(queryMods, mods...)\n\t}\n\n\tqueryMods = append(queryMods,\n\t\tqm.Where(\"\\\"post_histories\\\".\\\"post_id\\\"=?\", o.ID),\n\t)\n\n\tquery := PostHistories(queryMods...)\n\tqueries.SetFrom(query.Query, \"\\\"post_histories\\\"\")\n\n\tif len(queries.GetSelect(query.Query)) == 0 {\n\t\tqueries.SetSelect(query.Query, []string{\"\\\"post_histories\\\".*\"})\n\t}\n\n\treturn query\n}", "func (upq *UnsavedPostQuery) WithCategory(opts ...func(*CategoryQuery)) *UnsavedPostQuery {\n\tquery := &CategoryQuery{config: upq.config}\n\tfor _, opt := range opts {\n\t\topt(query)\n\t}\n\tupq.withCategory = query\n\treturn upq\n}", "func (c CategoryPostController) Show(ctx *fasthttp.RequestCtx) {\n\tvar post model.PostDEP\n\tvar postSlug model.PostSlug\n\tvar postDetail model.PostDetail\n\tvar postCategoryAssignment model.PostCategoryAssignment\n\tvar category model.Category\n\tvar user model.User\n\tc.GetDB().QueryRowWithModel(fmt.Sprintf(`\n\t\tSELECT \n\t\t\tp.id as id, p.author_id as author_id, u.username as author_username, \n\t\t\tp.inserted_at as inserted_at, ps.slug as slug, pd.title as title, \n\t\t\tpd.description as description, pd.content as content\n\t\tFROM %s AS p\n\t\tLEFT OUTER JOIN %s AS ps ON p.id = ps.post_id\n\t\tLEFT OUTER JOIN %s AS ps2 ON ps.post_id = ps2.post_id AND ps.id < ps2.id\n\t\tINNER JOIN %s AS pd ON p.id = pd.post_id\n\t\tLEFT OUTER JOIN %s AS pd2 ON pd.post_id = pd2.post_id AND pd.id < pd2.id\n\t\tINNER JOIN %s AS u ON p.author_id = u.id\n\t\tINNER JOIN %s AS pca ON p.id = pca.post_id\n\t\tINNER JOIN %s AS c ON pca.category_id = c.id\n\t\tWHERE ps2.id IS NULL AND pd2.id IS NULL AND (c.id::text = $1::text OR c.slug = $1) AND \n\t\t\t(p.id::text = $2::text OR ps.slug = $2)\n\t`, c.Model.TableName(), postSlug.TableName(), postSlug.TableName(), postDetail.TableName(),\n\t\tpostDetail.TableName(), user.TableName(), postCategoryAssignment.TableName(), category.TableName()),\n\t\t&post,\n\t\tphi.URLParam(ctx, \"categoryID\"),\n\t\tphi.URLParam(ctx, \"postID\")).Force()\n\n\tc.JSONResponse(ctx, model2.ResponseSuccessOne{\n\t\tData: post,\n\t}, fasthttp.StatusOK)\n}", "func (*controller) GetPosts(w http.ResponseWriter, r *http.Request) {\n\tw.Header().Set(\"Content-type\", \"application/json\")\n\tposts, err := postService.FindAll()\n\tif err != nil {\n\t\tw.WriteHeader(http.StatusInternalServerError)\n\t\tjson.NewEncoder(w).Encode(errors.ServiceError{Message: \"Failed to load posts\"})\n\t\treturn\n\t}\n\tw.WriteHeader(http.StatusOK)\n\tjson.NewEncoder(w).Encode(posts)\n\n}", "func (upq *UnsavedPostQuery) QueryImages() *UnsavedPostImageQuery {\n\tquery := &UnsavedPostImageQuery{config: upq.config}\n\tquery.path = func(ctx context.Context) (fromU *sql.Selector, err error) {\n\t\tif err := upq.prepareQuery(ctx); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tselector := upq.sqlQuery(ctx)\n\t\tif err := selector.Err(); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tstep := sqlgraph.NewStep(\n\t\t\tsqlgraph.From(unsavedpost.Table, unsavedpost.FieldID, selector),\n\t\t\tsqlgraph.To(unsavedpostimage.Table, unsavedpostimage.FieldID),\n\t\t\tsqlgraph.Edge(sqlgraph.O2M, false, unsavedpost.ImagesTable, unsavedpost.ImagesColumn),\n\t\t)\n\t\tfromU = sqlgraph.SetNeighbors(upq.driver.Dialect(), step)\n\t\treturn fromU, nil\n\t}\n\treturn query\n}", "func SelectAllFromPost() []Post {\n\tdb := MysqlConnect()\n\tdefer db.Close()\n\n\tresults, err := db.Query(\"SELECT * FROM post\")\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\n\tvar result []Post\n\n\tfor results.Next() {\n\n\t\tvar post Post\n\n\t\terr = results.Scan(&post.ID, &post.Title, &post.Description, &post.Post,\n\t\t\t&post.Date, &post.Author, &post.Thumbnail, &post.Categories)\n\n\t\tif err != nil {\n\t\t\tpanic(err.Error())\n\t\t}\n\t\tresult = append(result, post)\n\t}\n\n\treturn result\n}" ]
[ "0.82554436", "0.7327599", "0.6461221", "0.6445095", "0.6423918", "0.62419367", "0.6139956", "0.6099451", "0.60992247", "0.60653", "0.59765077", "0.5973004", "0.5904878", "0.5812197", "0.5746731", "0.5604293", "0.55960006", "0.55396366", "0.55185914", "0.54949415", "0.54740155", "0.5454046", "0.5448908", "0.5440591", "0.54328626", "0.5397543", "0.5381439", "0.53770506", "0.5341755", "0.5292544", "0.528356", "0.52808595", "0.5257945", "0.52478313", "0.52281654", "0.52007043", "0.51790375", "0.5161796", "0.51383734", "0.51080436", "0.51054627", "0.51048285", "0.509845", "0.50620645", "0.5035782", "0.5030474", "0.5028433", "0.5010629", "0.50002056", "0.4985854", "0.4973791", "0.49671942", "0.49564746", "0.49334994", "0.49225464", "0.49129948", "0.48997635", "0.48989442", "0.48844287", "0.48810685", "0.48720106", "0.48710763", "0.48674658", "0.4857805", "0.48467273", "0.4839899", "0.4835759", "0.4825096", "0.48146224", "0.47909087", "0.47825506", "0.47808617", "0.47763112", "0.47667181", "0.47517577", "0.47398174", "0.4729691", "0.47195238", "0.47160515", "0.47032797", "0.46965808", "0.46886945", "0.46677893", "0.46647477", "0.46561036", "0.46398512", "0.46222782", "0.46210966", "0.46079707", "0.46072975", "0.46066776", "0.45987144", "0.45945182", "0.45877582", "0.45851344", "0.45832095", "0.45763132", "0.45726654", "0.4571017", "0.4545792" ]
0.82628036
0
QueryUnsavedPosts queries the unsaved_posts edge of a Category.
func (c *CategoryClient) QueryUnsavedPosts(ca *Category) *UnsavedPostQuery { query := &UnsavedPostQuery{config: c.config} query.path = func(ctx context.Context) (fromV *sql.Selector, _ error) { id := ca.ID step := sqlgraph.NewStep( sqlgraph.From(category.Table, category.FieldID, id), sqlgraph.To(unsavedpost.Table, unsavedpost.FieldID), sqlgraph.Edge(sqlgraph.O2M, false, category.UnsavedPostsTable, category.UnsavedPostsColumn), ) fromV = sqlgraph.Neighbors(ca.driver.Dialect(), step) return fromV, nil } return query }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (c *Category) QueryUnsavedPosts() *UnsavedPostQuery {\n\treturn (&CategoryClient{config: c.config}).QueryUnsavedPosts(c)\n}", "func (c *AdminClient) QueryUnsavedPosts(a *Admin) *UnsavedPostQuery {\n\tquery := &UnsavedPostQuery{config: c.config}\n\tquery.path = func(ctx context.Context) (fromV *sql.Selector, _ error) {\n\t\tid := a.ID\n\t\tstep := sqlgraph.NewStep(\n\t\t\tsqlgraph.From(admin.Table, admin.FieldID, id),\n\t\t\tsqlgraph.To(unsavedpost.Table, unsavedpost.FieldID),\n\t\t\tsqlgraph.Edge(sqlgraph.O2M, false, admin.UnsavedPostsTable, admin.UnsavedPostsColumn),\n\t\t)\n\t\tfromV = sqlgraph.Neighbors(a.driver.Dialect(), step)\n\t\treturn fromV, nil\n\t}\n\treturn query\n}", "func (c *UnsavedPostThumbnailClient) QueryUnsavedPost(upt *UnsavedPostThumbnail) *UnsavedPostQuery {\n\tquery := &UnsavedPostQuery{config: c.config}\n\tquery.path = func(ctx context.Context) (fromV *sql.Selector, _ error) {\n\t\tid := upt.ID\n\t\tstep := sqlgraph.NewStep(\n\t\t\tsqlgraph.From(unsavedpostthumbnail.Table, unsavedpostthumbnail.FieldID, id),\n\t\t\tsqlgraph.To(unsavedpost.Table, unsavedpost.FieldID),\n\t\t\tsqlgraph.Edge(sqlgraph.O2O, true, unsavedpostthumbnail.UnsavedPostTable, unsavedpostthumbnail.UnsavedPostColumn),\n\t\t)\n\t\tfromV = sqlgraph.Neighbors(upt.driver.Dialect(), step)\n\t\treturn fromV, nil\n\t}\n\treturn query\n}", "func (c *UnsavedPostImageClient) QueryUnsavedPost(upi *UnsavedPostImage) *UnsavedPostQuery {\n\tquery := &UnsavedPostQuery{config: c.config}\n\tquery.path = func(ctx context.Context) (fromV *sql.Selector, _ error) {\n\t\tid := upi.ID\n\t\tstep := sqlgraph.NewStep(\n\t\t\tsqlgraph.From(unsavedpostimage.Table, unsavedpostimage.FieldID, id),\n\t\t\tsqlgraph.To(unsavedpost.Table, unsavedpost.FieldID),\n\t\t\tsqlgraph.Edge(sqlgraph.M2O, true, unsavedpostimage.UnsavedPostTable, unsavedpostimage.UnsavedPostColumn),\n\t\t)\n\t\tfromV = sqlgraph.Neighbors(upi.driver.Dialect(), step)\n\t\treturn fromV, nil\n\t}\n\treturn query\n}", "func (c *UnsavedPostAttachmentClient) QueryUnsavedPost(upa *UnsavedPostAttachment) *UnsavedPostQuery {\n\tquery := &UnsavedPostQuery{config: c.config}\n\tquery.path = func(ctx context.Context) (fromV *sql.Selector, _ error) {\n\t\tid := upa.ID\n\t\tstep := sqlgraph.NewStep(\n\t\t\tsqlgraph.From(unsavedpostattachment.Table, unsavedpostattachment.FieldID, id),\n\t\t\tsqlgraph.To(unsavedpost.Table, unsavedpost.FieldID),\n\t\t\tsqlgraph.Edge(sqlgraph.M2O, true, unsavedpostattachment.UnsavedPostTable, unsavedpostattachment.UnsavedPostColumn),\n\t\t)\n\t\tfromV = sqlgraph.Neighbors(upa.driver.Dialect(), step)\n\t\treturn fromV, nil\n\t}\n\treturn query\n}", "func (c *UnsavedPostVideoClient) QueryUnsavedPost(upv *UnsavedPostVideo) *UnsavedPostQuery {\n\tquery := &UnsavedPostQuery{config: c.config}\n\tquery.path = func(ctx context.Context) (fromV *sql.Selector, _ error) {\n\t\tid := upv.ID\n\t\tstep := sqlgraph.NewStep(\n\t\t\tsqlgraph.From(unsavedpostvideo.Table, unsavedpostvideo.FieldID, id),\n\t\t\tsqlgraph.To(unsavedpost.Table, unsavedpost.FieldID),\n\t\t\tsqlgraph.Edge(sqlgraph.M2O, true, unsavedpostvideo.UnsavedPostTable, unsavedpostvideo.UnsavedPostColumn),\n\t\t)\n\t\tfromV = sqlgraph.Neighbors(upv.driver.Dialect(), step)\n\t\treturn fromV, nil\n\t}\n\treturn query\n}", "func (c *UnsavedPostClient) QueryCategory(up *UnsavedPost) *CategoryQuery {\n\tquery := &CategoryQuery{config: c.config}\n\tquery.path = func(ctx context.Context) (fromV *sql.Selector, _ error) {\n\t\tid := up.ID\n\t\tstep := sqlgraph.NewStep(\n\t\t\tsqlgraph.From(unsavedpost.Table, unsavedpost.FieldID, id),\n\t\t\tsqlgraph.To(category.Table, category.FieldID),\n\t\t\tsqlgraph.Edge(sqlgraph.M2O, true, unsavedpost.CategoryTable, unsavedpost.CategoryColumn),\n\t\t)\n\t\tfromV = sqlgraph.Neighbors(up.driver.Dialect(), step)\n\t\treturn fromV, nil\n\t}\n\treturn query\n}", "func (upq *UnsavedPostQuery) QueryCategory() *CategoryQuery {\n\tquery := &CategoryQuery{config: upq.config}\n\tquery.path = func(ctx context.Context) (fromU *sql.Selector, err error) {\n\t\tif err := upq.prepareQuery(ctx); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tselector := upq.sqlQuery(ctx)\n\t\tif err := selector.Err(); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tstep := sqlgraph.NewStep(\n\t\t\tsqlgraph.From(unsavedpost.Table, unsavedpost.FieldID, selector),\n\t\t\tsqlgraph.To(category.Table, category.FieldID),\n\t\t\tsqlgraph.Edge(sqlgraph.M2O, true, unsavedpost.CategoryTable, unsavedpost.CategoryColumn),\n\t\t)\n\t\tfromU = sqlgraph.SetNeighbors(upq.driver.Dialect(), step)\n\t\treturn fromU, nil\n\t}\n\treturn query\n}", "func (e CategoryEdges) UnsavedPostsOrErr() ([]*UnsavedPost, error) {\n\tif e.loadedTypes[1] {\n\t\treturn e.UnsavedPosts, nil\n\t}\n\treturn nil, &NotLoadedError{edge: \"unsaved_posts\"}\n}", "func (upq *UnsavedPostQuery) All(ctx context.Context) ([]*UnsavedPost, error) {\n\tif err := upq.prepareQuery(ctx); err != nil {\n\t\treturn nil, err\n\t}\n\treturn upq.sqlAll(ctx)\n}", "func (c *CategoryClient) QueryPosts(ca *Category) *PostQuery {\n\tquery := &PostQuery{config: c.config}\n\tquery.path = func(ctx context.Context) (fromV *sql.Selector, _ error) {\n\t\tid := ca.ID\n\t\tstep := sqlgraph.NewStep(\n\t\t\tsqlgraph.From(category.Table, category.FieldID, id),\n\t\t\tsqlgraph.To(post.Table, post.FieldID),\n\t\t\tsqlgraph.Edge(sqlgraph.O2M, false, category.PostsTable, category.PostsColumn),\n\t\t)\n\t\tfromV = sqlgraph.Neighbors(ca.driver.Dialect(), step)\n\t\treturn fromV, nil\n\t}\n\treturn query\n}", "func (c *Category) QueryPosts() *PostQuery {\n\treturn (&CategoryClient{config: c.config}).QueryPosts(c)\n}", "func (upq *UnsavedPostQuery) WithCategory(opts ...func(*CategoryQuery)) *UnsavedPostQuery {\n\tquery := &CategoryQuery{config: upq.config}\n\tfor _, opt := range opts {\n\t\topt(query)\n\t}\n\tupq.withCategory = query\n\treturn upq\n}", "func (env *Env) GetUnpublishedPosts(w http.ResponseWriter, r *http.Request) {\n\tctx := r.Context()\n\tuser := ctx.Value(contextUser).(*models.User)\n\t// Just a double check - should we remove?\n\tif user.Role != \"ADMIN\" {\n\t\tw.WriteHeader(http.StatusForbidden)\n\t}\n\tp, err := env.DB.UnpublishedPosts()\n\tif err != nil {\n\t\tenv.log(r, err)\n\t\tw.WriteHeader(http.StatusNotFound)\n\t\treturn\n\t}\n\tw.Header().Set(\"Content-Type\", \"application/json\")\n\tw.WriteHeader(http.StatusOK)\n\tjson.NewEncoder(w).Encode(p)\n}", "func (c *AdminClient) QueryPosts(a *Admin) *PostQuery {\n\tquery := &PostQuery{config: c.config}\n\tquery.path = func(ctx context.Context) (fromV *sql.Selector, _ error) {\n\t\tid := a.ID\n\t\tstep := sqlgraph.NewStep(\n\t\t\tsqlgraph.From(admin.Table, admin.FieldID, id),\n\t\t\tsqlgraph.To(post.Table, post.FieldID),\n\t\t\tsqlgraph.Edge(sqlgraph.O2M, false, admin.PostsTable, admin.PostsColumn),\n\t\t)\n\t\tfromV = sqlgraph.Neighbors(a.driver.Dialect(), step)\n\t\treturn fromV, nil\n\t}\n\treturn query\n}", "func (c *UnsavedPostClient) Get(ctx context.Context, id int) (*UnsavedPost, error) {\n\treturn c.Query().Where(unsavedpost.ID(id)).Only(ctx)\n}", "func (upu *UnsavedPostUpdate) ClearCategory() *UnsavedPostUpdate {\n\tupu.mutation.ClearCategory()\n\treturn upu\n}", "func (m *UserMutation) ClearPosts() {\n\tm.clearedposts = true\n}", "func (upq *UnsavedPostQuery) QueryImages() *UnsavedPostImageQuery {\n\tquery := &UnsavedPostImageQuery{config: upq.config}\n\tquery.path = func(ctx context.Context) (fromU *sql.Selector, err error) {\n\t\tif err := upq.prepareQuery(ctx); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tselector := upq.sqlQuery(ctx)\n\t\tif err := selector.Err(); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tstep := sqlgraph.NewStep(\n\t\t\tsqlgraph.From(unsavedpost.Table, unsavedpost.FieldID, selector),\n\t\t\tsqlgraph.To(unsavedpostimage.Table, unsavedpostimage.FieldID),\n\t\t\tsqlgraph.Edge(sqlgraph.O2M, false, unsavedpost.ImagesTable, unsavedpost.ImagesColumn),\n\t\t)\n\t\tfromU = sqlgraph.SetNeighbors(upq.driver.Dialect(), step)\n\t\treturn fromU, nil\n\t}\n\treturn query\n}", "func (c *UnsavedPostClient) Query() *UnsavedPostQuery {\n\treturn &UnsavedPostQuery{\n\t\tconfig: c.config,\n\t}\n}", "func (postL) LoadPostHistories(ctx context.Context, e boil.ContextExecutor, singular bool, maybePost interface{}, mods queries.Applicator) error {\n\tvar slice []*Post\n\tvar object *Post\n\n\tif singular {\n\t\tobject = maybePost.(*Post)\n\t} else {\n\t\tslice = *maybePost.(*[]*Post)\n\t}\n\n\targs := make([]interface{}, 0, 1)\n\tif singular {\n\t\tif object.R == nil {\n\t\t\tobject.R = &postR{}\n\t\t}\n\t\targs = append(args, object.ID)\n\t} else {\n\tOuter:\n\t\tfor _, obj := range slice {\n\t\t\tif obj.R == nil {\n\t\t\t\tobj.R = &postR{}\n\t\t\t}\n\n\t\t\tfor _, a := range args {\n\t\t\t\tif a == obj.ID {\n\t\t\t\t\tcontinue Outer\n\t\t\t\t}\n\t\t\t}\n\n\t\t\targs = append(args, obj.ID)\n\t\t}\n\t}\n\n\tquery := NewQuery(qm.From(`post_histories`), qm.WhereIn(`post_id in ?`, args...))\n\tif mods != nil {\n\t\tmods.Apply(query)\n\t}\n\n\tresults, err := query.QueryContext(ctx, e)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"failed to eager load post_histories\")\n\t}\n\n\tvar resultSlice []*PostHistory\n\tif err = queries.Bind(results, &resultSlice); err != nil {\n\t\treturn errors.Wrap(err, \"failed to bind eager loaded slice post_histories\")\n\t}\n\n\tif err = results.Close(); err != nil {\n\t\treturn errors.Wrap(err, \"failed to close results in eager load on post_histories\")\n\t}\n\tif err = results.Err(); err != nil {\n\t\treturn errors.Wrap(err, \"error occurred during iteration of eager loaded relations for post_histories\")\n\t}\n\n\tif len(postHistoryAfterSelectHooks) != 0 {\n\t\tfor _, obj := range resultSlice {\n\t\t\tif err := obj.doAfterSelectHooks(ctx, e); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\tif singular {\n\t\tobject.R.PostHistories = resultSlice\n\t\tfor _, foreign := range resultSlice {\n\t\t\tif foreign.R == nil {\n\t\t\t\tforeign.R = &postHistoryR{}\n\t\t\t}\n\t\t\tforeign.R.Post = object\n\t\t}\n\t\treturn nil\n\t}\n\n\tfor _, foreign := range resultSlice {\n\t\tfor _, local := range slice {\n\t\t\tif local.ID == foreign.PostID {\n\t\t\t\tlocal.R.PostHistories = append(local.R.PostHistories, foreign)\n\t\t\t\tif foreign.R == nil {\n\t\t\t\t\tforeign.R = &postHistoryR{}\n\t\t\t\t}\n\t\t\t\tforeign.R.Post = local\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t}\n\n\treturn nil\n}", "func (c *UnsavedPostClient) QueryImages(up *UnsavedPost) *UnsavedPostImageQuery {\n\tquery := &UnsavedPostImageQuery{config: c.config}\n\tquery.path = func(ctx context.Context) (fromV *sql.Selector, _ error) {\n\t\tid := up.ID\n\t\tstep := sqlgraph.NewStep(\n\t\t\tsqlgraph.From(unsavedpost.Table, unsavedpost.FieldID, id),\n\t\t\tsqlgraph.To(unsavedpostimage.Table, unsavedpostimage.FieldID),\n\t\t\tsqlgraph.Edge(sqlgraph.O2M, false, unsavedpost.ImagesTable, unsavedpost.ImagesColumn),\n\t\t)\n\t\tfromV = sqlgraph.Neighbors(up.driver.Dialect(), step)\n\t\treturn fromV, nil\n\t}\n\treturn query\n}", "func (m *UserMutation) PostsCleared() bool {\n\treturn m.clearedposts\n}", "func (upq *UnsavedPostQuery) Clone() *UnsavedPostQuery {\n\tif upq == nil {\n\t\treturn nil\n\t}\n\treturn &UnsavedPostQuery{\n\t\tconfig: upq.config,\n\t\tlimit: upq.limit,\n\t\toffset: upq.offset,\n\t\torder: append([]OrderFunc{}, upq.order...),\n\t\tpredicates: append([]predicate.UnsavedPost{}, upq.predicates...),\n\t\twithAuthor: upq.withAuthor.Clone(),\n\t\twithCategory: upq.withCategory.Clone(),\n\t\twithThumbnail: upq.withThumbnail.Clone(),\n\t\twithImages: upq.withImages.Clone(),\n\t\twithVideos: upq.withVideos.Clone(),\n\t\twithAttachments: upq.withAttachments.Clone(),\n\t\t// clone intermediate query.\n\t\tsql: upq.sql.Clone(),\n\t\tpath: upq.path,\n\t}\n}", "func (upq *UnsavedPostQuery) AllX(ctx context.Context) []*UnsavedPost {\n\tnodes, err := upq.All(ctx)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn nodes\n}", "func (c *PostClient) QueryCategory(po *Post) *CategoryQuery {\n\tquery := &CategoryQuery{config: c.config}\n\tquery.path = func(ctx context.Context) (fromV *sql.Selector, _ error) {\n\t\tid := po.ID\n\t\tstep := sqlgraph.NewStep(\n\t\t\tsqlgraph.From(post.Table, post.FieldID, id),\n\t\t\tsqlgraph.To(category.Table, category.FieldID),\n\t\t\tsqlgraph.Edge(sqlgraph.M2O, true, post.CategoryTable, post.CategoryColumn),\n\t\t)\n\t\tfromV = sqlgraph.Neighbors(po.driver.Dialect(), step)\n\t\treturn fromV, nil\n\t}\n\treturn query\n}", "func (u *User) QueryPosts() *ExperienceQuery {\n\treturn (&UserClient{config: u.config}).QueryPosts(u)\n}", "func (c *UnsavedPostClient) QueryAttachments(up *UnsavedPost) *UnsavedPostAttachmentQuery {\n\tquery := &UnsavedPostAttachmentQuery{config: c.config}\n\tquery.path = func(ctx context.Context) (fromV *sql.Selector, _ error) {\n\t\tid := up.ID\n\t\tstep := sqlgraph.NewStep(\n\t\t\tsqlgraph.From(unsavedpost.Table, unsavedpost.FieldID, id),\n\t\t\tsqlgraph.To(unsavedpostattachment.Table, unsavedpostattachment.FieldID),\n\t\t\tsqlgraph.Edge(sqlgraph.O2M, false, unsavedpost.AttachmentsTable, unsavedpost.AttachmentsColumn),\n\t\t)\n\t\tfromV = sqlgraph.Neighbors(up.driver.Dialect(), step)\n\t\treturn fromV, nil\n\t}\n\treturn query\n}", "func (upq *UnsavedPostQuery) QueryAttachments() *UnsavedPostAttachmentQuery {\n\tquery := &UnsavedPostAttachmentQuery{config: upq.config}\n\tquery.path = func(ctx context.Context) (fromU *sql.Selector, err error) {\n\t\tif err := upq.prepareQuery(ctx); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tselector := upq.sqlQuery(ctx)\n\t\tif err := selector.Err(); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tstep := sqlgraph.NewStep(\n\t\t\tsqlgraph.From(unsavedpost.Table, unsavedpost.FieldID, selector),\n\t\t\tsqlgraph.To(unsavedpostattachment.Table, unsavedpostattachment.FieldID),\n\t\t\tsqlgraph.Edge(sqlgraph.O2M, false, unsavedpost.AttachmentsTable, unsavedpost.AttachmentsColumn),\n\t\t)\n\t\tfromU = sqlgraph.SetNeighbors(upq.driver.Dialect(), step)\n\t\treturn fromU, nil\n\t}\n\treturn query\n}", "func (b *blogsQueryBuilder) RemovePosts() (int64, error) {\n\tif b.err != nil {\n\t\treturn 0, b.err\n\t}\n\trelation, err := NRN_Blogs.Model.RelationByIndex(3)\n\tif err != nil {\n\t\treturn 0, errors.Wrapf(mapping.ErrInternal, \"getting 'Posts' relation by index for model 'Blog' failed: %v\", err)\n\t}\n\treturn b.builder.RemoveRelations(relation)\n}", "func (db *Database) GetAllPosts() ([]models.Post, error) {\n\tvar posts []models.Post\n\terr := db.DB.Model(&posts).Select()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn posts, nil\n}", "func (o *Post) PostHistories(mods ...qm.QueryMod) postHistoryQuery {\n\tvar queryMods []qm.QueryMod\n\tif len(mods) != 0 {\n\t\tqueryMods = append(queryMods, mods...)\n\t}\n\n\tqueryMods = append(queryMods,\n\t\tqm.Where(\"\\\"post_histories\\\".\\\"post_id\\\"=?\", o.ID),\n\t)\n\n\tquery := PostHistories(queryMods...)\n\tqueries.SetFrom(query.Query, \"\\\"post_histories\\\"\")\n\n\tif len(queries.GetSelect(query.Query)) == 0 {\n\t\tqueries.SetSelect(query.Query, []string{\"\\\"post_histories\\\".*\"})\n\t}\n\n\treturn query\n}", "func ReadPostsDraft() []models.PostsModel {\n\tdb, err := driver.Connect()\n\n\tif err != nil {\n\t\tfmt.Println(err.Error())\n\t\treturn nil\n\t}\n\n\tdefer db.Close()\n\n\tvar result []models.PostsModel\n\n\titems, err := db.Query(\"select id, title, content, category, status from posts where status='Draft'\")\n\tif err != nil {\n\t\tfmt.Println(err.Error())\n\t\treturn nil\n\t}\n\n\tfmt.Printf(\"%T\\n\", items)\n\n\tfor items.Next() {\n\t\tvar each = models.PostsModel{}\n\t\tvar err = items.Scan(&each.Id, &each.Title, &each.Content, &each.Category, &each.Status)\n\n\t\tif err != nil {\n\t\t\tfmt.Println(err.Error())\n\t\t\treturn nil\n\t\t}\n\n\t\tresult = append(result, each)\n\n\t}\n\n\tif err = items.Err(); err != nil {\n\t\tfmt.Println(err.Error())\n\t\treturn nil\n\t}\n\n\treturn result\n}", "func ReadPostsTrash() []models.PostsModel {\n\tdb, err := driver.Connect()\n\n\tif err != nil {\n\t\tfmt.Println(err.Error())\n\t\treturn nil\n\t}\n\n\tdefer db.Close()\n\n\tvar result []models.PostsModel\n\n\titems, err := db.Query(\"select id, title, content, category, status from posts where status='Trash'\")\n\tif err != nil {\n\t\tfmt.Println(err.Error())\n\t\treturn nil\n\t}\n\n\tfmt.Printf(\"%T\\n\", items)\n\n\tfor items.Next() {\n\t\tvar each = models.PostsModel{}\n\t\tvar err = items.Scan(&each.Id, &each.Title, &each.Content, &each.Category, &each.Status)\n\n\t\tif err != nil {\n\t\t\tfmt.Println(err.Error())\n\t\t\treturn nil\n\t\t}\n\n\t\tresult = append(result, each)\n\n\t}\n\n\tif err = items.Err(); err != nil {\n\t\tfmt.Println(err.Error())\n\t\treturn nil\n\t}\n\n\treturn result\n}", "func (r Repository) Posts(categoryName string, topic string) ([]DbPost, string) {\n\tthreads := r.Threads(categoryName)\n\tthread := filter(threads, func(t DbThread) bool {\n\t\treturn t.Topic == topic\n\t})\n\treturn thread[0].Posts, thread[0].Description\n}", "func PostsByCategory(categoryEng string) ([]Post, error) {\n\tconfig.Session.Refresh()\n\tcurrentSession := config.Session.Copy()\n\tdefer currentSession.Close()\n\n\tposts := []Post{}\n\tif err := config.Posts.Find(bson.M{\"categoryeng\": categoryEng}).All(&posts); err != nil {\n\t\treturn nil, errors.Wrapf(err, \"find posts by category [%s]\", categoryEng)\n\t}\n\n\treverse(posts)\n\n\treturn posts, nil\n}", "func (upq *UnsavedPostQuery) Where(ps ...predicate.UnsavedPost) *UnsavedPostQuery {\n\tupq.predicates = append(upq.predicates, ps...)\n\treturn upq\n}", "func (m *IGApiManager) GetSavedPosts() (items []IGItem, err error) {\n\tb, err := getHTTPResponse(urlSaved, m.dsUserId, m.sessionid, m.csrftoken)\n\tif err != nil {\n\t\treturn\n\t}\n\n\tspp := savedPostsResp{}\n\terr = json.Unmarshal(b, &spp)\n\tif err != nil {\n\t\treturn\n\t}\n\tfor _, item := range spp.Items {\n\t\titems = append(items, item.Item)\n\t}\n\n\tfor spp.MoreAvailable {\n\t\turl := urlSaved + \"?max_id=\" + spp.NextMaxId\n\t\tb, err = getHTTPResponse(url, m.dsUserId, m.sessionid, m.csrftoken)\n\t\tif err != nil {\n\t\t\treturn\n\t\t}\n\t\tspp = savedPostsResp{}\n\t\terr = json.Unmarshal(b, &spp)\n\t\tif err != nil {\n\t\t\treturn\n\t\t}\n\t\tfor _, item := range spp.Items {\n\t\t\titems = append(items, item.Item)\n\t\t}\n\t\tlog.Println(\"fetched\", len(items), \"items\")\n\t\t// sleep 500ms to prevent http 429\n\t\ttime.Sleep(500 * time.Millisecond)\n\t}\n\n\treturn\n}", "func (b *_Blogs) ClearPostsRelation(ctx context.Context, db database.DB, models ...*Blog) (int64, error) {\n\trelation, err := b.Model.RelationByIndex(3)\n\tif err != nil {\n\t\treturn 0, err\n\t}\n\tmodelInterfaces := make([]mapping.Model, len(models))\n\tfor i := range models {\n\t\tmodelInterfaces[i] = models[i]\n\t}\n\ts := query.NewScope(b.Model, modelInterfaces...)\n\trelationClearer, ok := db.(database.QueryRelationClearer)\n\tif !ok {\n\t\treturn 0, errors.WrapDetf(query.ErrInternal, \"DB doesn't implement QueryRelationAdder interface - %T\", db)\n\t}\n\treturn relationClearer.QueryClearRelations(ctx, s, relation)\n}", "func (upvc *UnsavedPostVideoCreate) SetUnsavedPost(u *UnsavedPost) *UnsavedPostVideoCreate {\n\treturn upvc.SetUnsavedPostID(u.ID)\n}", "func (m *UserMutation) ResetPosts() {\n\tm.posts = nil\n\tm.clearedposts = false\n\tm.removedposts = nil\n}", "func (r *queryResolver) Posts(ctx context.Context, after *entgql.Cursor[int], first *int, before *entgql.Cursor[int], last *int, orderBy *ent.PostOrder, where *ent.PostWhereInput) (*ent.PostConnection, error) {\n\tconn, err := ent.FromContext(ctx).Post.Query().Paginate(\n\t\tctx, after, first, before, last,\n\t\tent.WithPostOrder(orderBy),\n\t\tent.WithPostFilter(where.Filter),\n\t)\n\n\tif err == nil && conn.TotalCount == 1 {\n\t\tpost := conn.Edges[0].Node\n\n\t\tif post.ContentHTML == \"\" {\n\t\t\treturn conn, nil\n\t\t}\n\n\t\tgo database.PostViewCounter(ctx, post)\n\t}\n\n\treturn conn, err\n}", "func Posts(mods ...qm.QueryMod) postQuery {\n\tmods = append(mods, qm.From(\"\\\"posts\\\"\"))\n\treturn postQuery{NewQuery(mods...)}\n}", "func (k Keeper) Posts(goCtx context.Context, req *types.QueryPostsRequest) (*types.QueryPostsResponse, error) {\n\tvar posts []types.Post\n\tctx := sdk.UnwrapSDKContext(goCtx)\n\n\tif !subspacestypes.IsValidSubspace(req.SubspaceId) {\n\t\treturn nil, sdkerrors.Wrapf(subspacestypes.ErrInvalidSubspaceID, req.SubspaceId)\n\t}\n\n\tstore := ctx.KVStore(k.storeKey)\n\tpostsStore := prefix.NewStore(store, types.SubspacePostsPrefix(req.SubspaceId))\n\n\tpageRes, err := query.Paginate(postsStore, req.Pagination, func(key []byte, value []byte) error {\n\t\tstore := ctx.KVStore(k.storeKey)\n\t\tbz := store.Get(types.PostStoreKey(string(value)))\n\n\t\tvar post types.Post\n\t\tif err := k.cdc.UnmarshalBinaryBare(bz, &post); err != nil {\n\t\t\treturn status.Error(codes.Internal, err.Error())\n\t\t}\n\n\t\tposts = append(posts, post)\n\t\treturn nil\n\t})\n\n\tif err != nil {\n\t\treturn nil, status.Error(codes.Internal, err.Error())\n\t}\n\n\treturn &types.QueryPostsResponse{Posts: posts, Pagination: pageRes}, nil\n}", "func (s *Store) FindAllPosts(filter bson.M, opts ...*options.FindOptions) ([]models.Post, error) {\n\tvar ctx, cancel = context.WithTimeout(context.Background(), 10*time.Second)\n\tdefer cancel()\n\n\tdb := s.db.Database(dbName)\n\tcol := db.Collection(\"posts\")\n\tcur, err := col.Find(ctx, filter, opts...)\n\t// cur, err := col.Find(ctx, bson.M{\"categoryurl\": \"/category/news\", \"deleted\": false}, opts...)\n\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tposts := make([]models.Post, 0)\n\n\terr = cur.All(ctx, &posts)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn posts, nil\n}", "func (p *_Posts) Query(db database.DB, models ...*Post) *postsQueryBuilder {\n\tvar queryModels []mapping.Model\n\tif len(models) > 0 {\n\t\tqueryModels = make([]mapping.Model, len(models))\n\t\tfor i, model := range models {\n\t\t\tqueryModels[i] = model\n\t\t}\n\t}\n\tbuilder := db.Query(p.Model, queryModels...)\n\treturn &postsQueryBuilder{builder: builder}\n}", "func (q postQuery) DeleteAll(ctx context.Context, exec boil.ContextExecutor) (int64, error) {\n\tif q.Query == nil {\n\t\treturn 0, errors.New(\"orm: no postQuery provided for delete all\")\n\t}\n\n\tqueries.SetDelete(q.Query)\n\n\tresult, err := q.Query.ExecContext(ctx, exec)\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"orm: unable to delete all from posts\")\n\t}\n\n\trowsAff, err := result.RowsAffected()\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"orm: failed to get rows affected by deleteall for posts\")\n\t}\n\n\treturn rowsAff, nil\n}", "func (upuo *UnsavedPostUpdateOne) ClearCategory() *UnsavedPostUpdateOne {\n\tupuo.mutation.ClearCategory()\n\treturn upuo\n}", "func (upq *UnsavedPostQuery) Count(ctx context.Context) (int, error) {\n\tif err := upq.prepareQuery(ctx); err != nil {\n\t\treturn 0, err\n\t}\n\treturn upq.sqlCount(ctx)\n}", "func (bl *postBusiness) GetAll() (*models.Posts, *apperror.AppError) {\n\treturn bl.service.GetAll()\n}", "func (upu *UnsavedPostUpdate) ClearImages() *UnsavedPostUpdate {\n\tupu.mutation.ClearImages()\n\treturn upu\n}", "func (bav *UtxoView) GetAllPosts() (_corePosts []*PostEntry, _commentsByPostHash map[BlockHash][]*PostEntry, _err error) {\n\t// Start by fetching all the posts we have in the db.\n\t//\n\t// TODO(performance): This currently fetches all posts. We should implement\n\t// some kind of pagination instead though.\n\t_, _, dbPostEntries, err := DBGetAllPostsByTstamp(bav.Handle, true /*fetchEntries*/)\n\tif err != nil {\n\t\treturn nil, nil, errors.Wrapf(err, \"GetAllPosts: Problem fetching PostEntry's from db: \")\n\t}\n\n\t// Iterate through the entries found in the db and force the view to load them.\n\t// This fills in any gaps in the view so that, after this, the view should contain\n\t// the union of what it had before plus what was in the db.\n\tfor _, dbPostEntry := range dbPostEntries {\n\t\tbav.GetPostEntryForPostHash(dbPostEntry.PostHash)\n\t}\n\n\t// Do one more pass to load all the comments from the DB.\n\tfor _, postEntry := range bav.PostHashToPostEntry {\n\t\t// Ignore deleted or rolled-back posts.\n\t\tif postEntry.isDeleted {\n\t\t\tcontinue\n\t\t}\n\n\t\t// If we have a post in the view and if that post is not a comment\n\t\t// then fetch its attached comments from the db. We need to do this\n\t\t// because the tstamp index above only fetches \"core\" posts not\n\t\t// comments.\n\n\t\tif len(postEntry.ParentStakeID) == 0 {\n\t\t\t_, dbCommentHashes, _, err := DBGetCommentPostHashesForParentStakeID(\n\t\t\t\tbav.Handle, postEntry.ParentStakeID, false /*fetchEntries*/)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, nil, errors.Wrapf(err, \"GetAllPosts: Problem fetching comment PostEntry's from db: \")\n\t\t\t}\n\t\t\tfor _, commentHash := range dbCommentHashes {\n\t\t\t\tbav.GetPostEntryForPostHash(commentHash)\n\t\t\t}\n\t\t}\n\t}\n\n\tallCorePosts := []*PostEntry{}\n\tcommentsByPostHash := make(map[BlockHash][]*PostEntry)\n\tfor _, postEntry := range bav.PostHashToPostEntry {\n\t\t// Ignore deleted or rolled-back posts.\n\t\tif postEntry.isDeleted {\n\t\t\tcontinue\n\t\t}\n\n\t\t// Every post is either a core post or a comment. If it has a stake ID\n\t\t// its a comment, and if it doesn't then it's a core post.\n\t\tif len(postEntry.ParentStakeID) == 0 {\n\t\t\tallCorePosts = append(allCorePosts, postEntry)\n\t\t} else {\n\t\t\t// Add the comment to our map.\n\t\t\tcommentsForPost := commentsByPostHash[*StakeIDToHash(postEntry.ParentStakeID)]\n\t\t\tcommentsForPost = append(commentsForPost, postEntry)\n\t\t\tcommentsByPostHash[*StakeIDToHash(postEntry.ParentStakeID)] = commentsForPost\n\t\t}\n\t}\n\t// Sort all the comment lists as well. Here we put the latest comment at the\n\t// end.\n\tfor _, commentList := range commentsByPostHash {\n\t\tsort.Slice(commentList, func(ii, jj int) bool {\n\t\t\treturn commentList[ii].TimestampNanos < commentList[jj].TimestampNanos\n\t\t})\n\t}\n\n\treturn allCorePosts, commentsByPostHash, nil\n}", "func AllPosts() ([]*PostMessage, error) {\n\trows, err := db.Query(\"SELECT * FROM posts\")\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer rows.Close()\n\n\tposts := make([]*PostMessage, 0)\n\tfor rows.Next() {\n\t\tpost := new(PostMessage)\n\t\terr := rows.Scan(&post.URL, &post.Text)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tposts = append(posts, post)\n\t}\n\tif err = rows.Err(); err != nil {\n\t\treturn nil, err\n\t}\n\treturn posts, nil\n}", "func (t *tagStorage) QueryCategories() ([]model.CategoryInfo, error) {\n\tvar cs []model.CategoryInfo\n\n\terr := t.db.Table(model.CateTableName()).Where(\"del_flag = ?\", 0).Find(&cs)\n\treturn cs, err\n}", "func NewUnsavedPostClient(c config) *UnsavedPostClient {\n\treturn &UnsavedPostClient{config: c}\n}", "func (r *Resolver) PostQueryResolver(params graphql.ResolveParams) (interface{}, error) {\n\t// Strip the id from arguments and assert type\n\tid, ok := params.Args[\"id\"].(int)\n\tif ok {\n\t\tposts, err := r.Repository.GetByID(id)\n\t\treturn posts, err\n\t}\n\n\t// We didn't get a valid ID as a param, so we return all the posts\n\treturn r.Repository.GetAllPosts()\n}", "func (q bookCategoryQuery) DeleteAll(ctx context.Context, exec boil.ContextExecutor) (int64, error) {\n\tif q.Query == nil {\n\t\treturn 0, errors.New(\"models: no bookCategoryQuery provided for delete all\")\n\t}\n\n\tqueries.SetDelete(q.Query)\n\n\tresult, err := q.Query.ExecContext(ctx, exec)\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: unable to delete all from book_category\")\n\t}\n\n\trowsAff, err := result.RowsAffected()\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: failed to get rows affected by deleteall for book_category\")\n\t}\n\n\treturn rowsAff, nil\n}", "func GetReadyToSendPosts(app *state.AppState) ([]Post, error) {\n\tsession := app.MgoSession.Clone()\n\tdefer session.Close()\n\tvar posts []Post\n\tquery := bson.M{\"isSent\": false, \"sentDate\": bson.M{\"$lt\": Now()}}\n\terr := session.DB(dbName).C(\"posts\").Find(query).All(&posts)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn posts, nil\n}", "func GetPostsFromQuery(context appengine.Context, query *datastore.Query) (*[]Post, error) {\n\n\tvar posts []Post\n\tkeys, err := query.GetAll(context, &posts)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tfor i, key := range keys {\n\t\tposts[i].Id = key.IntID()\n\t}\n\treturn &posts, nil\n}", "func AllPosts() ([]Post, error) {\n\tconfig.Session.Refresh()\n\tcurrentSession := config.Session.Copy()\n\tdefer currentSession.Close()\n\n\tposts := make([]Post, 0)\n\tif err := config.Posts.Find(bson.M{}).All(&posts); err != nil {\n\t\treturn nil, errors.Wrap(err, \"find all posts\")\n\t}\n\n\treverse(posts)\n\n\treturn posts, nil\n}", "func (t *Thread) filter() {\n\ttemp := []*Post{}\n\tfor _, p := range t.Posts {\n\t\tif p.Name != 0 {\n\t\t\ttemp = append(temp, p)\n\t\t}\n\t}\n\tt.Posts = temp\n}", "func (repository *GormRepository) GetAllUnscoped(uow *UnitOfWork, out interface{}, queryProcessors []QueryProcessor) microappError.DatabaseError {\n\tdb := uow.DB\n\n\tif queryProcessors != nil {\n\t\tvar err error\n\t\tfor _, queryProcessor := range queryProcessors {\n\t\t\tdb, err = queryProcessor(db, out)\n\t\t\tif err != nil {\n\t\t\t\treturn microappError.NewDatabaseError(err)\n\t\t\t}\n\t\t}\n\t}\n\tif err := db.Unscoped().Find(out).Error; err != nil {\n\t\treturn microappError.NewDatabaseError(err)\n\t}\n\treturn nil\n}", "func (s *MockStore) GetRecentPosts(limit int) (ps []Post, err error) {\n\tfor i := s.serial - 1; i > 0; i-- {\n\t\tif len(ps) == limit {\n\t\t\tbreak\n\t\t}\n\t\tp, ok := s.mem[i]\n\t\tif ok {\n\t\t\tps = append(ps, p)\n\t\t}\n\t}\n\treturn ps, err\n}", "func (c *PostAttachmentClient) QueryPost(pa *PostAttachment) *PostQuery {\n\tquery := &PostQuery{config: c.config}\n\tquery.path = func(ctx context.Context) (fromV *sql.Selector, _ error) {\n\t\tid := pa.ID\n\t\tstep := sqlgraph.NewStep(\n\t\t\tsqlgraph.From(postattachment.Table, postattachment.FieldID, id),\n\t\t\tsqlgraph.To(post.Table, post.FieldID),\n\t\t\tsqlgraph.Edge(sqlgraph.M2O, true, postattachment.PostTable, postattachment.PostColumn),\n\t\t)\n\t\tfromV = sqlgraph.Neighbors(pa.driver.Dialect(), step)\n\t\treturn fromV, nil\n\t}\n\treturn query\n}", "func (r *ConversationThreadPostsCollectionRequest) Get(ctx context.Context) ([]Post, error) {\n\tvar query string\n\tif r.query != nil {\n\t\tquery = \"?\" + r.query.Encode()\n\t}\n\treturn r.Paging(ctx, \"GET\", query, nil)\n}", "func (c *UnsavedPostAttachmentClient) Query() *UnsavedPostAttachmentQuery {\n\treturn &UnsavedPostAttachmentQuery{\n\t\tconfig: c.config,\n\t}\n}", "func (k Keeper) GetPosts(ctx sdk.Context) []types.Post {\n\tvar posts []types.Post\n\tk.IteratePosts(ctx, func(_ int64, post types.Post) (stop bool) {\n\t\tposts = append(posts, post)\n\t\treturn false\n\t})\n\n\treturn posts\n}", "func (upq *UnsavedPostQuery) QueryAuthor() *AdminQuery {\n\tquery := &AdminQuery{config: upq.config}\n\tquery.path = func(ctx context.Context) (fromU *sql.Selector, err error) {\n\t\tif err := upq.prepareQuery(ctx); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tselector := upq.sqlQuery(ctx)\n\t\tif err := selector.Err(); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tstep := sqlgraph.NewStep(\n\t\t\tsqlgraph.From(unsavedpost.Table, unsavedpost.FieldID, selector),\n\t\t\tsqlgraph.To(admin.Table, admin.FieldID),\n\t\t\tsqlgraph.Edge(sqlgraph.M2O, true, unsavedpost.AuthorTable, unsavedpost.AuthorColumn),\n\t\t)\n\t\tfromU = sqlgraph.SetNeighbors(upq.driver.Dialect(), step)\n\t\treturn fromU, nil\n\t}\n\treturn query\n}", "func (c *PostThumbnailClient) QueryPost(pt *PostThumbnail) *PostQuery {\n\tquery := &PostQuery{config: c.config}\n\tquery.path = func(ctx context.Context) (fromV *sql.Selector, _ error) {\n\t\tid := pt.ID\n\t\tstep := sqlgraph.NewStep(\n\t\t\tsqlgraph.From(postthumbnail.Table, postthumbnail.FieldID, id),\n\t\t\tsqlgraph.To(post.Table, post.FieldID),\n\t\t\tsqlgraph.Edge(sqlgraph.O2O, true, postthumbnail.PostTable, postthumbnail.PostColumn),\n\t\t)\n\t\tfromV = sqlgraph.Neighbors(pt.driver.Dialect(), step)\n\t\treturn fromV, nil\n\t}\n\treturn query\n}", "func (repo *feedRepository) GetPosts(f *feed.Feed, sort feed.Sorting, limit, offset int) ([]*feed.Post, error) {\n\tvar err error\n\n\tvar rows *sql.Rows\n\tswitch sort {\n\t// TODO test queries with actual posts\n\tcase feed.SortNew:\n\t\trows, err = repo.db.Query(`\n\t\tSELECT id\n\t\tFROM\t(SELECT id, creation_time\n\t\t\t\t FROM (\n\t\t\t\t SELECT channel_username\n\t\t\t\t FROM feed_subscriptions\n\t\t\t\t WHERE feed_id = $1\n\t\t\t\t ) AS C (channel_from)\n\t\t\t\t NATURAL JOIN\n\t\t\t\t posts\n\t\t\t\t ) AS P\n\t\tORDER BY creation_time DESC NULLS LAST LIMIT $2 OFFSET $3`, f.ID, limit, offset)\n\tcase feed.SortHot:\n\t\trows, err = repo.db.Query(`\n\t\tSELECT post_id\n\t\tFROM(SELECT LP.post_id, comment_count\n\t\t\tFROM(\n\t\t\t SELECT *\n\t\t\t\tFROM (SELECT id, creation_time\n\t\t\t\t FROM (\n\t\t\t\t SELECT channel_username\n\t\t\t\t FROM feed_subscriptions\n\t\t\t\t WHERE feed_id = $1\n\t\t\t\t ) AS C (channel_from)\n\t\t\t\t NATURAL JOIN\n\t\t\t\t posts\n\t\t\t\t ) AS P\n\t\t\t\tORDER BY creation_time DESC NULLS LAST\n\t\t\t\t) AS LP (post_id)\n\t\t\t\tLEFT JOIN\n\t\t\t\t(SELECT post_from, COALESCE(COUNT(*), 0)\n\t\t\t\t FROM comments\n\t\t\t\t GROUP BY post_from\n\t\t\t\t) AS PS (post_id, comment_count) ON LP.post_id = PS.post_id\n\t\t\tORDER BY creation_time DESC\n\t\t) AS F ORDER BY comment_count DESC NULLS LAST \n\t\tLIMIT $2 OFFSET $3`, f.ID, limit, offset)\n\tcase feed.NotSet:\n\t\tfallthrough\n\tcase feed.SortTop:\n\t\tfallthrough\n\tdefault:\n\t\trows, err = repo.db.Query(`\n\t\tSELECT post_id\n\t\tFROM(SELECT Lp.post_id, total_star_count\n\t\t\tFROM(\n\t\t\t SELECT *\n\t\t\t\tFROM (SELECT id, creation_time\n\t\t\t\t FROM (\n\t\t\t\t SELECT channel_username\n\t\t\t\t FROM feed_subscriptions\n\t\t\t\t WHERE feed_id = $1\n\t\t\t\t ) AS C (channel_from)\n\t\t\t\t NATURAL JOIN\n\t\t\t\t posts\n\t\t\t\t ) AS P\n\t\t\t\tORDER BY creation_time DESC NULLS LAST\n\t\t\t\t) AS LP (post_id)\n\t\t\t\tLEFT JOIN\n\t\t\t\t(SELECT post_id,SUM(star_count)\n\t\t\t\t FROM post_stars\n\t\t\t\t GROUP BY post_id\n\t\t\t\t) AS PS (post_id, total_star_count) ON LP.post_id = PS.post_id\n\t\t\tORDER BY creation_time DESC\n\t\t) AS F ORDER BY total_star_count DESC NULLS LAST \n\t\tLIMIT $2 OFFSET $3`, f.ID, limit, offset)\n\t}\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"querying for feed_subscriptions failed because of: %s\", err.Error())\n\t}\n\tdefer rows.Close()\n\n\tvar id int\n\tposts := make([]*feed.Post, 0)\n\n\tfor rows.Next() {\n\t\terr := rows.Scan(&id)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"scanning from rows failed because: %s\", err.Error())\n\t\t}\n\t\tposts = append(posts, &feed.Post{ID: id})\n\t}\n\terr = rows.Err()\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"scanning from rows faulty because: %s\", err.Error())\n\t}\n\n\treturn posts, nil\n}", "func (e CategoryEdges) PostsOrErr() ([]*Post, error) {\n\tif e.loadedTypes[0] {\n\t\treturn e.Posts, nil\n\t}\n\treturn nil, &NotLoadedError{edge: \"posts\"}\n}", "func (p *PostsController) GetPosts(limit int, cursor string, userId int) ([]models.Post, bool) {\n\tvar posts []models.Post\n\tif limit > 50 {\n\t\tlimit = 50\n\t}\n\tlimit++\n\n\tif cursor != \"\" {\n\t\tp.db.Raw(`\n\t\t\tSELECT p.*,\n\t\t\t(SELECT \"value\" from \"likes\" \n\t\t\tWHERE \"user_id\" = ? and \"post_id\" = p.id) as \"StateValue\",\n\t\t\t(SELECT username FROM \"profiles\"\n\t\t\tWHERE user_id = p.user_id) as \"Creator\"\n\t\t\tFROM posts p\n\t\t\tWHERE p.created_at < ?\n\t\t\tORDER BY p.created_at DESC\n\t\t\tLIMIT ?\n\t\t`, userId, cursor, limit).Find(&posts)\n\t} else {\n\t\tp.db.Raw(`\n\t\t\tSELECT p.*,\n\t\t\t( SELECT \"value\" from \"likes\" \n\t\t\tWHERE \"user_id\" = ? and \"post_id\" = p.id) as \"StateValue\",\n\t\t\t(SELECT \"username\" FROM \"profiles\"\n\t\t\tWHERE user_id = p.user_id) as \"Creator\"\n\t\t\tFROM posts p\n\t\t\tORDER BY p.created_at DESC\n\t\t\tLIMIT ?\n\t\t`, userId, limit).Find(&posts)\n\t}\n\tif len(posts) == 0 {\n\t\treturn nil, false\n\t}\n\tif len(posts) == limit {\n\t\treturn posts[0 : limit-1], true\n\t}\n\n\treturn posts, false\n}", "func (p *_Posts) Refresh(ctx context.Context, db database.DB, models ...*Post) error {\n\tvar queryModels []mapping.Model\n\tif len(models) == 0 {\n\t\treturn errors.Wrap(query.ErrNoModels, \"nothing to refresh\")\n\t}\n\tqueryModels = make([]mapping.Model, len(models))\n\tfor i, model := range models {\n\t\tqueryModels[i] = model\n\t}\n\treturn db.Refresh(ctx, p.Model, queryModels...)\n}", "func NewCategoryQueryInMemory(db map[int]*model.Category) CategoryQuery {\n\treturn &categoryQueryInMemory{db}\n}", "func (postL) LoadPostsTags(ctx context.Context, e boil.ContextExecutor, singular bool, maybePost interface{}, mods queries.Applicator) error {\n\tvar slice []*Post\n\tvar object *Post\n\n\tif singular {\n\t\tobject = maybePost.(*Post)\n\t} else {\n\t\tslice = *maybePost.(*[]*Post)\n\t}\n\n\targs := make([]interface{}, 0, 1)\n\tif singular {\n\t\tif object.R == nil {\n\t\t\tobject.R = &postR{}\n\t\t}\n\t\targs = append(args, object.ID)\n\t} else {\n\tOuter:\n\t\tfor _, obj := range slice {\n\t\t\tif obj.R == nil {\n\t\t\t\tobj.R = &postR{}\n\t\t\t}\n\n\t\t\tfor _, a := range args {\n\t\t\t\tif a == obj.ID {\n\t\t\t\t\tcontinue Outer\n\t\t\t\t}\n\t\t\t}\n\n\t\t\targs = append(args, obj.ID)\n\t\t}\n\t}\n\n\tquery := NewQuery(qm.From(`posts_tags`), qm.WhereIn(`post_id in ?`, args...))\n\tif mods != nil {\n\t\tmods.Apply(query)\n\t}\n\n\tresults, err := query.QueryContext(ctx, e)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"failed to eager load posts_tags\")\n\t}\n\n\tvar resultSlice []*PostsTag\n\tif err = queries.Bind(results, &resultSlice); err != nil {\n\t\treturn errors.Wrap(err, \"failed to bind eager loaded slice posts_tags\")\n\t}\n\n\tif err = results.Close(); err != nil {\n\t\treturn errors.Wrap(err, \"failed to close results in eager load on posts_tags\")\n\t}\n\tif err = results.Err(); err != nil {\n\t\treturn errors.Wrap(err, \"error occurred during iteration of eager loaded relations for posts_tags\")\n\t}\n\n\tif len(postsTagAfterSelectHooks) != 0 {\n\t\tfor _, obj := range resultSlice {\n\t\t\tif err := obj.doAfterSelectHooks(ctx, e); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\tif singular {\n\t\tobject.R.PostsTags = resultSlice\n\t\tfor _, foreign := range resultSlice {\n\t\t\tif foreign.R == nil {\n\t\t\t\tforeign.R = &postsTagR{}\n\t\t\t}\n\t\t\tforeign.R.Post = object\n\t\t}\n\t\treturn nil\n\t}\n\n\tfor _, foreign := range resultSlice {\n\t\tfor _, local := range slice {\n\t\t\tif local.ID == foreign.PostID {\n\t\t\t\tlocal.R.PostsTags = append(local.R.PostsTags, foreign)\n\t\t\t\tif foreign.R == nil {\n\t\t\t\t\tforeign.R = &postsTagR{}\n\t\t\t\t}\n\t\t\t\tforeign.R.Post = local\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t}\n\n\treturn nil\n}", "func (c *UnsavedPostImageClient) Query() *UnsavedPostImageQuery {\n\treturn &UnsavedPostImageQuery{\n\t\tconfig: c.config,\n\t}\n}", "func (m *MenuMutation) CategoryCleared() bool {\n\treturn m.clearedcategory\n}", "func (u *User)GetPosts()(e error){\n\trows,e := db.Query(\"select * from posts where user_id = ? order by date desc \",u.Id)\n\tif e != nil {\n\t\treturn\n\t}\n\tfor rows.Next() {\n\t\tc := &Post{}\n\t\trows.Scan(&c.Id,&c.Title,&c.Topic,&c.Content,&c.Date,&c.CommunityId,&c.UserId)\n\t\tu.posts = append(u.posts,c)\n\t}\n\treturn\n}", "func FetchPosts(c appengine.Context, n int) ([]Post, error) {\n\tall, err := fetchPosts(c, n, nil)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tmine, err := fetchPosts(c, n, userKey(c))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tm := []Post{}\n\tmergePosts(&m, mine, all, n)\n\n\t// We fetch the comments for all posts concurrently.\n\terrc := make(chan error, len(m))\n\tfor i := range m {\n\t\tgo func(p *Post) {\n\t\t\terrc <- p.FetchComments(c)\n\t\t}(&m[i])\n\t}\n\tfor _ = range m {\n\t\tif err := <-errc; err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\treturn m, nil\n}", "func (controller *PostQueryController) GetPosts(w http.ResponseWriter, r *http.Request) {\n\tres, err := controller.DiscussionQueryServiceInterface.GetPosts(context.TODO())\n\tif err != nil {\n\t\tvar httpCode int\n\t\tvar errorMsg string\n\n\t\tswitch err.Error() {\n\t\tcase errors.MissingRecord:\n\t\t\thttpCode = http.StatusNotFound\n\t\t\terrorMsg = \"No records found.\"\n\t\tdefault:\n\t\t\thttpCode = http.StatusInternalServerError\n\t\t\terrorMsg = \"Please contact technical support.\"\n\t\t}\n\n\t\tresponse := viewmodels.HTTPResponseVM{\n\t\t\tStatus: httpCode,\n\t\t\tSuccess: false,\n\t\t\tMessage: errorMsg,\n\t\t\tErrorCode: err.Error(),\n\t\t}\n\n\t\tresponse.JSON(w)\n\t\treturn\n\t}\n\n\tvar posts []types.PostResponse\n\n\tfor _, post := range res {\n\t\tposts = append(posts, types.PostResponse{\n\t\t\tID: post.ID,\n\t\t\tContent: post.Content,\n\t\t\tCreatedAt: post.CreatedAt.Unix(),\n\t\t\tUpdatedAt: post.UpdatedAt.Unix(),\n\t\t})\n\t}\n\tresponse := viewmodels.HTTPResponseVM{\n\t\tStatus: http.StatusOK,\n\t\tSuccess: true,\n\t\tMessage: \"Successfully fetched post data.\",\n\t\tData: posts,\n\t}\n\n\tresponse.JSON(w)\n}", "func (upvc *UnsavedPostVideoCreate) SetUnsavedPostID(id int) *UnsavedPostVideoCreate {\n\tupvc.mutation.SetUnsavedPostID(id)\n\treturn upvc\n}", "func (c *UnsavedPostClient) QueryAuthor(up *UnsavedPost) *AdminQuery {\n\tquery := &AdminQuery{config: c.config}\n\tquery.path = func(ctx context.Context) (fromV *sql.Selector, _ error) {\n\t\tid := up.ID\n\t\tstep := sqlgraph.NewStep(\n\t\t\tsqlgraph.From(unsavedpost.Table, unsavedpost.FieldID, id),\n\t\t\tsqlgraph.To(admin.Table, admin.FieldID),\n\t\t\tsqlgraph.Edge(sqlgraph.M2O, true, unsavedpost.AuthorTable, unsavedpost.AuthorColumn),\n\t\t)\n\t\tfromV = sqlgraph.Neighbors(up.driver.Dialect(), step)\n\t\treturn fromV, nil\n\t}\n\treturn query\n}", "func GetAllPost(w http.ResponseWriter, r *http.Request) {\n\tpage := r.URL.Query()[\"page\"]\n\tuserID := r.URL.Query()[\"user\"]\n\n\tfilter := bson.M{}\n\tfilter[\"status\"] = bson.M{\n\t\t\"$ne\": poststatus.Deleted,\n\t}\n\n\tif len(userID) > 0 {\n\t\tuID, err := primitive.ObjectIDFromHex(userID[0])\n\t\tif err != nil {\n\t\t\tresponse.Error(w, http.StatusUnprocessableEntity, err.Error())\n\t\t\treturn\n\t\t}\n\t\tfilter[\"user_id\"] = uID\n\t}\n\n\tvar count int\n\n\tif len(page) > 0 {\n\t\tfmt.Println(\"STUFF\", len(page))\n\t\tnum, err := strconv.Atoi(page[0])\n\t\tif err != nil {\n\t\t\tresponse.Error(w, http.StatusUnprocessableEntity, err.Error())\n\t\t\treturn\n\t\t}\n\t\tcount = num\n\t} else {\n\t\tcount = 0\n\t}\n\n\tposts, err := GetAll(filter, count)\n\n\tif err != nil {\n\t\tresponse.Error(w, http.StatusUnprocessableEntity, err.Error())\n\t\treturn\n\t}\n\n\tif posts == nil {\n\t\tposts = []GetPostStruct{}\n\t}\n\n\tresponse.Success(w, r,\n\t\thttp.StatusOK,\n\t\tposts,\n\t)\n\treturn\n}", "func (c *UnsavedPostImageClient) Get(ctx context.Context, id int) (*UnsavedPostImage, error) {\n\treturn c.Query().Where(unsavedpostimage.ID(id)).Only(ctx)\n}", "func (b *_Blogs) ClearTopPostRelation(ctx context.Context, db database.DB, models ...*Blog) (int64, error) {\n\trelation, err := b.Model.RelationByIndex(4)\n\tif err != nil {\n\t\treturn 0, err\n\t}\n\tmodelInterfaces := make([]mapping.Model, len(models))\n\tfor i := range models {\n\t\tmodelInterfaces[i] = models[i]\n\t}\n\ts := query.NewScope(b.Model, modelInterfaces...)\n\trelationClearer, ok := db.(database.QueryRelationClearer)\n\tif !ok {\n\t\treturn 0, errors.WrapDetf(query.ErrInternal, \"DB doesn't implement QueryRelationAdder interface - %T\", db)\n\t}\n\treturn relationClearer.QueryClearRelations(ctx, s, relation)\n}", "func (upu *UnsavedPostUpdate) Where(ps ...predicate.UnsavedPost) *UnsavedPostUpdate {\n\tupu.mutation.predicates = append(upu.mutation.predicates, ps...)\n\treturn upu\n}", "func (c *PostVideoClient) QueryPost(pv *PostVideo) *PostQuery {\n\tquery := &PostQuery{config: c.config}\n\tquery.path = func(ctx context.Context) (fromV *sql.Selector, _ error) {\n\t\tid := pv.ID\n\t\tstep := sqlgraph.NewStep(\n\t\t\tsqlgraph.From(postvideo.Table, postvideo.FieldID, id),\n\t\t\tsqlgraph.To(post.Table, post.FieldID),\n\t\t\tsqlgraph.Edge(sqlgraph.M2O, true, postvideo.PostTable, postvideo.PostColumn),\n\t\t)\n\t\tfromV = sqlgraph.Neighbors(pv.driver.Dialect(), step)\n\t\treturn fromV, nil\n\t}\n\treturn query\n}", "func (m *PatientMutation) CategoryCleared() bool {\n\treturn m.clearedcategory\n}", "func NewUnsavedPostImageClient(c config) *UnsavedPostImageClient {\n\treturn &UnsavedPostImageClient{config: c}\n}", "func NewGraphqlPostUnauthorized() *GraphqlPostUnauthorized {\n\n\treturn &GraphqlPostUnauthorized{}\n}", "func GetPostsFromQueryPerPage(context appengine.Context, query *datastore.Query, page int) (*[]Post, bool, error) {\n\n\tcnt, _ := query.Count(context)\n\toffset := (page - 1) * postPerPage\n\thasOlder := offset+postPerPage < cnt\n\n\tqry := query.Limit(postPerPage).Offset(offset)\n\n\tposts, err := GetPostsFromQuery(context, qry)\n\n\treturn posts, hasOlder, err\n}", "func (q postQuery) All(ctx context.Context, exec boil.ContextExecutor) (PostSlice, error) {\n\tvar o []*Post\n\n\terr := q.Bind(ctx, exec, &o)\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"orm: failed to assign all query results to Post slice\")\n\t}\n\n\tif len(postAfterSelectHooks) != 0 {\n\t\tfor _, obj := range o {\n\t\t\tif err := obj.doAfterSelectHooks(ctx, exec); err != nil {\n\t\t\t\treturn o, err\n\t\t\t}\n\t\t}\n\t}\n\n\treturn o, nil\n}", "func getAllPosts(year int) ([]model.RedditPost, error) {\n\tposts := []model.RedditPost{}\n\n\terr := conn.View(func(tx *bolt.Tx) error {\n\t\tdailyBucket := tx.Bucket([]byte(\"daily_bucket\"))\n\n\t\treturn dailyBucket.ForEach(func(key, val []byte) error {\n\n\t\t\tb := dailyBucket.Bucket(key)\n\n\t\t\treturn b.ForEach(func(k, v []byte) error {\n\t\t\t\tvar post model.RedditPost\n\t\t\t\terr := json.Unmarshal(b.Get(k), &post)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\n\t\t\t\tpostTime := time.Unix(int64(post.Created), 0)\n\n\t\t\t\tif postTime.Year() == year {\n\t\t\t\t\tposts = append(posts, post)\n\t\t\t\t}\n\n\t\t\t\treturn nil\n\t\t\t})\n\t\t})\n\n\t})\n\n\treturn posts, err\n}", "func SelectAllFromPost() []Post {\n\tdb := MysqlConnect()\n\tdefer db.Close()\n\n\tresults, err := db.Query(\"SELECT * FROM post\")\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\n\tvar result []Post\n\n\tfor results.Next() {\n\n\t\tvar post Post\n\n\t\terr = results.Scan(&post.ID, &post.Title, &post.Description, &post.Post,\n\t\t\t&post.Date, &post.Author, &post.Thumbnail, &post.Categories)\n\n\t\tif err != nil {\n\t\t\tpanic(err.Error())\n\t\t}\n\t\tresult = append(result, post)\n\t}\n\n\treturn result\n}", "func (k Keeper) IteratePosts(ctx sdk.Context, fn func(index int64, post types.Post) (stop bool)) {\n\tstore := ctx.KVStore(k.StoreKey)\n\titerator := sdk.KVStorePrefixIterator(store, types.PostStorePrefix)\n\tdefer iterator.Close()\n\ti := int64(0)\n\tfor ; iterator.Valid(); iterator.Next() {\n\t\tvar post types.Post\n\t\tk.Cdc.MustUnmarshalBinaryBare(iterator.Value(), &post)\n\t\tstop := fn(i, post)\n\t\tif stop {\n\t\t\tbreak\n\t\t}\n\t\ti++\n\t}\n}", "func UnpublishPost(shorturl string) (types.Post, error) {\n\tdb := database.GetMySQLInstance()\n\tdefer db.Close()\n\tvar post types.Post\n\terr := db.Where(\"shorturl LIKE ?\", shorturl).First(&post).Error\n\tif err != nil && err == gorm.ErrRecordNotFound {\n\t\treturn post, errors.New(\"post not found\")\n\t}\n\n\terr = db.Model(&post).Updates(map[string]interface{}{\"published\": false}).Error\n\tif err != nil {\n\t\treturn post, err\n\t}\n\tpost.Published = false\n\treturn post, nil\n}", "func (upq *UnsavedPostQuery) QueryThumbnail() *UnsavedPostThumbnailQuery {\n\tquery := &UnsavedPostThumbnailQuery{config: upq.config}\n\tquery.path = func(ctx context.Context) (fromU *sql.Selector, err error) {\n\t\tif err := upq.prepareQuery(ctx); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tselector := upq.sqlQuery(ctx)\n\t\tif err := selector.Err(); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tstep := sqlgraph.NewStep(\n\t\t\tsqlgraph.From(unsavedpost.Table, unsavedpost.FieldID, selector),\n\t\t\tsqlgraph.To(unsavedpostthumbnail.Table, unsavedpostthumbnail.FieldID),\n\t\t\tsqlgraph.Edge(sqlgraph.O2O, false, unsavedpost.ThumbnailTable, unsavedpost.ThumbnailColumn),\n\t\t)\n\t\tfromU = sqlgraph.SetNeighbors(upq.driver.Dialect(), step)\n\t\treturn fromU, nil\n\t}\n\treturn query\n}", "func (s *PostSvc) FndPosts(ctx context.Context, req *pb.FndPostsReq) (*pb.PostsResp, error) {\n\treturn s.db.FndPosts(ctx, req)\n}", "func posts(w http.ResponseWriter, r *http.Request, _ httprouter.Params) {\n\tdb, err := db()\n\tif err != nil {\n\t\tlog.Println(\"Database was not properly opened\")\n\t\tsendErr(w, err, \"Database was not properly opened\", http.StatusInternalServerError)\n\t\treturn\n\t}\n\n\trows, err := db.Query(`\nSELECT p.id, p.name, p.content, p.permalink, p.visible, p.created_at, IFNULL(likes.likes, 0), p.cover\nFROM post p LEFT OUTER JOIN (SELECT post_id, COUNT(ip) AS likes\n FROM liker\n GROUP BY post_id) likes ON p.id = likes.post_id\nORDER BY created_at;\n\t`)\n\tif err != nil {\n\t\tlog.Println(\"Error in statement\")\n\t\tsendErr(w, err, \"Error in query blog\", http.StatusInternalServerError)\n\t\treturn\n\t}\n\n\tvar posts []Post\n\tfor rows.Next() {\n\t\tvar post Post\n\t\t// getting a post\n\t\tvar coverID sql.NullInt64\n\t\terr = rows.Scan(&post.ID, &post.Name, &post.Content, &post.Permalink,\n\t\t\t&post.Visible, &post.CreatedAt, &post.Likes, &coverID)\n\t\tif err != nil {\n\t\t\tlog.Println(\"Error while scanning at home handler\")\n\t\t\tsendErr(w, err, \"Error while scanning blog\", http.StatusInternalServerError)\n\t\t\treturn\n\t\t}\n\t\t// Adding a cover if neded\n\t\tif coverID.Valid {\n\t\t\trow := db.QueryRow(`\nSELECT id, url\nFROM image\nWHERE id = ?\n`, coverID)\n\t\t\tvar image Image\n\t\t\terr := row.Scan(&image.ID, &image.Url)\n\t\t\tif err != nil {\n\t\t\t\tsendErr(w, err, \"Error while trying to get an image for a post\", http.StatusInternalServerError)\n\t\t\t\treturn\n\t\t\t}\n\t\t\tpost.Cover = image\n\t\t}\n\n\t\t// Adding tags\n\t\ttagRows, err := db.Query(`\nSELECT t.id, t.name \nFROM post_tag pt INNER JOIN tag t ON pt.tag_id = t.id\nWHERE pt.post_id = ?;\n\t\t`, post.ID)\n\t\tif err != nil {\n\t\t\tlog.Println(\"Error while scanning at home handler\")\n\t\t\tsendErr(w, err, \"Error while scanning blog\", http.StatusInternalServerError)\n\t\t\treturn\n\t\t}\n\t\tvar tagsIDs []string\n\t\tvar tags []Tag\n\t\tfor tagRows.Next() {\n\t\t\tvar tag Tag\n\t\t\ttagRows.Scan(&tag.ID, &tag.Name)\n\t\t\ttags = append(tags, tag)\n\t\t\ttagsIDs = append(tagsIDs, tag.ID)\n\t\t}\n\t\tpost.TagsIDs = tagsIDs\n\t\tpost.Tags = tags\n\t\t// Append to []Post\n\t\tposts = append(posts, post)\n\t}\n\tdb.Close()\n\tjsn, err := jsonapi.Marshal(posts)\n\tsend(w, jsn)\n}", "func (b *ConversationThreadRequestBuilder) Posts() *ConversationThreadPostsCollectionRequestBuilder {\n\tbb := &ConversationThreadPostsCollectionRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}\n\tbb.baseURL += \"/posts\"\n\treturn bb\n}" ]
[ "0.82820505", "0.7462314", "0.6382531", "0.6375765", "0.6356579", "0.60820735", "0.6019085", "0.59472966", "0.58426327", "0.5654084", "0.5630219", "0.54999", "0.5420099", "0.51873016", "0.51262856", "0.49649864", "0.4962925", "0.49614844", "0.49121195", "0.48394227", "0.47455505", "0.4743943", "0.47286567", "0.4672265", "0.465386", "0.464893", "0.46003035", "0.4587661", "0.45539314", "0.45414552", "0.4519665", "0.45186272", "0.45015135", "0.4474814", "0.44682667", "0.44679877", "0.44643992", "0.442745", "0.44195613", "0.441118", "0.43919456", "0.43770772", "0.43588182", "0.43587446", "0.43550313", "0.43306464", "0.43159756", "0.4300724", "0.42978477", "0.42838427", "0.42800876", "0.42684138", "0.4268152", "0.42649266", "0.42115742", "0.42000532", "0.41928178", "0.4189368", "0.41401413", "0.41346735", "0.4134651", "0.41292062", "0.4128993", "0.4107211", "0.40739605", "0.40700918", "0.40581468", "0.40472648", "0.40425667", "0.40318054", "0.402941", "0.40216392", "0.40131646", "0.40067932", "0.40018818", "0.39956108", "0.39897123", "0.39885443", "0.39725247", "0.39721638", "0.39716017", "0.39680973", "0.39637005", "0.3961599", "0.39536962", "0.3946612", "0.3942425", "0.3941934", "0.3941366", "0.3921741", "0.39169833", "0.39167124", "0.39093736", "0.39034957", "0.3900912", "0.3899475", "0.3898548", "0.38942015", "0.38837776", "0.3876957" ]
0.815182
1
Hooks returns the client hooks.
func (c *CategoryClient) Hooks() []Hook { return c.hooks.Category }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (c *OperationClient) Hooks() []Hook {\n\treturn c.hooks.Operation\n}", "func (c *ToolClient) Hooks() []Hook {\n\treturn c.hooks.Tool\n}", "func (c *TagClient) Hooks() []Hook {\n\treturn c.hooks.Tag\n}", "func (c *ComplaintClient) Hooks() []Hook {\n\treturn c.hooks.Complaint\n}", "func (c *PostClient) Hooks() []Hook {\n\treturn c.hooks.Post\n}", "func (c *ClubapplicationClient) Hooks() []Hook {\n\treturn c.hooks.Clubapplication\n}", "func (c *ClinicClient) Hooks() []Hook {\n\treturn c.hooks.Clinic\n}", "func (c *EventClient) Hooks() []Hook {\n\treturn c.hooks.Event\n}", "func (c *BuildingClient) Hooks() []Hook {\n\treturn c.hooks.Building\n}", "func (c *OperativeClient) Hooks() []Hook {\n\treturn c.hooks.Operative\n}", "func (c *SituationClient) Hooks() []Hook {\n\treturn c.hooks.Situation\n}", "func (c *AppointmentClient) Hooks() []Hook {\n\treturn c.hooks.Appointment\n}", "func (c *RentalstatusClient) Hooks() []Hook {\n\treturn c.hooks.Rentalstatus\n}", "func (c *LeaseClient) Hooks() []Hook {\n\treturn c.hooks.Lease\n}", "func (c *ReturninvoiceClient) Hooks() []Hook {\n\treturn c.hooks.Returninvoice\n}", "func (c *ClubappStatusClient) Hooks() []Hook {\n\treturn c.hooks.ClubappStatus\n}", "func (c *ReviewClient) Hooks() []Hook {\n\treturn c.hooks.Review\n}", "func (c *EmployeeClient) Hooks() []Hook {\n\treturn c.hooks.Employee\n}", "func (c *EmployeeClient) Hooks() []Hook {\n\treturn c.hooks.Employee\n}", "func (c *EmployeeClient) Hooks() []Hook {\n\treturn c.hooks.Employee\n}", "func (c *WorkExperienceClient) Hooks() []Hook {\n\treturn c.hooks.WorkExperience\n}", "func (c *PartClient) Hooks() []Hook {\n\treturn c.hooks.Part\n}", "func (c *CleanernameClient) Hooks() []Hook {\n\treturn c.hooks.Cleanername\n}", "func (c *BeerClient) Hooks() []Hook {\n\treturn c.hooks.Beer\n}", "func (c *FoodmenuClient) Hooks() []Hook {\n\treturn c.hooks.Foodmenu\n}", "func (c *RepairinvoiceClient) Hooks() []Hook {\n\treturn c.hooks.Repairinvoice\n}", "func (c *StatusdClient) Hooks() []Hook {\n\treturn c.hooks.Statusd\n}", "func (c *EmptyClient) Hooks() []Hook {\n\treturn c.hooks.Empty\n}", "func (c *BillClient) Hooks() []Hook {\n\treturn c.hooks.Bill\n}", "func (c *BillClient) Hooks() []Hook {\n\treturn c.hooks.Bill\n}", "func (c *BillClient) Hooks() []Hook {\n\treturn c.hooks.Bill\n}", "func (c *CompanyClient) Hooks() []Hook {\n\treturn c.hooks.Company\n}", "func (c *CompanyClient) Hooks() []Hook {\n\treturn c.hooks.Company\n}", "func (c *IPClient) Hooks() []Hook {\n\treturn c.hooks.IP\n}", "func (c *VeterinarianClient) Hooks() []Hook {\n\treturn c.hooks.Veterinarian\n}", "func (c *MedicineClient) Hooks() []Hook {\n\treturn c.hooks.Medicine\n}", "func (c *PrescriptionClient) Hooks() []Hook {\n\treturn c.hooks.Prescription\n}", "func (c *TransactionClient) Hooks() []Hook {\n\treturn c.hooks.Transaction\n}", "func (c *KeyStoreClient) Hooks() []Hook {\n\treturn c.hooks.KeyStore\n}", "func (c *PetruleClient) Hooks() []Hook {\n\treturn c.hooks.Petrule\n}", "func (c *LevelOfDangerousClient) Hooks() []Hook {\n\treturn c.hooks.LevelOfDangerous\n}", "func (c *AdminClient) Hooks() []Hook {\n\treturn c.hooks.Admin\n}", "func (c *JobClient) Hooks() []Hook {\n\treturn c.hooks.Job\n}", "func (c *OrderClient) Hooks() []Hook {\n\treturn c.hooks.Order\n}", "func (c *PetClient) Hooks() []Hook {\n\treturn c.hooks.Pet\n}", "func (c *DNSBLResponseClient) Hooks() []Hook {\n\treturn c.hooks.DNSBLResponse\n}", "func (c *MealplanClient) Hooks() []Hook {\n\treturn c.hooks.Mealplan\n}", "func (c *RepairInvoiceClient) Hooks() []Hook {\n\treturn c.hooks.RepairInvoice\n}", "func (c *DoctorClient) Hooks() []Hook {\n\treturn c.hooks.Doctor\n}", "func (c *StatustClient) Hooks() []Hook {\n\treturn c.hooks.Statust\n}", "func (c *EatinghistoryClient) Hooks() []Hook {\n\treturn c.hooks.Eatinghistory\n}", "func (c *StaytypeClient) Hooks() []Hook {\n\treturn c.hooks.Staytype\n}", "func (c *CustomerClient) Hooks() []Hook {\n\treturn c.hooks.Customer\n}", "func (c *StatusRClient) Hooks() []Hook {\n\treturn c.hooks.StatusR\n}", "func (c *UserClient) Hooks() []Hook {\n\treturn c.hooks.User\n}", "func (c *UserClient) Hooks() []Hook {\n\treturn c.hooks.User\n}", "func (c *UserClient) Hooks() []Hook {\n\treturn c.hooks.User\n}", "func (c *UserClient) Hooks() []Hook {\n\treturn c.hooks.User\n}", "func (c *UserClient) Hooks() []Hook {\n\treturn c.hooks.User\n}", "func (c *UserClient) Hooks() []Hook {\n\treturn c.hooks.User\n}", "func (c *UserClient) Hooks() []Hook {\n\treturn c.hooks.User\n}", "func (c *UserClient) Hooks() []Hook {\n\treturn c.hooks.User\n}", "func (c *UserClient) Hooks() []Hook {\n\treturn c.hooks.User\n}", "func (c *UserClient) Hooks() []Hook {\n\treturn c.hooks.User\n}", "func (c *UserClient) Hooks() []Hook {\n\treturn c.hooks.User\n}", "func (c *UnitOfMedicineClient) Hooks() []Hook {\n\treturn c.hooks.UnitOfMedicine\n}", "func (c *YearClient) Hooks() []Hook {\n\treturn c.hooks.Year\n}", "func (c *ClubClient) Hooks() []Hook {\n\treturn c.hooks.Club\n}", "func (c *DentistClient) Hooks() []Hook {\n\treturn c.hooks.Dentist\n}", "func (c *PaymentClient) Hooks() []Hook {\n\treturn c.hooks.Payment\n}", "func (c *PaymentClient) Hooks() []Hook {\n\treturn c.hooks.Payment\n}", "func (c *BookingClient) Hooks() []Hook {\n\treturn c.hooks.Booking\n}", "func (c *DisciplineClient) Hooks() []Hook {\n\treturn c.hooks.Discipline\n}", "func (c *PlanetClient) Hooks() []Hook {\n\treturn c.hooks.Planet\n}", "func (c *OperationroomClient) Hooks() []Hook {\n\treturn c.hooks.Operationroom\n}", "func (c *LengthtimeClient) Hooks() []Hook {\n\treturn c.hooks.Lengthtime\n}", "func (c *DispenseMedicineClient) Hooks() []Hook {\n\treturn c.hooks.DispenseMedicine\n}", "func (c *PartorderClient) Hooks() []Hook {\n\treturn c.hooks.Partorder\n}", "func (c *PatientInfoClient) Hooks() []Hook {\n\treturn c.hooks.PatientInfo\n}", "func (c *SkillClient) Hooks() []Hook {\n\treturn c.hooks.Skill\n}", "func (c *PharmacistClient) Hooks() []Hook {\n\treturn c.hooks.Pharmacist\n}", "func (c *TitleClient) Hooks() []Hook {\n\treturn c.hooks.Title\n}", "func (c *DepositClient) Hooks() []Hook {\n\treturn c.hooks.Deposit\n}", "func (c *SessionClient) Hooks() []Hook {\n\treturn c.hooks.Session\n}", "func (c *PostImageClient) Hooks() []Hook {\n\treturn c.hooks.PostImage\n}", "func (c *DrugAllergyClient) Hooks() []Hook {\n\treturn c.hooks.DrugAllergy\n}", "func (c *TimerClient) Hooks() []Hook {\n\treturn c.hooks.Timer\n}", "func (c *PhysicianClient) Hooks() []Hook {\n\treturn c.hooks.Physician\n}", "func (c *PhysicianClient) Hooks() []Hook {\n\treturn c.hooks.Physician\n}", "func (c *PostAttachmentClient) Hooks() []Hook {\n\treturn c.hooks.PostAttachment\n}", "func (c *PatientClient) Hooks() []Hook {\n\treturn c.hooks.Patient\n}", "func (c *PatientClient) Hooks() []Hook {\n\treturn c.hooks.Patient\n}", "func (c *PatientClient) Hooks() []Hook {\n\treturn c.hooks.Patient\n}", "func (c *PostThumbnailClient) Hooks() []Hook {\n\treturn c.hooks.PostThumbnail\n}", "func (c *BedtypeClient) Hooks() []Hook {\n\treturn c.hooks.Bedtype\n}", "func (c *CoinInfoClient) Hooks() []Hook {\n\treturn c.hooks.CoinInfo\n}", "func (c *OperativerecordClient) Hooks() []Hook {\n\treturn c.hooks.Operativerecord\n}", "func (c *ActivitiesClient) Hooks() []Hook {\n\treturn c.hooks.Activities\n}", "func (c *MedicineTypeClient) Hooks() []Hook {\n\treturn c.hooks.MedicineType\n}", "func (c *AdminSessionClient) Hooks() []Hook {\n\treturn c.hooks.AdminSession\n}" ]
[ "0.80317485", "0.79030067", "0.7886111", "0.78830385", "0.7861127", "0.7827846", "0.78169984", "0.7799408", "0.7789961", "0.7762907", "0.774616", "0.77400076", "0.77377117", "0.7723144", "0.7715899", "0.77091956", "0.76981485", "0.7695239", "0.7695239", "0.7695239", "0.7691411", "0.76718473", "0.7669308", "0.76659566", "0.76649994", "0.7658629", "0.76272875", "0.7619314", "0.7616328", "0.7616328", "0.7616328", "0.7613535", "0.7613535", "0.7612722", "0.7607983", "0.76073736", "0.76072484", "0.7600732", "0.75947726", "0.7593981", "0.75886565", "0.75843227", "0.7583164", "0.7580412", "0.7568908", "0.7559808", "0.75595653", "0.75512165", "0.75502926", "0.7532545", "0.75314486", "0.7530887", "0.75256604", "0.7522074", "0.75039285", "0.75039285", "0.75039285", "0.75039285", "0.75039285", "0.75039285", "0.75039285", "0.75039285", "0.75039285", "0.75039285", "0.75039285", "0.7503626", "0.75009644", "0.74971604", "0.74927765", "0.74925745", "0.74925745", "0.7490701", "0.7489253", "0.748288", "0.748131", "0.74717736", "0.74631125", "0.74541014", "0.7448737", "0.7445493", "0.74428546", "0.74352837", "0.7419495", "0.7416624", "0.7410944", "0.7410398", "0.74081314", "0.73945314", "0.73945314", "0.7394305", "0.7393659", "0.7393659", "0.7393659", "0.73885626", "0.7386602", "0.7375832", "0.73689777", "0.73569894", "0.73537123", "0.7353203" ]
0.7597693
38
NewPostClient returns a client for the Post from the given config.
func NewPostClient(c config) *PostClient { return &PostClient{config: c} }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func NewPostImageClient(c config) *PostImageClient {\n\treturn &PostImageClient{config: c}\n}", "func (c *RPCClient) POSTClient() (*rpcclient.Client, er.R) {\n\tconfigCopy := *c.connConfig\n\tconfigCopy.HTTPPostMode = true\n\treturn rpcclient.New(&configCopy, nil)\n}", "func NewPostAttachmentClient(c config) *PostAttachmentClient {\n\treturn &PostAttachmentClient{config: c}\n}", "func NewPostVideoClient(c config) *PostVideoClient {\n\treturn &PostVideoClient{config: c}\n}", "func NewPostThumbnailClient(c config) *PostThumbnailClient {\n\treturn &PostThumbnailClient{config: c}\n}", "func NewClient(config Config) Client {\n\ttyp := config.Type()\n\n\tswitch typ {\n\tcase Bolt:\n\t\tbe := NewBoltBackend(config.(*BoltConfig))\n\t\t// TODO: Return an error instead of panicking.\n\t\tif err := be.Open(); err != nil {\n\t\t\tpanic(fmt.Errorf(\"Opening bolt backend: %s\", err))\n\t\t}\n\t\tq := NewBoltQueue(be.db)\n\t\treturn newKVClient(be, q)\n\n\tcase Rocks:\n\t\t// MORE TEMPORARY UGLINESS TO MAKE IT WORK FOR NOW:\n\t\tif err := os.MkdirAll(config.(*RocksConfig).Dir, os.FileMode(int(0700))); err != nil {\n\t\t\tpanic(fmt.Errorf(\"Creating rocks directory %q: %s\", config.(*RocksConfig).Dir, err))\n\t\t}\n\t\tbe := NewRocksBackend(config.(*RocksConfig))\n\t\tqueueFile := filepath.Join(config.(*RocksConfig).Dir, DefaultBoltQueueFilename)\n\t\tdb, err := bolt.Open(queueFile, 0600, NewBoltConfig(\"\").BoltOptions)\n\t\tif err != nil {\n\t\t\tpanic(fmt.Errorf(\"Creating bolt queue: %s\", err))\n\t\t}\n\t\tq := NewBoltQueue(db)\n\t\treturn newKVClient(be, q)\n\n\tcase Postgres:\n\t\tbe := NewPostgresBackend(config.(*PostgresConfig))\n\t\tq := NewPostgresQueue(config.(*PostgresConfig))\n\t\treturn newKVClient(be, q)\n\n\tdefault:\n\t\tpanic(fmt.Errorf(\"no client constructor available for db configuration type: %v\", typ))\n\t}\n}", "func NewUnsavedPostClient(c config) *UnsavedPostClient {\n\treturn &UnsavedPostClient{config: c}\n}", "func (c *Client) newPost(endpoint string, reqBody []byte) (*http.Request, error) {\n\tcurl, err := c.getURL(endpoint)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treq, err := http.NewRequest(http.MethodPost, curl, bytes.NewReader(reqBody))\n\tif err != nil {\n\t\treturn nil, errors.Wrapf(err, \"Failed posting to %s\", curl)\n\t}\n\treturn req, nil\n}", "func Post(url string) *THttpClient {\r\n\treturn NewHttpClient(url).Post(\"\")\r\n}", "func NewClient(config *Config) *Client {\n\ttr := config.Transport()\n\n\treturn &Client{\n\t\tconfig: config.Clone(),\n\t\ttr: tr,\n\t\tclient: &http.Client{Transport: tr},\n\t}\n}", "func (c Config) NewClient(tok oauth2.Token) *Client {\n\tts := tokenSource{\n\t\ttoken: tok,\n\t\tconfig: c,\n\t}\n\t_ = ts\n\tb, _ := url.Parse(c.BaseURL)\n\treturn &Client{\n\t\tTokenSource: ts,\n\t\tClient: http.Client{\n\t\t\tTransport: &oauth2.Transport{\n\t\t\t\tBase: &Transport{BaseURL: b},\n\t\t\t\tSource: ts,\n\t\t\t},\n\t\t},\n\t}\n}", "func New(c *Config) Client {\n\treturn newClient(c)\n}", "func NewClient(config Config) ClientInterface {\n\tcontext := ctx.Background()\n\tif config.GitHubToken == \"\" {\n\t\treturn Client{\n\t\t\tClient: github.NewClient(nil),\n\t\t\tContext: context,\n\t\t\tConfig: config,\n\t\t}\n\t}\n\toauth2Client := oauth2.NewClient(context, oauth2.StaticTokenSource(\n\t\t&oauth2.Token{AccessToken: config.GitHubToken},\n\t))\n\treturn Client{\n\t\tClient: github.NewClient(oauth2Client),\n\t\tContext: context,\n\t\tConfig: config,\n\t}\n}", "func NewClient(cfg *restclient.Config) (Client, error) {\n\tresult := &client{}\n\tc, err := dynamic.NewForConfig(cfg)\n\tif err != nil {\n\t\tmsg := fmt.Sprintf(\"Failed to create client, with error: %v\", err)\n\t\tlog.Printf(\"[Error] %s\", msg)\n\t\treturn nil, fmt.Errorf(msg)\n\t}\n\tresult.dynamicClient = c\n\treturn result, nil\n}", "func NewClient(config *Config) (*Client, error) {\n\tdefConfig := DefaultConfig()\n\n\tif len(config.Address) == 0 {\n\t\tconfig.Address = defConfig.Address\n\t}\n\n\tif len(config.Scheme) == 0 {\n\t\tconfig.Scheme = defConfig.Scheme\n\t}\n\n\tif config.HTTPClient == nil {\n\t\tconfig.HTTPClient = defConfig.HTTPClient\n\t}\n\n\tclient := &Client{\n\t\tConfig: *config,\n\t}\n\treturn client, nil\n}", "func NewClient(config Config) Client {\n\treturn DefaultClient{\n\t\tconfig: config,\n\t}\n}", "func newClient(ctx context.Context, cfg v1.Github) *client {\n\tgithubToken := os.Getenv(cfg.AccessTokenEnvVar)\n\t// Setup the token for github authentication\n\tts := oauth2.StaticTokenSource(\n\t\t&oauth2.Token{AccessToken: githubToken},\n\t)\n\ttc := oauth2.NewClient(context.Background(), ts)\n\n\t// Return a client instance from github\n\tc := github.NewClient(tc)\n\treturn &client{\n\t\tctx: ctx,\n\t\tClient: c,\n\t\towner: cfg.Owner,\n\t\trepo: cfg.Repo,\n\t\tbotName: cfg.BotName,\n\t}\n}", "func NewClient(config Config) (*Client, error) {\n\tclient := &Client{\n\t\tuserAgent: \"GoGenderize/\" + Version,\n\t\tapiKey: config.APIKey,\n\t\thttpClient: http.DefaultClient,\n\t}\n\n\tif config.UserAgent != \"\" {\n\t\tclient.userAgent = config.UserAgent\n\t}\n\n\tif config.HTTPClient != nil {\n\t\tclient.httpClient = config.HTTPClient\n\t}\n\n\tserver := defaultServer\n\tif config.Server != \"\" {\n\t\tserver = config.Server\n\t}\n\tapiURL, err := url.Parse(server)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tclient.apiURL = apiURL\n\n\treturn client, nil\n}", "func (a *UtilsApiService) CreateNotificationClientUsingPost(ctx context.Context, notificationClient NotificationClient) (NotificationClient, *http.Response, error) {\n\tvar (\n\t\tlocalVarHttpMethod = strings.ToUpper(\"Post\")\n\t\tlocalVarPostBody interface{}\n\t\tlocalVarFileName string\n\t\tlocalVarFileBytes []byte\n\t\tlocalVarReturnValue NotificationClient\n\t)\n\n\t// create path and map variables\n\ta.client = NewAPIClient(&Configuration{\n\t\tBasePath: ctx.Value(\"BasePath\").(string),\n\t\tDefaultHeader: make(map[string]string),\n\t\tUserAgent: \"Swagger-Codegen/1.0.0/go\",\n\t})\n\tlocalVarPath := a.client.cfg.BasePath + \"/nucleus/v1/notification_client\"\n\n\tlocalVarHeaderParams := make(map[string]string)\n\tlocalVarQueryParams := url.Values{}\n\tlocalVarFormParams := url.Values{}\n\n\t// to determine the Content-Type header\n\tlocalVarHttpContentTypes := []string{\"application/json\"}\n\n\t// set Content-Type header\n\tlocalVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes)\n\tif localVarHttpContentType != \"\" {\n\t\tlocalVarHeaderParams[\"Content-Type\"] = localVarHttpContentType\n\t}\n\n\t// to determine the Accept header\n\tlocalVarHttpHeaderAccepts := []string{\"*/*\"}\n\n\t// set Accept header\n\tlocalVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)\n\tif localVarHttpHeaderAccept != \"\" {\n\t\tlocalVarHeaderParams[\"Accept\"] = localVarHttpHeaderAccept\n\t}\n\t// body params\n\tlocalVarPostBody = &notificationClient\n\tr, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)\n\tif err != nil {\n\t\treturn localVarReturnValue, nil, err\n\t}\n\n\tlocalVarHttpResponse, err := a.client.callAPI(r)\n\tif err != nil || localVarHttpResponse == nil {\n\t\treturn localVarReturnValue, localVarHttpResponse, err\n\t}\n\n\tlocalVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body)\n\tlocalVarHttpResponse.Body.Close()\n\tif err != nil {\n\t\treturn localVarReturnValue, localVarHttpResponse, err\n\t}\n\n\tif localVarHttpResponse.StatusCode < 300 {\n\t\t// If we succeed, return the data, otherwise pass on to decode error.\n\t\terr = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get(\"Content-Type\"))\n\t\treturn localVarReturnValue, localVarHttpResponse, err\n\t}\n\n\tif localVarHttpResponse.StatusCode >= 300 {\n\t\tnewErr := GenericSwaggerError{\n\t\t\tbody: localVarBody,\n\t\t\terror: localVarHttpResponse.Status,\n\t\t}\n\n\t\tif localVarHttpResponse.StatusCode == 200 {\n\t\t\tvar v NotificationClient\n\t\t\terr = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get(\"Content-Type\"))\n\t\t\tif err != nil {\n\t\t\t\tnewErr.error = err.Error()\n\t\t\t\treturn localVarReturnValue, localVarHttpResponse, newErr\n\t\t\t}\n\t\t\tnewErr.model = v\n\t\t\treturn localVarReturnValue, localVarHttpResponse, newErr\n\t\t}\n\n\t\treturn localVarReturnValue, localVarHttpResponse, newErr\n\t}\n\n\treturn localVarReturnValue, localVarHttpResponse, nil\n}", "func NewClient(kubeconfig, configContext string) (*Client, error) {\n\tconfig, err := defaultRestConfig(kubeconfig, configContext)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\trestClient, err := rest.RESTClientFor(config)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &Client{config, restClient}, nil\n}", "func NewClient(kubeconfig, configContext string) (*Client, error) {\n\tconfig, err := defaultRestConfig(kubeconfig, configContext)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\trestClient, err := rest.RESTClientFor(config)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &Client{config, restClient}, nil\n}", "func NewClient(config ClientConfig) (Client, error) {\n\t// raise error on client creation if the url is invalid\n\tneturl, err := url.Parse(config.URL)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\thttpClient := http.DefaultClient\n\n\tif config.TLSInsecureSkipVerify {\n\t\thttpClient.Transport = &http.Transport{TLSClientConfig: &tls.Config{InsecureSkipVerify: true}}\n\t}\n\n\tc := &client{\n\t\tclient: httpClient,\n\t\trawurl: neturl.String(),\n\t\tusername: config.Username,\n\t\tpassword: config.Password,\n\t}\n\n\t// create a single service object and reuse it for each API service\n\tc.service.client = c\n\tc.knowledge = (*knowledgeService)(&c.service)\n\n\treturn c, nil\n}", "func (c *Client) Post() *Request {\n\treturn NewRequest(c.httpClient, c.base, \"POST\", c.version, c.authstring, c.userAgent)\n}", "func NewClient(c Config) (Client, error) {\n\tif len(c.Endpoint) == 0 {\n\t\tc.Endpoint = EndpointProduction\n\t}\n\n\treturn &client{\n\t\tapikey: c.APIKey,\n\t\tendpoint: c.Endpoint,\n\t\torganizationid: c.OrganizationID,\n\t\thttpClient: http.DefaultClient,\n\t}, nil\n}", "func NewClient(config Config) *Client {\n\treturn &Client{Config: config}\n}", "func NewClient(config ClientConfig) (*Client, error) {\n\tvar baseURLToUse *url.URL\n\tvar err error\n\tif config.BaseURL == \"\" {\n\t\tbaseURLToUse, err = url.Parse(defaultBaseURL)\n\t} else {\n\t\tbaseURLToUse, err = url.Parse(config.BaseURL)\n\t}\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tc := &Client{\n\t\temail: config.Username,\n\t\tpassword: config.Password,\n\t\tbaseURL: baseURLToUse.String(),\n\t}\n\tc.client = http.DefaultClient\n\tc.InvitationService = &InvitationService{client: c}\n\tc.ActiveUserService = &ActiveUserService{client: c}\n\tc.UserService = &UserService{\n\t\tActiveUserService: c.ActiveUserService,\n\t\tInvitationService: c.InvitationService,\n\t}\n\treturn c, nil\n}", "func NewClient(ctx context.Context, cfg ClientConfig) (*Client, error) {\n\tconfig := &tfe.Config{\n\t\tToken: cfg.Token,\n\t}\n\ttfeClient, err := tfe.NewClient(config)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"could not create a new TFE tfeClient: %w\", err)\n\t}\n\n\tw, err := tfeClient.Workspaces.Read(ctx, cfg.Organization, cfg.Workspace)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"could not retrieve workspace '%v/%v': %w\", cfg.Organization, cfg.Workspace, err)\n\t}\n\n\tc := Client{\n\t\tclient: tfeClient,\n\t\tworkspace: w,\n\t}\n\treturn &c, nil\n}", "func NewClient(config *Config) *Client {\n\tc := &Client{config: defaultConfig.Merge(config)}\n\n\treturn c\n}", "func NewClient(config *Config) (client *Client, err error) {\n\t// bootstrap the config\n\tdefConfig := DefaultConfig()\n\n\tif len(config.ApiAddress) == 0 {\n\t\tconfig.ApiAddress = defConfig.ApiAddress\n\t}\n\n\tif len(config.Username) == 0 {\n\t\tconfig.Username = defConfig.Username\n\t}\n\n\tif len(config.Password) == 0 {\n\t\tconfig.Password = defConfig.Password\n\t}\n\n\tif len(config.Token) == 0 {\n\t\tconfig.Token = defConfig.Token\n\t}\n\n\tif len(config.UserAgent) == 0 {\n\t\tconfig.UserAgent = defConfig.UserAgent\n\t}\n\n\tif config.HttpClient == nil {\n\t\tconfig.HttpClient = defConfig.HttpClient\n\t}\n\n\tif config.HttpClient.Transport == nil {\n\t\tconfig.HttpClient.Transport = shallowDefaultTransport()\n\t}\n\n\tvar tp *http.Transport\n\n\tswitch t := config.HttpClient.Transport.(type) {\n\tcase *http.Transport:\n\t\ttp = t\n\tcase *oauth2.Transport:\n\t\tif bt, ok := t.Base.(*http.Transport); ok {\n\t\t\ttp = bt\n\t\t}\n\t}\n\n\tif tp != nil {\n\t\tif tp.TLSClientConfig == nil {\n\t\t\ttp.TLSClientConfig = &tls.Config{}\n\t\t}\n\t\ttp.TLSClientConfig.InsecureSkipVerify = config.SkipSslValidation\n\t}\n\n\tconfig.ApiAddress = strings.TrimRight(config.ApiAddress, \"/\")\n\n\tclient = &Client{\n\t\tConfig: *config,\n\t}\n\n\tif err := client.refreshEndpoint(); err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn client, nil\n}", "func NewClient(config *Config) (c *Client, err error) {\n\tif config == nil {\n\t\treturn nil, errClientConfigNil\n\t}\n\n\tc = &Client{\n\t\trevocationTransport: http.DefaultTransport,\n\t}\n\n\tif c.transport, err = ghinstallation.NewAppsTransport(\n\t\thttp.DefaultTransport,\n\t\tint64(config.AppID),\n\t\t[]byte(config.PrvKey),\n\t); err != nil {\n\t\treturn nil, err\n\t}\n\n\tif c.url, err = url.ParseRequestURI(fmt.Sprintf(\n\t\t\"%s/app/installations/%v/access_tokens\",\n\t\tstrings.TrimSuffix(fmt.Sprint(config.BaseURL), \"/\"),\n\t\tconfig.InsID,\n\t)); err != nil {\n\t\treturn nil, err\n\t}\n\n\tif c.revocationURL, err = url.ParseRequestURI(fmt.Sprintf(\n\t\t\"%s/installation/token\",\n\t\tstrings.TrimSuffix(fmt.Sprint(config.BaseURL), \"/\"),\n\t)); err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn c, nil\n}", "func NewClient(payload []byte, context appengine.Context) (Client, error) {\n\tvar c Client\n\terr := json.Unmarshal(payload, &c)\n\tif err != nil {\n\t\treturn c, err\n\t}\n\n\t// prepare the recipient payload for email client\n\tfor k, v := range c.Recipient {\n\t\tc.Recipient[k].Render = fmt.Sprintf(\"%s <%s>\", v.Name, v.Email)\n\t}\n\n\tc.context = context\n\n\treturn c, err\n}", "func NewClient(cfg *Config) (*Client, error) {\r\n\tBaseURL := new(url.URL)\r\n\tvar err error\r\n\r\n\tviper.SetEnvPrefix(\"TS\")\r\n\tviper.BindEnv(\"LOG\")\r\n\r\n\tswitch l := viper.Get(\"LOG\"); l {\r\n\tcase \"trace\":\r\n\t\tlog.SetLevel(log.TraceLevel)\r\n\tcase \"debug\":\r\n\t\tlog.SetLevel(log.DebugLevel)\r\n\tcase \"info\":\r\n\t\tlog.SetLevel(log.InfoLevel)\r\n\tcase \"warn\":\r\n\t\tlog.SetLevel(log.WarnLevel)\r\n\tcase \"fatal\":\r\n\t\tlog.SetLevel(log.FatalLevel)\r\n\tcase \"panic\":\r\n\t\tlog.SetLevel(log.PanicLevel)\r\n\t}\r\n\r\n\tif cfg.BaseURL != \"\" {\r\n\t\tBaseURL, err = url.Parse(cfg.BaseURL)\r\n\t\tif err != nil {\r\n\t\t\treturn nil, err\r\n\t\t}\r\n\t} else {\r\n\t\tBaseURL, err = url.Parse(defaultBaseURL)\r\n\t\tif err != nil {\r\n\t\t\treturn nil, err\r\n\t\t}\r\n\t}\r\n\r\n\tnewClient := &Client{\r\n\t\tBaseURL: BaseURL,\r\n\t\tclient: http.DefaultClient,\r\n\t\tcreds: &Credentials{\r\n\t\t\tAPIKey: cfg.APIKey,\r\n\t\t\tOrganizationID: cfg.OrganizationID,\r\n\t\t\tUserID: cfg.UserID,\r\n\t\t},\r\n\t}\r\n\r\n\tnewClient.Rulesets = &RulesetService{newClient}\r\n\tnewClient.Rules = &RuleService{newClient}\r\n\r\n\treturn newClient, nil\r\n}", "func NewClient(config *config.Config) Client {\n\treturn &releaseClient{\n\t\tconfig: config,\n\t}\n}", "func New(config *ConnConfig, ntfnHandlers *NotificationHandlers) (*Client, error) {\n\t// Either open a websocket connection or create an HTTP client depending\n\t// on the HTTP POST mode. Also, set the notification handlers to nil\n\t// when running in HTTP POST mode.\n\tvar wsConn *websocket.Conn\n\tvar httpClient *http.Client\n\tconnEstablished := make(chan struct{})\n\tvar start bool\n\tif config.HTTPPostMode {\n\t\tntfnHandlers = nil\n\t\tstart = true\n\n\t\tvar err error\n\t\thttpClient, err = newHTTPClient(config)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t} else {\n\t\tif !config.DisableConnectOnNew {\n\t\t\tvar err error\n\t\t\twsConn, err = dial(config)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t\tstart = true\n\t\t}\n\t}\n\n\tclient := &Client{\n\t\tconfig: config,\n\t\twsConn: wsConn,\n\t\thttpClient: httpClient,\n\t\trequestMap: make(map[uint64]*list.Element),\n\t\trequestList: list.New(),\n\t\tntfnHandlers: ntfnHandlers,\n\t\tntfnState: newNotificationState(),\n\t\tsendChan: make(chan []byte, sendBufferSize),\n\t\tsendPostChan: make(chan *sendPostDetails, sendPostBufferSize),\n\t\tconnEstablished: connEstablished,\n\t\tdisconnect: make(chan struct{}),\n\t\tshutdown: make(chan struct{}),\n\t}\n\n\tif start {\n\t\tlog.Infof(\"Established connection to RPC server %s\",\n\t\t\tconfig.Host)\n\t\tclose(connEstablished)\n\t\tclient.start()\n\t\tif !client.config.HTTPPostMode && !client.config.DisableAutoReconnect {\n\t\t\tclient.wg.Add(1)\n\t\t\tgo client.wsReconnectHandler()\n\t\t}\n\t}\n\n\treturn client, nil\n}", "func NewClient(config *Config) *Client {\n\treturn &Client{\n\t\tconfig: config,\n\t}\n}", "func NewClient(config *Config) (*Client, error) {\n\t// bootstrap the config\n\tdefConfig := DefaultConfig()\n\n\tif config.Address == \"\" {\n\t\tconfig.Address = defConfig.Address\n\t} else if _, err := url.Parse(config.Address); err != nil {\n\t\treturn nil, fmt.Errorf(\"invalid address '%s': %v\", config.Address, err)\n\t}\n\n\thttpClient := config.HttpClient\n\tif httpClient == nil {\n\t\thttpClient = defaultHttpClient()\n\t\tif err := ConfigureTLS(httpClient, config.TLSConfig); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\tclient := &Client{\n\t\tconfig: *config,\n\t\thttpClient: httpClient,\n\t}\n\treturn client, nil\n}", "func (f *extendedPodFactory) CreateClient(cfg *rest.Config) (interface{}, error) {\n\treturn f.client, nil\n}", "func NewClient(config *Configuration) (*Client, error) {\n\t// Check that authorization values are defined at all\n\tif config.AuthorizationHeaderToken == \"\" {\n\t\treturn nil, fmt.Errorf(\"No authorization is defined. You need AuthorizationHeaderToken\")\n\t}\n\n\tif config.ApplicationID == \"\" {\n\t\treturn nil, fmt.Errorf(\"ApplicationID is required - this is the only way to identify your requests in highwinds logs\")\n\t}\n\n\t// Configure the client from final configuration\n\tc := &Client{\n\t\tc: http.DefaultClient,\n\t\tDebug: config.Debug,\n\t\tApplicationID: config.ApplicationID,\n\t\tIdentity: &identity.Identification{\n\t\t\tAuthorizationHeaderToken: config.AuthorizationHeaderToken,\n\t\t},\n\t}\n\n\t// TODO eventually instantiate a custom client but not ready for that yet\n\n\t// Configure timeout on default client\n\tif config.Timeout == 0 {\n\t\tc.c.Timeout = time.Second * 10\n\t} else {\n\t\tc.c.Timeout = time.Second * time.Duration(config.Timeout)\n\t}\n\n\t// Set default headers\n\tc.Headers = c.GetHeaders()\n\treturn c, nil\n}", "func NewClient(ctx context.Context, cfg *config.Config) *github.Client {\n\t// OAuth\n\ttokenSrc := oauth2.StaticTokenSource(\n\t\t&oauth2.Token{AccessToken: cfg.GitHub.AccessToken},\n\t)\n\ttokenClient := oauth2.NewClient(ctx, tokenSrc)\n\n\t// GH\n\tclient := github.NewClient(tokenClient)\n\treturn client\n}", "func New(config ClientConfig) (Client, error) {\n\tvar err error\n\n\tclient := Client{collections: make(map[string]*mongo.Collection)}\n\tclientOptions := options.Client().ApplyURI(config.url())\n\n\t// Connect to MongoDB\n\tif client.client, err = mongo.Connect(context.TODO(), clientOptions); err != nil {\n\t\treturn client, err\n\t}\n\n\t// Check the connection\n\tif err = client.client.Ping(context.TODO(), nil); err != nil {\n\t\treturn client, err\n\t}\n\n\tclient.database = client.client.Database(config.Database)\n\n\treturn client, nil\n}", "func NewClient(c *Config) *Client {\n\treturn &Client{\n\t\tBaseURL: BaseURLV1,\n\t\tUname: c.Username,\n\t\tPword: c.Password,\n\t\tHTTPClient: &http.Client{\n\t\t\tTimeout: time.Minute,\n\t\t},\n\t}\n}", "func New(ctx context.Context, config Config) *Client {\n\tclient := &Client{\n\t\tid: generateClientID(\"C\"),\n\t\tvalues: make(map[string]interface{}),\n\t\tevents: make(chan *Event, 64),\n\t\tsends: make(chan string, 64),\n\t\tcapEnabled: make(map[string]bool),\n\t\tcapData: make(map[string]string),\n\t\tconfig: config.WithDefaults(),\n\t\tstatus: &Status{id: generateClientID(\"T\")},\n\t}\n\n\tclient.ctx, client.cancel = context.WithCancel(ctx)\n\n\t_ = client.AddTarget(client.status)\n\n\tgo client.handleEventLoop()\n\tgo client.handleSendLoop()\n\n\tclient.EmitNonBlocking(NewEvent(\"client\", \"create\"))\n\n\treturn client\n}", "func (c *Config) NewClient(database string) *Client {\n\treturn &Client{\n\t\tconfig: *c,\n\t\tdatabaseName: database,\n\t}\n}", "func newClient() (*client, error) {\n\tconfig, err := parsePgEnv()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tc := client{\n\t\tconnConfig: config,\n\n\t\tuser: pg.NewUserService(\n\t\t\tpg.WithHost(config.Host),\n\t\t\tpg.WithPort(config.Port),\n\t\t\tpg.WithDatabase(config.Database),\n\t\t\tpg.WithUser(config.User),\n\t\t\tpg.WithPassword(config.Password),\n\t\t),\n\t}\n\treturn &c, nil\n}", "func New(cfg Config) (*Client, error) {\n\tvar transport http.RoundTripper\n\tif cfg.Transport != nil {\n\t\ttransport = cfg.Transport\n\t} else {\n\t\ttransport = &DefaultTransport\n\t}\n\n\tc := &Client{\n\t\tTransport: transport,\n\t}\n\treturn c, nil\n}", "func NewClient(config *Config) (*Client, error) {\n\n\tconfig = DefaultConfig().Merge(config)\n\n\tif !strings.HasPrefix(config.Address, \"http\") {\n\t\tconfig.Address = \"http://\" + config.Address\n\t}\n\n\tif err := config.Validate(); err != nil {\n\t\treturn nil, err\n\t}\n\n\tclient := &Client{\n\t\tconfig: *config,\n\t\theaders: map[string]string{},\n\t\thttpClient: cleanhttp.DefaultClient(),\n\t}\n\n\treturn client, nil\n}", "func NewClient(config *Config, client *http.Client, authType cauth.IAuth) (*Client, error) {\n\t// set up the transport layer\n\t// allow 100 concurrent connection in the connection pool\n\tif client.Transport == nil {\n\t\tt := http.Transport{}\n\t\tclient.Transport = &t\n\t}\n\tt := client.Transport.(*http.Transport).Clone()\n\tt.MaxIdleConns = maxIdleConns\n\tt.MaxConnsPerHost = maxConnsPerHost\n\tt.MaxIdleConnsPerHost = maxIdleConnsPerHost\n\t// override transport\n\tclient.Transport = t\n\n\tif config == nil {\n\t\treturn nil, errors.New(\"config is empty\")\n\t}\n\tif authType == nil {\n\t\treturn nil, errors.New(\"auth type is not defined\")\n\t}\n\treturn &Client{client: *client, config: config, authType: authType}, nil\n}", "func NewClient(config *Config) *Client {\n\treturn &Client{\n\t\tchanged: make(chan struct{}),\n\t\tclosing: make(chan struct{}),\n\t\tcacheData: &Data{},\n\t\tlogger: log.New(os.Stderr, \"[metaclient] \", log.LstdFlags),\n\t\tpath: config.Dir,\n\t\tretentionAutoCreate: config.RetentionAutoCreate,\n\t\tconfig: config,\n\t}\n}", "func (c *PostClient) Create() *PostCreate {\n\tmutation := newPostMutation(c.config, OpCreate)\n\treturn &PostCreate{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func NewClient(c Config) Client {\n\treturn &client{config: c}\n}", "func NewClient(reader io.Reader, confFunc configFunc) (*http.Client, error) {\n\tb, err := ioutil.ReadAll(reader)\n\tif err != nil {\n\t\tlog.Printf(\"Unable to read client secret file: %v\", err)\n\t\treturn nil, err\n\t}\n\n\tconf, err := confFunc(b)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tclient := getClient(conf)\n\treturn client, nil\n}", "func NewClient(clientID string, clientSecret string, redirectURI string, httpClient *http.Client, tr TokenRepository) *Config {\n\treturn &Config{\n\t\tclientID: clientID,\n\t\tclientSecret: clientSecret,\n\t\tredirectURI: redirectURI,\n\t\tHTTPClient: httpClient,\n\t\ttokenRepository: tr,\n\t}\n}", "func New(ctx context.Context, config Config) (*Client, error) {\n\terr := config.checkAndSetDefaults()\n\tif err != nil {\n\t\treturn nil, trace.Wrap(err)\n\t}\n\tc := &Client{Config: config}\n\tclient, err := c.connect(ctx)\n\tif err != nil {\n\t\treturn nil, trace.Wrap(err)\n\t}\n\tc.client = client\n\tc.addTerminationHandler()\n\treturn c, nil\n}", "func New(cfg *Config) *Client {\n\treturn &Client{\n\t\tcfg: cfg,\n\t}\n}", "func New(config model.Config) (model.Client, error) {\n\tconfig, err := validateConfig(config)\n\tif err != nil {\n\t\tWriteLogFile(err)\n\t\treturn nil, err\n\t}\n\tc := client{config}\n\tconn, err := connect(c.Host) // test connection\n\tif err != nil {\n\t\tWriteLogFile(err)\n\t\treturn nil, err\n\t}\n\tif err = conn.Bind(c.ROUser.Name, c.ROUser.Password); err != nil {\n\t\tWriteLogFile(err)\n\t\treturn nil, err\n\t}\n\tconn.Close()\n\treturn c, err\n}", "func GetClient(logger *zap.SugaredLogger, cfg *config.Config) (Interface, error) {\n\tcp, err := config.NewConfigurationProvider(cfg)\n\tif err != nil {\n\t\tlogger.With(zap.Error(err)).Fatal(\"Unable to create client.\")\n\t\treturn nil, err\n\t}\n\n\trateLimiter := NewRateLimiter(logger, cfg.RateLimiter)\n\n\tc, err := New(logger, cp, &rateLimiter)\n\treturn c, err\n}", "func GetClient(accessKey string) Client {\n\treturn Client{\n\t\tAccKey: accessKey,\n\t\tMethod: bingAPIMethodPost,\n\t\tUserAgent: bingAPIUserAgent,\n\t\tReqTimeout: bingAPIReqTimeout,\n\t}\n}", "func New(cfg client.Config) (client.Client, error) {\n\treturn client.New(cfg)\n}", "func New(httpClient *http.Client, opts *ClientOptions) (*Client, error) {\n\tif err := opts.Validate(); err != nil {\n\t\treturn nil, err\n\t}\n\n\tbaseURL, err := url.Parse(opts.Host)\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"error parsing host URL\")\n\t}\n\n\tclient := Client{\n\t\tbaseURL: baseURL,\n\t\tkey: opts.Key,\n\t\tversion: opts.Version,\n\t\tapiPath: opts.GhostPath,\n\t\thttpClient: httpClient,\n\t}\n\n\tclient.Posts = &PostResource{&client}\n\tclient.Pages = &PageResource{&client}\n\tclient.Authors = &AuthorResource{&client}\n\tclient.Tags = &TagResource{&client}\n\n\treturn &client, nil\n}", "func NewClient(config *Config) Client {\n\tendpoint := net.JoinHostPort(config.Hostname, strconv.Itoa(config.port()))\n\tif !strings.Contains(endpoint, \"//\") {\n\t\tendpoint = \"http://\" + endpoint\n\t}\n\n\topts := &jsonrpc.RPCClientOpts{\n\t\tCustomHeaders: map[string]string{\n\t\t\t\"Authorization\": \"Basic \" + base64.StdEncoding.EncodeToString([]byte(config.Username+\":\"+config.Password)),\n\t\t},\n\t}\n\n\treturn &client{\n\t\tRPCClient: jsonrpc.NewClientWithOpts(endpoint, opts),\n\t}\n}", "func getClient(config *oauth2.Config) *http.Client {\n\ttokFile := \"token.json\"\n\ttok, err := tokenFromFile(tokFile)\n\tif err != nil {\n\t\ttok = getTokenFromWeb(config)\n\t\tsaveToken(tokFile, tok)\n\t}\n\treturn config.Client(context.Background(), tok)\n}", "func getClient(config *oauth2.Config) *http.Client {\n\ttokFile := \"token.json\"\n\ttok, err := tokenFromFile(tokFile)\n\tif err != nil {\n\t\ttok = getTokenFromWeb(config)\n\t\tsaveToken(tokFile, tok)\n\t}\n\treturn config.Client(context.Background(), tok)\n}", "func getClient(config *oauth2.Config) *http.Client {\n\ttokFile := \"token.json\"\n\ttok, err := tokenFromFile(tokFile)\n\tif err != nil {\n\t\ttok = getTokenFromWeb(config)\n\t\tsaveToken(tokFile, tok)\n\t}\n\treturn config.Client(context.Background(), tok)\n}", "func newClient(project string) (*client, error) {\n\tctx := context.Background()\n\tcl, err := pubsub.NewClient(ctx, project)\n\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn &client{\n\t\tclient: cl,\n\t}, nil\n}", "func NewClient(c *Config) (*Client, error) {\n\th := cleanhttp.DefaultClient()\n\n\tclient := &Client{\n\t\tconfig: *c,\n\t\thttpClient: h,\n\t}\n\treturn client, nil\n}", "func NewClient(config HostConfig) *Client {\n\tc := &Client{\n\t\tconfig: config,\n\t}\n\tc.client = &http.Client{\n\t\tTransport: &http.Transport{\n\t\t\tTLSClientConfig: &tls.Config{\n\t\t\t\tInsecureSkipVerify: !config.Verify,\n\t\t\t},\n\t\t},\n\t}\n\n\tgrpcAddress := c.config.GRPC\n\tsecure := false\n\tif grpcAddress == `` {\n\t\tu, _ := url.Parse(c.config.API)\n\t\tgrpcAddress = u.Hostname()\n\t\tgrpcPort := u.Port()\n\t\tif u.Scheme == `http` {\n\t\t\tsecure = false\n\t\t\tif grpcPort == `` {\n\t\t\t\tgrpcPort = `80`\n\t\t\t}\n\t\t} else {\n\t\t\tsecure = true\n\t\t\tif grpcPort == `` {\n\t\t\t\tgrpcPort = `443`\n\t\t\t}\n\t\t}\n\n\t\tgrpcAddress = fmt.Sprintf(`%s:%s`, grpcAddress, grpcPort)\n\t}\n\n\tvar conn *grpc.ClientConn\n\tvar err error\n\tif secure {\n\t\tif conn, err = grpc.Dial(\n\t\t\tgrpcAddress,\n\t\t\tgrpc.WithTransportCredentials(credentials.NewTLS(&tls.Config{})),\n\t\t\tgrpc.WithDefaultCallOptions(grpc.MaxCallRecvMsgSize(100<<20)),\n\t\t); err != nil {\n\t\t\tpanic(err)\n\t\t}\n\t} else {\n\t\tif conn, err = grpc.Dial(\n\t\t\tgrpcAddress,\n\t\t\tgrpc.WithInsecure(),\n\t\t\tgrpc.WithDefaultCallOptions(grpc.MaxCallRecvMsgSize(100<<20)),\n\t\t); err != nil {\n\t\t\tpanic(err)\n\t\t}\n\t}\n\n\tc.cc = conn\n\n\tc.blog = protocols.NewTaoBlogClient(c.cc)\n\tc.management = protocols.NewManagementClient(c.cc)\n\n\treturn c\n}", "func NewClient(configMode string) (client AzureClient) {\n\tvar configload Config\n\tif configMode == \"metadata\" {\n\t\tconfigload = LoadConfig()\n\t} else if configMode == \"environment\" {\n\t\tconfigload = EnvLoadConfig()\n\t} else {\n\t\tlog.Print(\"Invalid config Mode\")\n\t}\n\n\tclient = AzureClient{\n\t\tconfigload,\n\t\tGetVMClient(configload),\n\t\tGetNicClient(configload),\n\t\tGetLbClient(configload),\n\t}\n\treturn\n}", "func New(config *rest.Config, options Options) (c Client, err error) {\n\tc, err = newClient(config, options)\n\tif err == nil && options.DryRun != nil && *options.DryRun {\n\t\tc = NewDryRunClient(c)\n\t}\n\treturn c, err\n}", "func NewClient(authToken string) Client {\n\treturn Client{AuthToken: authToken, BaseURL: defaultBaseURL}\n}", "func NewClient(config *core.Config) (c *Client, err error) {\n\t// create client\n\tc = &Client{\n\t\tconfig: config,\n\t\tdone: make(chan bool, 2),\n\t}\n\n\t// create cipher\n\tif c.cipher, err = core.NewCipher(c.config.Cipher, c.config.Passwd); err != nil {\n\t\tlogln(\"core: failed to initialize cipher:\", err)\n\t\treturn\n\t}\n\n\t// create managed net\n\tif c.net, err = nat.NewNetFromCIDR(DefaultClientSubnet); err != nil {\n\t\tlogln(\"nat: failed to create managed subnet:\", err)\n\t\treturn\n\t}\n\n\t// assign a localIP\n\tif c.localIP, err = c.net.Take(); err != nil {\n\t\tlogln(\"nat: faield to assign a localIP:\", err)\n\t\treturn\n\t}\n\n\treturn\n}", "func NewClient(config *config.Config, httpClient *http.Client) *Client {\n\treturn &Client{\n\t\tGetter: NewGetter(config, httpClient),\n\t}\n}", "func (c *Config) NewClient() (*Client, error) {\n\tapiKey, err := c.NewLogin()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &Client{\n\t\tToken: apiKey.Data.Token,\n\t\tServerURL: c.Hostname,\n\t\tApplication: c.Application,\n\t\tSSLSkipVerify: c.SSLSkipVerify,\n\t}, nil\n}", "func (a *Client) Post(params *PostParams) (*PostOK, error) {\n\t// TODO: Validate the params before sending\n\tif params == nil {\n\t\tparams = NewPostParams()\n\t}\n\n\tresult, err := a.transport.Submit(&runtime.ClientOperation{\n\t\tID: \"post\",\n\t\tMethod: \"POST\",\n\t\tPathPattern: \"/\",\n\t\tProducesMediaTypes: []string{\"application/json; qs=0.5\", \"application/vnd.schemaregistry+json; qs=0.9\", \"application/vnd.schemaregistry.v1+json\"},\n\t\tConsumesMediaTypes: []string{\"application/json\", \"application/octet-stream\", \"application/vnd.schemaregistry+json\", \"application/vnd.schemaregistry.v1+json\"},\n\t\tSchemes: []string{\"http\", \"https\"},\n\t\tParams: params,\n\t\tReader: &PostReader{formats: a.formats},\n\t\tContext: params.Context,\n\t\tClient: params.HTTPClient,\n\t})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn result.(*PostOK), nil\n\n}", "func NewClient(cfg *config.Configuration) (*Client, error) {\n\trc, err := rest.New(Url)\n\tif err != nil {\n\t\treturn &Client{}, err\n\t}\n\n\tclient := &Client{\n\t\tconfig: cfg,\n\t\tclient: rc,\n\t\tlimiter: rate.NewLimiter(30, 5),\n\t}\n\n\treturn client, nil\n}", "func NewClient(config *Config) Client {\n\tendpoint := net.JoinHostPort(config.hostname(), strconv.Itoa(config.port()))\n\tif !strings.Contains(endpoint, \"//\") {\n\t\tendpoint = \"http://\" + endpoint\n\t}\n\n\topts := &jsonrpc.RPCClientOpts{\n\t\tCustomHeaders: map[string]string{\n\t\t\t\"Authorization\": \"Basic \" + base64.StdEncoding.EncodeToString([]byte(config.username()+\":\"+config.password())),\n\t\t},\n\t}\n\n\treturn &client{\n\t\tRPCClient: jsonrpc.NewClientWithOpts(endpoint, opts),\n\t}\n}", "func GetClient(config *oauth2.Config) *http.Client {\n\t// The file token.json stores the user's access and refresh tokens, and is\n\t// created automatically when the authorization flow completes for the first\n\t// time.\n\ttokFile := \"token.json\"\n\ttok, err := TokenFromFile(tokFile)\n\tif err != nil {\n\t\ttok = GetTokenFromWeb(config)\n\t\tSaveToken(tokFile, tok)\n\t}\n\treturn config.Client(context.Background(), tok)\n}", "func (c *Config) Client(ctx context.Context, t *Ticket) *http.Client {\n\treturn NewClient(ctx, c.TicketSource(ctx, t))\n}", "func newClient(conf Config) (*github.Client, error) {\n\tctx := context.Background()\n\n\tvar ts oauth2.TokenSource\n\tswitch {\n\tcase conf.HasAPIToken():\n\t\tts = oauth2.StaticTokenSource(\n\t\t\t&oauth2.Token{AccessToken: conf.GetAPIToken()},\n\t\t)\n\tdefault:\n\t\treturn nil, errors.New(\"Cannot find GitHub credentials\")\n\t}\n\n\ttc := oauth2.NewClient(ctx, ts)\n\treturn github.NewClient(tc), nil\n}", "func NewClient(token string, dryRun bool) *Client {\n\treturn NewClientWithEndpoint(\"https://api.github.com\", token, dryRun)\n}", "func GetClient(config Config) (*client.Client, error) {\n\topts := []client.Option{\n\t\tclient.WithNamespace(config.GetNamespace()),\n\t\tclient.WithScope(config.GetScope()),\n\t}\n\tmember := config.GetMember()\n\thost := config.GetHost()\n\tif host != \"\" {\n\t\topts = append(opts, client.WithPeerHost(config.GetHost()))\n\t\topts = append(opts, client.WithPeerPort(config.GetPort()))\n\t\tfor _, s := range serviceRegistry.services {\n\t\t\tservice := func(service cluster.Service) func(peer.ID, *grpc.Server) {\n\t\t\t\treturn func(id peer.ID, server *grpc.Server) {\n\t\t\t\t\tservice(cluster.NodeID(id), server)\n\t\t\t\t}\n\t\t\t}(s)\n\t\t\topts = append(opts, client.WithPeerService(service))\n\t\t}\n\t}\n\tif member != \"\" {\n\t\topts = append(opts, client.WithMemberID(config.GetMember()))\n\t} else if host != \"\" {\n\t\topts = append(opts, client.WithMemberID(config.GetHost()))\n\t}\n\n\treturn client.New(config.GetController(), opts...)\n}", "func NewClient(config vipps.ClientConfig) *Client {\n\tvar baseURL string\n\tvar logger logging.Logger\n\n\tif config.HTTPClient == nil {\n\t\tpanic(\"config.HTTPClient cannot be nil\")\n\t}\n\n\tif config.Environment == vipps.EnvironmentTesting {\n\t\tbaseURL = vipps.BaseURLTesting\n\t} else {\n\t\tbaseURL = vipps.BaseURL\n\t}\n\n\tif config.Logger == nil {\n\t\tlogger = logging.NewNopLogger()\n\t} else {\n\t\tlogger = config.Logger\n\t}\n\n\treturn &Client{\n\t\tBaseURL: baseURL,\n\t\tAPIClient: &internal.APIClient{\n\t\t\tL: logger,\n\t\t\tC: config.HTTPClient,\n\t\t},\n\t}\n}", "func getClient(config *oauth2.Config) *http.Client {\n\tconf, _ := DefaultConfig()\n\ttok, err := tokenFromFile(conf.Path.TokenFile)\n\tif err != nil {\n\t\ttok = getTokenFromWeb(config)\n\t\tsaveToken(conf.Path.TokenFile, tok)\n\t}\n\treturn config.Client(context.Background(), tok)\n}", "func NewForConfig(config clientcmd.ClientConfig) (client *Client, err error) {\n\tif config == nil {\n\t\t// initialize client-go clients\n\t\tloadingRules := clientcmd.NewDefaultClientConfigLoadingRules()\n\t\tconfigOverrides := &clientcmd.ConfigOverrides{}\n\t\tconfig = clientcmd.NewNonInteractiveDeferredLoadingClientConfig(loadingRules, configOverrides)\n\t}\n\n\tclient = new(Client)\n\tclient.KubeConfig = config\n\n\tclient.KubeClientConfig, err = client.KubeConfig.ClientConfig()\n\tif err != nil {\n\t\treturn nil, errors.Wrapf(err, errorMsg)\n\t}\n\n\tclient.KubeClient, err = kubernetes.NewForConfig(client.KubeClientConfig)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tclient.Namespace, _, err = client.KubeConfig.Namespace()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tclient.OperatorClient, err = operatorsclientset.NewForConfig(client.KubeClientConfig)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tclient.DynamicClient, err = dynamic.NewForConfig(client.KubeClientConfig)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tclient.appsClient, err = appsclientset.NewForConfig(client.KubeClientConfig)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tclient.serviceCatalogClient, err = servicecatalogclienset.NewForConfig(client.KubeClientConfig)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tclient.discoveryClient, err = discovery.NewDiscoveryClientForConfig(client.KubeClientConfig)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tclient.checkIngressSupports = true\n\n\tclient.userClient, err = userclientset.NewForConfig(client.KubeClientConfig)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tclient.projectClient, err = projectclientset.NewForConfig(client.KubeClientConfig)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tclient.routeClient, err = routeclientset.NewForConfig(client.KubeClientConfig)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn client, nil\n}", "func NewPost(url string) *Request { return NewRequest(\"POST\", url) }", "func NewClient(config *latest.Config, kubeClient kubectl.Client, dockerClient docker.Client, log log.Logger) Client {\n\treturn &client{\n\t\tconfig: config,\n\t\tkubeClient: kubeClient,\n\t\tdockerClient: dockerClient,\n\t\tlog: log,\n\t}\n}", "func New(masterUrl,kubeconfig string)(*Client,error){\n // use the current context in kubeconfig\n config, err := clientcmd.BuildConfigFromFlags(masterUrl, kubeconfig)\n if err != nil {\n\t return nil,err\n }\n\n // create the clientset\n clientset, err := kubernetes.NewForConfig(config)\n if err!=nil{\n\t\treturn nil,err\n }\n return &Client{cset:clientset},nil\n}", "func NewClient(cfg *rest.Config) (versioned.Interface, error) {\n\tglog.Info(\"NewClient()\")\n\tscheme := runtime.NewScheme()\n\tif err := v1.AddToScheme(scheme); err != nil {\n\t\treturn nil, err\n\t}\n\n\tconfig := *cfg\n\tconfig.GroupVersion = &v1.SchemeGroupVersion\n\tconfig.APIPath = \"/apis\"\n\tconfig.ContentType = runtime.ContentTypeJSON\n\tconfig.NegotiatedSerializer = serializer.WithoutConversionCodecFactory{CodecFactory: serializer.NewCodecFactory(scheme)}\n\n\tcs, err := versioned.NewForConfig(&config)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn cs, nil\n}", "func NewPost() *Post {\n\treturn &Post{\n\t\tId: bson.NewObjectId(),\n\t\tCreatedAt: utils.Now(),\n\t}\n}", "func NewClient(cfg Config) ClientImplementation {\n\treturn ClientImplementation{\n\t\tAPIKey: cfg.APIKey,\n\t\tAPISecret: cfg.APISecret,\n\t\tURL: cfg.URL,\n\t\tOriginHost: cfg.OriginHost,\n\t\tHTTPClient: &http.Client{Timeout: 60 * time.Second},\n\t\t// 0: no logging\n\t\t// 1: errors only\n\t\t// 2: errors + informational (default)\n\t\t// 3: errors + informational + debug\n\t\tLogLevel: cfg.LogLevel,\n\t\tLogger: log.New(os.Stderr, \"\", log.LstdFlags),\n\t}\n}", "func NewClient(kubeconfig string) (client versioned.Interface, err error) {\n\tvar config *rest.Config\n\tconfig, err = getConfig(kubeconfig)\n\tif err != nil {\n\t\treturn\n\t}\n\treturn versioned.NewForConfig(config)\n}", "func Create() *ConnectedClient {\n client := ConnectedClient {}\n\n client.ClientSecret = generateClientSecret();\n client.ClientToken = generateClientIdentifier();\n client.ClientName = generateClientName();\n client.VoteHistory = make([]Vote, 0);\n client.QueueHistory = make([]QueueEntry, 0);\n client.ConnectionTime = time.Now();\n client.LastCommunicated = time.Now();\n\n currentClients[client.ClientToken] = &client\n\n return &client\n}", "func NewClient(config *Config) *Client {\n\tif config == nil {\n\t\tc := defaultConfig\n\t\tconfig = &c\n\t}\n\tif config.httpClient == nil {\n\t\tconfig.httpClient = http.DefaultClient\n\t}\n\tbaseURL, _ := url.Parse(defaultBaseURL)\n\n\tc := &Client{\n\t\tconfig: config,\n\t\tbaseURL: baseURL,\n\t\tuserAgent: userAgent,\n\t}\n\n\tc.common.client = c\n\tc.Candidates = (*CandidatesService)(&c.common)\n\treturn c\n}", "func NewClient(ctx context.Context, cfg *Config, bc *bclient.Client, db *db.Database) (*Client, error) {\n\twg := &sync.WaitGroup{}\n\n\tfor _, watcher := range cfg.Watchers {\n\t\twg.Add(1)\n\t\tgo func(discToken, token0, token1 string) {\n\t\t\tdefer wg.Done()\n\t\t\tdg, err := discordgo.New(\"Bot \" + discToken)\n\t\t\tif err != nil {\n\t\t\t\tlog.Println(\"failed to start watcher: \", err)\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tif err := dg.Open(); err != nil {\n\t\t\t\tlog.Println(\"failed to start watcher: \", err)\n\t\t\t\treturn\n\t\t\t}\n\t\t}(watcher.DiscordToken, watcher.Token0Address, watcher.Token1Address)\n\t}\n\n\tclient := &Client{bc: bc, wg: wg, db: db}\n\n\tlog.Println(\"bot is now running\")\n\treturn client, nil\n}", "func NewClient(cfg *Config) *Client {\n\treturn &Client{\n\t\tcfg: cfg,\n\t}\n}", "func NewClient(config *Settings) (*PlatformClient, error) {\n\tif err := config.Validate(); err != nil {\n\t\treturn nil, err\n\t}\n\tcfClient, err := config.CF.CFClientProvider(&config.CF.Config)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn &PlatformClient{\n\t\tclient: cfClient,\n\t\tsettings: config,\n\t\tplanResolver: NewPlanResolver(),\n\t}, nil\n}", "func New(context *contexter.Context) (*Client) {\n return &Client {\n urlBaseIndex: 0,\n\t\tcontext: context,\n }\n}", "func NewClient(conf config.RemoteWriteConfig) (*Client, error) {\n\ttlsConfig, err := httputil.NewTLSConfig(conf.TLSConfig)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// The only timeout we care about is the configured push timeout.\n\t// It is applied on request. So we leave out any timings here.\n\tvar rt http.RoundTripper = &http.Transport{\n\t\tProxy: http.ProxyURL(conf.ProxyURL.URL),\n\t\tTLSClientConfig: tlsConfig,\n\t}\n\n\tif conf.BasicAuth != nil {\n\t\trt = httputil.NewBasicAuthRoundTripper(conf.BasicAuth.Username, conf.BasicAuth.Password, rt)\n\t}\n\n\treturn &Client{\n\t\turl: *conf.URL,\n\t\tclient: httputil.NewClient(rt),\n\t\ttimeout: time.Duration(conf.RemoteTimeout),\n\t}, nil\n}", "func Post(url string, data ...interface{}) (*ClientResponse, error) {\n\treturn DoRequest(\"POST\", url, data...)\n}", "func NewClient(cfg *Config, args ...interface{}) (endpoint.Connector, error) {\n\treturn cfg.newClient(args)\n}", "func NewClient(getToken func() []byte, censor func([]byte) []byte, graphqlEndpoint string, bases ...string) (Client, error) {\n\treturn NewClientWithFields(logrus.Fields{}, getToken, censor, graphqlEndpoint, bases...)\n}" ]
[ "0.69091475", "0.6537998", "0.6282227", "0.60269856", "0.6015132", "0.596973", "0.59686834", "0.5928643", "0.5926885", "0.58377075", "0.5794894", "0.5792589", "0.5784017", "0.57805353", "0.575687", "0.5755235", "0.5751759", "0.57512414", "0.57465065", "0.5736899", "0.5736899", "0.572253", "0.5720855", "0.56674874", "0.56263775", "0.5623217", "0.56203026", "0.56172466", "0.5609675", "0.5591731", "0.55836016", "0.55568254", "0.5556379", "0.5554982", "0.555162", "0.55322134", "0.5523836", "0.55074006", "0.5498874", "0.54975295", "0.5494231", "0.54888445", "0.5485211", "0.54818", "0.5480298", "0.5465549", "0.5462619", "0.5450882", "0.54265887", "0.54224396", "0.54205614", "0.54197705", "0.54128164", "0.5392394", "0.53857714", "0.53823966", "0.53816164", "0.5379009", "0.53757924", "0.5363657", "0.5359629", "0.5359629", "0.5359629", "0.53595704", "0.5356957", "0.53478724", "0.5343346", "0.53431267", "0.5342736", "0.53338236", "0.5325624", "0.53255916", "0.5325115", "0.53207177", "0.5319656", "0.53165436", "0.53138936", "0.53123885", "0.53014493", "0.53002995", "0.5295788", "0.5295341", "0.529432", "0.52924085", "0.5292283", "0.5290987", "0.52901363", "0.5289393", "0.5289334", "0.5286706", "0.5285161", "0.5281026", "0.52783656", "0.52702266", "0.5267314", "0.52653015", "0.52642035", "0.526414", "0.52594393", "0.5258471" ]
0.7964783
0
Use adds a list of mutation hooks to the hooks stack. A call to `Use(f, g, h)` equals to `post.Hooks(f(g(h())))`.
func (c *PostClient) Use(hooks ...Hook) { c.hooks.Post = append(c.hooks.Post, hooks...) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (em *entityManager) Use(mw ...MiddlewareFunc) {\n\tem.mwStack = append(em.mwStack, mw...)\n}", "func (c *TagClient) Use(hooks ...Hook) {\n\tc.hooks.Tag = append(c.hooks.Tag, hooks...)\n}", "func (f *Flame) Use(handlers ...Handler) {\n\tvalidateAndWrapHandlers(handlers, nil)\n\tf.handlers = append(f.handlers, handlers...)\n}", "func (c *AdminClient) Use(hooks ...Hook) {\n\tc.hooks.Admin = append(c.hooks.Admin, hooks...)\n}", "func (c *StatustClient) Use(hooks ...Hook) {\n\tc.hooks.Statust = append(c.hooks.Statust, hooks...)\n}", "func (ms *MiddlewareStack) Use(mw ...MiddlewareFunc) {\n\tms.stack = append(ms.stack, mw...)\n}", "func (ms *MiddlewareStack) Use(mw ...MiddlewareFunc) {\n\tms.stack = append(ms.stack, mw...)\n}", "func (c *BranchClient) Use(hooks ...Hook) {\n\tc.hooks.Branch = append(c.hooks.Branch, hooks...)\n}", "func (c *PetruleClient) Use(hooks ...Hook) {\n\tc.hooks.Petrule = append(c.hooks.Petrule, hooks...)\n}", "func (c *FoodmenuClient) Use(hooks ...Hook) {\n\tc.hooks.Foodmenu = append(c.hooks.Foodmenu, hooks...)\n}", "func (c *MealplanClient) Use(hooks ...Hook) {\n\tc.hooks.Mealplan = append(c.hooks.Mealplan, hooks...)\n}", "func (c *EatinghistoryClient) Use(hooks ...Hook) {\n\tc.hooks.Eatinghistory = append(c.hooks.Eatinghistory, hooks...)\n}", "func (c *ReviewClient) Use(hooks ...Hook) {\n\tc.hooks.Review = append(c.hooks.Review, hooks...)\n}", "func (c *ToolClient) Use(hooks ...Hook) {\n\tc.hooks.Tool = append(c.hooks.Tool, hooks...)\n}", "func (c *WorkExperienceClient) Use(hooks ...Hook) {\n\tc.hooks.WorkExperience = append(c.hooks.WorkExperience, hooks...)\n}", "func (c *EventClient) Use(hooks ...Hook) {\n\tc.hooks.Event = append(c.hooks.Event, hooks...)\n}", "func (c *PharmacistClient) Use(hooks ...Hook) {\n\tc.hooks.Pharmacist = append(c.hooks.Pharmacist, hooks...)\n}", "func (c *WalletNodeClient) Use(hooks ...Hook) {\n\tc.hooks.WalletNode = append(c.hooks.WalletNode, hooks...)\n}", "func (c *LevelOfDangerousClient) Use(hooks ...Hook) {\n\tc.hooks.LevelOfDangerous = append(c.hooks.LevelOfDangerous, hooks...)\n}", "func (c *PhysicianClient) Use(hooks ...Hook) {\n\tc.hooks.Physician = append(c.hooks.Physician, hooks...)\n}", "func (c *PhysicianClient) Use(hooks ...Hook) {\n\tc.hooks.Physician = append(c.hooks.Physician, hooks...)\n}", "func (c *OperationClient) Use(hooks ...Hook) {\n\tc.hooks.Operation = append(c.hooks.Operation, hooks...)\n}", "func (c *DentistClient) Use(hooks ...Hook) {\n\tc.hooks.Dentist = append(c.hooks.Dentist, hooks...)\n}", "func (c *BeerClient) Use(hooks ...Hook) {\n\tc.hooks.Beer = append(c.hooks.Beer, hooks...)\n}", "func (c *SituationClient) Use(hooks ...Hook) {\n\tc.hooks.Situation = append(c.hooks.Situation, hooks...)\n}", "func (c *PetClient) Use(hooks ...Hook) {\n\tc.hooks.Pet = append(c.hooks.Pet, hooks...)\n}", "func (c *OperativeClient) Use(hooks ...Hook) {\n\tc.hooks.Operative = append(c.hooks.Operative, hooks...)\n}", "func (c *ComplaintClient) Use(hooks ...Hook) {\n\tc.hooks.Complaint = append(c.hooks.Complaint, hooks...)\n}", "func (c *SymptomClient) Use(hooks ...Hook) {\n\tc.hooks.Symptom = append(c.hooks.Symptom, hooks...)\n}", "func (c *PlanetClient) Use(hooks ...Hook) {\n\tc.hooks.Planet = append(c.hooks.Planet, hooks...)\n}", "func (c *CleanernameClient) Use(hooks ...Hook) {\n\tc.hooks.Cleanername = append(c.hooks.Cleanername, hooks...)\n}", "func (c *BillClient) Use(hooks ...Hook) {\n\tc.hooks.Bill = append(c.hooks.Bill, hooks...)\n}", "func (c *BillClient) Use(hooks ...Hook) {\n\tc.hooks.Bill = append(c.hooks.Bill, hooks...)\n}", "func (c *BillClient) Use(hooks ...Hook) {\n\tc.hooks.Bill = append(c.hooks.Bill, hooks...)\n}", "func (c *ClubBranchClient) Use(hooks ...Hook) {\n\tc.hooks.ClubBranch = append(c.hooks.ClubBranch, hooks...)\n}", "func (c *TasteClient) Use(hooks ...Hook) {\n\tc.hooks.Taste = append(c.hooks.Taste, hooks...)\n}", "func (c *FacultyClient) Use(hooks ...Hook) {\n\tc.hooks.Faculty = append(c.hooks.Faculty, hooks...)\n}", "func (c *BuildingClient) Use(hooks ...Hook) {\n\tc.hooks.Building = append(c.hooks.Building, hooks...)\n}", "func (c *VeterinarianClient) Use(hooks ...Hook) {\n\tc.hooks.Veterinarian = append(c.hooks.Veterinarian, hooks...)\n}", "func (c *BedtypeClient) Use(hooks ...Hook) {\n\tc.hooks.Bedtype = append(c.hooks.Bedtype, hooks...)\n}", "func (c *MedicineClient) Use(hooks ...Hook) {\n\tc.hooks.Medicine = append(c.hooks.Medicine, hooks...)\n}", "func (c *ClubClient) Use(hooks ...Hook) {\n\tc.hooks.Club = append(c.hooks.Club, hooks...)\n}", "func (c *PositionClient) Use(hooks ...Hook) {\n\tc.hooks.Position = append(c.hooks.Position, hooks...)\n}", "func (c *PositionClient) Use(hooks ...Hook) {\n\tc.hooks.Position = append(c.hooks.Position, hooks...)\n}", "func (c *PositionClient) Use(hooks ...Hook) {\n\tc.hooks.Position = append(c.hooks.Position, hooks...)\n}", "func (c *PurposeClient) Use(hooks ...Hook) {\n\tc.hooks.Purpose = append(c.hooks.Purpose, hooks...)\n}", "func (c *TransactionClient) Use(hooks ...Hook) {\n\tc.hooks.Transaction = append(c.hooks.Transaction, hooks...)\n}", "func (c *PositionassingmentClient) Use(hooks ...Hook) {\n\tc.hooks.Positionassingment = append(c.hooks.Positionassingment, hooks...)\n}", "func (c *PaymentClient) Use(hooks ...Hook) {\n\tc.hooks.Payment = append(c.hooks.Payment, hooks...)\n}", "func (c *PaymentClient) Use(hooks ...Hook) {\n\tc.hooks.Payment = append(c.hooks.Payment, hooks...)\n}", "func (c *Client) Use(hooks ...Hook) {\n\tc.Event.Use(hooks...)\n\tc.Tag.Use(hooks...)\n}", "func (c *UserClient) Use(hooks ...Hook) {\n\tc.hooks.User = append(c.hooks.User, hooks...)\n}", "func (c *UserClient) Use(hooks ...Hook) {\n\tc.hooks.User = append(c.hooks.User, hooks...)\n}", "func (c *UserClient) Use(hooks ...Hook) {\n\tc.hooks.User = append(c.hooks.User, hooks...)\n}", "func (c *UserClient) Use(hooks ...Hook) {\n\tc.hooks.User = append(c.hooks.User, hooks...)\n}", "func (c *UserClient) Use(hooks ...Hook) {\n\tc.hooks.User = append(c.hooks.User, hooks...)\n}", "func (c *UserClient) Use(hooks ...Hook) {\n\tc.hooks.User = append(c.hooks.User, hooks...)\n}", "func (c *UserClient) Use(hooks ...Hook) {\n\tc.hooks.User = append(c.hooks.User, hooks...)\n}", "func (c *UserClient) Use(hooks ...Hook) {\n\tc.hooks.User = append(c.hooks.User, hooks...)\n}", "func (c *UserClient) Use(hooks ...Hook) {\n\tc.hooks.User = append(c.hooks.User, hooks...)\n}", "func (c *UserClient) Use(hooks ...Hook) {\n\tc.hooks.User = append(c.hooks.User, hooks...)\n}", "func (c *UserClient) Use(hooks ...Hook) {\n\tc.hooks.User = append(c.hooks.User, hooks...)\n}", "func (c *UserWalletClient) Use(hooks ...Hook) {\n\tc.hooks.UserWallet = append(c.hooks.UserWallet, hooks...)\n}", "func (c *SkillClient) Use(hooks ...Hook) {\n\tc.hooks.Skill = append(c.hooks.Skill, hooks...)\n}", "func (c *EmployeeClient) Use(hooks ...Hook) {\n\tc.hooks.Employee = append(c.hooks.Employee, hooks...)\n}", "func (c *EmployeeClient) Use(hooks ...Hook) {\n\tc.hooks.Employee = append(c.hooks.Employee, hooks...)\n}", "func (c *EmployeeClient) Use(hooks ...Hook) {\n\tc.hooks.Employee = append(c.hooks.Employee, hooks...)\n}", "func (c *UnitOfMedicineClient) Use(hooks ...Hook) {\n\tc.hooks.UnitOfMedicine = append(c.hooks.UnitOfMedicine, hooks...)\n}", "func (c *DoctorClient) Use(hooks ...Hook) {\n\tc.hooks.Doctor = append(c.hooks.Doctor, hooks...)\n}", "func (c *ClubTypeClient) Use(hooks ...Hook) {\n\tc.hooks.ClubType = append(c.hooks.ClubType, hooks...)\n}", "func (c *UnsavedPostClient) Use(hooks ...Hook) {\n\tc.hooks.UnsavedPost = append(c.hooks.UnsavedPost, hooks...)\n}", "func (c *Client) Use(hooks ...Hook) {\n\tc.Admin.Use(hooks...)\n\tc.AdminSession.Use(hooks...)\n\tc.Category.Use(hooks...)\n\tc.Post.Use(hooks...)\n\tc.PostAttachment.Use(hooks...)\n\tc.PostImage.Use(hooks...)\n\tc.PostThumbnail.Use(hooks...)\n\tc.PostVideo.Use(hooks...)\n\tc.UnsavedPost.Use(hooks...)\n\tc.UnsavedPostAttachment.Use(hooks...)\n\tc.UnsavedPostImage.Use(hooks...)\n\tc.UnsavedPostThumbnail.Use(hooks...)\n\tc.UnsavedPostVideo.Use(hooks...)\n}", "func (c *GenderClient) Use(hooks ...Hook) {\n\tc.hooks.Gender = append(c.hooks.Gender, hooks...)\n}", "func (c *GenderClient) Use(hooks ...Hook) {\n\tc.hooks.Gender = append(c.hooks.Gender, hooks...)\n}", "func (c *PatientClient) Use(hooks ...Hook) {\n\tc.hooks.Patient = append(c.hooks.Patient, hooks...)\n}", "func (c *PatientClient) Use(hooks ...Hook) {\n\tc.hooks.Patient = append(c.hooks.Patient, hooks...)\n}", "func (c *PatientClient) Use(hooks ...Hook) {\n\tc.hooks.Patient = append(c.hooks.Patient, hooks...)\n}", "func (c *MedicineTypeClient) Use(hooks ...Hook) {\n\tc.hooks.MedicineType = append(c.hooks.MedicineType, hooks...)\n}", "func (c *PositionInPharmacistClient) Use(hooks ...Hook) {\n\tc.hooks.PositionInPharmacist = append(c.hooks.PositionInPharmacist, hooks...)\n}", "func (c *DepositClient) Use(hooks ...Hook) {\n\tc.hooks.Deposit = append(c.hooks.Deposit, hooks...)\n}", "func (c *PledgeClient) Use(hooks ...Hook) {\n\tc.hooks.Pledge = append(c.hooks.Pledge, hooks...)\n}", "func (c *Client) Use(hooks ...Hook) {\n\tc.Eatinghistory.Use(hooks...)\n\tc.Foodmenu.Use(hooks...)\n\tc.Mealplan.Use(hooks...)\n\tc.Taste.Use(hooks...)\n\tc.User.Use(hooks...)\n}", "func (c *UsertypeClient) Use(hooks ...Hook) {\n\tc.hooks.Usertype = append(c.hooks.Usertype, hooks...)\n}", "func (c *DrugAllergyClient) Use(hooks ...Hook) {\n\tc.hooks.DrugAllergy = append(c.hooks.DrugAllergy, hooks...)\n}", "func (c *CategoryClient) Use(hooks ...Hook) {\n\tc.hooks.Category = append(c.hooks.Category, hooks...)\n}", "func (c *ComplaintTypeClient) Use(hooks ...Hook) {\n\tc.hooks.ComplaintType = append(c.hooks.ComplaintType, hooks...)\n}", "func (c *ActivityTypeClient) Use(hooks ...Hook) {\n\tc.hooks.ActivityType = append(c.hooks.ActivityType, hooks...)\n}", "func (c *OrderClient) Use(hooks ...Hook) {\n\tc.hooks.Order = append(c.hooks.Order, hooks...)\n}", "func (c *PrescriptionClient) Use(hooks ...Hook) {\n\tc.hooks.Prescription = append(c.hooks.Prescription, hooks...)\n}", "func (c *ClubapplicationClient) Use(hooks ...Hook) {\n\tc.hooks.Clubapplication = append(c.hooks.Clubapplication, hooks...)\n}", "func (c *JobpositionClient) Use(hooks ...Hook) {\n\tc.hooks.Jobposition = append(c.hooks.Jobposition, hooks...)\n}", "func (c *StaytypeClient) Use(hooks ...Hook) {\n\tc.hooks.Staytype = append(c.hooks.Staytype, hooks...)\n}", "func (c *PatientInfoClient) Use(hooks ...Hook) {\n\tc.hooks.PatientInfo = append(c.hooks.PatientInfo, hooks...)\n}", "func (c *AnnotationClient) Use(hooks ...Hook) {\n\tc.hooks.Annotation = append(c.hooks.Annotation, hooks...)\n}", "func (c *Client) Use(hooks ...Hook) {\n\tc.Dentist.Use(hooks...)\n\tc.Employee.Use(hooks...)\n\tc.Patient.Use(hooks...)\n\tc.Queue.Use(hooks...)\n}", "func (c *PartClient) Use(hooks ...Hook) {\n\tc.hooks.Part = append(c.hooks.Part, hooks...)\n}", "func (c *QueueClient) Use(hooks ...Hook) {\n\tc.hooks.Queue = append(c.hooks.Queue, hooks...)\n}", "func (c *PostVideoClient) Use(hooks ...Hook) {\n\tc.hooks.PostVideo = append(c.hooks.PostVideo, hooks...)\n}", "func (c *ActivitiesClient) Use(hooks ...Hook) {\n\tc.hooks.Activities = append(c.hooks.Activities, hooks...)\n}", "func (c *NurseClient) Use(hooks ...Hook) {\n\tc.hooks.Nurse = append(c.hooks.Nurse, hooks...)\n}" ]
[ "0.6919863", "0.689355", "0.6892372", "0.68692", "0.68240553", "0.68120575", "0.68120575", "0.67369294", "0.6729135", "0.67081755", "0.6671805", "0.66688955", "0.6667076", "0.6665632", "0.6654336", "0.6644849", "0.6636107", "0.6626534", "0.6625483", "0.66095775", "0.66095775", "0.6601786", "0.6598982", "0.65950847", "0.65878195", "0.6576779", "0.65761715", "0.6538054", "0.65358293", "0.6516228", "0.65156794", "0.6508446", "0.6508446", "0.6508446", "0.65064096", "0.64966285", "0.6493472", "0.648688", "0.64845484", "0.6476359", "0.6471529", "0.6469778", "0.64663845", "0.64663845", "0.64663845", "0.64578664", "0.6455922", "0.6445422", "0.64309347", "0.64309347", "0.64182556", "0.6414814", "0.6414814", "0.6414814", "0.6414814", "0.6414814", "0.6414814", "0.6414814", "0.6414814", "0.6414814", "0.6414814", "0.6414814", "0.64107275", "0.6405961", "0.6389754", "0.6389754", "0.6389754", "0.6384104", "0.6383244", "0.63821024", "0.63708454", "0.6365208", "0.63588357", "0.63588357", "0.6348597", "0.6348597", "0.6348597", "0.6340574", "0.6336416", "0.6313671", "0.6303215", "0.6301785", "0.62946683", "0.6292743", "0.62810516", "0.62459517", "0.62374705", "0.62313753", "0.622597", "0.6207658", "0.62048125", "0.6183212", "0.6182163", "0.6181898", "0.6179529", "0.61770266", "0.6173504", "0.61410576", "0.6135084", "0.6126482" ]
0.68847847
3
Create returns a create builder for Post.
func (c *PostClient) Create() *PostCreate { mutation := newPostMutation(c.config, OpCreate) return &PostCreate{config: c.config, hooks: c.Hooks(), mutation: mutation} }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (p *postController) Create(c *gin.Context) {\n\tvar post models.Post\n\tif err := c.Bind(&post); err != nil {\n\t\tc.AbortWithError(400, err)\n\t}\n\tif err := postResource.Create(&post); err != nil {\n\t\tc.AbortWithError(400, err)\n\t\treturn\n\t}\n\tc.JSON(201, post)\n}", "func (c *UnsavedPostClient) Create() *UnsavedPostCreate {\n\tmutation := newUnsavedPostMutation(c.config, OpCreate)\n\treturn &UnsavedPostCreate{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func New(ctx *sweetygo.Context) error {\n\ttitle := ctx.Param(\"title\")\n\tcat := ctx.Param(\"cat\")\n\thtml := ctx.Param(\"html\")\n\tmd := ctx.Param(\"md\")\n\tif title != \"\" && cat != \"\" && html != \"\" && md != \"\" {\n\t\terr := model.NewPost(title, cat, html, md)\n\t\tif err != nil {\n\t\t\treturn ctx.JSON(500, 0, \"create post error\", nil)\n\t\t}\n\t\treturn ctx.JSON(201, 1, \"success\", nil)\n\t}\n\treturn ctx.JSON(406, 0, \"I can't understand what u want\", nil)\n}", "func CreatePost(c buffalo.Context) error {\n\tauthUser := c.Value(\"authUser\").(models.User)\n\tpost := &models.Post{}\n\tif err := c.Bind(post); err != nil {\n\t\treturn errors.WithStack(err)\n\t}\n\tdb := c.Value(\"tx\").(*pop.Connection)\n\tpost.UserID = authUser.ID\n\tpost.User = &authUser\n\tvalidationErrors, err := db.Eager().ValidateAndCreate(post)\n\tif err != nil {\n\t\treturn errors.WithStack(err)\n\t}\n\n\tif validationErrors.HasAny() {\n\n\t\terrResponse := utils.NewValidationErrorResponse(\n\t\t\thttp.StatusUnprocessableEntity, validationErrors.Errors,\n\t\t)\n\t\treturn c.Render(http.StatusUnprocessableEntity, r.JSON(errResponse))\n\t}\n\n\tpostResponse := PostResponse{\n\t\tCode: fmt.Sprintf(\"%d\", http.StatusCreated),\n\t\tData: post,\n\t}\n\treturn c.Render(http.StatusCreated, r.JSON(postResponse))\n}", "func (env *Env) CreatePost(w http.ResponseWriter, r *http.Request) {\n\t// Grab the context to get the user\n\tctx := r.Context()\n\t// Clean everything\n\ts := bluemonday.UGCPolicy()\n\tuser := ctx.Value(contextUser).(*models.User)\n\ttitle := s.Sanitize(r.FormValue(\"title\"))\n\tslug := s.Sanitize(r.FormValue(\"slug\"))\n\tsubtitle := s.Sanitize(r.FormValue(\"subtitle\"))\n\tshort := s.Sanitize(r.FormValue(\"short\"))\n\tcontent := s.Sanitize(r.FormValue(\"content\"))\n\tdigest := s.Sanitize(r.FormValue(\"digest\"))\n\t// published must be parsed into a bool\n\tpublished, err := strconv.ParseBool(s.Sanitize(r.FormValue(\"published\")))\n\tif err != nil {\n\t\tenv.log(r, err)\n\t\tw.WriteHeader(http.StatusBadRequest)\n\t\treturn\n\t}\n\tp, err := env.DB.InsertPost(user.ID, title, slug, subtitle, short, content, digest, published)\n\tif err != nil {\n\t\tenv.log(r, err)\n\t\tw.WriteHeader(http.StatusInternalServerError)\n\t\treturn\n\t}\n\t// Send out created post\n\tw.Header().Set(\"Content-Type\", \"application/json\")\n\tw.WriteHeader(http.StatusOK)\n\tjson.NewEncoder(w).Encode(p)\n}", "func (pr postRepository) Create(p Post) error {\n\treturn pr.getCollection().Insert(p)\n}", "func CreatePost(w http.ResponseWriter, r *http.Request) {\n\tvar createPost CreatePostDto\n\tif err := json.NewDecoder(r.Body).Decode(&createPost); err != nil {\n\t\tresponse.Error(w, http.StatusBadGateway, err.Error())\n\t\treturn\n\t}\n\n\tvar post Posts\n\tpost.Title = createPost.Title\n\tpost.Description = createPost.Description\n\tpost.ImageURL = createPost.ImageURL\n\n\tuserID := gCtx.Get(r, \"uid\")\n\tpostID, err := post.Save(userID.(string))\n\tif err != nil {\n\t\tresponse.Error(w, http.StatusBadGateway, err.Error())\n\t\treturn\n\t}\n\tresponse.Success(w, r,\n\t\thttp.StatusCreated,\n\t\tmap[string]interface{}{\n\t\t\t\"id\": postID,\n\t\t},\n\t)\n\treturn\n}", "func NewPost(username string, imageURL string, thumbnailURL string, caption string, url string, messageBody string, mood MoodState, keywords []string, likers []string) *Post {\n\n\tauditableContent := AuditableContent{createdBy: username, createdTime: time.Now()}\n\n\treturn &Post{\n\t\tauditableContent: auditableContent,\n\t\tcaption: caption,\n\t\turl: url,\n\t\timageURL: imageURL,\n\t\tthumbnailURL: thumbnailURL,\n\t\tmessageBody: messageBody,\n\t\tauthorMood: mood,\n\t\tkeywords: keywords,\n\t\tlikers: likers,\n\t}\n}", "func (c *PostAttachmentClient) Create() *PostAttachmentCreate {\n\tmutation := newPostAttachmentMutation(c.config, OpCreate)\n\treturn &PostAttachmentCreate{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func NewPost() *Post {\n\treturn &Post{\n\t\tId: bson.NewObjectId(),\n\t\tCreatedAt: utils.Now(),\n\t}\n}", "func (u *App) Create(c echo.Context, req *Create) (*model.Post, error) {\n\tid, err := util.GenerateUUID()\n\tif err = zaplog.ZLog(err); err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar operator model.User\n\tif err = u.db.Model(&model.User{}).Where(\"uuid = ?\", req.Author).First(&operator).Error; err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar dupe model.Post\n\tif err = u.db.Model(&model.Post{}).Where(\"slug = ?\", req.Slug).Order(\"id DESC\").First(&dupe).Error; err == nil {\n\t\tfragment := strings.TrimPrefix(dupe.Slug, req.Slug)\n\t\tif fragment == \"\" {\n\t\t\treq.Slug += \"-2\"\n\t\t}\n\n\t\tcounter, err := strconv.Atoi(strings.TrimPrefix(fragment, \"-\"))\n\t\tif err != nil {\n\t\t\treq.Slug += \"-2\"\n\t\t} else {\n\t\t\treq.Slug += fmt.Sprintf(\"-%d\", counter+1)\n\t\t}\n\t}\n\n\tif len(req.Excerpt) > 255 {\n\t\treq.Excerpt = req.Excerpt[:250] + \"...\"\n\t}\n\n\tpost := model.Post{\n\t\tBase: model.Base{ID: id},\n\t\tAuthor: req.Author,\n\t\tAuthorName: operator.Name,\n\t\tCategory: req.Category,\n\t\tTags: req.Tags,\n\t\tTitle: req.Title,\n\t\tSlug: req.Slug,\n\t\tContent: req.Content,\n\t\tExcerpt: req.Excerpt,\n\t\tStatus: req.Status,\n\t}\n\treturn u.udb.Create(u.db, post)\n}", "func (b Build) Create(c *gin.Context) {\n\tpost := models.PostBuild{}\n\tc.BindJSON(&post)\n\n\tif !sugar.ValidateRequest(c, post) {\n\t\treturn\n\t}\n\t// Ensure that the project exists, and the user has permissions for it\n\tproject := models.Project{}\n\terr := Project{}.Query(c).First(&project, \"projects.id = ?\", post.ProjectID).Error\n\tif err != nil {\n\t\tsugar.NotFoundOrError(c, err)\n\t\treturn\n\t}\n\n\tnewBuild := models.Build{Project: project, Message: post.Message, Token: uniuri.NewLen(64)}\n\tif err := db.Create(&newBuild).Error; err != nil {\n\t\tsugar.InternalError(c, err)\n\t\treturn\n\t}\n\tsugar.EnqueueEvent(b.Events, c, \"Posted Build\", project.UserID, map[string]interface{}{\"build_id\": newBuild.ID, \"project_name\": newBuild.Project.Name})\n\tsugar.SuccessResponse(c, 201, newBuild)\n}", "func (s *MockStore) CreatePost(b Post) (p Post, err error) {\n\tp.Date = time.Now()\n\tp.ID = s.serial\n\ts.serial++\n\n\ts.mem[p.ID] = p\n\treturn p, err\n}", "func (c *UnsavedPostAttachmentClient) Create() *UnsavedPostAttachmentCreate {\n\tmutation := newUnsavedPostAttachmentMutation(c.config, OpCreate)\n\treturn &UnsavedPostAttachmentCreate{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func NewPost(username string, mood MoodState, caption string, MessageBody string, url string, imageURL string, thumbnailURI string, keywords []string) *Post {\n\n\tauditableContent := AuditableContent{CreatedBy: username, TimeCreated: time.Now()}\n\treturn &Post{Caption: caption, MessageBody: MessageBody, URL: url, ImageURI: imageURL, ThumbnailURI: thumbnailURI, AuthorMood: mood, Keywords: keywords, AuditableContent: auditableContent}\n}", "func (r postActions) CreateOne(\n\t_published postWithPrismaPublishedSetParams, _title postWithPrismaTitleSetParams, _author postWithPrismaAuthorSetParams,\n\toptional ...postSetParams,\n) postCreateOne {\n\tvar v postCreateOne\n\tv.query = builder.NewQuery()\n\tv.query.Client = r.client\n\n\tv.query.Operation = \"mutation\"\n\tv.query.Method = \"createOne\"\n\tv.query.Model = \"Post\"\n\tv.query.Outputs = postOutput\n\n\tvar fields []builder.Field\n\n\tfields = append(fields, _published.data)\n\tfields = append(fields, _title.data)\n\n\tfields = append(fields, _author.data)\n\n\tfor _, q := range optional {\n\t\tfields = append(fields, q.data)\n\t}\n\n\tv.query.Inputs = append(v.query.Inputs, builder.Input{\n\t\tName: \"data\",\n\t\tFields: fields,\n\t})\n\treturn v\n}", "func NewPost(username string, mood MoodState, caption string, messageBody string, url string, imageURI string, thumbnailURI string, keywords []string) *Post {\n\tauditableContent := AuditableContent{CreatedBy: username, TimeCreated: time.Now()}\n\treturn &Post{Caption: caption, MessageBody: messageBody, URL: url, ImageURI: imageURI, ThumbnailURI: thumbnailURI, AuthorMood: mood, Keywords: keywords, AuditableContent: auditableContent}\n}", "func (ps *PostStorage) Create(post socialnet.Post) (socialnet.Post, error) {\n\tps.posts = append(ps.posts, post)\n\treturn post, nil\n}", "func (broadcast *Broadcast) CreatePost(ctx context.Context, author, postID, title, content,\n\tparentAuthor, parentPostID, sourceAuthor, sourcePostID, redistributionSplitRate string,\n\tlinks map[string]string, privKeyHex string, seq int64) (*model.BroadcastResponse, error) {\n\tvar mLinks []model.IDToURLMapping\n\tif links == nil || len(links) == 0 {\n\t\tmLinks = nil\n\t} else {\n\t\tfor k, v := range links {\n\t\t\tmLinks = append(mLinks, model.IDToURLMapping{k, v})\n\t\t}\n\t}\n\n\tmsg := model.CreatePostMsg{\n\t\tAuthor: author,\n\t\tPostID: postID,\n\t\tTitle: title,\n\t\tContent: content,\n\t\tParentAuthor: parentAuthor,\n\t\tParentPostID: parentPostID,\n\t\tSourceAuthor: sourceAuthor,\n\t\tSourcePostID: sourcePostID,\n\t\tLinks: mLinks,\n\t\tRedistributionSplitRate: redistributionSplitRate,\n\t}\n\treturn broadcast.broadcastTransaction(ctx, msg, privKeyHex, seq, \"\", false)\n}", "func (c *PostImageClient) Create() *PostImageCreate {\n\tmutation := newPostImageMutation(c.config, OpCreate)\n\treturn &PostImageCreate{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c Client) Create(input *CreateEntityInput) (*CreateEntityResponse, error) {\n\treturn c.CreateWithContext(context.Background(), input)\n}", "func (s *BlugService) CreatePost(ctx context.Context, post *models.Post) (err error) {\n\tdefer func(begin time.Time) {\n\t\ts.Logger.Info(\n\t\t\t\"blug\",\n\t\t\tzap.String(\"method\", \"createpost\"),\n\t\t\tzap.Int(\"id\", post.ID),\n\t\t\tzap.NamedError(\"err\", err),\n\t\t\tzap.Duration(\"took\", time.Since(begin)),\n\t\t)\n\t}(time.Now())\n\n\tunsafe := blackfriday.Run(\n\t\t[]byte(post.Markdown),\n\t\tblackfriday.WithNoExtensions(),\n\t)\n\tpost.HTML = string(bluemonday.UGCPolicy().SanitizeBytes(unsafe))\n\n\terr = s.DB.CreatePost(post)\n\n\treturn err\n}", "func (h *Handler) CreatePost(w http.ResponseWriter, r *http.Request) {\n\n\tswitch r.Method {\n\n\tcase \"GET\":\n\t\tfmt.Println(\"get create post\")\n\tcase \"POST\":\n\t\t// uid, err := r.Cookie(\"user_id\")\n\t\t_, _, _, post, _, err := GetJsonData(w, r, \"post\")\n\t\tif err != nil {\n\t\t\thttp.Error(w, err.Error(), http.StatusBadRequest)\n\t\t\treturn\n\t\t}\n\t\tstatus, err := h.Services.Post.Create(post)\n\t\tif err != nil {\n\t\t\tJsonResponse(w, r, 400, models.Error{Err: err, Value: err.Error()})\n\t\t\treturn\n\t\t}\n\t\tJsonResponse(w, r, status, \"success\")\n\tdefault:\n\t\tJsonResponse(w, r, http.StatusBadRequest, \"Bad Request\")\n\t}\n}", "func NewPost(creator *ID, text string, attachment *string) (*Post, error) {\n\tp := &Post{\n\t\tID: NewID(),\n\t\tCreator: creator,\n\t\tText: text,\n\t\tAttachment: attachment,\n\t\tCreatedAt: time.Now(),\n\t}\n\terr := p.Validate()\n\tif err != nil {\n\t\treturn nil, ErrInvalidEntity\n\t}\n\treturn p, nil\n}", "func New(title string, path string, body string) *BlogPost {\n\treturn &BlogPost{Title: title,\n\t\tPath: path,\n\t\tBody: template.HTML(body),\n\t\tApproved: false,\n\t\tDeleted: false,\n\t\tPublished: false,\n\t\tCreatedDate: time.Now(),\n\t}\n}", "func (app *builder) Create() Builder {\n\treturn createBuilder(\n\t\tapp.hashAdapter,\n\t\tapp.pkAdapter,\n\t)\n}", "func (post *Post) Create() (err error) {\n\tstatement := \"insert into posts (content, author) values ($1, $2) returning id\"\n\t//Prepare creates a prepared statement for later queries or executions. Multiple queries or executions may be run concurrently from the returned statement. The caller must call the statement's Close method when the statement is no longer needed.\n\tstmt, err := Db.Prepare(statement)\n\tif err != nil {\n\t\treturn\n\t}\n\tdefer stmt.Close()\n\t//QueryRow executes a prepared query statement with the given arguments. If an error occurs during the execution of the statement, that error will be returned by a call to Scan on the returned *Row, which is always non-nil. If the query selects no rows, the *Row's Scan will return ErrNoRows. Otherwise, the *Row's Scan scans the first selected row and discards the rest.\n\t//Scan copies the columns from the matched row into the values pointed at by dest. See the documentation on Rows.Scan for details. If more than one row matches the query, Scan uses the first row and discards the rest. If no row matches the query, Scan returns ErrNoRows.\n\terr = stmt.QueryRow(post.Content, post.Author).Scan(&post.Id)\n\treturn\n}", "func CreatePostHandler(w http.ResponseWriter, r *http.Request) {\n\tif r.Method != http.MethodPost {\n\t\tw.Write([]byte(\"Only Post.\"))\n\t\treturn\n\t}\n\tvar post data.Post\n\terr := json.NewDecoder(r.Body).Decode(&post)\n\tif err != nil {\n\t\tfmt.Println(err.Error())\n\t\treturn\n\t}\n\tuser, err := auth.GetSignInUser(r)\n\tif err != nil {\n\t\tfmt.Println(err.Error())\n\t\treturn\n\t}\n\tpost.UserID = user.UserID\n\tif err != nil {\n\t\tfmt.Println(err)\n\t\treturn\n\t}\n\terr = post.Save()\n\tif err != nil {\n\t\tfmt.Println(err.Error())\n\t\treturn\n\t}\n\treturnMsg := fmt.Sprintf(\"Created Post(ID: %d)\", post.ID)\n\tw.Write([]byte(returnMsg))\n\treturn\n}", "func (a App) CreatePost(res http.ResponseWriter, req *http.Request, params httprouter.Params) {\n\terr := req.ParseForm()\n\tif err != nil {\n\t\thttp.Error(res, err.Error(), http.StatusInternalServerError)\n\t}\n\n\tp := Post{\n\t\tId: \"3\",\n\t\tTitle: req.PostFormValue(\"title\"),\n\t\tBody: req.PostFormValue(\"body\"),\n\t}\n\n\tposts = append(posts, p)\n\n\thttp.Redirect(res, req, \"/post/3\", http.StatusFound)\n}", "func (c *UnsavedPostImageClient) Create() *UnsavedPostImageCreate {\n\tmutation := newUnsavedPostImageMutation(c.config, OpCreate)\n\treturn &UnsavedPostImageCreate{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *BeerClient) Create() *BeerCreate {\n\tmutation := newBeerMutation(c.config, OpCreate)\n\treturn &BeerCreate{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (d *PostDataStore) CreatePost(p *model.Post) (err error) {\n\tif err = d.DBHandler.Create(p).Error; err != nil {\n\t\treturn\n\t}\n\treturn\n}", "func (c *BuildingClient) Create() *BuildingCreate {\n\tmutation := newBuildingMutation(c.config, OpCreate)\n\treturn &BuildingCreate{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (cmd *CreatePostCommand) Run(c *client.Client, args []string) error {\n\tvar path string\n\tif len(args) > 0 {\n\t\tpath = args[0]\n\t} else {\n\t\tpath = \"/posts\"\n\t}\n\tvar payload client.CreatePostPayload\n\tif cmd.Payload != \"\" {\n\t\terr := json.Unmarshal([]byte(cmd.Payload), &payload)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"failed to deserialize payload: %s\", err)\n\t\t}\n\t}\n\tlogger := goa.NewLogger(log.New(os.Stderr, \"\", log.LstdFlags))\n\tctx := goa.WithLogger(context.Background(), logger)\n\tresp, err := c.CreatePost(ctx, path, &payload)\n\tif err != nil {\n\t\tgoa.LogError(ctx, \"failed\", \"err\", err)\n\t\treturn err\n\t}\n\n\tgoaclient.HandleResponse(c.Client, resp, PrettyPrint)\n\treturn nil\n}", "func (c *PostVideoClient) Create() *PostVideoCreate {\n\tmutation := newPostVideoMutation(c.config, OpCreate)\n\treturn &PostVideoCreate{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *PostThumbnailClient) Create() *PostThumbnailCreate {\n\tmutation := newPostThumbnailMutation(c.config, OpCreate)\n\treturn &PostThumbnailCreate{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (repository Posts) Create(post models.Post) (uint64, error) {\n\tdbStatement, err := repository.db.Prepare(\n\t\t\"INSERT INTO posts (title, content, author_id) VALUES (?, ?, ?)\",\n\t)\n\tif err != nil {\n\t\treturn 0, err\n\t}\n\tdefer dbStatement.Close()\n\n\tdbExecution, err := dbStatement.Exec(\n\t\tpost.Title,\n\t\tpost.Content,\n\t\tpost.AuthorID,\n\t)\n\tif err != nil {\n\t\treturn 0, err\n\t}\n\n\tlastInsertedID, err := dbExecution.LastInsertId()\n\tif err != nil {\n\t\treturn 0, err\n\t}\n\n\treturn uint64(lastInsertedID), nil\n}", "func (app *contentBuilder) Create() ContentBuilder {\n\treturn createContentBuilder(app.hashAdapter, app.pubKeyAdapter)\n}", "func Create(c *gin.Context) {\n\ttodo := todo{Title: c.PostForm(\"title\"), Done: false}\n\tdb := Database()\n\tdb.Save(&todo)\n\tc.JSON(http.StatusCreated, gin.H{\n\t\t\"status\": http.StatusCreated,\n\t\t\"message\": \"Todo created\",\n\t\t\"todoid\": todo.ID,\n\t})\n}", "func (c *BedtypeClient) Create() *BedtypeCreate {\n\tmutation := newBedtypeMutation(c.config, OpCreate)\n\treturn &BedtypeCreate{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (s *postsService) CreatePost(ctx context.Context, authorID string, post *model.CreatePostRequest) (*model.PostResponse, error) {\n\tdbPost := translateCreatePostRequestToDBPost(authorID, post)\n\n\t// generate uuid\n\tdbPost.PostUUID = uuid.NewV4().String()\n\n\t// write post to db\n\terr := s.db.CreatePost(ctx, dbPost)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// get post from db to populate response\n\tdbPost, err = s.db.GetPost(ctx, authorID, dbPost.PostUUID)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tresponse := translateDBPostToPostResponse(dbPost)\n\n\treturn response, nil\n}", "func NewCreatePostRequestBody()(*CreatePostRequestBody) {\n m := &CreatePostRequestBody{\n }\n m.SetAdditionalData(make(map[string]interface{}));\n return m\n}", "func (ctl *NoteController) Create(c *gin.Context) {\n\t// binding\n\tvar form models.Note\n\tif err := c.ShouldBindJSON(&form); err != nil {\n\t\tc.JSON(http.StatusBadRequest, Error(err))\n\t\treturn\n\t}\n\n\t// insert\n\tif _, err := models.DB().Model(&form).Returning(\"*\").Insert(); err != nil {\n\t\tc.JSON(http.StatusInternalServerError, Error(err))\n\t\treturn\n\t}\n\tc.JSON(http.StatusOK, form)\n}", "func (c *Consumer) CreatePost(ctx context.Context, m gosqs.Message) error {\n\tvar p Post\n\tif err := m.Decode(&p); err != nil {\n\t\treturn err\n\t}\n\n\t// send a message to the same queue\n\tc.MessageSelf(ctx, \"some_new_message\", &p)\n\n\t//forward the message to another queue\n\tc.Message(ctx, \"notification-worker\", \"some_new_message\", &p)\n\n\treturn nil\n}", "func CreatePostHandler(w http.ResponseWriter, r *http.Request, params httprouter.Params) {\n\tresponse, err := restClient.Post(postsUrl, r, r.Header)\n\n\tif err != nil {\n\t\trestClient.WriteErrorResponse(w, \"server_error\", \"Server error occured\")\n\t\treturn\n\t}\n\n\tvar post Post\n\trestClient.WriteJSONResponse(w, response, post)\n}", "func (s *Service) Create(ctx context.Context, req *CreateRequest) (*CreateReply, error) {\n\tid, token, err := s.m.Create(ctx)\n\tif err != nil {\n\t\tlog.Errorf(\"creating instance: %s\", err)\n\t\treturn nil, err\n\t}\n\treturn &CreateReply{\n\t\tID: id.String(),\n\t\tToken: token,\n\t}, nil\n}", "func createPost(w http.ResponseWriter, r *http.Request) {\n\n\tsession := sessions.Start(w, r)\n\n\tuser_id := session.GetString(\"user_id\")\n\tcommunity_id := r.FormValue(\"community\")\n\tbody := r.FormValue(\"body\")\n\timage := r.FormValue(\"image\")\n\turl := r.FormValue(\"url\")\n\n\tif len(body) > 2000 {\n\t\thttp.Error(w, \"Your post is too long. (2000 characters maximum)\", http.StatusBadRequest)\n\t\treturn\n\t}\n\tif len(body) == 0 && len(image) == 0 {\n\t\thttp.Error(w, \"Your post is empty.\", http.StatusBadRequest)\n\t\treturn\n\t}\n\n\tstmt, err := db.Prepare(\"INSERT posts SET created_by=?, community_id=?, body=?, image=?, url=?\")\n\tif err == nil {\n\n\t\t// If there's no errors, we can go ahead and execute the statement.\n\t\t_, err := stmt.Exec(&user_id, &community_id, &body, &image, &url)\n\t\tif err != nil {\n\n\t\t\thttp.Error(w, err.Error(), http.StatusInternalServerError)\n\t\t\treturn\n\n\t\t}\n\n\t\tvar posts = post{}\n\t\tvar timestamp time.Time\n\n\t\tdb.QueryRow(\"SELECT posts.id, created_by, created_at, body, image, username, nickname, avatar FROM posts LEFT JOIN users ON users.id = created_by WHERE created_by = ? ORDER BY created_at DESC LIMIT 1\", user_id).\n\t\t\tScan(&posts.ID, &posts.CreatedBy, &timestamp, &posts.Body, &posts.Image, &posts.PosterUsername, &posts.PosterNickname, &posts.PosterIcon)\n\t\tposts.CreatedAt = humanTiming(timestamp)\n\n\t\tvar data = map[string]interface{}{\n\t\t\t// This is sent to the user who created the post so they can't yeah it.\n\t\t\t\"CanYeah\": false,\n\t\t\t\"Post\": posts,\n\t\t}\n\n\t\terr = templates.ExecuteTemplate(w, \"create_post.html\", data)\n\n\t\tif err != nil {\n\n\t\t\thttp.Error(w, err.Error(), http.StatusInternalServerError)\n\n\t\t}\n\n\t\tvar postTpl bytes.Buffer\n\n\t\t// This will be sent other users so they can yeah it.\n\t\tdata[\"CanYeah\"] = true\n\n\t\ttemplates.ExecuteTemplate(&postTpl, \"create_post.html\", data)\n\n\t\tvar msg wsMessage\n\n\t\tmsg.Type = \"post\"\n\t\tmsg.Content = postTpl.String()\n\n\t\tfor client := range clients {\n\t\t\tif clients[client].OnPage == \"/communities/\"+community_id && clients[client].UserID != strconv.Itoa(posts.CreatedBy) {\n\t\t\t\terr := client.WriteJSON(msg)\n\t\t\t\tif err != nil {\n\t\t\t\t\tfmt.Println(err)\n\t\t\t\t\tclient.Close()\n\t\t\t\t\tdelete(clients, client)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn\n\n\t}\n\n}", "func (c *todoController) Create(ctx *fiber.Ctx) error {\n\tb := new(CreateDTO)\n\n\tif err := utils.ParseBodyAndValidate(ctx, b); err != nil {\n\t\treturn err\n\t}\n\n\tuser := utils.GetUser(ctx)\n\ttodo, err := c.useCase.Create(b, user)\n\n\tif err != nil {\n\t\treturn fiber.NewError(fiber.StatusConflict, err.Error())\n\t}\n\n\treturn ctx.JSON(&TodoCreateResponse{\n\t\tTodo: &TodoResponse{\n\t\t\tID: todo.ID,\n\t\t\tTask: todo.Task,\n\t\t\tCompleted: todo.Completed,\n\t\t},\n\t})\n}", "func (app *contentBuilder) Create() ContentBuilder {\n\treturn createContentBuilder(app.hashAdapter)\n}", "func (c *ReviewClient) Create() *ReviewCreate {\n\tmutation := newReviewMutation(c.config, OpCreate)\n\treturn &ReviewCreate{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *PetClient) Create() *PetCreate {\n\tmutation := newPetMutation(c.config, OpCreate)\n\treturn &PetCreate{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func NewPost(w http.ResponseWriter, r *http.Request) {\n\n\tdb, err := sqlx.Connect(\"postgres\", connStr)\n\tif err != nil {\n\t\tfmt.Println(err)\n\t}\n\n\tw.Header().Set(\"Content-Type\", \"application/json\")\n\n\tvar post m.PostIn\n\t_ = json.NewDecoder(r.Body).Decode(&post)\n\n\tquery := `insert into posts(title, content)\n\t\t\t\t\t\t\t\t\t\t\t values(:title, :content)`\n\n\t_, err = db.NamedExec(query, post)\n\tif err != nil {\n\t\tfmt.Println(err)\n\t}\n}", "func (c *MealplanClient) Create() *MealplanCreate {\n\tmutation := newMealplanMutation(c.config, OpCreate)\n\treturn &MealplanCreate{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func Create() gin.HandlerFunc {\n\treturn func(c *gin.Context) {\n\t\trequestBody := productPostRequest{}\n\t\tc.Bind(&requestBody)\n\n\t\tproduct := model.Products{\n\t\t\tProductTypeID: requestBody.ProductTypeID,\n\t\t\tName: requestBody.Name,\n\t\t}\n\n\t\terr := db.Db.Create(&product)\n\n\t\tif product.ID == 0 {\n\t\t\tc.JSON(http.StatusBadRequest, err.Error)\n\t\t\treturn\n\t\t}\n\n\t\tc.JSON(http.StatusOK, product)\n\t}\n}", "func Create(client *gophercloud.ServiceClient, instanceID string, opts CreateOptsBuilder) (r CreateResult) {\n\tb, err := opts.ToDBCreateMap()\n\tif err != nil {\n\t\tr.Err = err\n\t\treturn\n\t}\n\tresp, err := client.Post(baseURL(client, instanceID), &b, nil, nil)\n\t_, r.Header, r.Err = gophercloud.ParseResponse(resp, err)\n\treturn\n}", "func (j *JDB) Create(w http.ResponseWriter, r *http.Request) {\n\tpath := mux.Vars(r)[\"host\"]\n\tcol := mux.Vars(r)[\"col\"]\n\tid := mux.Vars(r)[\"slug\"]\n\tdata := post.Post{}\n\terr := r.ParseForm()\n\tif err != nil {\n\t\t// Handle error\n\t}\n\tvar post post.Post\n\t// r.PostForm is a map of our POST form values\n\terr = decoder.Decode(&post, r.PostForm)\n\tif err != nil {\n\t\t// Handle error\n\t}\n\n\tif err := j.db.Write(path+\"/\"+col, id, data); err != nil {\n\t\tfmt.Println(\"Error\", err)\n\t}\n}", "func (rb *ByProjectKeyGraphqlRequestBuilder) Post(body GraphQLRequest) *ByProjectKeyGraphqlRequestMethodPost {\n\treturn &ByProjectKeyGraphqlRequestMethodPost{\n\t\tbody: body,\n\t\turl: fmt.Sprintf(\"/%s/graphql\", rb.projectKey),\n\t\tclient: rb.client,\n\t}\n}", "func (c *Client) Create(data *CreateParams) (*xendit.Disbursement, *xendit.Error) {\n\treturn c.CreateWithContext(context.Background(), data)\n}", "func (app *builder) Create() Builder {\n\treturn createBuilder(app.hashAdapter)\n}", "func (app *builder) Create() Builder {\n\treturn createBuilder(app.hashAdapter)\n}", "func (c *PharmacistClient) Create() *PharmacistCreate {\n\tmutation := newPharmacistMutation(c.config, OpCreate)\n\treturn &PharmacistCreate{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func CreatePost(images []types.FileMetadata, author types.User, p types.RawPost, headerImage types.FileMetadata) (interface{}, error) {\n\tif p.ShortURL == \"new\" {\n\t\treturn nil, errors.New(\"the title `new` is reserved\")\n\t}\n\n\tvar post types.Post\n\tdb := database.GetMySQLInstance()\n\tdefer db.Close()\n\n\terr := db.Where(\"shorturl LIKE ?\", p.ShortURL).First(&post).Error\n\tif err != gorm.ErrRecordNotFound {\n\t\treturn nil, errors.New(\"post with similar title already exists..be unique\")\n\t}\n\n\tif p.HeaderImageIndex == nil {\n\t\tp.HeaderImageIndex = &EmptyHeaderIndex\n\t}\n\n\tpost = types.Post{\n\t\tAuthor: &author,\n\t\tTitle: p.Title,\n\t\tShortURL: p.ShortURL,\n\t\tType: p.Type,\n\t\tAbstract: p.Abstract,\n\t\tContent: p.Content,\n\t\tPubDate: p.PubDate,\n\t\tTags: CleanTags(p.Tags),\n\t\tHeaderImageIndex: p.HeaderImageIndex,\n\t\tReadNext: []string{p.ReadNext},\n\t\tIPOwner: p.IPOwner,\n\t}\n\n\t// headerImage was seperated from other images in handler earlier so we can\n\t// process headerImage differently later\n\t// @todo: func resolveHeaderImage\n\n\tpost, err = resolveAttachments(images, post, *post.HeaderImageIndex, headerImage, true)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\terr = createPost(&post, db)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn post, nil\n}", "func (c *TasteClient) Create() *TasteCreate {\n\tmutation := newTasteMutation(c.config, OpCreate)\n\treturn &TasteCreate{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func New(fn string) (*Post, error) {\n\tb, err := ioutil.ReadFile(fn)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t//Check if document start with valid token\n\tif !bytes.HasPrefix(b, []byte(\"---\\n\")) {\n\t\treturn nil, errMissingFrontMatter\n\t}\n\tb = bytes.TrimPrefix(b, []byte(\"---\\n\"))\n\n\t//Split b to array, array[0] is front matter\n\t//array[1] is the rest of text (post's body)\n\tarr := bytes.SplitN(b, []byte(\"\\n---\\n\"), 2)\n\n\t//Generate meta from text\n\tm, err := newMeta(string(arr[0]))\n\n\t//Convert the rest of text to Markdown\n\tbody := blackfriday.MarkdownCommon(arr[1])\n\tp := &Post{\n\t\tm,\n\t\tslug.Make(m.Title),\n\t\ttemplate.HTML(body),\n\t}\n\treturn p, nil\n}", "func NewPost(path string) *Post {\n var err error\n var finfo os.FileInfo\n var file *os.File\n\n if finfo, err = os.Stat(path); err != nil {\n return nil\n }\n\n p := &Post{\n Path: path,\n Headers: make(map[string]string),\n Cdt: finfo.ModTime(),\n }\n\n if file, err = os.Open(path); err == nil {\n defer file.Close()\n p.Read(file)\n }\n\n return p\n}", "func (r Requester) Create(jsonPayload string) Requester {\n\treq, err := http.NewRequest(http.MethodPost, r.url, strings.NewReader(jsonPayload))\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\tr.httpRequest = req\n\n\treturn r\n}", "func (c *DentistClient) Create() *DentistCreate {\n\tmutation := newDentistMutation(c.config, OpCreate)\n\treturn &DentistCreate{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func Create(client *gophercloud.ServiceClient, opts CreateOptsBuilder) (r CreateResult) {\n\tb, err := opts.ToReceiverCreateMap()\n\tif err != nil {\n\t\tr.Err = err\n\t\treturn\n\t}\n\tresp, err := client.Post(createURL(client), b, &r.Body, &gophercloud.RequestOpts{\n\t\tOkCodes: []int{200, 201, 202},\n\t})\n\t_, r.Header, r.Err = gophercloud.ParseResponse(resp, err)\n\treturn\n}", "func Create(client *gophercloud.ServiceClient, opts CreateOptsBuilder) (r CreateResult) {\n\tb, err := opts.ToTrustCreateMap()\n\tif err != nil {\n\t\tr.Err = err\n\t\treturn\n\t}\n\tresp, err := client.Post(createURL(client), &b, &r.Body, &gophercloud.RequestOpts{\n\t\tOkCodes: []int{201},\n\t})\n\t_, r.Header, r.Err = gophercloud.ParseResponse(resp, err)\n\treturn\n}", "func (c PostCommentDetailController) Create(ctx *fasthttp.RequestCtx) {\n\tvar e []bool\n\tpostID, notExists := utils.ParseInt(phi.URLParam(ctx, \"postID\"), 10, 64)\n\te = append(e, notExists)\n\tcommentID, notExists := utils.ParseInt(phi.URLParam(ctx, \"commentID\"), 10, 64)\n\te = append(e, notExists)\n\n\tif exists, _ := utils.InArray(true, e); exists {\n\t\tc.JSONResponse(ctx, model2.ResponseError{\n\t\t\tDetail: fasthttp.StatusMessage(fasthttp.StatusBadRequest),\n\t\t}, fasthttp.StatusBadRequest)\n\t\treturn\n\t}\n\n\tcommentDetail := new(model.PostCommentDetail)\n\tc.JSONBody(ctx, &commentDetail)\n\tcommentDetail.PostID = postID\n\tcommentDetail.CommentID = commentID\n\n\tif errs, err := database.ValidateStruct(commentDetail); err != nil {\n\t\tc.JSONResponse(ctx, model2.ResponseError{\n\t\t\tErrors: errs,\n\t\t\tDetail: fasthttp.StatusMessage(fasthttp.StatusUnprocessableEntity),\n\t\t}, fasthttp.StatusUnprocessableEntity)\n\t\treturn\n\t}\n\n\tcommentDetail.Comment = c.App.TextPolicy.Sanitize(commentDetail.Comment)\n\n\terr := c.GetDB().Insert(new(model.PostCommentDetail), commentDetail, \"id\", \"inserted_at\")\n\tif errs, err := database.ValidateConstraint(err, commentDetail); err != nil {\n\t\tc.JSONResponse(ctx, model2.ResponseError{\n\t\t\tErrors: errs,\n\t\t\tDetail: fasthttp.StatusMessage(fasthttp.StatusUnprocessableEntity),\n\t\t}, fasthttp.StatusUnprocessableEntity)\n\t\treturn\n\t}\n\n\tc.JSONResponse(ctx, model2.ResponseSuccessOne{\n\t\tData: commentDetail,\n\t}, fasthttp.StatusCreated)\n}", "func (app *builder) Create() Builder {\n\treturn createBuilder(app.hashAdapter, app.immutableBuilder)\n}", "func Create(c *golangsdk.ServiceClient, opts CreateOptsBuilder) (r CreateResult) {\n\tb, err := opts.ToDomainCreateMap()\n\tif err != nil {\n\t\tr.Err = err\n\t\treturn\n\t}\n\treqOpt := &golangsdk.RequestOpts{OkCodes: []int{200}}\n\t_, r.Err = c.Post(rootURL(c), b, &r.Body, reqOpt)\n\treturn\n}", "func (a *PostsApiService) CreatePost(ctx context.Context, body GlipCreatePost) (GlipPostInfo, *http.Response, error) {\n\tvar (\n\t\tlocalVarHttpMethod = strings.ToUpper(\"Post\")\n\t\tlocalVarPostBody interface{}\n\t\tlocalVarFormFileName string\n\t\tlocalVarFileName string\n\t\tlocalVarFileBytes []byte\n\t\tlocalVarReturnValue GlipPostInfo\n\t)\n\n\t// create path and map variables\n\tlocalVarPath := a.client.cfg.BasePath + \"/restapi/v1.0/glip/posts\"\n\n\tlocalVarHeaderParams := make(map[string]string)\n\tlocalVarQueryParams := url.Values{}\n\tlocalVarFormParams := url.Values{}\n\n\t// to determine the Content-Type header\n\tlocalVarHttpContentTypes := []string{\"application/json\"}\n\n\t// set Content-Type header\n\tlocalVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes)\n\tif localVarHttpContentType != \"\" {\n\t\tlocalVarHeaderParams[\"Content-Type\"] = localVarHttpContentType\n\t}\n\n\t// to determine the Accept header\n\tlocalVarHttpHeaderAccepts := []string{\"application/json\"}\n\n\t// set Accept header\n\tlocalVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)\n\tif localVarHttpHeaderAccept != \"\" {\n\t\tlocalVarHeaderParams[\"Accept\"] = localVarHttpHeaderAccept\n\t}\n\t// body params\n\tlocalVarPostBody = &body\n\tr, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)\n\tif err != nil {\n\t\treturn localVarReturnValue, nil, err\n\t}\n\n\tlocalVarHttpResponse, err := a.client.callAPI(r)\n\tif err != nil || localVarHttpResponse == nil {\n\t\treturn localVarReturnValue, localVarHttpResponse, err\n\t}\n\n\tlocalVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body)\n\tlocalVarHttpResponse.Body.Close()\n\tif err != nil {\n\t\treturn localVarReturnValue, localVarHttpResponse, err\n\t}\n\n\tif localVarHttpResponse.StatusCode >= 300 {\n\t\tnewErr := GenericOpenAPIError{\n\t\t\tbody: localVarBody,\n\t\t\terror: localVarHttpResponse.Status,\n\t\t}\n\t\tif localVarHttpResponse.StatusCode == 200 {\n\t\t\tvar v GlipPostInfo\n\t\t\terr = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get(\"Content-Type\"))\n\t\t\tif err != nil {\n\t\t\t\tnewErr.error = err.Error()\n\t\t\t\treturn localVarReturnValue, localVarHttpResponse, newErr\n\t\t\t}\n\t\t\tnewErr.model = v\n\t\t\treturn localVarReturnValue, localVarHttpResponse, newErr\n\t\t}\n\t\treturn localVarReturnValue, localVarHttpResponse, newErr\n\t}\n\n\terr = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get(\"Content-Type\"))\n\tif err != nil {\n\t\tnewErr := GenericOpenAPIError{\n\t\t\tbody: localVarBody,\n\t\t\terror: err.Error(),\n\t\t}\n\t\treturn localVarReturnValue, localVarHttpResponse, newErr\n\t}\n\n\treturn localVarReturnValue, localVarHttpResponse, nil\n}", "func (handler *Handler) handlePostCreate(w http.ResponseWriter, r *http.Request) {\n\tvar postDTO models.PostDTO\n\tif err := json.NewDecoder(r.Body).Decode(&postDTO); err != nil {\n\t\tresponses.ERROR(w, http.StatusUnprocessableEntity, err)\n\t\treturn\n\t}\n\tpost := models.DTOToPost(postDTO)\n\n\tuid, err := auth.ExtractTokenID(r)\n\tif err != nil {\n\t\tresponses.ERROR(w, http.StatusUnauthorized, errors.New(\"unauthorized\"))\n\t\treturn\n\t}\n\n\tpost.AuthorID = &uid\n\n\tdb := repository.NewPostRepository(handler.DB)\n\n\tif err := db.Save(&post); err != nil {\n\t\tresponses.ERROR(w, http.StatusInternalServerError, err)\n\t\treturn\n\t}\n\n\tresponses.JSON(w, http.StatusCreated, post)\n}", "func (c *QueueClient) Create() *QueueCreate {\n\tmutation := newQueueMutation(c.config, OpCreate)\n\treturn &QueueCreate{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func Create(client *gophercloud.ServiceClient, opts CreateOptsBuilder) (r CreateResult) {\n\tb, err := opts.ToContainerCreateMap()\n\tif err != nil {\n\t\tr.Err = err\n\t\treturn\n\t}\n\tresp, err := client.Post(createURL(client), &b, &r.Body, &gophercloud.RequestOpts{\n\t\tOkCodes: []int{201},\n\t})\n\t_, r.Header, r.Err = gophercloud.ParseResponse(resp, err)\n\treturn\n}", "func (c *PetruleClient) Create() *PetruleCreate {\n\tmutation := newPetruleMutation(c.config, OpCreate)\n\treturn &PetruleCreate{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func Create(c *gin.Context) {\n\tvar r CreateRequest\n\tif err := c.BindJSON(&r); err != nil {\n\t\tlog.Println(\"CreateBook BindJSON\", err)\n\t\tc.JSON(\n\t\t\thttp.StatusBadRequest,\n\t\t\tgin.H{\"error\": \"fail to create book\"},\n\t\t)\n\t\treturn\n\t}\n\tb := newBook(r)\n\tdb.Save(b)\n\tc.JSON(http.StatusCreated, gin.H{\"data\": b})\n}", "func (c *BillClient) Create() *BillCreate {\n\tmutation := newBillMutation(c.config, OpCreate)\n\treturn &BillCreate{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *BillClient) Create() *BillCreate {\n\tmutation := newBillMutation(c.config, OpCreate)\n\treturn &BillCreate{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *BillClient) Create() *BillCreate {\n\tmutation := newBillMutation(c.config, OpCreate)\n\treturn &BillCreate{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (h *userHandler) CreatePost(w http.ResponseWriter, r *http.Request) {\r\n\tvar u post\r\n\tif err := json.NewDecoder(r.Body).Decode(&u); err != nil {\r\n\t\tinternalServerError(w, r)\r\n\t\treturn\r\n\t}\r\n\th.store.Lock()\r\n\th.store.m[u.ID] = u\r\n\th.store.Unlock()\r\n\tjsonBytes, err := json.Marshal(u)\r\n\tif err != nil {\r\n\t\tinternalServerError(w, r)\r\n\t\treturn\r\n\t}\r\n\tw.WriteHeader(http.StatusOK)\r\n\tw.Write(jsonBytes)\r\n}", "func (c *postsClient) CreatePost(ctx context.Context, authorUUID string, post *model.CreatePostRequest) (*model.PostResponse, error) {\n\turl := c.serviceURI + v1API + fmt.Sprintf(\"/authors/%s/posts\", authorUUID)\n\n\treq, err := formatJSONRequest(http.MethodPost, url, post)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tres := &model.PostResponse{}\n\t_, err = executeRequest(c.web, req, res)\n\treturn res, err\n}", "func (app *builder) Create() Builder {\n\treturn createBuilder(app.eventsAdapter)\n}", "func CreatePost(req *http.Request, s sessions.Session, res render.Render, post Post) {\n\tpost, err := post.Insert(s)\n\tif err != nil {\n\t\tlog.Println(err)\n\t\tres.JSON(500, map[string]interface{}{\"error\": \"Internal server error\"})\n\t\treturn\n\t}\n\tswitch Root(req) {\n\tcase \"api\":\n\t\tres.JSON(200, post)\n\t\treturn\n\tcase \"post\":\n\t\tres.Redirect(\"/user\", 302)\n\t\treturn\n\t}\n}", "func (c *Client) Post() *Request {\n\treturn NewRequest(c.httpClient, c.base, \"POST\", c.version, c.authstring, c.userAgent)\n}", "func (c *DepositClient) Create() *DepositCreate {\n\tmutation := newDepositMutation(c.config, OpCreate)\n\treturn &DepositCreate{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (app *builder) Create() Builder {\n\treturn createBuilder()\n}", "func (app *builder) Create() Builder {\n\treturn createBuilder()\n}", "func (c *MedicineClient) Create() *MedicineCreate {\n\tmutation := newMedicineMutation(c.config, OpCreate)\n\treturn &MedicineCreate{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (app *builder) Create() Builder {\n\treturn createBuilder(app.immutableBuilder)\n}", "func (app *builder) Create() Builder {\n\treturn createBuilder(app.immutableBuilder)\n}", "func (c *CategoryClient) Create() *CategoryCreate {\n\tmutation := newCategoryMutation(c.config, OpCreate)\n\treturn &CategoryCreate{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *UnsavedPostVideoClient) Create() *UnsavedPostVideoCreate {\n\tmutation := newUnsavedPostVideoMutation(c.config, OpCreate)\n\treturn &UnsavedPostVideoCreate{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *UnsavedPostThumbnailClient) Create() *UnsavedPostThumbnailCreate {\n\tmutation := newUnsavedPostThumbnailMutation(c.config, OpCreate)\n\treturn &UnsavedPostThumbnailCreate{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (app *builder) Create() Builder {\n\treturn createBuilder(app.hashAdapter, app.minPubKeysInOwner)\n}", "func (c *PaymentClient) Create() *PaymentCreate {\n\tmutation := newPaymentMutation(c.config, OpCreate)\n\treturn &PaymentCreate{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *PaymentClient) Create() *PaymentCreate {\n\tmutation := newPaymentMutation(c.config, OpCreate)\n\treturn &PaymentCreate{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func Create(client *gophercloud.ServiceClient, opts CreateOptsBuilder) (r CreateResult) {\n\tb, err := opts.ToOrderCreateMap()\n\tif err != nil {\n\t\tr.Err = err\n\t\treturn\n\t}\n\tresp, err := client.Post(createURL(client), &b, &r.Body, &gophercloud.RequestOpts{\n\t\tOkCodes: []int{202},\n\t})\n\t_, r.Header, r.Err = gophercloud.ParseResponse(resp, err)\n\treturn\n}", "func Create(client *gophercloud.ServiceClient, opts CreateOptsBuilder) (r CreateResult) {\n\tb, err := opts.ToPolicyCreateMap()\n\tif err != nil {\n\t\tr.Err = err\n\t\treturn\n\t}\n\tresp, err := client.Post(createURL(client), b, &r.Body, &gophercloud.RequestOpts{\n\t\tOkCodes: []int{201},\n\t})\n\t_, r.Header, r.Err = gophercloud.ParseResponse(resp, err)\n\treturn\n}" ]
[ "0.6720405", "0.6619986", "0.64997834", "0.6293827", "0.62149775", "0.6194788", "0.6027724", "0.599829", "0.59772164", "0.59412843", "0.59148985", "0.58727497", "0.583878", "0.57501835", "0.57465166", "0.57183933", "0.5711843", "0.5705598", "0.5703684", "0.5700064", "0.5675022", "0.56738704", "0.5664721", "0.5659217", "0.5613535", "0.56132185", "0.558828", "0.5586915", "0.5573265", "0.55559474", "0.5555661", "0.55521303", "0.5543285", "0.552154", "0.55041", "0.55009127", "0.5495491", "0.54692125", "0.54603916", "0.54467446", "0.5446413", "0.54278636", "0.5414136", "0.5404693", "0.5381543", "0.53815204", "0.5371105", "0.5370742", "0.5356214", "0.53543615", "0.5349802", "0.5348919", "0.53426313", "0.5329521", "0.5326459", "0.5316125", "0.5312826", "0.53109187", "0.53069854", "0.53069854", "0.53039986", "0.5298403", "0.52980614", "0.5296385", "0.5294827", "0.5294038", "0.5286754", "0.5285127", "0.5281714", "0.52752584", "0.5274948", "0.52669054", "0.5260641", "0.5251684", "0.5239119", "0.52314705", "0.52306336", "0.5228594", "0.52280945", "0.52280945", "0.52280945", "0.5225962", "0.5221594", "0.521915", "0.5217516", "0.52128035", "0.5210625", "0.5204155", "0.5204155", "0.519516", "0.5190011", "0.5190011", "0.51875716", "0.518433", "0.51795435", "0.5176769", "0.5176361", "0.5176361", "0.51743114", "0.516839" ]
0.70469636
0
CreateBulk returns a builder for creating a bulk of Post entities.
func (c *PostClient) CreateBulk(builders ...*PostCreate) *PostCreateBulk { return &PostCreateBulk{config: c.config, builders: builders} }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (c *UnsavedPostClient) CreateBulk(builders ...*UnsavedPostCreate) *UnsavedPostCreateBulk {\n\treturn &UnsavedPostCreateBulk{config: c.config, builders: builders}\n}", "func (c *UnsavedPostAttachmentClient) CreateBulk(builders ...*UnsavedPostAttachmentCreate) *UnsavedPostAttachmentCreateBulk {\n\treturn &UnsavedPostAttachmentCreateBulk{config: c.config, builders: builders}\n}", "func (c *PostAttachmentClient) CreateBulk(builders ...*PostAttachmentCreate) *PostAttachmentCreateBulk {\n\treturn &PostAttachmentCreateBulk{config: c.config, builders: builders}\n}", "func (c *DNSBLQueryClient) CreateBulk(builders ...*DNSBLQueryCreate) *DNSBLQueryCreateBulk {\n\treturn &DNSBLQueryCreateBulk{config: c.config, builders: builders}\n}", "func (c *UnsavedPostImageClient) CreateBulk(builders ...*UnsavedPostImageCreate) *UnsavedPostImageCreateBulk {\n\treturn &UnsavedPostImageCreateBulk{config: c.config, builders: builders}\n}", "func (c *TagClient) CreateBulk(builders ...*TagCreate) *TagCreateBulk {\n\treturn &TagCreateBulk{config: c.config, builders: builders}\n}", "func (c *PetClient) CreateBulk(builders ...*PetCreate) *PetCreateBulk {\n\treturn &PetCreateBulk{config: c.config, builders: builders}\n}", "func (c *PostImageClient) CreateBulk(builders ...*PostImageCreate) *PostImageCreateBulk {\n\treturn &PostImageCreateBulk{config: c.config, builders: builders}\n}", "func (c *TransactionClient) CreateBulk(builders ...*TransactionCreate) *TransactionCreateBulk {\n\treturn &TransactionCreateBulk{config: c.config, builders: builders}\n}", "func (c *BeerClient) CreateBulk(builders ...*BeerCreate) *BeerCreateBulk {\n\treturn &BeerCreateBulk{config: c.config, builders: builders}\n}", "func (c *UnsavedPostThumbnailClient) CreateBulk(builders ...*UnsavedPostThumbnailCreate) *UnsavedPostThumbnailCreateBulk {\n\treturn &UnsavedPostThumbnailCreateBulk{config: c.config, builders: builders}\n}", "func (c *OperationClient) CreateBulk(builders ...*OperationCreate) *OperationCreateBulk {\n\treturn &OperationCreateBulk{config: c.config, builders: builders}\n}", "func (c *WorkExperienceClient) CreateBulk(builders ...*WorkExperienceCreate) *WorkExperienceCreateBulk {\n\treturn &WorkExperienceCreateBulk{config: c.config, builders: builders}\n}", "func (c *PostThumbnailClient) CreateBulk(builders ...*PostThumbnailCreate) *PostThumbnailCreateBulk {\n\treturn &PostThumbnailCreateBulk{config: c.config, builders: builders}\n}", "func (c *CategoryClient) CreateBulk(builders ...*CategoryCreate) *CategoryCreateBulk {\n\treturn &CategoryCreateBulk{config: c.config, builders: builders}\n}", "func (c *CompanyClient) CreateBulk(builders ...*CompanyCreate) *CompanyCreateBulk {\n\treturn &CompanyCreateBulk{config: c.config, builders: builders}\n}", "func (c *IPClient) CreateBulk(builders ...*IPCreate) *IPCreateBulk {\n\treturn &IPCreateBulk{config: c.config, builders: builders}\n}", "func (c *AdminClient) CreateBulk(builders ...*AdminCreate) *AdminCreateBulk {\n\treturn &AdminCreateBulk{config: c.config, builders: builders}\n}", "func (c *EmptyClient) CreateBulk(builders ...*EmptyCreate) *EmptyCreateBulk {\n\treturn &EmptyCreateBulk{config: c.config, builders: builders}\n}", "func (c *VeterinarianClient) CreateBulk(builders ...*VeterinarianCreate) *VeterinarianCreateBulk {\n\treturn &VeterinarianCreateBulk{config: c.config, builders: builders}\n}", "func (c *ReviewClient) CreateBulk(builders ...*ReviewCreate) *ReviewCreateBulk {\n\treturn &ReviewCreateBulk{config: c.config, builders: builders}\n}", "func (c *JobClient) CreateBulk(builders ...*JobCreate) *JobCreateBulk {\n\treturn &JobCreateBulk{config: c.config, builders: builders}\n}", "func (c *PostVideoClient) CreateBulk(builders ...*PostVideoCreate) *PostVideoCreateBulk {\n\treturn &PostVideoCreateBulk{config: c.config, builders: builders}\n}", "func (c *BinaryFileClient) CreateBulk(builders ...*BinaryFileCreate) *BinaryFileCreateBulk {\n\treturn &BinaryFileCreateBulk{config: c.config, builders: builders}\n}", "func (c *SkillClient) CreateBulk(builders ...*SkillCreate) *SkillCreateBulk {\n\treturn &SkillCreateBulk{config: c.config, builders: builders}\n}", "func (c *UnsavedPostVideoClient) CreateBulk(builders ...*UnsavedPostVideoCreate) *UnsavedPostVideoCreateBulk {\n\treturn &UnsavedPostVideoCreateBulk{config: c.config, builders: builders}\n}", "func (c *AppointmentClient) CreateBulk(builders ...*AppointmentCreate) *AppointmentCreateBulk {\n\treturn &AppointmentCreateBulk{config: c.config, builders: builders}\n}", "func (c *WalletNodeClient) CreateBulk(builders ...*WalletNodeCreate) *WalletNodeCreateBulk {\n\treturn &WalletNodeCreateBulk{config: c.config, builders: builders}\n}", "func (c *CardClient) CreateBulk(builders ...*CardCreate) *CardCreateBulk {\n\treturn &CardCreateBulk{config: c.config, builders: builders}\n}", "func (c *CustomerClient) CreateBulk(builders ...*CustomerCreate) *CustomerCreateBulk {\n\treturn &CustomerCreateBulk{config: c.config, builders: builders}\n}", "func (c *UserClient) CreateBulk(builders ...*UserCreate) *UserCreateBulk {\n\treturn &UserCreateBulk{config: c.config, builders: builders}\n}", "func (c *UserClient) CreateBulk(builders ...*UserCreate) *UserCreateBulk {\n\treturn &UserCreateBulk{config: c.config, builders: builders}\n}", "func (c *UserClient) CreateBulk(builders ...*UserCreate) *UserCreateBulk {\n\treturn &UserCreateBulk{config: c.config, builders: builders}\n}", "func (c *UserClient) CreateBulk(builders ...*UserCreate) *UserCreateBulk {\n\treturn &UserCreateBulk{config: c.config, builders: builders}\n}", "func (c *UserClient) CreateBulk(builders ...*UserCreate) *UserCreateBulk {\n\treturn &UserCreateBulk{config: c.config, builders: builders}\n}", "func (c *UserWalletClient) CreateBulk(builders ...*UserWalletCreate) *UserWalletCreateBulk {\n\treturn &UserWalletCreateBulk{config: c.config, builders: builders}\n}", "func (c *EventClient) CreateBulk(builders ...*EventCreate) *EventCreateBulk {\n\treturn &EventCreateBulk{config: c.config, builders: builders}\n}", "func (c *DNSBLResponseClient) CreateBulk(builders ...*DNSBLResponseCreate) *DNSBLResponseCreateBulk {\n\treturn &DNSBLResponseCreateBulk{config: c.config, builders: builders}\n}", "func (c *ClinicClient) CreateBulk(builders ...*ClinicCreate) *ClinicCreateBulk {\n\treturn &ClinicCreateBulk{config: c.config, builders: builders}\n}", "func (c *UserCardClient) CreateBulk(builders ...*UserCardCreate) *UserCardCreateBulk {\n\treturn &UserCardCreateBulk{config: c.config, builders: builders}\n}", "func (c *MediaClient) CreateBulk(builders ...*MediaCreate) *MediaCreateBulk {\n\treturn &MediaCreateBulk{config: c.config, builders: builders}\n}", "func (c *CardScanClient) CreateBulk(builders ...*CardScanCreate) *CardScanCreateBulk {\n\treturn &CardScanCreateBulk{config: c.config, builders: builders}\n}", "func (c *KeyStoreClient) CreateBulk(builders ...*KeyStoreCreate) *KeyStoreCreateBulk {\n\treturn &KeyStoreCreateBulk{config: c.config, builders: builders}\n}", "func (c *CoinInfoClient) CreateBulk(builders ...*CoinInfoCreate) *CoinInfoCreateBulk {\n\treturn &CoinInfoCreateBulk{config: c.config, builders: builders}\n}", "func (c *PlaylistClient) CreateBulk(builders ...*PlaylistCreate) *PlaylistCreateBulk {\n\treturn &PlaylistCreateBulk{config: c.config, builders: builders}\n}", "func (a *DefaultApiService) BulkCreate(ctx _context.Context) ApiBulkCreateRequest {\n\treturn ApiBulkCreateRequest{\n\t\tApiService: a,\n\t\tctx: ctx,\n\t}\n}", "func (m *Manager) BulkCreate(obj interface{}) error {\n\treturn m.Query(m.Insert().Values(obj).Returning(), obj)\n}", "func (c *AdminSessionClient) CreateBulk(builders ...*AdminSessionCreate) *AdminSessionCreateBulk {\n\treturn &AdminSessionCreateBulk{config: c.config, builders: builders}\n}", "func (s *CampaignNegativeKeywordService) CreateBulk(ctx context.Context, campaignID int64, data []*NegativeKeyword) ([]*NegativeKeyword, *Response, error) {\n\tif campaignID == 0 {\n\t\treturn nil, nil, fmt.Errorf(\"campaignID can not be 0\")\n\t}\n\tu := fmt.Sprintf(\"campaigns/%d/negativekeywords/bulk\", campaignID)\n\treq, err := s.client.NewRequest(\"POST\", u, data)\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\tnegativekeywords := []*NegativeKeyword{}\n\tresp, err := s.client.Do(ctx, req, &negativekeywords)\n\tif err != nil {\n\t\treturn nil, resp, err\n\t}\n\treturn negativekeywords, resp, nil\n}", "func (s *AdGroupNegativeKeywordService) CreateBulk(ctx context.Context, campaignID int64, adGroupID int64, data []*NegativeKeyword) ([]*NegativeKeyword, *Response, error) {\n\tif campaignID == 0 {\n\t\treturn nil, nil, fmt.Errorf(\"campaignID can not be 0\")\n\t}\n\tif adGroupID == 0 {\n\t\treturn nil, nil, fmt.Errorf(\"adGroupID can not be 0\")\n\t}\n\tu := fmt.Sprintf(\"campaigns/%d/adgroups/%d/negativekeywords/bulk\", campaignID, adGroupID)\n\treq, err := s.client.NewRequest(\"POST\", u, data)\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\tnegativekeywords := []*NegativeKeyword{}\n\tresp, err := s.client.Do(ctx, req, &negativekeywords)\n\tif err != nil {\n\t\treturn nil, resp, err\n\t}\n\n\treturn negativekeywords, resp, nil\n}", "func (m *MessagesController) CreateBulk(ctx *gin.Context) {\n\tmessagesIn := &tat.MessagesJSONIn{}\n\tctx.Bind(messagesIn)\n\tvar msgs []*tat.MessageJSONOut\n\tfor _, messageIn := range messagesIn.Messages {\n\t\tm, code, err := m.createSingle(ctx, messageIn)\n\t\tif err != nil {\n\t\t\tctx.JSON(code, gin.H{\"error\": err.Error()})\n\t\t\treturn\n\t\t}\n\t\tmsgs = append(msgs, m)\n\t}\n\tctx.JSON(http.StatusCreated, msgs)\n}", "func (r *AssetRepository) CreateBulk(assets []assetEntity.Asset) (int, error) {\n\terr := r.restore()\n\tif err != nil {\n\t\treturn 0, err\n\t}\n\n\tn, err := r.repository.CreateBulk(assets)\n\tif err != nil {\n\t\treturn n, fmt.Errorf(\"assets bulk create failed: %w\", err)\n\t}\n\terr = r.dump()\n\treturn n, err\n}", "func (a *BulkApiService) CreateBulkExport(ctx context.Context) ApiCreateBulkExportRequest {\n\treturn ApiCreateBulkExportRequest{\n\t\tApiService: a,\n\t\tctx: ctx,\n\t}\n}", "func (client *Client) CreateBulkTransaction(txn []*CreateTransaction) (_ *Response, err error) {\n\tpath := \"/transaction_bulk\"\n\turi := fmt.Sprintf(\"%s%s\", client.apiBaseURL, path)\n\n\tif len(txn) > MaxBulkPutSize {\n\t\treturn nil, ErrMaxBulkSizeExceeded\n\t}\n\n\ttxnBytes, err := json.Marshal(txn)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treq, err := http.NewRequest(http.MethodPost, uri, bytes.NewBuffer(txnBytes))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tresp, err := client.performRequest(req, string(txnBytes))\n\treturn resp, err\n}", "func (a *BulkApiService) CreateBulkRequest(ctx context.Context) ApiCreateBulkRequestRequest {\n\treturn ApiCreateBulkRequestRequest{\n\t\tApiService: a,\n\t\tctx: ctx,\n\t}\n}", "func NewBulk(data []byte) *EncodeData {\n\tans := &EncodeData{}\n\tans.Type = TypeBulk\n\tans.Value = data\n\treturn ans\n}", "func (a *BulkApiService) CreateBulkMoCloner(ctx context.Context) ApiCreateBulkMoClonerRequest {\n\treturn ApiCreateBulkMoClonerRequest{\n\t\tApiService: a,\n\t\tctx: ctx,\n\t}\n}", "func (bcb *BulkCreateBulk) Save(ctx context.Context) ([]*Bulk, error) {\n\tspecs := make([]*sqlgraph.CreateSpec, len(bcb.builders))\n\tnodes := make([]*Bulk, len(bcb.builders))\n\tmutators := make([]Mutator, len(bcb.builders))\n\tfor i := range bcb.builders {\n\t\tfunc(i int, root context.Context) {\n\t\t\tbuilder := bcb.builders[i]\n\t\t\tvar mut Mutator = MutateFunc(func(ctx context.Context, m Mutation) (Value, error) {\n\t\t\t\tmutation, ok := m.(*BulkMutation)\n\t\t\t\tif !ok {\n\t\t\t\t\treturn nil, fmt.Errorf(\"unexpected mutation type %T\", m)\n\t\t\t\t}\n\t\t\t\tif err := builder.check(); err != nil {\n\t\t\t\t\treturn nil, err\n\t\t\t\t}\n\t\t\t\tbuilder.mutation = mutation\n\t\t\t\tnodes[i], specs[i] = builder.createSpec()\n\t\t\t\tvar err error\n\t\t\t\tif i < len(mutators)-1 {\n\t\t\t\t\t_, err = mutators[i+1].Mutate(root, bcb.builders[i+1].mutation)\n\t\t\t\t} else {\n\t\t\t\t\t// Invoke the actual operation on the latest mutation in the chain.\n\t\t\t\t\tif err = sqlgraph.BatchCreate(ctx, bcb.driver, &sqlgraph.BatchCreateSpec{Nodes: specs}); err != nil {\n\t\t\t\t\t\tif cerr, ok := isSQLConstraintError(err); ok {\n\t\t\t\t\t\t\terr = cerr\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tmutation.done = true\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn nil, err\n\t\t\t\t}\n\t\t\t\tif nodes[i].ID == 0 {\n\t\t\t\t\tid := specs[i].ID.Value.(int64)\n\t\t\t\t\tnodes[i].ID = int(id)\n\t\t\t\t}\n\t\t\t\treturn nodes[i], nil\n\t\t\t})\n\t\t\tfor i := len(builder.hooks) - 1; i >= 0; i-- {\n\t\t\t\tmut = builder.hooks[i](mut)\n\t\t\t}\n\t\t\tmutators[i] = mut\n\t\t}(i, ctx)\n\t}\n\tif len(mutators) > 0 {\n\t\tif _, err := mutators[0].Mutate(ctx, bcb.builders[0].mutation); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\treturn nodes, nil\n}", "func (a *BulkApiService) CreateBulkMoDeepCloner(ctx context.Context) ApiCreateBulkMoDeepClonerRequest {\n\treturn ApiCreateBulkMoDeepClonerRequest{\n\t\tApiService: a,\n\t\tctx: ctx,\n\t}\n}", "func (a *BulkApiService) CreateBulkMoMerger(ctx context.Context) ApiCreateBulkMoMergerRequest {\n\treturn ApiCreateBulkMoMergerRequest{\n\t\tApiService: a,\n\t\tctx: ctx,\n\t}\n}", "func (a *DefaultApiService) BulkCreateExecute(r ApiBulkCreateRequest) (BulkCreateResponse, *_nethttp.Response, GenericOpenAPIError) {\n\tvar (\n\t\tlocalVarHTTPMethod = _nethttp.MethodPost\n\t\tlocalVarPostBody interface{}\n\t\tlocalVarFormFileName string\n\t\tlocalVarFileName string\n\t\tlocalVarFileBytes []byte\n\t\texecutionError GenericOpenAPIError\n\t\tlocalVarReturnValue BulkCreateResponse\n\t)\n\n\tlocalBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, \"DefaultApiService.BulkCreate\")\n\tif err != nil {\n\t\texecutionError.error = err.Error()\n\t\treturn localVarReturnValue, nil, executionError\n\t}\n\n\tlocalVarPath := localBasePath + \"/bulk_create\"\n\n\tlocalVarHeaderParams := make(map[string]string)\n\tlocalVarQueryParams := _neturl.Values{}\n\tlocalVarFormParams := _neturl.Values{}\n\n\t// to determine the Content-Type header\n\tlocalVarHTTPContentTypes := []string{\"application/json\"}\n\n\t// set Content-Type header\n\tlocalVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)\n\tif localVarHTTPContentType != \"\" {\n\t\tlocalVarHeaderParams[\"Content-Type\"] = localVarHTTPContentType\n\t}\n\n\t// to determine the Accept header\n\tlocalVarHTTPHeaderAccepts := []string{\"application/json\"}\n\n\t// set Accept header\n\tlocalVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)\n\tif localVarHTTPHeaderAccept != \"\" {\n\t\tlocalVarHeaderParams[\"Accept\"] = localVarHTTPHeaderAccept\n\t}\n\t// body params\n\tlocalVarPostBody = r.bulkCreatePayload\n\treq, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)\n\tif err != nil {\n\t\texecutionError.error = err.Error()\n\t\treturn localVarReturnValue, nil, executionError\n\t}\n\n\tlocalVarHTTPResponse, err := a.client.callAPI(req)\n\tif err != nil || localVarHTTPResponse == nil {\n\t\texecutionError.error = err.Error()\n\t\treturn localVarReturnValue, localVarHTTPResponse, executionError\n\t}\n\n\tlocalVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body)\n\tlocalVarHTTPResponse.Body.Close()\n\tlocalVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody))\n\tif err != nil {\n\t\texecutionError.error = err.Error()\n\t\treturn localVarReturnValue, localVarHTTPResponse, executionError\n\t}\n\n\tif localVarHTTPResponse.StatusCode >= 300 {\n\t\tnewErr := GenericOpenAPIError{\n\t\t\tbody: localVarBody,\n\t\t\terror: localVarHTTPResponse.Status,\n\t\t}\n\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t}\n\n\terr = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\tif err != nil {\n\t\tnewErr := GenericOpenAPIError{\n\t\t\tbody: localVarBody,\n\t\t\terror: err.Error(),\n\t\t}\n\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t}\n\n\treturn localVarReturnValue, localVarHTTPResponse, executionError\n}", "func (c *BulkDeletesController) Create(ctx *gin.Context) {\n\trequest := models.BulkDeleteRunRequest{}\n\tif err := ctx.ShouldBindJSON(&request); err != nil {\n\t\tctx.AbortWithError(422, err)\n\t} else if task, err := models.NewBulkDeleteRunTask(request); err != nil {\n\t\tctx.AbortWithError(422, err)\n\t} else if err := c.App.GetStore().Save(task); err != nil {\n\t\tctx.AbortWithError(500, err)\n\t} else if doc, err := jsonapi.Marshal(task); err != nil {\n\t\tctx.AbortWithError(500, err)\n\t} else {\n\t\tc.App.WakeBulkRunDeleter()\n\t\tctx.Data(201, MediaType, doc)\n\t}\n}", "func (c *queryClient) Bulk(args []*RequestBody) (io.ReadCloser, error) {\n\tbody := RequestBody{\n\t\tType: \"bulk\",\n\t\tArgs: args,\n\t}\n\n\treturn c.Send(body)\n}", "func NewMultiBulk(array []*EncodeData) *EncodeData {\n\tans := &EncodeData{}\n\tans.Type = TypeMultiBulk\n\tans.Array = array\n\treturn ans\n}", "func (ccb *CampaignCreateBulk) Save(ctx context.Context) ([]*Campaign, error) {\n\tspecs := make([]*sqlgraph.CreateSpec, len(ccb.builders))\n\tnodes := make([]*Campaign, len(ccb.builders))\n\tmutators := make([]Mutator, len(ccb.builders))\n\tfor i := range ccb.builders {\n\t\tfunc(i int, root context.Context) {\n\t\t\tbuilder := ccb.builders[i]\n\t\t\tbuilder.defaults()\n\t\t\tvar mut Mutator = MutateFunc(func(ctx context.Context, m Mutation) (Value, error) {\n\t\t\t\tmutation, ok := m.(*CampaignMutation)\n\t\t\t\tif !ok {\n\t\t\t\t\treturn nil, fmt.Errorf(\"unexpected mutation type %T\", m)\n\t\t\t\t}\n\t\t\t\tif err := builder.check(); err != nil {\n\t\t\t\t\treturn nil, err\n\t\t\t\t}\n\t\t\t\tbuilder.mutation = mutation\n\t\t\t\tnodes[i], specs[i] = builder.createSpec()\n\t\t\t\tvar err error\n\t\t\t\tif i < len(mutators)-1 {\n\t\t\t\t\t_, err = mutators[i+1].Mutate(root, ccb.builders[i+1].mutation)\n\t\t\t\t} else {\n\t\t\t\t\t// Invoke the actual operation on the latest mutation in the chain.\n\t\t\t\t\tif err = sqlgraph.BatchCreate(ctx, ccb.driver, &sqlgraph.BatchCreateSpec{Nodes: specs}); err != nil {\n\t\t\t\t\t\tif cerr, ok := isSQLConstraintError(err); ok {\n\t\t\t\t\t\t\terr = cerr\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tmutation.done = true\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn nil, err\n\t\t\t\t}\n\t\t\t\treturn nodes[i], nil\n\t\t\t})\n\t\t\tfor i := len(builder.hooks) - 1; i >= 0; i-- {\n\t\t\t\tmut = builder.hooks[i](mut)\n\t\t\t}\n\t\t\tmutators[i] = mut\n\t\t}(i, ctx)\n\t}\n\tif len(mutators) > 0 {\n\t\tif _, err := mutators[0].Mutate(ctx, ccb.builders[0].mutation); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\treturn nodes, nil\n}", "func (icb *InstanceCreateBulk) Save(ctx context.Context) ([]*Instance, error) {\n\tspecs := make([]*sqlgraph.CreateSpec, len(icb.builders))\n\tnodes := make([]*Instance, len(icb.builders))\n\tmutators := make([]Mutator, len(icb.builders))\n\tfor i := range icb.builders {\n\t\tfunc(i int, root context.Context) {\n\t\t\tbuilder := icb.builders[i]\n\t\t\tbuilder.defaults()\n\t\t\tvar mut Mutator = MutateFunc(func(ctx context.Context, m Mutation) (Value, error) {\n\t\t\t\tmutation, ok := m.(*InstanceMutation)\n\t\t\t\tif !ok {\n\t\t\t\t\treturn nil, fmt.Errorf(\"unexpected mutation type %T\", m)\n\t\t\t\t}\n\t\t\t\tif err := builder.check(); err != nil {\n\t\t\t\t\treturn nil, err\n\t\t\t\t}\n\t\t\t\tbuilder.mutation = mutation\n\t\t\t\tnodes[i], specs[i] = builder.createSpec()\n\t\t\t\tvar err error\n\t\t\t\tif i < len(mutators)-1 {\n\t\t\t\t\t_, err = mutators[i+1].Mutate(root, icb.builders[i+1].mutation)\n\t\t\t\t} else {\n\t\t\t\t\tspec := &sqlgraph.BatchCreateSpec{Nodes: specs}\n\t\t\t\t\t// Invoke the actual operation on the latest mutation in the chain.\n\t\t\t\t\tif err = sqlgraph.BatchCreate(ctx, icb.driver, spec); err != nil {\n\t\t\t\t\t\tif sqlgraph.IsConstraintError(err) {\n\t\t\t\t\t\t\terr = &ConstraintError{err.Error(), err}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn nil, err\n\t\t\t\t}\n\t\t\t\tmutation.id = &nodes[i].ID\n\t\t\t\tmutation.done = true\n\t\t\t\treturn nodes[i], nil\n\t\t\t})\n\t\t\tfor i := len(builder.hooks) - 1; i >= 0; i-- {\n\t\t\t\tmut = builder.hooks[i](mut)\n\t\t\t}\n\t\t\tmutators[i] = mut\n\t\t}(i, ctx)\n\t}\n\tif len(mutators) > 0 {\n\t\tif _, err := mutators[0].Mutate(ctx, icb.builders[0].mutation); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\treturn nodes, nil\n}", "func (r *pgRepository) CreateMany(ctx context.Context, tenant string, items []*model.APIDefinition) error {\n\tfor index, item := range items {\n\t\tentity := r.conv.ToEntity(item)\n\n\t\terr := r.creator.Create(ctx, resource.API, tenant, entity)\n\t\tif err != nil {\n\t\t\treturn errors.Wrapf(err, \"while persisting %d item\", index)\n\t\t}\n\t}\n\n\treturn nil\n}", "func (bcb *BouncerCreateBulk) Save(ctx context.Context) ([]*Bouncer, error) {\n\tspecs := make([]*sqlgraph.CreateSpec, len(bcb.builders))\n\tnodes := make([]*Bouncer, len(bcb.builders))\n\tmutators := make([]Mutator, len(bcb.builders))\n\tfor i := range bcb.builders {\n\t\tfunc(i int, root context.Context) {\n\t\t\tbuilder := bcb.builders[i]\n\t\t\tbuilder.defaults()\n\t\t\tvar mut Mutator = MutateFunc(func(ctx context.Context, m Mutation) (Value, error) {\n\t\t\t\tmutation, ok := m.(*BouncerMutation)\n\t\t\t\tif !ok {\n\t\t\t\t\treturn nil, fmt.Errorf(\"unexpected mutation type %T\", m)\n\t\t\t\t}\n\t\t\t\tif err := builder.check(); err != nil {\n\t\t\t\t\treturn nil, err\n\t\t\t\t}\n\t\t\t\tbuilder.mutation = mutation\n\t\t\t\tnodes[i], specs[i] = builder.createSpec()\n\t\t\t\tvar err error\n\t\t\t\tif i < len(mutators)-1 {\n\t\t\t\t\t_, err = mutators[i+1].Mutate(root, bcb.builders[i+1].mutation)\n\t\t\t\t} else {\n\t\t\t\t\tspec := &sqlgraph.BatchCreateSpec{Nodes: specs}\n\t\t\t\t\t// Invoke the actual operation on the latest mutation in the chain.\n\t\t\t\t\tif err = sqlgraph.BatchCreate(ctx, bcb.driver, spec); err != nil {\n\t\t\t\t\t\tif sqlgraph.IsConstraintError(err) {\n\t\t\t\t\t\t\terr = &ConstraintError{msg: err.Error(), wrap: err}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn nil, err\n\t\t\t\t}\n\t\t\t\tmutation.id = &nodes[i].ID\n\t\t\t\tif specs[i].ID.Value != nil {\n\t\t\t\t\tid := specs[i].ID.Value.(int64)\n\t\t\t\t\tnodes[i].ID = int(id)\n\t\t\t\t}\n\t\t\t\tmutation.done = true\n\t\t\t\treturn nodes[i], nil\n\t\t\t})\n\t\t\tfor i := len(builder.hooks) - 1; i >= 0; i-- {\n\t\t\t\tmut = builder.hooks[i](mut)\n\t\t\t}\n\t\t\tmutators[i] = mut\n\t\t}(i, ctx)\n\t}\n\tif len(mutators) > 0 {\n\t\tif _, err := mutators[0].Mutate(ctx, bcb.builders[0].mutation); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\treturn nodes, nil\n}", "func (a *BulkApiService) CreateBulkRequestExecute(r ApiCreateBulkRequestRequest) (*BulkRequest, *http.Response, error) {\n\tvar (\n\t\tlocalVarHTTPMethod = http.MethodPost\n\t\tlocalVarPostBody interface{}\n\t\tformFiles []formFile\n\t\tlocalVarReturnValue *BulkRequest\n\t)\n\n\tlocalBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, \"BulkApiService.CreateBulkRequest\")\n\tif err != nil {\n\t\treturn localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()}\n\t}\n\n\tlocalVarPath := localBasePath + \"/api/v1/bulk/Requests\"\n\n\tlocalVarHeaderParams := make(map[string]string)\n\tlocalVarQueryParams := url.Values{}\n\tlocalVarFormParams := url.Values{}\n\tif r.bulkRequest == nil {\n\t\treturn localVarReturnValue, nil, reportError(\"bulkRequest is required and must be specified\")\n\t}\n\n\t// to determine the Content-Type header\n\tlocalVarHTTPContentTypes := []string{\"application/json\"}\n\n\t// set Content-Type header\n\tlocalVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)\n\tif localVarHTTPContentType != \"\" {\n\t\tlocalVarHeaderParams[\"Content-Type\"] = localVarHTTPContentType\n\t}\n\n\t// to determine the Accept header\n\tlocalVarHTTPHeaderAccepts := []string{\"application/json\"}\n\n\t// set Accept header\n\tlocalVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)\n\tif localVarHTTPHeaderAccept != \"\" {\n\t\tlocalVarHeaderParams[\"Accept\"] = localVarHTTPHeaderAccept\n\t}\n\tif r.ifMatch != nil {\n\t\tlocalVarHeaderParams[\"If-Match\"] = parameterToString(*r.ifMatch, \"\")\n\t}\n\tif r.ifNoneMatch != nil {\n\t\tlocalVarHeaderParams[\"If-None-Match\"] = parameterToString(*r.ifNoneMatch, \"\")\n\t}\n\t// body params\n\tlocalVarPostBody = r.bulkRequest\n\treq, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles)\n\tif err != nil {\n\t\treturn localVarReturnValue, nil, err\n\t}\n\n\tlocalVarHTTPResponse, err := a.client.callAPI(req)\n\tif err != nil || localVarHTTPResponse == nil {\n\t\treturn localVarReturnValue, localVarHTTPResponse, err\n\t}\n\n\tlocalVarBody, err := ioutil.ReadAll(localVarHTTPResponse.Body)\n\tlocalVarHTTPResponse.Body.Close()\n\tlocalVarHTTPResponse.Body = ioutil.NopCloser(bytes.NewBuffer(localVarBody))\n\tif err != nil {\n\t\treturn localVarReturnValue, localVarHTTPResponse, err\n\t}\n\n\tif localVarHTTPResponse.StatusCode >= 300 {\n\t\tnewErr := &GenericOpenAPIError{\n\t\t\tbody: localVarBody,\n\t\t\terror: localVarHTTPResponse.Status,\n\t\t}\n\t\tif localVarHTTPResponse.StatusCode == 400 {\n\t\t\tvar v Error\n\t\t\terr = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\t\t\tif err != nil {\n\t\t\t\tnewErr.error = err.Error()\n\t\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t\t}\n\t\t\tnewErr.model = v\n\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t}\n\t\tif localVarHTTPResponse.StatusCode == 401 {\n\t\t\tvar v Error\n\t\t\terr = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\t\t\tif err != nil {\n\t\t\t\tnewErr.error = err.Error()\n\t\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t\t}\n\t\t\tnewErr.model = v\n\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t}\n\t\tif localVarHTTPResponse.StatusCode == 403 {\n\t\t\tvar v Error\n\t\t\terr = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\t\t\tif err != nil {\n\t\t\t\tnewErr.error = err.Error()\n\t\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t\t}\n\t\t\tnewErr.model = v\n\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t}\n\t\tif localVarHTTPResponse.StatusCode == 404 {\n\t\t\tvar v Error\n\t\t\terr = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\t\t\tif err != nil {\n\t\t\t\tnewErr.error = err.Error()\n\t\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t\t}\n\t\t\tnewErr.model = v\n\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t}\n\t\tvar v Error\n\t\terr = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\t\tif err != nil {\n\t\t\tnewErr.error = err.Error()\n\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t}\n\t\tnewErr.model = v\n\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t}\n\n\terr = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\tif err != nil {\n\t\tnewErr := &GenericOpenAPIError{\n\t\t\tbody: localVarBody,\n\t\t\terror: err.Error(),\n\t\t}\n\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t}\n\n\treturn localVarReturnValue, localVarHTTPResponse, nil\n}", "func PostBulkData(genreArtistData map[string]spotify.Artist) {\n\n\t// Print ES version\n\tlog.Info(\"ES client version:\", elastic.Version)\n\n\t// Create context for API calls\n\tctx := context.Background()\n\n\t// Initiate ES client instance\n\tclient, err := elastic.NewClient(\n\t\telastic.SetSniff(false),\n\t\telastic.SetURL(\"http://localhost:9200\"),\n\t\telastic.SetHealthcheckInterval(5*time.Second),\n\t)\n\tif err != nil {\n\t\tlog.Fatal(\"Set ES client failed, quitting. \\n\", err)\n\t} else {\n\t\t// Print client information\n\t\tlog.Println(\"client:\", client)\n\t}\n\n\t//hours, minutes, seconds := time.Now().Clock()\n\t//indexName := fmt.Sprintf(\"artists-%02d%02d%02d\", hours, minutes, seconds)\n\n\t// Set index to post to name\n\tindexName := \"artists-18122019\"\n\t// Declare a string slice with the index name in it\n\tindices := []string{indexName}\n\n\t// Check index\n\t// Create an instance\n\tindexExists := elastic.NewIndicesExistsService(client)\n\t// Set index name to check\n\tindexExists.Index(indices)\n\t// Check if index exists\n\texist, err := indexExists.Do(ctx)\n\tif err != nil {\n\t\tlog.Fatal(\"Problems querying index:\", err)\n\n\t} else if exist == false {\n\t\tlog.Errorf(\"Index %s does not exist on ES\", indexName)\n\t} else if exist == true {\n\t\tlog.Printf(\"Index: '%s' exists.\", indexName)\n\t\t// Create a new Bulk() object\n\t\tbulk := client.Bulk()\n\n\t\t// Put genre artist data into bulk instance\n\t\tfor id, doc := range genreArtistData {\n\t\t\tplaylists := []string{}\n\t\t\tfor plist := range doc.Playlist {\n\t\t\t\tplaylists = append(playlists, plist)\n\t\t\t}\n\t\t\tvar artistDoc artistPost\n\t\t\tartistDoc.ID = doc.ID\n\t\t\tartistDoc.Genres = doc.Genres\n\t\t\tartistDoc.Artist = doc.Name\n\t\t\tartistDoc.Playlists = playlists\n\t\t\t// Declare a new NewBulkIndexRequest() instance\n\t\t\treq := elastic.NewBulkIndexRequest()\n\n\t\t\t// Set index name for bulk instance\n\t\t\treq.OpType(\"index\")\n\t\t\treq.Index(indexName)\n\t\t\treq.Id(id)\n\t\t\treq.Doc(artistDoc)\n\n\t\t\t// Add req entry to bulk\n\t\t\tbulk = bulk.Add(req)\n\t\t}\n\t\tlog.Printf(\"%d entries are going to be bulk posted\", bulk.NumberOfActions())\n\n\t\t// Post bulk to Elasticsearch\n\t\tbulkResponse, err := bulk.Do(ctx)\n\n\t\tif err != nil {\n\t\t\tlog.Fatal(\"Failed posting to ES:\", err)\n\t\t} else {\n\t\t\t// Print response\n\t\t\tresponse := bulkResponse.Indexed()\n\t\t\tfor num, document := range response {\n\t\t\t\tlog.Printf(\"%03d item: %v\", num, document)\n\t\t\t}\n\t\t}\n\t}\n}", "func (s *grpcServer) BulkCreateJobPost(ctx context.Context, req *pb.BulkCreateJobPostRequest) (*pb.BulkCreateJobPostResponse, error) {\n\t_, rep, err := s.bulkCreateJobPost.ServeGRPC(ctx, req)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn rep.(*pb.BulkCreateJobPostResponse), nil\n}", "func (pcb *PetCreateBulk) Save(ctx context.Context) ([]*Pet, error) {\n\tspecs := make([]*sqlgraph.CreateSpec, len(pcb.builders))\n\tnodes := make([]*Pet, len(pcb.builders))\n\tmutators := make([]Mutator, len(pcb.builders))\n\tfor i := range pcb.builders {\n\t\tfunc(i int, root context.Context) {\n\t\t\tbuilder := pcb.builders[i]\n\t\t\tbuilder.defaults()\n\t\t\tvar mut Mutator = MutateFunc(func(ctx context.Context, m Mutation) (Value, error) {\n\t\t\t\tmutation, ok := m.(*PetMutation)\n\t\t\t\tif !ok {\n\t\t\t\t\treturn nil, fmt.Errorf(\"unexpected mutation type %T\", m)\n\t\t\t\t}\n\t\t\t\tif err := builder.check(); err != nil {\n\t\t\t\t\treturn nil, err\n\t\t\t\t}\n\t\t\t\tbuilder.mutation = mutation\n\t\t\t\tnodes[i], specs[i] = builder.createSpec()\n\t\t\t\tvar err error\n\t\t\t\tif i < len(mutators)-1 {\n\t\t\t\t\t_, err = mutators[i+1].Mutate(root, pcb.builders[i+1].mutation)\n\t\t\t\t} else {\n\t\t\t\t\tspec := &sqlgraph.BatchCreateSpec{Nodes: specs}\n\t\t\t\t\tspec.OnConflict = pcb.conflict\n\t\t\t\t\t// Invoke the actual operation on the latest mutation in the chain.\n\t\t\t\t\tif err = sqlgraph.BatchCreate(ctx, pcb.driver, spec); err != nil {\n\t\t\t\t\t\tif sqlgraph.IsConstraintError(err) {\n\t\t\t\t\t\t\terr = &ConstraintError{msg: err.Error(), wrap: err}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn nil, err\n\t\t\t\t}\n\t\t\t\tmutation.id = &nodes[i].ID\n\t\t\t\tif specs[i].ID.Value != nil {\n\t\t\t\t\tid := specs[i].ID.Value.(int64)\n\t\t\t\t\tnodes[i].ID = int(id)\n\t\t\t\t}\n\t\t\t\tmutation.done = true\n\t\t\t\treturn nodes[i], nil\n\t\t\t})\n\t\t\tfor i := len(builder.hooks) - 1; i >= 0; i-- {\n\t\t\t\tmut = builder.hooks[i](mut)\n\t\t\t}\n\t\t\tmutators[i] = mut\n\t\t}(i, ctx)\n\t}\n\tif len(mutators) > 0 {\n\t\tif _, err := mutators[0].Mutate(ctx, pcb.builders[0].mutation); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\treturn nodes, nil\n}", "func (bbcb *BasicBannerCreateBulk) Save(ctx context.Context) ([]*BasicBanner, error) {\n\tspecs := make([]*sqlgraph.CreateSpec, len(bbcb.builders))\n\tnodes := make([]*BasicBanner, len(bbcb.builders))\n\tmutators := make([]Mutator, len(bbcb.builders))\n\tfor i := range bbcb.builders {\n\t\tfunc(i int, root context.Context) {\n\t\t\tbuilder := bbcb.builders[i]\n\t\t\tbuilder.defaults()\n\t\t\tvar mut Mutator = MutateFunc(func(ctx context.Context, m Mutation) (Value, error) {\n\t\t\t\tmutation, ok := m.(*BasicBannerMutation)\n\t\t\t\tif !ok {\n\t\t\t\t\treturn nil, fmt.Errorf(\"unexpected mutation type %T\", m)\n\t\t\t\t}\n\t\t\t\tif err := builder.check(); err != nil {\n\t\t\t\t\treturn nil, err\n\t\t\t\t}\n\t\t\t\tbuilder.mutation = mutation\n\t\t\t\tnodes[i], specs[i] = builder.createSpec()\n\t\t\t\tvar err error\n\t\t\t\tif i < len(mutators)-1 {\n\t\t\t\t\t_, err = mutators[i+1].Mutate(root, bbcb.builders[i+1].mutation)\n\t\t\t\t} else {\n\t\t\t\t\t// Invoke the actual operation on the latest mutation in the chain.\n\t\t\t\t\tif err = sqlgraph.BatchCreate(ctx, bbcb.driver, &sqlgraph.BatchCreateSpec{Nodes: specs}); err != nil {\n\t\t\t\t\t\tif cerr, ok := isSQLConstraintError(err); ok {\n\t\t\t\t\t\t\terr = cerr\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tmutation.done = true\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn nil, err\n\t\t\t\t}\n\t\t\t\tid := specs[i].ID.Value.(int64)\n\t\t\t\tnodes[i].ID = int(id)\n\t\t\t\treturn nodes[i], nil\n\t\t\t})\n\t\t\tfor i := len(builder.hooks) - 1; i >= 0; i-- {\n\t\t\t\tmut = builder.hooks[i](mut)\n\t\t\t}\n\t\t\tmutators[i] = mut\n\t\t}(i, ctx)\n\t}\n\tif len(mutators) > 0 {\n\t\tif _, err := mutators[0].Mutate(ctx, bbcb.builders[0].mutation); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\treturn nodes, nil\n}", "func (hcb *HarborCreateBulk) Save(ctx context.Context) ([]*Harbor, error) {\n\tspecs := make([]*sqlgraph.CreateSpec, len(hcb.builders))\n\tnodes := make([]*Harbor, len(hcb.builders))\n\tmutators := make([]Mutator, len(hcb.builders))\n\tfor i := range hcb.builders {\n\t\tfunc(i int, root context.Context) {\n\t\t\tbuilder := hcb.builders[i]\n\t\t\tvar mut Mutator = MutateFunc(func(ctx context.Context, m Mutation) (Value, error) {\n\t\t\t\tmutation, ok := m.(*HarborMutation)\n\t\t\t\tif !ok {\n\t\t\t\t\treturn nil, fmt.Errorf(\"unexpected mutation type %T\", m)\n\t\t\t\t}\n\t\t\t\tif err := builder.check(); err != nil {\n\t\t\t\t\treturn nil, err\n\t\t\t\t}\n\t\t\t\tbuilder.mutation = mutation\n\t\t\t\tnodes[i], specs[i] = builder.createSpec()\n\t\t\t\tvar err error\n\t\t\t\tif i < len(mutators)-1 {\n\t\t\t\t\t_, err = mutators[i+1].Mutate(root, hcb.builders[i+1].mutation)\n\t\t\t\t} else {\n\t\t\t\t\t// Invoke the actual operation on the latest mutation in the chain.\n\t\t\t\t\tif err = sqlgraph.BatchCreate(ctx, hcb.driver, &sqlgraph.BatchCreateSpec{Nodes: specs}); err != nil {\n\t\t\t\t\t\tif cerr, ok := isSQLConstraintError(err); ok {\n\t\t\t\t\t\t\terr = cerr\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tmutation.done = true\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn nil, err\n\t\t\t\t}\n\t\t\t\tid := specs[i].ID.Value.(int64)\n\t\t\t\tnodes[i].ID = int(id)\n\t\t\t\treturn nodes[i], nil\n\t\t\t})\n\t\t\tfor i := len(builder.hooks) - 1; i >= 0; i-- {\n\t\t\t\tmut = builder.hooks[i](mut)\n\t\t\t}\n\t\t\tmutators[i] = mut\n\t\t}(i, ctx)\n\t}\n\tif len(mutators) > 0 {\n\t\tif _, err := mutators[0].Mutate(ctx, hcb.builders[0].mutation); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\treturn nodes, nil\n}", "func (c *Client) BulkSend(documents []Document) (*Response, error) {\n\t// We do not generate a traditional JSON here (often a one liner)\n\t// Elasticsearch expects one line of JSON per line (EOL = \\n)\n\t// plus an extra \\n at the very end of the document\n\t//\n\t// More informations about the Bulk JSON format for Elasticsearch:\n\t//\n\t// - http://www.elasticsearch.org/guide/reference/api/bulk.html\n\t//\n\t// This is quite annoying for us as we can not use the simple JSON\n\t// Marshaler available in Run().\n\t//\n\t// We have to generate this special JSON by ourselves which leads to\n\t// the code below.\n\t//\n\t// I know it is unreadable I must find an elegant way to fix this.\n\n\t// len(documents) * 2 : action + optional_sources\n\t// + 1 : room for the trailing \\n\n\tbulkData := make([][]byte, 0, len(documents)*2+1)\n\ti := 0\n\n\tfor _, doc := range documents {\n\t\taction, err := json.Marshal(map[string]interface{}{\n\t\t\tdoc.BulkCommand: map[string]interface{}{\n\t\t\t\t\"_index\": doc.Index,\n\t\t\t\t\"_type\": doc.Type,\n\t\t\t\t\"_id\": doc.ID,\n\t\t\t},\n\t\t})\n\n\t\tif err != nil {\n\t\t\treturn &Response{}, err\n\t\t}\n\n\t\tbulkData = append(bulkData, action)\n\t\ti++\n\n\t\tif doc.Fields != nil {\n\t\t\tif docFields, ok := doc.Fields.(map[string]interface{}); ok {\n\t\t\t\tif len(docFields) == 0 {\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\ttypeOfFields := reflect.TypeOf(doc.Fields)\n\t\t\t\tif typeOfFields.Kind() == reflect.Ptr {\n\t\t\t\t\ttypeOfFields = typeOfFields.Elem()\n\t\t\t\t}\n\t\t\t\tif typeOfFields.Kind() != reflect.Struct {\n\t\t\t\t\treturn &Response{}, fmt.Errorf(\"Document fields not in struct or map[string]interface{} format\")\n\t\t\t\t}\n\t\t\t\tif typeOfFields.NumField() == 0 {\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tsources, err := json.Marshal(doc.Fields)\n\t\t\tif err != nil {\n\t\t\t\treturn &Response{}, err\n\t\t\t}\n\n\t\t\tbulkData = append(bulkData, sources)\n\t\t\ti++\n\t\t}\n\t}\n\n\t// forces an extra trailing \\n absolutely necessary for elasticsearch\n\tbulkData = append(bulkData, []byte(nil))\n\n\tr := Request{\n\t\tMethod: \"POST\",\n\t\tAPI: \"_bulk\",\n\t\tBulkData: bytes.Join(bulkData, []byte(\"\\n\")),\n\t}\n\n\tresp, err := c.Do(&r)\n\tif err != nil {\n\t\treturn resp, err\n\t}\n\n\tif resp.Errors {\n\t\tfor _, item := range resp.Items {\n\t\t\tfor _, i := range item {\n\t\t\t\tif i.Error != \"\" {\n\t\t\t\t\treturn resp, &SearchError{i.Error, i.Status}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn resp, &SearchError{Msg: \"Unknown error while bulk indexing\"}\n\t}\n\n\treturn resp, err\n}", "func (wcb *WordCreateBulk) Save(ctx context.Context) ([]*Word, error) {\n\tspecs := make([]*sqlgraph.CreateSpec, len(wcb.builders))\n\tnodes := make([]*Word, len(wcb.builders))\n\tmutators := make([]Mutator, len(wcb.builders))\n\tfor i := range wcb.builders {\n\t\tfunc(i int, root context.Context) {\n\t\t\tbuilder := wcb.builders[i]\n\t\t\tbuilder.defaults()\n\t\t\tvar mut Mutator = MutateFunc(func(ctx context.Context, m Mutation) (Value, error) {\n\t\t\t\tmutation, ok := m.(*WordMutation)\n\t\t\t\tif !ok {\n\t\t\t\t\treturn nil, fmt.Errorf(\"unexpected mutation type %T\", m)\n\t\t\t\t}\n\t\t\t\tif err := builder.check(); err != nil {\n\t\t\t\t\treturn nil, err\n\t\t\t\t}\n\t\t\t\tbuilder.mutation = mutation\n\t\t\t\tnodes[i], specs[i] = builder.createSpec()\n\t\t\t\tvar err error\n\t\t\t\tif i < len(mutators)-1 {\n\t\t\t\t\t_, err = mutators[i+1].Mutate(root, wcb.builders[i+1].mutation)\n\t\t\t\t} else {\n\t\t\t\t\t// Invoke the actual operation on the latest mutation in the chain.\n\t\t\t\t\tif err = sqlgraph.BatchCreate(ctx, wcb.driver, &sqlgraph.BatchCreateSpec{Nodes: specs}); err != nil {\n\t\t\t\t\t\tif cerr, ok := isSQLConstraintError(err); ok {\n\t\t\t\t\t\t\terr = cerr\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tmutation.done = true\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn nil, err\n\t\t\t\t}\n\t\t\t\tid := specs[i].ID.Value.(int64)\n\t\t\t\tnodes[i].ID = int(id)\n\t\t\t\treturn nodes[i], nil\n\t\t\t})\n\t\t\tfor i := len(builder.hooks) - 1; i >= 0; i-- {\n\t\t\t\tmut = builder.hooks[i](mut)\n\t\t\t}\n\t\t\tmutators[i] = mut\n\t\t}(i, ctx)\n\t}\n\tif len(mutators) > 0 {\n\t\tif _, err := mutators[0].Mutate(ctx, wcb.builders[0].mutation); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\treturn nodes, nil\n}", "func (bcb *BeerCreateBulk) Save(ctx context.Context) ([]*Beer, error) {\n\tspecs := make([]*sqlgraph.CreateSpec, len(bcb.builders))\n\tnodes := make([]*Beer, len(bcb.builders))\n\tmutators := make([]Mutator, len(bcb.builders))\n\tfor i := range bcb.builders {\n\t\tfunc(i int, root context.Context) {\n\t\t\tbuilder := bcb.builders[i]\n\t\t\tbuilder.defaults()\n\t\t\tvar mut Mutator = MutateFunc(func(ctx context.Context, m Mutation) (Value, error) {\n\t\t\t\tmutation, ok := m.(*BeerMutation)\n\t\t\t\tif !ok {\n\t\t\t\t\treturn nil, fmt.Errorf(\"unexpected mutation type %T\", m)\n\t\t\t\t}\n\t\t\t\tif err := builder.check(); err != nil {\n\t\t\t\t\treturn nil, err\n\t\t\t\t}\n\t\t\t\tbuilder.mutation = mutation\n\t\t\t\tnodes[i], specs[i] = builder.createSpec()\n\t\t\t\tvar err error\n\t\t\t\tif i < len(mutators)-1 {\n\t\t\t\t\t_, err = mutators[i+1].Mutate(root, bcb.builders[i+1].mutation)\n\t\t\t\t} else {\n\t\t\t\t\t// Invoke the actual operation on the latest mutation in the chain.\n\t\t\t\t\tif err = sqlgraph.BatchCreate(ctx, bcb.driver, &sqlgraph.BatchCreateSpec{Nodes: specs}); err != nil {\n\t\t\t\t\t\tif cerr, ok := isSQLConstraintError(err); ok {\n\t\t\t\t\t\t\terr = cerr\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tmutation.done = true\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn nil, err\n\t\t\t\t}\n\t\t\t\tif nodes[i].ID == 0 {\n\t\t\t\t\tid := specs[i].ID.Value.(int64)\n\t\t\t\t\tnodes[i].ID = int64(id)\n\t\t\t\t}\n\t\t\t\treturn nodes[i], nil\n\t\t\t})\n\t\t\tfor i := len(builder.hooks) - 1; i >= 0; i-- {\n\t\t\t\tmut = builder.hooks[i](mut)\n\t\t\t}\n\t\t\tmutators[i] = mut\n\t\t}(i, ctx)\n\t}\n\tif len(mutators) > 0 {\n\t\tif _, err := mutators[0].Mutate(ctx, bcb.builders[0].mutation); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\treturn nodes, nil\n}", "func NewPostBatchParams() *PostBatchParams {\n\tvar ()\n\treturn &PostBatchParams{\n\n\t\ttimeout: cr.DefaultTimeout,\n\t}\n}", "func (pcb *PageCreateBulk) Save(ctx context.Context) ([]*Page, error) {\n\tspecs := make([]*sqlgraph.CreateSpec, len(pcb.builders))\n\tnodes := make([]*Page, len(pcb.builders))\n\tmutators := make([]Mutator, len(pcb.builders))\n\tfor i := range pcb.builders {\n\t\tfunc(i int, root context.Context) {\n\t\t\tbuilder := pcb.builders[i]\n\t\t\tbuilder.defaults()\n\t\t\tvar mut Mutator = MutateFunc(func(ctx context.Context, m Mutation) (Value, error) {\n\t\t\t\tmutation, ok := m.(*PageMutation)\n\t\t\t\tif !ok {\n\t\t\t\t\treturn nil, fmt.Errorf(\"unexpected mutation type %T\", m)\n\t\t\t\t}\n\t\t\t\tif err := builder.check(); err != nil {\n\t\t\t\t\treturn nil, err\n\t\t\t\t}\n\t\t\t\tbuilder.mutation = mutation\n\t\t\t\tvar err error\n\t\t\t\tnodes[i], specs[i] = builder.createSpec()\n\t\t\t\tif i < len(mutators)-1 {\n\t\t\t\t\t_, err = mutators[i+1].Mutate(root, pcb.builders[i+1].mutation)\n\t\t\t\t} else {\n\t\t\t\t\tspec := &sqlgraph.BatchCreateSpec{Nodes: specs}\n\t\t\t\t\t// Invoke the actual operation on the latest mutation in the chain.\n\t\t\t\t\tif err = sqlgraph.BatchCreate(ctx, pcb.driver, spec); err != nil {\n\t\t\t\t\t\tif sqlgraph.IsConstraintError(err) {\n\t\t\t\t\t\t\terr = &ConstraintError{msg: err.Error(), wrap: err}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn nil, err\n\t\t\t\t}\n\t\t\t\tmutation.id = &nodes[i].ID\n\t\t\t\tif specs[i].ID.Value != nil {\n\t\t\t\t\tid := specs[i].ID.Value.(int64)\n\t\t\t\t\tnodes[i].ID = int(id)\n\t\t\t\t}\n\t\t\t\tmutation.done = true\n\t\t\t\treturn nodes[i], nil\n\t\t\t})\n\t\t\tfor i := len(builder.hooks) - 1; i >= 0; i-- {\n\t\t\t\tmut = builder.hooks[i](mut)\n\t\t\t}\n\t\t\tmutators[i] = mut\n\t\t}(i, ctx)\n\t}\n\tif len(mutators) > 0 {\n\t\tif _, err := mutators[0].Mutate(ctx, pcb.builders[0].mutation); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\treturn nodes, nil\n}", "func (icb *ItemCreateBulk) Save(ctx context.Context) ([]*Item, error) {\n\tspecs := make([]*sqlgraph.CreateSpec, len(icb.builders))\n\tnodes := make([]*Item, len(icb.builders))\n\tmutators := make([]Mutator, len(icb.builders))\n\tfor i := range icb.builders {\n\t\tfunc(i int, root context.Context) {\n\t\t\tbuilder := icb.builders[i]\n\t\t\tbuilder.defaults()\n\t\t\tvar mut Mutator = MutateFunc(func(ctx context.Context, m Mutation) (Value, error) {\n\t\t\t\tmutation, ok := m.(*ItemMutation)\n\t\t\t\tif !ok {\n\t\t\t\t\treturn nil, fmt.Errorf(\"unexpected mutation type %T\", m)\n\t\t\t\t}\n\t\t\t\tif err := builder.check(); err != nil {\n\t\t\t\t\treturn nil, err\n\t\t\t\t}\n\t\t\t\tbuilder.mutation = mutation\n\t\t\t\tnodes[i], specs[i] = builder.createSpec()\n\t\t\t\tvar err error\n\t\t\t\tif i < len(mutators)-1 {\n\t\t\t\t\t_, err = mutators[i+1].Mutate(root, icb.builders[i+1].mutation)\n\t\t\t\t} else {\n\t\t\t\t\tspec := &sqlgraph.BatchCreateSpec{Nodes: specs}\n\t\t\t\t\tspec.OnConflict = icb.conflict\n\t\t\t\t\t// Invoke the actual operation on the latest mutation in the chain.\n\t\t\t\t\tif err = sqlgraph.BatchCreate(ctx, icb.driver, spec); err != nil {\n\t\t\t\t\t\tif sqlgraph.IsConstraintError(err) {\n\t\t\t\t\t\t\terr = &ConstraintError{msg: err.Error(), wrap: err}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn nil, err\n\t\t\t\t}\n\t\t\t\tmutation.id = &nodes[i].ID\n\t\t\t\tmutation.done = true\n\t\t\t\treturn nodes[i], nil\n\t\t\t})\n\t\t\tfor i := len(builder.hooks) - 1; i >= 0; i-- {\n\t\t\t\tmut = builder.hooks[i](mut)\n\t\t\t}\n\t\t\tmutators[i] = mut\n\t\t}(i, ctx)\n\t}\n\tif len(mutators) > 0 {\n\t\tif _, err := mutators[0].Mutate(ctx, icb.builders[0].mutation); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\treturn nodes, nil\n}", "func (etcb *ExportTaskCreateBulk) Save(ctx context.Context) ([]*ExportTask, error) {\n\tspecs := make([]*sqlgraph.CreateSpec, len(etcb.builders))\n\tnodes := make([]*ExportTask, len(etcb.builders))\n\tmutators := make([]Mutator, len(etcb.builders))\n\tfor i := range etcb.builders {\n\t\tfunc(i int, root context.Context) {\n\t\t\tbuilder := etcb.builders[i]\n\t\t\tbuilder.defaults()\n\t\t\tvar mut Mutator = MutateFunc(func(ctx context.Context, m Mutation) (Value, error) {\n\t\t\t\tmutation, ok := m.(*ExportTaskMutation)\n\t\t\t\tif !ok {\n\t\t\t\t\treturn nil, fmt.Errorf(\"unexpected mutation type %T\", m)\n\t\t\t\t}\n\t\t\t\tif err := builder.check(); err != nil {\n\t\t\t\t\treturn nil, err\n\t\t\t\t}\n\t\t\t\tbuilder.mutation = mutation\n\t\t\t\tnodes[i], specs[i] = builder.createSpec()\n\t\t\t\tvar err error\n\t\t\t\tif i < len(mutators)-1 {\n\t\t\t\t\t_, err = mutators[i+1].Mutate(root, etcb.builders[i+1].mutation)\n\t\t\t\t} else {\n\t\t\t\t\t// Invoke the actual operation on the latest mutation in the chain.\n\t\t\t\t\tif err = sqlgraph.BatchCreate(ctx, etcb.driver, &sqlgraph.BatchCreateSpec{Nodes: specs}); err != nil {\n\t\t\t\t\t\tif cerr, ok := isSQLConstraintError(err); ok {\n\t\t\t\t\t\t\terr = cerr\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tmutation.done = true\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn nil, err\n\t\t\t\t}\n\t\t\t\tid := specs[i].ID.Value.(int64)\n\t\t\t\tnodes[i].ID = int(id)\n\t\t\t\treturn nodes[i], nil\n\t\t\t})\n\t\t\tfor i := len(builder.hooks) - 1; i >= 0; i-- {\n\t\t\t\tmut = builder.hooks[i](mut)\n\t\t\t}\n\t\t\tmutators[i] = mut\n\t\t}(i, ctx)\n\t}\n\tif len(mutators) > 0 {\n\t\tif _, err := mutators[0].Mutate(ctx, etcb.builders[0].mutation); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\treturn nodes, nil\n}", "func (ccb *CompanyCreateBulk) Save(ctx context.Context) ([]*Company, error) {\n\tspecs := make([]*sqlgraph.CreateSpec, len(ccb.builders))\n\tnodes := make([]*Company, len(ccb.builders))\n\tmutators := make([]Mutator, len(ccb.builders))\n\tfor i := range ccb.builders {\n\t\tfunc(i int, root context.Context) {\n\t\t\tbuilder := ccb.builders[i]\n\t\t\tbuilder.defaults()\n\t\t\tvar mut Mutator = MutateFunc(func(ctx context.Context, m Mutation) (Value, error) {\n\t\t\t\tmutation, ok := m.(*CompanyMutation)\n\t\t\t\tif !ok {\n\t\t\t\t\treturn nil, fmt.Errorf(\"unexpected mutation type %T\", m)\n\t\t\t\t}\n\t\t\t\tif err := builder.check(); err != nil {\n\t\t\t\t\treturn nil, err\n\t\t\t\t}\n\t\t\t\tbuilder.mutation = mutation\n\t\t\t\tnodes[i], specs[i] = builder.createSpec()\n\t\t\t\tvar err error\n\t\t\t\tif i < len(mutators)-1 {\n\t\t\t\t\t_, err = mutators[i+1].Mutate(root, ccb.builders[i+1].mutation)\n\t\t\t\t} else {\n\t\t\t\t\t// Invoke the actual operation on the latest mutation in the chain.\n\t\t\t\t\tif err = sqlgraph.BatchCreate(ctx, ccb.driver, &sqlgraph.BatchCreateSpec{Nodes: specs}); err != nil {\n\t\t\t\t\t\tif sqlgraph.IsConstraintError(err) {\n\t\t\t\t\t\t\terr = &ConstraintError{err.Error(), err}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn nil, err\n\t\t\t\t}\n\t\t\t\tmutation.id = &nodes[i].ID\n\t\t\t\tmutation.done = true\n\t\t\t\tid := specs[i].ID.Value.(int64)\n\t\t\t\tnodes[i].ID = int(id)\n\t\t\t\treturn nodes[i], nil\n\t\t\t})\n\t\t\tfor i := len(builder.hooks) - 1; i >= 0; i-- {\n\t\t\t\tmut = builder.hooks[i](mut)\n\t\t\t}\n\t\t\tmutators[i] = mut\n\t\t}(i, ctx)\n\t}\n\tif len(mutators) > 0 {\n\t\tif _, err := mutators[0].Mutate(ctx, ccb.builders[0].mutation); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\treturn nodes, nil\n}", "func (rcb *RestaurantCreateBulk) Save(ctx context.Context) ([]*Restaurant, error) {\n\tspecs := make([]*sqlgraph.CreateSpec, len(rcb.builders))\n\tnodes := make([]*Restaurant, len(rcb.builders))\n\tmutators := make([]Mutator, len(rcb.builders))\n\tfor i := range rcb.builders {\n\t\tfunc(i int, root context.Context) {\n\t\t\tbuilder := rcb.builders[i]\n\t\t\tvar mut Mutator = MutateFunc(func(ctx context.Context, m Mutation) (Value, error) {\n\t\t\t\tmutation, ok := m.(*RestaurantMutation)\n\t\t\t\tif !ok {\n\t\t\t\t\treturn nil, fmt.Errorf(\"unexpected mutation type %T\", m)\n\t\t\t\t}\n\t\t\t\tif err := builder.check(); err != nil {\n\t\t\t\t\treturn nil, err\n\t\t\t\t}\n\t\t\t\tbuilder.mutation = mutation\n\t\t\t\tnodes[i], specs[i] = builder.createSpec()\n\t\t\t\tvar err error\n\t\t\t\tif i < len(mutators)-1 {\n\t\t\t\t\t_, err = mutators[i+1].Mutate(root, rcb.builders[i+1].mutation)\n\t\t\t\t} else {\n\t\t\t\t\t// Invoke the actual operation on the latest mutation in the chain.\n\t\t\t\t\tif err = sqlgraph.BatchCreate(ctx, rcb.driver, &sqlgraph.BatchCreateSpec{Nodes: specs}); err != nil {\n\t\t\t\t\t\tif sqlgraph.IsConstraintError(err) {\n\t\t\t\t\t\t\terr = &ConstraintError{err.Error(), err}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn nil, err\n\t\t\t\t}\n\t\t\t\tmutation.id = &nodes[i].ID\n\t\t\t\tmutation.done = true\n\t\t\t\tid := specs[i].ID.Value.(int64)\n\t\t\t\tnodes[i].ID = int(id)\n\t\t\t\treturn nodes[i], nil\n\t\t\t})\n\t\t\tfor i := len(builder.hooks) - 1; i >= 0; i-- {\n\t\t\t\tmut = builder.hooks[i](mut)\n\t\t\t}\n\t\t\tmutators[i] = mut\n\t\t}(i, ctx)\n\t}\n\tif len(mutators) > 0 {\n\t\tif _, err := mutators[0].Mutate(ctx, rcb.builders[0].mutation); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\treturn nodes, nil\n}", "func (acb *ArticleCreateBulk) Save(ctx context.Context) ([]*Article, error) {\n\tspecs := make([]*sqlgraph.CreateSpec, len(acb.builders))\n\tnodes := make([]*Article, len(acb.builders))\n\tmutators := make([]Mutator, len(acb.builders))\n\tfor i := range acb.builders {\n\t\tfunc(i int, root context.Context) {\n\t\t\tbuilder := acb.builders[i]\n\t\t\tbuilder.defaults()\n\t\t\tvar mut Mutator = MutateFunc(func(ctx context.Context, m Mutation) (Value, error) {\n\t\t\t\tmutation, ok := m.(*ArticleMutation)\n\t\t\t\tif !ok {\n\t\t\t\t\treturn nil, fmt.Errorf(\"unexpected mutation type %T\", m)\n\t\t\t\t}\n\t\t\t\tif err := builder.check(); err != nil {\n\t\t\t\t\treturn nil, err\n\t\t\t\t}\n\t\t\t\tbuilder.mutation = mutation\n\t\t\t\tnodes[i], specs[i] = builder.createSpec()\n\t\t\t\tvar err error\n\t\t\t\tif i < len(mutators)-1 {\n\t\t\t\t\t_, err = mutators[i+1].Mutate(root, acb.builders[i+1].mutation)\n\t\t\t\t} else {\n\t\t\t\t\t// Invoke the actual operation on the latest mutation in the chain.\n\t\t\t\t\tif err = sqlgraph.BatchCreate(ctx, acb.driver, &sqlgraph.BatchCreateSpec{Nodes: specs}); err != nil {\n\t\t\t\t\t\tif cerr, ok := isSQLConstraintError(err); ok {\n\t\t\t\t\t\t\terr = cerr\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tmutation.done = true\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn nil, err\n\t\t\t\t}\n\t\t\t\tif nodes[i].ID == 0 {\n\t\t\t\t\tid := specs[i].ID.Value.(int64)\n\t\t\t\t\tnodes[i].ID = int64(id)\n\t\t\t\t}\n\t\t\t\treturn nodes[i], nil\n\t\t\t})\n\t\t\tfor i := len(builder.hooks) - 1; i >= 0; i-- {\n\t\t\t\tmut = builder.hooks[i](mut)\n\t\t\t}\n\t\t\tmutators[i] = mut\n\t\t}(i, ctx)\n\t}\n\tif len(mutators) > 0 {\n\t\tif _, err := mutators[0].Mutate(ctx, acb.builders[0].mutation); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\treturn nodes, nil\n}", "func (p Database) Bulk(docs []interface{}) ([]Response, error) {\n\tm := map[string]interface{}{}\n\tm[\"docs\"] = docs\n\tjsonBuf, err := json.Marshal(m)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tresults := []Response{}\n\t_, err = interact(\"POST\", p.DBURL()+\"/_bulk_docs\", p.defaultHdrs, jsonBuf, &results)\n\treturn results, err\n}", "func BuildBulkPayload(collectionBulkBody string) (*collection.BulkPayload, error) {\n\tvar err error\n\tvar body BulkRequestBody\n\t{\n\t\terr = json.Unmarshal([]byte(collectionBulkBody), &body)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"invalid JSON for body, \\nerror: %s, \\nexample of valid JSON:\\n%s\", err, \"'{\\n \\\"operation\\\": \\\"cancel\\\",\\n \\\"size\\\": 1,\\n \\\"status\\\": \\\"in progress\\\"\\n }'\")\n\t\t}\n\t\tif !(body.Operation == \"retry\" || body.Operation == \"cancel\" || body.Operation == \"abandon\") {\n\t\t\terr = goa.MergeErrors(err, goa.InvalidEnumValueError(\"body.operation\", body.Operation, []any{\"retry\", \"cancel\", \"abandon\"}))\n\t\t}\n\t\tif !(body.Status == \"new\" || body.Status == \"in progress\" || body.Status == \"done\" || body.Status == \"error\" || body.Status == \"unknown\" || body.Status == \"queued\" || body.Status == \"pending\" || body.Status == \"abandoned\") {\n\t\t\terr = goa.MergeErrors(err, goa.InvalidEnumValueError(\"body.status\", body.Status, []any{\"new\", \"in progress\", \"done\", \"error\", \"unknown\", \"queued\", \"pending\", \"abandoned\"}))\n\t\t}\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\tv := &collection.BulkPayload{\n\t\tOperation: body.Operation,\n\t\tStatus: body.Status,\n\t\tSize: body.Size,\n\t}\n\t{\n\t\tvar zero uint\n\t\tif v.Size == zero {\n\t\t\tv.Size = 100\n\t\t}\n\t}\n\n\treturn v, nil\n}", "func (fcb *FeedCreateBulk) Save(ctx context.Context) ([]*Feed, error) {\n\tspecs := make([]*sqlgraph.CreateSpec, len(fcb.builders))\n\tnodes := make([]*Feed, len(fcb.builders))\n\tmutators := make([]Mutator, len(fcb.builders))\n\tfor i := range fcb.builders {\n\t\tfunc(i int, root context.Context) {\n\t\t\tbuilder := fcb.builders[i]\n\t\t\tvar mut Mutator = MutateFunc(func(ctx context.Context, m Mutation) (Value, error) {\n\t\t\t\tif err := builder.preSave(); err != nil {\n\t\t\t\t\treturn nil, err\n\t\t\t\t}\n\t\t\t\tmutation, ok := m.(*FeedMutation)\n\t\t\t\tif !ok {\n\t\t\t\t\treturn nil, fmt.Errorf(\"unexpected mutation type %T\", m)\n\t\t\t\t}\n\t\t\t\tbuilder.mutation = mutation\n\t\t\t\tnodes[i], specs[i] = builder.createSpec()\n\t\t\t\tvar err error\n\t\t\t\tif i < len(mutators)-1 {\n\t\t\t\t\t_, err = mutators[i+1].Mutate(root, fcb.builders[i+1].mutation)\n\t\t\t\t} else {\n\t\t\t\t\t// Invoke the actual operation on the latest mutation in the chain.\n\t\t\t\t\tif err = sqlgraph.BatchCreate(ctx, fcb.driver, &sqlgraph.BatchCreateSpec{Nodes: specs}); err != nil {\n\t\t\t\t\t\tif cerr, ok := isSQLConstraintError(err); ok {\n\t\t\t\t\t\t\terr = cerr\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tmutation.done = true\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn nil, err\n\t\t\t\t}\n\t\t\t\tif nodes[i].ID == 0 {\n\t\t\t\t\tid := specs[i].ID.Value.(int64)\n\t\t\t\t\tnodes[i].ID = int64(id)\n\t\t\t\t}\n\t\t\t\treturn nodes[i], nil\n\t\t\t})\n\t\t\tfor i := len(builder.hooks) - 1; i >= 0; i-- {\n\t\t\t\tmut = builder.hooks[i](mut)\n\t\t\t}\n\t\t\tmutators[i] = mut\n\t\t}(i, ctx)\n\t}\n\tif len(mutators) > 0 {\n\t\tif _, err := mutators[0].Mutate(ctx, fcb.builders[0].mutation); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\treturn nodes, nil\n}", "func (dscb *DataSourceCreateBulk) Save(ctx context.Context) ([]*DataSource, error) {\n\tspecs := make([]*sqlgraph.CreateSpec, len(dscb.builders))\n\tnodes := make([]*DataSource, len(dscb.builders))\n\tmutators := make([]Mutator, len(dscb.builders))\n\tfor i := range dscb.builders {\n\t\tfunc(i int, root context.Context) {\n\t\t\tbuilder := dscb.builders[i]\n\t\t\tbuilder.defaults()\n\t\t\tvar mut Mutator = MutateFunc(func(ctx context.Context, m Mutation) (Value, error) {\n\t\t\t\tmutation, ok := m.(*DataSourceMutation)\n\t\t\t\tif !ok {\n\t\t\t\t\treturn nil, fmt.Errorf(\"unexpected mutation type %T\", m)\n\t\t\t\t}\n\t\t\t\tif err := builder.check(); err != nil {\n\t\t\t\t\treturn nil, err\n\t\t\t\t}\n\t\t\t\tbuilder.mutation = mutation\n\t\t\t\tnodes[i], specs[i] = builder.createSpec()\n\t\t\t\tvar err error\n\t\t\t\tif i < len(mutators)-1 {\n\t\t\t\t\t_, err = mutators[i+1].Mutate(root, dscb.builders[i+1].mutation)\n\t\t\t\t} else {\n\t\t\t\t\tspec := &sqlgraph.BatchCreateSpec{Nodes: specs}\n\t\t\t\t\t// Invoke the actual operation on the latest mutation in the chain.\n\t\t\t\t\tif err = sqlgraph.BatchCreate(ctx, dscb.driver, spec); err != nil {\n\t\t\t\t\t\tif sqlgraph.IsConstraintError(err) {\n\t\t\t\t\t\t\terr = &ConstraintError{msg: err.Error(), wrap: err}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn nil, err\n\t\t\t\t}\n\t\t\t\tmutation.id = &nodes[i].ID\n\t\t\t\tif specs[i].ID.Value != nil {\n\t\t\t\t\tid := specs[i].ID.Value.(int64)\n\t\t\t\t\tnodes[i].ID = int(id)\n\t\t\t\t}\n\t\t\t\tmutation.done = true\n\t\t\t\treturn nodes[i], nil\n\t\t\t})\n\t\t\tfor i := len(builder.hooks) - 1; i >= 0; i-- {\n\t\t\t\tmut = builder.hooks[i](mut)\n\t\t\t}\n\t\t\tmutators[i] = mut\n\t\t}(i, ctx)\n\t}\n\tif len(mutators) > 0 {\n\t\tif _, err := mutators[0].Mutate(ctx, dscb.builders[0].mutation); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\treturn nodes, nil\n}", "func (dcb *DatasourceCreateBulk) Save(ctx context.Context) ([]*Datasource, error) {\n\tspecs := make([]*sqlgraph.CreateSpec, len(dcb.builders))\n\tnodes := make([]*Datasource, len(dcb.builders))\n\tmutators := make([]Mutator, len(dcb.builders))\n\tfor i := range dcb.builders {\n\t\tfunc(i int, root context.Context) {\n\t\t\tbuilder := dcb.builders[i]\n\t\t\tbuilder.defaults()\n\t\t\tvar mut Mutator = MutateFunc(func(ctx context.Context, m Mutation) (Value, error) {\n\t\t\t\tmutation, ok := m.(*DatasourceMutation)\n\t\t\t\tif !ok {\n\t\t\t\t\treturn nil, fmt.Errorf(\"unexpected mutation type %T\", m)\n\t\t\t\t}\n\t\t\t\tif err := builder.check(); err != nil {\n\t\t\t\t\treturn nil, err\n\t\t\t\t}\n\t\t\t\tbuilder.mutation = mutation\n\t\t\t\tnodes[i], specs[i] = builder.createSpec()\n\t\t\t\tvar err error\n\t\t\t\tif i < len(mutators)-1 {\n\t\t\t\t\t_, err = mutators[i+1].Mutate(root, dcb.builders[i+1].mutation)\n\t\t\t\t} else {\n\t\t\t\t\t// Invoke the actual operation on the latest mutation in the chain.\n\t\t\t\t\tif err = sqlgraph.BatchCreate(ctx, dcb.driver, &sqlgraph.BatchCreateSpec{Nodes: specs}); err != nil {\n\t\t\t\t\t\tif cerr, ok := isSQLConstraintError(err); ok {\n\t\t\t\t\t\t\terr = cerr\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tmutation.done = true\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn nil, err\n\t\t\t\t}\n\t\t\t\tif nodes[i].ID == 0 {\n\t\t\t\t\tid := specs[i].ID.Value.(int64)\n\t\t\t\t\tnodes[i].ID = int64(id)\n\t\t\t\t}\n\t\t\t\treturn nodes[i], nil\n\t\t\t})\n\t\t\tfor i := len(builder.hooks) - 1; i >= 0; i-- {\n\t\t\t\tmut = builder.hooks[i](mut)\n\t\t\t}\n\t\t\tmutators[i] = mut\n\t\t}(i, ctx)\n\t}\n\tif len(mutators) > 0 {\n\t\tif _, err := mutators[0].Mutate(ctx, dcb.builders[0].mutation); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\treturn nodes, nil\n}", "func (secretsManager *SecretsManagerV2) CreateSecretLocksBulkWithContext(ctx context.Context, createSecretLocksBulkOptions *CreateSecretLocksBulkOptions) (result *SecretLocks, response *core.DetailedResponse, err error) {\n\terr = core.ValidateNotNil(createSecretLocksBulkOptions, \"createSecretLocksBulkOptions cannot be nil\")\n\tif err != nil {\n\t\treturn\n\t}\n\terr = core.ValidateStruct(createSecretLocksBulkOptions, \"createSecretLocksBulkOptions\")\n\tif err != nil {\n\t\treturn\n\t}\n\n\tpathParamsMap := map[string]string{\n\t\t\"id\": *createSecretLocksBulkOptions.ID,\n\t}\n\n\tbuilder := core.NewRequestBuilder(core.POST)\n\tbuilder = builder.WithContext(ctx)\n\tbuilder.EnableGzipCompression = secretsManager.GetEnableGzipCompression()\n\t_, err = builder.ResolveRequestURL(secretsManager.Service.Options.URL, `/api/v2/secrets/{id}/locks_bulk`, pathParamsMap)\n\tif err != nil {\n\t\treturn\n\t}\n\n\tfor headerName, headerValue := range createSecretLocksBulkOptions.Headers {\n\t\tbuilder.AddHeader(headerName, headerValue)\n\t}\n\n\tsdkHeaders := common.GetSdkHeaders(\"secrets_manager\", \"V2\", \"CreateSecretLocksBulk\")\n\tfor headerName, headerValue := range sdkHeaders {\n\t\tbuilder.AddHeader(headerName, headerValue)\n\t}\n\tbuilder.AddHeader(\"Accept\", \"application/json\")\n\tbuilder.AddHeader(\"Content-Type\", \"application/json\")\n\n\tif createSecretLocksBulkOptions.Mode != nil {\n\t\tbuilder.AddQuery(\"mode\", fmt.Sprint(*createSecretLocksBulkOptions.Mode))\n\t}\n\n\tbody := make(map[string]interface{})\n\tif createSecretLocksBulkOptions.Locks != nil {\n\t\tbody[\"locks\"] = createSecretLocksBulkOptions.Locks\n\t}\n\t_, err = builder.SetBodyContentJSON(body)\n\tif err != nil {\n\t\treturn\n\t}\n\n\trequest, err := builder.Build()\n\tif err != nil {\n\t\treturn\n\t}\n\n\tvar rawResponse map[string]json.RawMessage\n\tresponse, err = secretsManager.Service.Request(request, &rawResponse)\n\tif err != nil {\n\t\treturn\n\t}\n\tif rawResponse != nil {\n\t\terr = core.UnmarshalModel(rawResponse, \"\", &result, UnmarshalSecretLocks)\n\t\tif err != nil {\n\t\t\treturn\n\t\t}\n\t\tresponse.Result = result\n\t}\n\n\treturn\n}", "func (a *APIGen) BulkCreateIndexPattern(ctx context.Context, indexPatterns []IndexPattern) error {\n\tpanic(\"Should Not Be Called from Gen Pattern.\")\n}", "func (u *Importer) Bulk(c echo.Context, r *esimporter.BulkRequest) ([]byte, int, error) {\n\n\t// Init DB connection, maybe in go routine\n\tdb, err := mssql.New(r.DBHost, r.DBName, r.DBUser, r.DBPass)\n\tif err != nil {\n\t\treturn nil, 0, err\n\t}\n\n\t// Execute bulk stored procedure\n\trows, err := mssql.ExecuteSP(db, r, \"GEN_Elastic_Bulk\")\n\tif err != nil {\n\t\treturn nil, 0, err\n\t}\n\n\tvar payload []byte\n\n\tfor rows.Next() {\n\t\tr := esimporter.ElasticBulkRequest{}\n\n\t\terr := rows.Scan(&r.DocID, &r.BulkInstructions, &r.Source)\n\t\tif err != nil {\n\t\t\treturn nil, 0, err\n\t\t}\n\n\t\t// Get the bulk request in the correct order\n\t\tpayload = append(payload, r.BulkInstructions...)\n\t\tpayload = append(payload, []byte(fmt.Sprintf(\"\\n\"))...)\n\t\tpayload = append(payload, r.Source...)\n\t\tpayload = append(payload, []byte(fmt.Sprintf(\"\\n\"))...)\n\n\t}\n\n\tstatusCode, err := elastic.PostBulk(payload, r)\n\tif err != nil {\n\t\treturn nil, 0, err\n\t}\n\n\treturn payload, statusCode, nil\n}", "func (wcb *WalletCreateBulk) Save(ctx context.Context) ([]*Wallet, error) {\n\tspecs := make([]*sqlgraph.CreateSpec, len(wcb.builders))\n\tnodes := make([]*Wallet, len(wcb.builders))\n\tmutators := make([]Mutator, len(wcb.builders))\n\tfor i := range wcb.builders {\n\t\tfunc(i int, root context.Context) {\n\t\t\tbuilder := wcb.builders[i]\n\t\t\tbuilder.defaults()\n\t\t\tvar mut Mutator = MutateFunc(func(ctx context.Context, m Mutation) (Value, error) {\n\t\t\t\tmutation, ok := m.(*WalletMutation)\n\t\t\t\tif !ok {\n\t\t\t\t\treturn nil, fmt.Errorf(\"unexpected mutation type %T\", m)\n\t\t\t\t}\n\t\t\t\tif err := builder.check(); err != nil {\n\t\t\t\t\treturn nil, err\n\t\t\t\t}\n\t\t\t\tbuilder.mutation = mutation\n\t\t\t\tnodes[i], specs[i] = builder.createSpec()\n\t\t\t\tvar err error\n\t\t\t\tif i < len(mutators)-1 {\n\t\t\t\t\t_, err = mutators[i+1].Mutate(root, wcb.builders[i+1].mutation)\n\t\t\t\t} else {\n\t\t\t\t\tspec := &sqlgraph.BatchCreateSpec{Nodes: specs}\n\t\t\t\t\t// Invoke the actual operation on the latest mutation in the chain.\n\t\t\t\t\tif err = sqlgraph.BatchCreate(ctx, wcb.driver, spec); err != nil {\n\t\t\t\t\t\tif sqlgraph.IsConstraintError(err) {\n\t\t\t\t\t\t\terr = &ConstraintError{msg: err.Error(), wrap: err}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn nil, err\n\t\t\t\t}\n\t\t\t\tmutation.id = &nodes[i].ID\n\t\t\t\tmutation.done = true\n\t\t\t\treturn nodes[i], nil\n\t\t\t})\n\t\t\tfor i := len(builder.hooks) - 1; i >= 0; i-- {\n\t\t\t\tmut = builder.hooks[i](mut)\n\t\t\t}\n\t\t\tmutators[i] = mut\n\t\t}(i, ctx)\n\t}\n\tif len(mutators) > 0 {\n\t\tif _, err := mutators[0].Mutate(ctx, wcb.builders[0].mutation); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\treturn nodes, nil\n}", "func (ftcb *FileTypeCreateBulk) Save(ctx context.Context) ([]*FileType, error) {\n\tspecs := make([]*sqlgraph.CreateSpec, len(ftcb.builders))\n\tnodes := make([]*FileType, len(ftcb.builders))\n\tmutators := make([]Mutator, len(ftcb.builders))\n\tfor i := range ftcb.builders {\n\t\tfunc(i int, root context.Context) {\n\t\t\tbuilder := ftcb.builders[i]\n\t\t\tbuilder.defaults()\n\t\t\tvar mut Mutator = MutateFunc(func(ctx context.Context, m Mutation) (Value, error) {\n\t\t\t\tmutation, ok := m.(*FileTypeMutation)\n\t\t\t\tif !ok {\n\t\t\t\t\treturn nil, fmt.Errorf(\"unexpected mutation type %T\", m)\n\t\t\t\t}\n\t\t\t\tif err := builder.check(); err != nil {\n\t\t\t\t\treturn nil, err\n\t\t\t\t}\n\t\t\t\tbuilder.mutation = mutation\n\t\t\t\tnodes[i], specs[i] = builder.createSpec()\n\t\t\t\tvar err error\n\t\t\t\tif i < len(mutators)-1 {\n\t\t\t\t\t_, err = mutators[i+1].Mutate(root, ftcb.builders[i+1].mutation)\n\t\t\t\t} else {\n\t\t\t\t\tspec := &sqlgraph.BatchCreateSpec{Nodes: specs}\n\t\t\t\t\tspec.OnConflict = ftcb.conflict\n\t\t\t\t\t// Invoke the actual operation on the latest mutation in the chain.\n\t\t\t\t\tif err = sqlgraph.BatchCreate(ctx, ftcb.driver, spec); err != nil {\n\t\t\t\t\t\tif sqlgraph.IsConstraintError(err) {\n\t\t\t\t\t\t\terr = &ConstraintError{msg: err.Error(), wrap: err}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn nil, err\n\t\t\t\t}\n\t\t\t\tmutation.id = &nodes[i].ID\n\t\t\t\tif specs[i].ID.Value != nil {\n\t\t\t\t\tid := specs[i].ID.Value.(int64)\n\t\t\t\t\tnodes[i].ID = int(id)\n\t\t\t\t}\n\t\t\t\tmutation.done = true\n\t\t\t\treturn nodes[i], nil\n\t\t\t})\n\t\t\tfor i := len(builder.hooks) - 1; i >= 0; i-- {\n\t\t\t\tmut = builder.hooks[i](mut)\n\t\t\t}\n\t\t\tmutators[i] = mut\n\t\t}(i, ctx)\n\t}\n\tif len(mutators) > 0 {\n\t\tif _, err := mutators[0].Mutate(ctx, ftcb.builders[0].mutation); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\treturn nodes, nil\n}", "func (rcb *RentalCreateBulk) Save(ctx context.Context) ([]*Rental, error) {\n\tspecs := make([]*sqlgraph.CreateSpec, len(rcb.builders))\n\tnodes := make([]*Rental, len(rcb.builders))\n\tmutators := make([]Mutator, len(rcb.builders))\n\tfor i := range rcb.builders {\n\t\tfunc(i int, root context.Context) {\n\t\t\tbuilder := rcb.builders[i]\n\t\t\tbuilder.defaults()\n\t\t\tvar mut Mutator = MutateFunc(func(ctx context.Context, m Mutation) (Value, error) {\n\t\t\t\tmutation, ok := m.(*RentalMutation)\n\t\t\t\tif !ok {\n\t\t\t\t\treturn nil, fmt.Errorf(\"unexpected mutation type %T\", m)\n\t\t\t\t}\n\t\t\t\tif err := builder.check(); err != nil {\n\t\t\t\t\treturn nil, err\n\t\t\t\t}\n\t\t\t\tbuilder.mutation = mutation\n\t\t\t\tnodes[i], specs[i] = builder.createSpec()\n\t\t\t\tvar err error\n\t\t\t\tif i < len(mutators)-1 {\n\t\t\t\t\t_, err = mutators[i+1].Mutate(root, rcb.builders[i+1].mutation)\n\t\t\t\t} else {\n\t\t\t\t\tspec := &sqlgraph.BatchCreateSpec{Nodes: specs}\n\t\t\t\t\t// Invoke the actual operation on the latest mutation in the chain.\n\t\t\t\t\tif err = sqlgraph.BatchCreate(ctx, rcb.driver, spec); err != nil {\n\t\t\t\t\t\tif sqlgraph.IsConstraintError(err) {\n\t\t\t\t\t\t\terr = &ConstraintError{msg: err.Error(), wrap: err}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn nil, err\n\t\t\t\t}\n\t\t\t\tmutation.id = &nodes[i].ID\n\t\t\t\tif specs[i].ID.Value != nil {\n\t\t\t\t\tid := specs[i].ID.Value.(int64)\n\t\t\t\t\tnodes[i].ID = int(id)\n\t\t\t\t}\n\t\t\t\tmutation.done = true\n\t\t\t\treturn nodes[i], nil\n\t\t\t})\n\t\t\tfor i := len(builder.hooks) - 1; i >= 0; i-- {\n\t\t\t\tmut = builder.hooks[i](mut)\n\t\t\t}\n\t\t\tmutators[i] = mut\n\t\t}(i, ctx)\n\t}\n\tif len(mutators) > 0 {\n\t\tif _, err := mutators[0].Mutate(ctx, rcb.builders[0].mutation); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\treturn nodes, nil\n}", "func (epcb *EntryPointCreateBulk) Save(ctx context.Context) ([]*EntryPoint, error) {\n\tspecs := make([]*sqlgraph.CreateSpec, len(epcb.builders))\n\tnodes := make([]*EntryPoint, len(epcb.builders))\n\tmutators := make([]Mutator, len(epcb.builders))\n\tfor i := range epcb.builders {\n\t\tfunc(i int, root context.Context) {\n\t\t\tbuilder := epcb.builders[i]\n\t\t\tbuilder.defaults()\n\t\t\tvar mut Mutator = MutateFunc(func(ctx context.Context, m Mutation) (Value, error) {\n\t\t\t\tmutation, ok := m.(*EntryPointMutation)\n\t\t\t\tif !ok {\n\t\t\t\t\treturn nil, fmt.Errorf(\"unexpected mutation type %T\", m)\n\t\t\t\t}\n\t\t\t\tif err := builder.check(); err != nil {\n\t\t\t\t\treturn nil, err\n\t\t\t\t}\n\t\t\t\tbuilder.mutation = mutation\n\t\t\t\tnodes[i], specs[i] = builder.createSpec()\n\t\t\t\tvar err error\n\t\t\t\tif i < len(mutators)-1 {\n\t\t\t\t\t_, err = mutators[i+1].Mutate(root, epcb.builders[i+1].mutation)\n\t\t\t\t} else {\n\t\t\t\t\t// Invoke the actual operation on the latest mutation in the chain.\n\t\t\t\t\tif err = sqlgraph.BatchCreate(ctx, epcb.driver, &sqlgraph.BatchCreateSpec{Nodes: specs}); err != nil {\n\t\t\t\t\t\tif cerr, ok := isSQLConstraintError(err); ok {\n\t\t\t\t\t\t\terr = cerr\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tmutation.done = true\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn nil, err\n\t\t\t\t}\n\t\t\t\tid := specs[i].ID.Value.(int64)\n\t\t\t\tnodes[i].ID = int(id)\n\t\t\t\treturn nodes[i], nil\n\t\t\t})\n\t\t\tfor i := len(builder.hooks) - 1; i >= 0; i-- {\n\t\t\t\tmut = builder.hooks[i](mut)\n\t\t\t}\n\t\t\tmutators[i] = mut\n\t\t}(i, ctx)\n\t}\n\tif len(mutators) > 0 {\n\t\tif _, err := mutators[0].Mutate(ctx, epcb.builders[0].mutation); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\treturn nodes, nil\n}", "func (a *BulkApiService) CreateBulkExportExecute(r ApiCreateBulkExportRequest) (*BulkExport, *http.Response, error) {\n\tvar (\n\t\tlocalVarHTTPMethod = http.MethodPost\n\t\tlocalVarPostBody interface{}\n\t\tformFiles []formFile\n\t\tlocalVarReturnValue *BulkExport\n\t)\n\n\tlocalBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, \"BulkApiService.CreateBulkExport\")\n\tif err != nil {\n\t\treturn localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()}\n\t}\n\n\tlocalVarPath := localBasePath + \"/api/v1/bulk/Exports\"\n\n\tlocalVarHeaderParams := make(map[string]string)\n\tlocalVarQueryParams := url.Values{}\n\tlocalVarFormParams := url.Values{}\n\tif r.bulkExport == nil {\n\t\treturn localVarReturnValue, nil, reportError(\"bulkExport is required and must be specified\")\n\t}\n\n\t// to determine the Content-Type header\n\tlocalVarHTTPContentTypes := []string{\"application/json\"}\n\n\t// set Content-Type header\n\tlocalVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)\n\tif localVarHTTPContentType != \"\" {\n\t\tlocalVarHeaderParams[\"Content-Type\"] = localVarHTTPContentType\n\t}\n\n\t// to determine the Accept header\n\tlocalVarHTTPHeaderAccepts := []string{\"application/json\"}\n\n\t// set Accept header\n\tlocalVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)\n\tif localVarHTTPHeaderAccept != \"\" {\n\t\tlocalVarHeaderParams[\"Accept\"] = localVarHTTPHeaderAccept\n\t}\n\tif r.ifMatch != nil {\n\t\tlocalVarHeaderParams[\"If-Match\"] = parameterToString(*r.ifMatch, \"\")\n\t}\n\tif r.ifNoneMatch != nil {\n\t\tlocalVarHeaderParams[\"If-None-Match\"] = parameterToString(*r.ifNoneMatch, \"\")\n\t}\n\t// body params\n\tlocalVarPostBody = r.bulkExport\n\treq, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles)\n\tif err != nil {\n\t\treturn localVarReturnValue, nil, err\n\t}\n\n\tlocalVarHTTPResponse, err := a.client.callAPI(req)\n\tif err != nil || localVarHTTPResponse == nil {\n\t\treturn localVarReturnValue, localVarHTTPResponse, err\n\t}\n\n\tlocalVarBody, err := ioutil.ReadAll(localVarHTTPResponse.Body)\n\tlocalVarHTTPResponse.Body.Close()\n\tlocalVarHTTPResponse.Body = ioutil.NopCloser(bytes.NewBuffer(localVarBody))\n\tif err != nil {\n\t\treturn localVarReturnValue, localVarHTTPResponse, err\n\t}\n\n\tif localVarHTTPResponse.StatusCode >= 300 {\n\t\tnewErr := &GenericOpenAPIError{\n\t\t\tbody: localVarBody,\n\t\t\terror: localVarHTTPResponse.Status,\n\t\t}\n\t\tif localVarHTTPResponse.StatusCode == 400 {\n\t\t\tvar v Error\n\t\t\terr = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\t\t\tif err != nil {\n\t\t\t\tnewErr.error = err.Error()\n\t\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t\t}\n\t\t\tnewErr.model = v\n\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t}\n\t\tif localVarHTTPResponse.StatusCode == 401 {\n\t\t\tvar v Error\n\t\t\terr = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\t\t\tif err != nil {\n\t\t\t\tnewErr.error = err.Error()\n\t\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t\t}\n\t\t\tnewErr.model = v\n\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t}\n\t\tif localVarHTTPResponse.StatusCode == 403 {\n\t\t\tvar v Error\n\t\t\terr = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\t\t\tif err != nil {\n\t\t\t\tnewErr.error = err.Error()\n\t\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t\t}\n\t\t\tnewErr.model = v\n\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t}\n\t\tif localVarHTTPResponse.StatusCode == 404 {\n\t\t\tvar v Error\n\t\t\terr = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\t\t\tif err != nil {\n\t\t\t\tnewErr.error = err.Error()\n\t\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t\t}\n\t\t\tnewErr.model = v\n\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t}\n\t\tvar v Error\n\t\terr = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\t\tif err != nil {\n\t\t\tnewErr.error = err.Error()\n\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t}\n\t\tnewErr.model = v\n\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t}\n\n\terr = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\tif err != nil {\n\t\tnewErr := &GenericOpenAPIError{\n\t\t\tbody: localVarBody,\n\t\t\terror: err.Error(),\n\t\t}\n\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t}\n\n\treturn localVarReturnValue, localVarHTTPResponse, nil\n}", "func CreateInBatch(vmSpecs []types.VMSpec, hostBus chan<- *types.Host) (err error) {\n\n\t// make working directory\n\n\tfor _, vm := range vmSpecs {\n\t\t// go create(vm, driverName, hostBus)\n\n\t\tdriverName := vm.CloudDriverName\n\t\tif driverName == \"\" {\n\t\t\treturn fmt.Errorf(\"driver name is not specified.\")\n\t\t}\n\t\tdriver, err := helpers.InitDrivers(driverName, vm, storePath)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\th := &HostHandler{\n\t\t\tName: vm.Name,\n\t\t\tDriver: driver,\n\t\t\tVMSpec: vm,\n\t\t\tcreateBus: hostBus,\n\t\t}\n\n\t\tgo h.createOrGet()\n\t}\n\n\treturn nil\n\n}", "func (*SecretsManagerV2) NewCreateSecretLocksBulkOptions(id string, locks []SecretLockPrototype) *CreateSecretLocksBulkOptions {\n\treturn &CreateSecretLocksBulkOptions{\n\t\tID: core.StringPtr(id),\n\t\tLocks: locks,\n\t}\n}", "func (bcb *BadgeCreateBulk) Save(ctx context.Context) ([]*Badge, error) {\n\tspecs := make([]*sqlgraph.CreateSpec, len(bcb.builders))\n\tnodes := make([]*Badge, len(bcb.builders))\n\tmutators := make([]Mutator, len(bcb.builders))\n\tfor i := range bcb.builders {\n\t\tfunc(i int, root context.Context) {\n\t\t\tbuilder := bcb.builders[i]\n\t\t\tvar mut Mutator = MutateFunc(func(ctx context.Context, m Mutation) (Value, error) {\n\t\t\t\tmutation, ok := m.(*BadgeMutation)\n\t\t\t\tif !ok {\n\t\t\t\t\treturn nil, fmt.Errorf(\"unexpected mutation type %T\", m)\n\t\t\t\t}\n\t\t\t\tif err := builder.check(); err != nil {\n\t\t\t\t\treturn nil, err\n\t\t\t\t}\n\t\t\t\tbuilder.mutation = mutation\n\t\t\t\tnodes[i], specs[i] = builder.createSpec()\n\t\t\t\tvar err error\n\t\t\t\tif i < len(mutators)-1 {\n\t\t\t\t\t_, err = mutators[i+1].Mutate(root, bcb.builders[i+1].mutation)\n\t\t\t\t} else {\n\t\t\t\t\tspec := &sqlgraph.BatchCreateSpec{Nodes: specs}\n\t\t\t\t\t// Invoke the actual operation on the latest mutation in the chain.\n\t\t\t\t\tif err = sqlgraph.BatchCreate(ctx, bcb.driver, spec); err != nil {\n\t\t\t\t\t\tif sqlgraph.IsConstraintError(err) {\n\t\t\t\t\t\t\terr = &ConstraintError{err.Error(), err}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn nil, err\n\t\t\t\t}\n\t\t\t\tmutation.id = &nodes[i].ID\n\t\t\t\tmutation.done = true\n\t\t\t\tif specs[i].ID.Value != nil {\n\t\t\t\t\tid := specs[i].ID.Value.(int64)\n\t\t\t\t\tnodes[i].ID = int(id)\n\t\t\t\t}\n\t\t\t\treturn nodes[i], nil\n\t\t\t})\n\t\t\tfor i := len(builder.hooks) - 1; i >= 0; i-- {\n\t\t\t\tmut = builder.hooks[i](mut)\n\t\t\t}\n\t\t\tmutators[i] = mut\n\t\t}(i, ctx)\n\t}\n\tif len(mutators) > 0 {\n\t\tif _, err := mutators[0].Mutate(ctx, bcb.builders[0].mutation); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\treturn nodes, nil\n}" ]
[ "0.79458475", "0.7477662", "0.74548864", "0.7348633", "0.73275405", "0.7297809", "0.72799176", "0.7278683", "0.7259438", "0.72226757", "0.71907735", "0.7160374", "0.7107063", "0.7087085", "0.70496774", "0.70415485", "0.70349", "0.7028817", "0.70233285", "0.7005902", "0.70027566", "0.69841105", "0.695164", "0.69384015", "0.6932406", "0.6907853", "0.6862934", "0.6840306", "0.67369497", "0.6728566", "0.67109215", "0.67109215", "0.67109215", "0.67109215", "0.67109215", "0.67081547", "0.6691109", "0.66408986", "0.6622758", "0.6597312", "0.65803254", "0.6541119", "0.6519024", "0.6493131", "0.6477242", "0.64646256", "0.6395229", "0.6181656", "0.61104476", "0.595869", "0.59312296", "0.59177077", "0.5901689", "0.5894527", "0.58755916", "0.5841066", "0.5735316", "0.57335454", "0.55959857", "0.55007035", "0.54554296", "0.5453043", "0.5423148", "0.53917164", "0.53673315", "0.53539294", "0.5304594", "0.52871335", "0.5244262", "0.5223234", "0.52180594", "0.5187539", "0.5184263", "0.5170726", "0.5151125", "0.5147874", "0.5139787", "0.50886095", "0.5088035", "0.5082872", "0.5075305", "0.5074909", "0.50722563", "0.50575507", "0.50339866", "0.5033632", "0.503175", "0.50261986", "0.49940994", "0.49921998", "0.49894387", "0.4962506", "0.4927165", "0.49248794", "0.49127176", "0.49123532", "0.48958293", "0.48739406", "0.48726815", "0.48635593" ]
0.7981331
0
Update returns an update builder for Post.
func (c *PostClient) Update() *PostUpdate { mutation := newPostMutation(c.config, OpUpdate) return &PostUpdate{config: c.config, hooks: c.Hooks(), mutation: mutation} }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (p *postsQueryBuilder) Update() (int64, error) {\n\tif p.err != nil {\n\t\treturn 0, p.err\n\t}\n\treturn p.builder.Update()\n}", "func (po *Post) Update() *PostUpdateOne {\n\treturn NewPostClient(po.config).UpdateOne(po)\n}", "func (u *App) Update(c echo.Context, r *Update) (result *model.Post, err error) {\n\tif err = u.rbac.EnforceRole(c, model.AdminRole); err != nil {\n\t\tzaplog.ZLog(err)\n\t\treturn\n\t}\n\n\tif len(r.Excerpt) > 255 {\n\t\tr.Excerpt = r.Excerpt[:250] + \"...\"\n\t}\n\n\told, err := u.udb.View(u.db, r.ID)\n\tif err = zaplog.ZLog(err); err != nil {\n\t\treturn\n\t}\n\n\tif r.Status != \"\" && old.Status != r.Status && !old.AllowedStatuses(r.Status) {\n\t\terr = zaplog.ZLog(fmt.Errorf(\"Não é possível passar de %s para %s\", old.Status, r.Status))\n\t\treturn\n\t}\n\n\tupdate := model.Post{\n\t\tBase: model.Base{ID: r.ID},\n\t\tAuthor: r.Author,\n\t\tCategory: r.Category,\n\t\tTags: r.Tags,\n\t\tTitle: r.Title,\n\t\tSlug: r.Slug,\n\t\tContent: r.Content,\n\t\tExcerpt: r.Excerpt,\n\t\tStatus: r.Status,\n\t}\n\n\tvar operator model.User\n\tif err = u.db.Model(&model.User{}).Where(\"uuid = ?\", r.Author).First(&operator).Error; err == nil {\n\t\tupdate.AuthorName = operator.Name\n\t}\n\n\tif err = zaplog.ZLog(u.udb.Update(u.db, &update)); err != nil {\n\t\treturn\n\t}\n\treturn u.udb.View(u.db, r.ID)\n}", "func (env *Env) UpdatePost(w http.ResponseWriter, r *http.Request) {\n\tctx := r.Context()\n\ts := bluemonday.UGCPolicy()\n\tuser := ctx.Value(contextUser).(*models.User)\n\t// post ID needs to be sanitized and parsed - return if error parsing\n\tid, err := uuid.Parse(s.Sanitize(r.FormValue(\"id\")))\n\tif err != nil {\n\t\tenv.log(r, err)\n\t\tw.WriteHeader(http.StatusBadRequest)\n\t\treturn\n\t}\n\ttitle := s.Sanitize(r.FormValue(\"title\"))\n\tslug := s.Sanitize(r.FormValue(\"slug\"))\n\tsubtitle := s.Sanitize(r.FormValue(\"subtitle\"))\n\tshort := s.Sanitize(r.FormValue(\"short\"))\n\tcontent := s.Sanitize(r.FormValue(\"content\"))\n\tdigest := s.Sanitize(r.FormValue(\"digest\"))\n\t// published must be parsed into a bool\n\tpublished, err := strconv.ParseBool(s.Sanitize(r.FormValue(\"published\")))\n\tif err != nil {\n\t\tenv.log(r, err)\n\t\tw.WriteHeader(http.StatusBadRequest)\n\t\treturn\n\t}\n\tp, err := env.DB.UpdatePost(id, user.ID, title, slug, subtitle, short, content, digest, published)\n\tif err != nil {\n\t\tenv.log(r, err)\n\t\tw.WriteHeader(http.StatusInternalServerError)\n\t\treturn\n\t}\n\t// Send out updated post\n\tw.Header().Set(\"Content-Type\", \"application/json\")\n\tw.WriteHeader(http.StatusOK)\n\tjson.NewEncoder(w).Encode(p)\n}", "func UpdatePost(c buffalo.Context) error {\n\tauthUser := c.Value(\"authUser\").(models.User)\n\tpost := &models.Post{}\n\tdatabase := c.Value(\"tx\").(*pop.Connection)\n\t// retrieve the existing record\n\tif txErr := database.Find(post, c.Param(\"post_id\")); txErr != nil {\n\n\t\tnotFoundResponse := utils.NewErrorResponse(\n\t\t\thttp.StatusNotFound,\n\t\t\t\"post_id\",\n\t\t\tfmt.Sprintf(\"The requested post %s is removed or move to somewhere else.\", c.Param(\"post_id\")),\n\t\t)\n\t\treturn c.Render(http.StatusNotFound, r.JSON(notFoundResponse))\n\t}\n\t// bind the form input\n\tif bindErr := c.Bind(post); bindErr != nil {\n\t\temptyBodyResponse := utils.NewErrorResponse(\n\t\t\thttp.StatusUnprocessableEntity,\n\t\t\t\"body\",\n\t\t\t\"The request body cannot be empty\",\n\t\t)\n\t\treturn c.Render(http.StatusUnprocessableEntity, r.JSON(emptyBodyResponse))\n\t}\n\tpost.UserID = authUser.ID\n\tvalidationErrors, err := database.ValidateAndUpdate(post)\n\tif err != nil {\n\t\treturn errors.WithStack(err)\n\t}\n\n\tif validationErrors.HasAny() {\n\t\terrResponse := utils.NewValidationErrorResponse(\n\t\t\thttp.StatusUnprocessableEntity,\n\t\t\tvalidationErrors.Errors,\n\t\t)\n\t\treturn c.Render(http.StatusUnprocessableEntity, r.JSON(errResponse))\n\t}\n\n\tresponse := PostResponse{\n\t\tCode: fmt.Sprintf(\"%d\", http.StatusOK),\n\t\tData: post,\n\t}\n\n\treturn c.Render(http.StatusOK, r.JSON(response))\n}", "func (c *UnsavedPostClient) Update() *UnsavedPostUpdate {\n\tmutation := newUnsavedPostMutation(c.config, OpUpdate)\n\treturn &UnsavedPostUpdate{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func Update(c *gin.Context) {\r\n\toldpost := getById(c)\r\n\tvar newpost Post\r\n\tif err := c.ShouldBindJSON(&newpost); err != nil {\r\n\t\tc.JSON(http.StatusBadRequest, gin.H{\r\n\t\t\t\"messege\": err.Error(),\r\n\t\t\t\"data\": \"\",\r\n\t\t})\r\n\t\treturn\r\n\t}\r\n\toldpost.Title = newpost.Title\r\n\toldpost.Des = newpost.Des\r\n\tif newpost.Status != \"\" {\r\n\t\toldpost.Status = newpost.Status\r\n\t}\r\n\r\n\tdb.Save(&oldpost)\r\n\r\n\tc.JSON(http.StatusOK, gin.H{\r\n\t\t\"messege\": \"Post has been updated\",\r\n\t\t\"data\": oldpost,\r\n\t})\r\n}", "func UpdatePost(request *models.Post, ID string) (*models.Post, error) {\n\tctx := context.Background()\n\tclient, err := firestore.NewClient(ctx, os.Getenv(\"PROJECT_ID\"))\n\tif err != nil {\n\t\tlog.Fatalf(\"Failed to create a Firestore Client: %v\", err)\n\t\treturn nil, err\n\t}\n\n\tdefer client.Close()\n\n\t_, err = client.Collection(collectionPosts).Doc(ID).Update(ctx, []firestore.Update{\n\t\t{\n\t\t\tPath: \"title\",\n\t\t\tValue: request.Title,\n\t\t},\n\t\t{\n\t\t\tPath: \"text\",\n\t\t\tValue: request.Text,\n\t\t},\n\t\t{\n\t\t\tPath: \"date\",\n\t\t\tValue: request.Date,\n\t\t},\n\t\t{\n\t\t\tPath: \"price\",\n\t\t\tValue: request.Price,\n\t\t},\n\t\t{\n\t\t\tPath: \"auhtors\",\n\t\t\tValue: request.Authors,\n\t\t},\n\t\t{\n\t\t\tPath: \"published\",\n\t\t\tValue: request.Published,\n\t\t},\n\t})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn request, nil\n}", "func (c *PostAttachmentClient) Update() *PostAttachmentUpdate {\n\tmutation := newPostAttachmentMutation(c.config, OpUpdate)\n\treturn &PostAttachmentUpdate{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (b *blogsQueryBuilder) Update() (int64, error) {\n\tif b.err != nil {\n\t\treturn 0, b.err\n\t}\n\treturn b.builder.Update()\n}", "func (server *Server) UpdatePost(w http.ResponseWriter, r *http.Request) {\n\tvar code = http.StatusBadRequest\n\tvar uid uint32\n\tvar body []byte\n\tvars := mux.Vars(r)\n\tpost := models.Post{}\n\tpostUpdate := models.Post{}\n\tvar postUpdated *models.Post\n\t// Check if the post id is valid\n\tpid, err := strconv.ParseUint(vars[\"id\"], 10, 64)\n\tif err != nil {\n\t\tgoto Error\n\t}\n\n\t//CHeck if the auth token is valid and get the user id from it\n\tuid, err = middlewares.ExtractTokenID(r)\n\tif err != nil {\n\t\terr = errors.New(\"Unauthorized\")\n\t\tcode = http.StatusUnauthorized\n\t\tgoto Error\n\t}\n\n\t// Check if the post exist\n\terr = server.DB.Debug().Model(models.Post{}).Where(\"id = ?\", pid).Take(&post).Error\n\tif err != nil {\n\t\terr = errors.New(\"Post not found\")\n\t\tcode = http.StatusNotFound\n\t\tgoto Error\n\t}\n\n\t// If a user attempt to update a post not belonging to him\n\tif uid != post.AuthorID {\n\t\terr = errors.New(\"Unauthorized\")\n\t\tcode = http.StatusUnauthorized\n\t\tgoto Error\n\t}\n\n\tif body, err = server.ParseRequest(w, r); err != nil {\n\t\tcode = http.StatusUnprocessableEntity\n\t\tgoto Error\n\t}\n\terr = json.Unmarshal(body, &postUpdate)\n\tif err != nil {\n\t\tcode = http.StatusUnprocessableEntity\n\t\tgoto Error\n\t}\n\n\t//Also check if the request user id is equal to the one gotten from token\n\tif uid != postUpdate.AuthorID {\n\t\terr = errors.New(\"Unauthorized\")\n\t\tcode = http.StatusUnauthorized\n\t\tgoto Error\n\t}\n\n\tpostUpdate.Prepare()\n\terr = postUpdate.Validate()\n\tif err != nil {\n\t\tcode = http.StatusUnprocessableEntity\n\t\tgoto Error\n\t}\n\n\tpostUpdate.ID = post.ID //this is important to tell the model the post id to update, the other update field are set above\n\tpostUpdated, err = postUpdate.UpdateAPost(server.DB)\n\n\tif err != nil {\n\t\tformattedError := formaterror.FormatError(err.Error())\n\t\tmiddlewares.ERROR(w, http.StatusInternalServerError, formattedError)\n\t\tlogger.WriteLog(r, http.StatusInternalServerError, formattedError, server.GetCurrentFuncName())\n\t\treturn\n\t}\n\tcode = http.StatusOK\n\tmiddlewares.JSON(w, code, postUpdated)\n\tlogger.WriteLog(r, code, nil, server.GetCurrentFuncName())\n\treturn\nError:\n\tmiddlewares.ERROR(w, code, err)\n\tlogger.WriteLog(r, code, err, server.GetCurrentFuncName())\n}", "func (svc *AdminBuildService) Update(b *library.Build) (*library.Build, *Response, error) {\n\t// set the API endpoint path we send the request to\n\tu := \"/api/v1/admin/build\"\n\n\t// library Build type we want to return\n\tv := new(library.Build)\n\n\t// send request using client\n\tresp, err := svc.client.Call(\"PUT\", u, b, v)\n\n\treturn v, resp, err\n}", "func (o *Post) Update(ctx context.Context, exec boil.ContextExecutor, columns boil.Columns) (int64, error) {\n\tcurrTime := time.Now().In(boil.GetLocation())\n\n\to.UpdatedAt = currTime\n\n\tvar err error\n\tif err = o.doBeforeUpdateHooks(ctx, exec); err != nil {\n\t\treturn 0, err\n\t}\n\tkey := makeCacheKey(columns, nil)\n\tpostUpdateCacheMut.RLock()\n\tcache, cached := postUpdateCache[key]\n\tpostUpdateCacheMut.RUnlock()\n\n\tif !cached {\n\t\twl := columns.UpdateColumnSet(\n\t\t\tpostColumns,\n\t\t\tpostPrimaryKeyColumns,\n\t\t)\n\n\t\tif !columns.IsWhitelist() {\n\t\t\twl = strmangle.SetComplement(wl, []string{\"created_at\"})\n\t\t}\n\t\tif len(wl) == 0 {\n\t\t\treturn 0, errors.New(\"orm: unable to update posts, could not build whitelist\")\n\t\t}\n\n\t\tcache.query = fmt.Sprintf(\"UPDATE \\\"posts\\\" SET %s WHERE %s\",\n\t\t\tstrmangle.SetParamNames(\"\\\"\", \"\\\"\", 1, wl),\n\t\t\tstrmangle.WhereClause(\"\\\"\", \"\\\"\", len(wl)+1, postPrimaryKeyColumns),\n\t\t)\n\t\tcache.valueMapping, err = queries.BindMapping(postType, postMapping, append(wl, postPrimaryKeyColumns...))\n\t\tif err != nil {\n\t\t\treturn 0, err\n\t\t}\n\t}\n\n\tvalues := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(o)), cache.valueMapping)\n\n\tif boil.DebugMode {\n\t\tfmt.Fprintln(boil.DebugWriter, cache.query)\n\t\tfmt.Fprintln(boil.DebugWriter, values)\n\t}\n\n\tvar result sql.Result\n\tresult, err = exec.ExecContext(ctx, cache.query, values...)\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"orm: unable to update posts row\")\n\t}\n\n\trowsAff, err := result.RowsAffected()\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"orm: failed to get rows affected by update for posts\")\n\t}\n\n\tif !cached {\n\t\tpostUpdateCacheMut.Lock()\n\t\tpostUpdateCache[key] = cache\n\t\tpostUpdateCacheMut.Unlock()\n\t}\n\n\treturn rowsAff, o.doAfterUpdateHooks(ctx, exec)\n}", "func (pr postRepository) Update(id string, p Post) error {\n\treturn pr.getCollection().Update(bson.M{\"_id\": bson.ObjectIdHex(id)}, p)\n}", "func Update(table string) *UpdateBuilder {\n\treturn NewUpdateBuilder(table)\n}", "func (b *Builder) Update(updates ...Eq) *Builder {\r\n\tb.updates = updates\r\n\tb.optype = updateType\r\n\treturn b\r\n}", "func Update(ctx *sweetygo.Context) error {\n\toldTitle := ctx.Param(\"title\") // from url\n\tnewTitle := ctx.Param(\"new-title\") // from form\n\tcat := ctx.Param(\"cat\")\n\thtml := ctx.Param(\"html\")\n\tmd := ctx.Param(\"md\")\n\tif newTitle != \"\" && cat != \"\" && html != \"\" && md != \"\" {\n\t\terr := model.UpdatePost(newTitle, cat, html, md, oldTitle)\n\t\tif err != nil {\n\t\t\treturn ctx.JSON(500, 0, \"update post error\", nil)\n\t\t}\n\t\treturn ctx.JSON(201, 1, \"success\", nil)\n\t}\n\treturn ctx.JSON(406, 0, \"I can't understand what u want\", nil)\n}", "func UpdateOne(w http.ResponseWriter, r *http.Request) {\n\tpostID := mux.Vars(r)[\"id\"]\n\tvar editPost EditPostDto\n\tif err := json.NewDecoder(r.Body).Decode(&editPost); err != nil {\n\t\tresponse.Error(w, http.StatusBadGateway, err.Error())\n\t\treturn\n\t}\n\n\tresult, err := editPost.EditPost(postID)\n\tif err != nil {\n\t\tresponse.Error(w, http.StatusBadGateway, err.Error())\n\t\treturn\n\t}\n\tresponse.Success(w, r,\n\t\thttp.StatusOK,\n\t\tresult,\n\t)\n\treturn\n}", "func UpdatePostHandler(w http.ResponseWriter, r *http.Request, params httprouter.Params) {\n\turl := fmt.Sprintf(\"%s/%s\", postsUrl, params.ByName(\"id\"))\n\tresponse, err := restClient.Put(url, r, r.Header)\n\n\tif err != nil {\n\t\trestClient.WriteErrorResponse(w, \"server_error\", \"Server error occured\")\n\t\treturn\n\t}\n\n\tvar post Post\n\trestClient.WriteJSONResponse(w, response, post)\n}", "func (b *Blog) Update() *BlogUpdateOne {\n\treturn NewBlogClient(b.config).UpdateOne(b)\n}", "func (c *UnsavedPostAttachmentClient) Update() *UnsavedPostAttachmentUpdate {\n\tmutation := newUnsavedPostAttachmentMutation(c.config, OpUpdate)\n\treturn &UnsavedPostAttachmentUpdate{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (cmd *UpdatePostCommand) Run(c *client.Client, args []string) error {\n\tvar path string\n\tif len(args) > 0 {\n\t\tpath = args[0]\n\t} else {\n\t\tpath = fmt.Sprintf(\"/posts/%v\", cmd.PostID)\n\t}\n\tvar payload client.UpdatePostPayload\n\tif cmd.Payload != \"\" {\n\t\terr := json.Unmarshal([]byte(cmd.Payload), &payload)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"failed to deserialize payload: %s\", err)\n\t\t}\n\t}\n\tlogger := goa.NewLogger(log.New(os.Stderr, \"\", log.LstdFlags))\n\tctx := goa.WithLogger(context.Background(), logger)\n\tresp, err := c.UpdatePost(ctx, path, &payload)\n\tif err != nil {\n\t\tgoa.LogError(ctx, \"failed\", \"err\", err)\n\t\treturn err\n\t}\n\n\tgoaclient.HandleResponse(c.Client, resp, PrettyPrint)\n\treturn nil\n}", "func Update(table string) *UpdateBuilder {\n\treturn DefaultFlavor.NewUpdateBuilder().Update(table)\n}", "func UpdatePost(req *http.Request, params martini.Params, s sessions.Session, res render.Render, entry Post) {\n\tvar post Post\n\tpost.Slug = params[\"slug\"]\n\tpost, err := post.Get()\n\tif err != nil {\n\t\tlog.Println(err)\n\t\tif err.Error() == \"not found\" {\n\t\t\tres.JSON(404, NotFound())\n\t\t\treturn\n\t\t}\n\t\tres.JSON(500, map[string]interface{}{\"error\": \"Internal server error\"})\n\t\treturn\n\t}\n\n\tpost, err = post.Update(s, entry)\n\tif err != nil {\n\t\tlog.Println(err)\n\t\tif err.Error() == \"unauthorized\" {\n\t\t\tres.JSON(401, map[string]interface{}{\"error\": \"Unauthorized\"})\n\t\t\treturn\n\t\t}\n\t\tres.JSON(500, map[string]interface{}{\"error\": \"Internal server error\"})\n\t\treturn\n\t}\n\n\tswitch Root(req) {\n\tcase \"api\":\n\t\tres.JSON(200, post)\n\t\treturn\n\tcase \"post\":\n\t\tres.Redirect(\"/user\", 302)\n\t\treturn\n\t}\n}", "func (c *BuildingClient) Update() *BuildingUpdate {\n\tmutation := newBuildingMutation(c.config, OpUpdate)\n\treturn &BuildingUpdate{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (qs ControlQS) Update() ControlUpdateQS {\n\treturn ControlUpdateQS{condFragments: qs.condFragments}\n}", "func (c *commentsQueryBuilder) Update() (int64, error) {\n\tif c.err != nil {\n\t\treturn 0, c.err\n\t}\n\treturn c.builder.Update()\n}", "func (c *PostImageClient) Update() *PostImageUpdate {\n\tmutation := newPostImageMutation(c.config, OpUpdate)\n\treturn &PostImageUpdate{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (d *UpdateBuilder) UpdateBuilder(setMap map[string]interface{}) squirrel.UpdateBuilder {\n\tqry := squirrel.Update(d.table).SetMap(setMap)\n\tif d.HasJoins() {\n\t\twith, where := d.preparePrefixExprForCondition()\n\t\tqry = qry.PrefixExpr(with).Where(where)\n\t} else {\n\t\tparams := d.generateConditionOptionPreprocessParams()\n\t\tqry = ApplyPaging(d.StatementBuilder, qry)\n\t\tqry = ApplySort(d.StatementBuilder, params, qry)\n\t\tqry = ApplyConditions(d.Where, params, qry)\n\t}\n\treturn qry\n}", "func NewUpdateBuilder() *UpdateBuilder {\n\treturn &UpdateBuilder{}\n}", "func (qs DaytypeQS) Update() DaytypeUpdateQS {\n\treturn DaytypeUpdateQS{condFragments: qs.condFragments}\n}", "func (ctl *NoteController) Update(c *gin.Context) {\n\t// parse id\n\tid, err := parseID(c)\n\tif err != nil {\n\t\treturn\n\t}\n\n\t// find\n\tform := models.Note{ID: id}\n\tif err := models.DB().Select(&form); err != nil {\n\t\tc.JSON(http.StatusInternalServerError, Error(err))\n\t\treturn\n\t}\n\n\t// binding\n\tif err := c.ShouldBindJSON(&form); err != nil {\n\t\tc.JSON(http.StatusBadRequest, Error(err))\n\t\treturn\n\t}\n\n\t// updates\n\tif err := models.DB().Update(&form); err != nil {\n\t\tc.JSON(http.StatusInternalServerError, Error(err))\n\t\treturn\n\t}\n\n\tc.JSON(http.StatusOK, form)\n}", "func (repository Posts) Update(postID uint64, post models.Post) error {\n\tdbStatement, err := repository.db.Prepare(\n\t\t\"UPDATE posts SET title = ?, content = ? WHERE id = ?\",\n\t)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer dbStatement.Close()\n\n\tif _, err = dbStatement.Exec(post.Title, post.Content, postID); err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func (p *Post) UpdateFromRequest(r *http.Request) {\n\tid := r.FormValue(\"id\")\n\tif bson.IsObjectIdHex(id) {\n\t\tp.Id = bson.ObjectIdHex(id)\n\t}\n\tp.Title = r.FormValue(\"title\")\n\tp.Image = r.FormValue(\"image\")\n\tp.Slug = r.FormValue(\"slug\")\n\tp.Markdown = r.FormValue(\"content\")\n\tp.Html = utils.Markdown2Html(p.Markdown)\n\tp.AllowComment = r.FormValue(\"comment\") == \"on\"\n\tp.Category = r.FormValue(\"category\")\n\tp.IsPublished = r.FormValue(\"status\") == \"on\"\n}", "func (c *BedtypeClient) Update() *BedtypeUpdate {\n\tmutation := newBedtypeMutation(c.config, OpUpdate)\n\treturn &BedtypeUpdate{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (r *resourceFrameworkShare) Update(ctx context.Context, req resource.UpdateRequest, resp *resource.UpdateResponse) {\n}", "func (d *PostDataStore) UpdatePost(p *model.Post) (err error) {\n\tif err = d.DBHandler.Update(p).Error; err != nil {\n\t\treturn\n\t}\n\treturn\n}", "func (s service) UpdatePost(pos *Post, id uint) (*Post, error) {\n\treturn (*s.repo).UpdatePost(pos, id)\n}", "func (r *PolicySetRequest) Update(ctx context.Context, reqObj *PolicySet) error {\n\treturn r.JSONRequest(ctx, \"PATCH\", \"\", reqObj, nil)\n}", "func (g guildMemberQueryBuilder) UpdateBuilder() UpdateGuildMemberBuilder {\n\tbuilder := &updateGuildMemberBuilder{}\n\tbuilder.r.itemFactory = func() interface{} {\n\t\treturn &Member{\n\t\t\tGuildID: g.gid,\n\t\t\tUserID: g.uid,\n\t\t}\n\t}\n\tbuilder.r.flags = g.flags\n\tbuilder.r.setup(g.client.req, &httd.Request{\n\t\tMethod: http.MethodPatch,\n\t\tCtx: g.ctx,\n\t\tEndpoint: endpoint.GuildMember(g.gid, g.uid),\n\t\tContentType: httd.ContentTypeJSON,\n\t}, nil)\n\n\t// TODO: cache member changes\n\treturn builder\n}", "func (c *PostThumbnailClient) Update() *PostThumbnailUpdate {\n\tmutation := newPostThumbnailMutation(c.config, OpUpdate)\n\treturn &PostThumbnailUpdate{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (h Handler) Update(w http.ResponseWriter, r *http.Request, p httprouter.Params) {\n\tdata := postData{}\n\terr := json.NewDecoder(r.Body).Decode(&data)\n\tif err != nil {\n\t\th.log.Println(err)\n\t\tres := response.Resp{\n\t\t\tStatus: \"error\",\n\t\t\tData: \"There was an problem, please try again\",\n\t\t}\n\t\tresponse.Writer(w, res)\n\t\treturn\n\t}\n\tif data.Name == \"\" || data.Desc == \"\" {\n\t\tres := response.Resp{\n\t\t\tStatus: \"error\",\n\t\t\tData: \"Empty post values\",\n\t\t}\n\t\tresponse.Writer(w, res)\n\t\treturn\n\t}\n\tid, err := strconv.ParseUint(p.ByName(\"id\"), 10, 64)\n\tif err != nil {\n\t\th.log.Println(err)\n\t\tres := response.Resp{\n\t\t\tStatus: \"error\",\n\t\t\tData: \"There was an problem, please try again\",\n\t\t}\n\t\tresponse.Writer(w, res)\n\t\treturn\n\t}\n\ttodo, err := h.m.Update(id, model.Todo{Name: data.Name, Description: data.Desc})\n\tif err != nil {\n\t\th.log.Println(err)\n\t\tres := response.Resp{\n\t\t\tStatus: \"error\",\n\t\t\tData: \"There was an problem, please try again\",\n\t\t}\n\t\tresponse.Writer(w, res)\n\t\treturn\n\t}\n\tres := response.Resp{\n\t\tStatus: \"succes\",\n\t\tData: todo,\n\t}\n\tresponse.Writer(w, res)\n}", "func (c *MealplanClient) Update() *MealplanUpdate {\n\tmutation := newMealplanMutation(c.config, OpUpdate)\n\treturn &MealplanUpdate{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func HandleUpdate(w http.ResponseWriter, r *http.Request) error {\n\n\t// Fetch the params\n\tparams, err := mux.Params(r)\n\tif err != nil {\n\t\treturn server.InternalError(err)\n\t}\n\n\t// Find the post\n\tpost, err := posts.Find(params.GetInt(posts.KeyName))\n\tif err != nil {\n\t\treturn server.NotFoundError(err)\n\t}\n\n\t// Check the authenticity token\n\terr = session.CheckAuthenticity(w, r)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Authorise update post\n\tuser := session.CurrentUser(w, r)\n\terr = can.Update(post, user)\n\tif err != nil {\n\t\treturn server.NotAuthorizedError(err)\n\t}\n\n\t// Validate the params, removing any we don't accept\n\tpostParams := post.ValidateParams(params.Map(), posts.AllowedParams())\n\n\terr = post.Update(postParams)\n\tif err != nil {\n\t\treturn server.InternalError(err)\n\t}\n\n\t// Redirect to post\n\treturn server.Redirect(w, r, post.ShowURL())\n}", "func Update(updates ...Eq) *Builder {\r\n\tbuilder := &Builder{cond: NewCond()}\r\n\treturn builder.Update(updates...)\r\n}", "func (d *Demo) Update() *DemoUpdateOne {\n\treturn (&DemoClient{config: d.config}).UpdateOne(d)\n}", "func (r *Entity) Update() (result sql.Result, err error) {\n\treturn Model.Data(r).Where(gdb.GetWhereConditionOfStruct(r)).Update()\n}", "func (r *Entity) Update() (result sql.Result, err error) {\n\treturn Model.Data(r).Where(gdb.GetWhereConditionOfStruct(r)).Update()\n}", "func (r *Entity) Update() (result sql.Result, err error) {\n\treturn Model.Data(r).Where(gdb.GetWhereConditionOfStruct(r)).Update()\n}", "func (r *Entity) Update() (result sql.Result, err error) {\n\treturn Model.Data(r).Where(gdb.GetWhereConditionOfStruct(r)).Update()\n}", "func (r *Entity) Update() (result sql.Result, err error) {\n\treturn Model.Data(r).Where(gdb.GetWhereConditionOfStruct(r)).Update()\n}", "func (t *PgAttributeType) Update() *qb.UpdateBuilder {\n\treturn t.table.Update()\n}", "func (s *Store) Update(w http.ResponseWriter, r *http.Request) {\n\t// We don't set up the: \"defer dphttp.DrainBody(r)\" here, as the body is fully read in function unmarshalInstance() below\n\t// and a call to DrainBody() puts this error: \"invalid Read on closed Body\" into the logs - to no good effect\n\t// because there is no more body to be read - so instead we just set up the usual Close() on the Body.\n\tdefer func() {\n\t\tif bodyCloseErr := r.Body.Close(); bodyCloseErr != nil {\n\t\t\tlog.Error(r.Context(), \"could not close response body\", bodyCloseErr)\n\t\t}\n\t}()\n\n\tctx := r.Context()\n\tvars := mux.Vars(r)\n\tinstanceID := vars[\"instance_id\"]\n\teTag := getIfMatch(r)\n\n\tlogData := log.Data{\"instance_id\": instanceID}\n\n\tinstance, err := unmarshalInstance(ctx, r.Body, false)\n\tif err != nil {\n\t\tlog.Error(ctx, \"update instance: failed unmarshalling json to model\", err, logData)\n\t\thandleInstanceErr(ctx, taskError{error: err, status: 400}, w, logData)\n\t\treturn\n\t}\n\n\tif err = validateInstanceUpdate(instance); err != nil {\n\t\thandleInstanceErr(ctx, taskError{error: err, status: 400}, w, logData)\n\t\treturn\n\t}\n\n\t// acquire instance lock so that the dp-graph call to AddVersionDetailsToInstance and the mongoDB update are atomic\n\tlockID, err := s.AcquireInstanceLock(ctx, instanceID)\n\tif err != nil {\n\t\tlog.Error(ctx, \"update instance: failed to lock the instance\", err, logData)\n\t\thandleInstanceErr(ctx, taskError{error: err, status: http.StatusInternalServerError}, w, logData)\n\t\treturn\n\t}\n\tdefer s.UnlockInstance(ctx, lockID)\n\n\t// Get the current document\n\tcurrentInstance, err := s.GetInstance(ctx, instanceID, eTag)\n\tif err != nil {\n\t\tlog.Error(ctx, \"update instance: store.GetInstance returned error\", err, logData)\n\t\thandleInstanceErr(ctx, err, w, logData)\n\t\treturn\n\t}\n\n\tlogData[\"current_state\"] = currentInstance.State\n\tlogData[\"requested_state\"] = instance.State\n\tif instance.State != \"\" && instance.State != currentInstance.State {\n\t\tif err = validateInstanceStateUpdate(instance, currentInstance); err != nil {\n\t\t\tlog.Error(ctx, \"update instance: instance state invalid\", err, logData)\n\t\t\thandleInstanceErr(ctx, err, w, logData)\n\t\t\treturn\n\t\t}\n\t}\n\n\tdatasetID := currentInstance.Links.Dataset.ID\n\n\t// edition confirmation is a one time process - cannot be edited for an instance once done\n\tif instance.State == models.EditionConfirmedState && instance.Version == 0 {\n\t\tif instance.Edition == \"\" {\n\t\t\tinstance.Edition = currentInstance.Edition\n\t\t}\n\n\t\tedition := instance.Edition\n\t\teditionLogData := log.Data{\"instance_id\": instanceID, \"dataset_id\": datasetID, \"edition\": edition}\n\n\t\teditionDoc, editionConfirmErr := s.confirmEdition(ctx, datasetID, edition, instanceID)\n\t\tif editionConfirmErr != nil {\n\t\t\tlog.Error(ctx, \"update instance: store.getEdition returned an error\", editionConfirmErr, editionLogData)\n\t\t\thandleInstanceErr(ctx, editionConfirmErr, w, logData)\n\t\t\treturn\n\t\t}\n\n\t\t// update instance with confirmed edition details\n\t\tinstance.Links = currentInstance.Links\n\t\tinstance.Links.Edition = &models.LinkObject{\n\t\t\tID: instance.Edition,\n\t\t\tHRef: editionDoc.Next.Links.Self.HRef,\n\t\t}\n\n\t\tinstance.Links.Version = editionDoc.Next.Links.LatestVersion\n\t\tinstance.Version, editionConfirmErr = strconv.Atoi(editionDoc.Next.Links.LatestVersion.ID)\n\t\tif editionConfirmErr != nil {\n\t\t\tlog.Error(ctx, \"update instance: failed to convert edition latestVersion id to instance.version int\", editionConfirmErr, editionLogData)\n\t\t\thandleInstanceErr(ctx, editionConfirmErr, w, logData)\n\t\t\treturn\n\t\t}\n\n\t\t// update dp-graph instance node (only for non-cantabular types)\n\t\tif currentInstance.Type == models.CantabularBlob.String() || currentInstance.Type == models.CantabularTable.String() || currentInstance.Type == models.CantabularFlexibleTable.String() || currentInstance.Type == models.CantabularMultivariateTable.String() {\n\t\t\teditionLogData[\"instance_type\"] = instance.Type\n\t\t\tlog.Info(ctx, \"skipping dp-graph instance update because it is not required by instance type\", editionLogData)\n\t\t} else {\n\t\t\tif versionErr := s.AddVersionDetailsToInstance(ctx, currentInstance.InstanceID, datasetID, edition, instance.Version); versionErr != nil {\n\t\t\t\tlog.Error(ctx, \"update instance: datastore.AddVersionDetailsToInstance returned an error\", versionErr, editionLogData)\n\t\t\t\thandleInstanceErr(ctx, versionErr, w, logData)\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\n\t\tlog.Info(ctx, \"update instance: added version details to instance\", editionLogData)\n\t}\n\n\t// Set the current mongo timestamp on instance document\n\tinstance.UniqueTimestamp = currentInstance.UniqueTimestamp\n\tnewETag, err := s.UpdateInstance(ctx, currentInstance, instance, eTag)\n\tif err != nil {\n\t\tlog.Error(ctx, \"update instance: store.UpdateInstance returned an error\", err, logData)\n\t\thandleInstanceErr(ctx, err, w, logData)\n\t\treturn\n\t}\n\n\tif instance, err = s.GetInstance(ctx, instanceID, newETag); err != nil {\n\t\tlog.Error(ctx, \"update instance: store.GetInstance for response returned an error\", err, logData)\n\t\thandleInstanceErr(ctx, err, w, logData)\n\t\treturn\n\t}\n\n\tb, err := json.Marshal(instance)\n\tif err != nil {\n\t\tlog.Error(ctx, \"add instance: failed to marshal instance to json\", err, logData)\n\t\thandleInstanceErr(ctx, err, w, logData)\n\t\treturn\n\t}\n\n\tsetJSONContentType(w)\n\tdpresponse.SetETag(w, newETag)\n\tw.WriteHeader(http.StatusOK)\n\twriteBody(ctx, w, b, logData)\n\n\tlog.Info(ctx, \"update instance: request successful\", logData)\n}", "func (c *UnsavedPostImageClient) Update() *UnsavedPostImageUpdate {\n\tmutation := newUnsavedPostImageMutation(c.config, OpUpdate)\n\treturn &UnsavedPostImageUpdate{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func NewUpdateBuilder() *UpdateBuilder {\n\treturn DefaultFlavor.NewUpdateBuilder()\n}", "func Update() *UpdateOptions {\n\treturn &UpdateOptions{}\n}", "func (w *Wrapper) Update(data interface{}) (err error) {\n\tw.query = w.buildUpdate(data)\n\t_, err = w.executeQuery()\n\treturn\n}", "func (c *Client) Update(d Document, query interface{}, extraArgs url.Values) (*Response, error) {\n\tr := Request{\n\t\tQuery: query,\n\t\tIndexList: []string{d.Index.(string)},\n\t\tTypeList: []string{d.Type},\n\t\tExtraArgs: extraArgs,\n\t\tMethod: \"POST\",\n\t\tAPI: \"_update\",\n\t}\n\n\tif d.ID != nil {\n\t\tr.ID = d.ID.(string)\n\t}\n\n\treturn c.Do(&r)\n}", "func (c *PostVideoClient) Update() *PostVideoUpdate {\n\tmutation := newPostVideoMutation(c.config, OpUpdate)\n\treturn &PostVideoUpdate{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func Update(c *gin.Context) {\n\tvar (\n\t\tp updateEnvironment\n\t)\n\tif err := c.ShouldBind(&p); err != nil {\n\t\tc.JSON(http.StatusBadRequest, gin.H{\"error\": err.Error()})\n\t\treturn\n\t}\n\n\terr := p.update()\n\tif err != nil {\n\t\tlog.Error().Err(err).Msg(\"Error occured while performing db query\")\n\t\tc.JSON(http.StatusInternalServerError, gin.H{\"error\": \"Internal Server Error\"})\n\t} else {\n\t\tc.JSON(http.StatusOK, \"OK\")\n\t}\n}", "func (r *Entity) Update() (result sql.Result, err error) {\n\twhere, args, err := gdb.GetWhereConditionOfStruct(r)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn Model.Data(r).Where(where, args).Update()\n}", "func (pr *Project) Update() *ProjectUpdateOne {\n\treturn (&ProjectClient{pr.config}).UpdateOne(pr)\n}", "func (r *DeviceManagementComplexSettingInstanceRequest) Update(ctx context.Context, reqObj *DeviceManagementComplexSettingInstance) error {\n\treturn r.JSONRequest(ctx, \"PATCH\", \"\", reqObj, nil)\n}", "func Update(c *gin.Context) {\n\tvar todo todo\n\tid := c.Param(\"Id\")\n\n\tdb := Database()\n\tdb.First(&todo, id)\n\n\tif todo.ID == 0 {\n\t\tc.JSON(http.StatusNotFound, gin.H{\n\t\t\t\"status\": http.StatusNotFound,\n\t\t\t\"message\": \"Todo Not Found\",\n\t\t})\n\t}\n\n\tif strings.TrimSpace(c.PostForm(\"title\")) != \"\" {\n\t\tdb.Model(&todo).Update(\"title\", c.PostForm(\"title\"))\n\t}\n\n\tif c.GetBool(\"done\") {\n\t\tdb.Model(&todo).Update(\"done\", c.GetBool(\"done\"))\n\t}\n\n\tc.JSON(http.StatusOK, gin.H{\n\t\t\"status\": http.StatusOK,\n\t\t\"message\": \"Todo Updated\",\n\t})\n}", "func Update(ctx context.Context, key string, value string, lease bool) error {\n\terr := Client().Update(ctx, key, []byte(value), lease)\n\tTrace(\"Update\", err, logrus.Fields{fieldKey: key, fieldValue: string(value), fieldAttachLease: lease})\n\treturn err\n}", "func (l *Like) Update() *LikeUpdateOne {\n\treturn (&LikeClient{config: l.config}).UpdateOne(l)\n}", "func (broadcast *Broadcast) UpdatePost(ctx context.Context, author, title, postID, content string,\n\tlinks map[string]string, privKeyHex string, seq int64) (*model.BroadcastResponse, error) {\n\tvar mLinks []model.IDToURLMapping\n\tif links == nil || len(links) == 0 {\n\t\tmLinks = nil\n\t} else {\n\t\tfor k, v := range links {\n\t\t\tmLinks = append(mLinks, model.IDToURLMapping{k, v})\n\t\t}\n\t}\n\n\tmsg := model.UpdatePostMsg{\n\t\tAuthor: author,\n\t\tPostID: postID,\n\t\tTitle: title,\n\t\tContent: content,\n\t\tLinks: mLinks,\n\t}\n\treturn broadcast.broadcastTransaction(ctx, msg, privKeyHex, seq, \"\", false)\n}", "func (r *DeviceManagementAbstractComplexSettingInstanceRequest) Update(ctx context.Context, reqObj *DeviceManagementAbstractComplexSettingInstance) error {\n\treturn r.JSONRequest(ctx, \"PATCH\", \"\", reqObj, nil)\n}", "func (handler Handler) handlePostUpdate(w http.ResponseWriter, r *http.Request) {\n\t// We try to get the user id from auth token:\n\tuid, err := auth.ExtractTokenID(r)\n\tif err != nil {\n\t\tresponses.ERROR(w, http.StatusUnauthorized, errors.New(\"unauthorized\"))\n\t\treturn\n\t}\n\n\tvars := mux.Vars(r)\n\tpid, err := strconv.ParseUint(vars[\"id\"], 10, 64)\n\tif err != nil {\n\t\tresponses.ERROR(w, http.StatusBadRequest, err)\n\t\treturn\n\t}\n\n\tdb := repository.NewPostRepository(handler.DB)\n\n\tpost, err := db.FindById(uint(pid))\n\tif err != nil {\n\t\tif errors.Is(err, gorm.ErrRecordNotFound) {\n\t\t\tresponses.ERROR(w, http.StatusNotFound, errors.New(\"the post with id \" + vars[\"id\"] + \" could not found\"))\n\t\t} else {\n\t\t\tresponses.ERROR(w, http.StatusInternalServerError, errors.New(\"something went wrong\"))\n\t\t\tlog.Println(err)\n\t\t}\n\t\treturn\n\t}\n\n\tif post.Author.ID != uid {\n\t\tresponses.ERROR(w, http.StatusUnauthorized, errors.New(\"you can not update the post who belongs to someone else\"))\n\t\treturn\n\t}\n\n\tbody, err := ioutil.ReadAll(r.Body)\n\tif err != nil {\n\t\tresponses.ERROR(w, http.StatusUnprocessableEntity, err)\n\t\treturn\n\t}\n\n\tvar postUpdate models.PostDTO\n\n\tif err = json.Unmarshal(body, &postUpdate); err != nil {\n\t\tresponses.ERROR(w, http.StatusUnprocessableEntity, err)\n\t\treturn\n\t}\n\n\tnewPost := models.DTOToPost(postUpdate)\n\n\tif err = db.UpdateById(&post, newPost); err != nil {\n\t\tresponses.ERROR(w, http.StatusInternalServerError, err)\n\t\treturn\n\t}\n\n\tresponses.JSON(w, http.StatusCreated, post)\n}", "func (t *RestControllerDescriptor) Update() *ggt.MethodDescriptor { return t.methodUpdate }", "func (c *BeerClient) Update() *BeerUpdate {\n\tmutation := newBeerMutation(c.config, OpUpdate)\n\treturn &BeerUpdate{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (pr *Product) Update() *ProductUpdateOne {\n\treturn (&ProductClient{config: pr.config}).UpdateOne(pr)\n}", "func (b *Bill) Update() *BillUpdateOne {\n\treturn (&BillClient{config: b.config}).UpdateOne(b)\n}", "func (t *Todo) Update() *TodoUpdateOne {\n\treturn (&TodoClient{t.config}).UpdateOne(t)\n}", "func (qs InstantprofileQS) Update() InstantprofileUpdateQS {\n\treturn InstantprofileUpdateQS{condFragments: qs.condFragments}\n}", "func (svc *AdminStepService) Update(s *library.Step) (*library.Step, *Response, error) {\n\t// set the API endpoint path we send the request to\n\tu := \"/api/v1/admin/step\"\n\n\t// library Step type we want to return\n\tv := new(library.Step)\n\n\t// send request using client\n\tresp, err := svc.client.Call(\"PUT\", u, s, v)\n\n\treturn v, resp, err\n}", "func (b *Bag) Update() *BagUpdateOne {\n\treturn (&BagClient{config: b.config}).UpdateOne(b)\n}", "func (su *PostUseCase) UpdateOne(id string, request data.Post) error {\n\tpost := &models.Post{ID: id}\n\terr := post.Get()\n\tif err != nil {\n\t\treturn err\n\t}\n\tpost.Post = request\n\terr = post.Update()\n\treturn err\n}", "func (c *ReviewClient) Update() *ReviewUpdate {\n\tmutation := newReviewMutation(c.config, OpUpdate)\n\treturn &ReviewUpdate{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (store MySQL) UpdatePost(post *Post) error {\n\tif post == nil {\n\t\treturn ErrUpdatePostIsNil\n\t}\n\tlog.Debug().Interface(\"post\", post).Msg(\"UpdatePost\")\n\n\tif post.ID == 0 {\n\t\treturn ErrUpdatePostIDMissing\n\t}\n\n\tpost.Title = strings.Trim(post.Title, \" \")\n\n\tif post.Title == \"\" {\n\t\treturn ErrUpdatePostTitleMissing\n\t}\n\n\tif post.Content == \"\" {\n\t\treturn ErrUpdatePostContentMissing\n\t}\n\n\tif post.UpdatedByID == 0 {\n\t\treturn ErrUpdatePostUpdatedByMissing\n\t}\n\n\tp, err := store.GetPostByID(post.ID)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif post.UpdatedByID != p.CreatedByID {\n\t\treturn ErrUpdatePostInvalidUser\n\t}\n\n\tconn := db.Connx(mysqlDbID)\n\n\t_, err = conn.Exec(`\n UPDATE `+postsTableName+` SET\n title = ?,\n content = ?,\n private = ?,\n updated_by = ?,\n updated_at = NOW(6)\n WHERE\n id = ?\n `,\n\t\tpost.Title,\n\t\tpost.Content,\n\t\tpost.Private,\n\t\tpost.UpdatedByID,\n\t\tpost.ID,\n\t)\n\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tp, err = store.GetPostByID(post.ID)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif p.ID > 0 {\n\t\t*post = p\n\t}\n\n\t// Emit event for post updated here\n\n\treturn err\n\n}", "func (svc *AdminDeploymentService) Update(d *library.Deployment) (*library.Deployment, *Response, error) {\n\t// set the API endpoint path we send the request to\n\tu := \"/api/v1/admin/deployment\"\n\n\t// library Deployment type we want to return\n\tv := new(library.Deployment)\n\n\t// send request using client\n\tresp, err := svc.client.Call(\"PUT\", u, d, v)\n\n\treturn v, resp, err\n}", "func Update(ds datastore.Datastore, a Input) error {\n\treturn update(ds, a)\n}", "func (post *Post) update() (err error) {\n\tstmt := \"UPDATE posts set title = $1, body = $2, author = $3 WHERE id = $4\"\n\t_, err = Db.Exec(stmt, post.Title, post.Body, post.Author, post.Id)\n\treturn\n}", "func (s *Service) UpdatePostHandler(w http.ResponseWriter, r *http.Request) {\n\n\tid, err := utilities.GetURLID(r, \"\")\n\tif err != nil {\n\n\t\tmessage, code := parseError(err)\n\t\thttp.Error(w, message, code)\n\n\t\treturn\n\t}\n\n\tform := PForm{}\n\n\tdefer r.Body.Close()\n\tif err := json.NewDecoder(r.Body).Decode(&form); err != nil {\n\n\t\tmessage, code := parseError(err)\n\t\thttp.Error(w, message, code)\n\n\t\treturn\n\t}\n\n\tctx, f := context.WithTimeout(r.Context(), TimeoutRequest)\n\tdefer f()\n\n\tpost, err := s.updatePost(ctx, id, form)\n\n\tif err != nil {\n\n\t\tmessage, code := parseError(err)\n\t\thttp.Error(w, message, code)\n\n\t\treturn\n\t}\n\n\tw.WriteHeader(http.StatusOK)\n\tw.Header().Add(\"Content-Type\", \"application/json\")\n\n\tif json.NewEncoder(w).Encode(post); err != nil {\n\t\thttp.Error(w, \"Internal Server Error\", http.StatusInternalServerError)\n\t}\n}", "func (e *FormService) Update(id int, name string, form *Form) (*Form, *Response, error) {\n\tif form == nil {\n\t\tform = &Form{}\n\t}\n\tform.ID = id\n\tform.Name = name\n\tendpoint := fmt.Sprintf(\"/assets/form/%d\", form.ID)\n\tresp, err := e.client.putRequestDecode(endpoint, form)\n\treturn form, resp, err\n}", "func Update(client *gophercloud.ServiceClient, id string, opts UpdateOptsBuilder) (r UpdateResult) {\n\tb, err := opts.ToProjectUpdateMap()\n\tif err != nil {\n\t\tr.Err = err\n\t\treturn\n\t}\n\t_, r.Err = client.Put(updateURL(client, id), b, &r.Body, &gophercloud.RequestOpts{\n\t\tOkCodes: []int{204},\n\t})\n\treturn\n}", "func (p *postsQueryBuilder) Get() (*Post, error) {\n\tif p.err != nil {\n\t\treturn nil, p.err\n\t}\n\tmodel, err := p.builder.Get()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn model.(*Post), nil\n}", "func (n *Notes) Update() *NotesUpdateOne {\n\treturn (&NotesClient{config: n.config}).UpdateOne(n)\n}", "func (r *DeviceManagementCollectionSettingInstanceRequest) Update(ctx context.Context, reqObj *DeviceManagementCollectionSettingInstance) error {\n\treturn r.JSONRequest(ctx, \"PATCH\", \"\", reqObj, nil)\n}", "func (self thread) Update(db Database) ThreadModel {\n root := self.posts[0].MessageID()\n reply_count := db.CountThreadReplies(root)\n\n if int(reply_count) + 1 != len(self.posts) {\n\n return thread{\n posts: append([]PostModel{self.posts[0]}, db.GetThreadReplyPostModels(self.prefix, root, 0)...),\n links: self.links,\n prefix: self.prefix,\n }\n }\n return self\n}", "func (h *Handler) Update(c echo.Context) error {\n\trec := models.Rec{}\n\terr := c.Bind(&rec)\n\tif err != nil {\n\t\treturn c.JSON(http.StatusInternalServerError, err)\n\t}\n\n\terr = h.Store.Update(&rec)\n\tif err != nil {\n\t\treturn c.JSON(http.StatusInternalServerError, err)\n\t}\n\n\treturn c.JSON(http.StatusOK, rec)\n}", "func Update(model Model) error {\n\t//Set our request URL to be root URL/Id, eg. example.com/api/todos/4\n\tfullURL := model.RootURL() + \"/\" + model.GetId()\n\tbodyString := \"\"\n\t// TODO: Do stronger type checking to prevent errors\n\t//Use reflect to identify fields of our model and convert to URL-encoded formdata string\n\tmodelValPtr := reflect.ValueOf(model)\n\tmodelVal := modelValPtr.Elem()\n\tmodelValType := modelVal.Type()\n\tfor i := 0; i < modelValType.NumField(); i++ {\n\t\tfield := modelVal.Field(i)\n\t\tfieldName := modelValType.Field(i).Name\n\t\tvalue := fmt.Sprint(field.Interface())\n\t\tbodyString += fieldName + \"=\" + url.QueryEscape(value)\n\t\tif i != modelValType.NumField()-1 {\n\t\t\tbodyString += \"&\"\n\t\t}\n\t}\n\t// Create our x-www-form-urlencoded PUT request\n\treq := xhr.NewRequest(\"PUT\", fullURL)\n\treq.Timeout = 1000 // one second, in milliseconds\n\treq.ResponseType = \"text\"\n\treq.SetRequestHeader(\"Content-Type\", \"application/x-www-form-urlencoded\")\n\t// Send our request\n\terr := req.Send(bodyString)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"Something went wrong with PUT request to %s. %s\", fullURL, err.Error())\n\t}\n\t// Unmarshal our server response object into our model\n\terr = json.Unmarshal([]byte(req.Response.String()), model)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"Failed to unmarshal response into object, with Error: %s.\\nResponse was: %s\", err, req.Response.String())\n\t}\n\treturn nil\n}", "func (svc *AdminHookService) Update(h *library.Hook) (*library.Hook, *Response, error) {\n\t// set the API endpoint path we send the request to\n\tu := \"/api/v1/admin/hook\"\n\n\t// library Hook type we want to return\n\tv := new(library.Hook)\n\n\t// send request using client\n\tresp, err := svc.client.Call(\"PUT\", u, h, v)\n\n\treturn v, resp, err\n}", "func (repo *PostAttributeRepository) Update(attribute *entity.PostAttribute, tableName string) error {\n\n\tprevAttribute := new(entity.PostAttribute)\n\terr := repo.conn.Table(tableName).Where(\"id = ?\", attribute.ID).First(prevAttribute).Error\n\n\tif err != nil {\n\t\treturn err\n\t}\n\n\terr = repo.conn.Table(tableName).Save(attribute).Error\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "func (c *Client) BuildUpdateRequest(ctx context.Context, v interface{}) (*http.Request, error) {\n\tvar (\n\t\tid uint32\n\t)\n\t{\n\t\tp, ok := v.(*blog.UpdatePayload)\n\t\tif !ok {\n\t\t\treturn nil, goahttp.ErrInvalidType(\"blog\", \"update\", \"*blog.UpdatePayload\", v)\n\t\t}\n\t\tif p.ID != nil {\n\t\t\tid = *p.ID\n\t\t}\n\t}\n\tu := &url.URL{Scheme: c.scheme, Host: c.host, Path: UpdateBlogPath(id)}\n\treq, err := http.NewRequest(\"PATCH\", u.String(), nil)\n\tif err != nil {\n\t\treturn nil, goahttp.ErrInvalidURL(\"blog\", \"update\", u.String(), err)\n\t}\n\tif ctx != nil {\n\t\treq = req.WithContext(ctx)\n\t}\n\n\treturn req, nil\n}", "func (p *Post) Update() error {\n\n\t// TODO: Apply\n\n\tcurrentPost := &Post{Id: p.Id}\n\terr := currentPost.GetPostById()\n\tif err == mgo.ErrNotFound {\n\t\treturn p.Insert()\n\t}\n\tif p.Slug != currentPost.Slug && !PostChangeSlug(p.Slug) {\n\t\tp.Slug = generateNewSlug(p.Slug, 1)\n\t}\n\n\t_, err = postSession.Clone().DB(DBName).C(\"posts\").UpsertId(p.Id, p)\n\n\treturn err\n}", "func (b *UpdateBuilder) Build(opts ...interface{}) (string, []interface{}) {\n\tif b.Flavor == sql.FlavorCosmosDb {\n\t\topts = removeOptTableAlias(opts...)\n\t}\n\ttableAliasForField := extractOptTableAlias(opts...)\n\ttableAlias := \"\"\n\tif tableAliasForField != \"\" {\n\t\tif !reTblNameWithAlias.MatchString(b.Table) {\n\t\t\ttableAlias = \" \" + tableAliasForField[:len(tableAliasForField)-1]\n\t\t}\n\t}\n\n\tsql := fmt.Sprintf(\"UPDATE %s%s\", b.Table, tableAlias)\n\tvalues := make([]interface{}, 0, len(b.Values))\n\tcols := make([]string, 0, len(b.Values))\n\tfor k := range b.Values {\n\t\tcols = append(cols, k)\n\t}\n\tsort.Strings(cols)\n\tsetList := make([]string, 0)\n\tfor _, col := range cols {\n\t\tvalues = append(values, b.Values[col])\n\t\talias := tableAliasForField\n\t\tif reColnamePrefixedTblname.MatchString(col) {\n\t\t\talias = \"\"\n\t\t}\n\t\tsetList = append(setList, fmt.Sprintf(\"%s%s=%s\", alias, col, b.PlaceholderGenerator(col)))\n\t}\n\tsql += \" SET \" + strings.Join(setList, \",\")\n\n\twhereClause := \"\"\n\tif b.Filter != nil {\n\t\tnewOpts := append([]interface{}{OptDbFlavor{Flavor: b.Flavor}}, opts...)\n\t\tvar tempValues []interface{}\n\t\twhereClause, tempValues = b.Filter.Build(b.PlaceholderGenerator, newOpts...)\n\t\tvalues = append(values, tempValues...)\n\t}\n\tif whereClause != \"\" {\n\t\tsql += \" WHERE \" + whereClause\n\t}\n\n\treturn sql, values\n}", "func Update(client *golangsdk.ServiceClient, instanceId, appId string, opts APIOptsBuilder) (r UpdateResult) {\n\treqBody, err := opts.ToAPIOptsMap()\n\tif err != nil {\n\t\tr.Err = err\n\t\treturn\n\t}\n\t_, r.Err = client.Put(resourceURL(client, instanceId, appId), reqBody, &r.Body, &golangsdk.RequestOpts{\n\t\tOkCodes: []int{200},\n\t})\n\treturn\n}", "func (id *ItemDescription) Update() *ItemDescriptionUpdateOne {\n\treturn (&ItemDescriptionClient{config: id.config}).UpdateOne(id)\n}", "func (r *Review) Update() *ReviewUpdateOne {\n\treturn (&ReviewClient{config: r.config}).UpdateOne(r)\n}" ]
[ "0.66079044", "0.65753376", "0.6355341", "0.62397635", "0.6172451", "0.61676896", "0.60051507", "0.59373945", "0.5913973", "0.5796397", "0.5757244", "0.5749685", "0.57025856", "0.5668755", "0.5648013", "0.5638282", "0.5622243", "0.55886173", "0.55839777", "0.55686563", "0.5551858", "0.55353457", "0.5511894", "0.5482832", "0.54612875", "0.5447901", "0.54340315", "0.54172975", "0.54077214", "0.5395759", "0.5386269", "0.5383508", "0.5379115", "0.5364029", "0.5350953", "0.5346338", "0.5344181", "0.53346664", "0.5320173", "0.5313793", "0.5302105", "0.52874297", "0.5283783", "0.52831405", "0.5269643", "0.5262477", "0.52510977", "0.52510977", "0.52510977", "0.52510977", "0.52510977", "0.5250573", "0.5234883", "0.5230077", "0.5220172", "0.52162826", "0.5214438", "0.51908475", "0.51822984", "0.51809084", "0.5179637", "0.5173502", "0.5167806", "0.516529", "0.51453644", "0.51445293", "0.51346326", "0.5128041", "0.51257974", "0.5124923", "0.5115174", "0.5111316", "0.5105627", "0.5090093", "0.50900084", "0.50868297", "0.50826985", "0.5082611", "0.50775707", "0.50733334", "0.5073016", "0.50728", "0.5070682", "0.5066207", "0.50579613", "0.50525403", "0.5050164", "0.5046971", "0.5044927", "0.5043595", "0.50411856", "0.5035308", "0.503381", "0.50315803", "0.5030331", "0.50290906", "0.5026153", "0.5024612", "0.5023194", "0.5016618" ]
0.64531887
2
UpdateOne returns an update builder for the given entity.
func (c *PostClient) UpdateOne(po *Post) *PostUpdateOne { mutation := newPostMutation(c.config, OpUpdateOne, withPost(po)) return &PostUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation} }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (c *BuildingClient) UpdateOne(b *Building) *BuildingUpdateOne {\n\tmutation := newBuildingMutation(c.config, OpUpdateOne, withBuilding(b))\n\treturn &BuildingUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *BedtypeClient) UpdateOne(b *Bedtype) *BedtypeUpdateOne {\n\tmutation := newBedtypeMutation(c.config, OpUpdateOne, withBedtype(b))\n\treturn &BedtypeUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *EmptyClient) UpdateOne(e *Empty) *EmptyUpdateOne {\n\tmutation := newEmptyMutation(c.config, OpUpdateOne, withEmpty(e))\n\treturn &EmptyUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *DentistClient) UpdateOne(d *Dentist) *DentistUpdateOne {\n\tmutation := newDentistMutation(c.config, OpUpdateOne, withDentist(d))\n\treturn &DentistUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *BeerClient) UpdateOne(b *Beer) *BeerUpdateOne {\n\tmutation := newBeerMutation(c.config, OpUpdateOne, withBeer(b))\n\treturn &BeerUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *BillClient) UpdateOne(b *Bill) *BillUpdateOne {\n\tmutation := newBillMutation(c.config, OpUpdateOne, withBill(b))\n\treturn &BillUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *BillClient) UpdateOne(b *Bill) *BillUpdateOne {\n\tmutation := newBillMutation(c.config, OpUpdateOne, withBill(b))\n\treturn &BillUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *BillClient) UpdateOne(b *Bill) *BillUpdateOne {\n\tmutation := newBillMutation(c.config, OpUpdateOne, withBill(b))\n\treturn &BillUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *OperationClient) UpdateOne(o *Operation) *OperationUpdateOne {\n\tmutation := newOperationMutation(c.config, OpUpdateOne, withOperation(o))\n\treturn &OperationUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *PostAttachmentClient) UpdateOne(pa *PostAttachment) *PostAttachmentUpdateOne {\n\tmutation := newPostAttachmentMutation(c.config, OpUpdateOne, withPostAttachment(pa))\n\treturn &PostAttachmentUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *CleaningroomClient) UpdateOne(cl *Cleaningroom) *CleaningroomUpdateOne {\n\tmutation := newCleaningroomMutation(c.config, OpUpdateOne, withCleaningroom(cl))\n\treturn &CleaningroomUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *CompanyClient) UpdateOne(co *Company) *CompanyUpdateOne {\n\tmutation := newCompanyMutation(c.config, OpUpdateOne, withCompany(co))\n\treturn &CompanyUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *CompanyClient) UpdateOne(co *Company) *CompanyUpdateOne {\n\tmutation := newCompanyMutation(c.config, OpUpdateOne, withCompany(co))\n\treturn &CompanyUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *EventClient) UpdateOne(e *Event) *EventUpdateOne {\n\tmutation := newEventMutation(c.config, OpUpdateOne, withEvent(e))\n\treturn &EventUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *DeviceClient) UpdateOne(d *Device) *DeviceUpdateOne {\n\tmutation := newDeviceMutation(c.config, OpUpdateOne, withDevice(d))\n\treturn &DeviceUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *OperationroomClient) UpdateOne(o *Operationroom) *OperationroomUpdateOne {\n\tmutation := newOperationroomMutation(c.config, OpUpdateOne, withOperationroom(o))\n\treturn &OperationroomUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *UnsavedPostAttachmentClient) UpdateOne(upa *UnsavedPostAttachment) *UnsavedPostAttachmentUpdateOne {\n\tmutation := newUnsavedPostAttachmentMutation(c.config, OpUpdateOne, withUnsavedPostAttachment(upa))\n\treturn &UnsavedPostAttachmentUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *DrugAllergyClient) UpdateOne(da *DrugAllergy) *DrugAllergyUpdateOne {\n\tmutation := newDrugAllergyMutation(c.config, OpUpdateOne, withDrugAllergy(da))\n\treturn &DrugAllergyUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *MealplanClient) UpdateOne(m *Mealplan) *MealplanUpdateOne {\n\tmutation := newMealplanMutation(c.config, OpUpdateOne, withMealplan(m))\n\treturn &MealplanUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *PhysicianClient) UpdateOne(ph *Physician) *PhysicianUpdateOne {\n\tmutation := newPhysicianMutation(c.config, OpUpdateOne, withPhysician(ph))\n\treturn &PhysicianUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *PhysicianClient) UpdateOne(ph *Physician) *PhysicianUpdateOne {\n\tmutation := newPhysicianMutation(c.config, OpUpdateOne, withPhysician(ph))\n\treturn &PhysicianUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *RoomdetailClient) UpdateOne(r *Roomdetail) *RoomdetailUpdateOne {\n\tmutation := newRoomdetailMutation(c.config, OpUpdateOne, withRoomdetail(r))\n\treturn &RoomdetailUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *OperativerecordClient) UpdateOne(o *Operativerecord) *OperativerecordUpdateOne {\n\tmutation := newOperativerecordMutation(c.config, OpUpdateOne, withOperativerecord(o))\n\treturn &OperativerecordUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *PatientroomClient) UpdateOne(pa *Patientroom) *PatientroomUpdateOne {\n\tmutation := newPatientroomMutation(c.config, OpUpdateOne, withPatientroom(pa))\n\treturn &PatientroomUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *AppointmentClient) UpdateOne(a *Appointment) *AppointmentUpdateOne {\n\tmutation := newAppointmentMutation(c.config, OpUpdateOne, withAppointment(a))\n\treturn &AppointmentUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *ToolClient) UpdateOne(t *Tool) *ToolUpdateOne {\n\tmutation := newToolMutation(c.config, OpUpdateOne, withTool(t))\n\treturn &ToolUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *UnsavedPostClient) UpdateOne(up *UnsavedPost) *UnsavedPostUpdateOne {\n\tmutation := newUnsavedPostMutation(c.config, OpUpdateOne, withUnsavedPost(up))\n\treturn &UnsavedPostUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *WorkExperienceClient) UpdateOne(we *WorkExperience) *WorkExperienceUpdateOne {\n\tmutation := newWorkExperienceMutation(c.config, OpUpdateOne, withWorkExperience(we))\n\treturn &WorkExperienceUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *TransactionClient) UpdateOne(t *Transaction) *TransactionUpdateOne {\n\tmutation := newTransactionMutation(c.config, OpUpdateOne, withTransaction(t))\n\treturn &TransactionUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *RoomuseClient) UpdateOne(r *Roomuse) *RoomuseUpdateOne {\n\tmutation := newRoomuseMutation(c.config, OpUpdateOne, withRoomuse(r))\n\treturn &RoomuseUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *DispenseMedicineClient) UpdateOne(dm *DispenseMedicine) *DispenseMedicineUpdateOne {\n\tmutation := newDispenseMedicineMutation(c.config, OpUpdateOne, withDispenseMedicine(dm))\n\treturn &DispenseMedicineUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *OrderClient) UpdateOne(o *Order) *OrderUpdateOne {\n\tmutation := newOrderMutation(c.config, OpUpdateOne, withOrder(o))\n\treturn &OrderUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *PharmacistClient) UpdateOne(ph *Pharmacist) *PharmacistUpdateOne {\n\tmutation := newPharmacistMutation(c.config, OpUpdateOne, withPharmacist(ph))\n\treturn &PharmacistUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *BookingClient) UpdateOne(b *Booking) *BookingUpdateOne {\n\tmutation := newBookingMutation(c.config, OpUpdateOne, withBooking(b))\n\treturn &BookingUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *AdminClient) UpdateOne(a *Admin) *AdminUpdateOne {\n\tmutation := newAdminMutation(c.config, OpUpdateOne, withAdmin(a))\n\treturn &AdminUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *MedicineClient) UpdateOne(m *Medicine) *MedicineUpdateOne {\n\tmutation := newMedicineMutation(c.config, OpUpdateOne, withMedicine(m))\n\treturn &MedicineUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *MedicineTypeClient) UpdateOne(mt *MedicineType) *MedicineTypeUpdateOne {\n\tmutation := newMedicineTypeMutation(c.config, OpUpdateOne, withMedicineType(mt))\n\treturn &MedicineTypeUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *DoctorClient) UpdateOne(d *Doctor) *DoctorUpdateOne {\n\tmutation := newDoctorMutation(c.config, OpUpdateOne, withDoctor(d))\n\treturn &DoctorUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *PatientofphysicianClient) UpdateOne(pa *Patientofphysician) *PatientofphysicianUpdateOne {\n\tmutation := newPatientofphysicianMutation(c.config, OpUpdateOne, withPatientofphysician(pa))\n\treturn &PatientofphysicianUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *ActivityTypeClient) UpdateOne(at *ActivityType) *ActivityTypeUpdateOne {\n\tmutation := newActivityTypeMutation(c.config, OpUpdateOne, withActivityType(at))\n\treturn &ActivityTypeUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *DNSBLQueryClient) UpdateOne(dq *DNSBLQuery) *DNSBLQueryUpdateOne {\n\tmutation := newDNSBLQueryMutation(c.config, OpUpdateOne, withDNSBLQuery(dq))\n\treturn &DNSBLQueryUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *OperativeClient) UpdateOne(o *Operative) *OperativeUpdateOne {\n\tmutation := newOperativeMutation(c.config, OpUpdateOne, withOperative(o))\n\treturn &OperativeUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *PatientClient) UpdateOne(pa *Patient) *PatientUpdateOne {\n\tmutation := newPatientMutation(c.config, OpUpdateOne, withPatient(pa))\n\treturn &PatientUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *PatientClient) UpdateOne(pa *Patient) *PatientUpdateOne {\n\tmutation := newPatientMutation(c.config, OpUpdateOne, withPatient(pa))\n\treturn &PatientUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *PatientClient) UpdateOne(pa *Patient) *PatientUpdateOne {\n\tmutation := newPatientMutation(c.config, OpUpdateOne, withPatient(pa))\n\treturn &PatientUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *FoodmenuClient) UpdateOne(f *Foodmenu) *FoodmenuUpdateOne {\n\tmutation := newFoodmenuMutation(c.config, OpUpdateOne, withFoodmenu(f))\n\treturn &FoodmenuUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *StaytypeClient) UpdateOne(s *Staytype) *StaytypeUpdateOne {\n\tmutation := newStaytypeMutation(c.config, OpUpdateOne, withStaytype(s))\n\treturn &StaytypeUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *LevelOfDangerousClient) UpdateOne(lod *LevelOfDangerous) *LevelOfDangerousUpdateOne {\n\tmutation := newLevelOfDangerousMutation(c.config, OpUpdateOne, withLevelOfDangerous(lod))\n\treturn &LevelOfDangerousUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (su *PostUseCase) UpdateOne(id string, request data.Post) error {\n\tpost := &models.Post{ID: id}\n\terr := post.Get()\n\tif err != nil {\n\t\treturn err\n\t}\n\tpost.Post = request\n\terr = post.Update()\n\treturn err\n}", "func UpdateOne(query interface{}, update interface{}) error {\n\treturn db.Update(Collection, query, update)\n}", "func (c *PartorderClient) UpdateOne(pa *Partorder) *PartorderUpdateOne {\n\tmutation := newPartorderMutation(c.config, OpUpdateOne, withPartorder(pa))\n\treturn &PartorderUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *UnitOfMedicineClient) UpdateOne(uom *UnitOfMedicine) *UnitOfMedicineUpdateOne {\n\tmutation := newUnitOfMedicineMutation(c.config, OpUpdateOne, withUnitOfMedicine(uom))\n\treturn &UnitOfMedicineUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *PurposeClient) UpdateOne(pu *Purpose) *PurposeUpdateOne {\n\tmutation := newPurposeMutation(c.config, OpUpdateOne, withPurpose(pu))\n\treturn &PurposeUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *ExaminationroomClient) UpdateOne(e *Examinationroom) *ExaminationroomUpdateOne {\n\tmutation := newExaminationroomMutation(c.config, OpUpdateOne, withExaminationroom(e))\n\treturn &ExaminationroomUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *PaymentClient) UpdateOne(pa *Payment) *PaymentUpdateOne {\n\tmutation := newPaymentMutation(c.config, OpUpdateOne, withPayment(pa))\n\treturn &PaymentUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *PaymentClient) UpdateOne(pa *Payment) *PaymentUpdateOne {\n\tmutation := newPaymentMutation(c.config, OpUpdateOne, withPayment(pa))\n\treturn &PaymentUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *StatustClient) UpdateOne(s *Statust) *StatustUpdateOne {\n\tmutation := newStatustMutation(c.config, OpUpdateOne, withStatust(s))\n\treturn &StatustUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *TagClient) UpdateOne(t *Tag) *TagUpdateOne {\n\tmutation := newTagMutation(c.config, OpUpdateOne, withTag(t))\n\treturn &TagUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *RepairinvoiceClient) UpdateOne(r *Repairinvoice) *RepairinvoiceUpdateOne {\n\tmutation := newRepairinvoiceMutation(c.config, OpUpdateOne, withRepairinvoice(r))\n\treturn &RepairinvoiceUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *DepositClient) UpdateOne(d *Deposit) *DepositUpdateOne {\n\tmutation := newDepositMutation(c.config, OpUpdateOne, withDeposit(d))\n\treturn &DepositUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *EmployeeClient) UpdateOne(e *Employee) *EmployeeUpdateOne {\n\tmutation := newEmployeeMutation(c.config, OpUpdateOne, withEmployee(e))\n\treturn &EmployeeUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *EmployeeClient) UpdateOne(e *Employee) *EmployeeUpdateOne {\n\tmutation := newEmployeeMutation(c.config, OpUpdateOne, withEmployee(e))\n\treturn &EmployeeUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *EmployeeClient) UpdateOne(e *Employee) *EmployeeUpdateOne {\n\tmutation := newEmployeeMutation(c.config, OpUpdateOne, withEmployee(e))\n\treturn &EmployeeUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *RoomClient) UpdateOne(r *Room) *RoomUpdateOne {\n\tmutation := newRoomMutation(c.config, OpUpdateOne, withRoom(r))\n\treturn &RoomUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *RoomClient) UpdateOne(r *Room) *RoomUpdateOne {\n\tmutation := newRoomMutation(c.config, OpUpdateOne, withRoom(r))\n\treturn &RoomUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *BillingstatusClient) UpdateOne(b *Billingstatus) *BillingstatusUpdateOne {\n\tmutation := newBillingstatusMutation(c.config, OpUpdateOne, withBillingstatus(b))\n\treturn &BillingstatusUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *EatinghistoryClient) UpdateOne(e *Eatinghistory) *EatinghistoryUpdateOne {\n\tmutation := newEatinghistoryMutation(c.config, OpUpdateOne, withEatinghistory(e))\n\treturn &EatinghistoryUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *StatusdClient) UpdateOne(s *Statusd) *StatusdUpdateOne {\n\tmutation := newStatusdMutation(c.config, OpUpdateOne, withStatusd(s))\n\treturn &StatusdUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (b *Bill) Update() *BillUpdateOne {\n\treturn (&BillClient{config: b.config}).UpdateOne(b)\n}", "func (c *AnnotationClient) UpdateOne(a *Annotation) *AnnotationUpdateOne {\n\tmutation := newAnnotationMutation(c.config, OpUpdateOne, withAnnotation(a))\n\treturn &AnnotationUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func UpdateOne(ctx context.Context, tx pgx.Tx, sb sq.UpdateBuilder) error {\n\tq, vs, err := sb.ToSql()\n\tif err != nil {\n\t\treturn err\n\t}\n\ttag, err := tx.Exec(ctx, q, vs...)\n\tif err != nil {\n\t\treturn err\n\t}\n\tif tag.RowsAffected() != 1 {\n\t\treturn ErrNoRowsAffected\n\t}\n\treturn nil\n}", "func (c *CleanernameClient) UpdateOne(cl *Cleanername) *CleanernameUpdateOne {\n\tmutation := newCleanernameMutation(c.config, OpUpdateOne, withCleanername(cl))\n\treturn &CleanernameUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *LeaseClient) UpdateOne(l *Lease) *LeaseUpdateOne {\n\tmutation := newLeaseMutation(c.config, OpUpdateOne, withLease(l))\n\treturn &LeaseUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *BinaryFileClient) UpdateOne(bf *BinaryFile) *BinaryFileUpdateOne {\n\tmutation := newBinaryFileMutation(c.config, OpUpdateOne, withBinaryFile(bf))\n\treturn &BinaryFileUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *JobClient) UpdateOne(j *Job) *JobUpdateOne {\n\tmutation := newJobMutation(c.config, OpUpdateOne, withJob(j))\n\treturn &JobUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *ActivitiesClient) UpdateOne(a *Activities) *ActivitiesUpdateOne {\n\tmutation := newActivitiesMutation(c.config, OpUpdateOne, withActivities(a))\n\treturn &ActivitiesUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *UnsavedPostImageClient) UpdateOne(upi *UnsavedPostImage) *UnsavedPostImageUpdateOne {\n\tmutation := newUnsavedPostImageMutation(c.config, OpUpdateOne, withUnsavedPostImage(upi))\n\treturn &UnsavedPostImageUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *ClubapplicationClient) UpdateOne(cl *Clubapplication) *ClubapplicationUpdateOne {\n\tmutation := newClubapplicationMutation(c.config, OpUpdateOne, withClubapplication(cl))\n\treturn &ClubapplicationUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *SkillClient) UpdateOne(s *Skill) *SkillUpdateOne {\n\tmutation := newSkillMutation(c.config, OpUpdateOne, withSkill(s))\n\treturn &SkillUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *RentalstatusClient) UpdateOne(r *Rentalstatus) *RentalstatusUpdateOne {\n\tmutation := newRentalstatusMutation(c.config, OpUpdateOne, withRentalstatus(r))\n\treturn &RentalstatusUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *UsertypeClient) UpdateOne(u *Usertype) *UsertypeUpdateOne {\n\tmutation := newUsertypeMutation(c.config, OpUpdateOne, withUsertype(u))\n\treturn &UsertypeUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *TasteClient) UpdateOne(t *Taste) *TasteUpdateOne {\n\tmutation := newTasteMutation(c.config, OpUpdateOne, withTaste(t))\n\treturn &TasteUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *PositionassingmentClient) UpdateOne(po *Positionassingment) *PositionassingmentUpdateOne {\n\tmutation := newPositionassingmentMutation(c.config, OpUpdateOne, withPositionassingment(po))\n\treturn &PositionassingmentUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *SymptomClient) UpdateOne(s *Symptom) *SymptomUpdateOne {\n\tmutation := newSymptomMutation(c.config, OpUpdateOne, withSymptom(s))\n\treturn &SymptomUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *PartClient) UpdateOne(pa *Part) *PartUpdateOne {\n\tmutation := newPartMutation(c.config, OpUpdateOne, withPart(pa))\n\treturn &PartUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func NewUpdateOneModel() *UpdateOneModel {\n\treturn &UpdateOneModel{}\n}", "func (c *DepartmentClient) UpdateOne(d *Department) *DepartmentUpdateOne {\n\tmutation := newDepartmentMutation(c.config, OpUpdateOne, withDepartment(d))\n\treturn &DepartmentUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *SituationClient) UpdateOne(s *Situation) *SituationUpdateOne {\n\tmutation := newSituationMutation(c.config, OpUpdateOne, withSituation(s))\n\treturn &SituationUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *ComplaintClient) UpdateOne(co *Complaint) *ComplaintUpdateOne {\n\tmutation := newComplaintMutation(c.config, OpUpdateOne, withComplaint(co))\n\treturn &ComplaintUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (t *Todo) Update() *TodoUpdateOne {\n\treturn (&TodoClient{t.config}).UpdateOne(t)\n}", "func (c *QueueClient) UpdateOne(q *Queue) *QueueUpdateOne {\n\tmutation := newQueueMutation(c.config, OpUpdateOne, withQueue(q))\n\treturn &QueueUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *UserWalletClient) UpdateOne(uw *UserWallet) *UserWalletUpdateOne {\n\tmutation := newUserWalletMutation(c.config, OpUpdateOne, withUserWallet(uw))\n\treturn &UserWalletUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *BranchClient) UpdateOne(b *Branch) *BranchUpdateOne {\n\tmutation := newBranchMutation(c.config, OpUpdateOne, withBranch(b))\n\treturn &BranchUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *ReturninvoiceClient) UpdateOne(r *Returninvoice) *ReturninvoiceUpdateOne {\n\tmutation := newReturninvoiceMutation(c.config, OpUpdateOne, withReturninvoice(r))\n\treturn &ReturninvoiceUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *PatientInfoClient) UpdateOne(pi *PatientInfo) *PatientInfoUpdateOne {\n\tmutation := newPatientInfoMutation(c.config, OpUpdateOne, withPatientInfo(pi))\n\treturn &PatientInfoUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *UserClient) UpdateOne(u *User) *UserUpdateOne {\n\tmutation := newUserMutation(c.config, OpUpdateOne, withUser(u))\n\treturn &UserUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *UserClient) UpdateOne(u *User) *UserUpdateOne {\n\tmutation := newUserMutation(c.config, OpUpdateOne, withUser(u))\n\treturn &UserUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *UserClient) UpdateOne(u *User) *UserUpdateOne {\n\tmutation := newUserMutation(c.config, OpUpdateOne, withUser(u))\n\treturn &UserUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *UserClient) UpdateOne(u *User) *UserUpdateOne {\n\tmutation := newUserMutation(c.config, OpUpdateOne, withUser(u))\n\treturn &UserUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *UserClient) UpdateOne(u *User) *UserUpdateOne {\n\tmutation := newUserMutation(c.config, OpUpdateOne, withUser(u))\n\treturn &UserUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}" ]
[ "0.69773513", "0.6700239", "0.66991323", "0.66772205", "0.66711056", "0.65891296", "0.65891296", "0.65891296", "0.6529943", "0.651992", "0.6517249", "0.6488436", "0.6488436", "0.6461467", "0.6444564", "0.6440813", "0.64263475", "0.6407116", "0.64044094", "0.6402244", "0.6402244", "0.6401924", "0.63997734", "0.63976485", "0.63883317", "0.63816136", "0.6380565", "0.6370969", "0.63709646", "0.6364213", "0.6363832", "0.6348345", "0.6335132", "0.6330745", "0.63263464", "0.6325927", "0.63202494", "0.631989", "0.6319132", "0.6316663", "0.6287886", "0.6282346", "0.62710464", "0.62710464", "0.62710464", "0.6258297", "0.62548864", "0.6243332", "0.6216176", "0.62148726", "0.6214705", "0.6211075", "0.62070787", "0.6187787", "0.6186292", "0.6186292", "0.618427", "0.61778814", "0.6174648", "0.61743003", "0.61704266", "0.61704266", "0.61704266", "0.6158959", "0.6158959", "0.6158523", "0.615801", "0.61553144", "0.6135769", "0.6133886", "0.6126848", "0.610412", "0.6084781", "0.6083719", "0.607597", "0.60747206", "0.6073408", "0.60694623", "0.6044985", "0.6041846", "0.6037389", "0.60345656", "0.6029807", "0.60198456", "0.6018794", "0.60022384", "0.59993756", "0.59894186", "0.59838474", "0.5975079", "0.59639263", "0.59572136", "0.5950218", "0.5949224", "0.5938023", "0.5934483", "0.5934483", "0.5934483", "0.5934483", "0.5934483" ]
0.64580745
14
UpdateOneID returns an update builder for the given id.
func (c *PostClient) UpdateOneID(id int) *PostUpdateOne { mutation := newPostMutation(c.config, OpUpdateOne, withPostID(id)) return &PostUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation} }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (c *BuildingClient) UpdateOneID(id int) *BuildingUpdateOne {\n\tmutation := newBuildingMutation(c.config, OpUpdateOne, withBuildingID(id))\n\treturn &BuildingUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *BedtypeClient) UpdateOneID(id int) *BedtypeUpdateOne {\n\tmutation := newBedtypeMutation(c.config, OpUpdateOne, withBedtypeID(id))\n\treturn &BedtypeUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *ModuleClient) UpdateOneID(id int) *ModuleUpdateOne {\n\treturn &ModuleUpdateOne{config: c.config, id: id}\n}", "func (c *ModuleVersionClient) UpdateOneID(id int) *ModuleVersionUpdateOne {\n\treturn &ModuleVersionUpdateOne{config: c.config, id: id}\n}", "func (c *BillClient) UpdateOneID(id int) *BillUpdateOne {\n\tmutation := newBillMutation(c.config, OpUpdateOne, withBillID(id))\n\treturn &BillUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *BillClient) UpdateOneID(id int) *BillUpdateOne {\n\tmutation := newBillMutation(c.config, OpUpdateOne, withBillID(id))\n\treturn &BillUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *BillClient) UpdateOneID(id int) *BillUpdateOne {\n\tmutation := newBillMutation(c.config, OpUpdateOne, withBillID(id))\n\treturn &BillUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *MealplanClient) UpdateOneID(id int) *MealplanUpdateOne {\n\tmutation := newMealplanMutation(c.config, OpUpdateOne, withMealplanID(id))\n\treturn &MealplanUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *BeerClient) UpdateOneID(id int) *BeerUpdateOne {\n\tmutation := newBeerMutation(c.config, OpUpdateOne, withBeerID(id))\n\treturn &BeerUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *RoomuseClient) UpdateOneID(id int) *RoomuseUpdateOne {\n\tmutation := newRoomuseMutation(c.config, OpUpdateOne, withRoomuseID(id))\n\treturn &RoomuseUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *BookingClient) UpdateOneID(id int) *BookingUpdateOne {\n\tmutation := newBookingMutation(c.config, OpUpdateOne, withBookingID(id))\n\treturn &BookingUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *CleaningroomClient) UpdateOneID(id int) *CleaningroomUpdateOne {\n\tmutation := newCleaningroomMutation(c.config, OpUpdateOne, withCleaningroomID(id))\n\treturn &CleaningroomUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *LengthtimeClient) UpdateOneID(id int) *LengthtimeUpdateOne {\n\tmutation := newLengthtimeMutation(c.config, OpUpdateOne, withLengthtimeID(id))\n\treturn &LengthtimeUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *ToolClient) UpdateOneID(id int) *ToolUpdateOne {\n\tmutation := newToolMutation(c.config, OpUpdateOne, withToolID(id))\n\treturn &ToolUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *StatustClient) UpdateOneID(id int) *StatustUpdateOne {\n\tmutation := newStatustMutation(c.config, OpUpdateOne, withStatustID(id))\n\treturn &StatustUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *DrugAllergyClient) UpdateOneID(id int) *DrugAllergyUpdateOne {\n\tmutation := newDrugAllergyMutation(c.config, OpUpdateOne, withDrugAllergyID(id))\n\treturn &DrugAllergyUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *ClubapplicationClient) UpdateOneID(id int) *ClubapplicationUpdateOne {\n\tmutation := newClubapplicationMutation(c.config, OpUpdateOne, withClubapplicationID(id))\n\treturn &ClubapplicationUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *AppointmentClient) UpdateOneID(id uuid.UUID) *AppointmentUpdateOne {\n\tmutation := newAppointmentMutation(c.config, OpUpdateOne, withAppointmentID(id))\n\treturn &AppointmentUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *EmptyClient) UpdateOneID(id int) *EmptyUpdateOne {\n\tmutation := newEmptyMutation(c.config, OpUpdateOne, withEmptyID(id))\n\treturn &EmptyUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *AdminClient) UpdateOneID(id int) *AdminUpdateOne {\n\tmutation := newAdminMutation(c.config, OpUpdateOne, withAdminID(id))\n\treturn &AdminUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *OperationroomClient) UpdateOneID(id int) *OperationroomUpdateOne {\n\tmutation := newOperationroomMutation(c.config, OpUpdateOne, withOperationroomID(id))\n\treturn &OperationroomUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *BinaryFileClient) UpdateOneID(id int) *BinaryFileUpdateOne {\n\tmutation := newBinaryFileMutation(c.config, OpUpdateOne, withBinaryFileID(id))\n\treturn &BinaryFileUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *PhysicianClient) UpdateOneID(id int) *PhysicianUpdateOne {\n\tmutation := newPhysicianMutation(c.config, OpUpdateOne, withPhysicianID(id))\n\treturn &PhysicianUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *PhysicianClient) UpdateOneID(id int) *PhysicianUpdateOne {\n\tmutation := newPhysicianMutation(c.config, OpUpdateOne, withPhysicianID(id))\n\treturn &PhysicianUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *RoomdetailClient) UpdateOneID(id int) *RoomdetailUpdateOne {\n\tmutation := newRoomdetailMutation(c.config, OpUpdateOne, withRoomdetailID(id))\n\treturn &RoomdetailUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *OperativeClient) UpdateOneID(id int) *OperativeUpdateOne {\n\tmutation := newOperativeMutation(c.config, OpUpdateOne, withOperativeID(id))\n\treturn &OperativeUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *DoctorClient) UpdateOneID(id int) *DoctorUpdateOne {\n\tmutation := newDoctorMutation(c.config, OpUpdateOne, withDoctorID(id))\n\treturn &DoctorUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *DentistClient) UpdateOneID(id int) *DentistUpdateOne {\n\tmutation := newDentistMutation(c.config, OpUpdateOne, withDentistID(id))\n\treturn &DentistUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *UnitOfMedicineClient) UpdateOneID(id int) *UnitOfMedicineUpdateOne {\n\tmutation := newUnitOfMedicineMutation(c.config, OpUpdateOne, withUnitOfMedicineID(id))\n\treturn &UnitOfMedicineUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *LeaseClient) UpdateOneID(id int) *LeaseUpdateOne {\n\tmutation := newLeaseMutation(c.config, OpUpdateOne, withLeaseID(id))\n\treturn &LeaseUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *PatientroomClient) UpdateOneID(id int) *PatientroomUpdateOne {\n\tmutation := newPatientroomMutation(c.config, OpUpdateOne, withPatientroomID(id))\n\treturn &PatientroomUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *RoomClient) UpdateOneID(id int) *RoomUpdateOne {\n\tmutation := newRoomMutation(c.config, OpUpdateOne, withRoomID(id))\n\treturn &RoomUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *RoomClient) UpdateOneID(id int) *RoomUpdateOne {\n\tmutation := newRoomMutation(c.config, OpUpdateOne, withRoomID(id))\n\treturn &RoomUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *JobClient) UpdateOneID(id int) *JobUpdateOne {\n\tmutation := newJobMutation(c.config, OpUpdateOne, withJobID(id))\n\treturn &JobUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *StatusdClient) UpdateOneID(id int) *StatusdUpdateOne {\n\tmutation := newStatusdMutation(c.config, OpUpdateOne, withStatusdID(id))\n\treturn &StatusdUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *BuildingClient) UpdateOne(b *Building) *BuildingUpdateOne {\n\tmutation := newBuildingMutation(c.config, OpUpdateOne, withBuilding(b))\n\treturn &BuildingUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *MedicineClient) UpdateOneID(id int) *MedicineUpdateOne {\n\tmutation := newMedicineMutation(c.config, OpUpdateOne, withMedicineID(id))\n\treturn &MedicineUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *DeviceClient) UpdateOneID(id int) *DeviceUpdateOne {\n\tmutation := newDeviceMutation(c.config, OpUpdateOne, withDeviceID(id))\n\treturn &DeviceUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *CleanernameClient) UpdateOneID(id int) *CleanernameUpdateOne {\n\tmutation := newCleanernameMutation(c.config, OpUpdateOne, withCleanernameID(id))\n\treturn &CleanernameUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *BillingstatusClient) UpdateOneID(id int) *BillingstatusUpdateOne {\n\tmutation := newBillingstatusMutation(c.config, OpUpdateOne, withBillingstatusID(id))\n\treturn &BillingstatusUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *PaymentClient) UpdateOneID(id int) *PaymentUpdateOne {\n\tmutation := newPaymentMutation(c.config, OpUpdateOne, withPaymentID(id))\n\treturn &PaymentUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *PaymentClient) UpdateOneID(id int) *PaymentUpdateOne {\n\tmutation := newPaymentMutation(c.config, OpUpdateOne, withPaymentID(id))\n\treturn &PaymentUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *LevelOfDangerousClient) UpdateOneID(id int) *LevelOfDangerousUpdateOne {\n\tmutation := newLevelOfDangerousMutation(c.config, OpUpdateOne, withLevelOfDangerousID(id))\n\treturn &LevelOfDangerousUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *FoodmenuClient) UpdateOneID(id int) *FoodmenuUpdateOne {\n\tmutation := newFoodmenuMutation(c.config, OpUpdateOne, withFoodmenuID(id))\n\treturn &FoodmenuUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *PharmacistClient) UpdateOneID(id int) *PharmacistUpdateOne {\n\tmutation := newPharmacistMutation(c.config, OpUpdateOne, withPharmacistID(id))\n\treturn &PharmacistUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *ExaminationroomClient) UpdateOneID(id int) *ExaminationroomUpdateOne {\n\tmutation := newExaminationroomMutation(c.config, OpUpdateOne, withExaminationroomID(id))\n\treturn &ExaminationroomUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *KeyStoreClient) UpdateOneID(id int32) *KeyStoreUpdateOne {\n\tmutation := newKeyStoreMutation(c.config, OpUpdateOne, withKeyStoreID(id))\n\treturn &KeyStoreUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *ActivitiesClient) UpdateOneID(id int) *ActivitiesUpdateOne {\n\tmutation := newActivitiesMutation(c.config, OpUpdateOne, withActivitiesID(id))\n\treturn &ActivitiesUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *PatientofphysicianClient) UpdateOneID(id int) *PatientofphysicianUpdateOne {\n\tmutation := newPatientofphysicianMutation(c.config, OpUpdateOne, withPatientofphysicianID(id))\n\treturn &PatientofphysicianUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *PostAttachmentClient) UpdateOneID(id int) *PostAttachmentUpdateOne {\n\tmutation := newPostAttachmentMutation(c.config, OpUpdateOne, withPostAttachmentID(id))\n\treturn &PostAttachmentUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *SkillClient) UpdateOneID(id int) *SkillUpdateOne {\n\tmutation := newSkillMutation(c.config, OpUpdateOne, withSkillID(id))\n\treturn &SkillUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *QueueClient) UpdateOneID(id int) *QueueUpdateOne {\n\tmutation := newQueueMutation(c.config, OpUpdateOne, withQueueID(id))\n\treturn &QueueUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *EventClient) UpdateOneID(id int) *EventUpdateOne {\n\tmutation := newEventMutation(c.config, OpUpdateOne, withEventID(id))\n\treturn &EventUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *DNSBLQueryClient) UpdateOneID(id uuid.UUID) *DNSBLQueryUpdateOne {\n\tmutation := newDNSBLQueryMutation(c.config, OpUpdateOne, withDNSBLQueryID(id))\n\treturn &DNSBLQueryUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *SymptomClient) UpdateOneID(id int) *SymptomUpdateOne {\n\tmutation := newSymptomMutation(c.config, OpUpdateOne, withSymptomID(id))\n\treturn &SymptomUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *PatientClient) UpdateOneID(id int) *PatientUpdateOne {\n\tmutation := newPatientMutation(c.config, OpUpdateOne, withPatientID(id))\n\treturn &PatientUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *PatientClient) UpdateOneID(id int) *PatientUpdateOne {\n\tmutation := newPatientMutation(c.config, OpUpdateOne, withPatientID(id))\n\treturn &PatientUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *PatientClient) UpdateOneID(id int) *PatientUpdateOne {\n\tmutation := newPatientMutation(c.config, OpUpdateOne, withPatientID(id))\n\treturn &PatientUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *NurseClient) UpdateOneID(id int) *NurseUpdateOne {\n\tmutation := newNurseMutation(c.config, OpUpdateOne, withNurseID(id))\n\treturn &NurseUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *PurposeClient) UpdateOneID(id int) *PurposeUpdateOne {\n\tmutation := newPurposeMutation(c.config, OpUpdateOne, withPurposeID(id))\n\treturn &PurposeUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *OrderClient) UpdateOneID(id int) *OrderUpdateOne {\n\tmutation := newOrderMutation(c.config, OpUpdateOne, withOrderID(id))\n\treturn &OrderUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *DepositClient) UpdateOneID(id int) *DepositUpdateOne {\n\tmutation := newDepositMutation(c.config, OpUpdateOne, withDepositID(id))\n\treturn &DepositUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *DispenseMedicineClient) UpdateOneID(id int) *DispenseMedicineUpdateOne {\n\tmutation := newDispenseMedicineMutation(c.config, OpUpdateOne, withDispenseMedicineID(id))\n\treturn &DispenseMedicineUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *PartorderClient) UpdateOneID(id int) *PartorderUpdateOne {\n\tmutation := newPartorderMutation(c.config, OpUpdateOne, withPartorderID(id))\n\treturn &PartorderUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *PlanetClient) UpdateOneID(id int) *PlanetUpdateOne {\n\tmutation := newPlanetMutation(c.config, OpUpdateOne)\n\tmutation.id = &id\n\treturn &PlanetUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *StaytypeClient) UpdateOneID(id int) *StaytypeUpdateOne {\n\tmutation := newStaytypeMutation(c.config, OpUpdateOne, withStaytypeID(id))\n\treturn &StaytypeUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *UsertypeClient) UpdateOneID(id int) *UsertypeUpdateOne {\n\tmutation := newUsertypeMutation(c.config, OpUpdateOne, withUsertypeID(id))\n\treturn &UsertypeUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *RentalstatusClient) UpdateOneID(id int) *RentalstatusUpdateOne {\n\tmutation := newRentalstatusMutation(c.config, OpUpdateOne, withRentalstatusID(id))\n\treturn &RentalstatusUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *PetruleClient) UpdateOneID(id int) *PetruleUpdateOne {\n\tmutation := newPetruleMutation(c.config, OpUpdateOne, withPetruleID(id))\n\treturn &PetruleUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *ActivityTypeClient) UpdateOneID(id int) *ActivityTypeUpdateOne {\n\tmutation := newActivityTypeMutation(c.config, OpUpdateOne, withActivityTypeID(id))\n\treturn &ActivityTypeUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *WorkExperienceClient) UpdateOneID(id int) *WorkExperienceUpdateOne {\n\tmutation := newWorkExperienceMutation(c.config, OpUpdateOne, withWorkExperienceID(id))\n\treturn &WorkExperienceUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *TasteClient) UpdateOneID(id int) *TasteUpdateOne {\n\tmutation := newTasteMutation(c.config, OpUpdateOne, withTasteID(id))\n\treturn &TasteUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *OperativerecordClient) UpdateOneID(id int) *OperativerecordUpdateOne {\n\tmutation := newOperativerecordMutation(c.config, OpUpdateOne, withOperativerecordID(id))\n\treturn &OperativerecordUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *OperationClient) UpdateOneID(id uuid.UUID) *OperationUpdateOne {\n\tmutation := newOperationMutation(c.config, OpUpdateOne, withOperationID(id))\n\treturn &OperationUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *UserClient) UpdateOneID(id int) *UserUpdateOne {\n\tmutation := newUserMutation(c.config, OpUpdateOne, withUserID(id))\n\treturn &UserUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *UserClient) UpdateOneID(id int) *UserUpdateOne {\n\tmutation := newUserMutation(c.config, OpUpdateOne, withUserID(id))\n\treturn &UserUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *UserClient) UpdateOneID(id int) *UserUpdateOne {\n\tmutation := newUserMutation(c.config, OpUpdateOne, withUserID(id))\n\treturn &UserUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *UserClient) UpdateOneID(id int) *UserUpdateOne {\n\tmutation := newUserMutation(c.config, OpUpdateOne, withUserID(id))\n\treturn &UserUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *UserClient) UpdateOneID(id int) *UserUpdateOne {\n\tmutation := newUserMutation(c.config, OpUpdateOne, withUserID(id))\n\treturn &UserUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *UserClient) UpdateOneID(id int) *UserUpdateOne {\n\tmutation := newUserMutation(c.config, OpUpdateOne, withUserID(id))\n\treturn &UserUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *UserClient) UpdateOneID(id int) *UserUpdateOne {\n\tmutation := newUserMutation(c.config, OpUpdateOne, withUserID(id))\n\treturn &UserUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *FacultyClient) UpdateOneID(id int) *FacultyUpdateOne {\n\tmutation := newFacultyMutation(c.config, OpUpdateOne, withFacultyID(id))\n\treturn &FacultyUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *MedicineTypeClient) UpdateOneID(id int) *MedicineTypeUpdateOne {\n\tmutation := newMedicineTypeMutation(c.config, OpUpdateOne, withMedicineTypeID(id))\n\treturn &MedicineTypeUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *TransactionClient) UpdateOneID(id int32) *TransactionUpdateOne {\n\tmutation := newTransactionMutation(c.config, OpUpdateOne, withTransactionID(id))\n\treturn &TransactionUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *AdminSessionClient) UpdateOneID(id int) *AdminSessionUpdateOne {\n\tmutation := newAdminSessionMutation(c.config, OpUpdateOne, withAdminSessionID(id))\n\treturn &AdminSessionUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *UnsavedPostAttachmentClient) UpdateOneID(id int) *UnsavedPostAttachmentUpdateOne {\n\tmutation := newUnsavedPostAttachmentMutation(c.config, OpUpdateOne, withUnsavedPostAttachmentID(id))\n\treturn &UnsavedPostAttachmentUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *EatinghistoryClient) UpdateOneID(id int) *EatinghistoryUpdateOne {\n\tmutation := newEatinghistoryMutation(c.config, OpUpdateOne, withEatinghistoryID(id))\n\treturn &EatinghistoryUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *UnsavedPostClient) UpdateOneID(id int) *UnsavedPostUpdateOne {\n\tmutation := newUnsavedPostMutation(c.config, OpUpdateOne, withUnsavedPostID(id))\n\treturn &UnsavedPostUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *UserWalletClient) UpdateOneID(id int64) *UserWalletUpdateOne {\n\tmutation := newUserWalletMutation(c.config, OpUpdateOne, withUserWalletID(id))\n\treturn &UserWalletUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *RepairinvoiceClient) UpdateOneID(id int) *RepairinvoiceUpdateOne {\n\tmutation := newRepairinvoiceMutation(c.config, OpUpdateOne, withRepairinvoiceID(id))\n\treturn &RepairinvoiceUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *ClubappStatusClient) UpdateOneID(id int) *ClubappStatusUpdateOne {\n\tmutation := newClubappStatusMutation(c.config, OpUpdateOne, withClubappStatusID(id))\n\treturn &ClubappStatusUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *UserClient) UpdateOneID(id int64) *UserUpdateOne {\n\tmutation := newUserMutation(c.config, OpUpdateOne, withUserID(id))\n\treturn &UserUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *PledgeClient) UpdateOneID(id int) *PledgeUpdateOne {\n\tmutation := newPledgeMutation(c.config, OpUpdateOne, withPledgeID(id))\n\treturn &PledgeUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *AnnotationClient) UpdateOneID(id int) *AnnotationUpdateOne {\n\tmutation := newAnnotationMutation(c.config, OpUpdateOne, withAnnotationID(id))\n\treturn &AnnotationUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *ComplaintClient) UpdateOneID(id int) *ComplaintUpdateOne {\n\tmutation := newComplaintMutation(c.config, OpUpdateOne, withComplaintID(id))\n\treturn &ComplaintUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *PatientInfoClient) UpdateOneID(id int) *PatientInfoUpdateOne {\n\tmutation := newPatientInfoMutation(c.config, OpUpdateOne, withPatientInfoID(id))\n\treturn &PatientInfoUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *BillClient) UpdateOne(b *Bill) *BillUpdateOne {\n\tmutation := newBillMutation(c.config, OpUpdateOne, withBill(b))\n\treturn &BillUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *BillClient) UpdateOne(b *Bill) *BillUpdateOne {\n\tmutation := newBillMutation(c.config, OpUpdateOne, withBill(b))\n\treturn &BillUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *BillClient) UpdateOne(b *Bill) *BillUpdateOne {\n\tmutation := newBillMutation(c.config, OpUpdateOne, withBill(b))\n\treturn &BillUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *BedtypeClient) UpdateOne(b *Bedtype) *BedtypeUpdateOne {\n\tmutation := newBedtypeMutation(c.config, OpUpdateOne, withBedtype(b))\n\treturn &BedtypeUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}" ]
[ "0.7161348", "0.7021795", "0.70109475", "0.6987695", "0.6971843", "0.6971843", "0.6971843", "0.6955421", "0.6893299", "0.6873468", "0.686999", "0.6867514", "0.68326384", "0.67677706", "0.676005", "0.67582935", "0.67317337", "0.6730868", "0.6728914", "0.6725172", "0.67245674", "0.67212975", "0.67189515", "0.67189515", "0.67102355", "0.6707127", "0.669769", "0.6690616", "0.66827035", "0.66774124", "0.6675087", "0.66744506", "0.66744506", "0.66643935", "0.6663119", "0.6659082", "0.6657644", "0.6655289", "0.6655261", "0.6653554", "0.66460645", "0.66460645", "0.663756", "0.6631523", "0.6624707", "0.6623987", "0.6601843", "0.65797526", "0.6576547", "0.6568908", "0.65603995", "0.6557924", "0.6552158", "0.6549937", "0.6521825", "0.65147156", "0.65147156", "0.65147156", "0.65099955", "0.65054363", "0.648952", "0.6478015", "0.6473789", "0.6471547", "0.6471048", "0.6470727", "0.6462047", "0.6457952", "0.64534163", "0.64484423", "0.6447777", "0.6440799", "0.6436213", "0.64297175", "0.6427824", "0.6427824", "0.6427824", "0.6427824", "0.6427824", "0.6427824", "0.6427824", "0.6426412", "0.64258724", "0.6424467", "0.6424315", "0.64222825", "0.64198", "0.6416395", "0.6413874", "0.64108914", "0.640751", "0.6402095", "0.63971955", "0.6396155", "0.63862425", "0.63839704", "0.6378773", "0.6378773", "0.6378773", "0.6374693" ]
0.6627142
44
Delete returns a delete builder for Post.
func (c *PostClient) Delete() *PostDelete { mutation := newPostMutation(c.config, OpDelete) return &PostDelete{config: c.config, hooks: c.Hooks(), mutation: mutation} }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (c *UnsavedPostClient) Delete() *UnsavedPostDelete {\n\tmutation := newUnsavedPostMutation(c.config, OpDelete)\n\treturn &UnsavedPostDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (p *postsQueryBuilder) Delete() (int64, error) {\n\tif p.err != nil {\n\t\treturn 0, p.err\n\t}\n\treturn p.builder.Delete()\n}", "func (c *BuildingClient) Delete() *BuildingDelete {\n\tmutation := newBuildingMutation(c.config, OpDelete)\n\treturn &BuildingDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *BedtypeClient) Delete() *BedtypeDelete {\n\tmutation := newBedtypeMutation(c.config, OpDelete)\n\treturn &BedtypeDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (mock *MockRepository) Delete(post *entity.Post) error {\n\treturn nil\n}", "func (c *BeerClient) Delete() *BeerDelete {\n\tmutation := newBeerMutation(c.config, OpDelete)\n\treturn &BeerDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *PostAttachmentClient) Delete() *PostAttachmentDelete {\n\tmutation := newPostAttachmentMutation(c.config, OpDelete)\n\treturn &PostAttachmentDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (b *QueryBuilder) Delete() {\n}", "func NewDeleteBuilder() *DeleteBuilder {\n\treturn &DeleteBuilder{}\n}", "func (c *DentistClient) Delete() *DentistDelete {\n\tmutation := newDentistMutation(c.config, OpDelete)\n\treturn &DentistDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *QueueClient) Delete() *QueueDelete {\n\tmutation := newQueueMutation(c.config, OpDelete)\n\treturn &QueueDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *UnsavedPostAttachmentClient) Delete() *UnsavedPostAttachmentDelete {\n\tmutation := newUnsavedPostAttachmentMutation(c.config, OpDelete)\n\treturn &UnsavedPostAttachmentDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *PostImageClient) Delete() *PostImageDelete {\n\tmutation := newPostImageMutation(c.config, OpDelete)\n\treturn &PostImageDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (b *Builder) Delete(url string) *Builder {\n\tb.Url = url\n\tb.Method = http.MethodDelete\n\treturn b\n}", "func (c *CleaningroomClient) Delete() *CleaningroomDelete {\n\tmutation := newCleaningroomMutation(c.config, OpDelete)\n\treturn &CleaningroomDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (dsl *PutDSL) Delete() linux.DeleteDSL {\n\treturn &DeleteDSL{dsl.parent, dsl.vppPut.Delete()}\n}", "func (dsl *PutDSL) Delete() linux.DeleteDSL {\n\treturn &DeleteDSL{dsl.parent, dsl.vppPut.Delete()}\n}", "func (b *Builder) Delete(conds ...Cond) *Builder {\r\n\tb.cond = b.cond.And(conds...)\r\n\tb.optype = deleteType\r\n\treturn b\r\n}", "func Delete(c *gin.Context) {\r\n\tpost := getById(c)\r\n\tif post.ID == 0 {\r\n\t\treturn\r\n\t}\r\n\tdb.Unscoped().Delete(&post)\r\n\tc.JSON(http.StatusOK, gin.H{\r\n\t\t\"messege\": \"deleted successfuly\",\r\n\t\t\"data\": \"\",\r\n\t})\r\n}", "func (c *AdminClient) Delete() *AdminDelete {\n\tmutation := newAdminMutation(c.config, OpDelete)\n\treturn &AdminDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func Delete(conds ...Cond) *Builder {\r\n\tbuilder := &Builder{cond: NewCond()}\r\n\treturn builder.Delete(conds...)\r\n}", "func (c *DoctorClient) Delete() *DoctorDelete {\n\tmutation := newDoctorMutation(c.config, OpDelete)\n\treturn &DoctorDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *PharmacistClient) Delete() *PharmacistDelete {\n\tmutation := newPharmacistMutation(c.config, OpDelete)\n\treturn &PharmacistDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *PostVideoClient) Delete() *PostVideoDelete {\n\tmutation := newPostVideoMutation(c.config, OpDelete)\n\treturn &PostVideoDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *Client) Delete() *Request {\n\treturn NewRequest(c.httpClient, c.base, \"DELETE\", c.version, c.authstring, c.userAgent)\n}", "func (c *MedicineClient) Delete() *MedicineDelete {\n\tmutation := newMedicineMutation(c.config, OpDelete)\n\treturn &MedicineDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *OperationClient) Delete() *OperationDelete {\n\tmutation := newOperationMutation(c.config, OpDelete)\n\treturn &OperationDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *DNSBLQueryClient) Delete() *DNSBLQueryDelete {\n\tmutation := newDNSBLQueryMutation(c.config, OpDelete)\n\treturn &DNSBLQueryDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *PetruleClient) Delete() *PetruleDelete {\n\tmutation := newPetruleMutation(c.config, OpDelete)\n\treturn &PetruleDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *TagClient) Delete() *TagDelete {\n\tmutation := newTagMutation(c.config, OpDelete)\n\treturn &TagDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *UnsavedPostImageClient) Delete() *UnsavedPostImageDelete {\n\tmutation := newUnsavedPostImageMutation(c.config, OpDelete)\n\treturn &UnsavedPostImageDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *BillClient) Delete() *BillDelete {\n\tmutation := newBillMutation(c.config, OpDelete)\n\treturn &BillDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *BillClient) Delete() *BillDelete {\n\tmutation := newBillMutation(c.config, OpDelete)\n\treturn &BillDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *BillClient) Delete() *BillDelete {\n\tmutation := newBillMutation(c.config, OpDelete)\n\treturn &BillDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *PetClient) Delete() *PetDelete {\n\tmutation := newPetMutation(c.config, OpDelete)\n\treturn &PetDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *MealplanClient) Delete() *MealplanDelete {\n\tmutation := newMealplanMutation(c.config, OpDelete)\n\treturn &MealplanDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *MedicineTypeClient) Delete() *MedicineTypeDelete {\n\tmutation := newMedicineTypeMutation(c.config, OpDelete)\n\treturn &MedicineTypeDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *DeviceClient) Delete() *DeviceDelete {\n\tmutation := newDeviceMutation(c.config, OpDelete)\n\treturn &DeviceDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *ReviewClient) Delete() *ReviewDelete {\n\tmutation := newReviewMutation(c.config, OpDelete)\n\treturn &ReviewDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *OperativerecordClient) Delete() *OperativerecordDelete {\n\tmutation := newOperativerecordMutation(c.config, OpDelete)\n\treturn &OperativerecordDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *RoomdetailClient) Delete() *RoomdetailDelete {\n\tmutation := newRoomdetailMutation(c.config, OpDelete)\n\treturn &RoomdetailDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *UsertypeClient) Delete() *UsertypeDelete {\n\tmutation := newUsertypeMutation(c.config, OpDelete)\n\treturn &UsertypeDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (b *JoinBuilder) Delete(tables ...*Table) *DeleteBuilder {\n\treturn makeDeleteBuilder(b, tables...)\n}", "func (c *EmptyClient) Delete() *EmptyDelete {\n\tmutation := newEmptyMutation(c.config, OpDelete)\n\treturn &EmptyDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *OperativeClient) Delete() *OperativeDelete {\n\tmutation := newOperativeMutation(c.config, OpDelete)\n\treturn &OperativeDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *PostThumbnailClient) Delete() *PostThumbnailDelete {\n\tmutation := newPostThumbnailMutation(c.config, OpDelete)\n\treturn &PostThumbnailDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *commentsQueryBuilder) Delete() (int64, error) {\n\tif c.err != nil {\n\t\treturn 0, c.err\n\t}\n\treturn c.builder.Delete()\n}", "func (c *StatusdClient) Delete() *StatusdDelete {\n\tmutation := newStatusdMutation(c.config, OpDelete)\n\treturn &StatusdDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func NewDeletePostMaterial(ctx *middleware.Context, handler DeletePostMaterialHandler) *DeletePostMaterial {\n\treturn &DeletePostMaterial{Context: ctx, Handler: handler}\n}", "func (c *NurseClient) Delete() *NurseDelete {\n\tmutation := newNurseMutation(c.config, OpDelete)\n\treturn &NurseDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *DepositClient) Delete() *DepositDelete {\n\tmutation := newDepositMutation(c.config, OpDelete)\n\treturn &DepositDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *BranchClient) Delete() *BranchDelete {\n\tmutation := newBranchMutation(c.config, OpDelete)\n\treturn &BranchDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *TransactionClient) Delete() *TransactionDelete {\n\tmutation := newTransactionMutation(c.config, OpDelete)\n\treturn &TransactionDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *ToolClient) Delete() *ToolDelete {\n\tmutation := newToolMutation(c.config, OpDelete)\n\treturn &ToolDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *CleanernameClient) Delete() *CleanernameDelete {\n\tmutation := newCleanernameMutation(c.config, OpDelete)\n\treturn &CleanernameDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *PatientroomClient) Delete() *PatientroomDelete {\n\tmutation := newPatientroomMutation(c.config, OpDelete)\n\treturn &PatientroomDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func BuildDel(key string) *Cmd {\n\treturn Build(key, \"DEL\", key)\n}", "func (c *FoodmenuClient) Delete() *FoodmenuDelete {\n\tmutation := newFoodmenuMutation(c.config, OpDelete)\n\treturn &FoodmenuDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *DepartmentClient) Delete() *DepartmentDelete {\n\tmutation := newDepartmentMutation(c.config, OpDelete)\n\treturn &DepartmentDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (op *DeleteOp) Delete(val string) *DeleteOp {\n\tif op != nil {\n\t\top.QueryOpts.Set(\"delete\", val)\n\t}\n\treturn op\n}", "func (c *PartorderClient) Delete() *PartorderDelete {\n\tmutation := newPartorderMutation(c.config, OpDelete)\n\treturn &PartorderDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *PhysicianClient) Delete() *PhysicianDelete {\n\tmutation := newPhysicianMutation(c.config, OpDelete)\n\treturn &PhysicianDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *PhysicianClient) Delete() *PhysicianDelete {\n\tmutation := newPhysicianMutation(c.config, OpDelete)\n\treturn &PhysicianDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *OrderClient) Delete() *OrderDelete {\n\tmutation := newOrderMutation(c.config, OpDelete)\n\treturn &OrderDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (post *Post) delete() (err error) {\n\t_, err = Db.Exec(\"delete from posts where id = $1\", post.Id)\n\treturn\n}", "func (c *LeaseClient) Delete() *LeaseDelete {\n\tmutation := newLeaseMutation(c.config, OpDelete)\n\treturn &LeaseDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *PatientClient) Delete() *PatientDelete {\n\tmutation := newPatientMutation(c.config, OpDelete)\n\treturn &PatientDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *PatientClient) Delete() *PatientDelete {\n\tmutation := newPatientMutation(c.config, OpDelete)\n\treturn &PatientDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *PatientClient) Delete() *PatientDelete {\n\tmutation := newPatientMutation(c.config, OpDelete)\n\treturn &PatientDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *RoomuseClient) Delete() *RoomuseDelete {\n\tmutation := newRoomuseMutation(c.config, OpDelete)\n\treturn &RoomuseDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (s *ServerState) deletePost(c *gin.Context) {\n\n\tc.JSON(http.StatusOK, gin.H{\"status\": \"success\"})\n}", "func makeDeletePostHandler(m *http.ServeMux, endpoints endpoint.Endpoints, options []http1.ServerOption) {\n\tm.Handle(\"/delete-post\", http1.NewServer(endpoints.DeletePostEndpoint, decodeDeletePostRequest, encodeDeletePostResponse, options...))\n}", "func (controller *EchoController) Delete(context *qhttp.Context) {\n\tcontroller.Get(context)\n}", "func (c *UnsavedPostVideoClient) Delete() *UnsavedPostVideoDelete {\n\tmutation := newUnsavedPostVideoMutation(c.config, OpDelete)\n\treturn &UnsavedPostVideoDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (repository Posts) Delete(postID uint64) error {\n\tdbStatement, err := repository.db.Prepare(\n\t\t\"DELETE FROM posts WHERE id = ?\",\n\t)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer dbStatement.Close()\n\n\tif _, err = dbStatement.Exec(postID); err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func (c *StatustClient) Delete() *StatustDelete {\n\tmutation := newStatustMutation(c.config, OpDelete)\n\treturn &StatustDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *DispenseMedicineClient) Delete() *DispenseMedicineDelete {\n\tmutation := newDispenseMedicineMutation(c.config, OpDelete)\n\treturn &DispenseMedicineDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *EventClient) Delete() *EventDelete {\n\tmutation := newEventMutation(c.config, OpDelete)\n\treturn &EventDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *PartClient) Delete() *PartDelete {\n\tmutation := newPartMutation(c.config, OpDelete)\n\treturn &PartDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *StaytypeClient) Delete() *StaytypeDelete {\n\tmutation := newStaytypeMutation(c.config, OpDelete)\n\treturn &StaytypeDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func NewDelete(appName string) *commander.CommandWrapper {\n\treturn &commander.CommandWrapper{\n\t\tHandler: &Delete{},\n\t\tHelp: &commander.CommandDescriptor{\n\t\t\tName: \"delete\",\n\t\t\tShortDescription: \"Delete a server.\",\n\t\t\tLongDescription: `Delete a server will destroy the world and container and the version file.`,\n\t\t\tArguments: \"name\",\n\t\t\tExamples: []string{\"\", \"my_server\"},\n\t\t},\n\t}\n}", "func (c *TasteClient) Delete() *TasteDelete {\n\tmutation := newTasteMutation(c.config, OpDelete)\n\treturn &TasteDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func Delete(g *types.Cmd) {\n\tg.AddOptions(\"--delete\")\n}", "func (c *MediaClient) Delete() *MediaDelete {\n\tmutation := newMediaMutation(c.config, OpDelete)\n\treturn &MediaDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *PaymentClient) Delete() *PaymentDelete {\n\tmutation := newPaymentMutation(c.config, OpDelete)\n\treturn &PaymentDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *PaymentClient) Delete() *PaymentDelete {\n\tmutation := newPaymentMutation(c.config, OpDelete)\n\treturn &PaymentDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *CardClient) Delete() *CardDelete {\n\tmutation := newCardMutation(c.config, OpDelete)\n\treturn &CardDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *ComplaintClient) Delete() *ComplaintDelete {\n\tmutation := newComplaintMutation(c.config, OpDelete)\n\treturn &ComplaintDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *DrugAllergyClient) Delete() *DrugAllergyDelete {\n\tmutation := newDrugAllergyMutation(c.config, OpDelete)\n\treturn &DrugAllergyDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *OperationroomClient) Delete() *OperationroomDelete {\n\tmutation := newOperationroomMutation(c.config, OpDelete)\n\treturn &OperationroomDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (s *BlugService) DeletePost(ctx context.Context, id int) (err error) {\n\tdefer func(begin time.Time) {\n\t\ts.Logger.Info(\n\t\t\t\"blug\",\n\t\t\tzap.String(\"method\", \"deletepost\"),\n\t\t\tzap.Int(\"id\", id),\n\t\t\tzap.NamedError(\"err\", err),\n\t\t\tzap.Duration(\"took\", time.Since(begin)),\n\t\t)\n\t}(time.Now())\n\n\terr = s.DB.DeletePost(id)\n\n\treturn err\n}", "func (c *ComplaintTypeClient) Delete() *ComplaintTypeDelete {\n\tmutation := newComplaintTypeMutation(c.config, OpDelete)\n\treturn &ComplaintTypeDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func DestroyPost(w http.ResponseWriter, r *http.Request) {\n\n\tdb, err := sqlx.Connect(\"postgres\", connStr)\n\tif err != nil {\n\t\tfmt.Println(err)\n\t}\n\n\tw.Header().Set(\"Content-Type\", \"application/json\")\n\n\tparams := mux.Vars(r)\n\tquery := \"delete from posts where id=\" + params[\"id\"]\n\n\tdb.MustExec(query)\n}", "func PostDeleteEndpoint(deleter deleting.Service) func(w http.ResponseWriter, r *http.Request) {\n\treturn func(w http.ResponseWriter, r *http.Request) {\n\t\tw.Header().Set(\"Content-Type\", \"application/json\")\n\n\t\tid := mux.Vars(r)[\"id\"]\n\n\t\t// Delete a post.\n\t\terr := deleter.PostDelete(id)\n\t\tif err != nil {\n\t\t\tlog.Println(\"Error deleting a post:\", err)\n\t\t\thttp.Error(w, err.Error(), http.StatusBadRequest)\n\t\t\treturn\n\t\t}\n\n\t\tw.WriteHeader(http.StatusNoContent)\n\t}\n}", "func DeletePostController(c *gin.Context) {\n\n\t// Get parameters from validate middleware\n\tparams := c.MustGet(\"params\").([]uint)\n\n\t// get userdata from user middleware\n\tuserdata := c.MustGet(\"userdata\").(user.User)\n\n\tif !c.MustGet(\"protected\").(bool) {\n\t\tc.JSON(e.ErrorMessage(e.ErrInternalError))\n\t\tc.Error(e.ErrInternalError).SetMeta(\"DeletePostController.protected\")\n\t\treturn\n\t}\n\n\t// Initialize model struct\n\tm := &models.DeletePostModel{\n\t\tIb: params[0],\n\t\tThread: params[1],\n\t\tID: params[2],\n\t}\n\n\t// Check the record id and get further info\n\terr := m.Status()\n\tif err == e.ErrNotFound {\n\t\tc.JSON(e.ErrorMessage(e.ErrNotFound))\n\t\tc.Error(err).SetMeta(\"DeletePostController.Status\")\n\t\treturn\n\t} else if err != nil {\n\t\tc.JSON(e.ErrorMessage(e.ErrInternalError))\n\t\tc.Error(err).SetMeta(\"DeletePostController.Status\")\n\t\treturn\n\t}\n\n\t// Delete data\n\terr = m.Delete()\n\tif err != nil {\n\t\tc.JSON(e.ErrorMessage(e.ErrInternalError))\n\t\tc.Error(err).SetMeta(\"DeletePostController.Delete\")\n\t\treturn\n\t}\n\n\t// Delete redis stuff\n\tindexKey := fmt.Sprintf(\"%s:%d\", \"index\", m.Ib)\n\tdirectoryKey := fmt.Sprintf(\"%s:%d\", \"directory\", m.Ib)\n\tthreadKey := fmt.Sprintf(\"%s:%d:%d\", \"thread\", m.Ib, m.Thread)\n\tpostKey := fmt.Sprintf(\"%s:%d:%d\", \"post\", m.Ib, m.Thread)\n\ttagsKey := fmt.Sprintf(\"%s:%d\", \"tags\", m.Ib)\n\timageKey := fmt.Sprintf(\"%s:%d\", \"image\", m.Ib)\n\tnewKey := fmt.Sprintf(\"%s:%d\", \"new\", m.Ib)\n\tpopularKey := fmt.Sprintf(\"%s:%d\", \"popular\", m.Ib)\n\tfavoritedKey := fmt.Sprintf(\"%s:%d\", \"favorited\", m.Ib)\n\n\terr = redis.Cache.Delete(indexKey, directoryKey, threadKey, postKey, tagsKey, imageKey, newKey, popularKey, favoritedKey)\n\tif err != nil {\n\t\tc.JSON(e.ErrorMessage(e.ErrInternalError))\n\t\tc.Error(err).SetMeta(\"DeletePostController.redis.Cache.Delete\")\n\t\treturn\n\t}\n\n\t// response message\n\tc.JSON(http.StatusOK, gin.H{\"success_message\": audit.AuditDeletePost})\n\n\t// audit log\n\taudit := audit.Audit{\n\t\tUser: userdata.ID,\n\t\tIb: m.Ib,\n\t\tType: audit.ModLog,\n\t\tIP: c.ClientIP(),\n\t\tAction: audit.AuditDeletePost,\n\t\tInfo: fmt.Sprintf(\"%s/%d\", m.Name, m.ID),\n\t}\n\n\t// submit audit\n\terr = audit.Submit()\n\tif err != nil {\n\t\tc.Error(err).SetMeta(\"DeletePostController.audit.Submit\")\n\t}\n\n}", "func (c *BookingClient) Delete() *BookingDelete {\n\tmutation := newBookingMutation(c.config, OpDelete)\n\treturn &BookingDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func DeletePostHandler(w http.ResponseWriter, r *http.Request, params httprouter.Params) {\n\turl := fmt.Sprintf(\"%s/%s\", postsUrl, params.ByName(\"id\"))\n\tresponse, err := restClient.Delete(url, r, r.Header)\n\n\tif err != nil {\n\t\trestClient.WriteErrorResponse(w, \"server_error\", \"Server error occured\")\n\t\treturn\n\t}\n\n\tvar post Post\n\trestClient.WriteJSONResponse(w, response, post)\n}", "func (b *blogsQueryBuilder) Delete() (int64, error) {\n\tif b.err != nil {\n\t\treturn 0, b.err\n\t}\n\treturn b.builder.Delete()\n}", "func delPost(w http.ResponseWriter, r *http.Request) {\n\n\t// Figure out which post they want to delete\n\tidStr := r.URL.Query().Get(\":id\")\n\n\t// Convert their input to an int\n\tid, err := strconv.Atoi(idStr)\n\tif err != nil {\n\t\thttp.Error(w, err.Error(), http.StatusBadRequest)\n\t\treturn\n\t}\n\n\t// Make sure it's a Post that exists\n\tif id < 0 || id >= len(db) {\n\t\thttp.Error(w, err.Error(), http.StatusNotFound)\n\t\treturn\n\t}\n\n\tdb = append(db[:id], db[id+1:]...)\n\n\tw.WriteHeader(http.StatusNoContent)\n}", "func (env *Env) DeletePost(w http.ResponseWriter, r *http.Request) {\n\t// Grab the context to get the user\n\tctx := r.Context()\n\tuser := ctx.Value(contextUser).(*models.User)\n\tid, err := uuid.Parse(chi.URLParam(r, \"postID\"))\n\tif err != nil {\n\t\tenv.log(r, err)\n\t\tw.WriteHeader(http.StatusBadRequest)\n\t\treturn\n\t}\n\t// Ignored returned post since it was deleted\n\t_, err = env.DB.DeletePost(id, user.ID)\n\tif err != nil {\n\t\tenv.log(r, err)\n\t\tw.WriteHeader(http.StatusInternalServerError)\n\t\treturn\n\t}\n\tw.WriteHeader(http.StatusOK)\n}" ]
[ "0.70245636", "0.6633888", "0.66225594", "0.65524584", "0.6465871", "0.64069337", "0.6406809", "0.6224442", "0.61901903", "0.6156969", "0.61420804", "0.6119911", "0.6119898", "0.6090632", "0.608237", "0.6078205", "0.6078205", "0.6075719", "0.606926", "0.6050583", "0.60391456", "0.6035515", "0.603381", "0.6031017", "0.6026175", "0.60245436", "0.6013871", "0.60055107", "0.59894234", "0.59863245", "0.5983338", "0.5965925", "0.5965925", "0.5965925", "0.5903607", "0.5900994", "0.59001774", "0.5870789", "0.58639026", "0.58636343", "0.5850915", "0.58220255", "0.5816572", "0.5807177", "0.5802396", "0.5793242", "0.57907057", "0.577367", "0.576465", "0.5763592", "0.57496667", "0.5723932", "0.57211566", "0.5719356", "0.5714982", "0.57143354", "0.57078916", "0.5703951", "0.5699953", "0.56884366", "0.56880116", "0.56838727", "0.56838727", "0.5681133", "0.5679672", "0.56788784", "0.56777936", "0.56777936", "0.56777936", "0.5676678", "0.56743544", "0.566969", "0.5662323", "0.5661586", "0.5653985", "0.5646293", "0.5641912", "0.5637035", "0.56286615", "0.56269455", "0.5626523", "0.5626345", "0.56205577", "0.5615864", "0.56106853", "0.56106853", "0.56070215", "0.560354", "0.5600251", "0.55899996", "0.5586581", "0.5585489", "0.5583422", "0.557572", "0.55676115", "0.55634516", "0.55622816", "0.5561799", "0.5561536", "0.55589473" ]
0.7515086
0
DeleteOne returns a delete builder for the given entity.
func (c *PostClient) DeleteOne(po *Post) *PostDeleteOne { return c.DeleteOneID(po.ID) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (c *BuildingClient) DeleteOne(b *Building) *BuildingDeleteOne {\n\treturn c.DeleteOneID(b.ID)\n}", "func (c *DeviceClient) DeleteOne(d *Device) *DeviceDeleteOne {\n\treturn c.DeleteOneID(d.ID)\n}", "func (c *EmptyClient) DeleteOne(e *Empty) *EmptyDeleteOne {\n\treturn c.DeleteOneID(e.ID)\n}", "func (c *DentistClient) DeleteOne(d *Dentist) *DentistDeleteOne {\n\treturn c.DeleteOneID(d.ID)\n}", "func (c *BedtypeClient) DeleteOne(b *Bedtype) *BedtypeDeleteOne {\n\treturn c.DeleteOneID(b.ID)\n}", "func (c *OperativerecordClient) DeleteOne(o *Operativerecord) *OperativerecordDeleteOne {\n\treturn c.DeleteOneID(o.ID)\n}", "func (c *OperationClient) DeleteOne(o *Operation) *OperationDeleteOne {\n\treturn c.DeleteOneID(o.ID)\n}", "func (c *DNSBLQueryClient) DeleteOne(dq *DNSBLQuery) *DNSBLQueryDeleteOne {\n\treturn c.DeleteOneID(dq.ID)\n}", "func (c *DispenseMedicineClient) DeleteOne(dm *DispenseMedicine) *DispenseMedicineDeleteOne {\n\treturn c.DeleteOneID(dm.ID)\n}", "func (c *Command) DeleteOne() (int64, error) {\n\tclient := c.set.gom.GetClient()\n\n\tcollection := client.Database(c.set.gom.GetDatabase()).Collection(c.set.tableName)\n\n\tif len(c.set.filter.(bson.M)) == 0 {\n\t\treturn 0, errors.New(\"filter can't be empty\")\n\t}\n\n\tctx, cancelFunc := c.set.GetContext()\n\tdefer cancelFunc()\n\n\tres, err := collection.DeleteOne(ctx, c.set.filter)\n\n\tif err != nil {\n\t\treturn 0, err\n\t}\n\n\treturn res.DeletedCount, nil\n}", "func (c *DoctorClient) DeleteOne(d *Doctor) *DoctorDeleteOne {\n\treturn c.DeleteOneID(d.ID)\n}", "func NewDeleteOneModel() *DeleteOneModel {\n\treturn &DeleteOneModel{}\n}", "func (c *DrugAllergyClient) DeleteOne(da *DrugAllergy) *DrugAllergyDeleteOne {\n\treturn c.DeleteOneID(da.ID)\n}", "func (c *BeerClient) DeleteOne(b *Beer) *BeerDeleteOne {\n\treturn c.DeleteOneID(b.ID)\n}", "func (d *Demo) DeleteOne(g *gom.Gom) {\n\ttoolkit.Println(\"===== Delete One =====\")\n\n\tvar err error\n\tif d.useParams {\n\t\t_, err = g.Set(&gom.SetParams{\n\t\t\tTableName: \"hero\",\n\t\t\tFilter: gom.Eq(\"Name\", \"Batman\"),\n\t\t\tTimeout: 10,\n\t\t}).Cmd().DeleteOne()\n\t} else {\n\t\t_, err = g.Set(nil).Table(\"hero\").Timeout(10).Filter(gom.Eq(\"Name\", \"Batman\")).Cmd().DeleteOne()\n\t}\n\n\tif err != nil {\n\t\ttoolkit.Println(err.Error())\n\t\treturn\n\t}\n}", "func (c *OrderClient) DeleteOne(o *Order) *OrderDeleteOne {\n\treturn c.DeleteOneID(o.ID)\n}", "func (c *AdminClient) DeleteOne(a *Admin) *AdminDeleteOne {\n\treturn c.DeleteOneID(a.ID)\n}", "func (c *PharmacistClient) DeleteOne(ph *Pharmacist) *PharmacistDeleteOne {\n\treturn c.DeleteOneID(ph.ID)\n}", "func (c *FoodmenuClient) DeleteOne(f *Foodmenu) *FoodmenuDeleteOne {\n\treturn c.DeleteOneID(f.ID)\n}", "func (c *CleaningroomClient) DeleteOne(cl *Cleaningroom) *CleaningroomDeleteOne {\n\treturn c.DeleteOneID(cl.ID)\n}", "func (c *PatientClient) DeleteOne(pa *Patient) *PatientDeleteOne {\n\treturn c.DeleteOneID(pa.ID)\n}", "func (c *PatientClient) DeleteOne(pa *Patient) *PatientDeleteOne {\n\treturn c.DeleteOneID(pa.ID)\n}", "func (c *PatientClient) DeleteOne(pa *Patient) *PatientDeleteOne {\n\treturn c.DeleteOneID(pa.ID)\n}", "func (c *CompanyClient) DeleteOne(co *Company) *CompanyDeleteOne {\n\treturn c.DeleteOneID(co.ID)\n}", "func (c *CompanyClient) DeleteOne(co *Company) *CompanyDeleteOne {\n\treturn c.DeleteOneID(co.ID)\n}", "func (c *DepositClient) DeleteOne(d *Deposit) *DepositDeleteOne {\n\treturn c.DeleteOneID(d.ID)\n}", "func (c *OperativeClient) DeleteOne(o *Operative) *OperativeDeleteOne {\n\treturn c.DeleteOneID(o.ID)\n}", "func (c *EventClient) DeleteOne(e *Event) *EventDeleteOne {\n\treturn c.DeleteOneID(e.ID)\n}", "func (c *UnsavedPostClient) DeleteOne(up *UnsavedPost) *UnsavedPostDeleteOne {\n\treturn c.DeleteOneID(up.ID)\n}", "func (c *BedtypeClient) DeleteOneID(id int) *BedtypeDeleteOne {\n\tbuilder := c.Delete().Where(bedtype.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &BedtypeDeleteOne{builder}\n}", "func (c *MedicineClient) DeleteOne(m *Medicine) *MedicineDeleteOne {\n\treturn c.DeleteOneID(m.ID)\n}", "func (c *OperativerecordClient) DeleteOneID(id int) *OperativerecordDeleteOne {\n\tbuilder := c.Delete().Where(operativerecord.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &OperativerecordDeleteOne{builder}\n}", "func (c *PatientofphysicianClient) DeleteOne(pa *Patientofphysician) *PatientofphysicianDeleteOne {\n\treturn c.DeleteOneID(pa.ID)\n}", "func (c *PhysicianClient) DeleteOne(ph *Physician) *PhysicianDeleteOne {\n\treturn c.DeleteOneID(ph.ID)\n}", "func (c *PhysicianClient) DeleteOne(ph *Physician) *PhysicianDeleteOne {\n\treturn c.DeleteOneID(ph.ID)\n}", "func DeleteOne(ctx context.Context, tx pgx.Tx, sb sq.DeleteBuilder) error {\n\tq, vs, err := sb.ToSql()\n\tif err != nil {\n\t\treturn err\n\t}\n\ttag, err := tx.Exec(ctx, q, vs...)\n\tif err != nil {\n\t\treturn err\n\t}\n\tif tag.RowsAffected() != 1 {\n\t\treturn ErrNoRowsAffected\n\t}\n\treturn nil\n}", "func (c *TransactionClient) DeleteOne(t *Transaction) *TransactionDeleteOne {\n\treturn c.DeleteOneID(t.ID)\n}", "func (c *LevelOfDangerousClient) DeleteOne(lod *LevelOfDangerous) *LevelOfDangerousDeleteOne {\n\treturn c.DeleteOneID(lod.ID)\n}", "func (c *BillClient) DeleteOne(b *Bill) *BillDeleteOne {\n\treturn c.DeleteOneID(b.ID)\n}", "func (c *BillClient) DeleteOne(b *Bill) *BillDeleteOne {\n\treturn c.DeleteOneID(b.ID)\n}", "func (c *BillClient) DeleteOne(b *Bill) *BillDeleteOne {\n\treturn c.DeleteOneID(b.ID)\n}", "func (c *PaymentClient) DeleteOne(pa *Payment) *PaymentDeleteOne {\n\treturn c.DeleteOneID(pa.ID)\n}", "func (c *PaymentClient) DeleteOne(pa *Payment) *PaymentDeleteOne {\n\treturn c.DeleteOneID(pa.ID)\n}", "func (c *CleanernameClient) DeleteOne(cl *Cleanername) *CleanernameDeleteOne {\n\treturn c.DeleteOneID(cl.ID)\n}", "func (d *DBRepository) deleteOne(ctx context.Context, id string) error {\n\tobjectId, err := primitive.ObjectIDFromHex(id)\n\tif err != nil {\n\t\treturn err\n\t}\n\tif _, err := d.Collection.DeleteOne(ctx, bson.M{\"_id\": objectId}); err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "func (c *MedicineTypeClient) DeleteOne(mt *MedicineType) *MedicineTypeDeleteOne {\n\treturn c.DeleteOneID(mt.ID)\n}", "func (c *StatusdClient) DeleteOne(s *Statusd) *StatusdDeleteOne {\n\treturn c.DeleteOneID(s.ID)\n}", "func (c *ToolClient) DeleteOne(t *Tool) *ToolDeleteOne {\n\treturn c.DeleteOneID(t.ID)\n}", "func (c *ActivityTypeClient) DeleteOne(at *ActivityType) *ActivityTypeDeleteOne {\n\treturn c.DeleteOneID(at.ID)\n}", "func (c *LevelOfDangerousClient) DeleteOneID(id int) *LevelOfDangerousDeleteOne {\n\tbuilder := c.Delete().Where(levelofdangerous.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &LevelOfDangerousDeleteOne{builder}\n}", "func (c *OperationroomClient) DeleteOne(o *Operationroom) *OperationroomDeleteOne {\n\treturn c.DeleteOneID(o.ID)\n}", "func (c *TagClient) DeleteOne(t *Tag) *TagDeleteOne {\n\treturn c.DeleteOneID(t.ID)\n}", "func (c *DentistClient) DeleteOneID(id int) *DentistDeleteOne {\n\tbuilder := c.Delete().Where(dentist.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &DentistDeleteOne{builder}\n}", "func (c *OperativeClient) DeleteOneID(id int) *OperativeDeleteOne {\n\tbuilder := c.Delete().Where(operative.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &OperativeDeleteOne{builder}\n}", "func NewDeleteOneNoContent() *DeleteOneNoContent {\n\treturn &DeleteOneNoContent{}\n}", "func (c *UnsavedPostClient) DeleteOneID(id int) *UnsavedPostDeleteOne {\n\tbuilder := c.Delete().Where(unsavedpost.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &UnsavedPostDeleteOne{builder}\n}", "func (c *StaytypeClient) DeleteOne(s *Staytype) *StaytypeDeleteOne {\n\treturn c.DeleteOneID(s.ID)\n}", "func (c *OrderClient) DeleteOneID(id int) *OrderDeleteOne {\n\tbuilder := c.Delete().Where(order.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &OrderDeleteOne{builder}\n}", "func (c *BuildingClient) DeleteOneID(id int) *BuildingDeleteOne {\n\tbuilder := c.Delete().Where(building.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &BuildingDeleteOne{builder}\n}", "func (c *PostClient) DeleteOneID(id int) *PostDeleteOne {\n\tbuilder := c.Delete().Where(post.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &PostDeleteOne{builder}\n}", "func (c *PatientroomClient) DeleteOne(pa *Patientroom) *PatientroomDeleteOne {\n\treturn c.DeleteOneID(pa.ID)\n}", "func (c *EventClient) DeleteOneID(id int) *EventDeleteOne {\n\tbuilder := c.Delete().Where(event.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &EventDeleteOne{builder}\n}", "func NewDeleteOneDefault(code int) *DeleteOneDefault {\n\treturn &DeleteOneDefault{\n\t\t_statusCode: code,\n\t}\n}", "func (c *UnsavedPostAttachmentClient) DeleteOne(upa *UnsavedPostAttachment) *UnsavedPostAttachmentDeleteOne {\n\treturn c.DeleteOneID(upa.ID)\n}", "func (c *UnitOfMedicineClient) DeleteOne(uom *UnitOfMedicine) *UnitOfMedicineDeleteOne {\n\treturn c.DeleteOneID(uom.ID)\n}", "func (c *FoodmenuClient) DeleteOneID(id int) *FoodmenuDeleteOne {\n\tbuilder := c.Delete().Where(foodmenu.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &FoodmenuDeleteOne{builder}\n}", "func (c *PostAttachmentClient) DeleteOne(pa *PostAttachment) *PostAttachmentDeleteOne {\n\treturn c.DeleteOneID(pa.ID)\n}", "func (c *DeviceClient) DeleteOneID(id int) *DeviceDeleteOne {\n\tbuilder := c.Delete().Where(device.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &DeviceDeleteOne{builder}\n}", "func (c *ToolClient) DeleteOneID(id int) *ToolDeleteOne {\n\tbuilder := c.Delete().Where(tool.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &ToolDeleteOne{builder}\n}", "func (c *AppointmentClient) DeleteOne(a *Appointment) *AppointmentDeleteOne {\n\treturn c.DeleteOneID(a.ID)\n}", "func (c *EmptyClient) DeleteOneID(id int) *EmptyDeleteOne {\n\tbuilder := c.Delete().Where(empty.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &EmptyDeleteOne{builder}\n}", "func (c *PurposeClient) DeleteOne(pu *Purpose) *PurposeDeleteOne {\n\treturn c.DeleteOneID(pu.ID)\n}", "func (c *AdminClient) DeleteOneID(id int) *AdminDeleteOne {\n\tbuilder := c.Delete().Where(admin.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &AdminDeleteOne{builder}\n}", "func (c *CleaningroomClient) DeleteOneID(id int) *CleaningroomDeleteOne {\n\tbuilder := c.Delete().Where(cleaningroom.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &CleaningroomDeleteOne{builder}\n}", "func (c *LengthtimeClient) DeleteOneID(id int) *LengthtimeDeleteOne {\n\tbuilder := c.Delete().Where(lengthtime.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &LengthtimeDeleteOne{builder}\n}", "func (c *DepartmentClient) DeleteOne(d *Department) *DepartmentDeleteOne {\n\treturn c.DeleteOneID(d.ID)\n}", "func (c *UnsavedPostAttachmentClient) DeleteOneID(id int) *UnsavedPostAttachmentDeleteOne {\n\tbuilder := c.Delete().Where(unsavedpostattachment.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &UnsavedPostAttachmentDeleteOne{builder}\n}", "func (c *PhysicianClient) DeleteOneID(id int) *PhysicianDeleteOne {\n\tbuilder := c.Delete().Where(physician.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &PhysicianDeleteOne{builder}\n}", "func (c *PhysicianClient) DeleteOneID(id int) *PhysicianDeleteOne {\n\tbuilder := c.Delete().Where(physician.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &PhysicianDeleteOne{builder}\n}", "func (c *DoctorClient) DeleteOneID(id int) *DoctorDeleteOne {\n\tbuilder := c.Delete().Where(doctor.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &DoctorDeleteOne{builder}\n}", "func (c *MealplanClient) DeleteOne(m *Mealplan) *MealplanDeleteOne {\n\treturn c.DeleteOneID(m.ID)\n}", "func (c *CleanernameClient) DeleteOneID(id int) *CleanernameDeleteOne {\n\tbuilder := c.Delete().Where(cleanername.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &CleanernameDeleteOne{builder}\n}", "func (c *ComplaintClient) DeleteOne(co *Complaint) *ComplaintDeleteOne {\n\treturn c.DeleteOneID(co.ID)\n}", "func (c *StatustClient) DeleteOneID(id int) *StatustDeleteOne {\n\tbuilder := c.Delete().Where(statust.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &StatustDeleteOne{builder}\n}", "func (c *PartorderClient) DeleteOne(pa *Partorder) *PartorderDeleteOne {\n\treturn c.DeleteOneID(pa.ID)\n}", "func (c *StaytypeClient) DeleteOneID(id int) *StaytypeDeleteOne {\n\tbuilder := c.Delete().Where(staytype.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &StaytypeDeleteOne{builder}\n}", "func (c *PatientofphysicianClient) DeleteOneID(id int) *PatientofphysicianDeleteOne {\n\tbuilder := c.Delete().Where(patientofphysician.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &PatientofphysicianDeleteOne{builder}\n}", "func (c *RoomdetailClient) DeleteOne(r *Roomdetail) *RoomdetailDeleteOne {\n\treturn c.DeleteOneID(r.ID)\n}", "func (c *BranchClient) DeleteOne(b *Branch) *BranchDeleteOne {\n\treturn c.DeleteOneID(b.ID)\n}", "func (c *UnitOfMedicineClient) DeleteOneID(id int) *UnitOfMedicineDeleteOne {\n\tbuilder := c.Delete().Where(unitofmedicine.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &UnitOfMedicineDeleteOne{builder}\n}", "func (c *TitleClient) DeleteOne(t *Title) *TitleDeleteOne {\n\treturn c.DeleteOneID(t.ID)\n}", "func (c *WorkExperienceClient) DeleteOne(we *WorkExperience) *WorkExperienceDeleteOne {\n\treturn c.DeleteOneID(we.ID)\n}", "func (c *AnnotationClient) DeleteOne(a *Annotation) *AnnotationDeleteOne {\n\treturn c.DeleteOneID(a.ID)\n}", "func (c *DispenseMedicineClient) DeleteOneID(id int) *DispenseMedicineDeleteOne {\n\tbuilder := c.Delete().Where(dispensemedicine.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &DispenseMedicineDeleteOne{builder}\n}", "func (c *UnsavedPostImageClient) DeleteOne(upi *UnsavedPostImage) *UnsavedPostImageDeleteOne {\n\treturn c.DeleteOneID(upi.ID)\n}", "func (c *DepositClient) DeleteOneID(id int) *DepositDeleteOne {\n\tbuilder := c.Delete().Where(deposit.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &DepositDeleteOne{builder}\n}", "func (c *PharmacistClient) DeleteOneID(id int) *PharmacistDeleteOne {\n\tbuilder := c.Delete().Where(pharmacist.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &PharmacistDeleteOne{builder}\n}", "func (c *PositionassingmentClient) DeleteOne(po *Positionassingment) *PositionassingmentDeleteOne {\n\treturn c.DeleteOneID(po.ID)\n}", "func (c *KeyStoreClient) DeleteOneID(id int32) *KeyStoreDeleteOne {\n\tbuilder := c.Delete().Where(keystore.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &KeyStoreDeleteOne{builder}\n}", "func (c *PaymentClient) DeleteOneID(id int) *PaymentDeleteOne {\n\tbuilder := c.Delete().Where(payment.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &PaymentDeleteOne{builder}\n}" ]
[ "0.6754239", "0.67072296", "0.67016196", "0.67011034", "0.6653609", "0.66129434", "0.6570163", "0.6555882", "0.6550148", "0.6522204", "0.6504479", "0.6499032", "0.64316624", "0.6429749", "0.64246684", "0.6418696", "0.6396313", "0.63832575", "0.6371247", "0.63639766", "0.63630384", "0.63630384", "0.63630384", "0.6355269", "0.6355269", "0.6351107", "0.63370615", "0.6333473", "0.6327508", "0.63201904", "0.63149154", "0.6302125", "0.6295902", "0.6284729", "0.6284729", "0.6276979", "0.62732875", "0.62684214", "0.6266123", "0.6266123", "0.6266123", "0.62612474", "0.62612474", "0.626064", "0.62476856", "0.6246732", "0.62460977", "0.62330806", "0.6232218", "0.6224974", "0.62241215", "0.62202203", "0.6211777", "0.6209366", "0.6203329", "0.6194709", "0.61866176", "0.6185029", "0.61803836", "0.6173257", "0.61721545", "0.61568314", "0.6156593", "0.61521", "0.6147634", "0.61444926", "0.61355424", "0.61347204", "0.6133231", "0.6115534", "0.611403", "0.611028", "0.6107552", "0.6100868", "0.60994744", "0.609352", "0.6092299", "0.60922116", "0.60922116", "0.60901564", "0.6088162", "0.608726", "0.60788137", "0.60774815", "0.6075914", "0.6070514", "0.60651606", "0.6063153", "0.6062919", "0.6060779", "0.6053847", "0.6052841", "0.6044668", "0.60371774", "0.603689", "0.6034605", "0.6022237", "0.60202974", "0.6018651", "0.60141647" ]
0.6360122
23
DeleteOneID returns a delete builder for the given id.
func (c *PostClient) DeleteOneID(id int) *PostDeleteOne { builder := c.Delete().Where(post.ID(id)) builder.mutation.id = &id builder.mutation.op = OpDeleteOne return &PostDeleteOne{builder} }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (c *BedtypeClient) DeleteOneID(id int) *BedtypeDeleteOne {\n\tbuilder := c.Delete().Where(bedtype.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &BedtypeDeleteOne{builder}\n}", "func (c *BuildingClient) DeleteOneID(id int) *BuildingDeleteOne {\n\tbuilder := c.Delete().Where(building.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &BuildingDeleteOne{builder}\n}", "func (c *LengthtimeClient) DeleteOneID(id int) *LengthtimeDeleteOne {\n\tbuilder := c.Delete().Where(lengthtime.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &LengthtimeDeleteOne{builder}\n}", "func (c *CleanernameClient) DeleteOneID(id int) *CleanernameDeleteOne {\n\tbuilder := c.Delete().Where(cleanername.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &CleanernameDeleteOne{builder}\n}", "func (c *ToolClient) DeleteOneID(id int) *ToolDeleteOne {\n\tbuilder := c.Delete().Where(tool.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &ToolDeleteOne{builder}\n}", "func (c *OperativeClient) DeleteOneID(id int) *OperativeDeleteOne {\n\tbuilder := c.Delete().Where(operative.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &OperativeDeleteOne{builder}\n}", "func (c *FoodmenuClient) DeleteOneID(id int) *FoodmenuDeleteOne {\n\tbuilder := c.Delete().Where(foodmenu.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &FoodmenuDeleteOne{builder}\n}", "func (c *CleaningroomClient) DeleteOneID(id int) *CleaningroomDeleteOne {\n\tbuilder := c.Delete().Where(cleaningroom.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &CleaningroomDeleteOne{builder}\n}", "func (c *DoctorClient) DeleteOneID(id int) *DoctorDeleteOne {\n\tbuilder := c.Delete().Where(doctor.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &DoctorDeleteOne{builder}\n}", "func (c *MealplanClient) DeleteOneID(id int) *MealplanDeleteOne {\n\tbuilder := c.Delete().Where(mealplan.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &MealplanDeleteOne{builder}\n}", "func (c *DentistClient) DeleteOneID(id int) *DentistDeleteOne {\n\tbuilder := c.Delete().Where(dentist.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &DentistDeleteOne{builder}\n}", "func (c *OperativerecordClient) DeleteOneID(id int) *OperativerecordDeleteOne {\n\tbuilder := c.Delete().Where(operativerecord.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &OperativerecordDeleteOne{builder}\n}", "func (c *LevelOfDangerousClient) DeleteOneID(id int) *LevelOfDangerousDeleteOne {\n\tbuilder := c.Delete().Where(levelofdangerous.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &LevelOfDangerousDeleteOne{builder}\n}", "func (c *PhysicianClient) DeleteOneID(id int) *PhysicianDeleteOne {\n\tbuilder := c.Delete().Where(physician.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &PhysicianDeleteOne{builder}\n}", "func (c *PhysicianClient) DeleteOneID(id int) *PhysicianDeleteOne {\n\tbuilder := c.Delete().Where(physician.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &PhysicianDeleteOne{builder}\n}", "func (c *BillClient) DeleteOneID(id int) *BillDeleteOne {\n\tbuilder := c.Delete().Where(bill.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &BillDeleteOne{builder}\n}", "func (c *BillClient) DeleteOneID(id int) *BillDeleteOne {\n\tbuilder := c.Delete().Where(bill.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &BillDeleteOne{builder}\n}", "func (c *BillClient) DeleteOneID(id int) *BillDeleteOne {\n\tbuilder := c.Delete().Where(bill.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &BillDeleteOne{builder}\n}", "func (c *DeviceClient) DeleteOneID(id int) *DeviceDeleteOne {\n\tbuilder := c.Delete().Where(device.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &DeviceDeleteOne{builder}\n}", "func (c *UnitOfMedicineClient) DeleteOneID(id int) *UnitOfMedicineDeleteOne {\n\tbuilder := c.Delete().Where(unitofmedicine.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &UnitOfMedicineDeleteOne{builder}\n}", "func (c *AdminClient) DeleteOneID(id int) *AdminDeleteOne {\n\tbuilder := c.Delete().Where(admin.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &AdminDeleteOne{builder}\n}", "func (c *DrugAllergyClient) DeleteOneID(id int) *DrugAllergyDeleteOne {\n\tbuilder := c.Delete().Where(drugallergy.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &DrugAllergyDeleteOne{builder}\n}", "func (c *RoomuseClient) DeleteOneID(id int) *RoomuseDeleteOne {\n\tbuilder := c.Delete().Where(roomuse.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &RoomuseDeleteOne{builder}\n}", "func (c *PatientofphysicianClient) DeleteOneID(id int) *PatientofphysicianDeleteOne {\n\tbuilder := c.Delete().Where(patientofphysician.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &PatientofphysicianDeleteOne{builder}\n}", "func (c *OrderClient) DeleteOneID(id int) *OrderDeleteOne {\n\tbuilder := c.Delete().Where(order.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &OrderDeleteOne{builder}\n}", "func (c *MedicineClient) DeleteOneID(id int) *MedicineDeleteOne {\n\tbuilder := c.Delete().Where(medicine.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &MedicineDeleteOne{builder}\n}", "func (c *EmptyClient) DeleteOneID(id int) *EmptyDeleteOne {\n\tbuilder := c.Delete().Where(empty.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &EmptyDeleteOne{builder}\n}", "func (c *MedicineTypeClient) DeleteOneID(id int) *MedicineTypeDeleteOne {\n\tbuilder := c.Delete().Where(medicinetype.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &MedicineTypeDeleteOne{builder}\n}", "func (c *BeerClient) DeleteOneID(id int) *BeerDeleteOne {\n\tbuilder := c.Delete().Where(beer.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &BeerDeleteOne{builder}\n}", "func (c *RoomdetailClient) DeleteOneID(id int) *RoomdetailDeleteOne {\n\tbuilder := c.Delete().Where(roomdetail.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &RoomdetailDeleteOne{builder}\n}", "func (c *StatustClient) DeleteOneID(id int) *StatustDeleteOne {\n\tbuilder := c.Delete().Where(statust.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &StatustDeleteOne{builder}\n}", "func (c *BookingClient) DeleteOneID(id int) *BookingDeleteOne {\n\tbuilder := c.Delete().Where(booking.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &BookingDeleteOne{builder}\n}", "func (c *BinaryFileClient) DeleteOneID(id int) *BinaryFileDeleteOne {\n\tbuilder := c.Delete().Where(binaryfile.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &BinaryFileDeleteOne{builder}\n}", "func (c *PharmacistClient) DeleteOneID(id int) *PharmacistDeleteOne {\n\tbuilder := c.Delete().Where(pharmacist.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &PharmacistDeleteOne{builder}\n}", "func (c *KeyStoreClient) DeleteOneID(id int32) *KeyStoreDeleteOne {\n\tbuilder := c.Delete().Where(keystore.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &KeyStoreDeleteOne{builder}\n}", "func (c *LeaseClient) DeleteOneID(id int) *LeaseDeleteOne {\n\tbuilder := c.Delete().Where(lease.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &LeaseDeleteOne{builder}\n}", "func (c *PaymentClient) DeleteOneID(id int) *PaymentDeleteOne {\n\tbuilder := c.Delete().Where(payment.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &PaymentDeleteOne{builder}\n}", "func (c *PaymentClient) DeleteOneID(id int) *PaymentDeleteOne {\n\tbuilder := c.Delete().Where(payment.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &PaymentDeleteOne{builder}\n}", "func (c *DispenseMedicineClient) DeleteOneID(id int) *DispenseMedicineDeleteOne {\n\tbuilder := c.Delete().Where(dispensemedicine.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &DispenseMedicineDeleteOne{builder}\n}", "func (c *DepositClient) DeleteOneID(id int) *DepositDeleteOne {\n\tbuilder := c.Delete().Where(deposit.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &DepositDeleteOne{builder}\n}", "func (c *StaytypeClient) DeleteOneID(id int) *StaytypeDeleteOne {\n\tbuilder := c.Delete().Where(staytype.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &StaytypeDeleteOne{builder}\n}", "func (c *OperationroomClient) DeleteOneID(id int) *OperationroomDeleteOne {\n\tbuilder := c.Delete().Where(operationroom.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &OperationroomDeleteOne{builder}\n}", "func (c *NurseClient) DeleteOneID(id int) *NurseDeleteOne {\n\tbuilder := c.Delete().Where(nurse.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &NurseDeleteOne{builder}\n}", "func (c *QueueClient) DeleteOneID(id int) *QueueDeleteOne {\n\tbuilder := c.Delete().Where(queue.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &QueueDeleteOne{builder}\n}", "func (c *OperationClient) DeleteOneID(id uuid.UUID) *OperationDeleteOne {\n\tbuilder := c.Delete().Where(operation.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &OperationDeleteOne{builder}\n}", "func (c *ComplaintClient) DeleteOneID(id int) *ComplaintDeleteOne {\n\tbuilder := c.Delete().Where(complaint.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &ComplaintDeleteOne{builder}\n}", "func (c *PatientroomClient) DeleteOneID(id int) *PatientroomDeleteOne {\n\tbuilder := c.Delete().Where(patientroom.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &PatientroomDeleteOne{builder}\n}", "func (c *ModuleClient) DeleteOneID(id int) *ModuleDeleteOne {\n\treturn &ModuleDeleteOne{c.Delete().Where(module.ID(id))}\n}", "func (c *ComplaintTypeClient) DeleteOneID(id int) *ComplaintTypeDeleteOne {\n\tbuilder := c.Delete().Where(complainttype.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &ComplaintTypeDeleteOne{builder}\n}", "func (c *PurposeClient) DeleteOneID(id int) *PurposeDeleteOne {\n\tbuilder := c.Delete().Where(purpose.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &PurposeDeleteOne{builder}\n}", "func (c *AdminSessionClient) DeleteOneID(id int) *AdminSessionDeleteOne {\n\tbuilder := c.Delete().Where(adminsession.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &AdminSessionDeleteOne{builder}\n}", "func (c *StatusdClient) DeleteOneID(id int) *StatusdDeleteOne {\n\tbuilder := c.Delete().Where(statusd.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &StatusdDeleteOne{builder}\n}", "func (c *DNSBLQueryClient) DeleteOneID(id uuid.UUID) *DNSBLQueryDeleteOne {\n\tbuilder := c.Delete().Where(dnsblquery.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &DNSBLQueryDeleteOne{builder}\n}", "func (c *PetruleClient) DeleteOneID(id int) *PetruleDeleteOne {\n\tbuilder := c.Delete().Where(petrule.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &PetruleDeleteOne{builder}\n}", "func (c *EventClient) DeleteOneID(id int) *EventDeleteOne {\n\tbuilder := c.Delete().Where(event.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &EventDeleteOne{builder}\n}", "func (c *ClubapplicationClient) DeleteOneID(id int) *ClubapplicationDeleteOne {\n\tbuilder := c.Delete().Where(clubapplication.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &ClubapplicationDeleteOne{builder}\n}", "func (c *DisciplineClient) DeleteOneID(id int) *DisciplineDeleteOne {\n\tbuilder := c.Delete().Where(discipline.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &DisciplineDeleteOne{builder}\n}", "func (c *RoomClient) DeleteOneID(id int) *RoomDeleteOne {\n\tbuilder := c.Delete().Where(room.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &RoomDeleteOne{builder}\n}", "func (c *RoomClient) DeleteOneID(id int) *RoomDeleteOne {\n\tbuilder := c.Delete().Where(room.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &RoomDeleteOne{builder}\n}", "func (c *PledgeClient) DeleteOneID(id int) *PledgeDeleteOne {\n\tbuilder := c.Delete().Where(pledge.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &PledgeDeleteOne{builder}\n}", "func (c *CardClient) DeleteOneID(id int) *CardDeleteOne {\n\tbuilder := c.Delete().Where(card.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &CardDeleteOne{builder}\n}", "func (c *BillingstatusClient) DeleteOneID(id int) *BillingstatusDeleteOne {\n\tbuilder := c.Delete().Where(billingstatus.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &BillingstatusDeleteOne{builder}\n}", "func (c *SymptomClient) DeleteOneID(id int) *SymptomDeleteOne {\n\tbuilder := c.Delete().Where(symptom.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &SymptomDeleteOne{builder}\n}", "func (c *PatientClient) DeleteOneID(id int) *PatientDeleteOne {\n\tbuilder := c.Delete().Where(patient.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &PatientDeleteOne{builder}\n}", "func (c *PatientClient) DeleteOneID(id int) *PatientDeleteOne {\n\tbuilder := c.Delete().Where(patient.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &PatientDeleteOne{builder}\n}", "func (c *PatientClient) DeleteOneID(id int) *PatientDeleteOne {\n\tbuilder := c.Delete().Where(patient.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &PatientDeleteOne{builder}\n}", "func (c *TasteClient) DeleteOneID(id int) *TasteDeleteOne {\n\tbuilder := c.Delete().Where(taste.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &TasteDeleteOne{builder}\n}", "func (c *UnsavedPostClient) DeleteOneID(id int) *UnsavedPostDeleteOne {\n\tbuilder := c.Delete().Where(unsavedpost.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &UnsavedPostDeleteOne{builder}\n}", "func (c *JobClient) DeleteOneID(id int) *JobDeleteOne {\n\tbuilder := c.Delete().Where(job.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &JobDeleteOne{builder}\n}", "func (c *ExaminationroomClient) DeleteOneID(id int) *ExaminationroomDeleteOne {\n\tbuilder := c.Delete().Where(examinationroom.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &ExaminationroomDeleteOne{builder}\n}", "func (c *PlanetClient) DeleteOneID(id int) *PlanetDeleteOne {\n\tbuilder := c.Delete().Where(planet.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &PlanetDeleteOne{builder}\n}", "func (c *PrescriptionClient) DeleteOneID(id int) *PrescriptionDeleteOne {\n\tbuilder := c.Delete().Where(prescription.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &PrescriptionDeleteOne{builder}\n}", "func (c *TransactionClient) DeleteOneID(id int32) *TransactionDeleteOne {\n\tbuilder := c.Delete().Where(transaction.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &TransactionDeleteOne{builder}\n}", "func (c *SessionClient) DeleteOneID(id int) *SessionDeleteOne {\n\tbuilder := c.Delete().Where(session.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &SessionDeleteOne{builder}\n}", "func (c *TitleClient) DeleteOneID(id int) *TitleDeleteOne {\n\tbuilder := c.Delete().Where(title.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &TitleDeleteOne{builder}\n}", "func (c *PatientInfoClient) DeleteOneID(id int) *PatientInfoDeleteOne {\n\tbuilder := c.Delete().Where(patientinfo.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &PatientInfoDeleteOne{builder}\n}", "func (c *EatinghistoryClient) DeleteOneID(id int) *EatinghistoryDeleteOne {\n\tbuilder := c.Delete().Where(eatinghistory.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &EatinghistoryDeleteOne{builder}\n}", "func (c *WifiClient) DeleteOneID(id int) *WifiDeleteOne {\n\tbuilder := c.Delete().Where(wifi.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &WifiDeleteOne{builder}\n}", "func (c *FacultyClient) DeleteOneID(id int) *FacultyDeleteOne {\n\tbuilder := c.Delete().Where(faculty.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &FacultyDeleteOne{builder}\n}", "func (c *WalletNodeClient) DeleteOneID(id int32) *WalletNodeDeleteOne {\n\tbuilder := c.Delete().Where(walletnode.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &WalletNodeDeleteOne{builder}\n}", "func (c *ClubTypeClient) DeleteOneID(id int) *ClubTypeDeleteOne {\n\tbuilder := c.Delete().Where(clubtype.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &ClubTypeDeleteOne{builder}\n}", "func (c *AppointmentClient) DeleteOneID(id uuid.UUID) *AppointmentDeleteOne {\n\tbuilder := c.Delete().Where(appointment.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &AppointmentDeleteOne{builder}\n}", "func (c *PartorderClient) DeleteOneID(id int) *PartorderDeleteOne {\n\tbuilder := c.Delete().Where(partorder.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &PartorderDeleteOne{builder}\n}", "func (c *ClubClient) DeleteOneID(id int) *ClubDeleteOne {\n\tbuilder := c.Delete().Where(club.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &ClubDeleteOne{builder}\n}", "func (c *CoinInfoClient) DeleteOneID(id int32) *CoinInfoDeleteOne {\n\tbuilder := c.Delete().Where(coininfo.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &CoinInfoDeleteOne{builder}\n}", "func (c *ClinicClient) DeleteOneID(id uuid.UUID) *ClinicDeleteOne {\n\tbuilder := c.Delete().Where(clinic.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &ClinicDeleteOne{builder}\n}", "func (c *TimerClient) DeleteOneID(id int) *TimerDeleteOne {\n\tbuilder := c.Delete().Where(timer.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &TimerDeleteOne{builder}\n}", "func (c *ClubappStatusClient) DeleteOneID(id int) *ClubappStatusDeleteOne {\n\tbuilder := c.Delete().Where(clubappstatus.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &ClubappStatusDeleteOne{builder}\n}", "func (c *ActivityTypeClient) DeleteOneID(id int) *ActivityTypeDeleteOne {\n\tbuilder := c.Delete().Where(activitytype.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &ActivityTypeDeleteOne{builder}\n}", "func (c *ModuleVersionClient) DeleteOneID(id int) *ModuleVersionDeleteOne {\n\treturn &ModuleVersionDeleteOne{c.Delete().Where(moduleversion.ID(id))}\n}", "func (c *UsertypeClient) DeleteOneID(id int) *UsertypeDeleteOne {\n\tbuilder := c.Delete().Where(usertype.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &UsertypeDeleteOne{builder}\n}", "func (c *ActivitiesClient) DeleteOneID(id int) *ActivitiesDeleteOne {\n\tbuilder := c.Delete().Where(activities.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &ActivitiesDeleteOne{builder}\n}", "func (c *SituationClient) DeleteOneID(id int) *SituationDeleteOne {\n\tbuilder := c.Delete().Where(situation.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &SituationDeleteOne{builder}\n}", "func (c *SkillClient) DeleteOneID(id int) *SkillDeleteOne {\n\tbuilder := c.Delete().Where(skill.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &SkillDeleteOne{builder}\n}", "func (c *RentalstatusClient) DeleteOneID(id int) *RentalstatusDeleteOne {\n\tbuilder := c.Delete().Where(rentalstatus.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &RentalstatusDeleteOne{builder}\n}", "func (c *BranchClient) DeleteOneID(id int) *BranchDeleteOne {\n\tbuilder := c.Delete().Where(branch.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &BranchDeleteOne{builder}\n}", "func (c *YearClient) DeleteOneID(id int) *YearDeleteOne {\n\tbuilder := c.Delete().Where(year.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &YearDeleteOne{builder}\n}", "func (c *PartClient) DeleteOneID(id int) *PartDeleteOne {\n\tbuilder := c.Delete().Where(part.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &PartDeleteOne{builder}\n}", "func (c *TagClient) DeleteOneID(id int) *TagDeleteOne {\n\tbuilder := c.Delete().Where(tag.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &TagDeleteOne{builder}\n}", "func (c *RepairinvoiceClient) DeleteOneID(id int) *RepairinvoiceDeleteOne {\n\tbuilder := c.Delete().Where(repairinvoice.ID(id))\n\tbuilder.mutation.id = &id\n\tbuilder.mutation.op = OpDeleteOne\n\treturn &RepairinvoiceDeleteOne{builder}\n}" ]
[ "0.76778156", "0.75968426", "0.75511706", "0.7541144", "0.7539394", "0.7526723", "0.74882805", "0.7487795", "0.74769074", "0.74767685", "0.74631363", "0.74613", "0.7458024", "0.745116", "0.745116", "0.7442616", "0.7442616", "0.7442616", "0.743347", "0.7425805", "0.7422992", "0.74197966", "0.7418542", "0.7399402", "0.7396725", "0.73856103", "0.73840207", "0.7375385", "0.735778", "0.73571473", "0.73506707", "0.73470324", "0.7346839", "0.7345604", "0.7343301", "0.73415756", "0.7339983", "0.7339983", "0.73328143", "0.7330048", "0.7329202", "0.7325914", "0.7323134", "0.7313714", "0.7307478", "0.72893864", "0.7282448", "0.72806984", "0.72796077", "0.7279311", "0.72784746", "0.7277576", "0.7277483", "0.72763735", "0.72697914", "0.7263448", "0.72509044", "0.7238351", "0.7238351", "0.7237803", "0.72373664", "0.723381", "0.72292316", "0.7228588", "0.7228588", "0.7228588", "0.72245425", "0.72225535", "0.72206736", "0.72152764", "0.7205751", "0.7203806", "0.72032803", "0.71952355", "0.7193382", "0.7190719", "0.7189693", "0.7165575", "0.71655035", "0.71611136", "0.7160824", "0.7160091", "0.7155872", "0.71474624", "0.7144856", "0.71436256", "0.71384954", "0.7131519", "0.712696", "0.7125728", "0.71234626", "0.7122792", "0.71096176", "0.7108689", "0.71075124", "0.7105292", "0.7104324", "0.7101526", "0.7095171", "0.7091349" ]
0.7304015
45
Query returns a query builder for Post.
func (c *PostClient) Query() *PostQuery { return &PostQuery{ config: c.config, } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (p *_Posts) Query(db database.DB, models ...*Post) *postsQueryBuilder {\n\tvar queryModels []mapping.Model\n\tif len(models) > 0 {\n\t\tqueryModels = make([]mapping.Model, len(models))\n\t\tfor i, model := range models {\n\t\t\tqueryModels[i] = model\n\t\t}\n\t}\n\tbuilder := db.Query(p.Model, queryModels...)\n\treturn &postsQueryBuilder{builder: builder}\n}", "func (c *UnsavedPostClient) Query() *UnsavedPostQuery {\n\treturn &UnsavedPostQuery{\n\t\tconfig: c.config,\n\t}\n}", "func (builder *QueryBuilder[K, F]) Query() Query[K, F] {\n\tif len(builder.query.Conditions) == 0 {\n\t\tbuilder.Where(defaultFilter[K, F]{})\n\t}\n\tif len(builder.query.Aggregators) == 0 {\n\t\tbuilder.Aggregate(defaultAggregator[K, F]{})\n\t}\n\tbuilder.query.results = &Result[K, F]{\n\t\tentries: make(map[ResultKey]*ResultEntry[K, F]),\n\t}\n\treturn builder.query\n}", "func (c *PostAttachmentClient) Query() *PostAttachmentQuery {\n\treturn &PostAttachmentQuery{\n\t\tconfig: c.config,\n\t}\n}", "func (c *BuildingClient) Query() *BuildingQuery {\n\treturn &BuildingQuery{config: c.config}\n}", "func (c *PostVideoClient) QueryPost(pv *PostVideo) *PostQuery {\n\tquery := &PostQuery{config: c.config}\n\tquery.path = func(ctx context.Context) (fromV *sql.Selector, _ error) {\n\t\tid := pv.ID\n\t\tstep := sqlgraph.NewStep(\n\t\t\tsqlgraph.From(postvideo.Table, postvideo.FieldID, id),\n\t\t\tsqlgraph.To(post.Table, post.FieldID),\n\t\t\tsqlgraph.Edge(sqlgraph.M2O, true, postvideo.PostTable, postvideo.PostColumn),\n\t\t)\n\t\tfromV = sqlgraph.Neighbors(pv.driver.Dialect(), step)\n\t\treturn fromV, nil\n\t}\n\treturn query\n}", "func (c *PostImageClient) QueryPost(pi *PostImage) *PostQuery {\n\tquery := &PostQuery{config: c.config}\n\tquery.path = func(ctx context.Context) (fromV *sql.Selector, _ error) {\n\t\tid := pi.ID\n\t\tstep := sqlgraph.NewStep(\n\t\t\tsqlgraph.From(postimage.Table, postimage.FieldID, id),\n\t\t\tsqlgraph.To(post.Table, post.FieldID),\n\t\t\tsqlgraph.Edge(sqlgraph.M2O, true, postimage.PostTable, postimage.PostColumn),\n\t\t)\n\t\tfromV = sqlgraph.Neighbors(pi.driver.Dialect(), step)\n\t\treturn fromV, nil\n\t}\n\treturn query\n}", "func (c *AdminClient) QueryPosts(a *Admin) *PostQuery {\n\tquery := &PostQuery{config: c.config}\n\tquery.path = func(ctx context.Context) (fromV *sql.Selector, _ error) {\n\t\tid := a.ID\n\t\tstep := sqlgraph.NewStep(\n\t\t\tsqlgraph.From(admin.Table, admin.FieldID, id),\n\t\t\tsqlgraph.To(post.Table, post.FieldID),\n\t\t\tsqlgraph.Edge(sqlgraph.O2M, false, admin.PostsTable, admin.PostsColumn),\n\t\t)\n\t\tfromV = sqlgraph.Neighbors(a.driver.Dialect(), step)\n\t\treturn fromV, nil\n\t}\n\treturn query\n}", "func (c *UnsavedPostAttachmentClient) Query() *UnsavedPostAttachmentQuery {\n\treturn &UnsavedPostAttachmentQuery{\n\t\tconfig: c.config,\n\t}\n}", "func (c *PostThumbnailClient) QueryPost(pt *PostThumbnail) *PostQuery {\n\tquery := &PostQuery{config: c.config}\n\tquery.path = func(ctx context.Context) (fromV *sql.Selector, _ error) {\n\t\tid := pt.ID\n\t\tstep := sqlgraph.NewStep(\n\t\t\tsqlgraph.From(postthumbnail.Table, postthumbnail.FieldID, id),\n\t\t\tsqlgraph.To(post.Table, post.FieldID),\n\t\t\tsqlgraph.Edge(sqlgraph.O2O, true, postthumbnail.PostTable, postthumbnail.PostColumn),\n\t\t)\n\t\tfromV = sqlgraph.Neighbors(pt.driver.Dialect(), step)\n\t\treturn fromV, nil\n\t}\n\treturn query\n}", "func (c *PostImageClient) Query() *PostImageQuery {\n\treturn &PostImageQuery{\n\t\tconfig: c.config,\n\t}\n}", "func (c *PostAttachmentClient) QueryPost(pa *PostAttachment) *PostQuery {\n\tquery := &PostQuery{config: c.config}\n\tquery.path = func(ctx context.Context) (fromV *sql.Selector, _ error) {\n\t\tid := pa.ID\n\t\tstep := sqlgraph.NewStep(\n\t\t\tsqlgraph.From(postattachment.Table, postattachment.FieldID, id),\n\t\t\tsqlgraph.To(post.Table, post.FieldID),\n\t\t\tsqlgraph.Edge(sqlgraph.M2O, true, postattachment.PostTable, postattachment.PostColumn),\n\t\t)\n\t\tfromV = sqlgraph.Neighbors(pa.driver.Dialect(), step)\n\t\treturn fromV, nil\n\t}\n\treturn query\n}", "func (s *Schema) Query() *Object {\n\treturn s.Object(\"Query\", query{})\n}", "func (c *BedtypeClient) Query() *BedtypeQuery {\n\treturn &BedtypeQuery{config: c.config}\n}", "func (p *postsQueryBuilder) Get() (*Post, error) {\n\tif p.err != nil {\n\t\treturn nil, p.err\n\t}\n\tmodel, err := p.builder.Get()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn model.(*Post), nil\n}", "func (c *UnsavedPostImageClient) Query() *UnsavedPostImageQuery {\n\treturn &UnsavedPostImageQuery{\n\t\tconfig: c.config,\n\t}\n}", "func (r *Resolver) Query() gqlhandler.QueryResolver { return &queryResolver{r} }", "func (c *BeerClient) Query() *BeerQuery {\n\treturn &BeerQuery{\n\t\tconfig: c.config,\n\t}\n}", "func (r *Resolver) Query() generated.QueryResolver { return &queryResolver{r} }", "func (r *Resolver) Query() generated.QueryResolver { return &queryResolver{r} }", "func (r *Resolver) Query() generated.QueryResolver { return &queryResolver{r} }", "func (r *Resolver) Query() generated.QueryResolver { return &queryResolver{r} }", "func (r *Resolver) Query() generated.QueryResolver { return &queryResolver{r} }", "func (r *Resolver) Query() generated.QueryResolver { return &queryResolver{r} }", "func (r *Resolver) Query() generated.QueryResolver { return &queryResolver{r} }", "func (r *Resolver) Query() generated.QueryResolver { return &queryResolver{r} }", "func (r *Resolver) Query() generated.QueryResolver { return &queryResolver{r} }", "func (r *Resolver) Query() generated.QueryResolver { return &queryResolver{r} }", "func (r *Resolver) Query() generated.QueryResolver { return &queryResolver{r} }", "func (r *Resolver) Query() generated.QueryResolver { return &queryResolver{r} }", "func (r *Resolver) Query() generated.QueryResolver { return &queryResolver{r} }", "func (r *Resolver) Query() generated.QueryResolver { return &queryResolver{r} }", "func (r *Resolver) Query() generated.QueryResolver { return &queryResolver{r} }", "func (r *Resolver) Query() generated.QueryResolver { return &queryResolver{r} }", "func (r *Resolver) Query() generated.QueryResolver { return &queryResolver{r} }", "func (r *Resolver) Query() generated.QueryResolver { return &queryResolver{r} }", "func (r *Resolver) Query() generated.QueryResolver { return &queryResolver{r} }", "func (r *Resolver) Query() generated.QueryResolver { return &queryResolver{r} }", "func (r *Resolver) Query() generated.QueryResolver { return &queryResolver{r} }", "func (r *Resolver) Query() generated.QueryResolver { return &queryResolver{r} }", "func (r *Resolver) Query() generated.QueryResolver { return &queryResolver{r} }", "func (r *Resolver) Query() generated.QueryResolver { return &queryResolver{r} }", "func (r *Resolver) Query() generated.QueryResolver { return &queryResolver{r} }", "func (r *Resolver) Query() generated.QueryResolver { return &queryResolver{r} }", "func (r *Resolver) Query() generated.QueryResolver { return &queryResolver{r} }", "func (r *Resolver) Query() generated.QueryResolver { return &queryResolver{r} }", "func (r *Resolver) Query() generated.QueryResolver { return &queryResolver{r} }", "func (r *Resolver) Query() generated.QueryResolver { return &queryResolver{r} }", "func (r *Resolver) Query() generated.QueryResolver { return &queryResolver{r} }", "func (r *Resolver) Query() generated.QueryResolver { return &queryResolver{r} }", "func (r *Resolver) Query() generated.QueryResolver { return &queryResolver{r} }", "func (r *Resolver) Query() generated.QueryResolver { return &queryResolver{r} }", "func (r *Resolver) Query() generated.QueryResolver { return &queryResolver{r} }", "func (r *Resolver) Query() generated.QueryResolver { return &queryResolver{r} }", "func (r *Resolver) Query() generated.QueryResolver { return &queryResolver{r} }", "func (r *Resolver) Query() generated.QueryResolver { return &queryResolver{r} }", "func (r *Resolver) Query() generated.QueryResolver { return &queryResolver{r} }", "func (r *Resolver) Query() generated.QueryResolver { return &queryResolver{r} }", "func (r *Resolver) Query() generated.QueryResolver { return &queryResolver{r} }", "func (r *Resolver) Query() generated.QueryResolver { return &queryResolver{r} }", "func (r *Resolver) Query() generated.QueryResolver { return &queryResolver{r} }", "func (r *Resolver) Query() generated.QueryResolver { return &queryResolver{r} }", "func (r *Resolver) Query() generated.QueryResolver { return &queryResolver{r} }", "func (r *Resolver) Query() generated.QueryResolver { return &queryResolver{r} }", "func (r *Resolver) Query() generated.QueryResolver { return &queryResolver{r} }", "func (r *Resolver) Query() generated.QueryResolver { return &queryResolver{r} }", "func (r *Resolver) Query() generated.QueryResolver { return &queryResolver{r} }", "func (r *Resolver) Query() generated.QueryResolver { return &queryResolver{r} }", "func (r *Resolver) Query() generated.QueryResolver { return &queryResolver{r} }", "func (r *Resolver) Query() generated.QueryResolver { return &queryResolver{r} }", "func (r *Resolver) Query() generated.QueryResolver { return &queryResolver{r} }", "func (r *Resolver) Query() generated.QueryResolver { return &queryResolver{r} }", "func (r *Resolver) Query() generated.QueryResolver { return &queryResolver{r} }", "func (r *Resolver) Query() generated.QueryResolver { return &queryResolver{r} }", "func (r *Resolver) Query() generated.QueryResolver { return &queryResolver{r} }", "func (r *Resolver) Query() generated.QueryResolver { return &queryResolver{r} }", "func (r *Resolver) Query() generated.QueryResolver { return &queryResolver{r} }", "func (r *Resolver) Query() generated.QueryResolver { return &queryResolver{r} }", "func (r *Resolver) Query() _graphql.QueryResolver { return &queryResolver{r} }", "func (r *Resolver) Query() server.QueryResolver { return &queryResolver{r} }", "func Query(q Mappable) *QueryRequest {\n\treturn &QueryRequest{q}\n}", "func (r *Resolver) Query() exec.QueryResolver { return &queryResolver{r} }", "func (c *CleaningroomClient) Query() *CleaningroomQuery {\n\treturn &CleaningroomQuery{config: c.config}\n}", "func (b *_Blogs) Query(db database.DB, models ...*Blog) *blogsQueryBuilder {\n\tvar queryModels []mapping.Model\n\tif len(models) > 0 {\n\t\tqueryModels = make([]mapping.Model, len(models))\n\t\tfor i, model := range models {\n\t\t\tqueryModels[i] = model\n\t\t}\n\t}\n\tbuilder := db.Query(b.Model, queryModels...)\n\treturn &blogsQueryBuilder{builder: builder}\n}", "func (c *PostVideoClient) Query() *PostVideoQuery {\n\treturn &PostVideoQuery{\n\t\tconfig: c.config,\n\t}\n}", "func (dqlx *dqlx) Query(rootFn *FilterFn) QueryBuilder {\n\treturn Query(rootFn).WithDClient(dqlx.dgraph)\n}", "func (c *UnsavedPostVideoClient) Query() *UnsavedPostVideoQuery {\n\treturn &UnsavedPostVideoQuery{\n\t\tconfig: c.config,\n\t}\n}", "func (c *BillClient) Query() *BillQuery {\n\treturn &BillQuery{config: c.config}\n}", "func (c *BillClient) Query() *BillQuery {\n\treturn &BillQuery{config: c.config}\n}", "func (c *BillClient) Query() *BillQuery {\n\treturn &BillQuery{config: c.config}\n}", "func (c *PostThumbnailClient) Query() *PostThumbnailQuery {\n\treturn &PostThumbnailQuery{\n\t\tconfig: c.config,\n\t}\n}", "func (c *ReviewClient) Query() *ReviewQuery {\n\treturn &ReviewQuery{\n\t\tconfig: c.config,\n\t}\n}", "func (b Build) Query(c *gin.Context) *gorm.DB {\n\tuser := middleware.GetUser(c)\n\tjoined := db.Joins(\"join projects on projects.id = builds.project_id\").\n\t\tWhere(\"projects.user_id=?\", user.ID)\n\treturn b.Preload(joined)\n}", "func (r *Resolver) Query() QueryResolver { return &queryResolver{r} }", "func (r *Resolver) Query() QueryResolver { return &queryResolver{r} }", "func (c *UnsavedPostThumbnailClient) Query() *UnsavedPostThumbnailQuery {\n\treturn &UnsavedPostThumbnailQuery{\n\t\tconfig: c.config,\n\t}\n}", "func (c *MedicineClient) Query() *MedicineQuery {\n\treturn &MedicineQuery{config: c.config}\n}", "func (c *MealplanClient) Query() *MealplanQuery {\n\treturn &MealplanQuery{config: c.config}\n}", "func (qs *Querier) QueryBuilder() *Query {\n\treturn &Query{\n\t\tPath: qs.DBPath,\n\t\t// range \"nil\" represents all time-series as querying\n\t\tRange: nil,\n\t\tType: qs.Type,\n\t}\n}", "func (c *BranchClient) Query() *BranchQuery {\n\treturn &BranchQuery{config: c.config}\n}" ]
[ "0.73069626", "0.72379965", "0.68524665", "0.6675761", "0.6467628", "0.6411076", "0.6408814", "0.63686836", "0.6350538", "0.63320416", "0.63079584", "0.6301757", "0.62995136", "0.6277731", "0.62441814", "0.6236264", "0.622673", "0.6192292", "0.6181036", "0.6181036", "0.6181036", "0.6181036", "0.6181036", "0.6181036", "0.6181036", "0.6181036", "0.6181036", "0.6181036", "0.6181036", "0.6181036", "0.6181036", "0.6181036", "0.6181036", "0.6181036", "0.6181036", "0.6181036", "0.6181036", "0.6181036", "0.6181036", "0.6181036", "0.6181036", "0.6181036", "0.6181036", "0.6181036", "0.6181036", "0.6181036", "0.6181036", "0.6181036", "0.6181036", "0.6181036", "0.6181036", "0.6181036", "0.6181036", "0.6181036", "0.6181036", "0.6181036", "0.6181036", "0.6181036", "0.6181036", "0.6181036", "0.6181036", "0.6181036", "0.6181036", "0.6181036", "0.6181036", "0.6181036", "0.6181036", "0.6181036", "0.6181036", "0.6181036", "0.6181036", "0.6181036", "0.6181036", "0.6181036", "0.6181036", "0.6181036", "0.6181036", "0.6181036", "0.6168506", "0.6167603", "0.6136434", "0.6132283", "0.61252594", "0.61181706", "0.61139965", "0.60560447", "0.605181", "0.6037664", "0.6037664", "0.6037664", "0.6019233", "0.6006911", "0.59641856", "0.5938139", "0.5938139", "0.5932925", "0.5926652", "0.59223044", "0.5921185", "0.59187263" ]
0.7404339
0
Get returns a Post entity by its id.
func (c *PostClient) Get(ctx context.Context, id int) (*Post, error) { return c.Query().Where(post.ID(id)).Only(ctx) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func GetPost(id int) (post Post, err error) {\n\tpost = Post{}\n\terr = Db.QueryRow(\"select * from posts where id = $1\", id).Scan(&post.ID, &post.Title, &post.Body, &post.CreatedAt)\n\treturn\n}", "func (repo *Posts) Post(id graphql.ID) *models.Post {\n\treturn repo.posts[id]\n}", "func (s service) GetPost(id uint) (*Post, error) {\n\tp, err := (*s.repo).GetPost(id)\n\tif err != nil {\n\t\treturn nil, ErrPostNotFound\n\t}\n\n\treturn p, err\n}", "func GetPostById(c *gin.Context) {\n\tpostID, err := strconv.ParseInt(c.Param(\"id\"), 10, 0)\n\tif err != nil {\n\t\tc.JSON(http.StatusBadRequest, gin.H{\"error\": err.Error()})\n\t\treturn\n\t}\n\n\tpost, err := postRepo.GetById(postID)\n\tif err != nil {\n\t\tc.JSON(http.StatusBadRequest, gin.H{\"error\": err.Error()})\n\t\treturn\n\t}\n\tc.JSON(http.StatusOK, PostModel{\n\t\tId: post.ID,\n\t\tLinks: halgo.Links{}.\n\t\t\tSelf(\"/posts/%d\", post.ID).\n\t\t\tLink(\"author\", \"%s/users/%d\", userServiceAddress, post.AuthorID).\n\t\t\tLink(\"ratings\", \"%s/ratings?postId=%d\", ratingServiceAddress, post.ID),\n\t\tHeadline: post.Headline,\n\t\tContent: post.Content,\n\t})\n}", "func (s *BlugService) GetPost(ctx context.Context, id int) (post *models.Post, err error) {\n\tdefer func(begin time.Time) {\n\t\ts.Logger.Info(\n\t\t\t\"blug\",\n\t\t\tzap.String(\"method\", \"getpost\"),\n\t\t\tzap.Int(\"id\", id),\n\t\t\tzap.NamedError(\"err\", err),\n\t\t\tzap.Duration(\"took\", time.Since(begin)),\n\t\t)\n\t}(time.Now())\n\n\tpost, err = s.DB.GetPost(id)\n\n\treturn post, err\n}", "func (s *MockStore) GetPost(id int) (p Post, err error) {\n\tp, ok := s.mem[id]\n\tif !ok {\n\t\terr = errors.New(\"Could not find a post with that id.\")\n\t}\n\treturn p, err\n}", "func GetPost(w http.ResponseWriter, r *http.Request, app api.AppServicer) (interface{}, error) {\n\tenv := app.(api.AppService)\n\tvars := mux.Vars(r)\n\tid, _ := strconv.Atoi(vars[\"id\"])\n\tpost := &models.Post{ID: id}\n\n\terr := post.GetPost(env.DB)\n\treturn post, err\n}", "func (p *postsQueryBuilder) Get() (*Post, error) {\n\tif p.err != nil {\n\t\treturn nil, p.err\n\t}\n\tmodel, err := p.builder.Get()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn model.(*Post), nil\n}", "func (c *UnsavedPostClient) Get(ctx context.Context, id int) (*UnsavedPost, error) {\n\treturn c.Query().Where(unsavedpost.ID(id)).Only(ctx)\n}", "func (p *PostsController) GetPost(id int, userId uint) (*models.Post, *echo.HTTPError) {\n\tvar post models.Post\n\tp.db.Raw(`\n\t\tSELECT p.*,\n\t\t(SELECT \"value\" from \"likes\" \n\t\tWHERE \"user_id\" = ? and \"post_id\" = p.id) as \"StateValue\",\n\t\t(SELECT username FROM \"profiles\"\n\t\tWHERE user_id = p.user_id) as \"Creator\"\n\t\tFROM posts p\n\t\tWHERE p.id = ?\n\t`, userId, id).Find(&post)\n\n\tif post.ID == 0 {\n\t\treturn nil, echo.NewHTTPError(404, \"post does not exist\")\n\t}\n\n\treturn &post, nil\n}", "func (p *PostsAPI) GetPost(c *gin.Context) {\n\tpostID, err := strconv.Atoi(c.Param(\"post_id\"))\n\tif err != nil {\n\t\tc.Status(http.StatusNotFound)\n\t\treturn\n\t}\n\n\t// Get post from database\n\tpost := &models.Post{}\n\tif err := p.db.Scopes(\n\t\tscopes.WithSpanFromContext(c.Request.Context()),\n\t).First(post, uint(postID)).Error; err != nil {\n\t\tc.Status(http.StatusNotFound)\n\t\treturn\n\t}\n\n\tc.JSON(http.StatusOK, post)\n}", "func (c *PostImageClient) Get(ctx context.Context, id int) (*PostImage, error) {\n\treturn c.Query().Where(postimage.ID(id)).Only(ctx)\n}", "func (*controller) GetPostByID(w http.ResponseWriter, r *http.Request) {\n\tw.Header().Set(\"Content-Type\", \"application/json\")\n\n\t// get the id from the url\n\tpostID := strings.Split(r.URL.Path, \"/\")[2]\n\n\t// cache: check/get data from the postID\n\tvar post *entity.Post = postCache.Get(postID)\n\tif post == nil {\n\t\tpost, err := postService.FindByID(postID)\n\t\tif err != nil {\n\t\t\t// cannot find id in db\n\t\t\tw.WriteHeader(http.StatusNotFound)\n\t\t\tjson.NewEncoder(w).Encode(errors.ServiceError{Message: \"No posts found!\"})\n\t\t\treturn\n\t\t}\n\t\t// store value into cache. Set(key, value)\n\t\tpostCache.Set(postID, post)\n\t\tw.WriteHeader(http.StatusOK)\n\t\tjson.NewEncoder(w).Encode(post)\n\t} else {\n\t\tw.WriteHeader(http.StatusOK)\n\t\tjson.NewEncoder(w).Encode(post)\n\t}\n}", "func (c BlogPostItem) Get(id int64) revel.Result {\n\tblogitem := new(models.BlogPost)\n\terr := c.Txn.SelectOne(blogitem,\n\t\t`SELECT * FROM BlogPost WHERE id = ?`, id)\n\tif err != nil {\n\t\treturn c.RenderText(\"Error. BlogPost probably doesn't exist.\")\n\t}\n\treturn c.RenderJson(blogitem)\n}", "func (db *Database) GetPost(postID string) (models.Post, error) {\n\tpost := &models.Post{}\n\terr := db.DB.Model(post).\n\t\tWhere(\"post.post_id = ?\", postID).\n\t\tSelect()\n\tif err != nil {\n\t\treturn models.Post{}, err\n\t}\n\n\treturn *post, nil\n}", "func (c *PostVideoClient) Get(ctx context.Context, id int) (*PostVideo, error) {\n\treturn c.Query().Where(postvideo.ID(id)).Only(ctx)\n}", "func (pc PostsController) getSinglePost(response http.ResponseWriter, request *http.Request, parameters httprouter.Params) {\n\tresponse.Header().Add(\"content-type\", \"application/json\")\n\tid_string := parameters.ByName(\"id\")\n\n\tid, _ := primitive.ObjectIDFromHex(id_string)\n\tvar post Posts\n\tctx, _ := context.WithTimeout(context.Background(), 10*time.Second)\n\terr := pc.postscollection.FindOne(ctx, bson.M{\"_id\": id}).Decode(&post)\n\n\tif err != nil {\n\t\tresponse.WriteHeader(http.StatusInternalServerError)\n\t\tresponse.Write([]byte(`{\"message: \"` + err.Error() + `\"}\"`))\n\t\treturn\n\t}\n\tjson.NewEncoder(response).Encode(post)\n}", "func (c *PostThumbnailClient) Get(ctx context.Context, id int) (*PostThumbnail, error) {\n\treturn c.Query().Where(postthumbnail.ID(id)).Only(ctx)\n}", "func (c *PostAttachmentClient) Get(ctx context.Context, id int) (*PostAttachment, error) {\n\treturn c.Query().Where(postattachment.ID(id)).Only(ctx)\n}", "func (env *Env) GetPost(w http.ResponseWriter, r *http.Request) {\n\t// Grab the context to get the user\n\tctx := r.Context()\n\tuser := ctx.Value(contextUser).(*models.User)\n\tid, err := uuid.Parse(chi.URLParam(r, \"postID\"))\n\tif err != nil {\n\t\tenv.log(r, err)\n\t\tw.WriteHeader(http.StatusBadRequest)\n\t\treturn\n\t}\n\tp, err := env.DB.FindPost(id)\n\tif err != nil {\n\t\tenv.log(r, err)\n\t\tw.WriteHeader(http.StatusNotFound)\n\t\treturn\n\t}\n\tif p.Published == false && user.Role != \"ADMIN\" {\n\t\tw.WriteHeader(http.StatusNotFound)\n\t}\n\tw.Header().Set(\"Content-Type\", \"application/json\")\n\tw.WriteHeader(http.StatusOK)\n\tjson.NewEncoder(w).Encode(p)\n}", "func GetPost(idString string, w http.ResponseWriter) {\r\n\tfmt.Println(\"inside GetPost\")\r\n\t//Connect Mongodb\r\n\tclient, err := mongo.NewClient(options.Client().ApplyURI(\"mongodb://127.0.0.1:27017\"))\r\n\tif err != nil {\r\n\t\tlog.Fatal(err)\r\n\t}\r\n\tctx, _ := context.WithTimeout(context.Background(), 10*time.Second)\r\n\terr = client.Connect(ctx)\r\n\tif err != nil {\r\n\t\tlog.Fatal(err)\r\n\t}\r\n\tdefer client.Disconnect(ctx)\r\n\r\n\t//Post Inside Database\r\n\tcollection := client.Database(\"inShotsDB\").Collection(\"posts\")\r\n\tid, err := primitive.ObjectIDFromHex(idString)\r\n\tfilter := bson.M{\"_id\": id}\r\n\tvar post Article\r\n\terr2 := collection.FindOne(context.TODO(), filter).Decode(&post)\r\n\tif err2 != nil {\r\n\t\tlog.Fatal(err2)\r\n\t}\r\n\tfmt.Println(\"Found Post\", post.Title)\r\n\tfmt.Fprintf(w, post.Title, post.Subtitle, post.Content)\r\n}", "func GetOnePost(w http.ResponseWriter, r *http.Request) {\n\tpostID := mux.Vars(r)[\"id\"]\n\tpID, err := primitive.ObjectIDFromHex(postID)\n\tif err != nil {\n\t\tresponse.Error(w, http.StatusUnprocessableEntity, err.Error())\n\t\treturn\n\t}\n\tres, err := GetOne(bson.M{\n\t\t\"_id\": pID,\n\t})\n\tif err != nil {\n\t\tresponse.Error(w, http.StatusUnprocessableEntity, err.Error())\n\t\treturn\n\t}\n\tresponse.Success(w, r,\n\t\thttp.StatusOK,\n\t\tres,\n\t)\n\treturn\n}", "func (r repository) Get(ctx context.Context, id string) (entity.Link, error) {\n\tvar link entity.Link\n\terr := r.db.With(ctx).Select().Model(id, &link)\n\treturn link, err\n}", "func (d *DynamoDB)GetPost(id string) (models.Post, error){\n\tfmt.Printf(logRoot + \"Searching %v table for post with id:%v\\n\", postTable, id)\n\tfmt.Println(\"UNIMPLEMENTED\")\n\treturn models.Post{}, nil\n}", "func (k Keeper) GetPost(ctx sdk.Context, id string) (post types.Post, found bool) {\n\tstore := ctx.KVStore(k.storeKey)\n\tif !store.Has(types.PostStoreKey(id)) {\n\t\treturn types.Post{}, false\n\t}\n\n\tk.cdc.MustUnmarshalBinaryBare(store.Get(types.PostStoreKey(id)), &post)\n\treturn post, true\n}", "func (post *Post) GetPostById(id ...bson.ObjectId) error {\n\tvar postId bson.ObjectId\n\tif len(id) == 0 {\n\t\tpostId = post.Id\n\t} else {\n\t\tpostId = id[0]\n\t}\n\n\terr := postSession.Clone().DB(DBName).C(\"posts\").FindId(postId).One(post)\n\treturn err\n}", "func (s *postsService) GetPost(ctx context.Context, authorUUID, postUUID string) (*model.PostResponse, error) {\n\t// get post from db to populate response\n\tdbPost, err := s.db.GetPost(ctx, authorUUID, postUUID)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tresponse := translateDBPostToPostResponse(dbPost)\n\n\treturn response, nil\n}", "func (handler *Handler) handlePostGet(w http.ResponseWriter, r *http.Request) {\n\t// We get the id in url and parse it as uint type\n\tvars := mux.Vars(r)\n\tid := vars[\"id\"]\n\ti, err := strconv.ParseUint(id, 10, 64)\n\tif err != nil {\n\t\tresponses.ERROR(w, http.StatusInternalServerError, err)\n\t\treturn\n\t}\n\n\tdb := repository.NewPostRepository(handler.DB)\n\n\t// We try to find the post with given id\n\tpost, err := db.FindById(uint(i))\n\tif err != nil {\n\t\tif errors.Is(err, gorm.ErrRecordNotFound) {\n\t\t\tresponses.ERROR(w, http.StatusNotFound, errors.New(\"the post with id \" + id + \" could not found\"))\n\t\t} else {\n\t\t\t// If method is failed for another reason than \"record not found\"\n\t\t\t// We don't want to share that reason with user\n\t\t\t// Instead we send a generic error to the user\n\t\t\t// and print the actual error to the console\n\t\t\tresponses.ERROR(w, http.StatusInternalServerError, errors.New(\"something went wrong\"))\n\t\t\tlog.Println(err)\n\t\t}\n\t\treturn\n\t}\n\n\t// If post is not published only the author can access it.\n\tif post.IsPublished == false {\n\t\tuid, err := auth.ExtractTokenID(r)\n\t\tif err != nil {\n\t\t\t// If the requester not authenticated we pretend like post is not exist\n\t\t\t// for protection against data leak.\n\t\t\tresponses.ERROR(w, http.StatusNotFound, errors.New(\"the post with id \" + id + \" could not found\"))\n\t\t\treturn\n\t\t}\n\n\t\tif uid != post.Author.ID {\n\t\t\tresponses.ERROR(w, http.StatusNotFound, errors.New(\"the post with id \" + id + \" could not found\"))\n\t\t\treturn\n\t\t}\n\t}\n\n\tresponses.JSON(w, http.StatusOK, post)\n}", "func retrieve(id int) (post Post, err error){\n\tpost = Post{}\n\terr = Db.QueryRow(\"select id, content, author from posts where id = $1\", id).Scan(&post.Id, &post.Content, &post.Author)\n\treturn\n}", "func (r *PostsService) Get(blogId string, postId string) *PostsGetCall {\n\tc := &PostsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}\n\tc.blogId = blogId\n\tc.postId = postId\n\treturn c\n}", "func (bl *postBusiness) GetByID(id uint64) (*models.Post, *apperror.AppError) {\n\treturn bl.service.GetByID(id)\n}", "func (c *UnsavedPostImageClient) Get(ctx context.Context, id int) (*UnsavedPostImage, error) {\n\treturn c.Query().Where(unsavedpostimage.ID(id)).Only(ctx)\n}", "func (db *MysqlDB) GetPostByID(id int64) (*Post, error) {\n\trow := db.Conn.QueryRow(\n\t\t`SELECT p.id, p.Title, p.Description, p.ImageURL, p.Annotation, p.PostText,\n u.Name AS AuthorName, p.CreatedAt, p.UpdatedAt\n FROM Posts p INNER JOIN Users u ON p.Author = u.id\n WHERE p.id = ?;`,\n\t\tid)\n\n\tvar ID int64\n\tvar Title string\n\tvar Description string\n\tvar ImageURL string\n\tvar Annotation string\n\tvar Text string\n\tvar Author string\n\tvar CreatedAt time.Time\n\tvar UpdatedAt time.Time\n\n\terr := row.Scan(&ID, &Title, &Description, &ImageURL, &Annotation, &Text, &Author, &CreatedAt, &UpdatedAt)\n\tpost := &Post{ID: ID,\n\t\tTitle: template.HTML(Title),\n\t\tDescription: template.HTML(Description),\n\t\tImageURL: ImageURL,\n\t\tAnnotation: template.HTML(Annotation),\n\t\tText: template.HTML(Text),\n\t\tAuthor: Author,\n\t\tCreatedAt: CreatedAt,\n\t\tUpdatedAt: UpdatedAt}\n\n\treturn post, err\n}", "func (m *EntityManager) Get(id string) (entity *Entity) {\n\tfor _, e := range m.entities {\n\t\tif e.ID() == id {\n\t\t\treturn e\n\t\t}\n\t}\n\treturn\n}", "func (ps *PostStorage) Read(id string) (socialnet.Post, error) {\n\tfor _, p := range ps.posts {\n\t\tif p.ID == id {\n\t\t\treturn p, nil\n\t\t}\n\t}\n\treturn socialnet.Post{}, fmt.Errorf(\n\t\t\"could not find post with ID %s\",\n\t\tid,\n\t)\n}", "func retrieve(id int) (post Post, err error) {\n\tpost = Post{}\n\tstmt := \"SELECT id, title, body, author FROM posts WHERE id = $1\"\n\terr = Db.QueryRow(stmt, id).Scan(&post.Id, &post.Title, &post.Body, &post.Author)\n\treturn\n}", "func (m *ArticleDB) Get(ctx context.Context, id uuid.UUID) (*Article, error) {\n\tdefer goa.MeasureSince([]string{\"goa\", \"db\", \"article\", \"get\"}, time.Now())\n\n\tvar native Article\n\terr := m.Db.Table(m.TableName()).Where(\"id = ?\", id).Find(&native).Error\n\tif err == gorm.ErrRecordNotFound {\n\t\treturn nil, err\n\t}\n\n\treturn &native, err\n}", "func (m *ArticleDB) Get(ctx context.Context, id int) (*Article, error) {\n\tdefer goa.MeasureSince([]string{\"goa\", \"db\", \"article\", \"get\"}, time.Now())\n\n\tvar native Article\n\terr := m.Db.Table(m.TableName()).Where(\"id = ?\", id).Find(&native).Error\n\tif err == gorm.ErrRecordNotFound {\n\t\treturn nil, err\n\t}\n\n\treturn &native, err\n}", "func (c *postsClient) GetPost(ctx context.Context, authorUUID, postUUID string) (*model.PostResponse, error) {\n\turl := c.serviceURI + v1API + fmt.Sprintf(\"/authors/%s/posts/%s\", authorUUID, postUUID)\n\n\treq, err := formatJSONRequest(http.MethodGet, url, nil)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tres := &model.PostResponse{}\n\t_, err = executeRequest(c.web, req, res)\n\treturn res, err\n}", "func (d *PostDataStore) FindPost(id int) (p model.Post, err error) {\n\tif err = d.DBHandler.Find(&p, id).Error; err != nil {\n\t\treturn\n\t}\n\treturn\n}", "func (c *UnsavedPostThumbnailClient) Get(ctx context.Context, id int) (*UnsavedPostThumbnail, error) {\n\treturn c.Query().Where(unsavedpostthumbnail.ID(id)).Only(ctx)\n}", "func getPost(w http.ResponseWriter, r *http.Request) {\n\tparams := mux.Vars(r)\n\tid, err := strconv.Atoi(params[\"id\"])\n\tif err != nil {\n\t\tjson.NewEncoder(w).Encode(\"yeet\")\n\t}\n\n\tfor _, item := range posts {\n\t\tif item.ID == id {\n\t\t\tjson.NewEncoder(w).Encode(item)\n\t\t}\n\t}\n}", "func (c *UnsavedPostVideoClient) Get(ctx context.Context, id int) (*UnsavedPostVideo, error) {\n\treturn c.Query().Where(unsavedpostvideo.ID(id)).Only(ctx)\n}", "func ShowPost(c buffalo.Context) error {\n\tdatabase := c.Value(\"tx\").(*pop.Connection)\n\n\tpost := &models.Post{}\n\n\tif txErr := database.Eager().Find(post, c.Param(\"post_id\")); txErr != nil {\n\n\t\tnotFoundResponse := utils.NewErrorResponse(\n\t\t\thttp.StatusNotFound,\n\t\t\t\"post_id\",\n\t\t\tfmt.Sprintf(\"The requested post %s is removed or move to somewhere else.\", c.Param(\"post_id\")),\n\t\t)\n\t\treturn c.Render(http.StatusNotFound, r.JSON(notFoundResponse))\n\t}\n\n\tpostResponse := PostResponse{\n\t\tCode: fmt.Sprintf(\"%d\", http.StatusOK),\n\t\tData: post,\n\t}\n\treturn c.Render(http.StatusOK, r.JSON(postResponse))\n}", "func (c *_Comments) GetPost(ctx context.Context, db database.DB, model *Comment, relationFieldset ...string) (*Post, error) {\n\tif model == nil {\n\t\treturn nil, errors.Wrap(query.ErrNoModels, \"provided nil model\")\n\t}\n\t// Check if primary key has zero value.\n\tif model.IsPrimaryKeyZero() {\n\t\treturn nil, errors.Wrap(mapping.ErrFieldValue, \"model's: 'Comment' primary key value has zero value\")\n\t}\n\trelationField, err := c.Model.RelationByIndex(2)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar fields []*mapping.StructField\n\trelationModel := relationField.Relationship().RelatedModelStruct()\n\tif len(relationFieldset) == 0 {\n\t\tfields = relationModel.Fields()\n\t} else {\n\t\tfor _, field := range relationFieldset {\n\t\t\tsField, ok := relationModel.FieldByName(field)\n\t\t\tif !ok {\n\t\t\t\treturn nil, errors.Wrapf(mapping.ErrInvalidModelField, \"no field: '%s' found for the model: 'Post'\", field)\n\t\t\t}\n\t\t\tfields = append(fields, sField)\n\t\t}\n\t}\n\n\trelations, err := db.GetRelations(ctx, c.Model, []mapping.Model{model}, relationField, fields...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif len(relations) == 0 {\n\t\treturn nil, nil\n\t}\n\treturn relations[0].(*Post), nil\n}", "func (d *DB) Get(id int) (Todo, error) {\n\tvar target Todo\n\tdb, err := gorm.Open(\"sqlite3\", \"model/DB/test.sqlite3\")\n\tif err != nil {\n\t\treturn target, err\n\t}\n\n\tdb.First(&target, id)\n\tdb.Close()\n\n\treturn target, nil\n}", "func GetPostEndpoint(response http.ResponseWriter, request *http.Request) {\r\n\tresponse.Header().Set(\"content-type\", \"application/json\")\r\n\tid := strings.TrimPrefix(request.URL.Path, \"/posts/\")\r\n\tobjID, _ := primitive.ObjectIDFromHex(id)\r\n\tvar post Post\r\n\tcollection := client.Database(\"appointy\").Collection(\"posts\")\r\n\tctx, _ := context.WithTimeout(context.Background(), 30*time.Second)\r\n\terr := collection.FindOne(ctx, Post{ID: objID}).Decode(&post)\r\n\tif err != nil {\r\n\t\tresponse.WriteHeader(http.StatusInternalServerError)\r\n\t\tresponse.Write([]byte(`{ \"message\": \"` + err.Error() + `\" }`))\r\n\t\treturn\r\n\t}\r\n\tjson.NewEncoder(response).Encode(post)\r\n}", "func (c *TitleClient) Get(ctx context.Context, id int) (*Title, error) {\n\treturn c.Query().Where(title.ID(id)).Only(ctx)\n}", "func (c *PetClient) Get(ctx context.Context, id uuid.UUID) (*Pet, error) {\n\treturn c.Query().Where(pet.ID(id)).Only(ctx)\n}", "func (s ArticleService) Get(ctx context.Context, id string) (*Article, error) {\n\tstat := `SELECT id, title, description, content FROM articles WHERE id = ?;`\n\tif s.DB == nil {\n\t\tpanic(\"no existing database\")\n\t}\n\trows, err := s.DB.QueryContext(ctx, stat, id)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer rows.Close()\n\n\tvar article Article\n\tif rows.Next() {\n\t\terr := rows.Scan(&article.ID, &article.Title, &article.Desc, &article.Content)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\treturn &article, err\n}", "func getPostHandler(res http.ResponseWriter, req *http.Request) {\n\tres.Header().Add(\"content-type\", \"application.json\")\n\tparams := mux.Vars(req)\n\tid, _ := primitive.ObjectIDFromHex(params[\"id\"])\n\tvar post MongoPostSchema\n\n\tpostsCol := client.Database(\"Aviroop_Nandy_Appointy\").Collection(\"posts\")\n\tctx, _ := context.WithTimeout(context.Background(), 15*time.Second)\n\terr := postsCol.FindOne(ctx, MongoPostSchema{ID: id}).Decode(&post)\n\n\tif err != nil {\n\t\tres.WriteHeader(http.StatusInternalServerError)\n\t\tres.Write([]byte(`{\"Error message\":\"` + err.Error() + `\"}`))\n\t\treturn\n\t}\n\tjson.NewEncoder(res).Encode(post)\n}", "func (ps PostStorage) GetPost(ctx sdk.Context, permlink linotypes.Permlink) (*Post, sdk.Error) {\n\tstore := ctx.KVStore(ps.key)\n\tkey := GetPostInfoKey(permlink)\n\tinfoByte := store.Get(key)\n\tif infoByte == nil {\n\t\treturn nil, types.ErrPostNotFound(permlink)\n\t}\n\tpostInfo := new(Post)\n\tps.cdc.MustUnmarshalBinaryLengthPrefixed(infoByte, postInfo)\n\treturn postInfo, nil\n}", "func (c *UnsavedPostAttachmentClient) Get(ctx context.Context, id int) (*UnsavedPostAttachment, error) {\n\treturn c.Query().Where(unsavedpostattachment.ID(id)).Only(ctx)\n}", "func (m *defaultEntityManager) Get(id string) (entity *Entity) {\n\tfor _, e := range m.entities {\n\t\tif e.ID() == id {\n\t\t\treturn e\n\t\t}\n\t}\n\treturn\n}", "func (list *List) Get(id ID) (*Entity, error) {\n\tif err := list.checkBoundaries(id); err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn list.entities[id], nil\n}", "func (prj *Project) Get(id uuid.UUID) error {\n\tres := db.First(prj, id)\n\treturn res.Error\n}", "func (u DomainDao) Get(id int) model.Domain {\n\tvar domain model.Domain\n\tdb := GetDb()\n\tdb.Where(\"id = ?\", id).First(&domain)\n\treturn domain\n}", "func (store MySQL) GetPostByID(id int) (Post, error) {\n\tlog.Debug().Int(\"post_id\", id).Msg(\"GetPostByID\")\n\n\tconn := db.Connx(mysqlDbID)\n\n\trows, err := conn.Queryx(`\n SELECT\n `+postSelectSQL+`\n FROM\n `+postsTableName+`\n WHERE\n id = ?\n LIMIT 1`,\n\t\tid)\n\n\tif err != nil {\n\t\treturn Post{}, err\n\t}\n\n\tdefer rows.Close()\n\n\treturn parsePostFromRows(rows), nil\n\n}", "func (c *EntryController) Get(ctx *app.GetEntryContext) error {\n\tentry, err := c.entryRepo.FindByID(ctx.EntryID)\n\tif err != nil {\n\t\tif errors.Cause(sql.ErrNoRows) != nil {\n\t\t\treturn ctx.NotFound()\n\t\t}\n\n\t\treturn errors.Wrap(err, \"Un-expected error\")\n\t}\n\n\tres := entryModelToMediaFull(entry)\n\treturn ctx.OKFull(res)\n}", "func (user User) Get() (User, error) {\n\tstmt, err := db.PrepareNamed(\"SELECT * FROM users WHERE id = :id\")\n\tif err != nil {\n\t\treturn user, err\n\t}\n\terr = stmt.Get(&user, user)\n\tif err != nil {\n\t\tif err.Error() == \"sql: no rows in result set\" {\n\t\t\treturn user, errors.New(\"not found\")\n\t\t}\n\t\treturn user, err\n\t}\n\tvar posts []Post\n\tstmt, err = db.PrepareNamed(\"SELECT * FROM posts WHERE author = :id ORDER BY created DESC\")\n\tif err != nil {\n\t\treturn user, err\n\t}\n\terr = stmt.Select(&posts, user)\n\tif err != nil {\n\t\tif err.Error() == \"sql: no rows in result set\" {\n\t\t\tuser.Posts = make([]Post, 0)\n\t\t\treturn user, nil\n\t\t}\n\t\treturn user, err\n\t}\n\tuser.Posts = posts\n\treturn user, nil\n}", "func GetPostFromStrId(context appengine.Context, strId string) (*Post, error) {\n\n\tvar post Post\n\tid, _ := strconv.ParseInt(strId, 10, 64)\n\tpostKey := datastore.NewKey(context, \"Post\", \"\", id, nil)\n\terr := datastore.Get(context, postKey, &post)\n\tpost.Id = id\n\treturn &post, err\n}", "func GetPostHandler(w http.ResponseWriter, r *http.Request, params httprouter.Params) {\n\turl := fmt.Sprintf(\"%s/%s\", postsUrl, params.ByName(\"id\"))\n\tresponse, err := restClient.Get(url, r, nil)\n\n\tif err != nil {\n\t\trestClient.WriteErrorResponse(w, \"server_error\", \"Server error occured\")\n\t\treturn\n\t}\n\n\tvar post Post\n\trestClient.WriteJSONResponse(w, response, post)\n}", "func (s *service) PostDetail(id string) (*model.Post, error) {\n\tpost, err := s.db.PostDetail(id)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn post, nil\n}", "func Get(key string) (Entity, error) {\n\tconn := db.Pool.Get()\n\tdefer conn.Close()\n\n\trecord, err := db.Get(conn, key)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn Load(key, record), nil\n}", "func (model *SnippetModel) Get(id int) (*models.Snippet, error) {\n\tstmt := ` SELECT id, title, content, created, expires FROM snippets\n\tWHERE expires > UTC_TIMESTAMP() AND id = ?`\n\n\tsnippet := &models.Snippet{}\n\n\terr := model.DB.QueryRow(stmt, id).Scan(&snippet.ID, &snippet.Title, &snippet.Content, &snippet.Created, &snippet.Expires)\n\tif err != nil {\n\t\tif errors.Is(err, sql.ErrNoRows) {\n\t\t\treturn nil, models.ErrNoRecord\n\t\t}\n\n\t\treturn nil, err\n\t}\n\n\treturn snippet, nil\n}", "func (c *PetruleClient) Get(ctx context.Context, id int) (*Petrule, error) {\n\treturn c.Query().Where(petrule.ID(id)).Only(ctx)\n}", "func (p Posts) Get(i int) *Post {\n\treturn p[i]\n}", "func (r *sampleRepository) Get(id uuid.UUID) (*model.Sample, error) {\n\tvar sample model.Sample\n\n\terr := r.DB.Where(\"id = ?\", id).Take(&sample).Error\n\n\tif err == gorm.ErrRecordNotFound {\n\t\treturn nil, nil\n\t}\n\n\treturn &sample, err\n}", "func (a Author) Get(cfg *config.Config, id string) (Author, error) {\n\tvar author Author\n\tsession := cfg.Session.Copy()\n\tif err := cfg.Database.C(AuthorCollection).Find(bson.M{\"_id\": id}).One(&author); err != nil {\n\t\treturn author, err\n\t}\n\tdefer session.Close()\n\treturn author, nil\n}", "func (c *PostClient) GetX(ctx context.Context, id int) *Post {\n\tobj, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn obj\n}", "func (c *ReviewClient) Get(ctx context.Context, id int32) (*Review, error) {\n\treturn c.Query().Where(review.ID(id)).Only(ctx)\n}", "func (ads *ArticleDS) Get(idS string) (*articles.Article, error) {\n\tid, err := strconv.Atoi(idS)\n\tif err != nil {\n\t\treturn nil, status.ErrBadRequest.WithMessage(err.Error())\n\t}\n\tdb := ads.db\n\ta := articles.Article{}\n\tfindStmt := `SELECT id, title, publish_date, body, tags FROM ARTICLES.ARTICLE WHERE id = $1`\n\terr = db.QueryRow(\n\t\tfindStmt,\n\t\tid).Scan(&a.ID, &a.Title, &a.Date, &a.Body, pq.Array(&a.Tags))\n\tif err == sql.ErrNoRows {\n\t\treturn nil, status.ErrNotFound.WithMessage(err.Error())\n\t}\n\treturn &a, nil\n}", "func (m *SnippetModel) Get(id int) (*models.Snippet, error) {\n\ttx, err := m.DB.Begin()\n\tif err != nil {\n\t\ttx.Rollback()\n\t\treturn nil, err\n\t}\n\tstmt := `SELECT id, title, content, created, expires FROM snippets\n WHERE expires > UTC_TIMESTAMP() AND id = ?`\n\t// m.DB.QueryRow returns a pointer to a sql.Row object which holds the\n\t// result from the database\n\trow := tx.QueryRow(stmt, id)\n\n\t// Initialize a pointer to a new zeroed Snippet struct\n\ts := &models.Snippet{}\n\n\t// row.Scan() copies the values from each field to the Snippet struct s,\n\t// All the values passed are pointers to the place you want to copy the data\n\t// into, and the number of arguments must be exactly the same as the number\n\t// of columns returned by your statement\n\terr = row.Scan(&s.ID, &s.Title, &s.Content, &s.Created, &s.Expires)\n\tif err != nil {\n\t\t// If the query returns no rows then row.Scan() will return a\n\t\t// sql.ErrNoRows error.\n\t\t// errors.Is() is used to check if the error is a sql.ErrNoRows\n\t\tif errors.Is(err, sql.ErrNoRows) {\n\t\t\ttx.Rollback()\n\t\t\treturn nil, models.ErrNoRecord\n\t\t} else {\n\t\t\ttx.Rollback()\n\t\t\treturn nil, err\n\t\t}\n\t}\n\t// If everything is OK then return the Snippet object\n\terr = tx.Commit()\n\treturn s, err\n}", "func (ctl *NoteController) Get(c *gin.Context) {\n\t// parse id\n\tid, err := parseID(c)\n\tif err != nil {\n\t\treturn\n\t}\n\n\t// find Note\n\tw := models.Note{ID: id}\n\tif err := models.DB().Select(&w); err != nil {\n\t\tc.JSON(http.StatusInternalServerError, Error(err))\n\t\treturn\n\t}\n\n\tc.JSON(http.StatusOK, w)\n}", "func (box *EntityBox) Get(id uint64) (*Entity, error) {\n\tobject, err := box.Box.Get(id)\n\tif err != nil {\n\t\treturn nil, err\n\t} else if object == nil {\n\t\treturn nil, nil\n\t}\n\treturn object.(*Entity), nil\n}", "func GetPostByID(db *gorm.DB, postID int) (interface{}, string) {\n\n\tvar post []model.Post\n\tvar result []model.PostOutput\n\terr := db.Where(\"id = ?\", postID).Preload(\"Comments\").Preload(\"Likes\").Preload(\"Comments.Author\").Preload(\"Likes.Author\").Find(&post).Error\n\tif err == nil {\n\t\tuser := false\n\t\tcomment := 2\n\t\tresult = postsToPostOutput(post, user, comment)\n\t\tif len(result) > 0 {\n\t\t\treturn result[0], \"\"\n\t\t}\n\t\treturn \"\", \"Post not found\"\n\t}\n\treturn result[0], err.Error()\n}", "func (r ProductRepository) Get(ctx context.Context, id uint) (*product.Product, error) {\n\tentity := &product.Product{}\n\n\terr := r.dbWithDefaults().First(&entity, id).Error\n\tif err != nil {\n\t\tif err == gorm.ErrRecordNotFound {\n\t\t\treturn entity, apperror.ErrNotFound\n\t\t}\n\t}\n\treturn entity, err\n}", "func (s *runnablesrvc) Get(ctx context.Context, p *runnable.GetPayload) (res *runnable.Runnable, err error) {\n\ts.logger.Print(\"runnable.get\")\n\tr, err := s.store.Get(ctx, p.ID)\n\tif r == nil {\n\t\treturn nil, runnable.MakeNotFound(errors.New(err.Error()))\n\t}\n\treturn runnableDomainToRest(r), nil\n}", "func (c *PharmacistClient) Get(ctx context.Context, id int) (*Pharmacist, error) {\n\treturn c.Query().Where(pharmacist.ID(id)).Only(ctx)\n}", "func (t *TargetController) Get(c *gin.Context) {\n\tid := c.Param(\"id\")\n\tt.db.Init()\n\tdefer t.db.Free()\n\ttarget, err := t.db.GetTargetByID(id, true)\n\tswitch {\n\tcase err != nil:\n\t\tt.log.Error(err)\n\t\tc.JSON(http.StatusInternalServerError, gin.H{\n\t\t\t\"message\": \"Internal error. Try again.\",\n\t\t})\n\t\treturn\n\tcase target == nil:\n\t\tc.JSON(http.StatusNotFound, gin.H{\n\t\t\t\"message\": \"Target not found.\",\n\t\t})\n\t\treturn\n\t}\n\tc.JSON(http.StatusOK, target)\n}", "func (o *PostGetOneParams) WithID(id int64) *PostGetOneParams {\n\to.SetID(id)\n\treturn o\n}", "func (d *Dao) GetById(id int64) (reward *model.AnchorReward, err error) {\n\trewards := []*model.AnchorReward{}\n\tif err := d.orm.Model(&model.AnchorReward{}).Find(&rewards, \"id=?\", id).Error; err != nil {\n\t\tlog.Error(\"getRewardById (%v) error(%v)\", id, err)\n\t\treturn reward, err\n\t}\n\tif len(rewards) != 0 {\n\t\treward = rewards[0]\n\t}\n\n\treturn\n}", "func (s MyEntityManager) Get(id uint64) ecs.Entity {\n\treturn *s.items[id].entity\n}", "func (c *TasteClient) Get(ctx context.Context, id int) (*Taste, error) {\n\treturn c.Query().Where(taste.ID(id)).Only(ctx)\n}", "func (c *MediaClient) Get(ctx context.Context, id int) (*Media, error) {\n\treturn c.Query().Where(media.ID(id)).Only(ctx)\n}", "func (c *DentistClient) Get(ctx context.Context, id int) (*Dentist, error) {\n\treturn c.Query().Where(dentist.ID(id)).Only(ctx)\n}", "func (e EndPoint) Get(container EndPointContainer) {\n\n\tvar id int64\n\t_, err := fmt.Sscanf(container.GetRequest().URL.Query().Get(\":id\"), \"%d\", &id)\n\tif err != nil {\n\t\tcontainer.Error(err, http.StatusBadRequest)\n\t\treturn\n\t}\n\tentity := reflect.New(container.GetPrototype()).Interface()\n\trepository := container.GetRepository()\n\terr = repository.FindByID(id, entity.(Entity))\n\tif err != nil {\n\t\tcontainer.Error(err, http.StatusInternalServerError)\n\t\treturn\n\t}\n\terr = json.NewEncoder(container.GetResponseWriter()).Encode(entity)\n\tif err != nil {\n\t\tcontainer.Error(err, http.StatusInternalServerError)\n\t}\n}", "func (t Transform) Get(db *DB, id int64) (*Transform, error) {\n\ttransform := &Transform{}\n\ttransform.ID = id\n\terr := db.Get(transform, db.Transforms.C(\"id\"))\n\treturn transform, err\n}", "func (*Products) Get(id int64) (Products, error) {\n\n\tquery := app.SQLCache[\"products_get_id.sql\"]\n\tstmt, err := db.Prepare(query)\n\n\tif err != nil {\n\t\tlog.Fatal(\"(GetProduct:Prepare)\", err)\n\t\treturn Products{}, err\n\t}\n\n\tdefer stmt.Close()\n\tvar product Products\n\n\terr = stmt.QueryRow(id).\n\t\tScan(&product.ID,\n\t\t\t&product.Name,\n\t\t\t&product.Unit,\n\t\t\t&product.Audit.Deleted,\n\t\t\t&product.Audit.DateCreated,\n\t\t\t&product.Audit.DateUpdated)\n\n\tif err != nil {\n\t\tlog.Println(\"(GetProduct:QueryRow:Scan)\", err)\n\t\treturn Products{}, err\n\t}\n\n\treturn product, nil\n}", "func (a *ArticleController) Get() {\n\n\to := orm.NewOrm()\n\tid, _ := strconv.Atoi(a.Ctx.Input.Param(\":id\"))\n\tarticle := m.Article{Id: id}\n\terr := o.Read(&article)\n\tif err == orm.ErrNoRows {\n\t\tfmt.Println(\"查询不到\")\n\t} else if err == orm.ErrMissPK {\n\t\tfmt.Println(\"找不到主键\")\n\t} else {\n\t\ta.Data[\"model\"] = article\n\t}\n\ta.Data[\"test\"] = err\n\ta.Data[\"id\"] = id\n\ta.Data[\"title\"] = article.Title\n\ta.Layout = \"nimda/layout.tpl\"\n\n}", "func (c *TagClient) Get(ctx context.Context, id int) (*Tag, error) {\n\treturn c.Query().Where(tag.ID(id)).Only(ctx)\n}", "func (store *EntryStore) Get(id []byte) (*hexalog.Entry, error) {\n\tsl, err := store.db.Get(store.ro, id)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer sl.Free()\n\n\tdata := sl.Data()\n\tif data == nil {\n\t\treturn nil, hexatype.ErrEntryNotFound\n\t}\n\n\tvar entry hexalog.Entry\n\terr = proto.Unmarshal(data, &entry)\n\treturn &entry, err\n}", "func (c *UnsavedPostClient) GetX(ctx context.Context, id int) *UnsavedPost {\n\tobj, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn obj\n}", "func getPost(w http.ResponseWriter, r *http.Request) {\r\n\tw.Header().Set(\"Content-Type\", \"application/json\")\r\n\tparams := mux.Vars(r)\r\n\tfor _, item := range posts {\r\n\t\tif item.ID == params[\"id\"] {\r\n\r\n\t\t\tjson.NewEncoder(w).Encode(item)\r\n\t\t\tbreak\r\n\t\t}\r\n\t\treturn\r\n\t}\r\n\tjson.NewEncoder(w).Encode(&Post{})\r\n}", "func (r *PortRepo) Get(id string) (*model.Port, error) {\n\tport := &model.Port{}\n\n\terr := r.collection.Find(bson.M{\"id\": id}).One(port)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn port, nil\n}", "func (c *MainController) Get() {\n\tposts, err := c.getAllPosts()\n\tif err != nil {\n\t\terr = errors.Wrap(err, \"Can not load posts\")\n\t\thttp.Error(c.Ctx.ResponseWriter, err.Error(), http.StatusInternalServerError)\n\t\tlog.Print(err)\n\t\treturn\n\t}\n\n\tc.Data[\"Title\"] = \"Blog\"\n\tc.Data[\"Posts\"] = posts\n\tc.TplName = \"index.tpl\"\n}", "func (c *BranchClient) Get(ctx context.Context, id int) (*Branch, error) {\n\treturn c.Query().Where(branch.ID(id)).Only(ctx)\n}", "func (m *SnippetModel) Get(id int) (*models.Snippet, error) {\n\t// Create the SQL statement to execute\n\t// Split over 2 lines for readibility\n\tstmt := `SELECT id, title, content, created, expires FROM snippets \n\tWHERE expires > UTC_TIMESTAMP() AND id =?`\n\n\t// Use the QueryRow() method on the comnnection pool to execute our\n\t// SQL statement, passing in the untrusted id variable as the value for the\n\t// placeholder parameter. This returns a pointer to a sql.Row object which\n\t// holds the result set from the database.\n\trow := m.DB.QueryRow(stmt, id)\n\n\t// Initialize a pointer to a new zeroed Snippet struct.\n\ts := &models.Snippet{}\n\n\t// Use row.Scan() to copy the values from each field in the sql.Row to the\n\t// corresponding field in the Snippet struct. Notice that the arguments\n\t// to row.Scan are *pointers* to the place we want to copy the data into,\n\t// and the number of arguments must be exactly the same as the number of\n\t// columns returned by the statement. If the query returns no rows, then\n\t// row.Scan() will return a sql.ErrNoRows error. We check for that and return\n\t// our models.ErrNoRecord error instead of a Snippet object\n\terr := row.Scan(&s.ID, &s.Title, &s.Content, &s.Created, &s.Expires)\n\tif err == sql.ErrNoRows {\n\t\treturn nil, models.ErrNoRecord\n\t} else if err != nil {\n\t\treturn nil, err\n\t}\n\n\t// If everything went OK then return the Snippet object.\n\treturn s, nil\n\n\t// Version above is long hand.\n\t// As errors from DB.QueryRow() are deferred until Scan() is called, it can be shortened to:\n\t// --------------------------------------\n\t// s := &models.Snippet{}\n\t// err := m.DB.QueryRow(\"SELECT ...\", id).Scan(&s.ID, &s.Title, &s.Content, &s.Created, &s.Expires)\n\t// if err == sql.ErrNoRows {\n\t// return nil, models.ErrNoRecord }\n\t// else if err != nil {\n\t// return nil, err }\n\t// return s, nil\n}", "func (c *DepositClient) Get(ctx context.Context, id int) (*Deposit, error) {\n\treturn c.Query().Where(deposit.ID(id)).Only(ctx)\n}", "func (c *PaymentClient) Get(ctx context.Context, id int) (*Payment, error) {\n\treturn c.Query().Where(payment.ID(id)).Only(ctx)\n}" ]
[ "0.7495577", "0.7447425", "0.7387182", "0.7363605", "0.72955465", "0.72891295", "0.72445786", "0.7226928", "0.71817124", "0.71701163", "0.7098485", "0.6985699", "0.69458616", "0.6916069", "0.6857761", "0.6845419", "0.68286604", "0.6708302", "0.65774596", "0.65211505", "0.65000904", "0.6471059", "0.6467693", "0.6456263", "0.64227706", "0.6394868", "0.6366736", "0.6335305", "0.633235", "0.6328567", "0.63251466", "0.6310668", "0.62451124", "0.62285936", "0.62266", "0.62098783", "0.62077904", "0.6205144", "0.61797965", "0.61613077", "0.61466205", "0.61418605", "0.6125601", "0.61070764", "0.609575", "0.60695004", "0.6055202", "0.60486656", "0.6021353", "0.59926254", "0.59825635", "0.59718347", "0.5967448", "0.59662503", "0.5954496", "0.5935048", "0.5902891", "0.59025645", "0.59025437", "0.58826375", "0.58735895", "0.5872587", "0.58684075", "0.58527225", "0.5851565", "0.5851225", "0.5847427", "0.58247745", "0.5812258", "0.5799482", "0.57986164", "0.578895", "0.5772528", "0.576992", "0.57697356", "0.57676697", "0.5755088", "0.57287514", "0.5715324", "0.57130134", "0.5701588", "0.5700618", "0.5693721", "0.56817573", "0.56803304", "0.5674847", "0.5658713", "0.5642601", "0.5626488", "0.56213045", "0.56066436", "0.55984336", "0.5591338", "0.5572284", "0.5557468", "0.555324", "0.5548852", "0.55473226", "0.5524383", "0.5523614" ]
0.8323977
0
GetX is like Get, but panics if an error occurs.
func (c *PostClient) GetX(ctx context.Context, id int) *Post { obj, err := c.Get(ctx, id) if err != nil { panic(err) } return obj }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (c *StatustClient) GetX(ctx context.Context, id int) *Statust {\n\ts, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn s\n}", "func (c *OperativeClient) GetX(ctx context.Context, id int) *Operative {\n\to, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn o\n}", "func (c *StaytypeClient) GetX(ctx context.Context, id int) *Staytype {\n\ts, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn s\n}", "func (c *LevelOfDangerousClient) GetX(ctx context.Context, id int) *LevelOfDangerous {\n\tlod, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn lod\n}", "func (c *DentistClient) GetX(ctx context.Context, id int) *Dentist {\n\td, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn d\n}", "func (c *ToolClient) GetX(ctx context.Context, id int) *Tool {\n\tt, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn t\n}", "func (c *IPClient) GetX(ctx context.Context, id uuid.UUID) *IP {\n\tobj, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn obj\n}", "func (c *BeerClient) GetX(ctx context.Context, id int) *Beer {\n\tobj, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn obj\n}", "func (c *PhysicianClient) GetX(ctx context.Context, id int) *Physician {\n\tph, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn ph\n}", "func (c *PhysicianClient) GetX(ctx context.Context, id int) *Physician {\n\tph, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn ph\n}", "func (c *PharmacistClient) GetX(ctx context.Context, id int) *Pharmacist {\n\tph, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn ph\n}", "func (c *EmptyClient) GetX(ctx context.Context, id int) *Empty {\n\tobj, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn obj\n}", "func (c *OperationClient) GetX(ctx context.Context, id uuid.UUID) *Operation {\n\tobj, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn obj\n}", "func (c *NurseClient) GetX(ctx context.Context, id int) *Nurse {\n\tn, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn n\n}", "func (c *PatientInfoClient) GetX(ctx context.Context, id int) *PatientInfo {\n\tpi, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn pi\n}", "func (c *ClinicClient) GetX(ctx context.Context, id uuid.UUID) *Clinic {\n\tobj, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn obj\n}", "func (c *LeaseClient) GetX(ctx context.Context, id int) *Lease {\n\tl, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn l\n}", "func (c *ModuleVersionClient) GetX(ctx context.Context, id int) *ModuleVersion {\n\tmv, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn mv\n}", "func (c *PetruleClient) GetX(ctx context.Context, id int) *Petrule {\n\tpe, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn pe\n}", "func (c *KeyStoreClient) GetX(ctx context.Context, id int32) *KeyStore {\n\tobj, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn obj\n}", "func (c *SituationClient) GetX(ctx context.Context, id int) *Situation {\n\ts, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn s\n}", "func (c *MedicineClient) GetX(ctx context.Context, id int) *Medicine {\n\tm, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn m\n}", "func (c *RepairinvoiceClient) GetX(ctx context.Context, id int) *Repairinvoice {\n\tr, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn r\n}", "func (c *BillClient) GetX(ctx context.Context, id int) *Bill {\n\tb, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn b\n}", "func (c *BillClient) GetX(ctx context.Context, id int) *Bill {\n\tb, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn b\n}", "func (c *BillClient) GetX(ctx context.Context, id int) *Bill {\n\tb, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn b\n}", "func (c *OperativerecordClient) GetX(ctx context.Context, id int) *Operativerecord {\n\to, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn o\n}", "func (c *ReturninvoiceClient) GetX(ctx context.Context, id int) *Returninvoice {\n\tr, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn r\n}", "func (c *CleanernameClient) GetX(ctx context.Context, id int) *Cleanername {\n\tcl, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn cl\n}", "func (c *AdminClient) GetX(ctx context.Context, id int) *Admin {\n\tobj, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn obj\n}", "func (c *RepairInvoiceClient) GetX(ctx context.Context, id int) *RepairInvoice {\n\tri, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn ri\n}", "func (c *ComplaintClient) GetX(ctx context.Context, id int) *Complaint {\n\tco, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn co\n}", "func (c *DNSBLQueryClient) GetX(ctx context.Context, id uuid.UUID) *DNSBLQuery {\n\tobj, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn obj\n}", "func (c *ModuleClient) GetX(ctx context.Context, id int) *Module {\n\tm, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn m\n}", "func (c *MedicineTypeClient) GetX(ctx context.Context, id int) *MedicineType {\n\tmt, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn mt\n}", "func (c *BuildingClient) GetX(ctx context.Context, id int) *Building {\n\tb, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn b\n}", "func (c *DeviceClient) GetX(ctx context.Context, id int) *Device {\n\td, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn d\n}", "func (c *PatientClient) GetX(ctx context.Context, id int) *Patient {\n\tpa, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn pa\n}", "func (c *PatientClient) GetX(ctx context.Context, id int) *Patient {\n\tpa, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn pa\n}", "func (c *PatientClient) GetX(ctx context.Context, id int) *Patient {\n\tpa, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn pa\n}", "func (c *RoomuseClient) GetX(ctx context.Context, id int) *Roomuse {\n\tr, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn r\n}", "func (c *UserClient) GetX(ctx context.Context, id int) *User {\n\tu, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn u\n}", "func (c *UserClient) GetX(ctx context.Context, id int) *User {\n\tu, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn u\n}", "func (c *UserClient) GetX(ctx context.Context, id int) *User {\n\tu, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn u\n}", "func (c *UserClient) GetX(ctx context.Context, id int) *User {\n\tu, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn u\n}", "func (c *UserClient) GetX(ctx context.Context, id int) *User {\n\tu, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn u\n}", "func (c *UserClient) GetX(ctx context.Context, id int) *User {\n\tu, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn u\n}", "func (c *StatusdClient) GetX(ctx context.Context, id int) *Statusd {\n\ts, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn s\n}", "func (c *UserClient) GetX(ctx context.Context, id int64) *User {\n\tobj, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn obj\n}", "func (c *PlanetClient) GetX(ctx context.Context, id int) *Planet {\n\tpl, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn pl\n}", "func (c *PurposeClient) GetX(ctx context.Context, id int) *Purpose {\n\tpu, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn pu\n}", "func (c *TransactionClient) GetX(ctx context.Context, id int32) *Transaction {\n\tobj, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn obj\n}", "func (c *LengthtimeClient) GetX(ctx context.Context, id int) *Lengthtime {\n\tl, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn l\n}", "func (c *VeterinarianClient) GetX(ctx context.Context, id uuid.UUID) *Veterinarian {\n\tobj, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn obj\n}", "func (c *UserClient) GetX(ctx context.Context, id int) *User {\n\tobj, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn obj\n}", "func (c *UserClient) GetX(ctx context.Context, id int) *User {\n\tobj, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn obj\n}", "func (c *UsertypeClient) GetX(ctx context.Context, id int) *Usertype {\n\tu, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn u\n}", "func (c *PrescriptionClient) GetX(ctx context.Context, id int) *Prescription {\n\tpr, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn pr\n}", "func (c *PaymentClient) GetX(ctx context.Context, id int) *Payment {\n\tpa, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn pa\n}", "func (c *PaymentClient) GetX(ctx context.Context, id int) *Payment {\n\tpa, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn pa\n}", "func (c *WorkExperienceClient) GetX(ctx context.Context, id int) *WorkExperience {\n\tobj, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn obj\n}", "func (c *DNSBLResponseClient) GetX(ctx context.Context, id uuid.UUID) *DNSBLResponse {\n\tobj, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn obj\n}", "func (c *UserClient) GetX(ctx context.Context, id uuid.UUID) *User {\n\tobj, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn obj\n}", "func (c *UserClient) GetX(ctx context.Context, id uuid.UUID) *User {\n\tobj, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn obj\n}", "func (c *OperationroomClient) GetX(ctx context.Context, id int) *Operationroom {\n\to, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn o\n}", "func (c *PatientofphysicianClient) GetX(ctx context.Context, id int) *Patientofphysician {\n\tpa, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn pa\n}", "func (c *PositionInPharmacistClient) GetX(ctx context.Context, id int) *PositionInPharmacist {\n\tpip, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn pip\n}", "func (c *CleaningroomClient) GetX(ctx context.Context, id int) *Cleaningroom {\n\tcl, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn cl\n}", "func (c *DoctorClient) GetX(ctx context.Context, id int) *Doctor {\n\td, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn d\n}", "func (c *StatusRClient) GetX(ctx context.Context, id int) *StatusR {\n\ts, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn s\n}", "func (c *SymptomClient) GetX(ctx context.Context, id int) *Symptom {\n\ts, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn s\n}", "func (c *TagClient) GetX(ctx context.Context, id int) *Tag {\n\tobj, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn obj\n}", "func (c *CoinInfoClient) GetX(ctx context.Context, id int32) *CoinInfo {\n\tobj, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn obj\n}", "func (c *WifiClient) GetX(ctx context.Context, id int) *Wifi {\n\tw, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn w\n}", "func (c *UnitOfMedicineClient) GetX(ctx context.Context, id int) *UnitOfMedicine {\n\tuom, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn uom\n}", "func (c *EmployeeClient) GetX(ctx context.Context, id int) *Employee {\n\te, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn e\n}", "func (c *EmployeeClient) GetX(ctx context.Context, id int) *Employee {\n\te, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn e\n}", "func (c *EmployeeClient) GetX(ctx context.Context, id int) *Employee {\n\te, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn e\n}", "func (c *YearClient) GetX(ctx context.Context, id int) *Year {\n\ty, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn y\n}", "func (x *V) Get(params ...interface{}) (*V, error) {\n\tif false == x.initialized {\n\t\treturn nil, errNotInitialized\n\t}\n\tif 0 == len(params) {\n\t\treturn nil, errNilParameter\n\t}\n\treturn x.getOrCreate(false, params...)\n}", "func (c *OrderClient) GetX(ctx context.Context, id int) *Order {\n\to, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn o\n}", "func (c *FoodmenuClient) GetX(ctx context.Context, id int) *Foodmenu {\n\tf, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn f\n}", "func (c *DispenseMedicineClient) GetX(ctx context.Context, id int) *DispenseMedicine {\n\tdm, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn dm\n}", "func (c *SkillClient) GetX(ctx context.Context, id int) *Skill {\n\tobj, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn obj\n}", "func (c *TitleClient) GetX(ctx context.Context, id int) *Title {\n\tt, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn t\n}", "func (c *CustomerClient) GetX(ctx context.Context, id uuid.UUID) *Customer {\n\tobj, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn obj\n}", "func Get(ctx *grumble.Context) error {\n\tclient, execCtx, cancel := newClientAndCtx(ctx, 5*time.Second)\n\tdefer cancel()\n\tval, err := client.Get(execCtx, &ldProto.Key{Key: ctx.Args.String(\"key\")})\n\tif err != nil || val.Key == \"\" {\n\t\treturn err\n\t}\n\treturn exec(ctx, handleKeyValueReturned(val))\n}", "func (_HelloWorld *HelloWorldCaller) Get(opts *bind.CallOpts) (string, error) {\n\tvar (\n\t\tret0 = new(string)\n\t)\n\tout := ret0\n\terr := _HelloWorld.contract.Call(opts, out, \"get\")\n\treturn *ret0, err\n}", "func (c *BillingstatusClient) GetX(ctx context.Context, id int) *Billingstatus {\n\tb, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn b\n}", "func (c *RentalstatusClient) GetX(ctx context.Context, id int) *Rentalstatus {\n\tr, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn r\n}", "func (c *UserWalletClient) GetX(ctx context.Context, id int64) *UserWallet {\n\tobj, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn obj\n}", "func (c *SessionClient) GetX(ctx context.Context, id int) *Session {\n\ts, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn s\n}", "func (c *ReviewClient) GetX(ctx context.Context, id int32) *Review {\n\tobj, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn obj\n}", "func (c *BookingClient) GetX(ctx context.Context, id int) *Booking {\n\tb, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn b\n}", "func (c *RoomdetailClient) GetX(ctx context.Context, id int) *Roomdetail {\n\tr, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn r\n}", "func (c *EventClient) GetX(ctx context.Context, id int) *Event {\n\tobj, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn obj\n}", "func (c *PositionassingmentClient) GetX(ctx context.Context, id int) *Positionassingment {\n\tpo, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn po\n}", "func (c *PatientroomClient) GetX(ctx context.Context, id int) *Patientroom {\n\tpa, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn pa\n}", "func (c *PetClient) GetX(ctx context.Context, id uuid.UUID) *Pet {\n\tobj, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn obj\n}", "func (c *CompanyClient) GetX(ctx context.Context, id int) *Company {\n\tobj, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn obj\n}" ]
[ "0.66496724", "0.66252446", "0.6615732", "0.6588074", "0.65865564", "0.6579172", "0.6565792", "0.6544459", "0.65345156", "0.65345156", "0.6532471", "0.65085334", "0.6506574", "0.6491457", "0.6471564", "0.6469912", "0.6469408", "0.6466656", "0.645947", "0.6424143", "0.63988686", "0.637982", "0.6379801", "0.63662297", "0.63662297", "0.63662297", "0.63648087", "0.6345202", "0.63387924", "0.6316006", "0.6315565", "0.63152325", "0.6307725", "0.63036525", "0.629203", "0.62886506", "0.62833667", "0.6282534", "0.6282534", "0.6282534", "0.6279849", "0.62784874", "0.62784874", "0.62784874", "0.62784874", "0.62784874", "0.62784874", "0.62607205", "0.6258848", "0.6245166", "0.62447625", "0.62445724", "0.6242281", "0.6242096", "0.62413293", "0.62413293", "0.6238969", "0.62387156", "0.6236871", "0.6236871", "0.62318987", "0.62232995", "0.6204355", "0.6204355", "0.6203673", "0.6202973", "0.6202917", "0.6202815", "0.6199118", "0.61942714", "0.6192401", "0.6189043", "0.61758024", "0.6165914", "0.6165194", "0.61619186", "0.61619186", "0.61619186", "0.6155354", "0.61457276", "0.6131832", "0.613054", "0.6127511", "0.61234546", "0.6113966", "0.60981816", "0.6097482", "0.6084122", "0.60767865", "0.6063842", "0.60482377", "0.6042763", "0.60408664", "0.6039773", "0.6035943", "0.6019771", "0.60111755", "0.60078114", "0.60033286", "0.59983164" ]
0.6083127
88
QueryAuthor queries the author edge of a Post.
func (c *PostClient) QueryAuthor(po *Post) *AdminQuery { query := &AdminQuery{config: c.config} query.path = func(ctx context.Context) (fromV *sql.Selector, _ error) { id := po.ID step := sqlgraph.NewStep( sqlgraph.From(post.Table, post.FieldID, id), sqlgraph.To(admin.Table, admin.FieldID), sqlgraph.Edge(sqlgraph.M2O, true, post.AuthorTable, post.AuthorColumn), ) fromV = sqlgraph.Neighbors(po.driver.Dialect(), step) return fromV, nil } return query }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (c *UnsavedPostClient) QueryAuthor(up *UnsavedPost) *AdminQuery {\n\tquery := &AdminQuery{config: c.config}\n\tquery.path = func(ctx context.Context) (fromV *sql.Selector, _ error) {\n\t\tid := up.ID\n\t\tstep := sqlgraph.NewStep(\n\t\t\tsqlgraph.From(unsavedpost.Table, unsavedpost.FieldID, id),\n\t\t\tsqlgraph.To(admin.Table, admin.FieldID),\n\t\t\tsqlgraph.Edge(sqlgraph.M2O, true, unsavedpost.AuthorTable, unsavedpost.AuthorColumn),\n\t\t)\n\t\tfromV = sqlgraph.Neighbors(up.driver.Dialect(), step)\n\t\treturn fromV, nil\n\t}\n\treturn query\n}", "func (po *Post) QueryAuthor() *UserQuery {\n\treturn NewPostClient(po.config).QueryAuthor(po)\n}", "func (upq *UnsavedPostQuery) QueryAuthor() *AdminQuery {\n\tquery := &AdminQuery{config: upq.config}\n\tquery.path = func(ctx context.Context) (fromU *sql.Selector, err error) {\n\t\tif err := upq.prepareQuery(ctx); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tselector := upq.sqlQuery(ctx)\n\t\tif err := selector.Err(); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tstep := sqlgraph.NewStep(\n\t\t\tsqlgraph.From(unsavedpost.Table, unsavedpost.FieldID, selector),\n\t\t\tsqlgraph.To(admin.Table, admin.FieldID),\n\t\t\tsqlgraph.Edge(sqlgraph.M2O, true, unsavedpost.AuthorTable, unsavedpost.AuthorColumn),\n\t\t)\n\t\tfromU = sqlgraph.SetNeighbors(upq.driver.Dialect(), step)\n\t\treturn fromU, nil\n\t}\n\treturn query\n}", "func Author(v string) predicate.Book {\n\treturn predicate.Book(func(s *sql.Selector) {\n\t\ts.Where(sql.EQ(s.C(FieldAuthor), v))\n\t})\n}", "func (upq *UnsavedPostQuery) WithAuthor(opts ...func(*AdminQuery)) *UnsavedPostQuery {\n\tquery := &AdminQuery{config: upq.config}\n\tfor _, opt := range opts {\n\t\topt(query)\n\t}\n\tupq.withAuthor = query\n\treturn upq\n}", "func (r *PostReprGQL) AUTHOR(ctx context.Context) *AuthorReprGQL {\n\treturn &AuthorReprGQL{}\n}", "func (p *Post) Author() *User {\n\tif !bson.IsObjectIdHex(p.CreatedBy) {\n\t\treturn ghostUser\n\t}\n\tuser := &User{Id: bson.ObjectIdHex(p.CreatedBy)}\n\terr := user.GetUserById()\n\tif err != nil {\n\t\treturn ghostUser\n\t}\n\treturn user\n}", "func (m *PostMutation) ClearAuthor() {\n\tm.clearedauthor = true\n}", "func AuthorEQ(v string) predicate.Book {\n\treturn predicate.Book(func(s *sql.Selector) {\n\t\ts.Where(sql.EQ(s.C(FieldAuthor), v))\n\t})\n}", "func (b *Book) Author(db XODB) (*Author, error) {\n\treturn AuthorByAuthorID(db, b.AuthorID)\n}", "func (r *authorsResource) GetAuthor(request *restful.Request, response *restful.Response) {\n\tauthorID := request.PathParameter(\"author-id\")\n\tctx := context.Background()\n\n\tres, err := r.service.GetAuthor(ctx, authorID)\n\tif err != nil {\n\t\tencodeErrorWithStatus(response, err, http.StatusBadRequest)\n\t}\n\n\tresponse.WriteHeaderAndEntity(http.StatusOK, res)\n}", "func (r postQueryAuthorIDString) Set(value string) postWithPrismaAuthorIDSetParams {\n\n\treturn postWithPrismaAuthorIDSetParams{\n\t\tdata: builder.Field{\n\t\t\tName: \"authorID\",\n\t\t\tValue: value,\n\t\t},\n\t}\n\n}", "func Authors(exec boil.Executor, mods ...qm.QueryMod) authorQuery {\n\tmods = append(mods, qm.From(\"\\\"authors\\\"\"))\n\treturn authorQuery{NewQuery(exec, mods...)}\n}", "func GetAuthor(w http.ResponseWriter, r *http.Request) {\n\tfmt.Println(\"Endpoint Hit: return single author\")\n\tvars := mux.Vars(r)\n\tid, _ := strconv.Atoi(vars[\"id\"])\n\n\tvar author models.Author\n\tresult := DB.First(&author, id)\n\tif result.Error != nil {\n\t\tresponses.RespondWithError(w, http.StatusBadRequest, result.Error)\n\t\treturn\n\t}\n\n\tresponses.RespondWithJSON(w, http.StatusOK, author)\n}", "func (q authorQuery) OneP() *Author {\n\to, err := q.One()\n\tif err != nil {\n\t\tpanic(boil.WrapErr(err))\n\t}\n\n\treturn o\n}", "func (pu *PostUpdate) ClearAuthor() *PostUpdate {\n\tpu.mutation.ClearAuthor()\n\treturn pu\n}", "func (r *ThreadReprGQL) AUTHOR(ctx context.Context) *AuthorReprGQL {\n\treturn &AuthorReprGQL{}\n}", "func (q authorQuery) Count() (int64, error) {\n\tvar count int64\n\n\tqueries.SetSelect(q.Query, nil)\n\tqueries.SetCount(q.Query)\n\n\terr := q.Query.QueryRow().Scan(&count)\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"mdbmdbmodels: failed to count authors rows\")\n\t}\n\n\treturn count, nil\n}", "func (pu *PostUpdate) SetAuthor(u *User) *PostUpdate {\n\treturn pu.SetAuthorID(u.ID)\n}", "func (q authorQuery) One() (*Author, error) {\n\to := &Author{}\n\n\tqueries.SetLimit(q.Query, 1)\n\n\terr := q.Bind(o)\n\tif err != nil {\n\t\tif errors.Cause(err) == sql.ErrNoRows {\n\t\t\treturn nil, sql.ErrNoRows\n\t\t}\n\t\treturn nil, errors.Wrap(err, \"mdbmdbmodels: failed to execute a one query for authors\")\n\t}\n\n\treturn o, nil\n}", "func (r *bookResolver) Author(ctx context.Context, obj *model.Book) (*model.Author, error) {\n\tfor _, a := range r.AuthorsDB{\n\t\tif a.ID == obj.Author.ID{\n\t\t\treturn a, nil\n\t\t}\n\t}\n\treturn nil, errors.New(\"error finding author\")\n}", "func (ec *executionContext) _Author_id(ctx context.Context, field graphql.CollectedField, obj *entc.Author) (ret graphql.Marshaler) {\n\tdefer func() {\n\t\tif r := recover(); r != nil {\n\t\t\tec.Error(ctx, ec.Recover(ctx, r))\n\t\t\tret = graphql.Null\n\t\t}\n\t}()\n\tfc := &graphql.FieldContext{\n\t\tObject: \"Author\",\n\t\tField: field,\n\t\tArgs: nil,\n\t\tIsMethod: true,\n\t}\n\n\tctx = graphql.WithFieldContext(ctx, fc)\n\tresTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {\n\t\tctx = rctx // use context from middleware stack in children\n\t\treturn ec.resolvers.Author().ID(rctx, obj)\n\t})\n\tif err != nil {\n\t\tec.Error(ctx, err)\n\t\treturn graphql.Null\n\t}\n\tif resTmp == nil {\n\t\tif !graphql.HasFieldError(ctx, fc) {\n\t\t\tec.Errorf(ctx, \"must not be null\")\n\t\t}\n\t\treturn graphql.Null\n\t}\n\tres := resTmp.(string)\n\tfc.Result = res\n\treturn ec.marshalNID2string(ctx, field.Selections, res)\n}", "func (ec *executionContext) _Author(ctx context.Context, sel []query.Selection, obj *model.Author) graphql.Marshaler {\n\tfields := graphql.CollectFields(ec.Doc, sel, authorImplementors, ec.Variables)\n\n\tout := graphql.NewOrderedMap(len(fields))\n\tfor i, field := range fields {\n\t\tout.Keys[i] = field.Alias\n\n\t\tswitch field.Name {\n\t\tcase \"__typename\":\n\t\t\tout.Values[i] = graphql.MarshalString(\"Author\")\n\t\tcase \"id\":\n\t\t\tout.Values[i] = ec._Author_id(ctx, field, obj)\n\t\tcase \"displayName\":\n\t\t\tout.Values[i] = ec._Author_displayName(ctx, field, obj)\n\t\tcase \"username\":\n\t\t\tout.Values[i] = ec._Author_username(ctx, field, obj)\n\t\tcase \"profileImagePath\":\n\t\t\tout.Values[i] = ec._Author_profileImagePath(ctx, field, obj)\n\t\tcase \"isAnonymous\":\n\t\t\tout.Values[i] = ec._Author_isAnonymous(ctx, field, obj)\n\t\tdefault:\n\t\t\tpanic(\"unknown field \" + strconv.Quote(field.Name))\n\t\t}\n\t}\n\n\treturn out\n}", "func GetFeedAuthor(db *sql.DB, feedID int64) (name, email string, err error) {\n\tstmt := \"SELECT authors.name, authors.email FROM feeds INNER JOIN authors ON authors.id = feeds.author_id WHERE feeds.id = $1\"\n\trow := db.QueryRow(stmt, feedID)\n\terr = row.Scan(&name, &email)\n\treturn\n}", "func (puo *PostUpdateOne) SetAuthor(u *User) *PostUpdateOne {\n\treturn puo.SetAuthorID(u.ID)\n}", "func (o *InlineResponse200115) SetAuthor(v InlineResponse200115Author) {\n\to.Author = &v\n}", "func FindAuthorP(exec boil.Executor, id int64, selectCols ...string) *Author {\n\tretobj, err := FindAuthor(exec, id, selectCols...)\n\tif err != nil {\n\t\tpanic(boil.WrapErr(err))\n\t}\n\n\treturn retobj\n}", "func (upu *UnsavedPostUpdate) SetAuthor(a *Admin) *UnsavedPostUpdate {\n\treturn upu.SetAuthorID(a.ID)\n}", "func (puo *PostUpdateOne) ClearAuthor() *PostUpdateOne {\n\tpuo.mutation.ClearAuthor()\n\treturn puo\n}", "func (upu *UnsavedPostUpdate) ClearAuthor() *UnsavedPostUpdate {\n\tupu.mutation.ClearAuthor()\n\treturn upu\n}", "func (upuo *UnsavedPostUpdateOne) SetAuthor(a *Admin) *UnsavedPostUpdateOne {\n\treturn upuo.SetAuthorID(a.ID)\n}", "func (p *PageRelatedArticle) SetAuthor(value string) {\n\tp.Flags.Set(3)\n\tp.Author = value\n}", "func (m *PostMutation) AuthorID() (r int, exists bool) {\n\tv := m.author\n\tif v == nil {\n\t\treturn\n\t}\n\treturn *v, true\n}", "func (o *InlineResponse20049Post) GetAuthorId() string {\n\tif o == nil || o.AuthorId == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\treturn *o.AuthorId\n}", "func (m *PostMutation) SetAuthorID(i int) {\n\tm.author = &i\n}", "func AuthorContains(v string) predicate.Book {\n\treturn predicate.Book(func(s *sql.Selector) {\n\t\ts.Where(sql.Contains(s.C(FieldAuthor), v))\n\t})\n}", "func (bb *BooktestBook) BooktestAuthor(ctx context.Context, db DB) (*BooktestAuthor, error) {\n\treturn BooktestAuthorByAuthorID(ctx, db, bb.AuthorID)\n}", "func (c *PostAttachmentClient) QueryPost(pa *PostAttachment) *PostQuery {\n\tquery := &PostQuery{config: c.config}\n\tquery.path = func(ctx context.Context) (fromV *sql.Selector, _ error) {\n\t\tid := pa.ID\n\t\tstep := sqlgraph.NewStep(\n\t\t\tsqlgraph.From(postattachment.Table, postattachment.FieldID, id),\n\t\t\tsqlgraph.To(post.Table, post.FieldID),\n\t\t\tsqlgraph.Edge(sqlgraph.M2O, true, postattachment.PostTable, postattachment.PostColumn),\n\t\t)\n\t\tfromV = sqlgraph.Neighbors(pa.driver.Dialect(), step)\n\t\treturn fromV, nil\n\t}\n\treturn query\n}", "func (m *PostMutation) AuthorCleared() bool {\n\treturn m.AuthorIDCleared() || m.clearedauthor\n}", "func (r *RPC) IsAuthor(c context.Context, arg *model.ArgMid, res *bool) (err error) {\n\t*res, _, err = r.s.IsAuthor(c, arg.Mid)\n\treturn\n}", "func AuthorGTE(v string) predicate.Book {\n\treturn predicate.Book(func(s *sql.Selector) {\n\t\ts.Where(sql.GTE(s.C(FieldAuthor), v))\n\t})\n}", "func (m *PostMutation) ClearAuthorID() {\n\tm.author = nil\n\tm.clearedFields[post.FieldAuthorID] = struct{}{}\n}", "func (o *InlineResponse20049Post) SetAuthorId(v string) {\n\to.AuthorId = &v\n}", "func (r *Readme) SetAuthor(a string) *Readme {\n\tr.author = a\n\treturn r\n}", "func (cc *CommentCreate) SetAuthor(u *User) *CommentCreate {\n\treturn cc.SetAuthorID(u.ID)\n}", "func (c *Client) Author(id string) (Author, []Manga, error) {\n\tauthors, err := c.authorsByIDs([]string{id})\n\tif err != nil {\n\t\treturn Author{}, nil, errors.Wrap(err, \"could not get authors meta data\")\n\t}\n\tif len(authors) == 0 {\n\t\treturn Author{}, nil, errors.Errorf(\"author with id %s not found\", id)\n\t}\n\n\tres, err := c.get(c.base+\"/mrs_serie_related_author\", url.Values{\"oid\": []string{id}})\n\tif err != nil {\n\t\treturn Author{}, nil, errors.Wrap(err, \"could not get authors mangas\")\n\t}\n\tvar mangaIDStructs []struct {\n\t\tID string `json:\"oid\"`\n\t}\n\tif err := json.Unmarshal(res, &mangaIDStructs); err != nil {\n\t\treturn Author{}, nil, errors.Wrap(err, \"could not unmarshal authors meta data\")\n\t}\n\tvar mangaIDs []string\n\tfor _, manga := range mangaIDStructs {\n\t\tmangaIDs = append(mangaIDs, manga.ID)\n\t}\n\tmangas, err := c.mangasByIDs(mangaIDs)\n\tif err != nil {\n\t\treturn Author{}, nil, errors.Wrap(err, \"could not get authors mangas\")\n\t}\n\tfor i := range mangas {\n\t\tmangas[i].Author = authors[0]\n\t}\n\treturn authors[0], mangas, nil\n}", "func (upuo *UnsavedPostUpdateOne) ClearAuthor() *UnsavedPostUpdateOne {\n\tupuo.mutation.ClearAuthor()\n\treturn upuo\n}", "func (m *PostMutation) ResetAuthor() {\n\tm.author = nil\n\tm.clearedauthor = false\n}", "func (c *PostThumbnailClient) QueryPost(pt *PostThumbnail) *PostQuery {\n\tquery := &PostQuery{config: c.config}\n\tquery.path = func(ctx context.Context) (fromV *sql.Selector, _ error) {\n\t\tid := pt.ID\n\t\tstep := sqlgraph.NewStep(\n\t\t\tsqlgraph.From(postthumbnail.Table, postthumbnail.FieldID, id),\n\t\t\tsqlgraph.To(post.Table, post.FieldID),\n\t\t\tsqlgraph.Edge(sqlgraph.O2O, true, postthumbnail.PostTable, postthumbnail.PostColumn),\n\t\t)\n\t\tfromV = sqlgraph.Neighbors(pt.driver.Dialect(), step)\n\t\treturn fromV, nil\n\t}\n\treturn query\n}", "func (o Comment) Author() string {\n\treturn o.model.Author // string\n}", "func (o *Source) Authors(exec boil.Executor, mods ...qm.QueryMod) authorQuery {\n\tvar queryMods []qm.QueryMod\n\tif len(mods) != 0 {\n\t\tqueryMods = append(queryMods, mods...)\n\t}\n\n\tqueryMods = append(queryMods,\n\t\tqm.InnerJoin(\"\\\"authors_sources\\\" on \\\"authors\\\".\\\"id\\\" = \\\"authors_sources\\\".\\\"author_id\\\"\"),\n\t\tqm.Where(\"\\\"authors_sources\\\".\\\"source_id\\\"=?\", o.ID),\n\t)\n\n\tquery := Authors(exec, queryMods...)\n\tqueries.SetFrom(query.Query, \"\\\"authors\\\"\")\n\n\tif len(queries.GetSelect(query.Query)) == 0 {\n\t\tqueries.SetSelect(query.Query, []string{\"\\\"authors\\\".*\"})\n\t}\n\n\treturn query\n}", "func UpdateFeedAuthor(db *sql.DB, feedID, authorID int64) error {\n\t_, err := db.Exec(\"UPDATE feeds SET author_id = $1 WHERE id = $2\", authorID, feedID)\n\treturn err\n}", "func FindAuthorG(id int64, selectCols ...string) (*Author, error) {\n\treturn FindAuthor(boil.GetDB(), id, selectCols...)\n}", "func (r *Resolver) Author() generated.AuthorResolver { return &authorResolver{r} }", "func (r *Resolver) Author() AuthorResolver { return &authorResolver{r} }", "func (c *CommitResult) GetAuthor() *User {\n\tif c == nil {\n\t\treturn nil\n\t}\n\treturn c.Author\n}", "func (mr *MockPostsRepoInterfaceMockRecorder) GetByAuthor(arg0 interface{}) *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"GetByAuthor\", reflect.TypeOf((*MockPostsRepoInterface)(nil).GetByAuthor), arg0)\n}", "func (p *PageRelatedArticle) GetAuthor() (value string, ok bool) {\n\tif !p.Flags.Has(3) {\n\t\treturn value, false\n\t}\n\treturn p.Author, true\n}", "func (puo *PostUpdateOne) SetAuthorID(id int) *PostUpdateOne {\n\tpuo.mutation.SetAuthorID(id)\n\treturn puo\n}", "func FindAuthor(exec boil.Executor, id int64, selectCols ...string) (*Author, error) {\n\tauthorObj := &Author{}\n\n\tsel := \"*\"\n\tif len(selectCols) > 0 {\n\t\tsel = strings.Join(strmangle.IdentQuoteSlice(dialect.LQ, dialect.RQ, selectCols), \",\")\n\t}\n\tquery := fmt.Sprintf(\n\t\t\"select %s from \\\"authors\\\" where \\\"id\\\"=$1\", sel,\n\t)\n\n\tq := queries.Raw(exec, query, id)\n\n\terr := q.Bind(authorObj)\n\tif err != nil {\n\t\tif errors.Cause(err) == sql.ErrNoRows {\n\t\t\treturn nil, sql.ErrNoRows\n\t\t}\n\t\treturn nil, errors.Wrap(err, \"mdbmdbmodels: unable to select from authors\")\n\t}\n\n\treturn authorObj, nil\n}", "func (pu *PostUpdate) SetAuthorID(id int) *PostUpdate {\n\tpu.mutation.SetAuthorID(id)\n\treturn pu\n}", "func (upuo *UnsavedPostUpdateOne) SetAuthorID(id int) *UnsavedPostUpdateOne {\n\tupuo.mutation.SetAuthorID(id)\n\treturn upuo\n}", "func runAuthor() {\n\tif !authorisedStatus() {\n\t\treturn\n\t}\n\n\twf.Var(\"last_action\", \"author\")\n\twf.Var(\"last_query\", opts.Query)\n\n\tvar (\n\t\tbooks []gr.Book\n\t\tkey = \"authors/\" + cachefileID(opts.AuthorID)\n\t\trerun = wf.IsRunning(booksJob)\n\t)\n\n\tif wf.Cache.Expired(key, opts.MaxCache.Search) {\n\t\trerun = true\n\t\tif err := runJob(booksJob, \"-savebooks\"); err != nil {\n\t\t\twf.FatalError(err)\n\t\t}\n\t}\n\n\tif wf.Cache.Exists(key) {\n\t\tcheckErr(wf.Cache.LoadJSON(key, &books))\n\t\tlog.Printf(\"loaded %d book(s) from cache\", len(books))\n\t} else {\n\t\twf.NewItem(\"Loading Books…\").\n\t\t\tSubtitle(\"Results will appear momentarily\").\n\t\t\tIcon(spinnerIcon())\n\t}\n\n\t// Search for books\n\tlog.Printf(\"authorName=%q, authorID=%d, sinceLastRequest=%v\", opts.AuthorName, opts.AuthorID, time.Since(opts.LastRequestParsed))\n\n\tvar (\n\t\ticons = newIconCache(iconCacheDir)\n\t\tmods = LoadModifiers()\n\t)\n\n\tfor _, b := range books {\n\t\tbookItem(b, icons, mods)\n\t}\n\n\taddNavActions()\n\n\tif !opts.QueryEmpty() {\n\t\twf.Filter(opts.Query)\n\t}\n\n\twf.WarnEmpty(\"No Matching Books\", \"Try a different query?\")\n\n\tif icons.HasQueue() {\n\t\tvar err error\n\t\tif err = icons.Close(); err == nil {\n\t\t\terr = runJob(iconsJob, \"-icons\")\n\t\t}\n\t\tlogIfError(err, \"cache icons: %v\")\n\t}\n\n\tif rerun || wf.IsRunning(iconsJob) {\n\t\twf.Rerun(rerunInterval)\n\t}\n\n\twf.SendFeedback()\n}", "func FeedHasAuthor(db *sql.DB, feedID int64) (result bool) {\n\tvar count int64\n\trow := db.QueryRow(\"SELECT COUNT(author_id) FROM feeds WHERE id = $1\", feedID)\n\terr := row.Scan(&count)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\tif count > 0 {\n\t\tresult = true\n\t}\n\treturn\n}", "func (me *XHasElem_Author) Walk() (err error) {\n\tif fn := WalkHandlers.XHasElem_Author; me != nil {\n\t\tif fn != nil {\n\t\t\tif err = fn(me, true); xsdt.OnWalkError(&err, &WalkErrors, WalkContinueOnError, WalkOnError) {\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t\tif err = me.Author.Walk(); xsdt.OnWalkError(&err, &WalkErrors, WalkContinueOnError, WalkOnError) {\n\t\t\treturn\n\t\t}\n\t\tif fn != nil {\n\t\t\tif err = fn(me, false); xsdt.OnWalkError(&err, &WalkErrors, WalkContinueOnError, WalkOnError) {\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t}\n\treturn\n}", "func GetAuthor(id string) (*models.Author, error) {\n\tfor _, author := range Authors {\n\t\tif author.ID == id {\n\t\t\treturn author, nil\n\t\t}\n\t}\n\treturn nil, fmt.Errorf(\"Author (id: %v) was not found\", id)\n}", "func (o *Source) Authors(mods ...qm.QueryMod) authorQuery {\n\tvar queryMods []qm.QueryMod\n\tif len(mods) != 0 {\n\t\tqueryMods = append(queryMods, mods...)\n\t}\n\n\tqueryMods = append(queryMods,\n\t\tqm.InnerJoin(\"\\\"authors_sources\\\" on \\\"authors\\\".\\\"id\\\" = \\\"authors_sources\\\".\\\"author_id\\\"\"),\n\t\tqm.Where(\"\\\"authors_sources\\\".\\\"source_id\\\"=?\", o.ID),\n\t)\n\n\tquery := Authors(queryMods...)\n\tqueries.SetFrom(query.Query, \"\\\"authors\\\"\")\n\n\tif len(queries.GetSelect(query.Query)) == 0 {\n\t\tqueries.SetSelect(query.Query, []string{\"\\\"authors\\\".*\"})\n\t}\n\n\treturn query\n}", "func (c *PostVideoClient) QueryPost(pv *PostVideo) *PostQuery {\n\tquery := &PostQuery{config: c.config}\n\tquery.path = func(ctx context.Context) (fromV *sql.Selector, _ error) {\n\t\tid := pv.ID\n\t\tstep := sqlgraph.NewStep(\n\t\t\tsqlgraph.From(postvideo.Table, postvideo.FieldID, id),\n\t\t\tsqlgraph.To(post.Table, post.FieldID),\n\t\t\tsqlgraph.Edge(sqlgraph.M2O, true, postvideo.PostTable, postvideo.PostColumn),\n\t\t)\n\t\tfromV = sqlgraph.Neighbors(pv.driver.Dialect(), step)\n\t\treturn fromV, nil\n\t}\n\treturn query\n}", "func (upu *UnsavedPostUpdate) SetAuthorID(id int) *UnsavedPostUpdate {\n\tupu.mutation.SetAuthorID(id)\n\treturn upu\n}", "func GetAllAuthor(author *entities.Author) []entities.Author {\n\tvar authorList []entities.Author\n\n\tdatabase := connection.MySqlConnect()\n\n\trows, _ := database.Query(\"SELECT id, name, email, pass FROM Author\")\n\tfor rows.Next() {\n\t\tauthor := *author\n\n\t\trows.Scan(&author.ID, &author.Name, &author.Email, &author.Pass)\n\t\tauthorList = append(authorList, author)\n\t}\n\n\treturn authorList\n}", "func Author(author string) func(f *Feed) error {\n\treturn func(f *Feed) error {\n\t\tf.Channel.Author = author\n\t\treturn nil\n\t}\n}", "func (q authorQuery) Exists() (bool, error) {\n\tvar count int64\n\n\tqueries.SetCount(q.Query)\n\tqueries.SetLimit(q.Query, 1)\n\n\terr := q.Query.QueryRow().Scan(&count)\n\tif err != nil {\n\t\treturn false, errors.Wrap(err, \"mdbmdbmodels: failed to check if authors exists\")\n\t}\n\n\treturn count > 0, nil\n}", "func (m *PostMutation) AuthorIDCleared() bool {\n\t_, ok := m.clearedFields[post.FieldAuthorID]\n\treturn ok\n}", "func (r *Readme) Author() string {\n\treturn r.author\n}", "func (o *InlineResponse200115) GetAuthor() InlineResponse200115Author {\n\tif o == nil || o.Author == nil {\n\t\tvar ret InlineResponse200115Author\n\t\treturn ret\n\t}\n\treturn *o.Author\n}", "func (q authorQuery) All() (AuthorSlice, error) {\n\tvar o []*Author\n\n\terr := q.Bind(&o)\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"mdbmdbmodels: failed to assign all query results to Author slice\")\n\t}\n\n\treturn o, nil\n}", "func (e PostEdges) AuthorOrErr() (*User, error) {\n\tif e.loadedTypes[0] {\n\t\tif e.Author == nil {\n\t\t\t// Edge was loaded but was not found.\n\t\t\treturn nil, &NotFoundError{label: user.Label}\n\t\t}\n\t\treturn e.Author, nil\n\t}\n\treturn nil, &NotLoadedError{edge: \"author\"}\n}", "func (t *TeamDiscussion) GetAuthor() *User {\n\tif t == nil {\n\t\treturn nil\n\t}\n\treturn t.Author\n}", "func AuthorLTE(v string) predicate.Book {\n\treturn predicate.Book(func(s *sql.Selector) {\n\t\ts.Where(sql.LTE(s.C(FieldAuthor), v))\n\t})\n}", "func (m *PostMutation) ResetAuthorID() {\n\tm.author = nil\n\tdelete(m.clearedFields, post.FieldAuthorID)\n}", "func marshalDiscussionPostAuthorToPostAuthorResponseBody(v *discussion.PostAuthor) *PostAuthorResponseBody {\n\tres := &PostAuthorResponseBody{\n\t\tID: v.ID,\n\t\tName: v.Name,\n\t}\n\tif v.Photo != nil {\n\t\tres.Photo = marshalDiscussionAuthorPhotoToAuthorPhotoResponseBody(v.Photo)\n\t}\n\n\treturn res\n}", "func (c *PostImageClient) QueryPost(pi *PostImage) *PostQuery {\n\tquery := &PostQuery{config: c.config}\n\tquery.path = func(ctx context.Context) (fromV *sql.Selector, _ error) {\n\t\tid := pi.ID\n\t\tstep := sqlgraph.NewStep(\n\t\t\tsqlgraph.From(postimage.Table, postimage.FieldID, id),\n\t\t\tsqlgraph.To(post.Table, post.FieldID),\n\t\t\tsqlgraph.Edge(sqlgraph.M2O, true, postimage.PostTable, postimage.PostColumn),\n\t\t)\n\t\tfromV = sqlgraph.Neighbors(pi.driver.Dialect(), step)\n\t\treturn fromV, nil\n\t}\n\treturn query\n}", "func (c *CategoryClient) QueryPosts(ca *Category) *PostQuery {\n\tquery := &PostQuery{config: c.config}\n\tquery.path = func(ctx context.Context) (fromV *sql.Selector, _ error) {\n\t\tid := ca.ID\n\t\tstep := sqlgraph.NewStep(\n\t\t\tsqlgraph.From(category.Table, category.FieldID, id),\n\t\t\tsqlgraph.To(post.Table, post.FieldID),\n\t\t\tsqlgraph.Edge(sqlgraph.O2M, false, category.PostsTable, category.PostsColumn),\n\t\t)\n\t\tfromV = sqlgraph.Neighbors(ca.driver.Dialect(), step)\n\t\treturn fromV, nil\n\t}\n\treturn query\n}", "func (r *RepositoryRelease) GetAuthor() *User {\n\tif r == nil {\n\t\treturn nil\n\t}\n\treturn r.Author\n}", "func FindAuthorGP(id int64, selectCols ...string) *Author {\n\tretobj, err := FindAuthor(boil.GetDB(), id, selectCols...)\n\tif err != nil {\n\t\tpanic(boil.WrapErr(err))\n\t}\n\n\treturn retobj\n}", "func (c *AdminClient) QueryPosts(a *Admin) *PostQuery {\n\tquery := &PostQuery{config: c.config}\n\tquery.path = func(ctx context.Context) (fromV *sql.Selector, _ error) {\n\t\tid := a.ID\n\t\tstep := sqlgraph.NewStep(\n\t\t\tsqlgraph.From(admin.Table, admin.FieldID, id),\n\t\t\tsqlgraph.To(post.Table, post.FieldID),\n\t\t\tsqlgraph.Edge(sqlgraph.O2M, false, admin.PostsTable, admin.PostsColumn),\n\t\t)\n\t\tfromV = sqlgraph.Neighbors(a.driver.Dialect(), step)\n\t\treturn fromV, nil\n\t}\n\treturn query\n}", "func (i *Invoice) Author() identity.DID {\n\treturn i.CoreDocument.Author()\n}", "func (kpc_obj *KPC) AddAuthor(aut Author) {\n\tkpc_obj.Authors = append(kpc_obj.Authors, aut)\n}", "func (o *InlineResponse200115) HasAuthor() bool {\n\tif o != nil && o.Author != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func GetAuthorByAuthorNameBatchFn(ctx context.Context, keys dataloader.Keys) []*dataloader.Result {\n\thandleError := handleErrorFunc\n\n\tvar authorName []string\n\tfor _, key := range keys {\n\t\tauthorName = append(authorName, key.String())\n\t}\n\n\t// Construct query\n\tquery := fmt.Sprintf(\"for author in Author filter author.name in %s return author\", prepareKeyListQueryFilterString(authorName))\n\n\t// Execute query\n\tbindVars := map[string]interface{}{}\n\tcoursor, err := database.Db.Query(context.Background(), query, bindVars)\n\tif err != nil {\n\t\thandleError(err)\n\t}\n\tdefer coursor.Close()\n\n\tvar results []*dataloader.Result\n\n\t// Extract Authors from the query result -\n\t// Populate result slice\n\tfor coursor.HasMore() {\n\t\tvar author Author\n\t\tmeta, _ := coursor.ReadDocument(ctx, &author)\n\t\tauthor.ID = meta.Key\n\n\t\tresult := dataloader.Result{\n\t\t\tData: author,\n\t\t\tError: nil,\n\t\t}\n\t\tresults = append(results, &result)\n\t}\n\n\tlogrus.Infof(\"[GetAuthorByAuthorNameBatchFn] batch size %d\\n\", len(results))\n\treturn results\n}", "func RetrieveCMDAuthor(parent string) (string, error) {\n\tdata := cmdAuthorSelection.exp().FindStringSubmatch(parent)\n\tif len(data) > 1 && data[1] != \"\" {\n\t\treturn data[1], nil\n\t}\n\treturn \"\", fmt.Errorf(\"missing Author from the parsed string\")\n}", "func (module *Crawler) Author() string {\n\treturn Author\n}", "func DeleteAuthor(author entities.Author) int64 {\n\tdatabase := connection.MySqlConnect()\n\n\tstatement, _ := database.Prepare(\"DELETE FROM Author WHERE id = ?\")\n\tresult, _ := statement.Exec(author.ID)\n\trowsAffected, _ := result.RowsAffected()\n\n\treturn rowsAffected\n}", "func AuthorNEQ(v string) predicate.Book {\n\treturn predicate.Book(func(s *sql.Selector) {\n\t\ts.Where(sql.NEQ(s.C(FieldAuthor), v))\n\t})\n}", "func msgForAuthor(ctx context.Context, report slack.MessageAction) messaging.Envelope {\n\t_, span := trace.StartSpan(ctx, \"msgFlagger/msgForAuthor\")\n\tdefer span.End()\n\n\tvar txt string\n\ttxt, err := render(\"templates/author.txt\", nil)\n\tif err != nil {\n\t\ttxt = \"One of your recent messages has been flagged as it may not comply with the Code of Conduct. One of our admins will investigate the context, but consider an empathetic review of your recent messages in the meantime.\"\n\t}\n\n\te := messaging.Envelope{\n\t\tDestination: messaging.Address{\n\t\t\tTeamID: report.Team.ID,\n\t\t\tChannelID: report.Channel.ID,\n\t\t\tUserID: report.Message.UserID,\n\t\t},\n\t\tMessage: messaging.Message{Text: txt},\n\t\tEphemeral: true,\n\t}\n\treturn e\n}", "func getAuthorIdByName(name string) (id int64, err error) {\r\n\tvar acct Account\r\n\tdb := getAccountDB()\r\n\terr = db.Where(\"name=?\", name).First(&acct).Error\r\n\tid = acct.Id\r\n\treturn\r\n}", "func IsAuthor(issueUser, commentUser string) bool {\n\treturn NormLogin(issueUser) == NormLogin(commentUser)\n}", "func AuthorExists(exec boil.Executor, id int64) (bool, error) {\n\tvar exists bool\n\tsql := \"select exists(select 1 from \\\"authors\\\" where \\\"id\\\"=$1 limit 1)\"\n\n\tif boil.DebugMode {\n\t\tfmt.Fprintln(boil.DebugWriter, sql)\n\t\tfmt.Fprintln(boil.DebugWriter, id)\n\t}\n\n\trow := exec.QueryRow(sql, id)\n\n\terr := row.Scan(&exists)\n\tif err != nil {\n\t\treturn false, errors.Wrap(err, \"mdbmdbmodels: unable to check if authors exists\")\n\t}\n\n\treturn exists, nil\n}", "func (o *InlineResponse20049Post) HasAuthorId() bool {\n\tif o != nil && o.AuthorId != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func AuthorIn(vs ...string) predicate.Book {\n\tv := make([]interface{}, len(vs))\n\tfor i := range v {\n\t\tv[i] = vs[i]\n\t}\n\treturn predicate.Book(func(s *sql.Selector) {\n\t\t// if not arguments were provided, append the FALSE constants,\n\t\t// since we can't apply \"IN ()\". This will make this predicate falsy.\n\t\tif len(v) == 0 {\n\t\t\ts.Where(sql.False())\n\t\t\treturn\n\t\t}\n\t\ts.Where(sql.In(s.C(FieldAuthor), v...))\n\t})\n}" ]
[ "0.8083459", "0.80203635", "0.77416974", "0.6260941", "0.6228352", "0.6227975", "0.58389455", "0.58313006", "0.5816068", "0.5740223", "0.5705673", "0.56945276", "0.5686728", "0.5679273", "0.5678319", "0.56471336", "0.56218153", "0.5618939", "0.5606739", "0.5564729", "0.5510354", "0.5470887", "0.5463097", "0.5462278", "0.5456102", "0.5433695", "0.54154426", "0.5410071", "0.5408534", "0.5367594", "0.53658926", "0.53613615", "0.5352564", "0.53363127", "0.5320722", "0.53149104", "0.53137314", "0.52989614", "0.5293957", "0.52737397", "0.5254617", "0.52537143", "0.5240768", "0.52244925", "0.5223636", "0.5219315", "0.52149385", "0.521451", "0.52054894", "0.5202594", "0.5192474", "0.51604956", "0.5144357", "0.51419395", "0.51351315", "0.51177114", "0.5109064", "0.5095887", "0.5094505", "0.5093411", "0.5089753", "0.50818276", "0.50654984", "0.5036585", "0.5021264", "0.50087273", "0.49895668", "0.49750692", "0.4963797", "0.4948778", "0.4923456", "0.49002483", "0.48988095", "0.48952678", "0.48867106", "0.48788324", "0.48471513", "0.48465678", "0.48389176", "0.48333487", "0.48286235", "0.48227665", "0.48135236", "0.48128888", "0.4800496", "0.47979265", "0.4797383", "0.47817478", "0.47690287", "0.47488254", "0.47445148", "0.47421607", "0.47311822", "0.47282752", "0.4722153", "0.47214267", "0.4711672", "0.47116652", "0.47059837", "0.47023" ]
0.8017825
2
QueryCategory queries the category edge of a Post.
func (c *PostClient) QueryCategory(po *Post) *CategoryQuery { query := &CategoryQuery{config: c.config} query.path = func(ctx context.Context) (fromV *sql.Selector, _ error) { id := po.ID step := sqlgraph.NewStep( sqlgraph.From(post.Table, post.FieldID, id), sqlgraph.To(category.Table, category.FieldID), sqlgraph.Edge(sqlgraph.M2O, true, post.CategoryTable, post.CategoryColumn), ) fromV = sqlgraph.Neighbors(po.driver.Dialect(), step) return fromV, nil } return query }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (c *UnsavedPostClient) QueryCategory(up *UnsavedPost) *CategoryQuery {\n\tquery := &CategoryQuery{config: c.config}\n\tquery.path = func(ctx context.Context) (fromV *sql.Selector, _ error) {\n\t\tid := up.ID\n\t\tstep := sqlgraph.NewStep(\n\t\t\tsqlgraph.From(unsavedpost.Table, unsavedpost.FieldID, id),\n\t\t\tsqlgraph.To(category.Table, category.FieldID),\n\t\t\tsqlgraph.Edge(sqlgraph.M2O, true, unsavedpost.CategoryTable, unsavedpost.CategoryColumn),\n\t\t)\n\t\tfromV = sqlgraph.Neighbors(up.driver.Dialect(), step)\n\t\treturn fromV, nil\n\t}\n\treturn query\n}", "func (upq *UnsavedPostQuery) QueryCategory() *CategoryQuery {\n\tquery := &CategoryQuery{config: upq.config}\n\tquery.path = func(ctx context.Context) (fromU *sql.Selector, err error) {\n\t\tif err := upq.prepareQuery(ctx); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tselector := upq.sqlQuery(ctx)\n\t\tif err := selector.Err(); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tstep := sqlgraph.NewStep(\n\t\t\tsqlgraph.From(unsavedpost.Table, unsavedpost.FieldID, selector),\n\t\t\tsqlgraph.To(category.Table, category.FieldID),\n\t\t\tsqlgraph.Edge(sqlgraph.M2O, true, unsavedpost.CategoryTable, unsavedpost.CategoryColumn),\n\t\t)\n\t\tfromU = sqlgraph.SetNeighbors(upq.driver.Dialect(), step)\n\t\treturn fromU, nil\n\t}\n\treturn query\n}", "func (t *Tool) QueryCategory() *CategoryQuery {\n\treturn (&ToolClient{config: t.config}).QueryCategory(t)\n}", "func (c *CategoryClient) QueryPosts(ca *Category) *PostQuery {\n\tquery := &PostQuery{config: c.config}\n\tquery.path = func(ctx context.Context) (fromV *sql.Selector, _ error) {\n\t\tid := ca.ID\n\t\tstep := sqlgraph.NewStep(\n\t\t\tsqlgraph.From(category.Table, category.FieldID, id),\n\t\t\tsqlgraph.To(post.Table, post.FieldID),\n\t\t\tsqlgraph.Edge(sqlgraph.O2M, false, category.PostsTable, category.PostsColumn),\n\t\t)\n\t\tfromV = sqlgraph.Neighbors(ca.driver.Dialect(), step)\n\t\treturn fromV, nil\n\t}\n\treturn query\n}", "func (t *tagStorage) QueryCategories() ([]model.CategoryInfo, error) {\n\tvar cs []model.CategoryInfo\n\n\terr := t.db.Table(model.CateTableName()).Where(\"del_flag = ?\", 0).Find(&cs)\n\treturn cs, err\n}", "func (c *Category) QueryPosts() *PostQuery {\n\treturn (&CategoryClient{config: c.config}).QueryPosts(c)\n}", "func (s *CategoryService) Query(rs app.RequestScope, offset, limit int) ([]models.Category, error) {\n\treturn s.dao.Query(rs, offset, limit)\n}", "func CategoryGet(c *gin.Context) {\n\tCategory, err := models.GetCategory(c.Param(\"name\"))\n\tif err != nil {\n\t\tc.HTML(http.StatusNotFound, \"errors/404\", nil)\n\t\treturn\n\t}\n\tvar filter models.DaoFilter\n\tfilter.Category.Name = Category.Name\n\tcount,_ := filter.GetPostsCount()\n\tcurrentPage, _ := strconv.Atoi(c.DefaultQuery(\"p\",\"1\"))\n\tlimit := 10\n\tPagination := helpers.NewPaginator(c,limit,count)\n\tlist, err := filter.GetPostsByPage(currentPage,limit)\n\tif err != nil {\n\t\tc.HTML(http.StatusNotFound, \"errors/404\", nil)\n\t\treturn\n\t}\n\n\th := helpers.DefaultH(c)\n\th[\"Title\"] = Category.Name\n\th[\"Category\"] = Category\n\th[\"Active\"] = \"categories\"\n\th[\"List\"] = list\n\th[\"Pagination\"] = Pagination\n\tc.HTML(http.StatusOK, \"categories/show\", h)\n}", "func (upq *UnsavedPostQuery) WithCategory(opts ...func(*CategoryQuery)) *UnsavedPostQuery {\n\tquery := &CategoryQuery{config: upq.config}\n\tfor _, opt := range opts {\n\t\topt(query)\n\t}\n\tupq.withCategory = query\n\treturn upq\n}", "func GetAllCategory(c * gin.Context){\n\tdb := database.DBConn()\n\trows, err := db.Query(\"SELECT * FROM category\")\n\tif err != nil{\n\t\tc.JSON(500, gin.H{\n\t\t\t\"messages\" : \"Story not found\",\n\t\t});\n\t}\n\tpost := DTO.CategoryDTO{}\n\tlist := [] DTO.CategoryDTO{}\n\tfor rows.Next(){\n\t\tvar id, types int\n\t\tvar name string\n\t\terr = rows.Scan(&id, &name, &types)\n\t\tif err != nil {\n\t\t\tpanic(err.Error())\n\t\t}\n\t\tpost.Id = id\n\t\tpost.Name = name\n\t\tpost.Type = types\n\t\tlist = append(list,post);\n\t}\n\tc.JSON(200, list)\n\tdefer db.Close()\n}", "func (c *CategoryClient) Query() *CategoryQuery {\n\treturn &CategoryQuery{\n\t\tconfig: c.config,\n\t}\n}", "func (c *Client) Category(ctx context.Context, category TorrentCategory, opts *CategoryOptions) ([]*Torrent, error) {\n\tif opts == nil {\n\t\topts = &CategoryOptions{\n\t\t\tPage: 0,\n\t\t}\n\t}\n\tquery := fmt.Sprintf(\"category:%d:%d\", category, opts.Page)\n\tv := url.Values{}\n\tv.Add(\"q\", query)\n\tpath := \"/q.php?\" + v.Encode()\n\treturn c.fetchTorrents(ctx, path)\n}", "func Cat(ctx *sweetygo.Context) error {\n\tif cat := ctx.Param(\"cat\"); cat != \"\" {\n\t\tposts, err := model.GetPostsByCat(cat, \"1\")\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tb := []byte(cat)\n\t\tb[0] -= 32 // uppercase\n\t\tcat = string(b)\n\t\tctx.Set(\"cat\", true)\n\t\tctx.Set(\"posts\", posts)\n\t\tctx.Set(\"title\", cat)\n\t\treturn ctx.Render(200, \"posts/cat\")\n\t}\n\treturn nil\n}", "func (upu *UnsavedPostUpdate) ClearCategory() *UnsavedPostUpdate {\n\tupu.mutation.ClearCategory()\n\treturn upu\n}", "func (c *PostThumbnailClient) QueryPost(pt *PostThumbnail) *PostQuery {\n\tquery := &PostQuery{config: c.config}\n\tquery.path = func(ctx context.Context) (fromV *sql.Selector, _ error) {\n\t\tid := pt.ID\n\t\tstep := sqlgraph.NewStep(\n\t\t\tsqlgraph.From(postthumbnail.Table, postthumbnail.FieldID, id),\n\t\t\tsqlgraph.To(post.Table, post.FieldID),\n\t\t\tsqlgraph.Edge(sqlgraph.O2O, true, postthumbnail.PostTable, postthumbnail.PostColumn),\n\t\t)\n\t\tfromV = sqlgraph.Neighbors(pt.driver.Dialect(), step)\n\t\treturn fromV, nil\n\t}\n\treturn query\n}", "func (Cadmium) GetCategory() string {\n\tvar c categoryType = transitionMetal\n\treturn c.get()\n}", "func (c CategoryPostController) Index(ctx *fasthttp.RequestCtx) {\n\tpaginate, _, _ := c.Paginate(ctx, \"id\", \"inserted_at\", \"updated_at\")\n\n\tvar posts []model.PostDEP\n\tvar postSlug model.PostSlug\n\tvar postDetail model.PostDetail\n\tvar postCategoryAssignment model.PostCategoryAssignment\n\tvar category model.Category\n\tvar user model.User\n\tc.GetDB().QueryWithModel(fmt.Sprintf(`\n\t\tSELECT \n\t\t\tp.id as id, p.author_id as author_id, u.username as author_username, \n\t\t\tp.inserted_at as inserted_at, ps.slug as slug, pd.title as title, \n\t\t\tpd.description as description, pd.content as content\n\t\tFROM %s AS p\n\t\tLEFT OUTER JOIN %s AS ps ON p.id = ps.post_id\n\t\tLEFT OUTER JOIN %s AS ps2 ON ps.post_id = ps2.post_id AND ps.id < ps2.id\n\t\tINNER JOIN %s AS pd ON p.id = pd.post_id\n\t\tLEFT OUTER JOIN %s AS pd2 ON pd.post_id = pd2.post_id AND pd.id < pd2.id\n\t\tINNER JOIN %s AS u ON p.author_id = u.id\n\t\tINNER JOIN %s AS pca ON p.id = pca.post_id\n\t\tINNER JOIN %s AS c ON pca.category_id = c.id\n\t\tWHERE ps2.id IS NULL AND pd2.id IS NULL AND (c.id::text = $1::text OR c.slug = $1)\n\t\tORDER BY %s %s\n\t\tLIMIT $2 OFFSET $3\n\t`, c.Model.TableName(), postSlug.TableName(), postSlug.TableName(), postDetail.TableName(),\n\t\tpostDetail.TableName(), user.TableName(), postCategoryAssignment.TableName(), category.TableName(),\n\t\tpaginate.OrderField,\n\t\tpaginate.OrderBy),\n\t\t&posts,\n\t\tphi.URLParam(ctx, \"categoryID\"),\n\t\tpaginate.Limit,\n\t\tpaginate.Offset)\n\n\tvar count int64\n\tcount, _ = c.App.Cache.Get(cmn.GetRedisKey(\"post\", \"count\")).Int64()\n\tif count == 0 {\n\t\tc.GetDB().DB.Get(&count, fmt.Sprintf(`\n\t\t\tSELECT count(p.id) FROM %s AS p\n\t\t\tINNER JOIN %s AS pd ON p.id = pd.post_id\n\t\t\tLEFT OUTER JOIN %s AS pd2 ON pd.post_id = pd2.post_id AND pd.id < pd2.id\n\t\t\tWHERE pd2.id IS NULL\n\t\t`, c.Model.TableName(), postDetail.TableName(), postDetail.TableName()))\n\t}\n\n\tc.JSONResponse(ctx, model2.ResponseSuccess{\n\t\tData: posts,\n\t\tTotalCount: count,\n\t}, fasthttp.StatusOK)\n}", "func (c CategoryPostController) Show(ctx *fasthttp.RequestCtx) {\n\tvar post model.PostDEP\n\tvar postSlug model.PostSlug\n\tvar postDetail model.PostDetail\n\tvar postCategoryAssignment model.PostCategoryAssignment\n\tvar category model.Category\n\tvar user model.User\n\tc.GetDB().QueryRowWithModel(fmt.Sprintf(`\n\t\tSELECT \n\t\t\tp.id as id, p.author_id as author_id, u.username as author_username, \n\t\t\tp.inserted_at as inserted_at, ps.slug as slug, pd.title as title, \n\t\t\tpd.description as description, pd.content as content\n\t\tFROM %s AS p\n\t\tLEFT OUTER JOIN %s AS ps ON p.id = ps.post_id\n\t\tLEFT OUTER JOIN %s AS ps2 ON ps.post_id = ps2.post_id AND ps.id < ps2.id\n\t\tINNER JOIN %s AS pd ON p.id = pd.post_id\n\t\tLEFT OUTER JOIN %s AS pd2 ON pd.post_id = pd2.post_id AND pd.id < pd2.id\n\t\tINNER JOIN %s AS u ON p.author_id = u.id\n\t\tINNER JOIN %s AS pca ON p.id = pca.post_id\n\t\tINNER JOIN %s AS c ON pca.category_id = c.id\n\t\tWHERE ps2.id IS NULL AND pd2.id IS NULL AND (c.id::text = $1::text OR c.slug = $1) AND \n\t\t\t(p.id::text = $2::text OR ps.slug = $2)\n\t`, c.Model.TableName(), postSlug.TableName(), postSlug.TableName(), postDetail.TableName(),\n\t\tpostDetail.TableName(), user.TableName(), postCategoryAssignment.TableName(), category.TableName()),\n\t\t&post,\n\t\tphi.URLParam(ctx, \"categoryID\"),\n\t\tphi.URLParam(ctx, \"postID\")).Force()\n\n\tc.JSONResponse(ctx, model2.ResponseSuccessOne{\n\t\tData: post,\n\t}, fasthttp.StatusOK)\n}", "func (Tellurium) GetCategory() string {\n\tvar c categoryType = metalloid\n\treturn c.get()\n}", "func (Lawrencium) GetCategory() string {\n\tvar c categoryType = actinoid\n\treturn c.get()\n}", "func (c *PostVideoClient) QueryPost(pv *PostVideo) *PostQuery {\n\tquery := &PostQuery{config: c.config}\n\tquery.path = func(ctx context.Context) (fromV *sql.Selector, _ error) {\n\t\tid := pv.ID\n\t\tstep := sqlgraph.NewStep(\n\t\t\tsqlgraph.From(postvideo.Table, postvideo.FieldID, id),\n\t\t\tsqlgraph.To(post.Table, post.FieldID),\n\t\t\tsqlgraph.Edge(sqlgraph.M2O, true, postvideo.PostTable, postvideo.PostColumn),\n\t\t)\n\t\tfromV = sqlgraph.Neighbors(pv.driver.Dialect(), step)\n\t\treturn fromV, nil\n\t}\n\treturn query\n}", "func (o *BookCategoryAssign) Category(mods ...qm.QueryMod) bookCategoryQuery {\n\tqueryMods := []qm.QueryMod{\n\t\tqm.Where(\"id=?\", o.CategoryID),\n\t}\n\n\tqueryMods = append(queryMods, mods...)\n\n\tquery := BookCategories(queryMods...)\n\tqueries.SetFrom(query.Query, \"`book_category`\")\n\n\treturn query\n}", "func (db RepoCategorys) Query(title string, code string, ComId uint32, pag Pagination) (*[]models.Categorys, error) {\r\n\tvar args []interface{}\r\n\r\n\tvar where string\r\n\targs = append(args, ComId)\r\n\tif title != \"\" {\r\n\t\twhere += \" AND REGEXP_LIKE(T.CTT_TITLE, :CTT_TITLE, 'i')\"\r\n\t\targs = append(args, title)\r\n\t}\r\n\r\n\tif code != \"\" {\r\n\t\twhere += \" AND REGEXP_LIKE(N.CTT_CODE, :CTT_CODE, 'i')\"\r\n\t\targs = append(args, code)\r\n\t}\r\n\r\n\tstrpag := pag.pag()\r\n\r\n\trows, err := db.conn.QueryContext(\r\n\t\t*db.ctx,\r\n\t\t`SELECT T.CTT_ID, T.CTT_TITLE, NVL(T.CTT_FATHER,0), LISTAGG(N.CNN_CODE, ', ')\r\n\t\t FROM CATEGORYS_TITLES T, CATEGORYS_NICKNAMES N\r\n\t\t WHERE T.CTT_ID = N.CTT_ID(+)\r\n\t\t AND N.COM_ID IS NULL OR N.COM_ID = :COM_ID`+where+\r\n\t\t\t` GROUP BY T.CTT_ID, T.CTT_TITLE, T.CTT_FATHER`+strpag, args...,\r\n\t)\r\n\tif err != nil {\r\n\t\treturn nil, err\r\n\t}\r\n\r\n\tdefer rows.Close()\r\n\r\n\tvar categorys []models.Categorys\r\n\tfor rows.Next() {\r\n\t\tvar category models.Categorys\r\n\t\terr = rows.Scan(&category.CTT_ID, &category.Title, &category.Father, &category.Code)\r\n\t\tcategorys = append(categorys, category)\r\n\t}\r\n\treturn &categorys, nil\r\n}", "func (dc DevCat) Category() Category {\n\treturn Category(dc[0])\n}", "func (da *DumbAnalyserImpl) GetCategory(message string) (cat string, confidence int) {\n\n\tfor k, v := range da.categories {\n\t\tfor _, keyword := range v {\n\t\t\tif strings.Contains(message, keyword) {\n\t\t\t\treturn k, 90\n\t\t\t}\n\t\t}\n\t}\n\treturn \"\", 0\n}", "func (store *Store) HandleCategory(ctx *gin.Context) (bool, error) {\n\tctx.String(200, \"You are trying access a category.\")\n\treturn true, nil\n}", "func (g *Goods) Category(c Context) {\n\t// TODO\n\tc.String(http.StatusOK, \"get goods category\")\n}", "func (lb *Leaderboard) Category(embeds string) (*Category, *Error) {\n\t// we only have the category ID at hand\n\tasserted, okay := lb.CategoryData.(string)\n\tif okay {\n\t\treturn CategoryByID(asserted, embeds)\n\t}\n\n\treturn toCategory(lb.CategoryData, true), nil\n}", "func (Fermium) GetCategory() string {\n\tvar c categoryType = actinoid\n\treturn c.get()\n}", "func (Manganese) GetCategory() string {\n\tvar c categoryType = transitionMetal\n\treturn c.get()\n}", "func (m *State) Category(channelID discord.Snowflake) bool {\n\tc, err := m.store.Channel(channelID)\n\tif err != nil || !c.CategoryID.Valid() {\n\t\treturn false\n\t}\n\n\treturn m.Channel(c.CategoryID)\n}", "func (upuo *UnsavedPostUpdateOne) ClearCategory() *UnsavedPostUpdateOne {\n\tupuo.mutation.ClearCategory()\n\treturn upuo\n}", "func (Molybdenum) GetCategory() string {\n\tvar c categoryType = transitionMetal\n\treturn c.get()\n}", "func (cRepo *CategoryGormRepo) Category(id uint) (*entity.Category, []error) {\n\tctg := entity.Category{}\n\terrs := cRepo.conn.First(&ctg, id).GetErrors()\n\tif len(errs) > 0 {\n\t\treturn nil, errs\n\t}\n\treturn &ctg, errs\n}", "func (o *IaasDeviceStatusAllOf) SetCategory(v string) {\n\to.Category = &v\n}", "func GetCategory(p providers.CategoryProvider) func(c *fiber.Ctx) error {\n\treturn func(c *fiber.Ctx) error {\n\t\tcategoryID, _ := strconv.Atoi(c.Params(\"id\"))\n\t\tcategory, err := p.CategoryGet(categoryID)\n\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\t// wrapped into array to it works in the template\n\t\tresult := make([]*models.Category, 0)\n\t\tresult = append(result, category)\n\t\treturn c.Render(\"category\", result)\n\t}\n}", "func UpdateCategory(filter bson.M, category structure.Category) error {\n\tsession := mgoSession.Copy()\n\tdefer session.Close()\n\n\t// set safe mode to return ErrNotFound if a document isn't found\n\tsession.SetSafe(&mgo.Safe{})\n\tc := session.DB(dbName).C(\"categories\")\n\n\terr := c.Update(\n\t\tfilter,\n\t\tbson.M{\n\t\t\t\"$set\": category,\n\t\t},\n\t)\n\tif err != nil && err == mgo.ErrNotFound {\n\t\treturn ErrNoCategory\n\t}\n\n\treturn err\n}", "func FetchCategory(c *gin.Context) {\n\tvar categories []api.Category\n\tvar count int64\n\n\tdb := data.ConnectDB()\n\tquery := db.Order(\"id DESC\").Find(&categories)\n\tquery.Count(&count)\n\tdb.Commit()\n\n\tc.JSON(http.StatusOK, gin.H{\n\t\t\"Code\": http.StatusOK,\n\t\t\"Success\": true,\n\t\t\"Data\": categories,\n\t\t\"Count\": count,\n\t})\n}", "func (g *Game) Categories(filter *CategoryFilter, sort *Sorting, embeds string) (*CategoryCollection, *Error) {\n\tif g.CategoriesData == nil {\n\t\treturn fetchCategoriesLink(firstLink(g, \"categories\"), filter, sort, embeds)\n\t}\n\n\treturn toCategoryCollection(g.CategoriesData), nil\n}", "func (tu *TimingUpdate) SetCategory(s string) *TimingUpdate {\n\ttu.mutation.SetCategory(s)\n\treturn tu\n}", "func GetCategory(db *sql.DB, id int) (Category, error) {\n\tvar category Category\n\terr := db.QueryRow(`SELECT c.id, c.name FROM category c WHERE id = ($1)`,\n\t\tid).Scan(&category.ID, &category.Name)\n\n\tif err != nil {\n\t\treturn category, err\n\t}\n\n\treturn category, nil\n\n}", "func GetCategory(response http.ResponseWriter, request *http.Request) {\n\t//var results TCategory\n\tvar errorResponse = ErrorResponse{\n\t\tCode: http.StatusInternalServerError, Message: \"Internal Server Error.\",\n\t}\n\n\tcollection := Client.Database(\"msdb\").Collection(\"t_cat_mg\")\n\tctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)\n\tcursor, err := collection.Find(ctx, bson.M{})\n\tvar results []bson.M\n\terr = cursor.All(ctx, &results)\n\n\tdefer cancel()\n\n\tif err != nil {\n\t\terrorResponse.Message = \"Document not found\"\n\t\treturnErrorResponse(response, request, errorResponse)\n\t} else {\n\t\tvar successResponse = SuccessResponse{\n\t\t\tCode: http.StatusOK,\n\t\t\tMessage: \"Success\",\n\t\t\tResponse: results,\n\t\t}\n\n\t\tsuccessJSONResponse, jsonError := json.Marshal(successResponse)\n\n\t\tif jsonError != nil {\n\t\t\treturnErrorResponse(response, request, errorResponse)\n\t\t}\n\t\tresponse.Header().Set(\"Content-Type\", \"application/json\")\n\t\tresponse.Write(successJSONResponse)\n\t}\n\n}", "func (c *CategoryClient) QueryUnsavedPosts(ca *Category) *UnsavedPostQuery {\n\tquery := &UnsavedPostQuery{config: c.config}\n\tquery.path = func(ctx context.Context) (fromV *sql.Selector, _ error) {\n\t\tid := ca.ID\n\t\tstep := sqlgraph.NewStep(\n\t\t\tsqlgraph.From(category.Table, category.FieldID, id),\n\t\t\tsqlgraph.To(unsavedpost.Table, unsavedpost.FieldID),\n\t\t\tsqlgraph.Edge(sqlgraph.O2M, false, category.UnsavedPostsTable, category.UnsavedPostsColumn),\n\t\t)\n\t\tfromV = sqlgraph.Neighbors(ca.driver.Dialect(), step)\n\t\treturn fromV, nil\n\t}\n\treturn query\n}", "func (Technetium) GetCategory() string {\n\tvar c categoryType = transitionMetal\n\treturn c.get()\n}", "func Category() string {\n\treturn category\n}", "func (r *DeviceCategoryRequest) Get(ctx context.Context) (resObj *DeviceCategory, err error) {\n\tvar query string\n\tif r.query != nil {\n\t\tquery = \"?\" + r.query.Encode()\n\t}\n\terr = r.JSONRequest(ctx, \"GET\", query, nil, &resObj)\n\treturn\n}", "func (c *AdminClient) QueryPosts(a *Admin) *PostQuery {\n\tquery := &PostQuery{config: c.config}\n\tquery.path = func(ctx context.Context) (fromV *sql.Selector, _ error) {\n\t\tid := a.ID\n\t\tstep := sqlgraph.NewStep(\n\t\t\tsqlgraph.From(admin.Table, admin.FieldID, id),\n\t\t\tsqlgraph.To(post.Table, post.FieldID),\n\t\t\tsqlgraph.Edge(sqlgraph.O2M, false, admin.PostsTable, admin.PostsColumn),\n\t\t)\n\t\tfromV = sqlgraph.Neighbors(a.driver.Dialect(), step)\n\t\treturn fromV, nil\n\t}\n\treturn query\n}", "func SetCategory(c *gin.Context) {\n\tvar reqBody api.Category\n\n\terr := c.ShouldBindJSON(&reqBody)\n\tif err != nil {\n\t\tc.JSON(http.StatusBadRequest, gin.H{\n\t\t\t\"Code\": http.StatusBadRequest,\n\t\t\t\"Success\": false,\n\t\t\t\"Data\": \"Incorrect request body.\",\n\t\t})\n\t\treturn\n\t}\n\n\tdb := data.ConnectDB()\n\tdb.Create(&dbTable.Category{\n\t\tTitle: reqBody.Title,\n\t})\n\n\tvar category api.Category\n\tdb.Last(&category)\n\tdb.Commit()\n\n\tc.JSON(http.StatusOK, gin.H{\n\t\t\"Code\": http.StatusOK,\n\t\t\"Success\": true,\n\t\t\"Data\": category.ID,\n\t})\n}", "func (c Controller) Category(id int) (*model.Category, error) {\n\treturn c.CategoriesRepository.Get(id, \"\")\n}", "func (c *PostImageClient) QueryPost(pi *PostImage) *PostQuery {\n\tquery := &PostQuery{config: c.config}\n\tquery.path = func(ctx context.Context) (fromV *sql.Selector, _ error) {\n\t\tid := pi.ID\n\t\tstep := sqlgraph.NewStep(\n\t\t\tsqlgraph.From(postimage.Table, postimage.FieldID, id),\n\t\t\tsqlgraph.To(post.Table, post.FieldID),\n\t\t\tsqlgraph.Edge(sqlgraph.M2O, true, postimage.PostTable, postimage.PostColumn),\n\t\t)\n\t\tfromV = sqlgraph.Neighbors(pi.driver.Dialect(), step)\n\t\treturn fromV, nil\n\t}\n\treturn query\n}", "func GetCategories(c *fiber.Ctx) error {\n\tdb := database.DBConn\n\n\trows, err := db.Query(\"SELECT * FROM categories\")\n\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tvar category models.Category\n\tvar categories []models.Category\n\n\tfor rows.Next() {\n\t\tif err := rows.Scan(&category.ID, &category.Name); err != nil {\n\t\t\treturn err\n\t\t}\n\t\tcategories = append(categories, category)\n\t}\n\treturn c.Render(\"category\", categories)\n}", "func (Samarium) GetCategory() string {\n\tvar c categoryType = lanthanoid\n\treturn c.get()\n}", "func (s *PutSourceServerActionInput) SetCategory(v string) *PutSourceServerActionInput {\n\ts.Category = &v\n\treturn s\n}", "func AddCategory(c *fiber.Ctx) error {\n\tcat := new(models.Category)\n\tdb := database.DBConn\n\tstmt, createTableError := db.Prepare(\"CREATE TABLE IF NOT EXISTS categories (id INTEGER PRIMARY KEY, name TEXT)\")\n\n\tif createTableError != nil {\n\t\treturn createTableError\n\t}\n\tstmt.Exec()\n\n\tif err := c.BodyParser(cat); err != nil {\n\t\treturn err\n\t}\n\n\tstmt, insertingError := database.DBConn.Prepare(\"INSERT INTO categories (name) VALUES (?)\")\n\n\tdefer stmt.Close()\n\n\tif insertingError != nil {\n\t\treturn insertingError\n\t}\n\tif _, err := stmt.Exec(cat.Name); err != nil {\n\t\treturn err\n\t}\n\treturn c.Status(201).SendString(\"Category created successfully\")\n}", "func (s *PutSourceServerActionOutput) SetCategory(v string) *PutSourceServerActionOutput {\n\ts.Category = &v\n\treturn s\n}", "func (o *GetOperatingSystemsParams) SetCategory(category *string) {\n\to.Category = category\n}", "func (m *ThreatAssessmentRequest) SetCategory(value *ThreatCategory)() {\n m.category = value\n}", "func (r Repository) Posts(categoryName string, topic string) ([]DbPost, string) {\n\tthreads := r.Threads(categoryName)\n\tthread := filter(threads, func(t DbThread) bool {\n\t\treturn t.Topic == topic\n\t})\n\treturn thread[0].Posts, thread[0].Description\n}", "func (c *TermsService) Category() *TermsTaxonomyService {\n\treturn &TermsTaxonomyService{\n\t\tclient: c.Client,\n\t\turl: fmt.Sprintf(\"%v/category\", \"terms\"),\n\t\ttaxonomyBase: \"category\",\n\t}\n}", "func (q bookCategoryQuery) Count(ctx context.Context, exec boil.ContextExecutor) (int64, error) {\n\tvar count int64\n\n\tqueries.SetSelect(q.Query, nil)\n\tqueries.SetCount(q.Query)\n\n\terr := q.Query.QueryRowContext(ctx, exec).Scan(&count)\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: failed to count book_category rows\")\n\t}\n\n\treturn count, nil\n}", "func (o *IaasDeviceStatusAllOf) GetCategory() string {\n\tif o == nil || o.Category == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\treturn *o.Category\n}", "func (client *Client) GetCategory(alias string, request CategoriesSearchParam) (response CategoryDetailResponse, err error) {\n\turl := fmt.Sprintf(\"/categories/%s\", alias)\n\n\tif err := client.query(url, &request, &response); err != nil {\n\t\treturn response, err\n\t}\n\treturn response, nil\n\n}", "func (r *DeviceManagementIntentSettingCategoryRequest) Get(ctx context.Context) (resObj *DeviceManagementIntentSettingCategory, err error) {\n\tvar query string\n\tif r.query != nil {\n\t\tquery = \"?\" + r.query.Encode()\n\t}\n\terr = r.JSONRequest(ctx, \"GET\", query, nil, &resObj)\n\treturn\n}", "func (p PostgresPersister) UpdateCategory(id string, in model.CategoryIn) (model.Category, error) {\n\tvar dbid int32\n\tfmt.Sscanf(id, p.pathPrefix+model.CategoryIDFormat, &dbid)\n\tvar cat model.Category\n\terr := p.db.QueryRow(\"UPDATE category SET body = $1, last_update_time = CURRENT_TIMESTAMP WHERE id = $2 RETURNING id, body, insert_time, last_update_time\", in, dbid).\n\t\tScan(\n\t\t\t&dbid,\n\t\t\t&cat.CategoryBody,\n\t\t\t&cat.InsertTime,\n\t\t\t&cat.LastUpdateTime,\n\t\t)\n\tcat.ID = p.pathPrefix + fmt.Sprintf(model.CategoryIDFormat, dbid)\n\tcat.Type = \"category\"\n\treturn cat, translateError(err)\n}", "func (tuo *TimingUpdateOne) SetCategory(s string) *TimingUpdateOne {\n\ttuo.mutation.SetCategory(s)\n\treturn tuo\n}", "func (o *InlineResponse200115) SetCategory(v InlineResponse2002Column) {\n\to.Category = &v\n}", "func (s *PutTemplateActionInput) SetCategory(v string) *PutTemplateActionInput {\n\ts.Category = &v\n\treturn s\n}", "func (s *SourceServerActionDocument) SetCategory(v string) *SourceServerActionDocument {\n\ts.Category = &v\n\treturn s\n}", "func AddCategory(cname string) error {\n\to := orm.NewOrm()\n\tcate := new(Category)\n\tcate.Title = cname\n\tcate.Created = time.Now()\n\tcate.TopicTime = time.Now()\n\tcate.TopicCount = 1\n\n\tqs := o.QueryTable(\"category\")\n\terr := qs.Filter(\"title\", cname).One(cate)\n\tif err == nil {\n\t\treturn err\n\t}\n\t/* if category does not exist,insert a new category */\n\t_, err = o.Insert(cate)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func (c *CategoryClient) Get(ctx context.Context, id int) (*Category, error) {\n\treturn c.Query().Where(category.ID(id)).Only(ctx)\n}", "func (s *PutTemplateActionOutput) SetCategory(v string) *PutTemplateActionOutput {\n\ts.Category = &v\n\treturn s\n}", "func (c *PostAttachmentClient) QueryPost(pa *PostAttachment) *PostQuery {\n\tquery := &PostQuery{config: c.config}\n\tquery.path = func(ctx context.Context) (fromV *sql.Selector, _ error) {\n\t\tid := pa.ID\n\t\tstep := sqlgraph.NewStep(\n\t\t\tsqlgraph.From(postattachment.Table, postattachment.FieldID, id),\n\t\t\tsqlgraph.To(post.Table, post.FieldID),\n\t\t\tsqlgraph.Edge(sqlgraph.M2O, true, postattachment.PostTable, postattachment.PostColumn),\n\t\t)\n\t\tfromV = sqlgraph.Neighbors(pa.driver.Dialect(), step)\n\t\treturn fromV, nil\n\t}\n\treturn query\n}", "func (fc *FileCreate) SetCategory(s string) *FileCreate {\n\tfc.mutation.SetCategory(s)\n\treturn fc\n}", "func TestCategory(t *testing.T) {\n\talltypes := []querypb.Type{\n\t\tNull,\n\t\tInt8,\n\t\tUint8,\n\t\tInt16,\n\t\tUint16,\n\t\tInt24,\n\t\tUint24,\n\t\tInt32,\n\t\tUint32,\n\t\tInt64,\n\t\tUint64,\n\t\tFloat32,\n\t\tFloat64,\n\t\tTimestamp,\n\t\tDate,\n\t\tTime,\n\t\tDatetime,\n\t\tYear,\n\t\tDecimal,\n\t\tText,\n\t\tBlob,\n\t\tVarChar,\n\t\tVarBinary,\n\t\tChar,\n\t\tBinary,\n\t\tBit,\n\t\tEnum,\n\t\tSet,\n\t\tGeometry,\n\t\tTypeJSON,\n\t\tExpression,\n\t\tHexNum,\n\t\tHexVal,\n\t\tBitNum,\n\t}\n\tfor _, typ := range alltypes {\n\t\tmatched := false\n\t\tif IsSigned(typ) {\n\t\t\tif !IsIntegral(typ) {\n\t\t\t\tt.Errorf(\"Signed type %v is not an integral\", typ)\n\t\t\t}\n\t\t\tmatched = true\n\t\t}\n\t\tif IsUnsigned(typ) {\n\t\t\tif !IsIntegral(typ) {\n\t\t\t\tt.Errorf(\"Unsigned type %v is not an integral\", typ)\n\t\t\t}\n\t\t\tif matched {\n\t\t\t\tt.Errorf(\"%v matched more than one category\", typ)\n\t\t\t}\n\t\t\tmatched = true\n\t\t}\n\t\tif IsFloat(typ) {\n\t\t\tif matched {\n\t\t\t\tt.Errorf(\"%v matched more than one category\", typ)\n\t\t\t}\n\t\t\tmatched = true\n\t\t}\n\t\tif IsQuoted(typ) {\n\t\t\tif matched {\n\t\t\t\tt.Errorf(\"%v matched more than one category\", typ)\n\t\t\t}\n\t\t\tmatched = true\n\t\t}\n\t\tif typ == Null || typ == Decimal || typ == Expression || typ == Bit ||\n\t\t\ttyp == HexNum || typ == HexVal || typ == BitNum {\n\t\t\tif matched {\n\t\t\t\tt.Errorf(\"%v matched more than one category\", typ)\n\t\t\t}\n\t\t\tmatched = true\n\t\t}\n\t\tif !matched {\n\t\t\tt.Errorf(\"%v matched no category\", typ)\n\t\t}\n\t}\n}", "func (cri *CategoryRepositoryImpl) Category(id int) (entity.Category, error) {\n\n\trow := cri.conn.QueryRow(\"SELECT * FROM categories WHERE id = $1\", id)\n\n\tc := entity.Category{}\n\n\terr := row.Scan(&c.ID, &c.Name, &c.Description, &c.Image)\n\tif err != nil {\n\t\treturn c, err\n\t}\n\n\treturn c, nil\n}", "func (r *DeviceManagementSettingCategoryRequest) Get(ctx context.Context) (resObj *DeviceManagementSettingCategory, err error) {\n\tvar query string\n\tif r.query != nil {\n\t\tquery = \"?\" + r.query.Encode()\n\t}\n\terr = r.JSONRequest(ctx, \"GET\", query, nil, &resObj)\n\treturn\n}", "func (s *Server) GetCategoryByName(ctx context.Context, in *api.CategoryQuery) (*api.Category, error) {\n\tdb, err := domain.GetConnection(utilities.GetConfiguration())\n\tif err != nil {\n\t\tlog.Fatalf(\"GetCategoryByName, error while connecting to database: %v\", err)\n\t}\n\tdefer db.Close()\n\treturn domain.GetCategoryByName(db, in)\n}", "func AddCategory(channel *discordgo.Channel, db *sql.DB) {\n\ttx, _ := db.Begin()\n\n\tstmt, _ := tx.Prepare(`INSERT INTO channelsCategories\n\t\t(id, position, name, nsfw)\n\tvalues (?, ?, ?, ?)`)\n\tstmt.Exec(\n\t\tchannel.ID,\n\t\tchannel.Position,\n\t\tchannel.Name,\n\t\tchannel.NSFW)\n\ttx.Commit()\n}", "func (s *TemplateActionDocument) SetCategory(v string) *TemplateActionDocument {\n\ts.Category = &v\n\treturn s\n}", "func (f *Feature) Category(x Example) Category {\n\tif f.Kind != Feature_CATEGORICAL {\n\t\treturn NoCategory\n\t}\n\n\treturn f.CategoryOf(x.GetExampleValue(f.Name))\n}", "func (o *Transaction) GetCategory() []string {\n\tif o == nil {\n\t\tvar ret []string\n\t\treturn ret\n\t}\n\n\treturn o.Category\n}", "func (db RepoCategorys) QueryNiks(title string, code string, comID uint32, pag Pagination) (*[]models.Categorys, error) {\r\n\tvar args []interface{}\r\n\r\n\targs = append(args, comID)\r\n\tvar where string\r\n\tif title != \"\" {\r\n\t\twhere += \" AND REGEXP_LIKE(T.CTT_TITLE, :CTT_TITLE, 'i')\"\r\n\t\targs = append(args, title)\r\n\t}\r\n\r\n\tif code != \"\" {\r\n\t\twhere += \" AND REGEXP_LIKE(N.CTT_CODE, :CTT_CODE, 'i')\"\r\n\t\targs = append(args, code)\r\n\t}\r\n\r\n\tstrpag := pag.pag()\r\n\r\n\trows, err := db.conn.QueryContext(\r\n\t\t*db.ctx,\r\n\t\t`SELECT T.CTT_ID, T.CTT_TITLE, N.CNN_CODE\r\n\t\tFROM CATEGORYS_TITLES T, CATEGORYS_NICKNAMES N\r\n\t WHERE T.CTT_ID = N.CTT_ID \r\n\t AND COM_ID = :COM_ID`+where+strpag, args...,\r\n\t)\r\n\tif err != nil {\r\n\t\treturn nil, err\r\n\t}\r\n\r\n\tdefer rows.Close()\r\n\r\n\tvar categorys []models.Categorys\r\n\r\n\tfor rows.Next() {\r\n\t\tvar category models.Categorys\r\n\t\trows.Scan(&category.CTT_ID, &category.Title, &category.Code)\r\n\t\tcategorys = append(categorys, category)\r\n\t}\r\n\treturn &categorys, nil\r\n}", "func (o *BulletinDTO) SetCategory(v string) {\n\to.Category = &v\n}", "func (m *CloudPcAuditEvent) GetCategory()(*CloudPcAuditCategory) {\n val, err := m.GetBackingStore().Get(\"category\")\n if err != nil {\n panic(err)\n }\n if val != nil {\n return val.(*CloudPcAuditCategory)\n }\n return nil\n}", "func (f *FlagBase[T, C, V]) GetCategory() string {\n\treturn f.Category\n}", "func (a *Adapter) Get(ctx context.Context, categoryCode string) (categoryDomain.Category, error) {\n\tt, err := a.categoryRepository.Category(ctx, categoryCode)\n\tif err == categoryDomain.ErrNotFound {\n\t\ta.logger.Warn(err)\n\t\treturn t, err\n\t}\n\tif err != nil {\n\t\ta.logger.Error(err)\n\t}\n\treturn t, err\n}", "func (s *Alert) SetCategory(v string) *Alert {\n\ts.Category = &v\n\treturn s\n}", "func NewCategoryQueryInMemory(db map[int]*model.Category) CategoryQuery {\n\treturn &categoryQueryInMemory{db}\n}", "func (p PostgresPersister) InsertCategory(in model.CategoryIn) (model.Category, error) {\n\tvar dbid int32\n\tvar cat model.Category\n\terr := p.db.QueryRow(\"INSERT INTO category (body) VALUES ($1) RETURNING id, body, insert_time, last_update_time\", in).\n\t\tScan(\n\t\t\t&dbid,\n\t\t\t&cat.CategoryBody,\n\t\t\t&cat.InsertTime,\n\t\t\t&cat.LastUpdateTime,\n\t\t)\n\tcat.ID = p.pathPrefix + fmt.Sprintf(model.CategoryIDFormat, dbid)\n\tcat.Type = \"category\"\n\treturn cat, translateError(err)\n}", "func (o *Transaction) SetCategory(v []string) {\n\to.Category = v\n}", "func (Krypton) GetCategory() string {\n\tvar c categoryType = nobleGas\n\treturn c.get()\n}", "func (o *SLOCorrectionCreateRequestAttributes) SetCategory(v SLOCorrectionCategory) {\n\to.Category = v\n}", "func (d *DB) Get_category(ipaddress string) (IP2Locationrecord, error) {\n\treturn d.query(ipaddress, category)\n}", "func (w *withCode) Category() categories.Category {\n\tswitch code := w.Code().Int(); {\n\tcase code < 50:\n\t\treturn grpcCategory(w.Code())\n\tcase code >= 50 && code < 100:\n\t\treturn categories.Temporary\n\tcase code >= 100 && code < 150:\n\t\treturn categories.System\n\tcase code >= 150 && code < 200:\n\t\treturn categories.Data\n\tdefault:\n\t\treturn categories.Unknown\n\t}\n}", "func (e Endpoints) GetCategory(ctx context.Context) (c []io.TodoCategory, error error) {\n\trequest := GetCategoryRequest{}\n\tresponse, err := e.GetCategoryEndpoint(ctx, request)\n\tif err != nil {\n\t\treturn\n\t}\n\treturn response.(GetCategoryResponse).C, response.(GetCategoryResponse).Error\n}", "func (m *ThreatAssessmentRequest) GetCategory()(*ThreatCategory) {\n val, err := m.GetBackingStore().Get(\"category\")\n if err != nil {\n panic(err)\n }\n if val != nil {\n return val.(*ThreatCategory)\n }\n return nil\n}", "func (g *GetTopChatsRequest) GetCategory() (value TopChatCategoryClass) {\n\tif g == nil {\n\t\treturn\n\t}\n\treturn g.Category\n}", "func (m *PatientMutation) CategoryCleared() bool {\n\treturn m.clearedcategory\n}", "func Categories(filter bson.M) ([]structure.Category, error) {\n\tvar categories []structure.Category\n\n\tsession := mgoSession.Copy()\n\tdefer session.Close()\n\n\tc := session.DB(dbName).C(\"categories\")\n\n\tpipeline := []bson.M{\n\t\tbson.M{\n\t\t\t\"$match\": filter,\n\t\t},\n\t\tbson.M{\n\t\t\t\"$project\": bson.M{\n\t\t\t\t\"_id\": 1,\n\t\t\t\t\"name\": 1,\n\t\t\t},\n\t\t},\n\t}\n\n\terr := c.Pipe(pipeline).All(&categories)\n\n\treturn categories, err\n}", "func (o ClusterNodeGroupDataDiskOutput) Category() pulumi.StringOutput {\n\treturn o.ApplyT(func(v ClusterNodeGroupDataDisk) string { return v.Category }).(pulumi.StringOutput)\n}" ]
[ "0.7618682", "0.7398114", "0.6680649", "0.623427", "0.5656076", "0.564827", "0.56055105", "0.545845", "0.5420303", "0.5414065", "0.538522", "0.52593666", "0.5104944", "0.5080627", "0.50686395", "0.5067414", "0.49797806", "0.49651045", "0.4941179", "0.49306858", "0.49158502", "0.49131152", "0.49102172", "0.48707053", "0.48697835", "0.48643216", "0.48387155", "0.48338282", "0.48306027", "0.4827501", "0.48272353", "0.4823685", "0.48194155", "0.48000887", "0.4769956", "0.47645867", "0.4755429", "0.47294745", "0.47264448", "0.47083357", "0.46993205", "0.46967396", "0.46894833", "0.46876335", "0.46854976", "0.4672403", "0.46716243", "0.46649465", "0.46525267", "0.4641928", "0.46277726", "0.46134567", "0.4608951", "0.4600372", "0.45963693", "0.45888254", "0.45834774", "0.4578972", "0.4578893", "0.45738938", "0.4571478", "0.45475256", "0.45462143", "0.453995", "0.45391804", "0.45340803", "0.45290157", "0.45246792", "0.45187715", "0.4513737", "0.4510413", "0.45096463", "0.45078504", "0.45067123", "0.450542", "0.4499928", "0.44996384", "0.4495139", "0.44943833", "0.44823003", "0.4481612", "0.44781068", "0.4476677", "0.44682494", "0.44613212", "0.44410893", "0.44240382", "0.44152692", "0.44085404", "0.4384678", "0.43809313", "0.43788052", "0.43740734", "0.43711716", "0.437052", "0.43676898", "0.4365228", "0.43616167", "0.43599957", "0.4347224" ]
0.76003575
1
QueryThumbnail queries the thumbnail edge of a Post.
func (c *PostClient) QueryThumbnail(po *Post) *PostThumbnailQuery { query := &PostThumbnailQuery{config: c.config} query.path = func(ctx context.Context) (fromV *sql.Selector, _ error) { id := po.ID step := sqlgraph.NewStep( sqlgraph.From(post.Table, post.FieldID, id), sqlgraph.To(postthumbnail.Table, postthumbnail.FieldID), sqlgraph.Edge(sqlgraph.O2O, false, post.ThumbnailTable, post.ThumbnailColumn), ) fromV = sqlgraph.Neighbors(po.driver.Dialect(), step) return fromV, nil } return query }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (c *UnsavedPostClient) QueryThumbnail(up *UnsavedPost) *UnsavedPostThumbnailQuery {\n\tquery := &UnsavedPostThumbnailQuery{config: c.config}\n\tquery.path = func(ctx context.Context) (fromV *sql.Selector, _ error) {\n\t\tid := up.ID\n\t\tstep := sqlgraph.NewStep(\n\t\t\tsqlgraph.From(unsavedpost.Table, unsavedpost.FieldID, id),\n\t\t\tsqlgraph.To(unsavedpostthumbnail.Table, unsavedpostthumbnail.FieldID),\n\t\t\tsqlgraph.Edge(sqlgraph.O2O, false, unsavedpost.ThumbnailTable, unsavedpost.ThumbnailColumn),\n\t\t)\n\t\tfromV = sqlgraph.Neighbors(up.driver.Dialect(), step)\n\t\treturn fromV, nil\n\t}\n\treturn query\n}", "func (upq *UnsavedPostQuery) QueryThumbnail() *UnsavedPostThumbnailQuery {\n\tquery := &UnsavedPostThumbnailQuery{config: upq.config}\n\tquery.path = func(ctx context.Context) (fromU *sql.Selector, err error) {\n\t\tif err := upq.prepareQuery(ctx); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tselector := upq.sqlQuery(ctx)\n\t\tif err := selector.Err(); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tstep := sqlgraph.NewStep(\n\t\t\tsqlgraph.From(unsavedpost.Table, unsavedpost.FieldID, selector),\n\t\t\tsqlgraph.To(unsavedpostthumbnail.Table, unsavedpostthumbnail.FieldID),\n\t\t\tsqlgraph.Edge(sqlgraph.O2O, false, unsavedpost.ThumbnailTable, unsavedpost.ThumbnailColumn),\n\t\t)\n\t\tfromU = sqlgraph.SetNeighbors(upq.driver.Dialect(), step)\n\t\treturn fromU, nil\n\t}\n\treturn query\n}", "func (c *PostThumbnailClient) Query() *PostThumbnailQuery {\n\treturn &PostThumbnailQuery{\n\t\tconfig: c.config,\n\t}\n}", "func (c *PostThumbnailClient) QueryPost(pt *PostThumbnail) *PostQuery {\n\tquery := &PostQuery{config: c.config}\n\tquery.path = func(ctx context.Context) (fromV *sql.Selector, _ error) {\n\t\tid := pt.ID\n\t\tstep := sqlgraph.NewStep(\n\t\t\tsqlgraph.From(postthumbnail.Table, postthumbnail.FieldID, id),\n\t\t\tsqlgraph.To(post.Table, post.FieldID),\n\t\t\tsqlgraph.Edge(sqlgraph.O2O, true, postthumbnail.PostTable, postthumbnail.PostColumn),\n\t\t)\n\t\tfromV = sqlgraph.Neighbors(pt.driver.Dialect(), step)\n\t\treturn fromV, nil\n\t}\n\treturn query\n}", "func (c *UnsavedPostThumbnailClient) Query() *UnsavedPostThumbnailQuery {\n\treturn &UnsavedPostThumbnailQuery{\n\t\tconfig: c.config,\n\t}\n}", "func (upq *UnsavedPostQuery) WithThumbnail(opts ...func(*UnsavedPostThumbnailQuery)) *UnsavedPostQuery {\n\tquery := &UnsavedPostThumbnailQuery{config: upq.config}\n\tfor _, opt := range opts {\n\t\topt(query)\n\t}\n\tupq.withThumbnail = query\n\treturn upq\n}", "func (c *PostThumbnailClient) Get(ctx context.Context, id int) (*PostThumbnail, error) {\n\treturn c.Query().Where(postthumbnail.ID(id)).Only(ctx)\n}", "func (t tracing) GetThumbnail(ctx context.Context, req *v0proto.GetThumbnailRequest, rsp *v0proto.GetThumbnailResponse) error {\n\tvar span trace.Span\n\n\tif thumbnailsTracing.TraceProvider != nil {\n\t\ttracer := thumbnailsTracing.TraceProvider.Tracer(\"thumbnails\")\n\t\tctx, span = tracer.Start(ctx, \"Thumbnails.GetThumbnail\")\n\t\tdefer span.End()\n\n\t\tspan.SetAttributes(\n\t\t\tattribute.KeyValue{Key: \"filepath\", Value: attribute.StringValue(req.Filepath)},\n\t\t\tattribute.KeyValue{Key: \"thumbnail_type\", Value: attribute.StringValue(req.ThumbnailType.String())},\n\t\t\tattribute.KeyValue{Key: \"width\", Value: attribute.IntValue(int(req.Width))},\n\t\t\tattribute.KeyValue{Key: \"height\", Value: attribute.IntValue(int(req.Height))},\n\t\t)\n\t}\n\n\treturn t.next.GetThumbnail(ctx, req, rsp)\n}", "func (upu *UnsavedPostUpdate) ClearThumbnail() *UnsavedPostUpdate {\n\tupu.mutation.ClearThumbnail()\n\treturn upu\n}", "func (i *InputInlineQueryResultDocument) GetThumbnailHeight() (value int32) {\n\tif i == nil {\n\t\treturn\n\t}\n\treturn i.ThumbnailHeight\n}", "func (s Thumbnails) GetThumbnail(w http.ResponseWriter, r *http.Request) {\n\tlogger := s.logger.SubloggerWithRequestID(r.Context())\n\tkey := r.Context().Value(keyContextKey).(string)\n\n\tthumbnail, err := s.manager.GetThumbnail(key)\n\tif err != nil {\n\t\tlogger.Debug().\n\t\t\tErr(err).\n\t\t\tStr(\"key\", key).\n\t\t\tMsg(\"could not get the thumbnail\")\n\t\tw.WriteHeader(http.StatusInternalServerError)\n\t\treturn\n\t}\n\n\tw.WriteHeader(http.StatusOK)\n\tw.Header().Set(\"Content-Length\", strconv.Itoa(len(thumbnail)))\n\tif _, err = w.Write(thumbnail); err != nil {\n\t\tlogger.Error().\n\t\t\tErr(err).\n\t\t\tStr(\"key\", key).\n\t\t\tMsg(\"could not write the thumbnail response\")\n\t}\n}", "func (i *InputInlineQueryResultContact) GetThumbnailHeight() (value int32) {\n\tif i == nil {\n\t\treturn\n\t}\n\treturn i.ThumbnailHeight\n}", "func (r *ImageRef) Thumbnail(width, height int, crop Interesting) error {\n\tout, err := vipsThumbnail(r.image, width, height, crop, SizeBoth)\n\tif err != nil {\n\t\treturn err\n\t}\n\tr.setImage(out)\n\treturn nil\n}", "func (upuo *UnsavedPostUpdateOne) ClearThumbnail() *UnsavedPostUpdateOne {\n\tupuo.mutation.ClearThumbnail()\n\treturn upuo\n}", "func (i *InputInlineQueryResultDocument) GetThumbnailWidth() (value int32) {\n\tif i == nil {\n\t\treturn\n\t}\n\treturn i.ThumbnailWidth\n}", "func (i *InputInlineQueryResultDocument) GetThumbnailURL() (value string) {\n\tif i == nil {\n\t\treturn\n\t}\n\treturn i.ThumbnailURL\n}", "func (i *InputInlineQueryResultLocation) GetThumbnailHeight() (value int32) {\n\tif i == nil {\n\t\treturn\n\t}\n\treturn i.ThumbnailHeight\n}", "func (upu *UnsavedPostUpdate) SetThumbnail(u *UnsavedPostThumbnail) *UnsavedPostUpdate {\n\treturn upu.SetThumbnailID(u.ID)\n}", "func (upuo *UnsavedPostUpdateOne) SetThumbnail(u *UnsavedPostThumbnail) *UnsavedPostUpdateOne {\n\treturn upuo.SetThumbnailID(u.ID)\n}", "func (c *UnsavedPostThumbnailClient) Get(ctx context.Context, id int) (*UnsavedPostThumbnail, error) {\n\treturn c.Query().Where(unsavedpostthumbnail.ID(id)).Only(ctx)\n}", "func (upuo *UnsavedPostUpdateOne) SetThumbnailID(id int) *UnsavedPostUpdateOne {\n\tupuo.mutation.SetThumbnailID(id)\n\treturn upuo\n}", "func (i *InputInlineQueryResultArticle) GetThumbnailHeight() (value int32) {\n\tif i == nil {\n\t\treturn\n\t}\n\treturn i.ThumbnailHeight\n}", "func (c *Files) GetThumbnail(in *GetThumbnailInput) (out *GetThumbnailOutput, err error) {\n\tbody, l, err := c.download(\"/files/get_thumbnail\", in, nil)\n\tif err != nil {\n\t\treturn\n\t}\n\n\tout = &GetThumbnailOutput{body, l}\n\treturn\n}", "func (i *InputInlineQueryResultLocation) GetThumbnailWidth() (value int32) {\n\tif i == nil {\n\t\treturn\n\t}\n\treturn i.ThumbnailWidth\n}", "func (i *InputInlineQueryResultPhoto) GetThumbnailURL() (value string) {\n\tif i == nil {\n\t\treturn\n\t}\n\treturn i.ThumbnailURL\n}", "func (upu *UnsavedPostUpdate) SetThumbnailID(id int) *UnsavedPostUpdate {\n\tupu.mutation.SetThumbnailID(id)\n\treturn upu\n}", "func (s *StickerSet) GetThumbnail() (value Thumbnail) {\n\tif s == nil {\n\t\treturn\n\t}\n\treturn s.Thumbnail\n}", "func (i *InputInlineQueryResultSticker) GetThumbnailURL() (value string) {\n\tif i == nil {\n\t\treturn\n\t}\n\treturn i.ThumbnailURL\n}", "func (i *InputInlineQueryResultVenue) GetThumbnailHeight() (value int32) {\n\tif i == nil {\n\t\treturn\n\t}\n\treturn i.ThumbnailHeight\n}", "func (c *PostImageClient) QueryPost(pi *PostImage) *PostQuery {\n\tquery := &PostQuery{config: c.config}\n\tquery.path = func(ctx context.Context) (fromV *sql.Selector, _ error) {\n\t\tid := pi.ID\n\t\tstep := sqlgraph.NewStep(\n\t\t\tsqlgraph.From(postimage.Table, postimage.FieldID, id),\n\t\t\tsqlgraph.To(post.Table, post.FieldID),\n\t\t\tsqlgraph.Edge(sqlgraph.M2O, true, postimage.PostTable, postimage.PostColumn),\n\t\t)\n\t\tfromV = sqlgraph.Neighbors(pi.driver.Dialect(), step)\n\t\treturn fromV, nil\n\t}\n\treturn query\n}", "func (i *InputInlineQueryResultArticle) GetThumbnailWidth() (value int32) {\n\tif i == nil {\n\t\treturn\n\t}\n\treturn i.ThumbnailWidth\n}", "func (c *PostClient) QueryImages(po *Post) *PostImageQuery {\n\tquery := &PostImageQuery{config: c.config}\n\tquery.path = func(ctx context.Context) (fromV *sql.Selector, _ error) {\n\t\tid := po.ID\n\t\tstep := sqlgraph.NewStep(\n\t\t\tsqlgraph.From(post.Table, post.FieldID, id),\n\t\t\tsqlgraph.To(postimage.Table, postimage.FieldID),\n\t\t\tsqlgraph.Edge(sqlgraph.O2M, false, post.ImagesTable, post.ImagesColumn),\n\t\t)\n\t\tfromV = sqlgraph.Neighbors(po.driver.Dialect(), step)\n\t\treturn fromV, nil\n\t}\n\treturn query\n}", "func (i *InputInlineQueryResultArticle) GetThumbnailURL() (value string) {\n\tif i == nil {\n\t\treturn\n\t}\n\treturn i.ThumbnailURL\n}", "func (i *InputInlineQueryResultContact) GetThumbnailWidth() (value int32) {\n\tif i == nil {\n\t\treturn\n\t}\n\treturn i.ThumbnailWidth\n}", "func (c *UnsavedPostClient) QueryImages(up *UnsavedPost) *UnsavedPostImageQuery {\n\tquery := &UnsavedPostImageQuery{config: c.config}\n\tquery.path = func(ctx context.Context) (fromV *sql.Selector, _ error) {\n\t\tid := up.ID\n\t\tstep := sqlgraph.NewStep(\n\t\t\tsqlgraph.From(unsavedpost.Table, unsavedpost.FieldID, id),\n\t\t\tsqlgraph.To(unsavedpostimage.Table, unsavedpostimage.FieldID),\n\t\t\tsqlgraph.Edge(sqlgraph.O2M, false, unsavedpost.ImagesTable, unsavedpost.ImagesColumn),\n\t\t)\n\t\tfromV = sqlgraph.Neighbors(up.driver.Dialect(), step)\n\t\treturn fromV, nil\n\t}\n\treturn query\n}", "func (i *InputInlineQueryResultVideo) GetThumbnailURL() (value string) {\n\tif i == nil {\n\t\treturn\n\t}\n\treturn i.ThumbnailURL\n}", "func (i *InputInlineQueryResultContact) GetThumbnailURL() (value string) {\n\tif i == nil {\n\t\treturn\n\t}\n\treturn i.ThumbnailURL\n}", "func (i *InputInlineQueryResultAnimation) GetThumbnailURL() (value string) {\n\tif i == nil {\n\t\treturn\n\t}\n\treturn i.ThumbnailURL\n}", "func (m *ChatMessageAttachment) GetThumbnailUrl()(*string) {\n val, err := m.GetBackingStore().Get(\"thumbnailUrl\")\n if err != nil {\n panic(err)\n }\n if val != nil {\n return val.(*string)\n }\n return nil\n}", "func (i *InputInlineQueryResultVenue) GetThumbnailWidth() (value int32) {\n\tif i == nil {\n\t\treturn\n\t}\n\treturn i.ThumbnailWidth\n}", "func (s *SharemeService) ThumbnailURL(c *gae.Context, key string) string {\n\treturn s.Stat(c, key).Thumbnail\n}", "func (c *UnsavedPostThumbnailClient) QueryUnsavedPost(upt *UnsavedPostThumbnail) *UnsavedPostQuery {\n\tquery := &UnsavedPostQuery{config: c.config}\n\tquery.path = func(ctx context.Context) (fromV *sql.Selector, _ error) {\n\t\tid := upt.ID\n\t\tstep := sqlgraph.NewStep(\n\t\t\tsqlgraph.From(unsavedpostthumbnail.Table, unsavedpostthumbnail.FieldID, id),\n\t\t\tsqlgraph.To(unsavedpost.Table, unsavedpost.FieldID),\n\t\t\tsqlgraph.Edge(sqlgraph.O2O, true, unsavedpostthumbnail.UnsavedPostTable, unsavedpostthumbnail.UnsavedPostColumn),\n\t\t)\n\t\tfromV = sqlgraph.Neighbors(upt.driver.Dialect(), step)\n\t\treturn fromV, nil\n\t}\n\treturn query\n}", "func (i *InputInlineQueryResultLocation) GetThumbnailURL() (value string) {\n\tif i == nil {\n\t\treturn\n\t}\n\treturn i.ThumbnailURL\n}", "func NewPostThumbnailClient(c config) *PostThumbnailClient {\n\treturn &PostThumbnailClient{config: c}\n}", "func (f Function) Thumbnail(c *draw.Canvas) {\n\ty := c.Center().Y\n\tc.StrokeLine2(f.LineStyle, c.Min.X, y, c.Max.X, y)\n}", "func (c *PostAttachmentClient) QueryPost(pa *PostAttachment) *PostQuery {\n\tquery := &PostQuery{config: c.config}\n\tquery.path = func(ctx context.Context) (fromV *sql.Selector, _ error) {\n\t\tid := pa.ID\n\t\tstep := sqlgraph.NewStep(\n\t\t\tsqlgraph.From(postattachment.Table, postattachment.FieldID, id),\n\t\t\tsqlgraph.To(post.Table, post.FieldID),\n\t\t\tsqlgraph.Edge(sqlgraph.M2O, true, postattachment.PostTable, postattachment.PostColumn),\n\t\t)\n\t\tfromV = sqlgraph.Neighbors(pa.driver.Dialect(), step)\n\t\treturn fromV, nil\n\t}\n\treturn query\n}", "func (c *CrocoDoc) Thumbnail(size string, filename string) (err error) {\n\tif c.Uuid == \"\" {\n\t\terr = errors.New(\"Cannot call Thumbnail: No UUID is set on the CrocoDoc.\")\n\t\treturn\n\t}\n\n\tif len(size) == 0 {\n\t\tsize = DEFAULT_THUMBNAIL_SIZE\n\t}\n\tif strings.Index(\"x\", size) != -1 {\n\t\terr = errors.New(\"Error: Thumbnail size needs to be specified as a string of the from '100x100'. (maximum size is '300x300')\")\n\t\treturn\n\t} else {\n\t\tdimensions := strings.Split(size, \"x\")\n\t\tx, errx := strconv.ParseInt((dimensions[0]), 10, 0)\n\t\ty, erry := strconv.ParseInt((dimensions[1]), 10, 0)\n\t\tif errx != nil || erry != nil || x < 1 || x > 300 || y < 1 || y > 300 {\n\t\t\terr = errors.New(\"Error: Thumbnail size needs to be specified as a string of the from '100x100'. (maximum size is '300x300')\")\n\t\t}\n\t}\n\n\tdata, err := gorequests.NewQueryData(\n\t\tmap[string]string{\n\t\t\t\"token\": CrocoDocToken,\n\t\t\t\"uuid\": c.Uuid,\n\t\t\t\"size\": size,\n\t\t})\n\tif err != nil {\n\t\tlog.Println(err)\n\t}\n\n\tr := gorequests.Get(THUMBNAIL_ENDPOINT, nil, data, -1)\n\tlog.Println(r.Headers())\n\tif r.Error != nil {\n\t\tlog.Println(r.Error)\n\t}\n\n\terr = checkResponse(r, false)\n\tif err != nil {\n\t\tlog.Println(err)\n\t\treturn\n\t}\n\n\tif len(filename) == 0 {\n\t\terr = r.IntoFile(fileLocation(fmt.Sprintf(\"%s.png\", c.Uuid)))\n\t} else {\n\t\terr = r.IntoFile(fileLocation(filename))\n\t}\n\n\tif err != nil {\n\t\tlog.Println(err)\n\t}\n\n\treturn\n}", "func (b *BarChart) Thumbnail(c *draw.Canvas) {\n\n// fmt.Println (\"Thumbnail start \" )\n\n\tpts := []vg.Point{\n\t\t{c.Min.X, c.Min.Y},\n\t\t{c.Min.X, c.Max.Y},\n\t\t{c.Max.X, c.Max.Y},\n\t\t{c.Max.X, c.Min.Y},\n\t}\n\tpoly := c.ClipPolygonY(pts)\n\tc.FillPolygon(b.Color, poly)\n\n\tpts = append(pts, vg.Point{X: c.Min.X, Y: c.Min.Y})\n\toutline := c.ClipLinesY(pts)\n\tc.StrokeLines(b.LineStyle, outline...)\n\n//\tfmt.Println (\"Thumbnail end \" )\n}", "func GetThumbnail(imageBytes []byte, width, height int, maxBytes int) ([]byte, string, error) {\n\treturn process(imageBytes, maxBytes, func(image image.Image) image.Image {\n\t\treturn imaging.Thumbnail(image, width, height, imaging.MitchellNetravali)\n\t})\n}", "func (bm *BingManager) queryNewImageUrl(query string) (string, error) {\n var Query *url.URL\n Query, err := url.Parse(\"https://api.datamarket.azure.com/Bing/Search/Image\")\n if err != nil {\n\t\treturn \"\", err\n }\n parameters := url.Values{}\n parameters.Add(\"ImageFilters\", \"'Aspect:Square'\")\n parameters.Add(\"$format\", \"json\")\n parameters.Add(\"Adult\", \"'Moderate'\")\n parameters.Add(\"$top\", \"1\")\n parameters.Add(\"Query\", fmt.Sprintf(\"'%s'\", query))\n \n Query.RawQuery = parameters.Encode()\n\n\n\treq, err := http.NewRequest(\"GET\", Query.String(), nil)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\treq.SetBasicAuth(bm.AccountKey, bm.AccountKey)\n\n\tresp, err := bm.HTTPClient.Do(req)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\tbody, err := ioutil.ReadAll(resp.Body)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n \n\tvar m struct {\n\t\tD struct {\n\t\t\tResults []struct {\n\t\t\t\tMediaUrl string `json:\"MediaUrl\"`\n Thumbnail struct {\n Url string `json:\"MediaUrl\"`\n } `json:\"Thumbnail\"`\n\t\t\t} `json:\"results\"`\n\t\t} `json:\"d\"`\n\t}\n\n\terr = json.Unmarshal(body, &m)\n\tif err != nil {\n\t\tfmt.Println(err)\n\t\treturn \"\", err\n\t}\n\treturn m.D.Results[0].Thumbnail.Url, err\n}", "func (i *InputInlineQueryResultVenue) GetThumbnailURL() (value string) {\n\tif i == nil {\n\t\treturn\n\t}\n\treturn i.ThumbnailURL\n}", "func (c *PostVideoClient) QueryPost(pv *PostVideo) *PostQuery {\n\tquery := &PostQuery{config: c.config}\n\tquery.path = func(ctx context.Context) (fromV *sql.Selector, _ error) {\n\t\tid := pv.ID\n\t\tstep := sqlgraph.NewStep(\n\t\t\tsqlgraph.From(postvideo.Table, postvideo.FieldID, id),\n\t\t\tsqlgraph.To(post.Table, post.FieldID),\n\t\t\tsqlgraph.Edge(sqlgraph.M2O, true, postvideo.PostTable, postvideo.PostColumn),\n\t\t)\n\t\tfromV = sqlgraph.Neighbors(pv.driver.Dialect(), step)\n\t\treturn fromV, nil\n\t}\n\treturn query\n}", "func GThumbnail(details *youtube.ThumbnailDetails) string {\n if details.Maxres != nil {\n return details.Maxres.Url\n }\n if details.Standard != nil {\n return details.Standard.Url\n }\n // this isn't a bug, \"standard\" is higher resolution than \"high\". go figure.\n if details.High != nil {\n return details.High.Url\n }\n if details.Medium != nil {\n return details.Medium.Url\n }\n return details.Default.Url\n}", "func (e *DiscordWebhookEmbed) SetThumbnail(icon string) {\n\te.Thumbnail.URL = icon\n}", "func NewGetThumbnailInput() *GetThumbnailInput {\n\treturn &GetThumbnailInput{\n\t\tFormat: ThumbnailFormatJPEG,\n\t\tSize: ThumbnailSizeW64H64,\n\t\tMode: ThumbnailModeStrict,\n\t}\n}", "func (m *ChatMessageAttachment) SetThumbnailUrl(value *string)() {\n err := m.GetBackingStore().Set(\"thumbnailUrl\", value)\n if err != nil {\n panic(err)\n }\n}", "func (h *webHandler) serveThumbnailImage(c *gin.Context) {\n\t// Get bookmark ID from URL\n\tid := c.Param(\"id\")\n\n\t// Open image\n\timgPath := fp.Join(h.dataDir, \"thumb\", id)\n\timg, err := os.Open(imgPath)\n\tutils.CheckError(err)\n\tdefer img.Close()\n\n\t// Get image type from its 512 first bytes\n\tbuffer := make([]byte, 512)\n\t_, err = img.Read(buffer)\n\tutils.CheckError(err)\n\n\tmimeType := http.DetectContentType(buffer)\n\tc.Header(\"Content-Type\", mimeType)\n\n\t// Serve image\n\timg.Seek(0, 0)\n\t_, err = io.Copy(c.Writer, img)\n\tutils.CheckError(err)\n}", "func (s *StorageService) GetThumbnail(\n\tsize int,\n\tuserID *mytype.OID,\n\tkey string,\n) (*minio.Object, error) {\n\tsizeStr := strconv.FormatInt(int64(size), 10)\n\t// Thumbnail objects are identified with a -'size' at the end of the key\n\tthumbKey := key + \"--\" + sizeStr\n\tthumbLocal := \"./tmp/\" + thumbKey + \".jpg\"\n\n\tobjectName := fmt.Sprintf(\n\t\t\"%s/%s/%s/%s\",\n\t\tthumbKey[:2],\n\t\tthumbKey[3:5],\n\t\tthumbKey[6:8],\n\t\tthumbKey[9:],\n\t)\n\tobjectPath := strings.Join([]string{\n\t\tuserID.Short,\n\t\tobjectName,\n\t}, \"/\")\n\n\tobjInfo, err := s.svc.StatObject(\n\t\ts.bucket,\n\t\tobjectPath,\n\t\tminio.StatObjectOptions{},\n\t)\n\tif err != nil {\n\t\tminioError := minio.ToErrorResponse(err)\n\t\tif minioError.Code != \"NoSuchKey\" {\n\t\t\tmylog.Log.WithError(err).Error(util.Trace(\"\"))\n\t\t\treturn nil, err\n\t\t}\n\n\t\tmylog.Log.Info(\"generating new thumbnail...\")\n\n\t\tasset, err := s.Get(userID, key)\n\t\tif err != nil {\n\t\t\tmylog.Log.WithError(err).Error(util.Trace(\"\"))\n\t\t\treturn nil, err\n\t\t}\n\n\t\timg, err := imaging.Decode(asset)\n\t\tif err != nil {\n\t\t\tmylog.Log.WithError(err).Error(util.Trace(\"\"))\n\t\t\treturn nil, err\n\t\t}\n\t\tthumb := imaging.Thumbnail(img, size, size, imaging.CatmullRom)\n\n\t\t// create a new blank image\n\t\tdst := imaging.New(size, size, color.NRGBA{0, 0, 0, 0})\n\n\t\t// paste thumbnails into the new image\n\t\tdst = imaging.Paste(dst, thumb, image.Pt(0, 0))\n\n\t\t// ensure path is available\n\t\tdir := filepath.Dir(thumbLocal)\n\t\tif err := os.MkdirAll(dir, os.ModePerm); err != nil {\n\t\t\tmylog.Log.WithError(err).Error(util.Trace(\"\"))\n\t\t\treturn nil, err\n\t\t}\n\n\t\terr = imaging.Save(dst, thumbLocal)\n\t\tif err != nil {\n\t\t\tmylog.Log.WithError(err).Error(util.Trace(\"\"))\n\t\t\treturn nil, err\n\t\t}\n\n\t\tthumbFile, err := os.Open(thumbLocal)\n\t\tif err != nil {\n\t\t\tmylog.Log.WithError(err).Error(util.Trace(\"\"))\n\t\t\treturn nil, err\n\t\t}\n\n\t\tthumbStat, err := thumbFile.Stat()\n\t\tif err != nil {\n\t\t\tmylog.Log.WithError(err).Error(util.Trace(\"\"))\n\t\t\treturn nil, err\n\t\t}\n\n\t\t_, err = s.svc.PutObject(\n\t\t\ts.bucket,\n\t\t\tobjectPath,\n\t\t\tthumbFile,\n\t\t\tthumbStat.Size(),\n\t\t\tminio.PutObjectOptions{ContentType: objInfo.ContentType},\n\t\t)\n\t\tif err != nil {\n\t\t\tmylog.Log.WithError(err).Error(util.Trace(\"\"))\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\tmylog.Log.WithFields(logrus.Fields{\n\t\t\"size\": size,\n\t\t\"user_id\": userID.String,\n\t\t\"key\": key,\n\t}).Info(util.Trace(\"thumbnail found\"))\n\treturn s.svc.GetObject(\n\t\ts.bucket,\n\t\tobjectPath,\n\t\tminio.GetObjectOptions{},\n\t)\n}", "func (upq *UnsavedPostQuery) QueryImages() *UnsavedPostImageQuery {\n\tquery := &UnsavedPostImageQuery{config: upq.config}\n\tquery.path = func(ctx context.Context) (fromU *sql.Selector, err error) {\n\t\tif err := upq.prepareQuery(ctx); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tselector := upq.sqlQuery(ctx)\n\t\tif err := selector.Err(); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tstep := sqlgraph.NewStep(\n\t\t\tsqlgraph.From(unsavedpost.Table, unsavedpost.FieldID, selector),\n\t\t\tsqlgraph.To(unsavedpostimage.Table, unsavedpostimage.FieldID),\n\t\t\tsqlgraph.Edge(sqlgraph.O2M, false, unsavedpost.ImagesTable, unsavedpost.ImagesColumn),\n\t\t)\n\t\tfromU = sqlgraph.SetNeighbors(upq.driver.Dialect(), step)\n\t\treturn fromU, nil\n\t}\n\treturn query\n}", "func (c *UnsavedPostThumbnailClient) Delete() *UnsavedPostThumbnailDelete {\n\tmutation := newUnsavedPostThumbnailMutation(c.config, OpDelete)\n\treturn &UnsavedPostThumbnailDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *PostImageClient) Query() *PostImageQuery {\n\treturn &PostImageQuery{\n\t\tconfig: c.config,\n\t}\n}", "func (c *PostThumbnailClient) Delete() *PostThumbnailDelete {\n\tmutation := newPostThumbnailMutation(c.config, OpDelete)\n\treturn &PostThumbnailDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (d *Details) ThumbnailFile() string {\n\treturn d.Stringv(\"thumbnail\", \"file\")\n}", "func (r *ImageRef) ThumbnailWithSize(width, height int, crop Interesting, size Size) error {\n\tout, err := vipsThumbnail(r.image, width, height, crop, size)\n\tif err != nil {\n\t\treturn err\n\t}\n\tr.setImage(out)\n\treturn nil\n}", "func (i *InputInlineQueryResultAnimation) GetThumbnailMimeType() (value string) {\n\tif i == nil {\n\t\treturn\n\t}\n\treturn i.ThumbnailMimeType\n}", "func (s *Pipeline) SetThumbnailConfig(v *PipelineOutputConfig) *Pipeline {\n\ts.ThumbnailConfig = v\n\treturn s\n}", "func (c *AdminClient) QueryPosts(a *Admin) *PostQuery {\n\tquery := &PostQuery{config: c.config}\n\tquery.path = func(ctx context.Context) (fromV *sql.Selector, _ error) {\n\t\tid := a.ID\n\t\tstep := sqlgraph.NewStep(\n\t\t\tsqlgraph.From(admin.Table, admin.FieldID, id),\n\t\t\tsqlgraph.To(post.Table, post.FieldID),\n\t\t\tsqlgraph.Edge(sqlgraph.O2M, false, admin.PostsTable, admin.PostsColumn),\n\t\t)\n\t\tfromV = sqlgraph.Neighbors(a.driver.Dialect(), step)\n\t\treturn fromV, nil\n\t}\n\treturn query\n}", "func (s *UpdatePipelineInput) SetThumbnailConfig(v *PipelineOutputConfig) *UpdatePipelineInput {\n\ts.ThumbnailConfig = v\n\treturn s\n}", "func (c *UnsavedPostImageClient) Query() *UnsavedPostImageQuery {\n\treturn &UnsavedPostImageQuery{\n\t\tconfig: c.config,\n\t}\n}", "func (s *CreatePipelineInput) SetThumbnailConfig(v *PipelineOutputConfig) *CreatePipelineInput {\n\ts.ThumbnailConfig = v\n\treturn s\n}", "func (t *Thumbnail) GetImage() image.Image {\n\treturn t.image\n}", "func ExtractThumbnailFromRaw(in, out string) error {\n\tcmd := exec.Command(*DcRaw, \"-c\", \"-e\", in)\n\tvar output bytes.Buffer\n\tcmd.Stdout = &output\n\terr := cmd.Run()\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn ioutil.WriteFile(out, output.Bytes(), 0600)\n}", "func (a *ImageApiService) ImageGetPageThumbnail(ctx _context.Context, imageGetPageThumbnailParameters ImageGetPageThumbnailParameters) (ImageGetPageThumbnailResponse, *_nethttp.Response, error) {\n\tvar (\n\t\tlocalVarHTTPMethod = _nethttp.MethodPost\n\t\tlocalVarPostBody interface{}\n\t\tlocalVarFormFileName string\n\t\tlocalVarFileName string\n\t\tlocalVarFileBytes []byte\n\t\tlocalVarReturnValue ImageGetPageThumbnailResponse\n\t)\n\n\t// create path and map variables\n\tlocalVarPath := a.client.cfg.BasePath + \"/api/image/ImageGetPageThumbnail\"\n\tlocalVarHeaderParams := make(map[string]string)\n\tlocalVarQueryParams := _neturl.Values{}\n\tlocalVarFormParams := _neturl.Values{}\n\n\t// to determine the Content-Type header\n\tlocalVarHTTPContentTypes := []string{\"application/json-patch+json\", \"application/json\", \"text/json\", \"application/_*+json\"}\n\n\t// set Content-Type header\n\tlocalVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)\n\tif localVarHTTPContentType != \"\" {\n\t\tlocalVarHeaderParams[\"Content-Type\"] = localVarHTTPContentType\n\t}\n\n\t// to determine the Accept header\n\tlocalVarHTTPHeaderAccepts := []string{\"text/plain\", \"application/json\", \"text/json\"}\n\n\t// set Accept header\n\tlocalVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)\n\tif localVarHTTPHeaderAccept != \"\" {\n\t\tlocalVarHeaderParams[\"Accept\"] = localVarHTTPHeaderAccept\n\t}\n\t// body params\n\tlocalVarPostBody = &imageGetPageThumbnailParameters\n\tr, err := a.client.prepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)\n\tif err != nil {\n\t\treturn localVarReturnValue, nil, err\n\t}\n\n\tlocalVarHTTPResponse, err := a.client.callAPI(r)\n\tif err != nil || localVarHTTPResponse == nil {\n\t\treturn localVarReturnValue, localVarHTTPResponse, err\n\t}\n\n\tlocalVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body)\n\tlocalVarHTTPResponse.Body.Close()\n\tif err != nil {\n\t\treturn localVarReturnValue, localVarHTTPResponse, err\n\t}\n\n\tif localVarHTTPResponse.StatusCode >= 300 {\n\t\tnewErr := GenericOpenAPIError{\n\t\t\tbody: localVarBody,\n\t\t\terror: localVarHTTPResponse.Status,\n\t\t}\n\t\tif localVarHTTPResponse.StatusCode == 200 {\n\t\t\tvar v ImageGetPageThumbnailResponse\n\t\t\terr = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\t\t\tif err != nil {\n\t\t\t\tnewErr.error = err.Error()\n\t\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t\t}\n\t\t\tnewErr.model = v\n\t\t}\n\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t}\n\n\terr = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\tif err != nil {\n\t\tnewErr := GenericOpenAPIError{\n\t\t\tbody: localVarBody,\n\t\t\terror: err.Error(),\n\t\t}\n\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t}\n\n\treturn localVarReturnValue, localVarHTTPResponse, nil\n}", "func createThumbnail(\n\tctx context.Context,\n\tsrc types.Path,\n\timg image.Image,\n\tconfig types.ThumbnailSize,\n\tmediaMetadata *types.MediaMetadata,\n\tactiveThumbnailGeneration *types.ActiveThumbnailGeneration,\n\tmaxThumbnailGenerators int,\n\tdb storage.Database,\n\tlogger *log.Entry,\n) (busy bool, errorReturn error) {\n\tlogger = logger.WithFields(log.Fields{\n\t\t\"Width\": config.Width,\n\t\t\"Height\": config.Height,\n\t\t\"ResizeMethod\": config.ResizeMethod,\n\t})\n\n\t// Check if request is larger than original\n\tif config.Width >= img.Bounds().Dx() && config.Height >= img.Bounds().Dy() {\n\t\treturn false, nil\n\t}\n\n\tdst := GetThumbnailPath(src, config)\n\n\t// Note: getActiveThumbnailGeneration uses mutexes and conditions from activeThumbnailGeneration\n\tisActive, busy, err := getActiveThumbnailGeneration(dst, config, activeThumbnailGeneration, maxThumbnailGenerators, logger)\n\tif err != nil {\n\t\treturn false, err\n\t}\n\tif busy {\n\t\treturn true, nil\n\t}\n\n\tif isActive {\n\t\t// Note: This is an active request that MUST broadcastGeneration to wake up waiting goroutines!\n\t\t// Note: broadcastGeneration uses mutexes and conditions from activeThumbnailGeneration\n\t\tdefer func() {\n\t\t\t// Note: errorReturn is the named return variable so we wrap this in a closure to re-evaluate the arguments at defer-time\n\t\t\t// if err := recover(); err != nil {\n\t\t\t// \tbroadcastGeneration(dst, activeThumbnailGeneration, config, err.(error), logger)\n\t\t\t// \tpanic(err)\n\t\t\t// }\n\t\t\tbroadcastGeneration(dst, activeThumbnailGeneration, config, errorReturn, logger)\n\t\t}()\n\t}\n\n\texists, err := isThumbnailExists(ctx, dst, config, mediaMetadata, db, logger)\n\tif err != nil || exists {\n\t\treturn false, err\n\t}\n\n\tstart := time.Now()\n\twidth, height, err := adjustSize(dst, img, config.Width, config.Height, config.ResizeMethod == types.Crop, logger)\n\tif err != nil {\n\t\treturn false, err\n\t}\n\tlogger.WithFields(log.Fields{\n\t\t\"ActualWidth\": width,\n\t\t\"ActualHeight\": height,\n\t\t\"processTime\": time.Since(start),\n\t}).Info(\"Generated thumbnail\")\n\n\tstat, err := os.Stat(string(dst))\n\tif err != nil {\n\t\treturn false, err\n\t}\n\n\tthumbnailMetadata := &types.ThumbnailMetadata{\n\t\tMediaMetadata: &types.MediaMetadata{\n\t\t\tMediaID: mediaMetadata.MediaID,\n\t\t\tOrigin: mediaMetadata.Origin,\n\t\t\t// Note: the code currently always creates a JPEG thumbnail\n\t\t\tContentType: types.ContentType(\"image/jpeg\"),\n\t\t\tFileSizeBytes: types.FileSizeBytes(stat.Size()),\n\t\t},\n\t\tThumbnailSize: types.ThumbnailSize{\n\t\t\tWidth: config.Width,\n\t\t\tHeight: config.Height,\n\t\t\tResizeMethod: config.ResizeMethod,\n\t\t},\n\t}\n\n\terr = db.StoreThumbnail(ctx, thumbnailMetadata)\n\tif err != nil {\n\t\tlogger.WithError(err).WithFields(log.Fields{\n\t\t\t\"ActualWidth\": width,\n\t\t\t\"ActualHeight\": height,\n\t\t}).Error(\"Failed to store thumbnail metadata in database.\")\n\t\treturn false, err\n\t}\n\n\treturn false, nil\n}", "func (c *UnsavedPostThumbnailClient) Update() *UnsavedPostThumbnailUpdate {\n\tmutation := newUnsavedPostThumbnailMutation(c.config, OpUpdate)\n\treturn &UnsavedPostThumbnailUpdate{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (svc *ServiceContext) GetThumbs(c *gin.Context) {\n\tpageStr := c.Query(\"page\")\n\tconst pageSize = 50\n\tpage := 1\n\tif pageStr != \"\" {\n\t\tpageInt, err := strconv.Atoi(pageStr)\n\t\tif err == nil {\n\t\t\tpage = pageInt\n\t\t}\n\t}\n\tstart := (page - 1) * pageSize\n\n\ttype Thumb struct {\n\t\tSubmissionID int `json:\"submissionID\"`\n\t\tURL string `json:\"url\"`\n\t}\n\ttype RecentThumbs struct {\n\t\tTotal int `json:\"total\"`\n\t\tPage int `json:\"page\"`\n\t\tPageSize int `json:\"pageSize\"`\n\t\tThumbs []Thumb `json:\"thumbs\"`\n\t}\n\n\tout := RecentThumbs{Total: 0, Page: page, PageSize: pageSize}\n\n\tlog.Printf(\"INFO: get total submissions\")\n\ttq := svc.DB.NewQuery(\"select count(*) as total from submissions where public=1\")\n\ttq.One(&out)\n\n\tqs := fmt.Sprintf(`select s.id as sub_id,upload_id,submitted_at,filename from submissions s\n\t\t\tinner join submission_files f on f.submission_id = s.id where public = 1\n\t\t\tgroup by s.id order by s.id desc limit %d,%d`, start, pageSize)\n\tq := svc.DB.NewQuery(qs)\n\trows, err := q.Rows()\n\tif err != nil {\n\t\tlog.Printf(\"ERROR: Unable to get recent submissions %s\", err.Error())\n\t\tc.String(http.StatusInternalServerError, \"Unable to retrieve recent submissions\")\n\t\treturn\n\t}\n\tfor rows.Next() {\n\t\tvar fi struct {\n\t\t\tSubID int `db:\"sub_id\"`\n\t\t\tUploadID string `db:\"upload_id\"`\n\t\t\tFilename string `db:\"filename\"`\n\t\t\tSubmitted string `db:\"submitted_at\"`\n\t\t}\n\t\trows.ScanStruct(&fi)\n\t\turl := fmt.Sprintf(\"/uploads/%s\", getThumbFilename(fi.Filename))\n\t\tout.Thumbs = append(out.Thumbs, Thumb{SubmissionID: fi.SubID, URL: url})\n\t}\n\n\tc.JSON(http.StatusOK, out)\n}", "func (task *Task) DownloadThumbnail(ctx context.Context, key []byte) ([]byte, error) {\n\tvar err error\n\tif err = task.RequiredStatus(StatusTaskStarted); err != nil {\n\t\tlog.WithContext(ctx).WithField(\"status\", task.Status().String()).Error(\"Wrong task status\")\n\t\treturn nil, errors.Errorf(\"wrong status: %w\", err)\n\t}\n\n\tvar file []byte\n\t<-task.NewAction(func(ctx context.Context) error {\n\t\tbase58Key := base58.Encode(key)\n\t\tfile, err = task.p2pClient.Retrieve(ctx, base58Key)\n\t\tif err != nil {\n\t\t\terr = errors.Errorf(\"failed to fetch p2p key : %s, error: %w\", string(base58Key), err)\n\t\t\ttask.UpdateStatus(StatusKeyNotFound)\n\t\t}\n\t\treturn nil\n\t})\n\n\treturn file, err\n}", "func (m *ItemItemsDriveItemItemRequestBuilder) Thumbnails()(*ItemItemsItemThumbnailsRequestBuilder) {\n return NewItemItemsItemThumbnailsRequestBuilderInternal(m.BaseRequestBuilder.PathParameters, m.BaseRequestBuilder.RequestAdapter)\n}", "func (c ProfilesController) GetMediaThumbnail(profileName, filename string) (BinaryResponse, error) {\n\tprofile, err := c.profileProvider.GetProfile(profileName)\n\n\tif err != nil {\n\t\treturn BinaryResponse{}, err\n\t}\n\n\tthumbnail, err := c.thumbnailProvider.GetThumbnail(filepath.Join(profile.MediaPath, filename))\n\n\tif err != nil {\n\t\treturn BinaryResponse{}, err\n\t}\n\n\treturn c.BinaryResponse(\"image/png\", thumbnail), nil\n}", "func (c *PostThumbnailClient) GetX(ctx context.Context, id int) *PostThumbnail {\n\tobj, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn obj\n}", "func (c *ProductsGetCall) Thumbnails(thumbnails string) *ProductsGetCall {\n\tc.opt_[\"thumbnails\"] = thumbnails\n\treturn c\n}", "func Thumbnail(src string, dest string) (err error) {\n\texist, err := isExist(dest)\n\tif err != nil {\n\t\treturn err\n\t}\n\tif exist {\n\t\treturn nil\n\t}\n\n\timgFile, err := os.Open(src)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"can't open source file %s error: %v\", src, err)\n\t}\n\tdefer imgFile.Close()\n\n\timg, _, err := image.Decode(imgFile)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"can't decode image file %s error: %v\", imgFile.Name(), err)\n\t}\n\n\tnewImg := resize.Thumbnail(thumbnailSize, thumbnailSize, img, resize.MitchellNetravali)\n\n\ttargetFile, err := os.Create(dest)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"can't create target file %s errror: %v\", targetFile.Name(), err)\n\t}\n\tdefer targetFile.Close()\n\n\terr = jpeg.Encode(targetFile, newImg, nil)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"cant' write image to file %s, error: %v\", targetFile.Name(), err)\n\t}\n\treturn nil\n}", "func (c *PostImageClient) Get(ctx context.Context, id int) (*PostImage, error) {\n\treturn c.Query().Where(postimage.ID(id)).Only(ctx)\n}", "func NewThumbnail(hash string, image image.Image) Thumbnail {\n\treturn Thumbnail{hash: hash, image: image}\n}", "func (c *UnsavedPostClient) QueryAttachments(up *UnsavedPost) *UnsavedPostAttachmentQuery {\n\tquery := &UnsavedPostAttachmentQuery{config: c.config}\n\tquery.path = func(ctx context.Context) (fromV *sql.Selector, _ error) {\n\t\tid := up.ID\n\t\tstep := sqlgraph.NewStep(\n\t\t\tsqlgraph.From(unsavedpost.Table, unsavedpost.FieldID, id),\n\t\t\tsqlgraph.To(unsavedpostattachment.Table, unsavedpostattachment.FieldID),\n\t\t\tsqlgraph.Edge(sqlgraph.O2M, false, unsavedpost.AttachmentsTable, unsavedpost.AttachmentsColumn),\n\t\t)\n\t\tfromV = sqlgraph.Neighbors(up.driver.Dialect(), step)\n\t\treturn fromV, nil\n\t}\n\treturn query\n}", "func (c *PostAttachmentClient) Query() *PostAttachmentQuery {\n\treturn &PostAttachmentQuery{\n\t\tconfig: c.config,\n\t}\n}", "func (c *CategoryClient) QueryPosts(ca *Category) *PostQuery {\n\tquery := &PostQuery{config: c.config}\n\tquery.path = func(ctx context.Context) (fromV *sql.Selector, _ error) {\n\t\tid := ca.ID\n\t\tstep := sqlgraph.NewStep(\n\t\t\tsqlgraph.From(category.Table, category.FieldID, id),\n\t\t\tsqlgraph.To(post.Table, post.FieldID),\n\t\t\tsqlgraph.Edge(sqlgraph.O2M, false, category.PostsTable, category.PostsColumn),\n\t\t)\n\t\tfromV = sqlgraph.Neighbors(ca.driver.Dialect(), step)\n\t\treturn fromV, nil\n\t}\n\treturn query\n}", "func (c *PostClient) QueryAttachments(po *Post) *PostAttachmentQuery {\n\tquery := &PostAttachmentQuery{config: c.config}\n\tquery.path = func(ctx context.Context) (fromV *sql.Selector, _ error) {\n\t\tid := po.ID\n\t\tstep := sqlgraph.NewStep(\n\t\t\tsqlgraph.From(post.Table, post.FieldID, id),\n\t\t\tsqlgraph.To(postattachment.Table, postattachment.FieldID),\n\t\t\tsqlgraph.Edge(sqlgraph.O2M, false, post.AttachmentsTable, post.AttachmentsColumn),\n\t\t)\n\t\tfromV = sqlgraph.Neighbors(po.driver.Dialect(), step)\n\t\treturn fromV, nil\n\t}\n\treturn query\n}", "func (c *DentistClient) QueryQueue(d *Dentist) *QueueQuery {\n\tquery := &QueueQuery{config: c.config}\n\tquery.path = func(ctx context.Context) (fromV *sql.Selector, _ error) {\n\t\tid := d.ID\n\t\tstep := sqlgraph.NewStep(\n\t\t\tsqlgraph.From(dentist.Table, dentist.FieldID, id),\n\t\t\tsqlgraph.To(queue.Table, queue.FieldID),\n\t\t\tsqlgraph.Edge(sqlgraph.O2M, false, dentist.QueueTable, dentist.QueueColumn),\n\t\t)\n\t\tfromV = sqlgraph.Neighbors(d.driver.Dialect(), step)\n\t\treturn fromV, nil\n\t}\n\treturn query\n}", "func (c *PostThumbnailClient) Update() *PostThumbnailUpdate {\n\tmutation := newPostThumbnailMutation(c.config, OpUpdate)\n\treturn &PostThumbnailUpdate{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func TestGenThumbnail(t *testing.T) {\n\t// png\n\tbuf, err := generatePng()\n\tassert.Nil(t, err)\n\tout := &bytes.Buffer{}\n\terr = GenThumbnail(&buf, out)\n\tassert.Nil(t, err)\n\t// jpg\n\tbuf, err = generateJpg()\n\tassert.Nil(t, err)\n\tout = &bytes.Buffer{}\n\terr = GenThumbnail(&buf, out)\n\tassert.Nil(t, err)\n\t// bmp\n\tbuf, err = generateBmp()\n\tassert.Nil(t, err)\n\tout = &bytes.Buffer{}\n\terr = GenThumbnail(&buf, out)\n\tassert.Nil(t, err)\n}", "func (c *UnsavedPostThumbnailClient) GetX(ctx context.Context, id int) *UnsavedPostThumbnail {\n\tobj, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn obj\n}", "func (r *Restaurant) QueryImages() *ImagePathQuery {\n\treturn (&RestaurantClient{config: r.config}).QueryImages(r)\n}", "func Thumbs(subject, from string) (string, error) {\n\treturn makeRequest(\"thumbs\", subject, from)\n}", "func (s *CreateJobOutput) SetThumbnailEncryption(v *Encryption) *CreateJobOutput {\n\ts.ThumbnailEncryption = v\n\treturn s\n}", "func (cli *Client) ListThumbnailJobs(pipelineName string) (*api.ListThumbnailJobsResponse, error) {\n\treturn api.ListThumbnailJobs(cli, pipelineName)\n}", "func (c *ProductsListCall) Thumbnails(thumbnails string) *ProductsListCall {\n\tc.opt_[\"thumbnails\"] = thumbnails\n\treturn c\n}", "func (a *PDFApiService) GetPageThumbnail(ctx _context.Context, pdfGetPageThumbnailParameters PdfGetPageThumbnailParameters) (PdfGetPageThumbnailResponse, *_nethttp.Response, error) {\n\tvar (\n\t\tlocalVarHTTPMethod = _nethttp.MethodPost\n\t\tlocalVarPostBody interface{}\n\t\tlocalVarFormFileName string\n\t\tlocalVarFileName string\n\t\tlocalVarFileBytes []byte\n\t\tlocalVarReturnValue PdfGetPageThumbnailResponse\n\t)\n\n\t// create path and map variables\n\tlocalVarPath := a.client.cfg.BasePath + \"/api/pdf/GetPageThumbnail\"\n\tlocalVarHeaderParams := make(map[string]string)\n\tlocalVarQueryParams := _neturl.Values{}\n\tlocalVarFormParams := _neturl.Values{}\n\n\t// to determine the Content-Type header\n\tlocalVarHTTPContentTypes := []string{\"application/json-patch+json\", \"application/json\", \"text/json\", \"application/_*+json\"}\n\n\t// set Content-Type header\n\tlocalVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)\n\tif localVarHTTPContentType != \"\" {\n\t\tlocalVarHeaderParams[\"Content-Type\"] = localVarHTTPContentType\n\t}\n\n\t// to determine the Accept header\n\tlocalVarHTTPHeaderAccepts := []string{\"text/plain\", \"application/json\", \"text/json\"}\n\n\t// set Accept header\n\tlocalVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)\n\tif localVarHTTPHeaderAccept != \"\" {\n\t\tlocalVarHeaderParams[\"Accept\"] = localVarHTTPHeaderAccept\n\t}\n\t// body params\n\tlocalVarPostBody = &pdfGetPageThumbnailParameters\n\tr, err := a.client.prepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)\n\tif err != nil {\n\t\treturn localVarReturnValue, nil, err\n\t}\n\n\tlocalVarHTTPResponse, err := a.client.callAPI(r)\n\tif err != nil || localVarHTTPResponse == nil {\n\t\treturn localVarReturnValue, localVarHTTPResponse, err\n\t}\n\n\tlocalVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body)\n\tlocalVarHTTPResponse.Body.Close()\n\tif err != nil {\n\t\treturn localVarReturnValue, localVarHTTPResponse, err\n\t}\n\n\tif localVarHTTPResponse.StatusCode >= 300 {\n\t\tnewErr := GenericOpenAPIError{\n\t\t\tbody: localVarBody,\n\t\t\terror: localVarHTTPResponse.Status,\n\t\t}\n\t\tif localVarHTTPResponse.StatusCode == 200 {\n\t\t\tvar v PdfGetPageThumbnailResponse\n\t\t\terr = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\t\t\tif err != nil {\n\t\t\t\tnewErr.error = err.Error()\n\t\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t\t}\n\t\t\tnewErr.model = v\n\t\t}\n\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t}\n\n\terr = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\tif err != nil {\n\t\tnewErr := GenericOpenAPIError{\n\t\t\tbody: localVarBody,\n\t\t\terror: err.Error(),\n\t\t}\n\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t}\n\n\treturn localVarReturnValue, localVarHTTPResponse, nil\n}", "func (c *StickersCreateStickerSetRequest) GetThumbAsNotEmpty() (*InputDocument, bool) {\n\tif value, ok := c.GetThumb(); ok {\n\t\treturn value.AsNotEmpty()\n\t}\n\treturn nil, false\n}", "func (c *UnsavedPostAttachmentClient) Query() *UnsavedPostAttachmentQuery {\n\treturn &UnsavedPostAttachmentQuery{\n\t\tconfig: c.config,\n\t}\n}" ]
[ "0.816393", "0.7844964", "0.6592198", "0.6481279", "0.6464289", "0.6217016", "0.6147732", "0.603379", "0.5642908", "0.5635008", "0.5491919", "0.5488332", "0.5486157", "0.54767245", "0.5465385", "0.545027", "0.5415374", "0.5413915", "0.54107815", "0.540247", "0.5386766", "0.5375766", "0.53567433", "0.52739865", "0.5271826", "0.5257307", "0.5230781", "0.52246815", "0.5199699", "0.5173986", "0.51735544", "0.512537", "0.51245844", "0.51181823", "0.50921065", "0.5062333", "0.5060875", "0.5029886", "0.5021283", "0.5004381", "0.5002573", "0.4989854", "0.49874803", "0.49867946", "0.4970036", "0.49379256", "0.49202937", "0.49106315", "0.4801537", "0.4795924", "0.4794687", "0.47907323", "0.47866106", "0.4782386", "0.47633708", "0.47601518", "0.4748307", "0.47350472", "0.46860254", "0.46814", "0.46293637", "0.46067733", "0.458825", "0.4585222", "0.45609796", "0.45356044", "0.4520945", "0.4489438", "0.44450563", "0.44199502", "0.44140375", "0.4389462", "0.43762538", "0.43713033", "0.4357589", "0.43500677", "0.43463293", "0.4336753", "0.43137485", "0.43126416", "0.43041554", "0.43002623", "0.4277045", "0.4269", "0.42674568", "0.4267003", "0.4226128", "0.42209455", "0.4220842", "0.42171705", "0.42089632", "0.42044508", "0.41960183", "0.41924918", "0.418955", "0.4189054", "0.41782385", "0.4168386", "0.41384444", "0.41292262" ]
0.819149
0
QueryImages queries the images edge of a Post.
func (c *PostClient) QueryImages(po *Post) *PostImageQuery { query := &PostImageQuery{config: c.config} query.path = func(ctx context.Context) (fromV *sql.Selector, _ error) { id := po.ID step := sqlgraph.NewStep( sqlgraph.From(post.Table, post.FieldID, id), sqlgraph.To(postimage.Table, postimage.FieldID), sqlgraph.Edge(sqlgraph.O2M, false, post.ImagesTable, post.ImagesColumn), ) fromV = sqlgraph.Neighbors(po.driver.Dialect(), step) return fromV, nil } return query }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (c *UnsavedPostClient) QueryImages(up *UnsavedPost) *UnsavedPostImageQuery {\n\tquery := &UnsavedPostImageQuery{config: c.config}\n\tquery.path = func(ctx context.Context) (fromV *sql.Selector, _ error) {\n\t\tid := up.ID\n\t\tstep := sqlgraph.NewStep(\n\t\t\tsqlgraph.From(unsavedpost.Table, unsavedpost.FieldID, id),\n\t\t\tsqlgraph.To(unsavedpostimage.Table, unsavedpostimage.FieldID),\n\t\t\tsqlgraph.Edge(sqlgraph.O2M, false, unsavedpost.ImagesTable, unsavedpost.ImagesColumn),\n\t\t)\n\t\tfromV = sqlgraph.Neighbors(up.driver.Dialect(), step)\n\t\treturn fromV, nil\n\t}\n\treturn query\n}", "func (upq *UnsavedPostQuery) QueryImages() *UnsavedPostImageQuery {\n\tquery := &UnsavedPostImageQuery{config: upq.config}\n\tquery.path = func(ctx context.Context) (fromU *sql.Selector, err error) {\n\t\tif err := upq.prepareQuery(ctx); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tselector := upq.sqlQuery(ctx)\n\t\tif err := selector.Err(); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tstep := sqlgraph.NewStep(\n\t\t\tsqlgraph.From(unsavedpost.Table, unsavedpost.FieldID, selector),\n\t\t\tsqlgraph.To(unsavedpostimage.Table, unsavedpostimage.FieldID),\n\t\t\tsqlgraph.Edge(sqlgraph.O2M, false, unsavedpost.ImagesTable, unsavedpost.ImagesColumn),\n\t\t)\n\t\tfromU = sqlgraph.SetNeighbors(upq.driver.Dialect(), step)\n\t\treturn fromU, nil\n\t}\n\treturn query\n}", "func (r *Restaurant) QueryImages() *ImagePathQuery {\n\treturn (&RestaurantClient{config: r.config}).QueryImages(r)\n}", "func (t *Transaction) QueryImages() *BinaryItemQuery {\n\treturn (&TransactionClient{config: t.config}).QueryImages(t)\n}", "func (imageService Service) QueryImages(queryParameters *QueryParameters) ([]Response, error) {\n\timagesContainer := imagesResponse{}\n\terr := imageService.queryImages(false /*includeDetails*/, &imagesContainer, queryParameters)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn imagesContainer.Images, nil\n}", "func (imageService Service) QueryImages(queryParameters *QueryParameters) ([]Response, error) {\n\timagesContainer := imagesResponse{}\n\terr := imageService.queryImages(false /*includeDetails*/, &imagesContainer, queryParameters)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn imagesContainer.Images, nil\n}", "func (c *PostImageClient) QueryPost(pi *PostImage) *PostQuery {\n\tquery := &PostQuery{config: c.config}\n\tquery.path = func(ctx context.Context) (fromV *sql.Selector, _ error) {\n\t\tid := pi.ID\n\t\tstep := sqlgraph.NewStep(\n\t\t\tsqlgraph.From(postimage.Table, postimage.FieldID, id),\n\t\t\tsqlgraph.To(post.Table, post.FieldID),\n\t\t\tsqlgraph.Edge(sqlgraph.M2O, true, postimage.PostTable, postimage.PostColumn),\n\t\t)\n\t\tfromV = sqlgraph.Neighbors(pi.driver.Dialect(), step)\n\t\treturn fromV, nil\n\t}\n\treturn query\n}", "func QueryImage(filename string) []string {\n\tres, err := db.Query(\"SELECT DISTINCT labels.description FROM labels, imagelabels where imagelabels.mid = labels.mid and imagelabels.filename = ?\", filename)\n\tdefer res.Close()\n\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\treturn getFilenamesFromRes(res)\n}", "func (c *PostImageClient) Query() *PostImageQuery {\n\treturn &PostImageQuery{\n\t\tconfig: c.config,\n\t}\n}", "func (upq *UnsavedPostQuery) WithImages(opts ...func(*UnsavedPostImageQuery)) *UnsavedPostQuery {\n\tquery := &UnsavedPostImageQuery{config: upq.config}\n\tfor _, opt := range opts {\n\t\topt(query)\n\t}\n\tupq.withImages = query\n\treturn upq\n}", "func List(ctx context.Context, dbConn *db.DB, queryParams url.Values) ([]Image, error) {\n\tsqlQuery := \"SELECT * from images\"\n\tif len(queryParams) > 0 {\n\t\twhere, err := dbConn.BuildWhere(queryParams)\n\t\tif err != nil {\n\t\t\treturn nil, errors.Wrap(err, \"List\")\n\t\t}\n\t\tsqlQuery += where\n\t}\n\n\timages := make([]Image, 0)\n\trows, err := dbConn.PSQLQuerier(ctx, sqlQuery)\n\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"List\")\n\t}\n\tfor rows.Next() {\n\t\tdata := Image{}\n\t\terr := rows.StructScan(&data)\n\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\timages = append(images, data)\n\t}\n\treturn images, nil\n}", "func (imageService Service) QueryImagesDetail(queryParameters *QueryParameters) ([]DetailResponse, error) {\n\timagesDetailContainer := imagesDetailResponse{}\n\terr := imageService.queryImages(true /*includeDetails*/, &imagesDetailContainer, queryParameters)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn imagesDetailContainer.Images, nil\n}", "func (imageService Service) QueryImagesDetail(queryParameters *QueryParameters) ([]DetailResponse, error) {\n\timagesDetailContainer := imagesDetailResponse{}\n\terr := imageService.queryImages(true /*includeDetails*/, &imagesDetailContainer, queryParameters)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn imagesDetailContainer.Images, nil\n}", "func (c *PostClient) QueryThumbnail(po *Post) *PostThumbnailQuery {\n\tquery := &PostThumbnailQuery{config: c.config}\n\tquery.path = func(ctx context.Context) (fromV *sql.Selector, _ error) {\n\t\tid := po.ID\n\t\tstep := sqlgraph.NewStep(\n\t\t\tsqlgraph.From(post.Table, post.FieldID, id),\n\t\t\tsqlgraph.To(postthumbnail.Table, postthumbnail.FieldID),\n\t\t\tsqlgraph.Edge(sqlgraph.O2O, false, post.ThumbnailTable, post.ThumbnailColumn),\n\t\t)\n\t\tfromV = sqlgraph.Neighbors(po.driver.Dialect(), step)\n\t\treturn fromV, nil\n\t}\n\treturn query\n}", "func (c *PostThumbnailClient) QueryPost(pt *PostThumbnail) *PostQuery {\n\tquery := &PostQuery{config: c.config}\n\tquery.path = func(ctx context.Context) (fromV *sql.Selector, _ error) {\n\t\tid := pt.ID\n\t\tstep := sqlgraph.NewStep(\n\t\t\tsqlgraph.From(postthumbnail.Table, postthumbnail.FieldID, id),\n\t\t\tsqlgraph.To(post.Table, post.FieldID),\n\t\t\tsqlgraph.Edge(sqlgraph.O2O, true, postthumbnail.PostTable, postthumbnail.PostColumn),\n\t\t)\n\t\tfromV = sqlgraph.Neighbors(pt.driver.Dialect(), step)\n\t\treturn fromV, nil\n\t}\n\treturn query\n}", "func (c *UnsavedPostImageClient) Query() *UnsavedPostImageQuery {\n\treturn &UnsavedPostImageQuery{\n\t\tconfig: c.config,\n\t}\n}", "func (mgr *ConverterManager) ProcessImages(p *Post) {\n\timages := p.DOM.Find(\"img\")\n\tprintDot()\n\n\tif images.Length() == 0 {\n\t\treturn\n\t}\n\n\tp.Images = make([]*Image, 0)\n\n\t// iterate img elements and process them\n\timages.Each(func(i int, imgDomElement *goquery.Selection) {\n\t\timg, err := p.NewImage(imgDomElement, i)\n\t\tif err != nil {\n\t\t\tprintRedDot()\n\t\t\treturn\n\t\t}\n\t\tprintDot()\n\n\t\terr = mgr.DownloadImage(img)\n\t\tif err != nil {\n\t\t\tprintRedDot()\n\t\t\treturn\n\t\t}\n\t\tprintDot()\n\n\t\t// the suffix after # is useful for styling the image in a way similar to what medium does\n\t\timageSrcAttr := fmt.Sprintf(\"%s#%s\", img.GetHugoSource(), extractMediumImageStyle(imgDomElement))\n\t\timgDomElement.SetAttr(\"src\", imageSrcAttr)\n\t\tprintDot()\n\n\t\t// if the image is the featured image, mark it down\n\t\tif _, isFeatured := imgDomElement.Attr(\"data-is-featured\"); isFeatured {\n\t\t\tp.FeaturedImage = img.GetHugoSource()\n\t\t}\n\t\tprintDot()\n\t})\n\n\t// if no images were marked as featured, get the first image\n\tif len(p.FeaturedImage) == 0 && len(p.Images) > 0 {\n\t\tp.FeaturedImage = p.Images[0].GetHugoSource()\n\t}\n\tprintDot()\n\n\treturn\n}", "func HasImages() predicate.Product {\n\treturn predicate.Product(func(s *sql.Selector) {\n\t\tstep := sqlgraph.NewStep(\n\t\t\tsqlgraph.From(Table, FieldID),\n\t\t\tsqlgraph.To(ImagesTable, FieldID),\n\t\t\tsqlgraph.Edge(sqlgraph.O2M, false, ImagesTable, ImagesColumn),\n\t\t)\n\t\tsqlgraph.HasNeighbors(s, step)\n\t})\n}", "func (c *UnsavedPostClient) QueryThumbnail(up *UnsavedPost) *UnsavedPostThumbnailQuery {\n\tquery := &UnsavedPostThumbnailQuery{config: c.config}\n\tquery.path = func(ctx context.Context) (fromV *sql.Selector, _ error) {\n\t\tid := up.ID\n\t\tstep := sqlgraph.NewStep(\n\t\t\tsqlgraph.From(unsavedpost.Table, unsavedpost.FieldID, id),\n\t\t\tsqlgraph.To(unsavedpostthumbnail.Table, unsavedpostthumbnail.FieldID),\n\t\t\tsqlgraph.Edge(sqlgraph.O2O, false, unsavedpost.ThumbnailTable, unsavedpost.ThumbnailColumn),\n\t\t)\n\t\tfromV = sqlgraph.Neighbors(up.driver.Dialect(), step)\n\t\treturn fromV, nil\n\t}\n\treturn query\n}", "func (c *PostThumbnailClient) Query() *PostThumbnailQuery {\n\treturn &PostThumbnailQuery{\n\t\tconfig: c.config,\n\t}\n}", "func (imageService Service) Images() (image []Response, err error) {\n\treturn imageService.QueryImages(nil)\n}", "func (imageService Service) Images() (image []Response, err error) {\n\treturn imageService.QueryImages(nil)\n}", "func (s *VarlinkInterface) SearchImages(ctx context.Context, c VarlinkCall, query_ string, limit_ *int64, filter_ ImageSearchFilter) error {\n\treturn c.ReplyMethodNotImplemented(ctx, \"io.podman.SearchImages\")\n}", "func RunImagesGet(ns string, config doit.Config, out io.Writer, args []string) error {\n\tclient := config.GetGodoClient()\n\n\tif len(args) != 1 {\n\t\treturn doit.NewMissingArgsErr(ns)\n\t}\n\n\trawID := args[0]\n\n\tvar i *godo.Image\n\tvar err error\n\n\tif id, cerr := strconv.Atoi(rawID); cerr == nil {\n\t\ti, _, err = client.Images.GetByID(id)\n\t} else {\n\t\tif len(rawID) > 0 {\n\t\t\ti, _, err = client.Images.GetBySlug(rawID)\n\t\t} else {\n\t\t\terr = fmt.Errorf(\"image identifier is required\")\n\t\t}\n\t}\n\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn displayOutput(&image{images: images{*i}}, out)\n}", "func (d *DigitalOcean) Images(myImages bool) (Images, error) {\n\tv := url.Values{}\n\n\tif myImages {\n\t\tv.Set(\"filter\", \"my_images\")\n\t}\n\n\tresp, err := digitalocean.NewRequest(*d.Client, \"images\", v)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar result digitalocean.ImagesResp\n\tif err := mapstructure.Decode(resp, &result); err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn result.Images, nil\n}", "func loadImages(posts []Post, ch chan<- Post) {\n\tfor {\n\t\t// Generate pseudo-random slice index\n\t\trand.Seed(time.Now().UnixNano())\n\t\tn := rand.Intn(len(posts))\n\n\t\tpost := posts[n]\n\n\t\t// fetch the posts image (if necessary)\n\t\tif post.Image == nil {\n\t\t\tresp, err := http.Get(post.URL)\n\n\t\t\tif err != nil {\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tif resp.StatusCode == http.StatusOK {\n\t\t\t\tpost.Image = resp.Body\n\t\t\t}\n\t\t}\n\n\t\t// Push post into ch\n\t\tfmt.Printf(\"Pushing [%q, Body = %q, Image = %t] into ch\\n\", post.Title, post.Body, post.Image != nil)\n\t\tch <- post\n\t}\n}", "func (c *UnsavedPostThumbnailClient) Query() *UnsavedPostThumbnailQuery {\n\treturn &UnsavedPostThumbnailQuery{\n\t\tconfig: c.config,\n\t}\n}", "func (c *UnsavedPostClient) QueryAttachments(up *UnsavedPost) *UnsavedPostAttachmentQuery {\n\tquery := &UnsavedPostAttachmentQuery{config: c.config}\n\tquery.path = func(ctx context.Context) (fromV *sql.Selector, _ error) {\n\t\tid := up.ID\n\t\tstep := sqlgraph.NewStep(\n\t\t\tsqlgraph.From(unsavedpost.Table, unsavedpost.FieldID, id),\n\t\t\tsqlgraph.To(unsavedpostattachment.Table, unsavedpostattachment.FieldID),\n\t\t\tsqlgraph.Edge(sqlgraph.O2M, false, unsavedpost.AttachmentsTable, unsavedpost.AttachmentsColumn),\n\t\t)\n\t\tfromV = sqlgraph.Neighbors(up.driver.Dialect(), step)\n\t\treturn fromV, nil\n\t}\n\treturn query\n}", "func (c *PostClient) QueryAttachments(po *Post) *PostAttachmentQuery {\n\tquery := &PostAttachmentQuery{config: c.config}\n\tquery.path = func(ctx context.Context) (fromV *sql.Selector, _ error) {\n\t\tid := po.ID\n\t\tstep := sqlgraph.NewStep(\n\t\t\tsqlgraph.From(post.Table, post.FieldID, id),\n\t\t\tsqlgraph.To(postattachment.Table, postattachment.FieldID),\n\t\t\tsqlgraph.Edge(sqlgraph.O2M, false, post.AttachmentsTable, post.AttachmentsColumn),\n\t\t)\n\t\tfromV = sqlgraph.Neighbors(po.driver.Dialect(), step)\n\t\treturn fromV, nil\n\t}\n\treturn query\n}", "func (d *Dry) ShowImages() {\n\tif images, err := d.dockerDaemon.Images(); err == nil {\n\t\td.changeViewMode(Images)\n\t\td.images = images\n\t} else {\n\t\td.appmessage(\n\t\t\tfmt.Sprintf(\n\t\t\t\t\"Could not retrieve image list: %s \", err.Error()))\n\t}\n}", "func (upq *UnsavedPostQuery) QueryThumbnail() *UnsavedPostThumbnailQuery {\n\tquery := &UnsavedPostThumbnailQuery{config: upq.config}\n\tquery.path = func(ctx context.Context) (fromU *sql.Selector, err error) {\n\t\tif err := upq.prepareQuery(ctx); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tselector := upq.sqlQuery(ctx)\n\t\tif err := selector.Err(); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tstep := sqlgraph.NewStep(\n\t\t\tsqlgraph.From(unsavedpost.Table, unsavedpost.FieldID, selector),\n\t\t\tsqlgraph.To(unsavedpostthumbnail.Table, unsavedpostthumbnail.FieldID),\n\t\t\tsqlgraph.Edge(sqlgraph.O2O, false, unsavedpost.ThumbnailTable, unsavedpost.ThumbnailColumn),\n\t\t)\n\t\tfromU = sqlgraph.SetNeighbors(upq.driver.Dialect(), step)\n\t\treturn fromU, nil\n\t}\n\treturn query\n}", "func (in *Database) GetImages() ([]*types.Image, error) {\n\trec := []*types.Image{}\n\ttxn := in.db.Txn(false)\n\tdefer txn.Abort()\n\tit, err := txn.Get(\"image\", \"id\")\n\tif err != nil {\n\t\treturn rec, err\n\t}\n\tfor obj := it.Next(); obj != nil; obj = it.Next() {\n\t\trec = append(rec, obj.(*types.Image))\n\t}\n\treturn rec, nil\n}", "func (c *AdminClient) QueryPosts(a *Admin) *PostQuery {\n\tquery := &PostQuery{config: c.config}\n\tquery.path = func(ctx context.Context) (fromV *sql.Selector, _ error) {\n\t\tid := a.ID\n\t\tstep := sqlgraph.NewStep(\n\t\t\tsqlgraph.From(admin.Table, admin.FieldID, id),\n\t\t\tsqlgraph.To(post.Table, post.FieldID),\n\t\t\tsqlgraph.Edge(sqlgraph.O2M, false, admin.PostsTable, admin.PostsColumn),\n\t\t)\n\t\tfromV = sqlgraph.Neighbors(a.driver.Dialect(), step)\n\t\treturn fromV, nil\n\t}\n\treturn query\n}", "func GetImages(\n\tstatus string, opts model.ImageOptions, categories []string,\n) ([]model.Image, error) {\n\n\tswitch status {\n\tcase \"unprocessed\":\n\t\treturn GetUnprocessedImages(opts)\n\tcase \"uncategorized\":\n\t\treturn mongodb.GetImages(opts, nil)\n\tcase \"autocategorized\":\n\t\treturn mongodb.GetImages(opts, &model.CategoryMap{\n\t\t\tProposed: categories,\n\t\t})\n\tcase \"categorized\":\n\t\treturn mongodb.GetImages(opts, &model.CategoryMap{\n\t\t\tAssigned: categories,\n\t\t})\n\tdefault:\n\t\treturn mongodb.GetImages(opts, &model.CategoryMap{})\n\t}\n}", "func (t *TMDB) CollectionImages(id int64, params ...option) (*CollectionImages, error) {\n\tc := new(CollectionImages)\n\tif err := t.get(c, fmt.Sprintf(\"/3/collection/%d/images\", id), url.Values{}, params...); err != nil {\n\t\treturn nil, err\n\t}\n\treturn c, nil\n}", "func (c *PostImageClient) Get(ctx context.Context, id int) (*PostImage, error) {\n\treturn c.Query().Where(postimage.ID(id)).Only(ctx)\n}", "func (p *PouchMigrator) PrepareImages(ctx context.Context) error {\n\t// Get all docker containers on host.\n\tcontainers, err := p.dockerd.ContainerList()\n\tif err != nil {\n\t\treturn fmt.Errorf(\"failed to get containers list: %v\", err)\n\t}\n\tlogrus.Debugf(\"Get %d containers\", len(containers))\n\n\tfor _, c := range containers {\n\t\tmeta, err := p.dockerd.ContainerInspect(c.ID)\n\t\tif err != nil {\n\t\t\tlogrus.Errorf(\"failed to inspect container %s: %v\", c.ID, err)\n\t\t\tcontinue\n\t\t}\n\n\t\timage, err := p.dockerd.ImageInspect(meta.Image)\n\t\tif err != nil {\n\t\t\tlogrus.Errorf(\"failed to inspect image %s: %v\", meta.Image, err)\n\t\t\tcontinue\n\t\t}\n\n\t\tvar imageName string\n\t\tif len(image.RepoTags) > 0 {\n\t\t\timageName = image.RepoTags[0]\n\t\t} else if len(image.RepoDigests) > 0 {\n\t\t\timageName = image.RepoDigests[0]\n\t\t} else {\n\t\t\tlogrus.Errorf(\"failed to get image %s: repoTags is empty\", meta.Image)\n\t\t\tcontinue\n\t\t}\n\n\t\t// check image existance\n\t\t_, err = p.containerd.GetImage(ctx, imageName)\n\t\tif err == nil {\n\t\t\tlogrus.Infof(\"image %s has been downloaded, skip pull image\", imageName)\n\t\t} else {\n\t\t\tlogrus.Infof(\"Start pull image: %s\", imageName)\n\t\t\tif err := p.containerd.PullImage(ctx, imageName); err != nil {\n\t\t\t\tlogrus.Errorf(\"failed to pull image %s: %v\", imageName, err)\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tlogrus.Infof(\"End pull image: %s\", imageName)\n\t\t}\n\t}\n\n\treturn nil\n}", "func getImages(app App) []docker.APIImages {\n\tpDebug(\"Getting images %s\", app.Image)\n\timgs, _ := client.ListImages(docker.ListImagesOptions{All: false, Filter: app.Image})\n\treturn imgs\n}", "func (a *Client) Images(params *ImagesParams) (*ImagesOK, error) {\n\t// TODO: Validate the params before sending\n\tif params == nil {\n\t\tparams = NewImagesParams()\n\t}\n\n\tresult, err := a.transport.Submit(&runtime.ClientOperation{\n\t\tID: \"Images\",\n\t\tMethod: \"POST\",\n\t\tPathPattern: \"/predict/images\",\n\t\tProducesMediaTypes: []string{\"application/json\"},\n\t\tConsumesMediaTypes: []string{\"application/json\"},\n\t\tSchemes: []string{\"http\", \"https\"},\n\t\tParams: params,\n\t\tReader: &ImagesReader{formats: a.formats},\n\t\tContext: params.Context,\n\t\tClient: params.HTTPClient,\n\t})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn result.(*ImagesOK), nil\n\n}", "func (a *Client) PostImages(params *PostImagesParams, authInfo runtime.ClientAuthInfoWriter) (*PostImagesOK, error) {\n\t// TODO: Validate the params before sending\n\tif params == nil {\n\t\tparams = NewPostImagesParams()\n\t}\n\n\tresult, err := a.transport.Submit(&runtime.ClientOperation{\n\t\tID: \"PostImages\",\n\t\tMethod: \"POST\",\n\t\tPathPattern: \"/images\",\n\t\tProducesMediaTypes: []string{\"application/json\"},\n\t\tConsumesMediaTypes: []string{\"\"},\n\t\tSchemes: []string{\"https\"},\n\t\tParams: params,\n\t\tReader: &PostImagesReader{formats: a.formats},\n\t\tAuthInfo: authInfo,\n\t\tContext: params.Context,\n\t})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn result.(*PostImagesOK), nil\n\n}", "func HasImagesWith(preds ...predicate.ImagePath) predicate.Product {\n\treturn predicate.Product(func(s *sql.Selector) {\n\t\tstep := sqlgraph.NewStep(\n\t\t\tsqlgraph.From(Table, FieldID),\n\t\t\tsqlgraph.To(ImagesInverseTable, FieldID),\n\t\t\tsqlgraph.Edge(sqlgraph.O2M, false, ImagesTable, ImagesColumn),\n\t\t)\n\t\tsqlgraph.HasNeighborsWith(s, step, func(s *sql.Selector) {\n\t\t\tfor _, p := range preds {\n\t\t\t\tp(s)\n\t\t\t}\n\t\t})\n\t})\n}", "func (upq *UnsavedPostQuery) QueryAttachments() *UnsavedPostAttachmentQuery {\n\tquery := &UnsavedPostAttachmentQuery{config: upq.config}\n\tquery.path = func(ctx context.Context) (fromU *sql.Selector, err error) {\n\t\tif err := upq.prepareQuery(ctx); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tselector := upq.sqlQuery(ctx)\n\t\tif err := selector.Err(); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tstep := sqlgraph.NewStep(\n\t\t\tsqlgraph.From(unsavedpost.Table, unsavedpost.FieldID, selector),\n\t\t\tsqlgraph.To(unsavedpostattachment.Table, unsavedpostattachment.FieldID),\n\t\t\tsqlgraph.Edge(sqlgraph.O2M, false, unsavedpost.AttachmentsTable, unsavedpost.AttachmentsColumn),\n\t\t)\n\t\tfromU = sqlgraph.SetNeighbors(upq.driver.Dialect(), step)\n\t\treturn fromU, nil\n\t}\n\treturn query\n}", "func (c *CategoryClient) QueryPosts(ca *Category) *PostQuery {\n\tquery := &PostQuery{config: c.config}\n\tquery.path = func(ctx context.Context) (fromV *sql.Selector, _ error) {\n\t\tid := ca.ID\n\t\tstep := sqlgraph.NewStep(\n\t\t\tsqlgraph.From(category.Table, category.FieldID, id),\n\t\t\tsqlgraph.To(post.Table, post.FieldID),\n\t\t\tsqlgraph.Edge(sqlgraph.O2M, false, category.PostsTable, category.PostsColumn),\n\t\t)\n\t\tfromV = sqlgraph.Neighbors(ca.driver.Dialect(), step)\n\t\treturn fromV, nil\n\t}\n\treturn query\n}", "func (bm *BingManager) queryNewImageUrl(query string) (string, error) {\n var Query *url.URL\n Query, err := url.Parse(\"https://api.datamarket.azure.com/Bing/Search/Image\")\n if err != nil {\n\t\treturn \"\", err\n }\n parameters := url.Values{}\n parameters.Add(\"ImageFilters\", \"'Aspect:Square'\")\n parameters.Add(\"$format\", \"json\")\n parameters.Add(\"Adult\", \"'Moderate'\")\n parameters.Add(\"$top\", \"1\")\n parameters.Add(\"Query\", fmt.Sprintf(\"'%s'\", query))\n \n Query.RawQuery = parameters.Encode()\n\n\n\treq, err := http.NewRequest(\"GET\", Query.String(), nil)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\treq.SetBasicAuth(bm.AccountKey, bm.AccountKey)\n\n\tresp, err := bm.HTTPClient.Do(req)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\tbody, err := ioutil.ReadAll(resp.Body)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n \n\tvar m struct {\n\t\tD struct {\n\t\t\tResults []struct {\n\t\t\t\tMediaUrl string `json:\"MediaUrl\"`\n Thumbnail struct {\n Url string `json:\"MediaUrl\"`\n } `json:\"Thumbnail\"`\n\t\t\t} `json:\"results\"`\n\t\t} `json:\"d\"`\n\t}\n\n\terr = json.Unmarshal(body, &m)\n\tif err != nil {\n\t\tfmt.Println(err)\n\t\treturn \"\", err\n\t}\n\treturn m.D.Results[0].Thumbnail.Url, err\n}", "func (fc *FacebookClient) GetImageUrlsFromPostId(postId string) []ImageInfo {\n\turl := fmt.Sprintf(fc.attachmentUrl, postId) + \"?access_token=\" + fc.accessToken\n\tclient := &http.Client{}\n\treq, _ := http.NewRequest(\"GET\", url, nil)\n\tresp, err := client.Do(req)\n\n\t// TLS handshake timeout\n\tif err != nil {\n\t\tlog.Print(err)\n\t\treturn make([]ImageInfo, 0)\n\t}\n\tdefer resp.Body.Close()\n\tbody, _ := ioutil.ReadAll(resp.Body)\n\n\t// Unmarshall response\n\tatt := new(AttachmentResponse)\n\tjson.Unmarshal(body, &att)\n\tret := make([]ImageInfo, 0)\n\tfor _, data := range att.Data {\n\t\t// Since missing values get unmarshalled into their type's 0'd value, make sure the src exists before we make an ImageInfo struct\n\t\tif len(data.Media.Image.Src) > 0 {\n\t\t\tinfo := ImageInfo{}\n\t\t\tinfo.Url = data.Media.Image.Src\n\t\t\tinfo.Id = data.Target.Id\n\t\t\tret = append(ret, info)\n\t\t}\n\t}\n\treturn ret\n}", "func (p Pipeline) PullImages(force bool) error {\n\tif Verbose {\n\t\tpipelineLogger.Printf(\"Pull Images:\")\n\t}\n\tcount, elapsedTime, totalElapsedTime, err := p.runCommand(runConfig{\n\t\tselection: func(step Step) bool {\n\t\t\treturn step.IsPullable()\n\t\t},\n\t\trun: func(runner Runner, step Step) func() error {\n\t\t\treturn func() error {\n\t\t\t\tif err := runner.ImageExistenceChecker(step)(); err != nil || force {\n\t\t\t\t\treturn runner.ImagePuller(step)()\n\t\t\t\t}\n\t\t\t\treturn nil\n\t\t\t}\n\t\t},\n\t})\n\tif Verbose {\n\t\tpipelineLogger.Printf(\"Pulled %d images in %s\", count, elapsedTime)\n\t\tpipelineLogger.Printf(\"Total time spent pulling images: %s\", totalElapsedTime)\n\t}\n\treturn err\n}", "func (r *PostReprGQL) IMG(ctx context.Context) *ImageReprGQL {\n\treturn &ImageReprGQL{}\n}", "func Image(imageName string) (ImageData, error) {\n\t// Formulating query\n\tquery, err := json.Marshal(\n\t\tGraphQLQuery{\n\t\t\tQuery: `\n\t\t\tquery($image: String!) {\n\t\t\t\timage(name: $image) {\n\t\t\t\t\turl\n\t\t\t\t\tvariables {\n\t\t\t\t\t\tname\n\t\t\t\t\t\tdescription\n\t\t\t\t\t\tdefault\n\t\t\t\t\t\trequired\n\t\t\t\t\t\tuncommon\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t`,\n\t\t\tVariables: map[string]interface{}{\n\t\t\t\t\"image\": imageName,\n\t\t\t},\n\t\t},\n\t)\n\tif err != nil {\n\t\treturn ImageData{}, err\n\t}\n\n\t// Make the query\n\tresp, err := http.Post(\n\t\t\"https://dockerenv.calebden.io/graphql\",\n\t\t\"application/json\",\n\t\tbytes.NewBuffer(query),\n\t)\n\tif err != nil {\n\t\treturn ImageData{}, err\n\t}\n\tdefer resp.Body.Close()\n\tif resp.StatusCode != http.StatusOK {\n\t\treturn ImageData{}, fmt.Errorf(\n\t\t\t\"Failed to get data for %v. Returned status code of %v\",\n\t\t\timageName,\n\t\t\tresp.Status,\n\t\t)\n\t}\n\n\t// Parsing the response\n\trawData, err := io.ReadAll(resp.Body)\n\tif err != nil {\n\t\treturn ImageData{}, err\n\t}\n\tvar data rawImageData\n\terr = json.Unmarshal(rawData, &data)\n\tif err != nil {\n\t\treturn ImageData{}, err\n\t}\n\tif len(data.Errors) != 0 {\n\t\treturn ImageData{}, fmt.Errorf(\n\t\t\t\"Failed to get data for %v as the following error occurred:\\n%v\",\n\t\t\timageName,\n\t\t\tdata.Errors[0].Message,\n\t\t)\n\t}\n\n\treturn data.Data.Image.ImageData, nil\n}", "func Pictures(exec boil.Executor, mods ...qm.QueryMod) pictureQuery {\n\tmods = append(mods, qm.From(\"`pictures`\"))\n\treturn pictureQuery{NewQuery(exec, mods...)}\n}", "func (p *OnPrem) GetImages(ctx *Context) ([]CloudImage, error) {\n\treturn nil, errors.New(\"un-implemented\")\n}", "func (c *PostAttachmentClient) QueryPost(pa *PostAttachment) *PostQuery {\n\tquery := &PostQuery{config: c.config}\n\tquery.path = func(ctx context.Context) (fromV *sql.Selector, _ error) {\n\t\tid := pa.ID\n\t\tstep := sqlgraph.NewStep(\n\t\t\tsqlgraph.From(postattachment.Table, postattachment.FieldID, id),\n\t\t\tsqlgraph.To(post.Table, post.FieldID),\n\t\t\tsqlgraph.Edge(sqlgraph.M2O, true, postattachment.PostTable, postattachment.PostColumn),\n\t\t)\n\t\tfromV = sqlgraph.Neighbors(pa.driver.Dialect(), step)\n\t\treturn fromV, nil\n\t}\n\treturn query\n}", "func SearchImage(w http.ResponseWriter, r *http.Request) {\n\n\t// add cors support\n\thelpers.SetupResponse(&w, r)\n\tif r.Method == \"OPTIONS\" {\n\t\tw.WriteHeader(http.StatusOK)\n\t\treturn\n\t}\n\n\tw.Header().Set(\"content-type\", \"application/json\")\n\n\tif (*r).Method == \"GET\" {\n\n\t\tid_available := false\n\t\tid, _, err := auth.ExtractUserIDEmail(r)\n\n\t\tif err == nil {\n\t\t\tid_available = true\n\t\t}\n\n\t\tnew_id, _ := primitive.ObjectIDFromHex(id)\n\n\t\tquery := bson.M{}\n\t\tcollection, err := helpers.GetDBCollection(\"images\")\n\t\tvar query_result primitive.M\n\t\t//check for filtering\n\t\ttext, text_exists := r.URL.Query()[\"text\"]\n\t\tcharacteristics, characteristics_exists := r.URL.Query()[\"characteristics\"]\n\t\timage_id, id_eixsts := r.URL.Query()[\"id\"]\n\n\t\tif id_eixsts && len(image_id[0]) > 1 { //check similar images of a specified image\n\n\t\t\tid, _ := primitive.ObjectIDFromHex(image_id[0])\n\n\t\t\terr = collection.FindOne(context.TODO(), bson.D{{\"_id\", id}}).Decode(&query_result)\n\n\t\t\tif err != nil {\n\t\t\t\tlogger.Log(err)\n\t\t\t\thttp.Error(w, fmt.Sprintf(`{\"status\":\"error\",\"error\":true,\"msg\":\"%s\"}`, \"image with that id not found\"), 404)\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tquery[\"type\"] = query_result[\"type\"]\n\n\t\t}\n\n\t\tif text_exists && len(text[0]) > 1 { //if image text is supplied do a check\n\t\t\tquery[\"text\"] = primitive.Regex{Pattern: text[0], Options: \"i\"}\n\t\t}\n\n\t\timageList := make([]models.Image, 0)\n\t\tctx, _ := context.WithTimeout(context.Background(), 30*time.Second)\n\n\t\tif err != nil {\n\t\t\tlog.Println(err)\n\t\t\thttp.Error(w, fmt.Sprintf(`{\"status\":\"error\",\"error\":true,\"msg\":\"%s\"}`, \"couldn't connect to the mongo collection\"), 500)\n\t\t\treturn\n\t\t}\n\n\t\tfindOptions := options.Find()\n\t\tfindOptions.SetSort(bson.D{{\"createdat\", -1}})\n\t\tcursor, err := collection.Find(context.TODO(), query, findOptions)\n\n\t\tfor cursor.Next(ctx) {\n\t\t\t// Declare a result BSON object\n\t\t\tvar image models.Image\n\n\t\t\t//var cover models.Cover\n\t\t\terr := cursor.Decode(&image)\n\t\t\tif err != nil {\n\t\t\t\tlogger.Log(err)\n\t\t\t\thttp.Error(w, fmt.Sprintf(`{\"status\":\"error\",\"error\":true,\"msg\":\"%s\"}`, \"error occured while getting a image\"), 500)\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tif image.Type == \"private\" { //means a authenticated user is making a search, so lets show him images that are privately owned by him/her\n\t\t\t\tif !id_available && image.UserID != new_id { //check if the user owns the image\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t}\n\n\t\t\timage.Image = \"https://imgrepo-test.s3.eu-west-2.amazonaws.com/\" + image.Image\n\n\t\t\tif characteristics_exists && len(characteristics[0]) > 1 { //if characteristics are supplied, then do a check\n\t\t\t\tfor i := range characteristics {\n\t\t\t\t\tif contains(image.Characteristics, characteristics[i]) { //check if this particular image contains any of the characteristics requested for.\n\t\t\t\t\t\timageList = append(imageList, image)\n\t\t\t\t\t\tbreak\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\timageList = append(imageList, image)\n\t\t\t}\n\n\t\t}\n\n\t\tjson.NewEncoder(w).Encode(models.Response{\n\t\t\tStatus: \"success\",\n\t\t\tError: false,\n\t\t\tData: models.DataResponse{\n\t\t\t\t\"images\": imageList,\n\t\t\t},\n\t\t})\n\t\treturn\n\n\t}\n\thttp.Error(w, fmt.Sprintf(`{\"status\":\"error\",\"error\":true,\"msg\":\"%s\"}`, \"method not allowed\"), 400)\n\treturn\n}", "func (e *Education) GetImages(ctx context.Context, entities Educations) {\n\t// Get a map of all img keys in my educations\n\timgs := make(map[int64]*datastore.Key)\n\n\tfor _, v := range entities {\n\t\tif _, ok := imgs[v.ImageKey.IntID()]; !ok {\n\t\t\timgs[v.ImageKey.IntID()] = v.ImageKey\n\t\t}\n\t}\n\n\t// Get all Images\n\torderedImgs := GetOrderedImgs(ctx, imgs)\n\n\t// Set Image to each edu\n\tfor i := 0; i < len(entities); i++ {\n\t\tentities[i].Image = orderedImgs[entities[i].ImageKey.IntID()]\n\t}\n}", "func (upu *UnsavedPostUpdate) ClearImages() *UnsavedPostUpdate {\n\tupu.mutation.ClearImages()\n\treturn upu\n}", "func Get(query string, size string, numPages int) {\n\n\tfor i := 1; i <= numPages; i++ {\n\t\turl := fmt.Sprintf(\"https://wallhaven.cc/search?q=%s&categories=101&purity=110&resolutions=%s&sorting=relevance&order=desc\", query, size)\n\t\tcolorlog.Debug(\"URL: %s\", url)\n\t\tresp, _ := soup.Get(url)\n\t\tdoc := soup.HTMLParse(resp)\n\t\tpics := doc.FindAll(\"a\", \"class\", \"preview\")\n\t\tfor _, p := range pics {\n\t\t\timgPath := p.Attrs()[\"href\"]\n\t\t\timgResp, _ := soup.Get(imgPath)\n\t\t\timgDoc := soup.HTMLParse(imgResp)\n\t\t\tif imgDoc.Find(\"img\", \"id\", \"wallpaper\").Error == nil {\n\t\t\t\tdlPath := imgDoc.Find(\"img\", \"id\", \"wallpaper\").Attrs()[\"src\"]\n\t\t\t\tpathsl := strings.Split(dlPath, \"/\")\n\t\t\t\tfilename := pathsl[len(pathsl)-1]\n\t\t\t\tcolorlog.Debug(\"Downloading %s...\", filename)\n\t\t\t\terr := helferlein.DownloadFile(dlPath, filename)\n\t\t\t\tif err != nil {\n\t\t\t\t\tcolorlog.Error(err.Error())\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tcolorlog.Fatal(\"Error: reading %s\", imgPath)\n\t\t\t}\n\t\t}\n\t}\n}", "func GetImages(w http.ResponseWriter, r *http.Request) {\n\ttools.SetHeader(w)\n\tif r.Method != \"GET\" {\n\t\treturn\n\t}\n\tvars := r.URL.Query()\n\tname := vars[\"name\"][0]\n\tfmt.Println(name)\n\t//find the images and return []byte\n\tfilepath := imgpath + name\n\ttemp, err := ioutil.ReadFile(filepath)\n\tif err != nil {\n\t\ttools.HandleError(\"GetImages readfile error :\", err, 1)\n\t\treturn\n\t}\n\tw.Write(temp)\n\treturn\n}", "func (a *Client) ImagesStream(params *ImagesStreamParams) (*ImagesStreamOK, error) {\n\t// TODO: Validate the params before sending\n\tif params == nil {\n\t\tparams = NewImagesStreamParams()\n\t}\n\n\tresult, err := a.transport.Submit(&runtime.ClientOperation{\n\t\tID: \"ImagesStream\",\n\t\tMethod: \"POST\",\n\t\tPathPattern: \"/predict/stream/images\",\n\t\tProducesMediaTypes: []string{\"application/json\"},\n\t\tConsumesMediaTypes: []string{\"application/json\"},\n\t\tSchemes: []string{\"http\", \"https\"},\n\t\tParams: params,\n\t\tReader: &ImagesStreamReader{formats: a.formats},\n\t\tContext: params.Context,\n\t\tClient: params.HTTPClient,\n\t})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn result.(*ImagesStreamOK), nil\n\n}", "func (d *Docker) Images(opt types.ImageListOptions) ([]types.ImageSummary, error) {\n\treturn d.ImageList(context.TODO(), opt)\n}", "func (ec *executionContext) field_Query_BaseImageList_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) {\n\tvar err error\n\targs := map[string]interface{}{}\n\tvar arg0 string\n\tif tmp, ok := rawArgs[\"image\"]; ok {\n\t\tctx := graphql.WithPathContext(ctx, graphql.NewPathWithField(\"image\"))\n\t\targ0, err = ec.unmarshalNString2string(ctx, tmp)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\targs[\"image\"] = arg0\n\tvar arg1 *string\n\tif tmp, ok := rawArgs[\"digest\"]; ok {\n\t\tctx := graphql.WithPathContext(ctx, graphql.NewPathWithField(\"digest\"))\n\t\targ1, err = ec.unmarshalOString2ᚖstring(ctx, tmp)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\targs[\"digest\"] = arg1\n\tvar arg2 *PageInput\n\tif tmp, ok := rawArgs[\"requestedPage\"]; ok {\n\t\tctx := graphql.WithPathContext(ctx, graphql.NewPathWithField(\"requestedPage\"))\n\t\targ2, err = ec.unmarshalOPageInput2ᚖzotregistryᚗioᚋzotᚋpkgᚋextensionsᚋsearchᚋgql_generatedᚐPageInput(ctx, tmp)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\targs[\"requestedPage\"] = arg2\n\treturn args, nil\n}", "func GetImages(ctx *pulumi.Context, args *GetImagesArgs, opts ...pulumi.InvokeOption) (*GetImagesResult, error) {\n\topts = internal.PkgInvokeDefaultOpts(opts)\n\tvar rv GetImagesResult\n\terr := ctx.Invoke(\"alicloud:simpleapplicationserver/getImages:getImages\", args, &rv, opts...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &rv, nil\n}", "func (u *User) QueryPosts() *ExperienceQuery {\n\treturn (&UserClient{config: u.config}).QueryPosts(u)\n}", "func (s *VarlinkInterface) ImagesPrune(ctx context.Context, c VarlinkCall, all_ bool) error {\n\treturn c.ReplyMethodNotImplemented(ctx, \"io.podman.ImagesPrune\")\n}", "func (h *Handler) GetImages(w http.ResponseWriter, r *http.Request) {\n\t// first list all the pools so that we can retrieve images from all pools\n\tpools, err := ceph.ListPoolSummaries(h.context, h.config.clusterInfo.Name)\n\tif err != nil {\n\t\tlogger.Errorf(\"failed to list pools: %+v\", err)\n\t\tw.WriteHeader(http.StatusInternalServerError)\n\t\treturn\n\t}\n\n\tresult := []model.BlockImage{}\n\n\t// for each pool, get further details about all the images in the pool\n\tfor _, p := range pools {\n\t\timages, ok := h.getImagesForPool(w, p.Name)\n\t\tif !ok {\n\t\t\treturn\n\t\t}\n\n\t\tresult = append(result, images...)\n\t}\n\n\tFormatJsonResponse(w, result)\n}", "func (p *PodmanTestIntegration) PullImages(images []string) error {\n\t// TODO\n\treturn libpod.ErrNotImplemented\n}", "func (client Client) Image(parameters Parameters) (ImageResultContainer, error) {\n\tvar result imageResultWrapper\n\n\tif err := client.search(parameters.GetURI(SearchTypeImage), &result); err != nil {\n\t\treturn ImageResultContainer{}, err\n\t}\n\n\treturn result.Data, nil\n}", "func (p *parser) GetPictures(a *goquery.Selection) []string {\n\tv := picture{area: a, cleanImg: p.cleanImg}\n\tv.setDetail()\n\treturn v.data\n}", "func (cli *Client) ImageList(ctx context.Context, options types.ImageListOptions) ([]types.Image, error) {\n\tvar images []types.Image\n\tquery := url.Values{}\n\n\tif options.Filters.Len() > 0 {\n\t\tfilterJSON, err := filters.ToParam(options.Filters)\n\t\tif err != nil {\n\t\t\treturn images, err\n\t\t}\n\t\tquery.Set(\"filters\", filterJSON)\n\t}\n\tif options.MatchName != \"\" {\n\t\t// FIXME rename this parameter, to not be confused with the filters flag\n\t\tquery.Set(\"filter\", options.MatchName)\n\t}\n\tif options.All {\n\t\tquery.Set(\"all\", \"1\")\n\t}\n\n\tserverResp, err := cli.get(ctx, \"/images/json\", query, nil)\n\tif err != nil {\n\t\treturn images, err\n\t}\n\n\terr = json.NewDecoder(serverResp.body).Decode(&images)\n\tensureReaderClosed(serverResp)\n\treturn images, err\n}", "func posts(w http.ResponseWriter, r *http.Request, _ httprouter.Params) {\n\tdb, err := db()\n\tif err != nil {\n\t\tlog.Println(\"Database was not properly opened\")\n\t\tsendErr(w, err, \"Database was not properly opened\", http.StatusInternalServerError)\n\t\treturn\n\t}\n\n\trows, err := db.Query(`\nSELECT p.id, p.name, p.content, p.permalink, p.visible, p.created_at, IFNULL(likes.likes, 0), p.cover\nFROM post p LEFT OUTER JOIN (SELECT post_id, COUNT(ip) AS likes\n FROM liker\n GROUP BY post_id) likes ON p.id = likes.post_id\nORDER BY created_at;\n\t`)\n\tif err != nil {\n\t\tlog.Println(\"Error in statement\")\n\t\tsendErr(w, err, \"Error in query blog\", http.StatusInternalServerError)\n\t\treturn\n\t}\n\n\tvar posts []Post\n\tfor rows.Next() {\n\t\tvar post Post\n\t\t// getting a post\n\t\tvar coverID sql.NullInt64\n\t\terr = rows.Scan(&post.ID, &post.Name, &post.Content, &post.Permalink,\n\t\t\t&post.Visible, &post.CreatedAt, &post.Likes, &coverID)\n\t\tif err != nil {\n\t\t\tlog.Println(\"Error while scanning at home handler\")\n\t\t\tsendErr(w, err, \"Error while scanning blog\", http.StatusInternalServerError)\n\t\t\treturn\n\t\t}\n\t\t// Adding a cover if neded\n\t\tif coverID.Valid {\n\t\t\trow := db.QueryRow(`\nSELECT id, url\nFROM image\nWHERE id = ?\n`, coverID)\n\t\t\tvar image Image\n\t\t\terr := row.Scan(&image.ID, &image.Url)\n\t\t\tif err != nil {\n\t\t\t\tsendErr(w, err, \"Error while trying to get an image for a post\", http.StatusInternalServerError)\n\t\t\t\treturn\n\t\t\t}\n\t\t\tpost.Cover = image\n\t\t}\n\n\t\t// Adding tags\n\t\ttagRows, err := db.Query(`\nSELECT t.id, t.name \nFROM post_tag pt INNER JOIN tag t ON pt.tag_id = t.id\nWHERE pt.post_id = ?;\n\t\t`, post.ID)\n\t\tif err != nil {\n\t\t\tlog.Println(\"Error while scanning at home handler\")\n\t\t\tsendErr(w, err, \"Error while scanning blog\", http.StatusInternalServerError)\n\t\t\treturn\n\t\t}\n\t\tvar tagsIDs []string\n\t\tvar tags []Tag\n\t\tfor tagRows.Next() {\n\t\t\tvar tag Tag\n\t\t\ttagRows.Scan(&tag.ID, &tag.Name)\n\t\t\ttags = append(tags, tag)\n\t\t\ttagsIDs = append(tagsIDs, tag.ID)\n\t\t}\n\t\tpost.TagsIDs = tagsIDs\n\t\tpost.Tags = tags\n\t\t// Append to []Post\n\t\tposts = append(posts, post)\n\t}\n\tdb.Close()\n\tjsn, err := jsonapi.Marshal(posts)\n\tsend(w, jsn)\n}", "func GetImages(w http.ResponseWriter, r *http.Request) {\n\n\t//Get Formdata\n\tqueryVar := mux.Vars(r)\n\tlastrecordedtime := queryVar[\"[0-9]+\"]\n\n\t//Get ImageIDs\n\timageIDs, err := model.GetImageIDs(lastrecordedtime)\n\tif err != nil {\n\n\t\tw.WriteHeader(http.StatusInternalServerError)\n\t\tw.Write([]byte(err.Error()))\n\t\treturn\n\n\t}\n\n\t//Make Response Model\n\tresponseModel := struct {\n\t\tImagesIDs []string\n\t}{\n\t\tImagesIDs: imageIDs,\n\t}\n\n\t//Make ResponeJSON\n\tresponseJSON, err := json.Marshal(responseModel)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\t//Write response\n\tw.Header().Set(\"Content-Type\", \"application/json; charset=UTF-8\")\n\tw.WriteHeader(http.StatusOK)\n\tw.Write(responseJSON)\n\n}", "func (bm *BingManager) getImageUrls(query string) []string {\n\tfmt.Println(query)\n\tfields := strings.Fields(query)\n\tresults := []string{}\n\tfor _, el := range fields {\n\t\tval, err := bm.getImageUrl(el)\n\n\t\tif err != nil {\n\t\t\tfmt.Println(err)\n\t\t\tcontinue\n\t\t} else if val != \"\" {\n\t\t\tresults = append(results, val)\n\t\t}\n\t}\n\n\treturn results\n}", "func RunImagesUpdate(ns string, config doit.Config, out io.Writer, args []string) error {\n\tclient := config.GetGodoClient()\n\n\tif len(args) != 1 {\n\t\treturn doit.NewMissingArgsErr(ns)\n\t}\n\n\tid, err := strconv.Atoi(args[0])\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tname, err := config.GetString(ns, doit.ArgImageName)\n\n\treq := &godo.ImageUpdateRequest{\n\t\tName: name,\n\t}\n\n\ti, _, err := client.Images.Update(id, req)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn displayOutput(&image{images: images{*i}}, out)\n}", "func (c *Category) QueryPosts() *PostQuery {\n\treturn (&CategoryClient{config: c.config}).QueryPosts(c)\n}", "func (c *UnsavedPostImageClient) QueryUnsavedPost(upi *UnsavedPostImage) *UnsavedPostQuery {\n\tquery := &UnsavedPostQuery{config: c.config}\n\tquery.path = func(ctx context.Context) (fromV *sql.Selector, _ error) {\n\t\tid := upi.ID\n\t\tstep := sqlgraph.NewStep(\n\t\t\tsqlgraph.From(unsavedpostimage.Table, unsavedpostimage.FieldID, id),\n\t\t\tsqlgraph.To(unsavedpost.Table, unsavedpost.FieldID),\n\t\t\tsqlgraph.Edge(sqlgraph.M2O, true, unsavedpostimage.UnsavedPostTable, unsavedpostimage.UnsavedPostColumn),\n\t\t)\n\t\tfromV = sqlgraph.Neighbors(upi.driver.Dialect(), step)\n\t\treturn fromV, nil\n\t}\n\treturn query\n}", "func (upuo *UnsavedPostUpdateOne) ClearImages() *UnsavedPostUpdateOne {\n\tupuo.mutation.ClearImages()\n\treturn upuo\n}", "func GetImageByClothesId(c * gin.Context){\n\tdb := database.DBConn()\n\trows, err := db.Query(\"SELECT * FROM images where clothesId = \"+c.Param(\"id\"))\n\tif err != nil{\n\t\tc.JSON(500, gin.H{\n\t\t\t\"messages\" : \"Story not found\",\n\t\t});\n\t}\n\tpost := DTO.ImageDTO{}\n\tlist := [] DTO.ImageDTO{}\n\tfor rows.Next(){\n\t\tvar id, clothesId int\n\t\tvar link string\n\t\terr = rows.Scan(&id, &link, &clothesId)\n\t\tif err != nil {\n\t\t\tpanic(err.Error())\n\t\t}\n\t\tpost.Id = id\n\t\tpost.ClothesId = clothesId\n\t\tpost.Link = link\n\t\tlist = append(list,post)\n\t}\n\tc.JSON(200, list)\n\tdefer db.Close()\n}", "func (i *ImageService) CountImages() int {\n\timgs, err := i.client.ListImages(context.TODO())\n\tif err != nil {\n\t\treturn 0\n\t}\n\n\treturn len(imgs)\n}", "func getImages() ([]types.ImageSummary, error) {\n\timages, err := client.ImageList(context.Background(), types.ImageListOptions{})\n\tif err != nil {\n\t\treturn []types.ImageSummary{}, err\n\t}\n\treturn images, nil\n}", "func (c *Container) Images() []*image.Image {\n\tvar images []*image.Image\n\tif c.image != nil {\n\t\timages = c.image.Images()\n\t}\n\treturn images\n}", "func ListImage(cli bce.Client, queryArgs *ListImageArgs) (*ListImageResult, error) {\n\t// Build the request\n\treq := &bce.BceRequest{}\n\treq.SetUri(getImageUri())\n\treq.SetMethod(http.GET)\n\n\tif queryArgs != nil {\n\t\tif len(queryArgs.Marker) != 0 {\n\t\t\treq.SetParam(\"marker\", queryArgs.Marker)\n\t\t}\n\t\tif queryArgs.MaxKeys != 0 {\n\t\t\treq.SetParam(\"maxKeys\", strconv.Itoa(queryArgs.MaxKeys))\n\t\t}\n\t\tif len(queryArgs.ImageName) != 0 {\n\t\t\tif len(queryArgs.ImageType) != 0 && strings.EqualFold(\"custom\", queryArgs.ImageType) {\n\t\t\t\treq.SetParam(\"imageName\", queryArgs.ImageName)\n\t\t\t} else {\n\t\t\t\treturn nil, errors.New(\"only the custom image type could filter by name\")\n\t\t\t}\n\t\t}\n\t\tif len(queryArgs.ImageType) != 0 {\n\t\t\treq.SetParam(\"imageType\", queryArgs.ImageType)\n\t\t}\n\t}\n\n\tif queryArgs == nil || queryArgs.MaxKeys == 0 {\n\t\treq.SetParam(\"maxKeys\", \"1000\")\n\t}\n\n\t// Send request and get response\n\tresp := &bce.BceResponse{}\n\tif err := cli.SendRequest(req, resp); err != nil {\n\t\treturn nil, err\n\t}\n\tif resp.IsFail() {\n\t\treturn nil, resp.ServiceError()\n\t}\n\n\tjsonBody := &ListImageResult{}\n\tif err := resp.ParseJsonBody(jsonBody); err != nil {\n\t\treturn nil, err\n\t}\n\treturn jsonBody, nil\n}", "func Images() *cobra.Command {\n\tcmd := &cobra.Command{\n\t\tUse: \"image\",\n\t\tShort: \"image commands\",\n\t\tLong: \"image commands\",\n\t}\n\n\tout := os.Stdout\n\n\tcmdImagesList := cmdBuilder(RunImagesList, \"list\", \"list images\", out)\n\tcmd.AddCommand(cmdImagesList)\n\taddBoolFlag(cmdImagesList, doit.ArgImagePublic, false, \"List public images\")\n\n\tcmdImagesListDistribution := cmdBuilder(RunImagesListDistribution,\n\t\t\"list-distribution\", \"list distribution images\", out)\n\tcmd.AddCommand(cmdImagesListDistribution)\n\taddBoolFlag(cmdImagesListDistribution, doit.ArgImagePublic, false, \"List public images\")\n\n\tcmdImagesListApplication := cmdBuilder(RunImagesListApplication,\n\t\t\"list-application\", \"list application images\", out)\n\tcmd.AddCommand(cmdImagesListApplication)\n\taddBoolFlag(cmdImagesListApplication, doit.ArgImagePublic, false, \"List public images\")\n\n\tcmdImagesListUser := cmdBuilder(RunImagesListDistribution,\n\t\t\"list-user\", \"list user images\", out)\n\tcmd.AddCommand(cmdImagesListUser)\n\taddBoolFlag(cmdImagesListUser, doit.ArgImagePublic, false, \"List public images\")\n\n\tcmdImagesGet := cmdBuilder(RunImagesGet, \"get <image-id|image-slug>\", \"Get image\", out)\n\tcmd.AddCommand(cmdImagesGet)\n\n\tcmdImagesUpdate := cmdBuilder(RunImagesUpdate, \"update <image-id>\", \"Update image\", out)\n\tcmd.AddCommand(cmdImagesUpdate)\n\taddStringFlag(cmdImagesUpdate, doit.ArgImageName, \"\", \"Image name\", requiredOpt())\n\n\tcmdImagesDelete := cmdBuilder(RunImagesDelete, \"delete <image-id>\", \"Delete image\", out)\n\tcmd.AddCommand(cmdImagesDelete)\n\n\treturn cmd\n}", "func (b *ecrBase) runGetImage(ctx context.Context, batchGetImageInput ecr.BatchGetImageInput) (*ecr.Image, error) {\n\t// Allow only a single image to be fetched at a time.\n\tif len(batchGetImageInput.ImageIds) != 1 {\n\t\treturn nil, errGetImageUnhandled\n\t}\n\n\tbatchGetImageInput.RegistryId = aws.String(b.ecrSpec.Registry())\n\tbatchGetImageInput.RepositoryName = aws.String(b.ecrSpec.Repository)\n\n\tlog.G(ctx).WithField(\"batchGetImageInput\", batchGetImageInput).Trace(\"ecr.base.image: requesting images\")\n\n\tbatchGetImageOutput, err := b.client.BatchGetImageWithContext(ctx, &batchGetImageInput)\n\tif err != nil {\n\t\tlog.G(ctx).WithError(err).Error(\"ecr.base.image: failed to get image\")\n\t\treturn nil, err\n\t}\n\tlog.G(ctx).WithField(\"batchGetImageOutput\", batchGetImageOutput).Trace(\"ecr.base.image: api response\")\n\n\t// Summarize image request failures for handled errors. Only the first\n\t// failure is checked as only a single ImageIdentifier is allowed to be\n\t// queried for.\n\tif len(batchGetImageOutput.Failures) > 0 {\n\t\tfailure := batchGetImageOutput.Failures[0]\n\t\tswitch aws.StringValue(failure.FailureCode) {\n\t\t// Requested image with a corresponding tag and digest does not exist.\n\t\t// This failure will generally occur when pushing an updated (or new)\n\t\t// image with a tag.\n\t\tcase ecr.ImageFailureCodeImageTagDoesNotMatchDigest:\n\t\t\tlog.G(ctx).WithField(\"failure\", failure).Debug(\"ecr.base.image: no matching image with specified digest\")\n\t\t\treturn nil, errImageNotFound\n\t\t// Requested image doesn't resolve to a known image. A new image will\n\t\t// result in an ImageNotFound error when checked before push.\n\t\tcase ecr.ImageFailureCodeImageNotFound:\n\t\t\tlog.G(ctx).WithField(\"failure\", failure).Debug(\"ecr.base.image: no image found\")\n\t\t\treturn nil, errImageNotFound\n\t\t// Requested image identifiers are invalid.\n\t\tcase ecr.ImageFailureCodeInvalidImageDigest, ecr.ImageFailureCodeInvalidImageTag:\n\t\t\tlog.G(ctx).WithField(\"failure\", failure).Error(\"ecr.base.image: invalid image identifier\")\n\t\t\treturn nil, reference.ErrInvalid\n\t\t// Unhandled failure reported for image request made.\n\t\tdefault:\n\t\t\tlog.G(ctx).WithField(\"failure\", failure).Warn(\"ecr.base.image: unhandled image request failure\")\n\t\t\treturn nil, errGetImageUnhandled\n\t\t}\n\t}\n\n\treturn batchGetImageOutput.Images[0], nil\n}", "func (pid *PostImageDelete) Where(ps ...predicate.PostImage) *PostImageDelete {\n\tpid.mutation.predicates = append(pid.mutation.predicates, ps...)\n\treturn pid\n}", "func (a *Client) PostImagesList(params *PostImagesListParams, authInfo runtime.ClientAuthInfoWriter) (*PostImagesListOK, error) {\n\t// TODO: Validate the params before sending\n\tif params == nil {\n\t\tparams = NewPostImagesListParams()\n\t}\n\n\tresult, err := a.transport.Submit(&runtime.ClientOperation{\n\t\tID: \"PostImagesList\",\n\t\tMethod: \"POST\",\n\t\tPathPattern: \"/images/list\",\n\t\tProducesMediaTypes: []string{\"application/json\"},\n\t\tConsumesMediaTypes: []string{\"\"},\n\t\tSchemes: []string{\"https\"},\n\t\tParams: params,\n\t\tReader: &PostImagesListReader{formats: a.formats},\n\t\tAuthInfo: authInfo,\n\t\tContext: params.Context,\n\t})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn result.(*PostImagesListOK), nil\n\n}", "func (rb *ByProjectKeyImageSearchRequestBuilder) Post(body io.Reader) *ByProjectKeyImageSearchRequestMethodPost {\n\treturn &ByProjectKeyImageSearchRequestMethodPost{\n\t\tbody: body,\n\t\turl: fmt.Sprintf(\"/%s/image-search\", rb.projectKey),\n\t\tclient: rb.client,\n\t}\n}", "func getImages(hostBase string, organization string, application string) (*http.Response, []*server.Image, error) {\n\n\turl := getImagesURL(hostBase, organization, application)\n\n\tkiln.LogInfo.Printf(\"Invoking get at URL %s\", url)\n\n\treq, err := http.NewRequest(\"GET\", url, nil)\n\treq.Header.Add(\"Accept\", \"application/json\")\n\treq.Header.Set(\"Authorization\", fmt.Sprintf(\"Bearer %s\", \"e30K.e30K.e30K\"))\n\tclient := &http.Client{}\n\tresponse, err := client.Do(req)\n\n\timages := []*server.Image{}\n\n\tbytes, err := ioutil.ReadAll(response.Body)\n\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\n\tbody := string(bytes)\n\n\tkiln.LogInfo.Printf(\"Response is %s\", body)\n\n\tjson.Unmarshal(bytes, &images)\n\n\treturn response, images, err\n\n}", "func (db *ImageDB) ImageList(uploaderID primitive.ObjectID) ([]bson.M, error) {\n\tvar data []bson.M\n\tmatchStage := bson.D{{\"$match\", bson.D{{\"metadata.uploader\", uploaderID}}}}\n\tprojectStage := bson.D{{\"$project\", bson.D{{\"id\", \"$_id\"}, {\"_id\", 0}, {\"uploadDate\", \"$uploadDate\"}}}}\n\n\tcursor, err := db.collection.Aggregate(timeoutContext(),\n\t\tmongo.Pipeline{matchStage, projectStage})\n\tif err != nil {\n\t\treturn data, err\n\t}\n\terr = cursor.All(timeoutContext(), &data)\n\tif err != nil {\n\t\treturn data, err\n\t}\n\n\treturn data, nil\n}", "func (s stack) ListImages(ctx context.Context, _ bool) (out []*abstract.Image, ferr fail.Error) {\n\tif valid.IsNil(s) {\n\t\treturn nil, fail.InvalidInstanceError()\n\t}\n\n\t// FIXME: It has to be remade from scratch...\n\n\tvar images []*abstract.Image\n\t// FIXME: Don't even add CentOS, our image selection algorithm is not able to select the right one, it has to be remade from scratch because it assumes that the the length of the full ID of an images is the same for all images, which is false for Azure; as a consequence, looking for \"ubuntu\" will return maybe a Centos, maybe something else...\n\t/*\n\t\timages = append(images, &abstract.Image{\n\t\t\tID: strings.Join([]string{\"OpenLogic\", \"CentOS\", \"8_5-gen2\"}, \":\"),\n\t\t\tName: strings.Join([]string{\"OpenLogic\", \"CentOS\", \"8_5-gen2\"}, \":\"),\n\t\t\tURL: \"\",\n\t\t\tDescription: \"\",\n\t\t\tStorageType: \"\",\n\t\t\tDiskSize: 0,\n\t\t\tPublisher: \"cognosys\",\n\t\t\tOffer: \"centos-8-latest\",\n\t\t\tSku: \"centos-8-latest\",\n\t\t})\n\t*/\n\timages = append(images, &abstract.Image{\n\t\tID: strings.Join([]string{\"Canonical\", \"UbuntuServer\", \"18.04-LTS\"}, \":\"),\n\t\tName: strings.Join([]string{\"Canonical\", \"UbuntuServer\", \"18.04-LTS\"}, \":\"),\n\t\tURL: \"\",\n\t\tDescription: \"\",\n\t\tStorageType: \"\",\n\t\tDiskSize: 30,\n\t\tPublisher: \"Canonical\",\n\t\tOffer: \"UbuntuServer\",\n\t\tSku: \"18.04-LTS\",\n\t})\n\timages = append(images, &abstract.Image{\n\t\tID: strings.Join([]string{\"Canonical\", \"0001-com-ubuntu-minimal-focal\", \"minimal-20_04-lts\"}, \":\"),\n\t\tName: strings.Join([]string{\"Canonical\", \"0001-com-ubuntu-minimal-focal\", \"minimal-20_04-lts\"}, \":\"),\n\t\tURL: \"\",\n\t\tDescription: \"\",\n\t\tStorageType: \"\",\n\t\tDiskSize: 30,\n\t\tPublisher: \"Canonical\",\n\t\tOffer: \"0001-com-ubuntu-minimal-focal\",\n\t\tSku: \"minimal-20_04-lts\",\n\t})\n\timages = append(images, &abstract.Image{\n\t\tID: strings.Join([]string{\"Canonical\", \"0001-com-ubuntu-server-jammy\", \"22_04-lts-gen2\"}, \":\"),\n\t\tName: strings.Join([]string{\"Canonical\", \"0001-com-ubuntu-server-jammy\", \"22_04-lts-gen2\"}, \":\"),\n\t\tURL: \"\",\n\t\tDescription: \"\",\n\t\tStorageType: \"\",\n\t\tDiskSize: 30,\n\t\tPublisher: \"Canonical\",\n\t\tOffer: \"0001-com-ubuntu-server-jammy\",\n\t\tSku: \"22_04-lts-gen2\",\n\t})\n\n\treturn images, nil\n}", "func GetAllImages() []Image {\n\treturn []Image{}\n}", "func (imp *Importer) fetchImages() {\n err := downloadImages(\n imp.idPath,\n func(id string, bodyRdr io.Reader) error {\n img, err := jpeg.Decode(bodyRdr)\n if err == nil {\n imp.send(&imagedata.ImageData{Id: id, Data: &img})\n } else {\n log.Printf(\"Error decoding image %s to jpeg\\n\", id)\n }\n return nil\n },\n )\n\n if err != nil { imp.sendErr(err) }\n}", "func GetPictures(db *gorm.DB) []Picture {\n\tvar pictures []Picture\n\tdb.Preload(\"Image\").Preload(\"User\").Order(\"created_at desc\").Find(&pictures)\n\treturn pictures\n}", "func (c *criContainerdService) ListImages(ctx context.Context, r *runtime.ListImagesRequest) (*runtime.ListImagesResponse, error) {\n\timageMetadataA, err := c.imageMetadataStore.List()\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to list image metadata from store %v\", err)\n\t}\n\t// TODO(mikebrow): Get the id->tags, and id->digest mapping from our checkpoint;\n\t// Get other information from containerd image/content store\n\n\tvar images []*runtime.Image\n\tfor _, image := range imageMetadataA { // TODO(mikebrow): write a ImageMetadata to runtime.Image converter\n\t\tri := &runtime.Image{\n\t\t\tId: image.ID,\n\t\t\tRepoTags: image.RepoTags,\n\t\t\tRepoDigests: image.RepoDigests,\n\t\t\tSize_: image.Size,\n\t\t\t// TODO(mikebrow): Uid and Username?\n\t\t}\n\t\timages = append(images, ri)\n\t}\n\n\treturn &runtime.ListImagesResponse{Images: images}, nil\n}", "func (p Pipeline) BuildImages(force bool) error {\n\tif Verbose {\n\t\tpipelineLogger.Printf(\"Build Images:\")\n\t}\n\tcount, elapsedTime, totalElapsedTime, err := p.runCommand(runConfig{\n\t\tselection: func(step Step) bool {\n\t\t\treturn step.IsBuildable()\n\t\t},\n\t\trun: func(runner Runner, step Step) func() error {\n\t\t\treturn runner.ImageBuilder(step, force)\n\t\t},\n\t})\n\tif Verbose {\n\t\tpipelineLogger.Printf(\"Build %d images in %s\", count, elapsedTime)\n\t\tpipelineLogger.Printf(\"Total time spent building images: %s\", totalElapsedTime)\n\t}\n\treturn err\n}", "func GetUserImages(w http.ResponseWriter, r *http.Request) {\n\n\t//Get current Session\n\tsession, _ := store.Get(r, \"session\")\n\tname := session.Values[\"username\"].(string)\n\n\t//Get User\n\tuser, err := model.GetUserByUsername(name)\n\tif err != nil {\n\n\t\tw.WriteHeader(http.StatusConflict)\n\t\tw.Write([]byte(err.Error()))\n\t\treturn\n\n\t}\n\n\t//Get Images\n\timages, err := user.GetImages()\n\tif err != nil {\n\n\t\tw.WriteHeader(http.StatusInternalServerError)\n\t\tw.Write([]byte(err.Error()))\n\t\treturn\n\n\t}\n\n\t//Get like and comment counts for each Image\n\tfor i := 0; i < len(images); i++ {\n\n\t\timages[i].Likes, err = images[i].GetLikeCounts()\n\t\tif err != nil {\n\n\t\t\thttp.Error(w, err.Error(), http.StatusInternalServerError)\n\t\t\treturn\n\n\t\t}\n\t\tcomments, err := images[i].GetComments()\n\t\tif err != nil {\n\n\t\t\thttp.Error(w, err.Error(), http.StatusInternalServerError)\n\t\t\treturn\n\n\t\t}\n\t\timages[i].Comments = len(comments)\n\n\t}\n\n\t//Make Response JSON\n\tresponseModel := struct {\n\t\tImages []model.Image\n\t}{\n\t\tImages: images,\n\t}\n\tresponseJSON, err := json.Marshal(responseModel)\n\tif err != nil {\n\n\t\tw.WriteHeader(http.StatusInternalServerError)\n\t\tw.Write([]byte(err.Error()))\n\t\treturn\n\n\t}\n\n\t//Write response\n\tw.Header().Set(\"Content-Type\", \"application/json; charset=UTF-8\")\n\tw.WriteHeader(http.StatusOK)\n\tw.Write(responseJSON)\n\n}", "func (*XMLDocument) Images() (images window.HTMLCollection) {\n\tmacro.Rewrite(\"$_.images\")\n\treturn images\n}", "func (o GetImagesResultOutput) Images() GetImagesImageArrayOutput {\n\treturn o.ApplyT(func(v GetImagesResult) []GetImagesImage { return v.Images }).(GetImagesImageArrayOutput)\n}", "func (o GetImagesResultOutput) Images() GetImagesImageArrayOutput {\n\treturn o.ApplyT(func(v GetImagesResult) []GetImagesImage { return v.Images }).(GetImagesImageArrayOutput)\n}", "func (t *TMDB) NetworkImages(id int64) (*CompanyImages, error) {\n\tc := new(CompanyImages)\n\tif err := t.get(c, fmt.Sprintf(\"/3/network/%d/images\", id), url.Values{}); err != nil {\n\t\treturn nil, err\n\t}\n\treturn c, nil\n}", "func TagImages(sources []string, target func(string) string) error {\n\n\tfor _, source := range sources {\n\t\terr := tagImage(source, target)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn nil\n}", "func GetGalleryImages(db *sql.DB) http.HandlerFunc {\n\treturn func(w http.ResponseWriter, r *http.Request) {\n\t\tfmt.Fprintf(w, \"GET /galleries/\"+mux.Vars(r)[\"id\"]+\"/images\")\n\n\t\tw.WriteHeader(http.StatusOK)\n\t\tw.Write([]byte(\"Not Implemented\"))\n\t}\n}", "func (s *FileStore) ListImages(filter string) ([]*Image, error) {\n\ts.Lock()\n\tdefer s.Unlock()\n\treturn s.listImagesUnlocked(filter)\n}" ]
[ "0.8188248", "0.7766799", "0.7121496", "0.67918533", "0.67526084", "0.67526084", "0.5961809", "0.59222555", "0.5840699", "0.5824042", "0.5788528", "0.5731255", "0.5731255", "0.5660598", "0.5581593", "0.55418473", "0.55230427", "0.54764485", "0.5401485", "0.53206635", "0.52717674", "0.52717674", "0.5257724", "0.5227802", "0.5223996", "0.51815003", "0.5151763", "0.5145625", "0.50800514", "0.50770533", "0.5074572", "0.5074391", "0.5062204", "0.5044139", "0.502965", "0.50106156", "0.50071335", "0.5000249", "0.49985176", "0.49500284", "0.4947748", "0.49318945", "0.49287128", "0.4928632", "0.49075136", "0.48910427", "0.48863766", "0.48715347", "0.48701063", "0.48237678", "0.48049876", "0.47943455", "0.47925156", "0.47679815", "0.47633323", "0.4756323", "0.4742585", "0.47401246", "0.47156876", "0.47155696", "0.47060716", "0.46983668", "0.46982703", "0.46845838", "0.46711138", "0.4670479", "0.4659756", "0.4629345", "0.46225804", "0.46199423", "0.4619211", "0.46139523", "0.46029985", "0.4600876", "0.45990807", "0.45965973", "0.4587754", "0.45874888", "0.45830995", "0.4574527", "0.4571122", "0.45685545", "0.45665342", "0.45626107", "0.4546064", "0.45431298", "0.45283994", "0.4527547", "0.45267054", "0.45190537", "0.45173246", "0.45171246", "0.45134145", "0.4511431", "0.44954574", "0.44954574", "0.44871923", "0.44808593", "0.44793805", "0.44761306" ]
0.82997257
0
QueryVideos queries the videos edge of a Post.
func (c *PostClient) QueryVideos(po *Post) *PostVideoQuery { query := &PostVideoQuery{config: c.config} query.path = func(ctx context.Context) (fromV *sql.Selector, _ error) { id := po.ID step := sqlgraph.NewStep( sqlgraph.From(post.Table, post.FieldID, id), sqlgraph.To(postvideo.Table, postvideo.FieldID), sqlgraph.Edge(sqlgraph.O2M, false, post.VideosTable, post.VideosColumn), ) fromV = sqlgraph.Neighbors(po.driver.Dialect(), step) return fromV, nil } return query }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (c *UnsavedPostClient) QueryVideos(up *UnsavedPost) *UnsavedPostVideoQuery {\n\tquery := &UnsavedPostVideoQuery{config: c.config}\n\tquery.path = func(ctx context.Context) (fromV *sql.Selector, _ error) {\n\t\tid := up.ID\n\t\tstep := sqlgraph.NewStep(\n\t\t\tsqlgraph.From(unsavedpost.Table, unsavedpost.FieldID, id),\n\t\t\tsqlgraph.To(unsavedpostvideo.Table, unsavedpostvideo.FieldID),\n\t\t\tsqlgraph.Edge(sqlgraph.O2M, false, unsavedpost.VideosTable, unsavedpost.VideosColumn),\n\t\t)\n\t\tfromV = sqlgraph.Neighbors(up.driver.Dialect(), step)\n\t\treturn fromV, nil\n\t}\n\treturn query\n}", "func (upq *UnsavedPostQuery) QueryVideos() *UnsavedPostVideoQuery {\n\tquery := &UnsavedPostVideoQuery{config: upq.config}\n\tquery.path = func(ctx context.Context) (fromU *sql.Selector, err error) {\n\t\tif err := upq.prepareQuery(ctx); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tselector := upq.sqlQuery(ctx)\n\t\tif err := selector.Err(); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tstep := sqlgraph.NewStep(\n\t\t\tsqlgraph.From(unsavedpost.Table, unsavedpost.FieldID, selector),\n\t\t\tsqlgraph.To(unsavedpostvideo.Table, unsavedpostvideo.FieldID),\n\t\t\tsqlgraph.Edge(sqlgraph.O2M, false, unsavedpost.VideosTable, unsavedpost.VideosColumn),\n\t\t)\n\t\tfromU = sqlgraph.SetNeighbors(upq.driver.Dialect(), step)\n\t\treturn fromU, nil\n\t}\n\treturn query\n}", "func GetVideos(c *fiber.Ctx) error {\n\tvar products []models.Video\n\n\t// basic sql query\n\tsql := \"SELECT * FROM videos\"\n\n\t// if your searches for video using title ot description\n\tif s := c.Query(\"s\"); s != \"\" {\n\t\tsql = fmt.Sprintf(\"%s WHERE title LIKE '%%%s%%' OR description LIKE '%%%s%%'\", sql, s, s)\n\t}\n\n\t// sort by asc or desc\n\tif sort := c.Query(\"sort\"); sort != \"\" {\n\t\tsql = fmt.Sprintf(\"%s ORDER BY date %s\", sql, sort)\n\t}\n\n\t// page number specified by user\n\tpage, _ := strconv.Atoi(c.Query(\"page\", \"1\"))\n\tperPage := 9\n\tvar total int64\n\n\t// total videos\n\tdatabase.DBConn.Raw(sql).Count(&total)\n\n\t// sql query to get videos on particular page\n\tsql = fmt.Sprintf(\"%s LIMIT %d OFFSET %d\", sql, perPage, (page-1)*perPage)\n\tdatabase.DBConn.Raw(sql).Scan(&products)\n\n\t// return the result to user\n\treturn c.JSON(fiber.Map{\n\t\t\"data\": products,\n\t\t\"total\": total,\n\t\t\"page\": page,\n\t\t\"last_page\": math.Ceil(float64(total / int64(perPage))),\n\t})\n}", "func (upq *UnsavedPostQuery) WithVideos(opts ...func(*UnsavedPostVideoQuery)) *UnsavedPostQuery {\n\tquery := &UnsavedPostVideoQuery{config: upq.config}\n\tfor _, opt := range opts {\n\t\topt(query)\n\t}\n\tupq.withVideos = query\n\treturn upq\n}", "func (c *PostVideoClient) Query() *PostVideoQuery {\n\treturn &PostVideoQuery{\n\t\tconfig: c.config,\n\t}\n}", "func (c *UnsavedPostVideoClient) Query() *UnsavedPostVideoQuery {\n\treturn &UnsavedPostVideoQuery{\n\t\tconfig: c.config,\n\t}\n}", "func (c *PostVideoClient) QueryPost(pv *PostVideo) *PostQuery {\n\tquery := &PostQuery{config: c.config}\n\tquery.path = func(ctx context.Context) (fromV *sql.Selector, _ error) {\n\t\tid := pv.ID\n\t\tstep := sqlgraph.NewStep(\n\t\t\tsqlgraph.From(postvideo.Table, postvideo.FieldID, id),\n\t\t\tsqlgraph.To(post.Table, post.FieldID),\n\t\t\tsqlgraph.Edge(sqlgraph.M2O, true, postvideo.PostTable, postvideo.PostColumn),\n\t\t)\n\t\tfromV = sqlgraph.Neighbors(pv.driver.Dialect(), step)\n\t\treturn fromV, nil\n\t}\n\treturn query\n}", "func (d *Dao) Videos2(c context.Context, aid int64) (vs []*archive.Video, err error) {\n\trows, err := d.db.Query(c, _videos2SQL, aid)\n\tif err != nil {\n\t\tlog.Error(\"d.db.Query(%s, %d) error(%v)\", _videos2SQL, aid, err)\n\t\treturn\n\t}\n\tdefer rows.Close()\n\tfor rows.Next() {\n\t\tv := &archive.Video{}\n\t\tif err = rows.Scan(&v.ID, &v.Filename, &v.Cid, &v.Aid, &v.Title, &v.Desc, &v.SrcType, &v.Duration, &v.Filesize, &v.Resolutions,\n\t\t\t&v.Playurl, &v.FailCode, &v.Index, &v.Attribute, &v.XcodeState, &v.Status, &v.State, &v.CTime, &v.MTime); err != nil {\n\t\t\tlog.Error(\"rows.Scan error(%v)\", err)\n\t\t\treturn\n\t\t}\n\t\tvs = append(vs, v)\n\t}\n\treturn\n}", "func (c *StickersCreateStickerSetRequest) GetVideos() (value bool) {\n\tif c == nil {\n\t\treturn\n\t}\n\treturn c.Flags.Has(4)\n}", "func (upu *UnsavedPostUpdate) ClearVideos() *UnsavedPostUpdate {\n\tupu.mutation.ClearVideos()\n\treturn upu\n}", "func (c *Client) GetVideos(params *VideosParams) (*VideosResponse, error) {\n\tresp, err := c.get(\"/videos\", &ManyVideos{}, params)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tvideos := &VideosResponse{}\n\tresp.HydrateResponseCommon(&videos.ResponseCommon)\n\tvideos.Data.Videos = resp.Data.(*ManyVideos).Videos\n\tvideos.Data.Pagination = resp.Data.(*ManyVideos).Pagination\n\n\treturn videos, nil\n}", "func Videos(videos []fs.Video) html.Node {\n\n\tdivs := make([]html.Node, 0, len(videos))\n\n\tdivs = append(divs, html.Style().Text(VideoCSS().String()))\n\n\tfor _, video := range videos {\n\t\tdivs = append(divs, Video(video))\n\t}\n\n\tif len(videos) == 0 {\n\t\tdivs = append(divs, CenterByBoxes(html.H2().Text(\"No videos\")))\n\t}\n\n\tpage := html.Div().Class(layout.HBox, layout.Grow, layout.Wrap).Children(\n\t\tdivs...,\n\t)\n\n\treturn Layout(\"Videos\", page)\n}", "func (client Client) Video(parameters Parameters) (VideoResultContainer, error) {\n\tvar result videoResultWrapper\n\n\tif err := client.search(parameters.GetURI(SearchTypeVideo), &result); err != nil {\n\t\treturn VideoResultContainer{}, err\n\t}\n\n\treturn result.Data, nil\n}", "func (s *StickerSet) GetVideos() (value bool) {\n\tif s == nil {\n\t\treturn\n\t}\n\treturn s.Flags.Has(6)\n}", "func (c *PostVideoClient) Get(ctx context.Context, id int) (*PostVideo, error) {\n\treturn c.Query().Where(postvideo.ID(id)).Only(ctx)\n}", "func GetVideosEndpoint(w http.ResponseWriter, req *http.Request){\n\tw.Header().Set(\"Content-Type\", \"application/json\")\n\t\n\t\t\n\tvideos, err := obtenerVideos(\"\",\"\",\"20\")\n\tif err != nil {\n\t\tfmt.Printf(\"Error obteniendo videos: %v\", err)\n\t\treturn\n\t}\n\tvar resultado []Video\n\tfor _, video := range videos {\n\t\tresultado = append(resultado, Video{Id: video.Id, Tema: video.Tema, Autor: video.Autor, Fecha: video.Fecha, Link: video.Link})\n\t\tfmt.Printf(\"%v\\n\", video.Tema)\n\t}\n\tfmt.Printf(\"%v\\n\", resultado)\n\tjson.NewEncoder(w).Encode(resultado)\n}", "func (vc VideoController) ViewVideos(w http.ResponseWriter, r *http.Request) {\n\tvar videos []models.Video\n\tif err := storage.DB.Find(&videos).Error; err != nil {\n\t\tlogrus.Error(\"Could not find videos : \", err.Error())\n\t\thttp.Error(w, \"Error finding videos\", http.StatusInternalServerError)\n\t\treturn\n\t}\n\trender.Render(w, r, \"videos\", map[string]interface{}{\n\t\t\"Videos\": videos,\n\t})\n}", "func (upuo *UnsavedPostUpdateOne) ClearVideos() *UnsavedPostUpdateOne {\n\tupuo.mutation.ClearVideos()\n\treturn upuo\n}", "func (upu *UnsavedPostUpdate) AddVideos(u ...*UnsavedPostVideo) *UnsavedPostUpdate {\n\tids := make([]int, len(u))\n\tfor i := range u {\n\t\tids[i] = u[i].ID\n\t}\n\treturn upu.AddVideoIDs(ids...)\n}", "func (vr *VideosRepo) GetVideos() (*youtube.VideoListResponse, error) {\n\tif vr.Videos.Id == \"\" {\n\t\treturn nil, errors.New(\"data: GetVideos by nil id\")\n\t}\n\treturn vr.Videos.List()\n}", "func (a *ApiV2) getVideos(accountId string) (videos []json.RawMessage, err error) {\n\tpath := \"/videos\"\n\tif accountId != \"\" {\n\t\tpath = \"/accounts/\" + accountId + path\n\t}\n\t// iterate through the requests until we get no more videos\n\tbase_url := a.getBaseUrl() + path\n\tpageNumber := 1\n\tpageSize := a.PageSize\n\tfor {\n\t\tvar obj VideoList\n\t\turl := base_url + fmt.Sprintf(\"?page_number=%d&page_size=%d\", pageNumber, pageSize)\n\t\treq, err := a.makeRequest(\"GET\", url, nil)\n\t\tif err != nil {\n\t\t\treturn videos, err\n\t\t}\n\t\terr = handleReq(a, req, &obj)\n\t\tif err != nil {\n\t\t\treturn videos, err\n\t\t}\n\t\tif len(obj.Videos) == 0 {\n\t\t\treturn videos, nil\n\t\t}\n\t\tvideos = append(videos, obj.Videos...)\n\t\tpageNumber++\n\t}\n\treturn videos, nil\n}", "func (upuo *UnsavedPostUpdateOne) AddVideos(u ...*UnsavedPostVideo) *UnsavedPostUpdateOne {\n\tids := make([]int, len(u))\n\tfor i := range u {\n\t\tids[i] = u[i].ID\n\t}\n\treturn upuo.AddVideoIDs(ids...)\n}", "func GetVideo(router *gin.RouterGroup) {\n\trouter.GET(\"/videos/:hash/:token/:type\", func(c *gin.Context) {\n\t\tif InvalidPreviewToken(c) {\n\t\t\tc.Data(http.StatusForbidden, \"image/svg+xml\", brokenIconSvg)\n\t\t\treturn\n\t\t}\n\n\t\tfileHash := c.Param(\"hash\")\n\t\ttypeName := c.Param(\"type\")\n\n\t\t_, ok := video.Types[typeName]\n\n\t\tif !ok {\n\t\t\tlog.Errorf(\"video: invalid type %s\", txt.Quote(typeName))\n\t\t\tc.Data(http.StatusOK, \"image/svg+xml\", videoIconSvg)\n\t\t\treturn\n\t\t}\n\n\t\tf, err := query.FileByHash(fileHash)\n\n\t\tif err != nil {\n\t\t\tlog.Errorf(\"video: %s\", err.Error())\n\t\t\tc.Data(http.StatusOK, \"image/svg+xml\", videoIconSvg)\n\t\t\treturn\n\t\t}\n\n\t\tif !f.FileVideo {\n\t\t\tf, err = query.VideoByPhotoUID(f.PhotoUID)\n\n\t\t\tif err != nil {\n\t\t\t\tlog.Errorf(\"video: %s\", err.Error())\n\t\t\t\tc.Data(http.StatusOK, \"image/svg+xml\", videoIconSvg)\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\n\t\tif f.FileError != \"\" {\n\t\t\tlog.Errorf(\"video: file error %s\", f.FileError)\n\t\t\tc.Data(http.StatusOK, \"image/svg+xml\", videoIconSvg)\n\t\t\treturn\n\t\t}\n\n\t\tfileName := photoprism.FileName(f.FileRoot, f.FileName)\n\n\t\tif !fs.FileExists(fileName) {\n\t\t\tlog.Errorf(\"video: file %s is missing\", txt.Quote(f.FileName))\n\t\t\tc.Data(http.StatusOK, \"image/svg+xml\", videoIconSvg)\n\n\t\t\t// Set missing flag so that the file doesn't show up in search results anymore.\n\t\t\tlogError(\"video\", f.Update(\"FileMissing\", true))\n\n\t\t\treturn\n\t\t}\n\n\t\tif c.Query(\"download\") != \"\" {\n\t\t\tc.FileAttachment(fileName, f.ShareFileName())\n\t\t} else {\n\t\t\tc.File(fileName)\n\t\t}\n\n\t\treturn\n\t})\n}", "func (c *CLI) FindVideos(query string) (*SearchResult, error) {\n\tvals := &url.Values{}\n\tvals.Add(\"q\", query)\n\tvals.Add(\"key\", c.Token)\n\n\tres, err := c.request(\"GET\",\n\t\t\"https://www.googleapis.com/youtube/v3/search?part=snippet&maxResults=1&type=video&\"+vals.Encode(),\n\t\tnil)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer res.Body.Close()\n\n\t// Save server response into a txt file - debug\n\t// b, _ := ioutil.ReadAll(res.Body)\n\t// ioutil.WriteFile(\"cc.txt\", b, 0644)\n\n\tvideo := &SearchResult{}\n\tif err := json.NewDecoder(res.Body).Decode(video); err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn video, nil\n}", "func (c *StickersCreateStickerSetRequest) SetVideos(value bool) {\n\tif value {\n\t\tc.Flags.Set(4)\n\t\tc.Videos = true\n\t} else {\n\t\tc.Flags.Unset(4)\n\t\tc.Videos = false\n\t}\n}", "func (s *StickerSet) SetVideos(value bool) {\n\tif value {\n\t\ts.Flags.Set(6)\n\t\ts.Videos = true\n\t} else {\n\t\ts.Flags.Unset(6)\n\t\ts.Videos = false\n\t}\n}", "func (upuo *UnsavedPostUpdateOne) RemoveVideos(u ...*UnsavedPostVideo) *UnsavedPostUpdateOne {\n\tids := make([]int, len(u))\n\tfor i := range u {\n\t\tids[i] = u[i].ID\n\t}\n\treturn upuo.RemoveVideoIDs(ids...)\n}", "func (upu *UnsavedPostUpdate) RemoveVideos(u ...*UnsavedPostVideo) *UnsavedPostUpdate {\n\tids := make([]int, len(u))\n\tfor i := range u {\n\t\tids[i] = u[i].ID\n\t}\n\treturn upu.RemoveVideoIDs(ids...)\n}", "func obtenerVideos(tema string, autor string, fecha string) ([]Video, error) {\n\tvideos := []Video{}\n\tdb, err := obtenerBaseDeDatos()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer db.Close()\n\t\n\tfilas, err := db.Query(\"SELECT id, tema, autor, fecha, link FROM videos where autor LIKE '%\"+autor+\"%' AND tema LIKE '%\"+tema+\"%' AND fecha LIKE '%\"+fecha+\"%'\")\n\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\t// Si llegamos aquí, significa que no ocurrió ningún error\n\tdefer filas.Close()\n\n\t// Aquí vamos a \"mapear\" lo que traiga la consulta en el while de más abajo\n\tvar c Video\n\n\t// Recorrer todas las filas, en un \"while\"\n\tfor filas.Next() {\n\t\terr = filas.Scan(&c.Id, &c.Tema, &c.Autor, &c.Fecha , &c.Link)\n\t\t// Al escanear puede haber un error\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\t\n\t\t// Y si no, entonces agregamos lo leído al arreglo\n\t\n\t\tvideos = append(videos, c)\n\t}\n\t// Vacío o no, regresamos el arreglo de contactos\n\treturn videos, nil\n}", "func EnumerateVideos(URL string, videos chan FlatVideo) (int, error) {\n\tvar (\n\t\tcount int\n\t\tfinalError error\n\t)\n\n\terr := doYoutubedl([]string{ytFlatPlaylist, ytDumpJSON, URL}, func(stdin io.ReadCloser, stderr io.ReadCloser) {\n\t\tdefer func() {\n\t\t\tif videos != nil {\n\t\t\t\tclose(videos)\n\t\t\t}\n\t\t}()\n\t\treader := bufio.NewReader(stdin)\n\t\tfor {\n\t\t\tline, err := reader.ReadString('\\n')\n\t\t\tif err != nil {\n\t\t\t\tif err != io.EOF {\n\t\t\t\t\tfinalError = err\n\t\t\t\t}\n\t\t\t\tbreak\n\t\t\t}\n\n\t\t\tcount++\n\n\t\t\tif videos != nil {\n\t\t\t\tvar fv = FlatVideo{}\n\t\t\t\terr := json.Unmarshal([]byte(line), &fv)\n\t\t\t\tif err != nil {\n\t\t\t\t\tfinalError = err\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t\tvideos <- fv\n\t\t\t}\n\t\t}\n\t})\n\tif err != nil {\n\t\treturn -1, err\n\t}\n\n\treturn count, finalError\n}", "func (client *Client) GetVideoList(request *GetVideoListRequest) (_result *GetVideoListResponse, _err error) {\n\truntime := &util.RuntimeOptions{}\n\t_result = &GetVideoListResponse{}\n\t_body, _err := client.GetVideoListWithOptions(request, runtime)\n\tif _err != nil {\n\t\treturn _result, _err\n\t}\n\t_result = _body\n\treturn _result, _err\n}", "func (c *Client) DeleteVideos(params *DeleteVideosParams) (*DeleteVideosResponse, error) {\n\tresp, err := c.delete(\"/videos\", &DeleteVideosResponse{}, params)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tvideos := &DeleteVideosResponse{}\n\tresp.HydrateResponseCommon(&videos.ResponseCommon)\n\n\treturn videos, nil\n}", "func (c *Client) SearchVideoByVideo(lib string, args *api.BaseRequest) (*api.SearchTaskResultResponse, error) {\n\treturn api.SearchVideoByVideo(c, lib, args)\n}", "func (c *UnsavedPostVideoClient) Get(ctx context.Context, id int) (*UnsavedPostVideo, error) {\n\treturn c.Query().Where(unsavedpostvideo.ID(id)).Only(ctx)\n}", "func (uu *UserUpdate) ClearVideos() *UserUpdate {\n\tuu.mutation.ClearVideos()\n\treturn uu\n}", "func (d *Dao) PpDelVideos(c context.Context, delIds []int) (err error) {\n\tvar delay = time.Now().Unix() + int64(d.conf.UgcSync.Frequency.ErrorWait)\n\tfor _, v := range delIds {\n\t\tif _, err = d.DB.Exec(c, _ppDelVideos, delay, v); err != nil {\n\t\t\tlog.Error(\"PpDelVideos, failed to delay: (%v,%v), Error: %v\", delay, v, err)\n\t\t\treturn\n\t\t}\n\t}\n\treturn\n}", "func (uuo *UserUpdateOne) ClearVideos() *UserUpdateOne {\n\tuuo.mutation.ClearVideos()\n\treturn uuo\n}", "func FetchYouTubeVideos(after time.Time, before time.Time, maxCount int64) ([]model.Video, error) {\n\tvideos := []model.Video{}\n\n\tyoutube, err := gapi.GenYouTubeService()\n\tif err != nil {\n\t\treturn videos, err\n\t}\n\n\tpageToken := \"\"\n\tparts := []string{\"id\", \"snippet\"}\n\tfor {\n\t\tcall := youtube.Search.\n\t\t\tList(parts).\n\t\t\tType(\"video\").\n\t\t\tOrder(\"date\").\n\t\t\tChannelId(os.Getenv(\"YOUTUBE_CHANNEL_ID\")).\n\t\t\tMaxResults(maxCount).\n\t\t\tPageToken(pageToken)\n\n\t\tif !after.IsZero() && !before.IsZero() {\n\t\t\tcall = call.PublishedAfter(after.Format(format)).PublishedBefore(before.Format(format))\n\t\t}\n\n\t\tresp, err := call.Do()\n\t\tif err != nil {\n\t\t\treturn videos, err\n\t\t}\n\n\t\tfor _, item := range resp.Items {\n\t\t\tvideo := model.NewVideo(item)\n\t\t\tvideos = append(videos, video)\n\t\t}\n\n\t\tpageToken = resp.NextPageToken\n\t\tif pageToken == \"\" {\n\t\t\tbreak\n\t\t}\n\t}\n\n\treturn videos, nil\n}", "func (c *UnsavedPostVideoClient) QueryUnsavedPost(upv *UnsavedPostVideo) *UnsavedPostQuery {\n\tquery := &UnsavedPostQuery{config: c.config}\n\tquery.path = func(ctx context.Context) (fromV *sql.Selector, _ error) {\n\t\tid := upv.ID\n\t\tstep := sqlgraph.NewStep(\n\t\t\tsqlgraph.From(unsavedpostvideo.Table, unsavedpostvideo.FieldID, id),\n\t\t\tsqlgraph.To(unsavedpost.Table, unsavedpost.FieldID),\n\t\t\tsqlgraph.Edge(sqlgraph.M2O, true, unsavedpostvideo.UnsavedPostTable, unsavedpostvideo.UnsavedPostColumn),\n\t\t)\n\t\tfromV = sqlgraph.Neighbors(upv.driver.Dialect(), step)\n\t\treturn fromV, nil\n\t}\n\treturn query\n}", "func (uuo *UserUpdateOne) AddVideos(v ...*Video) *UserUpdateOne {\n\tids := make([]uuid.UUID, len(v))\n\tfor i := range v {\n\t\tids[i] = v[i].ID\n\t}\n\treturn uuo.AddVideoIDs(ids...)\n}", "func NewPostVideoClient(c config) *PostVideoClient {\n\treturn &PostVideoClient{config: c}\n}", "func NewVideosClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*VideosClient, error) {\n\tif options == nil {\n\t\toptions = &arm.ClientOptions{}\n\t}\n\tep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint\n\tif c, ok := options.Cloud.Services[cloud.ResourceManager]; ok {\n\t\tep = c.Endpoint\n\t}\n\tpl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tclient := &VideosClient{\n\t\tsubscriptionID: subscriptionID,\n\t\thost: ep,\n\t\tpl: pl,\n\t}\n\treturn client, nil\n}", "func ListVideosInDirectory(directory string) ([]os.DirEntry, error) {\r\n\treturn ListFilesInDirectoryOptions(directory, &FilterOptions{\r\n\t\tFilterDirectories: true,\r\n\t\tFilterFuncs: []DirEntryFilterFunc{onlyVideosFunc},\r\n\t})\r\n}", "func (uuo *UserUpdateOne) RemoveVideos(v ...*Video) *UserUpdateOne {\n\tids := make([]uuid.UUID, len(v))\n\tfor i := range v {\n\t\tids[i] = v[i].ID\n\t}\n\treturn uuo.RemoveVideoIDs(ids...)\n}", "func videosHandler(videoChan chan ytvideo.YTVideo, tPoolNum chan int) {\n\tvideo := <-videoChan\n\t<-tPoolNum // get a turn in the pool\n\tdefer consumeThread(tPoolNum) // to give turn to other threads\n\tif debugOutput {\n\t\tfmt.Println(video.Id)\n\t}\n\tytdl := youtube_dl.YoutubeDl{}\n\tytdl.Path = \"$GOPATH/src/app/srts\"\n\terr := ytdl.DownloadVideo(video.Id)\n\tif err != nil {\n\t\tlog.Printf(\"%v\", err)\n\t}\n\t//if debugOutput {\n\t//\tlog.Printf(\"command : %v\", command)\n\t//}\n\tfmt.Print(\".\");\n\tStoreValue(video)\n\tgetVideoSuggestions(video.Id, videoChan, \"12\", tPoolNum)// 12 is a random token that works as initial value\n}", "func InsertVideos(videos []Video) error {\n\tids := []string{}\n\tvideosConvert := []interface{}{}\n\tfor _, video := range videos {\n\t\tvideosConvert = append(videosConvert, video)\n\t\tids = append(ids, video.VideoID)\n\t}\n\treturn DB.InsertIntoElastisearch(CONSTANT.VideosIndex, videosConvert, ids)\n}", "func (uu *UserUpdate) AddVideos(v ...*Video) *UserUpdate {\n\tids := make([]uuid.UUID, len(v))\n\tfor i := range v {\n\t\tids[i] = v[i].ID\n\t}\n\treturn uu.AddVideoIDs(ids...)\n}", "func (s *GroupsService) ListVideo(gr string, opt ...CallOption) ([]*Video, *Response, error) {\n\tu := fmt.Sprintf(\"groups/%s/videos\", gr)\n\tvideos, resp, err := listVideo(s.client, u, opt...)\n\n\treturn videos, resp, err\n}", "func (d *Dao) DeletedVideos(c context.Context) (delIds []int, err error) {\n\tvar rows *sql.Rows\n\tif rows, err = d.DB.Query(c, _deletedVideos); err != nil { // get the qualified aid to sync\n\t\treturn\n\t}\n\tdefer rows.Close()\n\tfor rows.Next() {\n\t\tvar cid int\n\t\tif err = rows.Scan(&cid); err != nil {\n\t\t\tlog.Error(\"ParseVideos row.Scan() error(%v)\", err)\n\t\t\treturn\n\t\t}\n\t\tdelIds = append(delIds, cid)\n\t}\n\tif err = rows.Err(); err != nil {\n\t\tlog.Error(\"d.deletedVideos.Query error(%v)\", err)\n\t}\n\treturn\n}", "func Video_(children ...HTML) HTML {\n return Video(nil, children...)\n}", "func (d *Dao) FinishDelVideos(c context.Context, delIds []int) (err error) {\n\tfor _, v := range delIds {\n\t\tif _, err = d.DB.Exec(c, _finishDelVideo, v); err != nil {\n\t\t\tlog.Error(\"FinishDelVideos Error: %v\", v, err)\n\t\t\treturn\n\t\t}\n\t}\n\treturn\n}", "func (repository *MockVideoRepository) GetVideoList(search string, start *uint, count *uint) ([]Video, error) {\n\tvideos := repository.videos\n\tif len(search) != 0 {\n\t\tfiltered := make([]Video, 0)\n\t\tfor _, v := range videos {\n\t\t\tif strings.Contains(v.Name, search) {\n\t\t\t\tfiltered = append(filtered, v)\n\t\t\t}\n\t\t}\n\t\tvideos = filtered\n\t}\n\tif start != nil {\n\t\tvideos = videos[*start:]\n\t}\n\tif count != nil {\n\t\tvideos = videos[:*count]\n\t}\n\treturn videos, repository.errorToReturn\n}", "func (i *InputInlineQueryResultVideo) GetVideoURL() (value string) {\n\tif i == nil {\n\t\treturn\n\t}\n\treturn i.VideoURL\n}", "func (video *FakeVideo) GetAllVideos(userID string) (videos []Video, err error) {\n\tjsonFile, err := os.Open(\"testdata/fake_videos.json\")\n\n\tif err != nil {\n\t\treturn\n\t}\n\n\tdefer jsonFile.Close()\n\n\tjsonData, err := ioutil.ReadAll(jsonFile)\n\n\tif err != nil {\n\t\treturn\n\t}\n\n\tvar fakeVideos []FakeVideo\n\tjson.Unmarshal(jsonData, &fakeVideos)\n\n\tfor _, fakeVideo := range fakeVideos {\n\t\tif fakeVideo.CreatedBy == userID {\n\t\t\tvideo := Video{\n\t\t\t\tID: fakeVideo.ID,\n\t\t\t\tName: fakeVideo.Name,\n\t\t\t\tURL: fakeVideo.URL,\n\t\t\t\tYoutubeVideoID: fakeVideo.YoutubeVideoID,\n\t\t\t}\n\n\t\t\tvideos = append(videos, video)\n\t\t}\n\t}\n\n\treturn\n}", "func getVideoSuggestions(videoId string, videoChan chan ytvideo.YTVideo, pageToken string, tPoolNum chan int) {\n\t//([]*youtube.Video){\n\tflag.Parse()\n\n\tclient := &http.Client{\n\t\tTransport: &transport.APIKey{Key: developerKey},\n\t}\n\n\tservice, err := youtube.New(client)\n\tif err != nil {\n\t\tlog.Fatalf(\"Error creating new YouTube client: %v\", err)\n\t}\n\n\t// Make the API call to YouTube.\n\tcall := service.Search.List(\"id,snippet\").\n\t\tMaxResults(*maxResults).\n\t\tType(\"video\").\n\t\tRelatedToVideoId(videoId).\n\t\tPageToken(pageToken)\n\n\tresponse, err := call.Do()\n\tif err != nil {\n\t\tlog.Fatalf(\"Error making search API call: %v\", err)\n\t}\n\n\t// Group video, channel, and playlist results in separate lists.\n\t//can use type youtube.Video later\n\tvideos := make(map[string]ytvideo.YTVideo)\n\n\n\t// // Iterate through each item and add it to the correct list.\n\tfor _, item := range response.Items {\n\t\tvideoObj := ytvideo.YTVideo{}.ConvertSearchResult(item)\n\t\tvideos[item.Id.VideoId] = videoObj\n\t\tgo videosHandler(videoChan, tPoolNum)\n\t\tvideoChan <- videoObj\n\t}\n\n\n\t//fetch the rest of th videos if we still have\n\tif len(response.NextPageToken) > 0 {\n\t\tgetVideoSuggestions(videoId, videoChan, response.NextPageToken, tPoolNum)\n\t}\n}", "func (s *GroupsService) GetVideo(gr string, vid int, opt ...CallOption) (*Video, *Response, error) {\n\tu := fmt.Sprintf(\"groups/%s/videos/%d\", gr, vid)\n\tvideo, resp, err := getVideo(s.client, u, opt...)\n\n\treturn video, resp, err\n}", "func DBVideoToGQLVideo(i *dbm.Video) (o *gql.Video, err error) {\n\to = &gql.Video{\n\t\tID: *i.ID,\n\t\tTitle: i.Title,\n\t\tURL: *i.Url,\n\t}\n\treturn o, err\n}", "func (uu *UserUpdate) RemoveVideos(v ...*Video) *UserUpdate {\n\tids := make([]uuid.UUID, len(v))\n\tfor i := range v {\n\t\tids[i] = v[i].ID\n\t}\n\treturn uu.RemoveVideoIDs(ids...)\n}", "func (i *InputInlineQueryResultVideo) GetVideoHeight() (value int32) {\n\tif i == nil {\n\t\treturn\n\t}\n\treturn i.VideoHeight\n}", "func (client *Client) GetVideoListWithOptions(request *GetVideoListRequest, runtime *util.RuntimeOptions) (_result *GetVideoListResponse, _err error) {\n\t_err = util.ValidateModel(request)\n\tif _err != nil {\n\t\treturn _result, _err\n\t}\n\tquery := map[string]interface{}{}\n\tif !tea.BoolValue(util.IsUnset(request.CateId)) {\n\t\tquery[\"CateId\"] = request.CateId\n\t}\n\n\tif !tea.BoolValue(util.IsUnset(request.EndTime)) {\n\t\tquery[\"EndTime\"] = request.EndTime\n\t}\n\n\tif !tea.BoolValue(util.IsUnset(request.PageNo)) {\n\t\tquery[\"PageNo\"] = request.PageNo\n\t}\n\n\tif !tea.BoolValue(util.IsUnset(request.PageSize)) {\n\t\tquery[\"PageSize\"] = request.PageSize\n\t}\n\n\tif !tea.BoolValue(util.IsUnset(request.SortBy)) {\n\t\tquery[\"SortBy\"] = request.SortBy\n\t}\n\n\tif !tea.BoolValue(util.IsUnset(request.StartTime)) {\n\t\tquery[\"StartTime\"] = request.StartTime\n\t}\n\n\tif !tea.BoolValue(util.IsUnset(request.Status)) {\n\t\tquery[\"Status\"] = request.Status\n\t}\n\n\tif !tea.BoolValue(util.IsUnset(request.StorageLocation)) {\n\t\tquery[\"StorageLocation\"] = request.StorageLocation\n\t}\n\n\treq := &openapi.OpenApiRequest{\n\t\tQuery: openapiutil.Query(query),\n\t}\n\tparams := &openapi.Params{\n\t\tAction: tea.String(\"GetVideoList\"),\n\t\tVersion: tea.String(\"2017-03-21\"),\n\t\tProtocol: tea.String(\"HTTPS\"),\n\t\tPathname: tea.String(\"/\"),\n\t\tMethod: tea.String(\"POST\"),\n\t\tAuthType: tea.String(\"AK\"),\n\t\tStyle: tea.String(\"RPC\"),\n\t\tReqBodyType: tea.String(\"formData\"),\n\t\tBodyType: tea.String(\"json\"),\n\t}\n\t_result = &GetVideoListResponse{}\n\t_body, _err := client.CallApi(params, req, runtime)\n\tif _err != nil {\n\t\treturn _result, _err\n\t}\n\t_err = tea.Convert(_body, &_result)\n\treturn _result, _err\n}", "func (mr *MockIRepositoryMockRecorder) GetRelatedVideos(id, start, count interface{}) *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"GetRelatedVideos\", reflect.TypeOf((*MockIRepository)(nil).GetRelatedVideos), id, start, count)\n}", "func ContainerChildrenGetQuery(\n\tctx context.Context,\n\tclient api.Client,\n\tcontainerPath string,\n\tlimit, maxDepth int,\n\tobjectType, sortDir string,\n\tsort, detail []string) (<-chan *ContainerChild, <-chan error) {\n\n\tvar (\n\t\tec = make(chan error)\n\t\tcc = make(chan *ContainerChild)\n\t\twg = &sync.WaitGroup{}\n\t\trnp = realNamespacePath(client)\n\t\tqs = api.OrderedValues{\n\t\t\t{queryByteArr},\n\t\t\t{limitByteArr, []byte(fmt.Sprintf(\"%d\", limit))},\n\t\t\t{maxDepthByteArr, []byte(fmt.Sprintf(\"%d\", maxDepth))},\n\t\t}\n\t)\n\n\tif objectType != \"\" {\n\t\tqs.Set(typeByteArr, []byte(objectType))\n\t}\n\tif len(sort) > 0 {\n\t\tif strings.EqualFold(sortDir, \"asc\") {\n\t\t\tqs = append(qs, sortDirAsc)\n\t\t} else {\n\t\t\tqs = append(qs, sortDirDesc)\n\t\t}\n\t\tqs = append(qs, append(sortQS, to2DByteArray(sort)...))\n\t}\n\tif len(detail) > 0 {\n\t\tqs = append(qs, append(detailQS, to2DByteArray(detail)...))\n\t}\n\n\tgo func() {\n\t\tfor {\n\t\t\tvar resp resumeableContainerChildList\n\t\t\tif err := client.Get(\n\t\t\t\tctx,\n\t\t\t\trnp,\n\t\t\t\tcontainerPath,\n\t\t\t\tqs,\n\t\t\t\tnil,\n\t\t\t\t&resp); err != nil {\n\t\t\t\tec <- err\n\t\t\t\tclose(ec)\n\t\t\t\tclose(cc)\n\t\t\t\treturn\n\t\t\t}\n\t\t\twg.Add(1)\n\t\t\tgo func(resp *resumeableContainerChildList) {\n\t\t\t\tdefer wg.Done()\n\t\t\t\tfor _, c := range resp.Children {\n\t\t\t\t\tcc <- c\n\t\t\t\t}\n\t\t\t}(&resp)\n\t\t\tif resp.Resume == \"\" {\n\t\t\t\tbreak\n\t\t\t}\n\t\t\tqs.Set(resumeByteArr, []byte(resp.Resume))\n\t\t}\n\t\twg.Wait()\n\t\tclose(ec)\n\t\tclose(cc)\n\t}()\n\treturn cc, ec\n}", "func (c *Client) GetSearchVideoByVideoResult(lib, source string) (*api.SearchTaskResultResponse, error) {\n\treturn api.GetSearchVideoByVideoResult(c, lib, source)\n}", "func (i *InputInlineQueryResultAnimation) GetVideoURL() (value string) {\n\tif i == nil {\n\t\treturn\n\t}\n\treturn i.VideoURL\n}", "func RunQuery(query int, waitGroup *sync.WaitGroup, MgoSession *mgo.Session) {\n\t// Decrement the wait group count so the program knows this\n\t// has been completed once the goroutine exits.\n\tdefer waitGroup.Done()\n\n\t// Request a socket connection from the session to process our query.\n\t// Close the session when the goroutine exits and put the connection back\n\t// into the pool.\n\tsessionCopy := MgoSession.Clone()\n\tdefer sessionCopy.Close()\n\n\t// Get a collection to execute the query against.\n\tcollection := sessionCopy.DB(\"MovieDatabase\").C(\"movies\")\n\n\tlog.Printf(\"RunQuery : %d : Executing\\n\", query)\n\n\t// Retrieve the inteface of movies.\n\tvar m interface{}\n\tm = getPages()\n\terr := collection.Insert(m)\n\tif err != nil {\n\t\tlog.Printf(\"RunQuery : ERROR : %s\\n\", err)\n\t\treturn\n\t}\n\n\tlog.Printf(\"RunQuery : %d : Count[%d]\\n\", query, m)\n}", "func (s *Server) GetFavouriteVideos(w rest.ResponseWriter, r *rest.Request) {\n\tresponse := models.BaseResponse{}\n\tresponse.Init(w)\n\n\tcurrentUser, err := s.LoginProcess(response, r)\n\n\tif err != nil {\n\t\treturn\n\t}\n\n\tpage := s.GetPageFromParams(r)\n\tuserID, err := s.GetUserIDFromParams(r)\n\n\tif err != nil {\n\t\tresponse.SendError(err.Error())\n\t\treturn\n\t}\n\n\tif userID == 0 {\n\t\tuserID = currentUser.ID\n\t}\n\n\tvideo := models.Video{}\n\tvideos, err := video.GetFavouriteVideos(s.Db, userID, page)\n\n\tif err != nil {\n\t\tresponse.SendError(err.Error())\n\t\treturn\n\t}\n\n\tresponse.SendSuccess(videos)\n}", "func DownloadVideo(video *Video) {\n\tdefer wg.Done()\n\tif video.VideoUrl == \"\" {\n\t\treturn\n\t}\n\t// $cmd = sprintf(\"ffmpeg -i \\\"%s\\\" -c copy \\\"%s/%s.mp4\\\"\", $param['video'], $dir, $val['title']);\n\t// cmd := fmt.Sprintf(\"ffmpeg -i \\\"%s\\\" -c copy \\\"%s/%s.mp4\\\"\",\n\t// \tvideo.VideoUrl, VConf.Main.DownloadDir, video.Title)\n\t// log.Println(cmd)\n\tcmd := exec.Command(\"ffmpeg\", \"-i\", `\"`+video.VideoUrl+`\"`,\n\t\t\"-c copy\", fmt.Sprintf(`\"%s/%s.mp4\"`, VConf.Main.DownloadDir, video.Title))\n\tlog.Println(cmd.Path, cmd.Args)\n\terr := cmd.Start()\n\tif err != nil {\n\t\tlog.Println(err)\n\t\treturn\n\t}\n\n}", "func (c *PostThumbnailClient) QueryPost(pt *PostThumbnail) *PostQuery {\n\tquery := &PostQuery{config: c.config}\n\tquery.path = func(ctx context.Context) (fromV *sql.Selector, _ error) {\n\t\tid := pt.ID\n\t\tstep := sqlgraph.NewStep(\n\t\t\tsqlgraph.From(postthumbnail.Table, postthumbnail.FieldID, id),\n\t\t\tsqlgraph.To(post.Table, post.FieldID),\n\t\t\tsqlgraph.Edge(sqlgraph.O2O, true, postthumbnail.PostTable, postthumbnail.PostColumn),\n\t\t)\n\t\tfromV = sqlgraph.Neighbors(pt.driver.Dialect(), step)\n\t\treturn fromV, nil\n\t}\n\treturn query\n}", "func (d *Dao) ListVideoArchive(ctx context.Context, avids []int64) (videos []*model.UpCardVideo, err error) {\n\n\tarchives, err := d.listArchives(ctx, avids)\n\tif err != nil {\n\t\tlog.Error(\"d.listArchives error(%v) arg(%v)\", err, avids)\n\t\terr = ecode.CreativeArcServiceErr\n\t\treturn\n\t}\n\tfor avid, data := range archives {\n\t\tvideo := transfer(avid, data)\n\t\tvideos = append(videos, video)\n\t}\n\n\treturn\n}", "func ParseVideoUrl(video *Video) {\n\tdefer wg.Done()\n\tres, err := http.Get(video.Url)\n\tif err != nil {\n\t\tlog.Println(err)\n\t\treturn\n\t}\n\tdefer res.Body.Close()\n\tbytes, err := ioutil.ReadAll(res.Body)\n\tif err != nil {\n\t\tlog.Println(err)\n\t\treturn\n\t}\n\treg := `videoFlashPlayUrl\\s=\\s\\'(.*)\\'`\n\tsubmatch := regexp.MustCompile(reg).FindAllSubmatch(bytes, -1)\n\tif len(submatch) > 0 && len(submatch[0]) > 0 {\n\t\tvv := submatch[0][1]\n\t\turlInfo, err := url.Parse(string(vv))\n\t\tif err != nil {\n\t\t\tlog.Println(err, string(vv))\n\t\t\treturn\n\t\t}\n\t\tlog.Println(urlInfo.Query()[\"video\"][0])\n\t\tvideo.VideoUrl = urlInfo.Query()[\"video\"][0]\n\t\tgo DownloadVideo(video)\n\t\twg.Add(1)\n\t\t// videoChan <- video\n\t}\n}", "func (i *InputInlineQueryResultAnimation) GetVideoHeight() (value int32) {\n\tif i == nil {\n\t\treturn\n\t}\n\treturn i.VideoHeight\n}", "func (m *MockIRepository) GetRelatedVideos(id aggregates.Id, start, count int) ([]aggregates.RelatedVideo, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"GetRelatedVideos\", id, start, count)\n\tret0, _ := ret[0].([]aggregates.RelatedVideo)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "func loadNewVideosFromMyChannel(knownVideos *tomlKnownVideos) {\n\n\tclient := getClient(youtube.YoutubeReadonlyScope)\n\tservice, err := youtube.New(client)\n\n\t// videoMeta data does not exist if there is no local data in knownvideos.toml\n\tif knownVideos.Videos == nil {\n\t\tknownVideos.Videos = make(map[string]videoMeta)\n\t}\n\tif err != nil {\n\t\tlog.Fatalf(\"Error creating YouTube client: %v\", err)\n\t}\n\n\tresponse := channelsListMine(service, \"contentDetails\")\n\n\tfor _, channel := range response.Items {\n\t\tplaylistId := channel.ContentDetails.RelatedPlaylists.Uploads\n\n\t\t// Print the playlist ID for the list of uploaded videos.\n\t\tfmt.Printf(\"Checking for new videos in list %s\\r\\n\", playlistId)\n\n\t\tnextPageToken := \"\"\n\t\tvar numItemsPerPage int64 = 35\t\t\t// max 50 https://developers.google.com/youtube/v3/docs/playlistItems/list#parameters\n\t\tfoundNewVideos := false\t\t\t\t\t// if we added videos, we will look for next page of videos\n\t\tfor {\n\t\t\t// Retrieve next set of items in the playlist.\n\t\t\t// Items are not returned in perfectly sorted order, so just go through all pages to get all items\n\t\t\t// Revisit this if it gets too slow\n\t\t\tplaylistResponse := playlistItemsList(service, \"snippet,ContentDetails\", playlistId, nextPageToken, numItemsPerPage)\n\n\t\t\tfor _, playlistItem := range playlistResponse.Items {\n\t\t\t\tfoundNewVideos = addNewVideosToList(playlistItem, knownVideos)\n\t\t\t}\n\n\t\t\tif foundNewVideos {\n\t\t\t\tfmt.Println(\"Found some new videos. Let's look for more!\")\n\t\t\t} else {\n\t\t\t\tfmt.Printf(\"Searched %v videos and found nothing new. Let's move on.\\r\\n\",numItemsPerPage)\n\t\t\t\t// The results are not exactly ordered by publishDate, so there could be cases where we didn't find expected videos\n\t\t\t\tfmt.Println(\"If we should have found some, increase numItemsPerPage or remove \\\"!foundNewVideos ||\\\" from code\")\n\t\t\t}\n\t\t\t// Set the token to retrieve the next page of results\n\t\t\t// or exit the loop if all results have (apparently) been retrieved.\n\t\t\tnextPageToken = playlistResponse.NextPageToken\n\t\t\tif !foundNewVideos || nextPageToken == \"\" {\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t}\n}", "func (c *PostVideoClient) Delete() *PostVideoDelete {\n\tmutation := newPostVideoMutation(c.config, OpDelete)\n\treturn &PostVideoDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (d *Dao) VideoOpers(c context.Context, vid int64) (op []*model.VOper, uids []int64, err error) {\n\tvar (\n\t\trows *sql.Rows\n\t\tctime time.Time\n\t)\n\top = []*model.VOper{}\n\tuids = []int64{}\n\tif rows, err = d.arcReadDB.Query(c, _videoOperSQL, vid); err != nil {\n\t\tlog.Error(\"d.arcReadDB.Query error(%v)\", err)\n\t\treturn\n\t}\n\tdefer rows.Close()\n\n\tfor rows.Next() {\n\t\tp := &model.VOper{}\n\t\tif err = rows.Scan(&p.ID, &p.AID, &p.UID, &p.VID, &p.Status, &p.Content, &p.Attribute, &p.LastID, &p.Remark, &ctime); err != nil {\n\t\t\tlog.Error(\"rows.Scan error(%v)\", err)\n\t\t\treturn\n\t\t}\n\t\tp.CTime = ctime.Format(\"2006-01-02 15:04:05\")\n\t\top = append(op, p)\n\t\tuids = append(uids, p.UID)\n\t}\n\treturn\n}", "func (c *Client) SearchVideoByImage(lib string, args *api.BaseRequest) (*api.SearchTaskResultResponse, error) {\n\treturn api.SearchVideoByImage(c, lib, args)\n}", "func (c *UnsavedPostClient) QueryAttachments(up *UnsavedPost) *UnsavedPostAttachmentQuery {\n\tquery := &UnsavedPostAttachmentQuery{config: c.config}\n\tquery.path = func(ctx context.Context) (fromV *sql.Selector, _ error) {\n\t\tid := up.ID\n\t\tstep := sqlgraph.NewStep(\n\t\t\tsqlgraph.From(unsavedpost.Table, unsavedpost.FieldID, id),\n\t\t\tsqlgraph.To(unsavedpostattachment.Table, unsavedpostattachment.FieldID),\n\t\t\tsqlgraph.Edge(sqlgraph.O2M, false, unsavedpost.AttachmentsTable, unsavedpost.AttachmentsColumn),\n\t\t)\n\t\tfromV = sqlgraph.Neighbors(up.driver.Dialect(), step)\n\t\treturn fromV, nil\n\t}\n\treturn query\n}", "func (a *attachUp) AddVideo(p, n string) AttachmentUploader {\n\ta.v = append(a.v, p)\n\tif n == \"\" {\n\t\tn = filepath.Base(p)\n\t}\n\ta.vn = append(a.vn, n)\n\treturn a\n}", "func GetVideoCatalogueByCourseHandle(es *database.ElasticService) func(http.ResponseWriter, *http.Request) {\n\treturn func(w http.ResponseWriter, r *http.Request) {\n\t\tsetupResponse(&w, r)\n\t\tif (*r).Method == \"OPTIONS\" {\n\t\t\treturn\n\t\t}\n\t\tcourse := r.URL.Query()[\"course\"]\n\t\tvideos, err := es.GetUniqueStringFieldValuesInIndexWithFilter(\n\t\t\tdatabase.VideoEventDescriptionIndexName,\n\t\t\t\"video_id\",\n\t\t\t\"course_id\",\n\t\t\tcourse[0],\n\t\t)\n\t\tif err != nil {\n\t\t\tlog.Printf(\"Error! Can't get unique videos for course: %v\\n\", err)\n\t\t\treturn\n\t\t}\n\n\t\tb, err := json.Marshal(videos)\n\t\tif err != nil {\n\t\t\tlog.Printf(\"Error! Can't convert video list to json: %v\\n\", err)\n\t\t}\n\t\tfmt.Fprintf(w, string(b))\n\t}\n}", "func filterVideosFunc(dirEntry os.DirEntry) bool {\r\n\treturn !IsVideoEXT(GetDirEntryEXT(dirEntry))\r\n}", "func VideoDirectory(id string) string {\n\treturn fmt.Sprintf(\"/video/%s\", id)\n}", "func (d *Dao) VideoMetaDB(c context.Context, cid int64) (meta *model.VideoCMS, err error) {\n\trows, err := d.db.Query(c, _videoMeta, cid)\n\tif err != nil {\n\t\tlog.Error(\"VideoMetaDB d.db.Query error(%v)\", err)\n\t\treturn\n\t}\n\tdefer rows.Close()\n\tfor rows.Next() {\n\t\tli := &model.VideoCMS{}\n\t\tif err = rows.Scan(&li.CID, &li.Title, &li.AID, &li.IndexOrder, &li.Valid, &li.Deleted, &li.Result); err != nil {\n\t\t\tlog.Error(\"VideoMetaDB row.Scan error(%v)\", err)\n\t\t\treturn\n\t\t}\n\t\tmeta = li\n\t}\n\treturn\n}", "func (c *UnsavedPostVideoClient) Delete() *UnsavedPostVideoDelete {\n\tmutation := newUnsavedPostVideoMutation(c.config, OpDelete)\n\treturn &UnsavedPostVideoDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func ConcatenateVideos(srcDir, destDir string) error {\n\tlistFilePath := path.Join(destDir, \"list.txt\")\n\terr := generateMP4List(srcDir, listFilePath)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\toutMP4Path := path.Join(destDir, \"out.mp4\")\n\t// ffmpeg -f concat -i mylist.txt -c copy output.mp4\n\targs := []string{\n\t\t\"-f\", \"concat\",\n\t\t\"-safe\", \"0\",\n\t\t\"-i\", listFilePath,\n\t\t\"-c\", \"copy\",\n\t\toutMP4Path,\n\t}\n\treturn runCmd(FFMPEG, \"\", args...)\n}", "func (p *PhoneCallWaiting) SetVideo(value bool) {\n\tif value {\n\t\tp.Flags.Set(6)\n\t\tp.Video = true\n\t} else {\n\t\tp.Flags.Unset(6)\n\t\tp.Video = false\n\t}\n}", "func videoThumbnailsFetcher(domains ...string) func(context.Context, *http.Client, *url.URL) (*unfurlist.Metadata, bool) {\n\tdoms := make(map[string]struct{})\n\tfor _, d := range domains {\n\t\tdoms[d] = struct{}{}\n\t}\n\treturn func(_ context.Context, _ *http.Client, u *url.URL) (*unfurlist.Metadata, bool) {\n\t\tif _, ok := doms[u.Host]; !ok {\n\t\t\treturn nil, false\n\t\t}\n\t\tswitch strings.ToLower(path.Ext(u.Path)) {\n\t\tdefault:\n\t\t\treturn nil, false\n\t\tcase \".mp4\", \".mov\", \".m4v\", \".3gp\", \".webm\", \".mkv\":\n\t\t}\n\t\tu2 := &url.URL{\n\t\t\tScheme: u.Scheme,\n\t\t\tHost: u.Host,\n\t\t\tPath: u.Path + \".thumb\",\n\t\t}\n\t\treturn &unfurlist.Metadata{\n\t\t\tTitle: path.Base(u.Path),\n\t\t\tType: \"video\",\n\t\t\tImage: u2.String(),\n\t\t}, true\n\t}\n}", "func ExampleVideoAnalyzersClient_Get() {\n\tcred, err := azidentity.NewDefaultAzureCredential(nil)\n\tif err != nil {\n\t\tlog.Fatalf(\"failed to obtain a credential: %v\", err)\n\t}\n\tctx := context.Background()\n\tclient, err := armvideoanalyzer.NewVideoAnalyzersClient(\"00000000-0000-0000-0000-000000000000\", cred, nil)\n\tif err != nil {\n\t\tlog.Fatalf(\"failed to create client: %v\", err)\n\t}\n\tres, err := client.Get(ctx,\n\t\t\"contoso\",\n\t\t\"contosotv\",\n\t\tnil)\n\tif err != nil {\n\t\tlog.Fatalf(\"failed to finish the request: %v\", err)\n\t}\n\t// TODO: use response item\n\t_ = res\n}", "func Video(props *VideoProps, children ...Element) *VideoElem {\n\trProps := &_VideoProps{\n\t\tBasicHTMLElement: newBasicHTMLElement(),\n\t}\n\n\tif props != nil {\n\t\tprops.assign(rProps)\n\t}\n\n\treturn &VideoElem{\n\t\tElement: createElement(\"video\", rProps, children...),\n\t}\n}", "func videoPath(filename string) string {\n\treturn fmt.Sprintf(\"content/video/%s\", filename)\n}", "func (d *Dao) VideoMetas(c context.Context, cids []int64) (meta map[int64]*model.VideoCMS, err error) {\n\tmeta = make(map[int64]*model.VideoCMS)\n\trows, err := d.db.Query(c, fmt.Sprintf(_videoMetas, xstr.JoinInts(cids)))\n\tif err != nil {\n\t\tlog.Error(\"VideoMetaDB d.db.Query error(%v)\", err)\n\t\treturn\n\t}\n\tdefer rows.Close()\n\tfor rows.Next() {\n\t\tli := &model.VideoCMS{}\n\t\tif err = rows.Scan(&li.CID, &li.Title, &li.AID, &li.IndexOrder, &li.Valid, &li.Deleted, &li.Result); err != nil {\n\t\t\tlog.Error(\"VideoMetaDB row.Scan error(%v)\", err)\n\t\t\treturn\n\t\t}\n\t\tmeta[int64(li.CID)] = li\n\t}\n\treturn\n}", "func ContainerChildrenPostQuery(\n\tctx context.Context,\n\tclient api.Client,\n\tcontainerPath string,\n\tlimit, maxDepth int,\n\tquery *ContainerQuery) ([]*ContainerChild, error) {\n\n\tvar resp ContainerChildList\n\n\tif err := client.Post(\n\t\tctx,\n\t\trealNamespacePath(client),\n\t\tcontainerPath,\n\t\tapi.OrderedValues{\n\t\t\t{queryByteArr},\n\t\t\t{limitByteArr, []byte(fmt.Sprintf(\"%d\", limit))},\n\t\t\t{maxDepthByteArr, []byte(fmt.Sprintf(\"%d\", maxDepth))},\n\t\t},\n\t\tnil,\n\t\tquery,\n\t\t&resp); err != nil {\n\n\t\treturn nil, err\n\t}\n\n\treturn resp, nil\n}", "func (s *Server) GetFavouriteVideos2(w rest.ResponseWriter, r *rest.Request) {\n\tresponse := models.BaseResponse{}\n\tresponse.Init(w)\n\n\tcurrentUser, err := s.LoginProcess(response, r)\n\n\tif err != nil {\n\t\treturn\n\t}\n\n\tpage := s.GetPageFromParams(r)\n\tuserID, err := s.GetUserIDFromParams(r)\n\n\tif err != nil {\n\t\tresponse.SendError(err.Error())\n\t\treturn\n\t}\n\n\tif userID == 0 {\n\t\tuserID = currentUser.ID\n\t}\n\n\tvideo := models.Video{}\n\tvideos, err := video.GetFavouriteVideos2(s.Db, userID, currentUser.ID, page)\n\n\tif err != nil {\n\t\tresponse.SendError(err.Error())\n\t\treturn\n\t}\n\n\tresponse.SendSuccess(videos)\n}", "func Video(attrs []htmlgo.Attribute, children ...HTML) HTML {\n\treturn &htmlgo.Tree{Tag: \"video\", Attributes: attrs, Children: children}\n}", "func SortVideoQualities(videos []AvailableVideo) {\n\tsort.Sort(sortableVideoQualities(videos))\n}", "func (client *Client) GetVideoInfo(request *GetVideoInfoRequest) (_result *GetVideoInfoResponse, _err error) {\n\truntime := &util.RuntimeOptions{}\n\t_result = &GetVideoInfoResponse{}\n\t_body, _err := client.GetVideoInfoWithOptions(request, runtime)\n\tif _err != nil {\n\t\treturn _result, _err\n\t}\n\t_result = _body\n\treturn _result, _err\n}", "func (c *PostClient) QueryAttachments(po *Post) *PostAttachmentQuery {\n\tquery := &PostAttachmentQuery{config: c.config}\n\tquery.path = func(ctx context.Context) (fromV *sql.Selector, _ error) {\n\t\tid := po.ID\n\t\tstep := sqlgraph.NewStep(\n\t\t\tsqlgraph.From(post.Table, post.FieldID, id),\n\t\t\tsqlgraph.To(postattachment.Table, postattachment.FieldID),\n\t\t\tsqlgraph.Edge(sqlgraph.O2M, false, post.AttachmentsTable, post.AttachmentsColumn),\n\t\t)\n\t\tfromV = sqlgraph.Neighbors(po.driver.Dialect(), step)\n\t\treturn fromV, nil\n\t}\n\treturn query\n}", "func (p *PhoneCallDiscarded) SetVideo(value bool) {\n\tif value {\n\t\tp.Flags.Set(6)\n\t\tp.Video = true\n\t} else {\n\t\tp.Flags.Unset(6)\n\t\tp.Video = false\n\t}\n}", "func (p *PhoneCallAccepted) SetVideo(value bool) {\n\tif value {\n\t\tp.Flags.Set(6)\n\t\tp.Video = true\n\t} else {\n\t\tp.Flags.Unset(6)\n\t\tp.Video = false\n\t}\n}", "func sendVideoMessage(slackClient *slack.RTM, slackChannel string) {\n\tpostMessageParameters:= slack.PostMessageParameters{UnfurlMedia: true, UnfurlLinks: true}\n\tslackClient.PostMessage(slackChannel, slack.MsgOptionText(\"https://www.youtube.com/watch?v=Rh64GkNRDNU&ab_channel=MarySpender\", true), slack.MsgOptionPostMessageParameters(postMessageParameters))\n}", "func (client *Client) DescribePlayTopVideosWithOptions(request *DescribePlayTopVideosRequest, runtime *util.RuntimeOptions) (_result *DescribePlayTopVideosResponse, _err error) {\n\t_err = util.ValidateModel(request)\n\tif _err != nil {\n\t\treturn _result, _err\n\t}\n\tquery := map[string]interface{}{}\n\tif !tea.BoolValue(util.IsUnset(request.BizDate)) {\n\t\tquery[\"BizDate\"] = request.BizDate\n\t}\n\n\tif !tea.BoolValue(util.IsUnset(request.OwnerId)) {\n\t\tquery[\"OwnerId\"] = request.OwnerId\n\t}\n\n\tif !tea.BoolValue(util.IsUnset(request.PageNo)) {\n\t\tquery[\"PageNo\"] = request.PageNo\n\t}\n\n\tif !tea.BoolValue(util.IsUnset(request.PageSize)) {\n\t\tquery[\"PageSize\"] = request.PageSize\n\t}\n\n\treq := &openapi.OpenApiRequest{\n\t\tQuery: openapiutil.Query(query),\n\t}\n\tparams := &openapi.Params{\n\t\tAction: tea.String(\"DescribePlayTopVideos\"),\n\t\tVersion: tea.String(\"2017-03-21\"),\n\t\tProtocol: tea.String(\"HTTPS\"),\n\t\tPathname: tea.String(\"/\"),\n\t\tMethod: tea.String(\"POST\"),\n\t\tAuthType: tea.String(\"AK\"),\n\t\tStyle: tea.String(\"RPC\"),\n\t\tReqBodyType: tea.String(\"formData\"),\n\t\tBodyType: tea.String(\"json\"),\n\t}\n\t_result = &DescribePlayTopVideosResponse{}\n\t_body, _err := client.CallApi(params, req, runtime)\n\tif _err != nil {\n\t\treturn _result, _err\n\t}\n\t_err = tea.Convert(_body, &_result)\n\treturn _result, _err\n}" ]
[ "0.81685627", "0.78411025", "0.63405895", "0.6145093", "0.5831517", "0.5756134", "0.5714916", "0.55673546", "0.55314726", "0.5464284", "0.53828335", "0.5356407", "0.5324934", "0.5267469", "0.52474505", "0.5229819", "0.5183849", "0.5180546", "0.5176505", "0.5146872", "0.5139025", "0.51384115", "0.5126584", "0.51123124", "0.50527537", "0.50424105", "0.49687278", "0.495539", "0.490553", "0.478817", "0.4764638", "0.47498754", "0.4721315", "0.47195753", "0.46819308", "0.4676498", "0.4658189", "0.46374515", "0.45851532", "0.45825732", "0.45766094", "0.45545384", "0.45480898", "0.45376828", "0.45224217", "0.4519576", "0.45192662", "0.45112118", "0.45031264", "0.45019808", "0.44994682", "0.44813955", "0.44770116", "0.4469297", "0.4454587", "0.4438584", "0.443459", "0.442575", "0.44041845", "0.43839014", "0.4349072", "0.43482697", "0.43378296", "0.4307691", "0.4305951", "0.42926344", "0.42840093", "0.42765877", "0.42324463", "0.422204", "0.421117", "0.420758", "0.41931835", "0.4180148", "0.41801396", "0.4171137", "0.41548523", "0.41458738", "0.4145127", "0.41290858", "0.41284817", "0.41210377", "0.41187072", "0.41144896", "0.41070688", "0.4100353", "0.40993282", "0.40949398", "0.4089222", "0.40813327", "0.4072635", "0.40716663", "0.405594", "0.40522742", "0.40518802", "0.40501353", "0.40477103", "0.40373847", "0.40353042", "0.40349266" ]
0.83149624
0
QueryAttachments queries the attachments edge of a Post.
func (c *PostClient) QueryAttachments(po *Post) *PostAttachmentQuery { query := &PostAttachmentQuery{config: c.config} query.path = func(ctx context.Context) (fromV *sql.Selector, _ error) { id := po.ID step := sqlgraph.NewStep( sqlgraph.From(post.Table, post.FieldID, id), sqlgraph.To(postattachment.Table, postattachment.FieldID), sqlgraph.Edge(sqlgraph.O2M, false, post.AttachmentsTable, post.AttachmentsColumn), ) fromV = sqlgraph.Neighbors(po.driver.Dialect(), step) return fromV, nil } return query }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (c *UnsavedPostClient) QueryAttachments(up *UnsavedPost) *UnsavedPostAttachmentQuery {\n\tquery := &UnsavedPostAttachmentQuery{config: c.config}\n\tquery.path = func(ctx context.Context) (fromV *sql.Selector, _ error) {\n\t\tid := up.ID\n\t\tstep := sqlgraph.NewStep(\n\t\t\tsqlgraph.From(unsavedpost.Table, unsavedpost.FieldID, id),\n\t\t\tsqlgraph.To(unsavedpostattachment.Table, unsavedpostattachment.FieldID),\n\t\t\tsqlgraph.Edge(sqlgraph.O2M, false, unsavedpost.AttachmentsTable, unsavedpost.AttachmentsColumn),\n\t\t)\n\t\tfromV = sqlgraph.Neighbors(up.driver.Dialect(), step)\n\t\treturn fromV, nil\n\t}\n\treturn query\n}", "func (upq *UnsavedPostQuery) QueryAttachments() *UnsavedPostAttachmentQuery {\n\tquery := &UnsavedPostAttachmentQuery{config: upq.config}\n\tquery.path = func(ctx context.Context) (fromU *sql.Selector, err error) {\n\t\tif err := upq.prepareQuery(ctx); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tselector := upq.sqlQuery(ctx)\n\t\tif err := selector.Err(); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tstep := sqlgraph.NewStep(\n\t\t\tsqlgraph.From(unsavedpost.Table, unsavedpost.FieldID, selector),\n\t\t\tsqlgraph.To(unsavedpostattachment.Table, unsavedpostattachment.FieldID),\n\t\t\tsqlgraph.Edge(sqlgraph.O2M, false, unsavedpost.AttachmentsTable, unsavedpost.AttachmentsColumn),\n\t\t)\n\t\tfromU = sqlgraph.SetNeighbors(upq.driver.Dialect(), step)\n\t\treturn fromU, nil\n\t}\n\treturn query\n}", "func (c *PostAttachmentClient) Query() *PostAttachmentQuery {\n\treturn &PostAttachmentQuery{\n\t\tconfig: c.config,\n\t}\n}", "func (c *UnsavedPostAttachmentClient) Query() *UnsavedPostAttachmentQuery {\n\treturn &UnsavedPostAttachmentQuery{\n\t\tconfig: c.config,\n\t}\n}", "func (r *PostAttachmentsCollectionRequest) Get(ctx context.Context) ([]Attachment, error) {\n\treturn r.GetN(ctx, 0)\n}", "func (upq *UnsavedPostQuery) WithAttachments(opts ...func(*UnsavedPostAttachmentQuery)) *UnsavedPostQuery {\n\tquery := &UnsavedPostAttachmentQuery{config: upq.config}\n\tfor _, opt := range opts {\n\t\topt(query)\n\t}\n\tupq.withAttachments = query\n\treturn upq\n}", "func (b *PostRequestBuilder) Attachments() *PostAttachmentsCollectionRequestBuilder {\n\tbb := &PostAttachmentsCollectionRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}\n\tbb.baseURL += \"/attachments\"\n\treturn bb\n}", "func (o *Post) GetAttachments() []MicrosoftGraphAttachment {\n\tif o == nil || o.Attachments == nil {\n\t\tvar ret []MicrosoftGraphAttachment\n\t\treturn ret\n\t}\n\treturn *o.Attachments\n}", "func (c *PostAttachmentClient) QueryPost(pa *PostAttachment) *PostQuery {\n\tquery := &PostQuery{config: c.config}\n\tquery.path = func(ctx context.Context) (fromV *sql.Selector, _ error) {\n\t\tid := pa.ID\n\t\tstep := sqlgraph.NewStep(\n\t\t\tsqlgraph.From(postattachment.Table, postattachment.FieldID, id),\n\t\t\tsqlgraph.To(post.Table, post.FieldID),\n\t\t\tsqlgraph.Edge(sqlgraph.M2O, true, postattachment.PostTable, postattachment.PostColumn),\n\t\t)\n\t\tfromV = sqlgraph.Neighbors(pa.driver.Dialect(), step)\n\t\treturn fromV, nil\n\t}\n\treturn query\n}", "func (m *EventItemRequestBuilder) Attachments()(*ib18d29dbe5c1c698693687c9c8e985db4ab1ddf50a568e2d1bfca96b9b934e87.AttachmentsRequestBuilder) {\n return ib18d29dbe5c1c698693687c9c8e985db4ab1ddf50a568e2d1bfca96b9b934e87.NewAttachmentsRequestBuilderInternal(m.pathParameters, m.requestAdapter);\n}", "func (a *Client) GetAttachments(params *GetAttachmentsParams, authInfo runtime.ClientAuthInfoWriter) (*GetAttachmentsOK, error) {\n\t// TODO: Validate the params before sending\n\tif params == nil {\n\t\tparams = NewGetAttachmentsParams()\n\t}\n\n\tresult, err := a.transport.Submit(&runtime.ClientOperation{\n\t\tID: \"GetAttachments\",\n\t\tMethod: \"GET\",\n\t\tPathPattern: \"/attachments\",\n\t\tProducesMediaTypes: []string{\"application/json\"},\n\t\tConsumesMediaTypes: []string{\"application/json\"},\n\t\tSchemes: []string{\"https\"},\n\t\tParams: params,\n\t\tReader: &GetAttachmentsReader{formats: a.formats},\n\t\tAuthInfo: authInfo,\n\t\tContext: params.Context,\n\t\tClient: params.HTTPClient,\n\t})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tsuccess, ok := result.(*GetAttachmentsOK)\n\tif ok {\n\t\treturn success, nil\n\t}\n\t// unexpected success response\n\t// safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue\n\tmsg := fmt.Sprintf(\"unexpected success response for GetAttachments: API contract not enforced by server. Client expected to get an error, but got: %T\", result)\n\tpanic(msg)\n}", "func (m *ChatMessage) GetAttachments()([]ChatMessageAttachmentable) {\n return m.attachments\n}", "func (c *PostAttachmentClient) Get(ctx context.Context, id int) (*PostAttachment, error) {\n\treturn c.Query().Where(postattachment.ID(id)).Only(ctx)\n}", "func (m *ItemMailFoldersItemMessagesMessageItemRequestBuilder) Attachments()(*ItemMailFoldersItemMessagesItemAttachmentsRequestBuilder) {\n return NewItemMailFoldersItemMessagesItemAttachmentsRequestBuilderInternal(m.BaseRequestBuilder.PathParameters, m.BaseRequestBuilder.RequestAdapter)\n}", "func ListAttachments(rs io.ReadSeeker, conf *pdf.Configuration) ([]string, error) {\n\tif conf == nil {\n\t\tconf = pdf.NewDefaultConfiguration()\n\t}\n\n\tfromStart := time.Now()\n\tctx, durRead, durVal, durOpt, err := readValidateAndOptimize(rs, conf, fromStart)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tfromWrite := time.Now()\n\tlist, err := pdf.AttachList(ctx.XRefTable)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tdurWrite := time.Since(fromWrite).Seconds()\n\tdurTotal := time.Since(fromStart).Seconds()\n\tlog.Stats.Printf(\"XRefTable:\\n%s\\n\", ctx)\n\tpdf.TimingStats(\"list files\", durRead, durVal, durOpt, durWrite, durTotal)\n\n\treturn list, nil\n}", "func (o *TaskRequest) GetAttachments() TaskRequestAttachments {\n\tif o == nil || o.Attachments == nil {\n\t\tvar ret TaskRequestAttachments\n\t\treturn ret\n\t}\n\treturn *o.Attachments\n}", "func (pstFile *File) GetAttachments(message *Message, formatType string, encryptionType string) ([]Attachment, error) {\n\tif !message.HasAttachments() {\n\t\treturn nil, nil\n\t}\n\n\tattachmentsTableContext, err := pstFile.GetAttachmentsTableContext(message, formatType, encryptionType)\n\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar attachments []Attachment\n\n\tfor i := 0; i < len(attachmentsTableContext); i++ {\n\t\tattachment, err := pstFile.GetAttachment(message, i, formatType, encryptionType)\n\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tattachments = append(attachments, attachment)\n\t}\n\n\treturn attachments, nil\n}", "func (m *ChatMessage) SetAttachments(value []ChatMessageAttachmentable)() {\n m.attachments = value\n}", "func (c *PostClient) QueryImages(po *Post) *PostImageQuery {\n\tquery := &PostImageQuery{config: c.config}\n\tquery.path = func(ctx context.Context) (fromV *sql.Selector, _ error) {\n\t\tid := po.ID\n\t\tstep := sqlgraph.NewStep(\n\t\t\tsqlgraph.From(post.Table, post.FieldID, id),\n\t\t\tsqlgraph.To(postimage.Table, postimage.FieldID),\n\t\t\tsqlgraph.Edge(sqlgraph.O2M, false, post.ImagesTable, post.ImagesColumn),\n\t\t)\n\t\tfromV = sqlgraph.Neighbors(po.driver.Dialect(), step)\n\t\treturn fromV, nil\n\t}\n\treturn query\n}", "func (o *Post) SetAttachments(v []MicrosoftGraphAttachment) {\n\to.Attachments = &v\n}", "func OnRecieveAttachments(s *discordgo.Session, m *discordgo.MessageCreate) {\n\tctx := context.Background()\n\t// Ignore all messages created by the bot itself\n\t// This isn't required in this specific example but it's a good practice.\n\tif m.Author.ID == s.State.User.ID {\n\t\treturn\n\t}\n\n\tif len(m.Attachments) == 0 {\n\t\treturn\n\t}\n\tsaveAttachments(ctx, m)\n}", "func (n *Client) GetAttachments(siteSlug string, pageSlug string, options *Options) (attachments *Attachments, result *Result) {\n\tu := fmt.Sprintf(\"/sites/%s/pages/%s/attachments\", siteSlug, pageSlug)\n\treq := n.getRequest(\"GET\", u, options)\n\tresult = n.retrieve(req, &attachments)\n\n\treturn\n}", "func (upu *UnsavedPostUpdate) ClearAttachments() *UnsavedPostUpdate {\n\tupu.mutation.ClearAttachments()\n\treturn upu\n}", "func (o *Post) GetAttachmentsOk() ([]MicrosoftGraphAttachment, bool) {\n\tif o == nil || o.Attachments == nil {\n\t\tvar ret []MicrosoftGraphAttachment\n\t\treturn ret, false\n\t}\n\treturn *o.Attachments, true\n}", "func (m *ItemCalendarsItemCalendarViewEventItemRequestBuilder) Attachments()(*ItemCalendarsItemCalendarViewItemAttachmentsRequestBuilder) {\n return NewItemCalendarsItemCalendarViewItemAttachmentsRequestBuilderInternal(m.BaseRequestBuilder.PathParameters, m.BaseRequestBuilder.RequestAdapter)\n}", "func (c *Client) PrintAttachments(attachments []*discordgo.MessageAttachment, conf *Config) {\n\tfor _, a := range attachments {\n\t\tif a.URL != \"\" && a.Filename != \"\" {\n\t\t\tif conf.ColorText {\n\t\t\t\tfmt.Println(Green(a.Filename), \" \\t\", Green(a.URL))\n\t\t\t} else {\n\t\t\t\tfmt.Println(a.Filename, \" \\t\", a.URL)\n\t\t\t}\n\t\t\tif conf.ShowImages {\n\t\t\t\tc.PrintImageURLComplex(a.URL, conf)\n\t\t\t}\n\t\t}\n\t}\n}", "func (o *InlineResponse20049Post) GetAttachments() []map[string]interface{} {\n\tif o == nil || o.Attachments == nil {\n\t\tvar ret []map[string]interface{}\n\t\treturn ret\n\t}\n\treturn *o.Attachments\n}", "func (o *TaskRequest) SetAttachments(v TaskRequestAttachments) {\n\to.Attachments = &v\n}", "func (tangle *Tangle) Attachments(transactionID transaction.ID) CachedAttachments {\n\tattachments := make(CachedAttachments, 0)\n\ttangle.attachmentStorage.ForEach(func(key []byte, cachedObject objectstorage.CachedObject) bool {\n\t\tattachments = append(attachments, &CachedAttachment{CachedObject: cachedObject})\n\n\t\treturn true\n\t}, transactionID.Bytes())\n\n\treturn attachments\n}", "func (c *UnsavedPostClient) QueryImages(up *UnsavedPost) *UnsavedPostImageQuery {\n\tquery := &UnsavedPostImageQuery{config: c.config}\n\tquery.path = func(ctx context.Context) (fromV *sql.Selector, _ error) {\n\t\tid := up.ID\n\t\tstep := sqlgraph.NewStep(\n\t\t\tsqlgraph.From(unsavedpost.Table, unsavedpost.FieldID, id),\n\t\t\tsqlgraph.To(unsavedpostimage.Table, unsavedpostimage.FieldID),\n\t\t\tsqlgraph.Edge(sqlgraph.O2M, false, unsavedpost.ImagesTable, unsavedpost.ImagesColumn),\n\t\t)\n\t\tfromV = sqlgraph.Neighbors(up.driver.Dialect(), step)\n\t\treturn fromV, nil\n\t}\n\treturn query\n}", "func (r Notification_Occurrence_Event) GetAttachments() (resp []datatypes.Notification_Occurrence_Event_Attachment, err error) {\n\terr = r.Session.DoRequest(\"SoftLayer_Notification_Occurrence_Event\", \"getAttachments\", nil, &r.Options, &resp)\n\treturn\n}", "func (mr *MockTestClientMockRecorder) GetTestRunAttachments(arg0, arg1 interface{}) *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"GetTestRunAttachments\", reflect.TypeOf((*MockTestClient)(nil).GetTestRunAttachments), arg0, arg1)\n}", "func (a *EmailControllerApiService) GetAttachments(ctx _context.Context, emailId string) ([]AttachmentMetaData, *_nethttp.Response, error) {\n\tvar (\n\t\tlocalVarHTTPMethod = _nethttp.MethodGet\n\t\tlocalVarPostBody interface{}\n\t\tlocalVarFormFileName string\n\t\tlocalVarFileName string\n\t\tlocalVarFileBytes []byte\n\t\tlocalVarReturnValue []AttachmentMetaData\n\t)\n\n\t// create path and map variables\n\tlocalVarPath := a.client.cfg.BasePath + \"/emails/{emailId}/attachments\"\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"emailId\"+\"}\", _neturl.QueryEscape(parameterToString(emailId, \"\")) , -1)\n\n\tlocalVarHeaderParams := make(map[string]string)\n\tlocalVarQueryParams := _neturl.Values{}\n\tlocalVarFormParams := _neturl.Values{}\n\n\t// to determine the Content-Type header\n\tlocalVarHTTPContentTypes := []string{}\n\n\t// set Content-Type header\n\tlocalVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)\n\tif localVarHTTPContentType != \"\" {\n\t\tlocalVarHeaderParams[\"Content-Type\"] = localVarHTTPContentType\n\t}\n\n\t// to determine the Accept header\n\tlocalVarHTTPHeaderAccepts := []string{\"application/json\"}\n\n\t// set Accept header\n\tlocalVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)\n\tif localVarHTTPHeaderAccept != \"\" {\n\t\tlocalVarHeaderParams[\"Accept\"] = localVarHTTPHeaderAccept\n\t}\n\tif ctx != nil {\n\t\t// API Key Authentication\n\t\tif auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok {\n\t\t\tvar key string\n\t\t\tif auth.Prefix != \"\" {\n\t\t\t\tkey = auth.Prefix + \" \" + auth.Key\n\t\t\t} else {\n\t\t\t\tkey = auth.Key\n\t\t\t}\n\t\t\tlocalVarHeaderParams[\"x-api-key\"] = key\n\t\t}\n\t}\n\tr, err := a.client.prepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)\n\tif err != nil {\n\t\treturn localVarReturnValue, nil, err\n\t}\n\n\tlocalVarHTTPResponse, err := a.client.callAPI(r)\n\tif err != nil || localVarHTTPResponse == nil {\n\t\treturn localVarReturnValue, localVarHTTPResponse, err\n\t}\n\n\tlocalVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body)\n\tlocalVarHTTPResponse.Body.Close()\n\tif err != nil {\n\t\treturn localVarReturnValue, localVarHTTPResponse, err\n\t}\n\n\tif localVarHTTPResponse.StatusCode >= 300 {\n\t\tnewErr := GenericOpenAPIError{\n\t\t\tbody: localVarBody,\n\t\t\terror: localVarHTTPResponse.Status,\n\t\t}\n\t\tif localVarHTTPResponse.StatusCode == 200 {\n\t\t\tvar v []AttachmentMetaData\n\t\t\terr = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\t\t\tif err != nil {\n\t\t\t\tnewErr.error = err.Error()\n\t\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t\t}\n\t\t\tnewErr.model = v\n\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t}\n\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t}\n\n\terr = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\tif err != nil {\n\t\tnewErr := GenericOpenAPIError{\n\t\t\tbody: localVarBody,\n\t\t\terror: err.Error(),\n\t\t}\n\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t}\n\n\treturn localVarReturnValue, localVarHTTPResponse, nil\n}", "func (c *UnsavedPostAttachmentClient) Get(ctx context.Context, id int) (*UnsavedPostAttachment, error) {\n\treturn c.Query().Where(unsavedpostattachment.ID(id)).Only(ctx)\n}", "func (mr *MockTestClientMockRecorder) GetTestResultAttachments(arg0, arg1 interface{}) *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"GetTestResultAttachments\", reflect.TypeOf((*MockTestClient)(nil).GetTestResultAttachments), arg0, arg1)\n}", "func (o *Post) HasAttachments() bool {\n\tif o != nil && o.Attachments != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (m *ItemOutlookTaskFoldersItemTasksOutlookTaskItemRequestBuilder) Attachments()(*ItemOutlookTaskFoldersItemTasksItemAttachmentsRequestBuilder) {\n return NewItemOutlookTaskFoldersItemTasksItemAttachmentsRequestBuilderInternal(m.BaseRequestBuilder.PathParameters, m.BaseRequestBuilder.RequestAdapter)\n}", "func (p AttachmentParameters) ToQuery() string {\n\treturn paramsToQuery(p)\n}", "func (upuo *UnsavedPostUpdateOne) ClearAttachments() *UnsavedPostUpdateOne {\n\tupuo.mutation.ClearAttachments()\n\treturn upuo\n}", "func (c Client) ListAttachments(ctx context.Context, ID it.IssueID) ([]it.Attachment, error) {\n\tmi, err := c.getIssue(ctx, ID)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tas := make([]it.Attachment, len(mi.Attachments))\n\tfor i, a := range mi.Attachments {\n\t\tdl := a.DownloadURL\n\t\tas[i] = it.Attachment{\n\t\t\tID: it.AttachmentID(strconv.Itoa(a.ID)),\n\t\t\tName: a.FileName,\n\t\t\tMIMEType: a.ContentType,\n\t\t\tGetBody: func() (io.ReadCloser, error) {\n\t\t\t\treq, err := http.NewRequest(\"GET\", dl, nil)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn nil, err\n\t\t\t\t}\n\t\t\t\tresp, err := http.DefaultClient.Do(req.WithContext(ctx))\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn nil, err\n\t\t\t\t}\n\t\t\t\treturn resp.Body, nil\n\t\t\t},\n\t\t}\n\t}\n\treturn as, nil\n}", "func (store *AttachmentStore) ClearAttachments() {\n\tstore.Lock()\n\tdefer store.Unlock()\n\tstore.clearAttachments()\n}", "func (r *Revision) AttachmentsIterator() (driver.Attachments, error) {\n\tif attachments, _ := r.options[\"attachments\"].(bool); !attachments {\n\t\treturn nil, nil\n\t}\n\tif accept, _ := r.options[\"header:accept\"].(string); accept == \"application/json\" {\n\t\treturn nil, nil\n\t}\n\titer := make(attsIter, 0, len(r.Attachments))\n\tfor filename, att := range r.Attachments {\n\t\tf, err := att.Open()\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tdrAtt := &driver.Attachment{\n\t\t\tFilename: filename,\n\t\t\tContent: f,\n\t\t\tContentType: att.ContentType,\n\t\t\tStub: att.Stub,\n\t\t\tFollows: att.Follows,\n\t\t\tSize: att.Size,\n\t\t\tDigest: att.Digest,\n\t\t}\n\t\tif att.RevPos != nil {\n\t\t\tdrAtt.RevPos = *att.RevPos\n\t\t}\n\t\titer = append(iter, drAtt)\n\t}\n\treturn &iter, nil\n}", "func (ctrl Attachment) List(ctx context.Context, r *request.AttachmentList) (interface{}, error) {\n\tif !auth.GetIdentityFromContext(ctx).Valid() {\n\t\treturn nil, errors.New(\"Unauthorized\")\n\t}\n\n\tf := types.AttachmentFilter{\n\t\tNamespaceID: r.NamespaceID,\n\t\tKind: r.Kind,\n\t\tModuleID: r.ModuleID,\n\t\tRecordID: r.RecordID,\n\t\tFieldName: r.FieldName,\n\t\t// Filter: r.Filter,\n\t\tPerPage: r.PerPage,\n\t\tPage: r.Page,\n\t\t// Sort: r.Sort,\n\t}\n\n\tset, filter, err := ctrl.attachment.With(ctx).Find(f)\n\treturn ctrl.makeFilterPayload(ctx, set, filter, err)\n}", "func (upq *UnsavedPostQuery) QueryImages() *UnsavedPostImageQuery {\n\tquery := &UnsavedPostImageQuery{config: upq.config}\n\tquery.path = func(ctx context.Context) (fromU *sql.Selector, err error) {\n\t\tif err := upq.prepareQuery(ctx); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tselector := upq.sqlQuery(ctx)\n\t\tif err := selector.Err(); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tstep := sqlgraph.NewStep(\n\t\t\tsqlgraph.From(unsavedpost.Table, unsavedpost.FieldID, selector),\n\t\t\tsqlgraph.To(unsavedpostimage.Table, unsavedpostimage.FieldID),\n\t\t\tsqlgraph.Edge(sqlgraph.O2M, false, unsavedpost.ImagesTable, unsavedpost.ImagesColumn),\n\t\t)\n\t\tfromU = sqlgraph.SetNeighbors(upq.driver.Dialect(), step)\n\t\treturn fromU, nil\n\t}\n\treturn query\n}", "func GetAttachmentData() []*types.Attachment {\n\treturn []*types.Attachment{\n\t\t{\n\t\t\tID: \"fakeID0\",\n\t\t\tName: \"fakeName0\",\n\t\t\tUploadURL: \"fakeUploadURL0\",\n\t\t\tDownloadURL: \"fakeDownloadURL0\",\n\t\t\tUploaded: true,\n\t\t},\n\t\t{\n\t\t\tID: \"fakeID1\",\n\t\t\tName: \"fakeName1\",\n\t\t\tUploadURL: \"fakeUploadURL1\",\n\t\t\tDownloadURL: \"fakeDownloadURL1\",\n\t\t\tUploaded: false,\n\t\t},\n\t}\n}", "func (message *Message) HasAttachments() bool {\n\treturn message.GetInteger(3591) & 0x10 != 0\n}", "func (s *SubmitTaskStateChangeInput) SetAttachments(v []*AttachmentStateChange) *SubmitTaskStateChangeInput {\n\ts.Attachments = v\n\treturn s\n}", "func (r *SpacesMessagesAttachmentsService) Get(name string) *SpacesMessagesAttachmentsGetCall {\n\tc := &SpacesMessagesAttachmentsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}\n\tc.name = name\n\treturn c\n}", "func ExtractAttachments(rs io.ReadSeeker, outDir string, fileNames []string, conf *pdf.Configuration) error {\n\tif conf == nil {\n\t\tconf = pdf.NewDefaultConfiguration()\n\t}\n\n\tfromStart := time.Now()\n\tctx, durRead, durVal, durOpt, err := readValidateAndOptimize(rs, conf, fromStart)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tfromWrite := time.Now()\n\n\tctx.Write.DirName = outDir\n\tif err = pdf.AttachExtract(ctx, stringSet(fileNames)); err != nil {\n\t\treturn err\n\t}\n\n\tdurWrite := time.Since(fromWrite).Seconds()\n\tdurTotal := time.Since(fromStart).Seconds()\n\tlog.Stats.Printf(\"XRefTable:\\n%s\\n\", ctx)\n\tpdf.TimingStats(\"write files\", durRead, durVal, durOpt, durWrite, durTotal)\n\n\treturn nil\n}", "func (o *InlineResponse200115) GetAttachments() []map[string]interface{} {\n\tif o == nil || o.Attachments == nil {\n\t\tvar ret []map[string]interface{}\n\t\treturn ret\n\t}\n\treturn *o.Attachments\n}", "func (c *PostThumbnailClient) QueryPost(pt *PostThumbnail) *PostQuery {\n\tquery := &PostQuery{config: c.config}\n\tquery.path = func(ctx context.Context) (fromV *sql.Selector, _ error) {\n\t\tid := pt.ID\n\t\tstep := sqlgraph.NewStep(\n\t\t\tsqlgraph.From(postthumbnail.Table, postthumbnail.FieldID, id),\n\t\t\tsqlgraph.To(post.Table, post.FieldID),\n\t\t\tsqlgraph.Edge(sqlgraph.O2O, true, postthumbnail.PostTable, postthumbnail.PostColumn),\n\t\t)\n\t\tfromV = sqlgraph.Neighbors(pt.driver.Dialect(), step)\n\t\treturn fromV, nil\n\t}\n\treturn query\n}", "func (s stack) ListVolumeAttachments(ctx context.Context, serverRef string) ([]*abstract.VolumeAttachment, fail.Error) {\n\tif valid.IsNil(s) {\n\t\treturn nil, fail.InvalidInstanceError()\n\t}\n\treturn nil, fail.NotImplementedError(\"implement me\")\n}", "func (t *Transaction) QueryImages() *BinaryItemQuery {\n\treturn (&TransactionClient{config: t.config}).QueryImages(t)\n}", "func (pstFile *File) GetAttachmentsCount(message *Message, formatType string, encryptionType string) (int, error) {\n\tattachmentsTableContext, err := pstFile.GetAttachmentsTableContext(message, formatType, encryptionType)\n\n\tif err != nil {\n\t\treturn -1, err\n\t}\n\n\treturn len(attachmentsTableContext), nil\n}", "func (c *AdminClient) QueryPosts(a *Admin) *PostQuery {\n\tquery := &PostQuery{config: c.config}\n\tquery.path = func(ctx context.Context) (fromV *sql.Selector, _ error) {\n\t\tid := a.ID\n\t\tstep := sqlgraph.NewStep(\n\t\t\tsqlgraph.From(admin.Table, admin.FieldID, id),\n\t\t\tsqlgraph.To(post.Table, post.FieldID),\n\t\t\tsqlgraph.Edge(sqlgraph.O2M, false, admin.PostsTable, admin.PostsColumn),\n\t\t)\n\t\tfromV = sqlgraph.Neighbors(a.driver.Dialect(), step)\n\t\treturn fromV, nil\n\t}\n\treturn query\n}", "func (m *Migration) GetExcludeAttachments() bool {\n\tif m == nil || m.ExcludeAttachments == nil {\n\t\treturn false\n\t}\n\treturn *m.ExcludeAttachments\n}", "func (o *Post) GetHasAttachments() bool {\n\tif o == nil || o.HasAttachments == nil {\n\t\tvar ret bool\n\t\treturn ret\n\t}\n\treturn *o.HasAttachments\n}", "func TestAttachments(t *testing.T) {\n\te := testutils.TestEmail()\n\n\tattachment := testutils.TestAttachment(t)\n\te.Attachments = append(e.Attachments, attachment)\n\n\tparams, err := b.paramsForEmail(e)\n\tif err != nil {\n\t\tt.FailNow()\n\t}\n\n\t// the sendgrid backend will have read the contents of the reader,\n\t// so we need to seek back to the beginning\n\toffset, err := attachment.Data.(io.ReadSeeker).Seek(0, 0)\n\tif err != nil {\n\t\tt.FailNow()\n\t} else if offset != int64(0) {\n\t\tt.FailNow()\n\t}\n\n\t// check that the file data is there\n\tfileData, err := ioutil.ReadAll(attachment.Data)\n\tif err != nil {\n\t\tt.FailNow()\n\t}\n\tif params.Get(fmt.Sprintf(\"files[%v]\", e.Attachments[0].Name)) != string(fileData) {\n\t\tt.FailNow()\n\t}\n}", "func List(c *golangsdk.ServiceClient, serverId string) ([]VolumeAttachment, error) {\n\tvar rst golangsdk.Result\n\t_, err := c.Get(rootURL(c, serverId), &rst.Body, &golangsdk.RequestOpts{\n\t\tMoreHeaders: requestOpts.MoreHeaders,\n\t})\n\tif err == nil {\n\t\tvar r []VolumeAttachment\n\t\trst.ExtractIntoSlicePtr(&r, \"volumeAttachments\")\n\t\treturn r, nil\n\t}\n\treturn nil, err\n}", "func (r AttachmentRepository) CreateManyAttachments(ctx context.Context, attachments []models.Attachment, feedbackID uint) error {\n\tdb := getDB(ctx, r.database.DB)\n\tq := r.database.SB.Insert(\"attachments\").Columns(\"name\", \"path\", \"feedback_id\")\n\n\tfor _, a := range attachments {\n\t\tq = q.Values(a.Name, a.Path, feedbackID)\n\t}\n\tq = q.Suffix(\"RETURNING id, name, path, feedback_id\")\n\n\tsql, args, err := q.ToSql()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\trows, err := db.Query(ctx, sql, args...)\n\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tgot, err := r.scan(rows)\n\tif err != nil {\n\t\treturn err\n\t}\n\tcopy(attachments, got)\n\t//r.close(db)\n\treturn nil\n\n}", "func (o GetTransitRouterVbrAttachmentsResultOutput) Attachments() GetTransitRouterVbrAttachmentsAttachmentArrayOutput {\n\treturn o.ApplyT(func(v GetTransitRouterVbrAttachmentsResult) []GetTransitRouterVbrAttachmentsAttachment {\n\t\treturn v.Attachments\n\t}).(GetTransitRouterVbrAttachmentsAttachmentArrayOutput)\n}", "func (m *EventItemRequestBuilder) AttachmentsById(id string)(*ia583e36d9ac073d787b4f5e0abb093224bbfbbb0acf8b3a6f1b0f1e7dfd13a55.AttachmentItemRequestBuilder) {\n urlTplParams := make(map[string]string)\n for idx, item := range m.pathParameters {\n urlTplParams[idx] = item\n }\n if id != \"\" {\n urlTplParams[\"attachment%2Did\"] = id\n }\n return ia583e36d9ac073d787b4f5e0abb093224bbfbbb0acf8b3a6f1b0f1e7dfd13a55.NewAttachmentItemRequestBuilderInternal(urlTplParams, m.requestAdapter);\n}", "func (o *TaskRequest) HasAttachments() bool {\n\tif o != nil && o.Attachments != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (a *Client) ListAttachments(params *ListAttachmentsParams, opts ...ClientOption) (*ListAttachmentsOK, error) {\n\t// TODO: Validate the params before sending\n\tif params == nil {\n\t\tparams = NewListAttachmentsParams()\n\t}\n\top := &runtime.ClientOperation{\n\t\tID: \"list_attachments\",\n\t\tMethod: \"GET\",\n\t\tPathPattern: \"/attach\",\n\t\tProducesMediaTypes: []string{\"application/json\"},\n\t\tConsumesMediaTypes: []string{\"application/json\"},\n\t\tSchemes: []string{\"http\", \"https\"},\n\t\tParams: params,\n\t\tReader: &ListAttachmentsReader{formats: a.formats},\n\t\tContext: params.Context,\n\t\tClient: params.HTTPClient,\n\t}\n\tfor _, opt := range opts {\n\t\topt(op)\n\t}\n\n\tresult, err := a.transport.Submit(op)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tsuccess, ok := result.(*ListAttachmentsOK)\n\tif ok {\n\t\treturn success, nil\n\t}\n\t// unexpected success response\n\tunexpectedSuccess := result.(*ListAttachmentsDefault)\n\treturn nil, runtime.NewAPIError(\"unexpected success response: content available as default response in error\", unexpectedSuccess, unexpectedSuccess.Code())\n}", "func (c *UnsavedPostAttachmentClient) QueryUnsavedPost(upa *UnsavedPostAttachment) *UnsavedPostQuery {\n\tquery := &UnsavedPostQuery{config: c.config}\n\tquery.path = func(ctx context.Context) (fromV *sql.Selector, _ error) {\n\t\tid := upa.ID\n\t\tstep := sqlgraph.NewStep(\n\t\t\tsqlgraph.From(unsavedpostattachment.Table, unsavedpostattachment.FieldID, id),\n\t\t\tsqlgraph.To(unsavedpost.Table, unsavedpost.FieldID),\n\t\t\tsqlgraph.Edge(sqlgraph.M2O, true, unsavedpostattachment.UnsavedPostTable, unsavedpostattachment.UnsavedPostColumn),\n\t\t)\n\t\tfromV = sqlgraph.Neighbors(upa.driver.Dialect(), step)\n\t\treturn fromV, nil\n\t}\n\treturn query\n}", "func (r *PostAttachmentsCollectionRequest) GetN(ctx context.Context, n int) ([]Attachment, error) {\n\tvar query string\n\tif r.query != nil {\n\t\tquery = \"?\" + r.query.Encode()\n\t}\n\treturn r.Paging(ctx, \"GET\", query, nil, n)\n}", "func (o *Post) PostUploadFiles(mods ...qm.QueryMod) postUploadFileQuery {\n\tvar queryMods []qm.QueryMod\n\tif len(mods) != 0 {\n\t\tqueryMods = append(queryMods, mods...)\n\t}\n\n\tqueryMods = append(queryMods,\n\t\tqm.Where(\"\\\"post_upload_files\\\".\\\"post_id\\\"=?\", o.ID),\n\t)\n\n\tquery := PostUploadFiles(queryMods...)\n\tqueries.SetFrom(query.Query, \"\\\"post_upload_files\\\"\")\n\n\tif len(queries.GetSelect(query.Query)) == 0 {\n\t\tqueries.SetSelect(query.Query, []string{\"\\\"post_upload_files\\\".*\"})\n\t}\n\n\treturn query\n}", "func (o *GetAttachmentParams) WithTimeout(timeout time.Duration) *GetAttachmentParams {\n\to.SetTimeout(timeout)\n\treturn o\n}", "func (bot *bot) DMWithAttachments(mattermostUserID string, attachments ...*model.SlackAttachment) (string, error) {\n\tpost := model.Post{}\n\tmodel.ParseSlackAttachment(&post, attachments)\n\treturn bot.dm(mattermostUserID, &post)\n}", "func (m *ItemTodoListsItemTasksTodoTaskItemRequestBuilder) Attachments()(*ItemTodoListsItemTasksItemAttachmentsRequestBuilder) {\n return NewItemTodoListsItemTasksItemAttachmentsRequestBuilderInternal(m.BaseRequestBuilder.PathParameters, m.BaseRequestBuilder.RequestAdapter)\n}", "func (o GetInstanceAttachmentsResultOutput) Attachments() GetInstanceAttachmentsAttachmentArrayOutput {\n\treturn o.ApplyT(func(v GetInstanceAttachmentsResult) []GetInstanceAttachmentsAttachment { return v.Attachments }).(GetInstanceAttachmentsAttachmentArrayOutput)\n}", "func (u *UserMigration) GetExcludeAttachments() bool {\n\tif u == nil || u.ExcludeAttachments == nil {\n\t\treturn false\n\t}\n\treturn *u.ExcludeAttachments\n}", "func (o *InlineResponse20051TodoItems) SetAttachmentsCount(v string) {\n\to.AttachmentsCount = &v\n}", "func (s *SubmitAttachmentStateChangesInput) SetAttachments(v []*AttachmentStateChange) *SubmitAttachmentStateChangesInput {\n\ts.Attachments = v\n\treturn s\n}", "func (c *PostVideoClient) QueryPost(pv *PostVideo) *PostQuery {\n\tquery := &PostQuery{config: c.config}\n\tquery.path = func(ctx context.Context) (fromV *sql.Selector, _ error) {\n\t\tid := pv.ID\n\t\tstep := sqlgraph.NewStep(\n\t\t\tsqlgraph.From(postvideo.Table, postvideo.FieldID, id),\n\t\t\tsqlgraph.To(post.Table, post.FieldID),\n\t\t\tsqlgraph.Edge(sqlgraph.M2O, true, postvideo.PostTable, postvideo.PostColumn),\n\t\t)\n\t\tfromV = sqlgraph.Neighbors(pv.driver.Dialect(), step)\n\t\treturn fromV, nil\n\t}\n\treturn query\n}", "func (m *ItemCalendarGroupsItemCalendarsItemCalendarViewItemExceptionOccurrencesEventItemRequestBuilder) Attachments()(*ItemCalendarGroupsItemCalendarsItemCalendarViewItemExceptionOccurrencesItemAttachmentsRequestBuilder) {\n return NewItemCalendarGroupsItemCalendarsItemCalendarViewItemExceptionOccurrencesItemAttachmentsRequestBuilderInternal(m.BaseRequestBuilder.PathParameters, m.BaseRequestBuilder.RequestAdapter)\n}", "func ListScriptAttachmentsMocked(t *testing.T, attachmentsIn []*types.Attachment, scriptID string) []*types.Attachment {\n\n\tassert := assert.New(t)\n\n\t// wire up\n\tcs := &utils.MockConcertoService{}\n\tds, err := NewScriptService(cs)\n\tassert.Nil(err, \"Couldn't load script service\")\n\tassert.NotNil(ds, \"Script service not instanced\")\n\n\t// to json\n\tdIn, err := json.Marshal(attachmentsIn)\n\tassert.Nil(err, \"Script test data corrupted\")\n\n\t// call service\n\tcs.On(\"Get\", fmt.Sprintf(APIPathBlueprintScriptAttachments, scriptID)).Return(dIn, 200, nil)\n\tattachmentsOut, err := ds.ListScriptAttachments(scriptID)\n\tassert.Nil(err, \"Error getting script attachments list\")\n\tassert.Equal(attachmentsIn, attachmentsOut, \"ListScriptAttachments returned different attachments\")\n\n\treturn attachmentsOut\n}", "func (mr *MockResultDBClientMockRecorder) QueryArtifacts(ctx, in interface{}, opts ...interface{}) *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\tvarargs := append([]interface{}{ctx, in}, opts...)\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"QueryArtifacts\", reflect.TypeOf((*MockResultDBClient)(nil).QueryArtifacts), varargs...)\n}", "func (s *Cluster) SetAttachments(v []*Attachment) *Cluster {\n\ts.Attachments = v\n\treturn s\n}", "func (upu *UnsavedPostUpdate) AddAttachments(u ...*UnsavedPostAttachment) *UnsavedPostUpdate {\n\tids := make([]int, len(u))\n\tfor i := range u {\n\t\tids[i] = u[i].ID\n\t}\n\treturn upu.AddAttachmentIDs(ids...)\n}", "func (mr *MockTestClientMockRecorder) GetTestResultAttachmentContent(arg0, arg1 interface{}) *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"GetTestResultAttachmentContent\", reflect.TypeOf((*MockTestClient)(nil).GetTestResultAttachmentContent), arg0, arg1)\n}", "func (upuo *UnsavedPostUpdateOne) AddAttachments(u ...*UnsavedPostAttachment) *UnsavedPostUpdateOne {\n\tids := make([]int, len(u))\n\tfor i := range u {\n\t\tids[i] = u[i].ID\n\t}\n\treturn upuo.AddAttachmentIDs(ids...)\n}", "func (o *InlineResponse20051TodoItems) GetAttachmentsCount() string {\n\tif o == nil || o.AttachmentsCount == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\treturn *o.AttachmentsCount\n}", "func (o VolumeV2Output) Attachments() VolumeV2AttachmentArrayOutput {\n\treturn o.ApplyT(func(v *VolumeV2) VolumeV2AttachmentArrayOutput { return v.Attachments }).(VolumeV2AttachmentArrayOutput)\n}", "func AddAttachments(rs io.ReadSeeker, w io.Writer, files []string, conf *pdf.Configuration) error {\n\tif conf == nil {\n\t\tconf = pdf.NewDefaultConfiguration()\n\t}\n\n\tfromStart := time.Now()\n\tctx, durRead, durVal, durOpt, err := readValidateAndOptimize(rs, conf, fromStart)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tfrom := time.Now()\n\tvar ok bool\n\n\tif ok, err = pdf.AttachAdd(ctx.XRefTable, stringSet(files)); err != nil {\n\t\treturn err\n\t}\n\tif !ok {\n\t\tlog.CLI.Println(\"no attachment added.\")\n\t\treturn nil\n\t}\n\n\tdurAdd := time.Since(from).Seconds()\n\tfromWrite := time.Now()\n\n\tif err = WriteContext(ctx, w); err != nil {\n\t\treturn err\n\t}\n\n\tdurWrite := durAdd + time.Since(fromWrite).Seconds()\n\tdurTotal := time.Since(fromStart).Seconds()\n\tlogOperationStats(ctx, \"add attachment, write\", durRead, durVal, durOpt, durWrite, durTotal)\n\n\treturn nil\n}", "func (c *CategoryClient) QueryPosts(ca *Category) *PostQuery {\n\tquery := &PostQuery{config: c.config}\n\tquery.path = func(ctx context.Context) (fromV *sql.Selector, _ error) {\n\t\tid := ca.ID\n\t\tstep := sqlgraph.NewStep(\n\t\t\tsqlgraph.From(category.Table, category.FieldID, id),\n\t\t\tsqlgraph.To(post.Table, post.FieldID),\n\t\t\tsqlgraph.Edge(sqlgraph.O2M, false, category.PostsTable, category.PostsColumn),\n\t\t)\n\t\tfromV = sqlgraph.Neighbors(ca.driver.Dialect(), step)\n\t\treturn fromV, nil\n\t}\n\treturn query\n}", "func (e *Equipment) QueryFiles() *FileQuery {\n\treturn (&EquipmentClient{e.config}).QueryFiles(e)\n}", "func (o *InlineResponse200115) SetAttachmentsCount(v string) {\n\to.AttachmentsCount = &v\n}", "func (o *TaskRequest) GetAttachmentsOk() (*TaskRequestAttachments, bool) {\n\tif o == nil || o.Attachments == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Attachments, true\n}", "func (c *PostImageClient) QueryPost(pi *PostImage) *PostQuery {\n\tquery := &PostQuery{config: c.config}\n\tquery.path = func(ctx context.Context) (fromV *sql.Selector, _ error) {\n\t\tid := pi.ID\n\t\tstep := sqlgraph.NewStep(\n\t\t\tsqlgraph.From(postimage.Table, postimage.FieldID, id),\n\t\t\tsqlgraph.To(post.Table, post.FieldID),\n\t\t\tsqlgraph.Edge(sqlgraph.M2O, true, postimage.PostTable, postimage.PostColumn),\n\t\t)\n\t\tfromV = sqlgraph.Neighbors(pi.driver.Dialect(), step)\n\t\treturn fromV, nil\n\t}\n\treturn query\n}", "func (ms HistogramBucketExemplar) Attachments() StringMap {\n\treturn newStringMap(&(*ms.orig).Attachments)\n}", "func (o GetTransitRouterVpcAttachmentsResultOutput) Attachments() GetTransitRouterVpcAttachmentsAttachmentArrayOutput {\n\treturn o.ApplyT(func(v GetTransitRouterVpcAttachmentsResult) []GetTransitRouterVpcAttachmentsAttachment {\n\t\treturn v.Attachments\n\t}).(GetTransitRouterVpcAttachmentsAttachmentArrayOutput)\n}", "func (o *InlineResponse20049Post) HasAttachments() bool {\n\tif o != nil && o.Attachments != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (c *PostClient) QueryVideos(po *Post) *PostVideoQuery {\n\tquery := &PostVideoQuery{config: c.config}\n\tquery.path = func(ctx context.Context) (fromV *sql.Selector, _ error) {\n\t\tid := po.ID\n\t\tstep := sqlgraph.NewStep(\n\t\t\tsqlgraph.From(post.Table, post.FieldID, id),\n\t\t\tsqlgraph.To(postvideo.Table, postvideo.FieldID),\n\t\t\tsqlgraph.Edge(sqlgraph.O2M, false, post.VideosTable, post.VideosColumn),\n\t\t)\n\t\tfromV = sqlgraph.Neighbors(po.driver.Dialect(), step)\n\t\treturn fromV, nil\n\t}\n\treturn query\n}", "func (this *Value) GetAttachment(key string) interface{} {\n\tif this.attachments != nil {\n\t\treturn this.attachments[key]\n\t}\n\treturn nil\n}", "func (a *Client) PostAttachments(params *PostAttachmentsParams, authInfo runtime.ClientAuthInfoWriter) (*PostAttachmentsOK, error) {\n\t// TODO: Validate the params before sending\n\tif params == nil {\n\t\tparams = NewPostAttachmentsParams()\n\t}\n\n\tresult, err := a.transport.Submit(&runtime.ClientOperation{\n\t\tID: \"PostAttachments\",\n\t\tMethod: \"POST\",\n\t\tPathPattern: \"/attachments\",\n\t\tProducesMediaTypes: []string{\"application/json\"},\n\t\tConsumesMediaTypes: []string{\"multipart/form-data\"},\n\t\tSchemes: []string{\"https\"},\n\t\tParams: params,\n\t\tReader: &PostAttachmentsReader{formats: a.formats},\n\t\tAuthInfo: authInfo,\n\t\tContext: params.Context,\n\t\tClient: params.HTTPClient,\n\t})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tsuccess, ok := result.(*PostAttachmentsOK)\n\tif ok {\n\t\treturn success, nil\n\t}\n\t// unexpected success response\n\t// safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue\n\tmsg := fmt.Sprintf(\"unexpected success response for PostAttachments: API contract not enforced by server. Client expected to get an error, but got: %T\", result)\n\tpanic(msg)\n}", "func ContainerChildrenGetQuery(\n\tctx context.Context,\n\tclient api.Client,\n\tcontainerPath string,\n\tlimit, maxDepth int,\n\tobjectType, sortDir string,\n\tsort, detail []string) (<-chan *ContainerChild, <-chan error) {\n\n\tvar (\n\t\tec = make(chan error)\n\t\tcc = make(chan *ContainerChild)\n\t\twg = &sync.WaitGroup{}\n\t\trnp = realNamespacePath(client)\n\t\tqs = api.OrderedValues{\n\t\t\t{queryByteArr},\n\t\t\t{limitByteArr, []byte(fmt.Sprintf(\"%d\", limit))},\n\t\t\t{maxDepthByteArr, []byte(fmt.Sprintf(\"%d\", maxDepth))},\n\t\t}\n\t)\n\n\tif objectType != \"\" {\n\t\tqs.Set(typeByteArr, []byte(objectType))\n\t}\n\tif len(sort) > 0 {\n\t\tif strings.EqualFold(sortDir, \"asc\") {\n\t\t\tqs = append(qs, sortDirAsc)\n\t\t} else {\n\t\t\tqs = append(qs, sortDirDesc)\n\t\t}\n\t\tqs = append(qs, append(sortQS, to2DByteArray(sort)...))\n\t}\n\tif len(detail) > 0 {\n\t\tqs = append(qs, append(detailQS, to2DByteArray(detail)...))\n\t}\n\n\tgo func() {\n\t\tfor {\n\t\t\tvar resp resumeableContainerChildList\n\t\t\tif err := client.Get(\n\t\t\t\tctx,\n\t\t\t\trnp,\n\t\t\t\tcontainerPath,\n\t\t\t\tqs,\n\t\t\t\tnil,\n\t\t\t\t&resp); err != nil {\n\t\t\t\tec <- err\n\t\t\t\tclose(ec)\n\t\t\t\tclose(cc)\n\t\t\t\treturn\n\t\t\t}\n\t\t\twg.Add(1)\n\t\t\tgo func(resp *resumeableContainerChildList) {\n\t\t\t\tdefer wg.Done()\n\t\t\t\tfor _, c := range resp.Children {\n\t\t\t\t\tcc <- c\n\t\t\t\t}\n\t\t\t}(&resp)\n\t\t\tif resp.Resume == \"\" {\n\t\t\t\tbreak\n\t\t\t}\n\t\t\tqs.Set(resumeByteArr, []byte(resp.Resume))\n\t\t}\n\t\twg.Wait()\n\t\tclose(ec)\n\t\tclose(cc)\n\t}()\n\treturn cc, ec\n}", "func gmailDownloadAttachments(svc *gmail.Service, query string, outDir string) {\n\ttotalMsg, totalAtt := 0, 0\n\tpageToken := \"\"\n\tfor {\n\t\treq := svc.Users.Messages.List(\"me\").Q(query)\n\t\tif pageToken != \"\" {\n\t\t\treq.PageToken(pageToken)\n\t\t}\n\t\tr, err := req.Do()\n\t\tif err != nil {\n\t\t\tlog.Fatalf(\"Unable to retrieve messages: %v\", err)\n\t\t}\n\n\t\tfor _, m := range r.Messages {\n\t\t\tmsg, err := svc.Users.Messages.Get(\"me\", m.Id).Do()\n\t\t\tif err != nil {\n\t\t\t\tlog.Fatalf(\"Unable to retrieve message %v: %v\", m.Id, err)\n\t\t\t}\n\n\t\t\tsubject := \"\"\n\t\t\tfor _, h := range msg.Payload.Headers {\n\t\t\t\tif h.Name == \"Subject\" {\n\t\t\t\t\tsubject = h.Value\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t}\n\t\t\ttotalMsg++\n\t\t\tlog.Printf(\"Message #%v: %v\", totalMsg, subject)\n\n\t\t\t// Download attachment here\n\t\t\tn := 1\n\t\t\tfor _, part := range msg.Payload.Parts {\n\t\t\t\tif part.Filename != \"\" {\n\t\t\t\t\ttotalAtt++\n\t\t\t\t\tattachmentBody, err := svc.Users.Messages.Attachments.Get(\"me\", m.Id, part.Body.AttachmentId).Do()\n\t\t\t\t\tif err != nil {\n\t\t\t\t\t\tlog.Fatalf(\"Error retrieving attachment with id %v\", part.Body.AttachmentId)\n\t\t\t\t\t}\n\t\t\t\t\tdata, err := b64.URLEncoding.DecodeString(attachmentBody.Data)\n\t\t\t\t\tif err != nil {\n\t\t\t\t\t\tlog.Fatalf(\"Error decoding attachment: %v\", err)\n\t\t\t\t\t}\n\t\t\t\t\tname := getUniqeFilename(outDir, part.Filename)\n\t\t\t\t\tfullName := filepath.Join(outDir, name)\n\t\t\t\t\tif err = ioutil.WriteFile(fullName, data, 0644); err != nil {\n\t\t\t\t\t\tlog.Fatalf(\"Unable to write to file %v\", fullName)\n\t\t\t\t\t}\n\t\t\t\t\tif err = os.Chtimes(fullName, time.Now(), time.Unix(msg.InternalDate/1000, 0)); err != nil {\n\t\t\t\t\t\tlog.Fatalf(\"Cannot change timestamps of file %v: %v\", fullName, err)\n\t\t\t\t\t}\n\t\t\t\t\tlog.Printf(\"Message #%v attachment #%v: %v\\n\", totalMsg, n, name)\n\t\t\t\t\tn++\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tif r.NextPageToken == \"\" {\n\t\t\tbreak\n\t\t}\n\t\tpageToken = r.NextPageToken\n\t}\n\tlog.Printf(\"Downloaded %v attachments from %v messages\\n\", totalAtt, totalMsg)\n}", "func Attach(c *golangsdk.ServiceClient, opts AttachOpts) (*jobs.Job, error) {\n\tb, err := golangsdk.BuildRequestBody(opts, \"volumeAttachment\")\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar r jobs.Job\n\t_, err = c.Post(attachURL(c, opts.ServerId), b, &r, &golangsdk.RequestOpts{\n\t\tMoreHeaders: requestOpts.MoreHeaders,\n\t})\n\treturn &r, err\n}", "func (a *Client) GetAttachmentsID(params *GetAttachmentsIDParams, authInfo runtime.ClientAuthInfoWriter) (*GetAttachmentsIDOK, error) {\n\t// TODO: Validate the params before sending\n\tif params == nil {\n\t\tparams = NewGetAttachmentsIDParams()\n\t}\n\n\tresult, err := a.transport.Submit(&runtime.ClientOperation{\n\t\tID: \"GetAttachmentsID\",\n\t\tMethod: \"GET\",\n\t\tPathPattern: \"/attachments/{id}\",\n\t\tProducesMediaTypes: []string{\"application/json\"},\n\t\tConsumesMediaTypes: []string{\"application/json\"},\n\t\tSchemes: []string{\"https\"},\n\t\tParams: params,\n\t\tReader: &GetAttachmentsIDReader{formats: a.formats},\n\t\tAuthInfo: authInfo,\n\t\tContext: params.Context,\n\t\tClient: params.HTTPClient,\n\t})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tsuccess, ok := result.(*GetAttachmentsIDOK)\n\tif ok {\n\t\treturn success, nil\n\t}\n\t// unexpected success response\n\t// safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue\n\tmsg := fmt.Sprintf(\"unexpected success response for GetAttachmentsID: API contract not enforced by server. Client expected to get an error, but got: %T\", result)\n\tpanic(msg)\n}" ]
[ "0.82712257", "0.79117626", "0.62547183", "0.61247474", "0.5882598", "0.58359337", "0.58109754", "0.5685171", "0.56332296", "0.54402965", "0.53094566", "0.5267023", "0.5266041", "0.5165025", "0.51487243", "0.5148651", "0.5135551", "0.5088738", "0.5045772", "0.499179", "0.49912688", "0.49813342", "0.49667087", "0.4951905", "0.49495563", "0.4943154", "0.49115005", "0.48899835", "0.48531845", "0.48516217", "0.4843825", "0.482489", "0.4769346", "0.47649747", "0.47449103", "0.47223365", "0.4709379", "0.46860316", "0.46669573", "0.46607018", "0.464771", "0.46473098", "0.4631355", "0.46312365", "0.46296465", "0.4623921", "0.462108", "0.46208963", "0.45842814", "0.45838296", "0.45672008", "0.45616332", "0.45556286", "0.4533442", "0.45312652", "0.45290706", "0.4501346", "0.4484285", "0.44560668", "0.44476536", "0.44474447", "0.44470218", "0.44466716", "0.44429535", "0.44378385", "0.4436062", "0.4421841", "0.4406822", "0.44051483", "0.440157", "0.44002265", "0.43960434", "0.43906087", "0.43677273", "0.43616444", "0.4359137", "0.43486118", "0.4346023", "0.43395776", "0.43272546", "0.42996746", "0.4293725", "0.42867374", "0.42776573", "0.4260692", "0.42566323", "0.42553464", "0.42544785", "0.424707", "0.4246433", "0.42301056", "0.4216164", "0.42089927", "0.41999504", "0.41994226", "0.41968724", "0.41965997", "0.4191074", "0.41838118", "0.41813755" ]
0.8287107
0
Hooks returns the client hooks.
func (c *PostClient) Hooks() []Hook { return c.hooks.Post }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (c *OperationClient) Hooks() []Hook {\n\treturn c.hooks.Operation\n}", "func (c *ToolClient) Hooks() []Hook {\n\treturn c.hooks.Tool\n}", "func (c *TagClient) Hooks() []Hook {\n\treturn c.hooks.Tag\n}", "func (c *ComplaintClient) Hooks() []Hook {\n\treturn c.hooks.Complaint\n}", "func (c *ClubapplicationClient) Hooks() []Hook {\n\treturn c.hooks.Clubapplication\n}", "func (c *ClinicClient) Hooks() []Hook {\n\treturn c.hooks.Clinic\n}", "func (c *EventClient) Hooks() []Hook {\n\treturn c.hooks.Event\n}", "func (c *BuildingClient) Hooks() []Hook {\n\treturn c.hooks.Building\n}", "func (c *OperativeClient) Hooks() []Hook {\n\treturn c.hooks.Operative\n}", "func (c *SituationClient) Hooks() []Hook {\n\treturn c.hooks.Situation\n}", "func (c *AppointmentClient) Hooks() []Hook {\n\treturn c.hooks.Appointment\n}", "func (c *RentalstatusClient) Hooks() []Hook {\n\treturn c.hooks.Rentalstatus\n}", "func (c *LeaseClient) Hooks() []Hook {\n\treturn c.hooks.Lease\n}", "func (c *ReturninvoiceClient) Hooks() []Hook {\n\treturn c.hooks.Returninvoice\n}", "func (c *ClubappStatusClient) Hooks() []Hook {\n\treturn c.hooks.ClubappStatus\n}", "func (c *ReviewClient) Hooks() []Hook {\n\treturn c.hooks.Review\n}", "func (c *EmployeeClient) Hooks() []Hook {\n\treturn c.hooks.Employee\n}", "func (c *EmployeeClient) Hooks() []Hook {\n\treturn c.hooks.Employee\n}", "func (c *EmployeeClient) Hooks() []Hook {\n\treturn c.hooks.Employee\n}", "func (c *WorkExperienceClient) Hooks() []Hook {\n\treturn c.hooks.WorkExperience\n}", "func (c *PartClient) Hooks() []Hook {\n\treturn c.hooks.Part\n}", "func (c *CleanernameClient) Hooks() []Hook {\n\treturn c.hooks.Cleanername\n}", "func (c *BeerClient) Hooks() []Hook {\n\treturn c.hooks.Beer\n}", "func (c *FoodmenuClient) Hooks() []Hook {\n\treturn c.hooks.Foodmenu\n}", "func (c *RepairinvoiceClient) Hooks() []Hook {\n\treturn c.hooks.Repairinvoice\n}", "func (c *StatusdClient) Hooks() []Hook {\n\treturn c.hooks.Statusd\n}", "func (c *EmptyClient) Hooks() []Hook {\n\treturn c.hooks.Empty\n}", "func (c *BillClient) Hooks() []Hook {\n\treturn c.hooks.Bill\n}", "func (c *BillClient) Hooks() []Hook {\n\treturn c.hooks.Bill\n}", "func (c *BillClient) Hooks() []Hook {\n\treturn c.hooks.Bill\n}", "func (c *CompanyClient) Hooks() []Hook {\n\treturn c.hooks.Company\n}", "func (c *CompanyClient) Hooks() []Hook {\n\treturn c.hooks.Company\n}", "func (c *IPClient) Hooks() []Hook {\n\treturn c.hooks.IP\n}", "func (c *VeterinarianClient) Hooks() []Hook {\n\treturn c.hooks.Veterinarian\n}", "func (c *MedicineClient) Hooks() []Hook {\n\treturn c.hooks.Medicine\n}", "func (c *PrescriptionClient) Hooks() []Hook {\n\treturn c.hooks.Prescription\n}", "func (c *TransactionClient) Hooks() []Hook {\n\treturn c.hooks.Transaction\n}", "func (c *CategoryClient) Hooks() []Hook {\n\treturn c.hooks.Category\n}", "func (c *KeyStoreClient) Hooks() []Hook {\n\treturn c.hooks.KeyStore\n}", "func (c *PetruleClient) Hooks() []Hook {\n\treturn c.hooks.Petrule\n}", "func (c *LevelOfDangerousClient) Hooks() []Hook {\n\treturn c.hooks.LevelOfDangerous\n}", "func (c *AdminClient) Hooks() []Hook {\n\treturn c.hooks.Admin\n}", "func (c *JobClient) Hooks() []Hook {\n\treturn c.hooks.Job\n}", "func (c *OrderClient) Hooks() []Hook {\n\treturn c.hooks.Order\n}", "func (c *PetClient) Hooks() []Hook {\n\treturn c.hooks.Pet\n}", "func (c *DNSBLResponseClient) Hooks() []Hook {\n\treturn c.hooks.DNSBLResponse\n}", "func (c *MealplanClient) Hooks() []Hook {\n\treturn c.hooks.Mealplan\n}", "func (c *RepairInvoiceClient) Hooks() []Hook {\n\treturn c.hooks.RepairInvoice\n}", "func (c *DoctorClient) Hooks() []Hook {\n\treturn c.hooks.Doctor\n}", "func (c *StatustClient) Hooks() []Hook {\n\treturn c.hooks.Statust\n}", "func (c *EatinghistoryClient) Hooks() []Hook {\n\treturn c.hooks.Eatinghistory\n}", "func (c *StaytypeClient) Hooks() []Hook {\n\treturn c.hooks.Staytype\n}", "func (c *CustomerClient) Hooks() []Hook {\n\treturn c.hooks.Customer\n}", "func (c *StatusRClient) Hooks() []Hook {\n\treturn c.hooks.StatusR\n}", "func (c *UserClient) Hooks() []Hook {\n\treturn c.hooks.User\n}", "func (c *UserClient) Hooks() []Hook {\n\treturn c.hooks.User\n}", "func (c *UserClient) Hooks() []Hook {\n\treturn c.hooks.User\n}", "func (c *UserClient) Hooks() []Hook {\n\treturn c.hooks.User\n}", "func (c *UserClient) Hooks() []Hook {\n\treturn c.hooks.User\n}", "func (c *UserClient) Hooks() []Hook {\n\treturn c.hooks.User\n}", "func (c *UserClient) Hooks() []Hook {\n\treturn c.hooks.User\n}", "func (c *UserClient) Hooks() []Hook {\n\treturn c.hooks.User\n}", "func (c *UserClient) Hooks() []Hook {\n\treturn c.hooks.User\n}", "func (c *UserClient) Hooks() []Hook {\n\treturn c.hooks.User\n}", "func (c *UserClient) Hooks() []Hook {\n\treturn c.hooks.User\n}", "func (c *UnitOfMedicineClient) Hooks() []Hook {\n\treturn c.hooks.UnitOfMedicine\n}", "func (c *YearClient) Hooks() []Hook {\n\treturn c.hooks.Year\n}", "func (c *ClubClient) Hooks() []Hook {\n\treturn c.hooks.Club\n}", "func (c *DentistClient) Hooks() []Hook {\n\treturn c.hooks.Dentist\n}", "func (c *PaymentClient) Hooks() []Hook {\n\treturn c.hooks.Payment\n}", "func (c *PaymentClient) Hooks() []Hook {\n\treturn c.hooks.Payment\n}", "func (c *BookingClient) Hooks() []Hook {\n\treturn c.hooks.Booking\n}", "func (c *DisciplineClient) Hooks() []Hook {\n\treturn c.hooks.Discipline\n}", "func (c *PlanetClient) Hooks() []Hook {\n\treturn c.hooks.Planet\n}", "func (c *OperationroomClient) Hooks() []Hook {\n\treturn c.hooks.Operationroom\n}", "func (c *LengthtimeClient) Hooks() []Hook {\n\treturn c.hooks.Lengthtime\n}", "func (c *DispenseMedicineClient) Hooks() []Hook {\n\treturn c.hooks.DispenseMedicine\n}", "func (c *PartorderClient) Hooks() []Hook {\n\treturn c.hooks.Partorder\n}", "func (c *PatientInfoClient) Hooks() []Hook {\n\treturn c.hooks.PatientInfo\n}", "func (c *SkillClient) Hooks() []Hook {\n\treturn c.hooks.Skill\n}", "func (c *PharmacistClient) Hooks() []Hook {\n\treturn c.hooks.Pharmacist\n}", "func (c *TitleClient) Hooks() []Hook {\n\treturn c.hooks.Title\n}", "func (c *DepositClient) Hooks() []Hook {\n\treturn c.hooks.Deposit\n}", "func (c *SessionClient) Hooks() []Hook {\n\treturn c.hooks.Session\n}", "func (c *PostImageClient) Hooks() []Hook {\n\treturn c.hooks.PostImage\n}", "func (c *DrugAllergyClient) Hooks() []Hook {\n\treturn c.hooks.DrugAllergy\n}", "func (c *TimerClient) Hooks() []Hook {\n\treturn c.hooks.Timer\n}", "func (c *PhysicianClient) Hooks() []Hook {\n\treturn c.hooks.Physician\n}", "func (c *PhysicianClient) Hooks() []Hook {\n\treturn c.hooks.Physician\n}", "func (c *PostAttachmentClient) Hooks() []Hook {\n\treturn c.hooks.PostAttachment\n}", "func (c *PatientClient) Hooks() []Hook {\n\treturn c.hooks.Patient\n}", "func (c *PatientClient) Hooks() []Hook {\n\treturn c.hooks.Patient\n}", "func (c *PatientClient) Hooks() []Hook {\n\treturn c.hooks.Patient\n}", "func (c *PostThumbnailClient) Hooks() []Hook {\n\treturn c.hooks.PostThumbnail\n}", "func (c *BedtypeClient) Hooks() []Hook {\n\treturn c.hooks.Bedtype\n}", "func (c *CoinInfoClient) Hooks() []Hook {\n\treturn c.hooks.CoinInfo\n}", "func (c *OperativerecordClient) Hooks() []Hook {\n\treturn c.hooks.Operativerecord\n}", "func (c *ActivitiesClient) Hooks() []Hook {\n\treturn c.hooks.Activities\n}", "func (c *MedicineTypeClient) Hooks() []Hook {\n\treturn c.hooks.MedicineType\n}", "func (c *AdminSessionClient) Hooks() []Hook {\n\treturn c.hooks.AdminSession\n}" ]
[ "0.80317485", "0.79030067", "0.7886111", "0.78830385", "0.7827846", "0.78169984", "0.7799408", "0.7789961", "0.7762907", "0.774616", "0.77400076", "0.77377117", "0.7723144", "0.7715899", "0.77091956", "0.76981485", "0.7695239", "0.7695239", "0.7695239", "0.7691411", "0.76718473", "0.7669308", "0.76659566", "0.76649994", "0.7658629", "0.76272875", "0.7619314", "0.7616328", "0.7616328", "0.7616328", "0.7613535", "0.7613535", "0.7612722", "0.7607983", "0.76073736", "0.76072484", "0.7600732", "0.7597693", "0.75947726", "0.7593981", "0.75886565", "0.75843227", "0.7583164", "0.7580412", "0.7568908", "0.7559808", "0.75595653", "0.75512165", "0.75502926", "0.7532545", "0.75314486", "0.7530887", "0.75256604", "0.7522074", "0.75039285", "0.75039285", "0.75039285", "0.75039285", "0.75039285", "0.75039285", "0.75039285", "0.75039285", "0.75039285", "0.75039285", "0.75039285", "0.7503626", "0.75009644", "0.74971604", "0.74927765", "0.74925745", "0.74925745", "0.7490701", "0.7489253", "0.748288", "0.748131", "0.74717736", "0.74631125", "0.74541014", "0.7448737", "0.7445493", "0.74428546", "0.74352837", "0.7419495", "0.7416624", "0.7410944", "0.7410398", "0.74081314", "0.73945314", "0.73945314", "0.7394305", "0.7393659", "0.7393659", "0.7393659", "0.73885626", "0.7386602", "0.7375832", "0.73689777", "0.73569894", "0.73537123", "0.7353203" ]
0.7861127
4
NewPostAttachmentClient returns a client for the PostAttachment from the given config.
func NewPostAttachmentClient(c config) *PostAttachmentClient { return &PostAttachmentClient{config: c} }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func NewUnsavedPostAttachmentClient(c config) *UnsavedPostAttachmentClient {\n\treturn &UnsavedPostAttachmentClient{config: c}\n}", "func NewPostImageClient(c config) *PostImageClient {\n\treturn &PostImageClient{config: c}\n}", "func NewPostClient(c config) *PostClient {\n\treturn &PostClient{config: c}\n}", "func (c *PostAttachmentClient) Create() *PostAttachmentCreate {\n\tmutation := newPostAttachmentMutation(c.config, OpCreate)\n\treturn &PostAttachmentCreate{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *PostAttachmentClient) Delete() *PostAttachmentDelete {\n\tmutation := newPostAttachmentMutation(c.config, OpDelete)\n\treturn &PostAttachmentDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func NewPostThumbnailClient(c config) *PostThumbnailClient {\n\treturn &PostThumbnailClient{config: c}\n}", "func (c *UnsavedPostAttachmentClient) Create() *UnsavedPostAttachmentCreate {\n\tmutation := newUnsavedPostAttachmentMutation(c.config, OpCreate)\n\treturn &UnsavedPostAttachmentCreate{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *UnsavedPostAttachmentClient) Delete() *UnsavedPostAttachmentDelete {\n\tmutation := newUnsavedPostAttachmentMutation(c.config, OpDelete)\n\treturn &UnsavedPostAttachmentDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (a *UtilsApiService) CreateNotificationClientUsingPost(ctx context.Context, notificationClient NotificationClient) (NotificationClient, *http.Response, error) {\n\tvar (\n\t\tlocalVarHttpMethod = strings.ToUpper(\"Post\")\n\t\tlocalVarPostBody interface{}\n\t\tlocalVarFileName string\n\t\tlocalVarFileBytes []byte\n\t\tlocalVarReturnValue NotificationClient\n\t)\n\n\t// create path and map variables\n\ta.client = NewAPIClient(&Configuration{\n\t\tBasePath: ctx.Value(\"BasePath\").(string),\n\t\tDefaultHeader: make(map[string]string),\n\t\tUserAgent: \"Swagger-Codegen/1.0.0/go\",\n\t})\n\tlocalVarPath := a.client.cfg.BasePath + \"/nucleus/v1/notification_client\"\n\n\tlocalVarHeaderParams := make(map[string]string)\n\tlocalVarQueryParams := url.Values{}\n\tlocalVarFormParams := url.Values{}\n\n\t// to determine the Content-Type header\n\tlocalVarHttpContentTypes := []string{\"application/json\"}\n\n\t// set Content-Type header\n\tlocalVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes)\n\tif localVarHttpContentType != \"\" {\n\t\tlocalVarHeaderParams[\"Content-Type\"] = localVarHttpContentType\n\t}\n\n\t// to determine the Accept header\n\tlocalVarHttpHeaderAccepts := []string{\"*/*\"}\n\n\t// set Accept header\n\tlocalVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)\n\tif localVarHttpHeaderAccept != \"\" {\n\t\tlocalVarHeaderParams[\"Accept\"] = localVarHttpHeaderAccept\n\t}\n\t// body params\n\tlocalVarPostBody = &notificationClient\n\tr, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)\n\tif err != nil {\n\t\treturn localVarReturnValue, nil, err\n\t}\n\n\tlocalVarHttpResponse, err := a.client.callAPI(r)\n\tif err != nil || localVarHttpResponse == nil {\n\t\treturn localVarReturnValue, localVarHttpResponse, err\n\t}\n\n\tlocalVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body)\n\tlocalVarHttpResponse.Body.Close()\n\tif err != nil {\n\t\treturn localVarReturnValue, localVarHttpResponse, err\n\t}\n\n\tif localVarHttpResponse.StatusCode < 300 {\n\t\t// If we succeed, return the data, otherwise pass on to decode error.\n\t\terr = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get(\"Content-Type\"))\n\t\treturn localVarReturnValue, localVarHttpResponse, err\n\t}\n\n\tif localVarHttpResponse.StatusCode >= 300 {\n\t\tnewErr := GenericSwaggerError{\n\t\t\tbody: localVarBody,\n\t\t\terror: localVarHttpResponse.Status,\n\t\t}\n\n\t\tif localVarHttpResponse.StatusCode == 200 {\n\t\t\tvar v NotificationClient\n\t\t\terr = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get(\"Content-Type\"))\n\t\t\tif err != nil {\n\t\t\t\tnewErr.error = err.Error()\n\t\t\t\treturn localVarReturnValue, localVarHttpResponse, newErr\n\t\t\t}\n\t\t\tnewErr.model = v\n\t\t\treturn localVarReturnValue, localVarHttpResponse, newErr\n\t\t}\n\n\t\treturn localVarReturnValue, localVarHttpResponse, newErr\n\t}\n\n\treturn localVarReturnValue, localVarHttpResponse, nil\n}", "func (c *PostAttachmentClient) Get(ctx context.Context, id int) (*PostAttachment, error) {\n\treturn c.Query().Where(postattachment.ID(id)).Only(ctx)\n}", "func NewPostVideoClient(c config) *PostVideoClient {\n\treturn &PostVideoClient{config: c}\n}", "func NewClient(payload []byte, context appengine.Context) (Client, error) {\n\tvar c Client\n\terr := json.Unmarshal(payload, &c)\n\tif err != nil {\n\t\treturn c, err\n\t}\n\n\t// prepare the recipient payload for email client\n\tfor k, v := range c.Recipient {\n\t\tc.Recipient[k].Render = fmt.Sprintf(\"%s <%s>\", v.Name, v.Email)\n\t}\n\n\tc.context = context\n\n\treturn c, err\n}", "func NewClient(config *Config) *Client {\n\ttr := config.Transport()\n\n\treturn &Client{\n\t\tconfig: config.Clone(),\n\t\ttr: tr,\n\t\tclient: &http.Client{Transport: tr},\n\t}\n}", "func NewPost(creator *ID, text string, attachment *string) (*Post, error) {\n\tp := &Post{\n\t\tID: NewID(),\n\t\tCreator: creator,\n\t\tText: text,\n\t\tAttachment: attachment,\n\t\tCreatedAt: time.Now(),\n\t}\n\terr := p.Validate()\n\tif err != nil {\n\t\treturn nil, ErrInvalidEntity\n\t}\n\treturn p, nil\n}", "func (o *CreateDrgAttachmentParams) WithHTTPClient(client *http.Client) *CreateDrgAttachmentParams {\n\to.SetHTTPClient(client)\n\treturn o\n}", "func (c *RPCClient) POSTClient() (*rpcclient.Client, er.R) {\n\tconfigCopy := *c.connConfig\n\tconfigCopy.HTTPPostMode = true\n\treturn rpcclient.New(&configCopy, nil)\n}", "func NewAttachment(filename, contentType string, body io.ReadCloser) *Attachment {\n\treturn &Attachment{\n\t\tReadCloser: body,\n\t\tFilename: filename,\n\t\tContentType: contentType,\n\t}\n}", "func NewAttachment(ctx *pulumi.Context,\n\tname string, args *AttachmentArgs, opts ...pulumi.ResourceOption) (*Attachment, error) {\n\tif args == nil {\n\t\treturn nil, errors.New(\"missing one or more required arguments\")\n\t}\n\n\tif args.InstanceIds == nil {\n\t\treturn nil, errors.New(\"invalid value for required argument 'InstanceIds'\")\n\t}\n\tif args.LoadBalancerId == nil {\n\t\treturn nil, errors.New(\"invalid value for required argument 'LoadBalancerId'\")\n\t}\n\topts = internal.PkgResourceDefaultOpts(opts)\n\tvar resource Attachment\n\terr := ctx.RegisterResource(\"alicloud:slb/attachment:Attachment\", name, args, &resource, opts...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &resource, nil\n}", "func (a *Client) PostAttachments(params *PostAttachmentsParams, authInfo runtime.ClientAuthInfoWriter) (*PostAttachmentsOK, error) {\n\t// TODO: Validate the params before sending\n\tif params == nil {\n\t\tparams = NewPostAttachmentsParams()\n\t}\n\n\tresult, err := a.transport.Submit(&runtime.ClientOperation{\n\t\tID: \"PostAttachments\",\n\t\tMethod: \"POST\",\n\t\tPathPattern: \"/attachments\",\n\t\tProducesMediaTypes: []string{\"application/json\"},\n\t\tConsumesMediaTypes: []string{\"multipart/form-data\"},\n\t\tSchemes: []string{\"https\"},\n\t\tParams: params,\n\t\tReader: &PostAttachmentsReader{formats: a.formats},\n\t\tAuthInfo: authInfo,\n\t\tContext: params.Context,\n\t\tClient: params.HTTPClient,\n\t})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tsuccess, ok := result.(*PostAttachmentsOK)\n\tif ok {\n\t\treturn success, nil\n\t}\n\t// unexpected success response\n\t// safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue\n\tmsg := fmt.Sprintf(\"unexpected success response for PostAttachments: API contract not enforced by server. Client expected to get an error, but got: %T\", result)\n\tpanic(msg)\n}", "func (f *extendedPodFactory) CreateClient(cfg *rest.Config) (interface{}, error) {\n\treturn f.client, nil\n}", "func NewClient(config ClientConfig) (*Client, error) {\n\tvar baseURLToUse *url.URL\n\tvar err error\n\tif config.BaseURL == \"\" {\n\t\tbaseURLToUse, err = url.Parse(defaultBaseURL)\n\t} else {\n\t\tbaseURLToUse, err = url.Parse(config.BaseURL)\n\t}\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tc := &Client{\n\t\temail: config.Username,\n\t\tpassword: config.Password,\n\t\tbaseURL: baseURLToUse.String(),\n\t}\n\tc.client = http.DefaultClient\n\tc.InvitationService = &InvitationService{client: c}\n\tc.ActiveUserService = &ActiveUserService{client: c}\n\tc.UserService = &UserService{\n\t\tActiveUserService: c.ActiveUserService,\n\t\tInvitationService: c.InvitationService,\n\t}\n\treturn c, nil\n}", "func NewClient(config *Config) (*Client, error) {\n\tdefConfig := DefaultConfig()\n\n\tif len(config.Address) == 0 {\n\t\tconfig.Address = defConfig.Address\n\t}\n\n\tif len(config.Scheme) == 0 {\n\t\tconfig.Scheme = defConfig.Scheme\n\t}\n\n\tif config.HTTPClient == nil {\n\t\tconfig.HTTPClient = defConfig.HTTPClient\n\t}\n\n\tclient := &Client{\n\t\tConfig: *config,\n\t}\n\treturn client, nil\n}", "func NewClient(c drive.Config) (drive.Client, error) {\n\treturn &Drive{config: c}, nil\n}", "func New(config *ConnConfig, ntfnHandlers *NotificationHandlers) (*Client, error) {\n\t// Either open a websocket connection or create an HTTP client depending\n\t// on the HTTP POST mode. Also, set the notification handlers to nil\n\t// when running in HTTP POST mode.\n\tvar wsConn *websocket.Conn\n\tvar httpClient *http.Client\n\tconnEstablished := make(chan struct{})\n\tvar start bool\n\tif config.HTTPPostMode {\n\t\tntfnHandlers = nil\n\t\tstart = true\n\n\t\tvar err error\n\t\thttpClient, err = newHTTPClient(config)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t} else {\n\t\tif !config.DisableConnectOnNew {\n\t\t\tvar err error\n\t\t\twsConn, err = dial(config)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t\tstart = true\n\t\t}\n\t}\n\n\tclient := &Client{\n\t\tconfig: config,\n\t\twsConn: wsConn,\n\t\thttpClient: httpClient,\n\t\trequestMap: make(map[uint64]*list.Element),\n\t\trequestList: list.New(),\n\t\tntfnHandlers: ntfnHandlers,\n\t\tntfnState: newNotificationState(),\n\t\tsendChan: make(chan []byte, sendBufferSize),\n\t\tsendPostChan: make(chan *sendPostDetails, sendPostBufferSize),\n\t\tconnEstablished: connEstablished,\n\t\tdisconnect: make(chan struct{}),\n\t\tshutdown: make(chan struct{}),\n\t}\n\n\tif start {\n\t\tlog.Infof(\"Established connection to RPC server %s\",\n\t\t\tconfig.Host)\n\t\tclose(connEstablished)\n\t\tclient.start()\n\t\tif !client.config.HTTPPostMode && !client.config.DisableAutoReconnect {\n\t\t\tclient.wg.Add(1)\n\t\t\tgo client.wsReconnectHandler()\n\t\t}\n\t}\n\n\treturn client, nil\n}", "func (c *PostAttachmentClient) Query() *PostAttachmentQuery {\n\treturn &PostAttachmentQuery{\n\t\tconfig: c.config,\n\t}\n}", "func NewClient(config *Config) (*Client, error) {\n\t// bootstrap the config\n\tdefConfig := DefaultConfig()\n\n\tif config.Address == \"\" {\n\t\tconfig.Address = defConfig.Address\n\t} else if _, err := url.Parse(config.Address); err != nil {\n\t\treturn nil, fmt.Errorf(\"invalid address '%s': %v\", config.Address, err)\n\t}\n\n\thttpClient := config.HttpClient\n\tif httpClient == nil {\n\t\thttpClient = defaultHttpClient()\n\t\tif err := ConfigureTLS(httpClient, config.TLSConfig); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\tclient := &Client{\n\t\tconfig: *config,\n\t\thttpClient: httpClient,\n\t}\n\treturn client, nil\n}", "func NewClient(config Config) Client {\n\ttyp := config.Type()\n\n\tswitch typ {\n\tcase Bolt:\n\t\tbe := NewBoltBackend(config.(*BoltConfig))\n\t\t// TODO: Return an error instead of panicking.\n\t\tif err := be.Open(); err != nil {\n\t\t\tpanic(fmt.Errorf(\"Opening bolt backend: %s\", err))\n\t\t}\n\t\tq := NewBoltQueue(be.db)\n\t\treturn newKVClient(be, q)\n\n\tcase Rocks:\n\t\t// MORE TEMPORARY UGLINESS TO MAKE IT WORK FOR NOW:\n\t\tif err := os.MkdirAll(config.(*RocksConfig).Dir, os.FileMode(int(0700))); err != nil {\n\t\t\tpanic(fmt.Errorf(\"Creating rocks directory %q: %s\", config.(*RocksConfig).Dir, err))\n\t\t}\n\t\tbe := NewRocksBackend(config.(*RocksConfig))\n\t\tqueueFile := filepath.Join(config.(*RocksConfig).Dir, DefaultBoltQueueFilename)\n\t\tdb, err := bolt.Open(queueFile, 0600, NewBoltConfig(\"\").BoltOptions)\n\t\tif err != nil {\n\t\t\tpanic(fmt.Errorf(\"Creating bolt queue: %s\", err))\n\t\t}\n\t\tq := NewBoltQueue(db)\n\t\treturn newKVClient(be, q)\n\n\tcase Postgres:\n\t\tbe := NewPostgresBackend(config.(*PostgresConfig))\n\t\tq := NewPostgresQueue(config.(*PostgresConfig))\n\t\treturn newKVClient(be, q)\n\n\tdefault:\n\t\tpanic(fmt.Errorf(\"no client constructor available for db configuration type: %v\", typ))\n\t}\n}", "func NewClient(config *Config) (client *Client, err error) {\n\t// bootstrap the config\n\tdefConfig := DefaultConfig()\n\n\tif len(config.ApiAddress) == 0 {\n\t\tconfig.ApiAddress = defConfig.ApiAddress\n\t}\n\n\tif len(config.Username) == 0 {\n\t\tconfig.Username = defConfig.Username\n\t}\n\n\tif len(config.Password) == 0 {\n\t\tconfig.Password = defConfig.Password\n\t}\n\n\tif len(config.Token) == 0 {\n\t\tconfig.Token = defConfig.Token\n\t}\n\n\tif len(config.UserAgent) == 0 {\n\t\tconfig.UserAgent = defConfig.UserAgent\n\t}\n\n\tif config.HttpClient == nil {\n\t\tconfig.HttpClient = defConfig.HttpClient\n\t}\n\n\tif config.HttpClient.Transport == nil {\n\t\tconfig.HttpClient.Transport = shallowDefaultTransport()\n\t}\n\n\tvar tp *http.Transport\n\n\tswitch t := config.HttpClient.Transport.(type) {\n\tcase *http.Transport:\n\t\ttp = t\n\tcase *oauth2.Transport:\n\t\tif bt, ok := t.Base.(*http.Transport); ok {\n\t\t\ttp = bt\n\t\t}\n\t}\n\n\tif tp != nil {\n\t\tif tp.TLSClientConfig == nil {\n\t\t\ttp.TLSClientConfig = &tls.Config{}\n\t\t}\n\t\ttp.TLSClientConfig.InsecureSkipVerify = config.SkipSslValidation\n\t}\n\n\tconfig.ApiAddress = strings.TrimRight(config.ApiAddress, \"/\")\n\n\tclient = &Client{\n\t\tConfig: *config,\n\t}\n\n\tif err := client.refreshEndpoint(); err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn client, nil\n}", "func NewAttachment(fallback, pretext, title, titleLink, text, color, footer string) *Attachment {\n return &Attachment{\n fallback,\n pretext,\n title,\n titleLink,\n text,\n color,\n footer,\n }\n}", "func NewAttachment(name string, inline bool) (*Attachment, error) {\n\tvar err error\n\tattach := &Attachment{}\n\tattach.Data, err = ioutil.ReadFile(name)\n\t_, attach.Name = filepath.Split(name)\n\treturn attach, err\n}", "func NewClient(config string, prefReplica int) *Client {\n\tlogger, _ := zap.NewDevelopment()\n\tdefer logger.Sync()\n\tsugar := logger.Sugar()\n\n\textAddrs := []string{}\n\tf, err := os.Open(config)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\tdefer f.Close()\n\n\tscan := bufio.NewScanner(f)\n\tfor scan.Scan() {\n\t\tfields := strings.Fields(scan.Text())\n\t\textAddrs = append(extAddrs, fields[1])\n\t}\n\n\tvar dialOpts []grpc.DialOption\n\tdialOpts = append(dialOpts, grpc.WithInsecure())\n\tdialOpts = append(dialOpts, grpc.WithKeepaliveParams(keepalive.ClientParameters{Time: 3 * time.Second}))\n\n\tvar extClients []proto.RaftClient\n\tfor _, a := range extAddrs {\n\t\tcc, err := grpc.Dial(a, dialOpts...)\n\t\tif err != nil {\n\t\t\tlog.Fatalf(\"unable to connect to host: %v\", err)\n\t\t}\n\t\tc := proto.NewRaftClient(cc)\n\t\textClients = append(extClients, c)\n\t}\n\n\tc := &Client{\n\t\tlogger: sugar,\n\t\tprefReplica: prefReplica,\n\t\traftClients: extClients,\n\t}\n\n\treturn c\n}", "func (o *GetAttachmentParams) WithHTTPClient(client *http.Client) *GetAttachmentParams {\n\to.SetHTTPClient(client)\n\treturn o\n}", "func NewClient(kubeconfig, configContext string) (*Client, error) {\n\tconfig, err := defaultRestConfig(kubeconfig, configContext)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\trestClient, err := rest.RESTClientFor(config)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &Client{config, restClient}, nil\n}", "func NewClient(kubeconfig, configContext string) (*Client, error) {\n\tconfig, err := defaultRestConfig(kubeconfig, configContext)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\trestClient, err := rest.RESTClientFor(config)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &Client{config, restClient}, nil\n}", "func NewUnsavedPostClient(c config) *UnsavedPostClient {\n\treturn &UnsavedPostClient{config: c}\n}", "func (c *Config) Client(ctx context.Context, t *Ticket) *http.Client {\n\treturn NewClient(ctx, c.TicketSource(ctx, t))\n}", "func NewClient(config *ClientConfig) (client *Client, err error) {\n\n\tclient = &Client{\n\t\tconnection: &connectionTracker{\n\t\t\tstate: INITIAL,\n\t\t\thostPortStr: net.JoinHostPort(config.DNSOrIPAddr, fmt.Sprintf(\"%d\", config.Port)),\n\t\t},\n\t\tcb: config.Callbacks,\n\t\tkeepAlivePeriod: config.KeepAlivePeriod,\n\t\tdeadlineIO: config.DeadlineIO,\n\t\tlogger: config.Logger,\n\t}\n\n\tif client.logger == nil {\n\t\tvar logBuf bytes.Buffer\n\t\tclient.logger = log.New(&logBuf, \"\", 0)\n\t}\n\n\tclient.outstandingRequest = make(map[requestID]*reqCtx)\n\tclient.bt = btree.New(2)\n\n\tif config.RootCAx509CertificatePEM == nil {\n\t\tclient.connection.useTLS = false\n\t\tclient.connection.tlsConn = nil\n\t\tclient.connection.x509CertPool = nil\n\t} else {\n\t\tclient.connection.useTLS = true\n\t\tclient.connection.netConn = nil\n\t\t// Add cert for root CA to our pool\n\t\tclient.connection.x509CertPool = x509.NewCertPool()\n\t\tok := client.connection.x509CertPool.AppendCertsFromPEM(config.RootCAx509CertificatePEM)\n\t\tif !ok {\n\t\t\terr = fmt.Errorf(\"x509CertPool.AppendCertsFromPEM() returned !ok\")\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\treturn client, err\n}", "func NewClient(c Config) (Client, error) {\n\tif len(c.Endpoint) == 0 {\n\t\tc.Endpoint = EndpointProduction\n\t}\n\n\treturn &client{\n\t\tapikey: c.APIKey,\n\t\tendpoint: c.Endpoint,\n\t\torganizationid: c.OrganizationID,\n\t\thttpClient: http.DefaultClient,\n\t}, nil\n}", "func (c *Client) newPost(endpoint string, reqBody []byte) (*http.Request, error) {\n\tcurl, err := c.getURL(endpoint)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treq, err := http.NewRequest(http.MethodPost, curl, bytes.NewReader(reqBody))\n\tif err != nil {\n\t\treturn nil, errors.Wrapf(err, \"Failed posting to %s\", curl)\n\t}\n\treturn req, nil\n}", "func NewClient(config Config) Client {\n\treturn DefaultClient{\n\t\tconfig: config,\n\t}\n}", "func NewClient(config Config) *Client {\n\treturn &Client{Config: config}\n}", "func NewGetAttachmentParamsWithHTTPClient(client *http.Client) *GetAttachmentParams {\n\tvar ()\n\treturn &GetAttachmentParams{\n\t\tHTTPClient: client,\n\t}\n}", "func NewClient(reader io.Reader, confFunc configFunc) (*http.Client, error) {\n\tb, err := ioutil.ReadAll(reader)\n\tif err != nil {\n\t\tlog.Printf(\"Unable to read client secret file: %v\", err)\n\t\treturn nil, err\n\t}\n\n\tconf, err := confFunc(b)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tclient := getClient(conf)\n\treturn client, nil\n}", "func NewHTTPClientFromConfig(cfg *config.Config) (*HTTPClient, error) {\n\t// get clients\n\tordererClients, err := getOrdererHTTPClients(cfg)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tpeerClients, err := getPeerHTTPClients(cfg)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn &HTTPClient{\n\t\tordererHTTPClients: ordererClients,\n\t\tpeerHTTPClients: peerClients,\n\t\tprivKey: cfg.KeyStore.Privs[0],\n\t}, nil\n}", "func NewUnsavedPostThumbnailClient(c config) *UnsavedPostThumbnailClient {\n\treturn &UnsavedPostThumbnailClient{config: c}\n}", "func NewClient(config *config.Config) Client {\n\treturn &releaseClient{\n\t\tconfig: config,\n\t}\n}", "func (c *UnsavedPostAttachmentClient) Get(ctx context.Context, id int) (*UnsavedPostAttachment, error) {\n\treturn c.Query().Where(unsavedpostattachment.ID(id)).Only(ctx)\n}", "func NewClient(config *adapter.Config, logger *log.Logger) *Client {\n\tif logger == nil {\n\t\tlogger = log.New(ioutil.Discard, \"\", 0)\n\t}\n\tc := &Client{\n\t\tconfig: config,\n\t\tlogger: logger,\n\t}\n\n\treturn c\n}", "func New(c *Config) Client {\n\treturn newClient(c)\n}", "func NewClient(c *Config) (*Client, error) {\n\tdef := DefaultConfig()\n\tif def == nil {\n\t\treturn nil, fmt.Errorf(\"could not create/read default configuration\")\n\t}\n\tif def.Error != nil {\n\t\treturn nil, errwrap.Wrapf(\"error encountered setting up default configuration: {{err}}\", def.Error)\n\t}\n\n\tif c == nil {\n\t\tc = def\n\t}\n\n\tc.modifyLock.Lock()\n\tdefer c.modifyLock.Unlock()\n\n\tif c.MinRetryWait == 0 {\n\t\tc.MinRetryWait = def.MinRetryWait\n\t}\n\n\tif c.MaxRetryWait == 0 {\n\t\tc.MaxRetryWait = def.MaxRetryWait\n\t}\n\n\tif c.HttpClient == nil {\n\t\tc.HttpClient = def.HttpClient\n\t}\n\tif c.HttpClient.Transport == nil {\n\t\tc.HttpClient.Transport = def.HttpClient.Transport\n\t}\n\n\taddress := c.Address\n\tif c.AgentAddress != \"\" {\n\t\taddress = c.AgentAddress\n\t}\n\n\tu, err := c.ParseAddress(address)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tclient := &Client{\n\t\taddr: u,\n\t\tconfig: c,\n\t\theaders: make(http.Header),\n\t}\n\n\tif c.ReadYourWrites {\n\t\tclient.replicationStateStore = &replicationStateStore{}\n\t}\n\n\t// Add the VaultRequest SSRF protection header\n\tclient.headers[RequestHeaderName] = []string{\"true\"}\n\n\tif token := os.Getenv(EnvVaultToken); token != \"\" {\n\t\tclient.token = token\n\t}\n\n\tif namespace := os.Getenv(EnvVaultNamespace); namespace != \"\" {\n\t\tclient.setNamespace(namespace)\n\t}\n\n\treturn client, nil\n}", "func NewClient(config *Configuration) (*Client, error) {\n\t// Check that authorization values are defined at all\n\tif config.AuthorizationHeaderToken == \"\" {\n\t\treturn nil, fmt.Errorf(\"No authorization is defined. You need AuthorizationHeaderToken\")\n\t}\n\n\tif config.ApplicationID == \"\" {\n\t\treturn nil, fmt.Errorf(\"ApplicationID is required - this is the only way to identify your requests in highwinds logs\")\n\t}\n\n\t// Configure the client from final configuration\n\tc := &Client{\n\t\tc: http.DefaultClient,\n\t\tDebug: config.Debug,\n\t\tApplicationID: config.ApplicationID,\n\t\tIdentity: &identity.Identification{\n\t\t\tAuthorizationHeaderToken: config.AuthorizationHeaderToken,\n\t\t},\n\t}\n\n\t// TODO eventually instantiate a custom client but not ready for that yet\n\n\t// Configure timeout on default client\n\tif config.Timeout == 0 {\n\t\tc.c.Timeout = time.Second * 10\n\t} else {\n\t\tc.c.Timeout = time.Second * time.Duration(config.Timeout)\n\t}\n\n\t// Set default headers\n\tc.Headers = c.GetHeaders()\n\treturn c, nil\n}", "func NewClient(cfg *restclient.Config) (Client, error) {\n\tresult := &client{}\n\tc, err := dynamic.NewForConfig(cfg)\n\tif err != nil {\n\t\tmsg := fmt.Sprintf(\"Failed to create client, with error: %v\", err)\n\t\tlog.Printf(\"[Error] %s\", msg)\n\t\treturn nil, fmt.Errorf(msg)\n\t}\n\tresult.dynamicClient = c\n\treturn result, nil\n}", "func NewClient(config ClientConfig) (Client, error) {\n\t// raise error on client creation if the url is invalid\n\tneturl, err := url.Parse(config.URL)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\thttpClient := http.DefaultClient\n\n\tif config.TLSInsecureSkipVerify {\n\t\thttpClient.Transport = &http.Transport{TLSClientConfig: &tls.Config{InsecureSkipVerify: true}}\n\t}\n\n\tc := &client{\n\t\tclient: httpClient,\n\t\trawurl: neturl.String(),\n\t\tusername: config.Username,\n\t\tpassword: config.Password,\n\t}\n\n\t// create a single service object and reuse it for each API service\n\tc.service.client = c\n\tc.knowledge = (*knowledgeService)(&c.service)\n\n\treturn c, nil\n}", "func NewClient(config *Config) *Client {\n\treturn &Client{\n\t\tconfig: config,\n\t}\n}", "func NewClientFromConfig() *Client {\n\treturn &Client{\n\t\tregistry: config.GlobalConfig.Registry,\n\t\torganization: config.GlobalConfig.Organization,\n\t\tusername: config.GlobalConfig.Username,\n\t\tpassword: config.GlobalConfig.Password,\n\t\tcopyTimeoutSeconds: config.GlobalConfig.ImageCopyTimeoutSeconds,\n\t\ttransport: defaultSkopeoTransport,\n\t}\n}", "func (p *flockerPlugin) newFlockerClient(hostIP string) (*flockerapi.Client, error) {\n\thost := env.GetEnvAsStringOrFallback(\"FLOCKER_CONTROL_SERVICE_HOST\", defaultHost)\n\tport, err := env.GetEnvAsIntOrFallback(\"FLOCKER_CONTROL_SERVICE_PORT\", defaultPort)\n\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tcaCertPath := env.GetEnvAsStringOrFallback(\"FLOCKER_CONTROL_SERVICE_CA_FILE\", defaultCACertFile)\n\tkeyPath := env.GetEnvAsStringOrFallback(\"FLOCKER_CONTROL_SERVICE_CLIENT_KEY_FILE\", defaultClientKeyFile)\n\tcertPath := env.GetEnvAsStringOrFallback(\"FLOCKER_CONTROL_SERVICE_CLIENT_CERT_FILE\", defaultClientCertFile)\n\n\tc, err := flockerapi.NewClient(host, port, hostIP, caCertPath, keyPath, certPath)\n\treturn c, err\n}", "func NewClient(config *Config) (*Client, error) {\n\n\tconfig = DefaultConfig().Merge(config)\n\n\tif !strings.HasPrefix(config.Address, \"http\") {\n\t\tconfig.Address = \"http://\" + config.Address\n\t}\n\n\tif err := config.Validate(); err != nil {\n\t\treturn nil, err\n\t}\n\n\tclient := &Client{\n\t\tconfig: *config,\n\t\theaders: map[string]string{},\n\t\thttpClient: cleanhttp.DefaultClient(),\n\t}\n\n\treturn client, nil\n}", "func NewRolePolicyAttachmentClient(conf aws.Config) RolePolicyAttachmentClient {\n\treturn iam.New(conf)\n}", "func NewClient(config *Config) *Client {\n\tc := &Client{config: defaultConfig.Merge(config)}\n\n\treturn c\n}", "func NewBedtypeClient(c config) *BedtypeClient {\n\treturn &BedtypeClient{config: c}\n}", "func New(httpClient *http.Client, opts *ClientOptions) (*Client, error) {\n\tif err := opts.Validate(); err != nil {\n\t\treturn nil, err\n\t}\n\n\tbaseURL, err := url.Parse(opts.Host)\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"error parsing host URL\")\n\t}\n\n\tclient := Client{\n\t\tbaseURL: baseURL,\n\t\tkey: opts.Key,\n\t\tversion: opts.Version,\n\t\tapiPath: opts.GhostPath,\n\t\thttpClient: httpClient,\n\t}\n\n\tclient.Posts = &PostResource{&client}\n\tclient.Pages = &PageResource{&client}\n\tclient.Authors = &AuthorResource{&client}\n\tclient.Tags = &TagResource{&client}\n\n\treturn &client, nil\n}", "func NewClient(c Config) Client {\n\treturn &client{config: c}\n}", "func NewFromConfig(ktClient pb.KeyTransparencyClient, config *pb.Domain) (*Client, error) {\n\tktVerifier, err := NewVerifierFromDomain(config)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn New(ktClient, config.DomainId, ktVerifier), nil\n}", "func New(config ClientConfig) (Client, error) {\n\tvar err error\n\n\tclient := Client{collections: make(map[string]*mongo.Collection)}\n\tclientOptions := options.Client().ApplyURI(config.url())\n\n\t// Connect to MongoDB\n\tif client.client, err = mongo.Connect(context.TODO(), clientOptions); err != nil {\n\t\treturn client, err\n\t}\n\n\t// Check the connection\n\tif err = client.client.Ping(context.TODO(), nil); err != nil {\n\t\treturn client, err\n\t}\n\n\tclient.database = client.client.Database(config.Database)\n\n\treturn client, nil\n}", "func NewEndpointAttachment(ctx *pulumi.Context,\n\tname string, args *EndpointAttachmentArgs, opts ...pulumi.ResourceOption) (*EndpointAttachment, error) {\n\tif args == nil {\n\t\treturn nil, errors.New(\"missing one or more required arguments\")\n\t}\n\n\tif args.OrganizationId == nil {\n\t\treturn nil, errors.New(\"invalid value for required argument 'OrganizationId'\")\n\t}\n\treplaceOnChanges := pulumi.ReplaceOnChanges([]string{\n\t\t\"organizationId\",\n\t})\n\topts = append(opts, replaceOnChanges)\n\topts = internal.PkgResourceDefaultOpts(opts)\n\tvar resource EndpointAttachment\n\terr := ctx.RegisterResource(\"google-native:apigee/v1:EndpointAttachment\", name, args, &resource, opts...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &resource, nil\n}", "func (c *Client) Post() *Request {\n\treturn NewRequest(c.httpClient, c.base, \"POST\", c.version, c.authstring, c.userAgent)\n}", "func NewClient(add, get, transfer, defaultPhoto, update, listMine, listProject, listAssociated, listProjectAssociated, downloadPhoto, listAll, delete_, adminSearch, progress, updateModule goa.Endpoint) *Client {\n\treturn &Client{\n\t\tAddEndpoint: add,\n\t\tGetEndpoint: get,\n\t\tTransferEndpoint: transfer,\n\t\tDefaultPhotoEndpoint: defaultPhoto,\n\t\tUpdateEndpoint: update,\n\t\tListMineEndpoint: listMine,\n\t\tListProjectEndpoint: listProject,\n\t\tListAssociatedEndpoint: listAssociated,\n\t\tListProjectAssociatedEndpoint: listProjectAssociated,\n\t\tDownloadPhotoEndpoint: downloadPhoto,\n\t\tListAllEndpoint: listAll,\n\t\tDeleteEndpoint: delete_,\n\t\tAdminSearchEndpoint: adminSearch,\n\t\tProgressEndpoint: progress,\n\t\tUpdateModuleEndpoint: updateModule,\n\t}\n}", "func NewClient(config *Config) (c *Client, err error) {\n\tif config == nil {\n\t\treturn nil, errClientConfigNil\n\t}\n\n\tc = &Client{\n\t\trevocationTransport: http.DefaultTransport,\n\t}\n\n\tif c.transport, err = ghinstallation.NewAppsTransport(\n\t\thttp.DefaultTransport,\n\t\tint64(config.AppID),\n\t\t[]byte(config.PrvKey),\n\t); err != nil {\n\t\treturn nil, err\n\t}\n\n\tif c.url, err = url.ParseRequestURI(fmt.Sprintf(\n\t\t\"%s/app/installations/%v/access_tokens\",\n\t\tstrings.TrimSuffix(fmt.Sprint(config.BaseURL), \"/\"),\n\t\tconfig.InsID,\n\t)); err != nil {\n\t\treturn nil, err\n\t}\n\n\tif c.revocationURL, err = url.ParseRequestURI(fmt.Sprintf(\n\t\t\"%s/installation/token\",\n\t\tstrings.TrimSuffix(fmt.Sprint(config.BaseURL), \"/\"),\n\t)); err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn c, nil\n}", "func CreateClientProvidingHTTPClient(httpClient HTTPClient, dockerConfig *configfile.ConfigFile) Client {\n\treturn Client{\n\t\tclient: httpClient,\n\t\tdockerConfig: dockerConfig,\n\t}\n}", "func NewClient(config *Config, client *http.Client, authType cauth.IAuth) (*Client, error) {\n\t// set up the transport layer\n\t// allow 100 concurrent connection in the connection pool\n\tif client.Transport == nil {\n\t\tt := http.Transport{}\n\t\tclient.Transport = &t\n\t}\n\tt := client.Transport.(*http.Transport).Clone()\n\tt.MaxIdleConns = maxIdleConns\n\tt.MaxConnsPerHost = maxConnsPerHost\n\tt.MaxIdleConnsPerHost = maxIdleConnsPerHost\n\t// override transport\n\tclient.Transport = t\n\n\tif config == nil {\n\t\treturn nil, errors.New(\"config is empty\")\n\t}\n\tif authType == nil {\n\t\treturn nil, errors.New(\"auth type is not defined\")\n\t}\n\treturn &Client{client: *client, config: config, authType: authType}, nil\n}", "func NewClientFromConfig(config DBConfig) PostgresClient {\n\tclient := PostgresClient{\n\t\tDBConfig: config,\n\t\tconnectionRetries: 0,\n\t}\n\t// Config prio: config < env < flags\n\tclient.ensureDefaults()\n\tclient.evalEnvironment()\n\treturn client\n}", "func NewChatMessageAttachment()(*ChatMessageAttachment) {\n m := &ChatMessageAttachment{\n }\n m.backingStore = ie8677ce2c7e1b4c22e9c3827ecd078d41185424dd9eeb92b7d971ed2d49a392e.BackingStoreFactoryInstance();\n m.SetAdditionalData(make(map[string]any))\n return m\n}", "func New(cfg Config) (*Client, error) {\n\tvar transport http.RoundTripper\n\tif cfg.Transport != nil {\n\t\ttransport = cfg.Transport\n\t} else {\n\t\ttransport = &DefaultTransport\n\t}\n\n\tc := &Client{\n\t\tTransport: transport,\n\t}\n\treturn c, nil\n}", "func NewClient(config HostConfig) *Client {\n\tc := &Client{\n\t\tconfig: config,\n\t}\n\tc.client = &http.Client{\n\t\tTransport: &http.Transport{\n\t\t\tTLSClientConfig: &tls.Config{\n\t\t\t\tInsecureSkipVerify: !config.Verify,\n\t\t\t},\n\t\t},\n\t}\n\n\tgrpcAddress := c.config.GRPC\n\tsecure := false\n\tif grpcAddress == `` {\n\t\tu, _ := url.Parse(c.config.API)\n\t\tgrpcAddress = u.Hostname()\n\t\tgrpcPort := u.Port()\n\t\tif u.Scheme == `http` {\n\t\t\tsecure = false\n\t\t\tif grpcPort == `` {\n\t\t\t\tgrpcPort = `80`\n\t\t\t}\n\t\t} else {\n\t\t\tsecure = true\n\t\t\tif grpcPort == `` {\n\t\t\t\tgrpcPort = `443`\n\t\t\t}\n\t\t}\n\n\t\tgrpcAddress = fmt.Sprintf(`%s:%s`, grpcAddress, grpcPort)\n\t}\n\n\tvar conn *grpc.ClientConn\n\tvar err error\n\tif secure {\n\t\tif conn, err = grpc.Dial(\n\t\t\tgrpcAddress,\n\t\t\tgrpc.WithTransportCredentials(credentials.NewTLS(&tls.Config{})),\n\t\t\tgrpc.WithDefaultCallOptions(grpc.MaxCallRecvMsgSize(100<<20)),\n\t\t); err != nil {\n\t\t\tpanic(err)\n\t\t}\n\t} else {\n\t\tif conn, err = grpc.Dial(\n\t\t\tgrpcAddress,\n\t\t\tgrpc.WithInsecure(),\n\t\t\tgrpc.WithDefaultCallOptions(grpc.MaxCallRecvMsgSize(100<<20)),\n\t\t); err != nil {\n\t\t\tpanic(err)\n\t\t}\n\t}\n\n\tc.cc = conn\n\n\tc.blog = protocols.NewTaoBlogClient(c.cc)\n\tc.management = protocols.NewManagementClient(c.cc)\n\n\treturn c\n}", "func NewClient(config *config.Config, httpClient *http.Client) *Client {\n\treturn &Client{\n\t\tGetter: NewGetter(config, httpClient),\n\t}\n}", "func NewCreateDrgAttachmentParamsWithHTTPClient(client *http.Client) *CreateDrgAttachmentParams {\n\tvar ()\n\treturn &CreateDrgAttachmentParams{\n\t\tHTTPClient: client,\n\t}\n}", "func NewClient(config *Config) *Client {\n\treturn &Client{\n\t\tchanged: make(chan struct{}),\n\t\tclosing: make(chan struct{}),\n\t\tcacheData: &Data{},\n\t\tlogger: log.New(os.Stderr, \"[metaclient] \", log.LstdFlags),\n\t\tpath: config.Dir,\n\t\tretentionAutoCreate: config.RetentionAutoCreate,\n\t\tconfig: config,\n\t}\n}", "func newDialClient(addr string) (SMTPClient, error) {\n\treturn smtp.Dial(addr)\n}", "func NewClient(configMode string) (client AzureClient) {\n\tvar configload Config\n\tif configMode == \"metadata\" {\n\t\tconfigload = LoadConfig()\n\t} else if configMode == \"environment\" {\n\t\tconfigload = EnvLoadConfig()\n\t} else {\n\t\tlog.Print(\"Invalid config Mode\")\n\t}\n\n\tclient = AzureClient{\n\t\tconfigload,\n\t\tGetVMClient(configload),\n\t\tGetNicClient(configload),\n\t\tGetLbClient(configload),\n\t}\n\treturn\n}", "func getClient(ctx context.Context, config *oauth2.Config) (*http.Client, error) {\n\ttokFile, err := xdg.CacheFile(\"gphotos-fb/token.json\")\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"xdg.CacheFile: %w\", err)\n\t}\n\n\ttok, err := tokenFromFile(tokFile)\n\tif err != nil {\n\t\ttok, err := getTokenFromWeb(ctx, config)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"getTokenFromWeb: %w\", err)\n\t\t}\n\n\t\tif err := saveToken(tokFile, tok); err != nil {\n\t\t\treturn nil, fmt.Errorf(\"saveToken: %w\", err)\n\t\t}\n\t}\n\treturn config.Client(ctx, tok), nil\n}", "func NewForConfig(c *rest.Config) (*AgonesV1Client, error) {\n\tconfig := *c\n\tif err := setConfigDefaults(&config); err != nil {\n\t\treturn nil, err\n\t}\n\thttpClient, err := rest.HTTPClientFor(&config)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn NewForConfigAndClient(&config, httpClient)\n}", "func NewWithGuid(guid string) (*Client, error) {\n\trawurl, ok := os.LookupEnv(\"ABR_ENDPOINT\")\n\tif !ok {\n\t\trawurl = BaseURL\n\t}\n\n\tbaseurl, err := url.Parse(rawurl)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tclient := &Client{\n\t\tBaseURL: baseurl,\n\t\thttpClient: &http.Client{},\n\t\tGUID: guid,\n\t}\n\treturn client, nil\n}", "func NewClient(c drive.Config) (drive.Client, error) {\n\td := &Drive{config: c}\n\tvar err error\n\t// Decode and verify RSA pub/priv keys\n\tif len(c.RsaPrivateKey) > 0 {\n\t\tb, _ := pem.Decode([]byte(c.RsaPrivateKey))\n\t\tif b == nil {\n\t\t\treturn nil, fmt.Errorf(\"parsing PEM encoded private key from config: %s\", c.RsaPrivateKey)\n\t\t}\n\t\tkey, err := x509.ParsePKCS1PrivateKey(b.Bytes)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"parsing PKCS1 private key from config: %s\", err)\n\t\t}\n\t\td.privkey = key\n\t\td.pubkey = &key.PublicKey\n\t} else if len(c.RsaPublicKey) > 0 {\n\t\tb, _ := pem.Decode([]byte(c.RsaPublicKey))\n\t\tif b == nil {\n\t\t\treturn nil, fmt.Errorf(\"parsing PEM encoded public key from config: %s\", c.RsaPublicKey)\n\t\t}\n\t\tpubkey, err := x509.ParsePKIXPublicKey(b.Bytes)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"failed to parse DER encoded public key from config: %s\", err)\n\t\t}\n\t\trsapubkey, ok := pubkey.(*rsa.PublicKey)\n\t\tif !ok {\n\t\t\treturn nil, fmt.Errorf(\"DER encoded public key in config must be an RSA key: %s\", err)\n\t\t}\n\t\td.pubkey = rsapubkey\n\t} else {\n\t\treturn nil, fmt.Errorf(\"encrypt requires that you specify either a public or private key\")\n\t}\n\n\t// Initialize the child client\n\tif len(c.Children) == 0 {\n\t\treturn nil, errors.New(\"no clients provided\")\n\t}\n\tif len(c.Children) > 1 {\n\t\treturn nil, errors.New(\"only one encrypted child is supported, you probably want a drive/cache in your config\")\n\t}\n\tchild, err := drive.NewClient(c.Children[0])\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"initing encrypted client %q: %s\", c.Provider, err)\n\t}\n\td.client = child\n\tif child.GetConfig().Write {\n\t\td.config.Write = true\n\t}\n\treturn d, nil\n}", "func (c *PostAttachmentClient) Update() *PostAttachmentUpdate {\n\tmutation := newPostAttachmentMutation(c.config, OpUpdate)\n\treturn &PostAttachmentUpdate{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func NewHTTPClientWithConfig(formats strfmt.Registry, cfg *TransportConfig) *OpenbankingPaymentsClient {\n\t// ensure nullable parameters have default\n\tif cfg == nil {\n\t\tcfg = DefaultTransportConfig()\n\t}\n\n\t// create transport and client\n\ttransport := httptransport.New(cfg.Host, cfg.BasePath, cfg.Schemes)\n\treturn New(transport, formats)\n}", "func NewClient(conf config.RemoteWriteConfig) (*Client, error) {\n\ttlsConfig, err := httputil.NewTLSConfig(conf.TLSConfig)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// The only timeout we care about is the configured push timeout.\n\t// It is applied on request. So we leave out any timings here.\n\tvar rt http.RoundTripper = &http.Transport{\n\t\tProxy: http.ProxyURL(conf.ProxyURL.URL),\n\t\tTLSClientConfig: tlsConfig,\n\t}\n\n\tif conf.BasicAuth != nil {\n\t\trt = httputil.NewBasicAuthRoundTripper(conf.BasicAuth.Username, conf.BasicAuth.Password, rt)\n\t}\n\n\treturn &Client{\n\t\turl: *conf.URL,\n\t\tclient: httputil.NewClient(rt),\n\t\ttimeout: time.Duration(conf.RemoteTimeout),\n\t}, nil\n}", "func NewControlPolicyAttachment(ctx *pulumi.Context,\n\tname string, args *ControlPolicyAttachmentArgs, opts ...pulumi.ResourceOption) (*ControlPolicyAttachment, error) {\n\tif args == nil {\n\t\treturn nil, errors.New(\"missing one or more required arguments\")\n\t}\n\n\tif args.PolicyId == nil {\n\t\treturn nil, errors.New(\"invalid value for required argument 'PolicyId'\")\n\t}\n\tif args.TargetId == nil {\n\t\treturn nil, errors.New(\"invalid value for required argument 'TargetId'\")\n\t}\n\topts = internal.PkgResourceDefaultOpts(opts)\n\tvar resource ControlPolicyAttachment\n\terr := ctx.RegisterResource(\"alicloud:resourcemanager/controlPolicyAttachment:ControlPolicyAttachment\", name, args, &resource, opts...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &resource, nil\n}", "func NewClient(cfg watson.Config) (Client, error) {\n\tdialog := Client{version: \"/\" + defaultMajorVersion}\n\tif len(cfg.Version) > 0 {\n\t\tdialog.version = \"/\" + cfg.Version\n\t}\n\tif len(cfg.Credentials.ServiceName) == 0 {\n\t\tcfg.Credentials.ServiceName = \"dialog\"\n\t}\n\tif len(cfg.Credentials.Url) == 0 {\n\t\tcfg.Credentials.Url = defaultUrl\n\t}\n\tclient, err := watson.NewClient(cfg.Credentials)\n\tif err != nil {\n\t\treturn Client{}, err\n\t}\n\tdialog.watsonClient = client\n\treturn dialog, nil\n}", "func NewForConfig(config clientcmd.ClientConfig) (client *Client, err error) {\n\tif config == nil {\n\t\t// initialize client-go clients\n\t\tloadingRules := clientcmd.NewDefaultClientConfigLoadingRules()\n\t\tconfigOverrides := &clientcmd.ConfigOverrides{}\n\t\tconfig = clientcmd.NewNonInteractiveDeferredLoadingClientConfig(loadingRules, configOverrides)\n\t}\n\n\tclient = new(Client)\n\tclient.KubeConfig = config\n\n\tclient.KubeClientConfig, err = client.KubeConfig.ClientConfig()\n\tif err != nil {\n\t\treturn nil, errors.Wrapf(err, errorMsg)\n\t}\n\n\tclient.KubeClient, err = kubernetes.NewForConfig(client.KubeClientConfig)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tclient.Namespace, _, err = client.KubeConfig.Namespace()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tclient.OperatorClient, err = operatorsclientset.NewForConfig(client.KubeClientConfig)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tclient.DynamicClient, err = dynamic.NewForConfig(client.KubeClientConfig)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tclient.appsClient, err = appsclientset.NewForConfig(client.KubeClientConfig)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tclient.serviceCatalogClient, err = servicecatalogclienset.NewForConfig(client.KubeClientConfig)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tclient.discoveryClient, err = discovery.NewDiscoveryClientForConfig(client.KubeClientConfig)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tclient.checkIngressSupports = true\n\n\tclient.userClient, err = userclientset.NewForConfig(client.KubeClientConfig)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tclient.projectClient, err = projectclientset.NewForConfig(client.KubeClientConfig)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tclient.routeClient, err = routeclientset.NewForConfig(client.KubeClientConfig)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn client, nil\n}", "func NewClient(config Config) (*Client, error) {\n\tclient := &Client{\n\t\tuserAgent: \"GoGenderize/\" + Version,\n\t\tapiKey: config.APIKey,\n\t\thttpClient: http.DefaultClient,\n\t}\n\n\tif config.UserAgent != \"\" {\n\t\tclient.userAgent = config.UserAgent\n\t}\n\n\tif config.HTTPClient != nil {\n\t\tclient.httpClient = config.HTTPClient\n\t}\n\n\tserver := defaultServer\n\tif config.Server != \"\" {\n\t\tserver = config.Server\n\t}\n\tapiURL, err := url.Parse(server)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tclient.apiURL = apiURL\n\n\treturn client, nil\n}", "func NewClient(kubeConfig string) (client *Client, err error) {\n\tconfig, err := GetClientConfig(kubeConfig)\n\tif err != nil {\n\t\treturn nil, trace.Wrap(err)\n\t}\n\n\tclientset, err := kubernetes.NewForConfig(config)\n\tif err != nil {\n\t\treturn nil, trace.Wrap(err)\n\t}\n\n\textClientset, err := apiextensionsclientset.NewForConfig(config)\n\tif err != nil {\n\t\treturn nil, trace.Wrap(err)\n\t}\n\n\treturn &Client{\n\t\tClient: clientset,\n\t\tExtClient: extClientset,\n\t}, nil\n}", "func NewClient(ctx context.Context, cfg *Config, bc *bclient.Client, db *db.Database) (*Client, error) {\n\twg := &sync.WaitGroup{}\n\n\tfor _, watcher := range cfg.Watchers {\n\t\twg.Add(1)\n\t\tgo func(discToken, token0, token1 string) {\n\t\t\tdefer wg.Done()\n\t\t\tdg, err := discordgo.New(\"Bot \" + discToken)\n\t\t\tif err != nil {\n\t\t\t\tlog.Println(\"failed to start watcher: \", err)\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tif err := dg.Open(); err != nil {\n\t\t\t\tlog.Println(\"failed to start watcher: \", err)\n\t\t\t\treturn\n\t\t\t}\n\t\t}(watcher.DiscordToken, watcher.Token0Address, watcher.Token1Address)\n\t}\n\n\tclient := &Client{bc: bc, wg: wg, db: db}\n\n\tlog.Println(\"bot is now running\")\n\treturn client, nil\n}", "func NewClient(config *latest.Config, kubeClient kubectl.Client, dockerClient docker.Client, log log.Logger) Client {\n\treturn &client{\n\t\tconfig: config,\n\t\tkubeClient: kubeClient,\n\t\tdockerClient: dockerClient,\n\t\tlog: log,\n\t}\n}", "func NewWithConfig(conf Config) (*WebhookHandler, error) {\n\th := &WebhookHandler{}\n\n\tcli, err := newClient(conf)\n\tif err != nil {\n\t\th.loggingError(\"newClient error: %s\", err)\n\t\treturn nil, err\n\t}\n\n\tif conf.BotID == 0 {\n\t\t// get bot's id from github's current user.\n\t\tctx := context.Background()\n\t\tu, _, err := cli.Users.Get(ctx, \"\")\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tconf.BotID = u.GetID()\n\t\th.loggingInfo(\"botID is fetched from github: %d\", conf.BotID)\n\t}\n\n\th.client = cli\n\th.Config = conf\n\th.loggingInfo(\"initialized\")\n\treturn h, nil\n}", "func NewUnsavedPostImageClient(c config) *UnsavedPostImageClient {\n\treturn &UnsavedPostImageClient{config: c}\n}", "func NewClient(config *Config) (c *Client, err error) {\n\tc = &Client{Config: config, volume: 15}\n\n\t// Check if Matrix and Telegram aren't enabled at the same time.\n\tif config.Telegram != nil && config.Matrix != nil {\n\t\treturn nil, fmt.Errorf(\"both Telegram and Matrix may not be configured at the same time\")\n\t}\n\n\t// Telegram\n\tif config.Telegram != nil {\n\t\tc.Telegram, err = telegram.NewClient(config.Telegram.Token, config.Telegram.Target)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"connecting to Telegram: %w\", err)\n\t\t}\n\t\tgo c.Telegram.Start()\n\t}\n\n\t// Matrix\n\tif config.Matrix != nil {\n\t\tc.Matrix, err = matrix.NewClient(config.Matrix.Server, config.Matrix.User, config.Matrix.Token, config.Matrix.Room)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"connecting to Matrix: %w\", err)\n\t\t}\n\t}\n\n\t// Mumble\n\tc.Mumble, err = mumble.NewClient(config.Mumble.Server, config.Mumble.User)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"connecting to Mumble: %w\", err)\n\t}\n\n\treturn\n}", "func NewClient(uploadPackBin, receivePackBin string) transport.Transport {\n\treturn common.NewClient(&runner{\n\t\tUploadPackBin: uploadPackBin,\n\t\tReceivePackBin: receivePackBin,\n\t})\n}", "func NewClient(instanceConfig config.InstanceConfig, apiConfig DestinationServiceAPIConfig,\n\tsubdomain string) (*Client, error) {\n\tif err := setInstanceConfigTokenURLForSubdomain(&instanceConfig, apiConfig, subdomain); err != nil {\n\t\treturn nil, err\n\t}\n\thttpClient, err := getHTTPClient(instanceConfig, apiConfig)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn &Client{\n\t\tHTTPClient: httpClient,\n\t\tapiConfig: apiConfig,\n\t\tauthConfig: instanceConfig,\n\t}, nil\n}", "func NewClient(config *Config) Client {\n\tendpoint := net.JoinHostPort(config.Hostname, strconv.Itoa(config.port()))\n\tif !strings.Contains(endpoint, \"//\") {\n\t\tendpoint = \"http://\" + endpoint\n\t}\n\n\topts := &jsonrpc.RPCClientOpts{\n\t\tCustomHeaders: map[string]string{\n\t\t\t\"Authorization\": \"Basic \" + base64.StdEncoding.EncodeToString([]byte(config.Username+\":\"+config.Password)),\n\t\t},\n\t}\n\n\treturn &client{\n\t\tRPCClient: jsonrpc.NewClientWithOpts(endpoint, opts),\n\t}\n}", "func NewForConfig(c *rest.Config) (*ZdyfapiV1alpha1Client, error) {\n\tconfig := *c\n\tif err := setConfigDefaults(&config); err != nil {\n\t\treturn nil, err\n\t}\n\tclient, err := rest.RESTClientFor(&config)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &ZdyfapiV1alpha1Client{client}, nil\n}" ]
[ "0.6432026", "0.6285115", "0.6260475", "0.5948145", "0.5884785", "0.5794917", "0.5782473", "0.55624205", "0.5469887", "0.53205776", "0.52869195", "0.5135196", "0.5133446", "0.5115558", "0.5087808", "0.507211", "0.5027645", "0.49662498", "0.49537706", "0.49149472", "0.48645562", "0.48590323", "0.48358208", "0.4827669", "0.48220637", "0.48156065", "0.47665155", "0.47627532", "0.47438654", "0.47326586", "0.47041026", "0.46831805", "0.46709618", "0.46709618", "0.46675688", "0.46365774", "0.46306264", "0.4629367", "0.46280554", "0.46241206", "0.46195075", "0.461893", "0.46067727", "0.46060988", "0.45936024", "0.45818728", "0.45271048", "0.45045477", "0.44961095", "0.4494445", "0.44925243", "0.44908935", "0.44775766", "0.44709912", "0.44661197", "0.44638643", "0.44628796", "0.44576472", "0.44576386", "0.44523978", "0.44470486", "0.44464535", "0.4442028", "0.44395906", "0.44395506", "0.44388223", "0.44364485", "0.443025", "0.44294602", "0.44236916", "0.44230565", "0.441983", "0.44182834", "0.44143414", "0.4412342", "0.44115126", "0.44090396", "0.43992034", "0.43917882", "0.43899074", "0.4382638", "0.43815687", "0.4379921", "0.4376116", "0.43722928", "0.43680483", "0.43616933", "0.43575686", "0.43543896", "0.43524072", "0.43506595", "0.43500042", "0.4346373", "0.4346093", "0.434568", "0.43399766", "0.4337314", "0.43336403", "0.43308407", "0.43291184" ]
0.8141046
0
Use adds a list of mutation hooks to the hooks stack. A call to `Use(f, g, h)` equals to `postattachment.Hooks(f(g(h())))`.
func (c *PostAttachmentClient) Use(hooks ...Hook) { c.hooks.PostAttachment = append(c.hooks.PostAttachment, hooks...) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (f *Flame) Use(handlers ...Handler) {\n\tvalidateAndWrapHandlers(handlers, nil)\n\tf.handlers = append(f.handlers, handlers...)\n}", "func (c *PostClient) Use(hooks ...Hook) {\n\tc.hooks.Post = append(c.hooks.Post, hooks...)\n}", "func (c *TagClient) Use(hooks ...Hook) {\n\tc.hooks.Tag = append(c.hooks.Tag, hooks...)\n}", "func (c *AdminClient) Use(hooks ...Hook) {\n\tc.hooks.Admin = append(c.hooks.Admin, hooks...)\n}", "func (em *entityManager) Use(mw ...MiddlewareFunc) {\n\tem.mwStack = append(em.mwStack, mw...)\n}", "func (c *WorkExperienceClient) Use(hooks ...Hook) {\n\tc.hooks.WorkExperience = append(c.hooks.WorkExperience, hooks...)\n}", "func (c *FoodmenuClient) Use(hooks ...Hook) {\n\tc.hooks.Foodmenu = append(c.hooks.Foodmenu, hooks...)\n}", "func (c *ReviewClient) Use(hooks ...Hook) {\n\tc.hooks.Review = append(c.hooks.Review, hooks...)\n}", "func (c *StatustClient) Use(hooks ...Hook) {\n\tc.hooks.Statust = append(c.hooks.Statust, hooks...)\n}", "func (c *EventClient) Use(hooks ...Hook) {\n\tc.hooks.Event = append(c.hooks.Event, hooks...)\n}", "func (c *PetruleClient) Use(hooks ...Hook) {\n\tc.hooks.Petrule = append(c.hooks.Petrule, hooks...)\n}", "func (c *EatinghistoryClient) Use(hooks ...Hook) {\n\tc.hooks.Eatinghistory = append(c.hooks.Eatinghistory, hooks...)\n}", "func (c *MealplanClient) Use(hooks ...Hook) {\n\tc.hooks.Mealplan = append(c.hooks.Mealplan, hooks...)\n}", "func (c *BeerClient) Use(hooks ...Hook) {\n\tc.hooks.Beer = append(c.hooks.Beer, hooks...)\n}", "func (c *PharmacistClient) Use(hooks ...Hook) {\n\tc.hooks.Pharmacist = append(c.hooks.Pharmacist, hooks...)\n}", "func (c *LevelOfDangerousClient) Use(hooks ...Hook) {\n\tc.hooks.LevelOfDangerous = append(c.hooks.LevelOfDangerous, hooks...)\n}", "func (c *ToolClient) Use(hooks ...Hook) {\n\tc.hooks.Tool = append(c.hooks.Tool, hooks...)\n}", "func (c *BranchClient) Use(hooks ...Hook) {\n\tc.hooks.Branch = append(c.hooks.Branch, hooks...)\n}", "func (c *DentistClient) Use(hooks ...Hook) {\n\tc.hooks.Dentist = append(c.hooks.Dentist, hooks...)\n}", "func (ms *MiddlewareStack) Use(mw ...MiddlewareFunc) {\n\tms.stack = append(ms.stack, mw...)\n}", "func (ms *MiddlewareStack) Use(mw ...MiddlewareFunc) {\n\tms.stack = append(ms.stack, mw...)\n}", "func (c *PetClient) Use(hooks ...Hook) {\n\tc.hooks.Pet = append(c.hooks.Pet, hooks...)\n}", "func (c *SituationClient) Use(hooks ...Hook) {\n\tc.hooks.Situation = append(c.hooks.Situation, hooks...)\n}", "func (c *PositionClient) Use(hooks ...Hook) {\n\tc.hooks.Position = append(c.hooks.Position, hooks...)\n}", "func (c *PositionClient) Use(hooks ...Hook) {\n\tc.hooks.Position = append(c.hooks.Position, hooks...)\n}", "func (c *PositionClient) Use(hooks ...Hook) {\n\tc.hooks.Position = append(c.hooks.Position, hooks...)\n}", "func (c *PositionassingmentClient) Use(hooks ...Hook) {\n\tc.hooks.Positionassingment = append(c.hooks.Positionassingment, hooks...)\n}", "func (c *OperationClient) Use(hooks ...Hook) {\n\tc.hooks.Operation = append(c.hooks.Operation, hooks...)\n}", "func (c *MedicineClient) Use(hooks ...Hook) {\n\tc.hooks.Medicine = append(c.hooks.Medicine, hooks...)\n}", "func (c *VeterinarianClient) Use(hooks ...Hook) {\n\tc.hooks.Veterinarian = append(c.hooks.Veterinarian, hooks...)\n}", "func (c *BillClient) Use(hooks ...Hook) {\n\tc.hooks.Bill = append(c.hooks.Bill, hooks...)\n}", "func (c *BillClient) Use(hooks ...Hook) {\n\tc.hooks.Bill = append(c.hooks.Bill, hooks...)\n}", "func (c *BillClient) Use(hooks ...Hook) {\n\tc.hooks.Bill = append(c.hooks.Bill, hooks...)\n}", "func (c *TasteClient) Use(hooks ...Hook) {\n\tc.hooks.Taste = append(c.hooks.Taste, hooks...)\n}", "func (c *ClubClient) Use(hooks ...Hook) {\n\tc.hooks.Club = append(c.hooks.Club, hooks...)\n}", "func (c *ComplaintClient) Use(hooks ...Hook) {\n\tc.hooks.Complaint = append(c.hooks.Complaint, hooks...)\n}", "func (c *PartClient) Use(hooks ...Hook) {\n\tc.hooks.Part = append(c.hooks.Part, hooks...)\n}", "func (c *WalletNodeClient) Use(hooks ...Hook) {\n\tc.hooks.WalletNode = append(c.hooks.WalletNode, hooks...)\n}", "func (c *PurposeClient) Use(hooks ...Hook) {\n\tc.hooks.Purpose = append(c.hooks.Purpose, hooks...)\n}", "func (c *PhysicianClient) Use(hooks ...Hook) {\n\tc.hooks.Physician = append(c.hooks.Physician, hooks...)\n}", "func (c *PhysicianClient) Use(hooks ...Hook) {\n\tc.hooks.Physician = append(c.hooks.Physician, hooks...)\n}", "func (c *BedtypeClient) Use(hooks ...Hook) {\n\tc.hooks.Bedtype = append(c.hooks.Bedtype, hooks...)\n}", "func (c *UnsavedPostClient) Use(hooks ...Hook) {\n\tc.hooks.UnsavedPost = append(c.hooks.UnsavedPost, hooks...)\n}", "func (c *BuildingClient) Use(hooks ...Hook) {\n\tc.hooks.Building = append(c.hooks.Building, hooks...)\n}", "func (c *OperativeClient) Use(hooks ...Hook) {\n\tc.hooks.Operative = append(c.hooks.Operative, hooks...)\n}", "func (c *ActivityTypeClient) Use(hooks ...Hook) {\n\tc.hooks.ActivityType = append(c.hooks.ActivityType, hooks...)\n}", "func (c *PlanetClient) Use(hooks ...Hook) {\n\tc.hooks.Planet = append(c.hooks.Planet, hooks...)\n}", "func (c *TransactionClient) Use(hooks ...Hook) {\n\tc.hooks.Transaction = append(c.hooks.Transaction, hooks...)\n}", "func (c *Client) Use(hooks ...Hook) {\n\tc.Event.Use(hooks...)\n\tc.Tag.Use(hooks...)\n}", "func (c *FacultyClient) Use(hooks ...Hook) {\n\tc.hooks.Faculty = append(c.hooks.Faculty, hooks...)\n}", "func (c *UserClient) Use(hooks ...Hook) {\n\tc.hooks.User = append(c.hooks.User, hooks...)\n}", "func (c *UserClient) Use(hooks ...Hook) {\n\tc.hooks.User = append(c.hooks.User, hooks...)\n}", "func (c *UserClient) Use(hooks ...Hook) {\n\tc.hooks.User = append(c.hooks.User, hooks...)\n}", "func (c *UserClient) Use(hooks ...Hook) {\n\tc.hooks.User = append(c.hooks.User, hooks...)\n}", "func (c *UserClient) Use(hooks ...Hook) {\n\tc.hooks.User = append(c.hooks.User, hooks...)\n}", "func (c *UserClient) Use(hooks ...Hook) {\n\tc.hooks.User = append(c.hooks.User, hooks...)\n}", "func (c *UserClient) Use(hooks ...Hook) {\n\tc.hooks.User = append(c.hooks.User, hooks...)\n}", "func (c *UserClient) Use(hooks ...Hook) {\n\tc.hooks.User = append(c.hooks.User, hooks...)\n}", "func (c *UserClient) Use(hooks ...Hook) {\n\tc.hooks.User = append(c.hooks.User, hooks...)\n}", "func (c *UserClient) Use(hooks ...Hook) {\n\tc.hooks.User = append(c.hooks.User, hooks...)\n}", "func (c *UserClient) Use(hooks ...Hook) {\n\tc.hooks.User = append(c.hooks.User, hooks...)\n}", "func (c *CleanernameClient) Use(hooks ...Hook) {\n\tc.hooks.Cleanername = append(c.hooks.Cleanername, hooks...)\n}", "func (c *PledgeClient) Use(hooks ...Hook) {\n\tc.hooks.Pledge = append(c.hooks.Pledge, hooks...)\n}", "func (c *SymptomClient) Use(hooks ...Hook) {\n\tc.hooks.Symptom = append(c.hooks.Symptom, hooks...)\n}", "func (c *ClubBranchClient) Use(hooks ...Hook) {\n\tc.hooks.ClubBranch = append(c.hooks.ClubBranch, hooks...)\n}", "func (c *PositionInPharmacistClient) Use(hooks ...Hook) {\n\tc.hooks.PositionInPharmacist = append(c.hooks.PositionInPharmacist, hooks...)\n}", "func (c *PaymentClient) Use(hooks ...Hook) {\n\tc.hooks.Payment = append(c.hooks.Payment, hooks...)\n}", "func (c *PaymentClient) Use(hooks ...Hook) {\n\tc.hooks.Payment = append(c.hooks.Payment, hooks...)\n}", "func (c *ClubTypeClient) Use(hooks ...Hook) {\n\tc.hooks.ClubType = append(c.hooks.ClubType, hooks...)\n}", "func (c *SkillClient) Use(hooks ...Hook) {\n\tc.hooks.Skill = append(c.hooks.Skill, hooks...)\n}", "func (c *MedicineTypeClient) Use(hooks ...Hook) {\n\tc.hooks.MedicineType = append(c.hooks.MedicineType, hooks...)\n}", "func (c *BinaryFileClient) Use(hooks ...Hook) {\n\tc.hooks.BinaryFile = append(c.hooks.BinaryFile, hooks...)\n}", "func (c *UnitOfMedicineClient) Use(hooks ...Hook) {\n\tc.hooks.UnitOfMedicine = append(c.hooks.UnitOfMedicine, hooks...)\n}", "func (c *UserWalletClient) Use(hooks ...Hook) {\n\tc.hooks.UserWallet = append(c.hooks.UserWallet, hooks...)\n}", "func (c *Client) Use(hooks ...Hook) {\n\tc.Admin.Use(hooks...)\n\tc.AdminSession.Use(hooks...)\n\tc.Category.Use(hooks...)\n\tc.Post.Use(hooks...)\n\tc.PostAttachment.Use(hooks...)\n\tc.PostImage.Use(hooks...)\n\tc.PostThumbnail.Use(hooks...)\n\tc.PostVideo.Use(hooks...)\n\tc.UnsavedPost.Use(hooks...)\n\tc.UnsavedPostAttachment.Use(hooks...)\n\tc.UnsavedPostImage.Use(hooks...)\n\tc.UnsavedPostThumbnail.Use(hooks...)\n\tc.UnsavedPostVideo.Use(hooks...)\n}", "func (c *QueueClient) Use(hooks ...Hook) {\n\tc.hooks.Queue = append(c.hooks.Queue, hooks...)\n}", "func (c *ActivitiesClient) Use(hooks ...Hook) {\n\tc.hooks.Activities = append(c.hooks.Activities, hooks...)\n}", "func (c *PostVideoClient) Use(hooks ...Hook) {\n\tc.hooks.PostVideo = append(c.hooks.PostVideo, hooks...)\n}", "func (c *EmployeeClient) Use(hooks ...Hook) {\n\tc.hooks.Employee = append(c.hooks.Employee, hooks...)\n}", "func (c *EmployeeClient) Use(hooks ...Hook) {\n\tc.hooks.Employee = append(c.hooks.Employee, hooks...)\n}", "func (c *EmployeeClient) Use(hooks ...Hook) {\n\tc.hooks.Employee = append(c.hooks.Employee, hooks...)\n}", "func (c *PatientClient) Use(hooks ...Hook) {\n\tc.hooks.Patient = append(c.hooks.Patient, hooks...)\n}", "func (c *PatientClient) Use(hooks ...Hook) {\n\tc.hooks.Patient = append(c.hooks.Patient, hooks...)\n}", "func (c *PatientClient) Use(hooks ...Hook) {\n\tc.hooks.Patient = append(c.hooks.Patient, hooks...)\n}", "func (c *JobpositionClient) Use(hooks ...Hook) {\n\tc.hooks.Jobposition = append(c.hooks.Jobposition, hooks...)\n}", "func (c *UsertypeClient) Use(hooks ...Hook) {\n\tc.hooks.Usertype = append(c.hooks.Usertype, hooks...)\n}", "func (c *PrescriptionClient) Use(hooks ...Hook) {\n\tc.hooks.Prescription = append(c.hooks.Prescription, hooks...)\n}", "func (c *GenderClient) Use(hooks ...Hook) {\n\tc.hooks.Gender = append(c.hooks.Gender, hooks...)\n}", "func (c *GenderClient) Use(hooks ...Hook) {\n\tc.hooks.Gender = append(c.hooks.Gender, hooks...)\n}", "func (c *DepositClient) Use(hooks ...Hook) {\n\tc.hooks.Deposit = append(c.hooks.Deposit, hooks...)\n}", "func (c *PostImageClient) Use(hooks ...Hook) {\n\tc.hooks.PostImage = append(c.hooks.PostImage, hooks...)\n}", "func (c *DoctorClient) Use(hooks ...Hook) {\n\tc.hooks.Doctor = append(c.hooks.Doctor, hooks...)\n}", "func (c *Client) Use(hooks ...Hook) {\n\tc.Eatinghistory.Use(hooks...)\n\tc.Foodmenu.Use(hooks...)\n\tc.Mealplan.Use(hooks...)\n\tc.Taste.Use(hooks...)\n\tc.User.Use(hooks...)\n}", "func (c *ClubapplicationClient) Use(hooks ...Hook) {\n\tc.hooks.Clubapplication = append(c.hooks.Clubapplication, hooks...)\n}", "func (c *OrderClient) Use(hooks ...Hook) {\n\tc.hooks.Order = append(c.hooks.Order, hooks...)\n}", "func (c *AnnotationClient) Use(hooks ...Hook) {\n\tc.hooks.Annotation = append(c.hooks.Annotation, hooks...)\n}", "func (c *PostThumbnailClient) Use(hooks ...Hook) {\n\tc.hooks.PostThumbnail = append(c.hooks.PostThumbnail, hooks...)\n}", "func (c *DrugAllergyClient) Use(hooks ...Hook) {\n\tc.hooks.DrugAllergy = append(c.hooks.DrugAllergy, hooks...)\n}", "func (c *PartorderClient) Use(hooks ...Hook) {\n\tc.hooks.Partorder = append(c.hooks.Partorder, hooks...)\n}", "func (c *UnsavedPostAttachmentClient) Use(hooks ...Hook) {\n\tc.hooks.UnsavedPostAttachment = append(c.hooks.UnsavedPostAttachment, hooks...)\n}" ]
[ "0.699156", "0.68902415", "0.6885639", "0.68679905", "0.6855003", "0.6767331", "0.67590666", "0.6758843", "0.6739275", "0.6721201", "0.670545", "0.66725653", "0.66690093", "0.664811", "0.66480476", "0.6632286", "0.66169125", "0.6606306", "0.6605284", "0.6602622", "0.6602622", "0.66019136", "0.65811706", "0.65726155", "0.65726155", "0.65726155", "0.6569825", "0.6555626", "0.6555104", "0.6537651", "0.6535409", "0.6535409", "0.6535409", "0.65096956", "0.6507147", "0.65057254", "0.65023106", "0.64993805", "0.64927524", "0.6478007", "0.6478007", "0.6477", "0.6474645", "0.64723015", "0.64564335", "0.64522594", "0.6447545", "0.64441437", "0.64417887", "0.64390785", "0.6434056", "0.6434056", "0.6434056", "0.6434056", "0.6434056", "0.6434056", "0.6434056", "0.6434056", "0.6434056", "0.6434056", "0.6434056", "0.6425781", "0.6424257", "0.6422486", "0.64116085", "0.6404021", "0.64012367", "0.64012367", "0.63968474", "0.6394885", "0.6387961", "0.6387506", "0.6380359", "0.63632315", "0.63534755", "0.6346591", "0.63415956", "0.6341216", "0.6339431", "0.6339431", "0.6339431", "0.6318898", "0.6318898", "0.6318898", "0.63146955", "0.63060147", "0.62990606", "0.6297612", "0.6297612", "0.62863314", "0.62842935", "0.6282268", "0.6270364", "0.6264092", "0.6262784", "0.6254468", "0.6254275", "0.62503976", "0.6245786", "0.62456083" ]
0.65684956
27