repo
stringlengths 5
67
| sha
stringlengths 40
40
| path
stringlengths 4
234
| url
stringlengths 85
339
| language
stringclasses 6
values | split
stringclasses 3
values | doc
stringlengths 3
51.2k
| sign
stringlengths 5
8.01k
| problem
stringlengths 13
51.2k
| output
stringlengths 0
3.87M
|
---|---|---|---|---|---|---|---|---|---|
docker/libnetwork | 9ff9b57c344df5cd47443ad9e65702ec85c5aeb0 | bitseq/sequence.go | https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/bitseq/sequence.go#L271-L306 | go | train | // CheckConsistency checks if the bit sequence is in an inconsistent state and attempts to fix it.
// It looks for a corruption signature that may happen in docker 1.9.0 and 1.9.1. | func (h *Handle) CheckConsistency() error | // CheckConsistency checks if the bit sequence is in an inconsistent state and attempts to fix it.
// It looks for a corruption signature that may happen in docker 1.9.0 and 1.9.1.
func (h *Handle) CheckConsistency() error | {
for {
h.Lock()
store := h.store
h.Unlock()
if store != nil {
if err := store.GetObject(datastore.Key(h.Key()...), h); err != nil && err != datastore.ErrKeyNotFound {
return err
}
}
h.Lock()
nh := h.getCopy()
h.Unlock()
if !nh.runConsistencyCheck() {
return nil
}
if err := nh.writeToStore(); err != nil {
if _, ok := err.(types.RetryError); !ok {
return fmt.Errorf("internal failure while fixing inconsistent bitsequence: %v", err)
}
continue
}
logrus.Infof("Fixed inconsistent bit sequence in datastore:\n%s\n%s", h, nh)
h.Lock()
h.head = nh.head
h.Unlock()
return nil
}
} |
docker/libnetwork | 9ff9b57c344df5cd47443ad9e65702ec85c5aeb0 | bitseq/sequence.go | https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/bitseq/sequence.go#L309-L383 | go | train | // set/reset the bit | func (h *Handle) set(ordinal, start, end uint64, any bool, release bool, serial bool) (uint64, error) | // set/reset the bit
func (h *Handle) set(ordinal, start, end uint64, any bool, release bool, serial bool) (uint64, error) | {
var (
bitPos uint64
bytePos uint64
ret uint64
err error
)
for {
var store datastore.DataStore
curr := uint64(0)
h.Lock()
store = h.store
if store != nil {
h.Unlock() // The lock is acquired in the GetObject
if err := store.GetObject(datastore.Key(h.Key()...), h); err != nil && err != datastore.ErrKeyNotFound {
return ret, err
}
h.Lock() // Acquire the lock back
}
if serial {
curr = h.curr
}
// Get position if available
if release {
bytePos, bitPos = ordinalToPos(ordinal)
} else {
if any {
bytePos, bitPos, err = getAvailableFromCurrent(h.head, start, curr, end)
ret = posToOrdinal(bytePos, bitPos)
if err == nil {
h.curr = ret + 1
}
} else {
bytePos, bitPos, err = checkIfAvailable(h.head, ordinal)
ret = ordinal
}
}
if err != nil {
h.Unlock()
return ret, err
}
// Create a private copy of h and work on it
nh := h.getCopy()
nh.head = pushReservation(bytePos, bitPos, nh.head, release)
if release {
nh.unselected++
} else {
nh.unselected--
}
if h.store != nil {
h.Unlock()
// Attempt to write private copy to store
if err := nh.writeToStore(); err != nil {
if _, ok := err.(types.RetryError); !ok {
return ret, fmt.Errorf("internal failure while setting the bit: %v", err)
}
// Retry
continue
}
h.Lock()
}
// Previous atomic push was successful. Save private copy to local copy
h.unselected = nh.unselected
h.head = nh.head
h.dbExists = nh.dbExists
h.dbIndex = nh.dbIndex
h.Unlock()
return ret, nil
}
} |
docker/libnetwork | 9ff9b57c344df5cd47443ad9e65702ec85c5aeb0 | bitseq/sequence.go | https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/bitseq/sequence.go#L386-L393 | go | train | // checks is needed because to cover the case where the number of bits is not a multiple of blockLen | func (h *Handle) validateOrdinal(ordinal uint64) error | // checks is needed because to cover the case where the number of bits is not a multiple of blockLen
func (h *Handle) validateOrdinal(ordinal uint64) error | {
h.Lock()
defer h.Unlock()
if ordinal >= h.bits {
return errors.New("bit does not belong to the sequence")
}
return nil
} |
docker/libnetwork | 9ff9b57c344df5cd47443ad9e65702ec85c5aeb0 | bitseq/sequence.go | https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/bitseq/sequence.go#L396-L413 | go | train | // Destroy removes from the datastore the data belonging to this handle | func (h *Handle) Destroy() error | // Destroy removes from the datastore the data belonging to this handle
func (h *Handle) Destroy() error | {
for {
if err := h.deleteFromStore(); err != nil {
if _, ok := err.(types.RetryError); !ok {
return fmt.Errorf("internal failure while destroying the sequence: %v", err)
}
// Fetch latest
if err := h.store.GetObject(datastore.Key(h.Key()...), h); err != nil {
if err == datastore.ErrKeyNotFound { // already removed
return nil
}
return fmt.Errorf("failed to fetch from store when destroying the sequence: %v", err)
}
continue
}
return nil
}
} |
docker/libnetwork | 9ff9b57c344df5cd47443ad9e65702ec85c5aeb0 | bitseq/sequence.go | https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/bitseq/sequence.go#L416-L430 | go | train | // ToByteArray converts this handle's data into a byte array | func (h *Handle) ToByteArray() ([]byte, error) | // ToByteArray converts this handle's data into a byte array
func (h *Handle) ToByteArray() ([]byte, error) | {
h.Lock()
defer h.Unlock()
ba := make([]byte, 16)
binary.BigEndian.PutUint64(ba[0:], h.bits)
binary.BigEndian.PutUint64(ba[8:], h.unselected)
bm, err := h.head.toByteArray()
if err != nil {
return nil, fmt.Errorf("failed to serialize head: %s", err.Error())
}
ba = append(ba, bm...)
return ba, nil
} |
docker/libnetwork | 9ff9b57c344df5cd47443ad9e65702ec85c5aeb0 | bitseq/sequence.go | https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/bitseq/sequence.go#L433-L451 | go | train | // FromByteArray reads his handle's data from a byte array | func (h *Handle) FromByteArray(ba []byte) error | // FromByteArray reads his handle's data from a byte array
func (h *Handle) FromByteArray(ba []byte) error | {
if ba == nil {
return errors.New("nil byte array")
}
nh := &sequence{}
err := nh.fromByteArray(ba[16:])
if err != nil {
return fmt.Errorf("failed to deserialize head: %s", err.Error())
}
h.Lock()
h.head = nh
h.bits = binary.BigEndian.Uint64(ba[0:8])
h.unselected = binary.BigEndian.Uint64(ba[8:16])
h.Unlock()
return nil
} |
docker/libnetwork | 9ff9b57c344df5cd47443ad9e65702ec85c5aeb0 | bitseq/sequence.go | https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/bitseq/sequence.go#L459-L463 | go | train | // Unselected returns the number of bits which are not selected | func (h *Handle) Unselected() uint64 | // Unselected returns the number of bits which are not selected
func (h *Handle) Unselected() uint64 | {
h.Lock()
defer h.Unlock()
return h.unselected
} |
docker/libnetwork | 9ff9b57c344df5cd47443ad9e65702ec85c5aeb0 | bitseq/sequence.go | https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/bitseq/sequence.go#L473-L484 | go | train | // MarshalJSON encodes Handle into json message | func (h *Handle) MarshalJSON() ([]byte, error) | // MarshalJSON encodes Handle into json message
func (h *Handle) MarshalJSON() ([]byte, error) | {
m := map[string]interface{}{
"id": h.id,
}
b, err := h.ToByteArray()
if err != nil {
return nil, err
}
m["sequence"] = b
return json.Marshal(m)
} |
docker/libnetwork | 9ff9b57c344df5cd47443ad9e65702ec85c5aeb0 | bitseq/sequence.go | https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/bitseq/sequence.go#L487-L502 | go | train | // UnmarshalJSON decodes json message into Handle | func (h *Handle) UnmarshalJSON(data []byte) error | // UnmarshalJSON decodes json message into Handle
func (h *Handle) UnmarshalJSON(data []byte) error | {
var (
m map[string]interface{}
b []byte
err error
)
if err = json.Unmarshal(data, &m); err != nil {
return err
}
h.id = m["id"].(string)
bi, _ := json.Marshal(m["sequence"])
if err := json.Unmarshal(bi, &b); err != nil {
return err
}
return h.FromByteArray(b)
} |
docker/libnetwork | 9ff9b57c344df5cd47443ad9e65702ec85c5aeb0 | bitseq/sequence.go | https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/bitseq/sequence.go#L505-L545 | go | train | // getFirstAvailable looks for the first unset bit in passed mask starting from start | func getFirstAvailable(head *sequence, start uint64) (uint64, uint64, error) | // getFirstAvailable looks for the first unset bit in passed mask starting from start
func getFirstAvailable(head *sequence, start uint64) (uint64, uint64, error) | {
// Find sequence which contains the start bit
byteStart, bitStart := ordinalToPos(start)
current, _, precBlocks, inBlockBytePos := findSequence(head, byteStart)
// Derive the this sequence offsets
byteOffset := byteStart - inBlockBytePos
bitOffset := inBlockBytePos*8 + bitStart
for current != nil {
if current.block != blockMAX {
// If the current block is not full, check if there is any bit
// from the current bit in the current block. If not, before proceeding to the
// next block node, make sure we check for available bit in the next
// instance of the same block. Due to RLE same block signature will be
// compressed.
retry:
bytePos, bitPos, err := current.getAvailableBit(bitOffset)
if err != nil && precBlocks == current.count-1 {
// This is the last instance in the same block node,
// so move to the next block.
goto next
}
if err != nil {
// There are some more instances of the same block, so add the offset
// and be optimistic that you will find the available bit in the next
// instance of the same block.
bitOffset = 0
byteOffset += blockBytes
precBlocks++
goto retry
}
return byteOffset + bytePos, bitPos, err
}
// Moving to next block: Reset bit offset.
next:
bitOffset = 0
byteOffset += (current.count * blockBytes) - (precBlocks * blockBytes)
precBlocks = 0
current = current.next
}
return invalidPos, invalidPos, ErrNoBitAvailable
} |
docker/libnetwork | 9ff9b57c344df5cd47443ad9e65702ec85c5aeb0 | bitseq/sequence.go | https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/bitseq/sequence.go#L550-L569 | go | train | // getAvailableFromCurrent will look for available ordinal from the current ordinal.
// If none found then it will loop back to the start to check of the available bit.
// This can be further optimized to check from start till curr in case of a rollover | func getAvailableFromCurrent(head *sequence, start, curr, end uint64) (uint64, uint64, error) | // getAvailableFromCurrent will look for available ordinal from the current ordinal.
// If none found then it will loop back to the start to check of the available bit.
// This can be further optimized to check from start till curr in case of a rollover
func getAvailableFromCurrent(head *sequence, start, curr, end uint64) (uint64, uint64, error) | {
var bytePos, bitPos uint64
var err error
if curr != 0 && curr > start {
bytePos, bitPos, err = getFirstAvailable(head, curr)
ret := posToOrdinal(bytePos, bitPos)
if end < ret || err != nil {
goto begin
}
return bytePos, bitPos, nil
}
begin:
bytePos, bitPos, err = getFirstAvailable(head, start)
ret := posToOrdinal(bytePos, bitPos)
if end < ret || err != nil {
return invalidPos, invalidPos, ErrNoBitAvailable
}
return bytePos, bitPos, nil
} |
docker/libnetwork | 9ff9b57c344df5cd47443ad9e65702ec85c5aeb0 | bitseq/sequence.go | https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/bitseq/sequence.go#L573-L587 | go | train | // checkIfAvailable checks if the bit correspondent to the specified ordinal is unset
// If the ordinal is beyond the sequence limits, a negative response is returned | func checkIfAvailable(head *sequence, ordinal uint64) (uint64, uint64, error) | // checkIfAvailable checks if the bit correspondent to the specified ordinal is unset
// If the ordinal is beyond the sequence limits, a negative response is returned
func checkIfAvailable(head *sequence, ordinal uint64) (uint64, uint64, error) | {
bytePos, bitPos := ordinalToPos(ordinal)
// Find the sequence containing this byte
current, _, _, inBlockBytePos := findSequence(head, bytePos)
if current != nil {
// Check whether the bit corresponding to the ordinal address is unset
bitSel := blockFirstBit >> (inBlockBytePos*8 + bitPos)
if current.block&bitSel == 0 {
return bytePos, bitPos, nil
}
}
return invalidPos, invalidPos, ErrBitAllocated
} |
docker/libnetwork | 9ff9b57c344df5cd47443ad9e65702ec85c5aeb0 | bitseq/sequence.go | https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/bitseq/sequence.go#L593-L615 | go | train | // Given the byte position and the sequences list head, return the pointer to the
// sequence containing the byte (current), the pointer to the previous sequence,
// the number of blocks preceding the block containing the byte inside the current sequence.
// If bytePos is outside of the list, function will return (nil, nil, 0, invalidPos) | func findSequence(head *sequence, bytePos uint64) (*sequence, *sequence, uint64, uint64) | // Given the byte position and the sequences list head, return the pointer to the
// sequence containing the byte (current), the pointer to the previous sequence,
// the number of blocks preceding the block containing the byte inside the current sequence.
// If bytePos is outside of the list, function will return (nil, nil, 0, invalidPos)
func findSequence(head *sequence, bytePos uint64) (*sequence, *sequence, uint64, uint64) | {
// Find the sequence containing this byte
previous := head
current := head
n := bytePos
for current.next != nil && n >= (current.count*blockBytes) { // Nil check for less than 32 addresses masks
n -= (current.count * blockBytes)
previous = current
current = current.next
}
// If byte is outside of the list, let caller know
if n >= (current.count * blockBytes) {
return nil, nil, 0, invalidPos
}
// Find the byte position inside the block and the number of blocks
// preceding the block containing the byte inside this sequence
precBlocks := n / blockBytes
inBlockBytePos := bytePos % blockBytes
return current, previous, precBlocks, inBlockBytePos
} |
docker/libnetwork | 9ff9b57c344df5cd47443ad9e65702ec85c5aeb0 | bitseq/sequence.go | https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/bitseq/sequence.go#L634-L693 | go | train | // PushReservation pushes the bit reservation inside the bitmask.
// Given byte and bit positions, identify the sequence (current) which holds the block containing the affected bit.
// Create a new block with the modified bit according to the operation (allocate/release).
// Create a new sequence containing the new block and insert it in the proper position.
// Remove current sequence if empty.
// Check if new sequence can be merged with neighbour (previous/next) sequences.
//
//
// Identify "current" sequence containing block:
// [prev seq] [current seq] [next seq]
//
// Based on block position, resulting list of sequences can be any of three forms:
//
// block position Resulting list of sequences
// A) block is first in current: [prev seq] [new] [modified current seq] [next seq]
// B) block is last in current: [prev seq] [modified current seq] [new] [next seq]
// C) block is in the middle of current: [prev seq] [curr pre] [new] [curr post] [next seq] | func pushReservation(bytePos, bitPos uint64, head *sequence, release bool) *sequence | // PushReservation pushes the bit reservation inside the bitmask.
// Given byte and bit positions, identify the sequence (current) which holds the block containing the affected bit.
// Create a new block with the modified bit according to the operation (allocate/release).
// Create a new sequence containing the new block and insert it in the proper position.
// Remove current sequence if empty.
// Check if new sequence can be merged with neighbour (previous/next) sequences.
//
//
// Identify "current" sequence containing block:
// [prev seq] [current seq] [next seq]
//
// Based on block position, resulting list of sequences can be any of three forms:
//
// block position Resulting list of sequences
// A) block is first in current: [prev seq] [new] [modified current seq] [next seq]
// B) block is last in current: [prev seq] [modified current seq] [new] [next seq]
// C) block is in the middle of current: [prev seq] [curr pre] [new] [curr post] [next seq]
func pushReservation(bytePos, bitPos uint64, head *sequence, release bool) *sequence | {
// Store list's head
newHead := head
// Find the sequence containing this byte
current, previous, precBlocks, inBlockBytePos := findSequence(head, bytePos)
if current == nil {
return newHead
}
// Construct updated block
bitSel := blockFirstBit >> (inBlockBytePos*8 + bitPos)
newBlock := current.block
if release {
newBlock &^= bitSel
} else {
newBlock |= bitSel
}
// Quit if it was a redundant request
if current.block == newBlock {
return newHead
}
// Current sequence inevitably looses one block, upadate count
current.count--
// Create new sequence
newSequence := &sequence{block: newBlock, count: 1}
// Insert the new sequence in the list based on block position
if precBlocks == 0 { // First in sequence (A)
newSequence.next = current
if current == head {
newHead = newSequence
previous = newHead
} else {
previous.next = newSequence
}
removeCurrentIfEmpty(&newHead, newSequence, current)
mergeSequences(previous)
} else if precBlocks == current.count { // Last in sequence (B)
newSequence.next = current.next
current.next = newSequence
mergeSequences(current)
} else { // In between the sequence (C)
currPre := &sequence{block: current.block, count: precBlocks, next: newSequence}
currPost := current
currPost.count -= precBlocks
newSequence.next = currPost
if currPost == head {
newHead = currPre
} else {
previous.next = currPre
}
// No merging or empty current possible here
}
return newHead
} |
docker/libnetwork | 9ff9b57c344df5cd47443ad9e65702ec85c5aeb0 | bitseq/sequence.go | https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/bitseq/sequence.go#L696-L705 | go | train | // Removes the current sequence from the list if empty, adjusting the head pointer if needed | func removeCurrentIfEmpty(head **sequence, previous, current *sequence) | // Removes the current sequence from the list if empty, adjusting the head pointer if needed
func removeCurrentIfEmpty(head **sequence, previous, current *sequence) | {
if current.count == 0 {
if current == *head {
*head = current.next
} else {
previous.next = current.next
current = current.next
}
}
} |
docker/libnetwork | 9ff9b57c344df5cd47443ad9e65702ec85c5aeb0 | bitseq/sequence.go | https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/bitseq/sequence.go#L710-L720 | go | train | // Given a pointer to a sequence, it checks if it can be merged with any following sequences
// It stops when no more merging is possible.
// TODO: Optimization: only attempt merge from start to end sequence, no need to scan till the end of the list | func mergeSequences(seq *sequence) | // Given a pointer to a sequence, it checks if it can be merged with any following sequences
// It stops when no more merging is possible.
// TODO: Optimization: only attempt merge from start to end sequence, no need to scan till the end of the list
func mergeSequences(seq *sequence) | {
if seq != nil {
// Merge all what possible from seq
for seq.next != nil && seq.block == seq.next.block {
seq.count += seq.next.count
seq.next = seq.next.next
}
// Move to next
mergeSequences(seq.next)
}
} |
docker/libnetwork | 9ff9b57c344df5cd47443ad9e65702ec85c5aeb0 | osl/interface_linux.go | https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/osl/interface_linux.go#L180-L203 | go | train | // Returns the sandbox's side veth interface statistics | func (i *nwIface) Statistics() (*types.InterfaceStatistics, error) | // Returns the sandbox's side veth interface statistics
func (i *nwIface) Statistics() (*types.InterfaceStatistics, error) | {
i.Lock()
n := i.ns
i.Unlock()
l, err := n.nlHandle.LinkByName(i.DstName())
if err != nil {
return nil, fmt.Errorf("failed to retrieve the statistics for %s in netns %s: %v", i.DstName(), n.path, err)
}
stats := l.Attrs().Statistics
if stats == nil {
return nil, fmt.Errorf("no statistics were returned")
}
return &types.InterfaceStatistics{
RxBytes: uint64(stats.RxBytes),
TxBytes: uint64(stats.TxBytes),
RxPackets: uint64(stats.RxPackets),
TxPackets: uint64(stats.TxPackets),
RxDropped: uint64(stats.RxDropped),
TxDropped: uint64(stats.TxDropped),
}, nil
} |
docker/libnetwork | 9ff9b57c344df5cd47443ad9e65702ec85c5aeb0 | cmd/proxy/proxy.go | https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/cmd/proxy/proxy.go#L29-L40 | go | train | // NewProxy creates a Proxy according to the specified frontendAddr and backendAddr. | func NewProxy(frontendAddr, backendAddr net.Addr) (Proxy, error) | // NewProxy creates a Proxy according to the specified frontendAddr and backendAddr.
func NewProxy(frontendAddr, backendAddr net.Addr) (Proxy, error) | {
switch frontendAddr.(type) {
case *net.UDPAddr:
return NewUDPProxy(frontendAddr.(*net.UDPAddr), backendAddr.(*net.UDPAddr))
case *net.TCPAddr:
return NewTCPProxy(frontendAddr.(*net.TCPAddr), backendAddr.(*net.TCPAddr))
case *sctp.SCTPAddr:
return NewSCTPProxy(frontendAddr.(*sctp.SCTPAddr), backendAddr.(*sctp.SCTPAddr))
default:
panic("Unsupported protocol")
}
} |
docker/libnetwork | 9ff9b57c344df5cd47443ad9e65702ec85c5aeb0 | ipamutils/utils.go | https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/ipamutils/utils.go#L48-L57 | go | train | // configDefaultNetworks configures local as well global default pool based on input | func configDefaultNetworks(defaultAddressPool []*NetworkToSplit, result *[]*net.IPNet) error | // configDefaultNetworks configures local as well global default pool based on input
func configDefaultNetworks(defaultAddressPool []*NetworkToSplit, result *[]*net.IPNet) error | {
mutex.Lock()
defer mutex.Unlock()
defaultNetworks, err := splitNetworks(defaultAddressPool)
if err != nil {
return err
}
*result = defaultNetworks
return nil
} |
docker/libnetwork | 9ff9b57c344df5cd47443ad9e65702ec85c5aeb0 | ipamutils/utils.go | https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/ipamutils/utils.go#L75-L80 | go | train | // ConfigGlobalScopeDefaultNetworks configures global default pool.
// Ideally this will be called from SwarmKit as part of swarm init | func ConfigGlobalScopeDefaultNetworks(defaultAddressPool []*NetworkToSplit) error | // ConfigGlobalScopeDefaultNetworks configures global default pool.
// Ideally this will be called from SwarmKit as part of swarm init
func ConfigGlobalScopeDefaultNetworks(defaultAddressPool []*NetworkToSplit) error | {
if defaultAddressPool == nil {
defaultAddressPool = globalScopeDefaultNetworks
}
return configDefaultNetworks(defaultAddressPool, &PredefinedGlobalScopeDefaultNetworks)
} |
docker/libnetwork | 9ff9b57c344df5cd47443ad9e65702ec85c5aeb0 | ipamutils/utils.go | https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/ipamutils/utils.go#L84-L89 | go | train | // ConfigLocalScopeDefaultNetworks configures local default pool.
// Ideally this will be called during libnetwork init | func ConfigLocalScopeDefaultNetworks(defaultAddressPool []*NetworkToSplit) error | // ConfigLocalScopeDefaultNetworks configures local default pool.
// Ideally this will be called during libnetwork init
func ConfigLocalScopeDefaultNetworks(defaultAddressPool []*NetworkToSplit) error | {
if defaultAddressPool == nil {
return nil
}
return configDefaultNetworks(defaultAddressPool, &PredefinedLocalScopeDefaultNetworks)
} |
docker/libnetwork | 9ff9b57c344df5cd47443ad9e65702ec85c5aeb0 | ipamutils/utils.go | https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/ipamutils/utils.go#L92-L107 | go | train | // splitNetworks takes a slice of networks, split them accordingly and returns them | func splitNetworks(list []*NetworkToSplit) ([]*net.IPNet, error) | // splitNetworks takes a slice of networks, split them accordingly and returns them
func splitNetworks(list []*NetworkToSplit) ([]*net.IPNet, error) | {
localPools := make([]*net.IPNet, 0, len(list))
for _, p := range list {
_, b, err := net.ParseCIDR(p.Base)
if err != nil {
return nil, fmt.Errorf("invalid base pool %q: %v", p.Base, err)
}
ones, _ := b.Mask.Size()
if p.Size <= 0 || p.Size < ones {
return nil, fmt.Errorf("invalid pools size: %d", p.Size)
}
localPools = append(localPools, splitNetwork(p.Size, b)...)
}
return localPools, nil
} |
docker/libnetwork | 9ff9b57c344df5cd47443ad9e65702ec85c5aeb0 | portmapper/mapper_linux.go | https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/portmapper/mapper_linux.go#L26-L29 | go | train | // SetIptablesChain sets the specified chain into portmapper | func (pm *PortMapper) SetIptablesChain(c *iptables.ChainInfo, bridgeName string) | // SetIptablesChain sets the specified chain into portmapper
func (pm *PortMapper) SetIptablesChain(c *iptables.ChainInfo, bridgeName string) | {
pm.chain = c
pm.bridgeName = bridgeName
} |
docker/libnetwork | 9ff9b57c344df5cd47443ad9e65702ec85c5aeb0 | portmapper/mapper_linux.go | https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/portmapper/mapper_linux.go#L32-L34 | go | train | // AppendForwardingTableEntry adds a port mapping to the forwarding table | func (pm *PortMapper) AppendForwardingTableEntry(proto string, sourceIP net.IP, sourcePort int, containerIP string, containerPort int) error | // AppendForwardingTableEntry adds a port mapping to the forwarding table
func (pm *PortMapper) AppendForwardingTableEntry(proto string, sourceIP net.IP, sourcePort int, containerIP string, containerPort int) error | {
return pm.forward(iptables.Append, proto, sourceIP, sourcePort, containerIP, containerPort)
} |
docker/libnetwork | 9ff9b57c344df5cd47443ad9e65702ec85c5aeb0 | portmapper/mapper_linux.go | https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/portmapper/mapper_linux.go#L37-L39 | go | train | // DeleteForwardingTableEntry removes a port mapping from the forwarding table | func (pm *PortMapper) DeleteForwardingTableEntry(proto string, sourceIP net.IP, sourcePort int, containerIP string, containerPort int) error | // DeleteForwardingTableEntry removes a port mapping from the forwarding table
func (pm *PortMapper) DeleteForwardingTableEntry(proto string, sourceIP net.IP, sourcePort int, containerIP string, containerPort int) error | {
return pm.forward(iptables.Delete, proto, sourceIP, sourcePort, containerIP, containerPort)
} |
docker/libnetwork | 9ff9b57c344df5cd47443ad9e65702ec85c5aeb0 | drivers/windows/overlay/joinleave_windows.go | https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/drivers/windows/overlay/joinleave_windows.go#L14-L48 | go | train | // Join method is invoked when a Sandbox is attached to an endpoint. | func (d *driver) Join(nid, eid string, sboxKey string, jinfo driverapi.JoinInfo, options map[string]interface{}) error | // Join method is invoked when a Sandbox is attached to an endpoint.
func (d *driver) Join(nid, eid string, sboxKey string, jinfo driverapi.JoinInfo, options map[string]interface{}) error | {
if err := validateID(nid, eid); err != nil {
return err
}
n := d.network(nid)
if n == nil {
return fmt.Errorf("could not find network with id %s", nid)
}
ep := n.endpoint(eid)
if ep == nil {
return fmt.Errorf("could not find endpoint with id %s", eid)
}
buf, err := proto.Marshal(&PeerRecord{
EndpointIP: ep.addr.String(),
EndpointMAC: ep.mac.String(),
TunnelEndpointIP: n.providerAddress,
})
if err != nil {
return err
}
if err := jinfo.AddTableEntry(ovPeerTable, eid, buf); err != nil {
logrus.Errorf("overlay: Failed adding table entry to joininfo: %v", err)
}
if ep.disablegateway {
jinfo.DisableGatewayService()
}
return nil
} |
docker/libnetwork | 9ff9b57c344df5cd47443ad9e65702ec85c5aeb0 | drivers/windows/overlay/joinleave_windows.go | https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/drivers/windows/overlay/joinleave_windows.go#L109-L115 | go | train | // Leave method is invoked when a Sandbox detaches from an endpoint. | func (d *driver) Leave(nid, eid string) error | // Leave method is invoked when a Sandbox detaches from an endpoint.
func (d *driver) Leave(nid, eid string) error | {
if err := validateID(nid, eid); err != nil {
return err
}
return nil
} |
satori/go.uuid | b2ce2384e17bbe0c6d34077efa39dbab3e09123b | sql.go | https://github.com/satori/go.uuid/blob/b2ce2384e17bbe0c6d34077efa39dbab3e09123b/sql.go#L60-L66 | go | train | // Value implements the driver.Valuer interface. | func (u NullUUID) Value() (driver.Value, error) | // Value implements the driver.Valuer interface.
func (u NullUUID) Value() (driver.Value, error) | {
if !u.Valid {
return nil, nil
}
// Delegate to UUID Value function
return u.UUID.Value()
} |
satori/go.uuid | b2ce2384e17bbe0c6d34077efa39dbab3e09123b | sql.go | https://github.com/satori/go.uuid/blob/b2ce2384e17bbe0c6d34077efa39dbab3e09123b/sql.go#L69-L78 | go | train | // Scan implements the sql.Scanner interface. | func (u *NullUUID) Scan(src interface{}) error | // Scan implements the sql.Scanner interface.
func (u *NullUUID) Scan(src interface{}) error | {
if src == nil {
u.UUID, u.Valid = Nil, false
return nil
}
// Delegate to UUID Scan function
u.Valid = true
return u.UUID.Scan(src)
} |
satori/go.uuid | b2ce2384e17bbe0c6d34077efa39dbab3e09123b | codec.go | https://github.com/satori/go.uuid/blob/b2ce2384e17bbe0c6d34077efa39dbab3e09123b/codec.go#L32-L35 | go | train | // FromBytes returns UUID converted from raw byte slice input.
// It will return error if the slice isn't 16 bytes long. | func FromBytes(input []byte) (u UUID, err error) | // FromBytes returns UUID converted from raw byte slice input.
// It will return error if the slice isn't 16 bytes long.
func FromBytes(input []byte) (u UUID, err error) | {
err = u.UnmarshalBinary(input)
return
} |
satori/go.uuid | b2ce2384e17bbe0c6d34077efa39dbab3e09123b | codec.go | https://github.com/satori/go.uuid/blob/b2ce2384e17bbe0c6d34077efa39dbab3e09123b/codec.go#L39-L45 | go | train | // FromBytesOrNil returns UUID converted from raw byte slice input.
// Same behavior as FromBytes, but returns a Nil UUID on error. | func FromBytesOrNil(input []byte) UUID | // FromBytesOrNil returns UUID converted from raw byte slice input.
// Same behavior as FromBytes, but returns a Nil UUID on error.
func FromBytesOrNil(input []byte) UUID | {
uuid, err := FromBytes(input)
if err != nil {
return Nil
}
return uuid
} |
satori/go.uuid | b2ce2384e17bbe0c6d34077efa39dbab3e09123b | codec.go | https://github.com/satori/go.uuid/blob/b2ce2384e17bbe0c6d34077efa39dbab3e09123b/codec.go#L56-L62 | go | train | // FromStringOrNil returns UUID parsed from string input.
// Same behavior as FromString, but returns a Nil UUID on error. | func FromStringOrNil(input string) UUID | // FromStringOrNil returns UUID parsed from string input.
// Same behavior as FromString, but returns a Nil UUID on error.
func FromStringOrNil(input string) UUID | {
uuid, err := FromString(input)
if err != nil {
return Nil
}
return uuid
} |
satori/go.uuid | b2ce2384e17bbe0c6d34077efa39dbab3e09123b | codec.go | https://github.com/satori/go.uuid/blob/b2ce2384e17bbe0c6d34077efa39dbab3e09123b/codec.go#L66-L69 | go | train | // MarshalText implements the encoding.TextMarshaler interface.
// The encoding is the same as returned by String. | func (u UUID) MarshalText() (text []byte, err error) | // MarshalText implements the encoding.TextMarshaler interface.
// The encoding is the same as returned by String.
func (u UUID) MarshalText() (text []byte, err error) | {
text = []byte(u.String())
return
} |
satori/go.uuid | b2ce2384e17bbe0c6d34077efa39dbab3e09123b | codec.go | https://github.com/satori/go.uuid/blob/b2ce2384e17bbe0c6d34077efa39dbab3e09123b/codec.go#L94-L109 | go | train | // UnmarshalText implements the encoding.TextUnmarshaler interface.
// Following formats are supported:
// "6ba7b810-9dad-11d1-80b4-00c04fd430c8",
// "{6ba7b810-9dad-11d1-80b4-00c04fd430c8}",
// "urn:uuid:6ba7b810-9dad-11d1-80b4-00c04fd430c8"
// "6ba7b8109dad11d180b400c04fd430c8"
// ABNF for supported UUID text representation follows:
// uuid := canonical | hashlike | braced | urn
// plain := canonical | hashlike
// canonical := 4hexoct '-' 2hexoct '-' 2hexoct '-' 6hexoct
// hashlike := 12hexoct
// braced := '{' plain '}'
// urn := URN ':' UUID-NID ':' plain
// URN := 'urn'
// UUID-NID := 'uuid'
// 12hexoct := 6hexoct 6hexoct
// 6hexoct := 4hexoct 2hexoct
// 4hexoct := 2hexoct 2hexoct
// 2hexoct := hexoct hexoct
// hexoct := hexdig hexdig
// hexdig := '0' | '1' | '2' | '3' | '4' | '5' | '6' | '7' | '8' | '9' |
// 'a' | 'b' | 'c' | 'd' | 'e' | 'f' |
// 'A' | 'B' | 'C' | 'D' | 'E' | 'F' | func (u *UUID) UnmarshalText(text []byte) (err error) | // UnmarshalText implements the encoding.TextUnmarshaler interface.
// Following formats are supported:
// "6ba7b810-9dad-11d1-80b4-00c04fd430c8",
// "{6ba7b810-9dad-11d1-80b4-00c04fd430c8}",
// "urn:uuid:6ba7b810-9dad-11d1-80b4-00c04fd430c8"
// "6ba7b8109dad11d180b400c04fd430c8"
// ABNF for supported UUID text representation follows:
// uuid := canonical | hashlike | braced | urn
// plain := canonical | hashlike
// canonical := 4hexoct '-' 2hexoct '-' 2hexoct '-' 6hexoct
// hashlike := 12hexoct
// braced := '{' plain '}'
// urn := URN ':' UUID-NID ':' plain
// URN := 'urn'
// UUID-NID := 'uuid'
// 12hexoct := 6hexoct 6hexoct
// 6hexoct := 4hexoct 2hexoct
// 4hexoct := 2hexoct 2hexoct
// 2hexoct := hexoct hexoct
// hexoct := hexdig hexdig
// hexdig := '0' | '1' | '2' | '3' | '4' | '5' | '6' | '7' | '8' | '9' |
// 'a' | 'b' | 'c' | 'd' | 'e' | 'f' |
// 'A' | 'B' | 'C' | 'D' | 'E' | 'F'
func (u *UUID) UnmarshalText(text []byte) (err error) | {
switch len(text) {
case 32:
return u.decodeHashLike(text)
case 36:
return u.decodeCanonical(text)
case 38:
return u.decodeBraced(text)
case 41:
fallthrough
case 45:
return u.decodeURN(text)
default:
return fmt.Errorf("uuid: incorrect UUID length: %s", text)
}
} |
satori/go.uuid | b2ce2384e17bbe0c6d34077efa39dbab3e09123b | codec.go | https://github.com/satori/go.uuid/blob/b2ce2384e17bbe0c6d34077efa39dbab3e09123b/codec.go#L113-L134 | go | train | // decodeCanonical decodes UUID string in format
// "6ba7b810-9dad-11d1-80b4-00c04fd430c8". | func (u *UUID) decodeCanonical(t []byte) (err error) | // decodeCanonical decodes UUID string in format
// "6ba7b810-9dad-11d1-80b4-00c04fd430c8".
func (u *UUID) decodeCanonical(t []byte) (err error) | {
if t[8] != '-' || t[13] != '-' || t[18] != '-' || t[23] != '-' {
return fmt.Errorf("uuid: incorrect UUID format %s", t)
}
src := t[:]
dst := u[:]
for i, byteGroup := range byteGroups {
if i > 0 {
src = src[1:] // skip dash
}
_, err = hex.Decode(dst[:byteGroup/2], src[:byteGroup])
if err != nil {
return
}
src = src[byteGroup:]
dst = dst[byteGroup/2:]
}
return
} |
satori/go.uuid | b2ce2384e17bbe0c6d34077efa39dbab3e09123b | codec.go | https://github.com/satori/go.uuid/blob/b2ce2384e17bbe0c6d34077efa39dbab3e09123b/codec.go#L138-L146 | go | train | // decodeHashLike decodes UUID string in format
// "6ba7b8109dad11d180b400c04fd430c8". | func (u *UUID) decodeHashLike(t []byte) (err error) | // decodeHashLike decodes UUID string in format
// "6ba7b8109dad11d180b400c04fd430c8".
func (u *UUID) decodeHashLike(t []byte) (err error) | {
src := t[:]
dst := u[:]
if _, err = hex.Decode(dst, src); err != nil {
return err
}
return
} |
satori/go.uuid | b2ce2384e17bbe0c6d34077efa39dbab3e09123b | codec.go | https://github.com/satori/go.uuid/blob/b2ce2384e17bbe0c6d34077efa39dbab3e09123b/codec.go#L151-L159 | go | train | // decodeBraced decodes UUID string in format
// "{6ba7b810-9dad-11d1-80b4-00c04fd430c8}" or in format
// "{6ba7b8109dad11d180b400c04fd430c8}". | func (u *UUID) decodeBraced(t []byte) (err error) | // decodeBraced decodes UUID string in format
// "{6ba7b810-9dad-11d1-80b4-00c04fd430c8}" or in format
// "{6ba7b8109dad11d180b400c04fd430c8}".
func (u *UUID) decodeBraced(t []byte) (err error) | {
l := len(t)
if t[0] != '{' || t[l-1] != '}' {
return fmt.Errorf("uuid: incorrect UUID format %s", t)
}
return u.decodePlain(t[1 : l-1])
} |
satori/go.uuid | b2ce2384e17bbe0c6d34077efa39dbab3e09123b | codec.go | https://github.com/satori/go.uuid/blob/b2ce2384e17bbe0c6d34077efa39dbab3e09123b/codec.go#L164-L174 | go | train | // decodeURN decodes UUID string in format
// "urn:uuid:6ba7b810-9dad-11d1-80b4-00c04fd430c8" or in format
// "urn:uuid:6ba7b8109dad11d180b400c04fd430c8". | func (u *UUID) decodeURN(t []byte) (err error) | // decodeURN decodes UUID string in format
// "urn:uuid:6ba7b810-9dad-11d1-80b4-00c04fd430c8" or in format
// "urn:uuid:6ba7b8109dad11d180b400c04fd430c8".
func (u *UUID) decodeURN(t []byte) (err error) | {
total := len(t)
urn_uuid_prefix := t[:9]
if !bytes.Equal(urn_uuid_prefix, urnPrefix) {
return fmt.Errorf("uuid: incorrect UUID format: %s", t)
}
return u.decodePlain(t[9:total])
} |
satori/go.uuid | b2ce2384e17bbe0c6d34077efa39dbab3e09123b | codec.go | https://github.com/satori/go.uuid/blob/b2ce2384e17bbe0c6d34077efa39dbab3e09123b/codec.go#L179-L188 | go | train | // decodePlain decodes UUID string in canonical format
// "6ba7b810-9dad-11d1-80b4-00c04fd430c8" or in hash-like format
// "6ba7b8109dad11d180b400c04fd430c8". | func (u *UUID) decodePlain(t []byte) (err error) | // decodePlain decodes UUID string in canonical format
// "6ba7b810-9dad-11d1-80b4-00c04fd430c8" or in hash-like format
// "6ba7b8109dad11d180b400c04fd430c8".
func (u *UUID) decodePlain(t []byte) (err error) | {
switch len(t) {
case 32:
return u.decodeHashLike(t)
case 36:
return u.decodeCanonical(t)
default:
return fmt.Errorf("uuid: incorrrect UUID length: %s", t)
}
} |
satori/go.uuid | b2ce2384e17bbe0c6d34077efa39dbab3e09123b | codec.go | https://github.com/satori/go.uuid/blob/b2ce2384e17bbe0c6d34077efa39dbab3e09123b/codec.go#L191-L194 | go | train | // MarshalBinary implements the encoding.BinaryMarshaler interface. | func (u UUID) MarshalBinary() (data []byte, err error) | // MarshalBinary implements the encoding.BinaryMarshaler interface.
func (u UUID) MarshalBinary() (data []byte, err error) | {
data = u.Bytes()
return
} |
satori/go.uuid | b2ce2384e17bbe0c6d34077efa39dbab3e09123b | codec.go | https://github.com/satori/go.uuid/blob/b2ce2384e17bbe0c6d34077efa39dbab3e09123b/codec.go#L198-L206 | go | train | // UnmarshalBinary implements the encoding.BinaryUnmarshaler interface.
// It will return error if the slice isn't 16 bytes long. | func (u *UUID) UnmarshalBinary(data []byte) (err error) | // UnmarshalBinary implements the encoding.BinaryUnmarshaler interface.
// It will return error if the slice isn't 16 bytes long.
func (u *UUID) UnmarshalBinary(data []byte) (err error) | {
if len(data) != Size {
err = fmt.Errorf("uuid: UUID must be exactly 16 bytes long, got %d bytes", len(data))
return
}
copy(u[:], data)
return
} |
satori/go.uuid | b2ce2384e17bbe0c6d34077efa39dbab3e09123b | generator.go | https://github.com/satori/go.uuid/blob/b2ce2384e17bbe0c6d34077efa39dbab3e09123b/generator.go#L63-L65 | go | train | // NewV3 returns UUID based on MD5 hash of namespace UUID and name. | func NewV3(ns UUID, name string) UUID | // NewV3 returns UUID based on MD5 hash of namespace UUID and name.
func NewV3(ns UUID, name string) UUID | {
return global.NewV3(ns, name)
} |
satori/go.uuid | b2ce2384e17bbe0c6d34077efa39dbab3e09123b | generator.go | https://github.com/satori/go.uuid/blob/b2ce2384e17bbe0c6d34077efa39dbab3e09123b/generator.go#L73-L75 | go | train | // NewV5 returns UUID based on SHA-1 hash of namespace UUID and name. | func NewV5(ns UUID, name string) UUID | // NewV5 returns UUID based on SHA-1 hash of namespace UUID and name.
func NewV5(ns UUID, name string) UUID | {
return global.NewV5(ns, name)
} |
satori/go.uuid | b2ce2384e17bbe0c6d34077efa39dbab3e09123b | generator.go | https://github.com/satori/go.uuid/blob/b2ce2384e17bbe0c6d34077efa39dbab3e09123b/generator.go#L110-L132 | go | train | // NewV1 returns UUID based on current timestamp and MAC address. | func (g *rfc4122Generator) NewV1() (UUID, error) | // NewV1 returns UUID based on current timestamp and MAC address.
func (g *rfc4122Generator) NewV1() (UUID, error) | {
u := UUID{}
timeNow, clockSeq, err := g.getClockSequence()
if err != nil {
return Nil, err
}
binary.BigEndian.PutUint32(u[0:], uint32(timeNow))
binary.BigEndian.PutUint16(u[4:], uint16(timeNow>>32))
binary.BigEndian.PutUint16(u[6:], uint16(timeNow>>48))
binary.BigEndian.PutUint16(u[8:], clockSeq)
hardwareAddr, err := g.getHardwareAddr()
if err != nil {
return Nil, err
}
copy(u[10:], hardwareAddr)
u.SetVersion(V1)
u.SetVariant(VariantRFC4122)
return u, nil
} |
satori/go.uuid | b2ce2384e17bbe0c6d34077efa39dbab3e09123b | generator.go | https://github.com/satori/go.uuid/blob/b2ce2384e17bbe0c6d34077efa39dbab3e09123b/generator.go#L135-L154 | go | train | // NewV2 returns DCE Security UUID based on POSIX UID/GID. | func (g *rfc4122Generator) NewV2(domain byte) (UUID, error) | // NewV2 returns DCE Security UUID based on POSIX UID/GID.
func (g *rfc4122Generator) NewV2(domain byte) (UUID, error) | {
u, err := g.NewV1()
if err != nil {
return Nil, err
}
switch domain {
case DomainPerson:
binary.BigEndian.PutUint32(u[:], posixUID)
case DomainGroup:
binary.BigEndian.PutUint32(u[:], posixGID)
}
u[9] = domain
u.SetVersion(V2)
u.SetVariant(VariantRFC4122)
return u, nil
} |
satori/go.uuid | b2ce2384e17bbe0c6d34077efa39dbab3e09123b | generator.go | https://github.com/satori/go.uuid/blob/b2ce2384e17bbe0c6d34077efa39dbab3e09123b/generator.go#L157-L163 | go | train | // NewV3 returns UUID based on MD5 hash of namespace UUID and name. | func (g *rfc4122Generator) NewV3(ns UUID, name string) UUID | // NewV3 returns UUID based on MD5 hash of namespace UUID and name.
func (g *rfc4122Generator) NewV3(ns UUID, name string) UUID | {
u := newFromHash(md5.New(), ns, name)
u.SetVersion(V3)
u.SetVariant(VariantRFC4122)
return u
} |
satori/go.uuid | b2ce2384e17bbe0c6d34077efa39dbab3e09123b | generator.go | https://github.com/satori/go.uuid/blob/b2ce2384e17bbe0c6d34077efa39dbab3e09123b/generator.go#L166-L175 | go | train | // NewV4 returns random generated UUID. | func (g *rfc4122Generator) NewV4() (UUID, error) | // NewV4 returns random generated UUID.
func (g *rfc4122Generator) NewV4() (UUID, error) | {
u := UUID{}
if _, err := io.ReadFull(g.rand, u[:]); err != nil {
return Nil, err
}
u.SetVersion(V4)
u.SetVariant(VariantRFC4122)
return u, nil
} |
satori/go.uuid | b2ce2384e17bbe0c6d34077efa39dbab3e09123b | generator.go | https://github.com/satori/go.uuid/blob/b2ce2384e17bbe0c6d34077efa39dbab3e09123b/generator.go#L178-L184 | go | train | // NewV5 returns UUID based on SHA-1 hash of namespace UUID and name. | func (g *rfc4122Generator) NewV5(ns UUID, name string) UUID | // NewV5 returns UUID based on SHA-1 hash of namespace UUID and name.
func (g *rfc4122Generator) NewV5(ns UUID, name string) UUID | {
u := newFromHash(sha1.New(), ns, name)
u.SetVersion(V5)
u.SetVariant(VariantRFC4122)
return u
} |
satori/go.uuid | b2ce2384e17bbe0c6d34077efa39dbab3e09123b | generator.go | https://github.com/satori/go.uuid/blob/b2ce2384e17bbe0c6d34077efa39dbab3e09123b/generator.go#L187-L212 | go | train | // Returns epoch and clock sequence. | func (g *rfc4122Generator) getClockSequence() (uint64, uint16, error) | // Returns epoch and clock sequence.
func (g *rfc4122Generator) getClockSequence() (uint64, uint16, error) | {
var err error
g.clockSequenceOnce.Do(func() {
buf := make([]byte, 2)
if _, err = io.ReadFull(g.rand, buf); err != nil {
return
}
g.clockSequence = binary.BigEndian.Uint16(buf)
})
if err != nil {
return 0, 0, err
}
g.storageMutex.Lock()
defer g.storageMutex.Unlock()
timeNow := g.getEpoch()
// Clock didn't change since last UUID generation.
// Should increase clock sequence.
if timeNow <= g.lastTime {
g.clockSequence++
}
g.lastTime = timeNow
return timeNow, g.clockSequence, nil
} |
satori/go.uuid | b2ce2384e17bbe0c6d34077efa39dbab3e09123b | generator.go | https://github.com/satori/go.uuid/blob/b2ce2384e17bbe0c6d34077efa39dbab3e09123b/generator.go#L215-L235 | go | train | // Returns hardware address. | func (g *rfc4122Generator) getHardwareAddr() ([]byte, error) | // Returns hardware address.
func (g *rfc4122Generator) getHardwareAddr() ([]byte, error) | {
var err error
g.hardwareAddrOnce.Do(func() {
if hwAddr, err := g.hwAddrFunc(); err == nil {
copy(g.hardwareAddr[:], hwAddr)
return
}
// Initialize hardwareAddr randomly in case
// of real network interfaces absence.
if _, err = io.ReadFull(g.rand, g.hardwareAddr[:]); err != nil {
return
}
// Set multicast bit as recommended by RFC 4122
g.hardwareAddr[0] |= 0x01
})
if err != nil {
return []byte{}, err
}
return g.hardwareAddr[:], nil
} |
satori/go.uuid | b2ce2384e17bbe0c6d34077efa39dbab3e09123b | generator.go | https://github.com/satori/go.uuid/blob/b2ce2384e17bbe0c6d34077efa39dbab3e09123b/generator.go#L254-L265 | go | train | // Returns hardware address. | func defaultHWAddrFunc() (net.HardwareAddr, error) | // Returns hardware address.
func defaultHWAddrFunc() (net.HardwareAddr, error) | {
ifaces, err := net.Interfaces()
if err != nil {
return []byte{}, err
}
for _, iface := range ifaces {
if len(iface.HardwareAddr) >= 6 {
return iface.HardwareAddr, nil
}
}
return []byte{}, fmt.Errorf("uuid: no HW address found")
} |
satori/go.uuid | b2ce2384e17bbe0c6d34077efa39dbab3e09123b | uuid.go | https://github.com/satori/go.uuid/blob/b2ce2384e17bbe0c6d34077efa39dbab3e09123b/uuid.go#L83-L85 | go | train | // Equal returns true if u1 and u2 equals, otherwise returns false. | func Equal(u1 UUID, u2 UUID) bool | // Equal returns true if u1 and u2 equals, otherwise returns false.
func Equal(u1 UUID, u2 UUID) bool | {
return bytes.Equal(u1[:], u2[:])
} |
satori/go.uuid | b2ce2384e17bbe0c6d34077efa39dbab3e09123b | uuid.go | https://github.com/satori/go.uuid/blob/b2ce2384e17bbe0c6d34077efa39dbab3e09123b/uuid.go#L93-L106 | go | train | // Variant returns UUID layout variant. | func (u UUID) Variant() byte | // Variant returns UUID layout variant.
func (u UUID) Variant() byte | {
switch {
case (u[8] >> 7) == 0x00:
return VariantNCS
case (u[8] >> 6) == 0x02:
return VariantRFC4122
case (u[8] >> 5) == 0x06:
return VariantMicrosoft
case (u[8] >> 5) == 0x07:
fallthrough
default:
return VariantFuture
}
} |
satori/go.uuid | b2ce2384e17bbe0c6d34077efa39dbab3e09123b | uuid.go | https://github.com/satori/go.uuid/blob/b2ce2384e17bbe0c6d34077efa39dbab3e09123b/uuid.go#L137-L150 | go | train | // SetVariant sets variant bits. | func (u *UUID) SetVariant(v byte) | // SetVariant sets variant bits.
func (u *UUID) SetVariant(v byte) | {
switch v {
case VariantNCS:
u[8] = (u[8]&(0xff>>1) | (0x00 << 7))
case VariantRFC4122:
u[8] = (u[8]&(0xff>>2) | (0x02 << 6))
case VariantMicrosoft:
u[8] = (u[8]&(0xff>>3) | (0x06 << 5))
case VariantFuture:
fallthrough
default:
u[8] = (u[8]&(0xff>>3) | (0x07 << 5))
}
} |
satori/go.uuid | b2ce2384e17bbe0c6d34077efa39dbab3e09123b | uuid.go | https://github.com/satori/go.uuid/blob/b2ce2384e17bbe0c6d34077efa39dbab3e09123b/uuid.go#L156-L161 | go | train | // Must is a helper that wraps a call to a function returning (UUID, error)
// and panics if the error is non-nil. It is intended for use in variable
// initializations such as
// var packageUUID = uuid.Must(uuid.FromString("123e4567-e89b-12d3-a456-426655440000")); | func Must(u UUID, err error) UUID | // Must is a helper that wraps a call to a function returning (UUID, error)
// and panics if the error is non-nil. It is intended for use in variable
// initializations such as
// var packageUUID = uuid.Must(uuid.FromString("123e4567-e89b-12d3-a456-426655440000"));
func Must(u UUID, err error) UUID | {
if err != nil {
panic(err)
}
return u
} |
xo/xo | 1a94fa516029cb306cce6d379d086e4d5b5bb232 | examples/pgcatalog/pgcatalog/pgcatalog.xo.go | https://github.com/xo/xo/blob/1a94fa516029cb306cce6d379d086e4d5b5bb232/examples/pgcatalog/pgcatalog/pgcatalog.xo.go#L21-L36 | go | train | // ASCII calls the stored procedure 'pg_catalog.ascii(text) integer' on db. | func ASCII(db XODB, v0 string) (int, error) | // ASCII calls the stored procedure 'pg_catalog.ascii(text) integer' on db.
func ASCII(db XODB, v0 string) (int, error) | {
var err error
// sql query
const sqlstr = `SELECT pg_catalog.ascii($1)`
// run query
var ret int
XOLog(sqlstr, v0)
err = db.QueryRow(sqlstr, v0).Scan(&ret)
if err != nil {
return 0, err
}
return ret, nil
} |
xo/xo | 1a94fa516029cb306cce6d379d086e4d5b5bb232 | examples/pgcatalog/pgcatalog/pgcatalog.xo.go | https://github.com/xo/xo/blob/1a94fa516029cb306cce6d379d086e4d5b5bb232/examples/pgcatalog/pgcatalog/pgcatalog.xo.go#L101-L116 | go | train | // Abstime calls the stored procedure 'pg_catalog.abstime(timestamp without time zone, timestamp with time zone) abstime' on db. | func Abstime(db XODB, v0 time.Time, v1 time.Time) (pgtypes.Abstime, error) | // Abstime calls the stored procedure 'pg_catalog.abstime(timestamp without time zone, timestamp with time zone) abstime' on db.
func Abstime(db XODB, v0 time.Time, v1 time.Time) (pgtypes.Abstime, error) | {
var err error
// sql query
const sqlstr = `SELECT pg_catalog.abstime($1, $2)`
// run query
var ret pgtypes.Abstime
XOLog(sqlstr, v0, v1)
err = db.QueryRow(sqlstr, v0, v1).Scan(&ret)
if err != nil {
return pgtypes.Abstime{}, err
}
return ret, nil
} |
xo/xo | 1a94fa516029cb306cce6d379d086e4d5b5bb232 | examples/pgcatalog/pgcatalog/pgcatalog.xo.go | https://github.com/xo/xo/blob/1a94fa516029cb306cce6d379d086e4d5b5bb232/examples/pgcatalog/pgcatalog/pgcatalog.xo.go#L281-L296 | go | train | // Abstimesend calls the stored procedure 'pg_catalog.abstimesend(abstime) bytea' on db. | func Abstimesend(db XODB, v0 pgtypes.Abstime) ([]byte, error) | // Abstimesend calls the stored procedure 'pg_catalog.abstimesend(abstime) bytea' on db.
func Abstimesend(db XODB, v0 pgtypes.Abstime) ([]byte, error) | {
var err error
// sql query
const sqlstr = `SELECT pg_catalog.abstimesend($1)`
// run query
var ret []byte
XOLog(sqlstr, v0)
err = db.QueryRow(sqlstr, v0).Scan(&ret)
if err != nil {
return nil, err
}
return ret, nil
} |
xo/xo | 1a94fa516029cb306cce6d379d086e4d5b5bb232 | examples/pgcatalog/pgcatalog/pgcatalog.xo.go | https://github.com/xo/xo/blob/1a94fa516029cb306cce6d379d086e4d5b5bb232/examples/pgcatalog/pgcatalog/pgcatalog.xo.go#L299-L314 | go | train | // Aclcontains calls the stored procedure 'pg_catalog.aclcontains(aclitem[], aclitem) boolean' on db. | func Aclcontains(db XODB, v0 []pgtypes.Aclitem, v1 pgtypes.Aclitem) (bool, error) | // Aclcontains calls the stored procedure 'pg_catalog.aclcontains(aclitem[], aclitem) boolean' on db.
func Aclcontains(db XODB, v0 []pgtypes.Aclitem, v1 pgtypes.Aclitem) (bool, error) | {
var err error
// sql query
const sqlstr = `SELECT pg_catalog.aclcontains($1, $2)`
// run query
var ret bool
XOLog(sqlstr, v0, v1)
err = db.QueryRow(sqlstr, v0, v1).Scan(&ret)
if err != nil {
return false, err
}
return ret, nil
} |
xo/xo | 1a94fa516029cb306cce6d379d086e4d5b5bb232 | examples/pgcatalog/pgcatalog/pgcatalog.xo.go | https://github.com/xo/xo/blob/1a94fa516029cb306cce6d379d086e4d5b5bb232/examples/pgcatalog/pgcatalog/pgcatalog.xo.go#L317-L332 | go | train | // Acldefault calls the stored procedure 'pg_catalog.acldefault("char", oid) aclitem[]' on db. | func Acldefault(db XODB, v0 uint8, v1 pgtypes.Oid) ([]pgtypes.Aclitem, error) | // Acldefault calls the stored procedure 'pg_catalog.acldefault("char", oid) aclitem[]' on db.
func Acldefault(db XODB, v0 uint8, v1 pgtypes.Oid) ([]pgtypes.Aclitem, error) | {
var err error
// sql query
const sqlstr = `SELECT pg_catalog.acldefault($1, $2)`
// run query
var ret []pgtypes.Aclitem
XOLog(sqlstr, v0, v1)
err = db.QueryRow(sqlstr, v0, v1).Scan(&ret)
if err != nil {
return nil, err
}
return ret, nil
} |
xo/xo | 1a94fa516029cb306cce6d379d086e4d5b5bb232 | examples/pgcatalog/pgcatalog/pgcatalog.xo.go | https://github.com/xo/xo/blob/1a94fa516029cb306cce6d379d086e4d5b5bb232/examples/pgcatalog/pgcatalog/pgcatalog.xo.go#L335-L350 | go | train | // Aclexplode calls the stored procedure 'pg_catalog.aclexplode(aclitem[]) SETOF record' on db. | func Aclexplode(db XODB, v0 []pgtypes.Aclitem) ([]pgtypes.Record, error) | // Aclexplode calls the stored procedure 'pg_catalog.aclexplode(aclitem[]) SETOF record' on db.
func Aclexplode(db XODB, v0 []pgtypes.Aclitem) ([]pgtypes.Record, error) | {
var err error
// sql query
const sqlstr = `SELECT pg_catalog.aclexplode($1)`
// run query
var ret []pgtypes.Record
XOLog(sqlstr, v0)
err = db.QueryRow(sqlstr, v0).Scan(&ret)
if err != nil {
return nil, err
}
return ret, nil
} |
xo/xo | 1a94fa516029cb306cce6d379d086e4d5b5bb232 | examples/pgcatalog/pgcatalog/pgcatalog.xo.go | https://github.com/xo/xo/blob/1a94fa516029cb306cce6d379d086e4d5b5bb232/examples/pgcatalog/pgcatalog/pgcatalog.xo.go#L425-L440 | go | train | // Aclremove calls the stored procedure 'pg_catalog.aclremove(aclitem[], aclitem) aclitem[]' on db. | func Aclremove(db XODB, v0 []pgtypes.Aclitem, v1 pgtypes.Aclitem) ([]pgtypes.Aclitem, error) | // Aclremove calls the stored procedure 'pg_catalog.aclremove(aclitem[], aclitem) aclitem[]' on db.
func Aclremove(db XODB, v0 []pgtypes.Aclitem, v1 pgtypes.Aclitem) ([]pgtypes.Aclitem, error) | {
var err error
// sql query
const sqlstr = `SELECT pg_catalog.aclremove($1, $2)`
// run query
var ret []pgtypes.Aclitem
XOLog(sqlstr, v0, v1)
err = db.QueryRow(sqlstr, v0, v1).Scan(&ret)
if err != nil {
return nil, err
}
return ret, nil
} |
xo/xo | 1a94fa516029cb306cce6d379d086e4d5b5bb232 | examples/pgcatalog/pgcatalog/pgcatalog.xo.go | https://github.com/xo/xo/blob/1a94fa516029cb306cce6d379d086e4d5b5bb232/examples/pgcatalog/pgcatalog/pgcatalog.xo.go#L569-L584 | go | train | // AnyarraySend calls the stored procedure 'pg_catalog.anyarray_send(anyarray) bytea' on db. | func AnyarraySend(db XODB, v0 pgtypes.Anyarray) ([]byte, error) | // AnyarraySend calls the stored procedure 'pg_catalog.anyarray_send(anyarray) bytea' on db.
func AnyarraySend(db XODB, v0 pgtypes.Anyarray) ([]byte, error) | {
var err error
// sql query
const sqlstr = `SELECT pg_catalog.anyarray_send($1)`
// run query
var ret []byte
XOLog(sqlstr, v0)
err = db.QueryRow(sqlstr, v0).Scan(&ret)
if err != nil {
return nil, err
}
return ret, nil
} |
xo/xo | 1a94fa516029cb306cce6d379d086e4d5b5bb232 | examples/pgcatalog/pgcatalog/pgcatalog.xo.go | https://github.com/xo/xo/blob/1a94fa516029cb306cce6d379d086e4d5b5bb232/examples/pgcatalog/pgcatalog/pgcatalog.xo.go#L731-L746 | go | train | // Anytextcat calls the stored procedure 'pg_catalog.anytextcat(anynonarray, text) text' on db. | func Anytextcat(db XODB, v0 pgtypes.Anynonarray, v1 string) (string, error) | // Anytextcat calls the stored procedure 'pg_catalog.anytextcat(anynonarray, text) text' on db.
func Anytextcat(db XODB, v0 pgtypes.Anynonarray, v1 string) (string, error) | {
var err error
// sql query
const sqlstr = `SELECT pg_catalog.anytextcat($1, $2)`
// run query
var ret string
XOLog(sqlstr, v0, v1)
err = db.QueryRow(sqlstr, v0, v1).Scan(&ret)
if err != nil {
return "", err
}
return ret, nil
} |
xo/xo | 1a94fa516029cb306cce6d379d086e4d5b5bb232 | examples/pgcatalog/pgcatalog/pgcatalog.xo.go | https://github.com/xo/xo/blob/1a94fa516029cb306cce6d379d086e4d5b5bb232/examples/pgcatalog/pgcatalog/pgcatalog.xo.go#L749-L764 | go | train | // Area calls the stored procedure 'pg_catalog.area(path, box, circle) double precision' on db. | func Area(db XODB, v0 pgtypes.Path, v1 pgtypes.Box, v2 pgtypes.Circle) (float64, error) | // Area calls the stored procedure 'pg_catalog.area(path, box, circle) double precision' on db.
func Area(db XODB, v0 pgtypes.Path, v1 pgtypes.Box, v2 pgtypes.Circle) (float64, error) | {
var err error
// sql query
const sqlstr = `SELECT pg_catalog.area($1, $2, $3)`
// run query
var ret float64
XOLog(sqlstr, v0, v1, v2)
err = db.QueryRow(sqlstr, v0, v1, v2).Scan(&ret)
if err != nil {
return 0.0, err
}
return ret, nil
} |
xo/xo | 1a94fa516029cb306cce6d379d086e4d5b5bb232 | examples/pgcatalog/pgcatalog/pgcatalog.xo.go | https://github.com/xo/xo/blob/1a94fa516029cb306cce6d379d086e4d5b5bb232/examples/pgcatalog/pgcatalog/pgcatalog.xo.go#L1001-L1016 | go | train | // ArrayGt calls the stored procedure 'pg_catalog.array_gt(anyarray, anyarray) boolean' on db. | func ArrayGt(db XODB, v0 pgtypes.Anyarray, v1 pgtypes.Anyarray) (bool, error) | // ArrayGt calls the stored procedure 'pg_catalog.array_gt(anyarray, anyarray) boolean' on db.
func ArrayGt(db XODB, v0 pgtypes.Anyarray, v1 pgtypes.Anyarray) (bool, error) | {
var err error
// sql query
const sqlstr = `SELECT pg_catalog.array_gt($1, $2)`
// run query
var ret bool
XOLog(sqlstr, v0, v1)
err = db.QueryRow(sqlstr, v0, v1).Scan(&ret)
if err != nil {
return false, err
}
return ret, nil
} |
xo/xo | 1a94fa516029cb306cce6d379d086e4d5b5bb232 | examples/pgcatalog/pgcatalog/pgcatalog.xo.go | https://github.com/xo/xo/blob/1a94fa516029cb306cce6d379d086e4d5b5bb232/examples/pgcatalog/pgcatalog/pgcatalog.xo.go#L1616-L1626 | go | train | // BinaryUpgradeCreateEmptyExtension calls the stored procedure 'pg_catalog.binary_upgrade_create_empty_extension(text, text, boolean, text, oid[], text[], text[]) void' on db. | func BinaryUpgradeCreateEmptyExtension(db XODB, v0 string, v1 string, v2 bool, v3 string, v4 []pgtypes.Oid, v5 StringSlice, v6 StringSlice) error | // BinaryUpgradeCreateEmptyExtension calls the stored procedure 'pg_catalog.binary_upgrade_create_empty_extension(text, text, boolean, text, oid[], text[], text[]) void' on db.
func BinaryUpgradeCreateEmptyExtension(db XODB, v0 string, v1 string, v2 bool, v3 string, v4 []pgtypes.Oid, v5 StringSlice, v6 StringSlice) error | {
var err error
// sql query
const sqlstr = `SELECT pg_catalog.binary_upgrade_create_empty_extension($1, $2, $3, $4, $5, $6, $7)`
// run query
XOLog(sqlstr)
_, err = db.Exec(sqlstr)
return err
} |
xo/xo | 1a94fa516029cb306cce6d379d086e4d5b5bb232 | examples/pgcatalog/pgcatalog/pgcatalog.xo.go | https://github.com/xo/xo/blob/1a94fa516029cb306cce6d379d086e4d5b5bb232/examples/pgcatalog/pgcatalog/pgcatalog.xo.go#L1629-L1639 | go | train | // BinaryUpgradeSetNextArrayPgTypeOid calls the stored procedure 'pg_catalog.binary_upgrade_set_next_array_pg_type_oid(oid) void' on db. | func BinaryUpgradeSetNextArrayPgTypeOid(db XODB, v0 pgtypes.Oid) error | // BinaryUpgradeSetNextArrayPgTypeOid calls the stored procedure 'pg_catalog.binary_upgrade_set_next_array_pg_type_oid(oid) void' on db.
func BinaryUpgradeSetNextArrayPgTypeOid(db XODB, v0 pgtypes.Oid) error | {
var err error
// sql query
const sqlstr = `SELECT pg_catalog.binary_upgrade_set_next_array_pg_type_oid($1)`
// run query
XOLog(sqlstr)
_, err = db.Exec(sqlstr)
return err
} |
xo/xo | 1a94fa516029cb306cce6d379d086e4d5b5bb232 | examples/pgcatalog/pgcatalog/pgcatalog.xo.go | https://github.com/xo/xo/blob/1a94fa516029cb306cce6d379d086e4d5b5bb232/examples/pgcatalog/pgcatalog/pgcatalog.xo.go#L1733-L1748 | go | train | // Bit calls the stored procedure 'pg_catalog.bit(bigint, integer, integer, integer, bit, integer, boolean) bit' on db. | func Bit(db XODB, v0 int64, v1 int, v2 int, v3 int, v4 uint8, v5 int, v6 bool) (uint8, error) | // Bit calls the stored procedure 'pg_catalog.bit(bigint, integer, integer, integer, bit, integer, boolean) bit' on db.
func Bit(db XODB, v0 int64, v1 int, v2 int, v3 int, v4 uint8, v5 int, v6 bool) (uint8, error) | {
var err error
// sql query
const sqlstr = `SELECT pg_catalog.bit($1, $2, $3, $4, $5, $6, $7)`
// run query
var ret uint8
XOLog(sqlstr, v0, v1, v2, v3, v4, v5, v6)
err = db.QueryRow(sqlstr, v0, v1, v2, v3, v4, v5, v6).Scan(&ret)
if err != nil {
return uint8(0), err
}
return ret, nil
} |
xo/xo | 1a94fa516029cb306cce6d379d086e4d5b5bb232 | examples/pgcatalog/pgcatalog/pgcatalog.xo.go | https://github.com/xo/xo/blob/1a94fa516029cb306cce6d379d086e4d5b5bb232/examples/pgcatalog/pgcatalog/pgcatalog.xo.go#L1805-L1820 | go | train | // BitOr calls the stored procedure 'pg_catalog.bit_or(bigint, smallint, integer, bit) bit' on db. | func BitOr(db XODB, v0 int64, v1 int16, v2 int, v3 uint8) (uint8, error) | // BitOr calls the stored procedure 'pg_catalog.bit_or(bigint, smallint, integer, bit) bit' on db.
func BitOr(db XODB, v0 int64, v1 int16, v2 int, v3 uint8) (uint8, error) | {
var err error
// sql query
const sqlstr = `SELECT pg_catalog.bit_or($1, $2, $3, $4)`
// run query
var ret uint8
XOLog(sqlstr, v0, v1, v2, v3)
err = db.QueryRow(sqlstr, v0, v1, v2, v3).Scan(&ret)
if err != nil {
return uint8(0), err
}
return ret, nil
} |
xo/xo | 1a94fa516029cb306cce6d379d086e4d5b5bb232 | examples/pgcatalog/pgcatalog/pgcatalog.xo.go | https://github.com/xo/xo/blob/1a94fa516029cb306cce6d379d086e4d5b5bb232/examples/pgcatalog/pgcatalog/pgcatalog.xo.go#L3065-L3080 | go | train | // BoxSend calls the stored procedure 'pg_catalog.box_send(box) bytea' on db. | func BoxSend(db XODB, v0 pgtypes.Box) ([]byte, error) | // BoxSend calls the stored procedure 'pg_catalog.box_send(box) bytea' on db.
func BoxSend(db XODB, v0 pgtypes.Box) ([]byte, error) | {
var err error
// sql query
const sqlstr = `SELECT pg_catalog.box_send($1)`
// run query
var ret []byte
XOLog(sqlstr, v0)
err = db.QueryRow(sqlstr, v0).Scan(&ret)
if err != nil {
return nil, err
}
return ret, nil
} |
xo/xo | 1a94fa516029cb306cce6d379d086e4d5b5bb232 | examples/pgcatalog/pgcatalog/pgcatalog.xo.go | https://github.com/xo/xo/blob/1a94fa516029cb306cce6d379d086e4d5b5bb232/examples/pgcatalog/pgcatalog/pgcatalog.xo.go#L4618-L4633 | go | train | // Btoidvectorcmp calls the stored procedure 'pg_catalog.btoidvectorcmp(oidvector, oidvector) integer' on db. | func Btoidvectorcmp(db XODB, v0 pgtypes.Oidvector, v1 pgtypes.Oidvector) (int, error) | // Btoidvectorcmp calls the stored procedure 'pg_catalog.btoidvectorcmp(oidvector, oidvector) integer' on db.
func Btoidvectorcmp(db XODB, v0 pgtypes.Oidvector, v1 pgtypes.Oidvector) (int, error) | {
var err error
// sql query
const sqlstr = `SELECT pg_catalog.btoidvectorcmp($1, $2)`
// run query
var ret int
XOLog(sqlstr, v0, v1)
err = db.QueryRow(sqlstr, v0, v1).Scan(&ret)
if err != nil {
return 0, err
}
return ret, nil
} |
xo/xo | 1a94fa516029cb306cce6d379d086e4d5b5bb232 | examples/pgcatalog/pgcatalog/pgcatalog.xo.go | https://github.com/xo/xo/blob/1a94fa516029cb306cce6d379d086e4d5b5bb232/examples/pgcatalog/pgcatalog/pgcatalog.xo.go#L4690-L4705 | go | train | // Btreltimecmp calls the stored procedure 'pg_catalog.btreltimecmp(reltime, reltime) integer' on db. | func Btreltimecmp(db XODB, v0 pgtypes.Reltime, v1 pgtypes.Reltime) (int, error) | // Btreltimecmp calls the stored procedure 'pg_catalog.btreltimecmp(reltime, reltime) integer' on db.
func Btreltimecmp(db XODB, v0 pgtypes.Reltime, v1 pgtypes.Reltime) (int, error) | {
var err error
// sql query
const sqlstr = `SELECT pg_catalog.btreltimecmp($1, $2)`
// run query
var ret int
XOLog(sqlstr, v0, v1)
err = db.QueryRow(sqlstr, v0, v1).Scan(&ret)
if err != nil {
return 0, err
}
return ret, nil
} |
xo/xo | 1a94fa516029cb306cce6d379d086e4d5b5bb232 | examples/pgcatalog/pgcatalog/pgcatalog.xo.go | https://github.com/xo/xo/blob/1a94fa516029cb306cce6d379d086e4d5b5bb232/examples/pgcatalog/pgcatalog/pgcatalog.xo.go#L5107-L5122 | go | train | // Bytearecv calls the stored procedure 'pg_catalog.bytearecv(internal) bytea' on db. | func Bytearecv(db XODB, v0 pgtypes.Internal) ([]byte, error) | // Bytearecv calls the stored procedure 'pg_catalog.bytearecv(internal) bytea' on db.
func Bytearecv(db XODB, v0 pgtypes.Internal) ([]byte, error) | {
var err error
// sql query
const sqlstr = `SELECT pg_catalog.bytearecv($1)`
// run query
var ret []byte
XOLog(sqlstr, v0)
err = db.QueryRow(sqlstr, v0).Scan(&ret)
if err != nil {
return nil, err
}
return ret, nil
} |
xo/xo | 1a94fa516029cb306cce6d379d086e4d5b5bb232 | examples/pgcatalog/pgcatalog/pgcatalog.xo.go | https://github.com/xo/xo/blob/1a94fa516029cb306cce6d379d086e4d5b5bb232/examples/pgcatalog/pgcatalog/pgcatalog.xo.go#L5881-L5896 | go | train | // Charrecv calls the stored procedure 'pg_catalog.charrecv(internal) "char"' on db. | func Charrecv(db XODB, v0 pgtypes.Internal) (uint8, error) | // Charrecv calls the stored procedure 'pg_catalog.charrecv(internal) "char"' on db.
func Charrecv(db XODB, v0 pgtypes.Internal) (uint8, error) | {
var err error
// sql query
const sqlstr = `SELECT pg_catalog.charrecv($1)`
// run query
var ret uint8
XOLog(sqlstr, v0)
err = db.QueryRow(sqlstr, v0).Scan(&ret)
if err != nil {
return uint8(0), err
}
return ret, nil
} |
xo/xo | 1a94fa516029cb306cce6d379d086e4d5b5bb232 | examples/pgcatalog/pgcatalog/pgcatalog.xo.go | https://github.com/xo/xo/blob/1a94fa516029cb306cce6d379d086e4d5b5bb232/examples/pgcatalog/pgcatalog/pgcatalog.xo.go#L5935-L5950 | go | train | // Cideq calls the stored procedure 'pg_catalog.cideq(cid, cid) boolean' on db. | func Cideq(db XODB, v0 pgtypes.Cid, v1 pgtypes.Cid) (bool, error) | // Cideq calls the stored procedure 'pg_catalog.cideq(cid, cid) boolean' on db.
func Cideq(db XODB, v0 pgtypes.Cid, v1 pgtypes.Cid) (bool, error) | {
var err error
// sql query
const sqlstr = `SELECT pg_catalog.cideq($1, $2)`
// run query
var ret bool
XOLog(sqlstr, v0, v1)
err = db.QueryRow(sqlstr, v0, v1).Scan(&ret)
if err != nil {
return false, err
}
return ret, nil
} |
xo/xo | 1a94fa516029cb306cce6d379d086e4d5b5bb232 | examples/pgcatalog/pgcatalog/pgcatalog.xo.go | https://github.com/xo/xo/blob/1a94fa516029cb306cce6d379d086e4d5b5bb232/examples/pgcatalog/pgcatalog/pgcatalog.xo.go#L6097-L6112 | go | train | // Cidsend calls the stored procedure 'pg_catalog.cidsend(cid) bytea' on db. | func Cidsend(db XODB, v0 pgtypes.Cid) ([]byte, error) | // Cidsend calls the stored procedure 'pg_catalog.cidsend(cid) bytea' on db.
func Cidsend(db XODB, v0 pgtypes.Cid) ([]byte, error) | {
var err error
// sql query
const sqlstr = `SELECT pg_catalog.cidsend($1)`
// run query
var ret []byte
XOLog(sqlstr, v0)
err = db.QueryRow(sqlstr, v0).Scan(&ret)
if err != nil {
return nil, err
}
return ret, nil
} |
xo/xo | 1a94fa516029cb306cce6d379d086e4d5b5bb232 | examples/pgcatalog/pgcatalog/pgcatalog.xo.go | https://github.com/xo/xo/blob/1a94fa516029cb306cce6d379d086e4d5b5bb232/examples/pgcatalog/pgcatalog/pgcatalog.xo.go#L6619-L6634 | go | train | // CircleSend calls the stored procedure 'pg_catalog.circle_send(circle) bytea' on db. | func CircleSend(db XODB, v0 pgtypes.Circle) ([]byte, error) | // CircleSend calls the stored procedure 'pg_catalog.circle_send(circle) bytea' on db.
func CircleSend(db XODB, v0 pgtypes.Circle) ([]byte, error) | {
var err error
// sql query
const sqlstr = `SELECT pg_catalog.circle_send($1)`
// run query
var ret []byte
XOLog(sqlstr, v0)
err = db.QueryRow(sqlstr, v0).Scan(&ret)
if err != nil {
return nil, err
}
return ret, nil
} |
xo/xo | 1a94fa516029cb306cce6d379d086e4d5b5bb232 | examples/pgcatalog/pgcatalog/pgcatalog.xo.go | https://github.com/xo/xo/blob/1a94fa516029cb306cce6d379d086e4d5b5bb232/examples/pgcatalog/pgcatalog/pgcatalog.xo.go#L6655-L6670 | go | train | // ClockTimestamp calls the stored procedure 'pg_catalog.clock_timestamp() timestamp with time zone' on db. | func ClockTimestamp(db XODB) (time.Time, error) | // ClockTimestamp calls the stored procedure 'pg_catalog.clock_timestamp() timestamp with time zone' on db.
func ClockTimestamp(db XODB) (time.Time, error) | {
var err error
// sql query
const sqlstr = `SELECT pg_catalog.clock_timestamp()`
// run query
var ret time.Time
XOLog(sqlstr)
err = db.QueryRow(sqlstr).Scan(&ret)
if err != nil {
return time.Time{}, err
}
return ret, nil
} |
xo/xo | 1a94fa516029cb306cce6d379d086e4d5b5bb232 | examples/pgcatalog/pgcatalog/pgcatalog.xo.go | https://github.com/xo/xo/blob/1a94fa516029cb306cce6d379d086e4d5b5bb232/examples/pgcatalog/pgcatalog/pgcatalog.xo.go#L7177-L7192 | go | train | // CurrentDatabase calls the stored procedure 'pg_catalog.current_database() name' on db. | func CurrentDatabase(db XODB) (pgtypes.Name, error) | // CurrentDatabase calls the stored procedure 'pg_catalog.current_database() name' on db.
func CurrentDatabase(db XODB) (pgtypes.Name, error) | {
var err error
// sql query
const sqlstr = `SELECT pg_catalog.current_database()`
// run query
var ret pgtypes.Name
XOLog(sqlstr)
err = db.QueryRow(sqlstr).Scan(&ret)
if err != nil {
return pgtypes.Name{}, err
}
return ret, nil
} |
xo/xo | 1a94fa516029cb306cce6d379d086e4d5b5bb232 | examples/pgcatalog/pgcatalog/pgcatalog.xo.go | https://github.com/xo/xo/blob/1a94fa516029cb306cce6d379d086e4d5b5bb232/examples/pgcatalog/pgcatalog/pgcatalog.xo.go#L7195-L7210 | go | train | // CurrentQuery calls the stored procedure 'pg_catalog.current_query() text' on db. | func CurrentQuery(db XODB) (string, error) | // CurrentQuery calls the stored procedure 'pg_catalog.current_query() text' on db.
func CurrentQuery(db XODB) (string, error) | {
var err error
// sql query
const sqlstr = `SELECT pg_catalog.current_query()`
// run query
var ret string
XOLog(sqlstr)
err = db.QueryRow(sqlstr).Scan(&ret)
if err != nil {
return "", err
}
return ret, nil
} |
xo/xo | 1a94fa516029cb306cce6d379d086e4d5b5bb232 | examples/pgcatalog/pgcatalog/pgcatalog.xo.go | https://github.com/xo/xo/blob/1a94fa516029cb306cce6d379d086e4d5b5bb232/examples/pgcatalog/pgcatalog/pgcatalog.xo.go#L7231-L7246 | go | train | // CurrentSchemas calls the stored procedure 'pg_catalog.current_schemas(boolean) name[]' on db. | func CurrentSchemas(db XODB, v0 bool) ([]pgtypes.Name, error) | // CurrentSchemas calls the stored procedure 'pg_catalog.current_schemas(boolean) name[]' on db.
func CurrentSchemas(db XODB, v0 bool) ([]pgtypes.Name, error) | {
var err error
// sql query
const sqlstr = `SELECT pg_catalog.current_schemas($1)`
// run query
var ret []pgtypes.Name
XOLog(sqlstr, v0)
err = db.QueryRow(sqlstr, v0).Scan(&ret)
if err != nil {
return nil, err
}
return ret, nil
} |
xo/xo | 1a94fa516029cb306cce6d379d086e4d5b5bb232 | examples/pgcatalog/pgcatalog/pgcatalog.xo.go | https://github.com/xo/xo/blob/1a94fa516029cb306cce6d379d086e4d5b5bb232/examples/pgcatalog/pgcatalog/pgcatalog.xo.go#L7429-L7444 | go | train | // Date calls the stored procedure 'pg_catalog.date(abstime, timestamp without time zone, timestamp with time zone) date' on db. | func Date(db XODB, v0 pgtypes.Abstime, v1 time.Time, v2 time.Time) (time.Time, error) | // Date calls the stored procedure 'pg_catalog.date(abstime, timestamp without time zone, timestamp with time zone) date' on db.
func Date(db XODB, v0 pgtypes.Abstime, v1 time.Time, v2 time.Time) (time.Time, error) | {
var err error
// sql query
const sqlstr = `SELECT pg_catalog.date($1, $2, $3)`
// run query
var ret time.Time
XOLog(sqlstr, v0, v1, v2)
err = db.QueryRow(sqlstr, v0, v1, v2).Scan(&ret)
if err != nil {
return time.Time{}, err
}
return ret, nil
} |
xo/xo | 1a94fa516029cb306cce6d379d086e4d5b5bb232 | examples/pgcatalog/pgcatalog/pgcatalog.xo.go | https://github.com/xo/xo/blob/1a94fa516029cb306cce6d379d086e4d5b5bb232/examples/pgcatalog/pgcatalog/pgcatalog.xo.go#L7447-L7462 | go | train | // DateCmp calls the stored procedure 'pg_catalog.date_cmp(date, date) integer' on db. | func DateCmp(db XODB, v0 time.Time, v1 time.Time) (int, error) | // DateCmp calls the stored procedure 'pg_catalog.date_cmp(date, date) integer' on db.
func DateCmp(db XODB, v0 time.Time, v1 time.Time) (int, error) | {
var err error
// sql query
const sqlstr = `SELECT pg_catalog.date_cmp($1, $2)`
// run query
var ret int
XOLog(sqlstr, v0, v1)
err = db.QueryRow(sqlstr, v0, v1).Scan(&ret)
if err != nil {
return 0, err
}
return ret, nil
} |
xo/xo | 1a94fa516029cb306cce6d379d086e4d5b5bb232 | examples/pgcatalog/pgcatalog/pgcatalog.xo.go | https://github.com/xo/xo/blob/1a94fa516029cb306cce6d379d086e4d5b5bb232/examples/pgcatalog/pgcatalog/pgcatalog.xo.go#L7933-L7948 | go | train | // DatePart calls the stored procedure 'pg_catalog.date_part(text, abstime, text, reltime, text, date, text, time without time zone, text, timestamp without time zone, text, timestamp with time zone, text, interval, text, time with time zone) double precision' on db. | func DatePart(db XODB, v0 string, v1 pgtypes.Abstime, v2 string, v3 pgtypes.Reltime, v4 string, v5 time.Time, v6 string, v7 time.Time, v8 string, v9 time.Time, v10 string, v11 time.Time, v12 string, v13 *time.Duration, v14 string, v15 time.Time) (float64, error) | // DatePart calls the stored procedure 'pg_catalog.date_part(text, abstime, text, reltime, text, date, text, time without time zone, text, timestamp without time zone, text, timestamp with time zone, text, interval, text, time with time zone) double precision' on db.
func DatePart(db XODB, v0 string, v1 pgtypes.Abstime, v2 string, v3 pgtypes.Reltime, v4 string, v5 time.Time, v6 string, v7 time.Time, v8 string, v9 time.Time, v10 string, v11 time.Time, v12 string, v13 *time.Duration, v14 string, v15 time.Time) (float64, error) | {
var err error
// sql query
const sqlstr = `SELECT pg_catalog.date_part($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13, $14, $15, $16)`
// run query
var ret float64
XOLog(sqlstr, v0, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15)
err = db.QueryRow(sqlstr, v0, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15).Scan(&ret)
if err != nil {
return 0.0, err
}
return ret, nil
} |
xo/xo | 1a94fa516029cb306cce6d379d086e4d5b5bb232 | examples/pgcatalog/pgcatalog/pgcatalog.xo.go | https://github.com/xo/xo/blob/1a94fa516029cb306cce6d379d086e4d5b5bb232/examples/pgcatalog/pgcatalog/pgcatalog.xo.go#L7987-L8002 | go | train | // DateRecv calls the stored procedure 'pg_catalog.date_recv(internal) date' on db. | func DateRecv(db XODB, v0 pgtypes.Internal) (time.Time, error) | // DateRecv calls the stored procedure 'pg_catalog.date_recv(internal) date' on db.
func DateRecv(db XODB, v0 pgtypes.Internal) (time.Time, error) | {
var err error
// sql query
const sqlstr = `SELECT pg_catalog.date_recv($1)`
// run query
var ret time.Time
XOLog(sqlstr, v0)
err = db.QueryRow(sqlstr, v0).Scan(&ret)
if err != nil {
return time.Time{}, err
}
return ret, nil
} |
xo/xo | 1a94fa516029cb306cce6d379d086e4d5b5bb232 | examples/pgcatalog/pgcatalog/pgcatalog.xo.go | https://github.com/xo/xo/blob/1a94fa516029cb306cce6d379d086e4d5b5bb232/examples/pgcatalog/pgcatalog/pgcatalog.xo.go#L8054-L8069 | go | train | // DateTrunc calls the stored procedure 'pg_catalog.date_trunc(text, timestamp without time zone, text, timestamp with time zone, text, interval) timestamp without time zone' on db. | func DateTrunc(db XODB, v0 string, v1 time.Time, v2 string, v3 time.Time, v4 string, v5 *time.Duration) (time.Time, error) | // DateTrunc calls the stored procedure 'pg_catalog.date_trunc(text, timestamp without time zone, text, timestamp with time zone, text, interval) timestamp without time zone' on db.
func DateTrunc(db XODB, v0 string, v1 time.Time, v2 string, v3 time.Time, v4 string, v5 *time.Duration) (time.Time, error) | {
var err error
// sql query
const sqlstr = `SELECT pg_catalog.date_trunc($1, $2, $3, $4, $5, $6)`
// run query
var ret time.Time
XOLog(sqlstr, v0, v1, v2, v3, v4, v5)
err = db.QueryRow(sqlstr, v0, v1, v2, v3, v4, v5).Scan(&ret)
if err != nil {
return time.Time{}, err
}
return ret, nil
} |
xo/xo | 1a94fa516029cb306cce6d379d086e4d5b5bb232 | examples/pgcatalog/pgcatalog/pgcatalog.xo.go | https://github.com/xo/xo/blob/1a94fa516029cb306cce6d379d086e4d5b5bb232/examples/pgcatalog/pgcatalog/pgcatalog.xo.go#L8090-L8105 | go | train | // DaterangeCanonical calls the stored procedure 'pg_catalog.daterange_canonical(daterange) daterange' on db. | func DaterangeCanonical(db XODB, v0 pgtypes.Daterange) (pgtypes.Daterange, error) | // DaterangeCanonical calls the stored procedure 'pg_catalog.daterange_canonical(daterange) daterange' on db.
func DaterangeCanonical(db XODB, v0 pgtypes.Daterange) (pgtypes.Daterange, error) | {
var err error
// sql query
const sqlstr = `SELECT pg_catalog.daterange_canonical($1)`
// run query
var ret pgtypes.Daterange
XOLog(sqlstr, v0)
err = db.QueryRow(sqlstr, v0).Scan(&ret)
if err != nil {
return pgtypes.Daterange{}, err
}
return ret, nil
} |
xo/xo | 1a94fa516029cb306cce6d379d086e4d5b5bb232 | examples/pgcatalog/pgcatalog/pgcatalog.xo.go | https://github.com/xo/xo/blob/1a94fa516029cb306cce6d379d086e4d5b5bb232/examples/pgcatalog/pgcatalog/pgcatalog.xo.go#L8270-L8285 | go | train | // Diagonal calls the stored procedure 'pg_catalog.diagonal(box) lseg' on db. | func Diagonal(db XODB, v0 pgtypes.Box) (pgtypes.Lseg, error) | // Diagonal calls the stored procedure 'pg_catalog.diagonal(box) lseg' on db.
func Diagonal(db XODB, v0 pgtypes.Box) (pgtypes.Lseg, error) | {
var err error
// sql query
const sqlstr = `SELECT pg_catalog.diagonal($1)`
// run query
var ret pgtypes.Lseg
XOLog(sqlstr, v0)
err = db.QueryRow(sqlstr, v0).Scan(&ret)
if err != nil {
return pgtypes.Lseg{}, err
}
return ret, nil
} |
xo/xo | 1a94fa516029cb306cce6d379d086e4d5b5bb232 | examples/pgcatalog/pgcatalog/pgcatalog.xo.go | https://github.com/xo/xo/blob/1a94fa516029cb306cce6d379d086e4d5b5bb232/examples/pgcatalog/pgcatalog/pgcatalog.xo.go#L8918-L8933 | go | train | // EnumGe calls the stored procedure 'pg_catalog.enum_ge(anyenum, anyenum) boolean' on db. | func EnumGe(db XODB, v0 pgtypes.Anyenum, v1 pgtypes.Anyenum) (bool, error) | // EnumGe calls the stored procedure 'pg_catalog.enum_ge(anyenum, anyenum) boolean' on db.
func EnumGe(db XODB, v0 pgtypes.Anyenum, v1 pgtypes.Anyenum) (bool, error) | {
var err error
// sql query
const sqlstr = `SELECT pg_catalog.enum_ge($1, $2)`
// run query
var ret bool
XOLog(sqlstr, v0, v1)
err = db.QueryRow(sqlstr, v0, v1).Scan(&ret)
if err != nil {
return false, err
}
return ret, nil
} |
xo/xo | 1a94fa516029cb306cce6d379d086e4d5b5bb232 | examples/pgcatalog/pgcatalog/pgcatalog.xo.go | https://github.com/xo/xo/blob/1a94fa516029cb306cce6d379d086e4d5b5bb232/examples/pgcatalog/pgcatalog/pgcatalog.xo.go#L8954-L8969 | go | train | // EnumIn calls the stored procedure 'pg_catalog.enum_in(cstring, oid) anyenum' on db. | func EnumIn(db XODB, v0 pgtypes.Cstring, v1 pgtypes.Oid) (pgtypes.Anyenum, error) | // EnumIn calls the stored procedure 'pg_catalog.enum_in(cstring, oid) anyenum' on db.
func EnumIn(db XODB, v0 pgtypes.Cstring, v1 pgtypes.Oid) (pgtypes.Anyenum, error) | {
var err error
// sql query
const sqlstr = `SELECT pg_catalog.enum_in($1, $2)`
// run query
var ret pgtypes.Anyenum
XOLog(sqlstr, v0, v1)
err = db.QueryRow(sqlstr, v0, v1).Scan(&ret)
if err != nil {
return pgtypes.Anyenum{}, err
}
return ret, nil
} |
xo/xo | 1a94fa516029cb306cce6d379d086e4d5b5bb232 | examples/pgcatalog/pgcatalog/pgcatalog.xo.go | https://github.com/xo/xo/blob/1a94fa516029cb306cce6d379d086e4d5b5bb232/examples/pgcatalog/pgcatalog/pgcatalog.xo.go#L9080-L9095 | go | train | // EnumRange calls the stored procedure 'pg_catalog.enum_range(anyenum, anyenum, anyenum) anyarray' on db. | func EnumRange(db XODB, v0 pgtypes.Anyenum, v1 pgtypes.Anyenum, v2 pgtypes.Anyenum) (pgtypes.Anyarray, error) | // EnumRange calls the stored procedure 'pg_catalog.enum_range(anyenum, anyenum, anyenum) anyarray' on db.
func EnumRange(db XODB, v0 pgtypes.Anyenum, v1 pgtypes.Anyenum, v2 pgtypes.Anyenum) (pgtypes.Anyarray, error) | {
var err error
// sql query
const sqlstr = `SELECT pg_catalog.enum_range($1, $2, $3)`
// run query
var ret pgtypes.Anyarray
XOLog(sqlstr, v0, v1, v2)
err = db.QueryRow(sqlstr, v0, v1, v2).Scan(&ret)
if err != nil {
return pgtypes.Anyarray{}, err
}
return ret, nil
} |
xo/xo | 1a94fa516029cb306cce6d379d086e4d5b5bb232 | examples/pgcatalog/pgcatalog/pgcatalog.xo.go | https://github.com/xo/xo/blob/1a94fa516029cb306cce6d379d086e4d5b5bb232/examples/pgcatalog/pgcatalog/pgcatalog.xo.go#L9098-L9113 | go | train | // EnumRecv calls the stored procedure 'pg_catalog.enum_recv(internal, oid) anyenum' on db. | func EnumRecv(db XODB, v0 pgtypes.Internal, v1 pgtypes.Oid) (pgtypes.Anyenum, error) | // EnumRecv calls the stored procedure 'pg_catalog.enum_recv(internal, oid) anyenum' on db.
func EnumRecv(db XODB, v0 pgtypes.Internal, v1 pgtypes.Oid) (pgtypes.Anyenum, error) | {
var err error
// sql query
const sqlstr = `SELECT pg_catalog.enum_recv($1, $2)`
// run query
var ret pgtypes.Anyenum
XOLog(sqlstr, v0, v1)
err = db.QueryRow(sqlstr, v0, v1).Scan(&ret)
if err != nil {
return pgtypes.Anyenum{}, err
}
return ret, nil
} |
xo/xo | 1a94fa516029cb306cce6d379d086e4d5b5bb232 | examples/pgcatalog/pgcatalog/pgcatalog.xo.go | https://github.com/xo/xo/blob/1a94fa516029cb306cce6d379d086e4d5b5bb232/examples/pgcatalog/pgcatalog/pgcatalog.xo.go#L9116-L9131 | go | train | // EnumSend calls the stored procedure 'pg_catalog.enum_send(anyenum) bytea' on db. | func EnumSend(db XODB, v0 pgtypes.Anyenum) ([]byte, error) | // EnumSend calls the stored procedure 'pg_catalog.enum_send(anyenum) bytea' on db.
func EnumSend(db XODB, v0 pgtypes.Anyenum) ([]byte, error) | {
var err error
// sql query
const sqlstr = `SELECT pg_catalog.enum_send($1)`
// run query
var ret []byte
XOLog(sqlstr, v0)
err = db.QueryRow(sqlstr, v0).Scan(&ret)
if err != nil {
return nil, err
}
return ret, nil
} |
xo/xo | 1a94fa516029cb306cce6d379d086e4d5b5bb232 | examples/pgcatalog/pgcatalog/pgcatalog.xo.go | https://github.com/xo/xo/blob/1a94fa516029cb306cce6d379d086e4d5b5bb232/examples/pgcatalog/pgcatalog/pgcatalog.xo.go#L11083-L11098 | go | train | // GenerateSeries calls the stored procedure 'pg_catalog.generate_series(bigint, bigint, integer, integer, numeric, numeric, bigint, bigint, bigint, integer, integer, integer, timestamp without time zone, timestamp without time zone, interval, timestamp with time zone, timestamp with time zone, interval, numeric, numeric, numeric) SETOF timestamp with time zone' on db. | func GenerateSeries(db XODB, v0 int64, v1 int64, v2 int, v3 int, v4 float64, v5 float64, v6 int64, v7 int64, v8 int64, v9 int, v10 int, v11 int, v12 time.Time, v13 time.Time, v14 *time.Duration, v15 time.Time, v16 time.Time, v17 *time.Duration, v18 float64, v19 float64, v20 float64) ([]time.Time, error) | // GenerateSeries calls the stored procedure 'pg_catalog.generate_series(bigint, bigint, integer, integer, numeric, numeric, bigint, bigint, bigint, integer, integer, integer, timestamp without time zone, timestamp without time zone, interval, timestamp with time zone, timestamp with time zone, interval, numeric, numeric, numeric) SETOF timestamp with time zone' on db.
func GenerateSeries(db XODB, v0 int64, v1 int64, v2 int, v3 int, v4 float64, v5 float64, v6 int64, v7 int64, v8 int64, v9 int, v10 int, v11 int, v12 time.Time, v13 time.Time, v14 *time.Duration, v15 time.Time, v16 time.Time, v17 *time.Duration, v18 float64, v19 float64, v20 float64) ([]time.Time, error) | {
var err error
// sql query
const sqlstr = `SELECT pg_catalog.generate_series($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13, $14, $15, $16, $17, $18, $19, $20, $21)`
// run query
var ret []time.Time
XOLog(sqlstr, v0, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20)
err = db.QueryRow(sqlstr, v0, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20).Scan(&ret)
if err != nil {
return nil, err
}
return ret, nil
} |
xo/xo | 1a94fa516029cb306cce6d379d086e4d5b5bb232 | examples/pgcatalog/pgcatalog/pgcatalog.xo.go | https://github.com/xo/xo/blob/1a94fa516029cb306cce6d379d086e4d5b5bb232/examples/pgcatalog/pgcatalog/pgcatalog.xo.go#L11155-L11170 | go | train | // GetCurrentTsConfig calls the stored procedure 'pg_catalog.get_current_ts_config() regconfig' on db. | func GetCurrentTsConfig(db XODB) (pgtypes.Regconfig, error) | // GetCurrentTsConfig calls the stored procedure 'pg_catalog.get_current_ts_config() regconfig' on db.
func GetCurrentTsConfig(db XODB) (pgtypes.Regconfig, error) | {
var err error
// sql query
const sqlstr = `SELECT pg_catalog.get_current_ts_config()`
// run query
var ret pgtypes.Regconfig
XOLog(sqlstr)
err = db.QueryRow(sqlstr).Scan(&ret)
if err != nil {
return pgtypes.Regconfig{}, err
}
return ret, nil
} |
xo/xo | 1a94fa516029cb306cce6d379d086e4d5b5bb232 | examples/pgcatalog/pgcatalog/pgcatalog.xo.go | https://github.com/xo/xo/blob/1a94fa516029cb306cce6d379d086e4d5b5bb232/examples/pgcatalog/pgcatalog/pgcatalog.xo.go#L11209-L11224 | go | train | // GinCmpPrefix calls the stored procedure 'pg_catalog.gin_cmp_prefix(text, text, smallint, internal) integer' on db. | func GinCmpPrefix(db XODB, v0 string, v1 string, v2 int16, v3 pgtypes.Internal) (int, error) | // GinCmpPrefix calls the stored procedure 'pg_catalog.gin_cmp_prefix(text, text, smallint, internal) integer' on db.
func GinCmpPrefix(db XODB, v0 string, v1 string, v2 int16, v3 pgtypes.Internal) (int, error) | {
var err error
// sql query
const sqlstr = `SELECT pg_catalog.gin_cmp_prefix($1, $2, $3, $4)`
// run query
var ret int
XOLog(sqlstr, v0, v1, v2, v3)
err = db.QueryRow(sqlstr, v0, v1, v2, v3).Scan(&ret)
if err != nil {
return 0, err
}
return ret, nil
} |
xo/xo | 1a94fa516029cb306cce6d379d086e4d5b5bb232 | examples/pgcatalog/pgcatalog/pgcatalog.xo.go | https://github.com/xo/xo/blob/1a94fa516029cb306cce6d379d086e4d5b5bb232/examples/pgcatalog/pgcatalog/pgcatalog.xo.go#L11263-L11278 | go | train | // GinConsistentJsonb calls the stored procedure 'pg_catalog.gin_consistent_jsonb(internal, smallint, anyarray, integer, internal, internal, internal, internal) boolean' on db. | func GinConsistentJsonb(db XODB, v0 pgtypes.Internal, v1 int16, v2 pgtypes.Anyarray, v3 int, v4 pgtypes.Internal, v5 pgtypes.Internal, v6 pgtypes.Internal, v7 pgtypes.Internal) (bool, error) | // GinConsistentJsonb calls the stored procedure 'pg_catalog.gin_consistent_jsonb(internal, smallint, anyarray, integer, internal, internal, internal, internal) boolean' on db.
func GinConsistentJsonb(db XODB, v0 pgtypes.Internal, v1 int16, v2 pgtypes.Anyarray, v3 int, v4 pgtypes.Internal, v5 pgtypes.Internal, v6 pgtypes.Internal, v7 pgtypes.Internal) (bool, error) | {
var err error
// sql query
const sqlstr = `SELECT pg_catalog.gin_consistent_jsonb($1, $2, $3, $4, $5, $6, $7, $8)`
// run query
var ret bool
XOLog(sqlstr, v0, v1, v2, v3, v4, v5, v6, v7)
err = db.QueryRow(sqlstr, v0, v1, v2, v3, v4, v5, v6, v7).Scan(&ret)
if err != nil {
return false, err
}
return ret, nil
} |
xo/xo | 1a94fa516029cb306cce6d379d086e4d5b5bb232 | examples/pgcatalog/pgcatalog/pgcatalog.xo.go | https://github.com/xo/xo/blob/1a94fa516029cb306cce6d379d086e4d5b5bb232/examples/pgcatalog/pgcatalog/pgcatalog.xo.go#L11371-L11386 | go | train | // GinExtractTsquery calls the stored procedure 'pg_catalog.gin_extract_tsquery(tsquery, internal, smallint, internal, internal, tsquery, internal, smallint, internal, internal, internal, internal) internal' on db. | func GinExtractTsquery(db XODB, v0 pgtypes.Tsquery, v1 pgtypes.Internal, v2 int16, v3 pgtypes.Internal, v4 pgtypes.Internal, v5 pgtypes.Tsquery, v6 pgtypes.Internal, v7 int16, v8 pgtypes.Internal, v9 pgtypes.Internal, v10 pgtypes.Internal, v11 pgtypes.Internal) (pgtypes.Internal, error) | // GinExtractTsquery calls the stored procedure 'pg_catalog.gin_extract_tsquery(tsquery, internal, smallint, internal, internal, tsquery, internal, smallint, internal, internal, internal, internal) internal' on db.
func GinExtractTsquery(db XODB, v0 pgtypes.Tsquery, v1 pgtypes.Internal, v2 int16, v3 pgtypes.Internal, v4 pgtypes.Internal, v5 pgtypes.Tsquery, v6 pgtypes.Internal, v7 int16, v8 pgtypes.Internal, v9 pgtypes.Internal, v10 pgtypes.Internal, v11 pgtypes.Internal) (pgtypes.Internal, error) | {
var err error
// sql query
const sqlstr = `SELECT pg_catalog.gin_extract_tsquery($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12)`
// run query
var ret pgtypes.Internal
XOLog(sqlstr, v0, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11)
err = db.QueryRow(sqlstr, v0, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11).Scan(&ret)
if err != nil {
return pgtypes.Internal{}, err
}
return ret, nil
} |
xo/xo | 1a94fa516029cb306cce6d379d086e4d5b5bb232 | examples/pgcatalog/pgcatalog/pgcatalog.xo.go | https://github.com/xo/xo/blob/1a94fa516029cb306cce6d379d086e4d5b5bb232/examples/pgcatalog/pgcatalog/pgcatalog.xo.go#L11443-L11458 | go | train | // GinTsqueryConsistent calls the stored procedure 'pg_catalog.gin_tsquery_consistent(internal, smallint, tsquery, integer, internal, internal, internal, smallint, tsquery, integer, internal, internal, internal, internal) boolean' on db. | func GinTsqueryConsistent(db XODB, v0 pgtypes.Internal, v1 int16, v2 pgtypes.Tsquery, v3 int, v4 pgtypes.Internal, v5 pgtypes.Internal, v6 pgtypes.Internal, v7 int16, v8 pgtypes.Tsquery, v9 int, v10 pgtypes.Internal, v11 pgtypes.Internal, v12 pgtypes.Internal, v13 pgtypes.Internal) (bool, error) | // GinTsqueryConsistent calls the stored procedure 'pg_catalog.gin_tsquery_consistent(internal, smallint, tsquery, integer, internal, internal, internal, smallint, tsquery, integer, internal, internal, internal, internal) boolean' on db.
func GinTsqueryConsistent(db XODB, v0 pgtypes.Internal, v1 int16, v2 pgtypes.Tsquery, v3 int, v4 pgtypes.Internal, v5 pgtypes.Internal, v6 pgtypes.Internal, v7 int16, v8 pgtypes.Tsquery, v9 int, v10 pgtypes.Internal, v11 pgtypes.Internal, v12 pgtypes.Internal, v13 pgtypes.Internal) (bool, error) | {
var err error
// sql query
const sqlstr = `SELECT pg_catalog.gin_tsquery_consistent($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13, $14)`
// run query
var ret bool
XOLog(sqlstr, v0, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13)
err = db.QueryRow(sqlstr, v0, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13).Scan(&ret)
if err != nil {
return false, err
}
return ret, nil
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.