code stringlengths 114 1.05M | path stringlengths 3 312 | quality_prob float64 0.5 0.99 | learning_prob float64 0.2 1 | filename stringlengths 3 168 | kind stringclasses 1 value |
|---|---|---|---|---|---|
package neuralnetwork
import (
m64 "math"
"gonum.org/v1/gonum/blas/blas32"
"gonum.org/v1/gonum/blas/blas64"
m32 "github.com/chewxy/math32"
)
type floatXX = float32
// M32 has funcs for float32 math
var M32 = struct {
Ceil func(float32) float32
Sqrt func(float32) float32
Pow func(float32, float32) float32
IsInf func(float32, int) bool
Abs func(float32) float32
Exp func(float32) float32
Tanh func(float32) float32
Log func(float32) float32
Log1p func(float32) float32
MaxFloat32 float32
Inf func(int) float32
IsNaN func(float32) bool
Nextafter func(x, y float32) float32
MaxFloatXX floatXX
}{
Ceil: m32.Ceil, Sqrt: m32.Sqrt, Pow: m32.Pow, IsInf: m32.IsInf, Abs: m32.Abs, Exp: m32.Exp, Tanh: m32.Tanh, Log: m32.Log, Log1p: m32.Log1p,
MaxFloat32: m32.MaxFloat32, Inf: m32.Inf, IsNaN: m32.IsNaN, Nextafter: m32.Nextafter, MaxFloatXX: m32.MaxFloat32}
// M64 has funcs for float64 math
var M64 = struct {
Ceil func(float64) float64
Sqrt func(float64) float64
Pow func(float64, float64) float64
IsInf func(float64, int) bool
Abs func(float64) float64
Exp func(float64) float64
Tanh func(float64) float64
Log func(float64) float64
Log1p func(float64) float64
MaxFloat64 float64
Inf func(int) float64
IsNaN func(float64) bool
Nextafter func(x, y float64) float64
}{Ceil: m64.Ceil, Sqrt: m64.Sqrt, Pow: m64.Pow, IsInf: m64.IsInf, Abs: m64.Abs, Exp: m64.Exp, Tanh: m64.Tanh, Log: m64.Log, Log1p: m64.Log1p,
MaxFloat64: m64.MaxFloat64, Inf: m64.Inf, IsNaN: m64.IsNaN, Nextafter: m64.Nextafter}
// MXX has funcs for floatXX math
var MXX = M32
type blas32Vector = blas32.Vector
type blas64Vector = blas64.Vector
type blasXXVector = blas32.Vector
func dot32(n, xinc, yinc int, x, y []float32) float32 {
return blas32.Dot(blas32.Vector{N: n, Inc: xinc, Data: x}, blas32.Vector{Inc: yinc, Data: y})
}
func dot64(n, xinc, yinc int, x, y []float64) float64 {
return blas64.Dot(blas64.Vector{N: n, Inc: xinc, Data: x}, blas64.Vector{N: n, Inc: yinc, Data: y})
}
var gemm32 = blas32.Gemm
var gemm64 = blas64.Gemm
// axpy32 adds x scaled by alpha to y:
// y[i] += alpha*x[i] for all i.
func axpy32(n int, alpha float32, X, Y []float32) {
blas32.Axpy(alpha, blas32.Vector{N: n, Inc: 1, Data: X}, blas32.Vector{N: n, Inc: 1, Data: Y})
}
// axpy64 adds x scaled by alpha to y:
// y[i] += alpha*x[i] for all i.
func axpy64(n int, alpha float64, X, Y []float64) {
blas64.Axpy(alpha, blas64.Vector{N: n, Data: X, Inc: 1}, blas64.Vector{N: n, Data: Y, Inc: 1})
}
// MaxIdx32 ...
func MaxIdx32(a []float32) int {
var mi int
for i := range a {
if a[i] > a[mi] {
mi = i
}
}
return mi
}
// MaxIdx64 ...
func MaxIdx64(a []float64) int {
var mi int
for i := range a {
if a[i] > a[mi] {
mi = i
}
}
return mi
}
// MaxIdxXX ...
var MaxIdxXX = MaxIdx32
var toLogitsXX = toLogits32 | neural_network/mathCompat.go | 0.691185 | 0.622258 | mathCompat.go | starcoder |
package main
import (
"fmt"
)
const (
Vertical = 0x01
Horizontal = 0x02
DiagonalRight = 0x04
DiagonalLeft = 0x08
)
func mulSequence(sequence []int) (res uint64) {
res = 1
for _, i := range sequence {
res *= uint64(i)
}
return
}
func indexToCoords(i int, width int) (x int, y int) {
return i / width, i % width
}
func coordsToIndex(x int, y int, width int) int {
return y*width + x
}
func checkDiagonalRight(x int, y int, seqLength int, grid []int, width int, height int) (mul uint64, sequence []int) {
sequence = make([]int, 0, seqLength)
for di := 0; di < seqLength; di++ {
if x+di >= width || y+di >= height {
return
}
sequence = append(sequence, grid[coordsToIndex(x+di, y+di, width)])
}
mul = mulSequence(sequence)
return
}
func checkDiagonalLeft(x int, y int, seqLength int, grid []int, width int, height int) (mul uint64, sequence []int) {
sequence = make([]int, 0, seqLength)
for di := 0; di < seqLength; di++ {
if x-di < 0 || y+di >= height {
return
}
sequence = append(sequence, grid[coordsToIndex(x-di, y+di, width)])
}
mul = mulSequence(sequence)
return
}
func checkVertical(x int, y int, seqLength int, grid []int, width int, height int) (mul uint64, sequence []int) {
sequence = make([]int, 0, seqLength)
for di := 0; di < seqLength; di++ {
if y+di >= height {
return
}
sequence = append(sequence, grid[coordsToIndex(x, y+di, width)])
}
mul = mulSequence(sequence)
return
}
func checkHorizontal(x int, y int, seqLength int, grid []int, width int, height int) (mul uint64, sequence []int) {
sequence = make([]int, 0, seqLength)
for di := 0; di < seqLength; di++ {
if x+di >= width {
return
}
sequence = append(sequence, grid[coordsToIndex(x+di, y, width)])
}
mul = mulSequence(sequence)
return
}
func naive(orientation int, seqLength int, grid []int, width int, height int) (maxMul uint64, maxSequence []int) {
if width*height != len(grid) {
panic("bad dimensions of the grid.")
}
maxSequence = make([]int, seqLength)
for i, _ := range grid {
x, y := indexToCoords(i, width)
if orientation&DiagonalRight != 0 {
mul, sequence := checkDiagonalRight(x, y, seqLength, grid, width, height)
if mul > maxMul {
maxMul = mul
copy(maxSequence, sequence)
}
}
if orientation&DiagonalLeft != 0 {
mul, sequence := checkDiagonalLeft(x, y, seqLength, grid, width, height)
if mul > maxMul {
maxMul = mul
copy(maxSequence, sequence)
}
}
if orientation&Vertical != 0 {
mul, sequence := checkVertical(x, y, seqLength, grid, width, height)
if mul > maxMul {
maxMul = mul
copy(maxSequence, sequence)
}
}
if orientation&Horizontal != 0 {
mul, sequence := checkHorizontal(x, y, seqLength, grid, width, height)
if mul > maxMul {
maxMul = mul
copy(maxSequence, sequence)
}
}
}
return
}
/*
source : https://projecteuler.net/problem=11
In the 20×20 grid below, four numbers along a diagonal line have been marked in red.
The product of these numbers is 26 × 63 × 78 × 14 = 1788696.
What is the greatest product of four adjacent numbers in the same direction (up, down, left, right, or diagonally) in the 20×20 grid?
*/
func main() {
grid := []int{
8, 2, 22, 97, 38, 15, 0, 40, 0, 75, 4, 5, 7, 78, 52, 12, 50, 77, 91, 8,
49, 49, 99, 40, 17, 81, 18, 57, 60, 87, 17, 40, 98, 43, 69, 48, 04, 56, 62, 0,
81, 49, 31, 73, 55, 79, 14, 29, 93, 71, 40, 67, 53, 88, 30, 3, 49, 13, 36, 65,
52, 70, 95, 23, 4, 60, 11, 42, 69, 24, 68, 56, 1, 32, 56, 71, 37, 2, 36, 91,
22, 31, 16, 71, 51, 67, 63, 89, 41, 92, 36, 54, 22, 40, 40, 28, 66, 33, 13, 80,
24, 47, 32, 60, 99, 3, 45, 2, 44, 75, 33, 53, 78, 36, 84, 20, 35, 17, 12, 50,
32, 98, 81, 28, 64, 23, 67, 10, 26, 38, 40, 67, 59, 54, 70, 66, 18, 38, 64, 70,
67, 26, 20, 68, 2, 62, 12, 20, 95, 63, 94, 39, 63, 8, 40, 91, 66, 49, 94, 21,
24, 55, 58, 5, 66, 73, 99, 26, 97, 17, 78, 78, 96, 83, 14, 88, 34, 89, 63, 72,
21, 36, 23, 9, 75, 0, 76, 44, 20, 45, 35, 14, 0, 61, 33, 97, 34, 31, 33, 95,
78, 17, 53, 28, 22, 75, 31, 67, 15, 94, 3, 80, 4, 62, 16, 14, 9, 53, 56, 92,
16, 39, 5, 42, 96, 35, 31, 47, 55, 58, 88, 24, 0, 17, 54, 24, 36, 29, 85, 57,
86, 56, 0, 48, 35, 71, 89, 7, 5, 44, 44, 37, 44, 60, 21, 58, 51, 54, 17, 58,
19, 80, 81, 68, 5, 94, 47, 69, 28, 73, 92, 13, 86, 52, 17, 77, 4, 89, 55, 40,
04, 52, 8, 83, 97, 35, 99, 16, 7, 97, 57, 32, 16, 26, 26, 79, 33, 27, 98, 66,
88, 36, 68, 87, 57, 62, 20, 72, 3, 46, 33, 67, 46, 55, 12, 32, 63, 93, 53, 69,
04, 42, 16, 73, 38, 25, 39, 11, 24, 94, 72, 18, 8, 46, 29, 32, 40, 62, 76, 36,
20, 69, 36, 41, 72, 30, 23, 88, 34, 62, 99, 69, 82, 67, 59, 85, 74, 4, 36, 16,
20, 73, 35, 29, 78, 31, 90, 1, 74, 31, 49, 71, 48, 86, 81, 16, 23, 57, 5, 54,
01, 70, 54, 71, 83, 51, 54, 69, 16, 92, 33, 48, 61, 43, 52, 1, 89, 19, 67, 48,
}
res, sequence := naive(Horizontal|Vertical|DiagonalLeft|DiagonalRight, 4, grid, 20, 20)
fmt.Println(res, sequence)
} | 11-largest-product-in-a-grid/main.go | 0.816736 | 0.513059 | main.go | starcoder |
package tree
import (
"github.com/algorithms-examples/queue"
"github.com/algorithms-examples/stack"
)
//Visitor interface to visit nodes while traversing the tree.
type Visitor interface {
visit(Value interface{})
}
// TraverseRecursivelyNLR is a pre-order traverse.
// Access the data part of the current node.
// Traverse the left subtree by recursively calling the pre-order function.
// Traverse the right subtree by recursively calling the pre-order function.
// The pre-order traversal is a topologically sorted one, because a parent node is processed before any of its child nodes is done.
func TraverseRecursivelyNLR(n *Node, visitor Visitor) {
if n != nil {
visitor.visit(n.Value)
TraverseRecursivelyNLR(n.Left, visitor)
TraverseRecursivelyNLR(n.Right, visitor)
}
}
// TraverseRecursivelyLRN is a post-order traverse.
// Traverse the left subtree by recursively calling the post-order function.
// Traverse the right subtree by recursively calling the post-order function.
// Access the data part of the current node.
func TraverseRecursivelyLRN(n *Node, visitor Visitor) {
if n != nil {
TraverseRecursivelyLRN(n.Left, visitor)
TraverseRecursivelyLRN(n.Right, visitor)
visitor.visit(n.Value)
}
}
// TraverseRecursivelyLNR is a in-order traverse.
// Traverse the left subtree by recursively calling the in-order function.
// Access the data part of the current node.
// Traverse the right subtree by recursively calling the in-order function.
// In a binary search tree ordered such that in each node the key is greater than all keys in its left subtree and less than all keys in its right subtree,
// in-order traversal retrieves the keys in ascending sorted order.
func TraverseRecursivelyLNR(n *Node, visitor Visitor) {
if n != nil {
TraverseRecursivelyLNR(n.Left, visitor)
visitor.visit(n.Value)
TraverseRecursivelyLNR(n.Right, visitor)
}
}
func toNode(v interface{}) *Node {
node, ok := v.(*Node)
if !ok {
panic("value is not *Node")
}
return node
}
// TraverseNLR is a pre-order traverse using stack instead of recursion.
func TraverseNLR(n *Node, visitor Visitor) {
stack := stack.Stack{}
currNode := n
for currNode != nil {
if currNode.Right != nil {
stack.Push(currNode.Right)
}
if currNode.Left != nil {
stack.Push(currNode.Left)
}
visitor.visit(currNode.Value.(int))
if !stack.IsEmpty() {
currNode = toNode(stack.Pop())
} else {
currNode = nil
}
}
}
func toNodeWrapper(v interface{}) *nodeWrapper {
n, ok := v.(*nodeWrapper)
if !ok {
panic("value is not *Node")
}
return n
}
type nodeWrapper struct {
n *Node
ready bool
}
func traverse(n *Node, visitor Visitor, nodeInserter func(currNodeWrap *nodeWrapper, stack *stack.Stack)) {
stack := stack.Stack{}
stack.Push(&nodeWrapper{n, false})
for !stack.IsEmpty() {
currNodeWrap := toNodeWrapper(stack.Pop())
if currNodeWrap.ready || currNodeWrap.n.Left == nil && currNodeWrap.n.Right == nil {
visitor.visit(currNodeWrap.n.Value.(int))
} else {
nodeInserter(currNodeWrap, &stack)
}
}
}
// TraverseLRN is a post-order traverse using stack instead of recursion.
func TraverseLRN(n *Node, visitor Visitor) {
traverse(n, visitor, func(currNodeWrap *nodeWrapper, stack *stack.Stack) {
currNodeWrap.ready = true
stack.Push(currNodeWrap)
if currNodeWrap.n.Right != nil {
stack.Push(&nodeWrapper{currNodeWrap.n.Right, false})
}
if currNodeWrap.n.Left != nil {
stack.Push(&nodeWrapper{currNodeWrap.n.Left, false})
}
})
}
// TraverseLNR is a in-order traverse using stack instead of recursion.
func TraverseLNR(n *Node, visitor Visitor) {
traverse(n, visitor, func(currNodeWrap *nodeWrapper, stack *stack.Stack) {
if currNodeWrap.n.Right != nil {
stack.Push(&nodeWrapper{currNodeWrap.n.Right, false})
}
currNodeWrap.ready = true
stack.Push(currNodeWrap)
if currNodeWrap.n.Left != nil {
stack.Push(&nodeWrapper{currNodeWrap.n.Left, false})
}
})
}
//TraverseBFS is a breadth-first search, which visits every node on a level before going to a lower level.
func TraverseBFS(n *Node, visitor Visitor) {
queue := queue.Queue{}
currNode := n
for currNode != nil {
if currNode.Left != nil {
queue.Push(currNode.Left)
}
if currNode.Right != nil {
queue.Push(currNode.Right)
}
visitor.visit(currNode.Value.(int))
if !queue.IsEmpty() {
currNode = toNode(queue.Pop())
} else {
currNode = nil
}
}
} | tree/traverser.go | 0.682362 | 0.513485 | traverser.go | starcoder |
package c4
import (
"bytes"
"crypto/sha512"
"io"
"math/bits"
"strings"
)
// `Tree` implements an ID tree as used for calculating IDs of non-contiguous
// sets of data. A C4 ID Tree is a type of merkle tree except that the list
// of IDs is sorted. According to the standard this is done to insure that
// two identical lists of IDs always resolve to the same ID.
type Tree []byte
// NewTree creates a new Tree from a DigestSlice, and copies the digests into
// the tree. However, it does not compute the tree.
func NewTree(s []ID) Tree {
size := 1
for l := len(s); l > 1; l = (l + 1) / 2 {
size += l
}
data := make([]byte, size*64)
offset := len(data) - len(s)*64
for i, id := range s {
copy(data[offset+i*64:], id[:])
}
return Tree(data)
}
func ReadTree(r io.Reader) (Tree, error) {
tree := make(Tree, 3*64)
// If the first 192 bytes are not 3 valid digests this is not a tree.
n, err := r.Read(tree)
if err != nil {
return nil, err
}
if n != len(tree) {
return nil, errInvalidTree{}
}
head := make([]ID, 3)
for i := range head {
copy(head[i][:], tree[i*64:])
}
root := head[1].Sum(head[2])
if root.Cmp(head[0]) != 0 {
return nil, errInvalidTree{}
}
buffer := make([]byte, 4096)
for err != io.EOF {
n, err = r.Read(buffer)
if err != nil && err != io.EOF {
return nil, err
}
tree = append(tree, buffer[:n]...)
}
// tree.rows = buildRows(tree)
return tree, nil
}
// Compute resolves all Digests in the tree, and returns the root Digest
func (t Tree) compute() (id ID) {
h := sha512.New()
rows := buildRows(t)
for i := len(rows) - 2; i >= 0; i-- {
l := len(rows[i+1])
for j := 0; j < l; j += 64 * 2 {
jj := j / 2
if j+64 >= l {
copy(rows[i][jj:], rows[i+1][j:j+64])
} else {
h.Reset()
if bytes.Compare(rows[i+1][j:j+64], rows[i+1][j+64:j+64*2]) == 1 {
h.Write(rows[i+1][j+64 : j+64*2])
h.Write(rows[i+1][j : j+64])
} else {
h.Write(rows[i+1][j : j+64*2])
}
copy(rows[i][jj:], h.Sum(nil)[0:64])
}
}
}
copy(id[:], t)
return id
}
func (t Tree) String() string {
var b strings.Builder
var id ID
if !t.valid() {
t.compute()
}
for i := 0; i < len(t); i += 64 {
copy(id[:], t[i:])
b.WriteString(id.String())
}
return b.String()
}
func (t Tree) valid() bool {
for _, b := range t[:64] {
if b != 0 {
return true
}
}
return false
}
// Bytes returns the tree as a slice of bytes.
func (t Tree) Bytes() []byte {
if !t.valid() {
t.compute()
}
return t
}
// Number of IDs in the list (i.e. the length of the bottom row of the tree).
func (t Tree) Len() int {
return listSize(len(t) / 64)
}
// The ID of the list (i.e. the level 0 of the tree).
func (t Tree) ID() (id ID) {
if !t.valid() {
return t.compute()
}
copy(id[:], t)
return id
}
func buildRows(data []byte) [][]byte {
length := len(data) / 64
w := listSize(length)
s := length - w
r := 1
for l := w; l > 1; l = (l + 1) / 2 {
r++
}
rows := make([][]byte, r)
i := len(rows) - 1
for range rows {
row := data[s*64 : (s+w)*64]
rows[i] = row
w = (w + 1) / 2
s -= w
i--
}
return rows
}
// listSize computes the length of the list represented by a
// tree given `total` number of branchs in the tree.
func listSize(total int) int {
// Given that:
// total >= 2*len(list)-1
// and
// total <= 2*len(list)-1+log2(len(list))
// The range of possible values for length are:
max := (total + 1) / 2
// min := max - log2(total)
min := max - bits.Len(uint(total))
if treeSize(min) == total {
return min
}
if treeSize(max) == total {
return max
}
// If not min or max, then we simply binary search for the matching size.
for {
length := (min + max) / 2
t := treeSize(length)
// fmt.Printf("listSize min, max, length, t: %d, %d, %d, %d\n", min, max, length, t)
if t == total {
return length
}
if t > total {
max = length
continue
}
if t < total {
min = length
continue
}
return length
}
}
// treeSize computes the total number of branchs required to represent
// a list of length `l` elements.
func treeSize(l int) int {
// Account for the root branch
total := 1
for ; l > 1; l = (l + 1) / 2 {
total = total + l
}
return total
}
// Left
// r = row + 1
// i = i * 2
// Right
// r = row + 1
// i = (i+1)*2 | tree.go | 0.755817 | 0.439447 | tree.go | starcoder |
package logic
import (
"math"
"math/rand"
)
// Representations for infinity for minimax algorithm.
const (
NegativeInfinity int64 = math.MinInt64
PositiveInfinity int64 = math.MaxInt64
)
// Move returns the best move based on the current boardstate board.
func (b Board) Move(n *Node) (xpos int, ypos int) {
var (
board [3][3]int
lowest int64 = 0
)
for _, child := range n.Children {
if child.Weight-heuristic(child) < lowest {
lowest = child.Weight
board = child.Value
}
}
var x, y int = pos(n.Value, board)
for {
if available(convert(b.Matrix), x, y) {
break
}
x, y = rand.Intn(3), rand.Intn(3)
}
return x, y
}
// Find finds the current boardstate.
func Find(node *Node, b [][]int) *Node {
for _, child := range node.Children {
node := Find(child, b)
if node.Value == convert(b) {
return node
}
}
return node
}
// available checks whether or not a position is available.
func available(board [3][3]int, row int, col int) bool {
if board[row][col] == EMPTY {
return true
}
return false
}
// convert converts a slice to an array.
func convert(b [][]int) (dest [3][3]int) {
for row := 0; row < 3; row++ {
for col := 0; col < 3; col++ {
dest[row][col] = b[row][col]
}
}
return dest
}
// pos returns the new coordinate pair for the chosen board.
func pos(old [3][3]int, new [3][3]int) (x int, y int) {
for row := 0; row < 3; row++ {
for col := 0; col < 3; col++ {
if old[row][col] != new[row][col] {
return row, col
}
}
}
return -1, -1
}
// heuristic is a function for modifying the value of a child node based on conditions that will lead to a win.
func heuristic(n *Node) int64 {
if len(n.Children) == 7 && n.Value[1][1] == O {
return 500
}
if block(n.Value) {
return 15
}
return 0
}
// block checks for whether or not a child node blocks X from winning.
func block(b [3][3]int) bool {
for i := 0; i < 3; i++ {
// -------------------------------------------------------
// Rows
if b[i][0] == X && b[i][1] == X && b[i][2] == O {
return true
}
if b[i][0] == O && b[i][1] == X && b[i][2] == X {
return true
}
if b[i][0] == X && b[i][1] == O && b[i][2] == X {
return true
}
// -------------------------------------------------------
// Columns
if b[0][i] == X && b[1][i] == O && b[2][i] == X {
return true
}
if b[0][i] == O && b[1][i] == X && b[2][i] == X {
return true
}
if b[0][i] == X && b[1][i] == X && b[2][i] == O {
return true
}
}
// -------------------------------------------------------
// Diagonals
if b[0][0] == X && b[1][1] == X && b[2][2] == O {
return true
}
if b[0][0] == X && b[1][1] == O && b[2][2] == X {
return true
}
if b[0][0] == O && b[1][1] == X && b[2][2] == X {
return true
}
if b[2][0] == X && b[1][1] == X && b[0][2] == O {
return true
}
if b[2][0] == X && b[1][1] == O && b[0][2] == X {
return true
}
if b[2][0] == O && b[1][1] == X && b[0][2] == X {
return true
}
return false
} | src/logic/ai.go | 0.725357 | 0.463444 | ai.go | starcoder |
package gfx
import (
"image"
"image/color"
"image/draw"
"math"
)
// Triangle is an array of three vertexes
type Triangle [3]Vertex
// NewTriangle creates a new triangle.
func NewTriangle(i int, td *TrianglesData) Triangle {
var t Triangle
t[0].Position = td.Position(i)
t[1].Position = td.Position(i + 1)
t[2].Position = td.Position(i + 2)
t[0].Color = td.Color(i)
t[1].Color = td.Color(i + 1)
t[2].Color = td.Color(i + 2)
return t
}
// T constructs a new triangle based on three vertexes.
func T(a, b, c Vertex) Triangle {
return Triangle{a, b, c}
}
// Positions returns the three positions.
func (t Triangle) Positions() (Vec, Vec, Vec) {
return t[0].Position, t[1].Position, t[2].Position
}
// Colors returns the three colors.
func (t Triangle) Colors() (color.NRGBA, color.NRGBA, color.NRGBA) {
return t[0].Color, t[1].Color, t[2].Color
}
// Bounds returns the bounds of the triangle.
func (t Triangle) Bounds() image.Rectangle {
return t.Rect().Bounds()
}
// Rect returns the triangle Rect.
func (t Triangle) Rect() Rect {
a, b, c := t.Positions()
return R(
math.Min(a.X, math.Min(b.X, c.X)),
math.Min(a.Y, math.Min(b.Y, c.Y)),
math.Max(a.X, math.Max(b.X, c.X)),
math.Max(a.Y, math.Max(b.Y, c.Y)),
)
}
// Color returns the color at vector u.
func (t Triangle) Color(u Vec) color.Color {
o := t.Centroid()
if triangleContains(u, t[0].Position, t[1].Position, o) {
return t[1].Color
}
if triangleContains(u, t[1].Position, t[2].Position, o) {
return t[2].Color
}
return t[0].Color
}
// Contains returns true if the given vector is inside the triangle.
func (t Triangle) Contains(u Vec) bool {
a, b, c := t.Positions()
vs1 := b.Sub(a)
vs2 := c.Sub(a)
q := u.Sub(a)
bs := q.Cross(vs2) / vs1.Cross(vs2)
bt := vs1.Cross(q) / vs1.Cross(vs2)
return bs >= 0 && bt >= 0 && bs+bt <= 1
}
func triangleContains(u, a, b, c Vec) bool {
vs1 := b.Sub(a)
vs2 := c.Sub(a)
q := u.Sub(a)
bs := q.Cross(vs2) / vs1.Cross(vs2)
bt := vs1.Cross(q) / vs1.Cross(vs2)
return bs >= 0 && bt >= 0 && bs+bt <= 1
}
// Centroid returns the centroid O of the triangle.
func (t Triangle) Centroid() Vec {
a, b, c := t.Positions()
return V(
(a.X+b.X+c.X)/3,
(a.Y+b.Y+c.Y)/3,
)
}
// TriangleFunc is a function type that is called by Triangle.EachPixel
type TriangleFunc func(u Vec, t Triangle)
// EachPixel calls the given TriangleFunc for each pixel in the triangle.
func (t Triangle) EachPixel(tf TriangleFunc) {
b := t.Bounds()
for x := b.Min.X; x < b.Max.X; x++ {
for y := b.Min.Y; y < b.Max.Y; y++ {
if u := IV(x, y); t.Contains(u) {
tf(u, t)
}
}
}
}
// Draw the first color in the triangle to dst.
func (t Triangle) Draw(dst draw.Image) (drawCount int) {
a, _, _ := t.Colors()
return t.DrawColor(dst, a)
}
// DrawOver draws the first color in the triangle over dst.
func (t Triangle) DrawOver(dst draw.Image) (drawCount int) {
a, _, _ := t.Colors()
return t.DrawColorOver(dst, a)
}
// DrawColor draws the triangle on dst using the given color.
func (t Triangle) DrawColor(dst draw.Image, c color.Color) (drawCount int) {
return t.drawColor(dst, c, draw.Src)
}
// DrawColorOver draws the triangle over dst using the given color.
func (t Triangle) DrawColorOver(dst draw.Image, c color.Color) (drawCount int) {
return t.drawColor(dst, c, draw.Over)
}
func (t Triangle) drawColor(dst draw.Image, c color.Color, op draw.Op) (drawCount int) {
b := t.Bounds()
var lefts, rights []Vec
var invalid = V(-math.MaxInt64, 0)
for y := b.Min.Y; y < b.Max.Y; y++ {
var left, right = invalid, invalid
for x := b.Min.X; x < b.Max.X; x++ {
if u := IV(x, y); t.Contains(u) {
left = u
break
}
}
for x := b.Max.X; x > b.Min.X; x-- {
if u := IV(x, y); t.Contains(u) {
right = u
break
}
}
if left != invalid && right != invalid {
lefts = append(lefts, left)
rights = append(rights, right)
}
}
uc := NewUniform(c)
for i := 0; i < len(lefts); i++ {
r := NewRect(lefts[i], rights[i].AddXY(0, 1)).Bounds()
draw.Draw(dst, r, uc, ZP, op)
drawCount++
}
return drawCount
}
// DrawWireframe draws the triangle as a wireframe on dst.
func (t Triangle) DrawWireframe(dst draw.Image, c color.Color) (drawCount int) {
if l := t[0].Position.To(t[1].Position).Len(); l > 25 {
DrawLine(dst, t[0].Position, t[1].Position, l/50, ColorWithAlpha(c, 128))
drawCount++
}
if l := t[1].Position.To(t[2].Position).Len(); l > 25 {
DrawLine(dst, t[1].Position, t[2].Position, l/50, ColorWithAlpha(c, 128))
drawCount++
}
if l := t[0].Position.To(t[2].Position).Len(); l > 25 {
DrawLine(dst, t[0].Position, t[2].Position, l/50, ColorWithAlpha(c, 128))
drawCount++
}
DrawLine(dst, t[0].Position, t[1].Position, 1, c)
DrawLine(dst, t[1].Position, t[2].Position, 1, c)
DrawLine(dst, t[0].Position, t[2].Position, 1, c)
drawCount += 3
return
} | vendor/github.com/peterhellberg/gfx/triangle.go | 0.842248 | 0.614741 | triangle.go | starcoder |
package wavesplatform
import (
"bytes"
"crypto/rand"
"crypto/sha256"
"crypto/sha512"
"encoding/base64"
"hash"
"strings"
"github.com/agl/ed25519"
"github.com/agl/ed25519/edwards25519"
"github.com/mr-tron/base58"
"github.com/tyler-smith/go-bip39"
"golang.org/x/crypto/blake2b"
"golang.org/x/crypto/sha3"
)
// Bytes is a type alias for the slice of bytes.
type Bytes []byte
// PublicKey is a string representation of a public key bytes in form of BASE58 string.
type PublicKey string
// PrivateKey is a string representation of a private key in form of BASE58 string.
type PrivateKey string
// Seed is a BIP39 seed phrase.
type Seed string
// Address is a string representation of Waves address in form of BASE58 string.
type Address string
// KeyPair is an interface to a structure that holds corresponding private and public keys.
type KeyPair struct {
PublicKey PublicKey
PrivateKey PrivateKey
}
// WavesChainID is a byte to represent blockchain identification.
type WavesChainID byte
// Known chain IDs
const (
MainNet WavesChainID = 'W'
TestNet WavesChainID = 'T'
)
// The lengths of basic crypto primitives.
const (
PublicKeyLength = 32
PrivateKeyLength = 32
DigestLength = 32
SignatureLength = 64
addressVersion byte = 0x01
headerSize = 2
bodySize = 20
checksumSize = 4
addressSize = headerSize + bodySize + checksumSize
seedBitSize = 160
seedWordsCount = 15
)
// WavesCrypto is a collection of functions to work with Waves basic types and crypto primitives used by Waves.
type WavesCrypto interface {
Blake2b(input Bytes) Bytes // Blake2b produces the BLAKE2b-256 digest of the given `input`.
Keccak(input Bytes) Bytes // Keccak creates a new legacy Keccak-256 hash digest of the `input`.
Sha256(input Bytes) Bytes // Sha256 returns a new SHA256 checksum calculated from the `input`.
Base58Encode(input Bytes) string // Base58Encode encodes the `input` into a BASE58 string.
Base58Decode(input string) Bytes // Base58Decode decodes the `input` string to bytes.
Base64Encode(input Bytes) string // Base64Encode returns a BASE64 string representation of the `input` bytes.
Base64Decode(input string) Bytes // Base64Decode decodes the `input` BASE64 string to bytes.
KeyPair(seed Seed) KeyPair // KeyPair returns a pair of keys produced from the `seed`.
PublicKey(seed Seed) PublicKey // PublicKey returns a public key generated from the `seed`.
PrivateKey(seed Seed) PrivateKey // PrivateKey generates a private key from the given `seed`.
Address(publicKey PublicKey, chainID WavesChainID) Address // Address generates new Waves address from the `publicKey` and `chainID`.
AddressFromSeed(seed Seed, chainID WavesChainID) Address // AddressFromSeed returns a new Waves address produced from the `seed` and `chainID`.
RandomSeed() Seed // RandomSeed return a new randomly generated BIP39 seed phrase.
VerifySeed(seed Seed) bool // Checks the seed parameters
SignBytes(bytes Bytes, privateKey PrivateKey) Bytes // SignBytes produces a signature for the `bytes` by `privateKey`.
SignBytesBySeed(bytes Bytes, seed Seed) Bytes // SignBytesBySeed returns a signature for the `bytes` by a private keys generated from the `seed`.~``
VerifySignature(publicKey PublicKey, bytes, signature Bytes) bool // VerifySignature returns true if `signature` is a valid signature of `bytes` by `publicKey`.
VerifyAddress(address Address, chainID WavesChainID) bool // VerifyAddress returns true if `address` is a valid Waves address for the given `chainId`. Function calls the `VerifyAddressChecksum` function.
VerifyAddressChecksum(address Address) bool // VerifyAddressChecksum calculates and compares the `address` checksum. Returns `true` if the checksum is correct.
}
type crypto struct {
blake hash.Hash
keccak hash.Hash
}
// NewWavesCrypto returns a new instance of WavesCrypto interface.
func NewWavesCrypto() WavesCrypto {
h1, err := blake2b.New256(nil)
// An error happens only if the passed array is bigger then the hash size. Here we pass empty array so the error is impossible.
if err != nil {
panic(err)
}
h2 := sha3.NewLegacyKeccak256()
return &crypto{
blake: h1,
keccak: h2,
}
}
// Blake2b function produces the BLAKE2b-256 digest of the given `input` bytes.
// In case of an error the function will panic.
func (c *crypto) Blake2b(input Bytes) Bytes {
result := make([]byte, DigestLength)
c.blake.Reset()
c.blake.Write(input)
c.blake.Sum(result[:0])
return result
}
// Keccak function creates a legacy Keccak-256 hash digest of the `input` bytes.
func (c *crypto) Keccak(input Bytes) Bytes {
result := make([]byte, DigestLength)
c.keccak.Reset()
c.keccak.Write(input)
c.keccak.Sum(result[:0])
return result
}
// Sha256 return SHA256 digest calculated of the `input`.
func (c *crypto) Sha256(input Bytes) Bytes {
result := make([]byte, DigestLength)
h := sha256.New()
h.Write(input)
h.Sum(result[:0])
return result
}
// Base58Encode returns the `input` bytes encoded as BASE58 string.
func (c *crypto) Base58Encode(input Bytes) string {
return base58.Encode(input)
}
// Base58Decode decodes the `input` string into slice of bytes. Invalid input will be decoded to nil slice of bytes.
func (c *crypto) Base58Decode(input string) Bytes {
b, err := base58.Decode(input)
if err != nil {
return nil
}
return b
}
// Base64Encode returns a BASE64 string representation of the `input` bytes.
func (c *crypto) Base64Encode(input Bytes) string {
return base64.StdEncoding.EncodeToString(input)
}
// Base64Decode decodes the `input` BASE64 string to bytes. Invalid input will result in nil slice of bytes.
func (c *crypto) Base64Decode(input string) Bytes {
b, err := base64.StdEncoding.DecodeString(input)
if err != nil {
return nil
}
return b
}
// KeyPair returns a pair of keys produced from the `seed`.
func (c *crypto) KeyPair(seed Seed) KeyPair {
sk, pk := c.generateKeyPair(string(seed))
return KeyPair{
PrivateKey: PrivateKey(base58.Encode(sk)),
PublicKey: PublicKey(base58.Encode(pk)),
}
}
// PublicKey returns a public key generated from the `seed`.
func (c *crypto) PublicKey(seed Seed) PublicKey {
return c.KeyPair(seed).PublicKey
}
// PrivateKey generates a private key from the given `seed`.
func (c *crypto) PrivateKey(seed Seed) PrivateKey {
return c.KeyPair(seed).PrivateKey
}
// Address generates new Waves address from the `publicKey` and `chainID`. The function returns an empty string in case of error.
func (c *crypto) Address(publicKey PublicKey, chainID WavesChainID) Address {
pk, err := base58.Decode(string(publicKey))
if err != nil {
return ""
}
return Address(base58.Encode(c.addressBytesFromPK(byte(chainID), pk)))
}
// AddressFromSeed returns a new Waves address produced from the `seed` and `chainID`.
func (c *crypto) AddressFromSeed(seed Seed, chainID WavesChainID) Address {
_, pk := c.generateKeyPair(string(seed))
return Address(base58.Encode(c.addressBytesFromPK(byte(chainID), pk)))
}
// RandomSeed return a new randomly generated BIP39 seed phrase.
func (c *crypto) RandomSeed() Seed {
// The errors are possible only in case of incorrect bits size of entropy, in our case the bits size is defined by constant.
entropy, err := bip39.NewEntropy(seedBitSize)
if err != nil {
panic(err)
}
mnemonic, err := bip39.NewMnemonic(entropy)
if err != nil {
panic(err)
}
return Seed(mnemonic)
}
// SignBytes produces a signature for the `bytes` by `privateKey`.
func (c *crypto) SignBytes(bytes Bytes, privateKey PrivateKey) Bytes {
privateKeyBytes := c.Base58Decode(string(privateKey))
var edPubKeyPoint edwards25519.ExtendedGroupElement
sk := new([DigestLength]byte)
copy(sk[:], privateKeyBytes[:DigestLength])
edwards25519.GeScalarMultBase(&edPubKeyPoint, sk)
edPubKey := new([DigestLength]byte)
edPubKeyPoint.ToBytes(edPubKey)
signBit := edPubKey[31] & 0x80
s := c.sign(sk, edPubKey[:], bytes)
s[63] &= 0x7f
s[63] |= signBit
return Bytes(s[:SignatureLength])
}
// SignBytesBySeed returns a signature for the `bytes` by a private keys generated from the `seed`.
func (c *crypto) SignBytesBySeed(bytes Bytes, seed Seed) Bytes {
sk := c.PrivateKey(seed)
return c.SignBytes(bytes, sk)
}
// VerifySignature returns true if `signature` is a valid signature of `bytes` message signed by `publicKey` key.
func (c *crypto) VerifySignature(publicKey PublicKey, bytes, signature Bytes) bool {
publicKeyBytes := c.Base58Decode(string(publicKey))
if len(publicKeyBytes) != DigestLength {
return false
}
if len(signature) != SignatureLength {
return false
}
pk := new([DigestLength]byte)
copy(pk[:], publicKeyBytes[:DigestLength])
var montX = new(edwards25519.FieldElement)
edwards25519.FeFromBytes(montX, pk)
var one = new(edwards25519.FieldElement)
edwards25519.FeOne(one)
var montXMinusOne = new(edwards25519.FieldElement)
edwards25519.FeSub(montXMinusOne, montX, one)
var montXPlusOne = new(edwards25519.FieldElement)
edwards25519.FeAdd(montXPlusOne, montX, one)
var invMontXPlusOne = new(edwards25519.FieldElement)
edwards25519.FeInvert(invMontXPlusOne, montXPlusOne)
var edY = new(edwards25519.FieldElement)
edwards25519.FeMul(edY, montXMinusOne, invMontXPlusOne)
var edPubKey = new([DigestLength]byte)
edwards25519.FeToBytes(edPubKey, edY)
edPubKey[31] &= 0x7F
edPubKey[31] |= signature[63] & 0x80
s := new([SignatureLength]byte)
copy(s[:], signature[:])
s[63] &= 0x7f
return ed25519.Verify(edPubKey, bytes, s)
}
// VerifyAddressChecksum returns true if `address` has a valid checksum.
func (c *crypto) VerifyAddressChecksum(address Address) bool {
ab := c.Base58Decode(string(address))
if len(ab) != addressSize {
return false
}
if ab[0] != addressVersion {
return false
}
cs := c.secureHash(ab[:headerSize+bodySize])
return bytes.Equal(ab[headerSize+bodySize:addressSize], cs[:checksumSize])
}
// VerifyAddress returns true if `address` is a valid Waves address for the given `chainID`.
func (c *crypto) VerifyAddress(address Address, chainID WavesChainID) bool {
ab := c.Base58Decode(string(address))
if len(ab) != addressSize {
return false
}
if ab[0] != addressVersion || ab[1] != byte(chainID) {
return false
}
cs := c.secureHash(ab[:headerSize+bodySize])
return bytes.Equal(ab[headerSize+bodySize:addressSize], cs[:checksumSize])
}
// VerifySeed checks the seed for correctness of its properties. Returns true if the seed has 15 words length and contains only words from the dictionary, otherwise returns false.
func (c *crypto) VerifySeed(seed Seed) bool {
str := string(seed)
words := strings.Fields(str)
return len(words) == seedWordsCount && bip39.IsMnemonicValid(str)
}
func (c *crypto) generateSecretKey(seed []byte) []byte {
sk := make([]byte, PrivateKeyLength)
copy(sk, seed[:PrivateKeyLength])
sk[0] &= 248
sk[31] &= 127
sk[31] |= 64
return sk
}
func (c *crypto) generatePublicKey(sk []byte) []byte {
pk := make([]byte, PublicKeyLength)
s := new([PrivateKeyLength]byte)
copy(s[:], sk[:PrivateKeyLength])
var ed edwards25519.ExtendedGroupElement
edwards25519.GeScalarMultBase(&ed, s)
var edYPlusOne = new(edwards25519.FieldElement)
edwards25519.FeAdd(edYPlusOne, &ed.Y, &ed.Z)
var oneMinusEdY = new(edwards25519.FieldElement)
edwards25519.FeSub(oneMinusEdY, &ed.Z, &ed.Y)
var invOneMinusEdY = new(edwards25519.FieldElement)
edwards25519.FeInvert(invOneMinusEdY, oneMinusEdY)
var montX = new(edwards25519.FieldElement)
edwards25519.FeMul(montX, edYPlusOne, invOneMinusEdY)
p := new([PublicKeyLength]byte)
edwards25519.FeToBytes(p, montX)
copy(pk[:], p[:])
return pk
}
func (c *crypto) generateKeyPair(seed string) ([]byte, []byte) {
s := make([]byte, len(seed)+4)
copy(s[4:], []byte(seed))
sh := c.secureHash(s)
digest := make([]byte, DigestLength)
h := sha256.New()
h.Write(sh)
h.Sum(digest[:0])
sk := c.generateSecretKey(digest)
pk := c.generatePublicKey(sk)
return sk, pk
}
func (c *crypto) secureHash(data []byte) []byte {
result := make([]byte, DigestLength)
c.blake.Reset()
c.keccak.Reset()
c.blake.Write(data)
c.blake.Sum(result[:0])
c.keccak.Write(result)
return c.keccak.Sum(result[:0])
}
func (c *crypto) addressBytesFromPK(scheme byte, pk []byte) []byte {
addr := make([]byte, addressSize)
addr[0] = addressVersion
addr[1] = scheme
sh := c.secureHash(pk)
copy(addr[headerSize:headerSize+bodySize], sh[:bodySize])
cs := c.secureHash(addr[:headerSize+bodySize])
copy(addr[headerSize+bodySize:addressSize], cs)
return addr
}
func (c *crypto) sign(curvePrivateKey *[DigestLength]byte, edPublicKey, data []byte) []byte {
prefix := bytes.Repeat([]byte{0xff}, 32)
prefix[0] = 0xfe
random := make([]byte, 64)
rand.Read(random)
var messageDigest, hramDigest [64]byte
h := sha512.New()
h.Write(prefix)
h.Write(curvePrivateKey[:])
h.Write(data)
h.Write(random)
h.Sum(messageDigest[:0])
var messageDigestReduced [32]byte
edwards25519.ScReduce(&messageDigestReduced, &messageDigest)
var R edwards25519.ExtendedGroupElement
edwards25519.GeScalarMultBase(&R, &messageDigestReduced)
var encodedR [32]byte
R.ToBytes(&encodedR)
h.Reset()
h.Write(encodedR[:])
h.Write(edPublicKey)
h.Write(data)
h.Sum(hramDigest[:0])
var hramDigestReduced [32]byte
edwards25519.ScReduce(&hramDigestReduced, &hramDigest)
var s [32]byte
edwards25519.ScMulAdd(&s, &hramDigestReduced, curvePrivateKey, &messageDigestReduced)
signature := make([]byte, SignatureLength)
copy(signature, encodedR[:])
copy(signature[32:], s[:])
return signature
} | crypto.go | 0.766381 | 0.458349 | crypto.go | starcoder |
package storage
import (
"context"
"io"
)
type Storage interface {
// CreateObjectExclusively atomically creates an object named name with metadata metadata and data r if no object named name exists.
// Returns a non-nil error e such that ErrorIsCode(e, PreconditionFailed) is true if an object named name already exists.
// Implementors can create an error e such that ErrorIsCode(e, PreconditionFailed) is true by calling NewErrorf(PreconditionFailed, "...", ...).
CreateObjectExclusively(ctx context.Context, name string, metadata ObjectMetadata, data io.ReadSeeker) error
// DeleteObject deletes an object named name.
// Returns a non-nil error e such that ErrorIsCode(e, NotFound) is true if no object named name exists.
// Implementors can create an error e such that ErrorIsCode(e, NotFound) is true by calling NewErrorf(NotFound, "...", ...).
DeleteObject(ctx context.Context, name string) error
// GetObject returns the data of an object as a reader.
// Returns a non-nil error e such that ErrorIsCode(e, NotFound) is true if no object named name exists.
// Implementors can create an error e such that ErrorIsCode(e, NotFound) is true by calling NewErrorf(NotFound, "...", ...).
GetObject(ctx context.Context, name string) (io.ReadCloser, error)
// GetObjectMetadata returns the metadata of an object as a reader.
// Returns a non-nil error e such that ErrorIsCode(e, NotFound) is true if no object named name exists.
// Implementors can create an error e such that ErrorIsCode(e, NotFound) is true by calling NewErrorf(NotFound, "...", ...).
GetObjectMetadata(ctx context.Context, name string) (ObjectMetadata, error)
// ListObjects returns a page of objects. A result *ObjectList o may have len(o.Names) < opts.MaxResults
// even if there are more pages.
ListObjects(ctx context.Context, opts ObjectListOptions) (*ObjectList, error)
}
type ObjectList struct {
Names []string
NextPageToken string
}
type ObjectListOptions struct {
// NamePrefix filters the object names to only those object names starting with NamePrefix.
NamePrefix string
// MaxResults is the maximum number of object names to return.
// If MaxResults is 0 then the maximum number of object names to return is implemention-defined but non-zero.
MaxResults int
// PageToken ccan be set to o.NextPageToken where o is an *ObjectList returned from a call to ListObjects.
PageToken string
}
type ObjectMetadata = map[string]string | go/internal/pkg/service/storage/storage.go | 0.61659 | 0.427158 | storage.go | starcoder |
package main
import (
rl "github.com/gen2brain/raylib-go/raylib"
"math"
"strings"
)
type hexagon struct {
x, y float32
letter rune
selected bool
}
func (h hexagon) points(r float32) []rl.Vector2 {
res := make([]rl.Vector2, 7)
for i := 0; i < 7; i++ {
fi := float64(i)
res[i].X = h.x + r*float32(math.Cos(math.Pi*fi/3))
res[i].Y = h.y + r*float32(math.Sin(math.Pi*fi/3))
}
return res
}
func inHexagon(pts []rl.Vector2, pt rl.Vector2) bool {
rec := rl.NewRectangle(pts[4].X, pts[4].Y, pts[5].X-pts[4].X, pts[2].Y-pts[4].Y)
if rl.CheckCollisionPointRec(pt, rec) {
return true
}
if rl.CheckCollisionPointTriangle(pt, pts[2], pts[3], pts[4]) {
return true
}
if rl.CheckCollisionPointTriangle(pt, pts[0], pts[1], pts[5]) {
return true
}
return false
}
func DrawLineStrip(points []rl.Vector2, pointsCount int32, color rl.Color) {
for i := int32(0); i < pointsCount - 1; i++ {
rl.DrawLineV(points[i], points[i+1], color)
}
}
func main() {
screenWidth := int32(600)
screenHeight := int32(600)
rl.InitWindow(screenWidth, screenHeight, "Honeycombs")
rl.SetTargetFPS(60)
letters := "LRDGITPFBVOKANUYCESM"
runes := []rune(letters)
var combs [20]hexagon
var pts [20][]rl.Vector2
x1, y1 := 150, 100
x2, y2 := 225, 143
w, h := 150, 87
r := float32(w / 3)
for i := 0; i < 20; i++ {
var x, y int
if i < 12 {
x = x1 + (i%3)*w
y = y1 + (i/3)*h
} else {
x = x2 + (i%2)*w
y = y2 + (i-12)/2*h
}
combs[i] = hexagon{float32(x), float32(y), runes[i], false}
pts[i] = combs[i].points(r)
}
nChosen := 0
sChosen := "Chosen: "
lChosen := "Last chosen: "
for !rl.WindowShouldClose() {
rl.BeginDrawing()
rl.ClearBackground(rl.RayWhite)
for i, c := range combs {
ctr := pts[i][0]
ctr.X -= r
index := -1
if key := rl.GetKeyPressed(); key > 0 {
if key >= 97 && key <= 122 {
key -= 32
}
index = strings.IndexRune(letters, key)
} else if rl.IsMouseButtonPressed(rl.MouseLeftButton) {
pt := rl.Vector2{float32(rl.GetMouseX()), float32(rl.GetMouseY())}
for i := 0; i < 20; i++ {
if inHexagon(pts[i], pt) {
index = i
break
}
}
}
if index >= 0 {
if !combs[index].selected {
combs[index].selected = true
nChosen++
s := string(combs[index].letter)
sChosen += s
lChosen = "Last chosen: " + s
if nChosen == 20 {
lChosen += " (All 20 Chosen!)"
}
}
}
if !c.selected {
rl.DrawPoly(ctr, 6, r-1, 30, rl.Yellow)
} else {
rl.DrawPoly(ctr, 6, r-1, 30, rl.Magenta)
}
rl.DrawText(string(c.letter), int32(c.x)-5, int32(c.y)-10, 32, rl.Black)
DrawLineStrip(pts[i], 7, rl.Black)
rl.DrawText(sChosen, 100, 525, 24, rl.Black)
rl.DrawText(lChosen, 100, 565, 24, rl.Black)
}
rl.EndDrawing()
}
rl.CloseWindow()
} | lang/Go/honeycombs.go | 0.607663 | 0.441492 | honeycombs.go | starcoder |
package condition
import (
"fmt"
"github.com/Jeffail/benthos/lib/log"
"github.com/Jeffail/benthos/lib/metrics"
"github.com/Jeffail/benthos/lib/types"
)
//------------------------------------------------------------------------------
func init() {
Constructors[TypeResource] = TypeSpec{
constructor: NewResource,
description: `
Resource is a condition type that runs a condition resource by its name. This
condition allows you to run the same configured condition resource in multiple
processors, or as a branch of another condition.
For example, let's imagine we have two outputs, one of which only receives
messages that satisfy a condition and the other receives the logical NOT of that
same condition. In this example we can save ourselves the trouble of configuring
the same condition twice by referring to it as a resource, like this:
` + "``` yaml" + `
output:
type: broker
broker:
pattern: fan_out
outputs:
- type: foo
foo:
processors:
- type: filter
filter:
type: resource
resource: foobar
- type: bar
bar:
processors:
- type: filter
filter:
type: not
not:
type: resource
resource: foobar
resources:
conditions:
foobar:
type: text
text:
operator: equals_cs
part: 1
arg: filter me please
` + "```" + `
It is also worth noting that when conditions are used as resources in this way
they will only be executed once per message, regardless of how many times they
are referenced (unless the content is modified). Therefore, resource conditions
can act as a runtime optimisation as well as a config optimisation.`,
}
}
//------------------------------------------------------------------------------
// Resource is a condition that returns the result of a condition resource.
type Resource struct {
mgr types.Manager
name string
log log.Modular
}
// NewResource returns a resource condition.
func NewResource(
conf Config, mgr types.Manager, log log.Modular, stats metrics.Type,
) (Type, error) {
if _, err := mgr.GetCondition(conf.Resource); err != nil {
return nil, fmt.Errorf("failed to obtain condition resource '%v': %v", conf.Resource, err)
}
return &Resource{
mgr: mgr,
name: conf.Resource,
log: log,
}, nil
}
//------------------------------------------------------------------------------
// Check attempts to check a message part against a configured condition.
func (c *Resource) Check(msg types.Message) bool {
cond, err := c.mgr.GetCondition(c.name)
if err != nil {
c.log.Debugf("Failed to obtain condition resource '%v': %v", c.name, err)
return false
}
return msg.LazyCondition(c.name, cond)
}
//------------------------------------------------------------------------------ | lib/processor/condition/resource.go | 0.714728 | 0.679983 | resource.go | starcoder |
package influxdb
import (
"io"
"time"
)
// Cursor is a cursor that reads and decodes a ResultSet.
type Cursor interface {
// NextSet will return the next ResultSet. This invalidates the previous
// ResultSet returned by this Cursor and discards any remaining data to be
// read (including any remaining partial results that need to be read).
// Depending on the implementation of the cursor, previous ResultSet's may
// still return results even after being invalidated.
NextSet() (ResultSet, error)
// Close closes the cursor so the underlying stream will be closed if one exists.
Close() error
}
// ResultSet encapsulates a result from a single command.
type ResultSet interface {
// Columns returns the column names for this ResultSet.
Columns() []string
// Index returns the array index for the column name. If a column with that
// name does not exist, this returns -1.
Index(name string) int
// Messages returns the informational messages sent by the server for this ResultSet.
Messages() []*Message
// NextSeries returns the next series in the result.
NextSeries() (Series, error)
}
// Series encapsulates a series within a ResultSet.
type Series interface {
// Name returns the measurement name associated with this series.
Name() string
// Tags returns the tags for this series. They are in sorted order.
Tags() Tags
// Columns returns the column names associated with this Series.
Columns() []string
// Len returns currently known length of the series. The length returned is
// the cumulative length of the entire series, not just the current batch.
// If the entire series hasn't been read because it is being sent in
// partial chunks, this returns false for complete.
Len() (n int, complete bool)
// NextRow returns the next row in the result.
NextRow() (Row, error)
}
// Row is a row of values in the ResultSet.
type Row interface {
// Time returns the time column as a time.Time if it exists in the Row.
Time() time.Time
// Value returns value at index. If an invalid index is given, this will panic.
Value(index int) interface{}
// Values returns the values from the row as an array slice.
Values() []interface{}
// ValueByName returns the value by a named column. If the column does not
// exist, this will return nil.
ValueByName(column string) interface{}
}
// NewCursor constructs a new cursor from the io.ReadCloser and parses it with
// the appropriate decoder for the format. The following formatters are supported:
// json (application/json)
func NewCursor(r io.ReadCloser, format string) (Cursor, error) {
switch format {
case "json", "application/json":
return newJSONCursor(r), nil
default:
return nil, ErrUnknownFormat{Format: format}
}
}
// Message is an informational message from the server.
type Message struct {
Level string `json:"level"`
Text string `json:"text"`
}
func (m *Message) String() string {
return m.Text
} | cursor.go | 0.646683 | 0.401365 | cursor.go | starcoder |
package gonfig
import (
"errors"
"fmt"
"reflect"
)
// setValueByString sets the value by parsing the string.
func setValueByString(v reflect.Value, s string) error {
if isSlice(v) {
if err := parseSlice(v, s); err != nil {
return fmt.Errorf("failed to parse slice value: %v", err)
}
} else {
if err := parseSimpleValue(v, s); err != nil {
return fmt.Errorf("failed to parse value: %v", err)
}
}
return nil
}
// setValue sets the option value to the given value.
// If the tye of the value is assignable or convertible to the type of the
// option value, it is directly set after optional conversion.
// If not, but the value is a string, it is passed to setValueByString.
// If not, and both v and the option's value are is a slice, we try converting
// the slice elements to the right elemens of the options slice.
func setValue(toSet, v reflect.Value) error {
t := toSet.Type()
if v.Type().AssignableTo(t) {
toSet.Set(v)
return nil
}
if v.Type().ConvertibleTo(t) && toSet.Type() != typeOfByteSlice {
toSet.Set(v.Convert(t))
return nil
}
if v.Type().Kind() == reflect.String {
return setValueByString(toSet, v.String())
}
if isSlice(toSet) && v.Type().Kind() == reflect.Slice {
return convertSlice(v, toSet)
}
return convertibleError(v, toSet.Type())
}
// isSupportedType returns whether the type t is supported by gonfig for parsing.
func isSupportedType(t reflect.Type) error {
if t.Implements(typeOfTextUnmarshaler) {
return nil
}
if t == typeOfByteSlice {
return nil
}
switch t.Kind() {
case reflect.Bool:
case reflect.String:
case reflect.Float32, reflect.Float64:
case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64:
case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64:
case reflect.Struct:
for i := 0; i < t.NumField(); i++ {
if err := isSupportedType(t.Field(i).Type); err != nil {
return fmt.Errorf("struct with unsupported type: %v", err)
}
}
case reflect.Slice:
// All but the fixed-bitsize types.
if err := isSupportedType(t.Elem()); err != nil {
return fmt.Errorf("slice of unsupported type: %v", err)
}
case reflect.Ptr:
if err := isSupportedType(t.Elem()); err != nil {
return fmt.Errorf("pointer to unsupported type: %v", err)
}
case reflect.Map:
if t.Key().Kind() != reflect.String || t.Elem().Kind() != reflect.Interface {
return errors.New("only maps of type map[string]interface{} are supported")
}
default:
return errors.New("type not supported")
}
return nil
}
// isZero checks if the value is the zero value for its type.
func isZero(v reflect.Value) bool {
switch v.Kind() {
case reflect.Func, reflect.Map, reflect.Slice:
return v.IsNil()
case reflect.Array:
z := true
for i := 0; i < v.Len(); i++ {
z = z && isZero(v.Index(i))
}
return z
case reflect.Struct:
z := true
for i := 0; i < v.NumField(); i++ {
z = z && isZero(v.Field(i))
}
return z
case reflect.Ptr:
return isZero(reflect.Indirect(v))
}
// Compare other types directly:
z := reflect.Zero(v.Type())
return v.Interface() == z.Interface()
}
// setSimpleMapValue trues to add the key and value to the map.
func setSimpleMapValue(mapValue reflect.Value, key, value string) error {
v := reflect.New(mapValue.Type().Elem()).Elem()
if err := parseSimpleValue(v, value); err != nil {
return err
}
mapValue.SetMapIndex(reflect.ValueOf(key), v)
return nil
} | values.go | 0.737253 | 0.455199 | values.go | starcoder |
package integration
import (
"errors"
"testing"
"github.com/CyCoreSystems/ari"
)
func TestEndpointList(t *testing.T, s Server) {
runTest("ok", t, s, func(t *testing.T, m *mock, cl ari.Client) {
h1 := ari.NewEndpointKey("h1", "1")
h2 := ari.NewEndpointKey("h1", "2")
m.Endpoint.On("List", (*ari.Key)(nil)).Return([]*ari.Key{h1, h2}, nil)
list, err := cl.Endpoint().List(nil)
if err != nil {
t.Errorf("Error in remote Endpoint List call: %s", err)
}
if len(list) != 2 {
t.Errorf("Expected list of length 2, got %d", len(list))
}
m.Endpoint.AssertCalled(t, "List", (*ari.Key)(nil))
})
runTest("err", t, s, func(t *testing.T, m *mock, cl ari.Client) {
m.Endpoint.On("List", (*ari.Key)(nil)).Return([]*ari.Key{}, errors.New("error"))
list, err := cl.Endpoint().List(nil)
if err == nil {
t.Errorf("Expected error in remote Endpoint List call")
}
if len(list) != 0 {
t.Errorf("Expected list of length 0, got %d", len(list))
}
m.Endpoint.AssertCalled(t, "List", (*ari.Key)(nil))
})
}
func TestEndpointListByTech(t *testing.T, s Server) {
runTest("ok", t, s, func(t *testing.T, m *mock, cl ari.Client) {
h1 := ari.NewEndpointKey("h1", "1")
h2 := ari.NewEndpointKey("h1", "2")
m.Endpoint.On("ListByTech", "tech", &ari.Key{Kind: "", ID: "", Node: "", Dialog: "", App: ""}).Return([]*ari.Key{h1, h2}, nil)
list, err := cl.Endpoint().ListByTech("tech", nil)
if err != nil {
t.Errorf("Error in remote Endpoint List call: %s", err)
}
if len(list) != 2 {
t.Errorf("Expected list of length 2, got %d", len(list))
}
m.Endpoint.AssertCalled(t, "ListByTech", "tech", &ari.Key{Kind: "", ID: "", Node: "", Dialog: "", App: ""})
})
runTest("err", t, s, func(t *testing.T, m *mock, cl ari.Client) {
m.Endpoint.On("ListByTech", "tech", &ari.Key{Kind: "", ID: "", Node: "", Dialog: "", App: ""}).Return([]*ari.Key{}, errors.New("error"))
list, err := cl.Endpoint().ListByTech("tech", nil)
if err == nil {
t.Errorf("Expected error in remote Endpoint List call")
}
if len(list) != 0 {
t.Errorf("Expected list of length 0, got %d", len(list))
}
m.Endpoint.AssertCalled(t, "ListByTech", "tech", &ari.Key{Kind: "", ID: "", Node: "", Dialog: "", App: ""})
})
}
func TestEndpointData(t *testing.T, s Server) {
runTest("ok", t, s, func(t *testing.T, m *mock, cl ari.Client) {
var expected ari.EndpointData
expected.State = "st1"
expected.Technology = "tech1"
expected.Resource = "resource"
h1 := ari.NewEndpointKey(expected.Technology, expected.Resource)
m.Endpoint.On("Data", h1).Return(&expected, nil)
data, err := cl.Endpoint().Data(h1)
if err != nil {
t.Errorf("Error in remote Endpoint Data call: %s", err)
}
if data == nil {
t.Errorf("Expected data to be non-nil")
} else {
failed := false
failed = failed || expected.State != data.State
failed = failed || expected.Resource != data.Resource
failed = failed || expected.Technology != data.Technology
if failed {
t.Errorf("Expected '%v', got '%v'", expected, data)
}
}
m.Endpoint.AssertCalled(t, "Data", h1)
})
runTest("err", t, s, func(t *testing.T, m *mock, cl ari.Client) {
var expected ari.EndpointData
expected.State = "st1"
expected.Technology = "tech1"
expected.Resource = "resource"
h1 := ari.NewEndpointKey(expected.Technology, expected.Resource)
m.Endpoint.On("Data", h1).Return(nil, errors.New("error"))
data, err := cl.Endpoint().Data(h1)
if err == nil {
t.Errorf("Expected error in remote Endpoint Data call")
}
if data != nil {
t.Errorf("Expected data to be nil")
}
m.Endpoint.AssertCalled(t, "Data", h1)
})
} | internal/integration/endpoint.go | 0.548915 | 0.405743 | endpoint.go | starcoder |
package plot
// TickLabels implements drawing tick labels.
type TickLabels struct {
X *TickLabelsX
Y *TickLabelsY
}
// NewTickLabels creates a new tick labelling element.
func NewTickLabels() *TickLabels {
return &TickLabels{
X: NewTickLabelsX(),
Y: NewTickLabelsY(),
}
}
// Draw draws tick labels to canvas using axes from plot.
func (labels *TickLabels) Draw(plot *Plot, canvas Canvas) {
labels.X.Draw(plot, canvas)
labels.Y.Draw(plot, canvas)
}
// TickLabelsX implements drawing tick labels.
type TickLabelsX struct {
Enabled bool
// Side determines position of the labels. -1 = min, 0 = center, 1 = max
Side float64
Style Style
}
// NewTickLabelsX creates a new tick labelling element for X axis.
func NewTickLabelsX() *TickLabelsX {
labels := &TickLabelsX{}
labels.Enabled = true
labels.Side = -1
return labels
}
// Draw draws tick labels to canvas using axes from plot.
func (labels *TickLabelsX) Draw(plot *Plot, canvas Canvas) {
if !labels.Enabled {
return
}
x, y := plot.X, plot.Y
sz := canvas.Bounds().Size()
yval := lerpUnit(labels.Side, y.Min, y.Max)
ypos := y.ToCanvas(yval, 0, sz.Y)
style := &labels.Style
if style.IsZero() {
style = &plot.Theme.FontSmall
}
for _, tick := range x.Ticks.Ticks(x) {
p := x.ToCanvas(tick.Value, 0, sz.X)
if tick.Label != "" {
canvas.Text(tick.Label, P(p, ypos), style)
}
}
}
// TickLabelsY implements drawing tick labels.
type TickLabelsY struct {
Enabled bool
// Side determines position of the labels. -1 = min, 0 = center, 1 = max
Side float64
Style Style
}
// NewTickLabelsY creates a new tick labelling element for X axis.
func NewTickLabelsY() *TickLabelsY {
labels := &TickLabelsY{}
labels.Enabled = true
labels.Side = -1
return labels
}
// Draw draws tick labels to canvas using axes from plot.
func (labels *TickLabelsY) Draw(plot *Plot, canvas Canvas) {
if !labels.Enabled {
return
}
x, y := plot.X, plot.Y
sz := canvas.Bounds().Size()
xval := lerpUnit(labels.Side, x.Min, x.Max)
xpos := x.ToCanvas(xval, 0, sz.X)
style := &labels.Style
if style.IsZero() {
style = &plot.Theme.FontSmall
}
for _, tick := range y.Ticks.Ticks(y) {
p := y.ToCanvas(tick.Value, 0, sz.Y)
if tick.Label != "" {
canvas.Text(tick.Label, P(xpos, p), style)
}
}
} | ticklabels.go | 0.901219 | 0.507324 | ticklabels.go | starcoder |
package objects
import "fmt"
// Compare - This function will compare two objects to make sure they are the
// same and will return a boolean, an integer that tracks the number of
// problems found, and a slice of strings that contain the detailed results,
// whether good or bad.
func Compare(o, obj2 *CommonObjectProperties, debug bool) (bool, int, []string) {
return o.Compare(obj2, debug)
}
// Compare - This method will compare two objects to make sure they are the
// same and will return a boolean, an integer that tracks the number of
// problems found, and a slice of strings that contain the detailed results,
// whether good or bad.
func (o *CommonObjectProperties) Compare(obj2 *CommonObjectProperties, debug bool) (bool, int, []string) {
var r *results = new(results)
r.debug = debug
// Object Type
if o.ObjectType != obj2.ObjectType {
str := fmt.Sprintf("-- the type property values do not match: %s | %s", o.ObjectType, obj2.ObjectType)
logProblem(r, str)
} else {
str := fmt.Sprintf("++ the type property values match: %s | %s", o.ObjectType, obj2.ObjectType)
logValid(r, str)
}
// Spec Version
if o.SpecVersion != obj2.SpecVersion {
str := fmt.Sprintf("-- the spec_version property values do not match: %s | %s", o.SpecVersion, obj2.SpecVersion)
logProblem(r, str)
} else {
str := fmt.Sprintf("++ the spec_version property values match: %s | %s", o.SpecVersion, obj2.SpecVersion)
logValid(r, str)
}
// ID
if o.ID != obj2.ID {
str := fmt.Sprintf("-- the id property values do not match: %s | %s", o.ID, obj2.ID)
logProblem(r, str)
} else {
str := fmt.Sprintf("++ the id property values match: %s | %s", o.ID, obj2.ID)
logValid(r, str)
}
// Check Created By Ref Value
if o.CreatedByRef != obj2.CreatedByRef {
str := fmt.Sprintf("-- The created by ref values do not match: %s | %s", o.CreatedByRef, obj2.CreatedByRef)
logProblem(r, str)
} else {
str := fmt.Sprintf("++ The created by ref values match: %s | %s", o.CreatedByRef, obj2.CreatedByRef)
logValid(r, str)
}
// Created
if o.Created != obj2.Created {
str := fmt.Sprintf("-- the created dates do not match: %s | %s", o.Created, obj2.Created)
logProblem(r, str)
} else {
str := fmt.Sprintf("++ the created dates match: %s | %s", o.Created, obj2.Created)
logValid(r, str)
}
// Modified
if o.Modified != obj2.Modified {
str := fmt.Sprintf("-- the modified dates do not match: %s | %s", o.Modified, obj2.Modified)
logProblem(r, str)
} else {
str := fmt.Sprintf("++ the modified dates match: %s | %s", o.Modified, obj2.Modified)
logValid(r, str)
}
// Revoked
if o.Revoked != obj2.Revoked {
str := fmt.Sprintf("-- the revoked values do not match: %t | %t", o.Revoked, obj2.Revoked)
logProblem(r, str)
} else {
str := fmt.Sprintf("++ the revoked values match: %t | %t", o.Revoked, obj2.Revoked)
logValid(r, str)
}
// Labels
if len(o.Labels) != len(obj2.Labels) {
str := fmt.Sprintf("-- the number of entries in the labels property do not match: %d | %d", len(o.Labels), len(obj2.Labels))
logProblem(r, str)
} else {
str := fmt.Sprintf("++ the number of entries in the labels property match: %d | %d", len(o.Labels), len(obj2.Labels))
logValid(r, str)
// If lengths are the same, then check each value
for index := range o.Labels {
if o.Labels[index] != obj2.Labels[index] {
str := fmt.Sprintf("-- the label values do not match: %s | %s", o.Labels[index], obj2.Labels[index])
logProblem(r, str)
} else {
str := fmt.Sprintf("++ the label values match: %s | %s", o.Labels[index], obj2.Labels[index])
logValid(r, str)
}
}
}
// Confidence
if o.Confidence != obj2.Confidence {
str := fmt.Sprintf("-- The confidence values do not match: %d | %d", o.Confidence, obj2.Confidence)
logProblem(r, str)
} else {
str := fmt.Sprintf("++ The confidence values match: %d | %d", o.Confidence, obj2.Confidence)
logValid(r, str)
}
// Lang
if o.Lang != obj2.Lang {
str := fmt.Sprintf("-- The lang values do not match: %s | %s", o.Lang, obj2.Lang)
logProblem(r, str)
} else {
str := fmt.Sprintf("++ The lang values match: %s | %s", o.Lang, obj2.Lang)
logValid(r, str)
}
// Check External References
if len(o.ExternalReferences) != len(obj2.ExternalReferences) {
str := fmt.Sprintf("-- The number of entries in external references do not match: %d | %d", len(o.ExternalReferences), len(obj2.ExternalReferences))
logProblem(r, str)
} else {
str := fmt.Sprintf("++ The number of entries in external references match: %d | %d", len(o.ExternalReferences), len(obj2.ExternalReferences))
logValid(r, str)
for index := range o.ExternalReferences {
// Check External Reference Source Name
if o.ExternalReferences[index].SourceName != obj2.ExternalReferences[index].SourceName {
str := fmt.Sprintf("-- The source name values do not match: %s | %s", o.ExternalReferences[index].SourceName, obj2.ExternalReferences[index].SourceName)
logProblem(r, str)
} else {
str := fmt.Sprintf("++ The source name values match: %s | %s", o.ExternalReferences[index].SourceName, obj2.ExternalReferences[index].SourceName)
logValid(r, str)
}
// Check External Reference Descriptions
if o.ExternalReferences[index].Description != obj2.ExternalReferences[index].Description {
str := fmt.Sprintf("-- The description values do not match: %s | %s", o.ExternalReferences[index].Description, obj2.ExternalReferences[index].Description)
logProblem(r, str)
} else {
str := fmt.Sprintf("++ The description values match: %s | %s", o.ExternalReferences[index].Description, obj2.ExternalReferences[index].Description)
logValid(r, str)
}
// Check External Reference URLs
if o.ExternalReferences[index].URL != obj2.ExternalReferences[index].URL {
str := fmt.Sprintf("-- The url values do not match: %s | %s", o.ExternalReferences[index].URL, obj2.ExternalReferences[index].URL)
logProblem(r, str)
} else {
str := fmt.Sprintf("++ The url values match: %s | %s", o.ExternalReferences[index].URL, obj2.ExternalReferences[index].URL)
logValid(r, str)
}
// Check External Reference Hashes
if len(o.ExternalReferences[index].Hashes) != len(obj2.ExternalReferences[index].Hashes) {
str := fmt.Sprintf("-- The number of entries in hashes do not match: %d | %d", len(o.ExternalReferences[index].Hashes), len(obj2.ExternalReferences[index].Hashes))
logProblem(r, str)
} else {
str := fmt.Sprintf("++ The number of entries in hashes match: %d | %d", len(o.ExternalReferences[index].Hashes), len(obj2.ExternalReferences[index].Hashes))
logValid(r, str)
// If lengths are the same, then check each value
for key := range o.ExternalReferences[index].Hashes {
if o.ExternalReferences[index].Hashes[key] != obj2.ExternalReferences[index].Hashes[key] {
str := fmt.Sprintf("-- The hash values do not match: %s | %s", o.ExternalReferences[index].Hashes[key], obj2.ExternalReferences[index].Hashes[key])
logProblem(r, str)
} else {
str := fmt.Sprintf("++ The hash values match: %s | %s", o.ExternalReferences[index].Hashes[key], obj2.ExternalReferences[index].Hashes[key])
logValid(r, str)
}
}
}
// Check External Reference External IDs
if o.ExternalReferences[index].ExternalID != obj2.ExternalReferences[index].ExternalID {
str := fmt.Sprintf("-- The external id values do not match: %s | %s", o.ExternalReferences[index].ExternalID, obj2.ExternalReferences[index].ExternalID)
logProblem(r, str)
} else {
str := fmt.Sprintf("++ The external id values match: %s | %s", o.ExternalReferences[index].ExternalID, obj2.ExternalReferences[index].ExternalID)
logValid(r, str)
}
}
}
// Check Object Marking Refs
if len(o.ObjectMarkingRefs) != len(obj2.ObjectMarkingRefs) {
str := fmt.Sprintf("-- The number of entries in object marking refs do not match: %d | %d", len(o.ObjectMarkingRefs), len(obj2.ObjectMarkingRefs))
logProblem(r, str)
} else {
str := fmt.Sprintf("++ The number of entries in object marking refs match: %d | %d", len(o.ObjectMarkingRefs), len(obj2.ObjectMarkingRefs))
logValid(r, str)
// If lengths are the same, then check each value
for index := range o.ObjectMarkingRefs {
if o.ObjectMarkingRefs[index] != obj2.ObjectMarkingRefs[index] {
str := fmt.Sprintf("-- The object marking ref values do not match: %s | %s", o.ObjectMarkingRefs[index], obj2.ObjectMarkingRefs[index])
logProblem(r, str)
} else {
str := fmt.Sprintf("++ The object marking ref values match: %s | %s", o.ObjectMarkingRefs[index], obj2.ObjectMarkingRefs[index])
logValid(r, str)
}
}
}
// Check Granular Markings
if len(o.GranularMarkings) != len(obj2.GranularMarkings) {
str := fmt.Sprintf("-- The number of entries in granular markings do not match: %d | %d", len(o.GranularMarkings), len(obj2.GranularMarkings))
logProblem(r, str)
} else {
str := fmt.Sprintf("++ The number of entries in granular markings match: %d | %d", len(o.GranularMarkings), len(obj2.GranularMarkings))
logValid(r, str)
for index := range o.GranularMarkings {
// Check Granular Marking Languages
if o.GranularMarkings[index].Lang != obj2.GranularMarkings[index].Lang {
str := fmt.Sprintf("-- The language values do not match: %s | %s", o.GranularMarkings[index].Lang, obj2.GranularMarkings[index].Lang)
logProblem(r, str)
} else {
str := fmt.Sprintf("++ The languages values match: %s | %s", o.GranularMarkings[index].Lang, obj2.GranularMarkings[index].Lang)
logValid(r, str)
}
// Check Granular Marking Refs
if o.GranularMarkings[index].MarkingRef != obj2.GranularMarkings[index].MarkingRef {
str := fmt.Sprintf("-- The marking ref values do not match: %s | %s", o.GranularMarkings[index].MarkingRef, obj2.GranularMarkings[index].MarkingRef)
logProblem(r, str)
} else {
str := fmt.Sprintf("++ The marking ref values match: %s | %s", o.GranularMarkings[index].MarkingRef, obj2.GranularMarkings[index].MarkingRef)
logValid(r, str)
}
// Check Granular Marking Selectors
if len(o.GranularMarkings[index].Selectors) != len(obj2.GranularMarkings[index].Selectors) {
str := fmt.Sprintf("-- The number of entries in selectors do not match: %d | %d", len(o.GranularMarkings[index].Selectors), len(obj2.GranularMarkings[index].Selectors))
logProblem(r, str)
} else {
str := fmt.Sprintf("++ The number of entries in selectors match: %d | %d", len(o.GranularMarkings[index].Selectors), len(obj2.GranularMarkings[index].Selectors))
logValid(r, str)
// If lengths are the same, then check each value
for j := range o.GranularMarkings[index].Selectors {
if o.GranularMarkings[index].Selectors[j] != obj2.GranularMarkings[index].Selectors[j] {
str := fmt.Sprintf("-- The selector values do not match: %s | %s", o.GranularMarkings[index].Selectors[j], obj2.GranularMarkings[index].Selectors[j])
logProblem(r, str)
} else {
str := fmt.Sprintf("++ The selector values match: %s | %s", o.GranularMarkings[index].Selectors[j], obj2.GranularMarkings[index].Selectors[j])
logValid(r, str)
}
}
}
}
}
// Return real values not pointers
if r.problemsFound > 0 {
return false, r.problemsFound, r.resultDetails
}
return true, 0, r.resultDetails
} | objects/compare.go | 0.743447 | 0.477554 | compare.go | starcoder |
package util
import (
"github.com/ayntgl/discordgo"
"github.com/rivo/tview"
)
// GetTreeNodeByReference walks the root `*TreeNode` of the given `*TreeView` *treeView* and returns the TreeNode whose reference is equal to the given reference *r*. If the `*TreeNode` is not found, `nil` is returned instead.
func GetTreeNodeByReference(treeView *tview.TreeView, r interface{}) (mn *tview.TreeNode) {
treeView.GetRoot().Walk(func(n, _ *tview.TreeNode) bool {
if n.GetReference() == r {
mn = n
return false
}
return true
})
return
}
// CreateTopLevelChannelsNodes builds and creates `*tview.TreeNode`s for top-level (channels that have an empty parent ID and of type GUILD_TEXT, GUILD_NEWS) channels. If the client user does not have the VIEW_CHANNEL permission for a channel, the channel is excluded from the parent.
func CreateTopLevelChannelsNodes(treeView *tview.TreeView, s *discordgo.State, n *tview.TreeNode, cs []*discordgo.Channel) {
for _, c := range cs {
if (c.Type == discordgo.ChannelTypeGuildText || c.Type == discordgo.ChannelTypeGuildNews) &&
(c.ParentID == "") {
if !HasPermission(s, c.ID, discordgo.PermissionViewChannel) {
continue
}
n.AddChild(CreateChannelNode(s, c))
continue
}
}
}
// CreateCategoryChannelsNodes builds and creates `*tview.TreeNode`s for category (type: GUILD_CATEGORY) channels. If the client user does not have the VIEW_CHANNEL permission for a channel, the channel is excluded from the parent.
func CreateCategoryChannelsNodes(treeView *tview.TreeView, s *discordgo.State, n *tview.TreeNode, cs []*discordgo.Channel) {
CategoryLoop:
for _, c := range cs {
if c.Type == discordgo.ChannelTypeGuildCategory {
if !HasPermission(s, c.ID, discordgo.PermissionViewChannel) {
continue
}
for _, child := range cs {
if child.ParentID == c.ID {
n.AddChild(CreateChannelNode(s, c))
continue CategoryLoop
}
}
n.AddChild(CreateChannelNode(s, c))
}
}
}
// CreateSecondLevelChannelsNodes builds and creates `*tview.TreeNode`s for second-level (channels that have a non-empty parent ID and of type GUILD_TEXT, GUILD_NEWS) channels. If the client user does not have the VIEW_CHANNEL permission for a channel, the channel is excluded from the parent.
func CreateSecondLevelChannelsNodes(treeView *tview.TreeView, s *discordgo.State, cs []*discordgo.Channel) {
for _, c := range cs {
if (c.Type == discordgo.ChannelTypeGuildText || c.Type == discordgo.ChannelTypeGuildNews) &&
(c.ParentID != "") {
if !HasPermission(s, c.ID, discordgo.PermissionViewChannel) {
continue
}
pn := GetTreeNodeByReference(treeView, c.ParentID)
if pn != nil {
pn.AddChild(CreateChannelNode(s, c))
}
}
}
}
// CreateChannelNode builds (encorporates unread channels in bold tag, otherwise dim, etc.) and returns a node according to the type of the given channel *c*.
func CreateChannelNode(s *discordgo.State, c *discordgo.Channel) *tview.TreeNode {
var cn *tview.TreeNode
switch c.Type {
case discordgo.ChannelTypeGuildText, discordgo.ChannelTypeGuildNews:
tag := "[::d]"
if ChannelIsUnread(s, c) {
tag = "[::b]"
}
cn = tview.NewTreeNode(tag + ChannelToString(c) + "[::-]").
SetReference(c.ID)
case discordgo.ChannelTypeGuildCategory:
cn = tview.NewTreeNode(c.Name).
SetReference(c.ID)
}
return cn
}
// HasPermission returns a boolean that indicates whether the client user has the given permission *p* in the given channel ID *cID*.
func HasPermission(s *discordgo.State, cID string, p int64) bool {
perm, err := s.UserChannelPermissions(s.User.ID, cID)
if err != nil {
return false
}
return perm&p == p
}
func HasKeybinding(sl []string, s string) bool {
for _, str := range sl {
if str == s {
return true
}
}
return false
} | util/ui.go | 0.821008 | 0.505188 | ui.go | starcoder |
package yologo
import (
"fmt"
"hash"
"hash/fnv"
"github.com/chewxy/hm"
"github.com/chewxy/math32"
"github.com/pkg/errors"
"gorgonia.org/gorgonia"
"gorgonia.org/tensor"
)
type yoloOp struct {
anchors []float32
masks []int
ignoreTresh float32
dimensions int
numClasses int
trainMode bool
gridSize int
bestAnchors [][]int
training *yoloTraining
}
func newYoloOp(anchors []float32, masks []int, netSize, gridSize, numClasses int, ignoreTresh float32) *yoloOp {
yoloOp := &yoloOp{
anchors: anchors,
dimensions: netSize,
numClasses: numClasses,
ignoreTresh: ignoreTresh,
masks: masks,
trainMode: false,
gridSize: gridSize,
training: &yoloTraining{},
}
return yoloOp
}
// YOLOv3Node Constructor for YOLO-based node operation
/*
input - Input node
anchors - Slice of anchors
masks - Slice of masks
netSize - Height/Width of input
numClasses - Amount of classes
ignoreTresh - Treshold
targets - Desired targets.
*/
func YOLOv3Node(input *gorgonia.Node, anchors []float32, masks []int, netSize, numClasses int, ignoreTresh float32, targets ...*gorgonia.Node) (*gorgonia.Node, YoloTrainer, error) {
// @todo: need to check input.Shape()[2] accessibility
op := newYoloOp(anchors, masks, netSize, input.Shape()[2], numClasses, ignoreTresh)
ret, err := gorgonia.ApplyOp(op, input)
return ret, op, err
}
/* Methods to match gorgonia.Op interface */
func (op *yoloOp) Arity() int {
return 1
}
func (op *yoloOp) ReturnsPtr() bool { return false }
func (op *yoloOp) CallsExtern() bool { return false }
func (op *yoloOp) WriteHash(h hash.Hash) {
fmt.Fprintf(h, "YOLO{}(anchors: (%v))", op.anchors)
}
func (op *yoloOp) Hashcode() uint32 {
h := fnv.New32a()
op.WriteHash(h)
return h.Sum32()
}
func (op *yoloOp) String() string {
return fmt.Sprintf("YOLO{}(anchors: (%v))", op.anchors)
}
func (op *yoloOp) InferShape(inputs ...gorgonia.DimSizer) (tensor.Shape, error) {
shp := inputs[0].(tensor.Shape)
if len(shp) < 4 {
return nil, fmt.Errorf("InferShape() for YOLO must contain 4 dimensions, but recieved %d)", len(shp))
}
s := shp.Clone()
if op.trainMode {
return []int{s[0], s[2] * s[3] * len(op.masks), (s[1] - 1) / len(op.masks)}, nil
}
return []int{s[0], s[2] * s[3] * len(op.masks), s[1] / len(op.masks)}, nil
}
func (op *yoloOp) Type() hm.Type {
a := hm.TypeVariable('a')
t := gorgonia.TensorType{Dims: 4, Of: a}
o := gorgonia.TensorType{Dims: 3, Of: a}
return hm.NewFnType(t, o)
}
func (op *yoloOp) OverwritesInput() int {
return -1
}
func (op *yoloOp) Do(inputs ...gorgonia.Value) (retVal gorgonia.Value, err error) {
inputTensor, err := op.checkInput(inputs...)
if err != nil {
return nil, errors.Wrap(err, "Can't check YOLO input")
}
batchSize := inputTensor.Shape()[0]
stride := op.dimensions / inputTensor.Shape()[2]
gridSize := inputTensor.Shape()[2]
bboxAttributes := 5 + op.numClasses
numAnchors := len(op.anchors) / 2
currentAnchors := []float32{}
for i := range op.masks {
if op.masks[i] >= numAnchors {
return nil, fmt.Errorf("Num of anchors is %[1]d, but mask values is %[2]d > %[1]d", numAnchors, op.masks[i])
}
currentAnchors = append(currentAnchors, op.anchors[i*2], op.anchors[i*2+1])
}
// Prepare reshaped input (it's common for both training and detection mode)
err = prepareReshapedInput(inputTensor, batchSize, gridSize, bboxAttributes, numAnchors)
if err != nil {
return nil, errors.Wrap(err, "Can't prepare reshaped input")
}
// Just inference without backpropagation in case of detection mode
if !op.trainMode {
return op.evaluateYOLOF32(inputTensor, batchSize, stride, gridSize, bboxAttributes, len(op.masks), currentAnchors)
}
// Training mode
inputTensorCopy := inputTensor.Clone().(tensor.Tensor)
var yoloBBoxes tensor.Tensor
yoloBBoxes, err = op.evaluateYOLOF32(inputTensorCopy, batchSize, stride, gridSize, bboxAttributes, len(op.masks), currentAnchors)
if err != nil {
return nil, errors.Wrap(err, "Can't evaluate YOLO [Training mode]")
}
if op.training == nil {
return nil, fmt.Errorf("Nil pointer on training params in yoloOp [Training mode]")
}
op.training.inputs, err = tensorToF32(inputTensor)
if err != nil {
return nil, errors.Wrap(err, "Can't cast tensor to []float32 for inputs [Training mode]")
}
op.training.bboxes, err = tensorToF32(yoloBBoxes)
if err != nil {
return nil, errors.Wrap(err, "Can't cast tensor to []float32 for bboxes [Training mode]")
}
preparedYOLOout := prepareTrainingOutputF32(
op.training.inputs, op.training.bboxes,
op.training.targets, op.training.scales,
op.bestAnchors, op.masks,
op.numClasses, op.dimensions, op.gridSize, op.ignoreTresh,
)
yoloTrainingTensor := tensor.New(tensor.WithShape(1, op.gridSize*op.gridSize*len(op.masks), 5+op.numClasses), tensor.Of(tensor.Float32), tensor.WithBacking(preparedYOLOout))
return yoloTrainingTensor, nil
}
/* Unexported methods */
// checkInput Check if everything is OK with inputs and returns tensor.Tensor (if OK)
func (op *yoloOp) checkInput(inputs ...gorgonia.Value) (tensor.Tensor, error) {
if err := checkArity(op, len(inputs)); err != nil {
return nil, errors.Wrap(err, "Can't check arity")
}
input := inputs[0]
inputTensor := input.(tensor.Tensor)
shp := inputTensor.Shape().Dims()
if shp != 4 {
return nil, fmt.Errorf("YOLO must contain 4 dimensions, but recieved %d)", shp)
}
inputNumericType := input.Dtype()
switch inputNumericType {
case gorgonia.Float32:
return inputTensor, nil
default:
return nil, fmt.Errorf("Only Float32 supported for inputs, but got %v", inputNumericType)
}
}
func prepareReshapedInput(input tensor.Tensor, batchSize, grid, bboxAttrs, numAnchors int) error {
err := input.Reshape(batchSize, bboxAttrs*numAnchors, grid*grid)
if err != nil {
return errors.Wrap(err, "Can't make reshape grid^2 for YOLO")
}
err = input.T(0, 2, 1)
if err != nil {
return errors.Wrap(err, "Can't safely transponse input for YOLO")
}
err = input.Transpose()
if err != nil {
return errors.Wrap(err, "Can't transponse input for YOLO")
}
err = input.Reshape(batchSize, grid*grid*numAnchors, bboxAttrs)
if err != nil {
return errors.Wrap(err, "Can't reshape bbox for YOLO")
}
return nil
}
func (op *yoloOp) evaluateYOLOF32(input tensor.Tensor, batchSize, stride, grid, bboxAttrs, numAnchors int, currentAnchors []float32) (retVal tensor.Tensor, err error) {
// Activation of x, y via sigmoid function
slXY, err := input.Slice(nil, nil, Slice(0, 2))
_, err = slXY.Apply(_sigmoidf32, tensor.UseUnsafe())
if err != nil {
return nil, errors.Wrap(err, "Can't activate XY")
}
// Activation of classes (objects) via sigmoid function
slClasses, err := input.Slice(nil, nil, Slice(4, 5+op.numClasses))
_, err = slClasses.Apply(_sigmoidf32, tensor.UseUnsafe())
if err != nil {
return nil, errors.Wrap(err, "Can't activate classes")
}
step := grid * numAnchors
for i := 0; i < grid; i++ {
vy, err := input.Slice(nil, Slice(i*step, i*step+step), Slice(1))
if err != nil {
return nil, errors.Wrap(err, "Can't slice while doing steps for grid")
}
_, err = tensor.Add(vy, float32(i), tensor.UseUnsafe())
if err != nil {
return nil, errors.Wrap(err, "Can't do tensor.Add(...) for float32; (1)")
}
for n := 0; n < numAnchors; n++ {
anchorsSlice, err := input.Slice(nil, Slice(i*numAnchors+n, input.Shape()[1], step), Slice(0))
if err != nil {
return nil, errors.Wrap(err, "Can't slice anchors while doing steps for grid")
}
_, err = tensor.Add(anchorsSlice, float32(i), tensor.UseUnsafe())
if err != nil {
return nil, errors.Wrap(err, "Can't do tensor.Add(...) for float32; (1)")
}
}
}
anchors := []float32{}
for i := 0; i < grid*grid; i++ {
anchors = append(anchors, currentAnchors...)
}
anchorsTensor := tensor.New(tensor.Of(tensor.Float32), tensor.WithShape(1, grid*grid*numAnchors, 2))
for i := range anchors {
anchorsTensor.Set(i, anchors[i])
}
_, err = tensor.Div(anchorsTensor, float32(stride), tensor.UseUnsafe())
if err != nil {
return nil, errors.Wrap(err, "Can't do tensor.Div(...) for float32")
}
vhw, err := input.Slice(nil, nil, Slice(2, 4))
if err != nil {
return nil, errors.Wrap(err, "Can't do slice on input S(2,4)")
}
_, err = vhw.Apply(math32.Exp, tensor.UseUnsafe())
if err != nil {
return nil, errors.Wrap(err, "Can't apply exp32 to YOLO operation")
}
_, err = tensor.Mul(vhw, anchorsTensor, tensor.UseUnsafe())
if err != nil {
return nil, errors.Wrap(err, "Can't do tensor.Mul(...) for anchors")
}
vv, err := input.Slice(nil, nil, Slice(0, 4))
if err != nil {
return nil, errors.Wrap(err, "Can't do slice on input S(0,4)")
}
_, err = tensor.Mul(vv, float32(stride), tensor.UseUnsafe())
if err != nil {
return nil, errors.Wrap(err, "Can't do tensor.Mul(...) for float32")
}
return input, nil
} | yolo_op.go | 0.602179 | 0.439747 | yolo_op.go | starcoder |
package world
import (
"context"
"github.com/ironarachne/world/pkg/geography/region"
"github.com/ironarachne/world/pkg/geometry"
"math"
"github.com/ojrac/opensimplex-go"
"github.com/ironarachne/world/pkg/random"
)
// Tile is a world tile
type Tile struct {
Altitude int
Temperature int
Humidity int
IsOcean bool
}
func initializeTiles(width int, height int) [][]Tile {
tiles := make([][]Tile, height)
for i := 0; i < height; i++ {
tiles[i] = make([]Tile, width)
}
for i := 0; i < height; i++ {
for j := 0; j < width; j++ {
tiles[i][j] = Tile{
IsOcean: true,
}
}
}
return tiles
}
func newCellGrid(width int, height int) [][]float64 {
cells := make([][]float64, height)
for i := 0; i < height; i++ {
cells[i] = make([]float64, width)
}
return cells
}
func getDistanceToNearestOcean(x int, y int, tiles [][]Tile) int {
var subjects []Tile
xMax := x
yMax := y
if len(tiles)-yMax > yMax {
yMax = len(tiles) - yMax
}
if len(tiles[0])-xMax > xMax {
xMax = len(tiles[0]) - xMax
}
distance := xMax
if yMax > distance {
distance = yMax
}
a := geometry.Point{X: float64(x), Y: float64(y)}
if tiles[y][x].IsOcean {
return 0
}
for d := 0; d < len(tiles)-y; d++ {
subjects = getTilesAtDistance(d, a, tiles)
for _, s := range subjects {
if s.IsOcean {
return d
}
}
}
return distance
}
func getTilesAtDistance(distance int, origin geometry.Point, tiles [][]Tile) []Tile {
var result []Tile
x := int(origin.X)
y := int(origin.Y)
xMax := len(tiles[0]) - 1
xMin := 0
yMax := len(tiles) - 1
yMin := 0
if x+distance < len(tiles[0])-1 {
xMax = x + distance
}
if x-distance > 0 {
xMin = x - distance
}
if y+distance < len(tiles)-1 {
yMax = y + distance
}
if y-distance > 0 {
yMax = y - distance
}
for j := yMin; j < yMax; j++ {
result = append(result, tiles[j][xMin])
}
for j := yMin; j < yMax; j++ {
result = append(result, tiles[j][xMax])
}
for j := xMin; j < xMax; j++ {
result = append(result, tiles[yMin][j])
}
for j := xMin; j < xMax; j++ {
result = append(result, tiles[yMax][j])
}
return result
}
func generateHumidities(tiles [][]Tile) [][]Tile {
var humidity int
for y, row := range tiles {
for x, h := range row {
humidity = 100 - h.Altitude
tiles[y][x].Humidity = humidity
}
}
return tiles
}
func generateTemperatures(tiles [][]Tile, minLatitude int, maxLatitude int) [][]Tile {
var latitude, modifier float64
modifier = float64(minLatitude) / float64(maxLatitude)
for y, row := range tiles {
latitude = float64(y) * modifier
for x, h := range row {
tiles[y][x].Temperature = region.GetTemperature(int(math.Abs(latitude)), h.Altitude)
}
}
return tiles
}
func generateHeightmap(ctx context.Context, width int, height int) [][]float64 {
var nx, ny, altitude float64
cells := newCellGrid(width, height)
noise := opensimplex.New(random.Int63n(ctx, 10000))
for y := 0; y < height; y++ {
for x := 0; x < width; x++ {
nx = float64(x) / float64(width)
ny = float64(y) / float64(height)
altitude = noise.Eval2(2*nx, 2*ny)
altitude += 0.5 * noise.Eval2(4*nx, 4*ny)
altitude += 0.25 * noise.Eval2(8*nx, 8*ny)
altitude += 0.125 * noise.Eval2(16*nx, 16*ny)
altitude += 0.0675 * noise.Eval2(32*nx, 32*ny)
altitude += 0.03375 * noise.Eval2(64*nx, 64*ny)
altitude = altitude * 100
if altitude < -100 {
altitude = -100
}
if altitude > 100 {
altitude = 100
}
cells[y][x] = altitude
}
}
return cells
}
func generateLand(ctx context.Context, tiles [][]Tile) ([][]Tile, error) {
height := len(tiles)
width := len(tiles[0])
heightmap := generateHeightmap(ctx, width, height)
for y, row := range heightmap {
for x, h := range row {
if h > 0 {
tiles[y][x].IsOcean = false
}
tiles[y][x].Altitude = int(h)
}
}
tiles = generateTemperatures(tiles, 0, 80)
tiles = generateHumidities(tiles)
return tiles, nil
} | pkg/world/tiles.go | 0.710528 | 0.501343 | tiles.go | starcoder |
package mos65c02
// Lda implements the LDA (load A) instruction, which saves the EffVal
// into the A register.
func Lda(c *CPU) {
c.ApplyNZ(c.EffVal)
c.A = c.EffVal
}
// Ldx implements the LDX (load X) instruction, which saves EffVal into
// X.
func Ldx(c *CPU) {
c.ApplyNZ(c.EffVal)
c.X = c.EffVal
}
// Ldy implements the LDY (load Y) instruction, which saves EffVal into
// Y.
func Ldy(c *CPU) {
c.ApplyNZ(c.EffVal)
c.Y = c.EffVal
}
// Pha implements the PHA (push A) instruction, which pushes the current
// value of the A register onto the stack.
func Pha(c *CPU) {
c.PushStack(c.A)
}
// Php implements the PHP (push P) instruction, which pushes the current
// value of the P register onto the stack. It has no connection to
// PHP-the-language.
func Php(c *CPU) {
c.PushStack(c.P)
}
// Phx implements the PHX (push X) instruction, which pushes the current
// value of the X register onto the stack.
func Phx(c *CPU) {
c.PushStack(c.X)
}
// Phy implements the PHY (push Y) instruction, which pushes the current
// value of the Y register onto the stack.
func Phy(c *CPU) {
c.PushStack(c.Y)
}
// Pla implements the PLA (pull A) instruction, which pops the top of
// the stack and saves that value in the A register.
func Pla(c *CPU) {
c.A = c.PopStack()
c.ApplyNZ(c.A)
}
// Plp implements the PLP (pull P) instruction, which pops the top of
// the stack and saves that value in the P register.
func Plp(c *CPU) {
c.P = c.PopStack()
}
// Plx implements the PLX (pull X) instruction, which pops the top of
// the stack and saves that value in the X register.
func Plx(c *CPU) {
c.X = c.PopStack()
c.ApplyNZ(c.X)
}
// Ply implements the PLY (pull Y) instruction, which pops the top of
// the stack and saves that value in the Y register.
func Ply(c *CPU) {
c.Y = c.PopStack()
c.ApplyNZ(c.Y)
}
// Sta implements the STA (store A) instruction, which saves the current
// value of the A register at the effective address.
func Sta(c *CPU) {
c.Set(c.EffAddr, c.A)
}
// Stx implements the STX (store X) instruction, which saves the current
// value of the X register at the effective address.
func Stx(c *CPU) {
c.Set(c.EffAddr, c.X)
}
// Sty implements the STY (store Y) instruction, which saves the current
// value of the Y register at the effective address.
func Sty(c *CPU) {
c.Set(c.EffAddr, c.Y)
}
// Stz implements the STZ (store zero) instruction, which sets the byte
// at the effective address to zero.
func Stz(c *CPU) {
c.Set(c.EffAddr, 0)
}
// Tax implements the TAX (transfer A to X) instruction, which sets the
// X register equal to the value of the A register.
func Tax(c *CPU) {
c.ApplyNZ(c.A)
c.X = c.A
}
// Tay implements the TAY (transfer A to Y) instruction, which sets the
// Y register equal to the value of the A register.
func Tay(c *CPU) {
c.ApplyNZ(c.A)
c.Y = c.A
}
// Tsx implements the TSX (transfer S to X) instruction, which sets the
// X register equal to the value of the S register.
func Tsx(c *CPU) {
c.ApplyNZ(c.S)
c.X = c.S
}
// Txa implements the TXA (transfer X to A) instruction, which sets the
// A register equal to the value of the X register.
func Txa(c *CPU) {
c.ApplyNZ(c.X)
c.A = c.X
}
// Txs implements the TXS (transfer X to S) instruction, which sets the
// S register equal to the value of the X register.
func Txs(c *CPU) {
c.ApplyNZ(c.X)
c.S = c.X
}
// Tya implements the TYA (transfer Y to A) instruction, which sets the
// A register equal to the value of the Y register.
func Tya(c *CPU) {
c.ApplyNZ(c.Y)
c.A = c.Y
} | pkg/mos65c02/i_loadstor.go | 0.685002 | 0.445288 | i_loadstor.go | starcoder |
package projection
import (
"errors"
"math"
"github.com/tomchavakis/turf-go/geojson/geometry"
meta "github.com/tomchavakis/turf-go/meta/coordEach"
)
const a = 6378137.0
// ToMercator converts a WGS84 GeoJSON object into Mercator (EPSG:900913) projection
func ToMercator(geojson interface{}) (interface{}, error) {
return Convert(geojson, "mercator")
}
// ToWgs84 Converts a Mercator (EPSG:900913) GeoJSON object into WGS84 projection
func ToWgs84(geojson interface{}) (interface{}, error) {
return Convert(geojson, "wgs84")
}
// ConvertToMercator converts a WGS84 lonlat to Mercator (EPSG:3857 sometimes knows as EPSG:900913) projection
// https://spatialreference.org/ref/sr-org/epsg3857-wgs84-web-mercator-auxiliary-sphere/
func ConvertToMercator(lonlat []float64) []float64 {
rad := math.Pi / 180.0
maxExtend := 2 * math.Pi * a / 2.0 // 20037508.342789244
// longitudes passing the 180th meridian
var adjusted float64
if math.Abs(lonlat[0]) <= 180.0 {
adjusted = lonlat[0]
} else {
adjusted = lonlat[0] - float64(sign(lonlat[0]))*360.0
}
xy := []float64{
a * adjusted * rad,
a * math.Log(math.Tan(math.Pi*0.25+0.5*lonlat[1]*rad)),
}
if xy[0] > maxExtend {
xy[0] = maxExtend
}
if xy[0] < -maxExtend {
xy[0] = -maxExtend
}
if xy[1] > maxExtend {
xy[1] = maxExtend
}
if xy[1] < -maxExtend {
xy[1] = -maxExtend
}
return xy
}
// ConvertToWgs84 convert 900913 x/y values to lon/lat
func ConvertToWgs84(xy []float64) []float64 {
dgs := 180.0 / math.Pi
return []float64{
xy[0] * dgs / a,
(math.Pi*0.5 - 2.0*math.Atan(math.Exp(-xy[1]/a))) * dgs,
}
}
// Convert converts a GeoJSON coordinates to the defined projection
// gjson is GeoJSON Feature or geometry
// projection defines the projection system to convert the coordinates to
func Convert(geojson interface{}, projection string) (interface{}, error) {
// Validation
if geojson == nil {
return nil, errors.New("geojson is required")
}
_, err := meta.CoordEach(geojson, func(p geometry.Point) geometry.Point {
if projection == "mercator" {
res := ConvertToMercator([]float64{p.Lng, p.Lat})
p.Lng = res[0]
p.Lat = res[1]
} else {
res := ConvertToWgs84([]float64{p.Lng, p.Lat})
p.Lng = res[0]
p.Lat = res[1]
}
return p
}, nil)
if err != nil {
return nil, err
}
return geojson, nil
}
func sign(x float64) int {
if x < 0 {
return -1
} else if x > 0 {
return 1
}
return 0
} | projection/projection.go | 0.819785 | 0.477981 | projection.go | starcoder |
package GoSDK
import ()
// Filter is the atomic structure inside a query it contains
// A field a value and an operator
type Filter struct {
Field string
Value interface{}
Operator string
}
//Ordering dictates the order the query values are returned in. True is Ascending, False is Descending
type Ordering struct {
SortOrder bool
OrderKey string
}
//Query contains configuration information for the request against a collection. It creates a subset of results for the operation to be performed upon
type Query struct {
Filters [][]Filter
PageSize int
PageNumber int
Order []Ordering
Columns []string
}
//NewQuery allocates a new query
func NewQuery() *Query {
query := &Query{
Filters: [][]Filter{[]Filter{}},
Order: []Ordering{},
}
return query
}
//EqualTo adds an equality constraint to the query. Similar to "WHERE foo = 'bar'"
func (q *Query) EqualTo(field string, value interface{}) {
f := Filter{
Field: field,
Value: value,
Operator: "=",
}
q.Filters[0] = append(q.Filters[0], f)
}
//GreaterThan adds the corresponding constraint to the query. Similar to "WHERE foo > 3"
func (q *Query) GreaterThan(field string, value interface{}) {
f := Filter{
Field: field,
Value: value,
Operator: ">",
}
q.Filters[0] = append(q.Filters[0], f)
}
//GreaterThanEqualTo adds the corresponding constraint to the query. Similar to "WHERE foo >= 3"
func (q *Query) GreaterThanEqualTo(field string, value interface{}) {
f := Filter{
Field: field,
Value: value,
Operator: ">=",
}
q.Filters[0] = append(q.Filters[0], f)
}
//LessThan adds the corresponding constraint to the query. Similar to "WHERE foo < 3"
func (q *Query) LessThan(field string, value interface{}) {
f := Filter{
Field: field,
Value: value,
Operator: "<",
}
q.Filters[0] = append(q.Filters[0], f)
}
//LessThanEqualTo adds the corresponding constraint to the query. Similar to "WHERE foo <= 3"
func (q *Query) LessThanEqualTo(field string, value interface{}) {
f := Filter{
Field: field,
Value: value,
Operator: "<=",
}
q.Filters[0] = append(q.Filters[0], f)
}
//NotEqualTo adds the corresponding constraint to the query. Similar to "WHERE foo != 'bar'"
func (q *Query) NotEqualTo(field string, value interface{}) {
f := Filter{
Field: field,
Value: value,
Operator: "!=",
}
q.Filters[0] = append(q.Filters[0], f)
}
//Matches allows fuzzy matching on string columns. Use PCRE syntax.
func (q *Query) Matches(field, regex string) {
f := Filter{
Field: field,
Value: regex,
Operator: "~",
}
q.Filters[0] = append(q.Filters[0], f)
}
//Or applies an or constraint to the query.
func (q *Query) Or(orQuery *Query) {
q.Filters = append(q.Filters, orQuery.Filters...)
}
// Map will produce the kind of thing that is sent as a query
// either as the body of a request or as a queryString
func (q *Query) serialize() map[string]interface{} {
qrMap := make(map[string]interface{})
qrMap["PAGENUM"] = q.PageNumber
qrMap["PAGESIZE"] = q.PageSize
qrMap["SELECTCOLUMNS"] = q.Columns
sortMap := make([]map[string]interface{}, len(q.Order))
for i, ordering := range q.Order {
sortMap[i] = make(map[string]interface{})
if ordering.SortOrder {
sortMap[i]["ASC"] = ordering.OrderKey
} else {
sortMap[i]["DESC"] = ordering.OrderKey
}
}
qrMap["SORT"] = sortMap
filterSlice := make([][]map[string]interface{}, len(q.Filters))
for i, querySlice := range q.Filters {
qm := make([]map[string]interface{}, len(querySlice))
for j, query := range querySlice {
mapForQuery := make(map[string]interface{})
var op string
switch query.Operator {
case "=":
op = "EQ"
case ">":
op = "GT"
case "<":
op = "LT"
case ">=":
op = "GTE"
case "<=":
op = "LTE"
case "/=", "!=":
op = "NEQ"
case "~":
op = "RE"
default:
op = "WHAT_THE_HELL_ARE_YOU_DOING"
}
mapForQuery[op] = []map[string]interface{}{map[string]interface{}{query.Field: query.Value}}
qm[j] = mapForQuery
}
filterSlice[i] = qm
}
qrMap["FILTERS"] = filterSlice
return qrMap
} | query.go | 0.683314 | 0.502686 | query.go | starcoder |
package eval
import (
"github.com/kocircuit/kocircuit/lang/circuit/model"
"github.com/kocircuit/kocircuit/lang/go/kit/tree"
)
type Figure interface{}
type Empty struct{}
func (e Empty) String() string { return tree.Sprint(e) }
func (e Empty) Link(span *model.Span, name string, monadic bool) (Shape, Effect, error) {
return nil, nil, span.Errorf(nil, "linking argument to empty")
}
func (e Empty) Select(span *model.Span, path model.Path) (Shape, Effect, error) {
return e, nil, nil
}
func (e Empty) Augment(span *model.Span, _ Fields) (Shape, Effect, error) {
return nil, nil, span.Errorf(nil, "augmenting an empty")
}
func (e Empty) Invoke(span *model.Span) (Shape, Effect, error) {
return nil, nil, span.Errorf(nil, "invoking an empty")
}
type Integer struct{ Value_ int64 }
func (v Integer) String() string { return tree.Sprint(v) }
func (v Integer) Link(span *model.Span, name string, monadic bool) (Shape, Effect, error) {
return nil, nil, span.Errorf(nil, "linking argument to integer")
}
func (v Integer) Select(span *model.Span, path model.Path) (Shape, Effect, error) {
if len(path) > 0 {
return nil, nil, span.Errorf(nil, "selecting %v into integer", path)
}
return v, nil, nil
}
func (v Integer) Augment(span *model.Span, _ Fields) (Shape, Effect, error) {
return nil, nil, span.Errorf(nil, "augmenting an integer")
}
func (v Integer) Invoke(span *model.Span) (Shape, Effect, error) {
return nil, nil, span.Errorf(nil, "invoking an integer")
}
type Float struct{ Value_ float64 }
func (v Float) String() string { return tree.Sprint(v) }
func (v Float) Link(span *model.Span, name string, monadic bool) (Shape, Effect, error) {
return nil, nil, span.Errorf(nil, "linking argument to float")
}
func (v Float) Select(span *model.Span, path model.Path) (Shape, Effect, error) {
if len(path) > 0 {
return nil, nil, span.Errorf(nil, "selecting %v into float", path)
}
return v, nil, nil
}
func (v Float) Augment(span *model.Span, _ Fields) (Shape, Effect, error) {
return nil, nil, span.Errorf(nil, "augmenting a float")
}
func (v Float) Invoke(span *model.Span) (Shape, Effect, error) {
return nil, nil, span.Errorf(nil, "invoking a float")
}
type Bool struct{ Value_ bool }
func (v Bool) String() string { return tree.Sprint(v) }
func (v Bool) Link(span *model.Span, name string, monadic bool) (Shape, Effect, error) {
return nil, nil, span.Errorf(nil, "linking argument to bool")
}
func (v Bool) Select(span *model.Span, path model.Path) (Shape, Effect, error) {
if len(path) > 0 {
return nil, nil, span.Errorf(nil, "selecting %v into bool", path)
}
return v, nil, nil
}
func (v Bool) Augment(span *model.Span, _ Fields) (Shape, Effect, error) {
return nil, nil, span.Errorf(nil, "augmenting a bool")
}
func (v Bool) Invoke(span *model.Span) (Shape, Effect, error) {
return nil, nil, span.Errorf(nil, "invoking a bool")
}
type String struct{ Value_ string }
func (v String) String() string { return tree.Sprint(v) }
func (v String) Link(span *model.Span, name string, monadic bool) (Shape, Effect, error) {
return nil, nil, span.Errorf(nil, "linking argument to string")
}
func (v String) Select(span *model.Span, path model.Path) (Shape, Effect, error) {
if len(path) > 0 {
return nil, nil, span.Errorf(nil, "selecting %v into string", path)
}
return v, nil, nil
}
func (v String) Augment(span *model.Span, _ Fields) (Shape, Effect, error) {
return nil, nil, span.Errorf(nil, "augmenting a string")
}
func (v String) Invoke(span *model.Span) (Shape, Effect, error) {
return nil, nil, span.Errorf(nil, "invoking a string")
} | lang/circuit/eval/figure.go | 0.830491 | 0.411111 | figure.go | starcoder |
package layers
import (
"fmt"
"math"
"strings"
)
type Polynomial struct {
layer
learner
Degree int
input []float64
terms [][]float64
}
func (l *Polynomial) Estimate(input []float64) []float64 {
copy(l.input, input)
for j := range l.terms {
var p float64
for k := range l.terms[j] {
l.terms[j][k] = math.Pow(input[j], float64(k))
p = math.FMA(l.weights[j][k], l.terms[j][k], p)
}
l.output[j] = input[j] * p
}
return l.output
}
func (l *Polynomial) Minimize(gradients []float64) []float64 {
for j := range l.weights {
var g float64
for k := range l.weights[j] {
d := float64(k + 1)
g = math.FMA(d*l.weights[j][k], l.terms[j][k], g)
l.localGradients[j][k] = gradients[j] * l.input[j] * l.terms[j][k]
}
gradients[j] = gradients[j] * g
}
return gradients
}
func (l *Polynomial) SetShape(shape []uint64) {
l.layer.SetShape(shape)
n := l.outputShape.Size()
l.input = make([]float64, n)
l.localGradients = make([][]float64, n)
l.terms = make([][]float64, n)
l.weights = make([][]float64, n)
for j := 0; j < n; j++ {
l.localGradients[j] = make([]float64, l.Degree)
l.terms[j] = make([]float64, l.Degree)
l.weights[j] = Random(l.Degree)
}
}
func (l *Polynomial) String() string {
return l.toYAML()
}
func (l *Polynomial) toYAML() string {
var s []string
s = append(s, "polynomial:")
s = append(s, fmt.Sprintf("%sgradients:", indent))
for _, v := range l.localGradients {
s = append(s, fmt.Sprintf("%s%s- %g", indent, indent, v))
}
s = append(s, fmt.Sprintf("%soutputs:", indent))
for _, v := range l.output {
s = append(s, fmt.Sprintf("%s%s- %g", indent, indent, v))
}
s = append(s, fmt.Sprintf("%spolynomials:", indent))
for j := range l.terms {
s = append(s, fmt.Sprintf("%s%s-", indent, indent))
s = append(s, fmt.Sprintf("%s%sinput: %g", indent, indent, l.input[j]))
s = append(s, fmt.Sprintf("%s%scoefficients:", indent, indent))
for _, v := range l.weights[j] {
s = append(s, fmt.Sprintf("%s%s%s- %g", indent, indent, indent, v))
}
s = append(s, fmt.Sprintf("%s%sterms:", indent, indent))
for _, v := range l.terms[j] {
s = append(s, fmt.Sprintf("%s%s%s- %g", indent, indent, indent, v))
}
}
return strings.Join(s, eol)
} | pkg/layers/polynomial.go | 0.57523 | 0.434821 | polynomial.go | starcoder |
package ipcalc
import (
"net"
"strconv"
"strings"
)
// CopyIP returns a copy of a net.IP address.
func CopyIP(ip net.IP) net.IP {
return append(net.IP(nil), ip...)
}
// IP returns an IP address of the correct byte length.
func IP(ip net.IP) net.IP {
if x := ip.To4(); x != nil {
return CopyIP(x)
}
return CopyIP(ip)
}
// IPVersion returns the IP address version for the given net.IP.
func IPVersion(ip net.IP) int {
if len(IP(ip)) == net.IPv4len {
return 4
}
return 6
}
// IPSize returns the address size in bytes for the given net.IP.
func IPSize(ip net.IP) int {
if IPVersion(ip) == 4 {
return net.IPv4len
}
return net.IPv6len
}
// ParseMask returns a net.IPMask from a string representation.
func ParseMask(mask string) net.IPMask {
return net.IPMask(IP(net.ParseIP(mask)))
}
// ParseIPMask returns a net.IP and net.IPMask from an ip[/mask] string representation.
// The IPMask need not be in CIDR format, if it starts with ~ then it will be inverted.
func ParseIPMask(addr string) (net.IP, net.IPMask, error) {
v := strings.Split(addr, "/")
ip := net.ParseIP(v[0])
if ip == nil {
return nil, nil, &net.ParseError{Type: "IP address", Text: v[0]}
}
var mask net.IPMask
if len(v) > 2 {
return nil, nil, &net.ParseError{Type: "IP/Mask", Text: addr}
} else if len(v) == 2 {
size := IPSize(ip) * 8
wildcard := false
if strings.HasPrefix(v[1], "~") {
wildcard = true
v[1] = v[1][1:]
}
if bits, err := strconv.Atoi(v[1]); err == nil {
mask = net.CIDRMask(bits, size)
} else {
mask = ParseMask(v[1])
}
if wildcard {
mask = Complement(mask)
}
if mask == nil {
return nil, nil, &net.ParseError{Type: "Mask", Text: v[1]}
}
}
return ip, mask, nil
}
// Complement returns the complement of a given net.IPMask, commonly used as a Wildcard Mask.
// e.g., Complement(255.255.254.0) -> 0.0.1.255.
func Complement(mask net.IPMask) net.IPMask {
if mask == nil {
return nil
}
w := make(net.IPMask, len(mask))
for i := 0; i < len(mask); i++ {
w[i] = ^mask[i]
}
return w
}
// NextIP returns the next IP address.
// e.g., NextIP(192.168.0.0) -> 192.168.0.1.
func NextIP(ip net.IP) net.IP {
ip = IP(ip)
for i := IPSize(ip) - 1; i >= 0; i-- {
ip[i]++
if ip[i] != 0x00 {
break
}
}
return ip
}
// PrevIP returns the previous IP address.
// e.g., PrevIP(192.168.0.1) -> 192.168.0.0.
func PrevIP(ip net.IP) net.IP {
ip = IP(ip)
for i := IPSize(ip) - 1; i >= 0; i-- {
ip[i]--
if ip[i] != 0xff {
break
}
}
return ip
}
// Add returns the sum of two net.IP addresses with the given mask.
// e.g., Add(192.168.0.1, 192.168.0.2, 0.0.0.255) -> 192.168.0.3.
func Add(a, b net.IP, mask net.IPMask) net.IP {
a = IP(a)
b = IP(b)
for i := len(mask) - 1; i >= 0; i-- {
prev := a[i]
a[i] += b[i] & mask[i]
if a[i] < prev && i > 0 {
for j := i - 1; j >= 0; j-- {
a[j]++
if a[j] != 0x00 {
break
}
}
}
}
return a
}
// Substract returns the difference of two net.IP addresses with the given mask.
// e.g., Substract(192.168.0.3, 192.168.0.1, 0.0.0.255) -> 192.168.0.2.
func Substract(a, b net.IP, mask net.IPMask) net.IP {
a = IP(a)
b = IP(b)
for i := len(mask) - 1; i >= 0; i-- {
prev := a[i]
a[i] -= b[i] & mask[i]
if a[i] > prev && i > 0 {
for j := i - 1; j >= 0; j-- {
a[j]--
if a[j] != 0xff {
break
}
}
}
}
return a
}
// And returns the bitwise AND of two net.IP addresses.
// e.g., And(192.168.0.255, 192.168.255.128) -> 192.168.0.128.
func And(a, b net.IP) net.IP {
a = IP(a)
b = IP(b)
for i := 0; i < IPSize(b); i++ {
a[i] &= b[i]
}
return a
}
// Or returns the bitwise OR of two net.IP addresses.
// e.g., Or(192.168.0.15, 192.168.10.128) -> 192.168.0.128.
func Or(a, b net.IP) net.IP {
a = IP(a)
b = IP(b)
for i := 0; i < IPSize(b); i++ {
a[i] |= b[i]
}
return a
}
// Xor returns the bitwise XOR of two net.IP addresses.
// e.g., Xor(192.0.2.1, 172.31.128.17) -> 172.16.17.32.
func Xor(a, b net.IP) net.IP {
a = IP(a)
b = IP(b)
for i := 0; i < IPSize(b); i++ {
a[i] ^= b[i]
}
return a
}
// Merge combines two net.IP addresses with the given mask.
// For bit i, if mask[i] is set then b[i] is returned, otherwise a[i] is returned.
// e.g., Merge(192.168.0.1, 172.16.32.100, 0.0.0.255) -> 192.168.0.100.
func Merge(a, b net.IP, mask net.IPMask) net.IP {
a = IP(a)
b = IP(b)
ip := make(net.IP, len(mask))
for i := 0; i < len(mask); i++ {
ip[i] = a[i]&^mask[i] | b[i]&mask[i]
}
return ip
}
// Broadcast returns the broadcast IP address for the given IPNet.
func Broadcast(n net.IPNet) net.IP {
ip := make(net.IP, IPSize(n.IP))
for i := 0; i < IPSize(n.IP); i++ {
ip[i] = n.IP[i] | ^n.Mask[i]
}
return ip
}
// NextSubnet returns the next subnet.
// e.g., NextSubnet(192.168.0.0/24) -> 192.168.1.0/24.
func NextSubnet(n net.IPNet) net.IPNet {
return net.IPNet{
IP: NextIP(Broadcast(n)),
Mask: n.Mask,
}
}
// PrevSubnet returns the previous subnet.
// e.g., PrevSubnet(192.168.1.0/24) -> 192.168.0.0/24.
func PrevSubnet(n net.IPNet) net.IPNet {
return net.IPNet{
IP: PrevIP(n.IP).Mask(n.Mask),
Mask: n.Mask,
}
}
// Contains returns whether the first net.IPNet wholly contains the second one.
// If either net has a non-standard mask then the result is undefined.
func Contains(a, b net.IPNet) bool {
return a.Contains(b.IP) && a.Contains(Broadcast(b))
} | ipcalc.go | 0.867682 | 0.413063 | ipcalc.go | starcoder |
package vmath
import (
"fmt"
"math"
"github.com/maja42/vmath/math32"
)
// Quat represents a Quaternion.
type Quat struct {
W float32
X, Y, Z float32
}
func (q Quat) String() string {
return fmt.Sprintf("Quat[%f, %f x %f x %f]", q.W, q.X, q.Y, q.Z)
}
// IdentQuat returns the identity quaternion.
func IdentQuat() Quat {
return Quat{1, 0, 0, 0}
}
// QuatFromAxisAngle returns a quaternion representing a rotation around a given axis.
func QuatFromAxisAngle(axis Vec3f, rad float32) Quat {
axis = axis.Normalize()
sinAngle, cosAngle := math32.Sincos(rad * 0.5)
return Quat{
cosAngle,
axis[0] * sinAngle,
axis[1] * sinAngle,
axis[2] * sinAngle,
}
}
// QuatFromEuler returns a quaternion based on the given euler rotations.
// Axis: yaw: Z, pitch: Y, roll: X
func QuatFromEuler(yaw, pitch, roll float32) Quat {
// Source: https://en.wikipedia.org/wiki/Conversion_between_quaternions_and_Euler_angles
sinY, cosY := math32.Sincos(yaw * 0.5)
sinP, cosP := math32.Sincos(pitch * 0.5)
sinR, cosR := math32.Sincos(roll * 0.5)
return Quat{
W: cosR*cosP*cosY + sinR*sinP*sinY,
X: sinR*cosP*cosY - cosR*sinP*sinY,
Y: cosR*sinP*cosY + sinR*cosP*sinY,
Z: cosR*cosP*sinY - sinR*sinP*cosY,
}
}
// Equals compares two quaternions.
// Uses the default Epsilon as relative tolerance.
func (q Quat) Equals(other Quat) bool {
return q.EqualsEps(other, Epsilon)
}
// EqualsEps compares two quaternions, using the given epsilon as a relative tolerance.
func (q Quat) EqualsEps(other Quat, epsilon float32) bool {
return EqualEps(q.W, other.W, epsilon) &&
EqualEps(q.X, other.X, epsilon) && EqualEps(q.Y, other.Y, epsilon) && EqualEps(q.Z, other.Z, epsilon)
}
// Vec4f returns the quaternion as a vector representation.
func (q Quat) Vec4f() Vec4f {
return Vec4f{q.W, q.X, q.Y, q.Z}
}
// Add performs component-wise addition.
func (q Quat) Add(other Quat) Quat {
return Quat{q.W + other.W, q.X + other.X, q.Y + other.Y, q.Z + other.Z}
}
// AddScalar performs component-wise scalar addition.
func (q Quat) AddScalar(s float32) Quat {
return Quat{q.W + s, q.X + s, q.Y + s, q.Z + s}
}
// Sub performs component-wise subtraction.
func (q Quat) Sub(other Quat) Quat {
return Quat{q.W - other.W, q.X - other.X, q.Y - other.Y, q.Z - other.Z}
}
// SubScalar performs component-wise scalar subtraction.
func (q Quat) SubScalar(s float32) Quat {
return Quat{q.W - s, q.X - s, q.Y - s, q.Z - s}
}
// Mul performs component-wise multiplication.
func (q Quat) Mul(other Quat) Quat {
return Quat{q.W * other.W, q.X * other.X, q.Y * other.Y, q.Z * other.Z}
}
// MulScalar performs component-wise scalar multiplication.
func (q Quat) MulScalar(s float32) Quat {
return Quat{q.W * s, q.X * s, q.Y * s, q.Z * s}
}
// Div performs component-wise division.
func (q Quat) Div(other Quat) Quat {
return Quat{q.W / other.W, q.X / other.X, q.Y / other.Y, q.Z / other.Z}
}
// DivScalar performs component-wise scalar division.
func (q Quat) DivScalar(s float32) Quat {
return Quat{q.W / s, q.X / s, q.Y / s, q.Z / s}
}
// Rotate multiplies two quaternions, performing a rotation.
func (q Quat) Rotate(other Quat) Quat {
return Quat{
(other.W * q.W) - (other.X * q.X) - (other.Y * q.Y) - (other.Z * q.Z),
(other.X * q.W) + (other.W * q.X) - (other.Z * q.Y) + (other.Y * q.Z),
(other.Y * q.W) + (other.Z * q.X) + (other.W * q.Y) - (other.X * q.Z),
(other.Z * q.W) - (other.Y * q.X) + (other.X * q.Y) + (other.W * q.Z),
}
}
// RotateX rotates the quaternion with a given angle round its X axis.
func (q Quat) RotateX(rad float32) Quat {
// Source: http://glmatrix.net/docs/module-quat.html
sinR, cosR := math32.Sincos(rad * 0.5)
return Quat{
q.W*cosR - q.X*sinR,
q.X*cosR + q.W*sinR,
q.Y*cosR + q.Z*sinR,
q.Z*cosR - q.Y*sinR,
}
}
// RotateY rotates the quaternion with a given angle round its Y axis.
func (q Quat) RotateY(rad float32) Quat {
// Source: http://glmatrix.net/docs/module-quat.html
sinR, cosR := math32.Sincos(rad * 0.5)
return Quat{
q.W*cosR - q.Y*sinR,
q.X*cosR - q.Z*sinR,
q.Y*cosR + q.W*sinR,
q.Z*cosR + q.X*sinR,
}
}
// RotateZ rotates the quaternion with a given angle round its Y axis.
func (q Quat) RotateZ(rad float32) Quat {
// Source: http://glmatrix.net/docs/module-quat.html
sinR, cosR := math32.Sincos(rad * 0.5)
return Quat{
q.W*cosR - q.Z*sinR,
q.X*cosR + q.Y*sinR,
q.Y*cosR - q.X*sinR,
q.Z*cosR + q.W*sinR,
}
}
// Dot performs a dot product with another quaternion.
func (q Quat) Dot(other Quat) float32 {
return q.W*other.W + q.X*other.X + q.Y*other.Y + q.Z*other.Z
}
// Inverse returns the inverse quaternion.
// This is the rotation around the same axis, but in the opposite direction.
func (q Quat) Inverse() Quat {
return Quat{-q.W, q.X, q.Y, q.Z}
}
// Conjugate returns the conjugated quaternion.
// This is a rotation with the same angle, but the axis is mirrored.
func (q Quat) Conjugate() Quat {
return Quat{q.W, -q.X, -q.Y, -q.Z}
}
// Length returns the quaternion's length.
func (q Quat) Length() float32 {
return math32.Sqrt(q.W*q.W + q.X*q.X + q.Y*q.Y + q.Z*q.Z)
}
// SquareLength returns the quaternion's squared length.
func (q Quat) SquareLength() float32 {
return q.W*q.W + q.X*q.X + q.Y*q.Y + q.Z*q.Z
}
// Normalize the quaternion.
// The quaternion must be non-zero.
func (q Quat) Normalize() Quat {
length := q.Length()
if length == 1 { // shortcut
return q
}
return Quat{q.W / length, q.X / length, q.Y / length, q.Z / length}
}
// Right returns the up-vector in the quaternion's coordinate system.
func (q Quat) Up() Vec3f {
return q.RotateVec(Vec3f{0, 1, 0})
}
// Forward returns the forward-vector in the quaternion's coordinate system.
func (q Quat) Forward() Vec3f {
return q.RotateVec(Vec3f{0, 0, -1})
}
// Right returns the right-vector in the quaternion's coordinate system.
func (q Quat) Right() Vec3f {
return q.RotateVec(Vec3f{1, 0, 0})
}
// Axis returns the quaternion's rotation axis.
// The returned axis is not normalized.
// If there is no rotation, the axis can be zero.
func (q Quat) Axis() Vec3f {
return Vec3f{q.X, q.Y, q.Z}
}
// Angle returns the quaternion's rotation angle around its axis.
func (q Quat) Angle() float32 {
q = q.Normalize()
return math32.Acos(q.W) * 2
}
// AxisRotation returns the quaternion's rotation angle and axis.
func (q Quat) AxisRotation() (Vec3f, float32) {
// Based on: http://glmatrix.net/docs/module-quat.html
rad := q.Angle()
s := math32.Sin(rad * 0.5)
if s < Epsilon { // no rotation
return Vec3f{1, 0, 0}, rad
}
return Vec3f{q.X / s, q.Y / s, q.Z / s}, rad
}
// ToEuler converts the quaternion into euler rotations.
// Axis: yaw: Z, pitch: Y, roll: X
func (q Quat) ToEuler() (yaw, pitch, roll float32) {
// Source: https://en.wikipedia.org/wiki/Conversion_between_quaternions_and_Euler_angles
// roll (x-axis rotation)
srcp := 2 * (q.W*q.X + q.Y*q.Z)
crcp := 1 - 2*(q.X*q.X+q.Y*q.Y)
roll = math32.Atan2(srcp, crcp)
// pitch (y-axis rotation)
sp := 2 * (q.W*q.Y - q.Z*q.X)
if math32.Abs(sp) >= 1 {
pitch = math32.Copysign(math.Pi/2, sp) // use 90° if out of range
} else {
pitch = math32.Asin(sp)
}
// yaw (z-axis rotation)
sycp := 2 * (q.W*q.Z + q.X*q.Y)
cycp := 1 - 2*(q.Y*q.Y+q.Z*q.Z)
yaw = math32.Atan2(sycp, cycp)
return
}
// AngleTo returns the angle between two quaternions by comparing one of their axis.
func (q Quat) AngleTo(other Quat) float32 {
return q.Forward().Angle(other.Forward())
}
// Mat4f returns a homogeneous 3D rotation matrix based on the quaternion.
func (q Quat) Mat4f() Mat4f {
return Mat4f{
1 - 2*q.Y*q.Y - 2*q.Z*q.Z, 2*q.X*q.Y + 2*q.W*q.Z, 2*q.X*q.Z - 2*q.W*q.Y, 0,
2*q.X*q.Y - 2*q.W*q.Z, 1 - 2*q.X*q.X - 2*q.Z*q.Z, 2*q.Y*q.Z + 2*q.W*q.X, 0,
2*q.X*q.Z + 2*q.W*q.Y, 2*q.Y*q.Z - 2*q.W*q.X, 1 - 2*q.X*q.X - 2*q.Y*q.Y, 0,
0, 0, 0, 1,
}
}
// RotateVec rotates a vector.
func (q Quat) RotateVec(v Vec3f) Vec3f {
// Source: https://gamedev.stackexchange.com/a/50545/39091
s := q.W
u := Vec3f{q.X, q.Y, q.Z}
a := u.MulScalar(2 * u.Dot(v))
b := v.MulScalar(s*s - u.Dot(u))
c := u.Cross(v).MulScalar(2 * s)
return a.Add(b).Add(c)
}
// Lerp performs a linear interpolation to another quaternion.
// The parameter t should be in range [0, 1].
func (q Quat) Lerp(other Quat, t float32) Quat {
return other.Sub(q).MulScalar(t).Add(q)
}
// Slerp performs a spherical linear interpolation to another quaternion.
// The parameter t should be in range [0, 1].
func (q Quat) Slerp(other Quat, t float32) Quat {
// Source: http://glmatrix.net/docs/module-quat.html
dot := q.Dot(other)
if dot > 0.9999 { // quaternions are close together, perform lerp
return q.Lerp(other, t)
}
if dot < 0.0 { // adjust signs
dot = -dot
other.W = -other.W
other.X = -other.X
other.Y = -other.Y
other.Z = -other.Z
}
return Quat{
(1-t)*q.W + 1*other.W,
(1-t)*q.X + 1*other.X,
(1-t)*q.Y + 1*other.Y,
(1-t)*q.Z + 1*other.Z,
}
} | quat.go | 0.952596 | 0.602997 | quat.go | starcoder |
package etw
import (
"bytes"
"encoding/binary"
)
// inType indicates the type of data contained in the ETW event.
type inType byte
// Various inType definitions for TraceLogging. These must match the definitions
// found in TraceLoggingProvider.h in the Windows SDK.
const (
inTypeNull inType = iota
inTypeUnicodeString
inTypeANSIString
inTypeInt8
inTypeUint8
inTypeInt16
inTypeUint16
inTypeInt32
inTypeUint32
inTypeInt64
inTypeUint64
inTypeFloat
inTypeDouble
inTypeBool32
inTypeBinary
inTypeGUID
inTypePointerUnsupported
inTypeFileTime
inTypeSystemTime
inTypeSID
inTypeHexInt32
inTypeHexInt64
inTypeCountedString
inTypeCountedANSIString
inTypeStruct
inTypeCountedBinary
inTypeCountedArray inType = 32
inTypeArray inType = 64
)
// outType specifies a hint to the event decoder for how the value should be
// formatted.
type outType byte
// Various outType definitions for TraceLogging. These must match the
// definitions found in TraceLoggingProvider.h in the Windows SDK.
const (
// outTypeDefault indicates that the default formatting for the inType will
// be used by the event decoder.
outTypeDefault outType = iota
outTypeNoPrint
outTypeString
outTypeBoolean
outTypeHex
outTypePID
outTypeTID
outTypePort
outTypeIPv4
outTypeIPv6
outTypeSocketAddress
outTypeXML
outTypeJSON
outTypeWin32Error
outTypeNTStatus
outTypeHResult
outTypeFileTime
outTypeSigned
outTypeUnsigned
outTypeUTF8 outType = 35
outTypePKCS7WithTypeInfo outType = 36
outTypeCodePointer outType = 37
outTypeDateTimeUTC outType = 38
)
// eventMetadata maintains a buffer which builds up the metadata for an ETW
// event. It needs to be paired with EventData which describes the event.
type eventMetadata struct {
buffer bytes.Buffer
}
// bytes returns the raw binary data containing the event metadata. Before being
// returned, the current size of the buffer is written to the start of the
// buffer. The returned value is not copied from the internal buffer, so it can
// be mutated by the eventMetadata object after it is returned.
func (em *eventMetadata) bytes() []byte {
// Finalize the event metadata buffer by filling in the buffer length at the
// beginning.
binary.LittleEndian.PutUint16(em.buffer.Bytes(), uint16(em.buffer.Len()))
return em.buffer.Bytes()
}
// writeEventHeader writes the metadata for the start of an event to the buffer.
// This specifies the event name and tags.
func (em *eventMetadata) writeEventHeader(name string, tags uint32) {
binary.Write(&em.buffer, binary.LittleEndian, uint16(0)) // Length placeholder
em.writeTags(tags)
em.buffer.WriteString(name)
em.buffer.WriteByte(0) // Null terminator for name
}
func (em *eventMetadata) writeFieldInner(name string, inType inType, outType outType, tags uint32, arrSize uint16) {
em.buffer.WriteString(name)
em.buffer.WriteByte(0) // Null terminator for name
if outType == outTypeDefault && tags == 0 {
em.buffer.WriteByte(byte(inType))
} else {
em.buffer.WriteByte(byte(inType | 128))
if tags == 0 {
em.buffer.WriteByte(byte(outType))
} else {
em.buffer.WriteByte(byte(outType | 128))
em.writeTags(tags)
}
}
if arrSize != 0 {
binary.Write(&em.buffer, binary.LittleEndian, arrSize)
}
}
// writeTags writes out the tags value to the event metadata. Tags is a 28-bit
// value, interpreted as bit flags, which are only relevant to the event
// consumer. The event consumer may choose to attribute special meaning to tags
// (e.g. 0x4 could mean the field contains PII). Tags are written as a series of
// bytes, each containing 7 bits of tag value, with the high bit set if there is
// more tag data in the following byte. This allows for a more compact
// representation when not all of the tag bits are needed.
func (em *eventMetadata) writeTags(tags uint32) {
// Only use the top 28 bits of the tags value.
tags &= 0xfffffff
for {
// Tags are written with the most significant bits (e.g. 21-27) first.
val := tags >> 21
if tags&0x1fffff == 0 {
// If there is no more data to write after this, write this value
// without the high bit set, and return.
em.buffer.WriteByte(byte(val & 0x7f))
return
}
em.buffer.WriteByte(byte(val | 0x80))
tags <<= 7
}
}
// writeField writes the metadata for a simple field to the buffer.
func (em *eventMetadata) writeField(name string, inType inType, outType outType, tags uint32) {
em.writeFieldInner(name, inType, outType, tags, 0)
}
// writeArray writes the metadata for an array field to the buffer. The number
// of elements in the array must be written as a uint16 in the event data,
// immediately preceeding the event data.
func (em *eventMetadata) writeArray(name string, inType inType, outType outType, tags uint32) {
em.writeFieldInner(name, inType|inTypeArray, outType, tags, 0)
}
// writeCountedArray writes the metadata for an array field to the buffer. The
// size of a counted array is fixed, and the size is written into the metadata
// directly.
func (em *eventMetadata) writeCountedArray(name string, count uint16, inType inType, outType outType, tags uint32) {
em.writeFieldInner(name, inType|inTypeCountedArray, outType, tags, count)
}
// writeStruct writes the metadata for a nested struct to the buffer. The struct
// contains the next N fields in the metadata, where N is specified by the
// fieldCount argument.
func (em *eventMetadata) writeStruct(name string, fieldCount uint8, tags uint32) {
em.writeFieldInner(name, inTypeStruct, outType(fieldCount), tags, 0)
} | vendor/github.com/Microsoft/go-winio/pkg/etw/eventmetadata.go | 0.512937 | 0.404684 | eventmetadata.go | starcoder |
// Package sentropy provides functions for computing entropy and delentropy
// of SippImages, as well as rendering these as images.
package sentropy
import (
"image"
"math"
)
import (
. "github.com/Causticity/sipp/shist"
. "github.com/Causticity/sipp/simage"
)
// SippEntropy is a structure that holds a reference to an image, the 1D
// histogram of its values, and the entropy values derived from the histogram.
type SippEntropy struct {
// A reference to the image.
Im SippImage
// A reference to the 1D histogram
Hist []uint32
// The entropy for each bin value that actually occurred.
BinEntropy []float64
// The largest entropy value of any bin.
MaxBinEntropy float64
// The entropy for the image, i.e. the sum of the entropies for all
// the bins.
Entropy float64
}
// Entropy returns a SippEntropy structure for the given image.
func Entropy(im SippImage) (ent *SippEntropy) {
ent = new(SippEntropy)
ent.Im = im
ent.Hist = GreyHist(im)
total := float64(im.Bounds().Dx() * im.Bounds().Dy())
normHist := make([]float64, len(ent.Hist))
var check float64
for i, binVal := range ent.Hist {
normHist[i] = float64(binVal) / total
check = check + normHist[i]
}
//fmt.Println("Normalised histogram sums to ", check)
ent.BinEntropy = make([]float64, len(ent.Hist))
for j, p := range normHist {
if p > 0 {
ent.BinEntropy[j] = -1.0 * p * math.Log2(p)
ent.Entropy = ent.Entropy + ent.BinEntropy[j]
if ent.BinEntropy[j] > ent.MaxBinEntropy {
ent.MaxBinEntropy = ent.BinEntropy[j]
}
}
}
return
}
// EntropyImage returns a greyscale image of the entropy for each pixel.
func (ent *SippEntropy) EntropyImage() SippImage {
entIm := new(SippGray)
entIm.Gray = image.NewGray(ent.Im.Bounds())
entImPix := entIm.Pix()
// scale the entropy from (0-maxEnt) to (0-255)
is16 := false
if ent.Im.Bpp() == 16 {
is16 = true
}
scale := 255.0 / ent.MaxBinEntropy
width := ent.Im.Bounds().Dx()
imPix := ent.Im.Pix()
for y := 0; y < ent.Im.Bounds().Dy(); y++ {
for x := 0; x < width; x++ {
index := ent.Im.PixOffset(x, y)
var val uint16 = uint16(imPix[index])
if is16 {
val = val<<8 | uint16(imPix[index+1])
}
entImPix[y*width+x] = uint8(math.Floor(ent.BinEntropy[val] * scale))
}
}
return entIm
}
// SippDelentropy is a structure that holds a reference to a gradient histogram
// and the delentropy values derived from it.
type SippDelentropy struct {
// A reference to the histogram we are computing from
hist *SippHist
// The delentropy for each bin value that actually occurred.
binDelentropy []float64
// The largest delentropy value of any bin.
maxBinDelentropy float64
// The delentropy for the image, i.e. the sum of the delentropies for all
// the bins.
Delentropy float64
}
// Delentropy returns a SippDelentropy structure for the given SippHist.
func Delentropy(hist *SippHist) (dent *SippDelentropy) {
// Store the entropy values corresponding to the bin counts that actually
// occurred.
dent = new(SippDelentropy)
dent.hist = hist
dent.binDelentropy = make([]float64, hist.Max+1)
total := float64(len(hist.Grad.Pix))
for _, bin := range hist.Bin {
if bin != 0 {
// compute the entropy only once for a given bin value.
if dent.binDelentropy[bin] == 0.0 {
p := float64(bin) / total
dent.binDelentropy[bin] = -1.0 * p * math.Log2(p)
}
dent.Delentropy += dent.binDelentropy[bin]
if dent.binDelentropy[bin] > dent.maxBinDelentropy {
dent.maxBinDelentropy = dent.binDelentropy[bin]
}
}
}
return
}
// HistDelentropyImage returns a greyscale image of the delentropy for each
// histogram bin.
func (dent *SippDelentropy) HistDelentropyImage() SippImage {
// Make a greyscale image of the entropy for each bin.
width, height := dent.hist.Size()
dentGray := new(SippGray)
dentGray.Gray = image.NewGray(image.Rect(0, 0, int(width), int(height)))
dentGrayPix := dentGray.Pix()
// scale the delentropy from (0-hist.maxBinDelentropy) to (0-255)
scale := 255.0 / dent.maxBinDelentropy
for i, val := range dent.hist.Bin {
dentGrayPix[i] = uint8(dent.binDelentropy[val] * scale)
}
return dentGray
}
// DelEntropyImage returns a greyscale image of the entropy for each gradient
// pixel.
func (dent *SippDelentropy) DelEntropyImage() SippImage {
// Make a greyscale image of the entropy for each bin.
dentGray := new(SippGray)
dentGray.Gray = image.NewGray(dent.hist.Grad.Rect)
dentGrayPix := dentGray.Pix()
// scale the entropy from (0-hist.maxBinDelentropy) to (0-255)
scale := 255.0 / dent.maxBinDelentropy
for i := range dentGrayPix {
// The following lookup works as follows:
// i - the gradient (and delentropy) image-pixel index
// hist.BinIndex[i] - the histogram bin for that pixel
// hist.Bin[hist.BinIndex[i] - the value in that bin
// dent.binDelentropy[...] The delentropy for that value
// We scale that delentropy and convert to an 8-bit pixel
dentGrayPix[i] = uint8(dent.binDelentropy[dent.hist.Bin[dent.hist.BinIndex[i]]] * scale)
}
return dentGray
} | sentropy/sentropy.go | 0.77806 | 0.67708 | sentropy.go | starcoder |
PCB Standoffs, Mounting Pillars
*/
//-----------------------------------------------------------------------------
package obj
import "github.com/deadsy/sdfx/sdf"
//-----------------------------------------------------------------------------
// StandoffParms defines the parameters for a board standoff pillar.
type StandoffParms struct {
PillarHeight float64
PillarDiameter float64
HoleDepth float64 // > 0 is a hole, < 0 is a support stub
HoleDiameter float64
NumberWebs int // number of triangular gussets around the standoff base
WebHeight float64
WebDiameter float64
WebWidth float64
}
// pillarWeb returns a single pillar web
func pillarWeb(k *StandoffParms) sdf.SDF3 {
w := sdf.NewPolygon()
w.Add(0, 0)
w.Add(0.5*k.WebDiameter, 0)
w.Add(0, k.WebHeight)
s := sdf.Extrude3D(sdf.Polygon2D(w.Vertices()), k.WebWidth)
m := sdf.Translate3d(sdf.V3{0, 0, -0.5 * k.PillarHeight}).Mul(sdf.RotateX(sdf.DtoR(90.0)))
return sdf.Transform3D(s, m)
}
// pillarWebs returns a set of pillar webs
func pillarWebs(k *StandoffParms) sdf.SDF3 {
if k.NumberWebs == 0 {
return nil
}
return sdf.RotateCopy3D(pillarWeb(k), k.NumberWebs)
}
// pillar returns a cylindrical pillar
func pillar(k *StandoffParms) sdf.SDF3 {
return sdf.Cylinder3D(k.PillarHeight, 0.5*k.PillarDiameter, 0)
}
// pillarHole returns a pillar screw hole (or support stub)
func pillarHole(k *StandoffParms) sdf.SDF3 {
if k.HoleDiameter == 0.0 || k.HoleDepth == 0.0 {
return nil
}
s := sdf.Cylinder3D(sdf.Abs(k.HoleDepth), 0.5*k.HoleDiameter, 0)
zOfs := 0.5 * (k.PillarHeight - k.HoleDepth)
return sdf.Transform3D(s, sdf.Translate3d(sdf.V3{0, 0, zOfs}))
}
// Standoff3D returns a single board standoff.
func Standoff3D(k *StandoffParms) sdf.SDF3 {
s0 := sdf.Union3D(pillar(k), pillarWebs(k))
if k.NumberWebs != 0 {
// Cut off any part of the webs that protrude from the top of the pillar
s0 = sdf.Intersect3D(s0, sdf.Cylinder3D(k.PillarHeight, k.WebDiameter, 0))
}
// Add the pillar hole/stub
if k.HoleDepth >= 0.0 {
// hole
s0 = sdf.Difference3D(s0, pillarHole(k))
} else {
// support stub
s0 = sdf.Union3D(s0, pillarHole(k))
}
return s0
}
//----------------------------------------------------------------------------- | obj/standoff.go | 0.781581 | 0.404684 | standoff.go | starcoder |
package parsers
import (
"errors"
"regexp"
"strconv"
"strings"
)
var (
// matches the row of the players table
// e.g. ` "NOTREADY ^5:^7 0^5:^7 rdner 25000 30 20 1 ^3^7\n"`
playerEntryRowRE = regexp.MustCompile(`^\s+"(.*)\s+:\s+(\d+):\s+(\S+)\s+(\d+)\s+(\d+)\s+(\d+)\s+(\d+)\s+\n"$`)
// matches the bot row of the players table
// e.g. " ^5:^7 4^5:^7 100.Slash [BOT] ^3^7\n"
botEntryRowRE = regexp.MustCompile(`^\s+"(.*)\s+:\s+(\d+):\s+(\d+)\.(\S+)\s+\[BOT\]\s+\s*\n"$`)
)
// Player represents a player on the server
type Player interface {
// GetStatus gets the status of the player (e.g. `READY` or `NOTREADY`).
GetStatus() string
// GetID gets a numeric ID of the player
GetID() int
// GetName gets the name of the player
GetName() string
}
// PlayerEntry represents basic information about the player.
// Implements `Player` interface
type PlayerEntry struct {
Status string
ID int
Player string
}
func (p PlayerEntry) GetStatus() string {
return p.Status
}
func (p PlayerEntry) GetID() int {
return p.ID
}
func (p PlayerEntry) GetName() string {
return p.Player
}
// HumanEntry represents the human player entry on the server
type HumanEntry struct {
PlayerEntry
// Network-related information
Rate int
MaxPkts int
Snaps int
PLost int
}
type BotEntry struct {
PlayerEntry
// Level of the bot (0-100)
Level int
}
// ParsePlayers tries to find information about human players and bots parsing the output
// of `rcon <password> players`.
func ParsePlayers(str string) (players []Player) {
str = RemoveQ3Colors(str)
lines := strings.Split(str, "print")
for _, line := range lines {
human, err := tryParseHuman(line)
if err == nil {
players = append(players, human)
continue
}
bot, err := tryParseBot(line)
if err == nil {
players = append(players, bot)
continue
}
}
return players
}
func tryParseHuman(line string) (player HumanEntry, err error) {
submatches := playerEntryRowRE.FindAllStringSubmatch(line, -1)
if len(submatches) != 1 {
return player, errors.New("the row does not match the player row")
}
row := submatches[0]
if len(row) != 8 {
return player, errors.New("the row does not have the right amount of columns")
}
row = row[1:]
player.Status = strings.TrimSpace(row[0])
player.ID, err = strconv.Atoi(row[1])
if err != nil {
return player, err
}
player.Player = strings.TrimSpace(row[2])
player.Rate, err = strconv.Atoi(row[3])
if err != nil {
return player, err
}
player.MaxPkts, err = strconv.Atoi(row[4])
if err != nil {
return player, err
}
player.Snaps, err = strconv.Atoi(row[5])
if err != nil {
return player, err
}
player.PLost, err = strconv.Atoi(row[6])
if err != nil {
return player, err
}
return player, nil
}
func tryParseBot(line string) (bot BotEntry, err error) {
submatches := botEntryRowRE.FindAllStringSubmatch(line, -1)
if len(submatches) != 1 {
return bot, errors.New("the row does not match the bot row")
}
row := submatches[0]
if len(row) != 5 {
return bot, errors.New("the row does not have the right amount of columns")
}
row = row[1:]
bot.Status = strings.TrimSpace(row[0])
bot.ID, err = strconv.Atoi(row[1])
if err != nil {
return bot, err
}
bot.Level, err = strconv.Atoi(row[2])
if err != nil {
return bot, err
}
bot.Player = strings.TrimSpace(row[3])
return bot, nil
} | pkg/parsers/players.go | 0.587825 | 0.44734 | players.go | starcoder |
package op
import (
"fmt"
"github.com/gonum/floats"
)
// The Mul operator.
type Mul struct {
Left, Right Operator
}
// Eval multiplies aligned values.
func (mul Mul) Eval(X [][]float64) []float64 {
x := mul.Left.Eval(X)
floats.Mul(x, mul.Right.Eval(X))
return x
}
// Arity of Mul is 2.
func (mul Mul) Arity() uint {
return 2
}
// Operand returns one of Mul's operands, or nil.
func (mul Mul) Operand(i uint) Operator {
switch i {
case 0:
return mul.Left
case 1:
return mul.Right
default:
return nil
}
}
// SetOperand replaces one of Mul's operands if i is equal to 0 or 1.
func (mul Mul) SetOperand(i uint, op Operator) Operator {
if i == 0 {
mul.Left = op
} else if i == 1 {
mul.Right = op
}
return mul
}
// The Mul operator is symmetric so we have to check u*v as well as v*u.
func (mul Mul) simplify(left, right Operator) (Operator, bool) {
switch left := left.(type) {
case Const:
switch left.Value {
// 0 * a = 0
case 0:
return Const{0}, true
// 1 * a = a
case 1:
return right, true
// -1 * a = -a
case -1:
return Neg{right}, true
}
switch right := right.(type) {
// a * b = c
case Const:
return Const{left.Value * right.Value}, true
}
}
return mul, false
}
// Simplify Mul.
func (mul Mul) Simplify() Operator {
// Simplify branches
mul.Left = mul.Left.Simplify()
mul.Right = mul.Right.Simplify()
// Try to simplify left/right
simpl, ok := mul.simplify(mul.Left, mul.Right)
if ok {
return simpl.Simplify()
}
// Try to simplify right/left
simpl, ok = mul.simplify(mul.Right, mul.Left)
if ok {
return simpl.Simplify()
}
return simpl
}
// Diff computes the following derivative: (uv)' = u'v + uv'
func (mul Mul) Diff(i uint) Operator {
return Add{Mul{mul.Left.Diff(i), mul.Right}, Mul{mul.Left, mul.Right.Diff(i)}}
}
// Name of Mul is "mul".
func (mul Mul) Name() string {
return "mul"
}
// String formatting.
func (mul Mul) String() string {
return fmt.Sprintf("%s*%s", parenthesize(mul.Left), parenthesize(mul.Right))
} | op/mul.go | 0.778481 | 0.485051 | mul.go | starcoder |
package main
import (
"fmt"
"sort"
"sync"
"time"
"log"
)
// Triplet is a slice containing three (3) integers whose sum equals zero (0).
type Triplet [3]int
// ThreeSum returns a slice of Triplets given a set of real numbers.
func ThreeSum(nums ...int) []Triplet {
// Calculate and log the total execution time.
defer func(t time.Time) {
log.Printf("Execution time: %s", time.Since(t))
}(time.Now())
// Use a slice to store the triplets.
var trpl []Triplet
// Use a channel to send data across goroutines and a WaitGroup to ensure all goroutines finish
// before closing the channel.
c := make(chan Triplet)
var wg sync.WaitGroup
wg.Add(len(nums))
// Keep track of all triplets found and ensure no duplicates.
go func(it <-chan Triplet) {
for i := range it {
var found bool
for t := range trpl {
if trpl[t][0] == i[0] && trpl[t][1] == i[1] && trpl[t][2] == i[2] {
found = true
}
}
if !found {
trpl = append(trpl, i)
}
}
}(c)
// Find all triplets whose sum equals zero (0).
sort.Ints(nums)
for i := range nums {
go func(i int, ot chan<- Triplet) {
defer wg.Done()
start, end := i + 1, len(nums) - 1
for start < end {
val := nums[i] + nums[start] + nums[end]
switch {
case val == 0:
ot <- Triplet{nums[i], nums[start], nums[end]}
end--
case val > 0:
end--
default:
start++
}
}
}(i, c)
}
wg.Wait()
return trpl
}
func main() {
tests := [][]int{
[]int{4, 5, -1, -2, -7, 2, -5, -3, -7, -3, 1},
[]int{-1, -6, -3, -7, 5, -8, 2, -8, 1},
[]int{-5, -1, -4, 2, 9, -9, -6, -1, -7},
}
for t := range tests {
fmt.Println(ThreeSum(tests[t]...))
}
} | 323-3sum/main.go | 0.761804 | 0.488893 | main.go | starcoder |
package crypto
// Copyright 2010 The Go Authors. All rights reserved.
// Copyright 2011 ThePiachu. All rights reserved.
// Copyright 2020 LXY1226. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// Package bitelliptic implements several Koblitz elliptic curves over prime
// fields.
// Origin File at:
// https://github.com/ThePiachu/Split-Vanity-Miner-Golang/blob/03677bc96ff4f5c2771e528562360ccbc513db8d/src/pkg/bitelliptic/bitelliptic.go
// This package operates, internally, on Jacobian coordinates. For a given
// (x, y) position on the curve, the Jacobian coordinates are (x1, y1, z1)
// where x = x1/z1² and y = y1/z1³. The greatest speedups come when the whole
// calculation can be performed within the transform (as in ScalarMult and
// ScalarBaseMult). But even for Add and Double, it's faster to apply and
// reverse the transform than to operate in affine coordinates.
import (
"io"
"math/big"
)
// A BitCurve represents a Koblitz Curve with a=0.
// See http://www.hyperelliptic.org/EFD/g1p/auto-shortw.html
type BitCurve struct {
P *big.Int // the order of the underlying field
N *big.Int // the order of the base point
B *big.Int // the constant of the BitCurve equation
Gx, Gy *big.Int // (x,y) of the base point
BitSize int // the size of the underlying field
}
// See FIPS 186-3, section D.2.2.1
// And http://www.secg.org/sec2-v2.pdf section 2.2.1
var secp192k1 = &BitCurve{
P: new(big.Int).SetBytes([]byte{
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFE, 0xFF, 0xFF, 0xEE, 0x37,
}), N: new(big.Int).SetBytes([]byte{
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFE,
0x26, 0xF2, 0xFC, 0x17, 0x0F, 0x69, 0x46, 0x6A, 0x74, 0xDE, 0xFD, 0x8D,
}), B: new(big.Int).SetBytes([]byte{
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03,
}), Gx: new(big.Int).SetBytes([]byte{
0xDB, 0x4F, 0xF1, 0x0E, 0xC0, 0x57, 0xE9, 0xAE, 0x26, 0xB0, 0x7D, 0x02,
0x80, 0xB7, 0xF4, 0x34, 0x1D, 0xA5, 0xD1, 0xB1, 0xEA, 0xE0, 0x6C, 0x7D,
}), Gy: new(big.Int).SetBytes([]byte{
0x9B, 0x2F, 0x2F, 0x6D, 0x9C, 0x56, 0x28, 0xA7, 0x84, 0x41, 0x63, 0xD0,
0x15, 0xBE, 0x86, 0x34, 0x40, 0x82, 0xAA, 0x88, 0xD9, 0x5E, 0x2F, 0x9D,
}),
BitSize: 192,
}
//TODO: double check if the function is okay
// affineFromJacobian reverses the Jacobian transform. See the comment at the
// top of the file.
func (BitCurve *BitCurve) affineFromJacobian(x, y, z *big.Int) (xOut, yOut *big.Int) {
zinv := new(big.Int).ModInverse(z, BitCurve.P)
zinvsq := new(big.Int).Mul(zinv, zinv)
xOut = new(big.Int).Mul(x, zinvsq)
xOut.Mod(xOut, BitCurve.P)
zinvsq.Mul(zinvsq, zinv)
yOut = new(big.Int).Mul(y, zinvsq)
yOut.Mod(yOut, BitCurve.P)
return
}
// addJacobian takes two points in Jacobian coordinates, (x1, y1, z1) and
// (x2, y2, z2) and returns their sum, also in Jacobian form.
func (BitCurve *BitCurve) addJacobian(x1, y1, z1, x2, y2, z2 *big.Int) (*big.Int, *big.Int, *big.Int) {
// See http://hyperelliptic.org/EFD/g1p/auto-shortw-jacobian-0.html#addition-add-2007-bl
z1z1 := new(big.Int).Mul(z1, z1)
z1z1.Mod(z1z1, BitCurve.P)
z2z2 := new(big.Int).Mul(z2, z2)
z2z2.Mod(z2z2, BitCurve.P)
u1 := new(big.Int).Mul(x1, z2z2)
u1.Mod(u1, BitCurve.P)
u2 := new(big.Int).Mul(x2, z1z1)
u2.Mod(u2, BitCurve.P)
h := new(big.Int).Sub(u2, u1)
if h.Sign() == -1 {
h.Add(h, BitCurve.P)
}
i := new(big.Int).Lsh(h, 1)
i.Mul(i, i)
j := new(big.Int).Mul(h, i)
s1 := new(big.Int).Mul(y1, z2)
s1.Mul(s1, z2z2)
s1.Mod(s1, BitCurve.P)
s2 := new(big.Int).Mul(y2, z1)
s2.Mul(s2, z1z1)
s2.Mod(s2, BitCurve.P)
r := new(big.Int).Sub(s2, s1)
if r.Sign() == -1 {
r.Add(r, BitCurve.P)
}
r.Lsh(r, 1)
v := new(big.Int).Mul(u1, i)
x3 := new(big.Int).Set(r)
x3.Mul(x3, x3)
x3.Sub(x3, j)
x3.Sub(x3, v)
x3.Sub(x3, v)
x3.Mod(x3, BitCurve.P)
y3 := new(big.Int).Set(r)
v.Sub(v, x3)
y3.Mul(y3, v)
s1.Mul(s1, j)
s1.Lsh(s1, 1)
y3.Sub(y3, s1)
y3.Mod(y3, BitCurve.P)
z3 := new(big.Int).Add(z1, z2)
z3.Mul(z3, z3)
z3.Sub(z3, z1z1)
if z3.Sign() == -1 {
z3.Add(z3, BitCurve.P)
}
z3.Sub(z3, z2z2)
if z3.Sign() == -1 {
z3.Add(z3, BitCurve.P)
}
z3.Mul(z3, h)
z3.Mod(z3, BitCurve.P)
return x3, y3, z3
}
// doubleJacobian takes a point in Jacobian coordinates, (x, y, z), and
// returns its double, also in Jacobian form.
func (BitCurve *BitCurve) doubleJacobian(x, y, z *big.Int) (*big.Int, *big.Int, *big.Int) {
// See http://hyperelliptic.org/EFD/g1p/auto-shortw-jacobian-0.html#doubling-dbl-2009-l
a := new(big.Int).Mul(x, x) //X1²
b := new(big.Int).Mul(y, y) //Y1²
c := new(big.Int).Mul(b, b) //B²
d := new(big.Int).Add(x, b) //X1+B
d.Mul(d, d) //(X1+B)²
d.Sub(d, a) //(X1+B)²-A
d.Sub(d, c) //(X1+B)²-A-C
d.Mul(d, big.NewInt(2)) //2*((X1+B)²-A-C)
e := new(big.Int).Mul(big.NewInt(3), a) //3*A
f := new(big.Int).Mul(e, e) //E²
x3 := new(big.Int).Mul(big.NewInt(2), d) //2*D
x3.Sub(f, x3) //F-2*D
x3.Mod(x3, BitCurve.P)
y3 := new(big.Int).Sub(d, x3) //D-X3
y3.Mul(e, y3) //E*(D-X3)
y3.Sub(y3, new(big.Int).Mul(big.NewInt(8), c)) //E*(D-X3)-8*C
y3.Mod(y3, BitCurve.P)
z3 := new(big.Int).Mul(y, z) //Y1*Z1
z3.Mul(big.NewInt(2), z3) //3*Y1*Z1
z3.Mod(z3, BitCurve.P)
return x3, y3, z3
}
//TODO: double check if it is okay
// ScalarMult returns k*(Bx,By) where k is a number in big-endian form.
func (BitCurve *BitCurve) ScalarMult(Bx, By *big.Int, k []byte) (*big.Int, *big.Int) {
// We have a slight problem in that the identity of the group (the
// point at infinity) cannot be represented in (x, y) form on a finite
// machine. Thus the standard add/double algorithm has to be tweaked
// slightly: our initial state is not the identity, but x, and we
// ignore the first true bit in |k|. If we don't find any true bits in
// |k|, then we return nil, nil, because we cannot return the identity
// element.
Bz := new(big.Int).SetInt64(1)
x := Bx
y := By
z := Bz
seenFirstTrue := false
for _, b := range k {
for bitNum := 0; bitNum < 8; bitNum++ {
if seenFirstTrue {
x, y, z = BitCurve.doubleJacobian(x, y, z)
}
if b&0x80 == 0x80 {
if !seenFirstTrue {
seenFirstTrue = true
} else {
x, y, z = BitCurve.addJacobian(Bx, By, Bz, x, y, z)
}
}
b <<= 1
}
}
if !seenFirstTrue {
return nil, nil
}
return BitCurve.affineFromJacobian(x, y, z)
}
// ScalarBaseMult returns k*G, where G is the base point of the group and k is
// an integer in big-endian form.
func (BitCurve *BitCurve) ScalarBaseMult(k []byte) (*big.Int, *big.Int) {
return BitCurve.ScalarMult(BitCurve.Gx, BitCurve.Gy, k)
}
var mask = []byte{0xff, 0x1, 0x3, 0x7, 0xf, 0x1f, 0x3f, 0x7f}
//TODO: double check if it is okay
// GenerateKey returns a public/private key pair. The private key is generated
// using the given reader, which must return random data.
func (BitCurve *BitCurve) GenerateKey(rand io.Reader) (priv []byte, x, y *big.Int, err error) {
byteLen := (BitCurve.BitSize + 7) >> 3
priv = make([]byte, byteLen)
for x == nil {
_, err = rand.Read(priv)
if err != nil {
return
}
// We have to mask off any excess bits in the case that the size of the
// underlying field is not a whole number of bytes.
priv[0] &= mask[BitCurve.BitSize%8]
// This is because, in tests, rand will return all zeros and we don't
// want to get the point at infinity and loop forever.
priv[1] ^= 0x42
x, y = BitCurve.ScalarBaseMult(priv)
}
return
}
/*
$ openssl asn1parse -in 1.cer -inform DER -dump
0:d=0 hl=2 l= 70 cons: SEQUENCE
2:d=1 hl=2 l= 16 cons: SEQUENCE
4:d=2 hl=2 l= 7 prim: OBJECT :id-ecPublicKey
13:d=2 hl=2 l= 5 prim: OBJECT :secp192k1
20:d=1 hl=2 l= 50 prim: BIT STRING
0000 - 00 04 92 8d 88 50 67 30-88 b3 43 26 4e 0c 6b ac .....Pg0..C&N.k.
0010 - b8 49 6d 69 77 99 f3 72-11 de b2 5b b7 39 06 cb .Imiw..r...[.9..
0020 - 08 9f ea 96 39 b4 e0 26-04 98 b5 1a 99 2d 50 81 ....9..&.....-P.
0030 - 3d a8 =.
*/ | protocol/crypto/secp192k1.go | 0.803906 | 0.4953 | secp192k1.go | starcoder |
package plandef
import (
"sort"
"strings"
)
// A VarSet is a set of variables. It's represented as an ordered slice of
// uniquely-named variables.
type VarSet []*Variable
// NewVarSet creates a new VarSet from the given variables. The key to 'in'
// should be the variable's Name.
func NewVarSet(in map[string]*Variable) VarSet {
set := make([]*Variable, 0, len(in))
for _, v := range in {
set = append(set, v)
}
sort.Slice(set, func(i, j int) bool {
return set[i].Name < set[j].Name
})
return set
}
// Contains returns true if v is in the set, false otherwise.
func (set VarSet) Contains(v *Variable) bool {
i := sort.Search(len(set),
func(i int) bool {
return set[i].Name >= v.Name
})
return i < len(set) && set[i].Name == v.Name
}
// ContainsSet return true if all variables in 'other' are in 'set', false
// otherwise.
func (set VarSet) ContainsSet(other VarSet) bool {
for _, v := range other {
if !set.Contains(v) {
return false
}
}
return true
}
// Intersect returns a new set with the variables present in both 'set' and
// 'other'.
func (set VarSet) Intersect(other VarSet) VarSet {
var both VarSet
left, right := set, other
for len(left) > 0 && len(right) > 0 {
switch {
case left[0].Name == right[0].Name:
both = append(both, left[0])
left = left[1:]
right = right[1:]
case left[0].Name < right[0].Name:
left = left[1:]
case left[0].Name > right[0].Name:
right = right[1:]
}
}
return both
}
// Union returns a new set with the variables present in either 'set' or 'other'.
func (set VarSet) Union(other VarSet) VarSet {
var either VarSet
left, right := set, other
for len(left) > 0 && len(right) > 0 {
switch {
case left[0].Name == right[0].Name:
either = append(either, left[0])
left = left[1:]
right = right[1:]
case left[0].Name < right[0].Name:
either = append(either, left[0])
left = left[1:]
case left[0].Name > right[0].Name:
either = append(either, right[0])
right = right[1:]
}
}
if len(left) > 0 {
either = append(either, left...)
} else if len(right) > 0 {
either = append(either, right...)
}
return either
}
// Sub returns a new set with the variables present in 'set' but not 'other'.
func (set VarSet) Sub(other VarSet) VarSet {
var diff VarSet
left, right := set, other
for len(left) > 0 && len(right) > 0 {
switch {
case left[0].Name == right[0].Name:
left = left[1:]
right = right[1:]
case left[0].Name < right[0].Name:
diff = append(diff, left[0])
left = left[1:]
case left[0].Name > right[0].Name:
right = right[1:]
}
}
if len(left) > 0 {
diff = append(diff, left...)
}
return diff
}
// Equal returns true if the two sets are made up of the same variable names,
// false otherwise.
func (set VarSet) Equal(other VarSet) bool {
if len(set) != len(other) {
return false
}
for i := range set {
if set[i].Name != other[i].Name {
return false
}
}
return true
}
// String returns a space-delimited ordered list of variable names.
func (set VarSet) String() string {
res := strings.Builder{}
for i, v := range set {
if i > 0 {
res.WriteByte(' ')
}
res.WriteString(v.String())
}
return res.String()
}
// Key implements cmp.Key.
func (set VarSet) Key(b *strings.Builder) {
for i, v := range set {
if i > 0 {
b.WriteByte(' ')
}
v.Key(b)
}
} | src/github.com/ebay/akutan/query/planner/plandef/varset.go | 0.705075 | 0.435361 | varset.go | starcoder |
package govector
import (
"errors"
"math/rand"
"time"
)
// kmeans is a simple k-means clusterer that determines centroids with the Train function,
// and then classifies additional observations with the Nearest function.
// Nodes represents a collection of vectors to cluster
type Nodes []Vector
var randSeed = time.Now().UnixNano()
// ErrorClusterLength error is returned when we the length of requested clusters is larger than the vectors nodes count
var ErrorClusterLength = errors.New("the length of requested clusters is larger than the vectors nodes count")
// Train takes an array of Nodes (observations), and produces as many centroids as specified by
// clusterCount. It will stop adjusting centroids after maxRounds is reached. If there are less
// observations than the number of centroids requested, then Train will return (false, nil).
func Train(nodes Nodes, clusterCount int, maxRounds int) (Nodes, error) {
if len(nodes) < clusterCount {
return nil, ErrorClusterLength
}
// Check to make sure everything is consistent, dimension-wise
stdLen := 0
for i, node := range nodes {
curLen := len(node)
if i == 0 {
stdLen = curLen
}
if i > 0 && len(node) != stdLen {
return nil, ErrorVectorLengths
}
}
centroids := make(Nodes, clusterCount)
r := rand.New(rand.NewSource(randSeed))
// Pick centroid starting points from Nodes
for i := 0; i < clusterCount; i++ {
srcIndex := r.Intn(len(nodes))
srcLen := len(nodes[srcIndex])
n := make(Vector, srcLen)
centroids[i] = n
copy(centroids[i], nodes[r.Intn(len(nodes))])
}
// Train centroids
movement := true
for i := 0; i < maxRounds && movement; i++ {
movement = false
groups := make(map[int][]Vector)
for _, node := range nodes {
near := Nearest(node, centroids)
groups[near] = append(groups[near], node)
}
for key, group := range groups {
newNode := meanNode(group)
if !Equal(centroids[key], newNode) {
centroids[key] = newNode
movement = true
}
}
}
return centroids, nil
}
// Nearest return the index of the closest centroid from nodes
func Nearest(in Vector, nodes Nodes) int {
count := len(nodes)
results := make(Vector, count)
cnt := make(chan int)
for i, node := range nodes {
go func(i int, node Vector, in Vector) {
results[i] = distance(in, node)
cnt <- 1
}(i, node, in)
}
wait(cnt, results)
mindex := 0
curdist := results[0]
for i, dist := range results {
if dist < curdist {
curdist = dist
mindex = i
}
}
return mindex
}
// Distance determines the square Euclidean distance between two nodes
func distance(node1, node2 Vector) float64 {
length := len(node1)
squares := make(Vector, length, length)
cnt := make(chan int)
for i := range node1 {
go func(i int) {
diff := node1[i] - node2[i]
squares[i] = diff * diff
cnt <- 1
}(i)
}
wait(cnt, squares)
sum := 0.0
for _, val := range squares {
sum += val
}
return sum
}
// meanNode takes an array of Nodes and returns a node which represents the average
// value for the provided nodes. This is used to center the centroids within their cluster.
func meanNode(values Nodes) Vector {
newNode := make(Vector, len(values[0]))
for _, value := range values {
for j := 0; j < len(newNode); j++ {
newNode[j] += (value)[j]
}
}
for i, value := range newNode {
newNode[i] = value / float64(len(values))
}
return newNode
}
// wait stops a function from continuing until the provided channel has processed as
// many items as there are dimensions in the provided Node.
func wait(c chan int, values Vector) {
count := len(values)
<-c
for respCnt := 1; respCnt < count; respCnt++ {
<-c
}
} | kmeans.go | 0.775987 | 0.718582 | kmeans.go | starcoder |
package basic
import "strings"
// TakeWhilePtrTest is template
func TakeWhilePtrTest() string {
return `
func TestTakeWhile<FTYPE>Ptr(t *testing.T) {
// Test : Take the numbers as long as condition match
var v2 <TYPE> = 2
var v4 <TYPE> = 4
var v5 <TYPE> = 5
var v7 <TYPE> = 7
var v40 <TYPE> = 40
expectedNewList := []*<TYPE>{&v4, &v2, &v4}
NewList := TakeWhile<FTYPE>Ptr(isEven<FTYPE>Ptr, []*<TYPE>{&v4, &v2, &v4, &v7, &v5})
if *NewList[0] != *expectedNewList[0] || *NewList[1] != *expectedNewList[1] || *NewList[2] != *expectedNewList[2] {
t.Errorf("TakeWhile<FTYPE>Ptr failed. Expected New list=%v, actual list=%v", expectedNewList, NewList)
}
expectedNewList = []*<TYPE>{&v40}
partialIsEvenDivisibleBy := func(num *<TYPE>) bool { return *num%10 == 0 }
NewList = TakeWhile<FTYPE>Ptr(partialIsEvenDivisibleBy, []*<TYPE>{&v40})
if *NewList[0] != *expectedNewList[0] {
t.Errorf("TakeWhile<FTYPE>Ptr failed. Expected New list=%v, actual list=%v", expectedNewList, NewList)
}
if len(TakeWhile<FTYPE>Ptr(nil, nil)) > 0 {
t.Errorf("TakeWhile<FTYPE>Ptr failed.")
}
if len(TakeWhile<FTYPE>Ptr(nil, []*<TYPE>{})) > 0 {
t.Errorf("TakeWhile<FTYPE>Ptr failed.")
t.Errorf(reflect.String.String())
}
}
`
}
// TakeWhileTestBool is template
func TakeWhileTestBool() string {
return `
func TestTakeWhile<FTYPE>Ptr(t *testing.T) {
// Test : Take the numbers as long as condition match
var vt <TYPE> = true
var vf <TYPE> = false
expectedNewList := []*<TYPE>{&vt, &vt, &vf}
NewList := TakeWhile<FTYPE>Ptr(func(v *bool) bool { return *v == true }, []*<TYPE>{&vt, &vt, &vf, &vf, &vf})
if *NewList[0] != *expectedNewList[0] || *NewList[1] != *expectedNewList[1] {
t.Errorf("TakeWhile<FTYPE>Ptr failed. Expected New list=%v, actual list=%v", expectedNewList, NewList)
}
expectedNewList = []*<TYPE>{&vt}
NewList = TakeWhile<FTYPE>Ptr(func(v *bool) bool { return *v == true }, []*<TYPE>{&vt})
if *NewList[0] != *expectedNewList[0] {
t.Errorf("TakeWhile<FTYPE>Ptr failed. Expected New list=%v, actual list=%v", expectedNewList, NewList)
}
if len(TakeWhile<FTYPE>Ptr(nil, nil)) > 0 {
t.Errorf("TakeWhile<FTYPE>Ptr failed.")
}
if len(TakeWhile<FTYPE>Ptr(nil, []*<TYPE>{})) > 0 {
t.Errorf("TakeWhile<FTYPE>Ptr failed.")
t.Errorf(reflect.String.String())
}
}
`
}
// ReplaceActivityTakeWhilePtr replaces ...
func ReplaceActivityTakeWhilePtr(code string) string {
s1 := `func TestTakeWhileStrPtrErr(t *testing.T) {
// Test : Take the numbers as long as condition match
var v2 string = "2"
var v4 string = "4"
var v5 string = "5"
var v7 string = "7"
var v40 string = "40"
var v0 string
expectedNewList := []*string{&v4, &v2, &v4}
NewList, _ := TakeWhileStrPtrErr(isEvenStrPtrErr, []*string{&v4, &v2, &v4, &v7, &v5})
if *NewList[0] != *expectedNewList[0] || *NewList[1] != *expectedNewList[1] || *NewList[2] != *expectedNewList[2] {
t.Errorf("TakeWhileStrPtrErr failed. Expected New list=%v, actual list=%v", expectedNewList, NewList)
}
_, err := TakeWhileStrPtrErr(isEvenStrPtrErr, []*string{&v0, &v2, &v4, &v7, &v5})
if err == nil {
t.Errorf("TakeWhileStrPtrErr failed. Expected New list=%v, actual list=%v", expectedNewList, NewList)
}
expectedNewList = []*string{&v40}
partialIsEvenDivisibleBy := func(num *string) (bool, error) {
if *num == "40" {
return true, nil
}
return false, nil
}
NewList, _ = TakeWhileStrPtrErr(partialIsEvenDivisibleBy, []*string{&v40})
if *NewList[0] != *expectedNewList[0] {
t.Errorf("TakeWhileStrPtrErr failed. Expected New list=%v, actual list=%v", expectedNewList, NewList)
}
r, _ := TakeWhileStrPtrErr(nil, nil)
if len(r) > 0 {
t.Errorf("TakeWhileStrPtrErr failed.")
}
r, _ = TakeWhileStrPtrErr(nil, []*string{})
if len(r) > 0 {
t.Errorf("TakeWhileStrPtr failed.")
}
}`
s2 := `func TestTakeWhileStrPtrErr(t *testing.T) {
// Test : Take the numbers as long as condition match
var v2 string = "2"
var v4 string = "4"
var v5 string = "5"
var v7 string = "7"
var v40 string = "40"
var v0 string = "0"
expectedNewList := []*string{&v4, &v2, &v4}
NewList, _ := TakeWhileStrPtrErr(isEvenStrPtrErr, []*string{&v4, &v2, &v4, &v7, &v5})
if *NewList[0] != *expectedNewList[0] || *NewList[1] != *expectedNewList[1] || *NewList[2] != *expectedNewList[2] {
t.Errorf("TakeWhileStrPtrErr failed. Expected New list=%v, actual list=%v", expectedNewList, NewList)
}
_, err := TakeWhileStrPtrErr(isEvenStrPtrErr, []*string{&v0, &v2, &v4, &v7, &v5})
if err == nil {
t.Errorf("TakeWhileStrPtrErr failed. Expected New list=%v, actual list=%v", expectedNewList, NewList)
}
expectedNewList = []*string{&v40}
partialIsEvenDivisibleBy := func(num *string) (bool, error) {
if *num == "40" {
return true, nil
}
return false, nil
}
NewList, _ = TakeWhileStrPtrErr(partialIsEvenDivisibleBy, []*string{&v40})
if *NewList[0] != *expectedNewList[0] {
t.Errorf("TakeWhileStrPtrErr failed. Expected New list=%v, actual list=%v", expectedNewList, NewList)
}
r, _ := TakeWhileStrPtrErr(nil, nil)
if len(r) > 0 {
t.Errorf("TakeWhileStrPtrErr failed.")
}
r, _ = TakeWhileStrPtrErr(nil, []*string{})
if len(r) > 0 {
t.Errorf("TakeWhileStrPtr failed.")
}
}`
code = strings.Replace(code, s1, s2, -1)
s1 = `func TestTakeWhileStrErr(t *testing.T) {
// Test : Take the numbers as long as condition match
var v2 string = "2"
var v4 string = "4"
var v5 string = "5"
var v7 string = "7"
var v40 string = "40"
var v0 string
expectedNewList := []string{v4, v2, v4}
NewList, _ := TakeWhileStrErr(isEvenStrErr, []string{v4, v2, v4, v7, v5})
if NewList[0] != expectedNewList[0] || NewList[1] != expectedNewList[1] || NewList[2] != expectedNewList[2] {
t.Errorf("TakeWhileStrErr failed. Expected New list=%v, actual list=%v", expectedNewList, NewList)
}
_, err := TakeWhileStrErr(isEvenStrErr, []string{v0, v2, v4, v7, v5})
if err == nil {
t.Errorf("TakeWhileStrErr failed. Expected New list=%v, actual list=%v", expectedNewList, NewList)
}
expectedNewList = []string{v40}
partialIsEvenDivisibleBy := func(num string) (bool, error) { if num == "40" { return true, nil}; return false, nil }
NewList, _ = TakeWhileStrErr(partialIsEvenDivisibleBy, []string{v40})
if NewList[0] != expectedNewList[0] {
t.Errorf("TakeWhileStrErr failed. Expected New list=%v, actual list=%v", expectedNewList, NewList)
}
r, _ := TakeWhileStrErr(nil, nil)
if len(r) > 0 {
t.Errorf("TakeWhileStrErr failed.")
}
r, _ = TakeWhileStrErr(nil, []string{})
if len(r) > 0 {
t.Errorf("TakeWhileStrErr failed.")
}
}`
s2 = `func TestTakeWhileStrErr(t *testing.T) {
// Test : Take the numbers as long as condition match
var v2 string = "2"
var v4 string = "4"
var v5 string = "5"
var v7 string = "7"
var v40 string = "40"
var v0 string = "0"
expectedNewList := []string{v4, v2, v4}
NewList, _ := TakeWhileStrErr(isEvenStrErr, []string{v4, v2, v4, v7, v5})
if NewList[0] != expectedNewList[0] || NewList[1] != expectedNewList[1] || NewList[2] != expectedNewList[2] {
t.Errorf("TakeWhileStrErr failed. Expected New list=%v, actual list=%v", expectedNewList, NewList)
}
_, err := TakeWhileStrErr(isEvenStrErr, []string{v0, v2, v4, v7, v5})
if err == nil {
t.Errorf("TakeWhileStrErr failed. Expected New list=%v, actual list=%v", expectedNewList, NewList)
}
expectedNewList = []string{v40}
partialIsEvenDivisibleBy := func(num string) (bool, error) { if num == "40" { return true, nil}; return false, nil }
NewList, _ = TakeWhileStrErr(partialIsEvenDivisibleBy, []string{v40})
if NewList[0] != expectedNewList[0] {
t.Errorf("TakeWhileStrErr failed. Expected New list=%v, actual list=%v", expectedNewList, NewList)
}
r, _ := TakeWhileStrErr(nil, nil)
if len(r) > 0 {
t.Errorf("TakeWhileStrErr failed.")
}
r, _ = TakeWhileStrErr(nil, []string{})
if len(r) > 0 {
t.Errorf("TakeWhileStrErr failed.")
}
}`
code = strings.Replace(code, s1, s2, -1)
s1 = `func TestTakeWhileStrPtr(t *testing.T) {
// Test : Take the numbers as long as condition match
var v2 string = "2"
var v4 string = "4"
var v5 string = "5"
var v7 string = "7"
var v40 string = "40"
expectedNewList := []*string{&v4, &v2, &v4}
NewList := TakeWhileStrPtr(isEvenStrPtr, []*string{&v4, &v2, &v4, &v7, &v5})
if *NewList[0] != *expectedNewList[0] || *NewList[1] != *expectedNewList[1] || *NewList[2] != *expectedNewList[2] {
t.Errorf("TakeWhileStrPtr failed. Expected New list=%v, actual list=%v", expectedNewList, NewList)
}
expectedNewList = []*string{&v40}
partialIsEvenDivisibleBy := func(num *string) bool { if *num == "40" { return true }; return false }
NewList = TakeWhileStrPtr(partialIsEvenDivisibleBy, []*string{&v40})
if *NewList[0] != *expectedNewList[0] {
t.Errorf("TakeWhileStrPtr failed. Expected New list=%v, actual list=%v", expectedNewList, NewList)
}
if len(TakeWhileStrPtr(nil, nil)) > 0 {
t.Errorf("TakeWhileStrPtr failed.")
}
if len(TakeWhileStrPtr(nil, []*string{})) > 0 {
t.Errorf("TakeWhileStrPtr failed.")
t.Errorf(reflect.String.String())
}
}`
s2 = `func TestTakeWhileStrPtr(t *testing.T) {
// Test : Take the numbers as long as condition match
var v2 string = "2"
var v4 string = "4"
var v5 string = "5"
var v7 string = "7"
var v40 string = "40"
expectedNewList := []*string{&v4, &v2, &v4}
NewList := TakeWhileStrPtr(isEvenStrPtr, []*string{&v4, &v2, &v4, &v7, &v5})
if *NewList[0] != *expectedNewList[0] || *NewList[1] != *expectedNewList[1] || *NewList[2] != *expectedNewList[2] {
t.Errorf("TakeWhileStrPtr failed. Expected New list=%v, actual list=%v", expectedNewList, NewList)
}
expectedNewList = []*string{&v40}
partialIsEvenDivisibleBy := func(num *string) bool {
if *num == "40" {
return true
}
return false
}
NewList = TakeWhileStrPtr(partialIsEvenDivisibleBy, []*string{&v40})
if *NewList[0] != *expectedNewList[0] {
t.Errorf("TakeWhileStrPtr failed. Expected New list=%v, actual list=%v", expectedNewList, NewList)
}
if len(TakeWhileStrPtr(nil, nil)) > 0 {
t.Errorf("TakeWhileStrPtr failed.")
}
if len(TakeWhileStrPtr(nil, []*string{})) > 0 {
t.Errorf("TakeWhileStrPtr failed.")
t.Errorf(reflect.String.String())
}
}`
code = strings.Replace(code, s1, s2, -1)
return code
}
//**********************TakeWhile<TYPE>PtrErr******************
// TakeWhilePtrErrTest is template
func TakeWhilePtrErrTest() string {
return `
func TestTakeWhile<FTYPE>PtrErr(t *testing.T) {
// Test : Take the numbers as long as condition match
var v2 <TYPE> = 2
var v4 <TYPE> = 4
var v5 <TYPE> = 5
var v7 <TYPE> = 7
var v40 <TYPE> = 40
var v0 <TYPE>
expectedNewList := []*<TYPE>{&v4, &v2, &v4}
NewList, _ := TakeWhile<FTYPE>PtrErr(isEven<FTYPE>PtrErr, []*<TYPE>{&v4, &v2, &v4, &v7, &v5})
if *NewList[0] != *expectedNewList[0] || *NewList[1] != *expectedNewList[1] || *NewList[2] != *expectedNewList[2] {
t.Errorf("TakeWhile<FTYPE>PtrErr failed. Expected New list=%v, actual list=%v", expectedNewList, NewList)
}
_, err := TakeWhile<FTYPE>PtrErr(isEven<FTYPE>PtrErr, []*<TYPE>{&v0, &v2, &v4, &v7, &v5})
if err == nil {
t.Errorf("TakeWhile<FTYPE>PtrErr failed. Expected New list=%v, actual list=%v", expectedNewList, NewList)
}
expectedNewList = []*<TYPE>{&v40}
partialIsEvenDivisibleBy := func(num *<TYPE>) (bool, error) { return *num%10 == 0, nil }
NewList, _ = TakeWhile<FTYPE>PtrErr(partialIsEvenDivisibleBy, []*<TYPE>{&v40})
if *NewList[0] != *expectedNewList[0] {
t.Errorf("TakeWhile<FTYPE>PtrErr failed. Expected New list=%v, actual list=%v", expectedNewList, NewList)
}
r, _ := TakeWhile<FTYPE>PtrErr(nil, nil)
if len(r) > 0 {
t.Errorf("TakeWhile<FTYPE>PtrErr failed.")
}
r, _ = TakeWhile<FTYPE>PtrErr(nil, []*<TYPE>{})
if len(r) > 0 {
t.Errorf("TakeWhile<FTYPE>Ptr failed.")
}
}
`
}
// TakeWhilePtrErrTestBool is template
func TakeWhilePtrErrTestBool() string {
return `
func TestTakeWhile<FTYPE>PtrErr(t *testing.T) {
// Test : Take the numbers as long as condition match
var vt <TYPE> = true
var vf <TYPE> = false
expectedNewList := []*<TYPE>{&vt, &vt, &vf}
NewList, _ := TakeWhile<FTYPE>PtrErr(func(v *bool) (bool, error) { return *v == true, nil }, []*<TYPE>{&vt, &vt, &vf, &vf, &vf})
if *NewList[0] != *expectedNewList[0] || *NewList[1] != *expectedNewList[1] {
t.Errorf("TakeWhile<FTYPE>PtrErr failed. Expected New list=%v, actual list=%v", expectedNewList, NewList)
}
expectedNewList = []*<TYPE>{&vt}
NewList, _ = TakeWhile<FTYPE>PtrErr(func(v *bool) (bool, error) { return *v == true, nil }, []*<TYPE>{&vt})
if *NewList[0] != *expectedNewList[0] {
t.Errorf("TakeWhile<FTYPE>PtrErr failed. Expected New list=%v, actual list=%v", expectedNewList, NewList)
}
_, err := TakeWhile<FTYPE>PtrErr(func(v *bool) (bool, error) {
if *v == false {
return false, errors.New("false is invalid for this test")
}
return *v == true, nil
}, []*<TYPE>{&vf})
if err == nil {
t.Errorf("TakeWhile<FTYPE>PtrErr failed. Expected New list=%v, actual list=%v", expectedNewList, NewList)
}
r, _ := TakeWhile<FTYPE>PtrErr(nil, nil)
if len(r) > 0 {
t.Errorf("TakeWhile<FTYPE>PtrErr failed.")
}
r, _ = TakeWhile<FTYPE>PtrErr(nil, []*<TYPE>{})
if len(r) > 0 {
t.Errorf("TakeWhile<FTYPE>Ptr failed.")
}
}
`
}
// ReplaceActivityTakeWhilePtrErr replaces ...
func ReplaceActivityTakeWhilePtrErr(code string) string {
s1 := `import (
_ "errors"
"reflect"
"testing"
)
func TestTakeWhileIntPtrErr(t *testing.T) {`
s2 := `import (
"errors"
"testing"
)
func TestTakeWhileIntPtrErr(t *testing.T) {`
code = strings.Replace(code, s1, s2, -1)
s1 = `partialIsEvenDivisibleBy := func(num *string) (bool, error) { return *num%10 == 0, nil }
NewList, _ = TakeWhileStrPtrErr(partialIsEvenDivisibleBy, []*string{&v40})`
s2 = `partialIsEvenDivisibleBy := func(num *string) (bool, error) {
if *num == "40" {
return true, nil
}
return false, nil
}
NewList, _ = TakeWhileStrPtrErr(partialIsEvenDivisibleBy, []*string{&v40})`
code = strings.Replace(code, s1, s2, -1)
s1 = `partialIsEvenDivisibleBy := func(num *float64) (bool, error) { return *num%10 == 0, nil }
NewList, _ = TakeWhileFloat64PtrErr(partialIsEvenDivisibleBy, []*float64{&v40})`
s2 = `partialIsEvenDivisibleBy := func(num *float64) (bool, error) { return int(*num)%10 == 0, nil }
NewList, _ = TakeWhileFloat64PtrErr(partialIsEvenDivisibleBy, []*float64{&v40})`
code = strings.Replace(code, s1, s2, -1)
s1 = `partialIsEvenDivisibleBy := func(num *float32) (bool, error) { return *num%10 == 0, nil }
NewList, _ = TakeWhileFloat32PtrErr(partialIsEvenDivisibleBy, []*float32{&v40})`
s2 = `partialIsEvenDivisibleBy := func(num *float32) (bool, error) { return int(*num)%10 == 0, nil }
NewList, _ = TakeWhileFloat32PtrErr(partialIsEvenDivisibleBy, []*float32{&v40})`
code = strings.Replace(code, s1, s2, -1)
return code
}
//**********************TakeWhile<TYPE>Err******************
// TakeWhileErrTest is template
func TakeWhileErrTest() string {
return `
func TestTakeWhile<FTYPE>Err(t *testing.T) {
// Test : Take the numbers as long as condition match
var v2 <TYPE> = 2
var v4 <TYPE> = 4
var v5 <TYPE> = 5
var v7 <TYPE> = 7
var v40 <TYPE> = 40
var v0 <TYPE>
expectedNewList := []<TYPE>{v4, v2, v4}
NewList, _ := TakeWhile<FTYPE>Err(isEven<FTYPE>Err, []<TYPE>{v4, v2, v4, v7, v5})
if NewList[0] != expectedNewList[0] || NewList[1] != expectedNewList[1] || NewList[2] != expectedNewList[2] {
t.Errorf("TakeWhile<FTYPE>Err failed. Expected New list=%v, actual list=%v", expectedNewList, NewList)
}
_, err := TakeWhile<FTYPE>Err(isEven<FTYPE>Err, []<TYPE>{v0, v2, v4, v7, v5})
if err == nil {
t.Errorf("TakeWhile<FTYPE>Err failed. Expected New list=%v, actual list=%v", expectedNewList, NewList)
}
expectedNewList = []<TYPE>{v40}
partialIsEvenDivisibleBy := func(num <TYPE>) (bool, error) { return num%10 == 0, nil }
NewList, _ = TakeWhile<FTYPE>Err(partialIsEvenDivisibleBy, []<TYPE>{v40})
if NewList[0] != expectedNewList[0] {
t.Errorf("TakeWhile<FTYPE>Err failed. Expected New list=%v, actual list=%v", expectedNewList, NewList)
}
r, _ := TakeWhile<FTYPE>Err(nil, nil)
if len(r) > 0 {
t.Errorf("TakeWhile<FTYPE>Err failed.")
}
r, _ = TakeWhile<FTYPE>Err(nil, []<TYPE>{})
if len(r) > 0 {
t.Errorf("TakeWhile<FTYPE>Err failed.")
}
}
`
}
// TakeWhileErrTestBool is template
func TakeWhileErrTestBool() string {
return `
func TestTakeWhile<FTYPE>Err(t *testing.T) {
// Test : Take the numbers as long as condition match
var vt <TYPE> = true
var vf <TYPE> = false
expectedNewList := []<TYPE>{vt, vt, vf}
NewList, _ := TakeWhile<FTYPE>Err(func(v bool) (bool, error) {return v == true, nil}, []<TYPE>{vt, vt, vf, vf, vf})
if NewList[0] != expectedNewList[0] || NewList[1] != expectedNewList[1] {
t.Errorf("TakeWhile<FTYPE>Err failed. Expected New list=%v, actual list=%v", expectedNewList, NewList)
}
expectedNewList = []<TYPE>{vt}
NewList, _ = TakeWhile<FTYPE>Err(func(v bool) (bool, error) {return v == true, nil}, []<TYPE>{vt})
if NewList[0] != expectedNewList[0] {
t.Errorf("TakeWhile<FTYPE>Err failed. Expected New list=%v, actual list=%v", expectedNewList, NewList)
}
_, err := TakeWhile<FTYPE>Err(func(v bool) (bool, error) { if v == false { return false, errors.New("false is invalid for this test") }; return v == true, nil}, []<TYPE>{vf})
if err == nil {
t.Errorf("TakeWhile<FTYPE>Err failed. Expected New list=%v, actual list=%v", expectedNewList, NewList)
}
r, _ := TakeWhile<FTYPE>Err(nil, nil)
if len(r) > 0 {
t.Errorf("TakeWhile<FTYPE>Err failed.")
}
r, _ = TakeWhile<FTYPE>Err(nil, []<TYPE>{})
if len(r) > 0 {
t.Errorf("TakeWhile<FTYPE>Err failed.")
}
}
`
}
// ReplaceActivityTakeWhileErr replaces ...
func ReplaceActivityTakeWhileErr(code string) string {
s1 := `import (
_ "errors"
"reflect"
"testing"
)
func TestTakeWhileIntErr(t *testing.T) {`
s2 := `import (
"errors"
"testing"
)
func TestTakeWhileIntErr(t *testing.T) {`
code = strings.Replace(code, s1, s2, -1)
s1 = `partialIsEvenDivisibleBy := func(num string) (bool, error) { return num%10 == 0, nil }
NewList, _ = TakeWhileStrErr(partialIsEvenDivisibleBy, []string{v40})`
s2 = `partialIsEvenDivisibleBy := func(num string) (bool, error) { if num == "40" { return true, nil}; return false, nil }
NewList, _ = TakeWhileStrErr(partialIsEvenDivisibleBy, []string{v40})`
code = strings.Replace(code, s1, s2, -1)
s1 = `partialIsEvenDivisibleBy := func(num float64) (bool, error) { return num%10 == 0, nil }
NewList, _ = TakeWhileFloat64Err(partialIsEvenDivisibleBy, []float64{v40})`
s2 = `partialIsEvenDivisibleBy := func(num float64) (bool, error) { return int(num)%10 == 0, nil }
NewList, _ = TakeWhileFloat64Err(partialIsEvenDivisibleBy, []float64{v40})`
code = strings.Replace(code, s1, s2, -1)
s1 = `partialIsEvenDivisibleBy := func(num float32) (bool, error) { return num%10 == 0, nil }
NewList, _ = TakeWhileFloat32Err(partialIsEvenDivisibleBy, []float32{v40})`
s2 = `partialIsEvenDivisibleBy := func(num float32) (bool, error) { return int(num)%10 == 0, nil }
NewList, _ = TakeWhileFloat32Err(partialIsEvenDivisibleBy, []float32{v40})`
code = strings.Replace(code, s1, s2, -1)
return code
} | internal/template/basic/takewhileptrtest.go | 0.53777 | 0.433682 | takewhileptrtest.go | starcoder |
package draw
import (
"image"
)
func doellipse(cmd byte, dst *Image, c image.Point, xr, yr, thick int, src *Image, sp image.Point, alpha uint32, phi int, op Op) {
setdrawop(dst.Display, op)
a := dst.Display.bufimage(1 + 4 + 4 + 2*4 + 4 + 4 + 4 + 2*4 + 2*4)
a[0] = cmd
bplong(a[1:], dst.id)
bplong(a[5:], src.id)
bplong(a[9:], uint32(c.X))
bplong(a[13:], uint32(c.Y))
bplong(a[17:], uint32(xr))
bplong(a[21:], uint32(yr))
bplong(a[25:], uint32(thick))
bplong(a[29:], uint32(sp.X))
bplong(a[33:], uint32(sp.Y))
bplong(a[37:], alpha)
bplong(a[41:], uint32(phi))
}
// Ellipse draws, using SoverD, an ellipse with center c and horizontal and
// vertical semiaxes a and b, and thickness 1+2*thick. The source is aligned so
// sp corresponds to c.
func (dst *Image) Ellipse(c image.Point, a, b, thick int, src *Image, sp image.Point) {
dst.Display.mu.Lock()
defer dst.Display.mu.Unlock()
doellipse('e', dst, c, a, b, thick, src, sp, 0, 0, SoverD)
}
// EllipseOp draws an ellipse with center c and horizontal and vertical
// semiaxes a and b, and thickness 1+2*thick. The source is aligned so sp
// corresponds to c.
func (dst *Image) EllipseOp(c image.Point, a, b, thick int, src *Image, sp image.Point, op Op) {
dst.Display.mu.Lock()
defer dst.Display.mu.Unlock()
doellipse('e', dst, c, a, b, thick, src, sp, 0, 0, op)
}
// FillEllipse draws and fills, using SoverD, an ellipse with center c and
// horizontal and vertical semiaxes a and b, and thickness 1+2*thick. The
// source is aligned so sp corresponds to c.
func (dst *Image) FillEllipse(c image.Point, a, b, thick int, src *Image, sp image.Point) {
dst.Display.mu.Lock()
defer dst.Display.mu.Unlock()
doellipse('E', dst, c, a, b, thick, src, sp, 0, 0, SoverD)
}
// FillEllipseOp draws and fills ellipse with center c and horizontal and
// vertical semiaxes a and b, and thickness 1+2*thick. The source is aligned so
// sp corresponds to c.
func (dst *Image) FillEllipseOp(c image.Point, a, b, thick int, src *Image, sp image.Point, op Op) {
dst.Display.mu.Lock()
defer dst.Display.mu.Unlock()
doellipse('E', dst, c, a, b, thick, src, sp, 0, 0, op)
}
// Arc draws, using SoverD, the arc centered at c, with thickness 1+2*thick,
// using the specified source color. The arc starts at angle alpha and extends
// counterclockwise by phi; angles are measured in degrees from the x axis.
func (dst *Image) Arc(c image.Point, a, b, thick int, src *Image, sp image.Point, alpha, phi int) {
dst.Display.mu.Lock()
defer dst.Display.mu.Unlock()
doellipse('e', dst, c, a, b, thick, src, sp, uint32(alpha)|1<<31, phi, SoverD)
}
// ArcOp draws the arc centered at c, with thickness 1+2*thick, using the
// specified source color. The arc starts at angle alpha and extends
// counterclockwise by phi; angles are measured in degrees from the x axis.
func (dst *Image) ArcOp(c image.Point, a, b, thick int, src *Image, sp image.Point, alpha, phi int, op Op) {
dst.Display.mu.Lock()
defer dst.Display.mu.Unlock()
doellipse('e', dst, c, a, b, thick, src, sp, uint32(alpha)|1<<31, phi, op)
}
// FillArc draws and fills, using SoverD, the arc centered at c, with thickness
// 1+2*thick, using the specified source color. The arc starts at angle alpha
// and extends counterclockwise by phi; angles are measured in degrees from the
// x axis.
func (dst *Image) FillArc(c image.Point, a, b, thick int, src *Image, sp image.Point, alpha, phi int) {
dst.Display.mu.Lock()
defer dst.Display.mu.Unlock()
doellipse('E', dst, c, a, b, thick, src, sp, uint32(alpha)|1<<31, phi, SoverD)
}
// FillArcOp draws and fills the arc centered at c, with thickness 1+2*thick,
// using the specified source color. The arc starts at angle alpha and extends
// counterclockwise by phi; angles are measured in degrees from the x axis.
func (dst *Image) FillArcOp(c image.Point, a, b, thick int, src *Image, sp image.Point, alpha, phi int, op Op) {
dst.Display.mu.Lock()
defer dst.Display.mu.Unlock()
doellipse('E', dst, c, a, b, thick, src, sp, uint32(alpha)|1<<31, phi, op)
} | vendor/9fans.net/go/draw/ellipse.go | 0.654453 | 0.608449 | ellipse.go | starcoder |
package imageutil
import (
"image"
"image/color"
"image/draw"
"strings"
)
const (
AlignTop = "top"
AlignCenter = "center"
AlignBottom = "bottom"
AlignLeft = "left"
AlignRight = "right"
)
// Crop takes an image and crops it to the specified rectangle.
func Crop(src image.Image, retain image.Rectangle) image.Image {
new := image.NewRGBA(retain)
draw.Draw(new, new.Bounds(), src, retain.Min, draw.Over)
return new
}
// CropX crops an image by its width horizontally.
func CropX(src image.Image, width uint, align string) image.Image {
if int(width) >= src.Bounds().Dx() {
return src
}
var xMin int
switch strings.ToLower(strings.TrimSpace(align)) {
case AlignLeft:
xMin = src.Bounds().Min.X
case AlignRight:
xMin = src.Bounds().Max.X - int(width)
default:
xMin = (src.Bounds().Max.X - int(width)) / 2
}
return Crop(src, image.Rect(
xMin,
src.Bounds().Min.Y,
xMin+int(width),
src.Bounds().Max.Y))
}
// CropY crops an image by its height vertically.
func CropY(src image.Image, height uint, align string) image.Image {
if int(height) >= src.Bounds().Dy() {
return src
}
var yMin int
switch strings.ToLower(strings.TrimSpace(align)) {
case AlignTop:
yMin = src.Bounds().Min.Y
case AlignBottom:
yMin = src.Bounds().Max.Y - int(height)
default:
yMin = (src.Bounds().Max.Y - int(height)) / 2
}
return Crop(src, image.Rect(
src.Bounds().Min.X,
yMin,
src.Bounds().Max.X,
yMin+int(height)))
}
// SquareLarger returns an image that is cropped to where the height and weight are equal
// to the larger of the source image.
func SquareLarger(src image.Image, bgcolor color.Color) image.Image {
width := src.Bounds().Dx()
height := src.Bounds().Dy()
switch {
case width > height:
new := AddBackgroundColor(image.NewRGBA(image.Rect(0, 0, width, width)), bgcolor)
draw.Draw(new, new.Bounds(), src, image.Point{
Y: src.Bounds().Min.Y + ((height - width) / 2),
X: src.Bounds().Min.X}, draw.Over)
return new
case width < height:
new := AddBackgroundColor(image.NewRGBA(image.Rect(0, 0, height, height)), bgcolor)
draw.Draw(new, new.Bounds(), src, image.Point{
X: src.Bounds().Min.X + ((width - height) / 2),
Y: src.Bounds().Min.Y}, draw.Over)
return new
default:
return src
}
}
// Square returns an image that is cropped to where the height and weight are equal
// to the smaller of the source image.
func Square(src image.Image) image.Image {
width := src.Bounds().Dx()
height := src.Bounds().Dy()
switch {
case width > height:
return CropX(src, uint(height), AlignCenter)
case width < height:
return CropY(src, uint(width), AlignCenter)
default:
return src
}
} | image/imageutil/crop.go | 0.82478 | 0.421552 | crop.go | starcoder |
package cloudformation
import (
"encoding/base64"
"strings"
)
// Ref creates a CloudFormation Reference to another resource in the template
func Ref(logicalName string) string {
return encode(`{ "Ref": "` + logicalName + `" }`)
}
// GetAtt returns the value of an attribute from a resource in the template.
func GetAtt(logicalName string, attribute string) string {
return encode(`{ "Fn::GetAtt": [ "` + logicalName + `", "` + attribute + `" ] }`)
}
// ImportValue returns the value of an output exported by another stack. You typically use this function to create cross-stack references. In the following example template snippets, Stack A exports VPC security group values and Stack B imports them.
func ImportValue(name string) string {
return encode(`{ "Fn::ImportValue": "` + name + `" }`)
}
// Base64 returns the Base64 representation of the input string. This function is typically used to pass encoded data to Amazon EC2 instances by way of the UserData property
func Base64(input string) string {
return encode(`{ "Fn::Base64": "` + input + `" }`)
}
// CIDR returns an array of CIDR address blocks. The number of CIDR blocks returned is dependent on the count parameter.
func CIDR(ipBlock, count, cidrBits string) string {
return encode(`{ "Fn::Cidr" : [ "` + ipBlock + `", "` + count + `", "` + cidrBits + `" ] }`)
}
// FindInMap returns the value corresponding to keys in a two-level map that is declared in the Mappings section.
func FindInMap(mapName, topLevelKey, secondLevelKey string) string {
return encode(`{ "Fn::FindInMap" : [ "` + mapName + `", "` + topLevelKey + `", "` + secondLevelKey + `" ] }`)
}
// GetAZs returns an array that lists Availability Zones for a specified region. Because customers have access to different Availability Zones, the intrinsic function Fn::GetAZs enables template authors to write templates that adapt to the calling user's access. That way you don't have to hard-code a full list of Availability Zones for a specified region.
func GetAZs(region string) string {
return encode(`{ "Fn::GetAZs": "` + region + `" }`)
}
// Join appends a set of values into a single value, separated by the specified delimiter. If a delimiter is the empty string, the set of values are concatenated with no delimiter.
func Join(delimiter string, values []string) string {
return encode(`{ "Fn::Join": [ "` + delimiter + `", [ "` + strings.Trim(strings.Join(values, `", "`), `, "`) + `" ] ] }`)
}
// Select returns a single object from a list of objects by index.
func Select(index string, list []string) string {
return encode(`{ "Fn::Select": [ "` + index + `", [ "` + strings.Trim(strings.Join(list, `", "`), `, "`) + `" ] ] }`)
}
// Split splits a string into a list of string values so that you can select an element from the resulting string list, use the Fn::Split intrinsic function. Specify the location of splits with a delimiter, such as , (a comma). After you split a string, use the Fn::Select function to pick a specific element.
func Split(delimiter, source string) string {
return encode(`{ "Fn::Split" : [ "` + delimiter + `", "` + source + `" ] }`)
}
// Sub substitutes variables in an input string with values that you specify. In your templates, you can use this function to construct commands or outputs that include values that aren't available until you create or update a stack.
func Sub(value string) string {
return encode(`{ "Fn::Sub" : "` + value + `" }`)
}
// And returns true if all the specified conditions evaluate to true, or returns false if any one of the conditions evaluates to false. Fn::And acts as an AND operator. The minimum number of conditions that you can include is 2, and the maximum is 10.
func And(conditions []string) string {
return encode(`{ "Fn::And": [ "` + strings.Trim(strings.Join(conditions, `", "`), `, "`) + `" ] }`)
}
// Equals compares if two values are equal. Returns true if the two values are equal or false if they aren't.
func Equals(value1, value2 string) string {
return encode(`{ "Fn::Equals" : [ "` + value1 + `", "` + value2 + `" ] }`)
}
// If returns one value if the specified condition evaluates to true and another value if the specified condition evaluates to false. Currently, AWS CloudFormation supports the Fn::If intrinsic function in the metadata attribute, update policy attribute, and property values in the Resources section and Outputs sections of a template. You can use the AWS::NoValue pseudo parameter as a return value to remove the corresponding property.
func If(value, ifEqual, ifNotEqual string) string {
return encode(`{ "Fn::If" : [ "` + value + `", "` + ifEqual + `", "` + ifNotEqual + `" ] }`)
}
// Not returns true for a condition that evaluates to false or returns false for a condition that evaluates to true. Fn::Not acts as a NOT operator.
func Not(conditions []string) string {
return encode(`{ "Fn::Not": [ "` + strings.Trim(strings.Join(conditions, `", "`), `, "`) + `" ] }`)
}
// Or returns true if any one of the specified conditions evaluate to true, or returns false if all of the conditions evaluates to false. Fn::Or acts as an OR operator. The minimum number of conditions that you can include is 2, and the maximum is 10.
func Or(conditions []string) string {
return encode(`{ "Fn::Or": [ "` + strings.Trim(strings.Join(conditions, `", "`), `, "`) + `" ] }`)
}
// encode takes a string representation of an intrinsic function, and base64 encodes it.
// This prevents the escaping issues when nesting multiple layers of intrinsic functions.
func encode(value string) string {
return base64.StdEncoding.EncodeToString([]byte(value))
} | vendor/github.com/awslabs/goformation/cloudformation/intrinsics.go | 0.906018 | 0.540196 | intrinsics.go | starcoder |
package pt
import (
"math"
"math/rand"
)
type Vector struct {
X, Y, Z float64
}
func V(x, y, z float64) Vector {
return Vector{x, y, z}
}
func RandomUnitVector(rnd *rand.Rand) Vector {
for {
var x, y, z float64
if rnd == nil {
x = rand.Float64()*2 - 1
y = rand.Float64()*2 - 1
z = rand.Float64()*2 - 1
} else {
x = rnd.Float64()*2 - 1
y = rnd.Float64()*2 - 1
z = rnd.Float64()*2 - 1
}
if x*x+y*y+z*z > 1 {
continue
}
return Vector{x, y, z}.Normalize()
}
}
func (a Vector) Length() float64 {
return math.Sqrt(a.X*a.X + a.Y*a.Y + a.Z*a.Z)
}
func (a Vector) LengthN(n float64) float64 {
if n == 2 {
return a.Length()
}
a = a.Abs()
return math.Pow(math.Pow(a.X, n)+math.Pow(a.Y, n)+math.Pow(a.Z, n), 1/n)
}
func (a Vector) Dot(b Vector) float64 {
return a.X*b.X + a.Y*b.Y + a.Z*b.Z
}
func (a Vector) Cross(b Vector) Vector {
x := a.Y*b.Z - a.Z*b.Y
y := a.Z*b.X - a.X*b.Z
z := a.X*b.Y - a.Y*b.X
return Vector{x, y, z}
}
func (a Vector) Normalize() Vector {
d := a.Length()
return Vector{a.X / d, a.Y / d, a.Z / d}
}
func (a Vector) Negate() Vector {
return Vector{-a.X, -a.Y, -a.Z}
}
func (a Vector) Abs() Vector {
return Vector{math.Abs(a.X), math.Abs(a.Y), math.Abs(a.Z)}
}
func (a Vector) Add(b Vector) Vector {
return Vector{a.X + b.X, a.Y + b.Y, a.Z + b.Z}
}
func (a Vector) Sub(b Vector) Vector {
return Vector{a.X - b.X, a.Y - b.Y, a.Z - b.Z}
}
func (a Vector) Mul(b Vector) Vector {
return Vector{a.X * b.X, a.Y * b.Y, a.Z * b.Z}
}
func (a Vector) Div(b Vector) Vector {
return Vector{a.X / b.X, a.Y / b.Y, a.Z / b.Z}
}
func (a Vector) Mod(b Vector) Vector {
// as implemented in GLSL
x := a.X - b.X*math.Floor(a.X/b.X)
y := a.Y - b.Y*math.Floor(a.Y/b.Y)
z := a.Z - b.Z*math.Floor(a.Z/b.Z)
return Vector{x, y, z}
}
func (a Vector) AddScalar(b float64) Vector {
return Vector{a.X + b, a.Y + b, a.Z + b}
}
func (a Vector) SubScalar(b float64) Vector {
return Vector{a.X - b, a.Y - b, a.Z - b}
}
func (a Vector) MulScalar(b float64) Vector {
return Vector{a.X * b, a.Y * b, a.Z * b}
}
func (a Vector) DivScalar(b float64) Vector {
return Vector{a.X / b, a.Y / b, a.Z / b}
}
func (a Vector) Min(b Vector) Vector {
return Vector{math.Min(a.X, b.X), math.Min(a.Y, b.Y), math.Min(a.Z, b.Z)}
}
func (a Vector) Max(b Vector) Vector {
return Vector{math.Max(a.X, b.X), math.Max(a.Y, b.Y), math.Max(a.Z, b.Z)}
}
func (a Vector) MinAxis() Vector {
x, y, z := math.Abs(a.X), math.Abs(a.Y), math.Abs(a.Z)
switch {
case x <= y && x <= z:
return Vector{1, 0, 0}
case y <= x && y <= z:
return Vector{0, 1, 0}
}
return Vector{0, 0, 1}
}
func (a Vector) MinComponent() float64 {
return math.Min(math.Min(a.X, a.Y), a.Z)
}
func (a Vector) MaxComponent() float64 {
return math.Max(math.Max(a.X, a.Y), a.Z)
}
func (n Vector) Reflect(i Vector) Vector {
return i.Sub(n.MulScalar(2 * n.Dot(i)))
}
func (n Vector) Refract(i Vector, n1, n2 float64) Vector {
nr := n1 / n2
cosI := -n.Dot(i)
sinT2 := nr * nr * (1 - cosI*cosI)
if sinT2 > 1 {
return Vector{}
}
cosT := math.Sqrt(1 - sinT2)
return i.MulScalar(nr).Add(n.MulScalar(nr*cosI - cosT))
}
func (n Vector) Reflectance(i Vector, n1, n2 float64) float64 {
nr := n1 / n2
cosI := -n.Dot(i)
sinT2 := nr * nr * (1 - cosI*cosI)
if sinT2 > 1 {
return 1
}
cosT := math.Sqrt(1 - sinT2)
rOrth := (n1*cosI - n2*cosT) / (n1*cosI + n2*cosT)
rPar := (n2*cosI - n1*cosT) / (n2*cosI + n1*cosT)
return (rOrth*rOrth + rPar*rPar) / 2
} | pt/vector.go | 0.824179 | 0.773002 | vector.go | starcoder |
package performance
import (
"fmt"
"math"
"time"
vegeta "github.com/tsenart/vegeta/lib"
)
// steadyUpPacer is a Pacer that describes attack request rates that increases in the beginning then becomes steady.
// Max | ,----------------
// | /
// | /
// | /
// | /
// Min -+------------------------------> t
// |<-Up->|
type steadyUpPacer struct {
// UpDuration is the duration that attack request rates increase from Min to Max.
UpDuration time.Duration
// Min is the attack request rates from the beginning, must be larger than 0.
Min vegeta.Rate
// Max is the maximum and final steady attack request rates.
Max vegeta.Rate
slope float64
minHitsPerNs float64
maxHitsPerNs float64
}
// NewSteadyUpPacer returns a new SteadyUpPacer with the given config.
func NewSteadyUpPacer(min vegeta.Rate, max vegeta.Rate, upDuration time.Duration) vegeta.Pacer {
return &steadyUpPacer{
Min: min,
Max: max,
UpDuration: upDuration,
slope: (hitsPerNs(max) - hitsPerNs(min)) / float64(upDuration),
minHitsPerNs: hitsPerNs(min),
maxHitsPerNs: hitsPerNs(max),
}
}
// steadyUpPacer satisfies the Pacer interface.
var _ vegeta.Pacer = steadyUpPacer{}
// String returns a pretty-printed description of the steadyUpPacer's behaviour.
func (sup steadyUpPacer) String() string {
return fmt.Sprintf("Up{%s + %s / %s}, then Steady{%s}", sup.Min, sup.Max, sup.UpDuration, sup.Max)
}
// invalid tests the constraints documented in the steadyUpPacer struct definition.
func (sup steadyUpPacer) invalid() bool {
return sup.UpDuration <= 0 || sup.minHitsPerNs <= 0 || sup.maxHitsPerNs <= sup.minHitsPerNs
}
// Pace determines the length of time to sleep until the next hit is sent.
func (sup steadyUpPacer) Pace(elapsedTime time.Duration, elapsedHits uint64) (time.Duration, bool) {
if sup.invalid() {
// If pacer configuration is invalid, stop the attack.
return 0, true
}
expectedHits := sup.hits(elapsedTime)
if elapsedHits < uint64(expectedHits) {
// Running behind, send next hit immediately.
return 0, false
}
// Re-arranging our hits equation to provide a duration given the number of
// requests sent is non-trivial, so we must solve for the duration numerically.
// math.Round() added here because we have to coerce to int64 nanoseconds
// at some point and it corrects a bunch of off-by-one problems.
nsPerHit := 1 / sup.hitsPerNs(elapsedTime)
hitsToWait := float64(elapsedHits+1) - expectedHits
nextHitIn := time.Duration(nsPerHit * hitsToWait)
// If we can't converge to an error of <1e-3 within 10 iterations, bail.
// This rarely even loops for any large Period if hitsToWait is small.
for i := 0; i < 10; i++ {
hitsAtGuess := sup.hits(elapsedTime + nextHitIn)
err := float64(elapsedHits+1) - hitsAtGuess
if math.Abs(err) < 1e-3 {
return nextHitIn, false
}
nextHitIn = time.Duration(float64(nextHitIn) / (hitsAtGuess - float64(elapsedHits)))
}
return nextHitIn, false
}
// hits returns the number of expected hits for this pacer during the given time.
func (sup steadyUpPacer) hits(t time.Duration) float64 {
if t <= 0 || sup.invalid() {
return 0
}
// If t is smaller than the UpDuration, calculate the hits as a trapezoid.
if t <= sup.UpDuration {
curtHitsPerNs := sup.hitsPerNs(t)
return (curtHitsPerNs + sup.minHitsPerNs) / 2.0 * float64(t)
}
// If t is larger than the UpDuration, calculate the hits as a trapezoid + a rectangle.
upHits := (sup.maxHitsPerNs + sup.minHitsPerNs) / 2.0 * float64(sup.UpDuration)
steadyHits := sup.maxHitsPerNs * float64(t-sup.UpDuration)
return upHits + steadyHits
}
// hitsPerNs returns the attack rate for this pacer at a given time.
func (sup steadyUpPacer) hitsPerNs(t time.Duration) float64 {
if t <= sup.UpDuration {
return sup.minHitsPerNs + float64(t)*sup.slope
}
return sup.maxHitsPerNs
}
// hitsPerNs returns the attack rate this ConstantPacer represents, in
// fractional hits per nanosecond.
func hitsPerNs(cp vegeta.ConstantPacer) float64 {
return float64(cp.Freq) / float64(cp.Per)
} | test/performance/pacers.go | 0.766119 | 0.446495 | pacers.go | starcoder |
package geometry
import (
"math"
"github.com/gonum/matrix/mat64"
)
// Box3 describes a box in 3d by min and max vector
type Box3 struct {
Min *mat64.Vector
Max *mat64.Vector
}
func NewBox3(min, max *mat64.Vector) Box3 {
b3 := Box3{}
if min == nil {
b3.Max = mat64.NewVector(3, []float64{
math.Inf(-1),
math.Inf(-1),
math.Inf(-1),
})
}
if max == nil {
b3.Min = mat64.NewVector(3, []float64{
math.Inf(1),
math.Inf(1),
math.Inf(1),
})
}
return b3
}
func (b3 *Box3) Empty() {
b3.Min = mat64.NewVector(3, []float64{
math.Inf(1),
math.Inf(1),
math.Inf(1),
})
b3.Max = mat64.NewVector(3, []float64{
math.Inf(-1),
math.Inf(-1),
math.Inf(-1),
})
}
func (b3 *Box3) GetCenter() *mat64.Vector {
center := mat64.NewVector(3, []float64{0, 0, 0})
center.AddVec(b3.Min, b3.Max)
MultiplyScalar(center, 0.5)
return center
}
func (b3 *Box3) SetFromPoints(points []*mat64.Vector) {
b3.Empty()
for _, point := range points {
b3.ExpandByPoint(point)
}
}
func (b3 *Box3) SetFromCenterAndSize(center, size *mat64.Vector) {
v1 := mat64.NewVector(3, []float64{0, 0, 0})
v1.CloneVec(size)
MultiplyScalar(v1, 0.5)
b3.Min.AddScaledVec(center, -0.5, size)
b3.Max.AddScaledVec(center, 0.5, size)
}
func (b3 *Box3) ExpandByPoint(vector *mat64.Vector) {
b3.Min = MinVec(b3.Min, vector)
b3.Max = MaxVec(b3.Max, vector)
}
func (b3 *Box3) ContainsPoint(point *mat64.Vector) bool {
notContained := point.At(0, 0) < b3.Min.At(0, 0) || point.At(0, 0) > b3.Max.At(0, 0) ||
point.At(1, 0) < b3.Min.At(1, 0) || point.At(1, 0) > b3.Max.At(1, 0) ||
point.At(2, 0) < b3.Min.At(2, 0) || point.At(2, 0) > b3.Max.At(2, 0)
return !notContained
}
func (b3 *Box3) ExpandByScalar(scalar float64) {
AddScalar(b3.Min, -scalar*0.5)
AddScalar(b3.Max, scalar*0.5)
}
func (b3 *Box3) GetSize() *mat64.Vector {
size := mat64.NewVector(3, []float64{0, 0, 0})
size.SubVec(b3.Max, b3.Min)
return size
}
func (b3 *Box3) Volume() float64 {
size := b3.GetSize()
return size.At(0, 0) * size.At(1, 0) * size.At(2, 0)
} | Box3.go | 0.827863 | 0.763814 | Box3.go | starcoder |
package sqlutil
import (
"fmt"
"strconv"
"strings"
)
const (
sqlConditionIn = "IN"
sqlConditionNotIn = "NOT IN"
)
// BuildInClauseString prepares a SQL IN clause with the given list of string values.
func (c *SQLUtil) BuildInClauseString(field string, values []string) string {
return c.composeInClause(sqlConditionIn, field, c.formatStrings(values))
}
// BuildNotInClauseString prepares a SQL NOT IN clause with the given list of string values.
func (c *SQLUtil) BuildNotInClauseString(field string, values []string) string {
return c.composeInClause(sqlConditionNotIn, field, c.formatStrings(values))
}
// BuildInClauseInt prepares a SQL IN clause with the given list of integer values.
func (c *SQLUtil) BuildInClauseInt(field string, values []int) string {
return c.composeInClause(sqlConditionIn, field, formatInts(values))
}
// BuildNotInClauseInt prepares a SQL NOT IN clause with the given list of integer values.
func (c *SQLUtil) BuildNotInClauseInt(field string, values []int) string {
return c.composeInClause(sqlConditionNotIn, field, formatInts(values))
}
// BuildInClauseUint prepares a SQL IN clause with the given list of integer values.
func (c *SQLUtil) BuildInClauseUint(field string, values []uint64) string {
return c.composeInClause(sqlConditionIn, field, formatUints(values))
}
// BuildNotInClauseUint prepares a SQL NOT IN clause with the given list of integer values.
func (c *SQLUtil) BuildNotInClauseUint(field string, values []uint64) string {
return c.composeInClause(sqlConditionNotIn, field, formatUints(values))
}
func (c *SQLUtil) composeInClause(condition string, field string, values []string) string {
if len(values) == 0 {
return ""
}
return fmt.Sprintf("%s %s (%s)", c.QuoteID(field), condition, strings.Join(values, ","))
}
func (c *SQLUtil) formatStrings(values []string) []string {
items := make([]string, len(values))
for k, v := range values {
items[k] = c.QuoteValue(v)
}
return items
}
func formatInts(values []int) []string {
items := make([]string, len(values))
for k, v := range values {
items[k] = strconv.Itoa(v)
}
return items
}
func formatUints(values []uint64) []string {
items := make([]string, len(values))
for k, v := range values {
items[k] = strconv.FormatUint(v, 10)
}
return items
} | pkg/sqlutil/sqlinclause.go | 0.69451 | 0.423756 | sqlinclause.go | starcoder |
package main
// Import packages
import ("image"; "image/color"; "image/draw";
"os"
"log")
// Declare a new structure
type Canvas struct {
image.RGBA
}
func NewCanvas(r image.Rectangle) *Canvas {
canvas := new(Canvas)
canvas.RGBA = *image.NewRGBA(r)
return canvas
}
func (c Canvas) Clone() *Canvas {
clone := NewCanvas(c.Bounds())
copy(clone.Pix, c.Pix)
return clone
}
func (c Canvas) DrawGradient() {
size := c.Bounds().Size()
for x := 0; x < size.X; x++ {
for y := 0; y < size.Y; y++ {
color := color.RGBA{
uint8(255 * x / size.X),
uint8(255 * y / size.Y),
55,
255}
c.Set(x, y, color)
}
}
}
func (c Canvas) DrawLine(color color.RGBA, from Coordinate, to Coordinate) {
delta := to.Sub(from)
length := delta.Length()
xStep, yStep := delta.X/length, delta.Y/length
limit := int(length+0.5)
for i:=0; i<limit; i++ {
x := from.X + float64(i)*xStep
y := from.Y + float64(i)*yStep
c.Set(int(x), int(y), color)
}
}
func (c Canvas) DrawSpiral(color color.RGBA, from Coordinate, iterations uint32,
degree float64, factor float64) {
dir := Coordinate{0, 3.5}
last := from
var i uint32
// Iterations defines the number of small lines drawn
for i = 0; i<iterations; i++ {
next := last.Add(dir)
c.DrawLine(color, last, next)
// Only rotation will create a circle
dir.Rotate(degree)
// This scaling is the one which is doing the magic
dir.Scale(factor)
last = next
}
}
func (c Canvas) DrawRect(color color.RGBA, from Coordinate, to Coordinate) {
for x := int(from.X); x<=int(to.X); x++ {
for y := int(from.Y); y <= int(to.Y); y++ {
c.Set(x, y, color)
}
}
}
func (c Canvas) SaveToFile(fileName string) {
file, err := os.Create(fileName)
if err != nil {
log.Fatal(err)
}
defer file.Close()
// png.Encode(file, c.RGBA)
}
func CreateCanvas(fileName string) *Canvas {
file, err := os.Open(fileName)
if err != nil {
log.Fatal(err)
}
defer file.Close()
img, _, err := image.Decode(file)
if err != nil {
log.Fatal(err)
}
c := NewCanvas(img.Bounds())
draw.Draw(c, img.Bounds(), img, image.ZP, draw.Src)
return c
} | canvas.go | 0.685318 | 0.427636 | canvas.go | starcoder |
package memo
import (
"container/list"
)
// ExprIter enumerates all the equivalent expressions in the Group according to
// the expression pattern.
type ExprIter struct {
// Group and Element solely identify a Group expression.
*Group
*list.Element
// matched indicates whether the current Group expression bound by the
// iterator matches the pattern after the creation or iteration.
matched bool
// Pattern describes the node of pattern tree.
// The Operand type of the Group expression and the EngineType of the Group
// must be matched with it.
*Pattern
// Children is used to iterate the child expressions.
Children []*ExprIter
}
// Next returns the next Group expression matches the pattern.
func (iter *ExprIter) Next() (found bool) {
defer func() {
iter.matched = found
}()
// Iterate child firstly.
for i := len(iter.Children) - 1; i >= 0; i-- {
if !iter.Children[i].Next() {
continue
}
for j := i + 1; j < len(iter.Children); j++ {
iter.Children[j].Reset()
}
return true
}
// It's root node or leaf ANY node.
if iter.Group == nil || iter.Operand == OperandAny {
return false
}
// Otherwise, iterate itself to find more matched equivalent expressions.
for elem := iter.Element.Next(); elem != nil; elem = elem.Next() {
expr := elem.Value.(*GroupExpr)
if !iter.Operand.Match(GetOperand(expr.ExprNode)) {
// All the Equivalents which have the same Operand are continuously
// stored in the list. Once the current equivalent can not Match
// the Operand, the rest can not, either.
return false
}
if len(iter.Children) == 0 {
iter.Element = elem
return true
}
if len(iter.Children) != len(expr.Children) {
continue
}
allMatched := true
for i := range iter.Children {
iter.Children[i].Group = expr.Children[i]
if !iter.Children[i].Reset() {
allMatched = false
break
}
}
if allMatched {
iter.Element = elem
return true
}
}
return false
}
// Matched returns whether the iterator founds a Group expression matches the
// pattern.
func (iter *ExprIter) Matched() bool {
return iter.matched
}
// Reset resets the iterator to the first matched Group expression.
func (iter *ExprIter) Reset() (findMatch bool) {
defer func() { iter.matched = findMatch }()
if iter.Pattern.MatchOperandAny(iter.Group.EngineType) {
return true
}
for elem := iter.Group.GetFirstElem(iter.Operand); elem != nil; elem = elem.Next() {
expr := elem.Value.(*GroupExpr)
if !iter.Pattern.Match(GetOperand(expr.ExprNode), expr.Group.EngineType) {
break
}
// The leaf node of the pattern tree might not be an OperandAny or a XXXScan.
// We allow the patterns like: Selection -> Projection.
// For example, we have such a memo:
// Group#1
// Selection_0 input:[Group#2]
// Group#2
// Projection_1 input:[Group#3]
// Projection_2 input:[Group#4]
// Group#3
// .....
// For the pattern above, we will match it twice: `Selection_0->Projection_1`
// and `Selection_0->Projection_2`. So if the iterator has no children, we can safely return
// the element here.
if len(iter.Children) == 0 {
iter.Element = elem
return true
}
if len(expr.Children) != len(iter.Children) {
continue
}
allMatched := true
for i := range iter.Children {
iter.Children[i].Group = expr.Children[i]
if !iter.Children[i].Reset() {
allMatched = false
break
}
}
if allMatched {
iter.Element = elem
return true
}
}
return false
}
// GetExpr returns the root GroupExpr of the iterator.
func (iter *ExprIter) GetExpr() *GroupExpr {
return iter.Element.Value.(*GroupExpr)
}
// NewExprIterFromGroupElem creates the iterator on the Group Element.
func NewExprIterFromGroupElem(elem *list.Element, p *Pattern) *ExprIter {
expr := elem.Value.(*GroupExpr)
if !p.Match(GetOperand(expr.ExprNode), expr.Group.EngineType) {
return nil
}
iter := newExprIterFromGroupExpr(expr, p)
if iter != nil {
iter.Element = elem
}
return iter
}
// newExprIterFromGroupExpr creates the iterator on the Group expression.
func newExprIterFromGroupExpr(expr *GroupExpr, p *Pattern) *ExprIter {
if len(p.Children) != 0 && len(p.Children) != len(expr.Children) {
return nil
}
iter := &ExprIter{Pattern: p, matched: true}
for i := range p.Children {
childIter := newExprIterFromGroup(expr.Children[i], p.Children[i])
if childIter == nil {
return nil
}
iter.Children = append(iter.Children, childIter)
}
return iter
}
// newExprIterFromGroup creates the iterator on the Group.
func newExprIterFromGroup(g *Group, p *Pattern) *ExprIter {
if p.MatchOperandAny(g.EngineType) {
return &ExprIter{Group: g, Pattern: p, matched: true}
}
for elem := g.GetFirstElem(p.Operand); elem != nil; elem = elem.Next() {
expr := elem.Value.(*GroupExpr)
if !p.Match(GetOperand(expr.ExprNode), g.EngineType) {
return nil
}
iter := newExprIterFromGroupExpr(expr, p)
if iter != nil {
iter.Group, iter.Element = g, elem
return iter
}
}
return nil
} | planner/memo/expr_iterator.go | 0.662141 | 0.476032 | expr_iterator.go | starcoder |
package debug
import (
"image"
"image/color"
"image/draw"
"github.com/alevinval/fingerprints/internal/types"
)
var (
red = color.RGBA{255, 0, 0, 255}
green = color.RGBA{25, 215, 0, 255}
cyan = color.RGBA{20, 200, 200, 255}
blue = color.RGBA{0, 0, 255, 255}
)
// DrawFeatures draws the original image with all the features that are
// detected drawn on top of it. Useful for understanding what data
// we are gathering, and visualise it. Helpful for detecting issues with
// the algorithms or potential next steps.
func DrawFeatures(original image.Image, result *types.DetectionResult) {
dst := original.(draw.Image)
for _, minutiae := range result.Minutia {
switch minutiae.Type {
case types.Bifurcation:
drawSquare(dst, minutiae.X, minutiae.Y, red)
case types.Termination:
drawSquare(dst, minutiae.X, minutiae.Y, blue)
case types.Pore:
drawSquare(dst, minutiae.X, minutiae.Y, green)
}
}
drawFrame(dst, result.Frame.Horizontal, cyan)
drawFrame(dst, result.Frame.Vertical, cyan)
drawDiagonalFrame(dst, result.Frame.Diagonal, cyan)
drawHalfPoint(dst, result.Frame.Diagonal, cyan)
drawHalfPoint(dst, result.Frame.Horizontal, cyan)
drawHalfPoint(dst, result.Frame.Vertical, cyan)
}
func drawFrame(dst draw.Image, r image.Rectangle, c color.Color) {
drawCross(dst, r.Bounds().Min.X, r.Bounds().Min.Y, c)
drawCross(dst, r.Bounds().Max.X, r.Bounds().Max.Y, c)
}
func drawDiagonalFrame(dst draw.Image, r image.Rectangle, c color.Color) {
drawEdgeTopLeft(dst, r.Bounds().Min.X, r.Bounds().Min.Y, c)
drawEdgeBottomRight(dst, r.Bounds().Max.X, r.Bounds().Max.Y, c)
}
func drawHalfPoint(dst draw.Image, r image.Rectangle, c color.Color) {
halfX, halfY := halfPoint(r)
drawX(dst, halfX, halfY, c)
}
func drawCircle(dst draw.Image, x, y int, c color.Color) {
dst.Set(x, y-1, c)
dst.Set(x+1, y, c)
dst.Set(x, y+1, c)
dst.Set(x-1, y, c)
}
func drawSquare(dst draw.Image, x, y int, c color.Color) {
dst.Set(x, y-1, c)
dst.Set(x, y+1, c)
dst.Set(x+1, y, c)
dst.Set(x+1, y-1, c)
dst.Set(x+1, y+1, c)
dst.Set(x-1, y, c)
dst.Set(x-1, y-1, c)
dst.Set(x-1, y+1, c)
}
func drawCross(dst draw.Image, x, y int, c color.Color) {
dst.Set(x, y, c)
dst.Set(x, y-1, c)
dst.Set(x, y+1, c)
dst.Set(x+1, y, c)
dst.Set(x-1, y, c)
}
func drawX(dst draw.Image, x, y int, c color.Color) {
dst.Set(x, y, c)
dst.Set(x-1, y-1, c)
dst.Set(x+1, y+1, c)
dst.Set(x-1, y+1, c)
dst.Set(x+1, y-1, c)
}
func drawEdgeTopLeft(dst draw.Image, x, y int, c color.Color) {
dst.Set(x-1, y+1, c)
dst.Set(x-1, y, c)
dst.Set(x-1, y-1, c)
dst.Set(x, y-1, c)
dst.Set(x+1, y-1, c)
}
func drawEdgeBottomRight(dst draw.Image, x, y int, c color.Color) {
dst.Set(x-1, y+1, c)
dst.Set(x, y+1, c)
dst.Set(x+1, y+1, c)
dst.Set(x+1, y, c)
dst.Set(x+1, y-1, c)
}
func halfPoint(r image.Rectangle) (int, int) {
return (r.Max.X + r.Min.X) / 2, (r.Max.Y + r.Min.Y) / 2
} | internal/debug/visualize.go | 0.697403 | 0.55447 | visualize.go | starcoder |
package aerospike
import (
"fmt"
ParticleType "github.com/aerospike/aerospike-client-go/internal/particle_type"
)
// Filter specifies a query filter definition.
type Filter struct {
name string
idxType IndexCollectionType
valueParticleType int
begin Value
end Value
}
// NewEqualFilter creates a new equality filter instance for query.
func NewEqualFilter(binName string, value interface{}) *Filter {
val := NewValue(value)
return newFilter(binName, ICT_DEFAULT, val.GetType(), val, val)
}
// NewRangeFilter creates a range filter for query.
// Range arguments must be int64 values.
// String ranges are not supported.
func NewRangeFilter(binName string, begin int64, end int64) *Filter {
vBegin, vEnd := NewValue(begin), NewValue(end)
return newFilter(binName, ICT_DEFAULT, vBegin.GetType(), vBegin, vEnd)
}
// NewContainsFilter creates a contains filter for query on collection index.
func NewContainsFilter(binName string, indexCollectionType IndexCollectionType, value interface{}) *Filter {
v := NewValue(value)
return newFilter(binName, indexCollectionType, v.GetType(), v, v)
}
// NewContainsRangeFilter creates a contains filter for query on ranges of data in a collection index.
func NewContainsRangeFilter(binName string, indexCollectionType IndexCollectionType, begin, end int64) *Filter {
vBegin, vEnd := NewValue(begin), NewValue(end)
return newFilter(binName, indexCollectionType, vBegin.GetType(), vBegin, vEnd)
}
// NewGeoWithinRegionFilter creates a geospatial "within region" filter for query.
// Argument must be a valid GeoJSON region.
func NewGeoWithinRegionFilter(binName, region string) *Filter {
v := NewStringValue(region)
return newFilter(binName, ICT_DEFAULT, ParticleType.GEOJSON, v, v)
}
// NewGeoWithinRegionForCollectionFilter creates a geospatial "within region" filter for query on collection index.
// Argument must be a valid GeoJSON region.
func NewGeoWithinRegionForCollectionFilter(binName string, collectionType IndexCollectionType, region string) *Filter {
v := NewStringValue(region)
return newFilter(binName, collectionType, ParticleType.GEOJSON, v, v)
}
// NewGeoRegionsContainingPointFilter creates a geospatial "containing point" filter for query.
// Argument must be a valid GeoJSON point.
func NewGeoRegionsContainingPointFilter(binName, point string) *Filter {
v := NewStringValue(point)
return newFilter(binName, ICT_DEFAULT, ParticleType.GEOJSON, v, v)
}
// NewGeoRegionsContainingPointForCollectionFilter creates a geospatial "containing point" filter for query on collection index.
// Argument must be a valid GeoJSON point.
func NewGeoRegionsContainingPointForCollectionFilter(binName string, collectionType IndexCollectionType, point string) *Filter {
v := NewStringValue(point)
return newFilter(binName, collectionType, ParticleType.GEOJSON, v, v)
}
// NewGeoWithinRadiusFilter creates a geospatial "within radius" filter for query.
// Arguments must be valid longitude/latitude/radius (meters) values.
func NewGeoWithinRadiusFilter(binName string, lng, lat, radius float64) *Filter {
rgnStr := fmt.Sprintf("{ \"type\": \"AeroCircle\", "+"\"coordinates\": [[%.8f, %.8f], %f] }", lng, lat, radius)
return newFilter(binName, ICT_DEFAULT, ParticleType.GEOJSON, NewValue(rgnStr), NewValue(rgnStr))
}
// NewGeoWithinRadiusForCollectionFilter creates a geospatial "within radius" filter for query on collection index.
// Arguments must be valid longitude/latitude/radius (meters) values.
func NewGeoWithinRadiusForCollectionFilter(binName string, collectionType IndexCollectionType, lng, lat, radius float64) *Filter {
rgnStr := fmt.Sprintf("{ \"type\": \"AeroCircle\", "+"\"coordinates\": [[%.8f, %.8f], %f] }", lng, lat, radius)
return newFilter(binName, collectionType, ParticleType.GEOJSON, NewValue(rgnStr), NewValue(rgnStr))
}
// Create a filter for query.
// Range arguments must be longs or integers which can be cast to longs.
// String ranges are not supported.
func newFilter(name string, indexCollectionType IndexCollectionType, valueParticleType int, begin Value, end Value) *Filter {
return &Filter{
name: name,
idxType: indexCollectionType,
valueParticleType: valueParticleType,
begin: begin,
end: end,
}
}
// IndexType return filter's index type.
func (fltr *Filter) IndexCollectionType() IndexCollectionType {
return fltr.idxType
}
func (fltr *Filter) estimateSize() (int, error) {
// bin name size(1) + particle type size(1) + begin particle size(4) + end particle size(4) = 10
szBegin, err := fltr.begin.estimateSize()
if err != nil {
return szBegin, err
}
szEnd, err := fltr.end.estimateSize()
if err != nil {
return szEnd, err
}
return len(fltr.name) + szBegin + szEnd + 10, nil
}
func (fltr *Filter) write(cmd *baseCommand) (int, error) {
size := 0
// Write name length
err := cmd.WriteByte(byte(len(fltr.name)))
if err != nil {
return 0, err
}
size++
// Write Name
n, err := cmd.WriteString(fltr.name)
if err != nil {
return size + n, err
}
size += n
// Write particle type.
err = cmd.WriteByte(byte(fltr.valueParticleType))
if err != nil {
return size, err
}
size++
// Write filter begin.
esz, err := fltr.begin.estimateSize()
if err != nil {
return size, err
}
n, err = cmd.WriteInt32(int32(esz))
if err != nil {
return size + n, err
}
size += n
n, err = fltr.begin.write(cmd)
if err != nil {
return size + n, err
}
size += n
// Write filter end.
esz, err = fltr.end.estimateSize()
if err != nil {
return size, err
}
n, err = cmd.WriteInt32(int32(esz))
if err != nil {
return size + n, err
}
size += n
n, err = fltr.end.write(cmd)
if err != nil {
return size + n, err
}
size += n
return size, nil
} | vendor/github.com/aerospike/aerospike-client-go/filter.go | 0.773687 | 0.417746 | filter.go | starcoder |
package runtime
import (
"time"
"github.com/m3db/m3/src/dbnode/ratelimit"
"github.com/m3db/m3/src/dbnode/topology"
xclose "github.com/m3db/m3/src/x/close"
)
// Options is a set of runtime options.
type Options interface {
// Validate will validate the runtime options are valid.
Validate() error
// SetPersistRateLimitOptions sets the persist rate limit options
SetPersistRateLimitOptions(value ratelimit.Options) Options
// PersistRateLimitOptions returns the persist rate limit options
PersistRateLimitOptions() ratelimit.Options
// SetWriteNewSeriesAsync sets whether to write new series asynchronously or not,
// when true this essentially makes writes for new series eventually consistent
// as after a write is finished you are not guaranteed to read it back immediately
// due to inserts into the shard map being buffered. The write is however written
// to the commit log before completing so it is considered durable.
SetWriteNewSeriesAsync(value bool) Options
// WriteNewSeriesAsync returns whether to write new series asynchronously or not,
// when true this essentially makes writes for new series eventually consistent
// as after a write is finished you are not guaranteed to read it back immediately
// due to inserts into the shard map being buffered. The write is however written
// to the commit log before completing so it is considered durable.
WriteNewSeriesAsync() bool
// SetWriteNewSeriesBackoffDuration sets the insert backoff duration during
// periods of heavy insertions, this backoff helps gather larger batches
// to insert into a shard in a single batch requiring far less write lock
// acquisitions.
SetWriteNewSeriesBackoffDuration(value time.Duration) Options
// WriteNewSeriesBackoffDuration returns the insert backoff duration during
// periods of heavy insertions, this backoff helps gather larger batches
// to insert into a shard in a single batch requiring far less write lock
// acquisitions.
WriteNewSeriesBackoffDuration() time.Duration
// SetWriteNewSeriesLimitPerShardPerSecond sets the insert rate limit per second,
// setting to zero disables any rate limit for new series insertions. This rate
// limit is primarily offered to defend against unintentional bursts of new
// time series being inserted.
SetWriteNewSeriesLimitPerShardPerSecond(value int) Options
// WriteNewSeriesLimitPerShardPerSecond returns the insert rate limit per second,
// setting to zero disables any rate limit for new series insertions. This rate
// limit is primarily offered to defend against unintentional bursts of new
// time series being inserted.
WriteNewSeriesLimitPerShardPerSecond() int
// SetEncodersPerBlockLimit sets the maximum number of encoders per block
// allowed. Setting to zero means an unlimited number of encoders are
// permitted. This rate limit is primarily offered to defend against
// bursts of out of order writes, which creates many encoders, subsequently
// causing a large burst in CPU load when trying to merge them.
SetEncodersPerBlockLimit(value int) Options
// EncodersPerBlockLimit sets the maximum number of encoders per block
// allowed. Setting to zero means an unlimited number of encoders are
// permitted. This rate limit is primarily offered to defend against
// bursts of out of order writes, which creates many encoders, subsequently
// causing a large burst in CPU load when trying to merge them.
EncodersPerBlockLimit() int
// SetTickSeriesBatchSize sets the batch size to process series together
// during a tick before yielding and sleeping the per series duration
// multiplied by the batch size.
// The higher this value is the more variable CPU utilization will be
// but the shorter ticks will ultimately be.
SetTickSeriesBatchSize(value int) Options
// TickSeriesBatchSize returns the batch size to process series together
// during a tick before yielding and sleeping the per series duration
// multiplied by the batch size.
// The higher this value is the more variable CPU utilization will be
// but the shorter ticks will ultimately be.
TickSeriesBatchSize() int
// SetTickPerSeriesSleepDuration sets the tick sleep per series value that
// provides a constant duration to sleep per series at the end of processing
// a batch of series during a background tick, this can directly effect how
// fast a block is persisted after is rotated from the mutable series buffer
// to a series block (since all series need to be merged/processed before a
// persist can occur).
SetTickPerSeriesSleepDuration(value time.Duration) Options
// TickPerSeriesSleepDuration returns the tick sleep per series value that
// provides a constant duration to sleep per series at the end of processing
// a batch of series during a background tick, this can directly effect how
// fast a block is persisted after is rotated from the mutable series buffer
// to a series block (since all series need to be merged/processed before a
// persist can occur).
TickPerSeriesSleepDuration() time.Duration
// SetTickMinimumInterval sets the minimum tick interval to run ticks, this
// helps throttle the tick when the amount of series is low and the sleeps
// on a per series basis is short.
SetTickMinimumInterval(value time.Duration) Options
// TickMinimumInterval returns the minimum tick interval to run ticks, this
// helps throttle the tick when the amount of series is low and the sleeps
// on a per series basis is short.
TickMinimumInterval() time.Duration
// SetMaxWiredBlocks sets the max blocks to keep wired; zero is used
// to specify no limit. Wired blocks that are in the buffer, I.E are
// being written to, cannot be unwired. Similarly, blocks which have
// just been rotated out of the buffer but have not been flushed yet
// can also not be unwired. This means that the limit is best effort.
SetMaxWiredBlocks(value uint) Options
// MaxWiredBlocks returns the max blocks to keep wired, zero is used
// to specify no limit. Wired blocks that are in the buffer, I.E are
// being written to, cannot be unwired. Similarly, blocks which have
// just been rotated out of the buffer but have not been flushed yet
// can also not be unwired. This means that the limit is best effort.
MaxWiredBlocks() uint
// SetClientBootstrapConsistencyLevel sets the client bootstrap
// consistency level used when bootstrapping from peers. Setting this
// will take effect immediately, and as such can be used to finish a
// bootstrap in an unhealthy cluster to recover read capability by setting
// this value to ReadConsistencyLevelNone.
SetClientBootstrapConsistencyLevel(value topology.ReadConsistencyLevel) Options
// ClientBootstrapConsistencyLevel returns the client bootstrap
// consistency level used when bootstrapping from peers. Setting this
// will take effect immediately, and as such can be used to finish a
// bootstrap in an unhealthy cluster to recover read capability by setting
// this value to ReadConsistencyLevelNone.
ClientBootstrapConsistencyLevel() topology.ReadConsistencyLevel
// SetClientReadConsistencyLevel sets the client read consistency level
// used when fetching data from peers for coordinated reads
SetClientReadConsistencyLevel(value topology.ReadConsistencyLevel) Options
// ClientReadConsistencyLevel returns the client read consistency level
// used when fetching data from peers for coordinated reads
ClientReadConsistencyLevel() topology.ReadConsistencyLevel
// SetClientWriteConsistencyLevel sets the client write consistency level
// used when fetching data from peers for coordinated writes
SetClientWriteConsistencyLevel(value topology.ConsistencyLevel) Options
// ClientWriteConsistencyLevel returns the client write consistency level
// used when fetching data from peers for coordinated writes
ClientWriteConsistencyLevel() topology.ConsistencyLevel
// SetIndexDefaultQueryTimeout is the hard timeout value to use if none is
// specified for a specific query, zero specifies to use no timeout at all.
SetIndexDefaultQueryTimeout(value time.Duration) Options
// IndexDefaultQueryTimeout is the hard timeout value to use if none is
// specified for a specific query, zero specifies to use no timeout at all.
IndexDefaultQueryTimeout() time.Duration
}
// OptionsManager updates and supplies runtime options.
type OptionsManager interface {
// Update updates the current runtime options.
Update(value Options) error
// Get returns the current values.
Get() Options
// RegisterListener registers a listener for updates to runtime options,
// it will synchronously call back the listener when this method is called
// to deliver the current set of runtime options.
RegisterListener(l OptionsListener) xclose.SimpleCloser
// Close closes the watcher and all descendent watches.
Close()
}
// OptionsListener listens for updates to runtime options.
type OptionsListener interface {
// SetRuntimeOptions is called when the listener is registered
// and when any updates occurred passing the new runtime options.
SetRuntimeOptions(value Options)
} | vendor/github.com/m3db/m3/src/dbnode/runtime/types.go | 0.674372 | 0.466481 | types.go | starcoder |
package commands
import "github.com/leanovate/gopter"
// SystemUnderTest resembles the system under test, which may be any kind
// of stateful unit of code
type SystemUnderTest interface{}
// State resembles the state the system under test is expected to be in
type State interface{}
// Result resembles the result of a command that may or may not be checked
type Result interface{}
// Command is any kind of command that may be applied to the system under test
type Command interface {
// Run applies the command to the system under test
Run(systemUnderTest SystemUnderTest) Result
// NextState calculates the next expected state if the command is applied
NextState(state State) State
// PreCondition checks if the state is valid before the command is applied
PreCondition(state State) bool
// PostCondition checks if the state is valid after the command is applied
PostCondition(state State, result Result) *gopter.PropResult
// String gets a (short) string representation of the command
String() string
}
// ProtoCommand is a prototype implementation of the Command interface
type ProtoCommand struct {
Name string
RunFunc func(systemUnderTest SystemUnderTest) Result
NextStateFunc func(state State) State
PreConditionFunc func(state State) bool
PostConditionFunc func(state State, result Result) *gopter.PropResult
}
// Run applies the command to the system under test
func (p *ProtoCommand) Run(systemUnderTest SystemUnderTest) Result {
if p.RunFunc != nil {
return p.RunFunc(systemUnderTest)
}
return nil
}
// NextState calculates the next expected state if the command is applied
func (p *ProtoCommand) NextState(state State) State {
if p.NextStateFunc != nil {
return p.NextStateFunc(state)
}
return state
}
// PreCondition checks if the state is valid before the command is applied
func (p *ProtoCommand) PreCondition(state State) bool {
if p.PreConditionFunc != nil {
return p.PreConditionFunc(state)
}
return true
}
// PostCondition checks if the state is valid after the command is applied
func (p *ProtoCommand) PostCondition(state State, result Result) *gopter.PropResult {
if p.PostConditionFunc != nil {
return p.PostConditionFunc(state, result)
}
return &gopter.PropResult{Status: gopter.PropTrue}
}
func (p *ProtoCommand) String() string {
return p.Name
} | vendor/github.com/leanovate/gopter/commands/command.go | 0.658637 | 0.467636 | command.go | starcoder |
package date
import (
"errors"
"time"
)
const (
rfc1123JSON = `"` + time.RFC1123 + `"`
rfc1123 = time.RFC1123
)
// TimeRFC1123 defines a type similar to time.Time but assumes a layout of RFC1123 date-time (i.e.,
// Mon, 02 Jan 2006 15:04:05 MST).
type TimeRFC1123 struct {
time.Time
}
// UnmarshalJSON reconstitutes the Time from a JSON string conforming to RFC1123 date-time
// (i.e., Mon, 02 Jan 2006 15:04:05 MST).
func (t *TimeRFC1123) UnmarshalJSON(data []byte) (err error) {
t.Time, err = ParseTime(rfc1123JSON, string(data))
if err != nil {
return err
}
return nil
}
// MarshalJSON preserves the Time as a JSON string conforming to RFC1123 date-time (i.e.,
// Mon, 02 Jan 2006 15:04:05 MST).
func (t TimeRFC1123) MarshalJSON() ([]byte, error) {
if y := t.Year(); y < 0 || y >= 10000 {
return nil, errors.New("Time.MarshalJSON: year outside of range [0,9999]")
}
b := []byte(t.Format(rfc1123JSON))
return b, nil
}
// MarshalText preserves the Time as a byte array conforming to RFC1123 date-time (i.e.,
// Mon, 02 Jan 2006 15:04:05 MST).
func (t TimeRFC1123) MarshalText() ([]byte, error) {
if y := t.Year(); y < 0 || y >= 10000 {
return nil, errors.New("Time.MarshalText: year outside of range [0,9999]")
}
b := []byte(t.Format(rfc1123))
return b, nil
}
// UnmarshalText reconstitutes a Time saved as a byte array conforming to RFC1123 date-time
// (i.e., Mon, 02 Jan 2006 15:04:05 MST).
func (t *TimeRFC1123) UnmarshalText(data []byte) (err error) {
t.Time, err = ParseTime(rfc1123, string(data))
if err != nil {
return err
}
return nil
}
// MarshalBinary preserves the Time as a byte array conforming to RFC1123 date-time (i.e.,
// Mon, 02 Jan 2006 15:04:05 MST).
func (t TimeRFC1123) MarshalBinary() ([]byte, error) {
return t.MarshalText()
}
// UnmarshalBinary reconstitutes a Time saved as a byte array conforming to RFC1123 date-time
// (i.e., Mon, 02 Jan 2006 15:04:05 MST).
func (t *TimeRFC1123) UnmarshalBinary(data []byte) error {
return t.UnmarshalText(data)
}
// ToTime returns a Time as a time.Time
func (t TimeRFC1123) ToTime() time.Time {
return t.Time
}
// String returns the Time formatted as an RFC1123 date-time string (i.e.,
// Mon, 02 Jan 2006 15:04:05 MST).
func (t TimeRFC1123) String() string {
// Note: time.Time.String does not return an RFC1123 compliant string, time.Time.MarshalText does.
b, err := t.MarshalText()
if err != nil {
return ""
}
return string(b)
} | vendor/github.com/Azure/go-autorest/autorest/date/timerfc1123.go | 0.826327 | 0.466967 | timerfc1123.go | starcoder |
package image
import (
"image/color"
)
// YCbCrSubsampleRatio is the chroma subsample ratio used in a YCbCr image.
type YCbCrSubsampleRatio int
const (
YCbCrSubsampleRatio444 YCbCrSubsampleRatio = iota
YCbCrSubsampleRatio422
YCbCrSubsampleRatio420
YCbCrSubsampleRatio440
YCbCrSubsampleRatio411
YCbCrSubsampleRatio410
)
func (s YCbCrSubsampleRatio) String() string {
switch s {
case YCbCrSubsampleRatio444:
return "YCbCrSubsampleRatio444"
case YCbCrSubsampleRatio422:
return "YCbCrSubsampleRatio422"
case YCbCrSubsampleRatio420:
return "YCbCrSubsampleRatio420"
case YCbCrSubsampleRatio440:
return "YCbCrSubsampleRatio440"
case YCbCrSubsampleRatio411:
return "YCbCrSubsampleRatio411"
case YCbCrSubsampleRatio410:
return "YCbCrSubsampleRatio410"
}
return "YCbCrSubsampleRatioUnknown"
}
// YCbCr is an in-memory image of Y'CbCr colors. There is one Y sample per
// pixel, but each Cb and Cr sample can span one or more pixels.
// YStride is the Y slice index delta between vertically adjacent pixels.
// CStride is the Cb and Cr slice index delta between vertically adjacent pixels
// that map to separate chroma samples.
// It is not an absolute requirement, but YStride and len(Y) are typically
// multiples of 8, and:
// For 4:4:4, CStride == YStride/1 && len(Cb) == len(Cr) == len(Y)/1.
// For 4:2:2, CStride == YStride/2 && len(Cb) == len(Cr) == len(Y)/2.
// For 4:2:0, CStride == YStride/2 && len(Cb) == len(Cr) == len(Y)/4.
// For 4:4:0, CStride == YStride/1 && len(Cb) == len(Cr) == len(Y)/2.
// For 4:1:1, CStride == YStride/4 && len(Cb) == len(Cr) == len(Y)/4.
// For 4:1:0, CStride == YStride/4 && len(Cb) == len(Cr) == len(Y)/8.
type YCbCr struct {
Y, Cb, Cr []uint8
YStride int
CStride int
SubsampleRatio YCbCrSubsampleRatio
Rect Rectangle
}
func (p *YCbCr) ColorModel() color.Model {
return color.YCbCrModel
}
func (p *YCbCr) Bounds() Rectangle {
return p.Rect
}
func (p *YCbCr) At(x, y int) color.Color {
return p.YCbCrAt(x, y)
}
func (p *YCbCr) YCbCrAt(x, y int) color.YCbCr {
if !(Point{x, y}.In(p.Rect)) {
return color.YCbCr{}
}
yi := p.YOffset(x, y)
ci := p.COffset(x, y)
return color.YCbCr{
p.Y[yi],
p.Cb[ci],
p.Cr[ci],
}
}
// YOffset returns the index of the first element of Y that corresponds to
// the pixel at (x, y).
func (p *YCbCr) YOffset(x, y int) int {
return (y-p.Rect.Min.Y)*p.YStride + (x - p.Rect.Min.X)
}
// COffset returns the index of the first element of Cb or Cr that corresponds
// to the pixel at (x, y).
func (p *YCbCr) COffset(x, y int) int {
switch p.SubsampleRatio {
case YCbCrSubsampleRatio422:
return (y-p.Rect.Min.Y)*p.CStride + (x/2 - p.Rect.Min.X/2)
case YCbCrSubsampleRatio420:
return (y/2-p.Rect.Min.Y/2)*p.CStride + (x/2 - p.Rect.Min.X/2)
case YCbCrSubsampleRatio440:
return (y/2-p.Rect.Min.Y/2)*p.CStride + (x - p.Rect.Min.X)
case YCbCrSubsampleRatio411:
return (y-p.Rect.Min.Y)*p.CStride + (x/4 - p.Rect.Min.X/4)
case YCbCrSubsampleRatio410:
return (y/2-p.Rect.Min.Y/2)*p.CStride + (x/4 - p.Rect.Min.X/4)
}
// Default to 4:4:4 subsampling.
return (y-p.Rect.Min.Y)*p.CStride + (x - p.Rect.Min.X)
}
// SubImage returns an image representing the portion of the image p visible
// through r. The returned value shares pixels with the original image.
func (p *YCbCr) SubImage(r Rectangle) Image {
r = r.Intersect(p.Rect)
// If r1 and r2 are Rectangles, r1.Intersect(r2) is not guaranteed to be inside
// either r1 or r2 if the intersection is empty. Without explicitly checking for
// this, the Pix[i:] expression below can panic.
if r.Empty() {
return &YCbCr{
SubsampleRatio: p.SubsampleRatio,
}
}
yi := p.YOffset(r.Min.X, r.Min.Y)
ci := p.COffset(r.Min.X, r.Min.Y)
return &YCbCr{
Y: p.Y[yi:],
Cb: p.Cb[ci:],
Cr: p.Cr[ci:],
SubsampleRatio: p.SubsampleRatio,
YStride: p.YStride,
CStride: p.CStride,
Rect: r,
}
}
func (p *YCbCr) Opaque() bool {
return true
}
func yCbCrSize(r Rectangle, subsampleRatio YCbCrSubsampleRatio) (w, h, cw, ch int) {
w, h = r.Dx(), r.Dy()
switch subsampleRatio {
case YCbCrSubsampleRatio422:
cw = (r.Max.X+1)/2 - r.Min.X/2
ch = h
case YCbCrSubsampleRatio420:
cw = (r.Max.X+1)/2 - r.Min.X/2
ch = (r.Max.Y+1)/2 - r.Min.Y/2
case YCbCrSubsampleRatio440:
cw = w
ch = (r.Max.Y+1)/2 - r.Min.Y/2
case YCbCrSubsampleRatio411:
cw = (r.Max.X+3)/4 - r.Min.X/4
ch = h
case YCbCrSubsampleRatio410:
cw = (r.Max.X+3)/4 - r.Min.X/4
ch = (r.Max.Y+1)/2 - r.Min.Y/2
default:
// Default to 4:4:4 subsampling.
cw = w
ch = h
}
return
}
// NewYCbCr returns a new YCbCr image with the given bounds and subsample
// ratio.
func NewYCbCr(r Rectangle, subsampleRatio YCbCrSubsampleRatio) *YCbCr {
w, h, cw, ch := yCbCrSize(r, subsampleRatio)
// totalLength should be the same as i2, below, for a valid Rectangle r.
totalLength := add2NonNeg(
mul3NonNeg(1, w, h),
mul3NonNeg(2, cw, ch),
)
if totalLength < 0 {
panic("image: NewYCbCr Rectangle has huge or negative dimensions")
}
i0 := w*h + 0*cw*ch
i1 := w*h + 1*cw*ch
i2 := w*h + 2*cw*ch
b := make([]byte, i2)
return &YCbCr{
Y: b[:i0:i0],
Cb: b[i0:i1:i1],
Cr: b[i1:i2:i2],
SubsampleRatio: subsampleRatio,
YStride: w,
CStride: cw,
Rect: r,
}
}
// NYCbCrA is an in-memory image of non-alpha-premultiplied Y'CbCr-with-alpha
// colors. A and AStride are analogous to the Y and YStride fields of the
// embedded YCbCr.
type NYCbCrA struct {
YCbCr
A []uint8
AStride int
}
func (p *NYCbCrA) ColorModel() color.Model {
return color.NYCbCrAModel
}
func (p *NYCbCrA) At(x, y int) color.Color {
return p.NYCbCrAAt(x, y)
}
func (p *NYCbCrA) NYCbCrAAt(x, y int) color.NYCbCrA {
if !(Point{X: x, Y: y}.In(p.Rect)) {
return color.NYCbCrA{}
}
yi := p.YOffset(x, y)
ci := p.COffset(x, y)
ai := p.AOffset(x, y)
return color.NYCbCrA{
color.YCbCr{
Y: p.Y[yi],
Cb: p.Cb[ci],
Cr: p.Cr[ci],
},
p.A[ai],
}
}
// AOffset returns the index of the first element of A that corresponds to the
// pixel at (x, y).
func (p *NYCbCrA) AOffset(x, y int) int {
return (y-p.Rect.Min.Y)*p.AStride + (x - p.Rect.Min.X)
}
// SubImage returns an image representing the portion of the image p visible
// through r. The returned value shares pixels with the original image.
func (p *NYCbCrA) SubImage(r Rectangle) Image {
r = r.Intersect(p.Rect)
// If r1 and r2 are Rectangles, r1.Intersect(r2) is not guaranteed to be inside
// either r1 or r2 if the intersection is empty. Without explicitly checking for
// this, the Pix[i:] expression below can panic.
if r.Empty() {
return &NYCbCrA{
YCbCr: YCbCr{
SubsampleRatio: p.SubsampleRatio,
},
}
}
yi := p.YOffset(r.Min.X, r.Min.Y)
ci := p.COffset(r.Min.X, r.Min.Y)
ai := p.AOffset(r.Min.X, r.Min.Y)
return &NYCbCrA{
YCbCr: YCbCr{
Y: p.Y[yi:],
Cb: p.Cb[ci:],
Cr: p.Cr[ci:],
SubsampleRatio: p.SubsampleRatio,
YStride: p.YStride,
CStride: p.CStride,
Rect: r,
},
A: p.A[ai:],
AStride: p.AStride,
}
}
// Opaque scans the entire image and reports whether it is fully opaque.
func (p *NYCbCrA) Opaque() bool {
if p.Rect.Empty() {
return true
}
i0, i1 := 0, p.Rect.Dx()
for y := p.Rect.Min.Y; y < p.Rect.Max.Y; y++ {
for _, a := range p.A[i0:i1] {
if a != 0xff {
return false
}
}
i0 += p.AStride
i1 += p.AStride
}
return true
}
// NewNYCbCrA returns a new NYCbCrA image with the given bounds and subsample
// ratio.
func NewNYCbCrA(r Rectangle, subsampleRatio YCbCrSubsampleRatio) *NYCbCrA {
w, h, cw, ch := yCbCrSize(r, subsampleRatio)
// totalLength should be the same as i3, below, for a valid Rectangle r.
totalLength := add2NonNeg(
mul3NonNeg(2, w, h),
mul3NonNeg(2, cw, ch),
)
if totalLength < 0 {
panic("image: NewNYCbCrA Rectangle has huge or negative dimension")
}
i0 := 1*w*h + 0*cw*ch
i1 := 1*w*h + 1*cw*ch
i2 := 1*w*h + 2*cw*ch
i3 := 2*w*h + 2*cw*ch
b := make([]byte, i3)
return &NYCbCrA{
YCbCr: YCbCr{
Y: b[:i0:i0],
Cb: b[i0:i1:i1],
Cr: b[i1:i2:i2],
SubsampleRatio: subsampleRatio,
YStride: w,
CStride: cw,
Rect: r,
},
A: b[i2:],
AStride: w,
}
} | src/image/ycbcr.go | 0.786295 | 0.415136 | ycbcr.go | starcoder |
// Copyright ©2015 The Gonum Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package cblas64
import "gonum.org/v1/gonum/blas"
// GeneralCols represents a matrix using the conventional column-major storage scheme.
type GeneralCols General
// From fills the receiver with elements from a. The receiver
// must have the same dimensions as a and have adequate backing
// data storage.
func (t GeneralCols) From(a General) {
if t.Rows != a.Rows || t.Cols != a.Cols {
panic("cblas64: mismatched dimension")
}
if len(t.Data) < (t.Cols-1)*t.Stride+t.Rows {
panic("cblas64: short data slice")
}
for i := 0; i < a.Rows; i++ {
for j, v := range a.Data[i*a.Stride : i*a.Stride+a.Cols] {
t.Data[i+j*t.Stride] = v
}
}
}
// From fills the receiver with elements from a. The receiver
// must have the same dimensions as a and have adequate backing
// data storage.
func (t General) From(a GeneralCols) {
if t.Rows != a.Rows || t.Cols != a.Cols {
panic("cblas64: mismatched dimension")
}
if len(t.Data) < (t.Rows-1)*t.Stride+t.Cols {
panic("cblas64: short data slice")
}
for j := 0; j < a.Cols; j++ {
for i, v := range a.Data[j*a.Stride : j*a.Stride+a.Rows] {
t.Data[i*t.Stride+j] = v
}
}
}
// TriangularCols represents a matrix using the conventional column-major storage scheme.
type TriangularCols Triangular
// From fills the receiver with elements from a. The receiver
// must have the same dimensions, uplo and diag as a and have
// adequate backing data storage.
func (t TriangularCols) From(a Triangular) {
if t.N != a.N {
panic("cblas64: mismatched dimension")
}
if t.Uplo != a.Uplo {
panic("cblas64: mismatched BLAS uplo")
}
if t.Diag != a.Diag {
panic("cblas64: mismatched BLAS diag")
}
switch a.Uplo {
default:
panic("cblas64: bad BLAS uplo")
case blas.Upper:
for i := 0; i < a.N; i++ {
for j := i; j < a.N; j++ {
t.Data[i+j*t.Stride] = a.Data[i*a.Stride+j]
}
}
case blas.Lower:
for i := 0; i < a.N; i++ {
for j := 0; j <= i; j++ {
t.Data[i+j*t.Stride] = a.Data[i*a.Stride+j]
}
}
case blas.All:
for i := 0; i < a.N; i++ {
for j := 0; j < a.N; j++ {
t.Data[i+j*t.Stride] = a.Data[i*a.Stride+j]
}
}
}
}
// From fills the receiver with elements from a. The receiver
// must have the same dimensions, uplo and diag as a and have
// adequate backing data storage.
func (t Triangular) From(a TriangularCols) {
if t.N != a.N {
panic("cblas64: mismatched dimension")
}
if t.Uplo != a.Uplo {
panic("cblas64: mismatched BLAS uplo")
}
if t.Diag != a.Diag {
panic("cblas64: mismatched BLAS diag")
}
switch a.Uplo {
default:
panic("cblas64: bad BLAS uplo")
case blas.Upper:
for i := 0; i < a.N; i++ {
for j := i; j < a.N; j++ {
t.Data[i*t.Stride+j] = a.Data[i+j*a.Stride]
}
}
case blas.Lower:
for i := 0; i < a.N; i++ {
for j := 0; j <= i; j++ {
t.Data[i*t.Stride+j] = a.Data[i+j*a.Stride]
}
}
case blas.All:
for i := 0; i < a.N; i++ {
for j := 0; j < a.N; j++ {
t.Data[i*t.Stride+j] = a.Data[i+j*a.Stride]
}
}
}
}
// BandCols represents a matrix using the band column-major storage scheme.
type BandCols Band
// From fills the receiver with elements from a. The receiver
// must have the same dimensions and bandwidth as a and have
// adequate backing data storage.
func (t BandCols) From(a Band) {
if t.Rows != a.Rows || t.Cols != a.Cols {
panic("cblas64: mismatched dimension")
}
if t.KL != a.KL || t.KU != a.KU {
panic("cblas64: mismatched bandwidth")
}
if a.Stride < a.KL+a.KU+1 {
panic("cblas64: short stride for source")
}
if t.Stride < t.KL+t.KU+1 {
panic("cblas64: short stride for destination")
}
for i := 0; i < a.Rows; i++ {
for j := max(0, i-a.KL); j < min(i+a.KU+1, a.Cols); j++ {
t.Data[i+t.KU-j+j*t.Stride] = a.Data[j+a.KL-i+i*a.Stride]
}
}
}
// From fills the receiver with elements from a. The receiver
// must have the same dimensions and bandwidth as a and have
// adequate backing data storage.
func (t Band) From(a BandCols) {
if t.Rows != a.Rows || t.Cols != a.Cols {
panic("cblas64: mismatched dimension")
}
if t.KL != a.KL || t.KU != a.KU {
panic("cblas64: mismatched bandwidth")
}
if a.Stride < a.KL+a.KU+1 {
panic("cblas64: short stride for source")
}
if t.Stride < t.KL+t.KU+1 {
panic("cblas64: short stride for destination")
}
for j := 0; j < a.Cols; j++ {
for i := max(0, j-a.KU); i < min(j+a.KL+1, a.Rows); i++ {
t.Data[j+a.KL-i+i*a.Stride] = a.Data[i+t.KU-j+j*t.Stride]
}
}
}
// TriangularBandCols represents a triangular matrix using the band column-major storage scheme.
type TriangularBandCols TriangularBand
// From fills the receiver with elements from a. The receiver
// must have the same dimensions, bandwidth and uplo as a and
// have adequate backing data storage.
func (t TriangularBandCols) From(a TriangularBand) {
if t.N != a.N {
panic("cblas64: mismatched dimension")
}
if t.K != a.K {
panic("cblas64: mismatched bandwidth")
}
if a.Stride < a.K+1 {
panic("cblas64: short stride for source")
}
if t.Stride < t.K+1 {
panic("cblas64: short stride for destination")
}
if t.Uplo != a.Uplo {
panic("cblas64: mismatched BLAS uplo")
}
if t.Diag != a.Diag {
panic("cblas64: mismatched BLAS diag")
}
dst := BandCols{
Rows: t.N, Cols: t.N,
Stride: t.Stride,
Data: t.Data,
}
src := Band{
Rows: a.N, Cols: a.N,
Stride: a.Stride,
Data: a.Data,
}
switch a.Uplo {
default:
panic("cblas64: bad BLAS uplo")
case blas.Upper:
dst.KU = t.K
src.KU = a.K
case blas.Lower:
dst.KL = t.K
src.KL = a.K
}
dst.From(src)
}
// From fills the receiver with elements from a. The receiver
// must have the same dimensions, bandwidth and uplo as a and
// have adequate backing data storage.
func (t TriangularBand) From(a TriangularBandCols) {
if t.N != a.N {
panic("cblas64: mismatched dimension")
}
if t.K != a.K {
panic("cblas64: mismatched bandwidth")
}
if a.Stride < a.K+1 {
panic("cblas64: short stride for source")
}
if t.Stride < t.K+1 {
panic("cblas64: short stride for destination")
}
if t.Uplo != a.Uplo {
panic("cblas64: mismatched BLAS uplo")
}
if t.Diag != a.Diag {
panic("cblas64: mismatched BLAS diag")
}
dst := Band{
Rows: t.N, Cols: t.N,
Stride: t.Stride,
Data: t.Data,
}
src := BandCols{
Rows: a.N, Cols: a.N,
Stride: a.Stride,
Data: a.Data,
}
switch a.Uplo {
default:
panic("cblas64: bad BLAS uplo")
case blas.Upper:
dst.KU = t.K
src.KU = a.K
case blas.Lower:
dst.KL = t.K
src.KL = a.K
}
dst.From(src)
}
func min(a, b int) int {
if a < b {
return a
}
return b
}
func max(a, b int) int {
if a > b {
return a
}
return b
} | blas/cblas64/conv.go | 0.844473 | 0.400808 | conv.go | starcoder |
package flowbits
import (
"unsafe"
)
// PutFloat32Big writes the given float32 to the bitstream in Big Endian format.
func (me *Bitstream) PutFloat32Big(value float32) error {
fp := *(*uint32)(unsafe.Pointer(&value))
return me.PutBitsUnsignedBig(uint64(fp), 32)
}
// PutFloat32Little writes the given float32 to the bitstream in Little Endian format.
func (me *Bitstream) PutFloat32Little(value float32) error {
fp := *(*uint32)(unsafe.Pointer(&value))
return me.PutBitsUnsignedLittle(uint64(fp), 32)
}
// GetFloat32Big reads a float32 value from the bitstream in Big Endian format and advances the bit read position.
func (me *Bitstream) GetFloat32Big() (float32, error) {
lbits, err := me.GetBitsUnsignedBig(32)
var nb uint32 = uint32(lbits)
fp := *(*float32)(unsafe.Pointer(&nb))
return fp, err
}
// GetFloat32Little reads a float32 value from the bitstream in Little Endian format and advances the bit read position.
func (me *Bitstream) GetFloat32Little() (float32, error) {
lbits, err := me.GetBitsUnsignedLittle(32)
bits := uint32(lbits)
return *(*float32)(unsafe.Pointer(&bits)), err
}
// NextFloat32Big reads a float32 value from the bitstream in Big Endian format, but does not advance the bit read position.
func (me *Bitstream) NextFloat32Big() (float32, error) {
lbits, err := me.NextBitsUnsignedBig(32)
var nb uint32 = uint32(lbits)
fp := *(*float32)(unsafe.Pointer(&nb))
return fp, err
}
// NextFloat32Little reads a float32 value from the bitstream in Little Endian format, but does not advance the bit read position.
func (me *Bitstream) NextFloat32Little() (float32, error) {
b, err := me.NextBitsUnsignedLittle(32)
bits := uint32(b)
return *(*float32)(unsafe.Pointer(&bits)), err
}
// PutFloat64Big writes the given float64 to the bitstream in Big Endian format.
func (me *Bitstream) PutFloat64Big(value float64) error {
fp := *(*uint64)(unsafe.Pointer(&value))
return me.PutBitsUnsignedBig(uint64(fp), 64)
}
// PutFloat64Little writes the given float64 to the bitstream in Little Endian format.
func (me *Bitstream) PutFloat64Little(value float64) error {
fp := *(*uint64)(unsafe.Pointer(&value))
return me.PutBitsUnsignedLittle(uint64(fp), 64)
}
// GetFloat64Big reads a float64 value from the bitstream in Big Endian format and advances the bit read position.
func (me *Bitstream) GetFloat64Big() (float64, error) {
nb, err := me.GetBitsUnsignedBig(64)
fp := *(*float64)(unsafe.Pointer(&nb))
return fp, err
}
// GetFloat64Little reads a float64 value from the bitstream in Little Endian format and advances the bit read position.
func (me *Bitstream) GetFloat64Little() (float64, error) {
nb, err := me.GetBitsUnsignedLittle(64)
fp := *(*float64)(unsafe.Pointer(&nb))
return fp, err
}
// NextFloat64Big reads a float64 value from the bitstream in Big Endian format, but does not advance the bit read position.
func (me *Bitstream) NextFloat64Big() (float64, error) {
nb, err := me.NextBitsUnsignedBig(64)
fp := *(*float64)(unsafe.Pointer(&nb))
return fp, err
}
// NextFloat64Little reads a float64 value from the bitstream in Little Endian format, but does not advance the bit read position.
func (me *Bitstream) NextFloat64Little() (float64, error) {
b, err := me.NextBitsUnsignedLittle(64)
bits := uint64(b)
fp := *(*float64)(unsafe.Pointer(&bits))
return fp, err
} | float.go | 0.748536 | 0.413892 | float.go | starcoder |
package main
import (
"encoding/json"
"fmt"
"sort"
"strconv"
"time"
"github.com/google/gapid/core/app/benchmark"
)
// Sample is a time.Duration with more readable JSON serialization.
type Sample time.Duration
// Multisample represents a collection of AnnotatedSamples gathered through
// multiple runs of a
type Multisample []Sample
// KeyedSamples maps atom indices to Multisamples.
type KeyedSamples map[string]*Multisample
// IndexedMultisample is a Multisample together with an atom index.
type IndexedMultisample struct {
Index int64
Values *Multisample
}
// IndexedMultisamples is a slice of IndexedMultisample, sortable by
// index and usable for plotting or complexity analysis.
type IndexedMultisamples []IndexedMultisample
// Analyse analyses the samples and returns the algorithmic cost.
func (s IndexedMultisamples) Analyse(accessor func(IndexedMultisample) (int, time.Duration)) benchmark.Fit {
samples := benchmark.Samples{}
for _, m := range s {
samples.AddOrUpdate(accessor(m))
}
return samples.Analyse()
}
// NewKeyedSamples instantiates a new KeyedSamples.
func NewKeyedSamples() KeyedSamples {
return make(map[string]*Multisample)
}
// Add records a new duration associated with the given index.
func (m KeyedSamples) Add(index int64, t time.Duration) {
key := fmt.Sprintf("%010d", index) // Easiest way to have samples show up in sorted order in the json.
ms, found := m[key]
if !found {
ms = new(Multisample)
m[key] = ms
}
ms.Add(t)
}
// IndexedMultisamples returns a sortable array of indexed multisamples.
func (m KeyedSamples) IndexedMultisamples() IndexedMultisamples {
result := make(IndexedMultisamples, len(m))
i := 0
for key, values := range m {
index, _ := strconv.ParseInt(key, 10, 64)
result[i] = IndexedMultisample{Index: index, Values: values}
i++
}
sort.Sort(result)
return result
}
func (s IndexedMultisamples) Len() int { return len(s) }
func (s IndexedMultisamples) Less(i, j int) bool {
return s[i].Index < s[j].Index
}
func (s IndexedMultisamples) Swap(i, j int) { s[i], s[j] = s[j], s[i] }
func (a *Sample) Set(t time.Duration) {
*a = Sample(t)
}
func (a Sample) Duration() time.Duration {
return time.Duration(a)
}
func (a *Sample) UnmarshalJSON(b []byte) error {
var durationString string
if err := json.Unmarshal(b, &durationString); err != nil {
return err
}
duration, err := time.ParseDuration(durationString)
if err != nil {
return err
}
a.Set(duration)
return nil
}
func (a Sample) MarshalJSON() ([]byte, error) {
return json.Marshal(a.Duration().String())
}
func (s *Multisample) AddWithData(t time.Duration, data string) {
*s = append(*s, Sample(t))
}
func (s *Multisample) Len() int {
return len(*s)
}
func (s *Multisample) Clear() {
*s = make([]Sample, 0)
}
func (s *Multisample) Add(t time.Duration) {
*s = append(*s, Sample(t))
}
func (s *Multisample) Average() time.Duration {
sum := int64(0)
for _, value := range *s {
sum += int64(value.Duration())
}
return time.Duration(sum / int64(len(*s)))
}
func (s *Multisample) Min() time.Duration {
min := time.Duration(1<<63 - 1)
for _, value := range *s {
if value.Duration() < min {
min = value.Duration()
}
}
return min
}
func (s *Multisample) Max() time.Duration {
max := time.Duration(-1 << 63)
for _, value := range *s {
if value.Duration() > max {
max = value.Duration()
}
}
return max
}
func (s *Multisample) Median() time.Duration {
arr := make([]int64, len(*s))
for i := range arr {
arr[i] = int64((*s)[i].Duration())
}
sort.Sort(int64Slice(arr))
if len(arr)%2 != 0 {
return time.Duration(arr[len(arr)/2])
} else {
return time.Duration((arr[len(arr)/2-1] + arr[len(arr)/2]) / 2)
}
}
type int64Slice []int64
func (p int64Slice) Len() int { return len(p) }
func (p int64Slice) Less(i, j int) bool { return p[i] < p[j] }
func (p int64Slice) Swap(i, j int) { p[i], p[j] = p[j], p[i] } | cmd/perf/samples.go | 0.756987 | 0.420243 | samples.go | starcoder |
package segmenttree
import (
"github.com/TheAlgorithms/Go/math/max"
"github.com/TheAlgorithms/Go/math/min"
)
const emptyLazyNode = -1
//SegmentTree with original Array and the Segment Tree Array
type SegmentTree struct {
Array []int
SegmentTree []int
LazyTree []int
}
//Propagate lazy tree node values
func (s *SegmentTree) Propagate(node int, leftNode int, rightNode int) {
if s.LazyTree[node] != emptyLazyNode {
//add lazy node value multiplied by (right-left+1), which represents all interval
//this is the same of adding a value on each node
s.SegmentTree[node] += (rightNode - leftNode + 1) * s.LazyTree[node]
if leftNode == rightNode {
//leaf node
s.Array[leftNode] = s.LazyTree[node]
} else {
//propagate lazy node value for children nodes
s.LazyTree[2*node] = s.LazyTree[node]
s.LazyTree[2*node+1] = s.LazyTree[node]
}
//clear lazy node
s.LazyTree[node] = emptyLazyNode
}
}
//Query on interval [firstIndex, leftIndex]
//node, leftNode and rightNode always should start with 1, 0 and len(Array)-1
func (s *SegmentTree) Query(node int, leftNode int, rightNode int, firstIndex int, lastIndex int) int {
if (firstIndex > lastIndex) || (leftNode > rightNode) {
//outside the interval
return 0
}
//propagate lazy tree
s.Propagate(node, leftNode, rightNode)
if (leftNode >= firstIndex) && (rightNode <= lastIndex) {
//inside the interval
return s.SegmentTree[node]
}
//get sum of left and right nodes
mid := (leftNode + rightNode) / 2
leftNodeSum := s.Query(2*node, leftNode, mid, firstIndex, min.Int(mid, lastIndex))
rightNodeSum := s.Query(2*node+1, mid+1, rightNode, max.Int(firstIndex, mid+1), lastIndex)
return leftNodeSum + rightNodeSum
}
//Update Segment Tree
//node, leftNode and rightNode always should start with 1, 0 and len(Array)-1
//index is the Array index that you want to update
//value is the value that you want to override
func (s *SegmentTree) Update(node int, leftNode int, rightNode int, firstIndex int, lastIndex int, value int) {
//propagate lazy tree
s.Propagate(node, leftNode, rightNode)
if (firstIndex > lastIndex) || (leftNode > rightNode) {
//outside the interval
return
}
if (leftNode >= firstIndex) && (rightNode <= lastIndex) {
//inside the interval
s.LazyTree[node] = value
s.Propagate(node, leftNode, rightNode)
} else {
//update left and right nodes
mid := (leftNode + rightNode) / 2
s.Update(2*node, leftNode, mid, firstIndex, min.Int(mid, lastIndex), value)
s.Update(2*node+1, mid+1, rightNode, max.Int(firstIndex, mid+1), lastIndex, value)
s.SegmentTree[node] = s.SegmentTree[2*node] + s.SegmentTree[2*node+1]
}
}
//Build Segment Tree
//node, leftNode and rightNode always should start with 1, 0 and len(Array)-1
func (s *SegmentTree) Build(node int, left int, right int) {
if left == right {
//leaf node
s.SegmentTree[node] = s.Array[left]
} else {
//get sum of left and right nodes
mid := (left + right) / 2
s.Build(2*node, left, mid)
s.Build(2*node+1, mid+1, right)
s.SegmentTree[node] = s.SegmentTree[2*node] + s.SegmentTree[2*node+1]
}
}
func NewSegmentTree(Array []int) *SegmentTree {
if len(Array) == 0 {
return nil
}
segTree := SegmentTree{
Array: Array,
SegmentTree: make([]int, 4*len(Array)),
LazyTree: make([]int, 4*len(Array)),
}
for i := range segTree.LazyTree {
//fill LazyTree with empty lazy nodes
segTree.LazyTree[i] = emptyLazyNode
}
//starts with node 1 and interval [0, len(arr)-1] inclusive
segTree.Build(1, 0, len(Array)-1)
return &segTree
} | structure/segmenttree/segmenttree.go | 0.723114 | 0.647756 | segmenttree.go | starcoder |
package processor
import (
"fmt"
"strconv"
"time"
"github.com/Jeffail/benthos/v3/internal/bloblang/field"
"github.com/Jeffail/benthos/v3/internal/docs"
bredis "github.com/Jeffail/benthos/v3/internal/impl/redis"
"github.com/Jeffail/benthos/v3/internal/interop"
"github.com/Jeffail/benthos/v3/lib/log"
"github.com/Jeffail/benthos/v3/lib/metrics"
"github.com/Jeffail/benthos/v3/lib/types"
"github.com/go-redis/redis/v7"
"github.com/opentracing/opentracing-go"
)
//------------------------------------------------------------------------------
func init() {
Constructors[TypeRedis] = TypeSpec{
constructor: NewRedis,
Categories: []Category{
CategoryIntegration,
},
Summary: `
Performs actions against Redis that aren't possible using a
` + "[`cache`](/docs/components/processors/cache)" + ` processor. Actions are
performed for each message of a batch, where the contents are replaced with the
result.`,
Description: `
## Operators
### ` + "`keys`" + `
Returns an array of strings containing all the keys that match the pattern specified by the ` + "`key` field" + `.
### ` + "`scard`" + `
Returns the cardinality of a set, or ` + "`0`" + ` if the key does not exist.
### ` + "`sadd`" + `
Adds a new member to a set. Returns ` + "`1`" + ` if the member was added.
### ` + "`incrby`" + `
Increments the number stored at ` + "`key`" + ` by the message content. If the
key does not exist, it is set to ` + "`0`" + ` before performing the operation.
Returns the value of ` + "`key`" + ` after the increment.`,
FieldSpecs: bredis.ConfigDocs().Add(
docs.FieldCommon("operator", "The [operator](#operators) to apply.").HasOptions("scard", "sadd", "incrby", "keys"),
docs.FieldCommon("key", "A key to use for the target operator.").IsInterpolated(),
docs.FieldAdvanced("retries", "The maximum number of retries before abandoning a request."),
docs.FieldAdvanced("retry_period", "The time to wait before consecutive retry attempts."),
PartsFieldSpec,
),
Examples: []docs.AnnotatedExample{
{
Title: "Querying Cardinality",
Summary: `
If given payloads containing a metadata field ` + "`set_key`" + ` it's possible
to query and store the cardinality of the set for each message using a
` + "[`branch` processor](/docs/components/processors/branch)" + ` in order to
augment rather than replace the message contents:`,
Config: `
pipeline:
processors:
- branch:
processors:
- redis:
url: TODO
operator: scard
key: ${! meta("set_key") }
result_map: 'root.cardinality = this'
`,
},
{
Title: "Running Total",
Summary: `
If we have JSON data containing number of friends visited during covid 19:
` + "```json" + `
{"name":"ash","month":"feb","year":2019,"friends_visited":10}
{"name":"ash","month":"apr","year":2019,"friends_visited":-2}
{"name":"bob","month":"feb","year":2019,"friends_visited":3}
{"name":"bob","month":"apr","year":2019,"friends_visited":1}
` + "```" + `
We can add a field that contains the running total number of friends visited:
` + "```json" + `
{"name":"ash","month":"feb","year":2019,"friends_visited":10,"total":10}
{"name":"ash","month":"apr","year":2019,"friends_visited":-2,"total":8}
{"name":"bob","month":"feb","year":2019,"friends_visited":3,"total":3}
{"name":"bob","month":"apr","year":2019,"friends_visited":1,"total":4}
` + "```" + `
Using the ` + "`incrby`" + ` operator:
`,
Config: `
pipeline:
processors:
- branch:
request_map: |
root = this.friends_visited
meta name = this.name
processors:
- redis:
url: TODO
operator: incrby
key: ${! meta("name") }
result_map: 'root.total = this'
`,
},
},
}
}
//------------------------------------------------------------------------------
// RedisConfig contains configuration fields for the Redis processor.
type RedisConfig struct {
bredis.Config `json:",inline" yaml:",inline"`
Parts []int `json:"parts" yaml:"parts"`
Operator string `json:"operator" yaml:"operator"`
Key string `json:"key" yaml:"key"`
Retries int `json:"retries" yaml:"retries"`
RetryPeriod string `json:"retry_period" yaml:"retry_period"`
}
// NewRedisConfig returns a RedisConfig with default values.
func NewRedisConfig() RedisConfig {
return RedisConfig{
Config: bredis.NewConfig(),
Parts: []int{},
Operator: "scard",
Key: "",
Retries: 3,
RetryPeriod: "500ms",
}
}
//------------------------------------------------------------------------------
// Redis is a processor that performs redis operations
type Redis struct {
parts []int
conf Config
log log.Modular
stats metrics.Type
key *field.Expression
operator redisOperator
client redis.UniversalClient
retryPeriod time.Duration
mCount metrics.StatCounter
mErr metrics.StatCounter
mSent metrics.StatCounter
mBatchSent metrics.StatCounter
mRedisRetry metrics.StatCounter
}
// NewRedis returns a Redis processor.
func NewRedis(
conf Config, mgr types.Manager, log log.Modular, stats metrics.Type,
) (Type, error) {
var retryPeriod time.Duration
if tout := conf.Redis.RetryPeriod; len(tout) > 0 {
var err error
if retryPeriod, err = time.ParseDuration(tout); err != nil {
return nil, fmt.Errorf("failed to parse retry period string: %v", err)
}
}
client, err := conf.Redis.Config.Client()
if err != nil {
return nil, err
}
key, err := interop.NewBloblangField(mgr, conf.Redis.Key)
if err != nil {
return nil, fmt.Errorf("failed to parse key expression: %v", err)
}
r := &Redis{
parts: conf.Redis.Parts,
conf: conf,
log: log,
stats: stats,
key: key,
retryPeriod: retryPeriod,
client: client,
mCount: stats.GetCounter("count"),
mErr: stats.GetCounter("error"),
mSent: stats.GetCounter("sent"),
mBatchSent: stats.GetCounter("batch.sent"),
mRedisRetry: stats.GetCounter("redis.retry"),
}
if r.operator, err = getRedisOperator(conf.Redis.Operator); err != nil {
return nil, err
}
return r, nil
}
//------------------------------------------------------------------------------
type redisOperator func(r *Redis, key string, part types.Part) error
func newRedisKeysOperator() redisOperator {
return func(r *Redis, key string, part types.Part) error {
res, err := r.client.Keys(key).Result()
for i := 0; i <= r.conf.Redis.Retries && err != nil; i++ {
r.log.Errorf("Keys command failed: %v\n", err)
<-time.After(r.retryPeriod)
r.mRedisRetry.Incr(1)
res, err = r.client.Keys(key).Result()
}
if err != nil {
return err
}
iRes := make([]interface{}, 0, len(res))
for _, v := range res {
iRes = append(iRes, v)
}
return part.SetJSON(iRes)
}
}
func newRedisSCardOperator() redisOperator {
return func(r *Redis, key string, part types.Part) error {
res, err := r.client.SCard(key).Result()
for i := 0; i <= r.conf.Redis.Retries && err != nil; i++ {
r.log.Errorf("SCard command failed: %v\n", err)
<-time.After(r.retryPeriod)
r.mRedisRetry.Incr(1)
res, err = r.client.SCard(key).Result()
}
if err != nil {
return err
}
part.Set(strconv.AppendInt(nil, res, 10))
return nil
}
}
func newRedisSAddOperator() redisOperator {
return func(r *Redis, key string, part types.Part) error {
res, err := r.client.SAdd(key, part.Get()).Result()
for i := 0; i <= r.conf.Redis.Retries && err != nil; i++ {
r.log.Errorf("SAdd command failed: %v\n", err)
<-time.After(r.retryPeriod)
r.mRedisRetry.Incr(1)
res, err = r.client.SAdd(key, part.Get()).Result()
}
if err != nil {
return err
}
part.Set(strconv.AppendInt(nil, res, 10))
return nil
}
}
func newRedisIncrByOperator() redisOperator {
return func(r *Redis, key string, part types.Part) error {
valueInt, err := strconv.Atoi(string(part.Get()))
if err != nil {
return err
}
res, err := r.client.IncrBy(key, int64(valueInt)).Result()
for i := 0; i <= r.conf.Redis.Retries && err != nil; i++ {
r.log.Errorf("incrby command failed: %v\n", err)
<-time.After(r.retryPeriod)
r.mRedisRetry.Incr(1)
res, err = r.client.IncrBy(key, int64(valueInt)).Result()
}
if err != nil {
return err
}
part.Set(strconv.AppendInt(nil, res, 10))
return nil
}
}
func getRedisOperator(opStr string) (redisOperator, error) {
switch opStr {
case "keys":
return newRedisKeysOperator(), nil
case "sadd":
return newRedisSAddOperator(), nil
case "scard":
return newRedisSCardOperator(), nil
case "incrby":
return newRedisIncrByOperator(), nil
}
return nil, fmt.Errorf("operator not recognised: %v", opStr)
}
// ProcessMessage applies the processor to a message, either creating >0
// resulting messages or a response to be sent back to the message source.
func (r *Redis) ProcessMessage(msg types.Message) ([]types.Message, types.Response) {
r.mCount.Incr(1)
newMsg := msg.Copy()
proc := func(index int, span opentracing.Span, part types.Part) error {
key := r.key.String(index, newMsg)
if err := r.operator(r, key, part); err != nil {
r.mErr.Incr(1)
r.log.Debugf("Operator failed for key '%s': %v\n", key, err)
return err
}
return nil
}
IteratePartsWithSpan(TypeRedis, r.parts, newMsg, proc)
r.mBatchSent.Incr(1)
r.mSent.Incr(int64(newMsg.Len()))
return []types.Message{newMsg}, nil
}
// CloseAsync shuts down the processor and stops processing requests.
func (r *Redis) CloseAsync() {
}
// WaitForClose blocks until the processor has closed down.
func (r *Redis) WaitForClose(timeout time.Duration) error {
r.client.Close()
return nil
}
//------------------------------------------------------------------------------ | lib/processor/redis.go | 0.768038 | 0.644141 | redis.go | starcoder |
package scomplex
import (
"image"
"math"
)
import (
. "github.com/Causticity/sipp/simage"
)
// A ComplexImage is an image where each pixel is a Go complex128.
type ComplexImage struct {
// The "pixel" data.
Pix []complex128
// The rectangle defining the bounds of the image.
Rect image.Rectangle
// The maximum modulus value that occurs in this image. This is useful
// when computing a histogram of the modulus value.
MaxMod float64
// Extreme values found in this image
MinRe, MaxRe, MinIm, MaxIm float64
}
// FromComplexArray wraps an array of complex numbers in a ComplexImage.
func FromComplexArray(cpx []complex128, width int) (dst *ComplexImage) {
dst = new(ComplexImage)
dst.Pix = cpx
dst.Rect = image.Rect(0, 0, width, len(cpx)/width)
dst.MinRe = math.MaxFloat64
dst.MinIm = math.MaxFloat64
dst.MaxRe = -math.MaxFloat64
dst.MaxIm = -math.MaxFloat64
dst.MaxMod = 0.0
for _, c := range cpx {
re := real(c)
im := imag(c)
modsq := re*re + im*im
// store the maximum squared value, then take the root afterwards
if modsq > dst.MaxMod {
dst.MaxMod = modsq
}
if re < dst.MinRe {
dst.MinRe = re
}
if re > dst.MaxRe {
dst.MaxRe = re
}
if im < dst.MinIm {
dst.MinIm = im
}
if im > dst.MaxIm {
dst.MaxIm = im
}
}
dst.MaxMod = math.Sqrt(dst.MaxMod)
return
}
// ToShiftedComplex converts the input image into a ComplexImage, multiplying
// each pixel by (-1)^(x+y), in order for a subsequent FFT to be centred
// properly.
func ToShiftedComplex(src SippImage) (dst *ComplexImage) {
dst = new(ComplexImage)
dst.Rect = src.Bounds()
dst.MinRe = math.MaxFloat64
dst.MinIm = 0
dst.MaxRe = -math.MaxFloat64
dst.MaxIm = 0
dst.MaxMod = 0.0
width := dst.Rect.Dx()
height := dst.Rect.Dy()
size := width * height
dst.Pix = make([]complex128, size)
// Multiply by (-1)^(x+y) while converting the pixels to complex numbers
shiftStart := 1.0
shift := shiftStart
i := 0
for y := 0; y < height; y++ {
for x := 0; x < width; x++ {
val := src.Val(x, y) * shift
dst.Pix[i] = complex(val, 0)
i++
shift = -shift
modsq := val*val
if modsq > dst.MaxMod {
dst.MaxMod = modsq
}
if val < dst.MinRe {
dst.MinRe = val
}
if val > dst.MaxRe {
dst.MaxRe = val
}
}
shiftStart = -shiftStart
shift = shiftStart
}
dst.MaxMod = math.Sqrt(dst.MaxMod)
return
}
// Render renders the real and imaginary parts of the image as separate 8-bit
// grayscale images.
func (comp *ComplexImage) Render() (SippImage, SippImage) {
// compute scale and offset for each image
rdiv := comp.MaxRe - comp.MinRe
if rdiv < 1.0 {
rdiv = 1.0
}
idiv := comp.MaxIm - comp.MinIm
if idiv < 1.0 {
idiv = 1.0
}
rscale := 255.0 / rdiv
iscale := 255.0 / idiv
re := new(SippGray)
re.Gray = image.NewGray(comp.Rect)
im := new(SippGray)
im.Gray = image.NewGray(comp.Rect)
// scan the complex image, generating the two renderings
rePix := re.Pix()
imPix := im.Pix()
for index, pix := range comp.Pix {
r := real(pix)
i := imag(pix)
rePix[index] = uint8((r - comp.MinRe) * rscale)
imPix[index] = uint8((i - comp.MinIm) * iscale)
}
return re, im
} | scomplex/complex_image.go | 0.741206 | 0.460592 | complex_image.go | starcoder |
package bqsort
import (
"math"
"reflect"
)
// Interface implementations can be sorted by the routines in this package.
// The methods refer to elements of the underlying collection by integer index.
type Interface interface {
// Len is the number of elements in the collection.
Len() int
// Key returns sort-key value of the element with index i.
// The smaller key elements come before larger keys.
Key(i int) uint64
// Swap swaps the elements with indexes i and j.
Swap(i, j int)
}
type reverse struct{ Interface }
func (r reverse) Key(i int) uint64 {
return ^r.Interface.Key(i)
}
// Reverse returns the reverse order for data.
func Reverse(data Interface) Interface {
if r, ok := data.(reverse); ok {
return r.Interface
}
return reverse{data}
}
type keySwapper interface {
Key(i int) uint64
Swap(i, j int)
}
type keySwap struct {
key func(i int) uint64
swap func(i, j int)
}
func (ks keySwap) Key(i int) uint64 { return ks.key(i) }
func (ks keySwap) Swap(i, j int) { ks.swap(i, j) }
// msb returns most significant bit (MSB).
func msb(val uint64) uint64 {
bit := uint64((math.MaxUint64 + 1) >> 1)
for val < bit {
bit >>= 1
}
return bit
}
func sort(data keySwapper, a, b int, bit uint64) {
ma := a
mb := b
for ma < mb {
for ma < mb && data.Key(ma)&bit == 0 {
ma++
}
mb--
for ma < mb && data.Key(mb)&bit != 0 {
mb--
}
if ma < mb {
data.Swap(ma, mb)
ma++
}
}
bit >>= 1
if bit == 0 {
return
}
if a < ma-1 {
sort(data, a, ma, bit)
}
if ma < b-1 {
sort(data, ma, b, bit)
}
}
// Sort sorts data.
// The data.Key() must be less than or equal to maxkey.
// The worst-case performance is O(n*k), where n is the data.Len() and k is the number of bits in the maxkey.
func Sort(data Interface, maxkey uint64) {
sort(data, 0, data.Len(), msb(maxkey))
}
// Slice sorts a slice.
// The key(i) returns the sort key of the slice[i] which must be less than or equal to maxkey.
// The cost is O(n*k), where n is the len(slice) and k is the number of bits in the maxkey.
func Slice(slice interface{}, maxkey uint64, key func(i int) uint64) {
len := reflect.ValueOf(slice).Len()
swap := reflect.Swapper(slice)
sort(keySwap{key, swap}, 0, len, msb(maxkey))
}
// Int8Slice implements Interface for []int8.
type Int8Slice []int8
func (x Int8Slice) Len() int { return len(x) }
func (x Int8Slice) Key(i int) uint64 { return uint64(x[i]) + (-math.MinInt8) }
func (x Int8Slice) Swap(i, j int) { x[i], x[j] = x[j], x[i] }
// Int8s sorts []int8.
// The worst-case performance is O(n*8).
func Int8s(x []int8) {
Sort(Int8Slice(x), msb(math.MaxInt8+(-math.MinInt8)))
}
// Uint8Slice implements Interface for []uint8.
type Uint8Slice []uint8
func (x Uint8Slice) Len() int { return len(x) }
func (x Uint8Slice) Key(i int) uint64 { return uint64(x[i]) }
func (x Uint8Slice) Swap(i, j int) { x[i], x[j] = x[j], x[i] }
// Uint8s sorts []uint8.
// The worst-case performance is O(n*8).
func Uint8s(x []uint8) {
Sort(Uint8Slice(x), msb(math.MaxUint8))
}
// Int16Slice implements Interface for []int16.
type Int16Slice []int16
func (x Int16Slice) Len() int { return len(x) }
func (x Int16Slice) Key(i int) uint64 { return uint64(x[i]) + (-math.MinInt16) }
func (x Int16Slice) Swap(i, j int) { x[i], x[j] = x[j], x[i] }
// Int16s sorts []int16.
// The worst-case performance is O(n*16).
func Int16s(x []int16) {
Sort(Int16Slice(x), msb(math.MaxInt16+(-math.MinInt16)))
}
// Uint16Slice implements Interface for []uint16.
type Uint16Slice []uint16
func (x Uint16Slice) Len() int { return len(x) }
func (x Uint16Slice) Key(i int) uint64 { return uint64(x[i]) }
func (x Uint16Slice) Swap(i, j int) { x[i], x[j] = x[j], x[i] }
// Uint16s sorts []uint16.
// The worst-case performance is O(n*16).
func Uint16s(x []uint16) {
Sort(Uint16Slice(x), msb(math.MaxUint16))
}
// Int32Slice implements Interface for []int32.
type Int32Slice []int32
func (x Int32Slice) Len() int { return len(x) }
func (x Int32Slice) Key(i int) uint64 { return uint64(x[i]) + (-math.MinInt32) }
func (x Int32Slice) Swap(i, j int) { x[i], x[j] = x[j], x[i] }
// Int32s sorts []int32.
// The worst-case performance is O(n*32).
func Int32s(x []int32) {
Sort(Int32Slice(x), msb(math.MaxInt32+(-math.MinInt32)))
}
// Uint32Slice implements Interface for []uint32.
type Uint32Slice []uint32
func (x Uint32Slice) Len() int { return len(x) }
func (x Uint32Slice) Key(i int) uint64 { return uint64(x[i]) }
func (x Uint32Slice) Swap(i, j int) { x[i], x[j] = x[j], x[i] }
// Uint32s sorts []uint32.
// The worst-case performance is O(n*32).
func Uint32s(x []uint32) {
Sort(Uint32Slice(x), msb(math.MaxUint32))
}
// Float32Slice implements Interface for []float32.
type Float32Slice []float32
func (x Float32Slice) Len() int { return len(x) }
func (x Float32Slice) Key(i int) uint64 {
v := math.Float32bits(x[i])
// NaN will be placed before -Inf.
if (v&0x7f800000) == 0x7f800000 && (v&0x007fffff) != 0 {
return 0
}
// invert the sign-bit to place the positive values after the negative values.
// the other bits in the positive value are already in order.
// invert other bits in the negative value to reverse the order.
if v&(1<<31) == 0 {
// positive value: invert the sign-bit
v ^= 1 << 31
} else {
// negative value: invert the sign-bit and other bits (all bits)
v = ^v
}
return uint64(v)
}
func (x Float32Slice) Swap(i, j int) { x[i], x[j] = x[j], x[i] }
// Float32s sorts []float32.
// The worst-case performance is O(n*32).
func Float32s(x []float32) {
Sort(Float32Slice(x), 1<<31)
} | bqsort.go | 0.732592 | 0.420778 | bqsort.go | starcoder |
package datadog
import (
"encoding/json"
"time"
)
// GetCreator returns the Creator field if non-nil, zero value otherwise.
func (a *Alert) GetCreator() int {
if a == nil || a.Creator == nil {
return 0
}
return *a.Creator
}
// GetCreatorOk returns a tuple with the Creator field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (a *Alert) GetCreatorOk() (int, bool) {
if a == nil || a.Creator == nil {
return 0, false
}
return *a.Creator, true
}
// HasCreator returns a boolean if a field has been set.
func (a *Alert) HasCreator() bool {
if a != nil && a.Creator != nil {
return true
}
return false
}
// SetCreator allocates a new a.Creator and returns the pointer to it.
func (a *Alert) SetCreator(v int) {
a.Creator = &v
}
// GetId returns the Id field if non-nil, zero value otherwise.
func (a *Alert) GetId() int {
if a == nil || a.Id == nil {
return 0
}
return *a.Id
}
// GetIdOk returns a tuple with the Id field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (a *Alert) GetIdOk() (int, bool) {
if a == nil || a.Id == nil {
return 0, false
}
return *a.Id, true
}
// HasId returns a boolean if a field has been set.
func (a *Alert) HasId() bool {
if a != nil && a.Id != nil {
return true
}
return false
}
// SetId allocates a new a.Id and returns the pointer to it.
func (a *Alert) SetId(v int) {
a.Id = &v
}
// GetMessage returns the Message field if non-nil, zero value otherwise.
func (a *Alert) GetMessage() string {
if a == nil || a.Message == nil {
return ""
}
return *a.Message
}
// GetMessageOk returns a tuple with the Message field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (a *Alert) GetMessageOk() (string, bool) {
if a == nil || a.Message == nil {
return "", false
}
return *a.Message, true
}
// HasMessage returns a boolean if a field has been set.
func (a *Alert) HasMessage() bool {
if a != nil && a.Message != nil {
return true
}
return false
}
// SetMessage allocates a new a.Message and returns the pointer to it.
func (a *Alert) SetMessage(v string) {
a.Message = &v
}
// GetName returns the Name field if non-nil, zero value otherwise.
func (a *Alert) GetName() string {
if a == nil || a.Name == nil {
return ""
}
return *a.Name
}
// GetNameOk returns a tuple with the Name field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (a *Alert) GetNameOk() (string, bool) {
if a == nil || a.Name == nil {
return "", false
}
return *a.Name, true
}
// HasName returns a boolean if a field has been set.
func (a *Alert) HasName() bool {
if a != nil && a.Name != nil {
return true
}
return false
}
// SetName allocates a new a.Name and returns the pointer to it.
func (a *Alert) SetName(v string) {
a.Name = &v
}
// GetNotifyNoData returns the NotifyNoData field if non-nil, zero value otherwise.
func (a *Alert) GetNotifyNoData() bool {
if a == nil || a.NotifyNoData == nil {
return false
}
return *a.NotifyNoData
}
// GetNotifyNoDataOk returns a tuple with the NotifyNoData field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (a *Alert) GetNotifyNoDataOk() (bool, bool) {
if a == nil || a.NotifyNoData == nil {
return false, false
}
return *a.NotifyNoData, true
}
// HasNotifyNoData returns a boolean if a field has been set.
func (a *Alert) HasNotifyNoData() bool {
if a != nil && a.NotifyNoData != nil {
return true
}
return false
}
// SetNotifyNoData allocates a new a.NotifyNoData and returns the pointer to it.
func (a *Alert) SetNotifyNoData(v bool) {
a.NotifyNoData = &v
}
// GetQuery returns the Query field if non-nil, zero value otherwise.
func (a *Alert) GetQuery() string {
if a == nil || a.Query == nil {
return ""
}
return *a.Query
}
// GetQueryOk returns a tuple with the Query field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (a *Alert) GetQueryOk() (string, bool) {
if a == nil || a.Query == nil {
return "", false
}
return *a.Query, true
}
// HasQuery returns a boolean if a field has been set.
func (a *Alert) HasQuery() bool {
if a != nil && a.Query != nil {
return true
}
return false
}
// SetQuery allocates a new a.Query and returns the pointer to it.
func (a *Alert) SetQuery(v string) {
a.Query = &v
}
// GetSilenced returns the Silenced field if non-nil, zero value otherwise.
func (a *Alert) GetSilenced() bool {
if a == nil || a.Silenced == nil {
return false
}
return *a.Silenced
}
// GetSilencedOk returns a tuple with the Silenced field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (a *Alert) GetSilencedOk() (bool, bool) {
if a == nil || a.Silenced == nil {
return false, false
}
return *a.Silenced, true
}
// HasSilenced returns a boolean if a field has been set.
func (a *Alert) HasSilenced() bool {
if a != nil && a.Silenced != nil {
return true
}
return false
}
// SetSilenced allocates a new a.Silenced and returns the pointer to it.
func (a *Alert) SetSilenced(v bool) {
a.Silenced = &v
}
// GetState returns the State field if non-nil, zero value otherwise.
func (a *Alert) GetState() string {
if a == nil || a.State == nil {
return ""
}
return *a.State
}
// GetStateOk returns a tuple with the State field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (a *Alert) GetStateOk() (string, bool) {
if a == nil || a.State == nil {
return "", false
}
return *a.State, true
}
// HasState returns a boolean if a field has been set.
func (a *Alert) HasState() bool {
if a != nil && a.State != nil {
return true
}
return false
}
// SetState allocates a new a.State and returns the pointer to it.
func (a *Alert) SetState(v string) {
a.State = &v
}
// GetAlertId returns the AlertId field if non-nil, zero value otherwise.
func (a *AlertGraphDefinition) GetAlertId() string {
if a == nil || a.AlertId == nil {
return ""
}
return *a.AlertId
}
// GetAlertIdOk returns a tuple with the AlertId field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (a *AlertGraphDefinition) GetAlertIdOk() (string, bool) {
if a == nil || a.AlertId == nil {
return "", false
}
return *a.AlertId, true
}
// HasAlertId returns a boolean if a field has been set.
func (a *AlertGraphDefinition) HasAlertId() bool {
if a != nil && a.AlertId != nil {
return true
}
return false
}
// SetAlertId allocates a new a.AlertId and returns the pointer to it.
func (a *AlertGraphDefinition) SetAlertId(v string) {
a.AlertId = &v
}
// GetTime returns the Time field if non-nil, zero value otherwise.
func (a *AlertGraphDefinition) GetTime() WidgetTime {
if a == nil || a.Time == nil {
return WidgetTime{}
}
return *a.Time
}
// GetTimeOk returns a tuple with the Time field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (a *AlertGraphDefinition) GetTimeOk() (WidgetTime, bool) {
if a == nil || a.Time == nil {
return WidgetTime{}, false
}
return *a.Time, true
}
// HasTime returns a boolean if a field has been set.
func (a *AlertGraphDefinition) HasTime() bool {
if a != nil && a.Time != nil {
return true
}
return false
}
// SetTime allocates a new a.Time and returns the pointer to it.
func (a *AlertGraphDefinition) SetTime(v WidgetTime) {
a.Time = &v
}
// GetTitle returns the Title field if non-nil, zero value otherwise.
func (a *AlertGraphDefinition) GetTitle() string {
if a == nil || a.Title == nil {
return ""
}
return *a.Title
}
// GetTitleOk returns a tuple with the Title field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (a *AlertGraphDefinition) GetTitleOk() (string, bool) {
if a == nil || a.Title == nil {
return "", false
}
return *a.Title, true
}
// HasTitle returns a boolean if a field has been set.
func (a *AlertGraphDefinition) HasTitle() bool {
if a != nil && a.Title != nil {
return true
}
return false
}
// SetTitle allocates a new a.Title and returns the pointer to it.
func (a *AlertGraphDefinition) SetTitle(v string) {
a.Title = &v
}
// GetTitleAlign returns the TitleAlign field if non-nil, zero value otherwise.
func (a *AlertGraphDefinition) GetTitleAlign() string {
if a == nil || a.TitleAlign == nil {
return ""
}
return *a.TitleAlign
}
// GetTitleAlignOk returns a tuple with the TitleAlign field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (a *AlertGraphDefinition) GetTitleAlignOk() (string, bool) {
if a == nil || a.TitleAlign == nil {
return "", false
}
return *a.TitleAlign, true
}
// HasTitleAlign returns a boolean if a field has been set.
func (a *AlertGraphDefinition) HasTitleAlign() bool {
if a != nil && a.TitleAlign != nil {
return true
}
return false
}
// SetTitleAlign allocates a new a.TitleAlign and returns the pointer to it.
func (a *AlertGraphDefinition) SetTitleAlign(v string) {
a.TitleAlign = &v
}
// GetTitleSize returns the TitleSize field if non-nil, zero value otherwise.
func (a *AlertGraphDefinition) GetTitleSize() string {
if a == nil || a.TitleSize == nil {
return ""
}
return *a.TitleSize
}
// GetTitleSizeOk returns a tuple with the TitleSize field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (a *AlertGraphDefinition) GetTitleSizeOk() (string, bool) {
if a == nil || a.TitleSize == nil {
return "", false
}
return *a.TitleSize, true
}
// HasTitleSize returns a boolean if a field has been set.
func (a *AlertGraphDefinition) HasTitleSize() bool {
if a != nil && a.TitleSize != nil {
return true
}
return false
}
// SetTitleSize allocates a new a.TitleSize and returns the pointer to it.
func (a *AlertGraphDefinition) SetTitleSize(v string) {
a.TitleSize = &v
}
// GetType returns the Type field if non-nil, zero value otherwise.
func (a *AlertGraphDefinition) GetType() string {
if a == nil || a.Type == nil {
return ""
}
return *a.Type
}
// GetTypeOk returns a tuple with the Type field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (a *AlertGraphDefinition) GetTypeOk() (string, bool) {
if a == nil || a.Type == nil {
return "", false
}
return *a.Type, true
}
// HasType returns a boolean if a field has been set.
func (a *AlertGraphDefinition) HasType() bool {
if a != nil && a.Type != nil {
return true
}
return false
}
// SetType allocates a new a.Type and returns the pointer to it.
func (a *AlertGraphDefinition) SetType(v string) {
a.Type = &v
}
// GetVizType returns the VizType field if non-nil, zero value otherwise.
func (a *AlertGraphDefinition) GetVizType() string {
if a == nil || a.VizType == nil {
return ""
}
return *a.VizType
}
// GetVizTypeOk returns a tuple with the VizType field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (a *AlertGraphDefinition) GetVizTypeOk() (string, bool) {
if a == nil || a.VizType == nil {
return "", false
}
return *a.VizType, true
}
// HasVizType returns a boolean if a field has been set.
func (a *AlertGraphDefinition) HasVizType() bool {
if a != nil && a.VizType != nil {
return true
}
return false
}
// SetVizType allocates a new a.VizType and returns the pointer to it.
func (a *AlertGraphDefinition) SetVizType(v string) {
a.VizType = &v
}
// GetAlertId returns the AlertId field if non-nil, zero value otherwise.
func (a *AlertValueDefinition) GetAlertId() string {
if a == nil || a.AlertId == nil {
return ""
}
return *a.AlertId
}
// GetAlertIdOk returns a tuple with the AlertId field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (a *AlertValueDefinition) GetAlertIdOk() (string, bool) {
if a == nil || a.AlertId == nil {
return "", false
}
return *a.AlertId, true
}
// HasAlertId returns a boolean if a field has been set.
func (a *AlertValueDefinition) HasAlertId() bool {
if a != nil && a.AlertId != nil {
return true
}
return false
}
// SetAlertId allocates a new a.AlertId and returns the pointer to it.
func (a *AlertValueDefinition) SetAlertId(v string) {
a.AlertId = &v
}
// GetPrecision returns the Precision field if non-nil, zero value otherwise.
func (a *AlertValueDefinition) GetPrecision() int {
if a == nil || a.Precision == nil {
return 0
}
return *a.Precision
}
// GetPrecisionOk returns a tuple with the Precision field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (a *AlertValueDefinition) GetPrecisionOk() (int, bool) {
if a == nil || a.Precision == nil {
return 0, false
}
return *a.Precision, true
}
// HasPrecision returns a boolean if a field has been set.
func (a *AlertValueDefinition) HasPrecision() bool {
if a != nil && a.Precision != nil {
return true
}
return false
}
// SetPrecision allocates a new a.Precision and returns the pointer to it.
func (a *AlertValueDefinition) SetPrecision(v int) {
a.Precision = &v
}
// GetTextAlign returns the TextAlign field if non-nil, zero value otherwise.
func (a *AlertValueDefinition) GetTextAlign() string {
if a == nil || a.TextAlign == nil {
return ""
}
return *a.TextAlign
}
// GetTextAlignOk returns a tuple with the TextAlign field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (a *AlertValueDefinition) GetTextAlignOk() (string, bool) {
if a == nil || a.TextAlign == nil {
return "", false
}
return *a.TextAlign, true
}
// HasTextAlign returns a boolean if a field has been set.
func (a *AlertValueDefinition) HasTextAlign() bool {
if a != nil && a.TextAlign != nil {
return true
}
return false
}
// SetTextAlign allocates a new a.TextAlign and returns the pointer to it.
func (a *AlertValueDefinition) SetTextAlign(v string) {
a.TextAlign = &v
}
// GetTitle returns the Title field if non-nil, zero value otherwise.
func (a *AlertValueDefinition) GetTitle() string {
if a == nil || a.Title == nil {
return ""
}
return *a.Title
}
// GetTitleOk returns a tuple with the Title field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (a *AlertValueDefinition) GetTitleOk() (string, bool) {
if a == nil || a.Title == nil {
return "", false
}
return *a.Title, true
}
// HasTitle returns a boolean if a field has been set.
func (a *AlertValueDefinition) HasTitle() bool {
if a != nil && a.Title != nil {
return true
}
return false
}
// SetTitle allocates a new a.Title and returns the pointer to it.
func (a *AlertValueDefinition) SetTitle(v string) {
a.Title = &v
}
// GetTitleAlign returns the TitleAlign field if non-nil, zero value otherwise.
func (a *AlertValueDefinition) GetTitleAlign() string {
if a == nil || a.TitleAlign == nil {
return ""
}
return *a.TitleAlign
}
// GetTitleAlignOk returns a tuple with the TitleAlign field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (a *AlertValueDefinition) GetTitleAlignOk() (string, bool) {
if a == nil || a.TitleAlign == nil {
return "", false
}
return *a.TitleAlign, true
}
// HasTitleAlign returns a boolean if a field has been set.
func (a *AlertValueDefinition) HasTitleAlign() bool {
if a != nil && a.TitleAlign != nil {
return true
}
return false
}
// SetTitleAlign allocates a new a.TitleAlign and returns the pointer to it.
func (a *AlertValueDefinition) SetTitleAlign(v string) {
a.TitleAlign = &v
}
// GetTitleSize returns the TitleSize field if non-nil, zero value otherwise.
func (a *AlertValueDefinition) GetTitleSize() string {
if a == nil || a.TitleSize == nil {
return ""
}
return *a.TitleSize
}
// GetTitleSizeOk returns a tuple with the TitleSize field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (a *AlertValueDefinition) GetTitleSizeOk() (string, bool) {
if a == nil || a.TitleSize == nil {
return "", false
}
return *a.TitleSize, true
}
// HasTitleSize returns a boolean if a field has been set.
func (a *AlertValueDefinition) HasTitleSize() bool {
if a != nil && a.TitleSize != nil {
return true
}
return false
}
// SetTitleSize allocates a new a.TitleSize and returns the pointer to it.
func (a *AlertValueDefinition) SetTitleSize(v string) {
a.TitleSize = &v
}
// GetType returns the Type field if non-nil, zero value otherwise.
func (a *AlertValueDefinition) GetType() string {
if a == nil || a.Type == nil {
return ""
}
return *a.Type
}
// GetTypeOk returns a tuple with the Type field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (a *AlertValueDefinition) GetTypeOk() (string, bool) {
if a == nil || a.Type == nil {
return "", false
}
return *a.Type, true
}
// HasType returns a boolean if a field has been set.
func (a *AlertValueDefinition) HasType() bool {
if a != nil && a.Type != nil {
return true
}
return false
}
// SetType allocates a new a.Type and returns the pointer to it.
func (a *AlertValueDefinition) SetType(v string) {
a.Type = &v
}
// GetUnit returns the Unit field if non-nil, zero value otherwise.
func (a *AlertValueDefinition) GetUnit() string {
if a == nil || a.Unit == nil {
return ""
}
return *a.Unit
}
// GetUnitOk returns a tuple with the Unit field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (a *AlertValueDefinition) GetUnitOk() (string, bool) {
if a == nil || a.Unit == nil {
return "", false
}
return *a.Unit, true
}
// HasUnit returns a boolean if a field has been set.
func (a *AlertValueDefinition) HasUnit() bool {
if a != nil && a.Unit != nil {
return true
}
return false
}
// SetUnit allocates a new a.Unit and returns the pointer to it.
func (a *AlertValueDefinition) SetUnit(v string) {
a.Unit = &v
}
// GetCreated returns the Created field if non-nil, zero value otherwise.
func (a *APIKey) GetCreated() time.Time {
if a == nil || a.Created == nil {
return time.Time{}
}
return *a.Created
}
// GetCreatedOk returns a tuple with the Created field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (a *APIKey) GetCreatedOk() (time.Time, bool) {
if a == nil || a.Created == nil {
return time.Time{}, false
}
return *a.Created, true
}
// HasCreated returns a boolean if a field has been set.
func (a *APIKey) HasCreated() bool {
if a != nil && a.Created != nil {
return true
}
return false
}
// SetCreated allocates a new a.Created and returns the pointer to it.
func (a *APIKey) SetCreated(v time.Time) {
a.Created = &v
}
// GetCreatedBy returns the CreatedBy field if non-nil, zero value otherwise.
func (a *APIKey) GetCreatedBy() string {
if a == nil || a.CreatedBy == nil {
return ""
}
return *a.CreatedBy
}
// GetCreatedByOk returns a tuple with the CreatedBy field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (a *APIKey) GetCreatedByOk() (string, bool) {
if a == nil || a.CreatedBy == nil {
return "", false
}
return *a.CreatedBy, true
}
// HasCreatedBy returns a boolean if a field has been set.
func (a *APIKey) HasCreatedBy() bool {
if a != nil && a.CreatedBy != nil {
return true
}
return false
}
// SetCreatedBy allocates a new a.CreatedBy and returns the pointer to it.
func (a *APIKey) SetCreatedBy(v string) {
a.CreatedBy = &v
}
// GetKey returns the Key field if non-nil, zero value otherwise.
func (a *APIKey) GetKey() string {
if a == nil || a.Key == nil {
return ""
}
return *a.Key
}
// GetKeyOk returns a tuple with the Key field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (a *APIKey) GetKeyOk() (string, bool) {
if a == nil || a.Key == nil {
return "", false
}
return *a.Key, true
}
// HasKey returns a boolean if a field has been set.
func (a *APIKey) HasKey() bool {
if a != nil && a.Key != nil {
return true
}
return false
}
// SetKey allocates a new a.Key and returns the pointer to it.
func (a *APIKey) SetKey(v string) {
a.Key = &v
}
// GetName returns the Name field if non-nil, zero value otherwise.
func (a *APIKey) GetName() string {
if a == nil || a.Name == nil {
return ""
}
return *a.Name
}
// GetNameOk returns a tuple with the Name field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (a *APIKey) GetNameOk() (string, bool) {
if a == nil || a.Name == nil {
return "", false
}
return *a.Name, true
}
// HasName returns a boolean if a field has been set.
func (a *APIKey) HasName() bool {
if a != nil && a.Name != nil {
return true
}
return false
}
// SetName allocates a new a.Name and returns the pointer to it.
func (a *APIKey) SetName(v string) {
a.Name = &v
}
// GetAggregation returns the Aggregation field if non-nil, zero value otherwise.
func (a *ApmOrLogQueryCompute) GetAggregation() string {
if a == nil || a.Aggregation == nil {
return ""
}
return *a.Aggregation
}
// GetAggregationOk returns a tuple with the Aggregation field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (a *ApmOrLogQueryCompute) GetAggregationOk() (string, bool) {
if a == nil || a.Aggregation == nil {
return "", false
}
return *a.Aggregation, true
}
// HasAggregation returns a boolean if a field has been set.
func (a *ApmOrLogQueryCompute) HasAggregation() bool {
if a != nil && a.Aggregation != nil {
return true
}
return false
}
// SetAggregation allocates a new a.Aggregation and returns the pointer to it.
func (a *ApmOrLogQueryCompute) SetAggregation(v string) {
a.Aggregation = &v
}
// GetFacet returns the Facet field if non-nil, zero value otherwise.
func (a *ApmOrLogQueryCompute) GetFacet() string {
if a == nil || a.Facet == nil {
return ""
}
return *a.Facet
}
// GetFacetOk returns a tuple with the Facet field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (a *ApmOrLogQueryCompute) GetFacetOk() (string, bool) {
if a == nil || a.Facet == nil {
return "", false
}
return *a.Facet, true
}
// HasFacet returns a boolean if a field has been set.
func (a *ApmOrLogQueryCompute) HasFacet() bool {
if a != nil && a.Facet != nil {
return true
}
return false
}
// SetFacet allocates a new a.Facet and returns the pointer to it.
func (a *ApmOrLogQueryCompute) SetFacet(v string) {
a.Facet = &v
}
// GetInterval returns the Interval field if non-nil, zero value otherwise.
func (a *ApmOrLogQueryCompute) GetInterval() int {
if a == nil || a.Interval == nil {
return 0
}
return *a.Interval
}
// GetIntervalOk returns a tuple with the Interval field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (a *ApmOrLogQueryCompute) GetIntervalOk() (int, bool) {
if a == nil || a.Interval == nil {
return 0, false
}
return *a.Interval, true
}
// HasInterval returns a boolean if a field has been set.
func (a *ApmOrLogQueryCompute) HasInterval() bool {
if a != nil && a.Interval != nil {
return true
}
return false
}
// SetInterval allocates a new a.Interval and returns the pointer to it.
func (a *ApmOrLogQueryCompute) SetInterval(v int) {
a.Interval = &v
}
// GetFacet returns the Facet field if non-nil, zero value otherwise.
func (a *ApmOrLogQueryGroupBy) GetFacet() string {
if a == nil || a.Facet == nil {
return ""
}
return *a.Facet
}
// GetFacetOk returns a tuple with the Facet field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (a *ApmOrLogQueryGroupBy) GetFacetOk() (string, bool) {
if a == nil || a.Facet == nil {
return "", false
}
return *a.Facet, true
}
// HasFacet returns a boolean if a field has been set.
func (a *ApmOrLogQueryGroupBy) HasFacet() bool {
if a != nil && a.Facet != nil {
return true
}
return false
}
// SetFacet allocates a new a.Facet and returns the pointer to it.
func (a *ApmOrLogQueryGroupBy) SetFacet(v string) {
a.Facet = &v
}
// GetLimit returns the Limit field if non-nil, zero value otherwise.
func (a *ApmOrLogQueryGroupBy) GetLimit() int {
if a == nil || a.Limit == nil {
return 0
}
return *a.Limit
}
// GetLimitOk returns a tuple with the Limit field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (a *ApmOrLogQueryGroupBy) GetLimitOk() (int, bool) {
if a == nil || a.Limit == nil {
return 0, false
}
return *a.Limit, true
}
// HasLimit returns a boolean if a field has been set.
func (a *ApmOrLogQueryGroupBy) HasLimit() bool {
if a != nil && a.Limit != nil {
return true
}
return false
}
// SetLimit allocates a new a.Limit and returns the pointer to it.
func (a *ApmOrLogQueryGroupBy) SetLimit(v int) {
a.Limit = &v
}
// GetSort returns the Sort field if non-nil, zero value otherwise.
func (a *ApmOrLogQueryGroupBy) GetSort() ApmOrLogQueryGroupBySort {
if a == nil || a.Sort == nil {
return ApmOrLogQueryGroupBySort{}
}
return *a.Sort
}
// GetSortOk returns a tuple with the Sort field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (a *ApmOrLogQueryGroupBy) GetSortOk() (ApmOrLogQueryGroupBySort, bool) {
if a == nil || a.Sort == nil {
return ApmOrLogQueryGroupBySort{}, false
}
return *a.Sort, true
}
// HasSort returns a boolean if a field has been set.
func (a *ApmOrLogQueryGroupBy) HasSort() bool {
if a != nil && a.Sort != nil {
return true
}
return false
}
// SetSort allocates a new a.Sort and returns the pointer to it.
func (a *ApmOrLogQueryGroupBy) SetSort(v ApmOrLogQueryGroupBySort) {
a.Sort = &v
}
// GetAggregation returns the Aggregation field if non-nil, zero value otherwise.
func (a *ApmOrLogQueryGroupBySort) GetAggregation() string {
if a == nil || a.Aggregation == nil {
return ""
}
return *a.Aggregation
}
// GetAggregationOk returns a tuple with the Aggregation field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (a *ApmOrLogQueryGroupBySort) GetAggregationOk() (string, bool) {
if a == nil || a.Aggregation == nil {
return "", false
}
return *a.Aggregation, true
}
// HasAggregation returns a boolean if a field has been set.
func (a *ApmOrLogQueryGroupBySort) HasAggregation() bool {
if a != nil && a.Aggregation != nil {
return true
}
return false
}
// SetAggregation allocates a new a.Aggregation and returns the pointer to it.
func (a *ApmOrLogQueryGroupBySort) SetAggregation(v string) {
a.Aggregation = &v
}
// GetFacet returns the Facet field if non-nil, zero value otherwise.
func (a *ApmOrLogQueryGroupBySort) GetFacet() string {
if a == nil || a.Facet == nil {
return ""
}
return *a.Facet
}
// GetFacetOk returns a tuple with the Facet field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (a *ApmOrLogQueryGroupBySort) GetFacetOk() (string, bool) {
if a == nil || a.Facet == nil {
return "", false
}
return *a.Facet, true
}
// HasFacet returns a boolean if a field has been set.
func (a *ApmOrLogQueryGroupBySort) HasFacet() bool {
if a != nil && a.Facet != nil {
return true
}
return false
}
// SetFacet allocates a new a.Facet and returns the pointer to it.
func (a *ApmOrLogQueryGroupBySort) SetFacet(v string) {
a.Facet = &v
}
// GetOrder returns the Order field if non-nil, zero value otherwise.
func (a *ApmOrLogQueryGroupBySort) GetOrder() string {
if a == nil || a.Order == nil {
return ""
}
return *a.Order
}
// GetOrderOk returns a tuple with the Order field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (a *ApmOrLogQueryGroupBySort) GetOrderOk() (string, bool) {
if a == nil || a.Order == nil {
return "", false
}
return *a.Order, true
}
// HasOrder returns a boolean if a field has been set.
func (a *ApmOrLogQueryGroupBySort) HasOrder() bool {
if a != nil && a.Order != nil {
return true
}
return false
}
// SetOrder allocates a new a.Order and returns the pointer to it.
func (a *ApmOrLogQueryGroupBySort) SetOrder(v string) {
a.Order = &v
}
// GetQuery returns the Query field if non-nil, zero value otherwise.
func (a *ApmOrLogQuerySearch) GetQuery() string {
if a == nil || a.Query == nil {
return ""
}
return *a.Query
}
// GetQueryOk returns a tuple with the Query field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (a *ApmOrLogQuerySearch) GetQueryOk() (string, bool) {
if a == nil || a.Query == nil {
return "", false
}
return *a.Query, true
}
// HasQuery returns a boolean if a field has been set.
func (a *ApmOrLogQuerySearch) HasQuery() bool {
if a != nil && a.Query != nil {
return true
}
return false
}
// SetQuery allocates a new a.Query and returns the pointer to it.
func (a *ApmOrLogQuerySearch) SetQuery(v string) {
a.Query = &v
}
// GetHash returns the Hash field if non-nil, zero value otherwise.
func (a *APPKey) GetHash() string {
if a == nil || a.Hash == nil {
return ""
}
return *a.Hash
}
// GetHashOk returns a tuple with the Hash field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (a *APPKey) GetHashOk() (string, bool) {
if a == nil || a.Hash == nil {
return "", false
}
return *a.Hash, true
}
// HasHash returns a boolean if a field has been set.
func (a *APPKey) HasHash() bool {
if a != nil && a.Hash != nil {
return true
}
return false
}
// SetHash allocates a new a.Hash and returns the pointer to it.
func (a *APPKey) SetHash(v string) {
a.Hash = &v
}
// GetName returns the Name field if non-nil, zero value otherwise.
func (a *APPKey) GetName() string {
if a == nil || a.Name == nil {
return ""
}
return *a.Name
}
// GetNameOk returns a tuple with the Name field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (a *APPKey) GetNameOk() (string, bool) {
if a == nil || a.Name == nil {
return "", false
}
return *a.Name, true
}
// HasName returns a boolean if a field has been set.
func (a *APPKey) HasName() bool {
if a != nil && a.Name != nil {
return true
}
return false
}
// SetName allocates a new a.Name and returns the pointer to it.
func (a *APPKey) SetName(v string) {
a.Name = &v
}
// GetOwner returns the Owner field if non-nil, zero value otherwise.
func (a *APPKey) GetOwner() string {
if a == nil || a.Owner == nil {
return ""
}
return *a.Owner
}
// GetOwnerOk returns a tuple with the Owner field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (a *APPKey) GetOwnerOk() (string, bool) {
if a == nil || a.Owner == nil {
return "", false
}
return *a.Owner, true
}
// HasOwner returns a boolean if a field has been set.
func (a *APPKey) HasOwner() bool {
if a != nil && a.Owner != nil {
return true
}
return false
}
// SetOwner allocates a new a.Owner and returns the pointer to it.
func (a *APPKey) SetOwner(v string) {
a.Owner = &v
}
// GetExpression returns the Expression field if non-nil, zero value otherwise.
func (a *ArithmeticProcessor) GetExpression() string {
if a == nil || a.Expression == nil {
return ""
}
return *a.Expression
}
// GetExpressionOk returns a tuple with the Expression field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (a *ArithmeticProcessor) GetExpressionOk() (string, bool) {
if a == nil || a.Expression == nil {
return "", false
}
return *a.Expression, true
}
// HasExpression returns a boolean if a field has been set.
func (a *ArithmeticProcessor) HasExpression() bool {
if a != nil && a.Expression != nil {
return true
}
return false
}
// SetExpression allocates a new a.Expression and returns the pointer to it.
func (a *ArithmeticProcessor) SetExpression(v string) {
a.Expression = &v
}
// GetIsReplaceMissing returns the IsReplaceMissing field if non-nil, zero value otherwise.
func (a *ArithmeticProcessor) GetIsReplaceMissing() bool {
if a == nil || a.IsReplaceMissing == nil {
return false
}
return *a.IsReplaceMissing
}
// GetIsReplaceMissingOk returns a tuple with the IsReplaceMissing field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (a *ArithmeticProcessor) GetIsReplaceMissingOk() (bool, bool) {
if a == nil || a.IsReplaceMissing == nil {
return false, false
}
return *a.IsReplaceMissing, true
}
// HasIsReplaceMissing returns a boolean if a field has been set.
func (a *ArithmeticProcessor) HasIsReplaceMissing() bool {
if a != nil && a.IsReplaceMissing != nil {
return true
}
return false
}
// SetIsReplaceMissing allocates a new a.IsReplaceMissing and returns the pointer to it.
func (a *ArithmeticProcessor) SetIsReplaceMissing(v bool) {
a.IsReplaceMissing = &v
}
// GetTarget returns the Target field if non-nil, zero value otherwise.
func (a *ArithmeticProcessor) GetTarget() string {
if a == nil || a.Target == nil {
return ""
}
return *a.Target
}
// GetTargetOk returns a tuple with the Target field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (a *ArithmeticProcessor) GetTargetOk() (string, bool) {
if a == nil || a.Target == nil {
return "", false
}
return *a.Target, true
}
// HasTarget returns a boolean if a field has been set.
func (a *ArithmeticProcessor) HasTarget() bool {
if a != nil && a.Target != nil {
return true
}
return false
}
// SetTarget allocates a new a.Target and returns the pointer to it.
func (a *ArithmeticProcessor) SetTarget(v string) {
a.Target = &v
}
// GetOverrideOnConflict returns the OverrideOnConflict field if non-nil, zero value otherwise.
func (a *AttributeRemapper) GetOverrideOnConflict() bool {
if a == nil || a.OverrideOnConflict == nil {
return false
}
return *a.OverrideOnConflict
}
// GetOverrideOnConflictOk returns a tuple with the OverrideOnConflict field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (a *AttributeRemapper) GetOverrideOnConflictOk() (bool, bool) {
if a == nil || a.OverrideOnConflict == nil {
return false, false
}
return *a.OverrideOnConflict, true
}
// HasOverrideOnConflict returns a boolean if a field has been set.
func (a *AttributeRemapper) HasOverrideOnConflict() bool {
if a != nil && a.OverrideOnConflict != nil {
return true
}
return false
}
// SetOverrideOnConflict allocates a new a.OverrideOnConflict and returns the pointer to it.
func (a *AttributeRemapper) SetOverrideOnConflict(v bool) {
a.OverrideOnConflict = &v
}
// GetPreserveSource returns the PreserveSource field if non-nil, zero value otherwise.
func (a *AttributeRemapper) GetPreserveSource() bool {
if a == nil || a.PreserveSource == nil {
return false
}
return *a.PreserveSource
}
// GetPreserveSourceOk returns a tuple with the PreserveSource field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (a *AttributeRemapper) GetPreserveSourceOk() (bool, bool) {
if a == nil || a.PreserveSource == nil {
return false, false
}
return *a.PreserveSource, true
}
// HasPreserveSource returns a boolean if a field has been set.
func (a *AttributeRemapper) HasPreserveSource() bool {
if a != nil && a.PreserveSource != nil {
return true
}
return false
}
// SetPreserveSource allocates a new a.PreserveSource and returns the pointer to it.
func (a *AttributeRemapper) SetPreserveSource(v bool) {
a.PreserveSource = &v
}
// GetSourceType returns the SourceType field if non-nil, zero value otherwise.
func (a *AttributeRemapper) GetSourceType() string {
if a == nil || a.SourceType == nil {
return ""
}
return *a.SourceType
}
// GetSourceTypeOk returns a tuple with the SourceType field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (a *AttributeRemapper) GetSourceTypeOk() (string, bool) {
if a == nil || a.SourceType == nil {
return "", false
}
return *a.SourceType, true
}
// HasSourceType returns a boolean if a field has been set.
func (a *AttributeRemapper) HasSourceType() bool {
if a != nil && a.SourceType != nil {
return true
}
return false
}
// SetSourceType allocates a new a.SourceType and returns the pointer to it.
func (a *AttributeRemapper) SetSourceType(v string) {
a.SourceType = &v
}
// GetTarget returns the Target field if non-nil, zero value otherwise.
func (a *AttributeRemapper) GetTarget() string {
if a == nil || a.Target == nil {
return ""
}
return *a.Target
}
// GetTargetOk returns a tuple with the Target field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (a *AttributeRemapper) GetTargetOk() (string, bool) {
if a == nil || a.Target == nil {
return "", false
}
return *a.Target, true
}
// HasTarget returns a boolean if a field has been set.
func (a *AttributeRemapper) HasTarget() bool {
if a != nil && a.Target != nil {
return true
}
return false
}
// SetTarget allocates a new a.Target and returns the pointer to it.
func (a *AttributeRemapper) SetTarget(v string) {
a.Target = &v
}
// GetTargetType returns the TargetType field if non-nil, zero value otherwise.
func (a *AttributeRemapper) GetTargetType() string {
if a == nil || a.TargetType == nil {
return ""
}
return *a.TargetType
}
// GetTargetTypeOk returns a tuple with the TargetType field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (a *AttributeRemapper) GetTargetTypeOk() (string, bool) {
if a == nil || a.TargetType == nil {
return "", false
}
return *a.TargetType, true
}
// HasTargetType returns a boolean if a field has been set.
func (a *AttributeRemapper) HasTargetType() bool {
if a != nil && a.TargetType != nil {
return true
}
return false
}
// SetTargetType allocates a new a.TargetType and returns the pointer to it.
func (a *AttributeRemapper) SetTargetType(v string) {
a.TargetType = &v
}
// GetAuthorHandle returns the AuthorHandle field if non-nil, zero value otherwise.
func (b *Board) GetAuthorHandle() string {
if b == nil || b.AuthorHandle == nil {
return ""
}
return *b.AuthorHandle
}
// GetAuthorHandleOk returns a tuple with the AuthorHandle field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (b *Board) GetAuthorHandleOk() (string, bool) {
if b == nil || b.AuthorHandle == nil {
return "", false
}
return *b.AuthorHandle, true
}
// HasAuthorHandle returns a boolean if a field has been set.
func (b *Board) HasAuthorHandle() bool {
if b != nil && b.AuthorHandle != nil {
return true
}
return false
}
// SetAuthorHandle allocates a new b.AuthorHandle and returns the pointer to it.
func (b *Board) SetAuthorHandle(v string) {
b.AuthorHandle = &v
}
// GetCreatedAt returns the CreatedAt field if non-nil, zero value otherwise.
func (b *Board) GetCreatedAt() string {
if b == nil || b.CreatedAt == nil {
return ""
}
return *b.CreatedAt
}
// GetCreatedAtOk returns a tuple with the CreatedAt field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (b *Board) GetCreatedAtOk() (string, bool) {
if b == nil || b.CreatedAt == nil {
return "", false
}
return *b.CreatedAt, true
}
// HasCreatedAt returns a boolean if a field has been set.
func (b *Board) HasCreatedAt() bool {
if b != nil && b.CreatedAt != nil {
return true
}
return false
}
// SetCreatedAt allocates a new b.CreatedAt and returns the pointer to it.
func (b *Board) SetCreatedAt(v string) {
b.CreatedAt = &v
}
// GetDescription returns the Description field if non-nil, zero value otherwise.
func (b *Board) GetDescription() string {
if b == nil || b.Description == nil {
return ""
}
return *b.Description
}
// GetDescriptionOk returns a tuple with the Description field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (b *Board) GetDescriptionOk() (string, bool) {
if b == nil || b.Description == nil {
return "", false
}
return *b.Description, true
}
// HasDescription returns a boolean if a field has been set.
func (b *Board) HasDescription() bool {
if b != nil && b.Description != nil {
return true
}
return false
}
// SetDescription allocates a new b.Description and returns the pointer to it.
func (b *Board) SetDescription(v string) {
b.Description = &v
}
// GetId returns the Id field if non-nil, zero value otherwise.
func (b *Board) GetId() string {
if b == nil || b.Id == nil {
return ""
}
return *b.Id
}
// GetIdOk returns a tuple with the Id field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (b *Board) GetIdOk() (string, bool) {
if b == nil || b.Id == nil {
return "", false
}
return *b.Id, true
}
// HasId returns a boolean if a field has been set.
func (b *Board) HasId() bool {
if b != nil && b.Id != nil {
return true
}
return false
}
// SetId allocates a new b.Id and returns the pointer to it.
func (b *Board) SetId(v string) {
b.Id = &v
}
// GetIsReadOnly returns the IsReadOnly field if non-nil, zero value otherwise.
func (b *Board) GetIsReadOnly() bool {
if b == nil || b.IsReadOnly == nil {
return false
}
return *b.IsReadOnly
}
// GetIsReadOnlyOk returns a tuple with the IsReadOnly field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (b *Board) GetIsReadOnlyOk() (bool, bool) {
if b == nil || b.IsReadOnly == nil {
return false, false
}
return *b.IsReadOnly, true
}
// HasIsReadOnly returns a boolean if a field has been set.
func (b *Board) HasIsReadOnly() bool {
if b != nil && b.IsReadOnly != nil {
return true
}
return false
}
// SetIsReadOnly allocates a new b.IsReadOnly and returns the pointer to it.
func (b *Board) SetIsReadOnly(v bool) {
b.IsReadOnly = &v
}
// GetLayoutType returns the LayoutType field if non-nil, zero value otherwise.
func (b *Board) GetLayoutType() string {
if b == nil || b.LayoutType == nil {
return ""
}
return *b.LayoutType
}
// GetLayoutTypeOk returns a tuple with the LayoutType field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (b *Board) GetLayoutTypeOk() (string, bool) {
if b == nil || b.LayoutType == nil {
return "", false
}
return *b.LayoutType, true
}
// HasLayoutType returns a boolean if a field has been set.
func (b *Board) HasLayoutType() bool {
if b != nil && b.LayoutType != nil {
return true
}
return false
}
// SetLayoutType allocates a new b.LayoutType and returns the pointer to it.
func (b *Board) SetLayoutType(v string) {
b.LayoutType = &v
}
// GetModifiedAt returns the ModifiedAt field if non-nil, zero value otherwise.
func (b *Board) GetModifiedAt() string {
if b == nil || b.ModifiedAt == nil {
return ""
}
return *b.ModifiedAt
}
// GetModifiedAtOk returns a tuple with the ModifiedAt field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (b *Board) GetModifiedAtOk() (string, bool) {
if b == nil || b.ModifiedAt == nil {
return "", false
}
return *b.ModifiedAt, true
}
// HasModifiedAt returns a boolean if a field has been set.
func (b *Board) HasModifiedAt() bool {
if b != nil && b.ModifiedAt != nil {
return true
}
return false
}
// SetModifiedAt allocates a new b.ModifiedAt and returns the pointer to it.
func (b *Board) SetModifiedAt(v string) {
b.ModifiedAt = &v
}
// GetTitle returns the Title field if non-nil, zero value otherwise.
func (b *Board) GetTitle() string {
if b == nil || b.Title == nil {
return ""
}
return *b.Title
}
// GetTitleOk returns a tuple with the Title field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (b *Board) GetTitleOk() (string, bool) {
if b == nil || b.Title == nil {
return "", false
}
return *b.Title, true
}
// HasTitle returns a boolean if a field has been set.
func (b *Board) HasTitle() bool {
if b != nil && b.Title != nil {
return true
}
return false
}
// SetTitle allocates a new b.Title and returns the pointer to it.
func (b *Board) SetTitle(v string) {
b.Title = &v
}
// GetUrl returns the Url field if non-nil, zero value otherwise.
func (b *Board) GetUrl() string {
if b == nil || b.Url == nil {
return ""
}
return *b.Url
}
// GetUrlOk returns a tuple with the Url field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (b *Board) GetUrlOk() (string, bool) {
if b == nil || b.Url == nil {
return "", false
}
return *b.Url, true
}
// HasUrl returns a boolean if a field has been set.
func (b *Board) HasUrl() bool {
if b != nil && b.Url != nil {
return true
}
return false
}
// SetUrl allocates a new b.Url and returns the pointer to it.
func (b *Board) SetUrl(v string) {
b.Url = &v
}
// GetAuthorHandle returns the AuthorHandle field if non-nil, zero value otherwise.
func (b *BoardLite) GetAuthorHandle() string {
if b == nil || b.AuthorHandle == nil {
return ""
}
return *b.AuthorHandle
}
// GetAuthorHandleOk returns a tuple with the AuthorHandle field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (b *BoardLite) GetAuthorHandleOk() (string, bool) {
if b == nil || b.AuthorHandle == nil {
return "", false
}
return *b.AuthorHandle, true
}
// HasAuthorHandle returns a boolean if a field has been set.
func (b *BoardLite) HasAuthorHandle() bool {
if b != nil && b.AuthorHandle != nil {
return true
}
return false
}
// SetAuthorHandle allocates a new b.AuthorHandle and returns the pointer to it.
func (b *BoardLite) SetAuthorHandle(v string) {
b.AuthorHandle = &v
}
// GetCreatedAt returns the CreatedAt field if non-nil, zero value otherwise.
func (b *BoardLite) GetCreatedAt() string {
if b == nil || b.CreatedAt == nil {
return ""
}
return *b.CreatedAt
}
// GetCreatedAtOk returns a tuple with the CreatedAt field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (b *BoardLite) GetCreatedAtOk() (string, bool) {
if b == nil || b.CreatedAt == nil {
return "", false
}
return *b.CreatedAt, true
}
// HasCreatedAt returns a boolean if a field has been set.
func (b *BoardLite) HasCreatedAt() bool {
if b != nil && b.CreatedAt != nil {
return true
}
return false
}
// SetCreatedAt allocates a new b.CreatedAt and returns the pointer to it.
func (b *BoardLite) SetCreatedAt(v string) {
b.CreatedAt = &v
}
// GetDescription returns the Description field if non-nil, zero value otherwise.
func (b *BoardLite) GetDescription() string {
if b == nil || b.Description == nil {
return ""
}
return *b.Description
}
// GetDescriptionOk returns a tuple with the Description field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (b *BoardLite) GetDescriptionOk() (string, bool) {
if b == nil || b.Description == nil {
return "", false
}
return *b.Description, true
}
// HasDescription returns a boolean if a field has been set.
func (b *BoardLite) HasDescription() bool {
if b != nil && b.Description != nil {
return true
}
return false
}
// SetDescription allocates a new b.Description and returns the pointer to it.
func (b *BoardLite) SetDescription(v string) {
b.Description = &v
}
// GetId returns the Id field if non-nil, zero value otherwise.
func (b *BoardLite) GetId() string {
if b == nil || b.Id == nil {
return ""
}
return *b.Id
}
// GetIdOk returns a tuple with the Id field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (b *BoardLite) GetIdOk() (string, bool) {
if b == nil || b.Id == nil {
return "", false
}
return *b.Id, true
}
// HasId returns a boolean if a field has been set.
func (b *BoardLite) HasId() bool {
if b != nil && b.Id != nil {
return true
}
return false
}
// SetId allocates a new b.Id and returns the pointer to it.
func (b *BoardLite) SetId(v string) {
b.Id = &v
}
// GetIsReadOnly returns the IsReadOnly field if non-nil, zero value otherwise.
func (b *BoardLite) GetIsReadOnly() bool {
if b == nil || b.IsReadOnly == nil {
return false
}
return *b.IsReadOnly
}
// GetIsReadOnlyOk returns a tuple with the IsReadOnly field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (b *BoardLite) GetIsReadOnlyOk() (bool, bool) {
if b == nil || b.IsReadOnly == nil {
return false, false
}
return *b.IsReadOnly, true
}
// HasIsReadOnly returns a boolean if a field has been set.
func (b *BoardLite) HasIsReadOnly() bool {
if b != nil && b.IsReadOnly != nil {
return true
}
return false
}
// SetIsReadOnly allocates a new b.IsReadOnly and returns the pointer to it.
func (b *BoardLite) SetIsReadOnly(v bool) {
b.IsReadOnly = &v
}
// GetLayoutType returns the LayoutType field if non-nil, zero value otherwise.
func (b *BoardLite) GetLayoutType() string {
if b == nil || b.LayoutType == nil {
return ""
}
return *b.LayoutType
}
// GetLayoutTypeOk returns a tuple with the LayoutType field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (b *BoardLite) GetLayoutTypeOk() (string, bool) {
if b == nil || b.LayoutType == nil {
return "", false
}
return *b.LayoutType, true
}
// HasLayoutType returns a boolean if a field has been set.
func (b *BoardLite) HasLayoutType() bool {
if b != nil && b.LayoutType != nil {
return true
}
return false
}
// SetLayoutType allocates a new b.LayoutType and returns the pointer to it.
func (b *BoardLite) SetLayoutType(v string) {
b.LayoutType = &v
}
// GetModifiedAt returns the ModifiedAt field if non-nil, zero value otherwise.
func (b *BoardLite) GetModifiedAt() string {
if b == nil || b.ModifiedAt == nil {
return ""
}
return *b.ModifiedAt
}
// GetModifiedAtOk returns a tuple with the ModifiedAt field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (b *BoardLite) GetModifiedAtOk() (string, bool) {
if b == nil || b.ModifiedAt == nil {
return "", false
}
return *b.ModifiedAt, true
}
// HasModifiedAt returns a boolean if a field has been set.
func (b *BoardLite) HasModifiedAt() bool {
if b != nil && b.ModifiedAt != nil {
return true
}
return false
}
// SetModifiedAt allocates a new b.ModifiedAt and returns the pointer to it.
func (b *BoardLite) SetModifiedAt(v string) {
b.ModifiedAt = &v
}
// GetTitle returns the Title field if non-nil, zero value otherwise.
func (b *BoardLite) GetTitle() string {
if b == nil || b.Title == nil {
return ""
}
return *b.Title
}
// GetTitleOk returns a tuple with the Title field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (b *BoardLite) GetTitleOk() (string, bool) {
if b == nil || b.Title == nil {
return "", false
}
return *b.Title, true
}
// HasTitle returns a boolean if a field has been set.
func (b *BoardLite) HasTitle() bool {
if b != nil && b.Title != nil {
return true
}
return false
}
// SetTitle allocates a new b.Title and returns the pointer to it.
func (b *BoardLite) SetTitle(v string) {
b.Title = &v
}
// GetUrl returns the Url field if non-nil, zero value otherwise.
func (b *BoardLite) GetUrl() string {
if b == nil || b.Url == nil {
return ""
}
return *b.Url
}
// GetUrlOk returns a tuple with the Url field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (b *BoardLite) GetUrlOk() (string, bool) {
if b == nil || b.Url == nil {
return "", false
}
return *b.Url, true
}
// HasUrl returns a boolean if a field has been set.
func (b *BoardLite) HasUrl() bool {
if b != nil && b.Url != nil {
return true
}
return false
}
// SetUrl allocates a new b.Url and returns the pointer to it.
func (b *BoardLite) SetUrl(v string) {
b.Url = &v
}
// GetId returns the Id field if non-nil, zero value otherwise.
func (b *BoardWidget) GetId() int {
if b == nil || b.Id == nil {
return 0
}
return *b.Id
}
// GetIdOk returns a tuple with the Id field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (b *BoardWidget) GetIdOk() (int, bool) {
if b == nil || b.Id == nil {
return 0, false
}
return *b.Id, true
}
// HasId returns a boolean if a field has been set.
func (b *BoardWidget) HasId() bool {
if b != nil && b.Id != nil {
return true
}
return false
}
// SetId allocates a new b.Id and returns the pointer to it.
func (b *BoardWidget) SetId(v int) {
b.Id = &v
}
// GetLayout returns the Layout field if non-nil, zero value otherwise.
func (b *BoardWidget) GetLayout() WidgetLayout {
if b == nil || b.Layout == nil {
return WidgetLayout{}
}
return *b.Layout
}
// GetLayoutOk returns a tuple with the Layout field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (b *BoardWidget) GetLayoutOk() (WidgetLayout, bool) {
if b == nil || b.Layout == nil {
return WidgetLayout{}, false
}
return *b.Layout, true
}
// HasLayout returns a boolean if a field has been set.
func (b *BoardWidget) HasLayout() bool {
if b != nil && b.Layout != nil {
return true
}
return false
}
// SetLayout allocates a new b.Layout and returns the pointer to it.
func (b *BoardWidget) SetLayout(v WidgetLayout) {
b.Layout = &v
}
// GetFilter returns the Filter field if non-nil, zero value otherwise.
func (c *Category) GetFilter() FilterConfiguration {
if c == nil || c.Filter == nil {
return FilterConfiguration{}
}
return *c.Filter
}
// GetFilterOk returns a tuple with the Filter field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (c *Category) GetFilterOk() (FilterConfiguration, bool) {
if c == nil || c.Filter == nil {
return FilterConfiguration{}, false
}
return *c.Filter, true
}
// HasFilter returns a boolean if a field has been set.
func (c *Category) HasFilter() bool {
if c != nil && c.Filter != nil {
return true
}
return false
}
// SetFilter allocates a new c.Filter and returns the pointer to it.
func (c *Category) SetFilter(v FilterConfiguration) {
c.Filter = &v
}
// GetName returns the Name field if non-nil, zero value otherwise.
func (c *Category) GetName() string {
if c == nil || c.Name == nil {
return ""
}
return *c.Name
}
// GetNameOk returns a tuple with the Name field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (c *Category) GetNameOk() (string, bool) {
if c == nil || c.Name == nil {
return "", false
}
return *c.Name, true
}
// HasName returns a boolean if a field has been set.
func (c *Category) HasName() bool {
if c != nil && c.Name != nil {
return true
}
return false
}
// SetName allocates a new c.Name and returns the pointer to it.
func (c *Category) SetName(v string) {
c.Name = &v
}
// GetTarget returns the Target field if non-nil, zero value otherwise.
func (c *CategoryProcessor) GetTarget() string {
if c == nil || c.Target == nil {
return ""
}
return *c.Target
}
// GetTargetOk returns a tuple with the Target field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (c *CategoryProcessor) GetTargetOk() (string, bool) {
if c == nil || c.Target == nil {
return "", false
}
return *c.Target, true
}
// HasTarget returns a boolean if a field has been set.
func (c *CategoryProcessor) HasTarget() bool {
if c != nil && c.Target != nil {
return true
}
return false
}
// SetTarget allocates a new c.Target and returns the pointer to it.
func (c *CategoryProcessor) SetTarget(v string) {
c.Target = &v
}
// GetTime returns the Time field if non-nil, zero value otherwise.
func (c *ChangeDefinition) GetTime() WidgetTime {
if c == nil || c.Time == nil {
return WidgetTime{}
}
return *c.Time
}
// GetTimeOk returns a tuple with the Time field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (c *ChangeDefinition) GetTimeOk() (WidgetTime, bool) {
if c == nil || c.Time == nil {
return WidgetTime{}, false
}
return *c.Time, true
}
// HasTime returns a boolean if a field has been set.
func (c *ChangeDefinition) HasTime() bool {
if c != nil && c.Time != nil {
return true
}
return false
}
// SetTime allocates a new c.Time and returns the pointer to it.
func (c *ChangeDefinition) SetTime(v WidgetTime) {
c.Time = &v
}
// GetTitle returns the Title field if non-nil, zero value otherwise.
func (c *ChangeDefinition) GetTitle() string {
if c == nil || c.Title == nil {
return ""
}
return *c.Title
}
// GetTitleOk returns a tuple with the Title field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (c *ChangeDefinition) GetTitleOk() (string, bool) {
if c == nil || c.Title == nil {
return "", false
}
return *c.Title, true
}
// HasTitle returns a boolean if a field has been set.
func (c *ChangeDefinition) HasTitle() bool {
if c != nil && c.Title != nil {
return true
}
return false
}
// SetTitle allocates a new c.Title and returns the pointer to it.
func (c *ChangeDefinition) SetTitle(v string) {
c.Title = &v
}
// GetTitleAlign returns the TitleAlign field if non-nil, zero value otherwise.
func (c *ChangeDefinition) GetTitleAlign() string {
if c == nil || c.TitleAlign == nil {
return ""
}
return *c.TitleAlign
}
// GetTitleAlignOk returns a tuple with the TitleAlign field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (c *ChangeDefinition) GetTitleAlignOk() (string, bool) {
if c == nil || c.TitleAlign == nil {
return "", false
}
return *c.TitleAlign, true
}
// HasTitleAlign returns a boolean if a field has been set.
func (c *ChangeDefinition) HasTitleAlign() bool {
if c != nil && c.TitleAlign != nil {
return true
}
return false
}
// SetTitleAlign allocates a new c.TitleAlign and returns the pointer to it.
func (c *ChangeDefinition) SetTitleAlign(v string) {
c.TitleAlign = &v
}
// GetTitleSize returns the TitleSize field if non-nil, zero value otherwise.
func (c *ChangeDefinition) GetTitleSize() string {
if c == nil || c.TitleSize == nil {
return ""
}
return *c.TitleSize
}
// GetTitleSizeOk returns a tuple with the TitleSize field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (c *ChangeDefinition) GetTitleSizeOk() (string, bool) {
if c == nil || c.TitleSize == nil {
return "", false
}
return *c.TitleSize, true
}
// HasTitleSize returns a boolean if a field has been set.
func (c *ChangeDefinition) HasTitleSize() bool {
if c != nil && c.TitleSize != nil {
return true
}
return false
}
// SetTitleSize allocates a new c.TitleSize and returns the pointer to it.
func (c *ChangeDefinition) SetTitleSize(v string) {
c.TitleSize = &v
}
// GetType returns the Type field if non-nil, zero value otherwise.
func (c *ChangeDefinition) GetType() string {
if c == nil || c.Type == nil {
return ""
}
return *c.Type
}
// GetTypeOk returns a tuple with the Type field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (c *ChangeDefinition) GetTypeOk() (string, bool) {
if c == nil || c.Type == nil {
return "", false
}
return *c.Type, true
}
// HasType returns a boolean if a field has been set.
func (c *ChangeDefinition) HasType() bool {
if c != nil && c.Type != nil {
return true
}
return false
}
// SetType allocates a new c.Type and returns the pointer to it.
func (c *ChangeDefinition) SetType(v string) {
c.Type = &v
}
// GetApmQuery returns the ApmQuery field if non-nil, zero value otherwise.
func (c *ChangeRequest) GetApmQuery() WidgetApmOrLogQuery {
if c == nil || c.ApmQuery == nil {
return WidgetApmOrLogQuery{}
}
return *c.ApmQuery
}
// GetApmQueryOk returns a tuple with the ApmQuery field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (c *ChangeRequest) GetApmQueryOk() (WidgetApmOrLogQuery, bool) {
if c == nil || c.ApmQuery == nil {
return WidgetApmOrLogQuery{}, false
}
return *c.ApmQuery, true
}
// HasApmQuery returns a boolean if a field has been set.
func (c *ChangeRequest) HasApmQuery() bool {
if c != nil && c.ApmQuery != nil {
return true
}
return false
}
// SetApmQuery allocates a new c.ApmQuery and returns the pointer to it.
func (c *ChangeRequest) SetApmQuery(v WidgetApmOrLogQuery) {
c.ApmQuery = &v
}
// GetChangeType returns the ChangeType field if non-nil, zero value otherwise.
func (c *ChangeRequest) GetChangeType() string {
if c == nil || c.ChangeType == nil {
return ""
}
return *c.ChangeType
}
// GetChangeTypeOk returns a tuple with the ChangeType field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (c *ChangeRequest) GetChangeTypeOk() (string, bool) {
if c == nil || c.ChangeType == nil {
return "", false
}
return *c.ChangeType, true
}
// HasChangeType returns a boolean if a field has been set.
func (c *ChangeRequest) HasChangeType() bool {
if c != nil && c.ChangeType != nil {
return true
}
return false
}
// SetChangeType allocates a new c.ChangeType and returns the pointer to it.
func (c *ChangeRequest) SetChangeType(v string) {
c.ChangeType = &v
}
// GetCompareTo returns the CompareTo field if non-nil, zero value otherwise.
func (c *ChangeRequest) GetCompareTo() string {
if c == nil || c.CompareTo == nil {
return ""
}
return *c.CompareTo
}
// GetCompareToOk returns a tuple with the CompareTo field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (c *ChangeRequest) GetCompareToOk() (string, bool) {
if c == nil || c.CompareTo == nil {
return "", false
}
return *c.CompareTo, true
}
// HasCompareTo returns a boolean if a field has been set.
func (c *ChangeRequest) HasCompareTo() bool {
if c != nil && c.CompareTo != nil {
return true
}
return false
}
// SetCompareTo allocates a new c.CompareTo and returns the pointer to it.
func (c *ChangeRequest) SetCompareTo(v string) {
c.CompareTo = &v
}
// GetIncreaseGood returns the IncreaseGood field if non-nil, zero value otherwise.
func (c *ChangeRequest) GetIncreaseGood() bool {
if c == nil || c.IncreaseGood == nil {
return false
}
return *c.IncreaseGood
}
// GetIncreaseGoodOk returns a tuple with the IncreaseGood field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (c *ChangeRequest) GetIncreaseGoodOk() (bool, bool) {
if c == nil || c.IncreaseGood == nil {
return false, false
}
return *c.IncreaseGood, true
}
// HasIncreaseGood returns a boolean if a field has been set.
func (c *ChangeRequest) HasIncreaseGood() bool {
if c != nil && c.IncreaseGood != nil {
return true
}
return false
}
// SetIncreaseGood allocates a new c.IncreaseGood and returns the pointer to it.
func (c *ChangeRequest) SetIncreaseGood(v bool) {
c.IncreaseGood = &v
}
// GetLogQuery returns the LogQuery field if non-nil, zero value otherwise.
func (c *ChangeRequest) GetLogQuery() WidgetApmOrLogQuery {
if c == nil || c.LogQuery == nil {
return WidgetApmOrLogQuery{}
}
return *c.LogQuery
}
// GetLogQueryOk returns a tuple with the LogQuery field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (c *ChangeRequest) GetLogQueryOk() (WidgetApmOrLogQuery, bool) {
if c == nil || c.LogQuery == nil {
return WidgetApmOrLogQuery{}, false
}
return *c.LogQuery, true
}
// HasLogQuery returns a boolean if a field has been set.
func (c *ChangeRequest) HasLogQuery() bool {
if c != nil && c.LogQuery != nil {
return true
}
return false
}
// SetLogQuery allocates a new c.LogQuery and returns the pointer to it.
func (c *ChangeRequest) SetLogQuery(v WidgetApmOrLogQuery) {
c.LogQuery = &v
}
// GetMetricQuery returns the MetricQuery field if non-nil, zero value otherwise.
func (c *ChangeRequest) GetMetricQuery() string {
if c == nil || c.MetricQuery == nil {
return ""
}
return *c.MetricQuery
}
// GetMetricQueryOk returns a tuple with the MetricQuery field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (c *ChangeRequest) GetMetricQueryOk() (string, bool) {
if c == nil || c.MetricQuery == nil {
return "", false
}
return *c.MetricQuery, true
}
// HasMetricQuery returns a boolean if a field has been set.
func (c *ChangeRequest) HasMetricQuery() bool {
if c != nil && c.MetricQuery != nil {
return true
}
return false
}
// SetMetricQuery allocates a new c.MetricQuery and returns the pointer to it.
func (c *ChangeRequest) SetMetricQuery(v string) {
c.MetricQuery = &v
}
// GetOrderBy returns the OrderBy field if non-nil, zero value otherwise.
func (c *ChangeRequest) GetOrderBy() string {
if c == nil || c.OrderBy == nil {
return ""
}
return *c.OrderBy
}
// GetOrderByOk returns a tuple with the OrderBy field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (c *ChangeRequest) GetOrderByOk() (string, bool) {
if c == nil || c.OrderBy == nil {
return "", false
}
return *c.OrderBy, true
}
// HasOrderBy returns a boolean if a field has been set.
func (c *ChangeRequest) HasOrderBy() bool {
if c != nil && c.OrderBy != nil {
return true
}
return false
}
// SetOrderBy allocates a new c.OrderBy and returns the pointer to it.
func (c *ChangeRequest) SetOrderBy(v string) {
c.OrderBy = &v
}
// GetOrderDir returns the OrderDir field if non-nil, zero value otherwise.
func (c *ChangeRequest) GetOrderDir() string {
if c == nil || c.OrderDir == nil {
return ""
}
return *c.OrderDir
}
// GetOrderDirOk returns a tuple with the OrderDir field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (c *ChangeRequest) GetOrderDirOk() (string, bool) {
if c == nil || c.OrderDir == nil {
return "", false
}
return *c.OrderDir, true
}
// HasOrderDir returns a boolean if a field has been set.
func (c *ChangeRequest) HasOrderDir() bool {
if c != nil && c.OrderDir != nil {
return true
}
return false
}
// SetOrderDir allocates a new c.OrderDir and returns the pointer to it.
func (c *ChangeRequest) SetOrderDir(v string) {
c.OrderDir = &v
}
// GetProcessQuery returns the ProcessQuery field if non-nil, zero value otherwise.
func (c *ChangeRequest) GetProcessQuery() WidgetProcessQuery {
if c == nil || c.ProcessQuery == nil {
return WidgetProcessQuery{}
}
return *c.ProcessQuery
}
// GetProcessQueryOk returns a tuple with the ProcessQuery field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (c *ChangeRequest) GetProcessQueryOk() (WidgetProcessQuery, bool) {
if c == nil || c.ProcessQuery == nil {
return WidgetProcessQuery{}, false
}
return *c.ProcessQuery, true
}
// HasProcessQuery returns a boolean if a field has been set.
func (c *ChangeRequest) HasProcessQuery() bool {
if c != nil && c.ProcessQuery != nil {
return true
}
return false
}
// SetProcessQuery allocates a new c.ProcessQuery and returns the pointer to it.
func (c *ChangeRequest) SetProcessQuery(v WidgetProcessQuery) {
c.ProcessQuery = &v
}
// GetShowPresent returns the ShowPresent field if non-nil, zero value otherwise.
func (c *ChangeRequest) GetShowPresent() bool {
if c == nil || c.ShowPresent == nil {
return false
}
return *c.ShowPresent
}
// GetShowPresentOk returns a tuple with the ShowPresent field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (c *ChangeRequest) GetShowPresentOk() (bool, bool) {
if c == nil || c.ShowPresent == nil {
return false, false
}
return *c.ShowPresent, true
}
// HasShowPresent returns a boolean if a field has been set.
func (c *ChangeRequest) HasShowPresent() bool {
if c != nil && c.ShowPresent != nil {
return true
}
return false
}
// SetShowPresent allocates a new c.ShowPresent and returns the pointer to it.
func (c *ChangeRequest) SetShowPresent(v bool) {
c.ShowPresent = &v
}
// GetAccount returns the Account field if non-nil, zero value otherwise.
func (c *ChannelSlackRequest) GetAccount() string {
if c == nil || c.Account == nil {
return ""
}
return *c.Account
}
// GetAccountOk returns a tuple with the Account field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (c *ChannelSlackRequest) GetAccountOk() (string, bool) {
if c == nil || c.Account == nil {
return "", false
}
return *c.Account, true
}
// HasAccount returns a boolean if a field has been set.
func (c *ChannelSlackRequest) HasAccount() bool {
if c != nil && c.Account != nil {
return true
}
return false
}
// SetAccount allocates a new c.Account and returns the pointer to it.
func (c *ChannelSlackRequest) SetAccount(v string) {
c.Account = &v
}
// GetChannelName returns the ChannelName field if non-nil, zero value otherwise.
func (c *ChannelSlackRequest) GetChannelName() string {
if c == nil || c.ChannelName == nil {
return ""
}
return *c.ChannelName
}
// GetChannelNameOk returns a tuple with the ChannelName field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (c *ChannelSlackRequest) GetChannelNameOk() (string, bool) {
if c == nil || c.ChannelName == nil {
return "", false
}
return *c.ChannelName, true
}
// HasChannelName returns a boolean if a field has been set.
func (c *ChannelSlackRequest) HasChannelName() bool {
if c != nil && c.ChannelName != nil {
return true
}
return false
}
// SetChannelName allocates a new c.ChannelName and returns the pointer to it.
func (c *ChannelSlackRequest) SetChannelName(v string) {
c.ChannelName = &v
}
// GetTransferAllUserComments returns the TransferAllUserComments field if non-nil, zero value otherwise.
func (c *ChannelSlackRequest) GetTransferAllUserComments() bool {
if c == nil || c.TransferAllUserComments == nil {
return false
}
return *c.TransferAllUserComments
}
// GetTransferAllUserCommentsOk returns a tuple with the TransferAllUserComments field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (c *ChannelSlackRequest) GetTransferAllUserCommentsOk() (bool, bool) {
if c == nil || c.TransferAllUserComments == nil {
return false, false
}
return *c.TransferAllUserComments, true
}
// HasTransferAllUserComments returns a boolean if a field has been set.
func (c *ChannelSlackRequest) HasTransferAllUserComments() bool {
if c != nil && c.TransferAllUserComments != nil {
return true
}
return false
}
// SetTransferAllUserComments allocates a new c.TransferAllUserComments and returns the pointer to it.
func (c *ChannelSlackRequest) SetTransferAllUserComments(v bool) {
c.TransferAllUserComments = &v
}
// GetCheck returns the Check field if non-nil, zero value otherwise.
func (c *Check) GetCheck() string {
if c == nil || c.Check == nil {
return ""
}
return *c.Check
}
// GetCheckOk returns a tuple with the Check field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (c *Check) GetCheckOk() (string, bool) {
if c == nil || c.Check == nil {
return "", false
}
return *c.Check, true
}
// HasCheck returns a boolean if a field has been set.
func (c *Check) HasCheck() bool {
if c != nil && c.Check != nil {
return true
}
return false
}
// SetCheck allocates a new c.Check and returns the pointer to it.
func (c *Check) SetCheck(v string) {
c.Check = &v
}
// GetHostName returns the HostName field if non-nil, zero value otherwise.
func (c *Check) GetHostName() string {
if c == nil || c.HostName == nil {
return ""
}
return *c.HostName
}
// GetHostNameOk returns a tuple with the HostName field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (c *Check) GetHostNameOk() (string, bool) {
if c == nil || c.HostName == nil {
return "", false
}
return *c.HostName, true
}
// HasHostName returns a boolean if a field has been set.
func (c *Check) HasHostName() bool {
if c != nil && c.HostName != nil {
return true
}
return false
}
// SetHostName allocates a new c.HostName and returns the pointer to it.
func (c *Check) SetHostName(v string) {
c.HostName = &v
}
// GetMessage returns the Message field if non-nil, zero value otherwise.
func (c *Check) GetMessage() string {
if c == nil || c.Message == nil {
return ""
}
return *c.Message
}
// GetMessageOk returns a tuple with the Message field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (c *Check) GetMessageOk() (string, bool) {
if c == nil || c.Message == nil {
return "", false
}
return *c.Message, true
}
// HasMessage returns a boolean if a field has been set.
func (c *Check) HasMessage() bool {
if c != nil && c.Message != nil {
return true
}
return false
}
// SetMessage allocates a new c.Message and returns the pointer to it.
func (c *Check) SetMessage(v string) {
c.Message = &v
}
// GetStatus returns the Status field if non-nil, zero value otherwise.
func (c *Check) GetStatus() Status {
if c == nil || c.Status == nil {
return 0
}
return *c.Status
}
// GetStatusOk returns a tuple with the Status field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (c *Check) GetStatusOk() (Status, bool) {
if c == nil || c.Status == nil {
return 0, false
}
return *c.Status, true
}
// HasStatus returns a boolean if a field has been set.
func (c *Check) HasStatus() bool {
if c != nil && c.Status != nil {
return true
}
return false
}
// SetStatus allocates a new c.Status and returns the pointer to it.
func (c *Check) SetStatus(v Status) {
c.Status = &v
}
// GetTimestamp returns the Timestamp field if non-nil, zero value otherwise.
func (c *Check) GetTimestamp() string {
if c == nil || c.Timestamp == nil {
return ""
}
return *c.Timestamp
}
// GetTimestampOk returns a tuple with the Timestamp field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (c *Check) GetTimestampOk() (string, bool) {
if c == nil || c.Timestamp == nil {
return "", false
}
return *c.Timestamp, true
}
// HasTimestamp returns a boolean if a field has been set.
func (c *Check) HasTimestamp() bool {
if c != nil && c.Timestamp != nil {
return true
}
return false
}
// SetTimestamp allocates a new c.Timestamp and returns the pointer to it.
func (c *Check) SetTimestamp(v string) {
c.Timestamp = &v
}
// GetCheck returns the Check field if non-nil, zero value otherwise.
func (c *CheckStatusDefinition) GetCheck() string {
if c == nil || c.Check == nil {
return ""
}
return *c.Check
}
// GetCheckOk returns a tuple with the Check field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (c *CheckStatusDefinition) GetCheckOk() (string, bool) {
if c == nil || c.Check == nil {
return "", false
}
return *c.Check, true
}
// HasCheck returns a boolean if a field has been set.
func (c *CheckStatusDefinition) HasCheck() bool {
if c != nil && c.Check != nil {
return true
}
return false
}
// SetCheck allocates a new c.Check and returns the pointer to it.
func (c *CheckStatusDefinition) SetCheck(v string) {
c.Check = &v
}
// GetGroup returns the Group field if non-nil, zero value otherwise.
func (c *CheckStatusDefinition) GetGroup() string {
if c == nil || c.Group == nil {
return ""
}
return *c.Group
}
// GetGroupOk returns a tuple with the Group field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (c *CheckStatusDefinition) GetGroupOk() (string, bool) {
if c == nil || c.Group == nil {
return "", false
}
return *c.Group, true
}
// HasGroup returns a boolean if a field has been set.
func (c *CheckStatusDefinition) HasGroup() bool {
if c != nil && c.Group != nil {
return true
}
return false
}
// SetGroup allocates a new c.Group and returns the pointer to it.
func (c *CheckStatusDefinition) SetGroup(v string) {
c.Group = &v
}
// GetGrouping returns the Grouping field if non-nil, zero value otherwise.
func (c *CheckStatusDefinition) GetGrouping() string {
if c == nil || c.Grouping == nil {
return ""
}
return *c.Grouping
}
// GetGroupingOk returns a tuple with the Grouping field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (c *CheckStatusDefinition) GetGroupingOk() (string, bool) {
if c == nil || c.Grouping == nil {
return "", false
}
return *c.Grouping, true
}
// HasGrouping returns a boolean if a field has been set.
func (c *CheckStatusDefinition) HasGrouping() bool {
if c != nil && c.Grouping != nil {
return true
}
return false
}
// SetGrouping allocates a new c.Grouping and returns the pointer to it.
func (c *CheckStatusDefinition) SetGrouping(v string) {
c.Grouping = &v
}
// GetTime returns the Time field if non-nil, zero value otherwise.
func (c *CheckStatusDefinition) GetTime() WidgetTime {
if c == nil || c.Time == nil {
return WidgetTime{}
}
return *c.Time
}
// GetTimeOk returns a tuple with the Time field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (c *CheckStatusDefinition) GetTimeOk() (WidgetTime, bool) {
if c == nil || c.Time == nil {
return WidgetTime{}, false
}
return *c.Time, true
}
// HasTime returns a boolean if a field has been set.
func (c *CheckStatusDefinition) HasTime() bool {
if c != nil && c.Time != nil {
return true
}
return false
}
// SetTime allocates a new c.Time and returns the pointer to it.
func (c *CheckStatusDefinition) SetTime(v WidgetTime) {
c.Time = &v
}
// GetTitle returns the Title field if non-nil, zero value otherwise.
func (c *CheckStatusDefinition) GetTitle() string {
if c == nil || c.Title == nil {
return ""
}
return *c.Title
}
// GetTitleOk returns a tuple with the Title field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (c *CheckStatusDefinition) GetTitleOk() (string, bool) {
if c == nil || c.Title == nil {
return "", false
}
return *c.Title, true
}
// HasTitle returns a boolean if a field has been set.
func (c *CheckStatusDefinition) HasTitle() bool {
if c != nil && c.Title != nil {
return true
}
return false
}
// SetTitle allocates a new c.Title and returns the pointer to it.
func (c *CheckStatusDefinition) SetTitle(v string) {
c.Title = &v
}
// GetTitleAlign returns the TitleAlign field if non-nil, zero value otherwise.
func (c *CheckStatusDefinition) GetTitleAlign() string {
if c == nil || c.TitleAlign == nil {
return ""
}
return *c.TitleAlign
}
// GetTitleAlignOk returns a tuple with the TitleAlign field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (c *CheckStatusDefinition) GetTitleAlignOk() (string, bool) {
if c == nil || c.TitleAlign == nil {
return "", false
}
return *c.TitleAlign, true
}
// HasTitleAlign returns a boolean if a field has been set.
func (c *CheckStatusDefinition) HasTitleAlign() bool {
if c != nil && c.TitleAlign != nil {
return true
}
return false
}
// SetTitleAlign allocates a new c.TitleAlign and returns the pointer to it.
func (c *CheckStatusDefinition) SetTitleAlign(v string) {
c.TitleAlign = &v
}
// GetTitleSize returns the TitleSize field if non-nil, zero value otherwise.
func (c *CheckStatusDefinition) GetTitleSize() string {
if c == nil || c.TitleSize == nil {
return ""
}
return *c.TitleSize
}
// GetTitleSizeOk returns a tuple with the TitleSize field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (c *CheckStatusDefinition) GetTitleSizeOk() (string, bool) {
if c == nil || c.TitleSize == nil {
return "", false
}
return *c.TitleSize, true
}
// HasTitleSize returns a boolean if a field has been set.
func (c *CheckStatusDefinition) HasTitleSize() bool {
if c != nil && c.TitleSize != nil {
return true
}
return false
}
// SetTitleSize allocates a new c.TitleSize and returns the pointer to it.
func (c *CheckStatusDefinition) SetTitleSize(v string) {
c.TitleSize = &v
}
// GetType returns the Type field if non-nil, zero value otherwise.
func (c *CheckStatusDefinition) GetType() string {
if c == nil || c.Type == nil {
return ""
}
return *c.Type
}
// GetTypeOk returns a tuple with the Type field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (c *CheckStatusDefinition) GetTypeOk() (string, bool) {
if c == nil || c.Type == nil {
return "", false
}
return *c.Type, true
}
// HasType returns a boolean if a field has been set.
func (c *CheckStatusDefinition) HasType() bool {
if c != nil && c.Type != nil {
return true
}
return false
}
// SetType allocates a new c.Type and returns the pointer to it.
func (c *CheckStatusDefinition) SetType(v string) {
c.Type = &v
}
// GetHandle returns the Handle field if non-nil, zero value otherwise.
func (c *Comment) GetHandle() string {
if c == nil || c.Handle == nil {
return ""
}
return *c.Handle
}
// GetHandleOk returns a tuple with the Handle field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (c *Comment) GetHandleOk() (string, bool) {
if c == nil || c.Handle == nil {
return "", false
}
return *c.Handle, true
}
// HasHandle returns a boolean if a field has been set.
func (c *Comment) HasHandle() bool {
if c != nil && c.Handle != nil {
return true
}
return false
}
// SetHandle allocates a new c.Handle and returns the pointer to it.
func (c *Comment) SetHandle(v string) {
c.Handle = &v
}
// GetId returns the Id field if non-nil, zero value otherwise.
func (c *Comment) GetId() int {
if c == nil || c.Id == nil {
return 0
}
return *c.Id
}
// GetIdOk returns a tuple with the Id field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (c *Comment) GetIdOk() (int, bool) {
if c == nil || c.Id == nil {
return 0, false
}
return *c.Id, true
}
// HasId returns a boolean if a field has been set.
func (c *Comment) HasId() bool {
if c != nil && c.Id != nil {
return true
}
return false
}
// SetId allocates a new c.Id and returns the pointer to it.
func (c *Comment) SetId(v int) {
c.Id = &v
}
// GetMessage returns the Message field if non-nil, zero value otherwise.
func (c *Comment) GetMessage() string {
if c == nil || c.Message == nil {
return ""
}
return *c.Message
}
// GetMessageOk returns a tuple with the Message field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (c *Comment) GetMessageOk() (string, bool) {
if c == nil || c.Message == nil {
return "", false
}
return *c.Message, true
}
// HasMessage returns a boolean if a field has been set.
func (c *Comment) HasMessage() bool {
if c != nil && c.Message != nil {
return true
}
return false
}
// SetMessage allocates a new c.Message and returns the pointer to it.
func (c *Comment) SetMessage(v string) {
c.Message = &v
}
// GetRelatedId returns the RelatedId field if non-nil, zero value otherwise.
func (c *Comment) GetRelatedId() int {
if c == nil || c.RelatedId == nil {
return 0
}
return *c.RelatedId
}
// GetRelatedIdOk returns a tuple with the RelatedId field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (c *Comment) GetRelatedIdOk() (int, bool) {
if c == nil || c.RelatedId == nil {
return 0, false
}
return *c.RelatedId, true
}
// HasRelatedId returns a boolean if a field has been set.
func (c *Comment) HasRelatedId() bool {
if c != nil && c.RelatedId != nil {
return true
}
return false
}
// SetRelatedId allocates a new c.RelatedId and returns the pointer to it.
func (c *Comment) SetRelatedId(v int) {
c.RelatedId = &v
}
// GetResource returns the Resource field if non-nil, zero value otherwise.
func (c *Comment) GetResource() string {
if c == nil || c.Resource == nil {
return ""
}
return *c.Resource
}
// GetResourceOk returns a tuple with the Resource field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (c *Comment) GetResourceOk() (string, bool) {
if c == nil || c.Resource == nil {
return "", false
}
return *c.Resource, true
}
// HasResource returns a boolean if a field has been set.
func (c *Comment) HasResource() bool {
if c != nil && c.Resource != nil {
return true
}
return false
}
// SetResource allocates a new c.Resource and returns the pointer to it.
func (c *Comment) SetResource(v string) {
c.Resource = &v
}
// GetUrl returns the Url field if non-nil, zero value otherwise.
func (c *Comment) GetUrl() string {
if c == nil || c.Url == nil {
return ""
}
return *c.Url
}
// GetUrlOk returns a tuple with the Url field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (c *Comment) GetUrlOk() (string, bool) {
if c == nil || c.Url == nil {
return "", false
}
return *c.Url, true
}
// HasUrl returns a boolean if a field has been set.
func (c *Comment) HasUrl() bool {
if c != nil && c.Url != nil {
return true
}
return false
}
// SetUrl allocates a new c.Url and returns the pointer to it.
func (c *Comment) SetUrl(v string) {
c.Url = &v
}
// GetColor returns the Color field if non-nil, zero value otherwise.
func (c *ConditionalFormat) GetColor() string {
if c == nil || c.Color == nil {
return ""
}
return *c.Color
}
// GetColorOk returns a tuple with the Color field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (c *ConditionalFormat) GetColorOk() (string, bool) {
if c == nil || c.Color == nil {
return "", false
}
return *c.Color, true
}
// HasColor returns a boolean if a field has been set.
func (c *ConditionalFormat) HasColor() bool {
if c != nil && c.Color != nil {
return true
}
return false
}
// SetColor allocates a new c.Color and returns the pointer to it.
func (c *ConditionalFormat) SetColor(v string) {
c.Color = &v
}
// GetComparator returns the Comparator field if non-nil, zero value otherwise.
func (c *ConditionalFormat) GetComparator() string {
if c == nil || c.Comparator == nil {
return ""
}
return *c.Comparator
}
// GetComparatorOk returns a tuple with the Comparator field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (c *ConditionalFormat) GetComparatorOk() (string, bool) {
if c == nil || c.Comparator == nil {
return "", false
}
return *c.Comparator, true
}
// HasComparator returns a boolean if a field has been set.
func (c *ConditionalFormat) HasComparator() bool {
if c != nil && c.Comparator != nil {
return true
}
return false
}
// SetComparator allocates a new c.Comparator and returns the pointer to it.
func (c *ConditionalFormat) SetComparator(v string) {
c.Comparator = &v
}
// GetCustomBgColor returns the CustomBgColor field if non-nil, zero value otherwise.
func (c *ConditionalFormat) GetCustomBgColor() string {
if c == nil || c.CustomBgColor == nil {
return ""
}
return *c.CustomBgColor
}
// GetCustomBgColorOk returns a tuple with the CustomBgColor field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (c *ConditionalFormat) GetCustomBgColorOk() (string, bool) {
if c == nil || c.CustomBgColor == nil {
return "", false
}
return *c.CustomBgColor, true
}
// HasCustomBgColor returns a boolean if a field has been set.
func (c *ConditionalFormat) HasCustomBgColor() bool {
if c != nil && c.CustomBgColor != nil {
return true
}
return false
}
// SetCustomBgColor allocates a new c.CustomBgColor and returns the pointer to it.
func (c *ConditionalFormat) SetCustomBgColor(v string) {
c.CustomBgColor = &v
}
// GetImageURL returns the ImageURL field if non-nil, zero value otherwise.
func (c *ConditionalFormat) GetImageURL() string {
if c == nil || c.ImageURL == nil {
return ""
}
return *c.ImageURL
}
// GetImageURLOk returns a tuple with the ImageURL field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (c *ConditionalFormat) GetImageURLOk() (string, bool) {
if c == nil || c.ImageURL == nil {
return "", false
}
return *c.ImageURL, true
}
// HasImageURL returns a boolean if a field has been set.
func (c *ConditionalFormat) HasImageURL() bool {
if c != nil && c.ImageURL != nil {
return true
}
return false
}
// SetImageURL allocates a new c.ImageURL and returns the pointer to it.
func (c *ConditionalFormat) SetImageURL(v string) {
c.ImageURL = &v
}
// GetInvert returns the Invert field if non-nil, zero value otherwise.
func (c *ConditionalFormat) GetInvert() bool {
if c == nil || c.Invert == nil {
return false
}
return *c.Invert
}
// GetInvertOk returns a tuple with the Invert field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (c *ConditionalFormat) GetInvertOk() (bool, bool) {
if c == nil || c.Invert == nil {
return false, false
}
return *c.Invert, true
}
// HasInvert returns a boolean if a field has been set.
func (c *ConditionalFormat) HasInvert() bool {
if c != nil && c.Invert != nil {
return true
}
return false
}
// SetInvert allocates a new c.Invert and returns the pointer to it.
func (c *ConditionalFormat) SetInvert(v bool) {
c.Invert = &v
}
// GetPalette returns the Palette field if non-nil, zero value otherwise.
func (c *ConditionalFormat) GetPalette() string {
if c == nil || c.Palette == nil {
return ""
}
return *c.Palette
}
// GetPaletteOk returns a tuple with the Palette field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (c *ConditionalFormat) GetPaletteOk() (string, bool) {
if c == nil || c.Palette == nil {
return "", false
}
return *c.Palette, true
}
// HasPalette returns a boolean if a field has been set.
func (c *ConditionalFormat) HasPalette() bool {
if c != nil && c.Palette != nil {
return true
}
return false
}
// SetPalette allocates a new c.Palette and returns the pointer to it.
func (c *ConditionalFormat) SetPalette(v string) {
c.Palette = &v
}
// GetValue returns the Value field if non-nil, zero value otherwise.
func (c *ConditionalFormat) GetValue() string {
if c == nil || c.Value == nil {
return ""
}
return *c.Value
}
// GetValueOk returns a tuple with the Value field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (c *ConditionalFormat) GetValueOk() (string, bool) {
if c == nil || c.Value == nil {
return "", false
}
return *c.Value, true
}
// HasValue returns a boolean if a field has been set.
func (c *ConditionalFormat) HasValue() bool {
if c != nil && c.Value != nil {
return true
}
return false
}
// SetValue allocates a new c.Value and returns the pointer to it.
func (c *ConditionalFormat) SetValue(v string) {
c.Value = &v
}
// GetAccessRole returns the AccessRole field if non-nil, zero value otherwise.
func (c *CreatedBy) GetAccessRole() string {
if c == nil || c.AccessRole == nil {
return ""
}
return *c.AccessRole
}
// GetAccessRoleOk returns a tuple with the AccessRole field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (c *CreatedBy) GetAccessRoleOk() (string, bool) {
if c == nil || c.AccessRole == nil {
return "", false
}
return *c.AccessRole, true
}
// HasAccessRole returns a boolean if a field has been set.
func (c *CreatedBy) HasAccessRole() bool {
if c != nil && c.AccessRole != nil {
return true
}
return false
}
// SetAccessRole allocates a new c.AccessRole and returns the pointer to it.
func (c *CreatedBy) SetAccessRole(v string) {
c.AccessRole = &v
}
// GetDisabled returns the Disabled field if non-nil, zero value otherwise.
func (c *CreatedBy) GetDisabled() bool {
if c == nil || c.Disabled == nil {
return false
}
return *c.Disabled
}
// GetDisabledOk returns a tuple with the Disabled field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (c *CreatedBy) GetDisabledOk() (bool, bool) {
if c == nil || c.Disabled == nil {
return false, false
}
return *c.Disabled, true
}
// HasDisabled returns a boolean if a field has been set.
func (c *CreatedBy) HasDisabled() bool {
if c != nil && c.Disabled != nil {
return true
}
return false
}
// SetDisabled allocates a new c.Disabled and returns the pointer to it.
func (c *CreatedBy) SetDisabled(v bool) {
c.Disabled = &v
}
// GetEmail returns the Email field if non-nil, zero value otherwise.
func (c *CreatedBy) GetEmail() string {
if c == nil || c.Email == nil {
return ""
}
return *c.Email
}
// GetEmailOk returns a tuple with the Email field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (c *CreatedBy) GetEmailOk() (string, bool) {
if c == nil || c.Email == nil {
return "", false
}
return *c.Email, true
}
// HasEmail returns a boolean if a field has been set.
func (c *CreatedBy) HasEmail() bool {
if c != nil && c.Email != nil {
return true
}
return false
}
// SetEmail allocates a new c.Email and returns the pointer to it.
func (c *CreatedBy) SetEmail(v string) {
c.Email = &v
}
// GetHandle returns the Handle field if non-nil, zero value otherwise.
func (c *CreatedBy) GetHandle() string {
if c == nil || c.Handle == nil {
return ""
}
return *c.Handle
}
// GetHandleOk returns a tuple with the Handle field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (c *CreatedBy) GetHandleOk() (string, bool) {
if c == nil || c.Handle == nil {
return "", false
}
return *c.Handle, true
}
// HasHandle returns a boolean if a field has been set.
func (c *CreatedBy) HasHandle() bool {
if c != nil && c.Handle != nil {
return true
}
return false
}
// SetHandle allocates a new c.Handle and returns the pointer to it.
func (c *CreatedBy) SetHandle(v string) {
c.Handle = &v
}
// GetIcon returns the Icon field if non-nil, zero value otherwise.
func (c *CreatedBy) GetIcon() string {
if c == nil || c.Icon == nil {
return ""
}
return *c.Icon
}
// GetIconOk returns a tuple with the Icon field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (c *CreatedBy) GetIconOk() (string, bool) {
if c == nil || c.Icon == nil {
return "", false
}
return *c.Icon, true
}
// HasIcon returns a boolean if a field has been set.
func (c *CreatedBy) HasIcon() bool {
if c != nil && c.Icon != nil {
return true
}
return false
}
// SetIcon allocates a new c.Icon and returns the pointer to it.
func (c *CreatedBy) SetIcon(v string) {
c.Icon = &v
}
// GetIsAdmin returns the IsAdmin field if non-nil, zero value otherwise.
func (c *CreatedBy) GetIsAdmin() bool {
if c == nil || c.IsAdmin == nil {
return false
}
return *c.IsAdmin
}
// GetIsAdminOk returns a tuple with the IsAdmin field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (c *CreatedBy) GetIsAdminOk() (bool, bool) {
if c == nil || c.IsAdmin == nil {
return false, false
}
return *c.IsAdmin, true
}
// HasIsAdmin returns a boolean if a field has been set.
func (c *CreatedBy) HasIsAdmin() bool {
if c != nil && c.IsAdmin != nil {
return true
}
return false
}
// SetIsAdmin allocates a new c.IsAdmin and returns the pointer to it.
func (c *CreatedBy) SetIsAdmin(v bool) {
c.IsAdmin = &v
}
// GetName returns the Name field if non-nil, zero value otherwise.
func (c *CreatedBy) GetName() string {
if c == nil || c.Name == nil {
return ""
}
return *c.Name
}
// GetNameOk returns a tuple with the Name field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (c *CreatedBy) GetNameOk() (string, bool) {
if c == nil || c.Name == nil {
return "", false
}
return *c.Name, true
}
// HasName returns a boolean if a field has been set.
func (c *CreatedBy) HasName() bool {
if c != nil && c.Name != nil {
return true
}
return false
}
// SetName allocates a new c.Name and returns the pointer to it.
func (c *CreatedBy) SetName(v string) {
c.Name = &v
}
// GetRole returns the Role field if non-nil, zero value otherwise.
func (c *CreatedBy) GetRole() string {
if c == nil || c.Role == nil {
return ""
}
return *c.Role
}
// GetRoleOk returns a tuple with the Role field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (c *CreatedBy) GetRoleOk() (string, bool) {
if c == nil || c.Role == nil {
return "", false
}
return *c.Role, true
}
// HasRole returns a boolean if a field has been set.
func (c *CreatedBy) HasRole() bool {
if c != nil && c.Role != nil {
return true
}
return false
}
// SetRole allocates a new c.Role and returns the pointer to it.
func (c *CreatedBy) SetRole(v string) {
c.Role = &v
}
// GetVerified returns the Verified field if non-nil, zero value otherwise.
func (c *CreatedBy) GetVerified() bool {
if c == nil || c.Verified == nil {
return false
}
return *c.Verified
}
// GetVerifiedOk returns a tuple with the Verified field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (c *CreatedBy) GetVerifiedOk() (bool, bool) {
if c == nil || c.Verified == nil {
return false, false
}
return *c.Verified, true
}
// HasVerified returns a boolean if a field has been set.
func (c *CreatedBy) HasVerified() bool {
if c != nil && c.Verified != nil {
return true
}
return false
}
// SetVerified allocates a new c.Verified and returns the pointer to it.
func (c *CreatedBy) SetVerified(v bool) {
c.Verified = &v
}
// GetEmail returns the Email field if non-nil, zero value otherwise.
func (c *Creator) GetEmail() string {
if c == nil || c.Email == nil {
return ""
}
return *c.Email
}
// GetEmailOk returns a tuple with the Email field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (c *Creator) GetEmailOk() (string, bool) {
if c == nil || c.Email == nil {
return "", false
}
return *c.Email, true
}
// HasEmail returns a boolean if a field has been set.
func (c *Creator) HasEmail() bool {
if c != nil && c.Email != nil {
return true
}
return false
}
// SetEmail allocates a new c.Email and returns the pointer to it.
func (c *Creator) SetEmail(v string) {
c.Email = &v
}
// GetHandle returns the Handle field if non-nil, zero value otherwise.
func (c *Creator) GetHandle() string {
if c == nil || c.Handle == nil {
return ""
}
return *c.Handle
}
// GetHandleOk returns a tuple with the Handle field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (c *Creator) GetHandleOk() (string, bool) {
if c == nil || c.Handle == nil {
return "", false
}
return *c.Handle, true
}
// HasHandle returns a boolean if a field has been set.
func (c *Creator) HasHandle() bool {
if c != nil && c.Handle != nil {
return true
}
return false
}
// SetHandle allocates a new c.Handle and returns the pointer to it.
func (c *Creator) SetHandle(v string) {
c.Handle = &v
}
// GetId returns the Id field if non-nil, zero value otherwise.
func (c *Creator) GetId() int {
if c == nil || c.Id == nil {
return 0
}
return *c.Id
}
// GetIdOk returns a tuple with the Id field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (c *Creator) GetIdOk() (int, bool) {
if c == nil || c.Id == nil {
return 0, false
}
return *c.Id, true
}
// HasId returns a boolean if a field has been set.
func (c *Creator) HasId() bool {
if c != nil && c.Id != nil {
return true
}
return false
}
// SetId allocates a new c.Id and returns the pointer to it.
func (c *Creator) SetId(v int) {
c.Id = &v
}
// GetName returns the Name field if non-nil, zero value otherwise.
func (c *Creator) GetName() string {
if c == nil || c.Name == nil {
return ""
}
return *c.Name
}
// GetNameOk returns a tuple with the Name field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (c *Creator) GetNameOk() (string, bool) {
if c == nil || c.Name == nil {
return "", false
}
return *c.Name, true
}
// HasName returns a boolean if a field has been set.
func (c *Creator) HasName() bool {
if c != nil && c.Name != nil {
return true
}
return false
}
// SetName allocates a new c.Name and returns the pointer to it.
func (c *Creator) SetName(v string) {
c.Name = &v
}
// GetDescription returns the Description field if non-nil, zero value otherwise.
func (d *Dashboard) GetDescription() string {
if d == nil || d.Description == nil {
return ""
}
return *d.Description
}
// GetDescriptionOk returns a tuple with the Description field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (d *Dashboard) GetDescriptionOk() (string, bool) {
if d == nil || d.Description == nil {
return "", false
}
return *d.Description, true
}
// HasDescription returns a boolean if a field has been set.
func (d *Dashboard) HasDescription() bool {
if d != nil && d.Description != nil {
return true
}
return false
}
// SetDescription allocates a new d.Description and returns the pointer to it.
func (d *Dashboard) SetDescription(v string) {
d.Description = &v
}
// GetId returns the Id field if non-nil, zero value otherwise.
func (d *Dashboard) GetId() int {
if d == nil || d.Id == nil {
return 0
}
return *d.Id
}
// GetIdOk returns a tuple with the Id field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (d *Dashboard) GetIdOk() (int, bool) {
if d == nil || d.Id == nil {
return 0, false
}
return *d.Id, true
}
// HasId returns a boolean if a field has been set.
func (d *Dashboard) HasId() bool {
if d != nil && d.Id != nil {
return true
}
return false
}
// SetId allocates a new d.Id and returns the pointer to it.
func (d *Dashboard) SetId(v int) {
d.Id = &v
}
// GetNewId returns the NewId field if non-nil, zero value otherwise.
func (d *Dashboard) GetNewId() string {
if d == nil || d.NewId == nil {
return ""
}
return *d.NewId
}
// GetNewIdOk returns a tuple with the NewId field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (d *Dashboard) GetNewIdOk() (string, bool) {
if d == nil || d.NewId == nil {
return "", false
}
return *d.NewId, true
}
// HasNewId returns a boolean if a field has been set.
func (d *Dashboard) HasNewId() bool {
if d != nil && d.NewId != nil {
return true
}
return false
}
// SetNewId allocates a new d.NewId and returns the pointer to it.
func (d *Dashboard) SetNewId(v string) {
d.NewId = &v
}
// GetReadOnly returns the ReadOnly field if non-nil, zero value otherwise.
func (d *Dashboard) GetReadOnly() bool {
if d == nil || d.ReadOnly == nil {
return false
}
return *d.ReadOnly
}
// GetReadOnlyOk returns a tuple with the ReadOnly field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (d *Dashboard) GetReadOnlyOk() (bool, bool) {
if d == nil || d.ReadOnly == nil {
return false, false
}
return *d.ReadOnly, true
}
// HasReadOnly returns a boolean if a field has been set.
func (d *Dashboard) HasReadOnly() bool {
if d != nil && d.ReadOnly != nil {
return true
}
return false
}
// SetReadOnly allocates a new d.ReadOnly and returns the pointer to it.
func (d *Dashboard) SetReadOnly(v bool) {
d.ReadOnly = &v
}
// GetTitle returns the Title field if non-nil, zero value otherwise.
func (d *Dashboard) GetTitle() string {
if d == nil || d.Title == nil {
return ""
}
return *d.Title
}
// GetTitleOk returns a tuple with the Title field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (d *Dashboard) GetTitleOk() (string, bool) {
if d == nil || d.Title == nil {
return "", false
}
return *d.Title, true
}
// HasTitle returns a boolean if a field has been set.
func (d *Dashboard) HasTitle() bool {
if d != nil && d.Title != nil {
return true
}
return false
}
// SetTitle allocates a new d.Title and returns the pointer to it.
func (d *Dashboard) SetTitle(v string) {
d.Title = &v
}
// GetComparator returns the Comparator field if non-nil, zero value otherwise.
func (d *DashboardConditionalFormat) GetComparator() string {
if d == nil || d.Comparator == nil {
return ""
}
return *d.Comparator
}
// GetComparatorOk returns a tuple with the Comparator field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (d *DashboardConditionalFormat) GetComparatorOk() (string, bool) {
if d == nil || d.Comparator == nil {
return "", false
}
return *d.Comparator, true
}
// HasComparator returns a boolean if a field has been set.
func (d *DashboardConditionalFormat) HasComparator() bool {
if d != nil && d.Comparator != nil {
return true
}
return false
}
// SetComparator allocates a new d.Comparator and returns the pointer to it.
func (d *DashboardConditionalFormat) SetComparator(v string) {
d.Comparator = &v
}
// GetCustomBgColor returns the CustomBgColor field if non-nil, zero value otherwise.
func (d *DashboardConditionalFormat) GetCustomBgColor() string {
if d == nil || d.CustomBgColor == nil {
return ""
}
return *d.CustomBgColor
}
// GetCustomBgColorOk returns a tuple with the CustomBgColor field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (d *DashboardConditionalFormat) GetCustomBgColorOk() (string, bool) {
if d == nil || d.CustomBgColor == nil {
return "", false
}
return *d.CustomBgColor, true
}
// HasCustomBgColor returns a boolean if a field has been set.
func (d *DashboardConditionalFormat) HasCustomBgColor() bool {
if d != nil && d.CustomBgColor != nil {
return true
}
return false
}
// SetCustomBgColor allocates a new d.CustomBgColor and returns the pointer to it.
func (d *DashboardConditionalFormat) SetCustomBgColor(v string) {
d.CustomBgColor = &v
}
// GetCustomFgColor returns the CustomFgColor field if non-nil, zero value otherwise.
func (d *DashboardConditionalFormat) GetCustomFgColor() string {
if d == nil || d.CustomFgColor == nil {
return ""
}
return *d.CustomFgColor
}
// GetCustomFgColorOk returns a tuple with the CustomFgColor field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (d *DashboardConditionalFormat) GetCustomFgColorOk() (string, bool) {
if d == nil || d.CustomFgColor == nil {
return "", false
}
return *d.CustomFgColor, true
}
// HasCustomFgColor returns a boolean if a field has been set.
func (d *DashboardConditionalFormat) HasCustomFgColor() bool {
if d != nil && d.CustomFgColor != nil {
return true
}
return false
}
// SetCustomFgColor allocates a new d.CustomFgColor and returns the pointer to it.
func (d *DashboardConditionalFormat) SetCustomFgColor(v string) {
d.CustomFgColor = &v
}
// GetCustomImageUrl returns the CustomImageUrl field if non-nil, zero value otherwise.
func (d *DashboardConditionalFormat) GetCustomImageUrl() string {
if d == nil || d.CustomImageUrl == nil {
return ""
}
return *d.CustomImageUrl
}
// GetCustomImageUrlOk returns a tuple with the CustomImageUrl field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (d *DashboardConditionalFormat) GetCustomImageUrlOk() (string, bool) {
if d == nil || d.CustomImageUrl == nil {
return "", false
}
return *d.CustomImageUrl, true
}
// HasCustomImageUrl returns a boolean if a field has been set.
func (d *DashboardConditionalFormat) HasCustomImageUrl() bool {
if d != nil && d.CustomImageUrl != nil {
return true
}
return false
}
// SetCustomImageUrl allocates a new d.CustomImageUrl and returns the pointer to it.
func (d *DashboardConditionalFormat) SetCustomImageUrl(v string) {
d.CustomImageUrl = &v
}
// GetInverted returns the Inverted field if non-nil, zero value otherwise.
func (d *DashboardConditionalFormat) GetInverted() bool {
if d == nil || d.Inverted == nil {
return false
}
return *d.Inverted
}
// GetInvertedOk returns a tuple with the Inverted field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (d *DashboardConditionalFormat) GetInvertedOk() (bool, bool) {
if d == nil || d.Inverted == nil {
return false, false
}
return *d.Inverted, true
}
// HasInverted returns a boolean if a field has been set.
func (d *DashboardConditionalFormat) HasInverted() bool {
if d != nil && d.Inverted != nil {
return true
}
return false
}
// SetInverted allocates a new d.Inverted and returns the pointer to it.
func (d *DashboardConditionalFormat) SetInverted(v bool) {
d.Inverted = &v
}
// GetPalette returns the Palette field if non-nil, zero value otherwise.
func (d *DashboardConditionalFormat) GetPalette() string {
if d == nil || d.Palette == nil {
return ""
}
return *d.Palette
}
// GetPaletteOk returns a tuple with the Palette field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (d *DashboardConditionalFormat) GetPaletteOk() (string, bool) {
if d == nil || d.Palette == nil {
return "", false
}
return *d.Palette, true
}
// HasPalette returns a boolean if a field has been set.
func (d *DashboardConditionalFormat) HasPalette() bool {
if d != nil && d.Palette != nil {
return true
}
return false
}
// SetPalette allocates a new d.Palette and returns the pointer to it.
func (d *DashboardConditionalFormat) SetPalette(v string) {
d.Palette = &v
}
// GetValue returns the Value field if non-nil, zero value otherwise.
func (d *DashboardConditionalFormat) GetValue() json.Number {
if d == nil || d.Value == nil {
return ""
}
return *d.Value
}
// GetValueOk returns a tuple with the Value field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (d *DashboardConditionalFormat) GetValueOk() (json.Number, bool) {
if d == nil || d.Value == nil {
return "", false
}
return *d.Value, true
}
// HasValue returns a boolean if a field has been set.
func (d *DashboardConditionalFormat) HasValue() bool {
if d != nil && d.Value != nil {
return true
}
return false
}
// SetValue allocates a new d.Value and returns the pointer to it.
func (d *DashboardConditionalFormat) SetValue(v json.Number) {
d.Value = &v
}
// GetDashboardCount returns the DashboardCount field if non-nil, zero value otherwise.
func (d *DashboardList) GetDashboardCount() int {
if d == nil || d.DashboardCount == nil {
return 0
}
return *d.DashboardCount
}
// GetDashboardCountOk returns a tuple with the DashboardCount field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (d *DashboardList) GetDashboardCountOk() (int, bool) {
if d == nil || d.DashboardCount == nil {
return 0, false
}
return *d.DashboardCount, true
}
// HasDashboardCount returns a boolean if a field has been set.
func (d *DashboardList) HasDashboardCount() bool {
if d != nil && d.DashboardCount != nil {
return true
}
return false
}
// SetDashboardCount allocates a new d.DashboardCount and returns the pointer to it.
func (d *DashboardList) SetDashboardCount(v int) {
d.DashboardCount = &v
}
// GetId returns the Id field if non-nil, zero value otherwise.
func (d *DashboardList) GetId() int {
if d == nil || d.Id == nil {
return 0
}
return *d.Id
}
// GetIdOk returns a tuple with the Id field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (d *DashboardList) GetIdOk() (int, bool) {
if d == nil || d.Id == nil {
return 0, false
}
return *d.Id, true
}
// HasId returns a boolean if a field has been set.
func (d *DashboardList) HasId() bool {
if d != nil && d.Id != nil {
return true
}
return false
}
// SetId allocates a new d.Id and returns the pointer to it.
func (d *DashboardList) SetId(v int) {
d.Id = &v
}
// GetName returns the Name field if non-nil, zero value otherwise.
func (d *DashboardList) GetName() string {
if d == nil || d.Name == nil {
return ""
}
return *d.Name
}
// GetNameOk returns a tuple with the Name field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (d *DashboardList) GetNameOk() (string, bool) {
if d == nil || d.Name == nil {
return "", false
}
return *d.Name, true
}
// HasName returns a boolean if a field has been set.
func (d *DashboardList) HasName() bool {
if d != nil && d.Name != nil {
return true
}
return false
}
// SetName allocates a new d.Name and returns the pointer to it.
func (d *DashboardList) SetName(v string) {
d.Name = &v
}
// GetId returns the Id field if non-nil, zero value otherwise.
func (d *DashboardListItem) GetId() int {
if d == nil || d.Id == nil {
return 0
}
return *d.Id
}
// GetIdOk returns a tuple with the Id field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (d *DashboardListItem) GetIdOk() (int, bool) {
if d == nil || d.Id == nil {
return 0, false
}
return *d.Id, true
}
// HasId returns a boolean if a field has been set.
func (d *DashboardListItem) HasId() bool {
if d != nil && d.Id != nil {
return true
}
return false
}
// SetId allocates a new d.Id and returns the pointer to it.
func (d *DashboardListItem) SetId(v int) {
d.Id = &v
}
// GetType returns the Type field if non-nil, zero value otherwise.
func (d *DashboardListItem) GetType() string {
if d == nil || d.Type == nil {
return ""
}
return *d.Type
}
// GetTypeOk returns a tuple with the Type field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (d *DashboardListItem) GetTypeOk() (string, bool) {
if d == nil || d.Type == nil {
return "", false
}
return *d.Type, true
}
// HasType returns a boolean if a field has been set.
func (d *DashboardListItem) HasType() bool {
if d != nil && d.Type != nil {
return true
}
return false
}
// SetType allocates a new d.Type and returns the pointer to it.
func (d *DashboardListItem) SetType(v string) {
d.Type = &v
}
// GetID returns the ID field if non-nil, zero value otherwise.
func (d *DashboardListItemV2) GetID() string {
if d == nil || d.ID == nil {
return ""
}
return *d.ID
}
// GetIDOk returns a tuple with the ID field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (d *DashboardListItemV2) GetIDOk() (string, bool) {
if d == nil || d.ID == nil {
return "", false
}
return *d.ID, true
}
// HasID returns a boolean if a field has been set.
func (d *DashboardListItemV2) HasID() bool {
if d != nil && d.ID != nil {
return true
}
return false
}
// SetID allocates a new d.ID and returns the pointer to it.
func (d *DashboardListItemV2) SetID(v string) {
d.ID = &v
}
// GetType returns the Type field if non-nil, zero value otherwise.
func (d *DashboardListItemV2) GetType() string {
if d == nil || d.Type == nil {
return ""
}
return *d.Type
}
// GetTypeOk returns a tuple with the Type field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (d *DashboardListItemV2) GetTypeOk() (string, bool) {
if d == nil || d.Type == nil {
return "", false
}
return *d.Type, true
}
// HasType returns a boolean if a field has been set.
func (d *DashboardListItemV2) HasType() bool {
if d != nil && d.Type != nil {
return true
}
return false
}
// SetType allocates a new d.Type and returns the pointer to it.
func (d *DashboardListItemV2) SetType(v string) {
d.Type = &v
}
// GetCreated returns the Created field if non-nil, zero value otherwise.
func (d *DashboardLite) GetCreated() string {
if d == nil || d.Created == nil {
return ""
}
return *d.Created
}
// GetCreatedOk returns a tuple with the Created field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (d *DashboardLite) GetCreatedOk() (string, bool) {
if d == nil || d.Created == nil {
return "", false
}
return *d.Created, true
}
// HasCreated returns a boolean if a field has been set.
func (d *DashboardLite) HasCreated() bool {
if d != nil && d.Created != nil {
return true
}
return false
}
// SetCreated allocates a new d.Created and returns the pointer to it.
func (d *DashboardLite) SetCreated(v string) {
d.Created = &v
}
// GetCreatedBy returns the CreatedBy field if non-nil, zero value otherwise.
func (d *DashboardLite) GetCreatedBy() CreatedBy {
if d == nil || d.CreatedBy == nil {
return CreatedBy{}
}
return *d.CreatedBy
}
// GetCreatedByOk returns a tuple with the CreatedBy field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (d *DashboardLite) GetCreatedByOk() (CreatedBy, bool) {
if d == nil || d.CreatedBy == nil {
return CreatedBy{}, false
}
return *d.CreatedBy, true
}
// HasCreatedBy returns a boolean if a field has been set.
func (d *DashboardLite) HasCreatedBy() bool {
if d != nil && d.CreatedBy != nil {
return true
}
return false
}
// SetCreatedBy allocates a new d.CreatedBy and returns the pointer to it.
func (d *DashboardLite) SetCreatedBy(v CreatedBy) {
d.CreatedBy = &v
}
// GetDescription returns the Description field if non-nil, zero value otherwise.
func (d *DashboardLite) GetDescription() string {
if d == nil || d.Description == nil {
return ""
}
return *d.Description
}
// GetDescriptionOk returns a tuple with the Description field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (d *DashboardLite) GetDescriptionOk() (string, bool) {
if d == nil || d.Description == nil {
return "", false
}
return *d.Description, true
}
// HasDescription returns a boolean if a field has been set.
func (d *DashboardLite) HasDescription() bool {
if d != nil && d.Description != nil {
return true
}
return false
}
// SetDescription allocates a new d.Description and returns the pointer to it.
func (d *DashboardLite) SetDescription(v string) {
d.Description = &v
}
// GetId returns the Id field if non-nil, zero value otherwise.
func (d *DashboardLite) GetId() int {
if d == nil || d.Id == nil {
return 0
}
return *d.Id
}
// GetIdOk returns a tuple with the Id field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (d *DashboardLite) GetIdOk() (int, bool) {
if d == nil || d.Id == nil {
return 0, false
}
return *d.Id, true
}
// HasId returns a boolean if a field has been set.
func (d *DashboardLite) HasId() bool {
if d != nil && d.Id != nil {
return true
}
return false
}
// SetId allocates a new d.Id and returns the pointer to it.
func (d *DashboardLite) SetId(v int) {
d.Id = &v
}
// GetModified returns the Modified field if non-nil, zero value otherwise.
func (d *DashboardLite) GetModified() string {
if d == nil || d.Modified == nil {
return ""
}
return *d.Modified
}
// GetModifiedOk returns a tuple with the Modified field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (d *DashboardLite) GetModifiedOk() (string, bool) {
if d == nil || d.Modified == nil {
return "", false
}
return *d.Modified, true
}
// HasModified returns a boolean if a field has been set.
func (d *DashboardLite) HasModified() bool {
if d != nil && d.Modified != nil {
return true
}
return false
}
// SetModified allocates a new d.Modified and returns the pointer to it.
func (d *DashboardLite) SetModified(v string) {
d.Modified = &v
}
// GetReadOnly returns the ReadOnly field if non-nil, zero value otherwise.
func (d *DashboardLite) GetReadOnly() bool {
if d == nil || d.ReadOnly == nil {
return false
}
return *d.ReadOnly
}
// GetReadOnlyOk returns a tuple with the ReadOnly field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (d *DashboardLite) GetReadOnlyOk() (bool, bool) {
if d == nil || d.ReadOnly == nil {
return false, false
}
return *d.ReadOnly, true
}
// HasReadOnly returns a boolean if a field has been set.
func (d *DashboardLite) HasReadOnly() bool {
if d != nil && d.ReadOnly != nil {
return true
}
return false
}
// SetReadOnly allocates a new d.ReadOnly and returns the pointer to it.
func (d *DashboardLite) SetReadOnly(v bool) {
d.ReadOnly = &v
}
// GetResource returns the Resource field if non-nil, zero value otherwise.
func (d *DashboardLite) GetResource() string {
if d == nil || d.Resource == nil {
return ""
}
return *d.Resource
}
// GetResourceOk returns a tuple with the Resource field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (d *DashboardLite) GetResourceOk() (string, bool) {
if d == nil || d.Resource == nil {
return "", false
}
return *d.Resource, true
}
// HasResource returns a boolean if a field has been set.
func (d *DashboardLite) HasResource() bool {
if d != nil && d.Resource != nil {
return true
}
return false
}
// SetResource allocates a new d.Resource and returns the pointer to it.
func (d *DashboardLite) SetResource(v string) {
d.Resource = &v
}
// GetTitle returns the Title field if non-nil, zero value otherwise.
func (d *DashboardLite) GetTitle() string {
if d == nil || d.Title == nil {
return ""
}
return *d.Title
}
// GetTitleOk returns a tuple with the Title field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (d *DashboardLite) GetTitleOk() (string, bool) {
if d == nil || d.Title == nil {
return "", false
}
return *d.Title, true
}
// HasTitle returns a boolean if a field has been set.
func (d *DashboardLite) HasTitle() bool {
if d != nil && d.Title != nil {
return true
}
return false
}
// SetTitle allocates a new d.Title and returns the pointer to it.
func (d *DashboardLite) SetTitle(v string) {
d.Title = &v
}
// GetTime returns the Time field if non-nil, zero value otherwise.
func (d *DistributionDefinition) GetTime() WidgetTime {
if d == nil || d.Time == nil {
return WidgetTime{}
}
return *d.Time
}
// GetTimeOk returns a tuple with the Time field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (d *DistributionDefinition) GetTimeOk() (WidgetTime, bool) {
if d == nil || d.Time == nil {
return WidgetTime{}, false
}
return *d.Time, true
}
// HasTime returns a boolean if a field has been set.
func (d *DistributionDefinition) HasTime() bool {
if d != nil && d.Time != nil {
return true
}
return false
}
// SetTime allocates a new d.Time and returns the pointer to it.
func (d *DistributionDefinition) SetTime(v WidgetTime) {
d.Time = &v
}
// GetTitle returns the Title field if non-nil, zero value otherwise.
func (d *DistributionDefinition) GetTitle() string {
if d == nil || d.Title == nil {
return ""
}
return *d.Title
}
// GetTitleOk returns a tuple with the Title field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (d *DistributionDefinition) GetTitleOk() (string, bool) {
if d == nil || d.Title == nil {
return "", false
}
return *d.Title, true
}
// HasTitle returns a boolean if a field has been set.
func (d *DistributionDefinition) HasTitle() bool {
if d != nil && d.Title != nil {
return true
}
return false
}
// SetTitle allocates a new d.Title and returns the pointer to it.
func (d *DistributionDefinition) SetTitle(v string) {
d.Title = &v
}
// GetTitleAlign returns the TitleAlign field if non-nil, zero value otherwise.
func (d *DistributionDefinition) GetTitleAlign() string {
if d == nil || d.TitleAlign == nil {
return ""
}
return *d.TitleAlign
}
// GetTitleAlignOk returns a tuple with the TitleAlign field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (d *DistributionDefinition) GetTitleAlignOk() (string, bool) {
if d == nil || d.TitleAlign == nil {
return "", false
}
return *d.TitleAlign, true
}
// HasTitleAlign returns a boolean if a field has been set.
func (d *DistributionDefinition) HasTitleAlign() bool {
if d != nil && d.TitleAlign != nil {
return true
}
return false
}
// SetTitleAlign allocates a new d.TitleAlign and returns the pointer to it.
func (d *DistributionDefinition) SetTitleAlign(v string) {
d.TitleAlign = &v
}
// GetTitleSize returns the TitleSize field if non-nil, zero value otherwise.
func (d *DistributionDefinition) GetTitleSize() string {
if d == nil || d.TitleSize == nil {
return ""
}
return *d.TitleSize
}
// GetTitleSizeOk returns a tuple with the TitleSize field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (d *DistributionDefinition) GetTitleSizeOk() (string, bool) {
if d == nil || d.TitleSize == nil {
return "", false
}
return *d.TitleSize, true
}
// HasTitleSize returns a boolean if a field has been set.
func (d *DistributionDefinition) HasTitleSize() bool {
if d != nil && d.TitleSize != nil {
return true
}
return false
}
// SetTitleSize allocates a new d.TitleSize and returns the pointer to it.
func (d *DistributionDefinition) SetTitleSize(v string) {
d.TitleSize = &v
}
// GetType returns the Type field if non-nil, zero value otherwise.
func (d *DistributionDefinition) GetType() string {
if d == nil || d.Type == nil {
return ""
}
return *d.Type
}
// GetTypeOk returns a tuple with the Type field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (d *DistributionDefinition) GetTypeOk() (string, bool) {
if d == nil || d.Type == nil {
return "", false
}
return *d.Type, true
}
// HasType returns a boolean if a field has been set.
func (d *DistributionDefinition) HasType() bool {
if d != nil && d.Type != nil {
return true
}
return false
}
// SetType allocates a new d.Type and returns the pointer to it.
func (d *DistributionDefinition) SetType(v string) {
d.Type = &v
}
// GetApmQuery returns the ApmQuery field if non-nil, zero value otherwise.
func (d *DistributionRequest) GetApmQuery() WidgetApmOrLogQuery {
if d == nil || d.ApmQuery == nil {
return WidgetApmOrLogQuery{}
}
return *d.ApmQuery
}
// GetApmQueryOk returns a tuple with the ApmQuery field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (d *DistributionRequest) GetApmQueryOk() (WidgetApmOrLogQuery, bool) {
if d == nil || d.ApmQuery == nil {
return WidgetApmOrLogQuery{}, false
}
return *d.ApmQuery, true
}
// HasApmQuery returns a boolean if a field has been set.
func (d *DistributionRequest) HasApmQuery() bool {
if d != nil && d.ApmQuery != nil {
return true
}
return false
}
// SetApmQuery allocates a new d.ApmQuery and returns the pointer to it.
func (d *DistributionRequest) SetApmQuery(v WidgetApmOrLogQuery) {
d.ApmQuery = &v
}
// GetLogQuery returns the LogQuery field if non-nil, zero value otherwise.
func (d *DistributionRequest) GetLogQuery() WidgetApmOrLogQuery {
if d == nil || d.LogQuery == nil {
return WidgetApmOrLogQuery{}
}
return *d.LogQuery
}
// GetLogQueryOk returns a tuple with the LogQuery field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (d *DistributionRequest) GetLogQueryOk() (WidgetApmOrLogQuery, bool) {
if d == nil || d.LogQuery == nil {
return WidgetApmOrLogQuery{}, false
}
return *d.LogQuery, true
}
// HasLogQuery returns a boolean if a field has been set.
func (d *DistributionRequest) HasLogQuery() bool {
if d != nil && d.LogQuery != nil {
return true
}
return false
}
// SetLogQuery allocates a new d.LogQuery and returns the pointer to it.
func (d *DistributionRequest) SetLogQuery(v WidgetApmOrLogQuery) {
d.LogQuery = &v
}
// GetMetricQuery returns the MetricQuery field if non-nil, zero value otherwise.
func (d *DistributionRequest) GetMetricQuery() string {
if d == nil || d.MetricQuery == nil {
return ""
}
return *d.MetricQuery
}
// GetMetricQueryOk returns a tuple with the MetricQuery field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (d *DistributionRequest) GetMetricQueryOk() (string, bool) {
if d == nil || d.MetricQuery == nil {
return "", false
}
return *d.MetricQuery, true
}
// HasMetricQuery returns a boolean if a field has been set.
func (d *DistributionRequest) HasMetricQuery() bool {
if d != nil && d.MetricQuery != nil {
return true
}
return false
}
// SetMetricQuery allocates a new d.MetricQuery and returns the pointer to it.
func (d *DistributionRequest) SetMetricQuery(v string) {
d.MetricQuery = &v
}
// GetProcessQuery returns the ProcessQuery field if non-nil, zero value otherwise.
func (d *DistributionRequest) GetProcessQuery() WidgetProcessQuery {
if d == nil || d.ProcessQuery == nil {
return WidgetProcessQuery{}
}
return *d.ProcessQuery
}
// GetProcessQueryOk returns a tuple with the ProcessQuery field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (d *DistributionRequest) GetProcessQueryOk() (WidgetProcessQuery, bool) {
if d == nil || d.ProcessQuery == nil {
return WidgetProcessQuery{}, false
}
return *d.ProcessQuery, true
}
// HasProcessQuery returns a boolean if a field has been set.
func (d *DistributionRequest) HasProcessQuery() bool {
if d != nil && d.ProcessQuery != nil {
return true
}
return false
}
// SetProcessQuery allocates a new d.ProcessQuery and returns the pointer to it.
func (d *DistributionRequest) SetProcessQuery(v WidgetProcessQuery) {
d.ProcessQuery = &v
}
// GetStyle returns the Style field if non-nil, zero value otherwise.
func (d *DistributionRequest) GetStyle() WidgetRequestStyle {
if d == nil || d.Style == nil {
return WidgetRequestStyle{}
}
return *d.Style
}
// GetStyleOk returns a tuple with the Style field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (d *DistributionRequest) GetStyleOk() (WidgetRequestStyle, bool) {
if d == nil || d.Style == nil {
return WidgetRequestStyle{}, false
}
return *d.Style, true
}
// HasStyle returns a boolean if a field has been set.
func (d *DistributionRequest) HasStyle() bool {
if d != nil && d.Style != nil {
return true
}
return false
}
// SetStyle allocates a new d.Style and returns the pointer to it.
func (d *DistributionRequest) SetStyle(v WidgetRequestStyle) {
d.Style = &v
}
// GetActive returns the Active field if non-nil, zero value otherwise.
func (d *Downtime) GetActive() bool {
if d == nil || d.Active == nil {
return false
}
return *d.Active
}
// GetActiveOk returns a tuple with the Active field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (d *Downtime) GetActiveOk() (bool, bool) {
if d == nil || d.Active == nil {
return false, false
}
return *d.Active, true
}
// HasActive returns a boolean if a field has been set.
func (d *Downtime) HasActive() bool {
if d != nil && d.Active != nil {
return true
}
return false
}
// SetActive allocates a new d.Active and returns the pointer to it.
func (d *Downtime) SetActive(v bool) {
d.Active = &v
}
// GetCanceled returns the Canceled field if non-nil, zero value otherwise.
func (d *Downtime) GetCanceled() int {
if d == nil || d.Canceled == nil {
return 0
}
return *d.Canceled
}
// GetCanceledOk returns a tuple with the Canceled field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (d *Downtime) GetCanceledOk() (int, bool) {
if d == nil || d.Canceled == nil {
return 0, false
}
return *d.Canceled, true
}
// HasCanceled returns a boolean if a field has been set.
func (d *Downtime) HasCanceled() bool {
if d != nil && d.Canceled != nil {
return true
}
return false
}
// SetCanceled allocates a new d.Canceled and returns the pointer to it.
func (d *Downtime) SetCanceled(v int) {
d.Canceled = &v
}
// GetCreatorID returns the CreatorID field if non-nil, zero value otherwise.
func (d *Downtime) GetCreatorID() int {
if d == nil || d.CreatorID == nil {
return 0
}
return *d.CreatorID
}
// GetCreatorIDOk returns a tuple with the CreatorID field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (d *Downtime) GetCreatorIDOk() (int, bool) {
if d == nil || d.CreatorID == nil {
return 0, false
}
return *d.CreatorID, true
}
// HasCreatorID returns a boolean if a field has been set.
func (d *Downtime) HasCreatorID() bool {
if d != nil && d.CreatorID != nil {
return true
}
return false
}
// SetCreatorID allocates a new d.CreatorID and returns the pointer to it.
func (d *Downtime) SetCreatorID(v int) {
d.CreatorID = &v
}
// GetDisabled returns the Disabled field if non-nil, zero value otherwise.
func (d *Downtime) GetDisabled() bool {
if d == nil || d.Disabled == nil {
return false
}
return *d.Disabled
}
// GetDisabledOk returns a tuple with the Disabled field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (d *Downtime) GetDisabledOk() (bool, bool) {
if d == nil || d.Disabled == nil {
return false, false
}
return *d.Disabled, true
}
// HasDisabled returns a boolean if a field has been set.
func (d *Downtime) HasDisabled() bool {
if d != nil && d.Disabled != nil {
return true
}
return false
}
// SetDisabled allocates a new d.Disabled and returns the pointer to it.
func (d *Downtime) SetDisabled(v bool) {
d.Disabled = &v
}
// GetEnd returns the End field if non-nil, zero value otherwise.
func (d *Downtime) GetEnd() int {
if d == nil || d.End == nil {
return 0
}
return *d.End
}
// GetEndOk returns a tuple with the End field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (d *Downtime) GetEndOk() (int, bool) {
if d == nil || d.End == nil {
return 0, false
}
return *d.End, true
}
// HasEnd returns a boolean if a field has been set.
func (d *Downtime) HasEnd() bool {
if d != nil && d.End != nil {
return true
}
return false
}
// SetEnd allocates a new d.End and returns the pointer to it.
func (d *Downtime) SetEnd(v int) {
d.End = &v
}
// GetId returns the Id field if non-nil, zero value otherwise.
func (d *Downtime) GetId() int {
if d == nil || d.Id == nil {
return 0
}
return *d.Id
}
// GetIdOk returns a tuple with the Id field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (d *Downtime) GetIdOk() (int, bool) {
if d == nil || d.Id == nil {
return 0, false
}
return *d.Id, true
}
// HasId returns a boolean if a field has been set.
func (d *Downtime) HasId() bool {
if d != nil && d.Id != nil {
return true
}
return false
}
// SetId allocates a new d.Id and returns the pointer to it.
func (d *Downtime) SetId(v int) {
d.Id = &v
}
// GetMessage returns the Message field if non-nil, zero value otherwise.
func (d *Downtime) GetMessage() string {
if d == nil || d.Message == nil {
return ""
}
return *d.Message
}
// GetMessageOk returns a tuple with the Message field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (d *Downtime) GetMessageOk() (string, bool) {
if d == nil || d.Message == nil {
return "", false
}
return *d.Message, true
}
// HasMessage returns a boolean if a field has been set.
func (d *Downtime) HasMessage() bool {
if d != nil && d.Message != nil {
return true
}
return false
}
// SetMessage allocates a new d.Message and returns the pointer to it.
func (d *Downtime) SetMessage(v string) {
d.Message = &v
}
// GetMonitorId returns the MonitorId field if non-nil, zero value otherwise.
func (d *Downtime) GetMonitorId() int {
if d == nil || d.MonitorId == nil {
return 0
}
return *d.MonitorId
}
// GetMonitorIdOk returns a tuple with the MonitorId field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (d *Downtime) GetMonitorIdOk() (int, bool) {
if d == nil || d.MonitorId == nil {
return 0, false
}
return *d.MonitorId, true
}
// HasMonitorId returns a boolean if a field has been set.
func (d *Downtime) HasMonitorId() bool {
if d != nil && d.MonitorId != nil {
return true
}
return false
}
// SetMonitorId allocates a new d.MonitorId and returns the pointer to it.
func (d *Downtime) SetMonitorId(v int) {
d.MonitorId = &v
}
// GetParentId returns the ParentId field if non-nil, zero value otherwise.
func (d *Downtime) GetParentId() int {
if d == nil || d.ParentId == nil {
return 0
}
return *d.ParentId
}
// GetParentIdOk returns a tuple with the ParentId field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (d *Downtime) GetParentIdOk() (int, bool) {
if d == nil || d.ParentId == nil {
return 0, false
}
return *d.ParentId, true
}
// HasParentId returns a boolean if a field has been set.
func (d *Downtime) HasParentId() bool {
if d != nil && d.ParentId != nil {
return true
}
return false
}
// SetParentId allocates a new d.ParentId and returns the pointer to it.
func (d *Downtime) SetParentId(v int) {
d.ParentId = &v
}
// GetRecurrence returns the Recurrence field if non-nil, zero value otherwise.
func (d *Downtime) GetRecurrence() Recurrence {
if d == nil || d.Recurrence == nil {
return Recurrence{}
}
return *d.Recurrence
}
// GetRecurrenceOk returns a tuple with the Recurrence field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (d *Downtime) GetRecurrenceOk() (Recurrence, bool) {
if d == nil || d.Recurrence == nil {
return Recurrence{}, false
}
return *d.Recurrence, true
}
// HasRecurrence returns a boolean if a field has been set.
func (d *Downtime) HasRecurrence() bool {
if d != nil && d.Recurrence != nil {
return true
}
return false
}
// SetRecurrence allocates a new d.Recurrence and returns the pointer to it.
func (d *Downtime) SetRecurrence(v Recurrence) {
d.Recurrence = &v
}
// GetStart returns the Start field if non-nil, zero value otherwise.
func (d *Downtime) GetStart() int {
if d == nil || d.Start == nil {
return 0
}
return *d.Start
}
// GetStartOk returns a tuple with the Start field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (d *Downtime) GetStartOk() (int, bool) {
if d == nil || d.Start == nil {
return 0, false
}
return *d.Start, true
}
// HasStart returns a boolean if a field has been set.
func (d *Downtime) HasStart() bool {
if d != nil && d.Start != nil {
return true
}
return false
}
// SetStart allocates a new d.Start and returns the pointer to it.
func (d *Downtime) SetStart(v int) {
d.Start = &v
}
// GetTimezone returns the Timezone field if non-nil, zero value otherwise.
func (d *Downtime) GetTimezone() string {
if d == nil || d.Timezone == nil {
return ""
}
return *d.Timezone
}
// GetTimezoneOk returns a tuple with the Timezone field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (d *Downtime) GetTimezoneOk() (string, bool) {
if d == nil || d.Timezone == nil {
return "", false
}
return *d.Timezone, true
}
// HasTimezone returns a boolean if a field has been set.
func (d *Downtime) HasTimezone() bool {
if d != nil && d.Timezone != nil {
return true
}
return false
}
// SetTimezone allocates a new d.Timezone and returns the pointer to it.
func (d *Downtime) SetTimezone(v string) {
d.Timezone = &v
}
// GetType returns the Type field if non-nil, zero value otherwise.
func (d *Downtime) GetType() int {
if d == nil || d.Type == nil {
return 0
}
return *d.Type
}
// GetTypeOk returns a tuple with the Type field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (d *Downtime) GetTypeOk() (int, bool) {
if d == nil || d.Type == nil {
return 0, false
}
return *d.Type, true
}
// HasType returns a boolean if a field has been set.
func (d *Downtime) HasType() bool {
if d != nil && d.Type != nil {
return true
}
return false
}
// SetType allocates a new d.Type and returns the pointer to it.
func (d *Downtime) SetType(v int) {
d.Type = &v
}
// GetUpdaterID returns the UpdaterID field if non-nil, zero value otherwise.
func (d *Downtime) GetUpdaterID() int {
if d == nil || d.UpdaterID == nil {
return 0
}
return *d.UpdaterID
}
// GetUpdaterIDOk returns a tuple with the UpdaterID field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (d *Downtime) GetUpdaterIDOk() (int, bool) {
if d == nil || d.UpdaterID == nil {
return 0, false
}
return *d.UpdaterID, true
}
// HasUpdaterID returns a boolean if a field has been set.
func (d *Downtime) HasUpdaterID() bool {
if d != nil && d.UpdaterID != nil {
return true
}
return false
}
// SetUpdaterID allocates a new d.UpdaterID and returns the pointer to it.
func (d *Downtime) SetUpdaterID(v int) {
d.UpdaterID = &v
}
// GetAggregation returns the Aggregation field if non-nil, zero value otherwise.
func (e *Event) GetAggregation() string {
if e == nil || e.Aggregation == nil {
return ""
}
return *e.Aggregation
}
// GetAggregationOk returns a tuple with the Aggregation field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (e *Event) GetAggregationOk() (string, bool) {
if e == nil || e.Aggregation == nil {
return "", false
}
return *e.Aggregation, true
}
// HasAggregation returns a boolean if a field has been set.
func (e *Event) HasAggregation() bool {
if e != nil && e.Aggregation != nil {
return true
}
return false
}
// SetAggregation allocates a new e.Aggregation and returns the pointer to it.
func (e *Event) SetAggregation(v string) {
e.Aggregation = &v
}
// GetAlertType returns the AlertType field if non-nil, zero value otherwise.
func (e *Event) GetAlertType() string {
if e == nil || e.AlertType == nil {
return ""
}
return *e.AlertType
}
// GetAlertTypeOk returns a tuple with the AlertType field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (e *Event) GetAlertTypeOk() (string, bool) {
if e == nil || e.AlertType == nil {
return "", false
}
return *e.AlertType, true
}
// HasAlertType returns a boolean if a field has been set.
func (e *Event) HasAlertType() bool {
if e != nil && e.AlertType != nil {
return true
}
return false
}
// SetAlertType allocates a new e.AlertType and returns the pointer to it.
func (e *Event) SetAlertType(v string) {
e.AlertType = &v
}
// GetEventType returns the EventType field if non-nil, zero value otherwise.
func (e *Event) GetEventType() string {
if e == nil || e.EventType == nil {
return ""
}
return *e.EventType
}
// GetEventTypeOk returns a tuple with the EventType field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (e *Event) GetEventTypeOk() (string, bool) {
if e == nil || e.EventType == nil {
return "", false
}
return *e.EventType, true
}
// HasEventType returns a boolean if a field has been set.
func (e *Event) HasEventType() bool {
if e != nil && e.EventType != nil {
return true
}
return false
}
// SetEventType allocates a new e.EventType and returns the pointer to it.
func (e *Event) SetEventType(v string) {
e.EventType = &v
}
// GetHost returns the Host field if non-nil, zero value otherwise.
func (e *Event) GetHost() string {
if e == nil || e.Host == nil {
return ""
}
return *e.Host
}
// GetHostOk returns a tuple with the Host field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (e *Event) GetHostOk() (string, bool) {
if e == nil || e.Host == nil {
return "", false
}
return *e.Host, true
}
// HasHost returns a boolean if a field has been set.
func (e *Event) HasHost() bool {
if e != nil && e.Host != nil {
return true
}
return false
}
// SetHost allocates a new e.Host and returns the pointer to it.
func (e *Event) SetHost(v string) {
e.Host = &v
}
// GetId returns the Id field if non-nil, zero value otherwise.
func (e *Event) GetId() int {
if e == nil || e.Id == nil {
return 0
}
return *e.Id
}
// GetIdOk returns a tuple with the Id field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (e *Event) GetIdOk() (int, bool) {
if e == nil || e.Id == nil {
return 0, false
}
return *e.Id, true
}
// HasId returns a boolean if a field has been set.
func (e *Event) HasId() bool {
if e != nil && e.Id != nil {
return true
}
return false
}
// SetId allocates a new e.Id and returns the pointer to it.
func (e *Event) SetId(v int) {
e.Id = &v
}
// GetPriority returns the Priority field if non-nil, zero value otherwise.
func (e *Event) GetPriority() string {
if e == nil || e.Priority == nil {
return ""
}
return *e.Priority
}
// GetPriorityOk returns a tuple with the Priority field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (e *Event) GetPriorityOk() (string, bool) {
if e == nil || e.Priority == nil {
return "", false
}
return *e.Priority, true
}
// HasPriority returns a boolean if a field has been set.
func (e *Event) HasPriority() bool {
if e != nil && e.Priority != nil {
return true
}
return false
}
// SetPriority allocates a new e.Priority and returns the pointer to it.
func (e *Event) SetPriority(v string) {
e.Priority = &v
}
// GetResource returns the Resource field if non-nil, zero value otherwise.
func (e *Event) GetResource() string {
if e == nil || e.Resource == nil {
return ""
}
return *e.Resource
}
// GetResourceOk returns a tuple with the Resource field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (e *Event) GetResourceOk() (string, bool) {
if e == nil || e.Resource == nil {
return "", false
}
return *e.Resource, true
}
// HasResource returns a boolean if a field has been set.
func (e *Event) HasResource() bool {
if e != nil && e.Resource != nil {
return true
}
return false
}
// SetResource allocates a new e.Resource and returns the pointer to it.
func (e *Event) SetResource(v string) {
e.Resource = &v
}
// GetSourceType returns the SourceType field if non-nil, zero value otherwise.
func (e *Event) GetSourceType() string {
if e == nil || e.SourceType == nil {
return ""
}
return *e.SourceType
}
// GetSourceTypeOk returns a tuple with the SourceType field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (e *Event) GetSourceTypeOk() (string, bool) {
if e == nil || e.SourceType == nil {
return "", false
}
return *e.SourceType, true
}
// HasSourceType returns a boolean if a field has been set.
func (e *Event) HasSourceType() bool {
if e != nil && e.SourceType != nil {
return true
}
return false
}
// SetSourceType allocates a new e.SourceType and returns the pointer to it.
func (e *Event) SetSourceType(v string) {
e.SourceType = &v
}
// GetText returns the Text field if non-nil, zero value otherwise.
func (e *Event) GetText() string {
if e == nil || e.Text == nil {
return ""
}
return *e.Text
}
// GetTextOk returns a tuple with the Text field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (e *Event) GetTextOk() (string, bool) {
if e == nil || e.Text == nil {
return "", false
}
return *e.Text, true
}
// HasText returns a boolean if a field has been set.
func (e *Event) HasText() bool {
if e != nil && e.Text != nil {
return true
}
return false
}
// SetText allocates a new e.Text and returns the pointer to it.
func (e *Event) SetText(v string) {
e.Text = &v
}
// GetTime returns the Time field if non-nil, zero value otherwise.
func (e *Event) GetTime() int {
if e == nil || e.Time == nil {
return 0
}
return *e.Time
}
// GetTimeOk returns a tuple with the Time field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (e *Event) GetTimeOk() (int, bool) {
if e == nil || e.Time == nil {
return 0, false
}
return *e.Time, true
}
// HasTime returns a boolean if a field has been set.
func (e *Event) HasTime() bool {
if e != nil && e.Time != nil {
return true
}
return false
}
// SetTime allocates a new e.Time and returns the pointer to it.
func (e *Event) SetTime(v int) {
e.Time = &v
}
// GetTitle returns the Title field if non-nil, zero value otherwise.
func (e *Event) GetTitle() string {
if e == nil || e.Title == nil {
return ""
}
return *e.Title
}
// GetTitleOk returns a tuple with the Title field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (e *Event) GetTitleOk() (string, bool) {
if e == nil || e.Title == nil {
return "", false
}
return *e.Title, true
}
// HasTitle returns a boolean if a field has been set.
func (e *Event) HasTitle() bool {
if e != nil && e.Title != nil {
return true
}
return false
}
// SetTitle allocates a new e.Title and returns the pointer to it.
func (e *Event) SetTitle(v string) {
e.Title = &v
}
// GetUrl returns the Url field if non-nil, zero value otherwise.
func (e *Event) GetUrl() string {
if e == nil || e.Url == nil {
return ""
}
return *e.Url
}
// GetUrlOk returns a tuple with the Url field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (e *Event) GetUrlOk() (string, bool) {
if e == nil || e.Url == nil {
return "", false
}
return *e.Url, true
}
// HasUrl returns a boolean if a field has been set.
func (e *Event) HasUrl() bool {
if e != nil && e.Url != nil {
return true
}
return false
}
// SetUrl allocates a new e.Url and returns the pointer to it.
func (e *Event) SetUrl(v string) {
e.Url = &v
}
// GetEventSize returns the EventSize field if non-nil, zero value otherwise.
func (e *EventStreamDefinition) GetEventSize() string {
if e == nil || e.EventSize == nil {
return ""
}
return *e.EventSize
}
// GetEventSizeOk returns a tuple with the EventSize field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (e *EventStreamDefinition) GetEventSizeOk() (string, bool) {
if e == nil || e.EventSize == nil {
return "", false
}
return *e.EventSize, true
}
// HasEventSize returns a boolean if a field has been set.
func (e *EventStreamDefinition) HasEventSize() bool {
if e != nil && e.EventSize != nil {
return true
}
return false
}
// SetEventSize allocates a new e.EventSize and returns the pointer to it.
func (e *EventStreamDefinition) SetEventSize(v string) {
e.EventSize = &v
}
// GetQuery returns the Query field if non-nil, zero value otherwise.
func (e *EventStreamDefinition) GetQuery() string {
if e == nil || e.Query == nil {
return ""
}
return *e.Query
}
// GetQueryOk returns a tuple with the Query field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (e *EventStreamDefinition) GetQueryOk() (string, bool) {
if e == nil || e.Query == nil {
return "", false
}
return *e.Query, true
}
// HasQuery returns a boolean if a field has been set.
func (e *EventStreamDefinition) HasQuery() bool {
if e != nil && e.Query != nil {
return true
}
return false
}
// SetQuery allocates a new e.Query and returns the pointer to it.
func (e *EventStreamDefinition) SetQuery(v string) {
e.Query = &v
}
// GetTime returns the Time field if non-nil, zero value otherwise.
func (e *EventStreamDefinition) GetTime() WidgetTime {
if e == nil || e.Time == nil {
return WidgetTime{}
}
return *e.Time
}
// GetTimeOk returns a tuple with the Time field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (e *EventStreamDefinition) GetTimeOk() (WidgetTime, bool) {
if e == nil || e.Time == nil {
return WidgetTime{}, false
}
return *e.Time, true
}
// HasTime returns a boolean if a field has been set.
func (e *EventStreamDefinition) HasTime() bool {
if e != nil && e.Time != nil {
return true
}
return false
}
// SetTime allocates a new e.Time and returns the pointer to it.
func (e *EventStreamDefinition) SetTime(v WidgetTime) {
e.Time = &v
}
// GetTitle returns the Title field if non-nil, zero value otherwise.
func (e *EventStreamDefinition) GetTitle() string {
if e == nil || e.Title == nil {
return ""
}
return *e.Title
}
// GetTitleOk returns a tuple with the Title field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (e *EventStreamDefinition) GetTitleOk() (string, bool) {
if e == nil || e.Title == nil {
return "", false
}
return *e.Title, true
}
// HasTitle returns a boolean if a field has been set.
func (e *EventStreamDefinition) HasTitle() bool {
if e != nil && e.Title != nil {
return true
}
return false
}
// SetTitle allocates a new e.Title and returns the pointer to it.
func (e *EventStreamDefinition) SetTitle(v string) {
e.Title = &v
}
// GetTitleAlign returns the TitleAlign field if non-nil, zero value otherwise.
func (e *EventStreamDefinition) GetTitleAlign() string {
if e == nil || e.TitleAlign == nil {
return ""
}
return *e.TitleAlign
}
// GetTitleAlignOk returns a tuple with the TitleAlign field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (e *EventStreamDefinition) GetTitleAlignOk() (string, bool) {
if e == nil || e.TitleAlign == nil {
return "", false
}
return *e.TitleAlign, true
}
// HasTitleAlign returns a boolean if a field has been set.
func (e *EventStreamDefinition) HasTitleAlign() bool {
if e != nil && e.TitleAlign != nil {
return true
}
return false
}
// SetTitleAlign allocates a new e.TitleAlign and returns the pointer to it.
func (e *EventStreamDefinition) SetTitleAlign(v string) {
e.TitleAlign = &v
}
// GetTitleSize returns the TitleSize field if non-nil, zero value otherwise.
func (e *EventStreamDefinition) GetTitleSize() string {
if e == nil || e.TitleSize == nil {
return ""
}
return *e.TitleSize
}
// GetTitleSizeOk returns a tuple with the TitleSize field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (e *EventStreamDefinition) GetTitleSizeOk() (string, bool) {
if e == nil || e.TitleSize == nil {
return "", false
}
return *e.TitleSize, true
}
// HasTitleSize returns a boolean if a field has been set.
func (e *EventStreamDefinition) HasTitleSize() bool {
if e != nil && e.TitleSize != nil {
return true
}
return false
}
// SetTitleSize allocates a new e.TitleSize and returns the pointer to it.
func (e *EventStreamDefinition) SetTitleSize(v string) {
e.TitleSize = &v
}
// GetType returns the Type field if non-nil, zero value otherwise.
func (e *EventStreamDefinition) GetType() string {
if e == nil || e.Type == nil {
return ""
}
return *e.Type
}
// GetTypeOk returns a tuple with the Type field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (e *EventStreamDefinition) GetTypeOk() (string, bool) {
if e == nil || e.Type == nil {
return "", false
}
return *e.Type, true
}
// HasType returns a boolean if a field has been set.
func (e *EventStreamDefinition) HasType() bool {
if e != nil && e.Type != nil {
return true
}
return false
}
// SetType allocates a new e.Type and returns the pointer to it.
func (e *EventStreamDefinition) SetType(v string) {
e.Type = &v
}
// GetQuery returns the Query field if non-nil, zero value otherwise.
func (e *EventTimelineDefinition) GetQuery() string {
if e == nil || e.Query == nil {
return ""
}
return *e.Query
}
// GetQueryOk returns a tuple with the Query field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (e *EventTimelineDefinition) GetQueryOk() (string, bool) {
if e == nil || e.Query == nil {
return "", false
}
return *e.Query, true
}
// HasQuery returns a boolean if a field has been set.
func (e *EventTimelineDefinition) HasQuery() bool {
if e != nil && e.Query != nil {
return true
}
return false
}
// SetQuery allocates a new e.Query and returns the pointer to it.
func (e *EventTimelineDefinition) SetQuery(v string) {
e.Query = &v
}
// GetTime returns the Time field if non-nil, zero value otherwise.
func (e *EventTimelineDefinition) GetTime() WidgetTime {
if e == nil || e.Time == nil {
return WidgetTime{}
}
return *e.Time
}
// GetTimeOk returns a tuple with the Time field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (e *EventTimelineDefinition) GetTimeOk() (WidgetTime, bool) {
if e == nil || e.Time == nil {
return WidgetTime{}, false
}
return *e.Time, true
}
// HasTime returns a boolean if a field has been set.
func (e *EventTimelineDefinition) HasTime() bool {
if e != nil && e.Time != nil {
return true
}
return false
}
// SetTime allocates a new e.Time and returns the pointer to it.
func (e *EventTimelineDefinition) SetTime(v WidgetTime) {
e.Time = &v
}
// GetTitle returns the Title field if non-nil, zero value otherwise.
func (e *EventTimelineDefinition) GetTitle() string {
if e == nil || e.Title == nil {
return ""
}
return *e.Title
}
// GetTitleOk returns a tuple with the Title field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (e *EventTimelineDefinition) GetTitleOk() (string, bool) {
if e == nil || e.Title == nil {
return "", false
}
return *e.Title, true
}
// HasTitle returns a boolean if a field has been set.
func (e *EventTimelineDefinition) HasTitle() bool {
if e != nil && e.Title != nil {
return true
}
return false
}
// SetTitle allocates a new e.Title and returns the pointer to it.
func (e *EventTimelineDefinition) SetTitle(v string) {
e.Title = &v
}
// GetTitleAlign returns the TitleAlign field if non-nil, zero value otherwise.
func (e *EventTimelineDefinition) GetTitleAlign() string {
if e == nil || e.TitleAlign == nil {
return ""
}
return *e.TitleAlign
}
// GetTitleAlignOk returns a tuple with the TitleAlign field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (e *EventTimelineDefinition) GetTitleAlignOk() (string, bool) {
if e == nil || e.TitleAlign == nil {
return "", false
}
return *e.TitleAlign, true
}
// HasTitleAlign returns a boolean if a field has been set.
func (e *EventTimelineDefinition) HasTitleAlign() bool {
if e != nil && e.TitleAlign != nil {
return true
}
return false
}
// SetTitleAlign allocates a new e.TitleAlign and returns the pointer to it.
func (e *EventTimelineDefinition) SetTitleAlign(v string) {
e.TitleAlign = &v
}
// GetTitleSize returns the TitleSize field if non-nil, zero value otherwise.
func (e *EventTimelineDefinition) GetTitleSize() string {
if e == nil || e.TitleSize == nil {
return ""
}
return *e.TitleSize
}
// GetTitleSizeOk returns a tuple with the TitleSize field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (e *EventTimelineDefinition) GetTitleSizeOk() (string, bool) {
if e == nil || e.TitleSize == nil {
return "", false
}
return *e.TitleSize, true
}
// HasTitleSize returns a boolean if a field has been set.
func (e *EventTimelineDefinition) HasTitleSize() bool {
if e != nil && e.TitleSize != nil {
return true
}
return false
}
// SetTitleSize allocates a new e.TitleSize and returns the pointer to it.
func (e *EventTimelineDefinition) SetTitleSize(v string) {
e.TitleSize = &v
}
// GetType returns the Type field if non-nil, zero value otherwise.
func (e *EventTimelineDefinition) GetType() string {
if e == nil || e.Type == nil {
return ""
}
return *e.Type
}
// GetTypeOk returns a tuple with the Type field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (e *EventTimelineDefinition) GetTypeOk() (string, bool) {
if e == nil || e.Type == nil {
return "", false
}
return *e.Type, true
}
// HasType returns a boolean if a field has been set.
func (e *EventTimelineDefinition) HasType() bool {
if e != nil && e.Type != nil {
return true
}
return false
}
// SetType allocates a new e.Type and returns the pointer to it.
func (e *EventTimelineDefinition) SetType(v string) {
e.Type = &v
}
// GetFilter returns the Filter field if non-nil, zero value otherwise.
func (e *ExclusionFilter) GetFilter() Filter {
if e == nil || e.Filter == nil {
return Filter{}
}
return *e.Filter
}
// GetFilterOk returns a tuple with the Filter field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (e *ExclusionFilter) GetFilterOk() (Filter, bool) {
if e == nil || e.Filter == nil {
return Filter{}, false
}
return *e.Filter, true
}
// HasFilter returns a boolean if a field has been set.
func (e *ExclusionFilter) HasFilter() bool {
if e != nil && e.Filter != nil {
return true
}
return false
}
// SetFilter allocates a new e.Filter and returns the pointer to it.
func (e *ExclusionFilter) SetFilter(v Filter) {
e.Filter = &v
}
// GetIsEnabled returns the IsEnabled field if non-nil, zero value otherwise.
func (e *ExclusionFilter) GetIsEnabled() bool {
if e == nil || e.IsEnabled == nil {
return false
}
return *e.IsEnabled
}
// GetIsEnabledOk returns a tuple with the IsEnabled field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (e *ExclusionFilter) GetIsEnabledOk() (bool, bool) {
if e == nil || e.IsEnabled == nil {
return false, false
}
return *e.IsEnabled, true
}
// HasIsEnabled returns a boolean if a field has been set.
func (e *ExclusionFilter) HasIsEnabled() bool {
if e != nil && e.IsEnabled != nil {
return true
}
return false
}
// SetIsEnabled allocates a new e.IsEnabled and returns the pointer to it.
func (e *ExclusionFilter) SetIsEnabled(v bool) {
e.IsEnabled = &v
}
// GetName returns the Name field if non-nil, zero value otherwise.
func (e *ExclusionFilter) GetName() string {
if e == nil || e.Name == nil {
return ""
}
return *e.Name
}
// GetNameOk returns a tuple with the Name field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (e *ExclusionFilter) GetNameOk() (string, bool) {
if e == nil || e.Name == nil {
return "", false
}
return *e.Name, true
}
// HasName returns a boolean if a field has been set.
func (e *ExclusionFilter) HasName() bool {
if e != nil && e.Name != nil {
return true
}
return false
}
// SetName allocates a new e.Name and returns the pointer to it.
func (e *ExclusionFilter) SetName(v string) {
e.Name = &v
}
// GetQuery returns the Query field if non-nil, zero value otherwise.
func (f *Filter) GetQuery() string {
if f == nil || f.Query == nil {
return ""
}
return *f.Query
}
// GetQueryOk returns a tuple with the Query field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (f *Filter) GetQueryOk() (string, bool) {
if f == nil || f.Query == nil {
return "", false
}
return *f.Query, true
}
// HasQuery returns a boolean if a field has been set.
func (f *Filter) HasQuery() bool {
if f != nil && f.Query != nil {
return true
}
return false
}
// SetQuery allocates a new f.Query and returns the pointer to it.
func (f *Filter) SetQuery(v string) {
f.Query = &v
}
// GetSampleRate returns the SampleRate field if non-nil, zero value otherwise.
func (f *Filter) GetSampleRate() float64 {
if f == nil || f.SampleRate == nil {
return 0
}
return *f.SampleRate
}
// GetSampleRateOk returns a tuple with the SampleRate field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (f *Filter) GetSampleRateOk() (float64, bool) {
if f == nil || f.SampleRate == nil {
return 0, false
}
return *f.SampleRate, true
}
// HasSampleRate returns a boolean if a field has been set.
func (f *Filter) HasSampleRate() bool {
if f != nil && f.SampleRate != nil {
return true
}
return false
}
// SetSampleRate allocates a new f.SampleRate and returns the pointer to it.
func (f *Filter) SetSampleRate(v float64) {
f.SampleRate = &v
}
// GetQuery returns the Query field if non-nil, zero value otherwise.
func (f *FilterConfiguration) GetQuery() string {
if f == nil || f.Query == nil {
return ""
}
return *f.Query
}
// GetQueryOk returns a tuple with the Query field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (f *FilterConfiguration) GetQueryOk() (string, bool) {
if f == nil || f.Query == nil {
return "", false
}
return *f.Query, true
}
// HasQuery returns a boolean if a field has been set.
func (f *FilterConfiguration) HasQuery() bool {
if f != nil && f.Query != nil {
return true
}
return false
}
// SetQuery allocates a new f.Query and returns the pointer to it.
func (f *FilterConfiguration) SetQuery(v string) {
f.Query = &v
}
// GetColor returns the Color field if non-nil, zero value otherwise.
func (f *FreeTextDefinition) GetColor() string {
if f == nil || f.Color == nil {
return ""
}
return *f.Color
}
// GetColorOk returns a tuple with the Color field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (f *FreeTextDefinition) GetColorOk() (string, bool) {
if f == nil || f.Color == nil {
return "", false
}
return *f.Color, true
}
// HasColor returns a boolean if a field has been set.
func (f *FreeTextDefinition) HasColor() bool {
if f != nil && f.Color != nil {
return true
}
return false
}
// SetColor allocates a new f.Color and returns the pointer to it.
func (f *FreeTextDefinition) SetColor(v string) {
f.Color = &v
}
// GetFontSize returns the FontSize field if non-nil, zero value otherwise.
func (f *FreeTextDefinition) GetFontSize() string {
if f == nil || f.FontSize == nil {
return ""
}
return *f.FontSize
}
// GetFontSizeOk returns a tuple with the FontSize field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (f *FreeTextDefinition) GetFontSizeOk() (string, bool) {
if f == nil || f.FontSize == nil {
return "", false
}
return *f.FontSize, true
}
// HasFontSize returns a boolean if a field has been set.
func (f *FreeTextDefinition) HasFontSize() bool {
if f != nil && f.FontSize != nil {
return true
}
return false
}
// SetFontSize allocates a new f.FontSize and returns the pointer to it.
func (f *FreeTextDefinition) SetFontSize(v string) {
f.FontSize = &v
}
// GetText returns the Text field if non-nil, zero value otherwise.
func (f *FreeTextDefinition) GetText() string {
if f == nil || f.Text == nil {
return ""
}
return *f.Text
}
// GetTextOk returns a tuple with the Text field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (f *FreeTextDefinition) GetTextOk() (string, bool) {
if f == nil || f.Text == nil {
return "", false
}
return *f.Text, true
}
// HasText returns a boolean if a field has been set.
func (f *FreeTextDefinition) HasText() bool {
if f != nil && f.Text != nil {
return true
}
return false
}
// SetText allocates a new f.Text and returns the pointer to it.
func (f *FreeTextDefinition) SetText(v string) {
f.Text = &v
}
// GetTextAlign returns the TextAlign field if non-nil, zero value otherwise.
func (f *FreeTextDefinition) GetTextAlign() string {
if f == nil || f.TextAlign == nil {
return ""
}
return *f.TextAlign
}
// GetTextAlignOk returns a tuple with the TextAlign field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (f *FreeTextDefinition) GetTextAlignOk() (string, bool) {
if f == nil || f.TextAlign == nil {
return "", false
}
return *f.TextAlign, true
}
// HasTextAlign returns a boolean if a field has been set.
func (f *FreeTextDefinition) HasTextAlign() bool {
if f != nil && f.TextAlign != nil {
return true
}
return false
}
// SetTextAlign allocates a new f.TextAlign and returns the pointer to it.
func (f *FreeTextDefinition) SetTextAlign(v string) {
f.TextAlign = &v
}
// GetType returns the Type field if non-nil, zero value otherwise.
func (f *FreeTextDefinition) GetType() string {
if f == nil || f.Type == nil {
return ""
}
return *f.Type
}
// GetTypeOk returns a tuple with the Type field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (f *FreeTextDefinition) GetTypeOk() (string, bool) {
if f == nil || f.Type == nil {
return "", false
}
return *f.Type, true
}
// HasType returns a boolean if a field has been set.
func (f *FreeTextDefinition) HasType() bool {
if f != nil && f.Type != nil {
return true
}
return false
}
// SetType allocates a new f.Type and returns the pointer to it.
func (f *FreeTextDefinition) SetType(v string) {
f.Type = &v
}
// GetDefinition returns the Definition field if non-nil, zero value otherwise.
func (g *Graph) GetDefinition() GraphDefinition {
if g == nil || g.Definition == nil {
return GraphDefinition{}
}
return *g.Definition
}
// GetDefinitionOk returns a tuple with the Definition field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (g *Graph) GetDefinitionOk() (GraphDefinition, bool) {
if g == nil || g.Definition == nil {
return GraphDefinition{}, false
}
return *g.Definition, true
}
// HasDefinition returns a boolean if a field has been set.
func (g *Graph) HasDefinition() bool {
if g != nil && g.Definition != nil {
return true
}
return false
}
// SetDefinition allocates a new g.Definition and returns the pointer to it.
func (g *Graph) SetDefinition(v GraphDefinition) {
g.Definition = &v
}
// GetTitle returns the Title field if non-nil, zero value otherwise.
func (g *Graph) GetTitle() string {
if g == nil || g.Title == nil {
return ""
}
return *g.Title
}
// GetTitleOk returns a tuple with the Title field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (g *Graph) GetTitleOk() (string, bool) {
if g == nil || g.Title == nil {
return "", false
}
return *g.Title, true
}
// HasTitle returns a boolean if a field has been set.
func (g *Graph) HasTitle() bool {
if g != nil && g.Title != nil {
return true
}
return false
}
// SetTitle allocates a new g.Title and returns the pointer to it.
func (g *Graph) SetTitle(v string) {
g.Title = &v
}
// GetCompute returns the Compute field if non-nil, zero value otherwise.
func (g *GraphApmOrLogQuery) GetCompute() GraphApmOrLogQueryCompute {
if g == nil || g.Compute == nil {
return GraphApmOrLogQueryCompute{}
}
return *g.Compute
}
// GetComputeOk returns a tuple with the Compute field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (g *GraphApmOrLogQuery) GetComputeOk() (GraphApmOrLogQueryCompute, bool) {
if g == nil || g.Compute == nil {
return GraphApmOrLogQueryCompute{}, false
}
return *g.Compute, true
}
// HasCompute returns a boolean if a field has been set.
func (g *GraphApmOrLogQuery) HasCompute() bool {
if g != nil && g.Compute != nil {
return true
}
return false
}
// SetCompute allocates a new g.Compute and returns the pointer to it.
func (g *GraphApmOrLogQuery) SetCompute(v GraphApmOrLogQueryCompute) {
g.Compute = &v
}
// GetIndex returns the Index field if non-nil, zero value otherwise.
func (g *GraphApmOrLogQuery) GetIndex() string {
if g == nil || g.Index == nil {
return ""
}
return *g.Index
}
// GetIndexOk returns a tuple with the Index field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (g *GraphApmOrLogQuery) GetIndexOk() (string, bool) {
if g == nil || g.Index == nil {
return "", false
}
return *g.Index, true
}
// HasIndex returns a boolean if a field has been set.
func (g *GraphApmOrLogQuery) HasIndex() bool {
if g != nil && g.Index != nil {
return true
}
return false
}
// SetIndex allocates a new g.Index and returns the pointer to it.
func (g *GraphApmOrLogQuery) SetIndex(v string) {
g.Index = &v
}
// GetSearch returns the Search field if non-nil, zero value otherwise.
func (g *GraphApmOrLogQuery) GetSearch() GraphApmOrLogQuerySearch {
if g == nil || g.Search == nil {
return GraphApmOrLogQuerySearch{}
}
return *g.Search
}
// GetSearchOk returns a tuple with the Search field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (g *GraphApmOrLogQuery) GetSearchOk() (GraphApmOrLogQuerySearch, bool) {
if g == nil || g.Search == nil {
return GraphApmOrLogQuerySearch{}, false
}
return *g.Search, true
}
// HasSearch returns a boolean if a field has been set.
func (g *GraphApmOrLogQuery) HasSearch() bool {
if g != nil && g.Search != nil {
return true
}
return false
}
// SetSearch allocates a new g.Search and returns the pointer to it.
func (g *GraphApmOrLogQuery) SetSearch(v GraphApmOrLogQuerySearch) {
g.Search = &v
}
// GetAggregation returns the Aggregation field if non-nil, zero value otherwise.
func (g *GraphApmOrLogQueryCompute) GetAggregation() string {
if g == nil || g.Aggregation == nil {
return ""
}
return *g.Aggregation
}
// GetAggregationOk returns a tuple with the Aggregation field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (g *GraphApmOrLogQueryCompute) GetAggregationOk() (string, bool) {
if g == nil || g.Aggregation == nil {
return "", false
}
return *g.Aggregation, true
}
// HasAggregation returns a boolean if a field has been set.
func (g *GraphApmOrLogQueryCompute) HasAggregation() bool {
if g != nil && g.Aggregation != nil {
return true
}
return false
}
// SetAggregation allocates a new g.Aggregation and returns the pointer to it.
func (g *GraphApmOrLogQueryCompute) SetAggregation(v string) {
g.Aggregation = &v
}
// GetFacet returns the Facet field if non-nil, zero value otherwise.
func (g *GraphApmOrLogQueryCompute) GetFacet() string {
if g == nil || g.Facet == nil {
return ""
}
return *g.Facet
}
// GetFacetOk returns a tuple with the Facet field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (g *GraphApmOrLogQueryCompute) GetFacetOk() (string, bool) {
if g == nil || g.Facet == nil {
return "", false
}
return *g.Facet, true
}
// HasFacet returns a boolean if a field has been set.
func (g *GraphApmOrLogQueryCompute) HasFacet() bool {
if g != nil && g.Facet != nil {
return true
}
return false
}
// SetFacet allocates a new g.Facet and returns the pointer to it.
func (g *GraphApmOrLogQueryCompute) SetFacet(v string) {
g.Facet = &v
}
// GetInterval returns the Interval field if non-nil, zero value otherwise.
func (g *GraphApmOrLogQueryCompute) GetInterval() int {
if g == nil || g.Interval == nil {
return 0
}
return *g.Interval
}
// GetIntervalOk returns a tuple with the Interval field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (g *GraphApmOrLogQueryCompute) GetIntervalOk() (int, bool) {
if g == nil || g.Interval == nil {
return 0, false
}
return *g.Interval, true
}
// HasInterval returns a boolean if a field has been set.
func (g *GraphApmOrLogQueryCompute) HasInterval() bool {
if g != nil && g.Interval != nil {
return true
}
return false
}
// SetInterval allocates a new g.Interval and returns the pointer to it.
func (g *GraphApmOrLogQueryCompute) SetInterval(v int) {
g.Interval = &v
}
// GetFacet returns the Facet field if non-nil, zero value otherwise.
func (g *GraphApmOrLogQueryGroupBy) GetFacet() string {
if g == nil || g.Facet == nil {
return ""
}
return *g.Facet
}
// GetFacetOk returns a tuple with the Facet field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (g *GraphApmOrLogQueryGroupBy) GetFacetOk() (string, bool) {
if g == nil || g.Facet == nil {
return "", false
}
return *g.Facet, true
}
// HasFacet returns a boolean if a field has been set.
func (g *GraphApmOrLogQueryGroupBy) HasFacet() bool {
if g != nil && g.Facet != nil {
return true
}
return false
}
// SetFacet allocates a new g.Facet and returns the pointer to it.
func (g *GraphApmOrLogQueryGroupBy) SetFacet(v string) {
g.Facet = &v
}
// GetLimit returns the Limit field if non-nil, zero value otherwise.
func (g *GraphApmOrLogQueryGroupBy) GetLimit() int {
if g == nil || g.Limit == nil {
return 0
}
return *g.Limit
}
// GetLimitOk returns a tuple with the Limit field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (g *GraphApmOrLogQueryGroupBy) GetLimitOk() (int, bool) {
if g == nil || g.Limit == nil {
return 0, false
}
return *g.Limit, true
}
// HasLimit returns a boolean if a field has been set.
func (g *GraphApmOrLogQueryGroupBy) HasLimit() bool {
if g != nil && g.Limit != nil {
return true
}
return false
}
// SetLimit allocates a new g.Limit and returns the pointer to it.
func (g *GraphApmOrLogQueryGroupBy) SetLimit(v int) {
g.Limit = &v
}
// GetSort returns the Sort field if non-nil, zero value otherwise.
func (g *GraphApmOrLogQueryGroupBy) GetSort() GraphApmOrLogQueryGroupBySort {
if g == nil || g.Sort == nil {
return GraphApmOrLogQueryGroupBySort{}
}
return *g.Sort
}
// GetSortOk returns a tuple with the Sort field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (g *GraphApmOrLogQueryGroupBy) GetSortOk() (GraphApmOrLogQueryGroupBySort, bool) {
if g == nil || g.Sort == nil {
return GraphApmOrLogQueryGroupBySort{}, false
}
return *g.Sort, true
}
// HasSort returns a boolean if a field has been set.
func (g *GraphApmOrLogQueryGroupBy) HasSort() bool {
if g != nil && g.Sort != nil {
return true
}
return false
}
// SetSort allocates a new g.Sort and returns the pointer to it.
func (g *GraphApmOrLogQueryGroupBy) SetSort(v GraphApmOrLogQueryGroupBySort) {
g.Sort = &v
}
// GetAggregation returns the Aggregation field if non-nil, zero value otherwise.
func (g *GraphApmOrLogQueryGroupBySort) GetAggregation() string {
if g == nil || g.Aggregation == nil {
return ""
}
return *g.Aggregation
}
// GetAggregationOk returns a tuple with the Aggregation field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (g *GraphApmOrLogQueryGroupBySort) GetAggregationOk() (string, bool) {
if g == nil || g.Aggregation == nil {
return "", false
}
return *g.Aggregation, true
}
// HasAggregation returns a boolean if a field has been set.
func (g *GraphApmOrLogQueryGroupBySort) HasAggregation() bool {
if g != nil && g.Aggregation != nil {
return true
}
return false
}
// SetAggregation allocates a new g.Aggregation and returns the pointer to it.
func (g *GraphApmOrLogQueryGroupBySort) SetAggregation(v string) {
g.Aggregation = &v
}
// GetFacet returns the Facet field if non-nil, zero value otherwise.
func (g *GraphApmOrLogQueryGroupBySort) GetFacet() string {
if g == nil || g.Facet == nil {
return ""
}
return *g.Facet
}
// GetFacetOk returns a tuple with the Facet field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (g *GraphApmOrLogQueryGroupBySort) GetFacetOk() (string, bool) {
if g == nil || g.Facet == nil {
return "", false
}
return *g.Facet, true
}
// HasFacet returns a boolean if a field has been set.
func (g *GraphApmOrLogQueryGroupBySort) HasFacet() bool {
if g != nil && g.Facet != nil {
return true
}
return false
}
// SetFacet allocates a new g.Facet and returns the pointer to it.
func (g *GraphApmOrLogQueryGroupBySort) SetFacet(v string) {
g.Facet = &v
}
// GetOrder returns the Order field if non-nil, zero value otherwise.
func (g *GraphApmOrLogQueryGroupBySort) GetOrder() string {
if g == nil || g.Order == nil {
return ""
}
return *g.Order
}
// GetOrderOk returns a tuple with the Order field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (g *GraphApmOrLogQueryGroupBySort) GetOrderOk() (string, bool) {
if g == nil || g.Order == nil {
return "", false
}
return *g.Order, true
}
// HasOrder returns a boolean if a field has been set.
func (g *GraphApmOrLogQueryGroupBySort) HasOrder() bool {
if g != nil && g.Order != nil {
return true
}
return false
}
// SetOrder allocates a new g.Order and returns the pointer to it.
func (g *GraphApmOrLogQueryGroupBySort) SetOrder(v string) {
g.Order = &v
}
// GetQuery returns the Query field if non-nil, zero value otherwise.
func (g *GraphApmOrLogQuerySearch) GetQuery() string {
if g == nil || g.Query == nil {
return ""
}
return *g.Query
}
// GetQueryOk returns a tuple with the Query field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (g *GraphApmOrLogQuerySearch) GetQueryOk() (string, bool) {
if g == nil || g.Query == nil {
return "", false
}
return *g.Query, true
}
// HasQuery returns a boolean if a field has been set.
func (g *GraphApmOrLogQuerySearch) HasQuery() bool {
if g != nil && g.Query != nil {
return true
}
return false
}
// SetQuery allocates a new g.Query and returns the pointer to it.
func (g *GraphApmOrLogQuerySearch) SetQuery(v string) {
g.Query = &v
}
// GetAutoscale returns the Autoscale field if non-nil, zero value otherwise.
func (g *GraphDefinition) GetAutoscale() bool {
if g == nil || g.Autoscale == nil {
return false
}
return *g.Autoscale
}
// GetAutoscaleOk returns a tuple with the Autoscale field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (g *GraphDefinition) GetAutoscaleOk() (bool, bool) {
if g == nil || g.Autoscale == nil {
return false, false
}
return *g.Autoscale, true
}
// HasAutoscale returns a boolean if a field has been set.
func (g *GraphDefinition) HasAutoscale() bool {
if g != nil && g.Autoscale != nil {
return true
}
return false
}
// SetAutoscale allocates a new g.Autoscale and returns the pointer to it.
func (g *GraphDefinition) SetAutoscale(v bool) {
g.Autoscale = &v
}
// GetCustomUnit returns the CustomUnit field if non-nil, zero value otherwise.
func (g *GraphDefinition) GetCustomUnit() string {
if g == nil || g.CustomUnit == nil {
return ""
}
return *g.CustomUnit
}
// GetCustomUnitOk returns a tuple with the CustomUnit field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (g *GraphDefinition) GetCustomUnitOk() (string, bool) {
if g == nil || g.CustomUnit == nil {
return "", false
}
return *g.CustomUnit, true
}
// HasCustomUnit returns a boolean if a field has been set.
func (g *GraphDefinition) HasCustomUnit() bool {
if g != nil && g.CustomUnit != nil {
return true
}
return false
}
// SetCustomUnit allocates a new g.CustomUnit and returns the pointer to it.
func (g *GraphDefinition) SetCustomUnit(v string) {
g.CustomUnit = &v
}
// GetIncludeNoMetricHosts returns the IncludeNoMetricHosts field if non-nil, zero value otherwise.
func (g *GraphDefinition) GetIncludeNoMetricHosts() bool {
if g == nil || g.IncludeNoMetricHosts == nil {
return false
}
return *g.IncludeNoMetricHosts
}
// GetIncludeNoMetricHostsOk returns a tuple with the IncludeNoMetricHosts field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (g *GraphDefinition) GetIncludeNoMetricHostsOk() (bool, bool) {
if g == nil || g.IncludeNoMetricHosts == nil {
return false, false
}
return *g.IncludeNoMetricHosts, true
}
// HasIncludeNoMetricHosts returns a boolean if a field has been set.
func (g *GraphDefinition) HasIncludeNoMetricHosts() bool {
if g != nil && g.IncludeNoMetricHosts != nil {
return true
}
return false
}
// SetIncludeNoMetricHosts allocates a new g.IncludeNoMetricHosts and returns the pointer to it.
func (g *GraphDefinition) SetIncludeNoMetricHosts(v bool) {
g.IncludeNoMetricHosts = &v
}
// GetIncludeUngroupedHosts returns the IncludeUngroupedHosts field if non-nil, zero value otherwise.
func (g *GraphDefinition) GetIncludeUngroupedHosts() bool {
if g == nil || g.IncludeUngroupedHosts == nil {
return false
}
return *g.IncludeUngroupedHosts
}
// GetIncludeUngroupedHostsOk returns a tuple with the IncludeUngroupedHosts field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (g *GraphDefinition) GetIncludeUngroupedHostsOk() (bool, bool) {
if g == nil || g.IncludeUngroupedHosts == nil {
return false, false
}
return *g.IncludeUngroupedHosts, true
}
// HasIncludeUngroupedHosts returns a boolean if a field has been set.
func (g *GraphDefinition) HasIncludeUngroupedHosts() bool {
if g != nil && g.IncludeUngroupedHosts != nil {
return true
}
return false
}
// SetIncludeUngroupedHosts allocates a new g.IncludeUngroupedHosts and returns the pointer to it.
func (g *GraphDefinition) SetIncludeUngroupedHosts(v bool) {
g.IncludeUngroupedHosts = &v
}
// GetNodeType returns the NodeType field if non-nil, zero value otherwise.
func (g *GraphDefinition) GetNodeType() string {
if g == nil || g.NodeType == nil {
return ""
}
return *g.NodeType
}
// GetNodeTypeOk returns a tuple with the NodeType field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (g *GraphDefinition) GetNodeTypeOk() (string, bool) {
if g == nil || g.NodeType == nil {
return "", false
}
return *g.NodeType, true
}
// HasNodeType returns a boolean if a field has been set.
func (g *GraphDefinition) HasNodeType() bool {
if g != nil && g.NodeType != nil {
return true
}
return false
}
// SetNodeType allocates a new g.NodeType and returns the pointer to it.
func (g *GraphDefinition) SetNodeType(v string) {
g.NodeType = &v
}
// GetPrecision returns the Precision field if non-nil, zero value otherwise.
func (g *GraphDefinition) GetPrecision() PrecisionT {
if g == nil || g.Precision == nil {
return ""
}
return *g.Precision
}
// GetPrecisionOk returns a tuple with the Precision field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (g *GraphDefinition) GetPrecisionOk() (PrecisionT, bool) {
if g == nil || g.Precision == nil {
return "", false
}
return *g.Precision, true
}
// HasPrecision returns a boolean if a field has been set.
func (g *GraphDefinition) HasPrecision() bool {
if g != nil && g.Precision != nil {
return true
}
return false
}
// SetPrecision allocates a new g.Precision and returns the pointer to it.
func (g *GraphDefinition) SetPrecision(v PrecisionT) {
g.Precision = &v
}
// GetStyle returns the Style field if non-nil, zero value otherwise.
func (g *GraphDefinition) GetStyle() Style {
if g == nil || g.Style == nil {
return Style{}
}
return *g.Style
}
// GetStyleOk returns a tuple with the Style field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (g *GraphDefinition) GetStyleOk() (Style, bool) {
if g == nil || g.Style == nil {
return Style{}, false
}
return *g.Style, true
}
// HasStyle returns a boolean if a field has been set.
func (g *GraphDefinition) HasStyle() bool {
if g != nil && g.Style != nil {
return true
}
return false
}
// SetStyle allocates a new g.Style and returns the pointer to it.
func (g *GraphDefinition) SetStyle(v Style) {
g.Style = &v
}
// GetTextAlign returns the TextAlign field if non-nil, zero value otherwise.
func (g *GraphDefinition) GetTextAlign() string {
if g == nil || g.TextAlign == nil {
return ""
}
return *g.TextAlign
}
// GetTextAlignOk returns a tuple with the TextAlign field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (g *GraphDefinition) GetTextAlignOk() (string, bool) {
if g == nil || g.TextAlign == nil {
return "", false
}
return *g.TextAlign, true
}
// HasTextAlign returns a boolean if a field has been set.
func (g *GraphDefinition) HasTextAlign() bool {
if g != nil && g.TextAlign != nil {
return true
}
return false
}
// SetTextAlign allocates a new g.TextAlign and returns the pointer to it.
func (g *GraphDefinition) SetTextAlign(v string) {
g.TextAlign = &v
}
// GetViz returns the Viz field if non-nil, zero value otherwise.
func (g *GraphDefinition) GetViz() string {
if g == nil || g.Viz == nil {
return ""
}
return *g.Viz
}
// GetVizOk returns a tuple with the Viz field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (g *GraphDefinition) GetVizOk() (string, bool) {
if g == nil || g.Viz == nil {
return "", false
}
return *g.Viz, true
}
// HasViz returns a boolean if a field has been set.
func (g *GraphDefinition) HasViz() bool {
if g != nil && g.Viz != nil {
return true
}
return false
}
// SetViz allocates a new g.Viz and returns the pointer to it.
func (g *GraphDefinition) SetViz(v string) {
g.Viz = &v
}
// GetLabel returns the Label field if non-nil, zero value otherwise.
func (g *GraphDefinitionMarker) GetLabel() string {
if g == nil || g.Label == nil {
return ""
}
return *g.Label
}
// GetLabelOk returns a tuple with the Label field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (g *GraphDefinitionMarker) GetLabelOk() (string, bool) {
if g == nil || g.Label == nil {
return "", false
}
return *g.Label, true
}
// HasLabel returns a boolean if a field has been set.
func (g *GraphDefinitionMarker) HasLabel() bool {
if g != nil && g.Label != nil {
return true
}
return false
}
// SetLabel allocates a new g.Label and returns the pointer to it.
func (g *GraphDefinitionMarker) SetLabel(v string) {
g.Label = &v
}
// GetMax returns the Max field if non-nil, zero value otherwise.
func (g *GraphDefinitionMarker) GetMax() json.Number {
if g == nil || g.Max == nil {
return ""
}
return *g.Max
}
// GetMaxOk returns a tuple with the Max field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (g *GraphDefinitionMarker) GetMaxOk() (json.Number, bool) {
if g == nil || g.Max == nil {
return "", false
}
return *g.Max, true
}
// HasMax returns a boolean if a field has been set.
func (g *GraphDefinitionMarker) HasMax() bool {
if g != nil && g.Max != nil {
return true
}
return false
}
// SetMax allocates a new g.Max and returns the pointer to it.
func (g *GraphDefinitionMarker) SetMax(v json.Number) {
g.Max = &v
}
// GetMin returns the Min field if non-nil, zero value otherwise.
func (g *GraphDefinitionMarker) GetMin() json.Number {
if g == nil || g.Min == nil {
return ""
}
return *g.Min
}
// GetMinOk returns a tuple with the Min field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (g *GraphDefinitionMarker) GetMinOk() (json.Number, bool) {
if g == nil || g.Min == nil {
return "", false
}
return *g.Min, true
}
// HasMin returns a boolean if a field has been set.
func (g *GraphDefinitionMarker) HasMin() bool {
if g != nil && g.Min != nil {
return true
}
return false
}
// SetMin allocates a new g.Min and returns the pointer to it.
func (g *GraphDefinitionMarker) SetMin(v json.Number) {
g.Min = &v
}
// GetType returns the Type field if non-nil, zero value otherwise.
func (g *GraphDefinitionMarker) GetType() string {
if g == nil || g.Type == nil {
return ""
}
return *g.Type
}
// GetTypeOk returns a tuple with the Type field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (g *GraphDefinitionMarker) GetTypeOk() (string, bool) {
if g == nil || g.Type == nil {
return "", false
}
return *g.Type, true
}
// HasType returns a boolean if a field has been set.
func (g *GraphDefinitionMarker) HasType() bool {
if g != nil && g.Type != nil {
return true
}
return false
}
// SetType allocates a new g.Type and returns the pointer to it.
func (g *GraphDefinitionMarker) SetType(v string) {
g.Type = &v
}
// GetVal returns the Val field if non-nil, zero value otherwise.
func (g *GraphDefinitionMarker) GetVal() json.Number {
if g == nil || g.Val == nil {
return ""
}
return *g.Val
}
// GetValOk returns a tuple with the Val field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (g *GraphDefinitionMarker) GetValOk() (json.Number, bool) {
if g == nil || g.Val == nil {
return "", false
}
return *g.Val, true
}
// HasVal returns a boolean if a field has been set.
func (g *GraphDefinitionMarker) HasVal() bool {
if g != nil && g.Val != nil {
return true
}
return false
}
// SetVal allocates a new g.Val and returns the pointer to it.
func (g *GraphDefinitionMarker) SetVal(v json.Number) {
g.Val = &v
}
// GetValue returns the Value field if non-nil, zero value otherwise.
func (g *GraphDefinitionMarker) GetValue() string {
if g == nil || g.Value == nil {
return ""
}
return *g.Value
}
// GetValueOk returns a tuple with the Value field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (g *GraphDefinitionMarker) GetValueOk() (string, bool) {
if g == nil || g.Value == nil {
return "", false
}
return *g.Value, true
}
// HasValue returns a boolean if a field has been set.
func (g *GraphDefinitionMarker) HasValue() bool {
if g != nil && g.Value != nil {
return true
}
return false
}
// SetValue allocates a new g.Value and returns the pointer to it.
func (g *GraphDefinitionMarker) SetValue(v string) {
g.Value = &v
}
// GetAggregator returns the Aggregator field if non-nil, zero value otherwise.
func (g *GraphDefinitionRequest) GetAggregator() string {
if g == nil || g.Aggregator == nil {
return ""
}
return *g.Aggregator
}
// GetAggregatorOk returns a tuple with the Aggregator field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (g *GraphDefinitionRequest) GetAggregatorOk() (string, bool) {
if g == nil || g.Aggregator == nil {
return "", false
}
return *g.Aggregator, true
}
// HasAggregator returns a boolean if a field has been set.
func (g *GraphDefinitionRequest) HasAggregator() bool {
if g != nil && g.Aggregator != nil {
return true
}
return false
}
// SetAggregator allocates a new g.Aggregator and returns the pointer to it.
func (g *GraphDefinitionRequest) SetAggregator(v string) {
g.Aggregator = &v
}
// GetApmQuery returns the ApmQuery field if non-nil, zero value otherwise.
func (g *GraphDefinitionRequest) GetApmQuery() GraphApmOrLogQuery {
if g == nil || g.ApmQuery == nil {
return GraphApmOrLogQuery{}
}
return *g.ApmQuery
}
// GetApmQueryOk returns a tuple with the ApmQuery field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (g *GraphDefinitionRequest) GetApmQueryOk() (GraphApmOrLogQuery, bool) {
if g == nil || g.ApmQuery == nil {
return GraphApmOrLogQuery{}, false
}
return *g.ApmQuery, true
}
// HasApmQuery returns a boolean if a field has been set.
func (g *GraphDefinitionRequest) HasApmQuery() bool {
if g != nil && g.ApmQuery != nil {
return true
}
return false
}
// SetApmQuery allocates a new g.ApmQuery and returns the pointer to it.
func (g *GraphDefinitionRequest) SetApmQuery(v GraphApmOrLogQuery) {
g.ApmQuery = &v
}
// GetChangeType returns the ChangeType field if non-nil, zero value otherwise.
func (g *GraphDefinitionRequest) GetChangeType() string {
if g == nil || g.ChangeType == nil {
return ""
}
return *g.ChangeType
}
// GetChangeTypeOk returns a tuple with the ChangeType field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (g *GraphDefinitionRequest) GetChangeTypeOk() (string, bool) {
if g == nil || g.ChangeType == nil {
return "", false
}
return *g.ChangeType, true
}
// HasChangeType returns a boolean if a field has been set.
func (g *GraphDefinitionRequest) HasChangeType() bool {
if g != nil && g.ChangeType != nil {
return true
}
return false
}
// SetChangeType allocates a new g.ChangeType and returns the pointer to it.
func (g *GraphDefinitionRequest) SetChangeType(v string) {
g.ChangeType = &v
}
// GetCompareTo returns the CompareTo field if non-nil, zero value otherwise.
func (g *GraphDefinitionRequest) GetCompareTo() string {
if g == nil || g.CompareTo == nil {
return ""
}
return *g.CompareTo
}
// GetCompareToOk returns a tuple with the CompareTo field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (g *GraphDefinitionRequest) GetCompareToOk() (string, bool) {
if g == nil || g.CompareTo == nil {
return "", false
}
return *g.CompareTo, true
}
// HasCompareTo returns a boolean if a field has been set.
func (g *GraphDefinitionRequest) HasCompareTo() bool {
if g != nil && g.CompareTo != nil {
return true
}
return false
}
// SetCompareTo allocates a new g.CompareTo and returns the pointer to it.
func (g *GraphDefinitionRequest) SetCompareTo(v string) {
g.CompareTo = &v
}
// GetExtraCol returns the ExtraCol field if non-nil, zero value otherwise.
func (g *GraphDefinitionRequest) GetExtraCol() string {
if g == nil || g.ExtraCol == nil {
return ""
}
return *g.ExtraCol
}
// GetExtraColOk returns a tuple with the ExtraCol field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (g *GraphDefinitionRequest) GetExtraColOk() (string, bool) {
if g == nil || g.ExtraCol == nil {
return "", false
}
return *g.ExtraCol, true
}
// HasExtraCol returns a boolean if a field has been set.
func (g *GraphDefinitionRequest) HasExtraCol() bool {
if g != nil && g.ExtraCol != nil {
return true
}
return false
}
// SetExtraCol allocates a new g.ExtraCol and returns the pointer to it.
func (g *GraphDefinitionRequest) SetExtraCol(v string) {
g.ExtraCol = &v
}
// GetIncreaseGood returns the IncreaseGood field if non-nil, zero value otherwise.
func (g *GraphDefinitionRequest) GetIncreaseGood() bool {
if g == nil || g.IncreaseGood == nil {
return false
}
return *g.IncreaseGood
}
// GetIncreaseGoodOk returns a tuple with the IncreaseGood field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (g *GraphDefinitionRequest) GetIncreaseGoodOk() (bool, bool) {
if g == nil || g.IncreaseGood == nil {
return false, false
}
return *g.IncreaseGood, true
}
// HasIncreaseGood returns a boolean if a field has been set.
func (g *GraphDefinitionRequest) HasIncreaseGood() bool {
if g != nil && g.IncreaseGood != nil {
return true
}
return false
}
// SetIncreaseGood allocates a new g.IncreaseGood and returns the pointer to it.
func (g *GraphDefinitionRequest) SetIncreaseGood(v bool) {
g.IncreaseGood = &v
}
// GetLogQuery returns the LogQuery field if non-nil, zero value otherwise.
func (g *GraphDefinitionRequest) GetLogQuery() GraphApmOrLogQuery {
if g == nil || g.LogQuery == nil {
return GraphApmOrLogQuery{}
}
return *g.LogQuery
}
// GetLogQueryOk returns a tuple with the LogQuery field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (g *GraphDefinitionRequest) GetLogQueryOk() (GraphApmOrLogQuery, bool) {
if g == nil || g.LogQuery == nil {
return GraphApmOrLogQuery{}, false
}
return *g.LogQuery, true
}
// HasLogQuery returns a boolean if a field has been set.
func (g *GraphDefinitionRequest) HasLogQuery() bool {
if g != nil && g.LogQuery != nil {
return true
}
return false
}
// SetLogQuery allocates a new g.LogQuery and returns the pointer to it.
func (g *GraphDefinitionRequest) SetLogQuery(v GraphApmOrLogQuery) {
g.LogQuery = &v
}
// GetOrderBy returns the OrderBy field if non-nil, zero value otherwise.
func (g *GraphDefinitionRequest) GetOrderBy() string {
if g == nil || g.OrderBy == nil {
return ""
}
return *g.OrderBy
}
// GetOrderByOk returns a tuple with the OrderBy field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (g *GraphDefinitionRequest) GetOrderByOk() (string, bool) {
if g == nil || g.OrderBy == nil {
return "", false
}
return *g.OrderBy, true
}
// HasOrderBy returns a boolean if a field has been set.
func (g *GraphDefinitionRequest) HasOrderBy() bool {
if g != nil && g.OrderBy != nil {
return true
}
return false
}
// SetOrderBy allocates a new g.OrderBy and returns the pointer to it.
func (g *GraphDefinitionRequest) SetOrderBy(v string) {
g.OrderBy = &v
}
// GetOrderDirection returns the OrderDirection field if non-nil, zero value otherwise.
func (g *GraphDefinitionRequest) GetOrderDirection() string {
if g == nil || g.OrderDirection == nil {
return ""
}
return *g.OrderDirection
}
// GetOrderDirectionOk returns a tuple with the OrderDirection field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (g *GraphDefinitionRequest) GetOrderDirectionOk() (string, bool) {
if g == nil || g.OrderDirection == nil {
return "", false
}
return *g.OrderDirection, true
}
// HasOrderDirection returns a boolean if a field has been set.
func (g *GraphDefinitionRequest) HasOrderDirection() bool {
if g != nil && g.OrderDirection != nil {
return true
}
return false
}
// SetOrderDirection allocates a new g.OrderDirection and returns the pointer to it.
func (g *GraphDefinitionRequest) SetOrderDirection(v string) {
g.OrderDirection = &v
}
// GetProcessQuery returns the ProcessQuery field if non-nil, zero value otherwise.
func (g *GraphDefinitionRequest) GetProcessQuery() GraphProcessQuery {
if g == nil || g.ProcessQuery == nil {
return GraphProcessQuery{}
}
return *g.ProcessQuery
}
// GetProcessQueryOk returns a tuple with the ProcessQuery field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (g *GraphDefinitionRequest) GetProcessQueryOk() (GraphProcessQuery, bool) {
if g == nil || g.ProcessQuery == nil {
return GraphProcessQuery{}, false
}
return *g.ProcessQuery, true
}
// HasProcessQuery returns a boolean if a field has been set.
func (g *GraphDefinitionRequest) HasProcessQuery() bool {
if g != nil && g.ProcessQuery != nil {
return true
}
return false
}
// SetProcessQuery allocates a new g.ProcessQuery and returns the pointer to it.
func (g *GraphDefinitionRequest) SetProcessQuery(v GraphProcessQuery) {
g.ProcessQuery = &v
}
// GetQuery returns the Query field if non-nil, zero value otherwise.
func (g *GraphDefinitionRequest) GetQuery() string {
if g == nil || g.Query == nil {
return ""
}
return *g.Query
}
// GetQueryOk returns a tuple with the Query field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (g *GraphDefinitionRequest) GetQueryOk() (string, bool) {
if g == nil || g.Query == nil {
return "", false
}
return *g.Query, true
}
// HasQuery returns a boolean if a field has been set.
func (g *GraphDefinitionRequest) HasQuery() bool {
if g != nil && g.Query != nil {
return true
}
return false
}
// SetQuery allocates a new g.Query and returns the pointer to it.
func (g *GraphDefinitionRequest) SetQuery(v string) {
g.Query = &v
}
// GetStacked returns the Stacked field if non-nil, zero value otherwise.
func (g *GraphDefinitionRequest) GetStacked() bool {
if g == nil || g.Stacked == nil {
return false
}
return *g.Stacked
}
// GetStackedOk returns a tuple with the Stacked field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (g *GraphDefinitionRequest) GetStackedOk() (bool, bool) {
if g == nil || g.Stacked == nil {
return false, false
}
return *g.Stacked, true
}
// HasStacked returns a boolean if a field has been set.
func (g *GraphDefinitionRequest) HasStacked() bool {
if g != nil && g.Stacked != nil {
return true
}
return false
}
// SetStacked allocates a new g.Stacked and returns the pointer to it.
func (g *GraphDefinitionRequest) SetStacked(v bool) {
g.Stacked = &v
}
// GetStyle returns the Style field if non-nil, zero value otherwise.
func (g *GraphDefinitionRequest) GetStyle() GraphDefinitionRequestStyle {
if g == nil || g.Style == nil {
return GraphDefinitionRequestStyle{}
}
return *g.Style
}
// GetStyleOk returns a tuple with the Style field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (g *GraphDefinitionRequest) GetStyleOk() (GraphDefinitionRequestStyle, bool) {
if g == nil || g.Style == nil {
return GraphDefinitionRequestStyle{}, false
}
return *g.Style, true
}
// HasStyle returns a boolean if a field has been set.
func (g *GraphDefinitionRequest) HasStyle() bool {
if g != nil && g.Style != nil {
return true
}
return false
}
// SetStyle allocates a new g.Style and returns the pointer to it.
func (g *GraphDefinitionRequest) SetStyle(v GraphDefinitionRequestStyle) {
g.Style = &v
}
// GetType returns the Type field if non-nil, zero value otherwise.
func (g *GraphDefinitionRequest) GetType() string {
if g == nil || g.Type == nil {
return ""
}
return *g.Type
}
// GetTypeOk returns a tuple with the Type field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (g *GraphDefinitionRequest) GetTypeOk() (string, bool) {
if g == nil || g.Type == nil {
return "", false
}
return *g.Type, true
}
// HasType returns a boolean if a field has been set.
func (g *GraphDefinitionRequest) HasType() bool {
if g != nil && g.Type != nil {
return true
}
return false
}
// SetType allocates a new g.Type and returns the pointer to it.
func (g *GraphDefinitionRequest) SetType(v string) {
g.Type = &v
}
// GetPalette returns the Palette field if non-nil, zero value otherwise.
func (g *GraphDefinitionRequestStyle) GetPalette() string {
if g == nil || g.Palette == nil {
return ""
}
return *g.Palette
}
// GetPaletteOk returns a tuple with the Palette field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (g *GraphDefinitionRequestStyle) GetPaletteOk() (string, bool) {
if g == nil || g.Palette == nil {
return "", false
}
return *g.Palette, true
}
// HasPalette returns a boolean if a field has been set.
func (g *GraphDefinitionRequestStyle) HasPalette() bool {
if g != nil && g.Palette != nil {
return true
}
return false
}
// SetPalette allocates a new g.Palette and returns the pointer to it.
func (g *GraphDefinitionRequestStyle) SetPalette(v string) {
g.Palette = &v
}
// GetType returns the Type field if non-nil, zero value otherwise.
func (g *GraphDefinitionRequestStyle) GetType() string {
if g == nil || g.Type == nil {
return ""
}
return *g.Type
}
// GetTypeOk returns a tuple with the Type field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (g *GraphDefinitionRequestStyle) GetTypeOk() (string, bool) {
if g == nil || g.Type == nil {
return "", false
}
return *g.Type, true
}
// HasType returns a boolean if a field has been set.
func (g *GraphDefinitionRequestStyle) HasType() bool {
if g != nil && g.Type != nil {
return true
}
return false
}
// SetType allocates a new g.Type and returns the pointer to it.
func (g *GraphDefinitionRequestStyle) SetType(v string) {
g.Type = &v
}
// GetWidth returns the Width field if non-nil, zero value otherwise.
func (g *GraphDefinitionRequestStyle) GetWidth() string {
if g == nil || g.Width == nil {
return ""
}
return *g.Width
}
// GetWidthOk returns a tuple with the Width field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (g *GraphDefinitionRequestStyle) GetWidthOk() (string, bool) {
if g == nil || g.Width == nil {
return "", false
}
return *g.Width, true
}
// HasWidth returns a boolean if a field has been set.
func (g *GraphDefinitionRequestStyle) HasWidth() bool {
if g != nil && g.Width != nil {
return true
}
return false
}
// SetWidth allocates a new g.Width and returns the pointer to it.
func (g *GraphDefinitionRequestStyle) SetWidth(v string) {
g.Width = &v
}
// GetQuery returns the Query field if non-nil, zero value otherwise.
func (g *GraphEvent) GetQuery() string {
if g == nil || g.Query == nil {
return ""
}
return *g.Query
}
// GetQueryOk returns a tuple with the Query field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (g *GraphEvent) GetQueryOk() (string, bool) {
if g == nil || g.Query == nil {
return "", false
}
return *g.Query, true
}
// HasQuery returns a boolean if a field has been set.
func (g *GraphEvent) HasQuery() bool {
if g != nil && g.Query != nil {
return true
}
return false
}
// SetQuery allocates a new g.Query and returns the pointer to it.
func (g *GraphEvent) SetQuery(v string) {
g.Query = &v
}
// GetLimit returns the Limit field if non-nil, zero value otherwise.
func (g *GraphProcessQuery) GetLimit() int {
if g == nil || g.Limit == nil {
return 0
}
return *g.Limit
}
// GetLimitOk returns a tuple with the Limit field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (g *GraphProcessQuery) GetLimitOk() (int, bool) {
if g == nil || g.Limit == nil {
return 0, false
}
return *g.Limit, true
}
// HasLimit returns a boolean if a field has been set.
func (g *GraphProcessQuery) HasLimit() bool {
if g != nil && g.Limit != nil {
return true
}
return false
}
// SetLimit allocates a new g.Limit and returns the pointer to it.
func (g *GraphProcessQuery) SetLimit(v int) {
g.Limit = &v
}
// GetMetric returns the Metric field if non-nil, zero value otherwise.
func (g *GraphProcessQuery) GetMetric() string {
if g == nil || g.Metric == nil {
return ""
}
return *g.Metric
}
// GetMetricOk returns a tuple with the Metric field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (g *GraphProcessQuery) GetMetricOk() (string, bool) {
if g == nil || g.Metric == nil {
return "", false
}
return *g.Metric, true
}
// HasMetric returns a boolean if a field has been set.
func (g *GraphProcessQuery) HasMetric() bool {
if g != nil && g.Metric != nil {
return true
}
return false
}
// SetMetric allocates a new g.Metric and returns the pointer to it.
func (g *GraphProcessQuery) SetMetric(v string) {
g.Metric = &v
}
// GetSearchBy returns the SearchBy field if non-nil, zero value otherwise.
func (g *GraphProcessQuery) GetSearchBy() string {
if g == nil || g.SearchBy == nil {
return ""
}
return *g.SearchBy
}
// GetSearchByOk returns a tuple with the SearchBy field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (g *GraphProcessQuery) GetSearchByOk() (string, bool) {
if g == nil || g.SearchBy == nil {
return "", false
}
return *g.SearchBy, true
}
// HasSearchBy returns a boolean if a field has been set.
func (g *GraphProcessQuery) HasSearchBy() bool {
if g != nil && g.SearchBy != nil {
return true
}
return false
}
// SetSearchBy allocates a new g.SearchBy and returns the pointer to it.
func (g *GraphProcessQuery) SetSearchBy(v string) {
g.SearchBy = &v
}
// GetGrokRule returns the GrokRule field if non-nil, zero value otherwise.
func (g *GrokParser) GetGrokRule() GrokRule {
if g == nil || g.GrokRule == nil {
return GrokRule{}
}
return *g.GrokRule
}
// GetGrokRuleOk returns a tuple with the GrokRule field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (g *GrokParser) GetGrokRuleOk() (GrokRule, bool) {
if g == nil || g.GrokRule == nil {
return GrokRule{}, false
}
return *g.GrokRule, true
}
// HasGrokRule returns a boolean if a field has been set.
func (g *GrokParser) HasGrokRule() bool {
if g != nil && g.GrokRule != nil {
return true
}
return false
}
// SetGrokRule allocates a new g.GrokRule and returns the pointer to it.
func (g *GrokParser) SetGrokRule(v GrokRule) {
g.GrokRule = &v
}
// GetSource returns the Source field if non-nil, zero value otherwise.
func (g *GrokParser) GetSource() string {
if g == nil || g.Source == nil {
return ""
}
return *g.Source
}
// GetSourceOk returns a tuple with the Source field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (g *GrokParser) GetSourceOk() (string, bool) {
if g == nil || g.Source == nil {
return "", false
}
return *g.Source, true
}
// HasSource returns a boolean if a field has been set.
func (g *GrokParser) HasSource() bool {
if g != nil && g.Source != nil {
return true
}
return false
}
// SetSource allocates a new g.Source and returns the pointer to it.
func (g *GrokParser) SetSource(v string) {
g.Source = &v
}
// GetMatchRules returns the MatchRules field if non-nil, zero value otherwise.
func (g *GrokRule) GetMatchRules() string {
if g == nil || g.MatchRules == nil {
return ""
}
return *g.MatchRules
}
// GetMatchRulesOk returns a tuple with the MatchRules field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (g *GrokRule) GetMatchRulesOk() (string, bool) {
if g == nil || g.MatchRules == nil {
return "", false
}
return *g.MatchRules, true
}
// HasMatchRules returns a boolean if a field has been set.
func (g *GrokRule) HasMatchRules() bool {
if g != nil && g.MatchRules != nil {
return true
}
return false
}
// SetMatchRules allocates a new g.MatchRules and returns the pointer to it.
func (g *GrokRule) SetMatchRules(v string) {
g.MatchRules = &v
}
// GetSupportRules returns the SupportRules field if non-nil, zero value otherwise.
func (g *GrokRule) GetSupportRules() string {
if g == nil || g.SupportRules == nil {
return ""
}
return *g.SupportRules
}
// GetSupportRulesOk returns a tuple with the SupportRules field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (g *GrokRule) GetSupportRulesOk() (string, bool) {
if g == nil || g.SupportRules == nil {
return "", false
}
return *g.SupportRules, true
}
// HasSupportRules returns a boolean if a field has been set.
func (g *GrokRule) HasSupportRules() bool {
if g != nil && g.SupportRules != nil {
return true
}
return false
}
// SetSupportRules allocates a new g.SupportRules and returns the pointer to it.
func (g *GrokRule) SetSupportRules(v string) {
g.SupportRules = &v
}
// GetLastNoDataTs returns the LastNoDataTs field if non-nil, zero value otherwise.
func (g *GroupData) GetLastNoDataTs() int {
if g == nil || g.LastNoDataTs == nil {
return 0
}
return *g.LastNoDataTs
}
// GetLastNoDataTsOk returns a tuple with the LastNoDataTs field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (g *GroupData) GetLastNoDataTsOk() (int, bool) {
if g == nil || g.LastNoDataTs == nil {
return 0, false
}
return *g.LastNoDataTs, true
}
// HasLastNoDataTs returns a boolean if a field has been set.
func (g *GroupData) HasLastNoDataTs() bool {
if g != nil && g.LastNoDataTs != nil {
return true
}
return false
}
// SetLastNoDataTs allocates a new g.LastNoDataTs and returns the pointer to it.
func (g *GroupData) SetLastNoDataTs(v int) {
g.LastNoDataTs = &v
}
// GetLastNotifiedTs returns the LastNotifiedTs field if non-nil, zero value otherwise.
func (g *GroupData) GetLastNotifiedTs() int {
if g == nil || g.LastNotifiedTs == nil {
return 0
}
return *g.LastNotifiedTs
}
// GetLastNotifiedTsOk returns a tuple with the LastNotifiedTs field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (g *GroupData) GetLastNotifiedTsOk() (int, bool) {
if g == nil || g.LastNotifiedTs == nil {
return 0, false
}
return *g.LastNotifiedTs, true
}
// HasLastNotifiedTs returns a boolean if a field has been set.
func (g *GroupData) HasLastNotifiedTs() bool {
if g != nil && g.LastNotifiedTs != nil {
return true
}
return false
}
// SetLastNotifiedTs allocates a new g.LastNotifiedTs and returns the pointer to it.
func (g *GroupData) SetLastNotifiedTs(v int) {
g.LastNotifiedTs = &v
}
// GetLastResolvedTs returns the LastResolvedTs field if non-nil, zero value otherwise.
func (g *GroupData) GetLastResolvedTs() int {
if g == nil || g.LastResolvedTs == nil {
return 0
}
return *g.LastResolvedTs
}
// GetLastResolvedTsOk returns a tuple with the LastResolvedTs field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (g *GroupData) GetLastResolvedTsOk() (int, bool) {
if g == nil || g.LastResolvedTs == nil {
return 0, false
}
return *g.LastResolvedTs, true
}
// HasLastResolvedTs returns a boolean if a field has been set.
func (g *GroupData) HasLastResolvedTs() bool {
if g != nil && g.LastResolvedTs != nil {
return true
}
return false
}
// SetLastResolvedTs allocates a new g.LastResolvedTs and returns the pointer to it.
func (g *GroupData) SetLastResolvedTs(v int) {
g.LastResolvedTs = &v
}
// GetLastTriggeredTs returns the LastTriggeredTs field if non-nil, zero value otherwise.
func (g *GroupData) GetLastTriggeredTs() int {
if g == nil || g.LastTriggeredTs == nil {
return 0
}
return *g.LastTriggeredTs
}
// GetLastTriggeredTsOk returns a tuple with the LastTriggeredTs field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (g *GroupData) GetLastTriggeredTsOk() (int, bool) {
if g == nil || g.LastTriggeredTs == nil {
return 0, false
}
return *g.LastTriggeredTs, true
}
// HasLastTriggeredTs returns a boolean if a field has been set.
func (g *GroupData) HasLastTriggeredTs() bool {
if g != nil && g.LastTriggeredTs != nil {
return true
}
return false
}
// SetLastTriggeredTs allocates a new g.LastTriggeredTs and returns the pointer to it.
func (g *GroupData) SetLastTriggeredTs(v int) {
g.LastTriggeredTs = &v
}
// GetName returns the Name field if non-nil, zero value otherwise.
func (g *GroupData) GetName() string {
if g == nil || g.Name == nil {
return ""
}
return *g.Name
}
// GetNameOk returns a tuple with the Name field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (g *GroupData) GetNameOk() (string, bool) {
if g == nil || g.Name == nil {
return "", false
}
return *g.Name, true
}
// HasName returns a boolean if a field has been set.
func (g *GroupData) HasName() bool {
if g != nil && g.Name != nil {
return true
}
return false
}
// SetName allocates a new g.Name and returns the pointer to it.
func (g *GroupData) SetName(v string) {
g.Name = &v
}
// GetStatus returns the Status field if non-nil, zero value otherwise.
func (g *GroupData) GetStatus() string {
if g == nil || g.Status == nil {
return ""
}
return *g.Status
}
// GetStatusOk returns a tuple with the Status field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (g *GroupData) GetStatusOk() (string, bool) {
if g == nil || g.Status == nil {
return "", false
}
return *g.Status, true
}
// HasStatus returns a boolean if a field has been set.
func (g *GroupData) HasStatus() bool {
if g != nil && g.Status != nil {
return true
}
return false
}
// SetStatus allocates a new g.Status and returns the pointer to it.
func (g *GroupData) SetStatus(v string) {
g.Status = &v
}
// GetTriggeringValue returns the TriggeringValue field if non-nil, zero value otherwise.
func (g *GroupData) GetTriggeringValue() TriggeringValue {
if g == nil || g.TriggeringValue == nil {
return TriggeringValue{}
}
return *g.TriggeringValue
}
// GetTriggeringValueOk returns a tuple with the TriggeringValue field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (g *GroupData) GetTriggeringValueOk() (TriggeringValue, bool) {
if g == nil || g.TriggeringValue == nil {
return TriggeringValue{}, false
}
return *g.TriggeringValue, true
}
// HasTriggeringValue returns a boolean if a field has been set.
func (g *GroupData) HasTriggeringValue() bool {
if g != nil && g.TriggeringValue != nil {
return true
}
return false
}
// SetTriggeringValue allocates a new g.TriggeringValue and returns the pointer to it.
func (g *GroupData) SetTriggeringValue(v TriggeringValue) {
g.TriggeringValue = &v
}
// GetLayoutType returns the LayoutType field if non-nil, zero value otherwise.
func (g *GroupDefinition) GetLayoutType() string {
if g == nil || g.LayoutType == nil {
return ""
}
return *g.LayoutType
}
// GetLayoutTypeOk returns a tuple with the LayoutType field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (g *GroupDefinition) GetLayoutTypeOk() (string, bool) {
if g == nil || g.LayoutType == nil {
return "", false
}
return *g.LayoutType, true
}
// HasLayoutType returns a boolean if a field has been set.
func (g *GroupDefinition) HasLayoutType() bool {
if g != nil && g.LayoutType != nil {
return true
}
return false
}
// SetLayoutType allocates a new g.LayoutType and returns the pointer to it.
func (g *GroupDefinition) SetLayoutType(v string) {
g.LayoutType = &v
}
// GetTitle returns the Title field if non-nil, zero value otherwise.
func (g *GroupDefinition) GetTitle() string {
if g == nil || g.Title == nil {
return ""
}
return *g.Title
}
// GetTitleOk returns a tuple with the Title field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (g *GroupDefinition) GetTitleOk() (string, bool) {
if g == nil || g.Title == nil {
return "", false
}
return *g.Title, true
}
// HasTitle returns a boolean if a field has been set.
func (g *GroupDefinition) HasTitle() bool {
if g != nil && g.Title != nil {
return true
}
return false
}
// SetTitle allocates a new g.Title and returns the pointer to it.
func (g *GroupDefinition) SetTitle(v string) {
g.Title = &v
}
// GetType returns the Type field if non-nil, zero value otherwise.
func (g *GroupDefinition) GetType() string {
if g == nil || g.Type == nil {
return ""
}
return *g.Type
}
// GetTypeOk returns a tuple with the Type field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (g *GroupDefinition) GetTypeOk() (string, bool) {
if g == nil || g.Type == nil {
return "", false
}
return *g.Type, true
}
// HasType returns a boolean if a field has been set.
func (g *GroupDefinition) HasType() bool {
if g != nil && g.Type != nil {
return true
}
return false
}
// SetType allocates a new g.Type and returns the pointer to it.
func (g *GroupDefinition) SetType(v string) {
g.Type = &v
}
// GetTime returns the Time field if non-nil, zero value otherwise.
func (h *HeatmapDefinition) GetTime() WidgetTime {
if h == nil || h.Time == nil {
return WidgetTime{}
}
return *h.Time
}
// GetTimeOk returns a tuple with the Time field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (h *HeatmapDefinition) GetTimeOk() (WidgetTime, bool) {
if h == nil || h.Time == nil {
return WidgetTime{}, false
}
return *h.Time, true
}
// HasTime returns a boolean if a field has been set.
func (h *HeatmapDefinition) HasTime() bool {
if h != nil && h.Time != nil {
return true
}
return false
}
// SetTime allocates a new h.Time and returns the pointer to it.
func (h *HeatmapDefinition) SetTime(v WidgetTime) {
h.Time = &v
}
// GetTitle returns the Title field if non-nil, zero value otherwise.
func (h *HeatmapDefinition) GetTitle() string {
if h == nil || h.Title == nil {
return ""
}
return *h.Title
}
// GetTitleOk returns a tuple with the Title field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (h *HeatmapDefinition) GetTitleOk() (string, bool) {
if h == nil || h.Title == nil {
return "", false
}
return *h.Title, true
}
// HasTitle returns a boolean if a field has been set.
func (h *HeatmapDefinition) HasTitle() bool {
if h != nil && h.Title != nil {
return true
}
return false
}
// SetTitle allocates a new h.Title and returns the pointer to it.
func (h *HeatmapDefinition) SetTitle(v string) {
h.Title = &v
}
// GetTitleAlign returns the TitleAlign field if non-nil, zero value otherwise.
func (h *HeatmapDefinition) GetTitleAlign() string {
if h == nil || h.TitleAlign == nil {
return ""
}
return *h.TitleAlign
}
// GetTitleAlignOk returns a tuple with the TitleAlign field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (h *HeatmapDefinition) GetTitleAlignOk() (string, bool) {
if h == nil || h.TitleAlign == nil {
return "", false
}
return *h.TitleAlign, true
}
// HasTitleAlign returns a boolean if a field has been set.
func (h *HeatmapDefinition) HasTitleAlign() bool {
if h != nil && h.TitleAlign != nil {
return true
}
return false
}
// SetTitleAlign allocates a new h.TitleAlign and returns the pointer to it.
func (h *HeatmapDefinition) SetTitleAlign(v string) {
h.TitleAlign = &v
}
// GetTitleSize returns the TitleSize field if non-nil, zero value otherwise.
func (h *HeatmapDefinition) GetTitleSize() string {
if h == nil || h.TitleSize == nil {
return ""
}
return *h.TitleSize
}
// GetTitleSizeOk returns a tuple with the TitleSize field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (h *HeatmapDefinition) GetTitleSizeOk() (string, bool) {
if h == nil || h.TitleSize == nil {
return "", false
}
return *h.TitleSize, true
}
// HasTitleSize returns a boolean if a field has been set.
func (h *HeatmapDefinition) HasTitleSize() bool {
if h != nil && h.TitleSize != nil {
return true
}
return false
}
// SetTitleSize allocates a new h.TitleSize and returns the pointer to it.
func (h *HeatmapDefinition) SetTitleSize(v string) {
h.TitleSize = &v
}
// GetType returns the Type field if non-nil, zero value otherwise.
func (h *HeatmapDefinition) GetType() string {
if h == nil || h.Type == nil {
return ""
}
return *h.Type
}
// GetTypeOk returns a tuple with the Type field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (h *HeatmapDefinition) GetTypeOk() (string, bool) {
if h == nil || h.Type == nil {
return "", false
}
return *h.Type, true
}
// HasType returns a boolean if a field has been set.
func (h *HeatmapDefinition) HasType() bool {
if h != nil && h.Type != nil {
return true
}
return false
}
// SetType allocates a new h.Type and returns the pointer to it.
func (h *HeatmapDefinition) SetType(v string) {
h.Type = &v
}
// GetYaxis returns the Yaxis field if non-nil, zero value otherwise.
func (h *HeatmapDefinition) GetYaxis() WidgetAxis {
if h == nil || h.Yaxis == nil {
return WidgetAxis{}
}
return *h.Yaxis
}
// GetYaxisOk returns a tuple with the Yaxis field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (h *HeatmapDefinition) GetYaxisOk() (WidgetAxis, bool) {
if h == nil || h.Yaxis == nil {
return WidgetAxis{}, false
}
return *h.Yaxis, true
}
// HasYaxis returns a boolean if a field has been set.
func (h *HeatmapDefinition) HasYaxis() bool {
if h != nil && h.Yaxis != nil {
return true
}
return false
}
// SetYaxis allocates a new h.Yaxis and returns the pointer to it.
func (h *HeatmapDefinition) SetYaxis(v WidgetAxis) {
h.Yaxis = &v
}
// GetApmQuery returns the ApmQuery field if non-nil, zero value otherwise.
func (h *HeatmapRequest) GetApmQuery() WidgetApmOrLogQuery {
if h == nil || h.ApmQuery == nil {
return WidgetApmOrLogQuery{}
}
return *h.ApmQuery
}
// GetApmQueryOk returns a tuple with the ApmQuery field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (h *HeatmapRequest) GetApmQueryOk() (WidgetApmOrLogQuery, bool) {
if h == nil || h.ApmQuery == nil {
return WidgetApmOrLogQuery{}, false
}
return *h.ApmQuery, true
}
// HasApmQuery returns a boolean if a field has been set.
func (h *HeatmapRequest) HasApmQuery() bool {
if h != nil && h.ApmQuery != nil {
return true
}
return false
}
// SetApmQuery allocates a new h.ApmQuery and returns the pointer to it.
func (h *HeatmapRequest) SetApmQuery(v WidgetApmOrLogQuery) {
h.ApmQuery = &v
}
// GetLogQuery returns the LogQuery field if non-nil, zero value otherwise.
func (h *HeatmapRequest) GetLogQuery() WidgetApmOrLogQuery {
if h == nil || h.LogQuery == nil {
return WidgetApmOrLogQuery{}
}
return *h.LogQuery
}
// GetLogQueryOk returns a tuple with the LogQuery field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (h *HeatmapRequest) GetLogQueryOk() (WidgetApmOrLogQuery, bool) {
if h == nil || h.LogQuery == nil {
return WidgetApmOrLogQuery{}, false
}
return *h.LogQuery, true
}
// HasLogQuery returns a boolean if a field has been set.
func (h *HeatmapRequest) HasLogQuery() bool {
if h != nil && h.LogQuery != nil {
return true
}
return false
}
// SetLogQuery allocates a new h.LogQuery and returns the pointer to it.
func (h *HeatmapRequest) SetLogQuery(v WidgetApmOrLogQuery) {
h.LogQuery = &v
}
// GetMetricQuery returns the MetricQuery field if non-nil, zero value otherwise.
func (h *HeatmapRequest) GetMetricQuery() string {
if h == nil || h.MetricQuery == nil {
return ""
}
return *h.MetricQuery
}
// GetMetricQueryOk returns a tuple with the MetricQuery field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (h *HeatmapRequest) GetMetricQueryOk() (string, bool) {
if h == nil || h.MetricQuery == nil {
return "", false
}
return *h.MetricQuery, true
}
// HasMetricQuery returns a boolean if a field has been set.
func (h *HeatmapRequest) HasMetricQuery() bool {
if h != nil && h.MetricQuery != nil {
return true
}
return false
}
// SetMetricQuery allocates a new h.MetricQuery and returns the pointer to it.
func (h *HeatmapRequest) SetMetricQuery(v string) {
h.MetricQuery = &v
}
// GetProcessQuery returns the ProcessQuery field if non-nil, zero value otherwise.
func (h *HeatmapRequest) GetProcessQuery() WidgetProcessQuery {
if h == nil || h.ProcessQuery == nil {
return WidgetProcessQuery{}
}
return *h.ProcessQuery
}
// GetProcessQueryOk returns a tuple with the ProcessQuery field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (h *HeatmapRequest) GetProcessQueryOk() (WidgetProcessQuery, bool) {
if h == nil || h.ProcessQuery == nil {
return WidgetProcessQuery{}, false
}
return *h.ProcessQuery, true
}
// HasProcessQuery returns a boolean if a field has been set.
func (h *HeatmapRequest) HasProcessQuery() bool {
if h != nil && h.ProcessQuery != nil {
return true
}
return false
}
// SetProcessQuery allocates a new h.ProcessQuery and returns the pointer to it.
func (h *HeatmapRequest) SetProcessQuery(v WidgetProcessQuery) {
h.ProcessQuery = &v
}
// GetStyle returns the Style field if non-nil, zero value otherwise.
func (h *HeatmapRequest) GetStyle() WidgetRequestStyle {
if h == nil || h.Style == nil {
return WidgetRequestStyle{}
}
return *h.Style
}
// GetStyleOk returns a tuple with the Style field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (h *HeatmapRequest) GetStyleOk() (WidgetRequestStyle, bool) {
if h == nil || h.Style == nil {
return WidgetRequestStyle{}, false
}
return *h.Style, true
}
// HasStyle returns a boolean if a field has been set.
func (h *HeatmapRequest) HasStyle() bool {
if h != nil && h.Style != nil {
return true
}
return false
}
// SetStyle allocates a new h.Style and returns the pointer to it.
func (h *HeatmapRequest) SetStyle(v WidgetRequestStyle) {
h.Style = &v
}
// GetEndTime returns the EndTime field if non-nil, zero value otherwise.
func (h *HostActionMute) GetEndTime() string {
if h == nil || h.EndTime == nil {
return ""
}
return *h.EndTime
}
// GetEndTimeOk returns a tuple with the EndTime field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (h *HostActionMute) GetEndTimeOk() (string, bool) {
if h == nil || h.EndTime == nil {
return "", false
}
return *h.EndTime, true
}
// HasEndTime returns a boolean if a field has been set.
func (h *HostActionMute) HasEndTime() bool {
if h != nil && h.EndTime != nil {
return true
}
return false
}
// SetEndTime allocates a new h.EndTime and returns the pointer to it.
func (h *HostActionMute) SetEndTime(v string) {
h.EndTime = &v
}
// GetMessage returns the Message field if non-nil, zero value otherwise.
func (h *HostActionMute) GetMessage() string {
if h == nil || h.Message == nil {
return ""
}
return *h.Message
}
// GetMessageOk returns a tuple with the Message field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (h *HostActionMute) GetMessageOk() (string, bool) {
if h == nil || h.Message == nil {
return "", false
}
return *h.Message, true
}
// HasMessage returns a boolean if a field has been set.
func (h *HostActionMute) HasMessage() bool {
if h != nil && h.Message != nil {
return true
}
return false
}
// SetMessage allocates a new h.Message and returns the pointer to it.
func (h *HostActionMute) SetMessage(v string) {
h.Message = &v
}
// GetOverride returns the Override field if non-nil, zero value otherwise.
func (h *HostActionMute) GetOverride() bool {
if h == nil || h.Override == nil {
return false
}
return *h.Override
}
// GetOverrideOk returns a tuple with the Override field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (h *HostActionMute) GetOverrideOk() (bool, bool) {
if h == nil || h.Override == nil {
return false, false
}
return *h.Override, true
}
// HasOverride returns a boolean if a field has been set.
func (h *HostActionMute) HasOverride() bool {
if h != nil && h.Override != nil {
return true
}
return false
}
// SetOverride allocates a new h.Override and returns the pointer to it.
func (h *HostActionMute) SetOverride(v bool) {
h.Override = &v
}
// GetNodeType returns the NodeType field if non-nil, zero value otherwise.
func (h *HostmapDefinition) GetNodeType() string {
if h == nil || h.NodeType == nil {
return ""
}
return *h.NodeType
}
// GetNodeTypeOk returns a tuple with the NodeType field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (h *HostmapDefinition) GetNodeTypeOk() (string, bool) {
if h == nil || h.NodeType == nil {
return "", false
}
return *h.NodeType, true
}
// HasNodeType returns a boolean if a field has been set.
func (h *HostmapDefinition) HasNodeType() bool {
if h != nil && h.NodeType != nil {
return true
}
return false
}
// SetNodeType allocates a new h.NodeType and returns the pointer to it.
func (h *HostmapDefinition) SetNodeType(v string) {
h.NodeType = &v
}
// GetNoGroupHosts returns the NoGroupHosts field if non-nil, zero value otherwise.
func (h *HostmapDefinition) GetNoGroupHosts() bool {
if h == nil || h.NoGroupHosts == nil {
return false
}
return *h.NoGroupHosts
}
// GetNoGroupHostsOk returns a tuple with the NoGroupHosts field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (h *HostmapDefinition) GetNoGroupHostsOk() (bool, bool) {
if h == nil || h.NoGroupHosts == nil {
return false, false
}
return *h.NoGroupHosts, true
}
// HasNoGroupHosts returns a boolean if a field has been set.
func (h *HostmapDefinition) HasNoGroupHosts() bool {
if h != nil && h.NoGroupHosts != nil {
return true
}
return false
}
// SetNoGroupHosts allocates a new h.NoGroupHosts and returns the pointer to it.
func (h *HostmapDefinition) SetNoGroupHosts(v bool) {
h.NoGroupHosts = &v
}
// GetNoMetricHosts returns the NoMetricHosts field if non-nil, zero value otherwise.
func (h *HostmapDefinition) GetNoMetricHosts() bool {
if h == nil || h.NoMetricHosts == nil {
return false
}
return *h.NoMetricHosts
}
// GetNoMetricHostsOk returns a tuple with the NoMetricHosts field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (h *HostmapDefinition) GetNoMetricHostsOk() (bool, bool) {
if h == nil || h.NoMetricHosts == nil {
return false, false
}
return *h.NoMetricHosts, true
}
// HasNoMetricHosts returns a boolean if a field has been set.
func (h *HostmapDefinition) HasNoMetricHosts() bool {
if h != nil && h.NoMetricHosts != nil {
return true
}
return false
}
// SetNoMetricHosts allocates a new h.NoMetricHosts and returns the pointer to it.
func (h *HostmapDefinition) SetNoMetricHosts(v bool) {
h.NoMetricHosts = &v
}
// GetRequests returns the Requests field if non-nil, zero value otherwise.
func (h *HostmapDefinition) GetRequests() HostmapRequests {
if h == nil || h.Requests == nil {
return HostmapRequests{}
}
return *h.Requests
}
// GetRequestsOk returns a tuple with the Requests field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (h *HostmapDefinition) GetRequestsOk() (HostmapRequests, bool) {
if h == nil || h.Requests == nil {
return HostmapRequests{}, false
}
return *h.Requests, true
}
// HasRequests returns a boolean if a field has been set.
func (h *HostmapDefinition) HasRequests() bool {
if h != nil && h.Requests != nil {
return true
}
return false
}
// SetRequests allocates a new h.Requests and returns the pointer to it.
func (h *HostmapDefinition) SetRequests(v HostmapRequests) {
h.Requests = &v
}
// GetStyle returns the Style field if non-nil, zero value otherwise.
func (h *HostmapDefinition) GetStyle() HostmapStyle {
if h == nil || h.Style == nil {
return HostmapStyle{}
}
return *h.Style
}
// GetStyleOk returns a tuple with the Style field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (h *HostmapDefinition) GetStyleOk() (HostmapStyle, bool) {
if h == nil || h.Style == nil {
return HostmapStyle{}, false
}
return *h.Style, true
}
// HasStyle returns a boolean if a field has been set.
func (h *HostmapDefinition) HasStyle() bool {
if h != nil && h.Style != nil {
return true
}
return false
}
// SetStyle allocates a new h.Style and returns the pointer to it.
func (h *HostmapDefinition) SetStyle(v HostmapStyle) {
h.Style = &v
}
// GetTitle returns the Title field if non-nil, zero value otherwise.
func (h *HostmapDefinition) GetTitle() string {
if h == nil || h.Title == nil {
return ""
}
return *h.Title
}
// GetTitleOk returns a tuple with the Title field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (h *HostmapDefinition) GetTitleOk() (string, bool) {
if h == nil || h.Title == nil {
return "", false
}
return *h.Title, true
}
// HasTitle returns a boolean if a field has been set.
func (h *HostmapDefinition) HasTitle() bool {
if h != nil && h.Title != nil {
return true
}
return false
}
// SetTitle allocates a new h.Title and returns the pointer to it.
func (h *HostmapDefinition) SetTitle(v string) {
h.Title = &v
}
// GetTitleAlign returns the TitleAlign field if non-nil, zero value otherwise.
func (h *HostmapDefinition) GetTitleAlign() string {
if h == nil || h.TitleAlign == nil {
return ""
}
return *h.TitleAlign
}
// GetTitleAlignOk returns a tuple with the TitleAlign field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (h *HostmapDefinition) GetTitleAlignOk() (string, bool) {
if h == nil || h.TitleAlign == nil {
return "", false
}
return *h.TitleAlign, true
}
// HasTitleAlign returns a boolean if a field has been set.
func (h *HostmapDefinition) HasTitleAlign() bool {
if h != nil && h.TitleAlign != nil {
return true
}
return false
}
// SetTitleAlign allocates a new h.TitleAlign and returns the pointer to it.
func (h *HostmapDefinition) SetTitleAlign(v string) {
h.TitleAlign = &v
}
// GetTitleSize returns the TitleSize field if non-nil, zero value otherwise.
func (h *HostmapDefinition) GetTitleSize() string {
if h == nil || h.TitleSize == nil {
return ""
}
return *h.TitleSize
}
// GetTitleSizeOk returns a tuple with the TitleSize field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (h *HostmapDefinition) GetTitleSizeOk() (string, bool) {
if h == nil || h.TitleSize == nil {
return "", false
}
return *h.TitleSize, true
}
// HasTitleSize returns a boolean if a field has been set.
func (h *HostmapDefinition) HasTitleSize() bool {
if h != nil && h.TitleSize != nil {
return true
}
return false
}
// SetTitleSize allocates a new h.TitleSize and returns the pointer to it.
func (h *HostmapDefinition) SetTitleSize(v string) {
h.TitleSize = &v
}
// GetType returns the Type field if non-nil, zero value otherwise.
func (h *HostmapDefinition) GetType() string {
if h == nil || h.Type == nil {
return ""
}
return *h.Type
}
// GetTypeOk returns a tuple with the Type field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (h *HostmapDefinition) GetTypeOk() (string, bool) {
if h == nil || h.Type == nil {
return "", false
}
return *h.Type, true
}
// HasType returns a boolean if a field has been set.
func (h *HostmapDefinition) HasType() bool {
if h != nil && h.Type != nil {
return true
}
return false
}
// SetType allocates a new h.Type and returns the pointer to it.
func (h *HostmapDefinition) SetType(v string) {
h.Type = &v
}
// GetApmQuery returns the ApmQuery field if non-nil, zero value otherwise.
func (h *HostmapRequest) GetApmQuery() WidgetApmOrLogQuery {
if h == nil || h.ApmQuery == nil {
return WidgetApmOrLogQuery{}
}
return *h.ApmQuery
}
// GetApmQueryOk returns a tuple with the ApmQuery field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (h *HostmapRequest) GetApmQueryOk() (WidgetApmOrLogQuery, bool) {
if h == nil || h.ApmQuery == nil {
return WidgetApmOrLogQuery{}, false
}
return *h.ApmQuery, true
}
// HasApmQuery returns a boolean if a field has been set.
func (h *HostmapRequest) HasApmQuery() bool {
if h != nil && h.ApmQuery != nil {
return true
}
return false
}
// SetApmQuery allocates a new h.ApmQuery and returns the pointer to it.
func (h *HostmapRequest) SetApmQuery(v WidgetApmOrLogQuery) {
h.ApmQuery = &v
}
// GetLogQuery returns the LogQuery field if non-nil, zero value otherwise.
func (h *HostmapRequest) GetLogQuery() WidgetApmOrLogQuery {
if h == nil || h.LogQuery == nil {
return WidgetApmOrLogQuery{}
}
return *h.LogQuery
}
// GetLogQueryOk returns a tuple with the LogQuery field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (h *HostmapRequest) GetLogQueryOk() (WidgetApmOrLogQuery, bool) {
if h == nil || h.LogQuery == nil {
return WidgetApmOrLogQuery{}, false
}
return *h.LogQuery, true
}
// HasLogQuery returns a boolean if a field has been set.
func (h *HostmapRequest) HasLogQuery() bool {
if h != nil && h.LogQuery != nil {
return true
}
return false
}
// SetLogQuery allocates a new h.LogQuery and returns the pointer to it.
func (h *HostmapRequest) SetLogQuery(v WidgetApmOrLogQuery) {
h.LogQuery = &v
}
// GetMetricQuery returns the MetricQuery field if non-nil, zero value otherwise.
func (h *HostmapRequest) GetMetricQuery() string {
if h == nil || h.MetricQuery == nil {
return ""
}
return *h.MetricQuery
}
// GetMetricQueryOk returns a tuple with the MetricQuery field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (h *HostmapRequest) GetMetricQueryOk() (string, bool) {
if h == nil || h.MetricQuery == nil {
return "", false
}
return *h.MetricQuery, true
}
// HasMetricQuery returns a boolean if a field has been set.
func (h *HostmapRequest) HasMetricQuery() bool {
if h != nil && h.MetricQuery != nil {
return true
}
return false
}
// SetMetricQuery allocates a new h.MetricQuery and returns the pointer to it.
func (h *HostmapRequest) SetMetricQuery(v string) {
h.MetricQuery = &v
}
// GetProcessQuery returns the ProcessQuery field if non-nil, zero value otherwise.
func (h *HostmapRequest) GetProcessQuery() WidgetProcessQuery {
if h == nil || h.ProcessQuery == nil {
return WidgetProcessQuery{}
}
return *h.ProcessQuery
}
// GetProcessQueryOk returns a tuple with the ProcessQuery field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (h *HostmapRequest) GetProcessQueryOk() (WidgetProcessQuery, bool) {
if h == nil || h.ProcessQuery == nil {
return WidgetProcessQuery{}, false
}
return *h.ProcessQuery, true
}
// HasProcessQuery returns a boolean if a field has been set.
func (h *HostmapRequest) HasProcessQuery() bool {
if h != nil && h.ProcessQuery != nil {
return true
}
return false
}
// SetProcessQuery allocates a new h.ProcessQuery and returns the pointer to it.
func (h *HostmapRequest) SetProcessQuery(v WidgetProcessQuery) {
h.ProcessQuery = &v
}
// GetFill returns the Fill field if non-nil, zero value otherwise.
func (h *HostmapRequests) GetFill() HostmapRequest {
if h == nil || h.Fill == nil {
return HostmapRequest{}
}
return *h.Fill
}
// GetFillOk returns a tuple with the Fill field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (h *HostmapRequests) GetFillOk() (HostmapRequest, bool) {
if h == nil || h.Fill == nil {
return HostmapRequest{}, false
}
return *h.Fill, true
}
// HasFill returns a boolean if a field has been set.
func (h *HostmapRequests) HasFill() bool {
if h != nil && h.Fill != nil {
return true
}
return false
}
// SetFill allocates a new h.Fill and returns the pointer to it.
func (h *HostmapRequests) SetFill(v HostmapRequest) {
h.Fill = &v
}
// GetSize returns the Size field if non-nil, zero value otherwise.
func (h *HostmapRequests) GetSize() HostmapRequest {
if h == nil || h.Size == nil {
return HostmapRequest{}
}
return *h.Size
}
// GetSizeOk returns a tuple with the Size field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (h *HostmapRequests) GetSizeOk() (HostmapRequest, bool) {
if h == nil || h.Size == nil {
return HostmapRequest{}, false
}
return *h.Size, true
}
// HasSize returns a boolean if a field has been set.
func (h *HostmapRequests) HasSize() bool {
if h != nil && h.Size != nil {
return true
}
return false
}
// SetSize allocates a new h.Size and returns the pointer to it.
func (h *HostmapRequests) SetSize(v HostmapRequest) {
h.Size = &v
}
// GetFillMax returns the FillMax field if non-nil, zero value otherwise.
func (h *HostmapStyle) GetFillMax() string {
if h == nil || h.FillMax == nil {
return ""
}
return *h.FillMax
}
// GetFillMaxOk returns a tuple with the FillMax field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (h *HostmapStyle) GetFillMaxOk() (string, bool) {
if h == nil || h.FillMax == nil {
return "", false
}
return *h.FillMax, true
}
// HasFillMax returns a boolean if a field has been set.
func (h *HostmapStyle) HasFillMax() bool {
if h != nil && h.FillMax != nil {
return true
}
return false
}
// SetFillMax allocates a new h.FillMax and returns the pointer to it.
func (h *HostmapStyle) SetFillMax(v string) {
h.FillMax = &v
}
// GetFillMin returns the FillMin field if non-nil, zero value otherwise.
func (h *HostmapStyle) GetFillMin() string {
if h == nil || h.FillMin == nil {
return ""
}
return *h.FillMin
}
// GetFillMinOk returns a tuple with the FillMin field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (h *HostmapStyle) GetFillMinOk() (string, bool) {
if h == nil || h.FillMin == nil {
return "", false
}
return *h.FillMin, true
}
// HasFillMin returns a boolean if a field has been set.
func (h *HostmapStyle) HasFillMin() bool {
if h != nil && h.FillMin != nil {
return true
}
return false
}
// SetFillMin allocates a new h.FillMin and returns the pointer to it.
func (h *HostmapStyle) SetFillMin(v string) {
h.FillMin = &v
}
// GetPalette returns the Palette field if non-nil, zero value otherwise.
func (h *HostmapStyle) GetPalette() string {
if h == nil || h.Palette == nil {
return ""
}
return *h.Palette
}
// GetPaletteOk returns a tuple with the Palette field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (h *HostmapStyle) GetPaletteOk() (string, bool) {
if h == nil || h.Palette == nil {
return "", false
}
return *h.Palette, true
}
// HasPalette returns a boolean if a field has been set.
func (h *HostmapStyle) HasPalette() bool {
if h != nil && h.Palette != nil {
return true
}
return false
}
// SetPalette allocates a new h.Palette and returns the pointer to it.
func (h *HostmapStyle) SetPalette(v string) {
h.Palette = &v
}
// GetPaletteFlip returns the PaletteFlip field if non-nil, zero value otherwise.
func (h *HostmapStyle) GetPaletteFlip() bool {
if h == nil || h.PaletteFlip == nil {
return false
}
return *h.PaletteFlip
}
// GetPaletteFlipOk returns a tuple with the PaletteFlip field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (h *HostmapStyle) GetPaletteFlipOk() (bool, bool) {
if h == nil || h.PaletteFlip == nil {
return false, false
}
return *h.PaletteFlip, true
}
// HasPaletteFlip returns a boolean if a field has been set.
func (h *HostmapStyle) HasPaletteFlip() bool {
if h != nil && h.PaletteFlip != nil {
return true
}
return false
}
// SetPaletteFlip allocates a new h.PaletteFlip and returns the pointer to it.
func (h *HostmapStyle) SetPaletteFlip(v bool) {
h.PaletteFlip = &v
}
// GetTotalActive returns the TotalActive field if non-nil, zero value otherwise.
func (h *HostTotalsResp) GetTotalActive() int {
if h == nil || h.TotalActive == nil {
return 0
}
return *h.TotalActive
}
// GetTotalActiveOk returns a tuple with the TotalActive field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (h *HostTotalsResp) GetTotalActiveOk() (int, bool) {
if h == nil || h.TotalActive == nil {
return 0, false
}
return *h.TotalActive, true
}
// HasTotalActive returns a boolean if a field has been set.
func (h *HostTotalsResp) HasTotalActive() bool {
if h != nil && h.TotalActive != nil {
return true
}
return false
}
// SetTotalActive allocates a new h.TotalActive and returns the pointer to it.
func (h *HostTotalsResp) SetTotalActive(v int) {
h.TotalActive = &v
}
// GetTotalUp returns the TotalUp field if non-nil, zero value otherwise.
func (h *HostTotalsResp) GetTotalUp() int {
if h == nil || h.TotalUp == nil {
return 0
}
return *h.TotalUp
}
// GetTotalUpOk returns a tuple with the TotalUp field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (h *HostTotalsResp) GetTotalUpOk() (int, bool) {
if h == nil || h.TotalUp == nil {
return 0, false
}
return *h.TotalUp, true
}
// HasTotalUp returns a boolean if a field has been set.
func (h *HostTotalsResp) HasTotalUp() bool {
if h != nil && h.TotalUp != nil {
return true
}
return false
}
// SetTotalUp allocates a new h.TotalUp and returns the pointer to it.
func (h *HostTotalsResp) SetTotalUp(v int) {
h.TotalUp = &v
}
// GetType returns the Type field if non-nil, zero value otherwise.
func (i *IframeDefinition) GetType() string {
if i == nil || i.Type == nil {
return ""
}
return *i.Type
}
// GetTypeOk returns a tuple with the Type field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (i *IframeDefinition) GetTypeOk() (string, bool) {
if i == nil || i.Type == nil {
return "", false
}
return *i.Type, true
}
// HasType returns a boolean if a field has been set.
func (i *IframeDefinition) HasType() bool {
if i != nil && i.Type != nil {
return true
}
return false
}
// SetType allocates a new i.Type and returns the pointer to it.
func (i *IframeDefinition) SetType(v string) {
i.Type = &v
}
// GetUrl returns the Url field if non-nil, zero value otherwise.
func (i *IframeDefinition) GetUrl() string {
if i == nil || i.Url == nil {
return ""
}
return *i.Url
}
// GetUrlOk returns a tuple with the Url field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (i *IframeDefinition) GetUrlOk() (string, bool) {
if i == nil || i.Url == nil {
return "", false
}
return *i.Url, true
}
// HasUrl returns a boolean if a field has been set.
func (i *IframeDefinition) HasUrl() bool {
if i != nil && i.Url != nil {
return true
}
return false
}
// SetUrl allocates a new i.Url and returns the pointer to it.
func (i *IframeDefinition) SetUrl(v string) {
i.Url = &v
}
// GetMargin returns the Margin field if non-nil, zero value otherwise.
func (i *ImageDefinition) GetMargin() string {
if i == nil || i.Margin == nil {
return ""
}
return *i.Margin
}
// GetMarginOk returns a tuple with the Margin field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (i *ImageDefinition) GetMarginOk() (string, bool) {
if i == nil || i.Margin == nil {
return "", false
}
return *i.Margin, true
}
// HasMargin returns a boolean if a field has been set.
func (i *ImageDefinition) HasMargin() bool {
if i != nil && i.Margin != nil {
return true
}
return false
}
// SetMargin allocates a new i.Margin and returns the pointer to it.
func (i *ImageDefinition) SetMargin(v string) {
i.Margin = &v
}
// GetSizing returns the Sizing field if non-nil, zero value otherwise.
func (i *ImageDefinition) GetSizing() string {
if i == nil || i.Sizing == nil {
return ""
}
return *i.Sizing
}
// GetSizingOk returns a tuple with the Sizing field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (i *ImageDefinition) GetSizingOk() (string, bool) {
if i == nil || i.Sizing == nil {
return "", false
}
return *i.Sizing, true
}
// HasSizing returns a boolean if a field has been set.
func (i *ImageDefinition) HasSizing() bool {
if i != nil && i.Sizing != nil {
return true
}
return false
}
// SetSizing allocates a new i.Sizing and returns the pointer to it.
func (i *ImageDefinition) SetSizing(v string) {
i.Sizing = &v
}
// GetType returns the Type field if non-nil, zero value otherwise.
func (i *ImageDefinition) GetType() string {
if i == nil || i.Type == nil {
return ""
}
return *i.Type
}
// GetTypeOk returns a tuple with the Type field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (i *ImageDefinition) GetTypeOk() (string, bool) {
if i == nil || i.Type == nil {
return "", false
}
return *i.Type, true
}
// HasType returns a boolean if a field has been set.
func (i *ImageDefinition) HasType() bool {
if i != nil && i.Type != nil {
return true
}
return false
}
// SetType allocates a new i.Type and returns the pointer to it.
func (i *ImageDefinition) SetType(v string) {
i.Type = &v
}
// GetUrl returns the Url field if non-nil, zero value otherwise.
func (i *ImageDefinition) GetUrl() string {
if i == nil || i.Url == nil {
return ""
}
return *i.Url
}
// GetUrlOk returns a tuple with the Url field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (i *ImageDefinition) GetUrlOk() (string, bool) {
if i == nil || i.Url == nil {
return "", false
}
return *i.Url, true
}
// HasUrl returns a boolean if a field has been set.
func (i *ImageDefinition) HasUrl() bool {
if i != nil && i.Url != nil {
return true
}
return false
}
// SetUrl allocates a new i.Url and returns the pointer to it.
func (i *ImageDefinition) SetUrl(v string) {
i.Url = &v
}
// GetAccountID returns the AccountID field if non-nil, zero value otherwise.
func (i *IntegrationAWSAccount) GetAccountID() string {
if i == nil || i.AccountID == nil {
return ""
}
return *i.AccountID
}
// GetAccountIDOk returns a tuple with the AccountID field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (i *IntegrationAWSAccount) GetAccountIDOk() (string, bool) {
if i == nil || i.AccountID == nil {
return "", false
}
return *i.AccountID, true
}
// HasAccountID returns a boolean if a field has been set.
func (i *IntegrationAWSAccount) HasAccountID() bool {
if i != nil && i.AccountID != nil {
return true
}
return false
}
// SetAccountID allocates a new i.AccountID and returns the pointer to it.
func (i *IntegrationAWSAccount) SetAccountID(v string) {
i.AccountID = &v
}
// GetRoleName returns the RoleName field if non-nil, zero value otherwise.
func (i *IntegrationAWSAccount) GetRoleName() string {
if i == nil || i.RoleName == nil {
return ""
}
return *i.RoleName
}
// GetRoleNameOk returns a tuple with the RoleName field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (i *IntegrationAWSAccount) GetRoleNameOk() (string, bool) {
if i == nil || i.RoleName == nil {
return "", false
}
return *i.RoleName, true
}
// HasRoleName returns a boolean if a field has been set.
func (i *IntegrationAWSAccount) HasRoleName() bool {
if i != nil && i.RoleName != nil {
return true
}
return false
}
// SetRoleName allocates a new i.RoleName and returns the pointer to it.
func (i *IntegrationAWSAccount) SetRoleName(v string) {
i.RoleName = &v
}
// GetAccountID returns the AccountID field if non-nil, zero value otherwise.
func (i *IntegrationAWSAccountDeleteRequest) GetAccountID() string {
if i == nil || i.AccountID == nil {
return ""
}
return *i.AccountID
}
// GetAccountIDOk returns a tuple with the AccountID field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (i *IntegrationAWSAccountDeleteRequest) GetAccountIDOk() (string, bool) {
if i == nil || i.AccountID == nil {
return "", false
}
return *i.AccountID, true
}
// HasAccountID returns a boolean if a field has been set.
func (i *IntegrationAWSAccountDeleteRequest) HasAccountID() bool {
if i != nil && i.AccountID != nil {
return true
}
return false
}
// SetAccountID allocates a new i.AccountID and returns the pointer to it.
func (i *IntegrationAWSAccountDeleteRequest) SetAccountID(v string) {
i.AccountID = &v
}
// GetRoleName returns the RoleName field if non-nil, zero value otherwise.
func (i *IntegrationAWSAccountDeleteRequest) GetRoleName() string {
if i == nil || i.RoleName == nil {
return ""
}
return *i.RoleName
}
// GetRoleNameOk returns a tuple with the RoleName field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (i *IntegrationAWSAccountDeleteRequest) GetRoleNameOk() (string, bool) {
if i == nil || i.RoleName == nil {
return "", false
}
return *i.RoleName, true
}
// HasRoleName returns a boolean if a field has been set.
func (i *IntegrationAWSAccountDeleteRequest) HasRoleName() bool {
if i != nil && i.RoleName != nil {
return true
}
return false
}
// SetRoleName allocates a new i.RoleName and returns the pointer to it.
func (i *IntegrationAWSAccountDeleteRequest) SetRoleName(v string) {
i.RoleName = &v
}
// GetClientEmail returns the ClientEmail field if non-nil, zero value otherwise.
func (i *IntegrationGCP) GetClientEmail() string {
if i == nil || i.ClientEmail == nil {
return ""
}
return *i.ClientEmail
}
// GetClientEmailOk returns a tuple with the ClientEmail field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (i *IntegrationGCP) GetClientEmailOk() (string, bool) {
if i == nil || i.ClientEmail == nil {
return "", false
}
return *i.ClientEmail, true
}
// HasClientEmail returns a boolean if a field has been set.
func (i *IntegrationGCP) HasClientEmail() bool {
if i != nil && i.ClientEmail != nil {
return true
}
return false
}
// SetClientEmail allocates a new i.ClientEmail and returns the pointer to it.
func (i *IntegrationGCP) SetClientEmail(v string) {
i.ClientEmail = &v
}
// GetHostFilters returns the HostFilters field if non-nil, zero value otherwise.
func (i *IntegrationGCP) GetHostFilters() string {
if i == nil || i.HostFilters == nil {
return ""
}
return *i.HostFilters
}
// GetHostFiltersOk returns a tuple with the HostFilters field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (i *IntegrationGCP) GetHostFiltersOk() (string, bool) {
if i == nil || i.HostFilters == nil {
return "", false
}
return *i.HostFilters, true
}
// HasHostFilters returns a boolean if a field has been set.
func (i *IntegrationGCP) HasHostFilters() bool {
if i != nil && i.HostFilters != nil {
return true
}
return false
}
// SetHostFilters allocates a new i.HostFilters and returns the pointer to it.
func (i *IntegrationGCP) SetHostFilters(v string) {
i.HostFilters = &v
}
// GetProjectID returns the ProjectID field if non-nil, zero value otherwise.
func (i *IntegrationGCP) GetProjectID() string {
if i == nil || i.ProjectID == nil {
return ""
}
return *i.ProjectID
}
// GetProjectIDOk returns a tuple with the ProjectID field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (i *IntegrationGCP) GetProjectIDOk() (string, bool) {
if i == nil || i.ProjectID == nil {
return "", false
}
return *i.ProjectID, true
}
// HasProjectID returns a boolean if a field has been set.
func (i *IntegrationGCP) HasProjectID() bool {
if i != nil && i.ProjectID != nil {
return true
}
return false
}
// SetProjectID allocates a new i.ProjectID and returns the pointer to it.
func (i *IntegrationGCP) SetProjectID(v string) {
i.ProjectID = &v
}
// GetAuthProviderX509CertURL returns the AuthProviderX509CertURL field if non-nil, zero value otherwise.
func (i *IntegrationGCPCreateRequest) GetAuthProviderX509CertURL() string {
if i == nil || i.AuthProviderX509CertURL == nil {
return ""
}
return *i.AuthProviderX509CertURL
}
// GetAuthProviderX509CertURLOk returns a tuple with the AuthProviderX509CertURL field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (i *IntegrationGCPCreateRequest) GetAuthProviderX509CertURLOk() (string, bool) {
if i == nil || i.AuthProviderX509CertURL == nil {
return "", false
}
return *i.AuthProviderX509CertURL, true
}
// HasAuthProviderX509CertURL returns a boolean if a field has been set.
func (i *IntegrationGCPCreateRequest) HasAuthProviderX509CertURL() bool {
if i != nil && i.AuthProviderX509CertURL != nil {
return true
}
return false
}
// SetAuthProviderX509CertURL allocates a new i.AuthProviderX509CertURL and returns the pointer to it.
func (i *IntegrationGCPCreateRequest) SetAuthProviderX509CertURL(v string) {
i.AuthProviderX509CertURL = &v
}
// GetAuthURI returns the AuthURI field if non-nil, zero value otherwise.
func (i *IntegrationGCPCreateRequest) GetAuthURI() string {
if i == nil || i.AuthURI == nil {
return ""
}
return *i.AuthURI
}
// GetAuthURIOk returns a tuple with the AuthURI field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (i *IntegrationGCPCreateRequest) GetAuthURIOk() (string, bool) {
if i == nil || i.AuthURI == nil {
return "", false
}
return *i.AuthURI, true
}
// HasAuthURI returns a boolean if a field has been set.
func (i *IntegrationGCPCreateRequest) HasAuthURI() bool {
if i != nil && i.AuthURI != nil {
return true
}
return false
}
// SetAuthURI allocates a new i.AuthURI and returns the pointer to it.
func (i *IntegrationGCPCreateRequest) SetAuthURI(v string) {
i.AuthURI = &v
}
// GetClientEmail returns the ClientEmail field if non-nil, zero value otherwise.
func (i *IntegrationGCPCreateRequest) GetClientEmail() string {
if i == nil || i.ClientEmail == nil {
return ""
}
return *i.ClientEmail
}
// GetClientEmailOk returns a tuple with the ClientEmail field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (i *IntegrationGCPCreateRequest) GetClientEmailOk() (string, bool) {
if i == nil || i.ClientEmail == nil {
return "", false
}
return *i.ClientEmail, true
}
// HasClientEmail returns a boolean if a field has been set.
func (i *IntegrationGCPCreateRequest) HasClientEmail() bool {
if i != nil && i.ClientEmail != nil {
return true
}
return false
}
// SetClientEmail allocates a new i.ClientEmail and returns the pointer to it.
func (i *IntegrationGCPCreateRequest) SetClientEmail(v string) {
i.ClientEmail = &v
}
// GetClientID returns the ClientID field if non-nil, zero value otherwise.
func (i *IntegrationGCPCreateRequest) GetClientID() string {
if i == nil || i.ClientID == nil {
return ""
}
return *i.ClientID
}
// GetClientIDOk returns a tuple with the ClientID field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (i *IntegrationGCPCreateRequest) GetClientIDOk() (string, bool) {
if i == nil || i.ClientID == nil {
return "", false
}
return *i.ClientID, true
}
// HasClientID returns a boolean if a field has been set.
func (i *IntegrationGCPCreateRequest) HasClientID() bool {
if i != nil && i.ClientID != nil {
return true
}
return false
}
// SetClientID allocates a new i.ClientID and returns the pointer to it.
func (i *IntegrationGCPCreateRequest) SetClientID(v string) {
i.ClientID = &v
}
// GetClientX509CertURL returns the ClientX509CertURL field if non-nil, zero value otherwise.
func (i *IntegrationGCPCreateRequest) GetClientX509CertURL() string {
if i == nil || i.ClientX509CertURL == nil {
return ""
}
return *i.ClientX509CertURL
}
// GetClientX509CertURLOk returns a tuple with the ClientX509CertURL field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (i *IntegrationGCPCreateRequest) GetClientX509CertURLOk() (string, bool) {
if i == nil || i.ClientX509CertURL == nil {
return "", false
}
return *i.ClientX509CertURL, true
}
// HasClientX509CertURL returns a boolean if a field has been set.
func (i *IntegrationGCPCreateRequest) HasClientX509CertURL() bool {
if i != nil && i.ClientX509CertURL != nil {
return true
}
return false
}
// SetClientX509CertURL allocates a new i.ClientX509CertURL and returns the pointer to it.
func (i *IntegrationGCPCreateRequest) SetClientX509CertURL(v string) {
i.ClientX509CertURL = &v
}
// GetHostFilters returns the HostFilters field if non-nil, zero value otherwise.
func (i *IntegrationGCPCreateRequest) GetHostFilters() string {
if i == nil || i.HostFilters == nil {
return ""
}
return *i.HostFilters
}
// GetHostFiltersOk returns a tuple with the HostFilters field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (i *IntegrationGCPCreateRequest) GetHostFiltersOk() (string, bool) {
if i == nil || i.HostFilters == nil {
return "", false
}
return *i.HostFilters, true
}
// HasHostFilters returns a boolean if a field has been set.
func (i *IntegrationGCPCreateRequest) HasHostFilters() bool {
if i != nil && i.HostFilters != nil {
return true
}
return false
}
// SetHostFilters allocates a new i.HostFilters and returns the pointer to it.
func (i *IntegrationGCPCreateRequest) SetHostFilters(v string) {
i.HostFilters = &v
}
// GetPrivateKey returns the PrivateKey field if non-nil, zero value otherwise.
func (i *IntegrationGCPCreateRequest) GetPrivateKey() string {
if i == nil || i.PrivateKey == nil {
return ""
}
return *i.PrivateKey
}
// GetPrivateKeyOk returns a tuple with the PrivateKey field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (i *IntegrationGCPCreateRequest) GetPrivateKeyOk() (string, bool) {
if i == nil || i.PrivateKey == nil {
return "", false
}
return *i.PrivateKey, true
}
// HasPrivateKey returns a boolean if a field has been set.
func (i *IntegrationGCPCreateRequest) HasPrivateKey() bool {
if i != nil && i.PrivateKey != nil {
return true
}
return false
}
// SetPrivateKey allocates a new i.PrivateKey and returns the pointer to it.
func (i *IntegrationGCPCreateRequest) SetPrivateKey(v string) {
i.PrivateKey = &v
}
// GetPrivateKeyID returns the PrivateKeyID field if non-nil, zero value otherwise.
func (i *IntegrationGCPCreateRequest) GetPrivateKeyID() string {
if i == nil || i.PrivateKeyID == nil {
return ""
}
return *i.PrivateKeyID
}
// GetPrivateKeyIDOk returns a tuple with the PrivateKeyID field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (i *IntegrationGCPCreateRequest) GetPrivateKeyIDOk() (string, bool) {
if i == nil || i.PrivateKeyID == nil {
return "", false
}
return *i.PrivateKeyID, true
}
// HasPrivateKeyID returns a boolean if a field has been set.
func (i *IntegrationGCPCreateRequest) HasPrivateKeyID() bool {
if i != nil && i.PrivateKeyID != nil {
return true
}
return false
}
// SetPrivateKeyID allocates a new i.PrivateKeyID and returns the pointer to it.
func (i *IntegrationGCPCreateRequest) SetPrivateKeyID(v string) {
i.PrivateKeyID = &v
}
// GetProjectID returns the ProjectID field if non-nil, zero value otherwise.
func (i *IntegrationGCPCreateRequest) GetProjectID() string {
if i == nil || i.ProjectID == nil {
return ""
}
return *i.ProjectID
}
// GetProjectIDOk returns a tuple with the ProjectID field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (i *IntegrationGCPCreateRequest) GetProjectIDOk() (string, bool) {
if i == nil || i.ProjectID == nil {
return "", false
}
return *i.ProjectID, true
}
// HasProjectID returns a boolean if a field has been set.
func (i *IntegrationGCPCreateRequest) HasProjectID() bool {
if i != nil && i.ProjectID != nil {
return true
}
return false
}
// SetProjectID allocates a new i.ProjectID and returns the pointer to it.
func (i *IntegrationGCPCreateRequest) SetProjectID(v string) {
i.ProjectID = &v
}
// GetTokenURI returns the TokenURI field if non-nil, zero value otherwise.
func (i *IntegrationGCPCreateRequest) GetTokenURI() string {
if i == nil || i.TokenURI == nil {
return ""
}
return *i.TokenURI
}
// GetTokenURIOk returns a tuple with the TokenURI field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (i *IntegrationGCPCreateRequest) GetTokenURIOk() (string, bool) {
if i == nil || i.TokenURI == nil {
return "", false
}
return *i.TokenURI, true
}
// HasTokenURI returns a boolean if a field has been set.
func (i *IntegrationGCPCreateRequest) HasTokenURI() bool {
if i != nil && i.TokenURI != nil {
return true
}
return false
}
// SetTokenURI allocates a new i.TokenURI and returns the pointer to it.
func (i *IntegrationGCPCreateRequest) SetTokenURI(v string) {
i.TokenURI = &v
}
// GetType returns the Type field if non-nil, zero value otherwise.
func (i *IntegrationGCPCreateRequest) GetType() string {
if i == nil || i.Type == nil {
return ""
}
return *i.Type
}
// GetTypeOk returns a tuple with the Type field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (i *IntegrationGCPCreateRequest) GetTypeOk() (string, bool) {
if i == nil || i.Type == nil {
return "", false
}
return *i.Type, true
}
// HasType returns a boolean if a field has been set.
func (i *IntegrationGCPCreateRequest) HasType() bool {
if i != nil && i.Type != nil {
return true
}
return false
}
// SetType allocates a new i.Type and returns the pointer to it.
func (i *IntegrationGCPCreateRequest) SetType(v string) {
i.Type = &v
}
// GetClientEmail returns the ClientEmail field if non-nil, zero value otherwise.
func (i *IntegrationGCPDeleteRequest) GetClientEmail() string {
if i == nil || i.ClientEmail == nil {
return ""
}
return *i.ClientEmail
}
// GetClientEmailOk returns a tuple with the ClientEmail field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (i *IntegrationGCPDeleteRequest) GetClientEmailOk() (string, bool) {
if i == nil || i.ClientEmail == nil {
return "", false
}
return *i.ClientEmail, true
}
// HasClientEmail returns a boolean if a field has been set.
func (i *IntegrationGCPDeleteRequest) HasClientEmail() bool {
if i != nil && i.ClientEmail != nil {
return true
}
return false
}
// SetClientEmail allocates a new i.ClientEmail and returns the pointer to it.
func (i *IntegrationGCPDeleteRequest) SetClientEmail(v string) {
i.ClientEmail = &v
}
// GetProjectID returns the ProjectID field if non-nil, zero value otherwise.
func (i *IntegrationGCPDeleteRequest) GetProjectID() string {
if i == nil || i.ProjectID == nil {
return ""
}
return *i.ProjectID
}
// GetProjectIDOk returns a tuple with the ProjectID field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (i *IntegrationGCPDeleteRequest) GetProjectIDOk() (string, bool) {
if i == nil || i.ProjectID == nil {
return "", false
}
return *i.ProjectID, true
}
// HasProjectID returns a boolean if a field has been set.
func (i *IntegrationGCPDeleteRequest) HasProjectID() bool {
if i != nil && i.ProjectID != nil {
return true
}
return false
}
// SetProjectID allocates a new i.ProjectID and returns the pointer to it.
func (i *IntegrationGCPDeleteRequest) SetProjectID(v string) {
i.ProjectID = &v
}
// GetClientEmail returns the ClientEmail field if non-nil, zero value otherwise.
func (i *IntegrationGCPUpdateRequest) GetClientEmail() string {
if i == nil || i.ClientEmail == nil {
return ""
}
return *i.ClientEmail
}
// GetClientEmailOk returns a tuple with the ClientEmail field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (i *IntegrationGCPUpdateRequest) GetClientEmailOk() (string, bool) {
if i == nil || i.ClientEmail == nil {
return "", false
}
return *i.ClientEmail, true
}
// HasClientEmail returns a boolean if a field has been set.
func (i *IntegrationGCPUpdateRequest) HasClientEmail() bool {
if i != nil && i.ClientEmail != nil {
return true
}
return false
}
// SetClientEmail allocates a new i.ClientEmail and returns the pointer to it.
func (i *IntegrationGCPUpdateRequest) SetClientEmail(v string) {
i.ClientEmail = &v
}
// GetHostFilters returns the HostFilters field if non-nil, zero value otherwise.
func (i *IntegrationGCPUpdateRequest) GetHostFilters() string {
if i == nil || i.HostFilters == nil {
return ""
}
return *i.HostFilters
}
// GetHostFiltersOk returns a tuple with the HostFilters field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (i *IntegrationGCPUpdateRequest) GetHostFiltersOk() (string, bool) {
if i == nil || i.HostFilters == nil {
return "", false
}
return *i.HostFilters, true
}
// HasHostFilters returns a boolean if a field has been set.
func (i *IntegrationGCPUpdateRequest) HasHostFilters() bool {
if i != nil && i.HostFilters != nil {
return true
}
return false
}
// SetHostFilters allocates a new i.HostFilters and returns the pointer to it.
func (i *IntegrationGCPUpdateRequest) SetHostFilters(v string) {
i.HostFilters = &v
}
// GetProjectID returns the ProjectID field if non-nil, zero value otherwise.
func (i *IntegrationGCPUpdateRequest) GetProjectID() string {
if i == nil || i.ProjectID == nil {
return ""
}
return *i.ProjectID
}
// GetProjectIDOk returns a tuple with the ProjectID field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (i *IntegrationGCPUpdateRequest) GetProjectIDOk() (string, bool) {
if i == nil || i.ProjectID == nil {
return "", false
}
return *i.ProjectID, true
}
// HasProjectID returns a boolean if a field has been set.
func (i *IntegrationGCPUpdateRequest) HasProjectID() bool {
if i != nil && i.ProjectID != nil {
return true
}
return false
}
// SetProjectID allocates a new i.ProjectID and returns the pointer to it.
func (i *IntegrationGCPUpdateRequest) SetProjectID(v string) {
i.ProjectID = &v
}
// GetAPIToken returns the APIToken field if non-nil, zero value otherwise.
func (i *integrationPD) GetAPIToken() string {
if i == nil || i.APIToken == nil {
return ""
}
return *i.APIToken
}
// GetAPITokenOk returns a tuple with the APIToken field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (i *integrationPD) GetAPITokenOk() (string, bool) {
if i == nil || i.APIToken == nil {
return "", false
}
return *i.APIToken, true
}
// HasAPIToken returns a boolean if a field has been set.
func (i *integrationPD) HasAPIToken() bool {
if i != nil && i.APIToken != nil {
return true
}
return false
}
// SetAPIToken allocates a new i.APIToken and returns the pointer to it.
func (i *integrationPD) SetAPIToken(v string) {
i.APIToken = &v
}
// GetSubdomain returns the Subdomain field if non-nil, zero value otherwise.
func (i *integrationPD) GetSubdomain() string {
if i == nil || i.Subdomain == nil {
return ""
}
return *i.Subdomain
}
// GetSubdomainOk returns a tuple with the Subdomain field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (i *integrationPD) GetSubdomainOk() (string, bool) {
if i == nil || i.Subdomain == nil {
return "", false
}
return *i.Subdomain, true
}
// HasSubdomain returns a boolean if a field has been set.
func (i *integrationPD) HasSubdomain() bool {
if i != nil && i.Subdomain != nil {
return true
}
return false
}
// SetSubdomain allocates a new i.Subdomain and returns the pointer to it.
func (i *integrationPD) SetSubdomain(v string) {
i.Subdomain = &v
}
// GetAPIToken returns the APIToken field if non-nil, zero value otherwise.
func (i *IntegrationPDRequest) GetAPIToken() string {
if i == nil || i.APIToken == nil {
return ""
}
return *i.APIToken
}
// GetAPITokenOk returns a tuple with the APIToken field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (i *IntegrationPDRequest) GetAPITokenOk() (string, bool) {
if i == nil || i.APIToken == nil {
return "", false
}
return *i.APIToken, true
}
// HasAPIToken returns a boolean if a field has been set.
func (i *IntegrationPDRequest) HasAPIToken() bool {
if i != nil && i.APIToken != nil {
return true
}
return false
}
// SetAPIToken allocates a new i.APIToken and returns the pointer to it.
func (i *IntegrationPDRequest) SetAPIToken(v string) {
i.APIToken = &v
}
// GetRunCheck returns the RunCheck field if non-nil, zero value otherwise.
func (i *IntegrationPDRequest) GetRunCheck() bool {
if i == nil || i.RunCheck == nil {
return false
}
return *i.RunCheck
}
// GetRunCheckOk returns a tuple with the RunCheck field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (i *IntegrationPDRequest) GetRunCheckOk() (bool, bool) {
if i == nil || i.RunCheck == nil {
return false, false
}
return *i.RunCheck, true
}
// HasRunCheck returns a boolean if a field has been set.
func (i *IntegrationPDRequest) HasRunCheck() bool {
if i != nil && i.RunCheck != nil {
return true
}
return false
}
// SetRunCheck allocates a new i.RunCheck and returns the pointer to it.
func (i *IntegrationPDRequest) SetRunCheck(v bool) {
i.RunCheck = &v
}
// GetSubdomain returns the Subdomain field if non-nil, zero value otherwise.
func (i *IntegrationPDRequest) GetSubdomain() string {
if i == nil || i.Subdomain == nil {
return ""
}
return *i.Subdomain
}
// GetSubdomainOk returns a tuple with the Subdomain field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (i *IntegrationPDRequest) GetSubdomainOk() (string, bool) {
if i == nil || i.Subdomain == nil {
return "", false
}
return *i.Subdomain, true
}
// HasSubdomain returns a boolean if a field has been set.
func (i *IntegrationPDRequest) HasSubdomain() bool {
if i != nil && i.Subdomain != nil {
return true
}
return false
}
// SetSubdomain allocates a new i.Subdomain and returns the pointer to it.
func (i *IntegrationPDRequest) SetSubdomain(v string) {
i.Subdomain = &v
}
// GetRunCheck returns the RunCheck field if non-nil, zero value otherwise.
func (i *IntegrationSlackRequest) GetRunCheck() bool {
if i == nil || i.RunCheck == nil {
return false
}
return *i.RunCheck
}
// GetRunCheckOk returns a tuple with the RunCheck field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (i *IntegrationSlackRequest) GetRunCheckOk() (bool, bool) {
if i == nil || i.RunCheck == nil {
return false, false
}
return *i.RunCheck, true
}
// HasRunCheck returns a boolean if a field has been set.
func (i *IntegrationSlackRequest) HasRunCheck() bool {
if i != nil && i.RunCheck != nil {
return true
}
return false
}
// SetRunCheck allocates a new i.RunCheck and returns the pointer to it.
func (i *IntegrationSlackRequest) SetRunCheck(v bool) {
i.RunCheck = &v
}
// GetID returns the ID field if non-nil, zero value otherwise.
func (l *LogSet) GetID() json.Number {
if l == nil || l.ID == nil {
return ""
}
return *l.ID
}
// GetIDOk returns a tuple with the ID field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (l *LogSet) GetIDOk() (json.Number, bool) {
if l == nil || l.ID == nil {
return "", false
}
return *l.ID, true
}
// HasID returns a boolean if a field has been set.
func (l *LogSet) HasID() bool {
if l != nil && l.ID != nil {
return true
}
return false
}
// SetID allocates a new l.ID and returns the pointer to it.
func (l *LogSet) SetID(v json.Number) {
l.ID = &v
}
// GetName returns the Name field if non-nil, zero value otherwise.
func (l *LogSet) GetName() string {
if l == nil || l.Name == nil {
return ""
}
return *l.Name
}
// GetNameOk returns a tuple with the Name field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (l *LogSet) GetNameOk() (string, bool) {
if l == nil || l.Name == nil {
return "", false
}
return *l.Name, true
}
// HasName returns a boolean if a field has been set.
func (l *LogSet) HasName() bool {
if l != nil && l.Name != nil {
return true
}
return false
}
// SetName allocates a new l.Name and returns the pointer to it.
func (l *LogSet) SetName(v string) {
l.Name = &v
}
// GetDailyLimit returns the DailyLimit field if non-nil, zero value otherwise.
func (l *LogsIndex) GetDailyLimit() int64 {
if l == nil || l.DailyLimit == nil {
return 0
}
return *l.DailyLimit
}
// GetDailyLimitOk returns a tuple with the DailyLimit field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (l *LogsIndex) GetDailyLimitOk() (int64, bool) {
if l == nil || l.DailyLimit == nil {
return 0, false
}
return *l.DailyLimit, true
}
// HasDailyLimit returns a boolean if a field has been set.
func (l *LogsIndex) HasDailyLimit() bool {
if l != nil && l.DailyLimit != nil {
return true
}
return false
}
// SetDailyLimit allocates a new l.DailyLimit and returns the pointer to it.
func (l *LogsIndex) SetDailyLimit(v int64) {
l.DailyLimit = &v
}
// GetFilter returns the Filter field if non-nil, zero value otherwise.
func (l *LogsIndex) GetFilter() FilterConfiguration {
if l == nil || l.Filter == nil {
return FilterConfiguration{}
}
return *l.Filter
}
// GetFilterOk returns a tuple with the Filter field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (l *LogsIndex) GetFilterOk() (FilterConfiguration, bool) {
if l == nil || l.Filter == nil {
return FilterConfiguration{}, false
}
return *l.Filter, true
}
// HasFilter returns a boolean if a field has been set.
func (l *LogsIndex) HasFilter() bool {
if l != nil && l.Filter != nil {
return true
}
return false
}
// SetFilter allocates a new l.Filter and returns the pointer to it.
func (l *LogsIndex) SetFilter(v FilterConfiguration) {
l.Filter = &v
}
// GetIsRateLimited returns the IsRateLimited field if non-nil, zero value otherwise.
func (l *LogsIndex) GetIsRateLimited() bool {
if l == nil || l.IsRateLimited == nil {
return false
}
return *l.IsRateLimited
}
// GetIsRateLimitedOk returns a tuple with the IsRateLimited field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (l *LogsIndex) GetIsRateLimitedOk() (bool, bool) {
if l == nil || l.IsRateLimited == nil {
return false, false
}
return *l.IsRateLimited, true
}
// HasIsRateLimited returns a boolean if a field has been set.
func (l *LogsIndex) HasIsRateLimited() bool {
if l != nil && l.IsRateLimited != nil {
return true
}
return false
}
// SetIsRateLimited allocates a new l.IsRateLimited and returns the pointer to it.
func (l *LogsIndex) SetIsRateLimited(v bool) {
l.IsRateLimited = &v
}
// GetName returns the Name field if non-nil, zero value otherwise.
func (l *LogsIndex) GetName() string {
if l == nil || l.Name == nil {
return ""
}
return *l.Name
}
// GetNameOk returns a tuple with the Name field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (l *LogsIndex) GetNameOk() (string, bool) {
if l == nil || l.Name == nil {
return "", false
}
return *l.Name, true
}
// HasName returns a boolean if a field has been set.
func (l *LogsIndex) HasName() bool {
if l != nil && l.Name != nil {
return true
}
return false
}
// SetName allocates a new l.Name and returns the pointer to it.
func (l *LogsIndex) SetName(v string) {
l.Name = &v
}
// GetNumRetentionDays returns the NumRetentionDays field if non-nil, zero value otherwise.
func (l *LogsIndex) GetNumRetentionDays() int64 {
if l == nil || l.NumRetentionDays == nil {
return 0
}
return *l.NumRetentionDays
}
// GetNumRetentionDaysOk returns a tuple with the NumRetentionDays field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (l *LogsIndex) GetNumRetentionDaysOk() (int64, bool) {
if l == nil || l.NumRetentionDays == nil {
return 0, false
}
return *l.NumRetentionDays, true
}
// HasNumRetentionDays returns a boolean if a field has been set.
func (l *LogsIndex) HasNumRetentionDays() bool {
if l != nil && l.NumRetentionDays != nil {
return true
}
return false
}
// SetNumRetentionDays allocates a new l.NumRetentionDays and returns the pointer to it.
func (l *LogsIndex) SetNumRetentionDays(v int64) {
l.NumRetentionDays = &v
}
// GetFilter returns the Filter field if non-nil, zero value otherwise.
func (l *LogsPipeline) GetFilter() FilterConfiguration {
if l == nil || l.Filter == nil {
return FilterConfiguration{}
}
return *l.Filter
}
// GetFilterOk returns a tuple with the Filter field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (l *LogsPipeline) GetFilterOk() (FilterConfiguration, bool) {
if l == nil || l.Filter == nil {
return FilterConfiguration{}, false
}
return *l.Filter, true
}
// HasFilter returns a boolean if a field has been set.
func (l *LogsPipeline) HasFilter() bool {
if l != nil && l.Filter != nil {
return true
}
return false
}
// SetFilter allocates a new l.Filter and returns the pointer to it.
func (l *LogsPipeline) SetFilter(v FilterConfiguration) {
l.Filter = &v
}
// GetId returns the Id field if non-nil, zero value otherwise.
func (l *LogsPipeline) GetId() string {
if l == nil || l.Id == nil {
return ""
}
return *l.Id
}
// GetIdOk returns a tuple with the Id field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (l *LogsPipeline) GetIdOk() (string, bool) {
if l == nil || l.Id == nil {
return "", false
}
return *l.Id, true
}
// HasId returns a boolean if a field has been set.
func (l *LogsPipeline) HasId() bool {
if l != nil && l.Id != nil {
return true
}
return false
}
// SetId allocates a new l.Id and returns the pointer to it.
func (l *LogsPipeline) SetId(v string) {
l.Id = &v
}
// GetIsEnabled returns the IsEnabled field if non-nil, zero value otherwise.
func (l *LogsPipeline) GetIsEnabled() bool {
if l == nil || l.IsEnabled == nil {
return false
}
return *l.IsEnabled
}
// GetIsEnabledOk returns a tuple with the IsEnabled field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (l *LogsPipeline) GetIsEnabledOk() (bool, bool) {
if l == nil || l.IsEnabled == nil {
return false, false
}
return *l.IsEnabled, true
}
// HasIsEnabled returns a boolean if a field has been set.
func (l *LogsPipeline) HasIsEnabled() bool {
if l != nil && l.IsEnabled != nil {
return true
}
return false
}
// SetIsEnabled allocates a new l.IsEnabled and returns the pointer to it.
func (l *LogsPipeline) SetIsEnabled(v bool) {
l.IsEnabled = &v
}
// GetIsReadOnly returns the IsReadOnly field if non-nil, zero value otherwise.
func (l *LogsPipeline) GetIsReadOnly() bool {
if l == nil || l.IsReadOnly == nil {
return false
}
return *l.IsReadOnly
}
// GetIsReadOnlyOk returns a tuple with the IsReadOnly field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (l *LogsPipeline) GetIsReadOnlyOk() (bool, bool) {
if l == nil || l.IsReadOnly == nil {
return false, false
}
return *l.IsReadOnly, true
}
// HasIsReadOnly returns a boolean if a field has been set.
func (l *LogsPipeline) HasIsReadOnly() bool {
if l != nil && l.IsReadOnly != nil {
return true
}
return false
}
// SetIsReadOnly allocates a new l.IsReadOnly and returns the pointer to it.
func (l *LogsPipeline) SetIsReadOnly(v bool) {
l.IsReadOnly = &v
}
// GetName returns the Name field if non-nil, zero value otherwise.
func (l *LogsPipeline) GetName() string {
if l == nil || l.Name == nil {
return ""
}
return *l.Name
}
// GetNameOk returns a tuple with the Name field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (l *LogsPipeline) GetNameOk() (string, bool) {
if l == nil || l.Name == nil {
return "", false
}
return *l.Name, true
}
// HasName returns a boolean if a field has been set.
func (l *LogsPipeline) HasName() bool {
if l != nil && l.Name != nil {
return true
}
return false
}
// SetName allocates a new l.Name and returns the pointer to it.
func (l *LogsPipeline) SetName(v string) {
l.Name = &v
}
// GetType returns the Type field if non-nil, zero value otherwise.
func (l *LogsPipeline) GetType() string {
if l == nil || l.Type == nil {
return ""
}
return *l.Type
}
// GetTypeOk returns a tuple with the Type field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (l *LogsPipeline) GetTypeOk() (string, bool) {
if l == nil || l.Type == nil {
return "", false
}
return *l.Type, true
}
// HasType returns a boolean if a field has been set.
func (l *LogsPipeline) HasType() bool {
if l != nil && l.Type != nil {
return true
}
return false
}
// SetType allocates a new l.Type and returns the pointer to it.
func (l *LogsPipeline) SetType(v string) {
l.Type = &v
}
// GetIsEnabled returns the IsEnabled field if non-nil, zero value otherwise.
func (l *LogsProcessor) GetIsEnabled() bool {
if l == nil || l.IsEnabled == nil {
return false
}
return *l.IsEnabled
}
// GetIsEnabledOk returns a tuple with the IsEnabled field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (l *LogsProcessor) GetIsEnabledOk() (bool, bool) {
if l == nil || l.IsEnabled == nil {
return false, false
}
return *l.IsEnabled, true
}
// HasIsEnabled returns a boolean if a field has been set.
func (l *LogsProcessor) HasIsEnabled() bool {
if l != nil && l.IsEnabled != nil {
return true
}
return false
}
// SetIsEnabled allocates a new l.IsEnabled and returns the pointer to it.
func (l *LogsProcessor) SetIsEnabled(v bool) {
l.IsEnabled = &v
}
// GetName returns the Name field if non-nil, zero value otherwise.
func (l *LogsProcessor) GetName() string {
if l == nil || l.Name == nil {
return ""
}
return *l.Name
}
// GetNameOk returns a tuple with the Name field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (l *LogsProcessor) GetNameOk() (string, bool) {
if l == nil || l.Name == nil {
return "", false
}
return *l.Name, true
}
// HasName returns a boolean if a field has been set.
func (l *LogsProcessor) HasName() bool {
if l != nil && l.Name != nil {
return true
}
return false
}
// SetName allocates a new l.Name and returns the pointer to it.
func (l *LogsProcessor) SetName(v string) {
l.Name = &v
}
// GetType returns the Type field if non-nil, zero value otherwise.
func (l *LogsProcessor) GetType() string {
if l == nil || l.Type == nil {
return ""
}
return *l.Type
}
// GetTypeOk returns a tuple with the Type field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (l *LogsProcessor) GetTypeOk() (string, bool) {
if l == nil || l.Type == nil {
return "", false
}
return *l.Type, true
}
// HasType returns a boolean if a field has been set.
func (l *LogsProcessor) HasType() bool {
if l != nil && l.Type != nil {
return true
}
return false
}
// SetType allocates a new l.Type and returns the pointer to it.
func (l *LogsProcessor) SetType(v string) {
l.Type = &v
}
// GetLogset returns the Logset field if non-nil, zero value otherwise.
func (l *LogStreamDefinition) GetLogset() string {
if l == nil || l.Logset == nil {
return ""
}
return *l.Logset
}
// GetLogsetOk returns a tuple with the Logset field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (l *LogStreamDefinition) GetLogsetOk() (string, bool) {
if l == nil || l.Logset == nil {
return "", false
}
return *l.Logset, true
}
// HasLogset returns a boolean if a field has been set.
func (l *LogStreamDefinition) HasLogset() bool {
if l != nil && l.Logset != nil {
return true
}
return false
}
// SetLogset allocates a new l.Logset and returns the pointer to it.
func (l *LogStreamDefinition) SetLogset(v string) {
l.Logset = &v
}
// GetQuery returns the Query field if non-nil, zero value otherwise.
func (l *LogStreamDefinition) GetQuery() string {
if l == nil || l.Query == nil {
return ""
}
return *l.Query
}
// GetQueryOk returns a tuple with the Query field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (l *LogStreamDefinition) GetQueryOk() (string, bool) {
if l == nil || l.Query == nil {
return "", false
}
return *l.Query, true
}
// HasQuery returns a boolean if a field has been set.
func (l *LogStreamDefinition) HasQuery() bool {
if l != nil && l.Query != nil {
return true
}
return false
}
// SetQuery allocates a new l.Query and returns the pointer to it.
func (l *LogStreamDefinition) SetQuery(v string) {
l.Query = &v
}
// GetTime returns the Time field if non-nil, zero value otherwise.
func (l *LogStreamDefinition) GetTime() WidgetTime {
if l == nil || l.Time == nil {
return WidgetTime{}
}
return *l.Time
}
// GetTimeOk returns a tuple with the Time field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (l *LogStreamDefinition) GetTimeOk() (WidgetTime, bool) {
if l == nil || l.Time == nil {
return WidgetTime{}, false
}
return *l.Time, true
}
// HasTime returns a boolean if a field has been set.
func (l *LogStreamDefinition) HasTime() bool {
if l != nil && l.Time != nil {
return true
}
return false
}
// SetTime allocates a new l.Time and returns the pointer to it.
func (l *LogStreamDefinition) SetTime(v WidgetTime) {
l.Time = &v
}
// GetTitle returns the Title field if non-nil, zero value otherwise.
func (l *LogStreamDefinition) GetTitle() string {
if l == nil || l.Title == nil {
return ""
}
return *l.Title
}
// GetTitleOk returns a tuple with the Title field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (l *LogStreamDefinition) GetTitleOk() (string, bool) {
if l == nil || l.Title == nil {
return "", false
}
return *l.Title, true
}
// HasTitle returns a boolean if a field has been set.
func (l *LogStreamDefinition) HasTitle() bool {
if l != nil && l.Title != nil {
return true
}
return false
}
// SetTitle allocates a new l.Title and returns the pointer to it.
func (l *LogStreamDefinition) SetTitle(v string) {
l.Title = &v
}
// GetTitleAlign returns the TitleAlign field if non-nil, zero value otherwise.
func (l *LogStreamDefinition) GetTitleAlign() string {
if l == nil || l.TitleAlign == nil {
return ""
}
return *l.TitleAlign
}
// GetTitleAlignOk returns a tuple with the TitleAlign field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (l *LogStreamDefinition) GetTitleAlignOk() (string, bool) {
if l == nil || l.TitleAlign == nil {
return "", false
}
return *l.TitleAlign, true
}
// HasTitleAlign returns a boolean if a field has been set.
func (l *LogStreamDefinition) HasTitleAlign() bool {
if l != nil && l.TitleAlign != nil {
return true
}
return false
}
// SetTitleAlign allocates a new l.TitleAlign and returns the pointer to it.
func (l *LogStreamDefinition) SetTitleAlign(v string) {
l.TitleAlign = &v
}
// GetTitleSize returns the TitleSize field if non-nil, zero value otherwise.
func (l *LogStreamDefinition) GetTitleSize() string {
if l == nil || l.TitleSize == nil {
return ""
}
return *l.TitleSize
}
// GetTitleSizeOk returns a tuple with the TitleSize field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (l *LogStreamDefinition) GetTitleSizeOk() (string, bool) {
if l == nil || l.TitleSize == nil {
return "", false
}
return *l.TitleSize, true
}
// HasTitleSize returns a boolean if a field has been set.
func (l *LogStreamDefinition) HasTitleSize() bool {
if l != nil && l.TitleSize != nil {
return true
}
return false
}
// SetTitleSize allocates a new l.TitleSize and returns the pointer to it.
func (l *LogStreamDefinition) SetTitleSize(v string) {
l.TitleSize = &v
}
// GetType returns the Type field if non-nil, zero value otherwise.
func (l *LogStreamDefinition) GetType() string {
if l == nil || l.Type == nil {
return ""
}
return *l.Type
}
// GetTypeOk returns a tuple with the Type field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (l *LogStreamDefinition) GetTypeOk() (string, bool) {
if l == nil || l.Type == nil {
return "", false
}
return *l.Type, true
}
// HasType returns a boolean if a field has been set.
func (l *LogStreamDefinition) HasType() bool {
if l != nil && l.Type != nil {
return true
}
return false
}
// SetType allocates a new l.Type and returns the pointer to it.
func (l *LogStreamDefinition) SetType(v string) {
l.Type = &v
}
// GetColorPreference returns the ColorPreference field if non-nil, zero value otherwise.
func (m *ManageStatusDefinition) GetColorPreference() string {
if m == nil || m.ColorPreference == nil {
return ""
}
return *m.ColorPreference
}
// GetColorPreferenceOk returns a tuple with the ColorPreference field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (m *ManageStatusDefinition) GetColorPreferenceOk() (string, bool) {
if m == nil || m.ColorPreference == nil {
return "", false
}
return *m.ColorPreference, true
}
// HasColorPreference returns a boolean if a field has been set.
func (m *ManageStatusDefinition) HasColorPreference() bool {
if m != nil && m.ColorPreference != nil {
return true
}
return false
}
// SetColorPreference allocates a new m.ColorPreference and returns the pointer to it.
func (m *ManageStatusDefinition) SetColorPreference(v string) {
m.ColorPreference = &v
}
// GetCount returns the Count field if non-nil, zero value otherwise.
func (m *ManageStatusDefinition) GetCount() int {
if m == nil || m.Count == nil {
return 0
}
return *m.Count
}
// GetCountOk returns a tuple with the Count field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (m *ManageStatusDefinition) GetCountOk() (int, bool) {
if m == nil || m.Count == nil {
return 0, false
}
return *m.Count, true
}
// HasCount returns a boolean if a field has been set.
func (m *ManageStatusDefinition) HasCount() bool {
if m != nil && m.Count != nil {
return true
}
return false
}
// SetCount allocates a new m.Count and returns the pointer to it.
func (m *ManageStatusDefinition) SetCount(v int) {
m.Count = &v
}
// GetDisplayFormat returns the DisplayFormat field if non-nil, zero value otherwise.
func (m *ManageStatusDefinition) GetDisplayFormat() string {
if m == nil || m.DisplayFormat == nil {
return ""
}
return *m.DisplayFormat
}
// GetDisplayFormatOk returns a tuple with the DisplayFormat field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (m *ManageStatusDefinition) GetDisplayFormatOk() (string, bool) {
if m == nil || m.DisplayFormat == nil {
return "", false
}
return *m.DisplayFormat, true
}
// HasDisplayFormat returns a boolean if a field has been set.
func (m *ManageStatusDefinition) HasDisplayFormat() bool {
if m != nil && m.DisplayFormat != nil {
return true
}
return false
}
// SetDisplayFormat allocates a new m.DisplayFormat and returns the pointer to it.
func (m *ManageStatusDefinition) SetDisplayFormat(v string) {
m.DisplayFormat = &v
}
// GetHideZeroCounts returns the HideZeroCounts field if non-nil, zero value otherwise.
func (m *ManageStatusDefinition) GetHideZeroCounts() bool {
if m == nil || m.HideZeroCounts == nil {
return false
}
return *m.HideZeroCounts
}
// GetHideZeroCountsOk returns a tuple with the HideZeroCounts field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (m *ManageStatusDefinition) GetHideZeroCountsOk() (bool, bool) {
if m == nil || m.HideZeroCounts == nil {
return false, false
}
return *m.HideZeroCounts, true
}
// HasHideZeroCounts returns a boolean if a field has been set.
func (m *ManageStatusDefinition) HasHideZeroCounts() bool {
if m != nil && m.HideZeroCounts != nil {
return true
}
return false
}
// SetHideZeroCounts allocates a new m.HideZeroCounts and returns the pointer to it.
func (m *ManageStatusDefinition) SetHideZeroCounts(v bool) {
m.HideZeroCounts = &v
}
// GetQuery returns the Query field if non-nil, zero value otherwise.
func (m *ManageStatusDefinition) GetQuery() string {
if m == nil || m.Query == nil {
return ""
}
return *m.Query
}
// GetQueryOk returns a tuple with the Query field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (m *ManageStatusDefinition) GetQueryOk() (string, bool) {
if m == nil || m.Query == nil {
return "", false
}
return *m.Query, true
}
// HasQuery returns a boolean if a field has been set.
func (m *ManageStatusDefinition) HasQuery() bool {
if m != nil && m.Query != nil {
return true
}
return false
}
// SetQuery allocates a new m.Query and returns the pointer to it.
func (m *ManageStatusDefinition) SetQuery(v string) {
m.Query = &v
}
// GetSort returns the Sort field if non-nil, zero value otherwise.
func (m *ManageStatusDefinition) GetSort() string {
if m == nil || m.Sort == nil {
return ""
}
return *m.Sort
}
// GetSortOk returns a tuple with the Sort field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (m *ManageStatusDefinition) GetSortOk() (string, bool) {
if m == nil || m.Sort == nil {
return "", false
}
return *m.Sort, true
}
// HasSort returns a boolean if a field has been set.
func (m *ManageStatusDefinition) HasSort() bool {
if m != nil && m.Sort != nil {
return true
}
return false
}
// SetSort allocates a new m.Sort and returns the pointer to it.
func (m *ManageStatusDefinition) SetSort(v string) {
m.Sort = &v
}
// GetStart returns the Start field if non-nil, zero value otherwise.
func (m *ManageStatusDefinition) GetStart() int {
if m == nil || m.Start == nil {
return 0
}
return *m.Start
}
// GetStartOk returns a tuple with the Start field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (m *ManageStatusDefinition) GetStartOk() (int, bool) {
if m == nil || m.Start == nil {
return 0, false
}
return *m.Start, true
}
// HasStart returns a boolean if a field has been set.
func (m *ManageStatusDefinition) HasStart() bool {
if m != nil && m.Start != nil {
return true
}
return false
}
// SetStart allocates a new m.Start and returns the pointer to it.
func (m *ManageStatusDefinition) SetStart(v int) {
m.Start = &v
}
// GetTitle returns the Title field if non-nil, zero value otherwise.
func (m *ManageStatusDefinition) GetTitle() string {
if m == nil || m.Title == nil {
return ""
}
return *m.Title
}
// GetTitleOk returns a tuple with the Title field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (m *ManageStatusDefinition) GetTitleOk() (string, bool) {
if m == nil || m.Title == nil {
return "", false
}
return *m.Title, true
}
// HasTitle returns a boolean if a field has been set.
func (m *ManageStatusDefinition) HasTitle() bool {
if m != nil && m.Title != nil {
return true
}
return false
}
// SetTitle allocates a new m.Title and returns the pointer to it.
func (m *ManageStatusDefinition) SetTitle(v string) {
m.Title = &v
}
// GetTitleAlign returns the TitleAlign field if non-nil, zero value otherwise.
func (m *ManageStatusDefinition) GetTitleAlign() string {
if m == nil || m.TitleAlign == nil {
return ""
}
return *m.TitleAlign
}
// GetTitleAlignOk returns a tuple with the TitleAlign field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (m *ManageStatusDefinition) GetTitleAlignOk() (string, bool) {
if m == nil || m.TitleAlign == nil {
return "", false
}
return *m.TitleAlign, true
}
// HasTitleAlign returns a boolean if a field has been set.
func (m *ManageStatusDefinition) HasTitleAlign() bool {
if m != nil && m.TitleAlign != nil {
return true
}
return false
}
// SetTitleAlign allocates a new m.TitleAlign and returns the pointer to it.
func (m *ManageStatusDefinition) SetTitleAlign(v string) {
m.TitleAlign = &v
}
// GetTitleSize returns the TitleSize field if non-nil, zero value otherwise.
func (m *ManageStatusDefinition) GetTitleSize() string {
if m == nil || m.TitleSize == nil {
return ""
}
return *m.TitleSize
}
// GetTitleSizeOk returns a tuple with the TitleSize field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (m *ManageStatusDefinition) GetTitleSizeOk() (string, bool) {
if m == nil || m.TitleSize == nil {
return "", false
}
return *m.TitleSize, true
}
// HasTitleSize returns a boolean if a field has been set.
func (m *ManageStatusDefinition) HasTitleSize() bool {
if m != nil && m.TitleSize != nil {
return true
}
return false
}
// SetTitleSize allocates a new m.TitleSize and returns the pointer to it.
func (m *ManageStatusDefinition) SetTitleSize(v string) {
m.TitleSize = &v
}
// GetType returns the Type field if non-nil, zero value otherwise.
func (m *ManageStatusDefinition) GetType() string {
if m == nil || m.Type == nil {
return ""
}
return *m.Type
}
// GetTypeOk returns a tuple with the Type field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (m *ManageStatusDefinition) GetTypeOk() (string, bool) {
if m == nil || m.Type == nil {
return "", false
}
return *m.Type, true
}
// HasType returns a boolean if a field has been set.
func (m *ManageStatusDefinition) HasType() bool {
if m != nil && m.Type != nil {
return true
}
return false
}
// SetType allocates a new m.Type and returns the pointer to it.
func (m *ManageStatusDefinition) SetType(v string) {
m.Type = &v
}
// GetHost returns the Host field if non-nil, zero value otherwise.
func (m *Metric) GetHost() string {
if m == nil || m.Host == nil {
return ""
}
return *m.Host
}
// GetHostOk returns a tuple with the Host field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (m *Metric) GetHostOk() (string, bool) {
if m == nil || m.Host == nil {
return "", false
}
return *m.Host, true
}
// HasHost returns a boolean if a field has been set.
func (m *Metric) HasHost() bool {
if m != nil && m.Host != nil {
return true
}
return false
}
// SetHost allocates a new m.Host and returns the pointer to it.
func (m *Metric) SetHost(v string) {
m.Host = &v
}
// GetMetric returns the Metric field if non-nil, zero value otherwise.
func (m *Metric) GetMetric() string {
if m == nil || m.Metric == nil {
return ""
}
return *m.Metric
}
// GetMetricOk returns a tuple with the Metric field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (m *Metric) GetMetricOk() (string, bool) {
if m == nil || m.Metric == nil {
return "", false
}
return *m.Metric, true
}
// HasMetric returns a boolean if a field has been set.
func (m *Metric) HasMetric() bool {
if m != nil && m.Metric != nil {
return true
}
return false
}
// SetMetric allocates a new m.Metric and returns the pointer to it.
func (m *Metric) SetMetric(v string) {
m.Metric = &v
}
// GetType returns the Type field if non-nil, zero value otherwise.
func (m *Metric) GetType() string {
if m == nil || m.Type == nil {
return ""
}
return *m.Type
}
// GetTypeOk returns a tuple with the Type field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (m *Metric) GetTypeOk() (string, bool) {
if m == nil || m.Type == nil {
return "", false
}
return *m.Type, true
}
// HasType returns a boolean if a field has been set.
func (m *Metric) HasType() bool {
if m != nil && m.Type != nil {
return true
}
return false
}
// SetType allocates a new m.Type and returns the pointer to it.
func (m *Metric) SetType(v string) {
m.Type = &v
}
// GetUnit returns the Unit field if non-nil, zero value otherwise.
func (m *Metric) GetUnit() string {
if m == nil || m.Unit == nil {
return ""
}
return *m.Unit
}
// GetUnitOk returns a tuple with the Unit field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (m *Metric) GetUnitOk() (string, bool) {
if m == nil || m.Unit == nil {
return "", false
}
return *m.Unit, true
}
// HasUnit returns a boolean if a field has been set.
func (m *Metric) HasUnit() bool {
if m != nil && m.Unit != nil {
return true
}
return false
}
// SetUnit allocates a new m.Unit and returns the pointer to it.
func (m *Metric) SetUnit(v string) {
m.Unit = &v
}
// GetDescription returns the Description field if non-nil, zero value otherwise.
func (m *MetricMetadata) GetDescription() string {
if m == nil || m.Description == nil {
return ""
}
return *m.Description
}
// GetDescriptionOk returns a tuple with the Description field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (m *MetricMetadata) GetDescriptionOk() (string, bool) {
if m == nil || m.Description == nil {
return "", false
}
return *m.Description, true
}
// HasDescription returns a boolean if a field has been set.
func (m *MetricMetadata) HasDescription() bool {
if m != nil && m.Description != nil {
return true
}
return false
}
// SetDescription allocates a new m.Description and returns the pointer to it.
func (m *MetricMetadata) SetDescription(v string) {
m.Description = &v
}
// GetPerUnit returns the PerUnit field if non-nil, zero value otherwise.
func (m *MetricMetadata) GetPerUnit() string {
if m == nil || m.PerUnit == nil {
return ""
}
return *m.PerUnit
}
// GetPerUnitOk returns a tuple with the PerUnit field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (m *MetricMetadata) GetPerUnitOk() (string, bool) {
if m == nil || m.PerUnit == nil {
return "", false
}
return *m.PerUnit, true
}
// HasPerUnit returns a boolean if a field has been set.
func (m *MetricMetadata) HasPerUnit() bool {
if m != nil && m.PerUnit != nil {
return true
}
return false
}
// SetPerUnit allocates a new m.PerUnit and returns the pointer to it.
func (m *MetricMetadata) SetPerUnit(v string) {
m.PerUnit = &v
}
// GetShortName returns the ShortName field if non-nil, zero value otherwise.
func (m *MetricMetadata) GetShortName() string {
if m == nil || m.ShortName == nil {
return ""
}
return *m.ShortName
}
// GetShortNameOk returns a tuple with the ShortName field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (m *MetricMetadata) GetShortNameOk() (string, bool) {
if m == nil || m.ShortName == nil {
return "", false
}
return *m.ShortName, true
}
// HasShortName returns a boolean if a field has been set.
func (m *MetricMetadata) HasShortName() bool {
if m != nil && m.ShortName != nil {
return true
}
return false
}
// SetShortName allocates a new m.ShortName and returns the pointer to it.
func (m *MetricMetadata) SetShortName(v string) {
m.ShortName = &v
}
// GetStatsdInterval returns the StatsdInterval field if non-nil, zero value otherwise.
func (m *MetricMetadata) GetStatsdInterval() int {
if m == nil || m.StatsdInterval == nil {
return 0
}
return *m.StatsdInterval
}
// GetStatsdIntervalOk returns a tuple with the StatsdInterval field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (m *MetricMetadata) GetStatsdIntervalOk() (int, bool) {
if m == nil || m.StatsdInterval == nil {
return 0, false
}
return *m.StatsdInterval, true
}
// HasStatsdInterval returns a boolean if a field has been set.
func (m *MetricMetadata) HasStatsdInterval() bool {
if m != nil && m.StatsdInterval != nil {
return true
}
return false
}
// SetStatsdInterval allocates a new m.StatsdInterval and returns the pointer to it.
func (m *MetricMetadata) SetStatsdInterval(v int) {
m.StatsdInterval = &v
}
// GetType returns the Type field if non-nil, zero value otherwise.
func (m *MetricMetadata) GetType() string {
if m == nil || m.Type == nil {
return ""
}
return *m.Type
}
// GetTypeOk returns a tuple with the Type field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (m *MetricMetadata) GetTypeOk() (string, bool) {
if m == nil || m.Type == nil {
return "", false
}
return *m.Type, true
}
// HasType returns a boolean if a field has been set.
func (m *MetricMetadata) HasType() bool {
if m != nil && m.Type != nil {
return true
}
return false
}
// SetType allocates a new m.Type and returns the pointer to it.
func (m *MetricMetadata) SetType(v string) {
m.Type = &v
}
// GetUnit returns the Unit field if non-nil, zero value otherwise.
func (m *MetricMetadata) GetUnit() string {
if m == nil || m.Unit == nil {
return ""
}
return *m.Unit
}
// GetUnitOk returns a tuple with the Unit field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (m *MetricMetadata) GetUnitOk() (string, bool) {
if m == nil || m.Unit == nil {
return "", false
}
return *m.Unit, true
}
// HasUnit returns a boolean if a field has been set.
func (m *MetricMetadata) HasUnit() bool {
if m != nil && m.Unit != nil {
return true
}
return false
}
// SetUnit allocates a new m.Unit and returns the pointer to it.
func (m *MetricMetadata) SetUnit(v string) {
m.Unit = &v
}
// GetCreator returns the Creator field if non-nil, zero value otherwise.
func (m *Monitor) GetCreator() Creator {
if m == nil || m.Creator == nil {
return Creator{}
}
return *m.Creator
}
// GetCreatorOk returns a tuple with the Creator field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (m *Monitor) GetCreatorOk() (Creator, bool) {
if m == nil || m.Creator == nil {
return Creator{}, false
}
return *m.Creator, true
}
// HasCreator returns a boolean if a field has been set.
func (m *Monitor) HasCreator() bool {
if m != nil && m.Creator != nil {
return true
}
return false
}
// SetCreator allocates a new m.Creator and returns the pointer to it.
func (m *Monitor) SetCreator(v Creator) {
m.Creator = &v
}
// GetId returns the Id field if non-nil, zero value otherwise.
func (m *Monitor) GetId() int {
if m == nil || m.Id == nil {
return 0
}
return *m.Id
}
// GetIdOk returns a tuple with the Id field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (m *Monitor) GetIdOk() (int, bool) {
if m == nil || m.Id == nil {
return 0, false
}
return *m.Id, true
}
// HasId returns a boolean if a field has been set.
func (m *Monitor) HasId() bool {
if m != nil && m.Id != nil {
return true
}
return false
}
// SetId allocates a new m.Id and returns the pointer to it.
func (m *Monitor) SetId(v int) {
m.Id = &v
}
// GetMessage returns the Message field if non-nil, zero value otherwise.
func (m *Monitor) GetMessage() string {
if m == nil || m.Message == nil {
return ""
}
return *m.Message
}
// GetMessageOk returns a tuple with the Message field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (m *Monitor) GetMessageOk() (string, bool) {
if m == nil || m.Message == nil {
return "", false
}
return *m.Message, true
}
// HasMessage returns a boolean if a field has been set.
func (m *Monitor) HasMessage() bool {
if m != nil && m.Message != nil {
return true
}
return false
}
// SetMessage allocates a new m.Message and returns the pointer to it.
func (m *Monitor) SetMessage(v string) {
m.Message = &v
}
// GetName returns the Name field if non-nil, zero value otherwise.
func (m *Monitor) GetName() string {
if m == nil || m.Name == nil {
return ""
}
return *m.Name
}
// GetNameOk returns a tuple with the Name field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (m *Monitor) GetNameOk() (string, bool) {
if m == nil || m.Name == nil {
return "", false
}
return *m.Name, true
}
// HasName returns a boolean if a field has been set.
func (m *Monitor) HasName() bool {
if m != nil && m.Name != nil {
return true
}
return false
}
// SetName allocates a new m.Name and returns the pointer to it.
func (m *Monitor) SetName(v string) {
m.Name = &v
}
// GetOptions returns the Options field if non-nil, zero value otherwise.
func (m *Monitor) GetOptions() Options {
if m == nil || m.Options == nil {
return Options{}
}
return *m.Options
}
// GetOptionsOk returns a tuple with the Options field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (m *Monitor) GetOptionsOk() (Options, bool) {
if m == nil || m.Options == nil {
return Options{}, false
}
return *m.Options, true
}
// HasOptions returns a boolean if a field has been set.
func (m *Monitor) HasOptions() bool {
if m != nil && m.Options != nil {
return true
}
return false
}
// SetOptions allocates a new m.Options and returns the pointer to it.
func (m *Monitor) SetOptions(v Options) {
m.Options = &v
}
// GetOverallState returns the OverallState field if non-nil, zero value otherwise.
func (m *Monitor) GetOverallState() string {
if m == nil || m.OverallState == nil {
return ""
}
return *m.OverallState
}
// GetOverallStateOk returns a tuple with the OverallState field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (m *Monitor) GetOverallStateOk() (string, bool) {
if m == nil || m.OverallState == nil {
return "", false
}
return *m.OverallState, true
}
// HasOverallState returns a boolean if a field has been set.
func (m *Monitor) HasOverallState() bool {
if m != nil && m.OverallState != nil {
return true
}
return false
}
// SetOverallState allocates a new m.OverallState and returns the pointer to it.
func (m *Monitor) SetOverallState(v string) {
m.OverallState = &v
}
// GetOverallStateModified returns the OverallStateModified field if non-nil, zero value otherwise.
func (m *Monitor) GetOverallStateModified() string {
if m == nil || m.OverallStateModified == nil {
return ""
}
return *m.OverallStateModified
}
// GetOverallStateModifiedOk returns a tuple with the OverallStateModified field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (m *Monitor) GetOverallStateModifiedOk() (string, bool) {
if m == nil || m.OverallStateModified == nil {
return "", false
}
return *m.OverallStateModified, true
}
// HasOverallStateModified returns a boolean if a field has been set.
func (m *Monitor) HasOverallStateModified() bool {
if m != nil && m.OverallStateModified != nil {
return true
}
return false
}
// SetOverallStateModified allocates a new m.OverallStateModified and returns the pointer to it.
func (m *Monitor) SetOverallStateModified(v string) {
m.OverallStateModified = &v
}
// GetQuery returns the Query field if non-nil, zero value otherwise.
func (m *Monitor) GetQuery() string {
if m == nil || m.Query == nil {
return ""
}
return *m.Query
}
// GetQueryOk returns a tuple with the Query field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (m *Monitor) GetQueryOk() (string, bool) {
if m == nil || m.Query == nil {
return "", false
}
return *m.Query, true
}
// HasQuery returns a boolean if a field has been set.
func (m *Monitor) HasQuery() bool {
if m != nil && m.Query != nil {
return true
}
return false
}
// SetQuery allocates a new m.Query and returns the pointer to it.
func (m *Monitor) SetQuery(v string) {
m.Query = &v
}
// GetType returns the Type field if non-nil, zero value otherwise.
func (m *Monitor) GetType() string {
if m == nil || m.Type == nil {
return ""
}
return *m.Type
}
// GetTypeOk returns a tuple with the Type field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (m *Monitor) GetTypeOk() (string, bool) {
if m == nil || m.Type == nil {
return "", false
}
return *m.Type, true
}
// HasType returns a boolean if a field has been set.
func (m *Monitor) HasType() bool {
if m != nil && m.Type != nil {
return true
}
return false
}
// SetType allocates a new m.Type and returns the pointer to it.
func (m *Monitor) SetType(v string) {
m.Type = &v
}
// GetName returns the Name field if non-nil, zero value otherwise.
func (m *MonitorQueryOpts) GetName() string {
if m == nil || m.Name == nil {
return ""
}
return *m.Name
}
// GetNameOk returns a tuple with the Name field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (m *MonitorQueryOpts) GetNameOk() (string, bool) {
if m == nil || m.Name == nil {
return "", false
}
return *m.Name, true
}
// HasName returns a boolean if a field has been set.
func (m *MonitorQueryOpts) HasName() bool {
if m != nil && m.Name != nil {
return true
}
return false
}
// SetName allocates a new m.Name and returns the pointer to it.
func (m *MonitorQueryOpts) SetName(v string) {
m.Name = &v
}
// GetWithDowntimes returns the WithDowntimes field if non-nil, zero value otherwise.
func (m *MonitorQueryOpts) GetWithDowntimes() bool {
if m == nil || m.WithDowntimes == nil {
return false
}
return *m.WithDowntimes
}
// GetWithDowntimesOk returns a tuple with the WithDowntimes field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (m *MonitorQueryOpts) GetWithDowntimesOk() (bool, bool) {
if m == nil || m.WithDowntimes == nil {
return false, false
}
return *m.WithDowntimes, true
}
// HasWithDowntimes returns a boolean if a field has been set.
func (m *MonitorQueryOpts) HasWithDowntimes() bool {
if m != nil && m.WithDowntimes != nil {
return true
}
return false
}
// SetWithDowntimes allocates a new m.WithDowntimes and returns the pointer to it.
func (m *MonitorQueryOpts) SetWithDowntimes(v bool) {
m.WithDowntimes = &v
}
// GetEnd returns the End field if non-nil, zero value otherwise.
func (m *MuteMonitorScope) GetEnd() int {
if m == nil || m.End == nil {
return 0
}
return *m.End
}
// GetEndOk returns a tuple with the End field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (m *MuteMonitorScope) GetEndOk() (int, bool) {
if m == nil || m.End == nil {
return 0, false
}
return *m.End, true
}
// HasEnd returns a boolean if a field has been set.
func (m *MuteMonitorScope) HasEnd() bool {
if m != nil && m.End != nil {
return true
}
return false
}
// SetEnd allocates a new m.End and returns the pointer to it.
func (m *MuteMonitorScope) SetEnd(v int) {
m.End = &v
}
// GetScope returns the Scope field if non-nil, zero value otherwise.
func (m *MuteMonitorScope) GetScope() string {
if m == nil || m.Scope == nil {
return ""
}
return *m.Scope
}
// GetScopeOk returns a tuple with the Scope field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (m *MuteMonitorScope) GetScopeOk() (string, bool) {
if m == nil || m.Scope == nil {
return "", false
}
return *m.Scope, true
}
// HasScope returns a boolean if a field has been set.
func (m *MuteMonitorScope) HasScope() bool {
if m != nil && m.Scope != nil {
return true
}
return false
}
// SetScope allocates a new m.Scope and returns the pointer to it.
func (m *MuteMonitorScope) SetScope(v string) {
m.Scope = &v
}
// GetFilter returns the Filter field if non-nil, zero value otherwise.
func (n *NestedPipeline) GetFilter() FilterConfiguration {
if n == nil || n.Filter == nil {
return FilterConfiguration{}
}
return *n.Filter
}
// GetFilterOk returns a tuple with the Filter field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (n *NestedPipeline) GetFilterOk() (FilterConfiguration, bool) {
if n == nil || n.Filter == nil {
return FilterConfiguration{}, false
}
return *n.Filter, true
}
// HasFilter returns a boolean if a field has been set.
func (n *NestedPipeline) HasFilter() bool {
if n != nil && n.Filter != nil {
return true
}
return false
}
// SetFilter allocates a new n.Filter and returns the pointer to it.
func (n *NestedPipeline) SetFilter(v FilterConfiguration) {
n.Filter = &v
}
// GetBackgroundColor returns the BackgroundColor field if non-nil, zero value otherwise.
func (n *NoteDefinition) GetBackgroundColor() string {
if n == nil || n.BackgroundColor == nil {
return ""
}
return *n.BackgroundColor
}
// GetBackgroundColorOk returns a tuple with the BackgroundColor field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (n *NoteDefinition) GetBackgroundColorOk() (string, bool) {
if n == nil || n.BackgroundColor == nil {
return "", false
}
return *n.BackgroundColor, true
}
// HasBackgroundColor returns a boolean if a field has been set.
func (n *NoteDefinition) HasBackgroundColor() bool {
if n != nil && n.BackgroundColor != nil {
return true
}
return false
}
// SetBackgroundColor allocates a new n.BackgroundColor and returns the pointer to it.
func (n *NoteDefinition) SetBackgroundColor(v string) {
n.BackgroundColor = &v
}
// GetContent returns the Content field if non-nil, zero value otherwise.
func (n *NoteDefinition) GetContent() string {
if n == nil || n.Content == nil {
return ""
}
return *n.Content
}
// GetContentOk returns a tuple with the Content field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (n *NoteDefinition) GetContentOk() (string, bool) {
if n == nil || n.Content == nil {
return "", false
}
return *n.Content, true
}
// HasContent returns a boolean if a field has been set.
func (n *NoteDefinition) HasContent() bool {
if n != nil && n.Content != nil {
return true
}
return false
}
// SetContent allocates a new n.Content and returns the pointer to it.
func (n *NoteDefinition) SetContent(v string) {
n.Content = &v
}
// GetFontSize returns the FontSize field if non-nil, zero value otherwise.
func (n *NoteDefinition) GetFontSize() string {
if n == nil || n.FontSize == nil {
return ""
}
return *n.FontSize
}
// GetFontSizeOk returns a tuple with the FontSize field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (n *NoteDefinition) GetFontSizeOk() (string, bool) {
if n == nil || n.FontSize == nil {
return "", false
}
return *n.FontSize, true
}
// HasFontSize returns a boolean if a field has been set.
func (n *NoteDefinition) HasFontSize() bool {
if n != nil && n.FontSize != nil {
return true
}
return false
}
// SetFontSize allocates a new n.FontSize and returns the pointer to it.
func (n *NoteDefinition) SetFontSize(v string) {
n.FontSize = &v
}
// GetShowTick returns the ShowTick field if non-nil, zero value otherwise.
func (n *NoteDefinition) GetShowTick() bool {
if n == nil || n.ShowTick == nil {
return false
}
return *n.ShowTick
}
// GetShowTickOk returns a tuple with the ShowTick field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (n *NoteDefinition) GetShowTickOk() (bool, bool) {
if n == nil || n.ShowTick == nil {
return false, false
}
return *n.ShowTick, true
}
// HasShowTick returns a boolean if a field has been set.
func (n *NoteDefinition) HasShowTick() bool {
if n != nil && n.ShowTick != nil {
return true
}
return false
}
// SetShowTick allocates a new n.ShowTick and returns the pointer to it.
func (n *NoteDefinition) SetShowTick(v bool) {
n.ShowTick = &v
}
// GetTextAlign returns the TextAlign field if non-nil, zero value otherwise.
func (n *NoteDefinition) GetTextAlign() string {
if n == nil || n.TextAlign == nil {
return ""
}
return *n.TextAlign
}
// GetTextAlignOk returns a tuple with the TextAlign field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (n *NoteDefinition) GetTextAlignOk() (string, bool) {
if n == nil || n.TextAlign == nil {
return "", false
}
return *n.TextAlign, true
}
// HasTextAlign returns a boolean if a field has been set.
func (n *NoteDefinition) HasTextAlign() bool {
if n != nil && n.TextAlign != nil {
return true
}
return false
}
// SetTextAlign allocates a new n.TextAlign and returns the pointer to it.
func (n *NoteDefinition) SetTextAlign(v string) {
n.TextAlign = &v
}
// GetTickEdge returns the TickEdge field if non-nil, zero value otherwise.
func (n *NoteDefinition) GetTickEdge() string {
if n == nil || n.TickEdge == nil {
return ""
}
return *n.TickEdge
}
// GetTickEdgeOk returns a tuple with the TickEdge field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (n *NoteDefinition) GetTickEdgeOk() (string, bool) {
if n == nil || n.TickEdge == nil {
return "", false
}
return *n.TickEdge, true
}
// HasTickEdge returns a boolean if a field has been set.
func (n *NoteDefinition) HasTickEdge() bool {
if n != nil && n.TickEdge != nil {
return true
}
return false
}
// SetTickEdge allocates a new n.TickEdge and returns the pointer to it.
func (n *NoteDefinition) SetTickEdge(v string) {
n.TickEdge = &v
}
// GetTickPos returns the TickPos field if non-nil, zero value otherwise.
func (n *NoteDefinition) GetTickPos() string {
if n == nil || n.TickPos == nil {
return ""
}
return *n.TickPos
}
// GetTickPosOk returns a tuple with the TickPos field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (n *NoteDefinition) GetTickPosOk() (string, bool) {
if n == nil || n.TickPos == nil {
return "", false
}
return *n.TickPos, true
}
// HasTickPos returns a boolean if a field has been set.
func (n *NoteDefinition) HasTickPos() bool {
if n != nil && n.TickPos != nil {
return true
}
return false
}
// SetTickPos allocates a new n.TickPos and returns the pointer to it.
func (n *NoteDefinition) SetTickPos(v string) {
n.TickPos = &v
}
// GetType returns the Type field if non-nil, zero value otherwise.
func (n *NoteDefinition) GetType() string {
if n == nil || n.Type == nil {
return ""
}
return *n.Type
}
// GetTypeOk returns a tuple with the Type field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (n *NoteDefinition) GetTypeOk() (string, bool) {
if n == nil || n.Type == nil {
return "", false
}
return *n.Type, true
}
// HasType returns a boolean if a field has been set.
func (n *NoteDefinition) HasType() bool {
if n != nil && n.Type != nil {
return true
}
return false
}
// SetType allocates a new n.Type and returns the pointer to it.
func (n *NoteDefinition) SetType(v string) {
n.Type = &v
}
// GetEnableLogsSample returns the EnableLogsSample field if non-nil, zero value otherwise.
func (o *Options) GetEnableLogsSample() bool {
if o == nil || o.EnableLogsSample == nil {
return false
}
return *o.EnableLogsSample
}
// GetEnableLogsSampleOk returns a tuple with the EnableLogsSample field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (o *Options) GetEnableLogsSampleOk() (bool, bool) {
if o == nil || o.EnableLogsSample == nil {
return false, false
}
return *o.EnableLogsSample, true
}
// HasEnableLogsSample returns a boolean if a field has been set.
func (o *Options) HasEnableLogsSample() bool {
if o != nil && o.EnableLogsSample != nil {
return true
}
return false
}
// SetEnableLogsSample allocates a new o.EnableLogsSample and returns the pointer to it.
func (o *Options) SetEnableLogsSample(v bool) {
o.EnableLogsSample = &v
}
// GetEscalationMessage returns the EscalationMessage field if non-nil, zero value otherwise.
func (o *Options) GetEscalationMessage() string {
if o == nil || o.EscalationMessage == nil {
return ""
}
return *o.EscalationMessage
}
// GetEscalationMessageOk returns a tuple with the EscalationMessage field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (o *Options) GetEscalationMessageOk() (string, bool) {
if o == nil || o.EscalationMessage == nil {
return "", false
}
return *o.EscalationMessage, true
}
// HasEscalationMessage returns a boolean if a field has been set.
func (o *Options) HasEscalationMessage() bool {
if o != nil && o.EscalationMessage != nil {
return true
}
return false
}
// SetEscalationMessage allocates a new o.EscalationMessage and returns the pointer to it.
func (o *Options) SetEscalationMessage(v string) {
o.EscalationMessage = &v
}
// GetEvaluationDelay returns the EvaluationDelay field if non-nil, zero value otherwise.
func (o *Options) GetEvaluationDelay() int {
if o == nil || o.EvaluationDelay == nil {
return 0
}
return *o.EvaluationDelay
}
// GetEvaluationDelayOk returns a tuple with the EvaluationDelay field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (o *Options) GetEvaluationDelayOk() (int, bool) {
if o == nil || o.EvaluationDelay == nil {
return 0, false
}
return *o.EvaluationDelay, true
}
// HasEvaluationDelay returns a boolean if a field has been set.
func (o *Options) HasEvaluationDelay() bool {
if o != nil && o.EvaluationDelay != nil {
return true
}
return false
}
// SetEvaluationDelay allocates a new o.EvaluationDelay and returns the pointer to it.
func (o *Options) SetEvaluationDelay(v int) {
o.EvaluationDelay = &v
}
// GetIncludeTags returns the IncludeTags field if non-nil, zero value otherwise.
func (o *Options) GetIncludeTags() bool {
if o == nil || o.IncludeTags == nil {
return false
}
return *o.IncludeTags
}
// GetIncludeTagsOk returns a tuple with the IncludeTags field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (o *Options) GetIncludeTagsOk() (bool, bool) {
if o == nil || o.IncludeTags == nil {
return false, false
}
return *o.IncludeTags, true
}
// HasIncludeTags returns a boolean if a field has been set.
func (o *Options) HasIncludeTags() bool {
if o != nil && o.IncludeTags != nil {
return true
}
return false
}
// SetIncludeTags allocates a new o.IncludeTags and returns the pointer to it.
func (o *Options) SetIncludeTags(v bool) {
o.IncludeTags = &v
}
// GetLocked returns the Locked field if non-nil, zero value otherwise.
func (o *Options) GetLocked() bool {
if o == nil || o.Locked == nil {
return false
}
return *o.Locked
}
// GetLockedOk returns a tuple with the Locked field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (o *Options) GetLockedOk() (bool, bool) {
if o == nil || o.Locked == nil {
return false, false
}
return *o.Locked, true
}
// HasLocked returns a boolean if a field has been set.
func (o *Options) HasLocked() bool {
if o != nil && o.Locked != nil {
return true
}
return false
}
// SetLocked allocates a new o.Locked and returns the pointer to it.
func (o *Options) SetLocked(v bool) {
o.Locked = &v
}
// GetNewHostDelay returns the NewHostDelay field if non-nil, zero value otherwise.
func (o *Options) GetNewHostDelay() int {
if o == nil || o.NewHostDelay == nil {
return 0
}
return *o.NewHostDelay
}
// GetNewHostDelayOk returns a tuple with the NewHostDelay field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (o *Options) GetNewHostDelayOk() (int, bool) {
if o == nil || o.NewHostDelay == nil {
return 0, false
}
return *o.NewHostDelay, true
}
// HasNewHostDelay returns a boolean if a field has been set.
func (o *Options) HasNewHostDelay() bool {
if o != nil && o.NewHostDelay != nil {
return true
}
return false
}
// SetNewHostDelay allocates a new o.NewHostDelay and returns the pointer to it.
func (o *Options) SetNewHostDelay(v int) {
o.NewHostDelay = &v
}
// GetNotifyAudit returns the NotifyAudit field if non-nil, zero value otherwise.
func (o *Options) GetNotifyAudit() bool {
if o == nil || o.NotifyAudit == nil {
return false
}
return *o.NotifyAudit
}
// GetNotifyAuditOk returns a tuple with the NotifyAudit field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (o *Options) GetNotifyAuditOk() (bool, bool) {
if o == nil || o.NotifyAudit == nil {
return false, false
}
return *o.NotifyAudit, true
}
// HasNotifyAudit returns a boolean if a field has been set.
func (o *Options) HasNotifyAudit() bool {
if o != nil && o.NotifyAudit != nil {
return true
}
return false
}
// SetNotifyAudit allocates a new o.NotifyAudit and returns the pointer to it.
func (o *Options) SetNotifyAudit(v bool) {
o.NotifyAudit = &v
}
// GetNotifyNoData returns the NotifyNoData field if non-nil, zero value otherwise.
func (o *Options) GetNotifyNoData() bool {
if o == nil || o.NotifyNoData == nil {
return false
}
return *o.NotifyNoData
}
// GetNotifyNoDataOk returns a tuple with the NotifyNoData field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (o *Options) GetNotifyNoDataOk() (bool, bool) {
if o == nil || o.NotifyNoData == nil {
return false, false
}
return *o.NotifyNoData, true
}
// HasNotifyNoData returns a boolean if a field has been set.
func (o *Options) HasNotifyNoData() bool {
if o != nil && o.NotifyNoData != nil {
return true
}
return false
}
// SetNotifyNoData allocates a new o.NotifyNoData and returns the pointer to it.
func (o *Options) SetNotifyNoData(v bool) {
o.NotifyNoData = &v
}
// GetQueryConfig returns the QueryConfig field if non-nil, zero value otherwise.
func (o *Options) GetQueryConfig() QueryConfig {
if o == nil || o.QueryConfig == nil {
return QueryConfig{}
}
return *o.QueryConfig
}
// GetQueryConfigOk returns a tuple with the QueryConfig field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (o *Options) GetQueryConfigOk() (QueryConfig, bool) {
if o == nil || o.QueryConfig == nil {
return QueryConfig{}, false
}
return *o.QueryConfig, true
}
// HasQueryConfig returns a boolean if a field has been set.
func (o *Options) HasQueryConfig() bool {
if o != nil && o.QueryConfig != nil {
return true
}
return false
}
// SetQueryConfig allocates a new o.QueryConfig and returns the pointer to it.
func (o *Options) SetQueryConfig(v QueryConfig) {
o.QueryConfig = &v
}
// GetRenotifyInterval returns the RenotifyInterval field if non-nil, zero value otherwise.
func (o *Options) GetRenotifyInterval() int {
if o == nil || o.RenotifyInterval == nil {
return 0
}
return *o.RenotifyInterval
}
// GetRenotifyIntervalOk returns a tuple with the RenotifyInterval field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (o *Options) GetRenotifyIntervalOk() (int, bool) {
if o == nil || o.RenotifyInterval == nil {
return 0, false
}
return *o.RenotifyInterval, true
}
// HasRenotifyInterval returns a boolean if a field has been set.
func (o *Options) HasRenotifyInterval() bool {
if o != nil && o.RenotifyInterval != nil {
return true
}
return false
}
// SetRenotifyInterval allocates a new o.RenotifyInterval and returns the pointer to it.
func (o *Options) SetRenotifyInterval(v int) {
o.RenotifyInterval = &v
}
// GetRequireFullWindow returns the RequireFullWindow field if non-nil, zero value otherwise.
func (o *Options) GetRequireFullWindow() bool {
if o == nil || o.RequireFullWindow == nil {
return false
}
return *o.RequireFullWindow
}
// GetRequireFullWindowOk returns a tuple with the RequireFullWindow field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (o *Options) GetRequireFullWindowOk() (bool, bool) {
if o == nil || o.RequireFullWindow == nil {
return false, false
}
return *o.RequireFullWindow, true
}
// HasRequireFullWindow returns a boolean if a field has been set.
func (o *Options) HasRequireFullWindow() bool {
if o != nil && o.RequireFullWindow != nil {
return true
}
return false
}
// SetRequireFullWindow allocates a new o.RequireFullWindow and returns the pointer to it.
func (o *Options) SetRequireFullWindow(v bool) {
o.RequireFullWindow = &v
}
// GetThresholds returns the Thresholds field if non-nil, zero value otherwise.
func (o *Options) GetThresholds() ThresholdCount {
if o == nil || o.Thresholds == nil {
return ThresholdCount{}
}
return *o.Thresholds
}
// GetThresholdsOk returns a tuple with the Thresholds field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (o *Options) GetThresholdsOk() (ThresholdCount, bool) {
if o == nil || o.Thresholds == nil {
return ThresholdCount{}, false
}
return *o.Thresholds, true
}
// HasThresholds returns a boolean if a field has been set.
func (o *Options) HasThresholds() bool {
if o != nil && o.Thresholds != nil {
return true
}
return false
}
// SetThresholds allocates a new o.Thresholds and returns the pointer to it.
func (o *Options) SetThresholds(v ThresholdCount) {
o.Thresholds = &v
}
// GetThresholdWindows returns the ThresholdWindows field if non-nil, zero value otherwise.
func (o *Options) GetThresholdWindows() ThresholdWindows {
if o == nil || o.ThresholdWindows == nil {
return ThresholdWindows{}
}
return *o.ThresholdWindows
}
// GetThresholdWindowsOk returns a tuple with the ThresholdWindows field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (o *Options) GetThresholdWindowsOk() (ThresholdWindows, bool) {
if o == nil || o.ThresholdWindows == nil {
return ThresholdWindows{}, false
}
return *o.ThresholdWindows, true
}
// HasThresholdWindows returns a boolean if a field has been set.
func (o *Options) HasThresholdWindows() bool {
if o != nil && o.ThresholdWindows != nil {
return true
}
return false
}
// SetThresholdWindows allocates a new o.ThresholdWindows and returns the pointer to it.
func (o *Options) SetThresholdWindows(v ThresholdWindows) {
o.ThresholdWindows = &v
}
// GetTimeoutH returns the TimeoutH field if non-nil, zero value otherwise.
func (o *Options) GetTimeoutH() int {
if o == nil || o.TimeoutH == nil {
return 0
}
return *o.TimeoutH
}
// GetTimeoutHOk returns a tuple with the TimeoutH field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (o *Options) GetTimeoutHOk() (int, bool) {
if o == nil || o.TimeoutH == nil {
return 0, false
}
return *o.TimeoutH, true
}
// HasTimeoutH returns a boolean if a field has been set.
func (o *Options) HasTimeoutH() bool {
if o != nil && o.TimeoutH != nil {
return true
}
return false
}
// SetTimeoutH allocates a new o.TimeoutH and returns the pointer to it.
func (o *Options) SetTimeoutH(v int) {
o.TimeoutH = &v
}
// GetCount returns the Count field if non-nil, zero value otherwise.
func (p *Params) GetCount() string {
if p == nil || p.Count == nil {
return ""
}
return *p.Count
}
// GetCountOk returns a tuple with the Count field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (p *Params) GetCountOk() (string, bool) {
if p == nil || p.Count == nil {
return "", false
}
return *p.Count, true
}
// HasCount returns a boolean if a field has been set.
func (p *Params) HasCount() bool {
if p != nil && p.Count != nil {
return true
}
return false
}
// SetCount allocates a new p.Count and returns the pointer to it.
func (p *Params) SetCount(v string) {
p.Count = &v
}
// GetSort returns the Sort field if non-nil, zero value otherwise.
func (p *Params) GetSort() string {
if p == nil || p.Sort == nil {
return ""
}
return *p.Sort
}
// GetSortOk returns a tuple with the Sort field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (p *Params) GetSortOk() (string, bool) {
if p == nil || p.Sort == nil {
return "", false
}
return *p.Sort, true
}
// HasSort returns a boolean if a field has been set.
func (p *Params) HasSort() bool {
if p != nil && p.Sort != nil {
return true
}
return false
}
// SetSort allocates a new p.Sort and returns the pointer to it.
func (p *Params) SetSort(v string) {
p.Sort = &v
}
// GetStart returns the Start field if non-nil, zero value otherwise.
func (p *Params) GetStart() string {
if p == nil || p.Start == nil {
return ""
}
return *p.Start
}
// GetStartOk returns a tuple with the Start field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (p *Params) GetStartOk() (string, bool) {
if p == nil || p.Start == nil {
return "", false
}
return *p.Start, true
}
// HasStart returns a boolean if a field has been set.
func (p *Params) HasStart() bool {
if p != nil && p.Start != nil {
return true
}
return false
}
// SetStart allocates a new p.Start and returns the pointer to it.
func (p *Params) SetStart(v string) {
p.Start = &v
}
// GetText returns the Text field if non-nil, zero value otherwise.
func (p *Params) GetText() string {
if p == nil || p.Text == nil {
return ""
}
return *p.Text
}
// GetTextOk returns a tuple with the Text field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (p *Params) GetTextOk() (string, bool) {
if p == nil || p.Text == nil {
return "", false
}
return *p.Text, true
}
// HasText returns a boolean if a field has been set.
func (p *Params) HasText() bool {
if p != nil && p.Text != nil {
return true
}
return false
}
// SetText allocates a new p.Text and returns the pointer to it.
func (p *Params) SetText(v string) {
p.Text = &v
}
// GetName returns the Name field if non-nil, zero value otherwise.
func (p *Period) GetName() string {
if p == nil || p.Name == nil {
return ""
}
return *p.Name
}
// GetNameOk returns a tuple with the Name field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (p *Period) GetNameOk() (string, bool) {
if p == nil || p.Name == nil {
return "", false
}
return *p.Name, true
}
// HasName returns a boolean if a field has been set.
func (p *Period) HasName() bool {
if p != nil && p.Name != nil {
return true
}
return false
}
// SetName allocates a new p.Name and returns the pointer to it.
func (p *Period) SetName(v string) {
p.Name = &v
}
// GetSeconds returns the Seconds field if non-nil, zero value otherwise.
func (p *Period) GetSeconds() json.Number {
if p == nil || p.Seconds == nil {
return ""
}
return *p.Seconds
}
// GetSecondsOk returns a tuple with the Seconds field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (p *Period) GetSecondsOk() (json.Number, bool) {
if p == nil || p.Seconds == nil {
return "", false
}
return *p.Seconds, true
}
// HasSeconds returns a boolean if a field has been set.
func (p *Period) HasSeconds() bool {
if p != nil && p.Seconds != nil {
return true
}
return false
}
// SetSeconds allocates a new p.Seconds and returns the pointer to it.
func (p *Period) SetSeconds(v json.Number) {
p.Seconds = &v
}
// GetText returns the Text field if non-nil, zero value otherwise.
func (p *Period) GetText() string {
if p == nil || p.Text == nil {
return ""
}
return *p.Text
}
// GetTextOk returns a tuple with the Text field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (p *Period) GetTextOk() (string, bool) {
if p == nil || p.Text == nil {
return "", false
}
return *p.Text, true
}
// HasText returns a boolean if a field has been set.
func (p *Period) HasText() bool {
if p != nil && p.Text != nil {
return true
}
return false
}
// SetText allocates a new p.Text and returns the pointer to it.
func (p *Period) SetText(v string) {
p.Text = &v
}
// GetUnit returns the Unit field if non-nil, zero value otherwise.
func (p *Period) GetUnit() string {
if p == nil || p.Unit == nil {
return ""
}
return *p.Unit
}
// GetUnitOk returns a tuple with the Unit field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (p *Period) GetUnitOk() (string, bool) {
if p == nil || p.Unit == nil {
return "", false
}
return *p.Unit, true
}
// HasUnit returns a boolean if a field has been set.
func (p *Period) HasUnit() bool {
if p != nil && p.Unit != nil {
return true
}
return false
}
// SetUnit allocates a new p.Unit and returns the pointer to it.
func (p *Period) SetUnit(v string) {
p.Unit = &v
}
// GetValue returns the Value field if non-nil, zero value otherwise.
func (p *Period) GetValue() string {
if p == nil || p.Value == nil {
return ""
}
return *p.Value
}
// GetValueOk returns a tuple with the Value field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (p *Period) GetValueOk() (string, bool) {
if p == nil || p.Value == nil {
return "", false
}
return *p.Value, true
}
// HasValue returns a boolean if a field has been set.
func (p *Period) HasValue() bool {
if p != nil && p.Value != nil {
return true
}
return false
}
// SetValue allocates a new p.Value and returns the pointer to it.
func (p *Period) SetValue(v string) {
p.Value = &v
}
// GetLogSet returns the LogSet field if non-nil, zero value otherwise.
func (q *QueryConfig) GetLogSet() LogSet {
if q == nil || q.LogSet == nil {
return LogSet{}
}
return *q.LogSet
}
// GetLogSetOk returns a tuple with the LogSet field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (q *QueryConfig) GetLogSetOk() (LogSet, bool) {
if q == nil || q.LogSet == nil {
return LogSet{}, false
}
return *q.LogSet, true
}
// HasLogSet returns a boolean if a field has been set.
func (q *QueryConfig) HasLogSet() bool {
if q != nil && q.LogSet != nil {
return true
}
return false
}
// SetLogSet allocates a new q.LogSet and returns the pointer to it.
func (q *QueryConfig) SetLogSet(v LogSet) {
q.LogSet = &v
}
// GetQueryIsFailed returns the QueryIsFailed field if non-nil, zero value otherwise.
func (q *QueryConfig) GetQueryIsFailed() bool {
if q == nil || q.QueryIsFailed == nil {
return false
}
return *q.QueryIsFailed
}
// GetQueryIsFailedOk returns a tuple with the QueryIsFailed field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (q *QueryConfig) GetQueryIsFailedOk() (bool, bool) {
if q == nil || q.QueryIsFailed == nil {
return false, false
}
return *q.QueryIsFailed, true
}
// HasQueryIsFailed returns a boolean if a field has been set.
func (q *QueryConfig) HasQueryIsFailed() bool {
if q != nil && q.QueryIsFailed != nil {
return true
}
return false
}
// SetQueryIsFailed allocates a new q.QueryIsFailed and returns the pointer to it.
func (q *QueryConfig) SetQueryIsFailed(v bool) {
q.QueryIsFailed = &v
}
// GetQueryString returns the QueryString field if non-nil, zero value otherwise.
func (q *QueryConfig) GetQueryString() string {
if q == nil || q.QueryString == nil {
return ""
}
return *q.QueryString
}
// GetQueryStringOk returns a tuple with the QueryString field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (q *QueryConfig) GetQueryStringOk() (string, bool) {
if q == nil || q.QueryString == nil {
return "", false
}
return *q.QueryString, true
}
// HasQueryString returns a boolean if a field has been set.
func (q *QueryConfig) HasQueryString() bool {
if q != nil && q.QueryString != nil {
return true
}
return false
}
// SetQueryString allocates a new q.QueryString and returns the pointer to it.
func (q *QueryConfig) SetQueryString(v string) {
q.QueryString = &v
}
// GetTimeRange returns the TimeRange field if non-nil, zero value otherwise.
func (q *QueryConfig) GetTimeRange() TimeRange {
if q == nil || q.TimeRange == nil {
return TimeRange{}
}
return *q.TimeRange
}
// GetTimeRangeOk returns a tuple with the TimeRange field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (q *QueryConfig) GetTimeRangeOk() (TimeRange, bool) {
if q == nil || q.TimeRange == nil {
return TimeRange{}, false
}
return *q.TimeRange, true
}
// HasTimeRange returns a boolean if a field has been set.
func (q *QueryConfig) HasTimeRange() bool {
if q != nil && q.TimeRange != nil {
return true
}
return false
}
// SetTimeRange allocates a new q.TimeRange and returns the pointer to it.
func (q *QueryConfig) SetTimeRange(v TimeRange) {
q.TimeRange = &v
}
// GetTime returns the Time field if non-nil, zero value otherwise.
func (q *QueryTableDefinition) GetTime() WidgetTime {
if q == nil || q.Time == nil {
return WidgetTime{}
}
return *q.Time
}
// GetTimeOk returns a tuple with the Time field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (q *QueryTableDefinition) GetTimeOk() (WidgetTime, bool) {
if q == nil || q.Time == nil {
return WidgetTime{}, false
}
return *q.Time, true
}
// HasTime returns a boolean if a field has been set.
func (q *QueryTableDefinition) HasTime() bool {
if q != nil && q.Time != nil {
return true
}
return false
}
// SetTime allocates a new q.Time and returns the pointer to it.
func (q *QueryTableDefinition) SetTime(v WidgetTime) {
q.Time = &v
}
// GetTitle returns the Title field if non-nil, zero value otherwise.
func (q *QueryTableDefinition) GetTitle() string {
if q == nil || q.Title == nil {
return ""
}
return *q.Title
}
// GetTitleOk returns a tuple with the Title field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (q *QueryTableDefinition) GetTitleOk() (string, bool) {
if q == nil || q.Title == nil {
return "", false
}
return *q.Title, true
}
// HasTitle returns a boolean if a field has been set.
func (q *QueryTableDefinition) HasTitle() bool {
if q != nil && q.Title != nil {
return true
}
return false
}
// SetTitle allocates a new q.Title and returns the pointer to it.
func (q *QueryTableDefinition) SetTitle(v string) {
q.Title = &v
}
// GetTitleAlign returns the TitleAlign field if non-nil, zero value otherwise.
func (q *QueryTableDefinition) GetTitleAlign() string {
if q == nil || q.TitleAlign == nil {
return ""
}
return *q.TitleAlign
}
// GetTitleAlignOk returns a tuple with the TitleAlign field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (q *QueryTableDefinition) GetTitleAlignOk() (string, bool) {
if q == nil || q.TitleAlign == nil {
return "", false
}
return *q.TitleAlign, true
}
// HasTitleAlign returns a boolean if a field has been set.
func (q *QueryTableDefinition) HasTitleAlign() bool {
if q != nil && q.TitleAlign != nil {
return true
}
return false
}
// SetTitleAlign allocates a new q.TitleAlign and returns the pointer to it.
func (q *QueryTableDefinition) SetTitleAlign(v string) {
q.TitleAlign = &v
}
// GetTitleSize returns the TitleSize field if non-nil, zero value otherwise.
func (q *QueryTableDefinition) GetTitleSize() string {
if q == nil || q.TitleSize == nil {
return ""
}
return *q.TitleSize
}
// GetTitleSizeOk returns a tuple with the TitleSize field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (q *QueryTableDefinition) GetTitleSizeOk() (string, bool) {
if q == nil || q.TitleSize == nil {
return "", false
}
return *q.TitleSize, true
}
// HasTitleSize returns a boolean if a field has been set.
func (q *QueryTableDefinition) HasTitleSize() bool {
if q != nil && q.TitleSize != nil {
return true
}
return false
}
// SetTitleSize allocates a new q.TitleSize and returns the pointer to it.
func (q *QueryTableDefinition) SetTitleSize(v string) {
q.TitleSize = &v
}
// GetType returns the Type field if non-nil, zero value otherwise.
func (q *QueryTableDefinition) GetType() string {
if q == nil || q.Type == nil {
return ""
}
return *q.Type
}
// GetTypeOk returns a tuple with the Type field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (q *QueryTableDefinition) GetTypeOk() (string, bool) {
if q == nil || q.Type == nil {
return "", false
}
return *q.Type, true
}
// HasType returns a boolean if a field has been set.
func (q *QueryTableDefinition) HasType() bool {
if q != nil && q.Type != nil {
return true
}
return false
}
// SetType allocates a new q.Type and returns the pointer to it.
func (q *QueryTableDefinition) SetType(v string) {
q.Type = &v
}
// GetAggregator returns the Aggregator field if non-nil, zero value otherwise.
func (q *QueryTableRequest) GetAggregator() string {
if q == nil || q.Aggregator == nil {
return ""
}
return *q.Aggregator
}
// GetAggregatorOk returns a tuple with the Aggregator field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (q *QueryTableRequest) GetAggregatorOk() (string, bool) {
if q == nil || q.Aggregator == nil {
return "", false
}
return *q.Aggregator, true
}
// HasAggregator returns a boolean if a field has been set.
func (q *QueryTableRequest) HasAggregator() bool {
if q != nil && q.Aggregator != nil {
return true
}
return false
}
// SetAggregator allocates a new q.Aggregator and returns the pointer to it.
func (q *QueryTableRequest) SetAggregator(v string) {
q.Aggregator = &v
}
// GetAlias returns the Alias field if non-nil, zero value otherwise.
func (q *QueryTableRequest) GetAlias() string {
if q == nil || q.Alias == nil {
return ""
}
return *q.Alias
}
// GetAliasOk returns a tuple with the Alias field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (q *QueryTableRequest) GetAliasOk() (string, bool) {
if q == nil || q.Alias == nil {
return "", false
}
return *q.Alias, true
}
// HasAlias returns a boolean if a field has been set.
func (q *QueryTableRequest) HasAlias() bool {
if q != nil && q.Alias != nil {
return true
}
return false
}
// SetAlias allocates a new q.Alias and returns the pointer to it.
func (q *QueryTableRequest) SetAlias(v string) {
q.Alias = &v
}
// GetApmQuery returns the ApmQuery field if non-nil, zero value otherwise.
func (q *QueryTableRequest) GetApmQuery() WidgetApmOrLogQuery {
if q == nil || q.ApmQuery == nil {
return WidgetApmOrLogQuery{}
}
return *q.ApmQuery
}
// GetApmQueryOk returns a tuple with the ApmQuery field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (q *QueryTableRequest) GetApmQueryOk() (WidgetApmOrLogQuery, bool) {
if q == nil || q.ApmQuery == nil {
return WidgetApmOrLogQuery{}, false
}
return *q.ApmQuery, true
}
// HasApmQuery returns a boolean if a field has been set.
func (q *QueryTableRequest) HasApmQuery() bool {
if q != nil && q.ApmQuery != nil {
return true
}
return false
}
// SetApmQuery allocates a new q.ApmQuery and returns the pointer to it.
func (q *QueryTableRequest) SetApmQuery(v WidgetApmOrLogQuery) {
q.ApmQuery = &v
}
// GetLimit returns the Limit field if non-nil, zero value otherwise.
func (q *QueryTableRequest) GetLimit() int {
if q == nil || q.Limit == nil {
return 0
}
return *q.Limit
}
// GetLimitOk returns a tuple with the Limit field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (q *QueryTableRequest) GetLimitOk() (int, bool) {
if q == nil || q.Limit == nil {
return 0, false
}
return *q.Limit, true
}
// HasLimit returns a boolean if a field has been set.
func (q *QueryTableRequest) HasLimit() bool {
if q != nil && q.Limit != nil {
return true
}
return false
}
// SetLimit allocates a new q.Limit and returns the pointer to it.
func (q *QueryTableRequest) SetLimit(v int) {
q.Limit = &v
}
// GetLogQuery returns the LogQuery field if non-nil, zero value otherwise.
func (q *QueryTableRequest) GetLogQuery() WidgetApmOrLogQuery {
if q == nil || q.LogQuery == nil {
return WidgetApmOrLogQuery{}
}
return *q.LogQuery
}
// GetLogQueryOk returns a tuple with the LogQuery field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (q *QueryTableRequest) GetLogQueryOk() (WidgetApmOrLogQuery, bool) {
if q == nil || q.LogQuery == nil {
return WidgetApmOrLogQuery{}, false
}
return *q.LogQuery, true
}
// HasLogQuery returns a boolean if a field has been set.
func (q *QueryTableRequest) HasLogQuery() bool {
if q != nil && q.LogQuery != nil {
return true
}
return false
}
// SetLogQuery allocates a new q.LogQuery and returns the pointer to it.
func (q *QueryTableRequest) SetLogQuery(v WidgetApmOrLogQuery) {
q.LogQuery = &v
}
// GetMetricQuery returns the MetricQuery field if non-nil, zero value otherwise.
func (q *QueryTableRequest) GetMetricQuery() string {
if q == nil || q.MetricQuery == nil {
return ""
}
return *q.MetricQuery
}
// GetMetricQueryOk returns a tuple with the MetricQuery field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (q *QueryTableRequest) GetMetricQueryOk() (string, bool) {
if q == nil || q.MetricQuery == nil {
return "", false
}
return *q.MetricQuery, true
}
// HasMetricQuery returns a boolean if a field has been set.
func (q *QueryTableRequest) HasMetricQuery() bool {
if q != nil && q.MetricQuery != nil {
return true
}
return false
}
// SetMetricQuery allocates a new q.MetricQuery and returns the pointer to it.
func (q *QueryTableRequest) SetMetricQuery(v string) {
q.MetricQuery = &v
}
// GetOrder returns the Order field if non-nil, zero value otherwise.
func (q *QueryTableRequest) GetOrder() string {
if q == nil || q.Order == nil {
return ""
}
return *q.Order
}
// GetOrderOk returns a tuple with the Order field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (q *QueryTableRequest) GetOrderOk() (string, bool) {
if q == nil || q.Order == nil {
return "", false
}
return *q.Order, true
}
// HasOrder returns a boolean if a field has been set.
func (q *QueryTableRequest) HasOrder() bool {
if q != nil && q.Order != nil {
return true
}
return false
}
// SetOrder allocates a new q.Order and returns the pointer to it.
func (q *QueryTableRequest) SetOrder(v string) {
q.Order = &v
}
// GetProcessQuery returns the ProcessQuery field if non-nil, zero value otherwise.
func (q *QueryTableRequest) GetProcessQuery() WidgetProcessQuery {
if q == nil || q.ProcessQuery == nil {
return WidgetProcessQuery{}
}
return *q.ProcessQuery
}
// GetProcessQueryOk returns a tuple with the ProcessQuery field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (q *QueryTableRequest) GetProcessQueryOk() (WidgetProcessQuery, bool) {
if q == nil || q.ProcessQuery == nil {
return WidgetProcessQuery{}, false
}
return *q.ProcessQuery, true
}
// HasProcessQuery returns a boolean if a field has been set.
func (q *QueryTableRequest) HasProcessQuery() bool {
if q != nil && q.ProcessQuery != nil {
return true
}
return false
}
// SetProcessQuery allocates a new q.ProcessQuery and returns the pointer to it.
func (q *QueryTableRequest) SetProcessQuery(v WidgetProcessQuery) {
q.ProcessQuery = &v
}
// GetAutoscale returns the Autoscale field if non-nil, zero value otherwise.
func (q *QueryValueDefinition) GetAutoscale() bool {
if q == nil || q.Autoscale == nil {
return false
}
return *q.Autoscale
}
// GetAutoscaleOk returns a tuple with the Autoscale field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (q *QueryValueDefinition) GetAutoscaleOk() (bool, bool) {
if q == nil || q.Autoscale == nil {
return false, false
}
return *q.Autoscale, true
}
// HasAutoscale returns a boolean if a field has been set.
func (q *QueryValueDefinition) HasAutoscale() bool {
if q != nil && q.Autoscale != nil {
return true
}
return false
}
// SetAutoscale allocates a new q.Autoscale and returns the pointer to it.
func (q *QueryValueDefinition) SetAutoscale(v bool) {
q.Autoscale = &v
}
// GetCustomUnit returns the CustomUnit field if non-nil, zero value otherwise.
func (q *QueryValueDefinition) GetCustomUnit() string {
if q == nil || q.CustomUnit == nil {
return ""
}
return *q.CustomUnit
}
// GetCustomUnitOk returns a tuple with the CustomUnit field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (q *QueryValueDefinition) GetCustomUnitOk() (string, bool) {
if q == nil || q.CustomUnit == nil {
return "", false
}
return *q.CustomUnit, true
}
// HasCustomUnit returns a boolean if a field has been set.
func (q *QueryValueDefinition) HasCustomUnit() bool {
if q != nil && q.CustomUnit != nil {
return true
}
return false
}
// SetCustomUnit allocates a new q.CustomUnit and returns the pointer to it.
func (q *QueryValueDefinition) SetCustomUnit(v string) {
q.CustomUnit = &v
}
// GetPrecision returns the Precision field if non-nil, zero value otherwise.
func (q *QueryValueDefinition) GetPrecision() int {
if q == nil || q.Precision == nil {
return 0
}
return *q.Precision
}
// GetPrecisionOk returns a tuple with the Precision field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (q *QueryValueDefinition) GetPrecisionOk() (int, bool) {
if q == nil || q.Precision == nil {
return 0, false
}
return *q.Precision, true
}
// HasPrecision returns a boolean if a field has been set.
func (q *QueryValueDefinition) HasPrecision() bool {
if q != nil && q.Precision != nil {
return true
}
return false
}
// SetPrecision allocates a new q.Precision and returns the pointer to it.
func (q *QueryValueDefinition) SetPrecision(v int) {
q.Precision = &v
}
// GetTextAlign returns the TextAlign field if non-nil, zero value otherwise.
func (q *QueryValueDefinition) GetTextAlign() string {
if q == nil || q.TextAlign == nil {
return ""
}
return *q.TextAlign
}
// GetTextAlignOk returns a tuple with the TextAlign field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (q *QueryValueDefinition) GetTextAlignOk() (string, bool) {
if q == nil || q.TextAlign == nil {
return "", false
}
return *q.TextAlign, true
}
// HasTextAlign returns a boolean if a field has been set.
func (q *QueryValueDefinition) HasTextAlign() bool {
if q != nil && q.TextAlign != nil {
return true
}
return false
}
// SetTextAlign allocates a new q.TextAlign and returns the pointer to it.
func (q *QueryValueDefinition) SetTextAlign(v string) {
q.TextAlign = &v
}
// GetTime returns the Time field if non-nil, zero value otherwise.
func (q *QueryValueDefinition) GetTime() WidgetTime {
if q == nil || q.Time == nil {
return WidgetTime{}
}
return *q.Time
}
// GetTimeOk returns a tuple with the Time field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (q *QueryValueDefinition) GetTimeOk() (WidgetTime, bool) {
if q == nil || q.Time == nil {
return WidgetTime{}, false
}
return *q.Time, true
}
// HasTime returns a boolean if a field has been set.
func (q *QueryValueDefinition) HasTime() bool {
if q != nil && q.Time != nil {
return true
}
return false
}
// SetTime allocates a new q.Time and returns the pointer to it.
func (q *QueryValueDefinition) SetTime(v WidgetTime) {
q.Time = &v
}
// GetTitle returns the Title field if non-nil, zero value otherwise.
func (q *QueryValueDefinition) GetTitle() string {
if q == nil || q.Title == nil {
return ""
}
return *q.Title
}
// GetTitleOk returns a tuple with the Title field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (q *QueryValueDefinition) GetTitleOk() (string, bool) {
if q == nil || q.Title == nil {
return "", false
}
return *q.Title, true
}
// HasTitle returns a boolean if a field has been set.
func (q *QueryValueDefinition) HasTitle() bool {
if q != nil && q.Title != nil {
return true
}
return false
}
// SetTitle allocates a new q.Title and returns the pointer to it.
func (q *QueryValueDefinition) SetTitle(v string) {
q.Title = &v
}
// GetTitleAlign returns the TitleAlign field if non-nil, zero value otherwise.
func (q *QueryValueDefinition) GetTitleAlign() string {
if q == nil || q.TitleAlign == nil {
return ""
}
return *q.TitleAlign
}
// GetTitleAlignOk returns a tuple with the TitleAlign field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (q *QueryValueDefinition) GetTitleAlignOk() (string, bool) {
if q == nil || q.TitleAlign == nil {
return "", false
}
return *q.TitleAlign, true
}
// HasTitleAlign returns a boolean if a field has been set.
func (q *QueryValueDefinition) HasTitleAlign() bool {
if q != nil && q.TitleAlign != nil {
return true
}
return false
}
// SetTitleAlign allocates a new q.TitleAlign and returns the pointer to it.
func (q *QueryValueDefinition) SetTitleAlign(v string) {
q.TitleAlign = &v
}
// GetTitleSize returns the TitleSize field if non-nil, zero value otherwise.
func (q *QueryValueDefinition) GetTitleSize() string {
if q == nil || q.TitleSize == nil {
return ""
}
return *q.TitleSize
}
// GetTitleSizeOk returns a tuple with the TitleSize field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (q *QueryValueDefinition) GetTitleSizeOk() (string, bool) {
if q == nil || q.TitleSize == nil {
return "", false
}
return *q.TitleSize, true
}
// HasTitleSize returns a boolean if a field has been set.
func (q *QueryValueDefinition) HasTitleSize() bool {
if q != nil && q.TitleSize != nil {
return true
}
return false
}
// SetTitleSize allocates a new q.TitleSize and returns the pointer to it.
func (q *QueryValueDefinition) SetTitleSize(v string) {
q.TitleSize = &v
}
// GetType returns the Type field if non-nil, zero value otherwise.
func (q *QueryValueDefinition) GetType() string {
if q == nil || q.Type == nil {
return ""
}
return *q.Type
}
// GetTypeOk returns a tuple with the Type field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (q *QueryValueDefinition) GetTypeOk() (string, bool) {
if q == nil || q.Type == nil {
return "", false
}
return *q.Type, true
}
// HasType returns a boolean if a field has been set.
func (q *QueryValueDefinition) HasType() bool {
if q != nil && q.Type != nil {
return true
}
return false
}
// SetType allocates a new q.Type and returns the pointer to it.
func (q *QueryValueDefinition) SetType(v string) {
q.Type = &v
}
// GetAggregator returns the Aggregator field if non-nil, zero value otherwise.
func (q *QueryValueRequest) GetAggregator() string {
if q == nil || q.Aggregator == nil {
return ""
}
return *q.Aggregator
}
// GetAggregatorOk returns a tuple with the Aggregator field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (q *QueryValueRequest) GetAggregatorOk() (string, bool) {
if q == nil || q.Aggregator == nil {
return "", false
}
return *q.Aggregator, true
}
// HasAggregator returns a boolean if a field has been set.
func (q *QueryValueRequest) HasAggregator() bool {
if q != nil && q.Aggregator != nil {
return true
}
return false
}
// SetAggregator allocates a new q.Aggregator and returns the pointer to it.
func (q *QueryValueRequest) SetAggregator(v string) {
q.Aggregator = &v
}
// GetApmQuery returns the ApmQuery field if non-nil, zero value otherwise.
func (q *QueryValueRequest) GetApmQuery() WidgetApmOrLogQuery {
if q == nil || q.ApmQuery == nil {
return WidgetApmOrLogQuery{}
}
return *q.ApmQuery
}
// GetApmQueryOk returns a tuple with the ApmQuery field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (q *QueryValueRequest) GetApmQueryOk() (WidgetApmOrLogQuery, bool) {
if q == nil || q.ApmQuery == nil {
return WidgetApmOrLogQuery{}, false
}
return *q.ApmQuery, true
}
// HasApmQuery returns a boolean if a field has been set.
func (q *QueryValueRequest) HasApmQuery() bool {
if q != nil && q.ApmQuery != nil {
return true
}
return false
}
// SetApmQuery allocates a new q.ApmQuery and returns the pointer to it.
func (q *QueryValueRequest) SetApmQuery(v WidgetApmOrLogQuery) {
q.ApmQuery = &v
}
// GetLogQuery returns the LogQuery field if non-nil, zero value otherwise.
func (q *QueryValueRequest) GetLogQuery() WidgetApmOrLogQuery {
if q == nil || q.LogQuery == nil {
return WidgetApmOrLogQuery{}
}
return *q.LogQuery
}
// GetLogQueryOk returns a tuple with the LogQuery field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (q *QueryValueRequest) GetLogQueryOk() (WidgetApmOrLogQuery, bool) {
if q == nil || q.LogQuery == nil {
return WidgetApmOrLogQuery{}, false
}
return *q.LogQuery, true
}
// HasLogQuery returns a boolean if a field has been set.
func (q *QueryValueRequest) HasLogQuery() bool {
if q != nil && q.LogQuery != nil {
return true
}
return false
}
// SetLogQuery allocates a new q.LogQuery and returns the pointer to it.
func (q *QueryValueRequest) SetLogQuery(v WidgetApmOrLogQuery) {
q.LogQuery = &v
}
// GetMetricQuery returns the MetricQuery field if non-nil, zero value otherwise.
func (q *QueryValueRequest) GetMetricQuery() string {
if q == nil || q.MetricQuery == nil {
return ""
}
return *q.MetricQuery
}
// GetMetricQueryOk returns a tuple with the MetricQuery field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (q *QueryValueRequest) GetMetricQueryOk() (string, bool) {
if q == nil || q.MetricQuery == nil {
return "", false
}
return *q.MetricQuery, true
}
// HasMetricQuery returns a boolean if a field has been set.
func (q *QueryValueRequest) HasMetricQuery() bool {
if q != nil && q.MetricQuery != nil {
return true
}
return false
}
// SetMetricQuery allocates a new q.MetricQuery and returns the pointer to it.
func (q *QueryValueRequest) SetMetricQuery(v string) {
q.MetricQuery = &v
}
// GetProcessQuery returns the ProcessQuery field if non-nil, zero value otherwise.
func (q *QueryValueRequest) GetProcessQuery() WidgetProcessQuery {
if q == nil || q.ProcessQuery == nil {
return WidgetProcessQuery{}
}
return *q.ProcessQuery
}
// GetProcessQueryOk returns a tuple with the ProcessQuery field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (q *QueryValueRequest) GetProcessQueryOk() (WidgetProcessQuery, bool) {
if q == nil || q.ProcessQuery == nil {
return WidgetProcessQuery{}, false
}
return *q.ProcessQuery, true
}
// HasProcessQuery returns a boolean if a field has been set.
func (q *QueryValueRequest) HasProcessQuery() bool {
if q != nil && q.ProcessQuery != nil {
return true
}
return false
}
// SetProcessQuery allocates a new q.ProcessQuery and returns the pointer to it.
func (q *QueryValueRequest) SetProcessQuery(v WidgetProcessQuery) {
q.ProcessQuery = &v
}
// GetPeriod returns the Period field if non-nil, zero value otherwise.
func (r *Recurrence) GetPeriod() int {
if r == nil || r.Period == nil {
return 0
}
return *r.Period
}
// GetPeriodOk returns a tuple with the Period field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (r *Recurrence) GetPeriodOk() (int, bool) {
if r == nil || r.Period == nil {
return 0, false
}
return *r.Period, true
}
// HasPeriod returns a boolean if a field has been set.
func (r *Recurrence) HasPeriod() bool {
if r != nil && r.Period != nil {
return true
}
return false
}
// SetPeriod allocates a new r.Period and returns the pointer to it.
func (r *Recurrence) SetPeriod(v int) {
r.Period = &v
}
// GetType returns the Type field if non-nil, zero value otherwise.
func (r *Recurrence) GetType() string {
if r == nil || r.Type == nil {
return ""
}
return *r.Type
}
// GetTypeOk returns a tuple with the Type field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (r *Recurrence) GetTypeOk() (string, bool) {
if r == nil || r.Type == nil {
return "", false
}
return *r.Type, true
}
// HasType returns a boolean if a field has been set.
func (r *Recurrence) HasType() bool {
if r != nil && r.Type != nil {
return true
}
return false
}
// SetType allocates a new r.Type and returns the pointer to it.
func (r *Recurrence) SetType(v string) {
r.Type = &v
}
// GetUntilDate returns the UntilDate field if non-nil, zero value otherwise.
func (r *Recurrence) GetUntilDate() int {
if r == nil || r.UntilDate == nil {
return 0
}
return *r.UntilDate
}
// GetUntilDateOk returns a tuple with the UntilDate field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (r *Recurrence) GetUntilDateOk() (int, bool) {
if r == nil || r.UntilDate == nil {
return 0, false
}
return *r.UntilDate, true
}
// HasUntilDate returns a boolean if a field has been set.
func (r *Recurrence) HasUntilDate() bool {
if r != nil && r.UntilDate != nil {
return true
}
return false
}
// SetUntilDate allocates a new r.UntilDate and returns the pointer to it.
func (r *Recurrence) SetUntilDate(v int) {
r.UntilDate = &v
}
// GetUntilOccurrences returns the UntilOccurrences field if non-nil, zero value otherwise.
func (r *Recurrence) GetUntilOccurrences() int {
if r == nil || r.UntilOccurrences == nil {
return 0
}
return *r.UntilOccurrences
}
// GetUntilOccurrencesOk returns a tuple with the UntilOccurrences field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (r *Recurrence) GetUntilOccurrencesOk() (int, bool) {
if r == nil || r.UntilOccurrences == nil {
return 0, false
}
return *r.UntilOccurrences, true
}
// HasUntilOccurrences returns a boolean if a field has been set.
func (r *Recurrence) HasUntilOccurrences() bool {
if r != nil && r.UntilOccurrences != nil {
return true
}
return false
}
// SetUntilOccurrences allocates a new r.UntilOccurrences and returns the pointer to it.
func (r *Recurrence) SetUntilOccurrences(v int) {
r.UntilOccurrences = &v
}
// GetAPIKey returns the APIKey field if non-nil, zero value otherwise.
func (r *reqAPIKey) GetAPIKey() APIKey {
if r == nil || r.APIKey == nil {
return APIKey{}
}
return *r.APIKey
}
// GetAPIKeyOk returns a tuple with the APIKey field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (r *reqAPIKey) GetAPIKeyOk() (APIKey, bool) {
if r == nil || r.APIKey == nil {
return APIKey{}, false
}
return *r.APIKey, true
}
// HasAPIKey returns a boolean if a field has been set.
func (r *reqAPIKey) HasAPIKey() bool {
if r != nil && r.APIKey != nil {
return true
}
return false
}
// SetAPIKey allocates a new r.APIKey and returns the pointer to it.
func (r *reqAPIKey) SetAPIKey(v APIKey) {
r.APIKey = &v
}
// GetAPPKey returns the APPKey field if non-nil, zero value otherwise.
func (r *reqAPPKey) GetAPPKey() APPKey {
if r == nil || r.APPKey == nil {
return APPKey{}
}
return *r.APPKey
}
// GetAPPKeyOk returns a tuple with the APPKey field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (r *reqAPPKey) GetAPPKeyOk() (APPKey, bool) {
if r == nil || r.APPKey == nil {
return APPKey{}, false
}
return *r.APPKey, true
}
// HasAPPKey returns a boolean if a field has been set.
func (r *reqAPPKey) HasAPPKey() bool {
if r != nil && r.APPKey != nil {
return true
}
return false
}
// SetAPPKey allocates a new r.APPKey and returns the pointer to it.
func (r *reqAPPKey) SetAPPKey(v APPKey) {
r.APPKey = &v
}
// GetComment returns the Comment field if non-nil, zero value otherwise.
func (r *reqComment) GetComment() Comment {
if r == nil || r.Comment == nil {
return Comment{}
}
return *r.Comment
}
// GetCommentOk returns a tuple with the Comment field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (r *reqComment) GetCommentOk() (Comment, bool) {
if r == nil || r.Comment == nil {
return Comment{}, false
}
return *r.Comment, true
}
// HasComment returns a boolean if a field has been set.
func (r *reqComment) HasComment() bool {
if r != nil && r.Comment != nil {
return true
}
return false
}
// SetComment allocates a new r.Comment and returns the pointer to it.
func (r *reqComment) SetComment(v Comment) {
r.Comment = &v
}
// GetDashboard returns the Dashboard field if non-nil, zero value otherwise.
func (r *reqGetDashboard) GetDashboard() Dashboard {
if r == nil || r.Dashboard == nil {
return Dashboard{}
}
return *r.Dashboard
}
// GetDashboardOk returns a tuple with the Dashboard field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (r *reqGetDashboard) GetDashboardOk() (Dashboard, bool) {
if r == nil || r.Dashboard == nil {
return Dashboard{}, false
}
return *r.Dashboard, true
}
// HasDashboard returns a boolean if a field has been set.
func (r *reqGetDashboard) HasDashboard() bool {
if r != nil && r.Dashboard != nil {
return true
}
return false
}
// SetDashboard allocates a new r.Dashboard and returns the pointer to it.
func (r *reqGetDashboard) SetDashboard(v Dashboard) {
r.Dashboard = &v
}
// GetResource returns the Resource field if non-nil, zero value otherwise.
func (r *reqGetDashboard) GetResource() string {
if r == nil || r.Resource == nil {
return ""
}
return *r.Resource
}
// GetResourceOk returns a tuple with the Resource field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (r *reqGetDashboard) GetResourceOk() (string, bool) {
if r == nil || r.Resource == nil {
return "", false
}
return *r.Resource, true
}
// HasResource returns a boolean if a field has been set.
func (r *reqGetDashboard) HasResource() bool {
if r != nil && r.Resource != nil {
return true
}
return false
}
// SetResource allocates a new r.Resource and returns the pointer to it.
func (r *reqGetDashboard) SetResource(v string) {
r.Resource = &v
}
// GetUrl returns the Url field if non-nil, zero value otherwise.
func (r *reqGetDashboard) GetUrl() string {
if r == nil || r.Url == nil {
return ""
}
return *r.Url
}
// GetUrlOk returns a tuple with the Url field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (r *reqGetDashboard) GetUrlOk() (string, bool) {
if r == nil || r.Url == nil {
return "", false
}
return *r.Url, true
}
// HasUrl returns a boolean if a field has been set.
func (r *reqGetDashboard) HasUrl() bool {
if r != nil && r.Url != nil {
return true
}
return false
}
// SetUrl allocates a new r.Url and returns the pointer to it.
func (r *reqGetDashboard) SetUrl(v string) {
r.Url = &v
}
// GetEvent returns the Event field if non-nil, zero value otherwise.
func (r *reqGetEvent) GetEvent() Event {
if r == nil || r.Event == nil {
return Event{}
}
return *r.Event
}
// GetEventOk returns a tuple with the Event field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (r *reqGetEvent) GetEventOk() (Event, bool) {
if r == nil || r.Event == nil {
return Event{}, false
}
return *r.Event, true
}
// HasEvent returns a boolean if a field has been set.
func (r *reqGetEvent) HasEvent() bool {
if r != nil && r.Event != nil {
return true
}
return false
}
// SetEvent allocates a new r.Event and returns the pointer to it.
func (r *reqGetEvent) SetEvent(v Event) {
r.Event = &v
}
// GetTags returns the Tags field if non-nil, zero value otherwise.
func (r *reqGetTags) GetTags() TagMap {
if r == nil || r.Tags == nil {
return TagMap{}
}
return *r.Tags
}
// GetTagsOk returns a tuple with the Tags field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (r *reqGetTags) GetTagsOk() (TagMap, bool) {
if r == nil || r.Tags == nil {
return TagMap{}, false
}
return *r.Tags, true
}
// HasTags returns a boolean if a field has been set.
func (r *reqGetTags) HasTags() bool {
if r != nil && r.Tags != nil {
return true
}
return false
}
// SetTags allocates a new r.Tags and returns the pointer to it.
func (r *reqGetTags) SetTags(v TagMap) {
r.Tags = &v
}
// GetData returns the Data field if non-nil, zero value otherwise.
func (r *reqSingleServiceLevelObjective) GetData() ServiceLevelObjective {
if r == nil || r.Data == nil {
return ServiceLevelObjective{}
}
return *r.Data
}
// GetDataOk returns a tuple with the Data field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (r *reqSingleServiceLevelObjective) GetDataOk() (ServiceLevelObjective, bool) {
if r == nil || r.Data == nil {
return ServiceLevelObjective{}, false
}
return *r.Data, true
}
// HasData returns a boolean if a field has been set.
func (r *reqSingleServiceLevelObjective) HasData() bool {
if r != nil && r.Data != nil {
return true
}
return false
}
// SetData allocates a new r.Data and returns the pointer to it.
func (r *reqSingleServiceLevelObjective) SetData(v ServiceLevelObjective) {
r.Data = &v
}
// GetAccessRole returns the AccessRole field if non-nil, zero value otherwise.
func (r *reqUpdateUser) GetAccessRole() string {
if r == nil || r.AccessRole == nil {
return ""
}
return *r.AccessRole
}
// GetAccessRoleOk returns a tuple with the AccessRole field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (r *reqUpdateUser) GetAccessRoleOk() (string, bool) {
if r == nil || r.AccessRole == nil {
return "", false
}
return *r.AccessRole, true
}
// HasAccessRole returns a boolean if a field has been set.
func (r *reqUpdateUser) HasAccessRole() bool {
if r != nil && r.AccessRole != nil {
return true
}
return false
}
// SetAccessRole allocates a new r.AccessRole and returns the pointer to it.
func (r *reqUpdateUser) SetAccessRole(v string) {
r.AccessRole = &v
}
// GetDisabled returns the Disabled field if non-nil, zero value otherwise.
func (r *reqUpdateUser) GetDisabled() bool {
if r == nil || r.Disabled == nil {
return false
}
return *r.Disabled
}
// GetDisabledOk returns a tuple with the Disabled field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (r *reqUpdateUser) GetDisabledOk() (bool, bool) {
if r == nil || r.Disabled == nil {
return false, false
}
return *r.Disabled, true
}
// HasDisabled returns a boolean if a field has been set.
func (r *reqUpdateUser) HasDisabled() bool {
if r != nil && r.Disabled != nil {
return true
}
return false
}
// SetDisabled allocates a new r.Disabled and returns the pointer to it.
func (r *reqUpdateUser) SetDisabled(v bool) {
r.Disabled = &v
}
// GetEmail returns the Email field if non-nil, zero value otherwise.
func (r *reqUpdateUser) GetEmail() string {
if r == nil || r.Email == nil {
return ""
}
return *r.Email
}
// GetEmailOk returns a tuple with the Email field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (r *reqUpdateUser) GetEmailOk() (string, bool) {
if r == nil || r.Email == nil {
return "", false
}
return *r.Email, true
}
// HasEmail returns a boolean if a field has been set.
func (r *reqUpdateUser) HasEmail() bool {
if r != nil && r.Email != nil {
return true
}
return false
}
// SetEmail allocates a new r.Email and returns the pointer to it.
func (r *reqUpdateUser) SetEmail(v string) {
r.Email = &v
}
// GetIsAdmin returns the IsAdmin field if non-nil, zero value otherwise.
func (r *reqUpdateUser) GetIsAdmin() bool {
if r == nil || r.IsAdmin == nil {
return false
}
return *r.IsAdmin
}
// GetIsAdminOk returns a tuple with the IsAdmin field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (r *reqUpdateUser) GetIsAdminOk() (bool, bool) {
if r == nil || r.IsAdmin == nil {
return false, false
}
return *r.IsAdmin, true
}
// HasIsAdmin returns a boolean if a field has been set.
func (r *reqUpdateUser) HasIsAdmin() bool {
if r != nil && r.IsAdmin != nil {
return true
}
return false
}
// SetIsAdmin allocates a new r.IsAdmin and returns the pointer to it.
func (r *reqUpdateUser) SetIsAdmin(v bool) {
r.IsAdmin = &v
}
// GetName returns the Name field if non-nil, zero value otherwise.
func (r *reqUpdateUser) GetName() string {
if r == nil || r.Name == nil {
return ""
}
return *r.Name
}
// GetNameOk returns a tuple with the Name field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (r *reqUpdateUser) GetNameOk() (string, bool) {
if r == nil || r.Name == nil {
return "", false
}
return *r.Name, true
}
// HasName returns a boolean if a field has been set.
func (r *reqUpdateUser) HasName() bool {
if r != nil && r.Name != nil {
return true
}
return false
}
// SetName allocates a new r.Name and returns the pointer to it.
func (r *reqUpdateUser) SetName(v string) {
r.Name = &v
}
// GetRole returns the Role field if non-nil, zero value otherwise.
func (r *reqUpdateUser) GetRole() string {
if r == nil || r.Role == nil {
return ""
}
return *r.Role
}
// GetRoleOk returns a tuple with the Role field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (r *reqUpdateUser) GetRoleOk() (string, bool) {
if r == nil || r.Role == nil {
return "", false
}
return *r.Role, true
}
// HasRole returns a boolean if a field has been set.
func (r *reqUpdateUser) HasRole() bool {
if r != nil && r.Role != nil {
return true
}
return false
}
// SetRole allocates a new r.Role and returns the pointer to it.
func (r *reqUpdateUser) SetRole(v string) {
r.Role = &v
}
// GetVerified returns the Verified field if non-nil, zero value otherwise.
func (r *reqUpdateUser) GetVerified() bool {
if r == nil || r.Verified == nil {
return false
}
return *r.Verified
}
// GetVerifiedOk returns a tuple with the Verified field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (r *reqUpdateUser) GetVerifiedOk() (bool, bool) {
if r == nil || r.Verified == nil {
return false, false
}
return *r.Verified, true
}
// HasVerified returns a boolean if a field has been set.
func (r *reqUpdateUser) HasVerified() bool {
if r != nil && r.Verified != nil {
return true
}
return false
}
// SetVerified allocates a new r.Verified and returns the pointer to it.
func (r *reqUpdateUser) SetVerified(v bool) {
r.Verified = &v
}
// GetColor returns the Color field if non-nil, zero value otherwise.
func (r *Rule) GetColor() string {
if r == nil || r.Color == nil {
return ""
}
return *r.Color
}
// GetColorOk returns a tuple with the Color field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (r *Rule) GetColorOk() (string, bool) {
if r == nil || r.Color == nil {
return "", false
}
return *r.Color, true
}
// HasColor returns a boolean if a field has been set.
func (r *Rule) HasColor() bool {
if r != nil && r.Color != nil {
return true
}
return false
}
// SetColor allocates a new r.Color and returns the pointer to it.
func (r *Rule) SetColor(v string) {
r.Color = &v
}
// GetThreshold returns the Threshold field if non-nil, zero value otherwise.
func (r *Rule) GetThreshold() json.Number {
if r == nil || r.Threshold == nil {
return ""
}
return *r.Threshold
}
// GetThresholdOk returns a tuple with the Threshold field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (r *Rule) GetThresholdOk() (json.Number, bool) {
if r == nil || r.Threshold == nil {
return "", false
}
return *r.Threshold, true
}
// HasThreshold returns a boolean if a field has been set.
func (r *Rule) HasThreshold() bool {
if r != nil && r.Threshold != nil {
return true
}
return false
}
// SetThreshold allocates a new r.Threshold and returns the pointer to it.
func (r *Rule) SetThreshold(v json.Number) {
r.Threshold = &v
}
// GetTimeframe returns the Timeframe field if non-nil, zero value otherwise.
func (r *Rule) GetTimeframe() string {
if r == nil || r.Timeframe == nil {
return ""
}
return *r.Timeframe
}
// GetTimeframeOk returns a tuple with the Timeframe field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (r *Rule) GetTimeframeOk() (string, bool) {
if r == nil || r.Timeframe == nil {
return "", false
}
return *r.Timeframe, true
}
// HasTimeframe returns a boolean if a field has been set.
func (r *Rule) HasTimeframe() bool {
if r != nil && r.Timeframe != nil {
return true
}
return false
}
// SetTimeframe allocates a new r.Timeframe and returns the pointer to it.
func (r *Rule) SetTimeframe(v string) {
r.Timeframe = &v
}
// GetRequests returns the Requests field if non-nil, zero value otherwise.
func (s *ScatterplotDefinition) GetRequests() ScatterplotRequests {
if s == nil || s.Requests == nil {
return ScatterplotRequests{}
}
return *s.Requests
}
// GetRequestsOk returns a tuple with the Requests field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (s *ScatterplotDefinition) GetRequestsOk() (ScatterplotRequests, bool) {
if s == nil || s.Requests == nil {
return ScatterplotRequests{}, false
}
return *s.Requests, true
}
// HasRequests returns a boolean if a field has been set.
func (s *ScatterplotDefinition) HasRequests() bool {
if s != nil && s.Requests != nil {
return true
}
return false
}
// SetRequests allocates a new s.Requests and returns the pointer to it.
func (s *ScatterplotDefinition) SetRequests(v ScatterplotRequests) {
s.Requests = &v
}
// GetTime returns the Time field if non-nil, zero value otherwise.
func (s *ScatterplotDefinition) GetTime() WidgetTime {
if s == nil || s.Time == nil {
return WidgetTime{}
}
return *s.Time
}
// GetTimeOk returns a tuple with the Time field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (s *ScatterplotDefinition) GetTimeOk() (WidgetTime, bool) {
if s == nil || s.Time == nil {
return WidgetTime{}, false
}
return *s.Time, true
}
// HasTime returns a boolean if a field has been set.
func (s *ScatterplotDefinition) HasTime() bool {
if s != nil && s.Time != nil {
return true
}
return false
}
// SetTime allocates a new s.Time and returns the pointer to it.
func (s *ScatterplotDefinition) SetTime(v WidgetTime) {
s.Time = &v
}
// GetTitle returns the Title field if non-nil, zero value otherwise.
func (s *ScatterplotDefinition) GetTitle() string {
if s == nil || s.Title == nil {
return ""
}
return *s.Title
}
// GetTitleOk returns a tuple with the Title field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (s *ScatterplotDefinition) GetTitleOk() (string, bool) {
if s == nil || s.Title == nil {
return "", false
}
return *s.Title, true
}
// HasTitle returns a boolean if a field has been set.
func (s *ScatterplotDefinition) HasTitle() bool {
if s != nil && s.Title != nil {
return true
}
return false
}
// SetTitle allocates a new s.Title and returns the pointer to it.
func (s *ScatterplotDefinition) SetTitle(v string) {
s.Title = &v
}
// GetTitleAlign returns the TitleAlign field if non-nil, zero value otherwise.
func (s *ScatterplotDefinition) GetTitleAlign() string {
if s == nil || s.TitleAlign == nil {
return ""
}
return *s.TitleAlign
}
// GetTitleAlignOk returns a tuple with the TitleAlign field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (s *ScatterplotDefinition) GetTitleAlignOk() (string, bool) {
if s == nil || s.TitleAlign == nil {
return "", false
}
return *s.TitleAlign, true
}
// HasTitleAlign returns a boolean if a field has been set.
func (s *ScatterplotDefinition) HasTitleAlign() bool {
if s != nil && s.TitleAlign != nil {
return true
}
return false
}
// SetTitleAlign allocates a new s.TitleAlign and returns the pointer to it.
func (s *ScatterplotDefinition) SetTitleAlign(v string) {
s.TitleAlign = &v
}
// GetTitleSize returns the TitleSize field if non-nil, zero value otherwise.
func (s *ScatterplotDefinition) GetTitleSize() string {
if s == nil || s.TitleSize == nil {
return ""
}
return *s.TitleSize
}
// GetTitleSizeOk returns a tuple with the TitleSize field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (s *ScatterplotDefinition) GetTitleSizeOk() (string, bool) {
if s == nil || s.TitleSize == nil {
return "", false
}
return *s.TitleSize, true
}
// HasTitleSize returns a boolean if a field has been set.
func (s *ScatterplotDefinition) HasTitleSize() bool {
if s != nil && s.TitleSize != nil {
return true
}
return false
}
// SetTitleSize allocates a new s.TitleSize and returns the pointer to it.
func (s *ScatterplotDefinition) SetTitleSize(v string) {
s.TitleSize = &v
}
// GetType returns the Type field if non-nil, zero value otherwise.
func (s *ScatterplotDefinition) GetType() string {
if s == nil || s.Type == nil {
return ""
}
return *s.Type
}
// GetTypeOk returns a tuple with the Type field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (s *ScatterplotDefinition) GetTypeOk() (string, bool) {
if s == nil || s.Type == nil {
return "", false
}
return *s.Type, true
}
// HasType returns a boolean if a field has been set.
func (s *ScatterplotDefinition) HasType() bool {
if s != nil && s.Type != nil {
return true
}
return false
}
// SetType allocates a new s.Type and returns the pointer to it.
func (s *ScatterplotDefinition) SetType(v string) {
s.Type = &v
}
// GetXaxis returns the Xaxis field if non-nil, zero value otherwise.
func (s *ScatterplotDefinition) GetXaxis() WidgetAxis {
if s == nil || s.Xaxis == nil {
return WidgetAxis{}
}
return *s.Xaxis
}
// GetXaxisOk returns a tuple with the Xaxis field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (s *ScatterplotDefinition) GetXaxisOk() (WidgetAxis, bool) {
if s == nil || s.Xaxis == nil {
return WidgetAxis{}, false
}
return *s.Xaxis, true
}
// HasXaxis returns a boolean if a field has been set.
func (s *ScatterplotDefinition) HasXaxis() bool {
if s != nil && s.Xaxis != nil {
return true
}
return false
}
// SetXaxis allocates a new s.Xaxis and returns the pointer to it.
func (s *ScatterplotDefinition) SetXaxis(v WidgetAxis) {
s.Xaxis = &v
}
// GetYaxis returns the Yaxis field if non-nil, zero value otherwise.
func (s *ScatterplotDefinition) GetYaxis() WidgetAxis {
if s == nil || s.Yaxis == nil {
return WidgetAxis{}
}
return *s.Yaxis
}
// GetYaxisOk returns a tuple with the Yaxis field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (s *ScatterplotDefinition) GetYaxisOk() (WidgetAxis, bool) {
if s == nil || s.Yaxis == nil {
return WidgetAxis{}, false
}
return *s.Yaxis, true
}
// HasYaxis returns a boolean if a field has been set.
func (s *ScatterplotDefinition) HasYaxis() bool {
if s != nil && s.Yaxis != nil {
return true
}
return false
}
// SetYaxis allocates a new s.Yaxis and returns the pointer to it.
func (s *ScatterplotDefinition) SetYaxis(v WidgetAxis) {
s.Yaxis = &v
}
// GetAggregator returns the Aggregator field if non-nil, zero value otherwise.
func (s *ScatterplotRequest) GetAggregator() string {
if s == nil || s.Aggregator == nil {
return ""
}
return *s.Aggregator
}
// GetAggregatorOk returns a tuple with the Aggregator field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (s *ScatterplotRequest) GetAggregatorOk() (string, bool) {
if s == nil || s.Aggregator == nil {
return "", false
}
return *s.Aggregator, true
}
// HasAggregator returns a boolean if a field has been set.
func (s *ScatterplotRequest) HasAggregator() bool {
if s != nil && s.Aggregator != nil {
return true
}
return false
}
// SetAggregator allocates a new s.Aggregator and returns the pointer to it.
func (s *ScatterplotRequest) SetAggregator(v string) {
s.Aggregator = &v
}
// GetApmQuery returns the ApmQuery field if non-nil, zero value otherwise.
func (s *ScatterplotRequest) GetApmQuery() WidgetApmOrLogQuery {
if s == nil || s.ApmQuery == nil {
return WidgetApmOrLogQuery{}
}
return *s.ApmQuery
}
// GetApmQueryOk returns a tuple with the ApmQuery field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (s *ScatterplotRequest) GetApmQueryOk() (WidgetApmOrLogQuery, bool) {
if s == nil || s.ApmQuery == nil {
return WidgetApmOrLogQuery{}, false
}
return *s.ApmQuery, true
}
// HasApmQuery returns a boolean if a field has been set.
func (s *ScatterplotRequest) HasApmQuery() bool {
if s != nil && s.ApmQuery != nil {
return true
}
return false
}
// SetApmQuery allocates a new s.ApmQuery and returns the pointer to it.
func (s *ScatterplotRequest) SetApmQuery(v WidgetApmOrLogQuery) {
s.ApmQuery = &v
}
// GetLogQuery returns the LogQuery field if non-nil, zero value otherwise.
func (s *ScatterplotRequest) GetLogQuery() WidgetApmOrLogQuery {
if s == nil || s.LogQuery == nil {
return WidgetApmOrLogQuery{}
}
return *s.LogQuery
}
// GetLogQueryOk returns a tuple with the LogQuery field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (s *ScatterplotRequest) GetLogQueryOk() (WidgetApmOrLogQuery, bool) {
if s == nil || s.LogQuery == nil {
return WidgetApmOrLogQuery{}, false
}
return *s.LogQuery, true
}
// HasLogQuery returns a boolean if a field has been set.
func (s *ScatterplotRequest) HasLogQuery() bool {
if s != nil && s.LogQuery != nil {
return true
}
return false
}
// SetLogQuery allocates a new s.LogQuery and returns the pointer to it.
func (s *ScatterplotRequest) SetLogQuery(v WidgetApmOrLogQuery) {
s.LogQuery = &v
}
// GetMetricQuery returns the MetricQuery field if non-nil, zero value otherwise.
func (s *ScatterplotRequest) GetMetricQuery() string {
if s == nil || s.MetricQuery == nil {
return ""
}
return *s.MetricQuery
}
// GetMetricQueryOk returns a tuple with the MetricQuery field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (s *ScatterplotRequest) GetMetricQueryOk() (string, bool) {
if s == nil || s.MetricQuery == nil {
return "", false
}
return *s.MetricQuery, true
}
// HasMetricQuery returns a boolean if a field has been set.
func (s *ScatterplotRequest) HasMetricQuery() bool {
if s != nil && s.MetricQuery != nil {
return true
}
return false
}
// SetMetricQuery allocates a new s.MetricQuery and returns the pointer to it.
func (s *ScatterplotRequest) SetMetricQuery(v string) {
s.MetricQuery = &v
}
// GetProcessQuery returns the ProcessQuery field if non-nil, zero value otherwise.
func (s *ScatterplotRequest) GetProcessQuery() WidgetProcessQuery {
if s == nil || s.ProcessQuery == nil {
return WidgetProcessQuery{}
}
return *s.ProcessQuery
}
// GetProcessQueryOk returns a tuple with the ProcessQuery field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (s *ScatterplotRequest) GetProcessQueryOk() (WidgetProcessQuery, bool) {
if s == nil || s.ProcessQuery == nil {
return WidgetProcessQuery{}, false
}
return *s.ProcessQuery, true
}
// HasProcessQuery returns a boolean if a field has been set.
func (s *ScatterplotRequest) HasProcessQuery() bool {
if s != nil && s.ProcessQuery != nil {
return true
}
return false
}
// SetProcessQuery allocates a new s.ProcessQuery and returns the pointer to it.
func (s *ScatterplotRequest) SetProcessQuery(v WidgetProcessQuery) {
s.ProcessQuery = &v
}
// GetX returns the X field if non-nil, zero value otherwise.
func (s *ScatterplotRequests) GetX() ScatterplotRequest {
if s == nil || s.X == nil {
return ScatterplotRequest{}
}
return *s.X
}
// GetXOk returns a tuple with the X field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (s *ScatterplotRequests) GetXOk() (ScatterplotRequest, bool) {
if s == nil || s.X == nil {
return ScatterplotRequest{}, false
}
return *s.X, true
}
// HasX returns a boolean if a field has been set.
func (s *ScatterplotRequests) HasX() bool {
if s != nil && s.X != nil {
return true
}
return false
}
// SetX allocates a new s.X and returns the pointer to it.
func (s *ScatterplotRequests) SetX(v ScatterplotRequest) {
s.X = &v
}
// GetY returns the Y field if non-nil, zero value otherwise.
func (s *ScatterplotRequests) GetY() ScatterplotRequest {
if s == nil || s.Y == nil {
return ScatterplotRequest{}
}
return *s.Y
}
// GetYOk returns a tuple with the Y field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (s *ScatterplotRequests) GetYOk() (ScatterplotRequest, bool) {
if s == nil || s.Y == nil {
return ScatterplotRequest{}, false
}
return *s.Y, true
}
// HasY returns a boolean if a field has been set.
func (s *ScatterplotRequests) HasY() bool {
if s != nil && s.Y != nil {
return true
}
return false
}
// SetY allocates a new s.Y and returns the pointer to it.
func (s *ScatterplotRequests) SetY(v ScatterplotRequest) {
s.Y = &v
}
// GetHeight returns the Height field if non-nil, zero value otherwise.
func (s *Screenboard) GetHeight() int {
if s == nil || s.Height == nil {
return 0
}
return *s.Height
}
// GetHeightOk returns a tuple with the Height field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (s *Screenboard) GetHeightOk() (int, bool) {
if s == nil || s.Height == nil {
return 0, false
}
return *s.Height, true
}
// HasHeight returns a boolean if a field has been set.
func (s *Screenboard) HasHeight() bool {
if s != nil && s.Height != nil {
return true
}
return false
}
// SetHeight allocates a new s.Height and returns the pointer to it.
func (s *Screenboard) SetHeight(v int) {
s.Height = &v
}
// GetId returns the Id field if non-nil, zero value otherwise.
func (s *Screenboard) GetId() int {
if s == nil || s.Id == nil {
return 0
}
return *s.Id
}
// GetIdOk returns a tuple with the Id field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (s *Screenboard) GetIdOk() (int, bool) {
if s == nil || s.Id == nil {
return 0, false
}
return *s.Id, true
}
// HasId returns a boolean if a field has been set.
func (s *Screenboard) HasId() bool {
if s != nil && s.Id != nil {
return true
}
return false
}
// SetId allocates a new s.Id and returns the pointer to it.
func (s *Screenboard) SetId(v int) {
s.Id = &v
}
// GetNewId returns the NewId field if non-nil, zero value otherwise.
func (s *Screenboard) GetNewId() string {
if s == nil || s.NewId == nil {
return ""
}
return *s.NewId
}
// GetNewIdOk returns a tuple with the NewId field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (s *Screenboard) GetNewIdOk() (string, bool) {
if s == nil || s.NewId == nil {
return "", false
}
return *s.NewId, true
}
// HasNewId returns a boolean if a field has been set.
func (s *Screenboard) HasNewId() bool {
if s != nil && s.NewId != nil {
return true
}
return false
}
// SetNewId allocates a new s.NewId and returns the pointer to it.
func (s *Screenboard) SetNewId(v string) {
s.NewId = &v
}
// GetReadOnly returns the ReadOnly field if non-nil, zero value otherwise.
func (s *Screenboard) GetReadOnly() bool {
if s == nil || s.ReadOnly == nil {
return false
}
return *s.ReadOnly
}
// GetReadOnlyOk returns a tuple with the ReadOnly field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (s *Screenboard) GetReadOnlyOk() (bool, bool) {
if s == nil || s.ReadOnly == nil {
return false, false
}
return *s.ReadOnly, true
}
// HasReadOnly returns a boolean if a field has been set.
func (s *Screenboard) HasReadOnly() bool {
if s != nil && s.ReadOnly != nil {
return true
}
return false
}
// SetReadOnly allocates a new s.ReadOnly and returns the pointer to it.
func (s *Screenboard) SetReadOnly(v bool) {
s.ReadOnly = &v
}
// GetShared returns the Shared field if non-nil, zero value otherwise.
func (s *Screenboard) GetShared() bool {
if s == nil || s.Shared == nil {
return false
}
return *s.Shared
}
// GetSharedOk returns a tuple with the Shared field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (s *Screenboard) GetSharedOk() (bool, bool) {
if s == nil || s.Shared == nil {
return false, false
}
return *s.Shared, true
}
// HasShared returns a boolean if a field has been set.
func (s *Screenboard) HasShared() bool {
if s != nil && s.Shared != nil {
return true
}
return false
}
// SetShared allocates a new s.Shared and returns the pointer to it.
func (s *Screenboard) SetShared(v bool) {
s.Shared = &v
}
// GetTitle returns the Title field if non-nil, zero value otherwise.
func (s *Screenboard) GetTitle() string {
if s == nil || s.Title == nil {
return ""
}
return *s.Title
}
// GetTitleOk returns a tuple with the Title field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (s *Screenboard) GetTitleOk() (string, bool) {
if s == nil || s.Title == nil {
return "", false
}
return *s.Title, true
}
// HasTitle returns a boolean if a field has been set.
func (s *Screenboard) HasTitle() bool {
if s != nil && s.Title != nil {
return true
}
return false
}
// SetTitle allocates a new s.Title and returns the pointer to it.
func (s *Screenboard) SetTitle(v string) {
s.Title = &v
}
// GetWidth returns the Width field if non-nil, zero value otherwise.
func (s *Screenboard) GetWidth() int {
if s == nil || s.Width == nil {
return 0
}
return *s.Width
}
// GetWidthOk returns a tuple with the Width field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (s *Screenboard) GetWidthOk() (int, bool) {
if s == nil || s.Width == nil {
return 0, false
}
return *s.Width, true
}
// HasWidth returns a boolean if a field has been set.
func (s *Screenboard) HasWidth() bool {
if s != nil && s.Width != nil {
return true
}
return false
}
// SetWidth allocates a new s.Width and returns the pointer to it.
func (s *Screenboard) SetWidth(v int) {
s.Width = &v
}
// GetId returns the Id field if non-nil, zero value otherwise.
func (s *ScreenboardLite) GetId() int {
if s == nil || s.Id == nil {
return 0
}
return *s.Id
}
// GetIdOk returns a tuple with the Id field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (s *ScreenboardLite) GetIdOk() (int, bool) {
if s == nil || s.Id == nil {
return 0, false
}
return *s.Id, true
}
// HasId returns a boolean if a field has been set.
func (s *ScreenboardLite) HasId() bool {
if s != nil && s.Id != nil {
return true
}
return false
}
// SetId allocates a new s.Id and returns the pointer to it.
func (s *ScreenboardLite) SetId(v int) {
s.Id = &v
}
// GetResource returns the Resource field if non-nil, zero value otherwise.
func (s *ScreenboardLite) GetResource() string {
if s == nil || s.Resource == nil {
return ""
}
return *s.Resource
}
// GetResourceOk returns a tuple with the Resource field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (s *ScreenboardLite) GetResourceOk() (string, bool) {
if s == nil || s.Resource == nil {
return "", false
}
return *s.Resource, true
}
// HasResource returns a boolean if a field has been set.
func (s *ScreenboardLite) HasResource() bool {
if s != nil && s.Resource != nil {
return true
}
return false
}
// SetResource allocates a new s.Resource and returns the pointer to it.
func (s *ScreenboardLite) SetResource(v string) {
s.Resource = &v
}
// GetTitle returns the Title field if non-nil, zero value otherwise.
func (s *ScreenboardLite) GetTitle() string {
if s == nil || s.Title == nil {
return ""
}
return *s.Title
}
// GetTitleOk returns a tuple with the Title field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (s *ScreenboardLite) GetTitleOk() (string, bool) {
if s == nil || s.Title == nil {
return "", false
}
return *s.Title, true
}
// HasTitle returns a boolean if a field has been set.
func (s *ScreenboardLite) HasTitle() bool {
if s != nil && s.Title != nil {
return true
}
return false
}
// SetTitle allocates a new s.Title and returns the pointer to it.
func (s *ScreenboardLite) SetTitle(v string) {
s.Title = &v
}
// GetId returns the Id field if non-nil, zero value otherwise.
func (s *ScreenboardMonitor) GetId() int {
if s == nil || s.Id == nil {
return 0
}
return *s.Id
}
// GetIdOk returns a tuple with the Id field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (s *ScreenboardMonitor) GetIdOk() (int, bool) {
if s == nil || s.Id == nil {
return 0, false
}
return *s.Id, true
}
// HasId returns a boolean if a field has been set.
func (s *ScreenboardMonitor) HasId() bool {
if s != nil && s.Id != nil {
return true
}
return false
}
// SetId allocates a new s.Id and returns the pointer to it.
func (s *ScreenboardMonitor) SetId(v int) {
s.Id = &v
}
// GetAggr returns the Aggr field if non-nil, zero value otherwise.
func (s *Series) GetAggr() string {
if s == nil || s.Aggr == nil {
return ""
}
return *s.Aggr
}
// GetAggrOk returns a tuple with the Aggr field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (s *Series) GetAggrOk() (string, bool) {
if s == nil || s.Aggr == nil {
return "", false
}
return *s.Aggr, true
}
// HasAggr returns a boolean if a field has been set.
func (s *Series) HasAggr() bool {
if s != nil && s.Aggr != nil {
return true
}
return false
}
// SetAggr allocates a new s.Aggr and returns the pointer to it.
func (s *Series) SetAggr(v string) {
s.Aggr = &v
}
// GetDisplayName returns the DisplayName field if non-nil, zero value otherwise.
func (s *Series) GetDisplayName() string {
if s == nil || s.DisplayName == nil {
return ""
}
return *s.DisplayName
}
// GetDisplayNameOk returns a tuple with the DisplayName field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (s *Series) GetDisplayNameOk() (string, bool) {
if s == nil || s.DisplayName == nil {
return "", false
}
return *s.DisplayName, true
}
// HasDisplayName returns a boolean if a field has been set.
func (s *Series) HasDisplayName() bool {
if s != nil && s.DisplayName != nil {
return true
}
return false
}
// SetDisplayName allocates a new s.DisplayName and returns the pointer to it.
func (s *Series) SetDisplayName(v string) {
s.DisplayName = &v
}
// GetEnd returns the End field if non-nil, zero value otherwise.
func (s *Series) GetEnd() float64 {
if s == nil || s.End == nil {
return 0
}
return *s.End
}
// GetEndOk returns a tuple with the End field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (s *Series) GetEndOk() (float64, bool) {
if s == nil || s.End == nil {
return 0, false
}
return *s.End, true
}
// HasEnd returns a boolean if a field has been set.
func (s *Series) HasEnd() bool {
if s != nil && s.End != nil {
return true
}
return false
}
// SetEnd allocates a new s.End and returns the pointer to it.
func (s *Series) SetEnd(v float64) {
s.End = &v
}
// GetExpression returns the Expression field if non-nil, zero value otherwise.
func (s *Series) GetExpression() string {
if s == nil || s.Expression == nil {
return ""
}
return *s.Expression
}
// GetExpressionOk returns a tuple with the Expression field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (s *Series) GetExpressionOk() (string, bool) {
if s == nil || s.Expression == nil {
return "", false
}
return *s.Expression, true
}
// HasExpression returns a boolean if a field has been set.
func (s *Series) HasExpression() bool {
if s != nil && s.Expression != nil {
return true
}
return false
}
// SetExpression allocates a new s.Expression and returns the pointer to it.
func (s *Series) SetExpression(v string) {
s.Expression = &v
}
// GetInterval returns the Interval field if non-nil, zero value otherwise.
func (s *Series) GetInterval() int {
if s == nil || s.Interval == nil {
return 0
}
return *s.Interval
}
// GetIntervalOk returns a tuple with the Interval field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (s *Series) GetIntervalOk() (int, bool) {
if s == nil || s.Interval == nil {
return 0, false
}
return *s.Interval, true
}
// HasInterval returns a boolean if a field has been set.
func (s *Series) HasInterval() bool {
if s != nil && s.Interval != nil {
return true
}
return false
}
// SetInterval allocates a new s.Interval and returns the pointer to it.
func (s *Series) SetInterval(v int) {
s.Interval = &v
}
// GetLength returns the Length field if non-nil, zero value otherwise.
func (s *Series) GetLength() int {
if s == nil || s.Length == nil {
return 0
}
return *s.Length
}
// GetLengthOk returns a tuple with the Length field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (s *Series) GetLengthOk() (int, bool) {
if s == nil || s.Length == nil {
return 0, false
}
return *s.Length, true
}
// HasLength returns a boolean if a field has been set.
func (s *Series) HasLength() bool {
if s != nil && s.Length != nil {
return true
}
return false
}
// SetLength allocates a new s.Length and returns the pointer to it.
func (s *Series) SetLength(v int) {
s.Length = &v
}
// GetMetric returns the Metric field if non-nil, zero value otherwise.
func (s *Series) GetMetric() string {
if s == nil || s.Metric == nil {
return ""
}
return *s.Metric
}
// GetMetricOk returns a tuple with the Metric field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (s *Series) GetMetricOk() (string, bool) {
if s == nil || s.Metric == nil {
return "", false
}
return *s.Metric, true
}
// HasMetric returns a boolean if a field has been set.
func (s *Series) HasMetric() bool {
if s != nil && s.Metric != nil {
return true
}
return false
}
// SetMetric allocates a new s.Metric and returns the pointer to it.
func (s *Series) SetMetric(v string) {
s.Metric = &v
}
// GetScope returns the Scope field if non-nil, zero value otherwise.
func (s *Series) GetScope() string {
if s == nil || s.Scope == nil {
return ""
}
return *s.Scope
}
// GetScopeOk returns a tuple with the Scope field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (s *Series) GetScopeOk() (string, bool) {
if s == nil || s.Scope == nil {
return "", false
}
return *s.Scope, true
}
// HasScope returns a boolean if a field has been set.
func (s *Series) HasScope() bool {
if s != nil && s.Scope != nil {
return true
}
return false
}
// SetScope allocates a new s.Scope and returns the pointer to it.
func (s *Series) SetScope(v string) {
s.Scope = &v
}
// GetStart returns the Start field if non-nil, zero value otherwise.
func (s *Series) GetStart() float64 {
if s == nil || s.Start == nil {
return 0
}
return *s.Start
}
// GetStartOk returns a tuple with the Start field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (s *Series) GetStartOk() (float64, bool) {
if s == nil || s.Start == nil {
return 0, false
}
return *s.Start, true
}
// HasStart returns a boolean if a field has been set.
func (s *Series) HasStart() bool {
if s != nil && s.Start != nil {
return true
}
return false
}
// SetStart allocates a new s.Start and returns the pointer to it.
func (s *Series) SetStart(v float64) {
s.Start = &v
}
// GetUnits returns the Units field if non-nil, zero value otherwise.
func (s *Series) GetUnits() UnitPair {
if s == nil || s.Units == nil {
return UnitPair{}
}
return *s.Units
}
// GetUnitsOk returns a tuple with the Units field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (s *Series) GetUnitsOk() (UnitPair, bool) {
if s == nil || s.Units == nil {
return UnitPair{}, false
}
return *s.Units, true
}
// HasUnits returns a boolean if a field has been set.
func (s *Series) HasUnits() bool {
if s != nil && s.Units != nil {
return true
}
return false
}
// SetUnits allocates a new s.Units and returns the pointer to it.
func (s *Series) SetUnits(v UnitPair) {
s.Units = &v
}
// GetAccount returns the Account field if non-nil, zero value otherwise.
func (s *ServiceHookSlackRequest) GetAccount() string {
if s == nil || s.Account == nil {
return ""
}
return *s.Account
}
// GetAccountOk returns a tuple with the Account field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (s *ServiceHookSlackRequest) GetAccountOk() (string, bool) {
if s == nil || s.Account == nil {
return "", false
}
return *s.Account, true
}
// HasAccount returns a boolean if a field has been set.
func (s *ServiceHookSlackRequest) HasAccount() bool {
if s != nil && s.Account != nil {
return true
}
return false
}
// SetAccount allocates a new s.Account and returns the pointer to it.
func (s *ServiceHookSlackRequest) SetAccount(v string) {
s.Account = &v
}
// GetUrl returns the Url field if non-nil, zero value otherwise.
func (s *ServiceHookSlackRequest) GetUrl() string {
if s == nil || s.Url == nil {
return ""
}
return *s.Url
}
// GetUrlOk returns a tuple with the Url field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (s *ServiceHookSlackRequest) GetUrlOk() (string, bool) {
if s == nil || s.Url == nil {
return "", false
}
return *s.Url, true
}
// HasUrl returns a boolean if a field has been set.
func (s *ServiceHookSlackRequest) HasUrl() bool {
if s != nil && s.Url != nil {
return true
}
return false
}
// SetUrl allocates a new s.Url and returns the pointer to it.
func (s *ServiceHookSlackRequest) SetUrl(v string) {
s.Url = &v
}
// GetCreatedAt returns the CreatedAt field if non-nil, zero value otherwise.
func (s *ServiceLevelObjective) GetCreatedAt() int {
if s == nil || s.CreatedAt == nil {
return 0
}
return *s.CreatedAt
}
// GetCreatedAtOk returns a tuple with the CreatedAt field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (s *ServiceLevelObjective) GetCreatedAtOk() (int, bool) {
if s == nil || s.CreatedAt == nil {
return 0, false
}
return *s.CreatedAt, true
}
// HasCreatedAt returns a boolean if a field has been set.
func (s *ServiceLevelObjective) HasCreatedAt() bool {
if s != nil && s.CreatedAt != nil {
return true
}
return false
}
// SetCreatedAt allocates a new s.CreatedAt and returns the pointer to it.
func (s *ServiceLevelObjective) SetCreatedAt(v int) {
s.CreatedAt = &v
}
// GetCreator returns the Creator field if non-nil, zero value otherwise.
func (s *ServiceLevelObjective) GetCreator() Creator {
if s == nil || s.Creator == nil {
return Creator{}
}
return *s.Creator
}
// GetCreatorOk returns a tuple with the Creator field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (s *ServiceLevelObjective) GetCreatorOk() (Creator, bool) {
if s == nil || s.Creator == nil {
return Creator{}, false
}
return *s.Creator, true
}
// HasCreator returns a boolean if a field has been set.
func (s *ServiceLevelObjective) HasCreator() bool {
if s != nil && s.Creator != nil {
return true
}
return false
}
// SetCreator allocates a new s.Creator and returns the pointer to it.
func (s *ServiceLevelObjective) SetCreator(v Creator) {
s.Creator = &v
}
// GetDescription returns the Description field if non-nil, zero value otherwise.
func (s *ServiceLevelObjective) GetDescription() string {
if s == nil || s.Description == nil {
return ""
}
return *s.Description
}
// GetDescriptionOk returns a tuple with the Description field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (s *ServiceLevelObjective) GetDescriptionOk() (string, bool) {
if s == nil || s.Description == nil {
return "", false
}
return *s.Description, true
}
// HasDescription returns a boolean if a field has been set.
func (s *ServiceLevelObjective) HasDescription() bool {
if s != nil && s.Description != nil {
return true
}
return false
}
// SetDescription allocates a new s.Description and returns the pointer to it.
func (s *ServiceLevelObjective) SetDescription(v string) {
s.Description = &v
}
// GetID returns the ID field if non-nil, zero value otherwise.
func (s *ServiceLevelObjective) GetID() string {
if s == nil || s.ID == nil {
return ""
}
return *s.ID
}
// GetIDOk returns a tuple with the ID field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (s *ServiceLevelObjective) GetIDOk() (string, bool) {
if s == nil || s.ID == nil {
return "", false
}
return *s.ID, true
}
// HasID returns a boolean if a field has been set.
func (s *ServiceLevelObjective) HasID() bool {
if s != nil && s.ID != nil {
return true
}
return false
}
// SetID allocates a new s.ID and returns the pointer to it.
func (s *ServiceLevelObjective) SetID(v string) {
s.ID = &v
}
// GetModifiedAt returns the ModifiedAt field if non-nil, zero value otherwise.
func (s *ServiceLevelObjective) GetModifiedAt() int {
if s == nil || s.ModifiedAt == nil {
return 0
}
return *s.ModifiedAt
}
// GetModifiedAtOk returns a tuple with the ModifiedAt field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (s *ServiceLevelObjective) GetModifiedAtOk() (int, bool) {
if s == nil || s.ModifiedAt == nil {
return 0, false
}
return *s.ModifiedAt, true
}
// HasModifiedAt returns a boolean if a field has been set.
func (s *ServiceLevelObjective) HasModifiedAt() bool {
if s != nil && s.ModifiedAt != nil {
return true
}
return false
}
// SetModifiedAt allocates a new s.ModifiedAt and returns the pointer to it.
func (s *ServiceLevelObjective) SetModifiedAt(v int) {
s.ModifiedAt = &v
}
// GetMonitorSearch returns the MonitorSearch field if non-nil, zero value otherwise.
func (s *ServiceLevelObjective) GetMonitorSearch() string {
if s == nil || s.MonitorSearch == nil {
return ""
}
return *s.MonitorSearch
}
// GetMonitorSearchOk returns a tuple with the MonitorSearch field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (s *ServiceLevelObjective) GetMonitorSearchOk() (string, bool) {
if s == nil || s.MonitorSearch == nil {
return "", false
}
return *s.MonitorSearch, true
}
// HasMonitorSearch returns a boolean if a field has been set.
func (s *ServiceLevelObjective) HasMonitorSearch() bool {
if s != nil && s.MonitorSearch != nil {
return true
}
return false
}
// SetMonitorSearch allocates a new s.MonitorSearch and returns the pointer to it.
func (s *ServiceLevelObjective) SetMonitorSearch(v string) {
s.MonitorSearch = &v
}
// GetName returns the Name field if non-nil, zero value otherwise.
func (s *ServiceLevelObjective) GetName() string {
if s == nil || s.Name == nil {
return ""
}
return *s.Name
}
// GetNameOk returns a tuple with the Name field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (s *ServiceLevelObjective) GetNameOk() (string, bool) {
if s == nil || s.Name == nil {
return "", false
}
return *s.Name, true
}
// HasName returns a boolean if a field has been set.
func (s *ServiceLevelObjective) HasName() bool {
if s != nil && s.Name != nil {
return true
}
return false
}
// SetName allocates a new s.Name and returns the pointer to it.
func (s *ServiceLevelObjective) SetName(v string) {
s.Name = &v
}
// GetQuery returns the Query field if non-nil, zero value otherwise.
func (s *ServiceLevelObjective) GetQuery() ServiceLevelObjectiveMetricQuery {
if s == nil || s.Query == nil {
return ServiceLevelObjectiveMetricQuery{}
}
return *s.Query
}
// GetQueryOk returns a tuple with the Query field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (s *ServiceLevelObjective) GetQueryOk() (ServiceLevelObjectiveMetricQuery, bool) {
if s == nil || s.Query == nil {
return ServiceLevelObjectiveMetricQuery{}, false
}
return *s.Query, true
}
// HasQuery returns a boolean if a field has been set.
func (s *ServiceLevelObjective) HasQuery() bool {
if s != nil && s.Query != nil {
return true
}
return false
}
// SetQuery allocates a new s.Query and returns the pointer to it.
func (s *ServiceLevelObjective) SetQuery(v ServiceLevelObjectiveMetricQuery) {
s.Query = &v
}
// GetType returns the Type field if non-nil, zero value otherwise.
func (s *ServiceLevelObjective) GetType() string {
if s == nil || s.Type == nil {
return ""
}
return *s.Type
}
// GetTypeOk returns a tuple with the Type field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (s *ServiceLevelObjective) GetTypeOk() (string, bool) {
if s == nil || s.Type == nil {
return "", false
}
return *s.Type, true
}
// HasType returns a boolean if a field has been set.
func (s *ServiceLevelObjective) HasType() bool {
if s != nil && s.Type != nil {
return true
}
return false
}
// SetType allocates a new s.Type and returns the pointer to it.
func (s *ServiceLevelObjective) SetType(v string) {
s.Type = &v
}
// GetTypeID returns the TypeID field if non-nil, zero value otherwise.
func (s *ServiceLevelObjective) GetTypeID() int {
if s == nil || s.TypeID == nil {
return 0
}
return *s.TypeID
}
// GetTypeIDOk returns a tuple with the TypeID field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (s *ServiceLevelObjective) GetTypeIDOk() (int, bool) {
if s == nil || s.TypeID == nil {
return 0, false
}
return *s.TypeID, true
}
// HasTypeID returns a boolean if a field has been set.
func (s *ServiceLevelObjective) HasTypeID() bool {
if s != nil && s.TypeID != nil {
return true
}
return false
}
// SetTypeID allocates a new s.TypeID and returns the pointer to it.
func (s *ServiceLevelObjective) SetTypeID(v int) {
s.TypeID = &v
}
// GetID returns the ID field if non-nil, zero value otherwise.
func (s *ServiceLevelObjectiveDeleteTimeFramesError) GetID() string {
if s == nil || s.ID == nil {
return ""
}
return *s.ID
}
// GetIDOk returns a tuple with the ID field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (s *ServiceLevelObjectiveDeleteTimeFramesError) GetIDOk() (string, bool) {
if s == nil || s.ID == nil {
return "", false
}
return *s.ID, true
}
// HasID returns a boolean if a field has been set.
func (s *ServiceLevelObjectiveDeleteTimeFramesError) HasID() bool {
if s != nil && s.ID != nil {
return true
}
return false
}
// SetID allocates a new s.ID and returns the pointer to it.
func (s *ServiceLevelObjectiveDeleteTimeFramesError) SetID(v string) {
s.ID = &v
}
// GetMessage returns the Message field if non-nil, zero value otherwise.
func (s *ServiceLevelObjectiveDeleteTimeFramesError) GetMessage() string {
if s == nil || s.Message == nil {
return ""
}
return *s.Message
}
// GetMessageOk returns a tuple with the Message field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (s *ServiceLevelObjectiveDeleteTimeFramesError) GetMessageOk() (string, bool) {
if s == nil || s.Message == nil {
return "", false
}
return *s.Message, true
}
// HasMessage returns a boolean if a field has been set.
func (s *ServiceLevelObjectiveDeleteTimeFramesError) HasMessage() bool {
if s != nil && s.Message != nil {
return true
}
return false
}
// SetMessage allocates a new s.Message and returns the pointer to it.
func (s *ServiceLevelObjectiveDeleteTimeFramesError) SetMessage(v string) {
s.Message = &v
}
// GetTimeFrame returns the TimeFrame field if non-nil, zero value otherwise.
func (s *ServiceLevelObjectiveDeleteTimeFramesError) GetTimeFrame() string {
if s == nil || s.TimeFrame == nil {
return ""
}
return *s.TimeFrame
}
// GetTimeFrameOk returns a tuple with the TimeFrame field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (s *ServiceLevelObjectiveDeleteTimeFramesError) GetTimeFrameOk() (string, bool) {
if s == nil || s.TimeFrame == nil {
return "", false
}
return *s.TimeFrame, true
}
// HasTimeFrame returns a boolean if a field has been set.
func (s *ServiceLevelObjectiveDeleteTimeFramesError) HasTimeFrame() bool {
if s != nil && s.TimeFrame != nil {
return true
}
return false
}
// SetTimeFrame allocates a new s.TimeFrame and returns the pointer to it.
func (s *ServiceLevelObjectiveDeleteTimeFramesError) SetTimeFrame(v string) {
s.TimeFrame = &v
}
// GetDenominator returns the Denominator field if non-nil, zero value otherwise.
func (s *ServiceLevelObjectiveMetricQuery) GetDenominator() string {
if s == nil || s.Denominator == nil {
return ""
}
return *s.Denominator
}
// GetDenominatorOk returns a tuple with the Denominator field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (s *ServiceLevelObjectiveMetricQuery) GetDenominatorOk() (string, bool) {
if s == nil || s.Denominator == nil {
return "", false
}
return *s.Denominator, true
}
// HasDenominator returns a boolean if a field has been set.
func (s *ServiceLevelObjectiveMetricQuery) HasDenominator() bool {
if s != nil && s.Denominator != nil {
return true
}
return false
}
// SetDenominator allocates a new s.Denominator and returns the pointer to it.
func (s *ServiceLevelObjectiveMetricQuery) SetDenominator(v string) {
s.Denominator = &v
}
// GetNumerator returns the Numerator field if non-nil, zero value otherwise.
func (s *ServiceLevelObjectiveMetricQuery) GetNumerator() string {
if s == nil || s.Numerator == nil {
return ""
}
return *s.Numerator
}
// GetNumeratorOk returns a tuple with the Numerator field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (s *ServiceLevelObjectiveMetricQuery) GetNumeratorOk() (string, bool) {
if s == nil || s.Numerator == nil {
return "", false
}
return *s.Numerator, true
}
// HasNumerator returns a boolean if a field has been set.
func (s *ServiceLevelObjectiveMetricQuery) HasNumerator() bool {
if s != nil && s.Numerator != nil {
return true
}
return false
}
// SetNumerator allocates a new s.Numerator and returns the pointer to it.
func (s *ServiceLevelObjectiveMetricQuery) SetNumerator(v string) {
s.Numerator = &v
}
// GetTarget returns the Target field if non-nil, zero value otherwise.
func (s *ServiceLevelObjectiveThreshold) GetTarget() float64 {
if s == nil || s.Target == nil {
return 0
}
return *s.Target
}
// GetTargetOk returns a tuple with the Target field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (s *ServiceLevelObjectiveThreshold) GetTargetOk() (float64, bool) {
if s == nil || s.Target == nil {
return 0, false
}
return *s.Target, true
}
// HasTarget returns a boolean if a field has been set.
func (s *ServiceLevelObjectiveThreshold) HasTarget() bool {
if s != nil && s.Target != nil {
return true
}
return false
}
// SetTarget allocates a new s.Target and returns the pointer to it.
func (s *ServiceLevelObjectiveThreshold) SetTarget(v float64) {
s.Target = &v
}
// GetTargetDisplay returns the TargetDisplay field if non-nil, zero value otherwise.
func (s *ServiceLevelObjectiveThreshold) GetTargetDisplay() string {
if s == nil || s.TargetDisplay == nil {
return ""
}
return *s.TargetDisplay
}
// GetTargetDisplayOk returns a tuple with the TargetDisplay field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (s *ServiceLevelObjectiveThreshold) GetTargetDisplayOk() (string, bool) {
if s == nil || s.TargetDisplay == nil {
return "", false
}
return *s.TargetDisplay, true
}
// HasTargetDisplay returns a boolean if a field has been set.
func (s *ServiceLevelObjectiveThreshold) HasTargetDisplay() bool {
if s != nil && s.TargetDisplay != nil {
return true
}
return false
}
// SetTargetDisplay allocates a new s.TargetDisplay and returns the pointer to it.
func (s *ServiceLevelObjectiveThreshold) SetTargetDisplay(v string) {
s.TargetDisplay = &v
}
// GetTimeFrame returns the TimeFrame field if non-nil, zero value otherwise.
func (s *ServiceLevelObjectiveThreshold) GetTimeFrame() string {
if s == nil || s.TimeFrame == nil {
return ""
}
return *s.TimeFrame
}
// GetTimeFrameOk returns a tuple with the TimeFrame field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (s *ServiceLevelObjectiveThreshold) GetTimeFrameOk() (string, bool) {
if s == nil || s.TimeFrame == nil {
return "", false
}
return *s.TimeFrame, true
}
// HasTimeFrame returns a boolean if a field has been set.
func (s *ServiceLevelObjectiveThreshold) HasTimeFrame() bool {
if s != nil && s.TimeFrame != nil {
return true
}
return false
}
// SetTimeFrame allocates a new s.TimeFrame and returns the pointer to it.
func (s *ServiceLevelObjectiveThreshold) SetTimeFrame(v string) {
s.TimeFrame = &v
}
// GetWarning returns the Warning field if non-nil, zero value otherwise.
func (s *ServiceLevelObjectiveThreshold) GetWarning() float64 {
if s == nil || s.Warning == nil {
return 0
}
return *s.Warning
}
// GetWarningOk returns a tuple with the Warning field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (s *ServiceLevelObjectiveThreshold) GetWarningOk() (float64, bool) {
if s == nil || s.Warning == nil {
return 0, false
}
return *s.Warning, true
}
// HasWarning returns a boolean if a field has been set.
func (s *ServiceLevelObjectiveThreshold) HasWarning() bool {
if s != nil && s.Warning != nil {
return true
}
return false
}
// SetWarning allocates a new s.Warning and returns the pointer to it.
func (s *ServiceLevelObjectiveThreshold) SetWarning(v float64) {
s.Warning = &v
}
// GetWarningDisplay returns the WarningDisplay field if non-nil, zero value otherwise.
func (s *ServiceLevelObjectiveThreshold) GetWarningDisplay() string {
if s == nil || s.WarningDisplay == nil {
return ""
}
return *s.WarningDisplay
}
// GetWarningDisplayOk returns a tuple with the WarningDisplay field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (s *ServiceLevelObjectiveThreshold) GetWarningDisplayOk() (string, bool) {
if s == nil || s.WarningDisplay == nil {
return "", false
}
return *s.WarningDisplay, true
}
// HasWarningDisplay returns a boolean if a field has been set.
func (s *ServiceLevelObjectiveThreshold) HasWarningDisplay() bool {
if s != nil && s.WarningDisplay != nil {
return true
}
return false
}
// SetWarningDisplay allocates a new s.WarningDisplay and returns the pointer to it.
func (s *ServiceLevelObjectiveThreshold) SetWarningDisplay(v string) {
s.WarningDisplay = &v
}
// GetServiceKey returns the ServiceKey field if non-nil, zero value otherwise.
func (s *servicePD) GetServiceKey() string {
if s == nil || s.ServiceKey == nil {
return ""
}
return *s.ServiceKey
}
// GetServiceKeyOk returns a tuple with the ServiceKey field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (s *servicePD) GetServiceKeyOk() (string, bool) {
if s == nil || s.ServiceKey == nil {
return "", false
}
return *s.ServiceKey, true
}
// HasServiceKey returns a boolean if a field has been set.
func (s *servicePD) HasServiceKey() bool {
if s != nil && s.ServiceKey != nil {
return true
}
return false
}
// SetServiceKey allocates a new s.ServiceKey and returns the pointer to it.
func (s *servicePD) SetServiceKey(v string) {
s.ServiceKey = &v
}
// GetServiceName returns the ServiceName field if non-nil, zero value otherwise.
func (s *servicePD) GetServiceName() string {
if s == nil || s.ServiceName == nil {
return ""
}
return *s.ServiceName
}
// GetServiceNameOk returns a tuple with the ServiceName field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (s *servicePD) GetServiceNameOk() (string, bool) {
if s == nil || s.ServiceName == nil {
return "", false
}
return *s.ServiceName, true
}
// HasServiceName returns a boolean if a field has been set.
func (s *servicePD) HasServiceName() bool {
if s != nil && s.ServiceName != nil {
return true
}
return false
}
// SetServiceName allocates a new s.ServiceName and returns the pointer to it.
func (s *servicePD) SetServiceName(v string) {
s.ServiceName = &v
}
// GetServiceKey returns the ServiceKey field if non-nil, zero value otherwise.
func (s *ServicePDRequest) GetServiceKey() string {
if s == nil || s.ServiceKey == nil {
return ""
}
return *s.ServiceKey
}
// GetServiceKeyOk returns a tuple with the ServiceKey field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (s *ServicePDRequest) GetServiceKeyOk() (string, bool) {
if s == nil || s.ServiceKey == nil {
return "", false
}
return *s.ServiceKey, true
}
// HasServiceKey returns a boolean if a field has been set.
func (s *ServicePDRequest) HasServiceKey() bool {
if s != nil && s.ServiceKey != nil {
return true
}
return false
}
// SetServiceKey allocates a new s.ServiceKey and returns the pointer to it.
func (s *ServicePDRequest) SetServiceKey(v string) {
s.ServiceKey = &v
}
// GetServiceName returns the ServiceName field if non-nil, zero value otherwise.
func (s *ServicePDRequest) GetServiceName() string {
if s == nil || s.ServiceName == nil {
return ""
}
return *s.ServiceName
}
// GetServiceNameOk returns a tuple with the ServiceName field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (s *ServicePDRequest) GetServiceNameOk() (string, bool) {
if s == nil || s.ServiceName == nil {
return "", false
}
return *s.ServiceName, true
}
// HasServiceName returns a boolean if a field has been set.
func (s *ServicePDRequest) HasServiceName() bool {
if s != nil && s.ServiceName != nil {
return true
}
return false
}
// SetServiceName allocates a new s.ServiceName and returns the pointer to it.
func (s *ServicePDRequest) SetServiceName(v string) {
s.ServiceName = &v
}
// GetFillMax returns the FillMax field if non-nil, zero value otherwise.
func (s *Style) GetFillMax() json.Number {
if s == nil || s.FillMax == nil {
return ""
}
return *s.FillMax
}
// GetFillMaxOk returns a tuple with the FillMax field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (s *Style) GetFillMaxOk() (json.Number, bool) {
if s == nil || s.FillMax == nil {
return "", false
}
return *s.FillMax, true
}
// HasFillMax returns a boolean if a field has been set.
func (s *Style) HasFillMax() bool {
if s != nil && s.FillMax != nil {
return true
}
return false
}
// SetFillMax allocates a new s.FillMax and returns the pointer to it.
func (s *Style) SetFillMax(v json.Number) {
s.FillMax = &v
}
// GetFillMin returns the FillMin field if non-nil, zero value otherwise.
func (s *Style) GetFillMin() json.Number {
if s == nil || s.FillMin == nil {
return ""
}
return *s.FillMin
}
// GetFillMinOk returns a tuple with the FillMin field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (s *Style) GetFillMinOk() (json.Number, bool) {
if s == nil || s.FillMin == nil {
return "", false
}
return *s.FillMin, true
}
// HasFillMin returns a boolean if a field has been set.
func (s *Style) HasFillMin() bool {
if s != nil && s.FillMin != nil {
return true
}
return false
}
// SetFillMin allocates a new s.FillMin and returns the pointer to it.
func (s *Style) SetFillMin(v json.Number) {
s.FillMin = &v
}
// GetPalette returns the Palette field if non-nil, zero value otherwise.
func (s *Style) GetPalette() string {
if s == nil || s.Palette == nil {
return ""
}
return *s.Palette
}
// GetPaletteOk returns a tuple with the Palette field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (s *Style) GetPaletteOk() (string, bool) {
if s == nil || s.Palette == nil {
return "", false
}
return *s.Palette, true
}
// HasPalette returns a boolean if a field has been set.
func (s *Style) HasPalette() bool {
if s != nil && s.Palette != nil {
return true
}
return false
}
// SetPalette allocates a new s.Palette and returns the pointer to it.
func (s *Style) SetPalette(v string) {
s.Palette = &v
}
// GetPaletteFlip returns the PaletteFlip field if non-nil, zero value otherwise.
func (s *Style) GetPaletteFlip() bool {
if s == nil || s.PaletteFlip == nil {
return false
}
return *s.PaletteFlip
}
// GetPaletteFlipOk returns a tuple with the PaletteFlip field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (s *Style) GetPaletteFlipOk() (bool, bool) {
if s == nil || s.PaletteFlip == nil {
return false, false
}
return *s.PaletteFlip, true
}
// HasPaletteFlip returns a boolean if a field has been set.
func (s *Style) HasPaletteFlip() bool {
if s != nil && s.PaletteFlip != nil {
return true
}
return false
}
// SetPaletteFlip allocates a new s.PaletteFlip and returns the pointer to it.
func (s *Style) SetPaletteFlip(v bool) {
s.PaletteFlip = &v
}
// GetOperator returns the Operator field if non-nil, zero value otherwise.
func (s *SyntheticsAssertion) GetOperator() string {
if s == nil || s.Operator == nil {
return ""
}
return *s.Operator
}
// GetOperatorOk returns a tuple with the Operator field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (s *SyntheticsAssertion) GetOperatorOk() (string, bool) {
if s == nil || s.Operator == nil {
return "", false
}
return *s.Operator, true
}
// HasOperator returns a boolean if a field has been set.
func (s *SyntheticsAssertion) HasOperator() bool {
if s != nil && s.Operator != nil {
return true
}
return false
}
// SetOperator allocates a new s.Operator and returns the pointer to it.
func (s *SyntheticsAssertion) SetOperator(v string) {
s.Operator = &v
}
// GetProperty returns the Property field if non-nil, zero value otherwise.
func (s *SyntheticsAssertion) GetProperty() string {
if s == nil || s.Property == nil {
return ""
}
return *s.Property
}
// GetPropertyOk returns a tuple with the Property field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (s *SyntheticsAssertion) GetPropertyOk() (string, bool) {
if s == nil || s.Property == nil {
return "", false
}
return *s.Property, true
}
// HasProperty returns a boolean if a field has been set.
func (s *SyntheticsAssertion) HasProperty() bool {
if s != nil && s.Property != nil {
return true
}
return false
}
// SetProperty allocates a new s.Property and returns the pointer to it.
func (s *SyntheticsAssertion) SetProperty(v string) {
s.Property = &v
}
// GetType returns the Type field if non-nil, zero value otherwise.
func (s *SyntheticsAssertion) GetType() string {
if s == nil || s.Type == nil {
return ""
}
return *s.Type
}
// GetTypeOk returns a tuple with the Type field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (s *SyntheticsAssertion) GetTypeOk() (string, bool) {
if s == nil || s.Type == nil {
return "", false
}
return *s.Type, true
}
// HasType returns a boolean if a field has been set.
func (s *SyntheticsAssertion) HasType() bool {
if s != nil && s.Type != nil {
return true
}
return false
}
// SetType allocates a new s.Type and returns the pointer to it.
func (s *SyntheticsAssertion) SetType(v string) {
s.Type = &v
}
// GetRequest returns the Request field if non-nil, zero value otherwise.
func (s *SyntheticsConfig) GetRequest() SyntheticsRequest {
if s == nil || s.Request == nil {
return SyntheticsRequest{}
}
return *s.Request
}
// GetRequestOk returns a tuple with the Request field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (s *SyntheticsConfig) GetRequestOk() (SyntheticsRequest, bool) {
if s == nil || s.Request == nil {
return SyntheticsRequest{}, false
}
return *s.Request, true
}
// HasRequest returns a boolean if a field has been set.
func (s *SyntheticsConfig) HasRequest() bool {
if s != nil && s.Request != nil {
return true
}
return false
}
// SetRequest allocates a new s.Request and returns the pointer to it.
func (s *SyntheticsConfig) SetRequest(v SyntheticsRequest) {
s.Request = &v
}
// GetHeight returns the Height field if non-nil, zero value otherwise.
func (s *SyntheticsDevice) GetHeight() int {
if s == nil || s.Height == nil {
return 0
}
return *s.Height
}
// GetHeightOk returns a tuple with the Height field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (s *SyntheticsDevice) GetHeightOk() (int, bool) {
if s == nil || s.Height == nil {
return 0, false
}
return *s.Height, true
}
// HasHeight returns a boolean if a field has been set.
func (s *SyntheticsDevice) HasHeight() bool {
if s != nil && s.Height != nil {
return true
}
return false
}
// SetHeight allocates a new s.Height and returns the pointer to it.
func (s *SyntheticsDevice) SetHeight(v int) {
s.Height = &v
}
// GetId returns the Id field if non-nil, zero value otherwise.
func (s *SyntheticsDevice) GetId() string {
if s == nil || s.Id == nil {
return ""
}
return *s.Id
}
// GetIdOk returns a tuple with the Id field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (s *SyntheticsDevice) GetIdOk() (string, bool) {
if s == nil || s.Id == nil {
return "", false
}
return *s.Id, true
}
// HasId returns a boolean if a field has been set.
func (s *SyntheticsDevice) HasId() bool {
if s != nil && s.Id != nil {
return true
}
return false
}
// SetId allocates a new s.Id and returns the pointer to it.
func (s *SyntheticsDevice) SetId(v string) {
s.Id = &v
}
// GetIsLandscape returns the IsLandscape field if non-nil, zero value otherwise.
func (s *SyntheticsDevice) GetIsLandscape() bool {
if s == nil || s.IsLandscape == nil {
return false
}
return *s.IsLandscape
}
// GetIsLandscapeOk returns a tuple with the IsLandscape field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (s *SyntheticsDevice) GetIsLandscapeOk() (bool, bool) {
if s == nil || s.IsLandscape == nil {
return false, false
}
return *s.IsLandscape, true
}
// HasIsLandscape returns a boolean if a field has been set.
func (s *SyntheticsDevice) HasIsLandscape() bool {
if s != nil && s.IsLandscape != nil {
return true
}
return false
}
// SetIsLandscape allocates a new s.IsLandscape and returns the pointer to it.
func (s *SyntheticsDevice) SetIsLandscape(v bool) {
s.IsLandscape = &v
}
// GetIsMobile returns the IsMobile field if non-nil, zero value otherwise.
func (s *SyntheticsDevice) GetIsMobile() bool {
if s == nil || s.IsMobile == nil {
return false
}
return *s.IsMobile
}
// GetIsMobileOk returns a tuple with the IsMobile field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (s *SyntheticsDevice) GetIsMobileOk() (bool, bool) {
if s == nil || s.IsMobile == nil {
return false, false
}
return *s.IsMobile, true
}
// HasIsMobile returns a boolean if a field has been set.
func (s *SyntheticsDevice) HasIsMobile() bool {
if s != nil && s.IsMobile != nil {
return true
}
return false
}
// SetIsMobile allocates a new s.IsMobile and returns the pointer to it.
func (s *SyntheticsDevice) SetIsMobile(v bool) {
s.IsMobile = &v
}
// GetName returns the Name field if non-nil, zero value otherwise.
func (s *SyntheticsDevice) GetName() string {
if s == nil || s.Name == nil {
return ""
}
return *s.Name
}
// GetNameOk returns a tuple with the Name field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (s *SyntheticsDevice) GetNameOk() (string, bool) {
if s == nil || s.Name == nil {
return "", false
}
return *s.Name, true
}
// HasName returns a boolean if a field has been set.
func (s *SyntheticsDevice) HasName() bool {
if s != nil && s.Name != nil {
return true
}
return false
}
// SetName allocates a new s.Name and returns the pointer to it.
func (s *SyntheticsDevice) SetName(v string) {
s.Name = &v
}
// GetUserAgent returns the UserAgent field if non-nil, zero value otherwise.
func (s *SyntheticsDevice) GetUserAgent() string {
if s == nil || s.UserAgent == nil {
return ""
}
return *s.UserAgent
}
// GetUserAgentOk returns a tuple with the UserAgent field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (s *SyntheticsDevice) GetUserAgentOk() (string, bool) {
if s == nil || s.UserAgent == nil {
return "", false
}
return *s.UserAgent, true
}
// HasUserAgent returns a boolean if a field has been set.
func (s *SyntheticsDevice) HasUserAgent() bool {
if s != nil && s.UserAgent != nil {
return true
}
return false
}
// SetUserAgent allocates a new s.UserAgent and returns the pointer to it.
func (s *SyntheticsDevice) SetUserAgent(v string) {
s.UserAgent = &v
}
// GetWidth returns the Width field if non-nil, zero value otherwise.
func (s *SyntheticsDevice) GetWidth() int {
if s == nil || s.Width == nil {
return 0
}
return *s.Width
}
// GetWidthOk returns a tuple with the Width field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (s *SyntheticsDevice) GetWidthOk() (int, bool) {
if s == nil || s.Width == nil {
return 0, false
}
return *s.Width, true
}
// HasWidth returns a boolean if a field has been set.
func (s *SyntheticsDevice) HasWidth() bool {
if s != nil && s.Width != nil {
return true
}
return false
}
// SetWidth allocates a new s.Width and returns the pointer to it.
func (s *SyntheticsDevice) SetWidth(v int) {
s.Width = &v
}
// GetDisplayName returns the DisplayName field if non-nil, zero value otherwise.
func (s *SyntheticsLocation) GetDisplayName() string {
if s == nil || s.DisplayName == nil {
return ""
}
return *s.DisplayName
}
// GetDisplayNameOk returns a tuple with the DisplayName field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (s *SyntheticsLocation) GetDisplayNameOk() (string, bool) {
if s == nil || s.DisplayName == nil {
return "", false
}
return *s.DisplayName, true
}
// HasDisplayName returns a boolean if a field has been set.
func (s *SyntheticsLocation) HasDisplayName() bool {
if s != nil && s.DisplayName != nil {
return true
}
return false
}
// SetDisplayName allocates a new s.DisplayName and returns the pointer to it.
func (s *SyntheticsLocation) SetDisplayName(v string) {
s.DisplayName = &v
}
// GetId returns the Id field if non-nil, zero value otherwise.
func (s *SyntheticsLocation) GetId() int {
if s == nil || s.Id == nil {
return 0
}
return *s.Id
}
// GetIdOk returns a tuple with the Id field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (s *SyntheticsLocation) GetIdOk() (int, bool) {
if s == nil || s.Id == nil {
return 0, false
}
return *s.Id, true
}
// HasId returns a boolean if a field has been set.
func (s *SyntheticsLocation) HasId() bool {
if s != nil && s.Id != nil {
return true
}
return false
}
// SetId allocates a new s.Id and returns the pointer to it.
func (s *SyntheticsLocation) SetId(v int) {
s.Id = &v
}
// GetIsLandscape returns the IsLandscape field if non-nil, zero value otherwise.
func (s *SyntheticsLocation) GetIsLandscape() bool {
if s == nil || s.IsLandscape == nil {
return false
}
return *s.IsLandscape
}
// GetIsLandscapeOk returns a tuple with the IsLandscape field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (s *SyntheticsLocation) GetIsLandscapeOk() (bool, bool) {
if s == nil || s.IsLandscape == nil {
return false, false
}
return *s.IsLandscape, true
}
// HasIsLandscape returns a boolean if a field has been set.
func (s *SyntheticsLocation) HasIsLandscape() bool {
if s != nil && s.IsLandscape != nil {
return true
}
return false
}
// SetIsLandscape allocates a new s.IsLandscape and returns the pointer to it.
func (s *SyntheticsLocation) SetIsLandscape(v bool) {
s.IsLandscape = &v
}
// GetName returns the Name field if non-nil, zero value otherwise.
func (s *SyntheticsLocation) GetName() string {
if s == nil || s.Name == nil {
return ""
}
return *s.Name
}
// GetNameOk returns a tuple with the Name field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (s *SyntheticsLocation) GetNameOk() (string, bool) {
if s == nil || s.Name == nil {
return "", false
}
return *s.Name, true
}
// HasName returns a boolean if a field has been set.
func (s *SyntheticsLocation) HasName() bool {
if s != nil && s.Name != nil {
return true
}
return false
}
// SetName allocates a new s.Name and returns the pointer to it.
func (s *SyntheticsLocation) SetName(v string) {
s.Name = &v
}
// GetRegion returns the Region field if non-nil, zero value otherwise.
func (s *SyntheticsLocation) GetRegion() string {
if s == nil || s.Region == nil {
return ""
}
return *s.Region
}
// GetRegionOk returns a tuple with the Region field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (s *SyntheticsLocation) GetRegionOk() (string, bool) {
if s == nil || s.Region == nil {
return "", false
}
return *s.Region, true
}
// HasRegion returns a boolean if a field has been set.
func (s *SyntheticsLocation) HasRegion() bool {
if s != nil && s.Region != nil {
return true
}
return false
}
// SetRegion allocates a new s.Region and returns the pointer to it.
func (s *SyntheticsLocation) SetRegion(v string) {
s.Region = &v
}
// GetAcceptSelfSigned returns the AcceptSelfSigned field if non-nil, zero value otherwise.
func (s *SyntheticsOptions) GetAcceptSelfSigned() bool {
if s == nil || s.AcceptSelfSigned == nil {
return false
}
return *s.AcceptSelfSigned
}
// GetAcceptSelfSignedOk returns a tuple with the AcceptSelfSigned field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (s *SyntheticsOptions) GetAcceptSelfSignedOk() (bool, bool) {
if s == nil || s.AcceptSelfSigned == nil {
return false, false
}
return *s.AcceptSelfSigned, true
}
// HasAcceptSelfSigned returns a boolean if a field has been set.
func (s *SyntheticsOptions) HasAcceptSelfSigned() bool {
if s != nil && s.AcceptSelfSigned != nil {
return true
}
return false
}
// SetAcceptSelfSigned allocates a new s.AcceptSelfSigned and returns the pointer to it.
func (s *SyntheticsOptions) SetAcceptSelfSigned(v bool) {
s.AcceptSelfSigned = &v
}
// GetFollowRedirects returns the FollowRedirects field if non-nil, zero value otherwise.
func (s *SyntheticsOptions) GetFollowRedirects() bool {
if s == nil || s.FollowRedirects == nil {
return false
}
return *s.FollowRedirects
}
// GetFollowRedirectsOk returns a tuple with the FollowRedirects field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (s *SyntheticsOptions) GetFollowRedirectsOk() (bool, bool) {
if s == nil || s.FollowRedirects == nil {
return false, false
}
return *s.FollowRedirects, true
}
// HasFollowRedirects returns a boolean if a field has been set.
func (s *SyntheticsOptions) HasFollowRedirects() bool {
if s != nil && s.FollowRedirects != nil {
return true
}
return false
}
// SetFollowRedirects allocates a new s.FollowRedirects and returns the pointer to it.
func (s *SyntheticsOptions) SetFollowRedirects(v bool) {
s.FollowRedirects = &v
}
// GetMinFailureDuration returns the MinFailureDuration field if non-nil, zero value otherwise.
func (s *SyntheticsOptions) GetMinFailureDuration() int {
if s == nil || s.MinFailureDuration == nil {
return 0
}
return *s.MinFailureDuration
}
// GetMinFailureDurationOk returns a tuple with the MinFailureDuration field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (s *SyntheticsOptions) GetMinFailureDurationOk() (int, bool) {
if s == nil || s.MinFailureDuration == nil {
return 0, false
}
return *s.MinFailureDuration, true
}
// HasMinFailureDuration returns a boolean if a field has been set.
func (s *SyntheticsOptions) HasMinFailureDuration() bool {
if s != nil && s.MinFailureDuration != nil {
return true
}
return false
}
// SetMinFailureDuration allocates a new s.MinFailureDuration and returns the pointer to it.
func (s *SyntheticsOptions) SetMinFailureDuration(v int) {
s.MinFailureDuration = &v
}
// GetMinLocationFailed returns the MinLocationFailed field if non-nil, zero value otherwise.
func (s *SyntheticsOptions) GetMinLocationFailed() int {
if s == nil || s.MinLocationFailed == nil {
return 0
}
return *s.MinLocationFailed
}
// GetMinLocationFailedOk returns a tuple with the MinLocationFailed field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (s *SyntheticsOptions) GetMinLocationFailedOk() (int, bool) {
if s == nil || s.MinLocationFailed == nil {
return 0, false
}
return *s.MinLocationFailed, true
}
// HasMinLocationFailed returns a boolean if a field has been set.
func (s *SyntheticsOptions) HasMinLocationFailed() bool {
if s != nil && s.MinLocationFailed != nil {
return true
}
return false
}
// SetMinLocationFailed allocates a new s.MinLocationFailed and returns the pointer to it.
func (s *SyntheticsOptions) SetMinLocationFailed(v int) {
s.MinLocationFailed = &v
}
// GetTickEvery returns the TickEvery field if non-nil, zero value otherwise.
func (s *SyntheticsOptions) GetTickEvery() int {
if s == nil || s.TickEvery == nil {
return 0
}
return *s.TickEvery
}
// GetTickEveryOk returns a tuple with the TickEvery field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (s *SyntheticsOptions) GetTickEveryOk() (int, bool) {
if s == nil || s.TickEvery == nil {
return 0, false
}
return *s.TickEvery, true
}
// HasTickEvery returns a boolean if a field has been set.
func (s *SyntheticsOptions) HasTickEvery() bool {
if s != nil && s.TickEvery != nil {
return true
}
return false
}
// SetTickEvery allocates a new s.TickEvery and returns the pointer to it.
func (s *SyntheticsOptions) SetTickEvery(v int) {
s.TickEvery = &v
}
// GetBody returns the Body field if non-nil, zero value otherwise.
func (s *SyntheticsRequest) GetBody() string {
if s == nil || s.Body == nil {
return ""
}
return *s.Body
}
// GetBodyOk returns a tuple with the Body field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (s *SyntheticsRequest) GetBodyOk() (string, bool) {
if s == nil || s.Body == nil {
return "", false
}
return *s.Body, true
}
// HasBody returns a boolean if a field has been set.
func (s *SyntheticsRequest) HasBody() bool {
if s != nil && s.Body != nil {
return true
}
return false
}
// SetBody allocates a new s.Body and returns the pointer to it.
func (s *SyntheticsRequest) SetBody(v string) {
s.Body = &v
}
// GetHost returns the Host field if non-nil, zero value otherwise.
func (s *SyntheticsRequest) GetHost() string {
if s == nil || s.Host == nil {
return ""
}
return *s.Host
}
// GetHostOk returns a tuple with the Host field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (s *SyntheticsRequest) GetHostOk() (string, bool) {
if s == nil || s.Host == nil {
return "", false
}
return *s.Host, true
}
// HasHost returns a boolean if a field has been set.
func (s *SyntheticsRequest) HasHost() bool {
if s != nil && s.Host != nil {
return true
}
return false
}
// SetHost allocates a new s.Host and returns the pointer to it.
func (s *SyntheticsRequest) SetHost(v string) {
s.Host = &v
}
// GetMethod returns the Method field if non-nil, zero value otherwise.
func (s *SyntheticsRequest) GetMethod() string {
if s == nil || s.Method == nil {
return ""
}
return *s.Method
}
// GetMethodOk returns a tuple with the Method field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (s *SyntheticsRequest) GetMethodOk() (string, bool) {
if s == nil || s.Method == nil {
return "", false
}
return *s.Method, true
}
// HasMethod returns a boolean if a field has been set.
func (s *SyntheticsRequest) HasMethod() bool {
if s != nil && s.Method != nil {
return true
}
return false
}
// SetMethod allocates a new s.Method and returns the pointer to it.
func (s *SyntheticsRequest) SetMethod(v string) {
s.Method = &v
}
// GetPort returns the Port field if non-nil, zero value otherwise.
func (s *SyntheticsRequest) GetPort() int {
if s == nil || s.Port == nil {
return 0
}
return *s.Port
}
// GetPortOk returns a tuple with the Port field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (s *SyntheticsRequest) GetPortOk() (int, bool) {
if s == nil || s.Port == nil {
return 0, false
}
return *s.Port, true
}
// HasPort returns a boolean if a field has been set.
func (s *SyntheticsRequest) HasPort() bool {
if s != nil && s.Port != nil {
return true
}
return false
}
// SetPort allocates a new s.Port and returns the pointer to it.
func (s *SyntheticsRequest) SetPort(v int) {
s.Port = &v
}
// GetTimeout returns the Timeout field if non-nil, zero value otherwise.
func (s *SyntheticsRequest) GetTimeout() int {
if s == nil || s.Timeout == nil {
return 0
}
return *s.Timeout
}
// GetTimeoutOk returns a tuple with the Timeout field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (s *SyntheticsRequest) GetTimeoutOk() (int, bool) {
if s == nil || s.Timeout == nil {
return 0, false
}
return *s.Timeout, true
}
// HasTimeout returns a boolean if a field has been set.
func (s *SyntheticsRequest) HasTimeout() bool {
if s != nil && s.Timeout != nil {
return true
}
return false
}
// SetTimeout allocates a new s.Timeout and returns the pointer to it.
func (s *SyntheticsRequest) SetTimeout(v int) {
s.Timeout = &v
}
// GetUrl returns the Url field if non-nil, zero value otherwise.
func (s *SyntheticsRequest) GetUrl() string {
if s == nil || s.Url == nil {
return ""
}
return *s.Url
}
// GetUrlOk returns a tuple with the Url field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (s *SyntheticsRequest) GetUrlOk() (string, bool) {
if s == nil || s.Url == nil {
return "", false
}
return *s.Url, true
}
// HasUrl returns a boolean if a field has been set.
func (s *SyntheticsRequest) HasUrl() bool {
if s != nil && s.Url != nil {
return true
}
return false
}
// SetUrl allocates a new s.Url and returns the pointer to it.
func (s *SyntheticsRequest) SetUrl(v string) {
s.Url = &v
}
// GetConfig returns the Config field if non-nil, zero value otherwise.
func (s *SyntheticsTest) GetConfig() SyntheticsConfig {
if s == nil || s.Config == nil {
return SyntheticsConfig{}
}
return *s.Config
}
// GetConfigOk returns a tuple with the Config field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (s *SyntheticsTest) GetConfigOk() (SyntheticsConfig, bool) {
if s == nil || s.Config == nil {
return SyntheticsConfig{}, false
}
return *s.Config, true
}
// HasConfig returns a boolean if a field has been set.
func (s *SyntheticsTest) HasConfig() bool {
if s != nil && s.Config != nil {
return true
}
return false
}
// SetConfig allocates a new s.Config and returns the pointer to it.
func (s *SyntheticsTest) SetConfig(v SyntheticsConfig) {
s.Config = &v
}
// GetCreatedAt returns the CreatedAt field if non-nil, zero value otherwise.
func (s *SyntheticsTest) GetCreatedAt() string {
if s == nil || s.CreatedAt == nil {
return ""
}
return *s.CreatedAt
}
// GetCreatedAtOk returns a tuple with the CreatedAt field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (s *SyntheticsTest) GetCreatedAtOk() (string, bool) {
if s == nil || s.CreatedAt == nil {
return "", false
}
return *s.CreatedAt, true
}
// HasCreatedAt returns a boolean if a field has been set.
func (s *SyntheticsTest) HasCreatedAt() bool {
if s != nil && s.CreatedAt != nil {
return true
}
return false
}
// SetCreatedAt allocates a new s.CreatedAt and returns the pointer to it.
func (s *SyntheticsTest) SetCreatedAt(v string) {
s.CreatedAt = &v
}
// GetCreatedBy returns the CreatedBy field if non-nil, zero value otherwise.
func (s *SyntheticsTest) GetCreatedBy() SyntheticsUser {
if s == nil || s.CreatedBy == nil {
return SyntheticsUser{}
}
return *s.CreatedBy
}
// GetCreatedByOk returns a tuple with the CreatedBy field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (s *SyntheticsTest) GetCreatedByOk() (SyntheticsUser, bool) {
if s == nil || s.CreatedBy == nil {
return SyntheticsUser{}, false
}
return *s.CreatedBy, true
}
// HasCreatedBy returns a boolean if a field has been set.
func (s *SyntheticsTest) HasCreatedBy() bool {
if s != nil && s.CreatedBy != nil {
return true
}
return false
}
// SetCreatedBy allocates a new s.CreatedBy and returns the pointer to it.
func (s *SyntheticsTest) SetCreatedBy(v SyntheticsUser) {
s.CreatedBy = &v
}
// GetDeletedAt returns the DeletedAt field if non-nil, zero value otherwise.
func (s *SyntheticsTest) GetDeletedAt() string {
if s == nil || s.DeletedAt == nil {
return ""
}
return *s.DeletedAt
}
// GetDeletedAtOk returns a tuple with the DeletedAt field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (s *SyntheticsTest) GetDeletedAtOk() (string, bool) {
if s == nil || s.DeletedAt == nil {
return "", false
}
return *s.DeletedAt, true
}
// HasDeletedAt returns a boolean if a field has been set.
func (s *SyntheticsTest) HasDeletedAt() bool {
if s != nil && s.DeletedAt != nil {
return true
}
return false
}
// SetDeletedAt allocates a new s.DeletedAt and returns the pointer to it.
func (s *SyntheticsTest) SetDeletedAt(v string) {
s.DeletedAt = &v
}
// GetMessage returns the Message field if non-nil, zero value otherwise.
func (s *SyntheticsTest) GetMessage() string {
if s == nil || s.Message == nil {
return ""
}
return *s.Message
}
// GetMessageOk returns a tuple with the Message field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (s *SyntheticsTest) GetMessageOk() (string, bool) {
if s == nil || s.Message == nil {
return "", false
}
return *s.Message, true
}
// HasMessage returns a boolean if a field has been set.
func (s *SyntheticsTest) HasMessage() bool {
if s != nil && s.Message != nil {
return true
}
return false
}
// SetMessage allocates a new s.Message and returns the pointer to it.
func (s *SyntheticsTest) SetMessage(v string) {
s.Message = &v
}
// GetModifiedAt returns the ModifiedAt field if non-nil, zero value otherwise.
func (s *SyntheticsTest) GetModifiedAt() string {
if s == nil || s.ModifiedAt == nil {
return ""
}
return *s.ModifiedAt
}
// GetModifiedAtOk returns a tuple with the ModifiedAt field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (s *SyntheticsTest) GetModifiedAtOk() (string, bool) {
if s == nil || s.ModifiedAt == nil {
return "", false
}
return *s.ModifiedAt, true
}
// HasModifiedAt returns a boolean if a field has been set.
func (s *SyntheticsTest) HasModifiedAt() bool {
if s != nil && s.ModifiedAt != nil {
return true
}
return false
}
// SetModifiedAt allocates a new s.ModifiedAt and returns the pointer to it.
func (s *SyntheticsTest) SetModifiedAt(v string) {
s.ModifiedAt = &v
}
// GetModifiedBy returns the ModifiedBy field if non-nil, zero value otherwise.
func (s *SyntheticsTest) GetModifiedBy() SyntheticsUser {
if s == nil || s.ModifiedBy == nil {
return SyntheticsUser{}
}
return *s.ModifiedBy
}
// GetModifiedByOk returns a tuple with the ModifiedBy field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (s *SyntheticsTest) GetModifiedByOk() (SyntheticsUser, bool) {
if s == nil || s.ModifiedBy == nil {
return SyntheticsUser{}, false
}
return *s.ModifiedBy, true
}
// HasModifiedBy returns a boolean if a field has been set.
func (s *SyntheticsTest) HasModifiedBy() bool {
if s != nil && s.ModifiedBy != nil {
return true
}
return false
}
// SetModifiedBy allocates a new s.ModifiedBy and returns the pointer to it.
func (s *SyntheticsTest) SetModifiedBy(v SyntheticsUser) {
s.ModifiedBy = &v
}
// GetMonitorId returns the MonitorId field if non-nil, zero value otherwise.
func (s *SyntheticsTest) GetMonitorId() int {
if s == nil || s.MonitorId == nil {
return 0
}
return *s.MonitorId
}
// GetMonitorIdOk returns a tuple with the MonitorId field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (s *SyntheticsTest) GetMonitorIdOk() (int, bool) {
if s == nil || s.MonitorId == nil {
return 0, false
}
return *s.MonitorId, true
}
// HasMonitorId returns a boolean if a field has been set.
func (s *SyntheticsTest) HasMonitorId() bool {
if s != nil && s.MonitorId != nil {
return true
}
return false
}
// SetMonitorId allocates a new s.MonitorId and returns the pointer to it.
func (s *SyntheticsTest) SetMonitorId(v int) {
s.MonitorId = &v
}
// GetMonitorStatus returns the MonitorStatus field if non-nil, zero value otherwise.
func (s *SyntheticsTest) GetMonitorStatus() string {
if s == nil || s.MonitorStatus == nil {
return ""
}
return *s.MonitorStatus
}
// GetMonitorStatusOk returns a tuple with the MonitorStatus field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (s *SyntheticsTest) GetMonitorStatusOk() (string, bool) {
if s == nil || s.MonitorStatus == nil {
return "", false
}
return *s.MonitorStatus, true
}
// HasMonitorStatus returns a boolean if a field has been set.
func (s *SyntheticsTest) HasMonitorStatus() bool {
if s != nil && s.MonitorStatus != nil {
return true
}
return false
}
// SetMonitorStatus allocates a new s.MonitorStatus and returns the pointer to it.
func (s *SyntheticsTest) SetMonitorStatus(v string) {
s.MonitorStatus = &v
}
// GetName returns the Name field if non-nil, zero value otherwise.
func (s *SyntheticsTest) GetName() string {
if s == nil || s.Name == nil {
return ""
}
return *s.Name
}
// GetNameOk returns a tuple with the Name field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (s *SyntheticsTest) GetNameOk() (string, bool) {
if s == nil || s.Name == nil {
return "", false
}
return *s.Name, true
}
// HasName returns a boolean if a field has been set.
func (s *SyntheticsTest) HasName() bool {
if s != nil && s.Name != nil {
return true
}
return false
}
// SetName allocates a new s.Name and returns the pointer to it.
func (s *SyntheticsTest) SetName(v string) {
s.Name = &v
}
// GetOptions returns the Options field if non-nil, zero value otherwise.
func (s *SyntheticsTest) GetOptions() SyntheticsOptions {
if s == nil || s.Options == nil {
return SyntheticsOptions{}
}
return *s.Options
}
// GetOptionsOk returns a tuple with the Options field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (s *SyntheticsTest) GetOptionsOk() (SyntheticsOptions, bool) {
if s == nil || s.Options == nil {
return SyntheticsOptions{}, false
}
return *s.Options, true
}
// HasOptions returns a boolean if a field has been set.
func (s *SyntheticsTest) HasOptions() bool {
if s != nil && s.Options != nil {
return true
}
return false
}
// SetOptions allocates a new s.Options and returns the pointer to it.
func (s *SyntheticsTest) SetOptions(v SyntheticsOptions) {
s.Options = &v
}
// GetPublicId returns the PublicId field if non-nil, zero value otherwise.
func (s *SyntheticsTest) GetPublicId() string {
if s == nil || s.PublicId == nil {
return ""
}
return *s.PublicId
}
// GetPublicIdOk returns a tuple with the PublicId field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (s *SyntheticsTest) GetPublicIdOk() (string, bool) {
if s == nil || s.PublicId == nil {
return "", false
}
return *s.PublicId, true
}
// HasPublicId returns a boolean if a field has been set.
func (s *SyntheticsTest) HasPublicId() bool {
if s != nil && s.PublicId != nil {
return true
}
return false
}
// SetPublicId allocates a new s.PublicId and returns the pointer to it.
func (s *SyntheticsTest) SetPublicId(v string) {
s.PublicId = &v
}
// GetStatus returns the Status field if non-nil, zero value otherwise.
func (s *SyntheticsTest) GetStatus() string {
if s == nil || s.Status == nil {
return ""
}
return *s.Status
}
// GetStatusOk returns a tuple with the Status field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (s *SyntheticsTest) GetStatusOk() (string, bool) {
if s == nil || s.Status == nil {
return "", false
}
return *s.Status, true
}
// HasStatus returns a boolean if a field has been set.
func (s *SyntheticsTest) HasStatus() bool {
if s != nil && s.Status != nil {
return true
}
return false
}
// SetStatus allocates a new s.Status and returns the pointer to it.
func (s *SyntheticsTest) SetStatus(v string) {
s.Status = &v
}
// GetSubtype returns the Subtype field if non-nil, zero value otherwise.
func (s *SyntheticsTest) GetSubtype() string {
if s == nil || s.Subtype == nil {
return ""
}
return *s.Subtype
}
// GetSubtypeOk returns a tuple with the Subtype field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (s *SyntheticsTest) GetSubtypeOk() (string, bool) {
if s == nil || s.Subtype == nil {
return "", false
}
return *s.Subtype, true
}
// HasSubtype returns a boolean if a field has been set.
func (s *SyntheticsTest) HasSubtype() bool {
if s != nil && s.Subtype != nil {
return true
}
return false
}
// SetSubtype allocates a new s.Subtype and returns the pointer to it.
func (s *SyntheticsTest) SetSubtype(v string) {
s.Subtype = &v
}
// GetType returns the Type field if non-nil, zero value otherwise.
func (s *SyntheticsTest) GetType() string {
if s == nil || s.Type == nil {
return ""
}
return *s.Type
}
// GetTypeOk returns a tuple with the Type field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (s *SyntheticsTest) GetTypeOk() (string, bool) {
if s == nil || s.Type == nil {
return "", false
}
return *s.Type, true
}
// HasType returns a boolean if a field has been set.
func (s *SyntheticsTest) HasType() bool {
if s != nil && s.Type != nil {
return true
}
return false
}
// SetType allocates a new s.Type and returns the pointer to it.
func (s *SyntheticsTest) SetType(v string) {
s.Type = &v
}
// GetEmail returns the Email field if non-nil, zero value otherwise.
func (s *SyntheticsUser) GetEmail() string {
if s == nil || s.Email == nil {
return ""
}
return *s.Email
}
// GetEmailOk returns a tuple with the Email field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (s *SyntheticsUser) GetEmailOk() (string, bool) {
if s == nil || s.Email == nil {
return "", false
}
return *s.Email, true
}
// HasEmail returns a boolean if a field has been set.
func (s *SyntheticsUser) HasEmail() bool {
if s != nil && s.Email != nil {
return true
}
return false
}
// SetEmail allocates a new s.Email and returns the pointer to it.
func (s *SyntheticsUser) SetEmail(v string) {
s.Email = &v
}
// GetHandle returns the Handle field if non-nil, zero value otherwise.
func (s *SyntheticsUser) GetHandle() string {
if s == nil || s.Handle == nil {
return ""
}
return *s.Handle
}
// GetHandleOk returns a tuple with the Handle field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (s *SyntheticsUser) GetHandleOk() (string, bool) {
if s == nil || s.Handle == nil {
return "", false
}
return *s.Handle, true
}
// HasHandle returns a boolean if a field has been set.
func (s *SyntheticsUser) HasHandle() bool {
if s != nil && s.Handle != nil {
return true
}
return false
}
// SetHandle allocates a new s.Handle and returns the pointer to it.
func (s *SyntheticsUser) SetHandle(v string) {
s.Handle = &v
}
// GetId returns the Id field if non-nil, zero value otherwise.
func (s *SyntheticsUser) GetId() int {
if s == nil || s.Id == nil {
return 0
}
return *s.Id
}
// GetIdOk returns a tuple with the Id field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (s *SyntheticsUser) GetIdOk() (int, bool) {
if s == nil || s.Id == nil {
return 0, false
}
return *s.Id, true
}
// HasId returns a boolean if a field has been set.
func (s *SyntheticsUser) HasId() bool {
if s != nil && s.Id != nil {
return true
}
return false
}
// SetId allocates a new s.Id and returns the pointer to it.
func (s *SyntheticsUser) SetId(v int) {
s.Id = &v
}
// GetName returns the Name field if non-nil, zero value otherwise.
func (s *SyntheticsUser) GetName() string {
if s == nil || s.Name == nil {
return ""
}
return *s.Name
}
// GetNameOk returns a tuple with the Name field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (s *SyntheticsUser) GetNameOk() (string, bool) {
if s == nil || s.Name == nil {
return "", false
}
return *s.Name, true
}
// HasName returns a boolean if a field has been set.
func (s *SyntheticsUser) HasName() bool {
if s != nil && s.Name != nil {
return true
}
return false
}
// SetName allocates a new s.Name and returns the pointer to it.
func (s *SyntheticsUser) SetName(v string) {
s.Name = &v
}
// GetDefault returns the Default field if non-nil, zero value otherwise.
func (t *TemplateVariable) GetDefault() string {
if t == nil || t.Default == nil {
return ""
}
return *t.Default
}
// GetDefaultOk returns a tuple with the Default field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (t *TemplateVariable) GetDefaultOk() (string, bool) {
if t == nil || t.Default == nil {
return "", false
}
return *t.Default, true
}
// HasDefault returns a boolean if a field has been set.
func (t *TemplateVariable) HasDefault() bool {
if t != nil && t.Default != nil {
return true
}
return false
}
// SetDefault allocates a new t.Default and returns the pointer to it.
func (t *TemplateVariable) SetDefault(v string) {
t.Default = &v
}
// GetName returns the Name field if non-nil, zero value otherwise.
func (t *TemplateVariable) GetName() string {
if t == nil || t.Name == nil {
return ""
}
return *t.Name
}
// GetNameOk returns a tuple with the Name field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (t *TemplateVariable) GetNameOk() (string, bool) {
if t == nil || t.Name == nil {
return "", false
}
return *t.Name, true
}
// HasName returns a boolean if a field has been set.
func (t *TemplateVariable) HasName() bool {
if t != nil && t.Name != nil {
return true
}
return false
}
// SetName allocates a new t.Name and returns the pointer to it.
func (t *TemplateVariable) SetName(v string) {
t.Name = &v
}
// GetPrefix returns the Prefix field if non-nil, zero value otherwise.
func (t *TemplateVariable) GetPrefix() string {
if t == nil || t.Prefix == nil {
return ""
}
return *t.Prefix
}
// GetPrefixOk returns a tuple with the Prefix field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (t *TemplateVariable) GetPrefixOk() (string, bool) {
if t == nil || t.Prefix == nil {
return "", false
}
return *t.Prefix, true
}
// HasPrefix returns a boolean if a field has been set.
func (t *TemplateVariable) HasPrefix() bool {
if t != nil && t.Prefix != nil {
return true
}
return false
}
// SetPrefix allocates a new t.Prefix and returns the pointer to it.
func (t *TemplateVariable) SetPrefix(v string) {
t.Prefix = &v
}
// GetCritical returns the Critical field if non-nil, zero value otherwise.
func (t *ThresholdCount) GetCritical() json.Number {
if t == nil || t.Critical == nil {
return ""
}
return *t.Critical
}
// GetCriticalOk returns a tuple with the Critical field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (t *ThresholdCount) GetCriticalOk() (json.Number, bool) {
if t == nil || t.Critical == nil {
return "", false
}
return *t.Critical, true
}
// HasCritical returns a boolean if a field has been set.
func (t *ThresholdCount) HasCritical() bool {
if t != nil && t.Critical != nil {
return true
}
return false
}
// SetCritical allocates a new t.Critical and returns the pointer to it.
func (t *ThresholdCount) SetCritical(v json.Number) {
t.Critical = &v
}
// GetCriticalRecovery returns the CriticalRecovery field if non-nil, zero value otherwise.
func (t *ThresholdCount) GetCriticalRecovery() json.Number {
if t == nil || t.CriticalRecovery == nil {
return ""
}
return *t.CriticalRecovery
}
// GetCriticalRecoveryOk returns a tuple with the CriticalRecovery field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (t *ThresholdCount) GetCriticalRecoveryOk() (json.Number, bool) {
if t == nil || t.CriticalRecovery == nil {
return "", false
}
return *t.CriticalRecovery, true
}
// HasCriticalRecovery returns a boolean if a field has been set.
func (t *ThresholdCount) HasCriticalRecovery() bool {
if t != nil && t.CriticalRecovery != nil {
return true
}
return false
}
// SetCriticalRecovery allocates a new t.CriticalRecovery and returns the pointer to it.
func (t *ThresholdCount) SetCriticalRecovery(v json.Number) {
t.CriticalRecovery = &v
}
// GetOk returns the Ok field if non-nil, zero value otherwise.
func (t *ThresholdCount) GetOk() json.Number {
if t == nil || t.Ok == nil {
return ""
}
return *t.Ok
}
// GetOkOk returns a tuple with the Ok field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (t *ThresholdCount) GetOkOk() (json.Number, bool) {
if t == nil || t.Ok == nil {
return "", false
}
return *t.Ok, true
}
// HasOk returns a boolean if a field has been set.
func (t *ThresholdCount) HasOk() bool {
if t != nil && t.Ok != nil {
return true
}
return false
}
// SetOk allocates a new t.Ok and returns the pointer to it.
func (t *ThresholdCount) SetOk(v json.Number) {
t.Ok = &v
}
// GetPeriod returns the Period field if non-nil, zero value otherwise.
func (t *ThresholdCount) GetPeriod() Period {
if t == nil || t.Period == nil {
return Period{}
}
return *t.Period
}
// GetPeriodOk returns a tuple with the Period field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (t *ThresholdCount) GetPeriodOk() (Period, bool) {
if t == nil || t.Period == nil {
return Period{}, false
}
return *t.Period, true
}
// HasPeriod returns a boolean if a field has been set.
func (t *ThresholdCount) HasPeriod() bool {
if t != nil && t.Period != nil {
return true
}
return false
}
// SetPeriod allocates a new t.Period and returns the pointer to it.
func (t *ThresholdCount) SetPeriod(v Period) {
t.Period = &v
}
// GetTimeAggregator returns the TimeAggregator field if non-nil, zero value otherwise.
func (t *ThresholdCount) GetTimeAggregator() string {
if t == nil || t.TimeAggregator == nil {
return ""
}
return *t.TimeAggregator
}
// GetTimeAggregatorOk returns a tuple with the TimeAggregator field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (t *ThresholdCount) GetTimeAggregatorOk() (string, bool) {
if t == nil || t.TimeAggregator == nil {
return "", false
}
return *t.TimeAggregator, true
}
// HasTimeAggregator returns a boolean if a field has been set.
func (t *ThresholdCount) HasTimeAggregator() bool {
if t != nil && t.TimeAggregator != nil {
return true
}
return false
}
// SetTimeAggregator allocates a new t.TimeAggregator and returns the pointer to it.
func (t *ThresholdCount) SetTimeAggregator(v string) {
t.TimeAggregator = &v
}
// GetUnknown returns the Unknown field if non-nil, zero value otherwise.
func (t *ThresholdCount) GetUnknown() json.Number {
if t == nil || t.Unknown == nil {
return ""
}
return *t.Unknown
}
// GetUnknownOk returns a tuple with the Unknown field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (t *ThresholdCount) GetUnknownOk() (json.Number, bool) {
if t == nil || t.Unknown == nil {
return "", false
}
return *t.Unknown, true
}
// HasUnknown returns a boolean if a field has been set.
func (t *ThresholdCount) HasUnknown() bool {
if t != nil && t.Unknown != nil {
return true
}
return false
}
// SetUnknown allocates a new t.Unknown and returns the pointer to it.
func (t *ThresholdCount) SetUnknown(v json.Number) {
t.Unknown = &v
}
// GetWarning returns the Warning field if non-nil, zero value otherwise.
func (t *ThresholdCount) GetWarning() json.Number {
if t == nil || t.Warning == nil {
return ""
}
return *t.Warning
}
// GetWarningOk returns a tuple with the Warning field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (t *ThresholdCount) GetWarningOk() (json.Number, bool) {
if t == nil || t.Warning == nil {
return "", false
}
return *t.Warning, true
}
// HasWarning returns a boolean if a field has been set.
func (t *ThresholdCount) HasWarning() bool {
if t != nil && t.Warning != nil {
return true
}
return false
}
// SetWarning allocates a new t.Warning and returns the pointer to it.
func (t *ThresholdCount) SetWarning(v json.Number) {
t.Warning = &v
}
// GetWarningRecovery returns the WarningRecovery field if non-nil, zero value otherwise.
func (t *ThresholdCount) GetWarningRecovery() json.Number {
if t == nil || t.WarningRecovery == nil {
return ""
}
return *t.WarningRecovery
}
// GetWarningRecoveryOk returns a tuple with the WarningRecovery field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (t *ThresholdCount) GetWarningRecoveryOk() (json.Number, bool) {
if t == nil || t.WarningRecovery == nil {
return "", false
}
return *t.WarningRecovery, true
}
// HasWarningRecovery returns a boolean if a field has been set.
func (t *ThresholdCount) HasWarningRecovery() bool {
if t != nil && t.WarningRecovery != nil {
return true
}
return false
}
// SetWarningRecovery allocates a new t.WarningRecovery and returns the pointer to it.
func (t *ThresholdCount) SetWarningRecovery(v json.Number) {
t.WarningRecovery = &v
}
// GetRecoveryWindow returns the RecoveryWindow field if non-nil, zero value otherwise.
func (t *ThresholdWindows) GetRecoveryWindow() string {
if t == nil || t.RecoveryWindow == nil {
return ""
}
return *t.RecoveryWindow
}
// GetRecoveryWindowOk returns a tuple with the RecoveryWindow field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (t *ThresholdWindows) GetRecoveryWindowOk() (string, bool) {
if t == nil || t.RecoveryWindow == nil {
return "", false
}
return *t.RecoveryWindow, true
}
// HasRecoveryWindow returns a boolean if a field has been set.
func (t *ThresholdWindows) HasRecoveryWindow() bool {
if t != nil && t.RecoveryWindow != nil {
return true
}
return false
}
// SetRecoveryWindow allocates a new t.RecoveryWindow and returns the pointer to it.
func (t *ThresholdWindows) SetRecoveryWindow(v string) {
t.RecoveryWindow = &v
}
// GetTriggerWindow returns the TriggerWindow field if non-nil, zero value otherwise.
func (t *ThresholdWindows) GetTriggerWindow() string {
if t == nil || t.TriggerWindow == nil {
return ""
}
return *t.TriggerWindow
}
// GetTriggerWindowOk returns a tuple with the TriggerWindow field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (t *ThresholdWindows) GetTriggerWindowOk() (string, bool) {
if t == nil || t.TriggerWindow == nil {
return "", false
}
return *t.TriggerWindow, true
}
// HasTriggerWindow returns a boolean if a field has been set.
func (t *ThresholdWindows) HasTriggerWindow() bool {
if t != nil && t.TriggerWindow != nil {
return true
}
return false
}
// SetTriggerWindow allocates a new t.TriggerWindow and returns the pointer to it.
func (t *ThresholdWindows) SetTriggerWindow(v string) {
t.TriggerWindow = &v
}
// GetAutoscale returns the Autoscale field if non-nil, zero value otherwise.
func (t *TileDef) GetAutoscale() bool {
if t == nil || t.Autoscale == nil {
return false
}
return *t.Autoscale
}
// GetAutoscaleOk returns a tuple with the Autoscale field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (t *TileDef) GetAutoscaleOk() (bool, bool) {
if t == nil || t.Autoscale == nil {
return false, false
}
return *t.Autoscale, true
}
// HasAutoscale returns a boolean if a field has been set.
func (t *TileDef) HasAutoscale() bool {
if t != nil && t.Autoscale != nil {
return true
}
return false
}
// SetAutoscale allocates a new t.Autoscale and returns the pointer to it.
func (t *TileDef) SetAutoscale(v bool) {
t.Autoscale = &v
}
// GetCustomUnit returns the CustomUnit field if non-nil, zero value otherwise.
func (t *TileDef) GetCustomUnit() string {
if t == nil || t.CustomUnit == nil {
return ""
}
return *t.CustomUnit
}
// GetCustomUnitOk returns a tuple with the CustomUnit field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (t *TileDef) GetCustomUnitOk() (string, bool) {
if t == nil || t.CustomUnit == nil {
return "", false
}
return *t.CustomUnit, true
}
// HasCustomUnit returns a boolean if a field has been set.
func (t *TileDef) HasCustomUnit() bool {
if t != nil && t.CustomUnit != nil {
return true
}
return false
}
// SetCustomUnit allocates a new t.CustomUnit and returns the pointer to it.
func (t *TileDef) SetCustomUnit(v string) {
t.CustomUnit = &v
}
// GetNodeType returns the NodeType field if non-nil, zero value otherwise.
func (t *TileDef) GetNodeType() string {
if t == nil || t.NodeType == nil {
return ""
}
return *t.NodeType
}
// GetNodeTypeOk returns a tuple with the NodeType field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (t *TileDef) GetNodeTypeOk() (string, bool) {
if t == nil || t.NodeType == nil {
return "", false
}
return *t.NodeType, true
}
// HasNodeType returns a boolean if a field has been set.
func (t *TileDef) HasNodeType() bool {
if t != nil && t.NodeType != nil {
return true
}
return false
}
// SetNodeType allocates a new t.NodeType and returns the pointer to it.
func (t *TileDef) SetNodeType(v string) {
t.NodeType = &v
}
// GetNoGroupHosts returns the NoGroupHosts field if non-nil, zero value otherwise.
func (t *TileDef) GetNoGroupHosts() bool {
if t == nil || t.NoGroupHosts == nil {
return false
}
return *t.NoGroupHosts
}
// GetNoGroupHostsOk returns a tuple with the NoGroupHosts field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (t *TileDef) GetNoGroupHostsOk() (bool, bool) {
if t == nil || t.NoGroupHosts == nil {
return false, false
}
return *t.NoGroupHosts, true
}
// HasNoGroupHosts returns a boolean if a field has been set.
func (t *TileDef) HasNoGroupHosts() bool {
if t != nil && t.NoGroupHosts != nil {
return true
}
return false
}
// SetNoGroupHosts allocates a new t.NoGroupHosts and returns the pointer to it.
func (t *TileDef) SetNoGroupHosts(v bool) {
t.NoGroupHosts = &v
}
// GetNoMetricHosts returns the NoMetricHosts field if non-nil, zero value otherwise.
func (t *TileDef) GetNoMetricHosts() bool {
if t == nil || t.NoMetricHosts == nil {
return false
}
return *t.NoMetricHosts
}
// GetNoMetricHostsOk returns a tuple with the NoMetricHosts field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (t *TileDef) GetNoMetricHostsOk() (bool, bool) {
if t == nil || t.NoMetricHosts == nil {
return false, false
}
return *t.NoMetricHosts, true
}
// HasNoMetricHosts returns a boolean if a field has been set.
func (t *TileDef) HasNoMetricHosts() bool {
if t != nil && t.NoMetricHosts != nil {
return true
}
return false
}
// SetNoMetricHosts allocates a new t.NoMetricHosts and returns the pointer to it.
func (t *TileDef) SetNoMetricHosts(v bool) {
t.NoMetricHosts = &v
}
// GetPrecision returns the Precision field if non-nil, zero value otherwise.
func (t *TileDef) GetPrecision() PrecisionT {
if t == nil || t.Precision == nil {
return ""
}
return *t.Precision
}
// GetPrecisionOk returns a tuple with the Precision field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (t *TileDef) GetPrecisionOk() (PrecisionT, bool) {
if t == nil || t.Precision == nil {
return "", false
}
return *t.Precision, true
}
// HasPrecision returns a boolean if a field has been set.
func (t *TileDef) HasPrecision() bool {
if t != nil && t.Precision != nil {
return true
}
return false
}
// SetPrecision allocates a new t.Precision and returns the pointer to it.
func (t *TileDef) SetPrecision(v PrecisionT) {
t.Precision = &v
}
// GetStyle returns the Style field if non-nil, zero value otherwise.
func (t *TileDef) GetStyle() TileDefStyle {
if t == nil || t.Style == nil {
return TileDefStyle{}
}
return *t.Style
}
// GetStyleOk returns a tuple with the Style field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (t *TileDef) GetStyleOk() (TileDefStyle, bool) {
if t == nil || t.Style == nil {
return TileDefStyle{}, false
}
return *t.Style, true
}
// HasStyle returns a boolean if a field has been set.
func (t *TileDef) HasStyle() bool {
if t != nil && t.Style != nil {
return true
}
return false
}
// SetStyle allocates a new t.Style and returns the pointer to it.
func (t *TileDef) SetStyle(v TileDefStyle) {
t.Style = &v
}
// GetTextAlign returns the TextAlign field if non-nil, zero value otherwise.
func (t *TileDef) GetTextAlign() string {
if t == nil || t.TextAlign == nil {
return ""
}
return *t.TextAlign
}
// GetTextAlignOk returns a tuple with the TextAlign field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (t *TileDef) GetTextAlignOk() (string, bool) {
if t == nil || t.TextAlign == nil {
return "", false
}
return *t.TextAlign, true
}
// HasTextAlign returns a boolean if a field has been set.
func (t *TileDef) HasTextAlign() bool {
if t != nil && t.TextAlign != nil {
return true
}
return false
}
// SetTextAlign allocates a new t.TextAlign and returns the pointer to it.
func (t *TileDef) SetTextAlign(v string) {
t.TextAlign = &v
}
// GetViz returns the Viz field if non-nil, zero value otherwise.
func (t *TileDef) GetViz() string {
if t == nil || t.Viz == nil {
return ""
}
return *t.Viz
}
// GetVizOk returns a tuple with the Viz field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (t *TileDef) GetVizOk() (string, bool) {
if t == nil || t.Viz == nil {
return "", false
}
return *t.Viz, true
}
// HasViz returns a boolean if a field has been set.
func (t *TileDef) HasViz() bool {
if t != nil && t.Viz != nil {
return true
}
return false
}
// SetViz allocates a new t.Viz and returns the pointer to it.
func (t *TileDef) SetViz(v string) {
t.Viz = &v
}
// GetCompute returns the Compute field if non-nil, zero value otherwise.
func (t *TileDefApmOrLogQuery) GetCompute() TileDefApmOrLogQueryCompute {
if t == nil || t.Compute == nil {
return TileDefApmOrLogQueryCompute{}
}
return *t.Compute
}
// GetComputeOk returns a tuple with the Compute field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (t *TileDefApmOrLogQuery) GetComputeOk() (TileDefApmOrLogQueryCompute, bool) {
if t == nil || t.Compute == nil {
return TileDefApmOrLogQueryCompute{}, false
}
return *t.Compute, true
}
// HasCompute returns a boolean if a field has been set.
func (t *TileDefApmOrLogQuery) HasCompute() bool {
if t != nil && t.Compute != nil {
return true
}
return false
}
// SetCompute allocates a new t.Compute and returns the pointer to it.
func (t *TileDefApmOrLogQuery) SetCompute(v TileDefApmOrLogQueryCompute) {
t.Compute = &v
}
// GetIndex returns the Index field if non-nil, zero value otherwise.
func (t *TileDefApmOrLogQuery) GetIndex() string {
if t == nil || t.Index == nil {
return ""
}
return *t.Index
}
// GetIndexOk returns a tuple with the Index field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (t *TileDefApmOrLogQuery) GetIndexOk() (string, bool) {
if t == nil || t.Index == nil {
return "", false
}
return *t.Index, true
}
// HasIndex returns a boolean if a field has been set.
func (t *TileDefApmOrLogQuery) HasIndex() bool {
if t != nil && t.Index != nil {
return true
}
return false
}
// SetIndex allocates a new t.Index and returns the pointer to it.
func (t *TileDefApmOrLogQuery) SetIndex(v string) {
t.Index = &v
}
// GetSearch returns the Search field if non-nil, zero value otherwise.
func (t *TileDefApmOrLogQuery) GetSearch() TileDefApmOrLogQuerySearch {
if t == nil || t.Search == nil {
return TileDefApmOrLogQuerySearch{}
}
return *t.Search
}
// GetSearchOk returns a tuple with the Search field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (t *TileDefApmOrLogQuery) GetSearchOk() (TileDefApmOrLogQuerySearch, bool) {
if t == nil || t.Search == nil {
return TileDefApmOrLogQuerySearch{}, false
}
return *t.Search, true
}
// HasSearch returns a boolean if a field has been set.
func (t *TileDefApmOrLogQuery) HasSearch() bool {
if t != nil && t.Search != nil {
return true
}
return false
}
// SetSearch allocates a new t.Search and returns the pointer to it.
func (t *TileDefApmOrLogQuery) SetSearch(v TileDefApmOrLogQuerySearch) {
t.Search = &v
}
// GetAggregation returns the Aggregation field if non-nil, zero value otherwise.
func (t *TileDefApmOrLogQueryCompute) GetAggregation() string {
if t == nil || t.Aggregation == nil {
return ""
}
return *t.Aggregation
}
// GetAggregationOk returns a tuple with the Aggregation field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (t *TileDefApmOrLogQueryCompute) GetAggregationOk() (string, bool) {
if t == nil || t.Aggregation == nil {
return "", false
}
return *t.Aggregation, true
}
// HasAggregation returns a boolean if a field has been set.
func (t *TileDefApmOrLogQueryCompute) HasAggregation() bool {
if t != nil && t.Aggregation != nil {
return true
}
return false
}
// SetAggregation allocates a new t.Aggregation and returns the pointer to it.
func (t *TileDefApmOrLogQueryCompute) SetAggregation(v string) {
t.Aggregation = &v
}
// GetFacet returns the Facet field if non-nil, zero value otherwise.
func (t *TileDefApmOrLogQueryCompute) GetFacet() string {
if t == nil || t.Facet == nil {
return ""
}
return *t.Facet
}
// GetFacetOk returns a tuple with the Facet field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (t *TileDefApmOrLogQueryCompute) GetFacetOk() (string, bool) {
if t == nil || t.Facet == nil {
return "", false
}
return *t.Facet, true
}
// HasFacet returns a boolean if a field has been set.
func (t *TileDefApmOrLogQueryCompute) HasFacet() bool {
if t != nil && t.Facet != nil {
return true
}
return false
}
// SetFacet allocates a new t.Facet and returns the pointer to it.
func (t *TileDefApmOrLogQueryCompute) SetFacet(v string) {
t.Facet = &v
}
// GetInterval returns the Interval field if non-nil, zero value otherwise.
func (t *TileDefApmOrLogQueryCompute) GetInterval() string {
if t == nil || t.Interval == nil {
return ""
}
return *t.Interval
}
// GetIntervalOk returns a tuple with the Interval field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (t *TileDefApmOrLogQueryCompute) GetIntervalOk() (string, bool) {
if t == nil || t.Interval == nil {
return "", false
}
return *t.Interval, true
}
// HasInterval returns a boolean if a field has been set.
func (t *TileDefApmOrLogQueryCompute) HasInterval() bool {
if t != nil && t.Interval != nil {
return true
}
return false
}
// SetInterval allocates a new t.Interval and returns the pointer to it.
func (t *TileDefApmOrLogQueryCompute) SetInterval(v string) {
t.Interval = &v
}
// GetFacet returns the Facet field if non-nil, zero value otherwise.
func (t *TileDefApmOrLogQueryGroupBy) GetFacet() string {
if t == nil || t.Facet == nil {
return ""
}
return *t.Facet
}
// GetFacetOk returns a tuple with the Facet field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (t *TileDefApmOrLogQueryGroupBy) GetFacetOk() (string, bool) {
if t == nil || t.Facet == nil {
return "", false
}
return *t.Facet, true
}
// HasFacet returns a boolean if a field has been set.
func (t *TileDefApmOrLogQueryGroupBy) HasFacet() bool {
if t != nil && t.Facet != nil {
return true
}
return false
}
// SetFacet allocates a new t.Facet and returns the pointer to it.
func (t *TileDefApmOrLogQueryGroupBy) SetFacet(v string) {
t.Facet = &v
}
// GetLimit returns the Limit field if non-nil, zero value otherwise.
func (t *TileDefApmOrLogQueryGroupBy) GetLimit() int {
if t == nil || t.Limit == nil {
return 0
}
return *t.Limit
}
// GetLimitOk returns a tuple with the Limit field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (t *TileDefApmOrLogQueryGroupBy) GetLimitOk() (int, bool) {
if t == nil || t.Limit == nil {
return 0, false
}
return *t.Limit, true
}
// HasLimit returns a boolean if a field has been set.
func (t *TileDefApmOrLogQueryGroupBy) HasLimit() bool {
if t != nil && t.Limit != nil {
return true
}
return false
}
// SetLimit allocates a new t.Limit and returns the pointer to it.
func (t *TileDefApmOrLogQueryGroupBy) SetLimit(v int) {
t.Limit = &v
}
// GetSort returns the Sort field if non-nil, zero value otherwise.
func (t *TileDefApmOrLogQueryGroupBy) GetSort() TileDefApmOrLogQueryGroupBySort {
if t == nil || t.Sort == nil {
return TileDefApmOrLogQueryGroupBySort{}
}
return *t.Sort
}
// GetSortOk returns a tuple with the Sort field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (t *TileDefApmOrLogQueryGroupBy) GetSortOk() (TileDefApmOrLogQueryGroupBySort, bool) {
if t == nil || t.Sort == nil {
return TileDefApmOrLogQueryGroupBySort{}, false
}
return *t.Sort, true
}
// HasSort returns a boolean if a field has been set.
func (t *TileDefApmOrLogQueryGroupBy) HasSort() bool {
if t != nil && t.Sort != nil {
return true
}
return false
}
// SetSort allocates a new t.Sort and returns the pointer to it.
func (t *TileDefApmOrLogQueryGroupBy) SetSort(v TileDefApmOrLogQueryGroupBySort) {
t.Sort = &v
}
// GetAggregation returns the Aggregation field if non-nil, zero value otherwise.
func (t *TileDefApmOrLogQueryGroupBySort) GetAggregation() string {
if t == nil || t.Aggregation == nil {
return ""
}
return *t.Aggregation
}
// GetAggregationOk returns a tuple with the Aggregation field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (t *TileDefApmOrLogQueryGroupBySort) GetAggregationOk() (string, bool) {
if t == nil || t.Aggregation == nil {
return "", false
}
return *t.Aggregation, true
}
// HasAggregation returns a boolean if a field has been set.
func (t *TileDefApmOrLogQueryGroupBySort) HasAggregation() bool {
if t != nil && t.Aggregation != nil {
return true
}
return false
}
// SetAggregation allocates a new t.Aggregation and returns the pointer to it.
func (t *TileDefApmOrLogQueryGroupBySort) SetAggregation(v string) {
t.Aggregation = &v
}
// GetFacet returns the Facet field if non-nil, zero value otherwise.
func (t *TileDefApmOrLogQueryGroupBySort) GetFacet() string {
if t == nil || t.Facet == nil {
return ""
}
return *t.Facet
}
// GetFacetOk returns a tuple with the Facet field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (t *TileDefApmOrLogQueryGroupBySort) GetFacetOk() (string, bool) {
if t == nil || t.Facet == nil {
return "", false
}
return *t.Facet, true
}
// HasFacet returns a boolean if a field has been set.
func (t *TileDefApmOrLogQueryGroupBySort) HasFacet() bool {
if t != nil && t.Facet != nil {
return true
}
return false
}
// SetFacet allocates a new t.Facet and returns the pointer to it.
func (t *TileDefApmOrLogQueryGroupBySort) SetFacet(v string) {
t.Facet = &v
}
// GetOrder returns the Order field if non-nil, zero value otherwise.
func (t *TileDefApmOrLogQueryGroupBySort) GetOrder() string {
if t == nil || t.Order == nil {
return ""
}
return *t.Order
}
// GetOrderOk returns a tuple with the Order field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (t *TileDefApmOrLogQueryGroupBySort) GetOrderOk() (string, bool) {
if t == nil || t.Order == nil {
return "", false
}
return *t.Order, true
}
// HasOrder returns a boolean if a field has been set.
func (t *TileDefApmOrLogQueryGroupBySort) HasOrder() bool {
if t != nil && t.Order != nil {
return true
}
return false
}
// SetOrder allocates a new t.Order and returns the pointer to it.
func (t *TileDefApmOrLogQueryGroupBySort) SetOrder(v string) {
t.Order = &v
}
// GetQuery returns the Query field if non-nil, zero value otherwise.
func (t *TileDefApmOrLogQuerySearch) GetQuery() string {
if t == nil || t.Query == nil {
return ""
}
return *t.Query
}
// GetQueryOk returns a tuple with the Query field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (t *TileDefApmOrLogQuerySearch) GetQueryOk() (string, bool) {
if t == nil || t.Query == nil {
return "", false
}
return *t.Query, true
}
// HasQuery returns a boolean if a field has been set.
func (t *TileDefApmOrLogQuerySearch) HasQuery() bool {
if t != nil && t.Query != nil {
return true
}
return false
}
// SetQuery allocates a new t.Query and returns the pointer to it.
func (t *TileDefApmOrLogQuerySearch) SetQuery(v string) {
t.Query = &v
}
// GetQuery returns the Query field if non-nil, zero value otherwise.
func (t *TileDefEvent) GetQuery() string {
if t == nil || t.Query == nil {
return ""
}
return *t.Query
}
// GetQueryOk returns a tuple with the Query field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (t *TileDefEvent) GetQueryOk() (string, bool) {
if t == nil || t.Query == nil {
return "", false
}
return *t.Query, true
}
// HasQuery returns a boolean if a field has been set.
func (t *TileDefEvent) HasQuery() bool {
if t != nil && t.Query != nil {
return true
}
return false
}
// SetQuery allocates a new t.Query and returns the pointer to it.
func (t *TileDefEvent) SetQuery(v string) {
t.Query = &v
}
// GetLabel returns the Label field if non-nil, zero value otherwise.
func (t *TileDefMarker) GetLabel() string {
if t == nil || t.Label == nil {
return ""
}
return *t.Label
}
// GetLabelOk returns a tuple with the Label field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (t *TileDefMarker) GetLabelOk() (string, bool) {
if t == nil || t.Label == nil {
return "", false
}
return *t.Label, true
}
// HasLabel returns a boolean if a field has been set.
func (t *TileDefMarker) HasLabel() bool {
if t != nil && t.Label != nil {
return true
}
return false
}
// SetLabel allocates a new t.Label and returns the pointer to it.
func (t *TileDefMarker) SetLabel(v string) {
t.Label = &v
}
// GetType returns the Type field if non-nil, zero value otherwise.
func (t *TileDefMarker) GetType() string {
if t == nil || t.Type == nil {
return ""
}
return *t.Type
}
// GetTypeOk returns a tuple with the Type field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (t *TileDefMarker) GetTypeOk() (string, bool) {
if t == nil || t.Type == nil {
return "", false
}
return *t.Type, true
}
// HasType returns a boolean if a field has been set.
func (t *TileDefMarker) HasType() bool {
if t != nil && t.Type != nil {
return true
}
return false
}
// SetType allocates a new t.Type and returns the pointer to it.
func (t *TileDefMarker) SetType(v string) {
t.Type = &v
}
// GetValue returns the Value field if non-nil, zero value otherwise.
func (t *TileDefMarker) GetValue() string {
if t == nil || t.Value == nil {
return ""
}
return *t.Value
}
// GetValueOk returns a tuple with the Value field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (t *TileDefMarker) GetValueOk() (string, bool) {
if t == nil || t.Value == nil {
return "", false
}
return *t.Value, true
}
// HasValue returns a boolean if a field has been set.
func (t *TileDefMarker) HasValue() bool {
if t != nil && t.Value != nil {
return true
}
return false
}
// SetValue allocates a new t.Value and returns the pointer to it.
func (t *TileDefMarker) SetValue(v string) {
t.Value = &v
}
// GetAlias returns the Alias field if non-nil, zero value otherwise.
func (t *TileDefMetadata) GetAlias() string {
if t == nil || t.Alias == nil {
return ""
}
return *t.Alias
}
// GetAliasOk returns a tuple with the Alias field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (t *TileDefMetadata) GetAliasOk() (string, bool) {
if t == nil || t.Alias == nil {
return "", false
}
return *t.Alias, true
}
// HasAlias returns a boolean if a field has been set.
func (t *TileDefMetadata) HasAlias() bool {
if t != nil && t.Alias != nil {
return true
}
return false
}
// SetAlias allocates a new t.Alias and returns the pointer to it.
func (t *TileDefMetadata) SetAlias(v string) {
t.Alias = &v
}
// GetLimit returns the Limit field if non-nil, zero value otherwise.
func (t *TileDefProcessQuery) GetLimit() int {
if t == nil || t.Limit == nil {
return 0
}
return *t.Limit
}
// GetLimitOk returns a tuple with the Limit field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (t *TileDefProcessQuery) GetLimitOk() (int, bool) {
if t == nil || t.Limit == nil {
return 0, false
}
return *t.Limit, true
}
// HasLimit returns a boolean if a field has been set.
func (t *TileDefProcessQuery) HasLimit() bool {
if t != nil && t.Limit != nil {
return true
}
return false
}
// SetLimit allocates a new t.Limit and returns the pointer to it.
func (t *TileDefProcessQuery) SetLimit(v int) {
t.Limit = &v
}
// GetMetric returns the Metric field if non-nil, zero value otherwise.
func (t *TileDefProcessQuery) GetMetric() string {
if t == nil || t.Metric == nil {
return ""
}
return *t.Metric
}
// GetMetricOk returns a tuple with the Metric field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (t *TileDefProcessQuery) GetMetricOk() (string, bool) {
if t == nil || t.Metric == nil {
return "", false
}
return *t.Metric, true
}
// HasMetric returns a boolean if a field has been set.
func (t *TileDefProcessQuery) HasMetric() bool {
if t != nil && t.Metric != nil {
return true
}
return false
}
// SetMetric allocates a new t.Metric and returns the pointer to it.
func (t *TileDefProcessQuery) SetMetric(v string) {
t.Metric = &v
}
// GetSearchBy returns the SearchBy field if non-nil, zero value otherwise.
func (t *TileDefProcessQuery) GetSearchBy() string {
if t == nil || t.SearchBy == nil {
return ""
}
return *t.SearchBy
}
// GetSearchByOk returns a tuple with the SearchBy field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (t *TileDefProcessQuery) GetSearchByOk() (string, bool) {
if t == nil || t.SearchBy == nil {
return "", false
}
return *t.SearchBy, true
}
// HasSearchBy returns a boolean if a field has been set.
func (t *TileDefProcessQuery) HasSearchBy() bool {
if t != nil && t.SearchBy != nil {
return true
}
return false
}
// SetSearchBy allocates a new t.SearchBy and returns the pointer to it.
func (t *TileDefProcessQuery) SetSearchBy(v string) {
t.SearchBy = &v
}
// GetAggregator returns the Aggregator field if non-nil, zero value otherwise.
func (t *TileDefRequest) GetAggregator() string {
if t == nil || t.Aggregator == nil {
return ""
}
return *t.Aggregator
}
// GetAggregatorOk returns a tuple with the Aggregator field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (t *TileDefRequest) GetAggregatorOk() (string, bool) {
if t == nil || t.Aggregator == nil {
return "", false
}
return *t.Aggregator, true
}
// HasAggregator returns a boolean if a field has been set.
func (t *TileDefRequest) HasAggregator() bool {
if t != nil && t.Aggregator != nil {
return true
}
return false
}
// SetAggregator allocates a new t.Aggregator and returns the pointer to it.
func (t *TileDefRequest) SetAggregator(v string) {
t.Aggregator = &v
}
// GetApmQuery returns the ApmQuery field if non-nil, zero value otherwise.
func (t *TileDefRequest) GetApmQuery() TileDefApmOrLogQuery {
if t == nil || t.ApmQuery == nil {
return TileDefApmOrLogQuery{}
}
return *t.ApmQuery
}
// GetApmQueryOk returns a tuple with the ApmQuery field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (t *TileDefRequest) GetApmQueryOk() (TileDefApmOrLogQuery, bool) {
if t == nil || t.ApmQuery == nil {
return TileDefApmOrLogQuery{}, false
}
return *t.ApmQuery, true
}
// HasApmQuery returns a boolean if a field has been set.
func (t *TileDefRequest) HasApmQuery() bool {
if t != nil && t.ApmQuery != nil {
return true
}
return false
}
// SetApmQuery allocates a new t.ApmQuery and returns the pointer to it.
func (t *TileDefRequest) SetApmQuery(v TileDefApmOrLogQuery) {
t.ApmQuery = &v
}
// GetChangeType returns the ChangeType field if non-nil, zero value otherwise.
func (t *TileDefRequest) GetChangeType() string {
if t == nil || t.ChangeType == nil {
return ""
}
return *t.ChangeType
}
// GetChangeTypeOk returns a tuple with the ChangeType field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (t *TileDefRequest) GetChangeTypeOk() (string, bool) {
if t == nil || t.ChangeType == nil {
return "", false
}
return *t.ChangeType, true
}
// HasChangeType returns a boolean if a field has been set.
func (t *TileDefRequest) HasChangeType() bool {
if t != nil && t.ChangeType != nil {
return true
}
return false
}
// SetChangeType allocates a new t.ChangeType and returns the pointer to it.
func (t *TileDefRequest) SetChangeType(v string) {
t.ChangeType = &v
}
// GetCompareTo returns the CompareTo field if non-nil, zero value otherwise.
func (t *TileDefRequest) GetCompareTo() string {
if t == nil || t.CompareTo == nil {
return ""
}
return *t.CompareTo
}
// GetCompareToOk returns a tuple with the CompareTo field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (t *TileDefRequest) GetCompareToOk() (string, bool) {
if t == nil || t.CompareTo == nil {
return "", false
}
return *t.CompareTo, true
}
// HasCompareTo returns a boolean if a field has been set.
func (t *TileDefRequest) HasCompareTo() bool {
if t != nil && t.CompareTo != nil {
return true
}
return false
}
// SetCompareTo allocates a new t.CompareTo and returns the pointer to it.
func (t *TileDefRequest) SetCompareTo(v string) {
t.CompareTo = &v
}
// GetExtraCol returns the ExtraCol field if non-nil, zero value otherwise.
func (t *TileDefRequest) GetExtraCol() string {
if t == nil || t.ExtraCol == nil {
return ""
}
return *t.ExtraCol
}
// GetExtraColOk returns a tuple with the ExtraCol field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (t *TileDefRequest) GetExtraColOk() (string, bool) {
if t == nil || t.ExtraCol == nil {
return "", false
}
return *t.ExtraCol, true
}
// HasExtraCol returns a boolean if a field has been set.
func (t *TileDefRequest) HasExtraCol() bool {
if t != nil && t.ExtraCol != nil {
return true
}
return false
}
// SetExtraCol allocates a new t.ExtraCol and returns the pointer to it.
func (t *TileDefRequest) SetExtraCol(v string) {
t.ExtraCol = &v
}
// GetIncreaseGood returns the IncreaseGood field if non-nil, zero value otherwise.
func (t *TileDefRequest) GetIncreaseGood() bool {
if t == nil || t.IncreaseGood == nil {
return false
}
return *t.IncreaseGood
}
// GetIncreaseGoodOk returns a tuple with the IncreaseGood field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (t *TileDefRequest) GetIncreaseGoodOk() (bool, bool) {
if t == nil || t.IncreaseGood == nil {
return false, false
}
return *t.IncreaseGood, true
}
// HasIncreaseGood returns a boolean if a field has been set.
func (t *TileDefRequest) HasIncreaseGood() bool {
if t != nil && t.IncreaseGood != nil {
return true
}
return false
}
// SetIncreaseGood allocates a new t.IncreaseGood and returns the pointer to it.
func (t *TileDefRequest) SetIncreaseGood(v bool) {
t.IncreaseGood = &v
}
// GetLimit returns the Limit field if non-nil, zero value otherwise.
func (t *TileDefRequest) GetLimit() int {
if t == nil || t.Limit == nil {
return 0
}
return *t.Limit
}
// GetLimitOk returns a tuple with the Limit field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (t *TileDefRequest) GetLimitOk() (int, bool) {
if t == nil || t.Limit == nil {
return 0, false
}
return *t.Limit, true
}
// HasLimit returns a boolean if a field has been set.
func (t *TileDefRequest) HasLimit() bool {
if t != nil && t.Limit != nil {
return true
}
return false
}
// SetLimit allocates a new t.Limit and returns the pointer to it.
func (t *TileDefRequest) SetLimit(v int) {
t.Limit = &v
}
// GetLogQuery returns the LogQuery field if non-nil, zero value otherwise.
func (t *TileDefRequest) GetLogQuery() TileDefApmOrLogQuery {
if t == nil || t.LogQuery == nil {
return TileDefApmOrLogQuery{}
}
return *t.LogQuery
}
// GetLogQueryOk returns a tuple with the LogQuery field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (t *TileDefRequest) GetLogQueryOk() (TileDefApmOrLogQuery, bool) {
if t == nil || t.LogQuery == nil {
return TileDefApmOrLogQuery{}, false
}
return *t.LogQuery, true
}
// HasLogQuery returns a boolean if a field has been set.
func (t *TileDefRequest) HasLogQuery() bool {
if t != nil && t.LogQuery != nil {
return true
}
return false
}
// SetLogQuery allocates a new t.LogQuery and returns the pointer to it.
func (t *TileDefRequest) SetLogQuery(v TileDefApmOrLogQuery) {
t.LogQuery = &v
}
// GetMetric returns the Metric field if non-nil, zero value otherwise.
func (t *TileDefRequest) GetMetric() string {
if t == nil || t.Metric == nil {
return ""
}
return *t.Metric
}
// GetMetricOk returns a tuple with the Metric field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (t *TileDefRequest) GetMetricOk() (string, bool) {
if t == nil || t.Metric == nil {
return "", false
}
return *t.Metric, true
}
// HasMetric returns a boolean if a field has been set.
func (t *TileDefRequest) HasMetric() bool {
if t != nil && t.Metric != nil {
return true
}
return false
}
// SetMetric allocates a new t.Metric and returns the pointer to it.
func (t *TileDefRequest) SetMetric(v string) {
t.Metric = &v
}
// GetOrderBy returns the OrderBy field if non-nil, zero value otherwise.
func (t *TileDefRequest) GetOrderBy() string {
if t == nil || t.OrderBy == nil {
return ""
}
return *t.OrderBy
}
// GetOrderByOk returns a tuple with the OrderBy field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (t *TileDefRequest) GetOrderByOk() (string, bool) {
if t == nil || t.OrderBy == nil {
return "", false
}
return *t.OrderBy, true
}
// HasOrderBy returns a boolean if a field has been set.
func (t *TileDefRequest) HasOrderBy() bool {
if t != nil && t.OrderBy != nil {
return true
}
return false
}
// SetOrderBy allocates a new t.OrderBy and returns the pointer to it.
func (t *TileDefRequest) SetOrderBy(v string) {
t.OrderBy = &v
}
// GetOrderDir returns the OrderDir field if non-nil, zero value otherwise.
func (t *TileDefRequest) GetOrderDir() string {
if t == nil || t.OrderDir == nil {
return ""
}
return *t.OrderDir
}
// GetOrderDirOk returns a tuple with the OrderDir field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (t *TileDefRequest) GetOrderDirOk() (string, bool) {
if t == nil || t.OrderDir == nil {
return "", false
}
return *t.OrderDir, true
}
// HasOrderDir returns a boolean if a field has been set.
func (t *TileDefRequest) HasOrderDir() bool {
if t != nil && t.OrderDir != nil {
return true
}
return false
}
// SetOrderDir allocates a new t.OrderDir and returns the pointer to it.
func (t *TileDefRequest) SetOrderDir(v string) {
t.OrderDir = &v
}
// GetProcessQuery returns the ProcessQuery field if non-nil, zero value otherwise.
func (t *TileDefRequest) GetProcessQuery() TileDefProcessQuery {
if t == nil || t.ProcessQuery == nil {
return TileDefProcessQuery{}
}
return *t.ProcessQuery
}
// GetProcessQueryOk returns a tuple with the ProcessQuery field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (t *TileDefRequest) GetProcessQueryOk() (TileDefProcessQuery, bool) {
if t == nil || t.ProcessQuery == nil {
return TileDefProcessQuery{}, false
}
return *t.ProcessQuery, true
}
// HasProcessQuery returns a boolean if a field has been set.
func (t *TileDefRequest) HasProcessQuery() bool {
if t != nil && t.ProcessQuery != nil {
return true
}
return false
}
// SetProcessQuery allocates a new t.ProcessQuery and returns the pointer to it.
func (t *TileDefRequest) SetProcessQuery(v TileDefProcessQuery) {
t.ProcessQuery = &v
}
// GetQuery returns the Query field if non-nil, zero value otherwise.
func (t *TileDefRequest) GetQuery() string {
if t == nil || t.Query == nil {
return ""
}
return *t.Query
}
// GetQueryOk returns a tuple with the Query field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (t *TileDefRequest) GetQueryOk() (string, bool) {
if t == nil || t.Query == nil {
return "", false
}
return *t.Query, true
}
// HasQuery returns a boolean if a field has been set.
func (t *TileDefRequest) HasQuery() bool {
if t != nil && t.Query != nil {
return true
}
return false
}
// SetQuery allocates a new t.Query and returns the pointer to it.
func (t *TileDefRequest) SetQuery(v string) {
t.Query = &v
}
// GetQueryType returns the QueryType field if non-nil, zero value otherwise.
func (t *TileDefRequest) GetQueryType() string {
if t == nil || t.QueryType == nil {
return ""
}
return *t.QueryType
}
// GetQueryTypeOk returns a tuple with the QueryType field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (t *TileDefRequest) GetQueryTypeOk() (string, bool) {
if t == nil || t.QueryType == nil {
return "", false
}
return *t.QueryType, true
}
// HasQueryType returns a boolean if a field has been set.
func (t *TileDefRequest) HasQueryType() bool {
if t != nil && t.QueryType != nil {
return true
}
return false
}
// SetQueryType allocates a new t.QueryType and returns the pointer to it.
func (t *TileDefRequest) SetQueryType(v string) {
t.QueryType = &v
}
// GetStyle returns the Style field if non-nil, zero value otherwise.
func (t *TileDefRequest) GetStyle() TileDefRequestStyle {
if t == nil || t.Style == nil {
return TileDefRequestStyle{}
}
return *t.Style
}
// GetStyleOk returns a tuple with the Style field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (t *TileDefRequest) GetStyleOk() (TileDefRequestStyle, bool) {
if t == nil || t.Style == nil {
return TileDefRequestStyle{}, false
}
return *t.Style, true
}
// HasStyle returns a boolean if a field has been set.
func (t *TileDefRequest) HasStyle() bool {
if t != nil && t.Style != nil {
return true
}
return false
}
// SetStyle allocates a new t.Style and returns the pointer to it.
func (t *TileDefRequest) SetStyle(v TileDefRequestStyle) {
t.Style = &v
}
// GetTextFilter returns the TextFilter field if non-nil, zero value otherwise.
func (t *TileDefRequest) GetTextFilter() string {
if t == nil || t.TextFilter == nil {
return ""
}
return *t.TextFilter
}
// GetTextFilterOk returns a tuple with the TextFilter field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (t *TileDefRequest) GetTextFilterOk() (string, bool) {
if t == nil || t.TextFilter == nil {
return "", false
}
return *t.TextFilter, true
}
// HasTextFilter returns a boolean if a field has been set.
func (t *TileDefRequest) HasTextFilter() bool {
if t != nil && t.TextFilter != nil {
return true
}
return false
}
// SetTextFilter allocates a new t.TextFilter and returns the pointer to it.
func (t *TileDefRequest) SetTextFilter(v string) {
t.TextFilter = &v
}
// GetType returns the Type field if non-nil, zero value otherwise.
func (t *TileDefRequest) GetType() string {
if t == nil || t.Type == nil {
return ""
}
return *t.Type
}
// GetTypeOk returns a tuple with the Type field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (t *TileDefRequest) GetTypeOk() (string, bool) {
if t == nil || t.Type == nil {
return "", false
}
return *t.Type, true
}
// HasType returns a boolean if a field has been set.
func (t *TileDefRequest) HasType() bool {
if t != nil && t.Type != nil {
return true
}
return false
}
// SetType allocates a new t.Type and returns the pointer to it.
func (t *TileDefRequest) SetType(v string) {
t.Type = &v
}
// GetPalette returns the Palette field if non-nil, zero value otherwise.
func (t *TileDefRequestStyle) GetPalette() string {
if t == nil || t.Palette == nil {
return ""
}
return *t.Palette
}
// GetPaletteOk returns a tuple with the Palette field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (t *TileDefRequestStyle) GetPaletteOk() (string, bool) {
if t == nil || t.Palette == nil {
return "", false
}
return *t.Palette, true
}
// HasPalette returns a boolean if a field has been set.
func (t *TileDefRequestStyle) HasPalette() bool {
if t != nil && t.Palette != nil {
return true
}
return false
}
// SetPalette allocates a new t.Palette and returns the pointer to it.
func (t *TileDefRequestStyle) SetPalette(v string) {
t.Palette = &v
}
// GetType returns the Type field if non-nil, zero value otherwise.
func (t *TileDefRequestStyle) GetType() string {
if t == nil || t.Type == nil {
return ""
}
return *t.Type
}
// GetTypeOk returns a tuple with the Type field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (t *TileDefRequestStyle) GetTypeOk() (string, bool) {
if t == nil || t.Type == nil {
return "", false
}
return *t.Type, true
}
// HasType returns a boolean if a field has been set.
func (t *TileDefRequestStyle) HasType() bool {
if t != nil && t.Type != nil {
return true
}
return false
}
// SetType allocates a new t.Type and returns the pointer to it.
func (t *TileDefRequestStyle) SetType(v string) {
t.Type = &v
}
// GetWidth returns the Width field if non-nil, zero value otherwise.
func (t *TileDefRequestStyle) GetWidth() string {
if t == nil || t.Width == nil {
return ""
}
return *t.Width
}
// GetWidthOk returns a tuple with the Width field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (t *TileDefRequestStyle) GetWidthOk() (string, bool) {
if t == nil || t.Width == nil {
return "", false
}
return *t.Width, true
}
// HasWidth returns a boolean if a field has been set.
func (t *TileDefRequestStyle) HasWidth() bool {
if t != nil && t.Width != nil {
return true
}
return false
}
// SetWidth allocates a new t.Width and returns the pointer to it.
func (t *TileDefRequestStyle) SetWidth(v string) {
t.Width = &v
}
// GetFillMax returns the FillMax field if non-nil, zero value otherwise.
func (t *TileDefStyle) GetFillMax() json.Number {
if t == nil || t.FillMax == nil {
return ""
}
return *t.FillMax
}
// GetFillMaxOk returns a tuple with the FillMax field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (t *TileDefStyle) GetFillMaxOk() (json.Number, bool) {
if t == nil || t.FillMax == nil {
return "", false
}
return *t.FillMax, true
}
// HasFillMax returns a boolean if a field has been set.
func (t *TileDefStyle) HasFillMax() bool {
if t != nil && t.FillMax != nil {
return true
}
return false
}
// SetFillMax allocates a new t.FillMax and returns the pointer to it.
func (t *TileDefStyle) SetFillMax(v json.Number) {
t.FillMax = &v
}
// GetFillMin returns the FillMin field if non-nil, zero value otherwise.
func (t *TileDefStyle) GetFillMin() json.Number {
if t == nil || t.FillMin == nil {
return ""
}
return *t.FillMin
}
// GetFillMinOk returns a tuple with the FillMin field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (t *TileDefStyle) GetFillMinOk() (json.Number, bool) {
if t == nil || t.FillMin == nil {
return "", false
}
return *t.FillMin, true
}
// HasFillMin returns a boolean if a field has been set.
func (t *TileDefStyle) HasFillMin() bool {
if t != nil && t.FillMin != nil {
return true
}
return false
}
// SetFillMin allocates a new t.FillMin and returns the pointer to it.
func (t *TileDefStyle) SetFillMin(v json.Number) {
t.FillMin = &v
}
// GetPalette returns the Palette field if non-nil, zero value otherwise.
func (t *TileDefStyle) GetPalette() string {
if t == nil || t.Palette == nil {
return ""
}
return *t.Palette
}
// GetPaletteOk returns a tuple with the Palette field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (t *TileDefStyle) GetPaletteOk() (string, bool) {
if t == nil || t.Palette == nil {
return "", false
}
return *t.Palette, true
}
// HasPalette returns a boolean if a field has been set.
func (t *TileDefStyle) HasPalette() bool {
if t != nil && t.Palette != nil {
return true
}
return false
}
// SetPalette allocates a new t.Palette and returns the pointer to it.
func (t *TileDefStyle) SetPalette(v string) {
t.Palette = &v
}
// GetPaletteFlip returns the PaletteFlip field if non-nil, zero value otherwise.
func (t *TileDefStyle) GetPaletteFlip() string {
if t == nil || t.PaletteFlip == nil {
return ""
}
return *t.PaletteFlip
}
// GetPaletteFlipOk returns a tuple with the PaletteFlip field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (t *TileDefStyle) GetPaletteFlipOk() (string, bool) {
if t == nil || t.PaletteFlip == nil {
return "", false
}
return *t.PaletteFlip, true
}
// HasPaletteFlip returns a boolean if a field has been set.
func (t *TileDefStyle) HasPaletteFlip() bool {
if t != nil && t.PaletteFlip != nil {
return true
}
return false
}
// SetPaletteFlip allocates a new t.PaletteFlip and returns the pointer to it.
func (t *TileDefStyle) SetPaletteFlip(v string) {
t.PaletteFlip = &v
}
// GetLiveSpan returns the LiveSpan field if non-nil, zero value otherwise.
func (t *Time) GetLiveSpan() string {
if t == nil || t.LiveSpan == nil {
return ""
}
return *t.LiveSpan
}
// GetLiveSpanOk returns a tuple with the LiveSpan field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (t *Time) GetLiveSpanOk() (string, bool) {
if t == nil || t.LiveSpan == nil {
return "", false
}
return *t.LiveSpan, true
}
// HasLiveSpan returns a boolean if a field has been set.
func (t *Time) HasLiveSpan() bool {
if t != nil && t.LiveSpan != nil {
return true
}
return false
}
// SetLiveSpan allocates a new t.LiveSpan and returns the pointer to it.
func (t *Time) SetLiveSpan(v string) {
t.LiveSpan = &v
}
// GetData returns the Data field if non-nil, zero value otherwise.
func (t *timeframesDeleteResp) GetData() ServiceLevelObjectiveDeleteTimeFramesResponse {
if t == nil || t.Data == nil {
return ServiceLevelObjectiveDeleteTimeFramesResponse{}
}
return *t.Data
}
// GetDataOk returns a tuple with the Data field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (t *timeframesDeleteResp) GetDataOk() (ServiceLevelObjectiveDeleteTimeFramesResponse, bool) {
if t == nil || t.Data == nil {
return ServiceLevelObjectiveDeleteTimeFramesResponse{}, false
}
return *t.Data, true
}
// HasData returns a boolean if a field has been set.
func (t *timeframesDeleteResp) HasData() bool {
if t != nil && t.Data != nil {
return true
}
return false
}
// SetData allocates a new t.Data and returns the pointer to it.
func (t *timeframesDeleteResp) SetData(v ServiceLevelObjectiveDeleteTimeFramesResponse) {
t.Data = &v
}
// GetFrom returns the From field if non-nil, zero value otherwise.
func (t *TimeRange) GetFrom() json.Number {
if t == nil || t.From == nil {
return ""
}
return *t.From
}
// GetFromOk returns a tuple with the From field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (t *TimeRange) GetFromOk() (json.Number, bool) {
if t == nil || t.From == nil {
return "", false
}
return *t.From, true
}
// HasFrom returns a boolean if a field has been set.
func (t *TimeRange) HasFrom() bool {
if t != nil && t.From != nil {
return true
}
return false
}
// SetFrom allocates a new t.From and returns the pointer to it.
func (t *TimeRange) SetFrom(v json.Number) {
t.From = &v
}
// GetLive returns the Live field if non-nil, zero value otherwise.
func (t *TimeRange) GetLive() bool {
if t == nil || t.Live == nil {
return false
}
return *t.Live
}
// GetLiveOk returns a tuple with the Live field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (t *TimeRange) GetLiveOk() (bool, bool) {
if t == nil || t.Live == nil {
return false, false
}
return *t.Live, true
}
// HasLive returns a boolean if a field has been set.
func (t *TimeRange) HasLive() bool {
if t != nil && t.Live != nil {
return true
}
return false
}
// SetLive allocates a new t.Live and returns the pointer to it.
func (t *TimeRange) SetLive(v bool) {
t.Live = &v
}
// GetTo returns the To field if non-nil, zero value otherwise.
func (t *TimeRange) GetTo() json.Number {
if t == nil || t.To == nil {
return ""
}
return *t.To
}
// GetToOk returns a tuple with the To field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (t *TimeRange) GetToOk() (json.Number, bool) {
if t == nil || t.To == nil {
return "", false
}
return *t.To, true
}
// HasTo returns a boolean if a field has been set.
func (t *TimeRange) HasTo() bool {
if t != nil && t.To != nil {
return true
}
return false
}
// SetTo allocates a new t.To and returns the pointer to it.
func (t *TimeRange) SetTo(v json.Number) {
t.To = &v
}
// GetLegendSize returns the LegendSize field if non-nil, zero value otherwise.
func (t *TimeseriesDefinition) GetLegendSize() string {
if t == nil || t.LegendSize == nil {
return ""
}
return *t.LegendSize
}
// GetLegendSizeOk returns a tuple with the LegendSize field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (t *TimeseriesDefinition) GetLegendSizeOk() (string, bool) {
if t == nil || t.LegendSize == nil {
return "", false
}
return *t.LegendSize, true
}
// HasLegendSize returns a boolean if a field has been set.
func (t *TimeseriesDefinition) HasLegendSize() bool {
if t != nil && t.LegendSize != nil {
return true
}
return false
}
// SetLegendSize allocates a new t.LegendSize and returns the pointer to it.
func (t *TimeseriesDefinition) SetLegendSize(v string) {
t.LegendSize = &v
}
// GetShowLegend returns the ShowLegend field if non-nil, zero value otherwise.
func (t *TimeseriesDefinition) GetShowLegend() bool {
if t == nil || t.ShowLegend == nil {
return false
}
return *t.ShowLegend
}
// GetShowLegendOk returns a tuple with the ShowLegend field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (t *TimeseriesDefinition) GetShowLegendOk() (bool, bool) {
if t == nil || t.ShowLegend == nil {
return false, false
}
return *t.ShowLegend, true
}
// HasShowLegend returns a boolean if a field has been set.
func (t *TimeseriesDefinition) HasShowLegend() bool {
if t != nil && t.ShowLegend != nil {
return true
}
return false
}
// SetShowLegend allocates a new t.ShowLegend and returns the pointer to it.
func (t *TimeseriesDefinition) SetShowLegend(v bool) {
t.ShowLegend = &v
}
// GetTime returns the Time field if non-nil, zero value otherwise.
func (t *TimeseriesDefinition) GetTime() WidgetTime {
if t == nil || t.Time == nil {
return WidgetTime{}
}
return *t.Time
}
// GetTimeOk returns a tuple with the Time field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (t *TimeseriesDefinition) GetTimeOk() (WidgetTime, bool) {
if t == nil || t.Time == nil {
return WidgetTime{}, false
}
return *t.Time, true
}
// HasTime returns a boolean if a field has been set.
func (t *TimeseriesDefinition) HasTime() bool {
if t != nil && t.Time != nil {
return true
}
return false
}
// SetTime allocates a new t.Time and returns the pointer to it.
func (t *TimeseriesDefinition) SetTime(v WidgetTime) {
t.Time = &v
}
// GetTitle returns the Title field if non-nil, zero value otherwise.
func (t *TimeseriesDefinition) GetTitle() string {
if t == nil || t.Title == nil {
return ""
}
return *t.Title
}
// GetTitleOk returns a tuple with the Title field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (t *TimeseriesDefinition) GetTitleOk() (string, bool) {
if t == nil || t.Title == nil {
return "", false
}
return *t.Title, true
}
// HasTitle returns a boolean if a field has been set.
func (t *TimeseriesDefinition) HasTitle() bool {
if t != nil && t.Title != nil {
return true
}
return false
}
// SetTitle allocates a new t.Title and returns the pointer to it.
func (t *TimeseriesDefinition) SetTitle(v string) {
t.Title = &v
}
// GetTitleAlign returns the TitleAlign field if non-nil, zero value otherwise.
func (t *TimeseriesDefinition) GetTitleAlign() string {
if t == nil || t.TitleAlign == nil {
return ""
}
return *t.TitleAlign
}
// GetTitleAlignOk returns a tuple with the TitleAlign field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (t *TimeseriesDefinition) GetTitleAlignOk() (string, bool) {
if t == nil || t.TitleAlign == nil {
return "", false
}
return *t.TitleAlign, true
}
// HasTitleAlign returns a boolean if a field has been set.
func (t *TimeseriesDefinition) HasTitleAlign() bool {
if t != nil && t.TitleAlign != nil {
return true
}
return false
}
// SetTitleAlign allocates a new t.TitleAlign and returns the pointer to it.
func (t *TimeseriesDefinition) SetTitleAlign(v string) {
t.TitleAlign = &v
}
// GetTitleSize returns the TitleSize field if non-nil, zero value otherwise.
func (t *TimeseriesDefinition) GetTitleSize() string {
if t == nil || t.TitleSize == nil {
return ""
}
return *t.TitleSize
}
// GetTitleSizeOk returns a tuple with the TitleSize field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (t *TimeseriesDefinition) GetTitleSizeOk() (string, bool) {
if t == nil || t.TitleSize == nil {
return "", false
}
return *t.TitleSize, true
}
// HasTitleSize returns a boolean if a field has been set.
func (t *TimeseriesDefinition) HasTitleSize() bool {
if t != nil && t.TitleSize != nil {
return true
}
return false
}
// SetTitleSize allocates a new t.TitleSize and returns the pointer to it.
func (t *TimeseriesDefinition) SetTitleSize(v string) {
t.TitleSize = &v
}
// GetType returns the Type field if non-nil, zero value otherwise.
func (t *TimeseriesDefinition) GetType() string {
if t == nil || t.Type == nil {
return ""
}
return *t.Type
}
// GetTypeOk returns a tuple with the Type field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (t *TimeseriesDefinition) GetTypeOk() (string, bool) {
if t == nil || t.Type == nil {
return "", false
}
return *t.Type, true
}
// HasType returns a boolean if a field has been set.
func (t *TimeseriesDefinition) HasType() bool {
if t != nil && t.Type != nil {
return true
}
return false
}
// SetType allocates a new t.Type and returns the pointer to it.
func (t *TimeseriesDefinition) SetType(v string) {
t.Type = &v
}
// GetYaxis returns the Yaxis field if non-nil, zero value otherwise.
func (t *TimeseriesDefinition) GetYaxis() WidgetAxis {
if t == nil || t.Yaxis == nil {
return WidgetAxis{}
}
return *t.Yaxis
}
// GetYaxisOk returns a tuple with the Yaxis field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (t *TimeseriesDefinition) GetYaxisOk() (WidgetAxis, bool) {
if t == nil || t.Yaxis == nil {
return WidgetAxis{}, false
}
return *t.Yaxis, true
}
// HasYaxis returns a boolean if a field has been set.
func (t *TimeseriesDefinition) HasYaxis() bool {
if t != nil && t.Yaxis != nil {
return true
}
return false
}
// SetYaxis allocates a new t.Yaxis and returns the pointer to it.
func (t *TimeseriesDefinition) SetYaxis(v WidgetAxis) {
t.Yaxis = &v
}
// GetApmQuery returns the ApmQuery field if non-nil, zero value otherwise.
func (t *TimeseriesRequest) GetApmQuery() WidgetApmOrLogQuery {
if t == nil || t.ApmQuery == nil {
return WidgetApmOrLogQuery{}
}
return *t.ApmQuery
}
// GetApmQueryOk returns a tuple with the ApmQuery field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (t *TimeseriesRequest) GetApmQueryOk() (WidgetApmOrLogQuery, bool) {
if t == nil || t.ApmQuery == nil {
return WidgetApmOrLogQuery{}, false
}
return *t.ApmQuery, true
}
// HasApmQuery returns a boolean if a field has been set.
func (t *TimeseriesRequest) HasApmQuery() bool {
if t != nil && t.ApmQuery != nil {
return true
}
return false
}
// SetApmQuery allocates a new t.ApmQuery and returns the pointer to it.
func (t *TimeseriesRequest) SetApmQuery(v WidgetApmOrLogQuery) {
t.ApmQuery = &v
}
// GetDisplayType returns the DisplayType field if non-nil, zero value otherwise.
func (t *TimeseriesRequest) GetDisplayType() string {
if t == nil || t.DisplayType == nil {
return ""
}
return *t.DisplayType
}
// GetDisplayTypeOk returns a tuple with the DisplayType field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (t *TimeseriesRequest) GetDisplayTypeOk() (string, bool) {
if t == nil || t.DisplayType == nil {
return "", false
}
return *t.DisplayType, true
}
// HasDisplayType returns a boolean if a field has been set.
func (t *TimeseriesRequest) HasDisplayType() bool {
if t != nil && t.DisplayType != nil {
return true
}
return false
}
// SetDisplayType allocates a new t.DisplayType and returns the pointer to it.
func (t *TimeseriesRequest) SetDisplayType(v string) {
t.DisplayType = &v
}
// GetLogQuery returns the LogQuery field if non-nil, zero value otherwise.
func (t *TimeseriesRequest) GetLogQuery() WidgetApmOrLogQuery {
if t == nil || t.LogQuery == nil {
return WidgetApmOrLogQuery{}
}
return *t.LogQuery
}
// GetLogQueryOk returns a tuple with the LogQuery field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (t *TimeseriesRequest) GetLogQueryOk() (WidgetApmOrLogQuery, bool) {
if t == nil || t.LogQuery == nil {
return WidgetApmOrLogQuery{}, false
}
return *t.LogQuery, true
}
// HasLogQuery returns a boolean if a field has been set.
func (t *TimeseriesRequest) HasLogQuery() bool {
if t != nil && t.LogQuery != nil {
return true
}
return false
}
// SetLogQuery allocates a new t.LogQuery and returns the pointer to it.
func (t *TimeseriesRequest) SetLogQuery(v WidgetApmOrLogQuery) {
t.LogQuery = &v
}
// GetMetricQuery returns the MetricQuery field if non-nil, zero value otherwise.
func (t *TimeseriesRequest) GetMetricQuery() string {
if t == nil || t.MetricQuery == nil {
return ""
}
return *t.MetricQuery
}
// GetMetricQueryOk returns a tuple with the MetricQuery field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (t *TimeseriesRequest) GetMetricQueryOk() (string, bool) {
if t == nil || t.MetricQuery == nil {
return "", false
}
return *t.MetricQuery, true
}
// HasMetricQuery returns a boolean if a field has been set.
func (t *TimeseriesRequest) HasMetricQuery() bool {
if t != nil && t.MetricQuery != nil {
return true
}
return false
}
// SetMetricQuery allocates a new t.MetricQuery and returns the pointer to it.
func (t *TimeseriesRequest) SetMetricQuery(v string) {
t.MetricQuery = &v
}
// GetProcessQuery returns the ProcessQuery field if non-nil, zero value otherwise.
func (t *TimeseriesRequest) GetProcessQuery() WidgetProcessQuery {
if t == nil || t.ProcessQuery == nil {
return WidgetProcessQuery{}
}
return *t.ProcessQuery
}
// GetProcessQueryOk returns a tuple with the ProcessQuery field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (t *TimeseriesRequest) GetProcessQueryOk() (WidgetProcessQuery, bool) {
if t == nil || t.ProcessQuery == nil {
return WidgetProcessQuery{}, false
}
return *t.ProcessQuery, true
}
// HasProcessQuery returns a boolean if a field has been set.
func (t *TimeseriesRequest) HasProcessQuery() bool {
if t != nil && t.ProcessQuery != nil {
return true
}
return false
}
// SetProcessQuery allocates a new t.ProcessQuery and returns the pointer to it.
func (t *TimeseriesRequest) SetProcessQuery(v WidgetProcessQuery) {
t.ProcessQuery = &v
}
// GetStyle returns the Style field if non-nil, zero value otherwise.
func (t *TimeseriesRequest) GetStyle() TimeseriesRequestStyle {
if t == nil || t.Style == nil {
return TimeseriesRequestStyle{}
}
return *t.Style
}
// GetStyleOk returns a tuple with the Style field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (t *TimeseriesRequest) GetStyleOk() (TimeseriesRequestStyle, bool) {
if t == nil || t.Style == nil {
return TimeseriesRequestStyle{}, false
}
return *t.Style, true
}
// HasStyle returns a boolean if a field has been set.
func (t *TimeseriesRequest) HasStyle() bool {
if t != nil && t.Style != nil {
return true
}
return false
}
// SetStyle allocates a new t.Style and returns the pointer to it.
func (t *TimeseriesRequest) SetStyle(v TimeseriesRequestStyle) {
t.Style = &v
}
// GetLineType returns the LineType field if non-nil, zero value otherwise.
func (t *TimeseriesRequestStyle) GetLineType() string {
if t == nil || t.LineType == nil {
return ""
}
return *t.LineType
}
// GetLineTypeOk returns a tuple with the LineType field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (t *TimeseriesRequestStyle) GetLineTypeOk() (string, bool) {
if t == nil || t.LineType == nil {
return "", false
}
return *t.LineType, true
}
// HasLineType returns a boolean if a field has been set.
func (t *TimeseriesRequestStyle) HasLineType() bool {
if t != nil && t.LineType != nil {
return true
}
return false
}
// SetLineType allocates a new t.LineType and returns the pointer to it.
func (t *TimeseriesRequestStyle) SetLineType(v string) {
t.LineType = &v
}
// GetLineWidth returns the LineWidth field if non-nil, zero value otherwise.
func (t *TimeseriesRequestStyle) GetLineWidth() string {
if t == nil || t.LineWidth == nil {
return ""
}
return *t.LineWidth
}
// GetLineWidthOk returns a tuple with the LineWidth field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (t *TimeseriesRequestStyle) GetLineWidthOk() (string, bool) {
if t == nil || t.LineWidth == nil {
return "", false
}
return *t.LineWidth, true
}
// HasLineWidth returns a boolean if a field has been set.
func (t *TimeseriesRequestStyle) HasLineWidth() bool {
if t != nil && t.LineWidth != nil {
return true
}
return false
}
// SetLineWidth allocates a new t.LineWidth and returns the pointer to it.
func (t *TimeseriesRequestStyle) SetLineWidth(v string) {
t.LineWidth = &v
}
// GetPalette returns the Palette field if non-nil, zero value otherwise.
func (t *TimeseriesRequestStyle) GetPalette() string {
if t == nil || t.Palette == nil {
return ""
}
return *t.Palette
}
// GetPaletteOk returns a tuple with the Palette field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (t *TimeseriesRequestStyle) GetPaletteOk() (string, bool) {
if t == nil || t.Palette == nil {
return "", false
}
return *t.Palette, true
}
// HasPalette returns a boolean if a field has been set.
func (t *TimeseriesRequestStyle) HasPalette() bool {
if t != nil && t.Palette != nil {
return true
}
return false
}
// SetPalette allocates a new t.Palette and returns the pointer to it.
func (t *TimeseriesRequestStyle) SetPalette(v string) {
t.Palette = &v
}
// GetNewStatus returns the NewStatus field if non-nil, zero value otherwise.
func (t *ToggleStatus) GetNewStatus() string {
if t == nil || t.NewStatus == nil {
return ""
}
return *t.NewStatus
}
// GetNewStatusOk returns a tuple with the NewStatus field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (t *ToggleStatus) GetNewStatusOk() (string, bool) {
if t == nil || t.NewStatus == nil {
return "", false
}
return *t.NewStatus, true
}
// HasNewStatus returns a boolean if a field has been set.
func (t *ToggleStatus) HasNewStatus() bool {
if t != nil && t.NewStatus != nil {
return true
}
return false
}
// SetNewStatus allocates a new t.NewStatus and returns the pointer to it.
func (t *ToggleStatus) SetNewStatus(v string) {
t.NewStatus = &v
}
// GetTime returns the Time field if non-nil, zero value otherwise.
func (t *ToplistDefinition) GetTime() WidgetTime {
if t == nil || t.Time == nil {
return WidgetTime{}
}
return *t.Time
}
// GetTimeOk returns a tuple with the Time field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (t *ToplistDefinition) GetTimeOk() (WidgetTime, bool) {
if t == nil || t.Time == nil {
return WidgetTime{}, false
}
return *t.Time, true
}
// HasTime returns a boolean if a field has been set.
func (t *ToplistDefinition) HasTime() bool {
if t != nil && t.Time != nil {
return true
}
return false
}
// SetTime allocates a new t.Time and returns the pointer to it.
func (t *ToplistDefinition) SetTime(v WidgetTime) {
t.Time = &v
}
// GetTitle returns the Title field if non-nil, zero value otherwise.
func (t *ToplistDefinition) GetTitle() string {
if t == nil || t.Title == nil {
return ""
}
return *t.Title
}
// GetTitleOk returns a tuple with the Title field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (t *ToplistDefinition) GetTitleOk() (string, bool) {
if t == nil || t.Title == nil {
return "", false
}
return *t.Title, true
}
// HasTitle returns a boolean if a field has been set.
func (t *ToplistDefinition) HasTitle() bool {
if t != nil && t.Title != nil {
return true
}
return false
}
// SetTitle allocates a new t.Title and returns the pointer to it.
func (t *ToplistDefinition) SetTitle(v string) {
t.Title = &v
}
// GetTitleAlign returns the TitleAlign field if non-nil, zero value otherwise.
func (t *ToplistDefinition) GetTitleAlign() string {
if t == nil || t.TitleAlign == nil {
return ""
}
return *t.TitleAlign
}
// GetTitleAlignOk returns a tuple with the TitleAlign field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (t *ToplistDefinition) GetTitleAlignOk() (string, bool) {
if t == nil || t.TitleAlign == nil {
return "", false
}
return *t.TitleAlign, true
}
// HasTitleAlign returns a boolean if a field has been set.
func (t *ToplistDefinition) HasTitleAlign() bool {
if t != nil && t.TitleAlign != nil {
return true
}
return false
}
// SetTitleAlign allocates a new t.TitleAlign and returns the pointer to it.
func (t *ToplistDefinition) SetTitleAlign(v string) {
t.TitleAlign = &v
}
// GetTitleSize returns the TitleSize field if non-nil, zero value otherwise.
func (t *ToplistDefinition) GetTitleSize() string {
if t == nil || t.TitleSize == nil {
return ""
}
return *t.TitleSize
}
// GetTitleSizeOk returns a tuple with the TitleSize field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (t *ToplistDefinition) GetTitleSizeOk() (string, bool) {
if t == nil || t.TitleSize == nil {
return "", false
}
return *t.TitleSize, true
}
// HasTitleSize returns a boolean if a field has been set.
func (t *ToplistDefinition) HasTitleSize() bool {
if t != nil && t.TitleSize != nil {
return true
}
return false
}
// SetTitleSize allocates a new t.TitleSize and returns the pointer to it.
func (t *ToplistDefinition) SetTitleSize(v string) {
t.TitleSize = &v
}
// GetType returns the Type field if non-nil, zero value otherwise.
func (t *ToplistDefinition) GetType() string {
if t == nil || t.Type == nil {
return ""
}
return *t.Type
}
// GetTypeOk returns a tuple with the Type field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (t *ToplistDefinition) GetTypeOk() (string, bool) {
if t == nil || t.Type == nil {
return "", false
}
return *t.Type, true
}
// HasType returns a boolean if a field has been set.
func (t *ToplistDefinition) HasType() bool {
if t != nil && t.Type != nil {
return true
}
return false
}
// SetType allocates a new t.Type and returns the pointer to it.
func (t *ToplistDefinition) SetType(v string) {
t.Type = &v
}
// GetApmQuery returns the ApmQuery field if non-nil, zero value otherwise.
func (t *ToplistRequest) GetApmQuery() WidgetApmOrLogQuery {
if t == nil || t.ApmQuery == nil {
return WidgetApmOrLogQuery{}
}
return *t.ApmQuery
}
// GetApmQueryOk returns a tuple with the ApmQuery field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (t *ToplistRequest) GetApmQueryOk() (WidgetApmOrLogQuery, bool) {
if t == nil || t.ApmQuery == nil {
return WidgetApmOrLogQuery{}, false
}
return *t.ApmQuery, true
}
// HasApmQuery returns a boolean if a field has been set.
func (t *ToplistRequest) HasApmQuery() bool {
if t != nil && t.ApmQuery != nil {
return true
}
return false
}
// SetApmQuery allocates a new t.ApmQuery and returns the pointer to it.
func (t *ToplistRequest) SetApmQuery(v WidgetApmOrLogQuery) {
t.ApmQuery = &v
}
// GetLogQuery returns the LogQuery field if non-nil, zero value otherwise.
func (t *ToplistRequest) GetLogQuery() WidgetApmOrLogQuery {
if t == nil || t.LogQuery == nil {
return WidgetApmOrLogQuery{}
}
return *t.LogQuery
}
// GetLogQueryOk returns a tuple with the LogQuery field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (t *ToplistRequest) GetLogQueryOk() (WidgetApmOrLogQuery, bool) {
if t == nil || t.LogQuery == nil {
return WidgetApmOrLogQuery{}, false
}
return *t.LogQuery, true
}
// HasLogQuery returns a boolean if a field has been set.
func (t *ToplistRequest) HasLogQuery() bool {
if t != nil && t.LogQuery != nil {
return true
}
return false
}
// SetLogQuery allocates a new t.LogQuery and returns the pointer to it.
func (t *ToplistRequest) SetLogQuery(v WidgetApmOrLogQuery) {
t.LogQuery = &v
}
// GetMetricQuery returns the MetricQuery field if non-nil, zero value otherwise.
func (t *ToplistRequest) GetMetricQuery() string {
if t == nil || t.MetricQuery == nil {
return ""
}
return *t.MetricQuery
}
// GetMetricQueryOk returns a tuple with the MetricQuery field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (t *ToplistRequest) GetMetricQueryOk() (string, bool) {
if t == nil || t.MetricQuery == nil {
return "", false
}
return *t.MetricQuery, true
}
// HasMetricQuery returns a boolean if a field has been set.
func (t *ToplistRequest) HasMetricQuery() bool {
if t != nil && t.MetricQuery != nil {
return true
}
return false
}
// SetMetricQuery allocates a new t.MetricQuery and returns the pointer to it.
func (t *ToplistRequest) SetMetricQuery(v string) {
t.MetricQuery = &v
}
// GetProcessQuery returns the ProcessQuery field if non-nil, zero value otherwise.
func (t *ToplistRequest) GetProcessQuery() WidgetProcessQuery {
if t == nil || t.ProcessQuery == nil {
return WidgetProcessQuery{}
}
return *t.ProcessQuery
}
// GetProcessQueryOk returns a tuple with the ProcessQuery field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (t *ToplistRequest) GetProcessQueryOk() (WidgetProcessQuery, bool) {
if t == nil || t.ProcessQuery == nil {
return WidgetProcessQuery{}, false
}
return *t.ProcessQuery, true
}
// HasProcessQuery returns a boolean if a field has been set.
func (t *ToplistRequest) HasProcessQuery() bool {
if t != nil && t.ProcessQuery != nil {
return true
}
return false
}
// SetProcessQuery allocates a new t.ProcessQuery and returns the pointer to it.
func (t *ToplistRequest) SetProcessQuery(v WidgetProcessQuery) {
t.ProcessQuery = &v
}
// GetStyle returns the Style field if non-nil, zero value otherwise.
func (t *ToplistRequest) GetStyle() WidgetRequestStyle {
if t == nil || t.Style == nil {
return WidgetRequestStyle{}
}
return *t.Style
}
// GetStyleOk returns a tuple with the Style field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (t *ToplistRequest) GetStyleOk() (WidgetRequestStyle, bool) {
if t == nil || t.Style == nil {
return WidgetRequestStyle{}, false
}
return *t.Style, true
}
// HasStyle returns a boolean if a field has been set.
func (t *ToplistRequest) HasStyle() bool {
if t != nil && t.Style != nil {
return true
}
return false
}
// SetStyle allocates a new t.Style and returns the pointer to it.
func (t *ToplistRequest) SetStyle(v WidgetRequestStyle) {
t.Style = &v
}
// GetDisplayFormat returns the DisplayFormat field if non-nil, zero value otherwise.
func (t *TraceServiceDefinition) GetDisplayFormat() string {
if t == nil || t.DisplayFormat == nil {
return ""
}
return *t.DisplayFormat
}
// GetDisplayFormatOk returns a tuple with the DisplayFormat field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (t *TraceServiceDefinition) GetDisplayFormatOk() (string, bool) {
if t == nil || t.DisplayFormat == nil {
return "", false
}
return *t.DisplayFormat, true
}
// HasDisplayFormat returns a boolean if a field has been set.
func (t *TraceServiceDefinition) HasDisplayFormat() bool {
if t != nil && t.DisplayFormat != nil {
return true
}
return false
}
// SetDisplayFormat allocates a new t.DisplayFormat and returns the pointer to it.
func (t *TraceServiceDefinition) SetDisplayFormat(v string) {
t.DisplayFormat = &v
}
// GetEnv returns the Env field if non-nil, zero value otherwise.
func (t *TraceServiceDefinition) GetEnv() string {
if t == nil || t.Env == nil {
return ""
}
return *t.Env
}
// GetEnvOk returns a tuple with the Env field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (t *TraceServiceDefinition) GetEnvOk() (string, bool) {
if t == nil || t.Env == nil {
return "", false
}
return *t.Env, true
}
// HasEnv returns a boolean if a field has been set.
func (t *TraceServiceDefinition) HasEnv() bool {
if t != nil && t.Env != nil {
return true
}
return false
}
// SetEnv allocates a new t.Env and returns the pointer to it.
func (t *TraceServiceDefinition) SetEnv(v string) {
t.Env = &v
}
// GetService returns the Service field if non-nil, zero value otherwise.
func (t *TraceServiceDefinition) GetService() string {
if t == nil || t.Service == nil {
return ""
}
return *t.Service
}
// GetServiceOk returns a tuple with the Service field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (t *TraceServiceDefinition) GetServiceOk() (string, bool) {
if t == nil || t.Service == nil {
return "", false
}
return *t.Service, true
}
// HasService returns a boolean if a field has been set.
func (t *TraceServiceDefinition) HasService() bool {
if t != nil && t.Service != nil {
return true
}
return false
}
// SetService allocates a new t.Service and returns the pointer to it.
func (t *TraceServiceDefinition) SetService(v string) {
t.Service = &v
}
// GetShowBreakdown returns the ShowBreakdown field if non-nil, zero value otherwise.
func (t *TraceServiceDefinition) GetShowBreakdown() bool {
if t == nil || t.ShowBreakdown == nil {
return false
}
return *t.ShowBreakdown
}
// GetShowBreakdownOk returns a tuple with the ShowBreakdown field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (t *TraceServiceDefinition) GetShowBreakdownOk() (bool, bool) {
if t == nil || t.ShowBreakdown == nil {
return false, false
}
return *t.ShowBreakdown, true
}
// HasShowBreakdown returns a boolean if a field has been set.
func (t *TraceServiceDefinition) HasShowBreakdown() bool {
if t != nil && t.ShowBreakdown != nil {
return true
}
return false
}
// SetShowBreakdown allocates a new t.ShowBreakdown and returns the pointer to it.
func (t *TraceServiceDefinition) SetShowBreakdown(v bool) {
t.ShowBreakdown = &v
}
// GetShowDistribution returns the ShowDistribution field if non-nil, zero value otherwise.
func (t *TraceServiceDefinition) GetShowDistribution() bool {
if t == nil || t.ShowDistribution == nil {
return false
}
return *t.ShowDistribution
}
// GetShowDistributionOk returns a tuple with the ShowDistribution field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (t *TraceServiceDefinition) GetShowDistributionOk() (bool, bool) {
if t == nil || t.ShowDistribution == nil {
return false, false
}
return *t.ShowDistribution, true
}
// HasShowDistribution returns a boolean if a field has been set.
func (t *TraceServiceDefinition) HasShowDistribution() bool {
if t != nil && t.ShowDistribution != nil {
return true
}
return false
}
// SetShowDistribution allocates a new t.ShowDistribution and returns the pointer to it.
func (t *TraceServiceDefinition) SetShowDistribution(v bool) {
t.ShowDistribution = &v
}
// GetShowErrors returns the ShowErrors field if non-nil, zero value otherwise.
func (t *TraceServiceDefinition) GetShowErrors() bool {
if t == nil || t.ShowErrors == nil {
return false
}
return *t.ShowErrors
}
// GetShowErrorsOk returns a tuple with the ShowErrors field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (t *TraceServiceDefinition) GetShowErrorsOk() (bool, bool) {
if t == nil || t.ShowErrors == nil {
return false, false
}
return *t.ShowErrors, true
}
// HasShowErrors returns a boolean if a field has been set.
func (t *TraceServiceDefinition) HasShowErrors() bool {
if t != nil && t.ShowErrors != nil {
return true
}
return false
}
// SetShowErrors allocates a new t.ShowErrors and returns the pointer to it.
func (t *TraceServiceDefinition) SetShowErrors(v bool) {
t.ShowErrors = &v
}
// GetShowHits returns the ShowHits field if non-nil, zero value otherwise.
func (t *TraceServiceDefinition) GetShowHits() bool {
if t == nil || t.ShowHits == nil {
return false
}
return *t.ShowHits
}
// GetShowHitsOk returns a tuple with the ShowHits field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (t *TraceServiceDefinition) GetShowHitsOk() (bool, bool) {
if t == nil || t.ShowHits == nil {
return false, false
}
return *t.ShowHits, true
}
// HasShowHits returns a boolean if a field has been set.
func (t *TraceServiceDefinition) HasShowHits() bool {
if t != nil && t.ShowHits != nil {
return true
}
return false
}
// SetShowHits allocates a new t.ShowHits and returns the pointer to it.
func (t *TraceServiceDefinition) SetShowHits(v bool) {
t.ShowHits = &v
}
// GetShowLatency returns the ShowLatency field if non-nil, zero value otherwise.
func (t *TraceServiceDefinition) GetShowLatency() bool {
if t == nil || t.ShowLatency == nil {
return false
}
return *t.ShowLatency
}
// GetShowLatencyOk returns a tuple with the ShowLatency field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (t *TraceServiceDefinition) GetShowLatencyOk() (bool, bool) {
if t == nil || t.ShowLatency == nil {
return false, false
}
return *t.ShowLatency, true
}
// HasShowLatency returns a boolean if a field has been set.
func (t *TraceServiceDefinition) HasShowLatency() bool {
if t != nil && t.ShowLatency != nil {
return true
}
return false
}
// SetShowLatency allocates a new t.ShowLatency and returns the pointer to it.
func (t *TraceServiceDefinition) SetShowLatency(v bool) {
t.ShowLatency = &v
}
// GetShowResourceList returns the ShowResourceList field if non-nil, zero value otherwise.
func (t *TraceServiceDefinition) GetShowResourceList() bool {
if t == nil || t.ShowResourceList == nil {
return false
}
return *t.ShowResourceList
}
// GetShowResourceListOk returns a tuple with the ShowResourceList field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (t *TraceServiceDefinition) GetShowResourceListOk() (bool, bool) {
if t == nil || t.ShowResourceList == nil {
return false, false
}
return *t.ShowResourceList, true
}
// HasShowResourceList returns a boolean if a field has been set.
func (t *TraceServiceDefinition) HasShowResourceList() bool {
if t != nil && t.ShowResourceList != nil {
return true
}
return false
}
// SetShowResourceList allocates a new t.ShowResourceList and returns the pointer to it.
func (t *TraceServiceDefinition) SetShowResourceList(v bool) {
t.ShowResourceList = &v
}
// GetSizeFormat returns the SizeFormat field if non-nil, zero value otherwise.
func (t *TraceServiceDefinition) GetSizeFormat() string {
if t == nil || t.SizeFormat == nil {
return ""
}
return *t.SizeFormat
}
// GetSizeFormatOk returns a tuple with the SizeFormat field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (t *TraceServiceDefinition) GetSizeFormatOk() (string, bool) {
if t == nil || t.SizeFormat == nil {
return "", false
}
return *t.SizeFormat, true
}
// HasSizeFormat returns a boolean if a field has been set.
func (t *TraceServiceDefinition) HasSizeFormat() bool {
if t != nil && t.SizeFormat != nil {
return true
}
return false
}
// SetSizeFormat allocates a new t.SizeFormat and returns the pointer to it.
func (t *TraceServiceDefinition) SetSizeFormat(v string) {
t.SizeFormat = &v
}
// GetSpanName returns the SpanName field if non-nil, zero value otherwise.
func (t *TraceServiceDefinition) GetSpanName() string {
if t == nil || t.SpanName == nil {
return ""
}
return *t.SpanName
}
// GetSpanNameOk returns a tuple with the SpanName field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (t *TraceServiceDefinition) GetSpanNameOk() (string, bool) {
if t == nil || t.SpanName == nil {
return "", false
}
return *t.SpanName, true
}
// HasSpanName returns a boolean if a field has been set.
func (t *TraceServiceDefinition) HasSpanName() bool {
if t != nil && t.SpanName != nil {
return true
}
return false
}
// SetSpanName allocates a new t.SpanName and returns the pointer to it.
func (t *TraceServiceDefinition) SetSpanName(v string) {
t.SpanName = &v
}
// GetTime returns the Time field if non-nil, zero value otherwise.
func (t *TraceServiceDefinition) GetTime() WidgetTime {
if t == nil || t.Time == nil {
return WidgetTime{}
}
return *t.Time
}
// GetTimeOk returns a tuple with the Time field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (t *TraceServiceDefinition) GetTimeOk() (WidgetTime, bool) {
if t == nil || t.Time == nil {
return WidgetTime{}, false
}
return *t.Time, true
}
// HasTime returns a boolean if a field has been set.
func (t *TraceServiceDefinition) HasTime() bool {
if t != nil && t.Time != nil {
return true
}
return false
}
// SetTime allocates a new t.Time and returns the pointer to it.
func (t *TraceServiceDefinition) SetTime(v WidgetTime) {
t.Time = &v
}
// GetTitle returns the Title field if non-nil, zero value otherwise.
func (t *TraceServiceDefinition) GetTitle() string {
if t == nil || t.Title == nil {
return ""
}
return *t.Title
}
// GetTitleOk returns a tuple with the Title field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (t *TraceServiceDefinition) GetTitleOk() (string, bool) {
if t == nil || t.Title == nil {
return "", false
}
return *t.Title, true
}
// HasTitle returns a boolean if a field has been set.
func (t *TraceServiceDefinition) HasTitle() bool {
if t != nil && t.Title != nil {
return true
}
return false
}
// SetTitle allocates a new t.Title and returns the pointer to it.
func (t *TraceServiceDefinition) SetTitle(v string) {
t.Title = &v
}
// GetTitleAlign returns the TitleAlign field if non-nil, zero value otherwise.
func (t *TraceServiceDefinition) GetTitleAlign() string {
if t == nil || t.TitleAlign == nil {
return ""
}
return *t.TitleAlign
}
// GetTitleAlignOk returns a tuple with the TitleAlign field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (t *TraceServiceDefinition) GetTitleAlignOk() (string, bool) {
if t == nil || t.TitleAlign == nil {
return "", false
}
return *t.TitleAlign, true
}
// HasTitleAlign returns a boolean if a field has been set.
func (t *TraceServiceDefinition) HasTitleAlign() bool {
if t != nil && t.TitleAlign != nil {
return true
}
return false
}
// SetTitleAlign allocates a new t.TitleAlign and returns the pointer to it.
func (t *TraceServiceDefinition) SetTitleAlign(v string) {
t.TitleAlign = &v
}
// GetTitleSize returns the TitleSize field if non-nil, zero value otherwise.
func (t *TraceServiceDefinition) GetTitleSize() string {
if t == nil || t.TitleSize == nil {
return ""
}
return *t.TitleSize
}
// GetTitleSizeOk returns a tuple with the TitleSize field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (t *TraceServiceDefinition) GetTitleSizeOk() (string, bool) {
if t == nil || t.TitleSize == nil {
return "", false
}
return *t.TitleSize, true
}
// HasTitleSize returns a boolean if a field has been set.
func (t *TraceServiceDefinition) HasTitleSize() bool {
if t != nil && t.TitleSize != nil {
return true
}
return false
}
// SetTitleSize allocates a new t.TitleSize and returns the pointer to it.
func (t *TraceServiceDefinition) SetTitleSize(v string) {
t.TitleSize = &v
}
// GetType returns the Type field if non-nil, zero value otherwise.
func (t *TraceServiceDefinition) GetType() string {
if t == nil || t.Type == nil {
return ""
}
return *t.Type
}
// GetTypeOk returns a tuple with the Type field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (t *TraceServiceDefinition) GetTypeOk() (string, bool) {
if t == nil || t.Type == nil {
return "", false
}
return *t.Type, true
}
// HasType returns a boolean if a field has been set.
func (t *TraceServiceDefinition) HasType() bool {
if t != nil && t.Type != nil {
return true
}
return false
}
// SetType allocates a new t.Type and returns the pointer to it.
func (t *TraceServiceDefinition) SetType(v string) {
t.Type = &v
}
// GetFromTs returns the FromTs field if non-nil, zero value otherwise.
func (t *TriggeringValue) GetFromTs() int {
if t == nil || t.FromTs == nil {
return 0
}
return *t.FromTs
}
// GetFromTsOk returns a tuple with the FromTs field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (t *TriggeringValue) GetFromTsOk() (int, bool) {
if t == nil || t.FromTs == nil {
return 0, false
}
return *t.FromTs, true
}
// HasFromTs returns a boolean if a field has been set.
func (t *TriggeringValue) HasFromTs() bool {
if t != nil && t.FromTs != nil {
return true
}
return false
}
// SetFromTs allocates a new t.FromTs and returns the pointer to it.
func (t *TriggeringValue) SetFromTs(v int) {
t.FromTs = &v
}
// GetToTs returns the ToTs field if non-nil, zero value otherwise.
func (t *TriggeringValue) GetToTs() int {
if t == nil || t.ToTs == nil {
return 0
}
return *t.ToTs
}
// GetToTsOk returns a tuple with the ToTs field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (t *TriggeringValue) GetToTsOk() (int, bool) {
if t == nil || t.ToTs == nil {
return 0, false
}
return *t.ToTs, true
}
// HasToTs returns a boolean if a field has been set.
func (t *TriggeringValue) HasToTs() bool {
if t != nil && t.ToTs != nil {
return true
}
return false
}
// SetToTs allocates a new t.ToTs and returns the pointer to it.
func (t *TriggeringValue) SetToTs(v int) {
t.ToTs = &v
}
// GetValue returns the Value field if non-nil, zero value otherwise.
func (t *TriggeringValue) GetValue() int {
if t == nil || t.Value == nil {
return 0
}
return *t.Value
}
// GetValueOk returns a tuple with the Value field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (t *TriggeringValue) GetValueOk() (int, bool) {
if t == nil || t.Value == nil {
return 0, false
}
return *t.Value, true
}
// HasValue returns a boolean if a field has been set.
func (t *TriggeringValue) HasValue() bool {
if t != nil && t.Value != nil {
return true
}
return false
}
// SetValue allocates a new t.Value and returns the pointer to it.
func (t *TriggeringValue) SetValue(v int) {
t.Value = &v
}
// GetAllScopes returns the AllScopes field if non-nil, zero value otherwise.
func (u *UnmuteMonitorScopes) GetAllScopes() bool {
if u == nil || u.AllScopes == nil {
return false
}
return *u.AllScopes
}
// GetAllScopesOk returns a tuple with the AllScopes field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (u *UnmuteMonitorScopes) GetAllScopesOk() (bool, bool) {
if u == nil || u.AllScopes == nil {
return false, false
}
return *u.AllScopes, true
}
// HasAllScopes returns a boolean if a field has been set.
func (u *UnmuteMonitorScopes) HasAllScopes() bool {
if u != nil && u.AllScopes != nil {
return true
}
return false
}
// SetAllScopes allocates a new u.AllScopes and returns the pointer to it.
func (u *UnmuteMonitorScopes) SetAllScopes(v bool) {
u.AllScopes = &v
}
// GetScope returns the Scope field if non-nil, zero value otherwise.
func (u *UnmuteMonitorScopes) GetScope() string {
if u == nil || u.Scope == nil {
return ""
}
return *u.Scope
}
// GetScopeOk returns a tuple with the Scope field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (u *UnmuteMonitorScopes) GetScopeOk() (string, bool) {
if u == nil || u.Scope == nil {
return "", false
}
return *u.Scope, true
}
// HasScope returns a boolean if a field has been set.
func (u *UnmuteMonitorScopes) HasScope() bool {
if u != nil && u.Scope != nil {
return true
}
return false
}
// SetScope allocates a new u.Scope and returns the pointer to it.
func (u *UnmuteMonitorScopes) SetScope(v string) {
u.Scope = &v
}
// GetNormalizeEndingSlashes returns the NormalizeEndingSlashes field if non-nil, zero value otherwise.
func (u *UrlParser) GetNormalizeEndingSlashes() bool {
if u == nil || u.NormalizeEndingSlashes == nil {
return false
}
return *u.NormalizeEndingSlashes
}
// GetNormalizeEndingSlashesOk returns a tuple with the NormalizeEndingSlashes field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (u *UrlParser) GetNormalizeEndingSlashesOk() (bool, bool) {
if u == nil || u.NormalizeEndingSlashes == nil {
return false, false
}
return *u.NormalizeEndingSlashes, true
}
// HasNormalizeEndingSlashes returns a boolean if a field has been set.
func (u *UrlParser) HasNormalizeEndingSlashes() bool {
if u != nil && u.NormalizeEndingSlashes != nil {
return true
}
return false
}
// SetNormalizeEndingSlashes allocates a new u.NormalizeEndingSlashes and returns the pointer to it.
func (u *UrlParser) SetNormalizeEndingSlashes(v bool) {
u.NormalizeEndingSlashes = &v
}
// GetTarget returns the Target field if non-nil, zero value otherwise.
func (u *UrlParser) GetTarget() string {
if u == nil || u.Target == nil {
return ""
}
return *u.Target
}
// GetTargetOk returns a tuple with the Target field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (u *UrlParser) GetTargetOk() (string, bool) {
if u == nil || u.Target == nil {
return "", false
}
return *u.Target, true
}
// HasTarget returns a boolean if a field has been set.
func (u *UrlParser) HasTarget() bool {
if u != nil && u.Target != nil {
return true
}
return false
}
// SetTarget allocates a new u.Target and returns the pointer to it.
func (u *UrlParser) SetTarget(v string) {
u.Target = &v
}
// GetAccessRole returns the AccessRole field if non-nil, zero value otherwise.
func (u *User) GetAccessRole() string {
if u == nil || u.AccessRole == nil {
return ""
}
return *u.AccessRole
}
// GetAccessRoleOk returns a tuple with the AccessRole field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (u *User) GetAccessRoleOk() (string, bool) {
if u == nil || u.AccessRole == nil {
return "", false
}
return *u.AccessRole, true
}
// HasAccessRole returns a boolean if a field has been set.
func (u *User) HasAccessRole() bool {
if u != nil && u.AccessRole != nil {
return true
}
return false
}
// SetAccessRole allocates a new u.AccessRole and returns the pointer to it.
func (u *User) SetAccessRole(v string) {
u.AccessRole = &v
}
// GetDisabled returns the Disabled field if non-nil, zero value otherwise.
func (u *User) GetDisabled() bool {
if u == nil || u.Disabled == nil {
return false
}
return *u.Disabled
}
// GetDisabledOk returns a tuple with the Disabled field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (u *User) GetDisabledOk() (bool, bool) {
if u == nil || u.Disabled == nil {
return false, false
}
return *u.Disabled, true
}
// HasDisabled returns a boolean if a field has been set.
func (u *User) HasDisabled() bool {
if u != nil && u.Disabled != nil {
return true
}
return false
}
// SetDisabled allocates a new u.Disabled and returns the pointer to it.
func (u *User) SetDisabled(v bool) {
u.Disabled = &v
}
// GetEmail returns the Email field if non-nil, zero value otherwise.
func (u *User) GetEmail() string {
if u == nil || u.Email == nil {
return ""
}
return *u.Email
}
// GetEmailOk returns a tuple with the Email field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (u *User) GetEmailOk() (string, bool) {
if u == nil || u.Email == nil {
return "", false
}
return *u.Email, true
}
// HasEmail returns a boolean if a field has been set.
func (u *User) HasEmail() bool {
if u != nil && u.Email != nil {
return true
}
return false
}
// SetEmail allocates a new u.Email and returns the pointer to it.
func (u *User) SetEmail(v string) {
u.Email = &v
}
// GetHandle returns the Handle field if non-nil, zero value otherwise.
func (u *User) GetHandle() string {
if u == nil || u.Handle == nil {
return ""
}
return *u.Handle
}
// GetHandleOk returns a tuple with the Handle field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (u *User) GetHandleOk() (string, bool) {
if u == nil || u.Handle == nil {
return "", false
}
return *u.Handle, true
}
// HasHandle returns a boolean if a field has been set.
func (u *User) HasHandle() bool {
if u != nil && u.Handle != nil {
return true
}
return false
}
// SetHandle allocates a new u.Handle and returns the pointer to it.
func (u *User) SetHandle(v string) {
u.Handle = &v
}
// GetIsAdmin returns the IsAdmin field if non-nil, zero value otherwise.
func (u *User) GetIsAdmin() bool {
if u == nil || u.IsAdmin == nil {
return false
}
return *u.IsAdmin
}
// GetIsAdminOk returns a tuple with the IsAdmin field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (u *User) GetIsAdminOk() (bool, bool) {
if u == nil || u.IsAdmin == nil {
return false, false
}
return *u.IsAdmin, true
}
// HasIsAdmin returns a boolean if a field has been set.
func (u *User) HasIsAdmin() bool {
if u != nil && u.IsAdmin != nil {
return true
}
return false
}
// SetIsAdmin allocates a new u.IsAdmin and returns the pointer to it.
func (u *User) SetIsAdmin(v bool) {
u.IsAdmin = &v
}
// GetName returns the Name field if non-nil, zero value otherwise.
func (u *User) GetName() string {
if u == nil || u.Name == nil {
return ""
}
return *u.Name
}
// GetNameOk returns a tuple with the Name field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (u *User) GetNameOk() (string, bool) {
if u == nil || u.Name == nil {
return "", false
}
return *u.Name, true
}
// HasName returns a boolean if a field has been set.
func (u *User) HasName() bool {
if u != nil && u.Name != nil {
return true
}
return false
}
// SetName allocates a new u.Name and returns the pointer to it.
func (u *User) SetName(v string) {
u.Name = &v
}
// GetRole returns the Role field if non-nil, zero value otherwise.
func (u *User) GetRole() string {
if u == nil || u.Role == nil {
return ""
}
return *u.Role
}
// GetRoleOk returns a tuple with the Role field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (u *User) GetRoleOk() (string, bool) {
if u == nil || u.Role == nil {
return "", false
}
return *u.Role, true
}
// HasRole returns a boolean if a field has been set.
func (u *User) HasRole() bool {
if u != nil && u.Role != nil {
return true
}
return false
}
// SetRole allocates a new u.Role and returns the pointer to it.
func (u *User) SetRole(v string) {
u.Role = &v
}
// GetVerified returns the Verified field if non-nil, zero value otherwise.
func (u *User) GetVerified() bool {
if u == nil || u.Verified == nil {
return false
}
return *u.Verified
}
// GetVerifiedOk returns a tuple with the Verified field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (u *User) GetVerifiedOk() (bool, bool) {
if u == nil || u.Verified == nil {
return false, false
}
return *u.Verified, true
}
// HasVerified returns a boolean if a field has been set.
func (u *User) HasVerified() bool {
if u != nil && u.Verified != nil {
return true
}
return false
}
// SetVerified allocates a new u.Verified and returns the pointer to it.
func (u *User) SetVerified(v bool) {
u.Verified = &v
}
// GetIsEncoded returns the IsEncoded field if non-nil, zero value otherwise.
func (u *UserAgentParser) GetIsEncoded() bool {
if u == nil || u.IsEncoded == nil {
return false
}
return *u.IsEncoded
}
// GetIsEncodedOk returns a tuple with the IsEncoded field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (u *UserAgentParser) GetIsEncodedOk() (bool, bool) {
if u == nil || u.IsEncoded == nil {
return false, false
}
return *u.IsEncoded, true
}
// HasIsEncoded returns a boolean if a field has been set.
func (u *UserAgentParser) HasIsEncoded() bool {
if u != nil && u.IsEncoded != nil {
return true
}
return false
}
// SetIsEncoded allocates a new u.IsEncoded and returns the pointer to it.
func (u *UserAgentParser) SetIsEncoded(v bool) {
u.IsEncoded = &v
}
// GetTarget returns the Target field if non-nil, zero value otherwise.
func (u *UserAgentParser) GetTarget() string {
if u == nil || u.Target == nil {
return ""
}
return *u.Target
}
// GetTargetOk returns a tuple with the Target field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (u *UserAgentParser) GetTargetOk() (string, bool) {
if u == nil || u.Target == nil {
return "", false
}
return *u.Target, true
}
// HasTarget returns a boolean if a field has been set.
func (u *UserAgentParser) HasTarget() bool {
if u != nil && u.Target != nil {
return true
}
return false
}
// SetTarget allocates a new u.Target and returns the pointer to it.
func (u *UserAgentParser) SetTarget(v string) {
u.Target = &v
}
// GetAlertID returns the AlertID field if non-nil, zero value otherwise.
func (w *Widget) GetAlertID() int {
if w == nil || w.AlertID == nil {
return 0
}
return *w.AlertID
}
// GetAlertIDOk returns a tuple with the AlertID field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (w *Widget) GetAlertIDOk() (int, bool) {
if w == nil || w.AlertID == nil {
return 0, false
}
return *w.AlertID, true
}
// HasAlertID returns a boolean if a field has been set.
func (w *Widget) HasAlertID() bool {
if w != nil && w.AlertID != nil {
return true
}
return false
}
// SetAlertID allocates a new w.AlertID and returns the pointer to it.
func (w *Widget) SetAlertID(v int) {
w.AlertID = &v
}
// GetAutoRefresh returns the AutoRefresh field if non-nil, zero value otherwise.
func (w *Widget) GetAutoRefresh() bool {
if w == nil || w.AutoRefresh == nil {
return false
}
return *w.AutoRefresh
}
// GetAutoRefreshOk returns a tuple with the AutoRefresh field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (w *Widget) GetAutoRefreshOk() (bool, bool) {
if w == nil || w.AutoRefresh == nil {
return false, false
}
return *w.AutoRefresh, true
}
// HasAutoRefresh returns a boolean if a field has been set.
func (w *Widget) HasAutoRefresh() bool {
if w != nil && w.AutoRefresh != nil {
return true
}
return false
}
// SetAutoRefresh allocates a new w.AutoRefresh and returns the pointer to it.
func (w *Widget) SetAutoRefresh(v bool) {
w.AutoRefresh = &v
}
// GetBgcolor returns the Bgcolor field if non-nil, zero value otherwise.
func (w *Widget) GetBgcolor() string {
if w == nil || w.Bgcolor == nil {
return ""
}
return *w.Bgcolor
}
// GetBgcolorOk returns a tuple with the Bgcolor field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (w *Widget) GetBgcolorOk() (string, bool) {
if w == nil || w.Bgcolor == nil {
return "", false
}
return *w.Bgcolor, true
}
// HasBgcolor returns a boolean if a field has been set.
func (w *Widget) HasBgcolor() bool {
if w != nil && w.Bgcolor != nil {
return true
}
return false
}
// SetBgcolor allocates a new w.Bgcolor and returns the pointer to it.
func (w *Widget) SetBgcolor(v string) {
w.Bgcolor = &v
}
// GetCheck returns the Check field if non-nil, zero value otherwise.
func (w *Widget) GetCheck() string {
if w == nil || w.Check == nil {
return ""
}
return *w.Check
}
// GetCheckOk returns a tuple with the Check field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (w *Widget) GetCheckOk() (string, bool) {
if w == nil || w.Check == nil {
return "", false
}
return *w.Check, true
}
// HasCheck returns a boolean if a field has been set.
func (w *Widget) HasCheck() bool {
if w != nil && w.Check != nil {
return true
}
return false
}
// SetCheck allocates a new w.Check and returns the pointer to it.
func (w *Widget) SetCheck(v string) {
w.Check = &v
}
// GetColor returns the Color field if non-nil, zero value otherwise.
func (w *Widget) GetColor() string {
if w == nil || w.Color == nil {
return ""
}
return *w.Color
}
// GetColorOk returns a tuple with the Color field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (w *Widget) GetColorOk() (string, bool) {
if w == nil || w.Color == nil {
return "", false
}
return *w.Color, true
}
// HasColor returns a boolean if a field has been set.
func (w *Widget) HasColor() bool {
if w != nil && w.Color != nil {
return true
}
return false
}
// SetColor allocates a new w.Color and returns the pointer to it.
func (w *Widget) SetColor(v string) {
w.Color = &v
}
// GetColorPreference returns the ColorPreference field if non-nil, zero value otherwise.
func (w *Widget) GetColorPreference() string {
if w == nil || w.ColorPreference == nil {
return ""
}
return *w.ColorPreference
}
// GetColorPreferenceOk returns a tuple with the ColorPreference field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (w *Widget) GetColorPreferenceOk() (string, bool) {
if w == nil || w.ColorPreference == nil {
return "", false
}
return *w.ColorPreference, true
}
// HasColorPreference returns a boolean if a field has been set.
func (w *Widget) HasColorPreference() bool {
if w != nil && w.ColorPreference != nil {
return true
}
return false
}
// SetColorPreference allocates a new w.ColorPreference and returns the pointer to it.
func (w *Widget) SetColorPreference(v string) {
w.ColorPreference = &v
}
// GetColumns returns the Columns field if non-nil, zero value otherwise.
func (w *Widget) GetColumns() string {
if w == nil || w.Columns == nil {
return ""
}
return *w.Columns
}
// GetColumnsOk returns a tuple with the Columns field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (w *Widget) GetColumnsOk() (string, bool) {
if w == nil || w.Columns == nil {
return "", false
}
return *w.Columns, true
}
// HasColumns returns a boolean if a field has been set.
func (w *Widget) HasColumns() bool {
if w != nil && w.Columns != nil {
return true
}
return false
}
// SetColumns allocates a new w.Columns and returns the pointer to it.
func (w *Widget) SetColumns(v string) {
w.Columns = &v
}
// GetDisplayFormat returns the DisplayFormat field if non-nil, zero value otherwise.
func (w *Widget) GetDisplayFormat() string {
if w == nil || w.DisplayFormat == nil {
return ""
}
return *w.DisplayFormat
}
// GetDisplayFormatOk returns a tuple with the DisplayFormat field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (w *Widget) GetDisplayFormatOk() (string, bool) {
if w == nil || w.DisplayFormat == nil {
return "", false
}
return *w.DisplayFormat, true
}
// HasDisplayFormat returns a boolean if a field has been set.
func (w *Widget) HasDisplayFormat() bool {
if w != nil && w.DisplayFormat != nil {
return true
}
return false
}
// SetDisplayFormat allocates a new w.DisplayFormat and returns the pointer to it.
func (w *Widget) SetDisplayFormat(v string) {
w.DisplayFormat = &v
}
// GetEnv returns the Env field if non-nil, zero value otherwise.
func (w *Widget) GetEnv() string {
if w == nil || w.Env == nil {
return ""
}
return *w.Env
}
// GetEnvOk returns a tuple with the Env field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (w *Widget) GetEnvOk() (string, bool) {
if w == nil || w.Env == nil {
return "", false
}
return *w.Env, true
}
// HasEnv returns a boolean if a field has been set.
func (w *Widget) HasEnv() bool {
if w != nil && w.Env != nil {
return true
}
return false
}
// SetEnv allocates a new w.Env and returns the pointer to it.
func (w *Widget) SetEnv(v string) {
w.Env = &v
}
// GetEventSize returns the EventSize field if non-nil, zero value otherwise.
func (w *Widget) GetEventSize() string {
if w == nil || w.EventSize == nil {
return ""
}
return *w.EventSize
}
// GetEventSizeOk returns a tuple with the EventSize field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (w *Widget) GetEventSizeOk() (string, bool) {
if w == nil || w.EventSize == nil {
return "", false
}
return *w.EventSize, true
}
// HasEventSize returns a boolean if a field has been set.
func (w *Widget) HasEventSize() bool {
if w != nil && w.EventSize != nil {
return true
}
return false
}
// SetEventSize allocates a new w.EventSize and returns the pointer to it.
func (w *Widget) SetEventSize(v string) {
w.EventSize = &v
}
// GetFontSize returns the FontSize field if non-nil, zero value otherwise.
func (w *Widget) GetFontSize() string {
if w == nil || w.FontSize == nil {
return ""
}
return *w.FontSize
}
// GetFontSizeOk returns a tuple with the FontSize field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (w *Widget) GetFontSizeOk() (string, bool) {
if w == nil || w.FontSize == nil {
return "", false
}
return *w.FontSize, true
}
// HasFontSize returns a boolean if a field has been set.
func (w *Widget) HasFontSize() bool {
if w != nil && w.FontSize != nil {
return true
}
return false
}
// SetFontSize allocates a new w.FontSize and returns the pointer to it.
func (w *Widget) SetFontSize(v string) {
w.FontSize = &v
}
// GetGroup returns the Group field if non-nil, zero value otherwise.
func (w *Widget) GetGroup() string {
if w == nil || w.Group == nil {
return ""
}
return *w.Group
}
// GetGroupOk returns a tuple with the Group field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (w *Widget) GetGroupOk() (string, bool) {
if w == nil || w.Group == nil {
return "", false
}
return *w.Group, true
}
// HasGroup returns a boolean if a field has been set.
func (w *Widget) HasGroup() bool {
if w != nil && w.Group != nil {
return true
}
return false
}
// SetGroup allocates a new w.Group and returns the pointer to it.
func (w *Widget) SetGroup(v string) {
w.Group = &v
}
// GetGrouping returns the Grouping field if non-nil, zero value otherwise.
func (w *Widget) GetGrouping() string {
if w == nil || w.Grouping == nil {
return ""
}
return *w.Grouping
}
// GetGroupingOk returns a tuple with the Grouping field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (w *Widget) GetGroupingOk() (string, bool) {
if w == nil || w.Grouping == nil {
return "", false
}
return *w.Grouping, true
}
// HasGrouping returns a boolean if a field has been set.
func (w *Widget) HasGrouping() bool {
if w != nil && w.Grouping != nil {
return true
}
return false
}
// SetGrouping allocates a new w.Grouping and returns the pointer to it.
func (w *Widget) SetGrouping(v string) {
w.Grouping = &v
}
// GetHeight returns the Height field if non-nil, zero value otherwise.
func (w *Widget) GetHeight() int {
if w == nil || w.Height == nil {
return 0
}
return *w.Height
}
// GetHeightOk returns a tuple with the Height field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (w *Widget) GetHeightOk() (int, bool) {
if w == nil || w.Height == nil {
return 0, false
}
return *w.Height, true
}
// HasHeight returns a boolean if a field has been set.
func (w *Widget) HasHeight() bool {
if w != nil && w.Height != nil {
return true
}
return false
}
// SetHeight allocates a new w.Height and returns the pointer to it.
func (w *Widget) SetHeight(v int) {
w.Height = &v
}
// GetHideZeroCounts returns the HideZeroCounts field if non-nil, zero value otherwise.
func (w *Widget) GetHideZeroCounts() bool {
if w == nil || w.HideZeroCounts == nil {
return false
}
return *w.HideZeroCounts
}
// GetHideZeroCountsOk returns a tuple with the HideZeroCounts field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (w *Widget) GetHideZeroCountsOk() (bool, bool) {
if w == nil || w.HideZeroCounts == nil {
return false, false
}
return *w.HideZeroCounts, true
}
// HasHideZeroCounts returns a boolean if a field has been set.
func (w *Widget) HasHideZeroCounts() bool {
if w != nil && w.HideZeroCounts != nil {
return true
}
return false
}
// SetHideZeroCounts allocates a new w.HideZeroCounts and returns the pointer to it.
func (w *Widget) SetHideZeroCounts(v bool) {
w.HideZeroCounts = &v
}
// GetHTML returns the HTML field if non-nil, zero value otherwise.
func (w *Widget) GetHTML() string {
if w == nil || w.HTML == nil {
return ""
}
return *w.HTML
}
// GetHTMLOk returns a tuple with the HTML field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (w *Widget) GetHTMLOk() (string, bool) {
if w == nil || w.HTML == nil {
return "", false
}
return *w.HTML, true
}
// HasHTML returns a boolean if a field has been set.
func (w *Widget) HasHTML() bool {
if w != nil && w.HTML != nil {
return true
}
return false
}
// SetHTML allocates a new w.HTML and returns the pointer to it.
func (w *Widget) SetHTML(v string) {
w.HTML = &v
}
// GetLayoutVersion returns the LayoutVersion field if non-nil, zero value otherwise.
func (w *Widget) GetLayoutVersion() string {
if w == nil || w.LayoutVersion == nil {
return ""
}
return *w.LayoutVersion
}
// GetLayoutVersionOk returns a tuple with the LayoutVersion field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (w *Widget) GetLayoutVersionOk() (string, bool) {
if w == nil || w.LayoutVersion == nil {
return "", false
}
return *w.LayoutVersion, true
}
// HasLayoutVersion returns a boolean if a field has been set.
func (w *Widget) HasLayoutVersion() bool {
if w != nil && w.LayoutVersion != nil {
return true
}
return false
}
// SetLayoutVersion allocates a new w.LayoutVersion and returns the pointer to it.
func (w *Widget) SetLayoutVersion(v string) {
w.LayoutVersion = &v
}
// GetLegend returns the Legend field if non-nil, zero value otherwise.
func (w *Widget) GetLegend() bool {
if w == nil || w.Legend == nil {
return false
}
return *w.Legend
}
// GetLegendOk returns a tuple with the Legend field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (w *Widget) GetLegendOk() (bool, bool) {
if w == nil || w.Legend == nil {
return false, false
}
return *w.Legend, true
}
// HasLegend returns a boolean if a field has been set.
func (w *Widget) HasLegend() bool {
if w != nil && w.Legend != nil {
return true
}
return false
}
// SetLegend allocates a new w.Legend and returns the pointer to it.
func (w *Widget) SetLegend(v bool) {
w.Legend = &v
}
// GetLegendSize returns the LegendSize field if non-nil, zero value otherwise.
func (w *Widget) GetLegendSize() string {
if w == nil || w.LegendSize == nil {
return ""
}
return *w.LegendSize
}
// GetLegendSizeOk returns a tuple with the LegendSize field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (w *Widget) GetLegendSizeOk() (string, bool) {
if w == nil || w.LegendSize == nil {
return "", false
}
return *w.LegendSize, true
}
// HasLegendSize returns a boolean if a field has been set.
func (w *Widget) HasLegendSize() bool {
if w != nil && w.LegendSize != nil {
return true
}
return false
}
// SetLegendSize allocates a new w.LegendSize and returns the pointer to it.
func (w *Widget) SetLegendSize(v string) {
w.LegendSize = &v
}
// GetLogset returns the Logset field if non-nil, zero value otherwise.
func (w *Widget) GetLogset() string {
if w == nil || w.Logset == nil {
return ""
}
return *w.Logset
}
// GetLogsetOk returns a tuple with the Logset field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (w *Widget) GetLogsetOk() (string, bool) {
if w == nil || w.Logset == nil {
return "", false
}
return *w.Logset, true
}
// HasLogset returns a boolean if a field has been set.
func (w *Widget) HasLogset() bool {
if w != nil && w.Logset != nil {
return true
}
return false
}
// SetLogset allocates a new w.Logset and returns the pointer to it.
func (w *Widget) SetLogset(v string) {
w.Logset = &v
}
// GetManageStatusShowTitle returns the ManageStatusShowTitle field if non-nil, zero value otherwise.
func (w *Widget) GetManageStatusShowTitle() bool {
if w == nil || w.ManageStatusShowTitle == nil {
return false
}
return *w.ManageStatusShowTitle
}
// GetManageStatusShowTitleOk returns a tuple with the ManageStatusShowTitle field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (w *Widget) GetManageStatusShowTitleOk() (bool, bool) {
if w == nil || w.ManageStatusShowTitle == nil {
return false, false
}
return *w.ManageStatusShowTitle, true
}
// HasManageStatusShowTitle returns a boolean if a field has been set.
func (w *Widget) HasManageStatusShowTitle() bool {
if w != nil && w.ManageStatusShowTitle != nil {
return true
}
return false
}
// SetManageStatusShowTitle allocates a new w.ManageStatusShowTitle and returns the pointer to it.
func (w *Widget) SetManageStatusShowTitle(v bool) {
w.ManageStatusShowTitle = &v
}
// GetManageStatusTitleAlign returns the ManageStatusTitleAlign field if non-nil, zero value otherwise.
func (w *Widget) GetManageStatusTitleAlign() string {
if w == nil || w.ManageStatusTitleAlign == nil {
return ""
}
return *w.ManageStatusTitleAlign
}
// GetManageStatusTitleAlignOk returns a tuple with the ManageStatusTitleAlign field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (w *Widget) GetManageStatusTitleAlignOk() (string, bool) {
if w == nil || w.ManageStatusTitleAlign == nil {
return "", false
}
return *w.ManageStatusTitleAlign, true
}
// HasManageStatusTitleAlign returns a boolean if a field has been set.
func (w *Widget) HasManageStatusTitleAlign() bool {
if w != nil && w.ManageStatusTitleAlign != nil {
return true
}
return false
}
// SetManageStatusTitleAlign allocates a new w.ManageStatusTitleAlign and returns the pointer to it.
func (w *Widget) SetManageStatusTitleAlign(v string) {
w.ManageStatusTitleAlign = &v
}
// GetManageStatusTitleSize returns the ManageStatusTitleSize field if non-nil, zero value otherwise.
func (w *Widget) GetManageStatusTitleSize() string {
if w == nil || w.ManageStatusTitleSize == nil {
return ""
}
return *w.ManageStatusTitleSize
}
// GetManageStatusTitleSizeOk returns a tuple with the ManageStatusTitleSize field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (w *Widget) GetManageStatusTitleSizeOk() (string, bool) {
if w == nil || w.ManageStatusTitleSize == nil {
return "", false
}
return *w.ManageStatusTitleSize, true
}
// HasManageStatusTitleSize returns a boolean if a field has been set.
func (w *Widget) HasManageStatusTitleSize() bool {
if w != nil && w.ManageStatusTitleSize != nil {
return true
}
return false
}
// SetManageStatusTitleSize allocates a new w.ManageStatusTitleSize and returns the pointer to it.
func (w *Widget) SetManageStatusTitleSize(v string) {
w.ManageStatusTitleSize = &v
}
// GetManageStatusTitleText returns the ManageStatusTitleText field if non-nil, zero value otherwise.
func (w *Widget) GetManageStatusTitleText() string {
if w == nil || w.ManageStatusTitleText == nil {
return ""
}
return *w.ManageStatusTitleText
}
// GetManageStatusTitleTextOk returns a tuple with the ManageStatusTitleText field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (w *Widget) GetManageStatusTitleTextOk() (string, bool) {
if w == nil || w.ManageStatusTitleText == nil {
return "", false
}
return *w.ManageStatusTitleText, true
}
// HasManageStatusTitleText returns a boolean if a field has been set.
func (w *Widget) HasManageStatusTitleText() bool {
if w != nil && w.ManageStatusTitleText != nil {
return true
}
return false
}
// SetManageStatusTitleText allocates a new w.ManageStatusTitleText and returns the pointer to it.
func (w *Widget) SetManageStatusTitleText(v string) {
w.ManageStatusTitleText = &v
}
// GetMargin returns the Margin field if non-nil, zero value otherwise.
func (w *Widget) GetMargin() string {
if w == nil || w.Margin == nil {
return ""
}
return *w.Margin
}
// GetMarginOk returns a tuple with the Margin field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (w *Widget) GetMarginOk() (string, bool) {
if w == nil || w.Margin == nil {
return "", false
}
return *w.Margin, true
}
// HasMargin returns a boolean if a field has been set.
func (w *Widget) HasMargin() bool {
if w != nil && w.Margin != nil {
return true
}
return false
}
// SetMargin allocates a new w.Margin and returns the pointer to it.
func (w *Widget) SetMargin(v string) {
w.Margin = &v
}
// GetMonitor returns the Monitor field if non-nil, zero value otherwise.
func (w *Widget) GetMonitor() ScreenboardMonitor {
if w == nil || w.Monitor == nil {
return ScreenboardMonitor{}
}
return *w.Monitor
}
// GetMonitorOk returns a tuple with the Monitor field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (w *Widget) GetMonitorOk() (ScreenboardMonitor, bool) {
if w == nil || w.Monitor == nil {
return ScreenboardMonitor{}, false
}
return *w.Monitor, true
}
// HasMonitor returns a boolean if a field has been set.
func (w *Widget) HasMonitor() bool {
if w != nil && w.Monitor != nil {
return true
}
return false
}
// SetMonitor allocates a new w.Monitor and returns the pointer to it.
func (w *Widget) SetMonitor(v ScreenboardMonitor) {
w.Monitor = &v
}
// GetMustShowBreakdown returns the MustShowBreakdown field if non-nil, zero value otherwise.
func (w *Widget) GetMustShowBreakdown() bool {
if w == nil || w.MustShowBreakdown == nil {
return false
}
return *w.MustShowBreakdown
}
// GetMustShowBreakdownOk returns a tuple with the MustShowBreakdown field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (w *Widget) GetMustShowBreakdownOk() (bool, bool) {
if w == nil || w.MustShowBreakdown == nil {
return false, false
}
return *w.MustShowBreakdown, true
}
// HasMustShowBreakdown returns a boolean if a field has been set.
func (w *Widget) HasMustShowBreakdown() bool {
if w != nil && w.MustShowBreakdown != nil {
return true
}
return false
}
// SetMustShowBreakdown allocates a new w.MustShowBreakdown and returns the pointer to it.
func (w *Widget) SetMustShowBreakdown(v bool) {
w.MustShowBreakdown = &v
}
// GetMustShowDistribution returns the MustShowDistribution field if non-nil, zero value otherwise.
func (w *Widget) GetMustShowDistribution() bool {
if w == nil || w.MustShowDistribution == nil {
return false
}
return *w.MustShowDistribution
}
// GetMustShowDistributionOk returns a tuple with the MustShowDistribution field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (w *Widget) GetMustShowDistributionOk() (bool, bool) {
if w == nil || w.MustShowDistribution == nil {
return false, false
}
return *w.MustShowDistribution, true
}
// HasMustShowDistribution returns a boolean if a field has been set.
func (w *Widget) HasMustShowDistribution() bool {
if w != nil && w.MustShowDistribution != nil {
return true
}
return false
}
// SetMustShowDistribution allocates a new w.MustShowDistribution and returns the pointer to it.
func (w *Widget) SetMustShowDistribution(v bool) {
w.MustShowDistribution = &v
}
// GetMustShowErrors returns the MustShowErrors field if non-nil, zero value otherwise.
func (w *Widget) GetMustShowErrors() bool {
if w == nil || w.MustShowErrors == nil {
return false
}
return *w.MustShowErrors
}
// GetMustShowErrorsOk returns a tuple with the MustShowErrors field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (w *Widget) GetMustShowErrorsOk() (bool, bool) {
if w == nil || w.MustShowErrors == nil {
return false, false
}
return *w.MustShowErrors, true
}
// HasMustShowErrors returns a boolean if a field has been set.
func (w *Widget) HasMustShowErrors() bool {
if w != nil && w.MustShowErrors != nil {
return true
}
return false
}
// SetMustShowErrors allocates a new w.MustShowErrors and returns the pointer to it.
func (w *Widget) SetMustShowErrors(v bool) {
w.MustShowErrors = &v
}
// GetMustShowHits returns the MustShowHits field if non-nil, zero value otherwise.
func (w *Widget) GetMustShowHits() bool {
if w == nil || w.MustShowHits == nil {
return false
}
return *w.MustShowHits
}
// GetMustShowHitsOk returns a tuple with the MustShowHits field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (w *Widget) GetMustShowHitsOk() (bool, bool) {
if w == nil || w.MustShowHits == nil {
return false, false
}
return *w.MustShowHits, true
}
// HasMustShowHits returns a boolean if a field has been set.
func (w *Widget) HasMustShowHits() bool {
if w != nil && w.MustShowHits != nil {
return true
}
return false
}
// SetMustShowHits allocates a new w.MustShowHits and returns the pointer to it.
func (w *Widget) SetMustShowHits(v bool) {
w.MustShowHits = &v
}
// GetMustShowLatency returns the MustShowLatency field if non-nil, zero value otherwise.
func (w *Widget) GetMustShowLatency() bool {
if w == nil || w.MustShowLatency == nil {
return false
}
return *w.MustShowLatency
}
// GetMustShowLatencyOk returns a tuple with the MustShowLatency field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (w *Widget) GetMustShowLatencyOk() (bool, bool) {
if w == nil || w.MustShowLatency == nil {
return false, false
}
return *w.MustShowLatency, true
}
// HasMustShowLatency returns a boolean if a field has been set.
func (w *Widget) HasMustShowLatency() bool {
if w != nil && w.MustShowLatency != nil {
return true
}
return false
}
// SetMustShowLatency allocates a new w.MustShowLatency and returns the pointer to it.
func (w *Widget) SetMustShowLatency(v bool) {
w.MustShowLatency = &v
}
// GetMustShowResourceList returns the MustShowResourceList field if non-nil, zero value otherwise.
func (w *Widget) GetMustShowResourceList() bool {
if w == nil || w.MustShowResourceList == nil {
return false
}
return *w.MustShowResourceList
}
// GetMustShowResourceListOk returns a tuple with the MustShowResourceList field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (w *Widget) GetMustShowResourceListOk() (bool, bool) {
if w == nil || w.MustShowResourceList == nil {
return false, false
}
return *w.MustShowResourceList, true
}
// HasMustShowResourceList returns a boolean if a field has been set.
func (w *Widget) HasMustShowResourceList() bool {
if w != nil && w.MustShowResourceList != nil {
return true
}
return false
}
// SetMustShowResourceList allocates a new w.MustShowResourceList and returns the pointer to it.
func (w *Widget) SetMustShowResourceList(v bool) {
w.MustShowResourceList = &v
}
// GetParams returns the Params field if non-nil, zero value otherwise.
func (w *Widget) GetParams() Params {
if w == nil || w.Params == nil {
return Params{}
}
return *w.Params
}
// GetParamsOk returns a tuple with the Params field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (w *Widget) GetParamsOk() (Params, bool) {
if w == nil || w.Params == nil {
return Params{}, false
}
return *w.Params, true
}
// HasParams returns a boolean if a field has been set.
func (w *Widget) HasParams() bool {
if w != nil && w.Params != nil {
return true
}
return false
}
// SetParams allocates a new w.Params and returns the pointer to it.
func (w *Widget) SetParams(v Params) {
w.Params = &v
}
// GetPrecision returns the Precision field if non-nil, zero value otherwise.
func (w *Widget) GetPrecision() PrecisionT {
if w == nil || w.Precision == nil {
return ""
}
return *w.Precision
}
// GetPrecisionOk returns a tuple with the Precision field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (w *Widget) GetPrecisionOk() (PrecisionT, bool) {
if w == nil || w.Precision == nil {
return "", false
}
return *w.Precision, true
}
// HasPrecision returns a boolean if a field has been set.
func (w *Widget) HasPrecision() bool {
if w != nil && w.Precision != nil {
return true
}
return false
}
// SetPrecision allocates a new w.Precision and returns the pointer to it.
func (w *Widget) SetPrecision(v PrecisionT) {
w.Precision = &v
}
// GetQuery returns the Query field if non-nil, zero value otherwise.
func (w *Widget) GetQuery() string {
if w == nil || w.Query == nil {
return ""
}
return *w.Query
}
// GetQueryOk returns a tuple with the Query field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (w *Widget) GetQueryOk() (string, bool) {
if w == nil || w.Query == nil {
return "", false
}
return *w.Query, true
}
// HasQuery returns a boolean if a field has been set.
func (w *Widget) HasQuery() bool {
if w != nil && w.Query != nil {
return true
}
return false
}
// SetQuery allocates a new w.Query and returns the pointer to it.
func (w *Widget) SetQuery(v string) {
w.Query = &v
}
// GetServiceName returns the ServiceName field if non-nil, zero value otherwise.
func (w *Widget) GetServiceName() string {
if w == nil || w.ServiceName == nil {
return ""
}
return *w.ServiceName
}
// GetServiceNameOk returns a tuple with the ServiceName field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (w *Widget) GetServiceNameOk() (string, bool) {
if w == nil || w.ServiceName == nil {
return "", false
}
return *w.ServiceName, true
}
// HasServiceName returns a boolean if a field has been set.
func (w *Widget) HasServiceName() bool {
if w != nil && w.ServiceName != nil {
return true
}
return false
}
// SetServiceName allocates a new w.ServiceName and returns the pointer to it.
func (w *Widget) SetServiceName(v string) {
w.ServiceName = &v
}
// GetServiceService returns the ServiceService field if non-nil, zero value otherwise.
func (w *Widget) GetServiceService() string {
if w == nil || w.ServiceService == nil {
return ""
}
return *w.ServiceService
}
// GetServiceServiceOk returns a tuple with the ServiceService field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (w *Widget) GetServiceServiceOk() (string, bool) {
if w == nil || w.ServiceService == nil {
return "", false
}
return *w.ServiceService, true
}
// HasServiceService returns a boolean if a field has been set.
func (w *Widget) HasServiceService() bool {
if w != nil && w.ServiceService != nil {
return true
}
return false
}
// SetServiceService allocates a new w.ServiceService and returns the pointer to it.
func (w *Widget) SetServiceService(v string) {
w.ServiceService = &v
}
// GetSizeVersion returns the SizeVersion field if non-nil, zero value otherwise.
func (w *Widget) GetSizeVersion() string {
if w == nil || w.SizeVersion == nil {
return ""
}
return *w.SizeVersion
}
// GetSizeVersionOk returns a tuple with the SizeVersion field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (w *Widget) GetSizeVersionOk() (string, bool) {
if w == nil || w.SizeVersion == nil {
return "", false
}
return *w.SizeVersion, true
}
// HasSizeVersion returns a boolean if a field has been set.
func (w *Widget) HasSizeVersion() bool {
if w != nil && w.SizeVersion != nil {
return true
}
return false
}
// SetSizeVersion allocates a new w.SizeVersion and returns the pointer to it.
func (w *Widget) SetSizeVersion(v string) {
w.SizeVersion = &v
}
// GetSizing returns the Sizing field if non-nil, zero value otherwise.
func (w *Widget) GetSizing() string {
if w == nil || w.Sizing == nil {
return ""
}
return *w.Sizing
}
// GetSizingOk returns a tuple with the Sizing field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (w *Widget) GetSizingOk() (string, bool) {
if w == nil || w.Sizing == nil {
return "", false
}
return *w.Sizing, true
}
// HasSizing returns a boolean if a field has been set.
func (w *Widget) HasSizing() bool {
if w != nil && w.Sizing != nil {
return true
}
return false
}
// SetSizing allocates a new w.Sizing and returns the pointer to it.
func (w *Widget) SetSizing(v string) {
w.Sizing = &v
}
// GetText returns the Text field if non-nil, zero value otherwise.
func (w *Widget) GetText() string {
if w == nil || w.Text == nil {
return ""
}
return *w.Text
}
// GetTextOk returns a tuple with the Text field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (w *Widget) GetTextOk() (string, bool) {
if w == nil || w.Text == nil {
return "", false
}
return *w.Text, true
}
// HasText returns a boolean if a field has been set.
func (w *Widget) HasText() bool {
if w != nil && w.Text != nil {
return true
}
return false
}
// SetText allocates a new w.Text and returns the pointer to it.
func (w *Widget) SetText(v string) {
w.Text = &v
}
// GetTextAlign returns the TextAlign field if non-nil, zero value otherwise.
func (w *Widget) GetTextAlign() string {
if w == nil || w.TextAlign == nil {
return ""
}
return *w.TextAlign
}
// GetTextAlignOk returns a tuple with the TextAlign field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (w *Widget) GetTextAlignOk() (string, bool) {
if w == nil || w.TextAlign == nil {
return "", false
}
return *w.TextAlign, true
}
// HasTextAlign returns a boolean if a field has been set.
func (w *Widget) HasTextAlign() bool {
if w != nil && w.TextAlign != nil {
return true
}
return false
}
// SetTextAlign allocates a new w.TextAlign and returns the pointer to it.
func (w *Widget) SetTextAlign(v string) {
w.TextAlign = &v
}
// GetTextSize returns the TextSize field if non-nil, zero value otherwise.
func (w *Widget) GetTextSize() string {
if w == nil || w.TextSize == nil {
return ""
}
return *w.TextSize
}
// GetTextSizeOk returns a tuple with the TextSize field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (w *Widget) GetTextSizeOk() (string, bool) {
if w == nil || w.TextSize == nil {
return "", false
}
return *w.TextSize, true
}
// HasTextSize returns a boolean if a field has been set.
func (w *Widget) HasTextSize() bool {
if w != nil && w.TextSize != nil {
return true
}
return false
}
// SetTextSize allocates a new w.TextSize and returns the pointer to it.
func (w *Widget) SetTextSize(v string) {
w.TextSize = &v
}
// GetTick returns the Tick field if non-nil, zero value otherwise.
func (w *Widget) GetTick() bool {
if w == nil || w.Tick == nil {
return false
}
return *w.Tick
}
// GetTickOk returns a tuple with the Tick field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (w *Widget) GetTickOk() (bool, bool) {
if w == nil || w.Tick == nil {
return false, false
}
return *w.Tick, true
}
// HasTick returns a boolean if a field has been set.
func (w *Widget) HasTick() bool {
if w != nil && w.Tick != nil {
return true
}
return false
}
// SetTick allocates a new w.Tick and returns the pointer to it.
func (w *Widget) SetTick(v bool) {
w.Tick = &v
}
// GetTickEdge returns the TickEdge field if non-nil, zero value otherwise.
func (w *Widget) GetTickEdge() string {
if w == nil || w.TickEdge == nil {
return ""
}
return *w.TickEdge
}
// GetTickEdgeOk returns a tuple with the TickEdge field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (w *Widget) GetTickEdgeOk() (string, bool) {
if w == nil || w.TickEdge == nil {
return "", false
}
return *w.TickEdge, true
}
// HasTickEdge returns a boolean if a field has been set.
func (w *Widget) HasTickEdge() bool {
if w != nil && w.TickEdge != nil {
return true
}
return false
}
// SetTickEdge allocates a new w.TickEdge and returns the pointer to it.
func (w *Widget) SetTickEdge(v string) {
w.TickEdge = &v
}
// GetTickPos returns the TickPos field if non-nil, zero value otherwise.
func (w *Widget) GetTickPos() string {
if w == nil || w.TickPos == nil {
return ""
}
return *w.TickPos
}
// GetTickPosOk returns a tuple with the TickPos field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (w *Widget) GetTickPosOk() (string, bool) {
if w == nil || w.TickPos == nil {
return "", false
}
return *w.TickPos, true
}
// HasTickPos returns a boolean if a field has been set.
func (w *Widget) HasTickPos() bool {
if w != nil && w.TickPos != nil {
return true
}
return false
}
// SetTickPos allocates a new w.TickPos and returns the pointer to it.
func (w *Widget) SetTickPos(v string) {
w.TickPos = &v
}
// GetTileDef returns the TileDef field if non-nil, zero value otherwise.
func (w *Widget) GetTileDef() TileDef {
if w == nil || w.TileDef == nil {
return TileDef{}
}
return *w.TileDef
}
// GetTileDefOk returns a tuple with the TileDef field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (w *Widget) GetTileDefOk() (TileDef, bool) {
if w == nil || w.TileDef == nil {
return TileDef{}, false
}
return *w.TileDef, true
}
// HasTileDef returns a boolean if a field has been set.
func (w *Widget) HasTileDef() bool {
if w != nil && w.TileDef != nil {
return true
}
return false
}
// SetTileDef allocates a new w.TileDef and returns the pointer to it.
func (w *Widget) SetTileDef(v TileDef) {
w.TileDef = &v
}
// GetTime returns the Time field if non-nil, zero value otherwise.
func (w *Widget) GetTime() Time {
if w == nil || w.Time == nil {
return Time{}
}
return *w.Time
}
// GetTimeOk returns a tuple with the Time field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (w *Widget) GetTimeOk() (Time, bool) {
if w == nil || w.Time == nil {
return Time{}, false
}
return *w.Time, true
}
// HasTime returns a boolean if a field has been set.
func (w *Widget) HasTime() bool {
if w != nil && w.Time != nil {
return true
}
return false
}
// SetTime allocates a new w.Time and returns the pointer to it.
func (w *Widget) SetTime(v Time) {
w.Time = &v
}
// GetTitle returns the Title field if non-nil, zero value otherwise.
func (w *Widget) GetTitle() bool {
if w == nil || w.Title == nil {
return false
}
return *w.Title
}
// GetTitleOk returns a tuple with the Title field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (w *Widget) GetTitleOk() (bool, bool) {
if w == nil || w.Title == nil {
return false, false
}
return *w.Title, true
}
// HasTitle returns a boolean if a field has been set.
func (w *Widget) HasTitle() bool {
if w != nil && w.Title != nil {
return true
}
return false
}
// SetTitle allocates a new w.Title and returns the pointer to it.
func (w *Widget) SetTitle(v bool) {
w.Title = &v
}
// GetTitleAlign returns the TitleAlign field if non-nil, zero value otherwise.
func (w *Widget) GetTitleAlign() string {
if w == nil || w.TitleAlign == nil {
return ""
}
return *w.TitleAlign
}
// GetTitleAlignOk returns a tuple with the TitleAlign field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (w *Widget) GetTitleAlignOk() (string, bool) {
if w == nil || w.TitleAlign == nil {
return "", false
}
return *w.TitleAlign, true
}
// HasTitleAlign returns a boolean if a field has been set.
func (w *Widget) HasTitleAlign() bool {
if w != nil && w.TitleAlign != nil {
return true
}
return false
}
// SetTitleAlign allocates a new w.TitleAlign and returns the pointer to it.
func (w *Widget) SetTitleAlign(v string) {
w.TitleAlign = &v
}
// GetTitleSize returns the TitleSize field if non-nil, zero value otherwise.
func (w *Widget) GetTitleSize() int {
if w == nil || w.TitleSize == nil {
return 0
}
return *w.TitleSize
}
// GetTitleSizeOk returns a tuple with the TitleSize field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (w *Widget) GetTitleSizeOk() (int, bool) {
if w == nil || w.TitleSize == nil {
return 0, false
}
return *w.TitleSize, true
}
// HasTitleSize returns a boolean if a field has been set.
func (w *Widget) HasTitleSize() bool {
if w != nil && w.TitleSize != nil {
return true
}
return false
}
// SetTitleSize allocates a new w.TitleSize and returns the pointer to it.
func (w *Widget) SetTitleSize(v int) {
w.TitleSize = &v
}
// GetTitleText returns the TitleText field if non-nil, zero value otherwise.
func (w *Widget) GetTitleText() string {
if w == nil || w.TitleText == nil {
return ""
}
return *w.TitleText
}
// GetTitleTextOk returns a tuple with the TitleText field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (w *Widget) GetTitleTextOk() (string, bool) {
if w == nil || w.TitleText == nil {
return "", false
}
return *w.TitleText, true
}
// HasTitleText returns a boolean if a field has been set.
func (w *Widget) HasTitleText() bool {
if w != nil && w.TitleText != nil {
return true
}
return false
}
// SetTitleText allocates a new w.TitleText and returns the pointer to it.
func (w *Widget) SetTitleText(v string) {
w.TitleText = &v
}
// GetType returns the Type field if non-nil, zero value otherwise.
func (w *Widget) GetType() string {
if w == nil || w.Type == nil {
return ""
}
return *w.Type
}
// GetTypeOk returns a tuple with the Type field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (w *Widget) GetTypeOk() (string, bool) {
if w == nil || w.Type == nil {
return "", false
}
return *w.Type, true
}
// HasType returns a boolean if a field has been set.
func (w *Widget) HasType() bool {
if w != nil && w.Type != nil {
return true
}
return false
}
// SetType allocates a new w.Type and returns the pointer to it.
func (w *Widget) SetType(v string) {
w.Type = &v
}
// GetUnit returns the Unit field if non-nil, zero value otherwise.
func (w *Widget) GetUnit() string {
if w == nil || w.Unit == nil {
return ""
}
return *w.Unit
}
// GetUnitOk returns a tuple with the Unit field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (w *Widget) GetUnitOk() (string, bool) {
if w == nil || w.Unit == nil {
return "", false
}
return *w.Unit, true
}
// HasUnit returns a boolean if a field has been set.
func (w *Widget) HasUnit() bool {
if w != nil && w.Unit != nil {
return true
}
return false
}
// SetUnit allocates a new w.Unit and returns the pointer to it.
func (w *Widget) SetUnit(v string) {
w.Unit = &v
}
// GetURL returns the URL field if non-nil, zero value otherwise.
func (w *Widget) GetURL() string {
if w == nil || w.URL == nil {
return ""
}
return *w.URL
}
// GetURLOk returns a tuple with the URL field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (w *Widget) GetURLOk() (string, bool) {
if w == nil || w.URL == nil {
return "", false
}
return *w.URL, true
}
// HasURL returns a boolean if a field has been set.
func (w *Widget) HasURL() bool {
if w != nil && w.URL != nil {
return true
}
return false
}
// SetURL allocates a new w.URL and returns the pointer to it.
func (w *Widget) SetURL(v string) {
w.URL = &v
}
// GetVizType returns the VizType field if non-nil, zero value otherwise.
func (w *Widget) GetVizType() string {
if w == nil || w.VizType == nil {
return ""
}
return *w.VizType
}
// GetVizTypeOk returns a tuple with the VizType field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (w *Widget) GetVizTypeOk() (string, bool) {
if w == nil || w.VizType == nil {
return "", false
}
return *w.VizType, true
}
// HasVizType returns a boolean if a field has been set.
func (w *Widget) HasVizType() bool {
if w != nil && w.VizType != nil {
return true
}
return false
}
// SetVizType allocates a new w.VizType and returns the pointer to it.
func (w *Widget) SetVizType(v string) {
w.VizType = &v
}
// GetWidth returns the Width field if non-nil, zero value otherwise.
func (w *Widget) GetWidth() int {
if w == nil || w.Width == nil {
return 0
}
return *w.Width
}
// GetWidthOk returns a tuple with the Width field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (w *Widget) GetWidthOk() (int, bool) {
if w == nil || w.Width == nil {
return 0, false
}
return *w.Width, true
}
// HasWidth returns a boolean if a field has been set.
func (w *Widget) HasWidth() bool {
if w != nil && w.Width != nil {
return true
}
return false
}
// SetWidth allocates a new w.Width and returns the pointer to it.
func (w *Widget) SetWidth(v int) {
w.Width = &v
}
// GetX returns the X field if non-nil, zero value otherwise.
func (w *Widget) GetX() int {
if w == nil || w.X == nil {
return 0
}
return *w.X
}
// GetXOk returns a tuple with the X field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (w *Widget) GetXOk() (int, bool) {
if w == nil || w.X == nil {
return 0, false
}
return *w.X, true
}
// HasX returns a boolean if a field has been set.
func (w *Widget) HasX() bool {
if w != nil && w.X != nil {
return true
}
return false
}
// SetX allocates a new w.X and returns the pointer to it.
func (w *Widget) SetX(v int) {
w.X = &v
}
// GetY returns the Y field if non-nil, zero value otherwise.
func (w *Widget) GetY() int {
if w == nil || w.Y == nil {
return 0
}
return *w.Y
}
// GetYOk returns a tuple with the Y field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (w *Widget) GetYOk() (int, bool) {
if w == nil || w.Y == nil {
return 0, false
}
return *w.Y, true
}
// HasY returns a boolean if a field has been set.
func (w *Widget) HasY() bool {
if w != nil && w.Y != nil {
return true
}
return false
}
// SetY allocates a new w.Y and returns the pointer to it.
func (w *Widget) SetY(v int) {
w.Y = &v
}
// GetCompute returns the Compute field if non-nil, zero value otherwise.
func (w *WidgetApmOrLogQuery) GetCompute() ApmOrLogQueryCompute {
if w == nil || w.Compute == nil {
return ApmOrLogQueryCompute{}
}
return *w.Compute
}
// GetComputeOk returns a tuple with the Compute field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (w *WidgetApmOrLogQuery) GetComputeOk() (ApmOrLogQueryCompute, bool) {
if w == nil || w.Compute == nil {
return ApmOrLogQueryCompute{}, false
}
return *w.Compute, true
}
// HasCompute returns a boolean if a field has been set.
func (w *WidgetApmOrLogQuery) HasCompute() bool {
if w != nil && w.Compute != nil {
return true
}
return false
}
// SetCompute allocates a new w.Compute and returns the pointer to it.
func (w *WidgetApmOrLogQuery) SetCompute(v ApmOrLogQueryCompute) {
w.Compute = &v
}
// GetIndex returns the Index field if non-nil, zero value otherwise.
func (w *WidgetApmOrLogQuery) GetIndex() string {
if w == nil || w.Index == nil {
return ""
}
return *w.Index
}
// GetIndexOk returns a tuple with the Index field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (w *WidgetApmOrLogQuery) GetIndexOk() (string, bool) {
if w == nil || w.Index == nil {
return "", false
}
return *w.Index, true
}
// HasIndex returns a boolean if a field has been set.
func (w *WidgetApmOrLogQuery) HasIndex() bool {
if w != nil && w.Index != nil {
return true
}
return false
}
// SetIndex allocates a new w.Index and returns the pointer to it.
func (w *WidgetApmOrLogQuery) SetIndex(v string) {
w.Index = &v
}
// GetSearch returns the Search field if non-nil, zero value otherwise.
func (w *WidgetApmOrLogQuery) GetSearch() ApmOrLogQuerySearch {
if w == nil || w.Search == nil {
return ApmOrLogQuerySearch{}
}
return *w.Search
}
// GetSearchOk returns a tuple with the Search field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (w *WidgetApmOrLogQuery) GetSearchOk() (ApmOrLogQuerySearch, bool) {
if w == nil || w.Search == nil {
return ApmOrLogQuerySearch{}, false
}
return *w.Search, true
}
// HasSearch returns a boolean if a field has been set.
func (w *WidgetApmOrLogQuery) HasSearch() bool {
if w != nil && w.Search != nil {
return true
}
return false
}
// SetSearch allocates a new w.Search and returns the pointer to it.
func (w *WidgetApmOrLogQuery) SetSearch(v ApmOrLogQuerySearch) {
w.Search = &v
}
// GetIncludeZero returns the IncludeZero field if non-nil, zero value otherwise.
func (w *WidgetAxis) GetIncludeZero() bool {
if w == nil || w.IncludeZero == nil {
return false
}
return *w.IncludeZero
}
// GetIncludeZeroOk returns a tuple with the IncludeZero field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (w *WidgetAxis) GetIncludeZeroOk() (bool, bool) {
if w == nil || w.IncludeZero == nil {
return false, false
}
return *w.IncludeZero, true
}
// HasIncludeZero returns a boolean if a field has been set.
func (w *WidgetAxis) HasIncludeZero() bool {
if w != nil && w.IncludeZero != nil {
return true
}
return false
}
// SetIncludeZero allocates a new w.IncludeZero and returns the pointer to it.
func (w *WidgetAxis) SetIncludeZero(v bool) {
w.IncludeZero = &v
}
// GetLabel returns the Label field if non-nil, zero value otherwise.
func (w *WidgetAxis) GetLabel() string {
if w == nil || w.Label == nil {
return ""
}
return *w.Label
}
// GetLabelOk returns a tuple with the Label field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (w *WidgetAxis) GetLabelOk() (string, bool) {
if w == nil || w.Label == nil {
return "", false
}
return *w.Label, true
}
// HasLabel returns a boolean if a field has been set.
func (w *WidgetAxis) HasLabel() bool {
if w != nil && w.Label != nil {
return true
}
return false
}
// SetLabel allocates a new w.Label and returns the pointer to it.
func (w *WidgetAxis) SetLabel(v string) {
w.Label = &v
}
// GetMax returns the Max field if non-nil, zero value otherwise.
func (w *WidgetAxis) GetMax() string {
if w == nil || w.Max == nil {
return ""
}
return *w.Max
}
// GetMaxOk returns a tuple with the Max field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (w *WidgetAxis) GetMaxOk() (string, bool) {
if w == nil || w.Max == nil {
return "", false
}
return *w.Max, true
}
// HasMax returns a boolean if a field has been set.
func (w *WidgetAxis) HasMax() bool {
if w != nil && w.Max != nil {
return true
}
return false
}
// SetMax allocates a new w.Max and returns the pointer to it.
func (w *WidgetAxis) SetMax(v string) {
w.Max = &v
}
// GetMin returns the Min field if non-nil, zero value otherwise.
func (w *WidgetAxis) GetMin() string {
if w == nil || w.Min == nil {
return ""
}
return *w.Min
}
// GetMinOk returns a tuple with the Min field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (w *WidgetAxis) GetMinOk() (string, bool) {
if w == nil || w.Min == nil {
return "", false
}
return *w.Min, true
}
// HasMin returns a boolean if a field has been set.
func (w *WidgetAxis) HasMin() bool {
if w != nil && w.Min != nil {
return true
}
return false
}
// SetMin allocates a new w.Min and returns the pointer to it.
func (w *WidgetAxis) SetMin(v string) {
w.Min = &v
}
// GetScale returns the Scale field if non-nil, zero value otherwise.
func (w *WidgetAxis) GetScale() string {
if w == nil || w.Scale == nil {
return ""
}
return *w.Scale
}
// GetScaleOk returns a tuple with the Scale field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (w *WidgetAxis) GetScaleOk() (string, bool) {
if w == nil || w.Scale == nil {
return "", false
}
return *w.Scale, true
}
// HasScale returns a boolean if a field has been set.
func (w *WidgetAxis) HasScale() bool {
if w != nil && w.Scale != nil {
return true
}
return false
}
// SetScale allocates a new w.Scale and returns the pointer to it.
func (w *WidgetAxis) SetScale(v string) {
w.Scale = &v
}
// GetComparator returns the Comparator field if non-nil, zero value otherwise.
func (w *WidgetConditionalFormat) GetComparator() string {
if w == nil || w.Comparator == nil {
return ""
}
return *w.Comparator
}
// GetComparatorOk returns a tuple with the Comparator field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (w *WidgetConditionalFormat) GetComparatorOk() (string, bool) {
if w == nil || w.Comparator == nil {
return "", false
}
return *w.Comparator, true
}
// HasComparator returns a boolean if a field has been set.
func (w *WidgetConditionalFormat) HasComparator() bool {
if w != nil && w.Comparator != nil {
return true
}
return false
}
// SetComparator allocates a new w.Comparator and returns the pointer to it.
func (w *WidgetConditionalFormat) SetComparator(v string) {
w.Comparator = &v
}
// GetCustomBgColor returns the CustomBgColor field if non-nil, zero value otherwise.
func (w *WidgetConditionalFormat) GetCustomBgColor() string {
if w == nil || w.CustomBgColor == nil {
return ""
}
return *w.CustomBgColor
}
// GetCustomBgColorOk returns a tuple with the CustomBgColor field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (w *WidgetConditionalFormat) GetCustomBgColorOk() (string, bool) {
if w == nil || w.CustomBgColor == nil {
return "", false
}
return *w.CustomBgColor, true
}
// HasCustomBgColor returns a boolean if a field has been set.
func (w *WidgetConditionalFormat) HasCustomBgColor() bool {
if w != nil && w.CustomBgColor != nil {
return true
}
return false
}
// SetCustomBgColor allocates a new w.CustomBgColor and returns the pointer to it.
func (w *WidgetConditionalFormat) SetCustomBgColor(v string) {
w.CustomBgColor = &v
}
// GetCustomFgColor returns the CustomFgColor field if non-nil, zero value otherwise.
func (w *WidgetConditionalFormat) GetCustomFgColor() string {
if w == nil || w.CustomFgColor == nil {
return ""
}
return *w.CustomFgColor
}
// GetCustomFgColorOk returns a tuple with the CustomFgColor field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (w *WidgetConditionalFormat) GetCustomFgColorOk() (string, bool) {
if w == nil || w.CustomFgColor == nil {
return "", false
}
return *w.CustomFgColor, true
}
// HasCustomFgColor returns a boolean if a field has been set.
func (w *WidgetConditionalFormat) HasCustomFgColor() bool {
if w != nil && w.CustomFgColor != nil {
return true
}
return false
}
// SetCustomFgColor allocates a new w.CustomFgColor and returns the pointer to it.
func (w *WidgetConditionalFormat) SetCustomFgColor(v string) {
w.CustomFgColor = &v
}
// GetHideValue returns the HideValue field if non-nil, zero value otherwise.
func (w *WidgetConditionalFormat) GetHideValue() bool {
if w == nil || w.HideValue == nil {
return false
}
return *w.HideValue
}
// GetHideValueOk returns a tuple with the HideValue field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (w *WidgetConditionalFormat) GetHideValueOk() (bool, bool) {
if w == nil || w.HideValue == nil {
return false, false
}
return *w.HideValue, true
}
// HasHideValue returns a boolean if a field has been set.
func (w *WidgetConditionalFormat) HasHideValue() bool {
if w != nil && w.HideValue != nil {
return true
}
return false
}
// SetHideValue allocates a new w.HideValue and returns the pointer to it.
func (w *WidgetConditionalFormat) SetHideValue(v bool) {
w.HideValue = &v
}
// GetImageUrl returns the ImageUrl field if non-nil, zero value otherwise.
func (w *WidgetConditionalFormat) GetImageUrl() string {
if w == nil || w.ImageUrl == nil {
return ""
}
return *w.ImageUrl
}
// GetImageUrlOk returns a tuple with the ImageUrl field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (w *WidgetConditionalFormat) GetImageUrlOk() (string, bool) {
if w == nil || w.ImageUrl == nil {
return "", false
}
return *w.ImageUrl, true
}
// HasImageUrl returns a boolean if a field has been set.
func (w *WidgetConditionalFormat) HasImageUrl() bool {
if w != nil && w.ImageUrl != nil {
return true
}
return false
}
// SetImageUrl allocates a new w.ImageUrl and returns the pointer to it.
func (w *WidgetConditionalFormat) SetImageUrl(v string) {
w.ImageUrl = &v
}
// GetMetric returns the Metric field if non-nil, zero value otherwise.
func (w *WidgetConditionalFormat) GetMetric() string {
if w == nil || w.Metric == nil {
return ""
}
return *w.Metric
}
// GetMetricOk returns a tuple with the Metric field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (w *WidgetConditionalFormat) GetMetricOk() (string, bool) {
if w == nil || w.Metric == nil {
return "", false
}
return *w.Metric, true
}
// HasMetric returns a boolean if a field has been set.
func (w *WidgetConditionalFormat) HasMetric() bool {
if w != nil && w.Metric != nil {
return true
}
return false
}
// SetMetric allocates a new w.Metric and returns the pointer to it.
func (w *WidgetConditionalFormat) SetMetric(v string) {
w.Metric = &v
}
// GetPalette returns the Palette field if non-nil, zero value otherwise.
func (w *WidgetConditionalFormat) GetPalette() string {
if w == nil || w.Palette == nil {
return ""
}
return *w.Palette
}
// GetPaletteOk returns a tuple with the Palette field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (w *WidgetConditionalFormat) GetPaletteOk() (string, bool) {
if w == nil || w.Palette == nil {
return "", false
}
return *w.Palette, true
}
// HasPalette returns a boolean if a field has been set.
func (w *WidgetConditionalFormat) HasPalette() bool {
if w != nil && w.Palette != nil {
return true
}
return false
}
// SetPalette allocates a new w.Palette and returns the pointer to it.
func (w *WidgetConditionalFormat) SetPalette(v string) {
w.Palette = &v
}
// GetTimeframe returns the Timeframe field if non-nil, zero value otherwise.
func (w *WidgetConditionalFormat) GetTimeframe() string {
if w == nil || w.Timeframe == nil {
return ""
}
return *w.Timeframe
}
// GetTimeframeOk returns a tuple with the Timeframe field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (w *WidgetConditionalFormat) GetTimeframeOk() (string, bool) {
if w == nil || w.Timeframe == nil {
return "", false
}
return *w.Timeframe, true
}
// HasTimeframe returns a boolean if a field has been set.
func (w *WidgetConditionalFormat) HasTimeframe() bool {
if w != nil && w.Timeframe != nil {
return true
}
return false
}
// SetTimeframe allocates a new w.Timeframe and returns the pointer to it.
func (w *WidgetConditionalFormat) SetTimeframe(v string) {
w.Timeframe = &v
}
// GetValue returns the Value field if non-nil, zero value otherwise.
func (w *WidgetConditionalFormat) GetValue() float64 {
if w == nil || w.Value == nil {
return 0
}
return *w.Value
}
// GetValueOk returns a tuple with the Value field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (w *WidgetConditionalFormat) GetValueOk() (float64, bool) {
if w == nil || w.Value == nil {
return 0, false
}
return *w.Value, true
}
// HasValue returns a boolean if a field has been set.
func (w *WidgetConditionalFormat) HasValue() bool {
if w != nil && w.Value != nil {
return true
}
return false
}
// SetValue allocates a new w.Value and returns the pointer to it.
func (w *WidgetConditionalFormat) SetValue(v float64) {
w.Value = &v
}
// GetQuery returns the Query field if non-nil, zero value otherwise.
func (w *WidgetEvent) GetQuery() string {
if w == nil || w.Query == nil {
return ""
}
return *w.Query
}
// GetQueryOk returns a tuple with the Query field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (w *WidgetEvent) GetQueryOk() (string, bool) {
if w == nil || w.Query == nil {
return "", false
}
return *w.Query, true
}
// HasQuery returns a boolean if a field has been set.
func (w *WidgetEvent) HasQuery() bool {
if w != nil && w.Query != nil {
return true
}
return false
}
// SetQuery allocates a new w.Query and returns the pointer to it.
func (w *WidgetEvent) SetQuery(v string) {
w.Query = &v
}
// GetHeight returns the Height field if non-nil, zero value otherwise.
func (w *WidgetLayout) GetHeight() float64 {
if w == nil || w.Height == nil {
return 0
}
return *w.Height
}
// GetHeightOk returns a tuple with the Height field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (w *WidgetLayout) GetHeightOk() (float64, bool) {
if w == nil || w.Height == nil {
return 0, false
}
return *w.Height, true
}
// HasHeight returns a boolean if a field has been set.
func (w *WidgetLayout) HasHeight() bool {
if w != nil && w.Height != nil {
return true
}
return false
}
// SetHeight allocates a new w.Height and returns the pointer to it.
func (w *WidgetLayout) SetHeight(v float64) {
w.Height = &v
}
// GetWidth returns the Width field if non-nil, zero value otherwise.
func (w *WidgetLayout) GetWidth() float64 {
if w == nil || w.Width == nil {
return 0
}
return *w.Width
}
// GetWidthOk returns a tuple with the Width field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (w *WidgetLayout) GetWidthOk() (float64, bool) {
if w == nil || w.Width == nil {
return 0, false
}
return *w.Width, true
}
// HasWidth returns a boolean if a field has been set.
func (w *WidgetLayout) HasWidth() bool {
if w != nil && w.Width != nil {
return true
}
return false
}
// SetWidth allocates a new w.Width and returns the pointer to it.
func (w *WidgetLayout) SetWidth(v float64) {
w.Width = &v
}
// GetX returns the X field if non-nil, zero value otherwise.
func (w *WidgetLayout) GetX() float64 {
if w == nil || w.X == nil {
return 0
}
return *w.X
}
// GetXOk returns a tuple with the X field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (w *WidgetLayout) GetXOk() (float64, bool) {
if w == nil || w.X == nil {
return 0, false
}
return *w.X, true
}
// HasX returns a boolean if a field has been set.
func (w *WidgetLayout) HasX() bool {
if w != nil && w.X != nil {
return true
}
return false
}
// SetX allocates a new w.X and returns the pointer to it.
func (w *WidgetLayout) SetX(v float64) {
w.X = &v
}
// GetY returns the Y field if non-nil, zero value otherwise.
func (w *WidgetLayout) GetY() float64 {
if w == nil || w.Y == nil {
return 0
}
return *w.Y
}
// GetYOk returns a tuple with the Y field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (w *WidgetLayout) GetYOk() (float64, bool) {
if w == nil || w.Y == nil {
return 0, false
}
return *w.Y, true
}
// HasY returns a boolean if a field has been set.
func (w *WidgetLayout) HasY() bool {
if w != nil && w.Y != nil {
return true
}
return false
}
// SetY allocates a new w.Y and returns the pointer to it.
func (w *WidgetLayout) SetY(v float64) {
w.Y = &v
}
// GetDisplayType returns the DisplayType field if non-nil, zero value otherwise.
func (w *WidgetMarker) GetDisplayType() string {
if w == nil || w.DisplayType == nil {
return ""
}
return *w.DisplayType
}
// GetDisplayTypeOk returns a tuple with the DisplayType field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (w *WidgetMarker) GetDisplayTypeOk() (string, bool) {
if w == nil || w.DisplayType == nil {
return "", false
}
return *w.DisplayType, true
}
// HasDisplayType returns a boolean if a field has been set.
func (w *WidgetMarker) HasDisplayType() bool {
if w != nil && w.DisplayType != nil {
return true
}
return false
}
// SetDisplayType allocates a new w.DisplayType and returns the pointer to it.
func (w *WidgetMarker) SetDisplayType(v string) {
w.DisplayType = &v
}
// GetLabel returns the Label field if non-nil, zero value otherwise.
func (w *WidgetMarker) GetLabel() string {
if w == nil || w.Label == nil {
return ""
}
return *w.Label
}
// GetLabelOk returns a tuple with the Label field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (w *WidgetMarker) GetLabelOk() (string, bool) {
if w == nil || w.Label == nil {
return "", false
}
return *w.Label, true
}
// HasLabel returns a boolean if a field has been set.
func (w *WidgetMarker) HasLabel() bool {
if w != nil && w.Label != nil {
return true
}
return false
}
// SetLabel allocates a new w.Label and returns the pointer to it.
func (w *WidgetMarker) SetLabel(v string) {
w.Label = &v
}
// GetValue returns the Value field if non-nil, zero value otherwise.
func (w *WidgetMarker) GetValue() string {
if w == nil || w.Value == nil {
return ""
}
return *w.Value
}
// GetValueOk returns a tuple with the Value field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (w *WidgetMarker) GetValueOk() (string, bool) {
if w == nil || w.Value == nil {
return "", false
}
return *w.Value, true
}
// HasValue returns a boolean if a field has been set.
func (w *WidgetMarker) HasValue() bool {
if w != nil && w.Value != nil {
return true
}
return false
}
// SetValue allocates a new w.Value and returns the pointer to it.
func (w *WidgetMarker) SetValue(v string) {
w.Value = &v
}
// GetAliasName returns the AliasName field if non-nil, zero value otherwise.
func (w *WidgetMetadata) GetAliasName() string {
if w == nil || w.AliasName == nil {
return ""
}
return *w.AliasName
}
// GetAliasNameOk returns a tuple with the AliasName field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (w *WidgetMetadata) GetAliasNameOk() (string, bool) {
if w == nil || w.AliasName == nil {
return "", false
}
return *w.AliasName, true
}
// HasAliasName returns a boolean if a field has been set.
func (w *WidgetMetadata) HasAliasName() bool {
if w != nil && w.AliasName != nil {
return true
}
return false
}
// SetAliasName allocates a new w.AliasName and returns the pointer to it.
func (w *WidgetMetadata) SetAliasName(v string) {
w.AliasName = &v
}
// GetExpression returns the Expression field if non-nil, zero value otherwise.
func (w *WidgetMetadata) GetExpression() string {
if w == nil || w.Expression == nil {
return ""
}
return *w.Expression
}
// GetExpressionOk returns a tuple with the Expression field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (w *WidgetMetadata) GetExpressionOk() (string, bool) {
if w == nil || w.Expression == nil {
return "", false
}
return *w.Expression, true
}
// HasExpression returns a boolean if a field has been set.
func (w *WidgetMetadata) HasExpression() bool {
if w != nil && w.Expression != nil {
return true
}
return false
}
// SetExpression allocates a new w.Expression and returns the pointer to it.
func (w *WidgetMetadata) SetExpression(v string) {
w.Expression = &v
}
// GetLimit returns the Limit field if non-nil, zero value otherwise.
func (w *WidgetProcessQuery) GetLimit() int {
if w == nil || w.Limit == nil {
return 0
}
return *w.Limit
}
// GetLimitOk returns a tuple with the Limit field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (w *WidgetProcessQuery) GetLimitOk() (int, bool) {
if w == nil || w.Limit == nil {
return 0, false
}
return *w.Limit, true
}
// HasLimit returns a boolean if a field has been set.
func (w *WidgetProcessQuery) HasLimit() bool {
if w != nil && w.Limit != nil {
return true
}
return false
}
// SetLimit allocates a new w.Limit and returns the pointer to it.
func (w *WidgetProcessQuery) SetLimit(v int) {
w.Limit = &v
}
// GetMetric returns the Metric field if non-nil, zero value otherwise.
func (w *WidgetProcessQuery) GetMetric() string {
if w == nil || w.Metric == nil {
return ""
}
return *w.Metric
}
// GetMetricOk returns a tuple with the Metric field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (w *WidgetProcessQuery) GetMetricOk() (string, bool) {
if w == nil || w.Metric == nil {
return "", false
}
return *w.Metric, true
}
// HasMetric returns a boolean if a field has been set.
func (w *WidgetProcessQuery) HasMetric() bool {
if w != nil && w.Metric != nil {
return true
}
return false
}
// SetMetric allocates a new w.Metric and returns the pointer to it.
func (w *WidgetProcessQuery) SetMetric(v string) {
w.Metric = &v
}
// GetSearchBy returns the SearchBy field if non-nil, zero value otherwise.
func (w *WidgetProcessQuery) GetSearchBy() string {
if w == nil || w.SearchBy == nil {
return ""
}
return *w.SearchBy
}
// GetSearchByOk returns a tuple with the SearchBy field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (w *WidgetProcessQuery) GetSearchByOk() (string, bool) {
if w == nil || w.SearchBy == nil {
return "", false
}
return *w.SearchBy, true
}
// HasSearchBy returns a boolean if a field has been set.
func (w *WidgetProcessQuery) HasSearchBy() bool {
if w != nil && w.SearchBy != nil {
return true
}
return false
}
// SetSearchBy allocates a new w.SearchBy and returns the pointer to it.
func (w *WidgetProcessQuery) SetSearchBy(v string) {
w.SearchBy = &v
}
// GetPalette returns the Palette field if non-nil, zero value otherwise.
func (w *WidgetRequestStyle) GetPalette() string {
if w == nil || w.Palette == nil {
return ""
}
return *w.Palette
}
// GetPaletteOk returns a tuple with the Palette field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (w *WidgetRequestStyle) GetPaletteOk() (string, bool) {
if w == nil || w.Palette == nil {
return "", false
}
return *w.Palette, true
}
// HasPalette returns a boolean if a field has been set.
func (w *WidgetRequestStyle) HasPalette() bool {
if w != nil && w.Palette != nil {
return true
}
return false
}
// SetPalette allocates a new w.Palette and returns the pointer to it.
func (w *WidgetRequestStyle) SetPalette(v string) {
w.Palette = &v
}
// GetLiveSpan returns the LiveSpan field if non-nil, zero value otherwise.
func (w *WidgetTime) GetLiveSpan() string {
if w == nil || w.LiveSpan == nil {
return ""
}
return *w.LiveSpan
}
// GetLiveSpanOk returns a tuple with the LiveSpan field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (w *WidgetTime) GetLiveSpanOk() (string, bool) {
if w == nil || w.LiveSpan == nil {
return "", false
}
return *w.LiveSpan, true
}
// HasLiveSpan returns a boolean if a field has been set.
func (w *WidgetTime) HasLiveSpan() bool {
if w != nil && w.LiveSpan != nil {
return true
}
return false
}
// SetLiveSpan allocates a new w.LiveSpan and returns the pointer to it.
func (w *WidgetTime) SetLiveSpan(v string) {
w.LiveSpan = &v
}
// GetIncludeUnits returns the IncludeUnits field if non-nil, zero value otherwise.
func (y *Yaxis) GetIncludeUnits() bool {
if y == nil || y.IncludeUnits == nil {
return false
}
return *y.IncludeUnits
}
// GetIncludeUnitsOk returns a tuple with the IncludeUnits field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (y *Yaxis) GetIncludeUnitsOk() (bool, bool) {
if y == nil || y.IncludeUnits == nil {
return false, false
}
return *y.IncludeUnits, true
}
// HasIncludeUnits returns a boolean if a field has been set.
func (y *Yaxis) HasIncludeUnits() bool {
if y != nil && y.IncludeUnits != nil {
return true
}
return false
}
// SetIncludeUnits allocates a new y.IncludeUnits and returns the pointer to it.
func (y *Yaxis) SetIncludeUnits(v bool) {
y.IncludeUnits = &v
}
// GetIncludeZero returns the IncludeZero field if non-nil, zero value otherwise.
func (y *Yaxis) GetIncludeZero() bool {
if y == nil || y.IncludeZero == nil {
return false
}
return *y.IncludeZero
}
// GetIncludeZeroOk returns a tuple with the IncludeZero field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (y *Yaxis) GetIncludeZeroOk() (bool, bool) {
if y == nil || y.IncludeZero == nil {
return false, false
}
return *y.IncludeZero, true
}
// HasIncludeZero returns a boolean if a field has been set.
func (y *Yaxis) HasIncludeZero() bool {
if y != nil && y.IncludeZero != nil {
return true
}
return false
}
// SetIncludeZero allocates a new y.IncludeZero and returns the pointer to it.
func (y *Yaxis) SetIncludeZero(v bool) {
y.IncludeZero = &v
}
// GetMax returns the Max field if non-nil, zero value otherwise.
func (y *Yaxis) GetMax() float64 {
if y == nil || y.Max == nil {
return 0
}
return *y.Max
}
// GetMaxOk returns a tuple with the Max field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (y *Yaxis) GetMaxOk() (float64, bool) {
if y == nil || y.Max == nil {
return 0, false
}
return *y.Max, true
}
// HasMax returns a boolean if a field has been set.
func (y *Yaxis) HasMax() bool {
if y != nil && y.Max != nil {
return true
}
return false
}
// SetMax allocates a new y.Max and returns the pointer to it.
func (y *Yaxis) SetMax(v float64) {
y.Max = &v
}
// GetMin returns the Min field if non-nil, zero value otherwise.
func (y *Yaxis) GetMin() float64 {
if y == nil || y.Min == nil {
return 0
}
return *y.Min
}
// GetMinOk returns a tuple with the Min field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (y *Yaxis) GetMinOk() (float64, bool) {
if y == nil || y.Min == nil {
return 0, false
}
return *y.Min, true
}
// HasMin returns a boolean if a field has been set.
func (y *Yaxis) HasMin() bool {
if y != nil && y.Min != nil {
return true
}
return false
}
// SetMin allocates a new y.Min and returns the pointer to it.
func (y *Yaxis) SetMin(v float64) {
y.Min = &v
}
// GetScale returns the Scale field if non-nil, zero value otherwise.
func (y *Yaxis) GetScale() string {
if y == nil || y.Scale == nil {
return ""
}
return *y.Scale
}
// GetScaleOk returns a tuple with the Scale field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (y *Yaxis) GetScaleOk() (string, bool) {
if y == nil || y.Scale == nil {
return "", false
}
return *y.Scale, true
}
// HasScale returns a boolean if a field has been set.
func (y *Yaxis) HasScale() bool {
if y != nil && y.Scale != nil {
return true
}
return false
}
// SetScale allocates a new y.Scale and returns the pointer to it.
func (y *Yaxis) SetScale(v string) {
y.Scale = &v
} | vendor/github.com/zorkian/go-datadog-api/datadog-accessors.go | 0.801159 | 0.49762 | datadog-accessors.go | starcoder |
package asyncjobs
import (
"context"
"fmt"
"math/rand"
"sort"
"time"
)
// RetryPolicy defines a period that failed jobs will be retried against
type RetryPolicy struct {
// Intervals is a range of time periods backoff will be based off
Intervals []time.Duration
// Jitter is a factor applied to the specific interval avoid repeating same backoff periods
Jitter float64
}
// RetryPolicyProvider is the interface that the ReplyPolicy implements,
// use this to implement your own exponential backoff system or similar for
// task retries.
type RetryPolicyProvider interface {
Duration(n int) time.Duration
}
var (
// RetryLinearTenMinutes is a 50-step policy between 1 and 10 minutes
RetryLinearTenMinutes = linearPolicy(50, 0.90, time.Minute, 10*time.Minute)
// RetryLinearOneHour is a 50-step policy between 10 minutes and 1 hour
RetryLinearOneHour = linearPolicy(20, 0.90, 10*time.Minute, 60*time.Minute)
// RetryLinearOneMinute is a 20-step policy between 1 second and 1 minute
RetryLinearOneMinute = linearPolicy(20, 0.5, time.Second, time.Minute)
// RetryDefault is the default retry policy
RetryDefault = RetryLinearTenMinutes
retryLinearTenSeconds = linearPolicy(20, 0.1, 500*time.Millisecond, 10*time.Second)
retryForTesting = linearPolicy(1, 0.1, time.Millisecond, 10*time.Millisecond)
policies = map[string]RetryPolicyProvider{
"default": RetryDefault,
"1m": RetryLinearOneMinute,
"10m": RetryLinearTenMinutes,
"1h": RetryLinearOneHour,
}
)
// RetryPolicyNames returns a list of pre-generated retry policies
func RetryPolicyNames() []string {
var names []string
for k := range policies {
names = append(names, k)
}
sort.Strings(names)
return names
}
// RetryPolicyLookup loads a policy by name
func RetryPolicyLookup(name string) (RetryPolicyProvider, error) {
policy, ok := policies[name]
if !ok {
return nil, fmt.Errorf("%w: %s", ErrUnknownRetryPolicy, name)
}
return policy, nil
}
// IsRetryPolicyKnown determines if the named policy exist
func IsRetryPolicyKnown(name string) bool {
for _, p := range RetryPolicyNames() {
if p == name {
return true
}
}
return false
}
// Duration is the period to sleep for try n, it includes a jitter
func (p RetryPolicy) Duration(n int) time.Duration {
if n >= len(p.Intervals) {
n = len(p.Intervals) - 1
}
delay := p.jitter(p.Intervals[n])
if delay == 0 {
delay = p.Intervals[0]
}
return delay
}
// RetrySleep sleeps for the duration for try n or until interrupted by ctx
func RetrySleep(ctx context.Context, p RetryPolicyProvider, n int) error {
timer := time.NewTimer(p.Duration(n))
select {
case <-timer.C:
return nil
case <-ctx.Done():
timer.Stop()
return ctx.Err()
}
}
func linearPolicy(steps uint64, jitter float64, min time.Duration, max time.Duration) RetryPolicy {
if max < min {
max, min = min, max
}
p := RetryPolicy{
Intervals: []time.Duration{},
Jitter: jitter,
}
stepSize := uint64(max-min) / steps
for i := uint64(0); i < steps; i += 1 {
p.Intervals = append(p.Intervals, time.Duration(uint64(min)+(i*stepSize)))
}
return p
}
func (p RetryPolicy) jitter(d time.Duration) time.Duration {
if d == 0 {
return 0
}
jf := (float64(d) * p.Jitter) + float64(rand.Int63n(int64(d)))
return time.Duration(jf).Round(time.Millisecond)
} | retrypolicy.go | 0.728748 | 0.476336 | retrypolicy.go | starcoder |
package image
import (
"image"
"image/color"
lib_color "github.com/mchapman87501/go_mars_2020_img_utils/lib/image/color"
)
type CIELab struct {
// Pix, Stride, Rect
Pix []float64
Stride int
Rect image.Rectangle
}
func (p *CIELab) ColorModel() color.Model { return lib_color.CIELabModel }
func (p *CIELab) Bounds() image.Rectangle { return p.Rect }
func (p *CIELab) At(x, y int) color.Color {
return p.CIELabAt(x, y)
}
func (p *CIELab) CIELabAt(x, y int) lib_color.CIELab {
if !(image.Point{x, y}.In(p.Rect)) {
return lib_color.CIELab{
L: 0,
A: 0,
B: 0,
}
}
i := p.PixOffset(x, y)
result := lib_color.CIELab{L: p.Pix[i], A: p.Pix[i+1], B: p.Pix[i+2]}
return result
}
func (p *CIELab) PixOffset(x, y int) int {
return (y-p.Rect.Min.Y)*p.Stride + (x-p.Rect.Min.X)*3
}
func (p *CIELab) Set(x, y int, c color.Color) {
if !(image.Point{x, y}.In(p.Rect)) {
return
}
c1 := lib_color.CIELabModel.Convert(c).(lib_color.CIELab)
i := p.PixOffset(x, y)
s := p.Pix[i : i+3 : i+3]
s[0] = c1.L
s[1] = c1.A
s[2] = c1.B
}
func (p *CIELab) SetCIELab(x, y int, c lib_color.CIELab) {
if !(image.Point{x, y}.In(p.Rect)) {
return
}
i := p.PixOffset(x, y)
s := p.Pix[i : i+3 : i+3]
s[0] = c.L
s[1] = c.A
s[2] = c.B
}
func (p *CIELab) SubImage(rect image.Rectangle) *CIELab {
// This is taken from the implementation of NRGBA's SubImage.
r := rect.Intersect(p.Rect)
if r.Empty() {
return &CIELab{}
}
i := p.PixOffset(r.Min.X, r.Min.Y)
return &CIELab{
Pix: p.Pix[i:], // <- Those who choose to access Pix directly can overrun the image.
Stride: p.Stride,
Rect: r,
}
}
func (p *CIELab) Opaque() bool {
return true
}
func NewCIELab(r image.Rectangle) *CIELab {
area := r.Dx() * r.Dy()
channels := 3 // L, a, b
bufferSize := area * channels
pix := make([]float64, bufferSize)
return &CIELab{Pix: pix, Stride: channels * r.Dx(), Rect: r}
}
// Create a CIELab from an image.RGBA.
// The image origin will be at 0, 0.
func CIELabFromImage(src image.Image) *CIELab {
rect := src.Bounds()
result := NewCIELab(rect)
offset := 0
for y := rect.Min.Y; y < rect.Max.Y; y++ {
for x := rect.Min.X; x < rect.Max.X; x++ {
r, g, b, _ := src.At(x, y).RGBA()
labL, laba, labb := lib_color.RGBToCIELab(r, g, b)
result.Pix[offset] = labL
result.Pix[offset+1] = laba
result.Pix[offset+2] = labb
offset += 3
}
}
return result
} | lib/image/cie_lab.go | 0.695958 | 0.577763 | cie_lab.go | starcoder |
package optimga
import (
"fmt"
"math"
"math/rand"
)
const nbChildrenRate = 7
type RealES struct {
genotypeCommon
genes []float64
steps []float64 // Sigma standard deviations
rangeGene float64
tglobal float64
tlocal float64
sizeGenotype int // needed for tcglobal and tlocal computation
fitnessFunc func([]float64) Fitness
}
func (r *RealES) init() {
r.genes = make([]float64, r.sizeGenotype)
r.steps = make([]float64, r.sizeGenotype)
for i := range r.genes {
r.genes[i] = rand.Float64() * r.rangeGene
r.steps[i] = rand.Float64()
}
r.tglobal = 1 / math.Sqrt(2*float64(r.sizeGenotype))
r.tlocal = 1 / math.Sqrt(2*math.Sqrt(float64(r.sizeGenotype)))
}
func (r *RealES) String() string {
var result string
result += fmt.Sprintf("genes: ")
for i := range r.genes {
result += fmt.Sprintf("%f ", r.genes[i])
}
result += fmt.Sprintf("\n\nstdev: ")
for i := range r.steps {
result += fmt.Sprintf("%f ", r.steps[i])
}
return result
}
func (r *RealES) checkBoundaries(gene float64) float64 {
if gene < -r.rangeGene {
gene = -r.rangeGene
} else if gene > r.rangeGene {
gene = r.rangeGene
}
return gene
}
func (r *RealES) cross(gen Genotype) {
for i := range r.genes {
weight := rand.Float64()
var r2 = gen.(*RealES)
rgene := r.genes[i]
r2gene := r2.genes[i]
r.genes[i] = rgene*weight + r2gene*(1-weight)
r2.genes[i] = rgene*(1-weight) + r2gene*(weight)
r.genes[i] = r.checkBoundaries(r.genes[i])
r2.genes[i] = r2.checkBoundaries(r.genes[i])
}
}
func (r *RealES) mutate() {
mindev := 0.0
global := r.tglobal * rand.NormFloat64()
for i := range r.steps {
r.steps[i] *= math.Exp(global + r.tlocal*rand.NormFloat64())
if r.steps[i] < mindev {
r.steps[i] = mindev
} else if r.steps[i] > r.rangeGene/2 {
r.steps[i] = r.rangeGene / 2
}
}
for i := range r.genes {
r.genes[i] += r.steps[i] * rand.NormFloat64()
r.genes[i] = r.checkBoundaries(r.genes[i])
}
}
func (r *RealES) GetGenes() []float64 {
return r.genes
}
func (r *RealES) clone() Genotype {
rclone := new(RealES)
*rclone = *r
rclone.genes = make([]float64, len(r.genes))
copy(rclone.genes, r.genes)
rclone.steps = make([]float64, len(r.steps))
copy(rclone.steps, r.steps)
return rclone
}
func (r *RealES) eval() Fitness {
return r.fitnessFunc(r.genes)
}
func MakeRealESPop(algo *AlgoGAES, rangeGene float64, sizeGenotype int, sizePop int, fitnessFunc func([]float64) Fitness) {
algo.pop = new(Pop)
algo.nbChildren = sizePop * nbChildrenRate
for i := 0; i < sizePop; i++ {
realES := new(RealES)
realES.sizeGenotype = sizeGenotype
realES.rangeGene = rangeGene
realES.fitnessFunc = fitnessFunc
realES.init()
algo.pop.genotypes = append(algo.pop.genotypes, realES)
}
} | genreals.go | 0.594669 | 0.551634 | genreals.go | starcoder |
package querier
import (
"sort"
"github.com/prometheus/prometheus/model/labels"
"github.com/prometheus/prometheus/storage"
"github.com/prometheus/prometheus/tsdb/chunkenc"
"github.com/cortexproject/cortex/pkg/cortexpb"
)
// timeSeriesSeriesSet is a wrapper around a cortexpb.TimeSeries slice to implement to SeriesSet interface
type timeSeriesSeriesSet struct {
ts []cortexpb.TimeSeries
i int
}
func newTimeSeriesSeriesSet(series []cortexpb.TimeSeries) *timeSeriesSeriesSet {
sort.Sort(byTimeSeriesLabels(series))
return &timeSeriesSeriesSet{
ts: series,
i: -1,
}
}
// Next implements storage.SeriesSet interface.
func (t *timeSeriesSeriesSet) Next() bool { t.i++; return t.i < len(t.ts) }
// At implements storage.SeriesSet interface.
func (t *timeSeriesSeriesSet) At() storage.Series {
if t.i < 0 {
return nil
}
return ×eries{series: t.ts[t.i]}
}
// Err implements storage.SeriesSet interface.
func (t *timeSeriesSeriesSet) Err() error { return nil }
// Warnings implements storage.SeriesSet interface.
func (t *timeSeriesSeriesSet) Warnings() storage.Warnings { return nil }
// timeseries is a type wrapper that implements the storage.Series interface
type timeseries struct {
series cortexpb.TimeSeries
}
// timeSeriesSeriesIterator is a wrapper around a cortexpb.TimeSeries to implement the SeriesIterator interface
type timeSeriesSeriesIterator struct {
ts *timeseries
i int
}
type byTimeSeriesLabels []cortexpb.TimeSeries
func (b byTimeSeriesLabels) Len() int { return len(b) }
func (b byTimeSeriesLabels) Swap(i, j int) { b[i], b[j] = b[j], b[i] }
func (b byTimeSeriesLabels) Less(i, j int) bool {
return labels.Compare(cortexpb.FromLabelAdaptersToLabels(b[i].Labels), cortexpb.FromLabelAdaptersToLabels(b[j].Labels)) < 0
}
// Labels implements the storage.Series interface.
// Conversion is safe because ingester sets these by calling client.FromLabelsToLabelAdapters which guarantees labels are sorted.
func (t *timeseries) Labels() labels.Labels {
return cortexpb.FromLabelAdaptersToLabels(t.series.Labels)
}
// Iterator implements the storage.Series interface
func (t *timeseries) Iterator() chunkenc.Iterator {
return &timeSeriesSeriesIterator{
ts: t,
i: -1,
}
}
// Seek implements SeriesIterator interface
func (t *timeSeriesSeriesIterator) Seek(s int64) bool {
offset := 0
if t.i > 0 {
offset = t.i // only advance via Seek
}
t.i = sort.Search(len(t.ts.series.Samples[offset:]), func(i int) bool {
return t.ts.series.Samples[offset+i].TimestampMs >= s
}) + offset
return t.i < len(t.ts.series.Samples)
}
// At implements the SeriesIterator interface
func (t *timeSeriesSeriesIterator) At() (int64, float64) {
if t.i < 0 || t.i >= len(t.ts.series.Samples) {
return 0, 0
}
return t.ts.series.Samples[t.i].TimestampMs, t.ts.series.Samples[t.i].Value
}
// Next implements the SeriesIterator interface
func (t *timeSeriesSeriesIterator) Next() bool { t.i++; return t.i < len(t.ts.series.Samples) }
// Err implements the SeriesIterator interface
func (t *timeSeriesSeriesIterator) Err() error { return nil } | pkg/querier/timeseries_series_set.go | 0.876205 | 0.495239 | timeseries_series_set.go | starcoder |
package lib
import (
"fmt"
"time"
"github.com/asukakenji/151a48667a3852a43a2028024ffc102e/common"
"github.com/asukakenji/151a48667a3852a43a2028024ffc102e/constant"
"github.com/asukakenji/151a48667a3852a43a2028024ffc102e/matrix"
"github.com/golang/glog"
"googlemaps.github.io/maps"
)
/*
LocationsToGoogleMapsLocations is a helper function which transforms the parameter
into a value that fits the Google Maps API.
It takes a common.Locations value as input,
and returns a slice of string as output.
Each element in the output slice is a latitude-longitude pair separated by a comma.
For example, an element {"22.372081", "114.107877"} in the input is transformed
into an element "22.372081,114.107877" in the output.
*/
func LocationsToGoogleMapsLocations(locs common.Locations) []string {
glocs := make([]string, len(locs))
for i, loc := range locs {
glocs[i] = fmt.Sprintf("%s,%s", loc[0], loc[1])
}
return glocs
}
func PathToLocationPath(locs common.Locations, path []int) common.Locations {
locationPath := make([][]string, len(locs))
for i, index := range path {
locationPath[i] = locs[index]
}
return locationPath
}
/*
GoogleMapsMatrixToMatrix is a helper function which transforms the parameter -
a value returned from the Google Maps API -
into a value that fits the internal API of this project.
It takes a *maps.DistanceMatrixRequest value as input,
and returns a matrix.Matrix as output.
The maps.DistanceMatrixRequest type is equivalent to the following:
type DistanceMatrixResponse struct {
OriginAddresses []string
DestinationAddresses []string
Rows []struct {
Elements []*struct {
Status string
Duration time.Duration
DurationInTraffic time.Duration
Distance struct {
HumanReadable string
Meters int
}
}
}
}
The value m.Get(r, c) in the output m refers to the field
resp.Rows[r].Elements[c].Distance.Meters in the input resp,
except when r == c, where m.Get(r, c) equals constant.Infinity
to fit the Travelling Salesman problem.
*/
func GoogleMapsMatrixToMatrix(resp *maps.DistanceMatrixResponse) (matrix.Matrix, common.Error) {
if resp == nil {
return matrix.NewSquareMatrix([][]int{}), nil
}
m := make([][]int, len(resp.Rows))
for r, row := range resp.Rows {
m[r] = make([]int, len(row.Elements))
for c, element := range row.Elements {
if element.Status != "OK" {
switch status := element.Status; status {
case "NOT_FOUND":
hash := common.NewToken()
glog.Errorf("[%s] GoogleMapsMatrixToMatrix: NOT_FOUND", hash)
return nil, NewLocationNotFoundError(resp, r, c, hash)
case "ZERO_RESULTS":
hash := common.NewToken()
glog.Errorf("[%s] GoogleMapsMatrixToMatrix: ZERO_RESULTS", hash)
return nil, NewRouteNotFoundError(resp, r, c, hash)
default:
fixedHash := "f8de639fab2bc7ab65c3153df6b8ee9e"
glog.Errorf("[%s] GoogleMapsMatrixToMatrix: Unknown error: Status: %q", fixedHash, status)
return nil, common.WrapError(fmt.Errorf("Unknown error: Status: %q", status), fixedHash)
}
}
if r == c {
m[r][c] = constant.Infinity
continue
}
m[r][c] = element.Distance.Meters
}
}
return matrix.NewSquareMatrix(m), nil
}
/*
CalculateTotalTime is a helper function which calculates
the estimated total time needed for driving along the given path
from the information retrieved from Google Maps API.
It takes a *maps.DistanceMatrixResponse value and a path as input,
and returns the estimated total time needed as output.
The field used to calculate the total time is
resp.Rows[from].Elements[to].Duration,
where from and to are the indices of the locations.
*/
func CalculateTotalTime(resp *maps.DistanceMatrixResponse, path []int) time.Duration {
totalTime := time.Duration(0)
size := len(path)
for i := 1; i < size; i++ {
totalTime += resp.Rows[path[i-1]].Elements[path[i]].Duration
}
return totalTime
} | cmd/backtier/lib/helper.go | 0.7237 | 0.505981 | helper.go | starcoder |
package iso20022
// Net position of a segregated holding, in a single security, within the overall position held in a securities account. A securities balance is calculated from the sum of securities' receipts minus the sum of securities' deliveries.
type AggregateBalanceInformation2 struct {
// Total quantity of financial instrument for the referenced holding.
AggregateQuantity *BalanceQuantity1Choice `xml:"AggtQty"`
// Specifies the number of days used for calculating the accrued interest amount.
DaysAccrued *Number `xml:"DaysAcrd,omitempty"`
// Total value of a balance of the securities account for a specific financial instrument, expressed in one or more currencies.
HoldingValue []*ActiveOrHistoricCurrencyAndAmount `xml:"HldgVal"`
// Interest amount that has accrued in between coupon payment periods.
AccruedInterestAmount *ActiveOrHistoricCurrencyAndAmount `xml:"AcrdIntrstAmt,omitempty"`
// Value of a security, as booked in an account. Book value is often different from the current market value of the security.
BookValue *ActiveOrHistoricCurrencyAndAmount `xml:"BookVal,omitempty"`
// Place where the securities are safe-kept, physically or notionally. This place can be, for example, a local custodian, a Central Securities Depository (CSD) or an International Central Securities Depository (ICSD).
SafekeepingPlace *SafekeepingPlaceFormatChoice `xml:"SfkpgPlc,omitempty"`
// Security held on the account for which the balance is calculated.
FinancialInstrumentDetails *FinancialInstrument4 `xml:"FinInstrmDtls"`
// Price of the financial instrument in one or more currencies.
PriceDetails []*PriceInformation1 `xml:"PricDtls"`
// Currency exchange related to a securities order.
ForeignExchangeDetails *ForeignExchangeTerms3 `xml:"FrgnXchgDtls,omitempty"`
// Net position of a segregated holding of a single security within the overall position held in a securities account, eg, sub-balance per status.
BalanceBreakdownDetails []*SubBalanceInformation1 `xml:"BalBrkdwnDtls,omitempty"`
// Net position of a segregated holding of a single security within the overall position held in a securities account, eg, sub-balance per status.
AdditionalBalanceBreakdownDetails []*AdditionalBalanceInformation `xml:"AddtlBalBrkdwnDtls,omitempty"`
// Net position of a segregated holding, in a single security, within the overall position held in a securities account at a specified place of safekeeping.
BalanceAtSafekeepingPlace []*AggregateBalancePerSafekeepingPlace2 `xml:"BalAtSfkpgPlc,omitempty"`
}
func (a *AggregateBalanceInformation2) AddAggregateQuantity() *BalanceQuantity1Choice {
a.AggregateQuantity = new(BalanceQuantity1Choice)
return a.AggregateQuantity
}
func (a *AggregateBalanceInformation2) SetDaysAccrued(value string) {
a.DaysAccrued = (*Number)(&value)
}
func (a *AggregateBalanceInformation2) AddHoldingValue(value, currency string) {
a.HoldingValue = append(a.HoldingValue, NewActiveOrHistoricCurrencyAndAmount(value, currency))
}
func (a *AggregateBalanceInformation2) SetAccruedInterestAmount(value, currency string) {
a.AccruedInterestAmount = NewActiveOrHistoricCurrencyAndAmount(value, currency)
}
func (a *AggregateBalanceInformation2) SetBookValue(value, currency string) {
a.BookValue = NewActiveOrHistoricCurrencyAndAmount(value, currency)
}
func (a *AggregateBalanceInformation2) AddSafekeepingPlace() *SafekeepingPlaceFormatChoice {
a.SafekeepingPlace = new(SafekeepingPlaceFormatChoice)
return a.SafekeepingPlace
}
func (a *AggregateBalanceInformation2) AddFinancialInstrumentDetails() *FinancialInstrument4 {
a.FinancialInstrumentDetails = new(FinancialInstrument4)
return a.FinancialInstrumentDetails
}
func (a *AggregateBalanceInformation2) AddPriceDetails() *PriceInformation1 {
newValue := new(PriceInformation1)
a.PriceDetails = append(a.PriceDetails, newValue)
return newValue
}
func (a *AggregateBalanceInformation2) AddForeignExchangeDetails() *ForeignExchangeTerms3 {
a.ForeignExchangeDetails = new(ForeignExchangeTerms3)
return a.ForeignExchangeDetails
}
func (a *AggregateBalanceInformation2) AddBalanceBreakdownDetails() *SubBalanceInformation1 {
newValue := new(SubBalanceInformation1)
a.BalanceBreakdownDetails = append(a.BalanceBreakdownDetails, newValue)
return newValue
}
func (a *AggregateBalanceInformation2) AddAdditionalBalanceBreakdownDetails() *AdditionalBalanceInformation {
newValue := new(AdditionalBalanceInformation)
a.AdditionalBalanceBreakdownDetails = append(a.AdditionalBalanceBreakdownDetails, newValue)
return newValue
}
func (a *AggregateBalanceInformation2) AddBalanceAtSafekeepingPlace() *AggregateBalancePerSafekeepingPlace2 {
newValue := new(AggregateBalancePerSafekeepingPlace2)
a.BalanceAtSafekeepingPlace = append(a.BalanceAtSafekeepingPlace, newValue)
return newValue
} | AggregateBalanceInformation2.go | 0.867934 | 0.551332 | AggregateBalanceInformation2.go | starcoder |
package layers
import (
"fmt"
"gitlab.com/akita/mgpusim/driver"
"gitlab.com/akita/mgpusim/insts"
"gitlab.com/akita/mgpusim/kernels"
)
// TensorOperator can perform operations on tensors.
type TensorOperator struct {
driver *driver.Driver
context *driver.Context
gemmKernel *insts.HsaCo
transposeKernel *insts.HsaCo
transposeTensorKernel *insts.HsaCo
dilateTensorKernel *insts.HsaCo
elemWiseAddKernel *insts.HsaCo
}
// NewTensorOperator creates a new tensor operator, injecting depencies // including the GPU driver and the GPU context.
func NewTensorOperator(
driver *driver.Driver,
context *driver.Context,
) *TensorOperator {
to := &TensorOperator{
driver: driver,
context: context,
}
to.loadGemmKernel()
to.loadMatrixTransposeKernel()
to.loadTransposeTensorKernel()
to.loadDilateTensorKernel()
to.loadElemWiseKernels()
return to
}
func (to *TensorOperator) loadGemmKernel() {
bytes := _escFSMustByte(false, "/gpu_gemm.hsaco")
to.gemmKernel = kernels.LoadProgramFromMemory(bytes,
"gemm")
if to.gemmKernel == nil {
panic("failed to load femm kernel")
}
}
func (to *TensorOperator) loadMatrixTransposeKernel() {
bytes := _escFSMustByte(false, "/trans.hsaco")
to.transposeKernel = kernels.LoadProgramFromMemory(bytes,
"Transpose")
if to.transposeKernel == nil {
panic("failed to load matrix transpose kernel")
}
}
func (to *TensorOperator) loadTransposeTensorKernel() {
bytes := _escFSMustByte(false, "/transpose.hsaco")
to.transposeTensorKernel = kernels.LoadProgramFromMemory(bytes,
"transpose_tensor")
if to.transposeKernel == nil {
panic("failed to load transpose tensor kernel")
}
}
func (to *TensorOperator) loadDilateTensorKernel() {
bytes := _escFSMustByte(false, "/dilate.hsaco")
to.dilateTensorKernel = kernels.LoadProgramFromMemory(
bytes, "dilate_tensor")
if to.transposeKernel == nil {
panic("failed to load dilate tensor kernel")
}
}
func (to *TensorOperator) loadElemWiseKernels() {
bytes := _escFSMustByte(false, "/element_wise.hsaco")
to.elemWiseAddKernel = kernels.LoadProgramFromMemory(bytes,
"add")
if to.elemWiseAddKernel == nil {
panic("failed to load element-wise add kernel")
}
}
// CreateTensor creates a new Tensor.
func (to *TensorOperator) CreateTensor(size []int) *Tensor {
sizeOfFloat := 4
numElement := 1
for _, s := range size {
numElement *= s
}
m := &Tensor{
driver: to.driver,
ctx: to.context,
size: size,
ptr: to.driver.AllocateMemory(
to.context, uint64(numElement*sizeOfFloat)),
}
hostData := make([]float32, numElement)
to.driver.MemCopyH2D(to.context, m.ptr, hostData)
return m
}
// CreateTensorWithBuf creates a new tensor without allocating new GPU memory.
func (to *TensorOperator) CreateTensorWithBuf(
ptr driver.GPUPtr,
size []int,
) *Tensor {
t := &Tensor{
driver: to.driver,
ctx: to.context,
size: size,
ptr: ptr,
}
return t
}
// Dump prints the tensor content to a string
func (to *TensorOperator) Dump(name string, tensor *Tensor) string {
sizeOfFloat := 4
hData := make([]float32, tensor.NumElement()*sizeOfFloat)
to.driver.MemCopyD2H(to.context, hData, tensor.ptr)
// currPos := make([]int, len(tensor.size)+1)
dimSize := make([]int, tensor.Dim())
product := 1
for i := tensor.Dim() - 1; i >= 0; i-- {
product *= tensor.size[i]
dimSize[i] = product
}
out := fmt.Sprintf("\n\n%s:\n", name)
indent := 0
for i := 0; i < tensor.NumElement(); i++ {
for _, d := range dimSize {
if i%d == 0 {
out += "\n"
for k := 0; k < indent; k++ {
out += " "
}
out += "["
indent++
}
}
out += fmt.Sprintf("%4f, ", hData[i])
for _, d := range dimSize {
if (i+1)%d == 0 {
out += "],"
indent--
}
}
}
out += "\n"
return out
}
// Free fress the metory of the tensor.
func (to *TensorOperator) Free(t *Tensor) {
err := to.driver.FreeMemory(to.context, t.ptr)
if err != nil {
panic(err)
}
}
// ToGPU copies the metory to a GPU.
func (to *TensorOperator) ToGPU(m *Tensor, data []float32) {
to.driver.MemCopyH2D(to.context, m.ptr, data)
}
// FromGPU copiles the data back from the GPU.
func (to *TensorOperator) FromGPU(m *Tensor, data []float32) {
to.driver.MemCopyD2H(to.context, data, m.ptr)
}
// GemmKernArgs represents the kernel arguments of the gemm operation.
type GemmKernArgs struct {
M, N, K int32
Alpha, Beta float32
Padding int32
A, B, C, D driver.GPUPtr
OffsetX, OffsetY, OffsetZ int32
}
// Gemm calculates D = alpha * A * B + beta * C.
func (to *TensorOperator) Gemm(
transA, transB bool,
m, n, k int,
alpha, beta float32,
matrixA, matrixB, matrixC, matrixD *Tensor,
) {
blockSize := 16
wiWidth := uint32(n)
wiHeight := uint32(m)
kernArg := GemmKernArgs{
M: int32(m),
N: int32(n),
K: int32(k),
Alpha: alpha,
Beta: beta,
A: matrixA.ptr,
B: matrixB.ptr,
C: matrixC.ptr,
D: matrixD.ptr,
}
to.driver.LaunchKernel(
to.context,
to.gemmKernel,
[3]uint32{wiWidth, wiHeight, 1},
[3]uint16{uint16(blockSize), uint16(blockSize), 1},
&kernArg,
)
}
// MatrixTransposeKernelArgs represents the kernel arguments of the matrix
// transpose kernel.
type MatrixTransposeKernelArgs struct {
Input driver.GPUPtr
Output driver.GPUPtr
OutputWidth int32
OutputHeight int32
HiddenGlobalOffsetX int64
HiddenGlobalOffsetY int64
HiddenGlobalOffsetZ int64
}
// TransposeMatrix transposes the in Matrix and stores the results in the out
// Matrix.
func (to *TensorOperator) TransposeMatrix(in, out *Tensor) {
to.mustBeMatrix(in)
to.mustBeMatrix(out)
blockSize := 16
wiWidth := uint32(out.size[1])
wiHeight := uint32(out.size[0])
kernArg := MatrixTransposeKernelArgs{
Input: in.ptr,
Output: out.ptr,
OutputWidth: int32(in.size[0]),
OutputHeight: int32(in.size[1]),
HiddenGlobalOffsetX: 0,
HiddenGlobalOffsetY: 0,
HiddenGlobalOffsetZ: 0,
}
to.driver.LaunchKernel(
to.context,
to.transposeKernel,
[3]uint32{wiWidth, wiHeight, 1},
[3]uint16{uint16(blockSize), uint16(blockSize), 1},
&kernArg,
)
out.size = []int{in.size[1], in.size[0]}
}
func (to *TensorOperator) mustBeMatrix(t *Tensor) {
if t.Dim() != 2 {
panic("not a matrix")
}
}
type transposeTensorArgs struct {
In driver.GPUPtr
Out driver.GPUPtr
InSize driver.GPUPtr
OutSize driver.GPUPtr
Order driver.GPUPtr
InIndexBuf driver.GPUPtr
OutIndexBuf driver.GPUPtr
Dim int32
Padding int32
OffsetX, OffsetY, OffsetZ int32
}
// TransposeTensor reorders the axis order.
func (to *TensorOperator) TransposeTensor(in, out *Tensor, order []int) {
sizeOfInt32 := int32(4)
dim := int32(in.Dim())
hOrder := make([]int32, dim)
hInSize := make([]int32, dim)
hOutSize := make([]int32, dim)
for i := int32(0); i < dim; i++ {
hOrder[i] = int32(order[i])
hInSize[i] = int32(in.size[i])
hOutSize[i] = int32(out.size[i])
}
dOrder := to.driver.AllocateMemory(to.context, uint64(dim*sizeOfInt32))
to.driver.MemCopyH2D(to.context, dOrder, hOrder)
defer to.driver.FreeMemory(to.context, dOrder)
dInSize := to.driver.AllocateMemory(to.context, uint64(dim*sizeOfInt32))
to.driver.MemCopyH2D(to.context, dInSize, hInSize)
defer to.driver.FreeMemory(to.context, dInSize)
dOutSize := to.driver.AllocateMemory(to.context, uint64(dim*sizeOfInt32))
to.driver.MemCopyH2D(to.context, dOutSize, hOutSize)
defer to.driver.FreeMemory(to.context, dOutSize)
dInIndexBuf := to.driver.AllocateMemory(to.context,
uint64(int32(in.NumElement())*dim*sizeOfInt32))
defer to.driver.FreeMemory(to.context, dInIndexBuf)
dOutIndexBuf := to.driver.AllocateMemory(to.context,
uint64(int32(in.NumElement())*dim*sizeOfInt32))
defer to.driver.FreeMemory(to.context, dOutIndexBuf)
args := transposeTensorArgs{
In: in.ptr,
Out: out.ptr,
InSize: dInSize,
OutSize: dOutSize,
Order: dOrder,
InIndexBuf: dInIndexBuf,
OutIndexBuf: dOutIndexBuf,
Dim: dim,
}
to.driver.LaunchKernel(
to.context,
to.transposeTensorKernel,
[3]uint32{uint32(in.NumElement()), 1, 1},
[3]uint16{uint16(64), 1, 1},
&args,
)
out.descriptor = ""
for i := 0; i < len(in.descriptor); i++ {
out.descriptor += string(in.descriptor[order[i]])
}
}
// Rotate180 will rotate the lowest two dimensions by 180 degree.
func (to *TensorOperator) Rotate180(in, out *Tensor) {
inV := in.Vector()
outV := make([]float64, len(inV))
for i := 0; i < len(inV); i++ {
outIndex := i
outPos := make([]int, len(in.size))
inPos := make([]int, len(in.size))
sizeLeft := outIndex
accumulatedLength := 1
for d := 0; d < len(in.size); d++ {
p := sizeLeft % in.size[len(in.size)-d-1]
sizeLeft /= in.size[len(in.size)-d-1]
outPos[len(in.size)-d-1] = p
}
for d := 0; d < len(in.size); d++ {
if d < len(in.size)-2 {
inPos[d] = outPos[d]
} else {
inPos[d] = in.size[d] - outPos[d] - 1
}
}
inIndex := 0
accumulatedLength = 1
for d := 0; d < len(in.size); d++ {
inIndex += inPos[len(in.size)-d-1] * accumulatedLength
accumulatedLength *= in.size[len(in.size)-d-1]
}
outV[outIndex] = inV[inIndex]
}
out.Init(outV, in.size)
}
// Repeat can duplicate the elements in a tensor by the given number of times.
func (to *TensorOperator) Repeat(in, out *Tensor, times int) {
sizeOfFloat := 4
ptr := out.ptr
for i := 0; i < times; i++ {
to.driver.MemCopyD2D(to.context, ptr, in.ptr,
in.NumElement()*sizeOfFloat)
ptr += driver.GPUPtr(in.NumElement() * sizeOfFloat)
}
}
type dilateTensorKernelArg struct {
In driver.GPUPtr
Out driver.GPUPtr
InSize driver.GPUPtr
OutSize driver.GPUPtr
Dilate driver.GPUPtr
InIndexBuf driver.GPUPtr
OutIndexBuf driver.GPUPtr
Dim int32
Padding int32
OffsetX, OffsetY, OffsetZ int32
}
// Dilate adds zeros between the original elements.
func (to *TensorOperator) Dilate(in, out *Tensor, dilate [2]int) {
sizeOfInt32 := int32(4)
dim := int32(in.Dim())
hDilate := make([]int32, 2)
hInSize := make([]int32, dim)
hOutSize := make([]int32, dim)
for i := int32(0); i < dim; i++ {
hInSize[i] = int32(in.size[i])
hOutSize[i] = int32(out.size[i])
}
hDilate[0] = int32(dilate[0])
hDilate[1] = int32(dilate[1])
dDilate := to.driver.AllocateMemory(to.context, uint64(dim*sizeOfInt32))
to.driver.MemCopyH2D(to.context, dDilate, hDilate)
defer to.driver.FreeMemory(to.context, dDilate)
dInSize := to.driver.AllocateMemory(to.context, uint64(dim*sizeOfInt32))
to.driver.MemCopyH2D(to.context, dInSize, hInSize)
defer to.driver.FreeMemory(to.context, dInSize)
dOutSize := to.driver.AllocateMemory(to.context, uint64(dim*sizeOfInt32))
to.driver.MemCopyH2D(to.context, dOutSize, hOutSize)
defer to.driver.FreeMemory(to.context, dOutSize)
dInIndexBuf := to.driver.AllocateMemory(to.context,
uint64(int32(in.NumElement())*dim*sizeOfInt32))
defer to.driver.FreeMemory(to.context, dInIndexBuf)
dOutIndexBuf := to.driver.AllocateMemory(to.context,
uint64(int32(in.NumElement())*dim*sizeOfInt32))
defer to.driver.FreeMemory(to.context, dOutIndexBuf)
args := dilateTensorKernelArg{
In: in.ptr,
Out: out.ptr,
InSize: dInSize,
OutSize: dOutSize,
Dilate: dDilate,
InIndexBuf: dInIndexBuf,
OutIndexBuf: dOutIndexBuf,
Dim: dim,
}
to.driver.LaunchKernel(
to.context,
to.dilateTensorKernel,
[3]uint32{uint32(out.NumElement()), 1, 1},
[3]uint16{uint16(64), 1, 1},
&args,
)
}
type elemWiseAddKernArg struct {
Out, In1, In2 driver.GPUPtr
N, Padding int32
OffsetX, OffsetY, OffsetZ int64
}
// ElemWiseAdd performs element-wise add operation by adding elements in in1
// and in2 and store the results in out.
func (to *TensorOperator) ElemWiseAdd(in1, in2, out *Tensor) {
args := elemWiseAddKernArg{
out.ptr, in1.ptr, out.ptr,
int32(out.NumElement()),
0,
0, 0, 0,
}
to.driver.LaunchKernel(
to.context, to.elemWiseAddKernel,
[3]uint32{uint32(out.NumElement()), 1, 1},
[3]uint16{64, 1, 1},
&args,
)
} | benchmarks/dnn/layers/tensoroperator.go | 0.682468 | 0.47457 | tensoroperator.go | starcoder |
package hzgorm
import (
"fmt"
"github.com/jinzhu/gorm"
"reflect"
"strings"
"unicode"
)
type hzGormUtils struct {
}
func (hzutils *hzGormUtils) stringBetween(value string, start string, end string) string {
posFirst := strings.Index(value, start)
if posFirst == -1 {
return ""
}
posLast := strings.Index(value, end)
if posLast == -1 {
return ""
}
posFirstAdjusted := posFirst + len(start)
if posFirstAdjusted >= posLast {
return ""
}
return value[posFirstAdjusted:posLast]
}
func (hzutils *hzGormUtils) stringBefore(value string, c string) string {
pos := strings.Index(value, c)
if pos == -1 {
return ""
}
return value[0:pos]
}
func (hzutils *hzGormUtils) stringAfter(value string, c string) string {
pos := strings.LastIndex(value, c)
if pos == -1 {
return ""
}
adjustedPos := pos + len(c)
if adjustedPos >= len(value) {
return ""
}
return value[adjustedPos:len(value)]
}
func (hzutils *hzGormUtils) stringCaseInsensitiveContains(s, substr string) bool {
s, substr = strings.ToUpper(s), strings.ToUpper(substr)
return strings.Contains(s, substr)
}
func (hzutils *hzGormUtils) structGetFieldNamesDeep(t reflect.Type, fieldNames *[]string) []string {
structMap := map[reflect.Type]string{}
for i := 0; i < t.NumField(); i++ {
field := t.Field(i)
fieldName := field.Name
fieldType := field.Type
firstRune := []rune(fieldName)[0]
if unicode.IsUpper(firstRune) && fieldType != reflect.TypeOf(gorm.Model{}) {
*fieldNames = append(*fieldNames, fieldName)
}
if fieldType.Kind() == reflect.Struct {
structMap[fieldType] = fieldName
}
}
for k, _ := range structMap {
hzutils.structGetFieldNamesDeep(k, fieldNames)
}
return *fieldNames
}
func (hzutils *hzGormUtils) determinePrimaryKeyValue(val reflect.Value, primaryKey string) string {
var temp []reflect.Value
var primaryKeyValue interface{}
for i := 0; i < val.Type().NumField(); i++ {
if reflect.Struct == val.Field(i).Kind() {
temp = append(temp, val.Field(i))
}
f := val.Type().Field(i)
if strings.EqualFold(f.Name, primaryKey) {
primaryKeyValue = val.Field(i)
break
}
}
if primaryKeyValue == nil {
for _, temp := range temp {
if primaryKeyValue = hzutils.determinePrimaryKeyValue(temp, primaryKey); primaryKeyValue != nil {
break
}
}
}
return fmt.Sprintf("%v", primaryKeyValue)
}
func (hzutils *hzGormUtils) createNewStructType(value reflect.Value) reflect.Type {
switch value.Kind() {
case reflect.Slice:
return reflect.New(value.Type().Elem()).Elem().Type()
case reflect.Struct:
return reflect.New(value.Type()).Elem().Type()
}
return value.Type()
}
func (hzutils *hzGormUtils) createNewStructInterface(value reflect.Value) interface{} {
switch value.Kind() {
case reflect.Slice:
return reflect.New(value.Type().Elem()).Interface()
case reflect.Struct:
return reflect.New(value.Type()).Interface()
}
return value.Interface()
} | utils.go | 0.507324 | 0.403156 | utils.go | starcoder |
package px
import (
"math"
"github.com/giorgiga/sstats"
)
type PixelSet struct {
pixels []Pixel
rgbStats [3]sstats.Summary
}
func MakePixelSet(pixels []Pixel) PixelSet {
rgbStats := [3]sstats.Summary{ sstats.MakeSummary(), sstats.MakeSummary(), sstats.MakeSummary() }
for _,rgb := range pixels {
rgbStats[0].Meet( float64( rgb[0] ) )
rgbStats[1].Meet( float64( rgb[1] ) )
rgbStats[2].Meet( float64( rgb[2] ) )
}
return PixelSet{ pixels, rgbStats }
}
func (pset *PixelSet) Size() int {
return len(pset.pixels)
}
func (pset *PixelSet) Empty() bool {
return len(pset.pixels) == 0
}
func (pset *PixelSet) Mean() Pixel {
return Pixel{
uint8( math.Floor(pset.rgbStats[0].Mean() + .5) ),
uint8( math.Floor(pset.rgbStats[1].Mean() + .5) ),
uint8( math.Floor(pset.rgbStats[2].Mean() + .5) ),
}
}
func (pset *PixelSet) MedianCut(axis int) (px Pixel, left PixelSet, right PixelSet) {
l := len(pset.pixels)
if (l < 2) {
if l == 0 {
return pset.Mean(), *pset, *pset
} else { // l == 1
return pset.pixels[0], *pset, MakePixelSet( []Pixel{} )
}
} else {
px := median(pset.pixels, axis)
if l % 2 == 0 {
left := MakePixelSet( pset.pixels[ :l/2] )
right := MakePixelSet( pset.pixels[l/2: ] )
return px, left, right
} else {
left := MakePixelSet( pset.pixels[ :l/2] )
right := MakePixelSet( pset.pixels[l/2+1: ] )
return px, left, right
}
}
}
func (pset *PixelSet) MaxVariance() (axis int, variance float64) {
return sstats.Max( pset.rgbStats[0].Variance(),
pset.rgbStats[1].Variance(),
pset.rgbStats[2].Variance() )
}
func (pset *PixelSet) MaxSpread() (axis int, spread float64) {
return sstats.Max( pset.rgbStats[0].Max() - pset.rgbStats[0].Min(),
pset.rgbStats[1].Max() - pset.rgbStats[1].Min(),
pset.rgbStats[2].Max() - pset.rgbStats[2].Min() )
}
// this is adapted from github.com/giorgiga/sstats - see there for comments
func median(pixels []Pixel, axis int) Pixel {
sz := len(pixels)
switch sz {
case 0: return Pixel{}
case 1: return pixels[0]
default: return findIth(pixels, axis, sz/2, sz % 2 == 0)
}
}
func findIth(values []Pixel, axis int, i int, domean bool) Pixel {
pi := qSortRoundR(values, axis, len(values)/2)
if i < pi {
return findIth(values[:pi], axis, i, domean)
} else if pi < i {
return findIth(values[pi:], axis, i - pi, domean)
} else if domean {
prev := values[0]
for _,p := range values[:i] {
if p[axis] > prev[axis] { prev = p }
}
pset := MakePixelSet( []Pixel{values[i], prev} )
return pset.Mean()
} else {
return values[i]
}
}
func qSortRoundR(values []Pixel, axis int, pivot int) int {
values[pivot], values[0] = values[0], values[pivot]
right := len(values) -1
for i := right; i > 0; i-- {
if values[i][axis] > values[0][axis] {
values[i], values[right] = values[right], values[i]
right--
}
}
values[right], values[0] = values[0], values[right]
return right
} | px/pixelset.go | 0.714927 | 0.445349 | pixelset.go | starcoder |
package element
// MulNoCarry see https://hackmd.io/@gnark/modular_multiplication for more info on the algorithm
const MulNoCarry = `
{{ define "mul_nocarry" }}
var t [{{.all.NbWords}}]uint64
var c [3]uint64
{{- range $j := .all.NbWordsIndexesFull}}
{
// round {{$j}}
v := {{$.V1}}[{{$j}}]
{{- if eq $j 0}}
c[1], c[0] = bits.Mul64(v, {{$.V2}}[0])
m := c[0] * {{index $.all.QInverse 0}}
c[2] = madd0(m, {{index $.all.Q 0}}, c[0])
{{- range $i := $.all.NbWordsIndexesNoZero}}
c[1], c[0] = madd1(v, {{$.V2}}[{{$i}}], c[1])
{{- if eq $i $.all.NbWordsLastIndex}}
t[{{sub $.all.NbWords 1}}], t[{{sub $i 1}}] = madd3(m, {{index $.all.Q $i}}, c[0], c[2], c[1])
{{- else}}
c[2], t[{{sub $i 1}}] = madd2(m, {{index $.all.Q $i}}, c[2], c[0])
{{- end}}
{{- end}}
{{- else if eq $j $.all.NbWordsLastIndex}}
c[1], c[0] = madd1(v, {{$.V2}}[0], t[0])
m := c[0] * {{index $.all.QInverse 0}}
c[2] = madd0(m, {{index $.all.Q 0}}, c[0])
{{- range $i := $.all.NbWordsIndexesNoZero}}
c[1], c[0] = madd2(v, {{$.V2}}[{{$i}}], c[1], t[{{$i}}])
{{- if eq $i $.all.NbWordsLastIndex}}
z[{{sub $.all.NbWords 1}}], z[{{sub $i 1}}] = madd3(m, {{index $.all.Q $i}}, c[0], c[2], c[1])
{{- else}}
c[2], z[{{sub $i 1}}] = madd2(m, {{index $.all.Q $i}}, c[2], c[0])
{{- end}}
{{- end}}
{{- else}}
c[1], c[0] = madd1(v, {{$.V2}}[0], t[0])
m := c[0] * {{index $.all.QInverse 0}}
c[2] = madd0(m, {{index $.all.Q 0}}, c[0])
{{- range $i := $.all.NbWordsIndexesNoZero}}
c[1], c[0] = madd2(v, {{$.V2}}[{{$i}}], c[1], t[{{$i}}])
{{- if eq $i $.all.NbWordsLastIndex}}
t[{{sub $.all.NbWords 1}}], t[{{sub $i 1}}] = madd3(m, {{index $.all.Q $i}}, c[0], c[2], c[1])
{{- else}}
c[2], t[{{sub $i 1}}] = madd2(m, {{index $.all.Q $i}}, c[2], c[0])
{{- end}}
{{- end}}
{{- end }}
}
{{- end}}
{{ end }}
{{ define "mul_nocarry_v2" }}
var t [{{.all.NbWords}}]uint64
{{- range $j := .all.NbWordsIndexesFull}}
{
// round {{$j}}
{{- if eq $j 0}}
c1, c0 := bits.Mul64(y, {{$.V2}}[0])
m := c0 * {{index $.all.QInverse 0}}
c2 := madd0(m, {{index $.all.Q 0}}, c0)
{{- range $i := $.all.NbWordsIndexesNoZero}}
c1, c0 = madd1(y, {{$.V2}}[{{$i}}], c1)
{{- if eq $i $.all.NbWordsLastIndex}}
t[{{sub $.all.NbWords 1}}], t[{{sub $i 1}}] = madd3(m, {{index $.all.Q $i}}, c0, c2, c1)
{{- else}}
c2, t[{{sub $i 1}}] = madd2(m, {{index $.all.Q $i}}, c2, c0)
{{- end}}
{{- end}}
{{- else if eq $j $.all.NbWordsLastIndex}}
m := t[0] * {{index $.all.QInverse 0}}
c2 := madd0(m, {{index $.all.Q 0}}, t[0])
{{- range $i := $.all.NbWordsIndexesNoZero}}
{{- if eq $i $.all.NbWordsLastIndex}}
z[{{sub $.all.NbWords 1}}], z[{{sub $i 1}}] = madd2(m, {{index $.all.Q $i}}, t[{{$i}}], c2)
{{- else}}
c2, z[{{sub $i 1}}] = madd2(m, {{index $.all.Q $i}}, c2, t[{{$i}}])
{{- end}}
{{- end}}
{{- else}}
m := t[0] * {{index $.all.QInverse 0}}
c2 := madd0(m, {{index $.all.Q 0}}, t[0])
{{- range $i := $.all.NbWordsIndexesNoZero}}
{{- if eq $i $.all.NbWordsLastIndex}}
t[{{sub $.all.NbWords 1}}], t[{{sub $i 1}}] = madd2(m, {{index $.all.Q $i}}, t[{{$i}}], c2)
{{- else}}
c2, t[{{sub $i 1}}] = madd2(m, {{index $.all.Q $i}}, c2, t[{{$i}}])
{{- end}}
{{- end}}
{{- end }}
}
{{- end}}
{{ end }}
` | field/internal/templates/element/mul_nocarry.go | 0.50952 | 0.514888 | mul_nocarry.go | starcoder |
package day3
import (
"math"
"strconv"
"strings"
)
type path struct {
direction string
length int
}
// Point reflects a position within the wire coordindate system
type Point struct {
x int16
y int16
}
// CrossingPoint reflect the coordinate where 2 wires cross. Steps holds the steps for both wires to reach the crossing.
type CrossingPoint struct {
point Point
steps int
}
// GetNearestCrossingWithDistance returns the manhattan distance of nearest crossing point.
func GetNearestCrossingWithDistance(crossings []CrossingPoint) float64 {
nearestDistance := -1.0
for _, crossingPoint := range crossings {
distance := math.Abs(float64(crossingPoint.point.x)) + math.Abs(float64(crossingPoint.point.y))
if nearestDistance == -1.0 {
nearestDistance = distance
} else {
if distance < nearestDistance {
nearestDistance = distance
}
}
}
return nearestDistance
}
// GetShortestStepCrossing calculates the crossing that is reached with the shortes amount of steps
func GetShortestStepCrossing(crossings []CrossingPoint) int {
var steps int
for idx, cp := range crossings {
if idx == 0 {
steps = cp.steps
} else {
if cp.steps < steps {
steps = cp.steps
}
}
}
return steps
}
// GetCrossings finds the Points that both wire coordinates have in common aka the crossings.
func GetCrossings(coordinatesWire0 []Point, coordinatesWire1 []Point) (crossings []CrossingPoint) {
crossings = []CrossingPoint{}
for idx, point := range coordinatesWire1 {
found, position := containsElement(coordinatesWire0, point)
if found {
crossings = append(crossings, CrossingPoint{point: point, steps: position + idx})
}
}
// remove first element as this is the starting point 0,0
crossings = crossings[1:]
return
}
// WireInstructionsToCoordinates takes stringified instructions for a wire and transforms them to coordinates reflected by the Point struct.
func WireInstructionsToCoordinates(instructions string) ([]Point, error) {
coordinates := []Point{{x: 0, y: 0}}
paths, err := splitInputToPath(instructions)
if err != nil {
return nil, err
}
for _, path := range paths {
coordinates = insertPathCoordinates(path, coordinates)
}
return coordinates, nil
}
// containsElement checks if the given needle is found in the haystack and at which position
func containsElement(haystack []Point, needle Point) (bool, int) {
for idx, element := range haystack {
if element.x == needle.x && element.y == needle.y {
return true, idx
}
}
return false, -1
}
// insertPathCoordinates creates points from the paths and inserts them into coordinates
func insertPathCoordinates(path path, coordinates []Point) []Point {
// create points slice from path
points := pathToPoints(path, coordinates[len(coordinates)-1])
for _, point := range points {
coordinates = append(coordinates, point)
}
return coordinates
}
func pathToPoints(path path, start Point) []Point {
result := make([]Point, 0)
for i := 1; i <= path.length; i++ {
switch path.direction {
case "R":
result = append(result, Point{x: start.x + int16(i), y: start.y})
case "D":
result = append(result, Point{x: start.x, y: start.y - int16(i)})
case "L":
result = append(result, Point{x: start.x - int16(i), y: start.y})
case "U":
result = append(result, Point{x: start.x, y: start.y + int16(i)})
}
}
return result
}
// splitInputToPath splits the given string into "path" instances
func splitInputToPath(input string) ([]path, error) {
var paths []path
elements := strings.Split(input, ",")
for _, v := range elements {
length, err := strconv.Atoi(v[1:])
if err != nil {
return nil, err
}
paths = append(paths, path{v[:1], length})
}
return paths, nil
} | day3-crossed-wires/day3/day3.go | 0.820073 | 0.764892 | day3.go | starcoder |
package search
import (
"log"
"github.com/chippydip/go-sc2ai/api"
"github.com/chippydip/go-sc2ai/botutil"
"github.com/chippydip/go-sc2ai/enums/ability"
"github.com/chippydip/go-sc2ai/enums/unit"
)
var sizeCache = map[api.UnitTypeID]api.Size2DI{}
// UnitPlacementSize estimates building footprints based on unit radius.
func UnitPlacementSize(u botutil.Unit) api.Size2DI {
if s, ok := sizeCache[u.UnitType]; ok {
return s
}
// Round coordinate to the nearest half (not needed except for things like the KD8Charge)
x, y := float32(int32(u.Pos.X*2+0.5))/2, float32(int32(u.Pos.Y*2+0.5))/2
xEven, yEven := int(u.Pos.X*2+0.5)%2 == 0, int(u.Pos.Y*2+0.5)%2 == 0
// Compute bounds based on the (bad) radius provided by the game
xMin, yMin := int32(x-u.Radius+0.5), int32(y-u.Radius+0.5)
xMax, yMax := int32(x+u.Radius+0.5), int32(y+u.Radius+0.5)
// Get the real radius in all four directions as calculated above
rxMin, ryMin := x-float32(xMin), y-float32(yMin)
rxMax, ryMax := float32(xMax)-x, float32(yMax)-y
// If the radii are not symetric, take the smaller value
rx, ry := rxMin, ryMin
if rxMax < rx {
rx = rxMax
}
if ryMax < ry {
ry = ryMax
}
// Re-compute bounds with the hopefully better radii
xMin, yMin = int32(u.Pos.X-rx+0.5), int32(u.Pos.Y-ry+0.5)
xMax, yMax = int32(u.Pos.X+rx+0.5), int32(u.Pos.Y+ry+0.5)
// Adjust for non-square structures (TODO: should this just special-case Minerals?)
if xEven != yEven {
if yEven {
xMin++
xMax--
} else {
yMin++
yMax--
}
}
// Cache and return the computed size
size := api.Size2DI{X: xMax - xMin, Y: yMax - yMin}
sizeCache[u.UnitType] = size
log.Printf("%v %v %v -> %v", unit.String(u.UnitType), u.Pos2D(), u.Radius, size)
return size
}
// PlacementGrid ...
type PlacementGrid struct {
raw api.ImageDataBits
grid api.ImageDataBits
structures map[api.UnitTag]structureInfo
}
type structureInfo struct {
point api.Point2D
size api.Size2DI
}
// NewPlacementGrid ...
func NewPlacementGrid(bot *botutil.Bot) *PlacementGrid {
raw := bot.GameInfo().GetStartRaw().GetPlacementGrid().Bits()
pg := &PlacementGrid{
raw: raw,
grid: raw.Copy(),
structures: map[api.UnitTag]structureInfo{},
}
update := func() {
// Remove any units that are gone or have changed type or position
for k, v := range pg.structures {
if u := bot.UnitByTag(k); u.IsNil() || !u.IsStructure() || u.Pos2D() != v.point || UnitPlacementSize(u) != v.size {
pg.markGrid(v.point, v.size, true)
delete(pg.structures, k)
}
}
// (Re-)add new units or ones that have changed type or position
bot.AllUnits().Each(func(u botutil.Unit) {
if _, ok := pg.structures[u.Tag]; !ok && u.IsStructure() {
v := structureInfo{u.Pos2D(), UnitPlacementSize(u)}
pg.markGrid(v.point, v.size, false)
pg.structures[u.Tag] = v
}
})
}
bot.OnAfterStep(update)
update()
var req []*api.RequestQueryBuildingPlacement
var lut []api.UnitTypeID
for k, v := range pg.structures {
xMin, yMin := int32(v.point.X-float32(v.size.X)/2), int32(v.point.Y-float32(v.size.Y)/2)
xMax, yMax := xMin+v.size.X, yMin+v.size.Y
for y := yMin; y < yMax; y++ {
for x := xMin; x < xMax; x++ {
if pg.grid.Get(x, y) != raw.Get(x, y) {
req = append(req, &api.RequestQueryBuildingPlacement{
AbilityId: ability.Build_SensorTower,
TargetPos: &api.Point2D{X: float32(x) + 0.5, Y: float32(y) + 0.5},
})
lut = append(lut, bot.UnitByTag(k).UnitType)
}
}
}
}
resp := bot.Query(api.RequestQuery{
Placements: req,
})
heightMap := NewHeightMap(bot.GameInfo().StartRaw)
var ok, inval = 0, 0
for i, r := range resp.GetPlacements() {
var color *api.Color
if r.GetResult() == api.ActionResult_Success {
color = green
inval++
} else {
color = red
ok++
}
v := req[i].TargetPos
z := heightMap.Interpolate(v.X, v.Y)
queryBoxes = append(queryBoxes, &api.DebugBox{
Color: color,
Min: &api.Point{X: v.X - 0.375, Y: v.Y - 0.375, Z: z},
Max: &api.Point{X: v.X + 0.375, Y: v.Y + 0.375, Z: z + 1},
})
}
log.Printf("ok: %v, inval: %v", ok, inval)
return pg
}
var queryBoxes []*api.DebugBox
func (pg *PlacementGrid) markGrid(pos api.Point2D, size api.Size2DI, value bool) {
xMin, yMin := int32(pos.X-float32(size.X)/2), int32(pos.Y-float32(size.Y)/2)
xMax, yMax := xMin+size.X, yMin+size.Y
for y := yMin; y < yMax; y++ {
for x := xMin; x < xMax; x++ {
pg.grid.Set(x, y, value)
}
}
}
func (pg *PlacementGrid) checkGrid(pos api.Point2D, size api.Size2DI, value bool) bool {
xMin, yMin := int32(pos.X-float32(size.X)/2), int32(pos.Y-float32(size.Y)/2)
xMax, yMax := xMin+size.X, yMin+size.Y
for y := yMin; y < yMax; y++ {
for x := xMin; x < xMax; x++ {
if pg.grid.Get(x, y) != value {
return false
}
}
}
return true
}
// CanPlace checks if a structure of a certain type can currently be places at the given location.
func (pg *PlacementGrid) CanPlace(u botutil.Unit, pos api.Point2D) bool {
return pg.checkGrid(pos, UnitPlacementSize(u), true)
}
// DebugPrint ...
func (pg *PlacementGrid) DebugPrint(bot *botutil.Bot) {
heightMap := NewHeightMap(bot.GameInfo().StartRaw)
var boxes []*api.DebugBox
for _, v := range pg.structures {
z := heightMap.Interpolate(v.point.X, v.point.Y)
boxes = append(boxes, &api.DebugBox{
Min: &api.Point{X: v.point.X - float32(v.size.X)/2, Y: v.point.Y - float32(v.size.Y)/2, Z: z},
Max: &api.Point{X: v.point.X + float32(v.size.X)/2, Y: v.point.Y + float32(v.size.Y)/2, Z: z + 1},
})
}
bot.SendDebugCommands([]*api.DebugCommand{
&api.DebugCommand{
Command: &api.DebugCommand_Draw{
Draw: &api.DebugDraw{
Boxes: boxes,
},
},
},
&api.DebugCommand{
Command: &api.DebugCommand_Draw{
Draw: &api.DebugDraw{
Boxes: queryBoxes,
},
},
},
})
} | search/placement.go | 0.561936 | 0.408454 | placement.go | starcoder |
// +build linux
package v4l
import "io"
// A Buffer holds the raw image data of a frame captured from a Device. It
// implements io.Reader, io.ByteReader, io.ReaderAt, and io.Seeker. A call to
// Capture, Close, or TurnOff on the corresponding Device may cause the contents
// of the buffer to go away.
type Buffer struct {
d *device
n uint64
pos int
seq uint32
}
// Size returns the total number of bytes in the buffer. As long as the data is
// available, the return value is constant and unaffected by calls to the
// methods of Buffer. If the data is no longer available, it returns 0.
func (b *Buffer) Size() int64 {
return int64(len(b.source()))
}
// Len returns the number of unread bytes in the buffer. If the data is no
// longer available, it returns 0.
func (b *Buffer) Len() int {
src := b.source()
if src == nil {
return 0
}
return len(src) - b.pos
}
// SeqNum returns the sequence number of the frame in the buffer as reported by
// the kernel.
func (b *Buffer) SeqNum() uint32 {
return b.seq
}
// Read reads up to len(dst) bytes into dst, and returns the number of bytes
// read, along with any error encountered.
func (b *Buffer) Read(dst []byte) (int, error) {
src := b.source()
if src == nil {
return 0, ErrBufferGone
}
if b.pos == len(src) {
return 0, io.EOF
}
n := copy(dst, src[b.pos:])
b.pos += n
return n, nil
}
// ReadAt reads up to len(dst) bytes into dst starting at the specified offset,
// and returns the number of bytes read, along with any error encountered.
// The seek offset is unaffected by ReadAt.
func (b *Buffer) ReadAt(dst []byte, offset int64) (int, error) {
src := b.source()
if src == nil {
return 0, ErrBufferGone
}
if offset < 0 {
return 0, Error("negative offset")
}
if offset >= int64(len(src)) {
return 0, io.EOF
}
n := copy(dst, src[offset:])
if n < len(dst) {
return n, io.EOF
}
return n, nil
}
// ReadByte returns the next byte in the buffer.
func (b *Buffer) ReadByte() (byte, error) {
src := b.source()
if src == nil {
return 0, ErrBufferGone
}
if b.pos == len(src) {
return 0, io.EOF
}
x := src[b.pos]
b.pos++
return x, nil
}
// Seek sets the seek offset.
func (b *Buffer) Seek(offset int64, whence int) (int64, error) {
src := b.source()
if src == nil {
return 0, ErrBufferGone
}
var i int64
switch whence {
case io.SeekStart:
i = offset
case io.SeekCurrent:
i = int64(b.pos) + offset
case io.SeekEnd:
i = int64(len(src)) + offset
default:
return 0, Error("invalid whence")
}
if i < 0 {
return 0, Error("negative offset")
}
if i > int64(len(src)) {
i = int64(len(src))
}
b.pos = int(i)
return i, nil
}
// source returns the underlying byte slice of the buffer, or nil, if it's no
// longer available.
func (b *Buffer) source() []byte {
if b.d.nCaptures != b.n || b.d.bufIndex == noBuffer {
return nil
}
return b.d.buffers[b.d.bufIndex]
} | vendor/github.com/korandiz/v4l/buffer.go | 0.657098 | 0.500183 | buffer.go | starcoder |
package hbook
import "sort"
// indices for the 2D-binning overflows
const (
bngNW int = 1 + iota
bngN
bngNE
bngE
bngSE
bngS
bngSW
bngW
)
type binning2D struct {
bins []Bin2D
dist dist2D
outflows [8]dist2D
xrange Range
yrange Range
nx int
ny int
xedges []Bin1D
yedges []Bin1D
}
func newBinning2D(nx int, xlow, xhigh float64, ny int, ylow, yhigh float64) binning2D {
if xlow >= xhigh {
panic(errInvalidXAxis)
}
if ylow >= yhigh {
panic(errInvalidYAxis)
}
if nx <= 0 {
panic(errEmptyXAxis)
}
if ny <= 0 {
panic(errEmptyYAxis)
}
bng := binning2D{
bins: make([]Bin2D, nx*ny),
xrange: Range{Min: xlow, Max: xhigh},
yrange: Range{Min: ylow, Max: yhigh},
nx: nx,
ny: ny,
xedges: make([]Bin1D, nx),
yedges: make([]Bin1D, ny),
}
xwidth := bng.xrange.Width() / float64(bng.nx)
ywidth := bng.yrange.Width() / float64(bng.ny)
xmin := bng.xrange.Min
ymin := bng.yrange.Min
for ix := range bng.xedges {
xbin := &bng.xedges[ix]
xbin.xrange.Min = xmin + float64(ix)*xwidth
xbin.xrange.Max = xmin + float64(ix+1)*xwidth
for iy := range bng.yedges {
ybin := &bng.yedges[iy]
ybin.xrange.Min = ymin + float64(iy)*ywidth
ybin.xrange.Max = ymin + float64(iy+1)*ywidth
i := iy*nx + ix
bin := &bng.bins[i]
bin.xrange.Min = xbin.xrange.Min
bin.xrange.Max = xbin.xrange.Max
bin.yrange.Min = ybin.xrange.Min
bin.yrange.Max = ybin.xrange.Max
}
}
return bng
}
func newBinning2DFromEdges(xedges, yedges []float64) binning2D {
if len(xedges) <= 1 {
panic(errShortXAxis)
}
if !sort.IsSorted(sort.Float64Slice(xedges)) {
panic(errNotSortedXAxis)
}
if len(yedges) <= 1 {
panic(errShortYAxis)
}
if !sort.IsSorted(sort.Float64Slice(yedges)) {
panic(errNotSortedYAxis)
}
var (
nx = len(xedges) - 1
ny = len(yedges) - 1
xlow = xedges[0]
xhigh = xedges[nx]
ylow = yedges[0]
yhigh = yedges[ny]
)
bng := binning2D{
bins: make([]Bin2D, nx*ny),
xrange: Range{Min: xlow, Max: xhigh},
yrange: Range{Min: ylow, Max: yhigh},
nx: nx,
ny: ny,
xedges: make([]Bin1D, nx),
yedges: make([]Bin1D, ny),
}
for ix, xmin := range xedges[:nx] {
xmax := xedges[ix+1]
if xmin == xmax {
panic(errDupEdgesXAxis)
}
bng.xedges[ix].xrange.Min = xmin
bng.xedges[ix].xrange.Max = xmax
for iy, ymin := range yedges[:ny] {
ymax := yedges[iy+1]
if ymin == ymax {
panic(errDupEdgesYAxis)
}
i := iy*nx + ix
bin := &bng.bins[i]
bin.xrange.Min = xmin
bin.xrange.Max = xmax
bin.yrange.Min = ymin
bin.yrange.Max = ymax
}
}
for iy, ymin := range yedges[:ny] {
ymax := yedges[iy+1]
bng.yedges[iy].xrange.Min = ymin
bng.yedges[iy].xrange.Max = ymax
}
return bng
}
func (bng *binning2D) entries() int64 {
return bng.dist.Entries()
}
func (bng *binning2D) effEntries() float64 {
return bng.dist.EffEntries()
}
// xMin returns the low edge of the X-axis
func (bng *binning2D) xMin() float64 {
return bng.xrange.Min
}
// xMax returns the high edge of the X-axis
func (bng *binning2D) xMax() float64 {
return bng.xrange.Max
}
// yMin returns the low edge of the Y-axis
func (bng *binning2D) yMin() float64 {
return bng.yrange.Min
}
// yMax returns the high edge of the Y-axis
func (bng *binning2D) yMax() float64 {
return bng.yrange.Max
}
func (bng *binning2D) fill(x, y, w float64) {
idx := bng.coordToIndex(x, y)
bng.dist.fill(x, y, w)
if idx == len(bng.bins) {
// GAP bin
return
}
if idx < 0 {
bng.outflows[-idx-1].fill(x, y, w)
return
}
bng.bins[idx].fill(x, y, w)
}
func (bng *binning2D) coordToIndex(x, y float64) int {
ix := Bin1Ds(bng.xedges).IndexOf(x)
iy := Bin1Ds(bng.yedges).IndexOf(y)
switch {
case ix == bng.nx && iy == bng.ny: // GAP
return len(bng.bins)
case ix == OverflowBin && iy == OverflowBin:
return -bngNE
case ix == OverflowBin && iy == UnderflowBin:
return -bngSE
case ix == UnderflowBin && iy == UnderflowBin:
return -bngSW
case ix == UnderflowBin && iy == OverflowBin:
return -bngNW
case ix == OverflowBin:
return -bngE
case ix == UnderflowBin:
return -bngW
case iy == OverflowBin:
return -bngN
case iy == UnderflowBin:
return -bngS
}
return iy*bng.nx + ix
}
// Bins returns the slice of bins for this binning.
func (bng *binning2D) Bins() []Bin2D {
return bng.bins
} | hbook/binning2d.go | 0.612657 | 0.540196 | binning2d.go | starcoder |
package datadog
import (
"encoding/json"
"time"
)
// UsageIngestedSpansHour Ingested spans usage for a given organization for a given hour.
type UsageIngestedSpansHour struct {
// The hour for the usage.
Hour *time.Time `json:"hour,omitempty"`
// Contains the total number of bytes ingested during a given hour.
IngestedEventsBytes *int64 `json:"ingested_events_bytes,omitempty"`
// The organization name.
OrgName *string `json:"org_name,omitempty"`
// The organization public ID.
PublicId *string `json:"public_id,omitempty"`
// UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct
UnparsedObject map[string]interface{} `json:-`
}
// NewUsageIngestedSpansHour instantiates a new UsageIngestedSpansHour object
// This constructor will assign default values to properties that have it defined,
// and makes sure properties required by API are set, but the set of arguments
// will change when the set of required properties is changed
func NewUsageIngestedSpansHour() *UsageIngestedSpansHour {
this := UsageIngestedSpansHour{}
return &this
}
// NewUsageIngestedSpansHourWithDefaults instantiates a new UsageIngestedSpansHour object
// This constructor will only assign default values to properties that have it defined,
// but it doesn't guarantee that properties required by API are set
func NewUsageIngestedSpansHourWithDefaults() *UsageIngestedSpansHour {
this := UsageIngestedSpansHour{}
return &this
}
// GetHour returns the Hour field value if set, zero value otherwise.
func (o *UsageIngestedSpansHour) GetHour() time.Time {
if o == nil || o.Hour == nil {
var ret time.Time
return ret
}
return *o.Hour
}
// GetHourOk returns a tuple with the Hour field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *UsageIngestedSpansHour) GetHourOk() (*time.Time, bool) {
if o == nil || o.Hour == nil {
return nil, false
}
return o.Hour, true
}
// HasHour returns a boolean if a field has been set.
func (o *UsageIngestedSpansHour) HasHour() bool {
if o != nil && o.Hour != nil {
return true
}
return false
}
// SetHour gets a reference to the given time.Time and assigns it to the Hour field.
func (o *UsageIngestedSpansHour) SetHour(v time.Time) {
o.Hour = &v
}
// GetIngestedEventsBytes returns the IngestedEventsBytes field value if set, zero value otherwise.
func (o *UsageIngestedSpansHour) GetIngestedEventsBytes() int64 {
if o == nil || o.IngestedEventsBytes == nil {
var ret int64
return ret
}
return *o.IngestedEventsBytes
}
// GetIngestedEventsBytesOk returns a tuple with the IngestedEventsBytes field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *UsageIngestedSpansHour) GetIngestedEventsBytesOk() (*int64, bool) {
if o == nil || o.IngestedEventsBytes == nil {
return nil, false
}
return o.IngestedEventsBytes, true
}
// HasIngestedEventsBytes returns a boolean if a field has been set.
func (o *UsageIngestedSpansHour) HasIngestedEventsBytes() bool {
if o != nil && o.IngestedEventsBytes != nil {
return true
}
return false
}
// SetIngestedEventsBytes gets a reference to the given int64 and assigns it to the IngestedEventsBytes field.
func (o *UsageIngestedSpansHour) SetIngestedEventsBytes(v int64) {
o.IngestedEventsBytes = &v
}
// GetOrgName returns the OrgName field value if set, zero value otherwise.
func (o *UsageIngestedSpansHour) GetOrgName() string {
if o == nil || o.OrgName == nil {
var ret string
return ret
}
return *o.OrgName
}
// GetOrgNameOk returns a tuple with the OrgName field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *UsageIngestedSpansHour) GetOrgNameOk() (*string, bool) {
if o == nil || o.OrgName == nil {
return nil, false
}
return o.OrgName, true
}
// HasOrgName returns a boolean if a field has been set.
func (o *UsageIngestedSpansHour) HasOrgName() bool {
if o != nil && o.OrgName != nil {
return true
}
return false
}
// SetOrgName gets a reference to the given string and assigns it to the OrgName field.
func (o *UsageIngestedSpansHour) SetOrgName(v string) {
o.OrgName = &v
}
// GetPublicId returns the PublicId field value if set, zero value otherwise.
func (o *UsageIngestedSpansHour) GetPublicId() string {
if o == nil || o.PublicId == nil {
var ret string
return ret
}
return *o.PublicId
}
// GetPublicIdOk returns a tuple with the PublicId field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *UsageIngestedSpansHour) GetPublicIdOk() (*string, bool) {
if o == nil || o.PublicId == nil {
return nil, false
}
return o.PublicId, true
}
// HasPublicId returns a boolean if a field has been set.
func (o *UsageIngestedSpansHour) HasPublicId() bool {
if o != nil && o.PublicId != nil {
return true
}
return false
}
// SetPublicId gets a reference to the given string and assigns it to the PublicId field.
func (o *UsageIngestedSpansHour) SetPublicId(v string) {
o.PublicId = &v
}
func (o UsageIngestedSpansHour) MarshalJSON() ([]byte, error) {
toSerialize := map[string]interface{}{}
if o.UnparsedObject != nil {
return json.Marshal(o.UnparsedObject)
}
if o.Hour != nil {
toSerialize["hour"] = o.Hour
}
if o.IngestedEventsBytes != nil {
toSerialize["ingested_events_bytes"] = o.IngestedEventsBytes
}
if o.OrgName != nil {
toSerialize["org_name"] = o.OrgName
}
if o.PublicId != nil {
toSerialize["public_id"] = o.PublicId
}
return json.Marshal(toSerialize)
}
func (o *UsageIngestedSpansHour) UnmarshalJSON(bytes []byte) (err error) {
raw := map[string]interface{}{}
all := struct {
Hour *time.Time `json:"hour,omitempty"`
IngestedEventsBytes *int64 `json:"ingested_events_bytes,omitempty"`
OrgName *string `json:"org_name,omitempty"`
PublicId *string `json:"public_id,omitempty"`
}{}
err = json.Unmarshal(bytes, &all)
if err != nil {
err = json.Unmarshal(bytes, &raw)
if err != nil {
return err
}
o.UnparsedObject = raw
return nil
}
o.Hour = all.Hour
o.IngestedEventsBytes = all.IngestedEventsBytes
o.OrgName = all.OrgName
o.PublicId = all.PublicId
return nil
} | api/v1/datadog/model_usage_ingested_spans_hour.go | 0.693473 | 0.479991 | model_usage_ingested_spans_hour.go | starcoder |
package input
import (
"github.com/Jeffail/benthos/v3/lib/input/reader"
"github.com/Jeffail/benthos/v3/lib/log"
"github.com/Jeffail/benthos/v3/lib/message/batch"
"github.com/Jeffail/benthos/v3/lib/metrics"
"github.com/Jeffail/benthos/v3/lib/types"
"github.com/Jeffail/benthos/v3/lib/util/kafka/sasl"
"github.com/Jeffail/benthos/v3/lib/util/tls"
"github.com/Jeffail/benthos/v3/lib/x/docs"
)
//------------------------------------------------------------------------------
func init() {
Constructors[TypeKafka] = TypeSpec{
constructor: NewKafka,
Summary: `
Connects to a Kafka broker and consumes a topic and partition.`,
Description: `
Offsets are managed within kafka as per the consumer group. Only one partition
per input is supported, if you wish to balance partitions across a consumer
group look at the ` + "`kafka_balanced`" + ` input type instead.
Use the ` + "`batching`" + ` fields to configure an optional
[batching policy](/docs/configuration/batching#batch-policy). Any other batching
mechanism will stall with this input due its sequential transaction model.
### Metadata
This input adds the following metadata fields to each message:
` + "``` text" + `
- kafka_key
- kafka_topic
- kafka_partition
- kafka_offset
- kafka_lag
- kafka_timestamp_unix
- All existing message headers (version 0.11+)
` + "```" + `
The field ` + "`kafka_lag`" + ` is the calculated difference between the high
water mark offset of the partition at the time of ingestion and the current
message offset.
You can access these metadata fields using
[function interpolation](/docs/configuration/interpolation#metadata).`,
sanitiseConfigFunc: func(conf Config) (interface{}, error) {
return sanitiseWithBatch(conf.Kafka, conf.Kafka.Batching)
},
FieldSpecs: docs.FieldSpecs{
docs.FieldDeprecated("max_batch_count"),
docs.FieldCommon("addresses", "A list of broker addresses to connect to. If an item of the list contains commas it will be expanded into multiple addresses.", []string{"localhost:9092"}, []string{"localhost:9041,localhost:9042"}, []string{"localhost:9041", "localhost:9042"}),
tls.FieldSpec(),
sasl.FieldSpec(),
docs.FieldCommon("topic", "A topic to consume from."),
docs.FieldCommon("partition", "A partition to consume from."),
docs.FieldCommon("consumer_group", "An identifier for the consumer group of the connection."),
docs.FieldCommon("client_id", "An identifier for the client connection."),
docs.FieldAdvanced("start_from_oldest", "If an offset is not found for a topic parition, determines whether to consume from the oldest available offset, otherwise messages are consumed from the latest offset."),
docs.FieldAdvanced("commit_period", "The period of time between each commit of the current partition offsets. Offsets are always committed during shutdown."),
docs.FieldAdvanced("max_processing_period", "A maximum estimate for the time taken to process a message, this is used for tuning consumer group synchronization."),
docs.FieldAdvanced("fetch_buffer_cap", "The maximum number of unprocessed messages to fetch at a given time."),
docs.FieldAdvanced("target_version", "The version of the Kafka protocol to use."),
batch.FieldSpec(),
},
}
}
//------------------------------------------------------------------------------
// NewKafka creates a new Kafka input type.
func NewKafka(conf Config, mgr types.Manager, log log.Modular, stats metrics.Type) (Type, error) {
// TODO: V4 Remove this.
if conf.Kafka.MaxBatchCount > 1 {
log.Warnf("Field '%v.max_batch_count' is deprecated, use '%v.batching.count' instead.\n", conf.Type, conf.Type)
conf.Kafka.Batching.Count = conf.Kafka.MaxBatchCount
}
k, err := reader.NewKafka(conf.Kafka, mgr, log, stats)
if err != nil {
return nil, err
}
var kb reader.Type = k
if !conf.Kafka.Batching.IsNoop() {
if kb, err = reader.NewSyncBatcher(conf.Kafka.Batching, k, mgr, log, stats); err != nil {
return nil, err
}
}
return NewReader(TypeKafka, reader.NewPreserver(kb), log, stats)
}
//------------------------------------------------------------------------------ | lib/input/kafka.go | 0.711431 | 0.773002 | kafka.go | starcoder |
package executor
import (
"fmt"
"github.com/lovelly/gleam/sql/context"
"github.com/lovelly/gleam/sql/infoschema"
"github.com/lovelly/gleam/sql/model"
"github.com/lovelly/gleam/sql/plan"
)
// executorBuilder builds an Executor from a Plan.
// The InfoSchema must not change during execution.
type executorBuilder struct {
ctx context.Context
is infoschema.InfoSchema
// If there is any error during Executor building process, err is set.
err error
}
func newExecutorBuilder(ctx context.Context, is infoschema.InfoSchema) *executorBuilder {
return &executorBuilder{
ctx: ctx,
is: is,
}
}
func (b *executorBuilder) build(p plan.Plan) Executor {
switch v := p.(type) {
case nil:
b.err = fmt.Errorf("Unknown Plan %T", p)
return nil
case *plan.CheckTable:
b.err = fmt.Errorf("Unknown Plan %T", p)
return nil
case *plan.DDL:
b.err = fmt.Errorf("Unknown Plan %T", p)
return nil
case *plan.Deallocate:
b.err = fmt.Errorf("Unknown Plan %T", p)
return nil
case *plan.Delete:
b.err = fmt.Errorf("Unknown Plan %T", p)
return nil
case *plan.Execute:
b.err = fmt.Errorf("Unknown Plan %T", p)
return nil
case *plan.Explain:
b.err = fmt.Errorf("Unknown Plan %T", p)
return nil
case *plan.Insert:
b.err = fmt.Errorf("Unknown Plan %T", p)
return nil
case *plan.LoadData:
b.err = fmt.Errorf("Unknown Plan %T", p)
return nil
case *plan.Limit:
return b.buildLimit(v)
case *plan.Prepare:
b.err = fmt.Errorf("Unknown Plan %T", p)
return nil
case *plan.SelectLock:
b.err = fmt.Errorf("Unknown Plan %T", p)
return nil
case *plan.ShowDDL:
b.err = fmt.Errorf("Unknown Plan %T", p)
return nil
case *plan.Show:
b.err = fmt.Errorf("Unknown Plan %T", p)
return nil
case *plan.Simple:
b.err = fmt.Errorf("Unknown Plan %T", p)
return nil
case *plan.Set:
b.err = fmt.Errorf("Unknown Plan %T", p)
return nil
case *plan.Sort:
b.err = fmt.Errorf("Unknown Plan %T", p)
return b.buildSort(v)
case *plan.Union:
b.err = fmt.Errorf("Unknown Plan %T", p)
return b.buildUnion(v)
case *plan.Update:
b.err = fmt.Errorf("Unknown Plan %T", p)
return nil
case *plan.PhysicalUnionScan:
return b.buildUnionScanExec(v)
case *plan.PhysicalHashJoin:
b.err = fmt.Errorf("Unknown Plan %T", p)
return b.buildJoin(v)
case *plan.PhysicalHashSemiJoin:
b.err = fmt.Errorf("Unknown Plan %T", p)
return nil // b.buildSemiJoin(v)
case *plan.Selection:
b.err = fmt.Errorf("Unknown Plan %T", p)
return b.buildSelection(v)
case *plan.PhysicalAggregation:
b.err = fmt.Errorf("Unknown Plan %T", p)
return b.buildAggregation(v)
case *plan.Projection:
return b.buildProjection(v)
case *plan.PhysicalMemTable:
b.err = fmt.Errorf("Unknown Plan %T", p)
return nil
case *plan.PhysicalTableScan:
return b.buildTableScan(v)
case *plan.PhysicalIndexScan:
b.err = fmt.Errorf("Unknown Plan %T", p)
return nil
case *plan.TableDual:
b.err = fmt.Errorf("Unknown Plan %T", p)
return b.buildTableDual(v)
case *plan.PhysicalApply:
b.err = fmt.Errorf("Unknown Plan %T", p)
return b.buildApply(v)
case *plan.Exists:
b.err = fmt.Errorf("Unknown Plan %T", p)
return nil
case *plan.MaxOneRow:
b.err = fmt.Errorf("Unknown Plan %T", p)
return nil
case *plan.Trim:
b.err = fmt.Errorf("Unknown Plan %T", p)
return nil
case *plan.PhysicalDummyScan:
b.err = fmt.Errorf("Unknown Plan %T", p)
return nil
case *plan.Cache:
b.err = fmt.Errorf("Unknown Plan %T", p)
return nil
default:
b.err = fmt.Errorf("Unknown Plan %T", p)
return nil
}
}
func (b *executorBuilder) buildLimit(v *plan.Limit) Executor {
src := b.build(v.GetChildByIndex(0))
e := &LimitExec{
Src: src,
Offset: v.Offset,
Count: v.Count,
schema: v.GetSchema(),
}
return e
}
func (b *executorBuilder) buildUnionScanExec(v *plan.PhysicalUnionScan) Executor {
src := b.build(v.GetChildByIndex(0))
if b.err != nil {
return nil
}
us := &UnionScanExec{ctx: b.ctx, Src: src, schema: v.GetSchema()}
switch x := src.(type) {
case *SelectTableExec:
us.desc = x.desc
us.condition = v.Condition
/*
case *XSelectIndexExec:
us.desc = x.indexPlan.Desc
for _, ic := range x.indexPlan.Index.Columns {
for i, col := range x.indexPlan.GetSchema().Columns {
if col.ColName.L == ic.Name.L {
us.usedIndex = append(us.usedIndex, i)
break
}
}
}
us.dirty = getDirtyDB(b.ctx).getDirtyTable(x.table.Meta().ID)
us.condition = v.Condition
us.buildAndSortAddedRows(x.table, x.asName)
*/
default:
// The mem table will not be written by sql directly, so we can omit the union scan to avoid err reporting.
return src
}
return us
}
func (b *executorBuilder) buildJoin(v *plan.PhysicalHashJoin) Executor {
return nil
}
func (b *executorBuilder) buildAggregation(v *plan.PhysicalAggregation) Executor {
return nil
}
func (b *executorBuilder) buildSelection(v *plan.Selection) Executor {
return nil
}
func (b *executorBuilder) buildProjection(v *plan.Projection) Executor {
return &ProjectionExec{
Src: b.build(v.GetChildByIndex(0)),
ctx: b.ctx,
exprs: v.Exprs,
schema: v.GetSchema(),
}
}
func (b *executorBuilder) buildTableDual(v *plan.TableDual) Executor {
return nil
}
func (b *executorBuilder) buildTableScan(v *plan.PhysicalTableScan) Executor {
table, _ := b.is.TableByName(model.NewCIStr(""), v.Table.Name)
st := &SelectTableExec{
tableInfo: v.Table,
ctx: b.ctx,
asName: v.TableAsName,
table: table,
schema: v.GetSchema(),
Columns: v.Columns,
ranges: v.Ranges,
desc: v.Desc,
limitCount: v.LimitCount,
keepOrder: v.KeepOrder,
// where: v.TableConditionPBExpr,
aggregate: v.Aggregated,
// aggFuncs: v.AggFuncsPB,
aggFields: v.AggFields,
// byItems: v.GbyItemsPB,
// orderByList: v.SortItemsPB,
}
return st
}
func (b *executorBuilder) buildSort(v *plan.Sort) Executor {
return nil
}
func (b *executorBuilder) buildApply(v *plan.PhysicalApply) Executor {
return nil
}
func (b *executorBuilder) buildUnion(v *plan.Union) Executor {
return nil
} | sql/executor/builder.go | 0.562417 | 0.427935 | builder.go | starcoder |
package types
import (
"fmt"
"github.com/src-d/go-mysql-server/sql"
"vitess.io/vitess/go/sqltypes"
"vitess.io/vitess/go/vt/proto/query"
dtypes "github.com/liquidata-inc/dolt/go/store/types"
)
type ValueToSql func(dtypes.Value) (interface{}, error)
type SqlToValue func(interface{}) (dtypes.Value, error)
type SqlType interface {
// NomsKind is the underlying NomsKind that this initialization structure represents.
NomsKind() dtypes.NomsKind
// SqlType is the sql.Type that will be returned for Values of the NomsKind returned by NomsKind().
// In other words, this is the SQL type that will be used as the default type for all Values of this NomsKind.
SqlType() sql.Type
// SqlTypes are the SQL types that will be directly processed to represent the underlying NomsKind of Value.
SqlTypes() []sql.Type
// GetValueToSql returns a function that accepts a Value (same type as returned by Value()) and returns the SQL representation.
GetValueToSql() ValueToSql
// GetSqlToValue returns a function that accepts any variable and returns a Value if applicable.
GetSqlToValue() SqlToValue
fmt.Stringer
}
var SqlTypeInitializers = []SqlType{
//boolType{},
datetimeType{},
floatType{},
intType{},
stringType{},
uintType{},
uuidType{},
}
func init() {
for _, sqlTypeInit := range SqlTypeInitializers {
kind := sqlTypeInit.NomsKind()
nomsKindToSqlType[kind] = sqlTypeInit.SqlType()
nomsValToSqlValFunc[kind] = sqlTypeInit.GetValueToSql()
nomsKindToValFunc[kind] = sqlTypeInit.GetSqlToValue()
nomsKindToSqlTypeStr[kind] = sqlTypeInit.SqlType().String()
for _, st := range sqlTypeInit.SqlTypes() {
if _, ok := sqlTypeToNomsKind[st]; ok {
panic(fmt.Errorf("SQL type %v already has a representation", st))
}
sqlTypeToNomsKind[st] = kind
}
}
}
var (
nomsKindToSqlType = map[dtypes.NomsKind]sql.Type{dtypes.BoolKind: sql.Int8}
nomsKindToSqlTypeStr = make(map[dtypes.NomsKind]string)
nomsKindToValFunc = make(map[dtypes.NomsKind]SqlToValue)
nomsValToSqlValFunc = make(map[dtypes.NomsKind]ValueToSql)
sqlTypeToNomsKind = make(map[sql.Type]dtypes.NomsKind)
baseSqlTypesToNomsKind = map[query.Type]dtypes.NomsKind{
sqltypes.Binary: dtypes.StringKind,
sqltypes.Bit: dtypes.UintKind,
sqltypes.Blob: dtypes.StringKind,
sqltypes.Char: dtypes.StringKind,
sqltypes.Date: dtypes.TimestampKind,
sqltypes.Datetime: dtypes.TimestampKind,
sqltypes.Decimal: dtypes.FloatKind,
sqltypes.Float32: dtypes.FloatKind,
sqltypes.Float64: dtypes.FloatKind,
sqltypes.Int16: dtypes.IntKind,
sqltypes.Int24: dtypes.IntKind,
sqltypes.Int32: dtypes.IntKind,
sqltypes.Int64: dtypes.IntKind,
sqltypes.Int8: dtypes.IntKind,
sqltypes.Null: dtypes.NullKind,
sqltypes.Text: dtypes.StringKind,
sqltypes.Time: dtypes.InlineBlobKind,
sqltypes.Timestamp: dtypes.TimestampKind,
sqltypes.Uint16: dtypes.UintKind,
sqltypes.Uint24: dtypes.UintKind,
sqltypes.Uint32: dtypes.UintKind,
sqltypes.Uint64: dtypes.UintKind,
sqltypes.Uint8: dtypes.UintKind,
sqltypes.VarBinary: dtypes.StringKind,
sqltypes.VarChar: dtypes.StringKind,
sqltypes.Year: dtypes.IntKind,
}
)
func NomsKindToSqlType(nomsKind dtypes.NomsKind) (sql.Type, error) {
if st, ok := nomsKindToSqlType[nomsKind]; ok {
return st, nil
}
if nomsKind == dtypes.BoolKind {
return sql.Boolean, nil
}
return nil, fmt.Errorf("no corresponding SQL type found for %v", nomsKind)
}
func NomsKindToSqlTypeString(nomsKind dtypes.NomsKind) (string, error) {
if str, ok := nomsKindToSqlTypeStr[nomsKind]; ok {
return str, nil
}
if nomsKind == dtypes.BoolKind {
return "BOOLEAN", nil
}
return "", fmt.Errorf("no corresponding SQL type found for %v", nomsKind)
}
func NomsValToSqlVal(val dtypes.Value) (interface{}, error) {
if dtypes.IsNull(val) {
return nil, nil
}
if valueToSQL, ok := nomsValToSqlValFunc[val.Kind()]; ok {
return valueToSQL(val)
}
if boolVal, ok := val.(dtypes.Bool); ok {
return bool(boolVal), nil
}
return nil, fmt.Errorf("Value of %v is unsupported in SQL", val.Kind())
}
func SqlTypeToNomsKind(t sql.Type) (dtypes.NomsKind, error) {
if kind, ok := sqlTypeToNomsKind[t]; ok {
return kind, nil
}
if kind, ok := baseSqlTypesToNomsKind[t.Type()]; ok {
return kind, nil
}
return dtypes.UnknownKind, fmt.Errorf("unknown SQL type %v", t)
}
func SqlTypeToString(t sql.Type) (string, error) {
return t.String(), nil
}
func SqlValToNomsVal(val interface{}, kind dtypes.NomsKind) (dtypes.Value, error) {
if val == nil {
return nil, nil
}
if varToVal, ok := nomsKindToValFunc[kind]; ok {
return varToVal(val)
}
if kind == dtypes.BoolKind {
return boolType{}.GetSqlToValue()(val)
}
return nil, fmt.Errorf("Value of %v is unsupported in SQL", kind)
} | go/libraries/doltcore/sqle/types/types.go | 0.567218 | 0.434521 | types.go | starcoder |
package forge
import (
"errors"
"fmt"
)
// List struct used for holding data neede for Reference data type
type List struct {
values []Value
}
// NewList will create and initialize a new List value
func NewList() *List {
return &List{
values: make([]Value, 0),
}
}
// GetType will simply return back LIST
func (list *List) GetType() ValueType {
return LIST
}
// GetValue will resolve and return the value from the underlying list
// this is necessary to inherit from Value
func (list *List) GetValue() interface{} {
var values []interface{}
for _, val := range list.values {
values = append(values, val.GetValue())
}
return values
}
// GetValues will return back the list of underlygin values
func (list *List) GetValues() []Value {
return list.values
}
// UpdateValue will set the underlying list value
func (list *List) UpdateValue(value interface{}) error {
// Valid types
switch value.(type) {
case []Value:
list.values = value.([]Value)
default:
msg := fmt.Sprintf("Unsupported type, %s must be of type []Value", value)
return errors.New(msg)
}
return nil
}
// Get will return the Value at the index
func (list *List) Get(idx int) (Value, error) {
if idx > list.Length() {
return nil, errors.New("index out of range")
}
return list.values[idx], nil
}
// GetBoolean will try to get the value stored at the index as a bool
// will respond with an error if the value does not exist or cannot be converted to a bool
func (list *List) GetBoolean(idx int) (bool, error) {
value, err := list.Get(idx)
if err != nil {
return false, err
}
switch value.(type) {
case *Primative:
return value.(*Primative).AsBoolean()
}
return false, errors.New("could not convert unknown value to boolean")
}
// GetFloat will try to get the value stored at the index as a float64
// will respond with an error if the value does not exist or cannot be converted to a float64
func (list *List) GetFloat(idx int) (float64, error) {
value, err := list.Get(idx)
if err != nil {
return float64(0), err
}
switch value.(type) {
case *Primative:
return value.(*Primative).AsFloat()
}
return float64(0), errors.New("could not convert non-primative value to float")
}
// GetInteger will try to get the value stored at the index as a int64
// will respond with an error if the value does not exist or cannot be converted to a int64
func (list *List) GetInteger(idx int) (int64, error) {
value, err := list.Get(idx)
if err != nil {
return int64(0), err
}
switch value.(type) {
case *Primative:
return value.(*Primative).AsInteger()
}
return int64(0), errors.New("could not convert non-primative value to integer")
}
// GetList will try to get the value stored at the index as a List
// will respond with an error if the value does not exist or is not a List
func (list *List) GetList(idx int) (*List, error) {
value, err := list.Get(idx)
if err != nil {
return nil, err
}
if value.GetType() == LIST {
return value.(*List), nil
}
return nil, errors.New("could not fetch value as list")
}
// GetString will try to get the value stored at the index as a string
// will respond with an error if the value does not exist or cannot be converted to a string
func (list *List) GetString(idx int) (string, error) {
value, err := list.Get(idx)
if err != nil {
return "", err
}
switch value.(type) {
case *Primative:
return value.(*Primative).AsString()
}
return "", errors.New("could not convert non-primative value to string")
}
// Set will set the new Value at the index
func (list *List) Set(idx int, value Value) {
list.values[idx] = value
}
// Append will append a new Value on the end of the internal list
func (list *List) Append(value Value) {
list.values = append(list.values, value)
}
// Length will return back the total number of items in the list
func (list *List) Length() int {
return len(list.values)
} | vendor/github.com/brettlangdon/forge/list.go | 0.697918 | 0.468 | list.go | starcoder |
package graphics2d
// Constant width path tracer. Traces a path at a normal distance of width from the path.
// Join types - round, bevel [default], miter
// TraceProc defines the width and join types of the trace. The gap between two adjacent
// steps must be greater than MinGap for the join function to be called.
type TraceProc struct {
Width float64
Flatten float64
JoinFunc func([][]float64, []float64, [][]float64) [][][]float64
}
// NewTraceProc creates a trace path processor with width w, the bevel join and butt cap types.
func NewTraceProc(w float64) *TraceProc {
return &TraceProc{w, 0.5, JoinBevel} // 10 degrees
}
// Process implements the PathProcessor interface.
func (tp *TraceProc) Process(p *Path) []*Path {
path := PartsToPath(tp.ProcessParts(p)...)
if path == nil {
return []*Path{}
}
if p.Closed() {
path.Close()
}
if tp.Width < 0 {
path = path.Reverse()
}
return []*Path{path}
}
// ProcessParts returns the processed path as a slice of parts, rather a path so other path
// processors don't have to round trip path -> parts -> path -> parts (e.g. StrokeProc).
func (tp *TraceProc) ProcessParts(p *Path) [][][]float64 {
// A point isn't traceable.
if len(p.Steps()) == 1 {
return [][][]float64{}
}
w := tp.Width
if w < 0 {
w = -w
p = p.Reverse()
}
// Preprocess curves into safe forms.
p = p.Simplify()
parts := p.Parts()
n := len(parts)
tangs := p.Tangents()
// Convert tangents to scaled RHS normals
norms := make([][][]float64, n)
for i := 0; i < n; i++ {
norms[i] = make([][]float64, 2)
norms[i][0] = []float64{w * tangs[i][0][1], -w * tangs[i][0][0]}
norms[i][1] = []float64{w * tangs[i][1][1], -w * tangs[i][1][0]}
}
// Calculate the path by LineTransforming the parts and handling the joins
rhs := make([][][]float64, n)
for i := 0; i < n; i++ {
part := parts[i]
ln := len(part) - 1
offs := norms[i]
xfm := LineTransform(part[0][0], part[0][1],
part[ln][0], part[ln][1],
part[0][0]+offs[0][0], part[0][1]+offs[0][1],
part[ln][0]+offs[1][0], part[ln][1]+offs[1][1])
rhs[i] = xfm.Apply(part...)
}
// Compute the joins
nrhs := make([][][]float64, 0, 2*n)
nrhs = append(nrhs, rhs[0])
for i := 1; i < n; i++ {
last := nrhs[len(nrhs)-1]
// Check for knot first
npt := PartsIntersection(last, rhs[i], tp.Flatten)
if npt != nil {
// Tweak the end of nrhs[$] and start of rhs[i]
// Not strictly correct - should really figure out the t value for
// the point and then split part at t value to preserve the part's cp.
last[len(last)-1] = npt
rhs[i][0] = npt
} else {
nrhs = append(nrhs, tp.JoinFunc(last, parts[i][0], rhs[i])...)
}
nrhs = append(nrhs, rhs[i])
}
if p.Closed() {
// Join the end points
last := nrhs[len(nrhs)-1]
npt := PartsIntersection(last, nrhs[0], tp.Flatten)
if npt != nil {
last[len(last)-1] = npt
nrhs[0][0] = npt
} else {
nrhs = append(nrhs, tp.JoinFunc(last, parts[0][0], nrhs[0])...)
}
}
return nrhs
} | traceproc.go | 0.756358 | 0.636763 | traceproc.go | starcoder |
package numeric
import (
"sort"
)
// UintSlice attaches the methods of Interface to []uint, sorting a increasing order.
type UintSlice []uint
func (p UintSlice) Len() int { return len(p) }
func (p UintSlice) Less(i, j int) bool { return p[i] < p[j] }
func (p UintSlice) Swap(i, j int) { p[i], p[j] = p[j], p[i] }
// Sort is a convenience method.
func (p UintSlice) Sort() { sort.Sort(p) }
// Int8Slice attaches the methods of Interface to []int8, sorting a increasing order.
type Int8Slice []int8
func (p Int8Slice) Len() int { return len(p) }
func (p Int8Slice) Less(i, j int) bool { return p[i] < p[j] }
func (p Int8Slice) Swap(i, j int) { p[i], p[j] = p[j], p[i] }
// Sort is a convenience method.
func (p Int8Slice) Sort() { sort.Sort(p) }
// Uint8Slice attaches the methods of Interface to []uint8, sorting a increasing order.
type Uint8Slice []uint8
func (p Uint8Slice) Len() int { return len(p) }
func (p Uint8Slice) Less(i, j int) bool { return p[i] < p[j] }
func (p Uint8Slice) Swap(i, j int) { p[i], p[j] = p[j], p[i] }
// Sort is a convenience method.
func (p Uint8Slice) Sort() { sort.Sort(p) }
// Int16Slice attaches the methods of Interface to []int16, sorting a increasing order.
type Int16Slice []int16
func (p Int16Slice) Len() int { return len(p) }
func (p Int16Slice) Less(i, j int) bool { return p[i] < p[j] }
func (p Int16Slice) Swap(i, j int) { p[i], p[j] = p[j], p[i] }
// Sort is a convenience method.
func (p Int16Slice) Sort() { sort.Sort(p) }
// Uint16Slice attaches the methods of Interface to []uint16, sorting a increasing order.
type Uint16Slice []uint16
func (p Uint16Slice) Len() int { return len(p) }
func (p Uint16Slice) Less(i, j int) bool { return p[i] < p[j] }
func (p Uint16Slice) Swap(i, j int) { p[i], p[j] = p[j], p[i] }
// Sort is a convenience method.
func (p Uint16Slice) Sort() { sort.Sort(p) }
// Int32Slice attaches the methods of Interface to []int32, sorting a increasing order.
type Int32Slice []int32
func (p Int32Slice) Len() int { return len(p) }
func (p Int32Slice) Less(i, j int) bool { return p[i] < p[j] }
func (p Int32Slice) Swap(i, j int) { p[i], p[j] = p[j], p[i] }
// Sort is a convenience method.
func (p Int32Slice) Sort() { sort.Sort(p) }
// Uint32Slice attaches the methods of Interface to []uint, sorting a increasing order.
type Uint32Slice []uint32
func (p Uint32Slice) Len() int { return len(p) }
func (p Uint32Slice) Less(i, j int) bool { return p[i] < p[j] }
func (p Uint32Slice) Swap(i, j int) { p[i], p[j] = p[j], p[i] }
// Sort is a convenience method.
func (p Uint32Slice) Sort() { sort.Sort(p) }
// Int64Slice attaches the methods of Interface to []int64, sorting a increasing order.
type Int64Slice []int64
func (p Int64Slice) Len() int { return len(p) }
func (p Int64Slice) Less(i, j int) bool { return p[i] < p[j] }
func (p Int64Slice) Swap(i, j int) { p[i], p[j] = p[j], p[i] }
// Sort is a convenience method.
func (p Int64Slice) Sort() { sort.Sort(p) }
// Uint64Slice attaches the methods of Interface to []uint64, sorting a increasing order.
type Uint64Slice []uint64
func (p Uint64Slice) Len() int { return len(p) }
func (p Uint64Slice) Less(i, j int) bool { return p[i] < p[j] }
func (p Uint64Slice) Swap(i, j int) { p[i], p[j] = p[j], p[i] }
// Sort is a convenience method.
func (p Uint64Slice) Sort() { sort.Sort(p) } | numeric/sort.go | 0.622 | 0.522872 | sort.go | starcoder |
package math32
// Curve constructs an array of Vector3
type Curve struct {
points []Vector3
length float32
}
func (c *Curve) GetPoints() []Vector3 {
return c.points
}
func (c *Curve) GetLength() float32 {
return c.length
}
func (c *Curve) SetLength() {
points := c.points
l := float32(0.0)
for i := 1; i < len(points); i++ {
p0 := points[i].Clone()
p1 := points[i-1].Clone()
l += (p0.Sub(p1)).Length()
}
c.length = l
}
// Continue combines two curves
// creates and returns a pointer to a new curve
// combined curves are unaffected
func (c *Curve) Continue(other *Curve) *Curve {
last := c.points[len(c.points)-1].Clone()
first := other.points[0].Clone()
var continued, otherpoints []Vector3
for i := 0; i < len(c.points); i++ {
continued = append(continued, *c.points[i].Clone())
}
for i := 1; i < len(other.points); i++ {
otherpoints = append(otherpoints, *other.points[i].Clone())
}
for i := 0; i < len(otherpoints); i++ {
continued = append(continued, *otherpoints[i].Sub(first).Add(last))
}
newC := new(Curve)
newC.points = continued
newC.SetLength()
return newC
}
// NewBezierQuadratic creates and returns a pointer to a new curve
// Uses Vector3 pointers origin, control, and destination to calculate with
// int npoints as the desired number of points along the curve
func NewBezierQuadratic(origin, control, destination *Vector3, npoints int) *Curve {
c := new(Curve)
if npoints <= 2 {
npoints = 3
}
var equation func(float32, float32, float32, float32) float32
equation = func(t, v0, v1, v2 float32) float32 {
a0 := 1.0 - t
result := a0*a0*v0 + 2.0*t*a0*v1 + t*t*v2
return result
}
var bezier []Vector3
for i := 0; i <= npoints; i++ {
t := float32(i) / float32(npoints)
x := equation(t, origin.X, control.X, destination.X)
y := equation(t, origin.Y, control.Y, destination.Y)
z := equation(t, origin.Z, control.Z, destination.Z)
vect := NewVector3(x, y, z)
bezier = append(bezier, *vect)
}
c.points = bezier
c.SetLength()
return c
}
// NewBezierCubic creates and returns a pointer to a new curve
// Uses Vector3 pointers origin, control1, control2, and destination to calculate with
// int npoints as the desired number of points along the curve
func NewBezierCubic(origin, control1, control2, destination *Vector3, npoints int) *Curve {
c := new(Curve)
if npoints <= 3 {
npoints = 4
}
var equation func(float32, float32, float32, float32, float32) float32
equation = func(t, v0, v1, v2, v3 float32) float32 {
a0 := 1.0 - t
result := a0*a0*a0*v0 + 3.0*t*a0*a0*v1 + 3.0*t*t*a0*v2 + t*t*t*v3
return result
}
var bezier []Vector3
for i := 0; i <= npoints; i++ {
t := float32(i) / float32(npoints)
x := equation(t, origin.X, control1.X, control2.X, destination.X)
y := equation(t, origin.Y, control1.Y, control2.Y, destination.Y)
z := equation(t, origin.Z, control1.Z, control2.Z, destination.Z)
vect := NewVector3(x, y, z)
bezier = append(bezier, *vect)
}
c.points = bezier
c.SetLength()
return c
}
// NewHermiteSpline creates and returns a pointer to a new curve
// Uses Vector3 pointers origin, tangent1, destination, and tangent2 to calculate with
// int npoints as the desired number of points along the curve
func NewHermiteSpline(origin, tangent1, destination, tangent2 *Vector3, npoints int) *Curve {
c := new(Curve)
var equation func(float32, *Vector3, *Vector3, *Vector3, *Vector3) *Vector3
equation = func(t float32, v0, tan0, v1, tan1 *Vector3) *Vector3 {
t2 := t * t
t3 := t * t2
p0 := (2.0 * t3) - (3.0 * t2) + 1.0
p1 := (-2.0 * t3) + (3.0 * t2)
p2 := t3 - (2.0 * t2) + t
p3 := t3 - t2
x := (v0.X * p0) + (v1.X * p1) + (tan0.X * p2) + (tan1.X * p3)
y := (v0.Y * p0) + (v1.Y * p1) + (tan0.Y * p2) + (tan1.Y * p3)
z := (v0.Z * p0) + (v1.Z * p1) + (tan0.Z * p2) + (tan1.Z * p3)
return NewVector3(x, y, z)
}
step := float32(1.0) / float32(npoints)
var hermite []Vector3
for i := 0; i <= npoints; i++ {
vect := equation(float32(i)*step, origin, tangent1, destination, tangent2)
hermite = append(hermite, *vect)
}
c.points = hermite
c.SetLength()
return c
}
// NewCatmullRomSpline creates and returns a pointer to a new curve
// Uses array of Vector3 pointers with int npoints as the desired number of points between supplied points
// Use Boolean closed with true to close the start and end points
func NewCatmullRomSpline(points []*Vector3, npoints int, closed bool) *Curve {
c := new(Curve)
var equation func(float32, *Vector3, *Vector3, *Vector3, *Vector3) *Vector3
equation = func(t float32, v0, v1, v2, v3 *Vector3) *Vector3 {
t2 := t * t
t3 := t * t2
x := 0.5 * ((((2.0 * v1.X) + ((-v0.X + v2.X) * t)) +
(((((2.0 * v0.X) - (5.0 * v1.X)) + (4.0 * v2.X)) - v3.X) * t2)) +
((((-v0.X + (3.0 * v1.X)) - (3.0 * v2.X)) + v3.X) * t3))
y := 0.5 * ((((2.0 * v1.Y) + ((-v0.Y + v2.Y) * t)) +
(((((2.0 * v0.Y) - (5.0 * v1.Y)) + (4.0 * v2.Y)) - v3.Y) * t2)) +
((((-v0.Y + (3.0 * v1.Y)) - (3.0 * v2.Y)) + v3.Y) * t3))
z := 0.5 * ((((2.0 * v1.Z) + ((-v0.Z + v2.Z) * t)) +
(((((2.0 * v0.Z) - (5.0 * v1.Z)) + (4.0 * v2.Z)) - v3.Z) * t2)) +
((((-v0.Z + (3.0 * v1.Z)) - (3.0 * v2.Z)) + v3.Z) * t3))
return NewVector3(x, y, z)
}
step := float32(1.0) / float32(npoints)
var catmull []Vector3
var t float32
if closed {
count := len(points)
for i := 0; i < count; i++ {
t = 0.0
for n := 0; n < npoints; n++ {
vect := equation(t, points[i%count], points[(i+1)%count], points[(i+2)%count], points[(i+3)%count])
catmull = append(catmull, *vect)
t += step
}
}
catmull = append(catmull, catmull[0])
} else {
total := []*Vector3{points[0].Clone()}
total = append(total, points...)
total = append(total, points[len(points)-1].Clone())
var i int
for i = 0; i < len(total)-3; i++ {
t = 0
for n := 0; n < npoints; n++ {
vect := equation(t, total[i], total[i+1], total[i+2], total[i+3])
catmull = append(catmull, *vect)
t += step
}
}
i--
vect := equation(t, total[i], total[i+1], total[i+2], total[i+3])
catmull = append(catmull, *vect)
}
c.points = catmull
c.SetLength()
return c
} | math32/curves.go | 0.899058 | 0.561395 | curves.go | starcoder |
package bitarray
// CopyBitsFromBytes reads nBits bits from b at the offset bOff, and write them
// into the buffer at the offset off.
func (buf *Buffer) CopyBitsFromBytes(off int, b []byte, bOff, nBits int) {
switch {
case off < 0:
panicf("CopyBitsFromBytes: negative off %d.", off)
case buf.nBits < off+nBits:
panicf("CopyBitsFromBytes: out of range: off=%d + nBits=%d > len=%d.", off, nBits, buf.nBits)
case nBits == 0:
return
}
copyBits(buf.b, b, buf.off+off, bOff, nBits)
}
// CopyBitsToBytes reads nBits bits of the buffer starting at the offset off,
// and write them into the byte slice b at the offset bOff.
func (buf *Buffer) CopyBitsToBytes(off int, b []byte, bOff, nBits int) {
switch {
case off < 0:
panicf("CopyBitsToBytes: negative off %d.", off)
case buf.nBits < off+nBits:
panicf("CopyBitsToBytes: out of range: off=%d + nBits=%d > len=%d.", off, nBits, buf.nBits)
case nBits == 0:
return
}
copyBits(b, buf.b, bOff, buf.off+off, nBits)
}
// CopyBits copies bits from src into dst. CopyBits returns the number of bits
// copied, which will be the minimum of src.Len() and dst.Len().
func CopyBits(dst, src *Buffer) int {
nBits := dst.Len()
if sLen := src.Len(); sLen < nBits {
nBits = sLen
}
if nBits != 0 {
copyBits(dst.b, src.b, dst.off, src.off, nBits)
}
return nBits
}
// CopyBitsN is identical to CopyBits except that it copies up to nBits bits.
func CopyBitsN(dst, src *Buffer, nBits int) int {
if dLen := dst.Len(); dLen < nBits {
nBits = dLen
}
if sLen := src.Len(); sLen < nBits {
nBits = sLen
}
if nBits != 0 {
copyBits(dst.b, src.b, dst.off, src.off, nBits)
}
return nBits
}
// CopyBitsPartial is identical to CopyBitsN except that it reads and writes
// bits starting at specified offsets rather than the first bits.
func CopyBitsPartial(dst, src *Buffer, dstOff, srcOff, nBits int) int {
if dLen := dst.Len() - dstOff; dLen < nBits {
nBits = dLen
}
if sLen := src.Len() - srcOff; sLen < nBits {
nBits = sLen
}
if nBits != 0 {
copyBits(dst.b, src.b, dst.off+dstOff, src.off+srcOff, nBits)
}
return nBits
} | buffer_copy.go | 0.722918 | 0.462716 | buffer_copy.go | starcoder |
package utils
import (
"math"
. "github.com/gmlewis/go-gcode/gcode"
)
const (
defaultFlatness = 1e-4
defaultMinL = 0.1 // mm
)
// VBezierOptions represents options for VBezier3.
type VBezierOptions struct {
Flatness float64
MinL float64
}
// Vectorize cubic Bezier curves by recursive subdivision
// using De Casteljau's algorithm
// Input:
// b0 : node left
// b1 : control point left
// b2 : control point right
// b3 : node right
// flatness : resisidual 2-2*|cos(phi)| to determine direction of line
// minl : minimum distance between points
// Output:
// Vectorlist of points excluding b0 and exactly ending at b3
func VBezier3(b0, b1, b2, b3 Tuple, opts *VBezierOptions) []Tuple {
flatness, minL := defaultFlatness, defaultMinL
if opts != nil {
flatness = opts.Flatness
minL = opts.MinL
}
return genBezier(b0, b1, b2, b3, flatness, minL)
}
func genBezier(b0, b1, b2, b3 Tuple, flatness, minL float64) []Tuple {
l := b0.Add(b1).MultScalar(0.5)
m := b1.Add(b2).MultScalar(0.5)
r := b2.Add(b3).MultScalar(0.5)
lm := l.Add(m).MultScalar(0.5)
rm := r.Add(m).MultScalar(0.5)
t := lm.Add(rm).MultScalar(0.5)
// If the b0-top-b3 triangle is under the minimum length then return
// this triangle. Extreme cases where the control points pull out the
// curve to the sides is handled by ensuring that left and right
// node-to-conrol points must adhere to the same minimum length.
if (t.Sub(b0).Magnitude()+b3.Sub(t).Magnitude()) < minL && r.Sub(l).Magnitude() < minL {
return []Tuple{t, b3}
}
// cos(Angles) as seen from both sides should sum to 2.0 within
// tolerance to be co-linear but from opposite direction.
cplv := b0.Sub(m).Normalize().Dot(lm.Sub(t).Normalize())
cprv := b3.Sub(m).Normalize().Dot(t.Sub(rm).Normalize())
// We're done if we are co-linear.
// The angle test is scaled by the distance between the end-points
// relative to the minL argument. This reduces the perpendicular
// deviation from the curve to a minimum.
if b3.Sub(b0).Magnitude()/minL*(2.0-math.Abs(cprv-cplv)) < flatness {
return []Tuple{b3}
}
// Otherwise, return the points with bisected recursion.
left := genBezier(b0, l, lm, t, flatness, minL)
right := genBezier(t, rm, r, b3, flatness, minL)
result := append([]Tuple{}, left[0:len(left)-1]...)
result = append(result, t)
result = append(result, right[0:len(right)-1]...)
result = append(result, b3)
return result
} | utils/vbezier.go | 0.806319 | 0.484014 | vbezier.go | starcoder |
package document
import (
"errors"
)
// ErrStreamClosed is used to indicate that a stream must be closed.
var ErrStreamClosed = errors.New("stream closed")
// An Iterator can iterate over documents.
type Iterator interface {
// Iterate goes through all the documents and calls the given function by passing each one of them.
// If the given function returns an error, the iteration stops.
Iterate(func(d Document) error) error
}
// NewIterator creates an iterator that iterates over documents.
func NewIterator(documents ...Document) Iterator {
return documentsIterator(documents)
}
type documentsIterator []Document
func (rr documentsIterator) Iterate(fn func(d Document) error) error {
var err error
for _, d := range rr {
err = fn(d)
if err != nil {
return err
}
}
return nil
}
// Stream reads documents of an iterator one by one and passes them
// through a list of functions for transformation.
type Stream struct {
it Iterator
op StreamOperator
}
// NewStream creates a stream using the given iterator.
func NewStream(it Iterator) Stream {
return Stream{it: it}
}
// Iterate calls the underlying iterator's iterate method.
// If this stream was created using the Pipe method, it will apply fn
// to any document passed by the underlying iterator.
// If fn returns a document, it will be passed to the next stream.
// If it returns a nil document, the document will be ignored.
// If it returns an error, the stream will be interrupted and that error will bubble up
// and returned by fn, unless that error is ErrStreamClosed, in which case
// the Iterate method will stop the iteration and return nil.
// It implements the Iterator interface.
func (s Stream) Iterate(fn func(d Document) error) error {
if s.it == nil {
return nil
}
if s.op == nil {
return s.it.Iterate(fn)
}
opFn := s.op()
err := s.it.Iterate(func(d Document) error {
d, err := opFn(d)
if err != nil {
return err
}
if d == nil {
return nil
}
return fn(d)
})
if err != ErrStreamClosed {
return err
}
return nil
}
// Pipe creates a new Stream who can read its data from s and apply
// op to every document passed by its Iterate method.
func (s Stream) Pipe(op StreamOperator) Stream {
return Stream{
it: s,
op: op,
}
}
// Map applies fn to each received document and passes it to the next stream.
// If fn returns an error, the stream is interrupted.
func (s Stream) Map(fn func(d Document) (Document, error)) Stream {
return s.Pipe(func() func(d Document) (Document, error) {
return fn
})
}
// Filter each received document using fn.
// If fn returns true, the document is kept, otherwise it is skipped.
// If fn returns an error, the stream is interrupted.
func (s Stream) Filter(fn func(d Document) (bool, error)) Stream {
return s.Pipe(func() func(d Document) (Document, error) {
return func(d Document) (Document, error) {
ok, err := fn(d)
if err != nil {
return nil, err
}
if !ok {
return nil, nil
}
return d, nil
}
})
}
// Limit interrupts the stream once the number of passed documents have reached n.
func (s Stream) Limit(n int) Stream {
return s.Pipe(func() func(d Document) (Document, error) {
var count int
return func(d Document) (Document, error) {
if count < n {
count++
return d, nil
}
return nil, ErrStreamClosed
}
})
}
// Offset ignores n documents then passes the subsequent ones to the stream.
func (s Stream) Offset(n int) Stream {
return s.Pipe(func() func(d Document) (Document, error) {
var skipped int
return func(d Document) (Document, error) {
if skipped < n {
skipped++
return nil, nil
}
return d, nil
}
})
}
// Append adds the given iterator to the stream.
func (s Stream) Append(it Iterator) Stream {
if mr, ok := s.it.(multiIterator); ok {
mr.iterators = append(mr.iterators, it)
s.it = mr
} else {
s.it = multiIterator{
iterators: []Iterator{s, it},
}
}
return s
}
// Count counts all the documents from the stream.
func (s Stream) Count() (int, error) {
counter := 0
err := s.Iterate(func(d Document) error {
counter++
return nil
})
return counter, err
}
// First runs the stream, returns the first document found and closes the stream.
// If the stream is empty, all return values are nil.
func (s Stream) First() (d Document, err error) {
err = s.Iterate(func(doc Document) error {
d = doc
return ErrStreamClosed
})
if err == ErrStreamClosed {
err = nil
}
return
}
// An StreamOperator is used to modify a stream.
// If a stream operator returns a document, it will be passed to the next stream.
// If it returns a nil document, the document will be ignored.
// If it returns an error, the stream will be interrupted and that error will bubble up
// and returned by this function, unless that error is ErrStreamClosed, in which case
// the Iterate method will stop the iteration and return nil.
// Stream operators can be reused, and thus, any state or side effect should be kept within the operator closure
// unless the nature of the operator prevents that.
type StreamOperator func() func(d Document) (Document, error)
type multiIterator struct {
iterators []Iterator
}
func (m multiIterator) Iterate(fn func(d Document) error) error {
for _, it := range m.iterators {
err := it.Iterate(fn)
if err != nil {
return err
}
}
return nil
} | document/iterator.go | 0.768038 | 0.406715 | iterator.go | starcoder |
package compress
import "sort"
type rotation struct {
int
s []uint8
}
type Rotations []rotation
func (r Rotations) Len() int {
return len(r)
}
func less(a, b rotation) bool {
la, lb, ia, ib := len(a.s), len(b.s), a.int, b.int
for {
if x, y := a.s[ia], b.s[ib]; x != y {
return x < y
}
ia, ib = ia + 1, ib + 1
if ia == la {
ia = 0
}
if ib == lb {
ib = 0
}
if ia == a.int && ib == b.int {
break
}
}
return false
}
func (r Rotations) Less(i, j int) bool {
return less(r[i], r[j])
}
func (r Rotations) Swap(i, j int) {
r[i], r[j] = r[j], r[i]
}
func merge(left, right, out Rotations) {
for len(left) > 0 && len(right) > 0 {
if less(left[0], right[0]) {
out[0], left = left[0], left[1:]
} else {
out[0], right = right[0], right[1:]
}
out = out[1:]
}
copy(out, left)
copy(out, right)
}
func psort(in Rotations, s chan<- bool) {
if len(in) < 1024 {
sort.Sort(in)
s <- true
return
}
l, r, split := make(chan bool), make(chan bool), len(in) / 2
left, right := in[:split], in[split:]
go psort(left, l)
go psort(right, r)
_, _ = <-l, <-r
out := make(Rotations, len(in))
merge(left, right, out)
copy(in, out)
s <- true
}
func BijectiveBurrowsWheelerCoder(input <-chan []byte) Coder8 {
output := make(chan []byte)
go func() {
var lyndon Lyndon
var rotations Rotations
wait := make(chan bool)
var buffer []uint8
for block := range input {
if cap(buffer) < len(block) {
buffer = make([]uint8, len(block))
} else {
buffer = buffer[:len(block)]
}
copy(buffer, block)
lyndon.Factor(buffer)
/* rotate */
if length := len(block); cap(rotations) < length {
rotations = make(Rotations, length)
} else {
rotations = rotations[:length]
}
r := 0
for _, word := range lyndon.Words {
for i, _ := range word {
rotations[r], r = rotation{i, word}, r + 1
}
}
go psort(rotations, wait)
<-wait
/* output the last character of each rotation */
for i, j := range rotations {
if j.int == 0 {
j.int = len(j.s)
}
block[i] = j.s[j.int - 1]
}
output <- block
}
close(output)
}()
return Coder8{Alphabit:256, Input:output}
}
func BijectiveBurrowsWheelerDecoder(input <-chan []byte) Coder8 {
inverse := func(buffer []byte) {
length := len(buffer)
input, major, minor := make([]byte, length), [256]int {}, make([]int, length)
for k, v := range buffer {
input[k], minor[k], major[v] = v, major[v], major[v] + 1
}
sum := 0
for k, v := range major {
major[k], sum = sum, sum + v
}
j := length - 1
for k, _ := range input {
for minor[k] != -1 {
buffer[j], j, k, minor[k] = input[k], j - 1, major[input[k]] + minor[k], -1
}
}
}
buffer, i := []byte(nil), 0
add := func(symbol uint8) bool {
if len(buffer) == 0 {
next, ok := <-input
if !ok {
return true
}
buffer = next
}
buffer[i], i = symbol, i + 1
if i == len(buffer) {
inverse(buffer)
next, ok := <-input
if !ok {
return true
}
buffer, i = next, 0
}
return false
}
return Coder8{Alphabit:256, Output:add}
} | _vendor/src/github.com/pointlander/compress/burrows_wheeler.go | 0.636805 | 0.460046 | burrows_wheeler.go | starcoder |
package model
import (
"database/sql"
"errors"
)
/*
| Table Name | Column Name | Position | Matches | Qty |
| ------------------------------------- | --------------------------------- | -------- | --------------------------------------- | --- |
| DOMAINS | DOMAIN_CATALOG | 1 | sql2003, pg, mssql, hsqldb, h2 | 5 |
| DOMAINS | DOMAIN_SCHEMA | 2 | sql2003, pg, mssql, hsqldb, h2 | 5 |
| DOMAINS | DOMAIN_NAME | 3 | sql2003, pg, mssql, hsqldb, h2 | 5 |
| DOMAINS | DATA_TYPE | 4 | sql2003, pg, mssql, hsqldb, h2 | 5 |
| DOMAINS | CHARACTER_MAXIMUM_LENGTH | 5 | sql2003, pg, mssql, hsqldb | 4 |
| DOMAINS | CHARACTER_OCTET_LENGTH | 6 | sql2003, pg, mssql, hsqldb | 4 |
| DOMAINS | CHARACTER_SET_CATALOG | 7 | sql2003, pg, mssql, hsqldb | 4 |
| DOMAINS | CHARACTER_SET_SCHEMA | 8 | sql2003, pg, mssql, hsqldb | 4 |
| DOMAINS | CHARACTER_SET_NAME | 9 | sql2003, pg, mssql, hsqldb | 4 |
| DOMAINS | COLLATION_CATALOG | 10 | sql2003, pg, mssql, hsqldb | 4 |
| DOMAINS | COLLATION_SCHEMA | 11 | sql2003, pg, mssql, hsqldb | 4 |
| DOMAINS | COLLATION_NAME | 12 | sql2003, pg, mssql, hsqldb | 4 |
| DOMAINS | NUMERIC_PRECISION | 13 | sql2003, pg, mssql, hsqldb | 4 |
| DOMAINS | NUMERIC_PRECISION_RADIX | 14 | sql2003, pg, mssql, hsqldb | 4 |
| DOMAINS | NUMERIC_SCALE | 15 | sql2003, pg, mssql, hsqldb | 4 |
| DOMAINS | DATETIME_PRECISION | 16 | sql2003, pg, mssql, hsqldb | 4 |
| DOMAINS | INTERVAL_TYPE | 17 | sql2003, pg, hsqldb | 3 |
| DOMAINS | INTERVAL_PRECISION | 18 | sql2003, pg, hsqldb | 3 |
| DOMAINS | DOMAIN_DEFAULT | 19 | sql2003, pg, mssql, hsqldb | 4 |
| DOMAINS | MAXIMUM_CARDINALITY | 20 | sql2003, pg, hsqldb | 3 |
| DOMAINS | DTD_IDENTIFIER | 21 | sql2003, pg, hsqldb | 3 |
*/
// Domain contains details for (user defined) domains
type Domain struct {
DomainCatalog sql.NullString `json:"domainCatalog"`
DomainSchema sql.NullString `json:"domainSchema"`
DomainName sql.NullString `json:"domainName"`
DomainOwner sql.NullString `json:"domainOwner"`
DataType sql.NullString `json:"dataType"`
DomainDefault sql.NullString `json:"domainDefault"`
Comment sql.NullString `json:"comment"`
}
// Domains returns a slice of Domains for the (schema) parameter
func (db *m.DB) Domains(q, schema string) ([]Domain, error) {
var d []Domain
if q == "" {
return d, errors.New("No query provided to Domains")
}
rows, err := db.Query(q, schema)
if err != nil {
return d, err
}
defer func() {
if cerr := rows.Close(); cerr != nil && err == nil {
err = cerr
}
}()
for rows.Next() {
var u Domain
err = rows.Scan(&u.DomainCatalog,
&u.DomainSchema,
&u.DomainName,
&u.DomainOwner,
&u.DataType,
&u.DomainDefault,
&u.Comment,
)
if err != nil {
return d, err
} else {
d = append(d, u)
}
}
return d, err
} | model/domains.go | 0.577257 | 0.409516 | domains.go | starcoder |
package algorithms
import (
"github.com/bionoren/mazes/grid"
"math/rand"
)
// AldousBroderWilsons runs AldousBroder until either the grid is half visited or it has run for size*4 iterations. Then it runs Wilson's algorithm until the grid is fully visited
func AldousBroderWilsons(g grid.Grid) {
// Aldous-broder
size := g.Rows() * g.Cols()
node := g.CellForIndex(rand.Intn(size))
visited := make([]bool, size)
visits := 1
visited[node.Index()] = true
var i = 0
for visits < size/2 && i < size*4 {
dir := grid.Direction(rand.Intn(int(grid.WEST) + 1))
if node.HasNeighbor(dir) {
if !visited[node.Neighbor(dir).Index()] {
visited[node.Neighbor(dir).Index()] = true
visits++
g.Connect(node.Row(), node.Col(), dir)
}
node = *node.Neighbor(dir)
}
i++
}
// Wilson's
options := make([]int, 0, size)
for i, v := range visited {
if !v {
options = append(options, i)
}
}
if len(options) == 0 {
return
}
node = g.CellForIndex(options[rand.Intn(len(options))])
pathed := make([]bool, size)
path := make([]grid.Cell, 0, size/2) // on large grids, size/2 is a reasonable initial memory guess
pathed[node.Index()] = true
for {
dir := grid.Direction(rand.Intn(int(grid.WEST) + 1))
if node.HasNeighbor(dir) {
next := *node.Neighbor(dir)
if visited[next.Index()] { // connect the path to the visited maze
for i := len(path) - 1; i >= 0; i-- {
g.Connect(next.Row(), next.Col(), g.CellDir(next, path[i]))
next = path[i]
visited[next.Index()] = true
}
filteredOpts := options[:0]
for _, idx := range options {
if !visited[idx] {
filteredOpts = append(filteredOpts, idx)
}
}
options = filteredOpts
if len(options) == 0 {
break
}
next = g.CellForIndex(options[rand.Intn(len(options))])
path = path[:1]
path[0] = next
pathed[next.Index()] = true
} else if pathed[next.Index()] { // loop-erase
for i := len(path) - 1; i >= 0; i-- {
n := path[i]
pathed[n.Index()] = false
path = path[:i]
if n.Index() == next.Index() {
break
}
}
pathed[next.Index()] = true
path = append(path, next)
} else { // build path
pathed[next.Index()] = true
path = append(path, next)
}
node = next
}
}
} | algorithms/aldousBroderWilsons.go | 0.562898 | 0.452596 | aldousBroderWilsons.go | starcoder |
package asdu
// about information object 应用服务数据单元 - 信息对象
// InfoObjAddr is the information object address.
// See companion standard 101, subclass 7.2.5.
// The width is controlled by Params.InfoObjAddrSize.
// <0>: 无关的信息对象地址
// - width 1: <1..255>
// - width 2: <1..65535>
// - width 3: <1..16777215>
type InfoObjAddr uint
// InfoObjAddrIrrelevant Zero means that the information object address is irrelevant.
const InfoObjAddrIrrelevant InfoObjAddr = 0
// SinglePoint is a measured value of a switch.
// See companion standard 101, subclass 7.2.6.1.
type SinglePoint byte
// SinglePoint defined
const (
SPIOff SinglePoint = iota // 关
SPIOn // 开
)
// Value single point to byte
func (sf SinglePoint) Value() byte {
return byte(sf & 0x01)
}
// DoublePoint is a measured value of a determination aware switch.
// See companion standard 101, subclass 7.2.6.2.
type DoublePoint byte
// DoublePoint defined
const (
DPIIndeterminateOrIntermediate DoublePoint = iota // 不确定或中间状态
DPIDeterminedOff // 确定状态开
DPIDeterminedOn // 确定状态关
DPIIndeterminate // 不确定或中间状态
)
// Value double point to byte
func (sf DoublePoint) Value() byte {
return byte(sf & 0x03)
}
// QualityDescriptor Quality descriptor flags attribute measured values.
// See companion standard 101, subclass 7.2.6.3.
type QualityDescriptor byte
// QualityDescriptor defined.
const (
// QDSOverflow marks whether the value is beyond a predefined range.
QDSOverflow QualityDescriptor = 1 << iota
_ // reserve
_ // reserve
_ // reserve
// QDSBlocked flags that the value is blocked for transmission; the
// value remains in the state that was acquired before it was blocked.
QDSBlocked
// QDSSubstituted flags that the value was provided by the input of
// an operator (dispatcher) instead of an automatic source.
QDSSubstituted
// QDSNotTopical flags that the most recent update was unsuccessful.
QDSNotTopical
// QDSInvalid flags that the value was incorrectly acquired.
QDSInvalid
// QDSGood means no flags, no problems.
QDSGood QualityDescriptor = 0
)
//QualityDescriptorProtection Quality descriptor Protection Equipment flags attribute.
// See companion standard 101, subclass 7.2.6.4.
type QualityDescriptorProtection byte
// QualityDescriptorProtection defined.
const (
_ QualityDescriptorProtection = 1 << iota // reserve
_ // reserve
_ // reserve
// QDPElapsedTimeInvalid flags that the elapsed time was incorrectly acquired.
QDPElapsedTimeInvalid
// QDPBlocked flags that the value is blocked for transmission; the
// value remains in the state that was acquired before it was blocked.
QDPBlocked
// QDPSubstituted flags that the value was provided by the input of
// an operator (dispatcher) instead of an automatic source.
QDPSubstituted
// QDPNotTopical flags that the most recent update was unsuccessful.
QDPNotTopical
// QDPInvalid flags that the value was incorrectly acquired.
QDPInvalid
// QDPGood means no flags, no problems.
QDPGood QualityDescriptorProtection = 0
)
// StepPosition is a measured value with transient state indication.
// 带瞬变状态指示的测量值,用于变压器步位置或其它步位置的值
// See companion standard 101, subclass 7.2.6.5.
// Val range <-64..63>
// bit[0-5]: <-64..63>
// NOTE: bit6 为符号位
// bit7: 0: 设备未在瞬变状态 1: 设备处于瞬变状态
type StepPosition struct {
Val int
HasTransient bool
}
// Value returns step position value.
func (sf StepPosition) Value() byte {
p := sf.Val & 0x7f
if sf.HasTransient {
p |= 0x80
}
return byte(p)
}
// ParseStepPosition parse byte to StepPosition.
func ParseStepPosition(b byte) StepPosition {
step := StepPosition{HasTransient: (b & 0x80) != 0}
if b&0x40 == 0 {
step.Val = int(b & 0x3f)
} else {
step.Val = int(b) | (-1 &^ 0x3f)
}
return step
}
// Normalize is a 16-bit normalized value in[-1, 1 − 2⁻¹⁵]..
// 规一化值 f归一= 32768 * f真实 / 满码值
// See companion standard 101, subclass 7.2.6.6.
type Normalize int16
// Float64 returns the value in [-1, 1 − 2⁻¹⁵].
func (sf Normalize) Float64() float64 {
return float64(sf) / 32768
}
// BinaryCounterReading is binary counter reading
// See companion standard 101, subclass 7.2.6.9.
// CounterReading: 计数器读数 [bit0...bit31]
// SeqNumber: 顺序记法 [bit32...bit40]
// SQ: 顺序号 [bit32...bit36]
// CY: 进位 [bit37]
// CA: 计数量被调整
// IV: 无效
type BinaryCounterReading struct {
CounterReading int32
SeqNumber byte
HasCarry bool
IsAdjusted bool
IsInvalid bool
}
// SingleEvent is single event
// See companion standard 101, subclass 7.2.6.10.
type SingleEvent byte
// SingleEvent dSequenceNotationefined
const (
SEIndeterminateOrIntermediate SingleEvent = iota // 不确定或中间状态
SEDeterminedOff // 确定状态开
SEDeterminedOn // 确定状态关
SEIndeterminate // 不确定或中间状态
)
// StartEvent Start event protection
type StartEvent byte
// StartEvent defined
// See companion standard 101, subclass 7.2.6.11.
const (
SEPGeneralStart StartEvent = 1 << iota // 总启动
SEPStartL1 // A相保护启动
SEPStartL2 // B相保护启动
SEPStartL3 // C相保护启动
SEPStartEarthCurrent // 接地电流保护启动
SEPStartReverseDirection // 反向保护启动
// other reserved
)
// OutputCircuitInfo output command information
// See companion standard 101, subclass 7.2.6.12.
type OutputCircuitInfo byte
// OutputCircuitInfo defined
const (
OCIGeneralCommand OutputCircuitInfo = 1 << iota // 总命令输出至输出电路
OCICommandL1 // A 相保护命令输出至输出电路
OCICommandL2 // B 相保护命令输出至输出电路
OCICommandL3 // C 相保护命令输出至输出电路
// other reserved
)
// FBPTestWord test special value
// See companion standard 101, subclass 7.2.6.14.
const FBPTestWord uint16 = 0x55aa
// SingleCommand Single command
// See companion standard 101, subclass 7.2.6.15.
type SingleCommand byte
// SingleCommand defined
const (
SCOOn SingleCommand = iota
SCOOff
)
// DoubleCommand double command
// See companion standard 101, subclass 7.2.6.16.
type DoubleCommand byte
// DoubleCommand defined
const (
DCONotAllow0 DoubleCommand = iota
DCOOn
DCOOff
DCONotAllow3
)
// StepCommand step command
// See companion standard 101, subclass 7.2.6.17.
type StepCommand byte
// StepCommand defined
const (
SCONotAllow0 StepCommand = iota
SCOStepDown
SCOStepUP
SCONotAllow3
)
// COICause Initialization reason
// See companion standard 101, subclass 7.2.6.21.
type COICause byte
// COICause defined
// 0: 当地电源合上
// 1: 当地手动复位
// 2: 远方复位
// <3..31>: 本配讨标准备的标准定义保留
// <32...127>: 为特定使用保留
const (
COILocalPowerOn COICause = iota
COILocalHandReset
COIRemoteReset
)
// CauseOfInitial cause of initial
// Cause: see COICause
// IsLocalChange: false - 未改变当地参数的初始化
// true - 改变当地参数后的初始化
type CauseOfInitial struct {
Cause COICause
IsLocalChange bool
}
// ParseCauseOfInitial parse byte to cause of initial
func ParseCauseOfInitial(b byte) CauseOfInitial {
return CauseOfInitial{
Cause: COICause(b & 0x7f),
IsLocalChange: b&0x80 == 0x80,
}
}
// Value CauseOfInitial to byte
func (sf CauseOfInitial) Value() byte {
if sf.IsLocalChange {
return byte(sf.Cause | 0x80)
}
return byte(sf.Cause)
}
// QualifierOfInterrogation Qualifier Of Interrogation
// See companion standard 101, subclass 7.2.6.22.
type QualifierOfInterrogation byte
// QualifierOfInterrogation defined
const (
// <1..19>: 为标准定义保留
QOIStation QualifierOfInterrogation = 20 + iota // interrogated by station interrogation
QOIGroup1 // interrogated by group 1 interrogation
QOIGroup2 // interrogated by group 2 interrogation
QOIGroup3 // interrogated by group 3 interrogation
QOIGroup4 // interrogated by group 4 interrogation
QOIGroup5 // interrogated by group 5 interrogation
QOIGroup6 // interrogated by group 6 interrogation
QOIGroup7 // interrogated by group 7 interrogation
QOIGroup8 // interrogated by group 8 interrogation
QOIGroup9 // interrogated by group 9 interrogation
QOIGroup10 // interrogated by group 10 interrogation
QOIGroup11 // interrogated by group 11 interrogation
QOIGroup12 // interrogated by group 12 interrogation
QOIGroup13 // interrogated by group 13 interrogation
QOIGroup14 // interrogated by group 14 interrogation
QOIGroup15 // interrogated by group 15 interrogation
QOIGroup16 // interrogated by group 16 interrogation
// <37..63>:为标准定义保留
// <64..255>: 为特定使用保留
// 0:未使用
QOIUnused QualifierOfInterrogation = 0
)
// QCCRequest 请求 [bit0...bit5]
// See companion standard 101, subclass 172.16.31.10.
type QCCRequest byte
// QCCFreeze 冻结 [bit6,bit7]
// See companion standard 101, subclass 172.16.31.10.
type QCCFreeze byte
// QCCRequest and QCCFreeze defined
const (
QCCUnused QCCRequest = iota
QCCGroup1
QCCGroup2
QCCGroup3
QCCGroup4
QCCTotal
// <6..31>: 为标准定义
// <32..63>: 为特定使用保留
QCCFrzRead QCCFreeze = 0x00 // 读(无冻结或复位)
QCCFrzFreezeNoReset QCCFreeze = 0x40 // 计数量冻结不带复位(被冻结的值为累计量)
QCCFrzFreezeReset QCCFreeze = 0x80 // 计数量冻结带复位(被冻结的值为增量信息)
QCCFrzReset QCCFreeze = 0xc0 // 计数量复位
)
// QualifierCountCall 计数量召唤命令限定词
// See companion standard 101, subclass 7.2.6.23.
type QualifierCountCall struct {
Request QCCRequest
Freeze QCCFreeze
}
// ParseQualifierCountCall parse byte to QualifierCountCall
func ParseQualifierCountCall(b byte) QualifierCountCall {
return QualifierCountCall{
Request: QCCRequest(b & 0x3f),
Freeze: QCCFreeze(b & 0xc0),
}
}
// Value QualifierCountCall to byte
func (sf QualifierCountCall) Value() byte {
return byte(sf.Request&0x3f) | byte(sf.Freeze&0xc0)
}
// QPMCategory 测量参数类别
type QPMCategory byte
// QPMCategory defined
const (
QPMUnused QPMCategory = iota // 0: not used
QPMThreshold // 1: threshold value
QPMSmoothing // 2: smoothing factor (filter time constant)
QPMLowLimit // 3: low limit for transmission of measured values
QPMHighLimit // 4: high limit for transmission of measured values
// 5‥31: reserved for standard definitions of sf companion standard (compatible range)
// 32‥63: reserved for special use (private range)
QPMChangeFlag QPMCategory = 0x40 // bit6 marks local parameter change 当地参数改变
QPMInOperationFlag QPMCategory = 0x80 // bit7 marks parameter operation 参数在运行
)
// QualifierOfParameterMV Qualifier Of Parameter Of Measured Values 测量值参数限定词
// See companion standard 101, subclass 7.2.6.24.
// QPMCategory : [bit0...bit5] 参数类型
// IsChange : [bit6]当地参数改变,false - 未改变,true - 改变
// IsInOperation : [bit7] 参数在运行,false - 运行, true - 不在运行
type QualifierOfParameterMV struct {
Category QPMCategory
IsChange bool
IsInOperation bool
}
// ParseQualifierOfParamMV parse byte to QualifierOfParameterMV
func ParseQualifierOfParamMV(b byte) QualifierOfParameterMV {
return QualifierOfParameterMV{
Category: QPMCategory(b & 0x3f),
IsChange: b&0x40 == 0x40,
IsInOperation: b&0x80 == 0x80,
}
}
// Value QualifierOfParameterMV to byte
func (sf QualifierOfParameterMV) Value() byte {
v := byte(sf.Category) & 0x3f
if sf.IsChange {
v |= 0x40
}
if sf.IsInOperation {
v |= 0x80
}
return v
}
// QualifierOfParameterAct Qualifier Of Parameter Activation 参数激活限定词
// See companion standard 101, subclass 7.2.6.25.
type QualifierOfParameterAct byte
// QualifierOfParameterAct defined
const (
QPAUnused QualifierOfParameterAct = iota
// 激活/停止激活这之前装载的参数(信息对象地址=0)
QPADeActPrevLoadedParameter
// 激活/停止激活所寻址信息对象的参数
QPADeActObjectParameter
// 激活/停止激活所寻址的持续循环或周期传输的信息对象
QPADeActObjectTransmission
// 4‥127: reserved for standard definitions of sf companion standard (compatible range)
// 128‥255: reserved for special use (private range)
)
// QOCQual the qualifier of qual.
// See companion standard 101, subclass 7.2.6.26.
type QOCQual byte
// QOCQual defined
const (
// 0: no additional definition
// 无另外的定义
QOCNoAdditionalDefinition QOCQual = iota
// 1: short pulse duration (circuit-breaker), duration determined by a system parameter in the outstation
// 短脉冲持续时间(断路器),持续时间由被控站内的系统参数所确定
QOCShortPulseDuration
// 2: long pulse duration, duration determined by a system parameter in the outstation
// 长脉冲持续时间,持续时间由被控站内的系统参数所确定
QOCLongPulseDuration
// 3: persistent output
// 持续输出
QOCPersistentOutput
// 4‥8: reserved for standard definitions of sf companion standard
// 9‥15: reserved for the selection of other predefined functions
// 16‥31: reserved for special use (private range)
)
// QualifierOfCommand is a qualifier of command. 命令限定词
// See companion standard 101, subclass 7.2.6.26.
// See section 5, subclass 6.8.
// InSelect: true - selects, false - executes.
type QualifierOfCommand struct {
Qual QOCQual
InSelect bool
}
// ParseQualifierOfCommand parse byte to QualifierOfCommand
func ParseQualifierOfCommand(b byte) QualifierOfCommand {
return QualifierOfCommand{
Qual: QOCQual((b >> 2) & 0x1f),
InSelect: b&0x80 == 0x80,
}
}
// Value QualifierOfCommand to byte
func (sf QualifierOfCommand) Value() byte {
v := (byte(sf.Qual) & 0x1f) << 2
if sf.InSelect {
v |= 0x80
}
return v
}
// QualifierOfResetProcessCmd 复位进程命令限定词
// See companion standard 101, subclass 7.2.6.27.
type QualifierOfResetProcessCmd byte
// QualifierOfResetProcessCmd defined
const (
// 未采用
QRPUnused QualifierOfResetProcessCmd = iota
// 进程的总复位
QPRGeneralRest
// 复位事件缓冲区等待处理的带时标的信息
QPRResetPendingInfoWithTimeTag
// <3..127>: 为标准保留
//<128..255>: 为特定使用保留
)
/*
TODO: file 文件相关未定义
*/
// QOSQual is the qualifier of a set-point command qual.
// See companion standard 101, subclass 7.2.6.39.
// 0: default
// 0‥63: reserved for standard definitions of sf companion standard (compatible range)
// 64‥127: reserved for special use (private range)
type QOSQual uint
// QualifierOfSetpointCmd is a qualifier of command. 设定命令限定词
// See section 5, subclass 6.8.
// InSelect: true - selects, false - executes.
type QualifierOfSetpointCmd struct {
Qual QOSQual
InSelect bool
}
// ParseQualifierOfSetpointCmd parse byte to QualifierOfSetpointCmd
func ParseQualifierOfSetpointCmd(b byte) QualifierOfSetpointCmd {
return QualifierOfSetpointCmd{
Qual: QOSQual(b & 0x7f),
InSelect: b&0x80 == 0x80,
}
}
// Value QualifierOfSetpointCmd to byte
func (sf QualifierOfSetpointCmd) Value() byte {
v := byte(sf.Qual) & 0x7f
if sf.InSelect {
v |= 0x80
}
return v
}
// StatusAndStatusChangeDetection 状态和状态变位检出
// See companion standard 101, subclass 7.2.6.40.
type StatusAndStatusChangeDetection uint32 | asdu/information.go | 0.534127 | 0.418875 | information.go | starcoder |
package figmatypes
// VectorOrFrameOffset contains the fields from Vector and FrameOffset.
type VectorOrFrameOffset struct {
X float64 `json:"x,omitempty"`
Y float64 `json:"y,omitempty"`
NodeID string `json:"node_id,omitempty"`
NodeOffset *Vector `json:"node_offset,omitempty"`
}
// Types
// Color is an RGBA Color.
type Color struct {
R float64 `json:"r"`
G float64 `json:"g"`
B float64 `json:"b"`
A float64 `json:"a"`
}
// FormatType describes the possible image formats.
type FormatType string
const (
FormatTypeJPG FormatType = "JPG"
FormatTypePNG = "PNG"
FormatTypeSVG = "SVG"
)
// ExportSetting describes export settings for a Figma object.
type ExportSetting struct {
Suffix string `json:"suffix"`
Format FormatType `json:"format"`
Constraint Constraint `json:"constraint"`
}
// ConstraintType describes a type of Constraint.
type ConstraintType string
const (
ConstraintTypeSCALE ConstraintType = "SCALE"
ConstraintTypeWIDTH = "WIDTH"
ConstraintTypeHEIGHT = "HEIGHT"
)
// A Constraint is a sizing constraint for exports.
type Constraint struct {
Type ConstraintType `json:"type"`
Value float64 `json:"value"`
}
// A Rectangle expresses a bounding box in absolute coordinates
type Rectangle struct {
X float64 `json:"x"`
Y float64 `json:"y"`
Width float64 `json:"width"`
Height float64 `json:"height"`
}
// BlendMode describes how layer blends with layers below.
type BlendMode string
const (
BlendModePASS_THROUGH BlendMode = "PASS_THROUGH"
BlendModeNORMAL = "NORMAL"
BlendModeDARKEN = "DARKEN"
BlendModeMULTIPLY = "MULTIPLY"
BlendModeLINEAR_BURN = "LINEAR_BURN"
BlendModeCOLOR_BURN = "COLOR_BURN"
BlendModeLIGHTEN = "LIGHTEN"
BlendModeSCREEN = "SCREEN"
BlendModeLINEAR_DODGE = "LINEAR_DODGE"
BlendModeCOLOR_DODGE = "COLOR_DODGE"
BlendModeOVERLAY = "OVERLAY"
BlendModeSOFT_LIGHT = "SOFT_LIGHT"
BlendModeHARD_LIGHT = "HARD_LIGHT"
BlendModeDIFFERENCE = "DIFFERENCE"
BlendModeEXCLUSION = "EXCLUSION"
BlendModeHUE = "HUE"
BlendModeSATURATION = "SATURATION"
BlendModeCOLOR = "COLOR"
BlendModeLUMINOSITY = "LUMINOSITY"
)
type LayoutConstraintVertical string
const (
LayoutConstraintVerticalTOP LayoutConstraintVertical = "TOP"
LayoutConstraintVerticalBOTTOM = "BOTTOM"
LayoutConstraintVerticalCENTER = "CENTER"
LayoutConstraintVerticalTOP_BOTTOM = "TOP_BOTTOM"
LayoutConstraintVerticalSCALE = "SCALE"
)
type LayoutConstraintHorizontal string
const (
LayoutConstraintHoritontalLEFT LayoutConstraintHorizontal = "LEFT"
LayoutConstraintHoritontalRIGHT = "RIGHT"
LayoutConstraintHoritontalCENTER = "CENTER"
LayoutConstraintHoritontalLEFT_RIGHT = "LEFT_RIGHT"
LayoutConstraintHoritontalSCALE = "SCALE"
)
type LayoutConstraint struct {
Vertical LayoutConstraintVertical `json:"vertical,omitempty"`
Horizontal LayoutConstraintHorizontal `json:"horizontal,omitempty"`
}
type LayoutGridPattern string
const (
LayoutGridPatternCOLUMNS LayoutGridPattern = "COLUMNS"
LayoutGridPatternROWS = "ROWS"
LayoutGridPatternGRID = "GRID"
)
type LayoutGridAlignment string
const (
LayoutGridAlignmentMIN LayoutGridAlignment = "MIN"
LayoutGridAlignmentMAX = "MAX"
LayoutGridAlignmentCENTER = "CENTER"
)
type LayoutGrid struct {
Pattern LayoutGridPattern `json:"pattern,omitempty"`
SectionSize float64 `json:"sectionSize,omitempty"`
Color Color `json:"color,omitempty"`
Alignment LayoutGridAlignment `json:"alignment,omitempty"`
GutterSize int `json:"gutterSize"`
Count int `json:"count,omitempty"`
Offset int `json:"offset"`
Visible *bool `json:"visible,omitempty"`
}
type EffectType string
const (
EffectTypeINNER_SHADOW EffectType = "INNER_SHADOW"
EffectTypeDROP_SHADOW = "DROP_SHADOW"
EffectTypeLAYER_BLUR = "LAYER_BLUR"
EffectTypeBACKGROUND_BLUR = "BACKGROUND_BLUR"
)
type Effect struct {
Type EffectType `json:"type"`
Visible *bool `json:"visible,omitempty"`
Color Color `json:"color,omitempty"`
BlendMode string `json:"blendMode,omitempty"`
Radius float64 `json:"radius,omitempty"`
Offset Vector `json:"offset,omitempty"`
}
type PaintType string
const (
PaintTypeSOLID PaintType = "SOLID"
PaintTypeGRADIENT_LINEAR = "GRADIENT_LINEAR"
PaintTypeGRADIENT_RADIAL = "GRADIENT_RADIAL"
PaintTypeGRADIENT_ANGULAR = "GRADIENT_ANGULAR"
PaintTypeGRADIENT_DIAMOND = "GRADIENT_DIAMOND"
PaintTypeIMAGE = "IMAGE"
PaintTypeEMOJI = "EMOJI"
)
type ScaleMode string
const (
ScaleModeFILL ScaleMode = "FILL"
ScaleModeFIT = "FIT"
ScaleModeTILE = "TILE"
ScaleModeSTRETCH = "STRETCH"
)
// Paint is a solid color, gradient, or image texture that can be applied as fills or strokes.
type Paint struct {
Type PaintType `json:"type"`
// Is the paint enabled?. default: true.
Visible *bool `json:"visible,omitempty"`
// Overall opacity of paint (colors within the paint can also have opacity values which would blend with this). default: 1.
Opacity float64 `json:"opacity,omitempty"`
// Solid color of the paint.
Color *Color `json:"color,omitempty"`
// This field contains three vectors, each of which are a position in normalized object space (normalized object space is if the top left corner of the bounding box of the object is (0, 0) and the bottom right is (1,1)). The first position corresponds to the start of the gradient (value 0 for the purposes of calculating gradient stops), the second position is the end of the gradient (value 1), and the third handle position determines the width of the gradient (only relevant for non-linear gradients). See image examples below:.
GradientHandlePositions []Vector `json:"gradientHandlePositions,omitempty"`
// Positions of key points along the gradient axis with the colors anchored there. Colors along the gradient are interpolated smoothly between neighboring gradient stops..
GradientStops []ColorStop `json:"gradientStops,omitempty"`
// Image scaling mode.
ScaleMode string `json:"scaleMode,omitempty"`
}
type Vector struct {
X float64 `json:"x"`
Y float64 `json:"y"`
}
type Transform [][]float64
type Path struct {
Path string `json:"path"`
WindingRule string `json:"winding_rule"`
}
type FrameOffset struct {
NodeID string `json:"node_id"`
NodeOffset Vector `json:"node_offset"`
}
type ColorStop struct {
Position float64 `json:"position"`
Color Color `json:"color,omitempty"`
}
type TypeStyle struct {
FontFamily string `json:"fontFamily,omitempty"`
FontPostScriptName string `json:"fontPostScriptName,omitempty"`
Italic bool `json:"italic,omitempty"`
FontWeight float64 `json:"fontWeight,omitempty"`
FontSize float64 `json:"fontSize,omitempty"`
TextAlignHorizontal string `json:"textAlignHorizontal,omitempty"`
TextAlignVertical string `json:"textAlignVertical,omitempty"`
LetterSpacing float64 `json:"letterSpacing"`
LineHeightPercent float64 `json:"lineHeightPercent,omitempty"`
LineHeightPx float64 `json:"lineHeightPx,omitempty"`
Fills []Paint `json:"fills,omitempty"`
}
// Style is the name of a style.
type Style string
// StyleType is the type of a style.
type StyleType string
const (
styleTypeFILL StyleType = "FILL"
StyleTypeSTROKE = "STROKE"
StyleTypeTEXT = "TEXT"
StyleTypeEFFECT = "EFFECT"
StyleTypeGRID = "GRID"
) | figmatypes/figma.go | 0.913279 | 0.421611 | figma.go | starcoder |
package axtest
import (
"github.com/golang/protobuf/proto"
"github.com/jmalloc/ax"
"github.com/jmalloc/ax/endpoint"
)
// ContainsMessage returns true if v contains a message equal to m.
func ContainsMessage(v []proto.Message, m proto.Message) bool {
for _, x := range v {
if proto.Equal(x, m) {
return true
}
}
return false
}
// ConsistsOfMessages returns true if a and b contain equal messages, regardless of order.
func ConsistsOfMessages(a []proto.Message, b ...proto.Message) bool {
if len(a) != len(b) {
return false
}
for _, m := range a {
if !ContainsMessage(b, m) {
return false
}
}
return true
}
// EnvelopesEqual returns true if a and b are equivalent.
func EnvelopesEqual(a, b ax.Envelope) bool {
if !a.CreatedAt.Equal(b.CreatedAt) {
return false
}
if !a.SendAt.Equal(b.SendAt) {
return false
}
if !proto.Equal(a.Message, b.Message) {
return false
}
// ensure the "difficult to compare" values are equal so the remainder of
// the struct can be compared using the equality operator.
a.CreatedAt = b.CreatedAt
a.SendAt = b.SendAt
a.Message = b.Message
return a == b
}
// ContainsEnvelope returns true if v contains an envelope equal to m.
func ContainsEnvelope(v []ax.Envelope, env ax.Envelope) bool {
for _, x := range v {
if EnvelopesEqual(x, env) {
return true
}
}
return false
}
// ConsistsOfEnvelopes returns true if a and b contain equal messages, regardless of order.
func ConsistsOfEnvelopes(a []ax.Envelope, b ...ax.Envelope) bool {
if len(a) != len(b) {
return false
}
for _, env := range a {
if !ContainsEnvelope(b, env) {
return false
}
}
return true
}
// InboundEnvelopesEqual returns true if a and b are equivalent.
func InboundEnvelopesEqual(a, b endpoint.InboundEnvelope) bool {
if !EnvelopesEqual(a.Envelope, b.Envelope) {
return false
}
// ensure the "difficult to compare" values are equal so the remainder of
// the struct can be compared using the equality operator.
a.Envelope = b.Envelope
return a == b
}
// ContainsInboundEnvelope returns true if v contains an envelope equal to m.
func ContainsInboundEnvelope(v []endpoint.InboundEnvelope, env endpoint.InboundEnvelope) bool {
for _, x := range v {
if InboundEnvelopesEqual(x, env) {
return true
}
}
return false
}
// ConsistsOfInboundEnvelopes returns true if a and b contain equal messages, regardless of order.
func ConsistsOfInboundEnvelopes(a []endpoint.InboundEnvelope, b ...endpoint.InboundEnvelope) bool {
if len(a) != len(b) {
return false
}
for _, env := range a {
if !ContainsInboundEnvelope(b, env) {
return false
}
}
return true
}
// OutboundEnvelopesEqual returns true if a and b are equivalent.
func OutboundEnvelopesEqual(a, b endpoint.OutboundEnvelope) bool {
if !EnvelopesEqual(a.Envelope, b.Envelope) {
return false
}
// ensure the "difficult to compare" values are equal so the remainder of
// the struct can be compared using the equality operator.
a.Envelope = b.Envelope
return a == b
}
// ContainsOutboundEnvelope returns true if v contains an envelope equal to m.
func ContainsOutboundEnvelope(v []endpoint.OutboundEnvelope, env endpoint.OutboundEnvelope) bool {
for _, x := range v {
if OutboundEnvelopesEqual(x, env) {
return true
}
}
return false
}
// ConsistsOfOutboundEnvelopes returns true if a and b contain equal messages, regardless of order.
func ConsistsOfOutboundEnvelopes(a []endpoint.OutboundEnvelope, b ...endpoint.OutboundEnvelope) bool {
if len(a) != len(b) {
return false
}
for _, env := range a {
if !ContainsOutboundEnvelope(b, env) {
return false
}
}
return true
} | axtest/compare.go | 0.826432 | 0.4881 | compare.go | starcoder |
package day10
import (
"errors"
"fmt"
"strings"
)
type point struct {
x int
y int
}
// Map is a map of asteroids on a two-dimensional grid.
type Map struct {
asteroids []*Asteroid
grid map[point]*Asteroid
}
var (
errEmptyMap = errors.New("the map string is empty")
)
// LoadFromString reads a map from a string representation of it.
func LoadFromString(s string) (*Map, error) {
lines := strings.Split(s, "\n")
if len(lines) == 0 {
return nil, errEmptyMap
}
var asteroids []*Asteroid
grid := make(map[point]*Asteroid)
for y, line := range lines {
for x, c := range line {
if c == '#' {
a := newAsteroid(x, y)
a.ConnectAll(asteroids)
asteroids = append(asteroids, a)
grid[point{x, y}] = a
}
}
}
return &Map{
asteroids: asteroids,
grid: grid,
}, nil
}
// At checks whether there is an asteroid at the given coordinates.
func (m *Map) At(x, y int) bool {
_, ok := m.grid[point{x, y}]
return ok
}
// VisibleAsteroids returns the number of asteroids visible from a station on the asteroid
// at the given coordinates.
func (m *Map) VisibleAsteroids(x, y int) int {
a := m.grid[point{x, y}]
if a == nil {
panic(fmt.Errorf("cannot check visible asteroids from (%d, %d) because there is no asteroid there", x, y))
}
return len(a.VisibleAsteroids())
}
// BestAsteroid returns the coordinates of the asteroid with the best visibility to other
// asteroids, along with the number of asteroids visible from it.
func (m *Map) BestAsteroid() (int, int, int) {
var best *Asteroid
var count int
for _, a := range m.asteroids {
n := a.VisibleAsteroids()
if len(n) > count {
best, count = a, len(n)
}
}
return best.X, best.Y, count
}
// Vaporized returns the coordinates of the Nth asteroid to be vaporized by the laser at
// the given coordinates.
func (m *Map) Vaporized(x, y, n int) (int, int) {
a := m.grid[point{x, y}]
var seen int
for i := 0; true; i++ {
as := a.AsteroidsAtDistance(i)
if seen+len(as) <= n {
seen += len(as)
} else {
b := as[n-seen]
return b.X, b.Y
}
}
panic("how did I get here?")
} | day10/map.go | 0.779406 | 0.418043 | map.go | starcoder |
package movingcounter
import (
"time"
)
type Clock interface {
Now() time.Time
}
type defaultClock struct{}
func (defaultClock) Now() time.Time {
return time.Now()
}
type Value interface {
Add(a Value) Value
Sub(a Value) Value
Min(a Value) Value
Max(a Value) Value
}
type Int64Value int64
func (v Int64Value) Add(a Value) Value {
return v + a.(Int64Value)
}
func (v Int64Value) Sub(a Value) Value {
return v - a.(Int64Value)
}
func (v Int64Value) Min(a Value) Value {
if a.(Int64Value) < v {
return a
}
return v
}
func (v Int64Value) Max(a Value) Value {
if a.(Int64Value) > v {
return a
}
return v
}
type MovingCounter struct {
clock Clock
period, bucketPeriod time.Duration
zero Value
buckets []counterBucket
first, active int
total Value
count uint64
}
type counterBucket struct {
startTime time.Time
total, min, max Value
count uint64
}
func (b *counterBucket) reset(t time.Time) {
b.startTime = t
b.count = 0
b.total = nil
b.min = nil
b.max = nil
}
func (b *counterBucket) add(val Value) {
if b.count == 0 {
b.total = val
b.min = val
b.max = val
} else {
b.total = b.total.Add(val)
b.min = b.min.Min(val)
b.max = b.max.Max(val)
}
b.count++
}
func NewMovingCounter(clock Clock, period time.Duration, numBuckets int, zero Value) *MovingCounter {
if zero == nil {
panic("zero-value must not be nil")
}
if clock == nil {
clock = defaultClock{}
}
return &MovingCounter{
clock: clock,
period: period,
bucketPeriod: period / time.Duration(numBuckets),
zero: zero,
buckets: make([]counterBucket, numBuckets),
total: zero,
}
}
func (c *MovingCounter) expireOld(now time.Time) {
firstTime := now.Add(-c.period)
for c.active > 0 {
bucket := c.buckets[c.first]
if bucket.startTime.After(firstTime) {
break
}
if bucket.count > 0 {
c.count -= bucket.count
c.total = c.total.Sub(bucket.total)
}
bucket.reset(time.Time{})
c.active--
c.first = (c.first + 1) % len(c.buckets)
}
if c.active == 0 {
// Expired everything.
c.first = 0
if c.count != 0 {
panic("c.count != 0")
}
}
// TODO: If the counter value is a float, rounding errors will accumulate
// over time. We need to occasionally recalculate the total to minimise those
// rounding errors.
if c.count == 0 {
c.total = c.zero
} else if c.count < 0 {
panic("c.count < 0")
}
}
func (c *MovingCounter) getBucket(now time.Time) *counterBucket {
if c.active > 0 {
currIndex := (c.first + c.active - 1) % len(c.buckets)
bucket := &c.buckets[currIndex]
if now.Before(bucket.startTime) {
// Going backwards in time.
return nil
} else if now.Before(bucket.startTime.Add(c.bucketPeriod)) {
return bucket
}
}
c.expireOld(now)
if c.active >= len(c.buckets) {
panic("c.active >= len(c.buckets)")
}
c.active++
index := (c.first + c.active - 1) % len(c.buckets)
bucket := &c.buckets[index]
ut := now.UnixNano()
st := ut - (ut % c.bucketPeriod.Nanoseconds())
bucket.reset(time.Unix(0, st))
return bucket
}
func (c *MovingCounter) iterate(f func(*counterBucket)) {
for i := 0; i < c.active; i++ {
index := (c.first + i) % len(c.buckets)
b := &c.buckets[index]
if b.count == 0 {
continue
}
f(b)
}
}
func (c *MovingCounter) Add(val Value) {
now := c.clock.Now()
c.addWithTime(val, now)
}
func (c *MovingCounter) addWithTime(val Value, now time.Time) {
b := c.getBucket(now)
if b == nil {
return
}
b.add(val)
c.total = c.total.Add(val)
c.count++
}
func (c *MovingCounter) Total() (Value, uint64) {
// Advances time forward and expires old buckets.
c.expireOld(c.clock.Now())
return c.total, c.count
}
func (c *MovingCounter) Min() Value {
// Advances time forward and expires old buckets.
c.expireOld(c.clock.Now())
min := c.zero
hasVal := false
c.iterate(func(b *counterBucket) {
if !hasVal {
min = b.min
hasVal = true
} else {
min = min.Min(b.min)
}
})
return min
}
func (c *MovingCounter) Max() Value {
// Advances time forward and expires old buckets.
c.expireOld(c.clock.Now())
max := c.zero
hasVal := false
c.iterate(func(b *counterBucket) {
if !hasVal {
max = b.max
hasVal = true
} else {
max = max.Max(b.max)
}
})
return max
} | movingcounter/counter.go | 0.533641 | 0.440289 | counter.go | starcoder |
package nifi
import (
"encoding/json"
)
// DimensionsDTO struct for DimensionsDTO
type DimensionsDTO struct {
// The width of the label in pixels when at a 1:1 scale.
Width *float64 `json:"width,omitempty"`
// The height of the label in pixels when at a 1:1 scale.
Height *float64 `json:"height,omitempty"`
}
// NewDimensionsDTO instantiates a new DimensionsDTO object
// This constructor will assign default values to properties that have it defined,
// and makes sure properties required by API are set, but the set of arguments
// will change when the set of required properties is changed
func NewDimensionsDTO() *DimensionsDTO {
this := DimensionsDTO{}
return &this
}
// NewDimensionsDTOWithDefaults instantiates a new DimensionsDTO object
// This constructor will only assign default values to properties that have it defined,
// but it doesn't guarantee that properties required by API are set
func NewDimensionsDTOWithDefaults() *DimensionsDTO {
this := DimensionsDTO{}
return &this
}
// GetWidth returns the Width field value if set, zero value otherwise.
func (o *DimensionsDTO) GetWidth() float64 {
if o == nil || o.Width == nil {
var ret float64
return ret
}
return *o.Width
}
// GetWidthOk returns a tuple with the Width field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *DimensionsDTO) GetWidthOk() (*float64, bool) {
if o == nil || o.Width == nil {
return nil, false
}
return o.Width, true
}
// HasWidth returns a boolean if a field has been set.
func (o *DimensionsDTO) HasWidth() bool {
if o != nil && o.Width != nil {
return true
}
return false
}
// SetWidth gets a reference to the given float64 and assigns it to the Width field.
func (o *DimensionsDTO) SetWidth(v float64) {
o.Width = &v
}
// GetHeight returns the Height field value if set, zero value otherwise.
func (o *DimensionsDTO) GetHeight() float64 {
if o == nil || o.Height == nil {
var ret float64
return ret
}
return *o.Height
}
// GetHeightOk returns a tuple with the Height field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *DimensionsDTO) GetHeightOk() (*float64, bool) {
if o == nil || o.Height == nil {
return nil, false
}
return o.Height, true
}
// HasHeight returns a boolean if a field has been set.
func (o *DimensionsDTO) HasHeight() bool {
if o != nil && o.Height != nil {
return true
}
return false
}
// SetHeight gets a reference to the given float64 and assigns it to the Height field.
func (o *DimensionsDTO) SetHeight(v float64) {
o.Height = &v
}
func (o DimensionsDTO) MarshalJSON() ([]byte, error) {
toSerialize := map[string]interface{}{}
if o.Width != nil {
toSerialize["width"] = o.Width
}
if o.Height != nil {
toSerialize["height"] = o.Height
}
return json.Marshal(toSerialize)
}
type NullableDimensionsDTO struct {
value *DimensionsDTO
isSet bool
}
func (v NullableDimensionsDTO) Get() *DimensionsDTO {
return v.value
}
func (v *NullableDimensionsDTO) Set(val *DimensionsDTO) {
v.value = val
v.isSet = true
}
func (v NullableDimensionsDTO) IsSet() bool {
return v.isSet
}
func (v *NullableDimensionsDTO) Unset() {
v.value = nil
v.isSet = false
}
func NewNullableDimensionsDTO(val *DimensionsDTO) *NullableDimensionsDTO {
return &NullableDimensionsDTO{value: val, isSet: true}
}
func (v NullableDimensionsDTO) MarshalJSON() ([]byte, error) {
return json.Marshal(v.value)
}
func (v *NullableDimensionsDTO) UnmarshalJSON(src []byte) error {
v.isSet = true
return json.Unmarshal(src, &v.value)
} | model_dimensions_dto.go | 0.807347 | 0.598957 | model_dimensions_dto.go | starcoder |
package sigma
// NodeSimpleAnd is a list of matchers connected with logical conjunction
type NodeSimpleAnd []Branch
// Match implements Matcher
func (n NodeSimpleAnd) Match(e Event) (bool, bool) {
for _, b := range n {
match, applicable := b.Match(e)
if !match || !applicable {
return match, applicable
}
}
return true, true
}
// Reduce cleans up unneeded slices
// Static structures can be used if node only holds one or two elements
// Avoids pointless runtime loops
func (n NodeSimpleAnd) Reduce() Branch {
if len(n) == 1 {
return n[0]
}
if len(n) == 2 {
return &NodeAnd{L: n[0], R: n[1]}
}
return n
}
// NodeSimpleOr is a list of matchers connected with logical disjunction
type NodeSimpleOr []Branch
// Reduce cleans up unneeded slices
// Static structures can be used if node only holds one or two elements
// Avoids pointless runtime loops
func (n NodeSimpleOr) Reduce() Branch {
if len(n) == 1 {
return n[0]
}
if len(n) == 2 {
return &NodeOr{L: n[0], R: n[1]}
}
return n
}
// Match implements Matcher
func (n NodeSimpleOr) Match(e Event) (bool, bool) {
var oneApplicable bool
for _, b := range n {
match, applicable := b.Match(e)
if match {
return true, true
}
if applicable {
oneApplicable = true
}
}
return false, oneApplicable
}
// NodeNot negates a branch
type NodeNot struct {
B Branch
}
// Match implements Matcher
func (n NodeNot) Match(e Event) (bool, bool) {
match, applicable := n.B.Match(e)
if !applicable {
return match, applicable
}
return !match, applicable
}
// NodeAnd is a two element node of a binary tree with Left and Right branches
// connected via logical conjunction
type NodeAnd struct {
L, R Branch
}
// Match implements Matcher
func (n NodeAnd) Match(e Event) (bool, bool) {
lMatch, lApplicable := n.L.Match(e)
if !lMatch {
return false, lApplicable
}
rMatch, rApplicable := n.R.Match(e)
return lMatch && rMatch, lApplicable && rApplicable
}
// NodeOr is a two element node of a binary tree with Left and Right branches
// connected via logical disjunction
type NodeOr struct {
L, R Branch
}
// Match implements Matcher
func (n NodeOr) Match(e Event) (bool, bool) {
lMatch, lApplicable := n.L.Match(e)
if lMatch {
return true, lApplicable
}
rMatch, rApplicable := n.R.Match(e)
return lMatch || rMatch, lApplicable || rApplicable
}
func newNodeNotIfNegated(b Branch, negated bool) Branch {
if negated {
return &NodeNot{B: b}
}
return b
}
// TODO - use these functions to create binary trees instead of dunamic slices
func newConjunction(s NodeSimpleAnd) Branch {
if l := len(s); l == 1 || l == 2 {
return s.Reduce()
}
return &NodeAnd{
L: s[0],
R: newConjunction(s[1:]),
}
}
func newDisjunction(s NodeSimpleOr) Branch {
if l := len(s); l == 1 || l == 2 {
return s.Reduce()
}
return &NodeOr{
L: s[0],
R: newDisjunction(s[1:]),
}
} | pkg/sigma/v2/nodes.go | 0.760028 | 0.430147 | nodes.go | starcoder |
package status
import "strings"
import "strconv"
import sisimoji "sisimai/string"
/*
http://www.iana.org/assignments/smtp-enhanced-status-codes/smtp-enhanced-status-codes.xhtml
-------------------------------------------------------------------------------------------------
[Class Sub-Codes]
2.X.Y Success
4.X.Y Persistent Transient Failure
5.X.Y Permanent Failure
-------------------------------------------------------------------------------------------------
[Subject Sub-Codes]
X.0.X --- Other or Undefined Status
There is no additional subject information available.
X.1.X --- Addressing Status
The address status reports on the originator or destination address. It may include
address syntax or validity. These errors can generally be corrected by the sender and
retried.
X.2.X --- Mailbox Status
Mailbox status indicates that something having to do with the mailbox has caused this
DSN. Mailbox issues are assumed to be under the general control of the recipient.
X.3.X --- Mail System Status
Mail system status indicates that something having to do with the destination system
has caused this DSN. System issues are assumed to be under the general control of the
destination system administrator.
X.4.X --- Network and Routing Status
The networking or routing codes report status about the delivery system itself. These
system components include any necessary infrastructure such as directory and routing
services. Network issues are assumed to be under the control of the destination or
intermediate system administrator.
X.5.X --- Mail Delivery Protocol Status
The mail delivery protocol status codes report failures involving the message delivery
protocol. These failures include the full range of problems resulting from
implementation errors or an unreliable connection.
X.6.X --- Message Content or Media Status
The message content or media status codes report failures involving the content of the
message. These codes report failures due to translation, transcoding, or otherwise
unsupported message media. Message content or media issues are under the control of both
the sender and the receiver, both of which must support a common set of supported
content-types.
X.7.X --- Security or Policy Status
The security or policy status codes report failures involving policies such as
per-recipient or per-host filtering and cryptographic operations. Security and policy
status issues are assumed to be under the control of either or both the sender and
recipient. Both the sender and recipient must permit the exchange of messages and
arrange the exchange of necessary keys and certificates for cryptographic operations.
-------------------------------------------------------------------------------------------------
[Enumerated Status Codes]
X.0.0 Any Other undefined Status:(RFC 3463)
Other undefined status is the only undefined error code. It should be used for all
errors for which only the class of the error is known.
X.1.0 --- Other address status:(RFC 3463)
Something about the address specified in the message caused this DSN.
X.1.1 451 Bad destination mailbox address:(RFC3463)
550 The mailbox specified in the address does not exist. For Internet mail names, this
means the address portion to the the left of the "@" sign is invalid. This code is
only useful for permanent failures.
X.1.2 --- Bad destination system addres:
The destination system specified in the address does not exist or is incapable of
accepting mail. For Internet mail names, this means the address portion to the
right of the "@" is invalid for mail. This code is only useful for permanent
failures.
X.1.3 501 Bad destination mailbox address syntax:
The destination address was syntactically invalid. This can apply to any field in
the address. This code is only useful for permanent failures.
X.1.4 --- Destination mailbox address ambiguous:(RFC 3463)
The mailbox address as specified matches one or more recipients on the destination
system. This may result if a heuristic address mapping algorithm is used to map
the specified address to a local mailbox name.
X.1.5 250 Destination address valid:(RFC 3463)
This mailbox address as specified was valid. This status code should be used for
positive delivery reports.
X.1.6 --- Destination mailbox has moved, No forwarding address:(RFC 3463)
The mailbox address provided was at one time valid, but mail is no longer being
accepted for that address. This code is only useful for permanent failures.
X.1.7 --- Bad sender"s mailbox address syntax:(RFC 3463)
The sender"s address was syntactically invalid. This can apply to any field in
the address.
X.1.8 451 Bad sender"s system address:(RFC 3463)
501 The sender"s system specified in the address does not exist or is incapable of
accepting return mail. For domain names, this means the address portion to the
right of the "@" is invalid for mail.
X.1.9 --- Message relayed to non-compliant mailer:(RFC 5248, 3886)
The mailbox address specified was valid, but the message has been relayed to a
system that does not speak this protocol; no further information can be provided.
X.1.10 --- Recipient address has null MX:(RFC 7505)
This status code is returned when the associated address is marked as invalid
using a null MX.
-------------------------------------------------------------------------------------------------
X.2.0 --- Other or undefined mailbox status:(RFC 3463)
The mailbox exists, but something about the destination mailbox has caused the
sending of this DSN.
X.2.1 --- Mailbox disabled, not accepting messages:(RFC 3463)
The mailbox exists, but is not accepting messages. This may be a permanent error
if the mailbox will never be re-enabled or a transient error if the mailbox is
only temporarily disabled.
X.2.2 552 Mailbox full:(RFC 3463)
The mailbox is full because the user has exceeded a per-mailbox administrative
quota or physical capacity. The general semantics implies that the recipient can
delete messages to make more space available. This code should be used as a
persistent transient failure.
X.2.3 552 Message length exceeds administrative limit:(RFC 3463)
A per-mailbox administrative message length limit has been exceeded. This status
code should be used when the per-mailbox message length limit is less than the
general system limit. This code should be used as a permanent failure.
X.2.4 450 Mailing list expansion problem:(RFC 3463)
452 The mailbox is a mailing list address and the mailing list was unable to be
expanded. This code may represent a permanent failure or a persistent transient
failure.
-------------------------------------------------------------------------------------------------
X.3.0 221 Other or undefined mail system status:(RFC 3463)
250 The destination system exists and normally accepts mail, but something about the
421,451 system has caused the generation of this DSN.
550,554
X.3.1 452 Mail system full:(RFC 3463)
Mail system storage has been exceeded. The general semantics imply that the
individual recipient may not be able to delete material to make room for
additional messages. This is useful only as a persistent transient error.
X.3.2 453 System not accepting network messages:(RFC 3463)
521 The host on which the mailbox is resident is not accepting messages. Examples of
such conditions include an imminent shutdown, excessive load, or system
maintenance. This is useful for both permanent and persistent transient errors.
X.3.3 --- System not capable of selected features:(RFC 3463)
Selected features specified for the message are not supported by the destination
system. This can occur in gateways when features from one domain cannot be mapped
onto the supported feature in another.
X.3.4 552 Message too big for system:(RFC 3463)
554 The message is larger than per-message size limit. This limit may either be for
physical or administrative reasons. This is useful only as a permanent error.
X.3.5 --- System incorrectly configured:(RFC 3463)
The system is not configured in a manner that will permit it to accept this
message.
-------------------------------------------------------------------------------------------------
X.4.0 --- Other or undefined network or routing status:(RFC 3463)
Something went wrong with the networking, but it is not clear what the problem is,
or the problem cannot be well expressed with any of the other provided detail
codes.
X.4.1 451 No answer from host:(RFC 3463)
The outbound connection attempt was not answered, because either the remote system
was busy, or was unable to take a call. This is useful only as a persistent
transient error.
X.4.2 421 Bad connection:(RFC 3463)
The outbound connection was established, but was unable to complete the message
transaction, either because of time-out, or inadequate connection quality. This
is useful only as a persistent transient error.
X.4.3 451 Directory server failure:(RFC 3463)
550 The network system was unable to forward the message, because a directory server
was unavailable. This is useful only as a persistent transient error. The
inability to connect to an Internet DNS server is one example of the directory
server failure error.
X.4.4 --- Unable to route:(RFC 3463)
The mail system was unable to determine the next hop for the message because the
necessary routing information was unavailable from the directory server. This is
useful for both permanent and persistent transient errors. A DNS lookup returning
only an SOA (Start of Administration) record for a domain name is one example of
the unable to route error.
X.4.5 451 Mail system congestion:(RFC 3463)
The mail system was unable to deliver the message because the mail system was
congested. This is useful only as a persistent transient error.
X.4.6 --- Routing loop detected:(RFC 3463)
A routing loop caused the message to be forwarded too many times, either because
of incorrect routing tables or a user-forwarding loop. This is useful only as a
persistent transient error.
X.4.7 --- Delivery time expired:(RFC 3463)
The message was considered too old by the rejecting system, either because it
remained on that host too long or because the time-to-live value specified by the
sender of the message was exceeded. If possible, the code for the actual problem
found when delivery was attempted should be returned rather than this code.
-------------------------------------------------------------------------------------------------
X.5.0 220 Other or undefined protocol status:(RFC 3463)
250-253 Something was wrong with the protocol necessary to deliver the message to the next
451,452 hop and the problem cannot be well expressed with any of the other provided detail
454,458 codes.
459,554
501-503
X.5.1 430 Invalid command:(RFC 3463)
500,501 A mail transaction protocol command was issued which was either out of sequence
503,530 or unsupported. This is useful only as a permanent error.
550,554
555
X.5.2 500 Syntax error:(RFC 3463)
500,501 A mail transaction protocol command was issued which could not be interpreted,
502,550 either because the syntax was wrong or the command is unrecognized. This is useful
555 only as a permanent error.
X.5.3 451 Too many recipients:(RFC 3463)
More recipients were specified for the message than could have been delivered by
the protocol. This error should normally result in the segmentation of the message
into two, the remainder of the recipients to be delivered on a subsequent delivery
attempt. It is included in this list in the event that such segmentation is not
possible.
X.5.4 451 Invalid command arguments:(RFC 3463)
501-504 A valid mail transaction protocol command was issued with invalid arguments,
550 either because the arguments were out of range or represented unrecognized
555 features. This is useful only as a permanent error.
X.5.5 --- Wrong protocol version:(RFC 3463)
A protocol version mis-match existed which could not be automatically resolved by
the communicating parties.
X.5.6 550 Authentication Exchange line is too long (RFC 4954)
This enhanced status code SHOULD be returned when the server fails the AUTH
command due to the client sending a [BASE64] response which is longer than the
maximum buffer size available for the currently selected SASL mechanism. This is
useful for both permanent and persistent transient errors.
-------------------------------------------------------------------------------------------------
X.6.0 --- Other or undefined media error:(RFC 3463)
Something about the content of a message caused it to be considered undeliverable
and the problem cannot be well expressed with any of the other provided detail
codes.
X.6.1 --- Media not supported:(RFC 3463)
The media of the message is not supported by either the delivery protocol or the
next system in the forwarding path. This is useful only as a permanent error.
X.6.2 --- Conversion required and prohibited:(RFC 3463)
The content of the message must be converted before it can be delivered and such
conversion is not permitted. Such prohibitions may be the expression of the sender
in the message itself or the policy of the sending host.
X.6.3 554 Conversion required but not supported:(RFC 3463)
The message content must be converted in order to be forwarded but such conversion
is not possible or is not practical by a host in the forwarding path. This
condition may result when an ESMTP gateway supports 8bit transport but is not able
to downgrade the message to 7 bit as required for the next hop.
X.6.4 250 Conversion with loss performed:(RFC 3463)
This is a warning sent to the sender when message delivery was successfully but
when the delivery required a conversion in which some data was lost. This may also
be a permanent error if the sender has indicated that conversion with loss is
prohibited for the message.
X.6.5 --- Conversion Failed:(RFC 3463)
A conversion was required but was unsuccessful. This may be useful as a permanent
or persistent temporary notification.
X.6.6 554 Message content not available (RFC 4468)
The message content could not be fetched from a remote system. This may be useful
as a permanent or persistent temporary notification.
X.6.7 553 The ALT-ADDRESS is required but not specified:(RFC 6531)
550 This indicates the reception of a MAIL or RCPT command that non-ASCII addresses
are not permitted
X.6.8 252 UTF-8 string reply is required, but not permitted by the client:(RFC 6531)
553 This indicates that a reply containing a UTF-8 string is required to show the
550 mailbox name, but that form of response is not permitted by the SMTP client.
X.6.9 550 UTF8SMTP downgrade failed:(RFC 6531)
This indicates that transaction failed after the final "." of the DATA command.
X.6.10 This is a duplicate of X.6.8 and is thus deprecated.
-------------------------------------------------------------------------------------------------
X.7.0 220 Other or undefined security status:(RFC 3463)
235 Something related to security caused the message to be returned, and the problem
450,454 cannot be well expressed with any of the other provided detail codes. This status
500,501 code may also be used when the condition cannot be further described because of
503,504 security policies in force.
530,535
550
X.7.1 451 Delivery not authorized, message refused:(RFC 3463)
454,502 The sender is not authorized to send to the destination. This can be the result
503,533 of per-host or per-recipient filtering. This memo does not discuss the merits of
550,551 any such filtering, but provides a mechanism to report such. This is useful only
as a permanent error.
X.7.2 550 Mailing list expansion prohibited:(RFC 3463)
The sender is not authorized to send a message to the intended mailing list. This
is useful only as a permanent error.
X.7.3 --- Security conversion required but not possible:(RFC 3463)
A conversion from one secure messaging protocol to another was required for
delivery and such conversion was not possible. This is useful only as a permanent
error.
X.7.4 504 Security features not supported:(RFC 3463)
A message contained security features such as secure authentication that could not
be supported on the delivery protocol. This is useful only as a permanent error.
X.7.5 --- Cryptographic failure:(RFC 3463)
A transport system otherwise authorized to validate or decrypt a message in
transport was unable to do so because necessary information such as key was not
available or such information was invalid.
X.7.6 --- Cryptographic algorithm not supported:(RFC 3463)
A transport system otherwise authorized to validate or decrypt a message was
unable to do so because the necessary algorithm was not supported.
X.7.7 --- Message integrity failure:(RFC 3463)
A transport system otherwise authorized to validate a message was unable to do so
because the message was corrupted or altered. This may be useful as a permanent,
transient persistent, or successful delivery code.
X.7.8 535 Trust relationship required:(RFC 4954)
554 This response to the AUTH command indicates that the authentication failed due to
invalid or insufficient authentication credentials. In this case, the client
SHOULD ask the user to supply new credentials (such as by presenting a password
dialog box).
X.7.9 534 Authentication mechanism is too weak:(RFC 4954)
This response to the AUTH command indicates that the selected authentication
mechanism is weaker than server policy permits for that user. The client SHOULD
retry with a new authentication mechanism.
X.7.10 523 Encryption Needed:(RFC 5248)
This indicates that external strong privacy layer is needed in order to use the
requested authentication mechanism. This is primarily intended for use with clear
text authentication mechanisms. A client which receives this may activate a
security layer such as TLS prior to authenticating, or attempt to use a stronger
mechanism.
X.7.11 524 Encryption required for requested authentication mechanism:(RFC 4954)
538 This response to the AUTH command indicates that the selected authentication
mechanism may only be used when the underlying SMTP connection is encrypted. Note
that this response code is documented here for historical purposes only. Modern
implementations SHOULD NOT advertise mechanisms that are not permitted due to lack
of encryption, unless an encryption layer of sufficient strength is currently
being employed.
X.7.12 422 A password transition is needed:(RFC 4954)
432 This response to the AUTH command indicates that the user needs to transition to
the selected authentication mechanism. This is typically done by authenticating
once using the [PLAIN] authentication mechanism. The selected mechanism SHOULD
then work for authentications in subsequent sessions.
X.7.13 525 User Account Disabled:(RFC 5248)
Sometimes a system administrator will have to disable a user"s account (e.g., due
to lack of payment, abuse, evidence of a break-in attempt, etc). This error code
occurs after a successful authentication to a disabled account. This informs the
client that the failure is permanent until the user contacts their system
administrator to get the account re-enabled. It differs from a generic
authentication failure where the client"s best option is to present the passphrase
entry dialog in case the user simply mistyped their passphrase.
X.7.14 535 Trust relationship required:(RFC 5248)
554 The submission server requires a configured trust relationship with a third-party
server in order to access the message content. This value replaces the prior use
of X.7.8 for this error condition. thereby updating [RFC4468].
X.7.15 450 Priority Level is too low:(RFC6710)
550 The specified priority level is below the lowest priority acceptable for the
4xx receiving SMTP server. This condition might be temporary, for example the server
5xx is operating in a mode where only higher priority messages are accepted for
transfer and delivery, while lower priority messages are rejected.
X.7.16 552 Message is too big for the specified priority:(RFC 6710)
4xx The message is too big for the specified priority. This condition might be
5xx temporary, for example the server is operating in a mode where only higher
priority messages below certain size are accepted for transfer and delivery.
X.7.17 5xx Mailbox owner has changed:(RFC 6710)
This status code is returned when a message is received with a
Require-Recipient-Valid-Since field or RRVS extension and the receiving system is
able to determine that the intended recipient mailbox has not been under
continuous ownership since the specified date-time.
X.7.18 5xx Domain owner has changed:(RFC 7293)
This status code is returned when a message is received with a
Require-Recipient-Valid-Since field or RRVS extension and the receiving system
wishes to disclose that the owner of the domain name of the recipient has changed
since the specified date-time.
X.7.19 5xx RRVS test cannot be completed:(RFC 7293)
This status code is returned when a message is received with a
Require-Recipient-Valid-Since field or RRVS extension and the receiving system
cannot complete the requested evaluation because the required timestamp was not
recorded. The message originator needs to decide whether to reissue the message
without RRVS protection.
X.7.20 550 No passing DKIM signature found:(RFC 7372)
This status code is returned when a message did not contain any passing DKIM
signatures. (This violates the advice of Section 6.1 of [RFC6376].)
X.7.21 550 No acceptable DKIM signature found:(RFC 7372, 6476)
This status code is returned when a message contains one or more passing DKIM
signatures, but none are acceptable. (This violates the advice of Section 6.1 of
[RFC6376].)
X.7.22 550 No valid author-matched DKIM signature found:(RFC 7372)
This status code is returned when a message contains one or more passing DKIM
signatures, but none are acceptable because none have an identifier(s) that
matches the author address(es) found in the From header field. This is a special
case of X.7.21. (This violates the advice of Section 6.1 of [RFC6376].)
X.7.23 550 SPF validation failed:(RFC 7273, 7208)
This status code is returned when a message completed an SPF check that produced
a "fail" result, contrary to local policy requirements. Used in place of 5.7.1 as
described in Section 8.4 of [RFC7208].
X.7.24 451 SPF validation error:(RFC 7372, 7208)
550 This status code is returned when evaluation of SPF relative to an arriving
message resulted in an error. Used in place of 4.4.3 or 5.5.2 as described in
Sections 8.6 and 8.7 of [RFC7208].
X.7.25 550 Reverse DNS validation failed:(RFC 7372, 7601)
This status code is returned when an SMTP client"s IP address failed a reverse
DNS validation check, contrary to local policy requirements.
X.7.26 550 Multiple authentication checks failed:(RFC 7372)
This status code is returned when a message failed more than one message
authentication check, contrary to local policy requirements. The particular
mechanisms that failed are not specified.
X.7.27 550 Sender address has null MX:(RFC 7505)
This status code is returned when the associated sender address has a null MX,
and the SMTP receiver is configured to reject mail from such sender
(e.g., because it could not return a DSN).
-------------------------------------------------------------------------------------------------
SAMPLES
554 5.5.0 No recipients have been specified
503 5.5.0 Valid RCPT TO required before BURL
554 5.6.3 Conversion required but not supported
554 5.3.4 Message too big for system
554 5.7.8 URL resolution requires trust relationship
552 5.2.2 Mailbox full
554 5.6.6 IMAP URL resolution failed
250 2.5.0 Waiting for additional BURL or BDAT commands
451 4.4.1 IMAP server unavailable
250 2.5.0 Ok.
250 2.6.4 MIME header conversion with loss performed
235 2.7.0 Authentication Succeeded
432 4.7.12 A password transition is needed
454 4.7.0 Temporary authentication failure
534 5.7.9 Authentication mechanism is too weak
535 5.7.8 Authentication credentials invalid
500 5.5.6 Authentication Exchange line is too long
530 5.7.0 Authentication required
538 5.7.11 Encryption required for requested authentication
5.7.8 Authentication credentials invalid
5.7.9 Authentication mechanism is too weak
5.7.11 Encryption required for requested authentication mechanism
-------------------------------------------------------------------------------------------------
*/
// standardcode() returns an error reason matched with the given delivery status code
func StandardCode(argv0 string) string {
// @param [string] argv0 Delivery Status Code
// @return [string] Matched error reason name or an empty string
table := map[string]string {
"2.1.5": "delivered", // Successfully delivered
// ----------------------------------------------------------------------------------------
"4.1.6": "hasmoved", // Destination mailbox has moved, No forwarding address
"4.1.7": "rejected", // Bad sender"s mailbox address syntax
"4.1.8": "rejected", // Bad sender"s system address
"4.1.9": "systemerror", // Message relayed to non-compliant mailer
"4.2.1": "suspend", // Mailbox disabled, not accepting messages
"4.2.2": "mailboxfull", // Mailbox full
"4.2.3": "exceedlimit", // Message length exceeds administrative limit
"4.2.4": "filtered", // Mailing list expansion problem
//"4.3.0": "systemerror", // Other or undefined mail system status
"4.3.1": "systemfull", // Mail system full
"4.3.2": "notaccept", // System not accepting network messages
"4.3.3": "systemerror", // System not capable of selected features
"4.3.5": "systemerror", // System incorrectly configured
//"4.4.0": "networkerror", // Other or undefined network or routing status
"4.4.1": "expired", // No answer from host
"4.4.2": "networkerror", // Bad connection
"4.4.3": "systemerror", // Directory server failure
"4.4.4": "networkerror", // Unable to route
"4.4.5": "systemfull", // Mail system congestion
"4.4.6": "networkerror", // Routing loop detected
"4.4.7": "expired", // Delivery time expired
//"4.5.0": "networkerror", // Other or undefined protocol status
"4.5.3": "systemerror", // Too many recipients
"4.5.5": "systemerror", // Wrong protocol version
"4.6.0": "contenterror", // Other or undefined media error
"4.6.2": "contenterror", // Conversion required and prohibited
"4.6.5": "contenterror", // Conversion Failed
//"4.7.0": "securityerror",// Other or undefined security status
"4.7.1": "blocked", // Delivery not authorized, message refused
"4.7.2": "blocked", // Mailing list expansion prohibited
"4.7.5": "securityerror",// Cryptographic failure
"4.7.6": "securityerror",// Cryptographic algorithm not supported
"4.7.7": "securityerror",// Message integrity failure
"4.7.12": "securityerror",// A password transition is needed
"4.7.15": "securityerror",// Priority Level is too low
"4.7.16": "mesgtoobig", // Message is too big for the specified priority
"4.7.24": "securityerror",// SPF validation error
"4.7.25": "blocked", // Reverse DNS validation failed
// ----------------------------------------------------------------------------------------
"5.1.0": "userunknown", // Other address status
"5.1.1": "userunknown", // Bad destination mailbox address
"5.1.2": "hostunknown", // Bad destination system address
"5.1.3": "userunknown", // Bad destination mailbox address syntax
"5.1.4": "filtered", // Destination mailbox address ambiguous
"5.1.6": "hasmoved", // Destination mailbox has moved, No forwarding address
"5.1.7": "rejected", // Bad sender"s mailbox address syntax
"5.1.8": "rejected", // Bad sender"s system address
"5.1.9": "systemerror", // Message relayed to non-compliant mailer
"5.1.10": "notaccept", // Recipient address has null MX
"5.2.0": "filtered", // Other or undefined mailbox status
"5.2.1": "filtered", // Mailbox disabled, not accepting messages
"5.2.2": "mailboxfull", // Mailbox full
"5.2.3": "exceedlimit", // Message length exceeds administrative limit
"5.2.4": "filtered", // Mailing list expansion problem
"5.3.0": "systemerror", // Other or undefined mail system status
"5.3.1": "systemfull", // Mail system full
"5.3.2": "notaccept", // System not accepting network messages
"5.3.3": "systemerror", // System not capable of selected features
"5.3.4": "mesgtoobig", // Message too big for system
"5.3.5": "systemerror", // System incorrectly configured
"5.4.0": "networkerror", // Other or undefined network or routing status
"5.4.3": "systemerror", // Directory server failure
"5.4.4": "hostunknown", // Unable to route
"5.5.2": "syntaxerror", // If the server cannot BASE64 decode any client response (AUTH)
"5.5.3": "toomanyconn", // Too many recipients
"5.5.4": "systemerror", // Invalid command arguments
"5.5.5": "systemerror", // Wrong protocol version
"5.5.6": "syntaxerror", // Authentication Exchange line is too long
"5.6.0": "contenterror", // Other or undefined media error
"5.6.1": "contenterror", // Media not supported
"5.6.2": "contenterror", // Conversion required and prohibited
"5.6.3": "contenterror", // Conversion required but not supported
"5.6.5": "contenterror", // Conversion Failed
"5.6.6": "contenterror", // Message content not available
"5.6.7": "contenterror", // Non-ASCII addresses not permitted for that sender/recipient
"5.6.8": "contenterror", // UTF-8 string reply is required, but not permitted by the SMTP client
"5.6.9": "contenterror", // UTF-8 header message cannot be transferred to one or more recipients
"5.7.0": "securityerror",// Other or undefined security status
"5.7.1": "securityerror",// Delivery not authorized, message refused
"5.7.2": "securityerror",// Mailing list expansion prohibited
"5.7.3": "securityerror",// Security conversion required but not possible
"5.7.4": "securityerror",// Security features not supported
"5.7.5": "securityerror",// Cryptographic failure
"5.7.6": "securityerror",// Cryptographic algorithm not supported
"5.7.7": "securityerror",// Message integrity failure
"5.7.8": "securityerror",// Authentication credentials invalid
"5.7.9": "securityerror",// Authentication mechanism is too weak
"5.7.10": "securityerror",// Encryption Needed
"5.7.11": "securityerror",// Encryption required for requested authentication mechanism
"5.7.13": "suspend", // User Account Disabled
"5.7.14": "securityerror",// Trust relationship required
"5.7.15": "securityerror",// Priority Level is too low
"5.7.16": "mesgtoobig", // Message is too big for the specified priority
"5.7.17": "hasmoved", // Mailbox owner has changed
"5.7.18": "hasmoved", // Domain owner has changed
"5.7.19": "securityerror",// RRVS test cannot be completed
"5.7.20": "securityerror",// No passing DKIM signature found
"5.7.21": "securityerror",// No acceptable DKIM signature found
"5.7.22": "securityerror",// No valid author-matched DKIM signature found
"5.7.23": "securityerror",// SPF validation failed
"5.7.24": "securityerror",// SPF validation error
"5.7.25": "blocked", // Reverse DNS validation failed
"5.7.26": "securityerror",// Multiple authentication checks failed
"5.7.27": "notaccept", // MX resource record of a destination host is Null MX: RFC7505
}
return table[argv0]
}
// InternalCode() returns an internal delivery status code matched with the given error reason name
func InternalCode(argv0 string, argv1 bool) string {
// @param [string] argv0 An error reason name
// @param [bool] argv1 true: temporary error, false: permanent error
// @return [string] Matched delivery status code or an empty string
codet := map[string]string {
"blocked": "4.0.971",
"contenterror": "4.0.960",
//"exceedlimit": "4.0.923",
"expired": "4.0.947",
"filtered": "4.0.924",
//"hasmoved": "4.0.916",
//"hostunknown": "4.0.912",
"mailboxfull": "4.0.922",
//"mailererror": "4.0.939",
//"mesgtoobig": "4.0.934",
"networkerror": "4.0.944",
//"norelaying": "4.0.909",
"notaccept": "4.0.932",
"onhold": "4.0.901",
"rejected": "4.0.918",
"securityerror": "4.0.970",
"spamdetected": "4.0.980",
//"suspend": "4.0.921",
"systemerror": "4.0.930",
"systemfull": "4.0.931",
"toomanyconn": "4.0.945",
//"userunknown": "4.0.911",
"undefined": "4.0.900",
}
codep := map[string]string {
"blocked": "5.0.971",
"contenterror": "5.0.960",
"exceedlimit": "5.0.923",
"expired": "5.0.947",
"filtered": "5.0.910",
"hasmoved": "5.0.916",
"hostunknown": "5.0.912",
"mailboxfull": "5.0.922",
"mailererror": "5.0.939",
"mesgtoobig": "5.0.934",
"networkerror": "5.0.944",
"norelaying": "5.0.909",
"notaccept": "5.0.932",
"onhold": "5.0.901",
"policyviolation": "5.0.972",
"rejected": "5.0.918",
"securityerror": "5.0.970",
"spamdetected": "5.0.980",
"suspend": "5.0.921",
"systemerror": "5.0.930",
"systemfull": "5.0.931",
"syntaxerror": "5.0.902",
"toomanyconn": "5.0.945",
"userunknown": "5.0.911",
"undefined": "5.0.900",
"virusdetected": "5.0.971",
}
if argv1 {
// Return a matched delivery status code in the Permanent Errors: codep
return codep[argv0]
} else {
// Return a matched delivery status code in the Tempoorary Errors: codet
return codet[argv0]
}
}
// Code() returns an internal delivery status code matched with the given reason string
func Code(argv0 string, argv1 bool) string {
// @param [string] argv0 Reason name
// @param [bool] argv1 false: Permanent error, true: Temporary error
// @return [string] Internal delivery status code or an empty string
if len(argv0) == 0 { return "" }
return InternalCode(argv0, argv1)
}
// Name() returns a reason string matched with the given delivery status code
func Name(argv0 string) string {
// @param [string] argv0 Delivery status code(D.S.N.)
// @return [string] Reason name or an empty string
if len(argv0) == 0 { return "" }
if strings.HasPrefix(argv0, "2") || strings.HasPrefix(argv0, "4") || strings.HasPrefix(argv0, "5") {
// The first letter of a delivery status code are 2, 4 or 5
if sisimoji.ContainsOnlyNumbers(strings.ReplaceAll(argv0, ".", "")) { return StandardCode(argv0) }
}
return ""
}
// Find() returns a delivery status code found from the given string
func Find(argv0 string) string {
// @param [string] argv0 String including DSN
// @return [string] Found delivery status code or an empty string
if len(argv0) < 5 { return "" }
argv0 = strings.ReplaceAll(argv0, "-", " ") // "550-5.1.1" => "550 5.1.1"
found := ""
CEFLOOP: for _, e := range strings.Fields(argv0) {
// Find a delivery status code from each field
e = strings.TrimSpace(e) // Strip space characters
e = strings.Trim(e, "[]") // Strip square brackets
e = strings.Trim(e, "()") // Strip parentheses
if len(e) < 5 { continue } // Minimun length is 5: "5.1.1"
if strings.Count(e, ".") != 2 { continue } // The number of "." is 2
if e[0:2] == "2." || e[0:2] == "4." || e[0:2] == "5." {
// The first character of a delivery status is 2, 4 or 5
for _, v := range strings.Split(e[2:], ".") {
// Check each digit of the delivery status code like "2.1.5"
i, oops := strconv.Atoi(v)
if oops != nil { continue CEFLOOP }
if i < 0 { continue CEFLOOP }
if strings.HasPrefix(e, "4.") || strings.HasPrefix(e, "5.") {
// 4.2.3 OR 5.1.1
if i > 999 { continue CEFLOOP }
} else {
// 2.1.5
if i > 7 { continue CEFLOOP }
}
}
found = e
break CEFLOOP
}
}
return found
} | sisimai/smtp/status/lib.go | 0.513425 | 0.560373 | lib.go | starcoder |
package hsvimage
import (
"github.com/spakin/hsvimage/hsvcolor"
"image"
"image/color"
)
// NHSVA is an in-memory image whose At method returns hsvcolor.NHSVA values.
type NHSVA struct {
// Pix holds the image's pixels, in H, S, V, A order. The pixel at
// (x, y) starts at Pix[(y-Rect.Min.Y)*Stride + (x-Rect.Min.X)*4].
Pix []uint8
// Stride is the Pix stride (in bytes) between vertically adjacent pixels.
Stride int
// Rect is the image's bounds.
Rect image.Rectangle
}
// ColorModel states that an NHSVA image uses the hsvcolor.NHSVA color model.
func (p *NHSVA) ColorModel() color.Model { return hsvcolor.NHSVAModel }
// Bounds returns the image's bounding rectangle.
func (p *NHSVA) Bounds() image.Rectangle { return p.Rect }
// At returns the color at the given image coordinates.
func (p *NHSVA) At(x, y int) color.Color {
return p.NHSVAAt(x, y)
}
// NHSVAAt returns the color at the given image coordinates as specifically an
// hsvcolor.NHSVA color.
func (p *NHSVA) NHSVAAt(x, y int) hsvcolor.NHSVA {
if !(image.Point{x, y}.In(p.Rect)) {
return hsvcolor.NHSVA{}
}
i := p.PixOffset(x, y)
s := p.Pix[i : i+4 : i+4] // Small cap improves performance, see https://golang.org/issue/27857
return hsvcolor.NHSVA{H: s[0], S: s[1], V: s[2], A: s[3]}
}
// PixOffset returns the index of the first element of Pix that corresponds to
// the pixel at (x, y).
func (p *NHSVA) PixOffset(x, y int) int {
return (y-p.Rect.Min.Y)*p.Stride + (x-p.Rect.Min.X)*4
}
// Set assigns an arbitrary color to a given coordinate.
func (p *NHSVA) Set(x, y int, c color.Color) {
if !(image.Point{x, y}.In(p.Rect)) {
return
}
i := p.PixOffset(x, y)
c1 := hsvcolor.NHSVAModel.Convert(c).(hsvcolor.NHSVA)
s := p.Pix[i : i+4 : i+4] // Small cap improves performance, see https://golang.org/issue/27857
s[0] = c1.H
s[1] = c1.S
s[2] = c1.V
s[3] = c1.A
}
// SetNHSVA assigns an NHSVA color to a given coordinate.
func (p *NHSVA) SetNHSVA(x, y int, c hsvcolor.NHSVA) {
if !(image.Point{x, y}.In(p.Rect)) {
return
}
i := p.PixOffset(x, y)
s := p.Pix[i : i+4 : i+4] // Small cap improves performance, see https://golang.org/issue/27857
s[0] = c.H
s[1] = c.S
s[2] = c.V
s[3] = c.A
}
// SubImage returns an image representing the portion of the image p visible
// through r. The returned value shares pixels with the original image.
func (p *NHSVA) SubImage(r image.Rectangle) image.Image {
r = r.Intersect(p.Rect)
// If r1 and r2 are Rectangles, r1.Intersect(r2) is not guaranteed to
// be inside either r1 or r2 if the intersection is empty. Without
// explicitly checking for this, the Pix[i:] expression below can
// panic.
if r.Empty() {
return &NHSVA{}
}
i := p.PixOffset(r.Min.X, r.Min.Y)
return &NHSVA{
Pix: p.Pix[i:],
Stride: p.Stride,
Rect: r,
}
}
// Opaque scans the entire image and reports whether it is fully opaque.
func (p *NHSVA) Opaque() bool {
if p.Rect.Empty() {
return true
}
i0, i1 := 3, p.Rect.Dx()*4
for y := p.Rect.Min.Y; y < p.Rect.Max.Y; y++ {
for i := i0; i < i1; i += 4 {
if p.Pix[i] != 0xff {
return false
}
}
i0 += p.Stride
i1 += p.Stride
}
return true
}
// NewNHSVA returns a new NHSVA image with the given bounds.
func NewNHSVA(r image.Rectangle) *NHSVA {
w, h := r.Dx(), r.Dy()
pix := make([]uint8, 4*w*h)
return &NHSVA{pix, 4 * w, r}
}
// NHSVA64 is an in-memory image whose At method returns hsvcolor.NHSVA64 values.
type NHSVA64 struct {
// Pix holds the image's pixels, in H, S, V, A order and big-endian
// format. The pixel at (x, y) starts at Pix[(y-Rect.Min.Y)*Stride +
// (x-Rect.Min.X)*8].
Pix []uint8
// Stride is the Pix stride (in bytes) between vertically adjacent pixels.
Stride int
// Rect is the image's bounds.
Rect image.Rectangle
}
// ColorModel states that an NHSVA64 image uses the hsvcolor.NHSVA64 color model.
func (p *NHSVA64) ColorModel() color.Model { return hsvcolor.NHSVA64Model }
// Bounds returns the image's bounding rectangle.
func (p *NHSVA64) Bounds() image.Rectangle { return p.Rect }
// At returns the color at the given image coordinates.
func (p *NHSVA64) At(x, y int) color.Color {
return p.NHSVA64At(x, y)
}
// NHSVA64At returns the color at the given image coordinates as specifically an
// hsvcolor.NHSVA64 color.
func (p *NHSVA64) NHSVA64At(x, y int) hsvcolor.NHSVA64 {
if !(image.Point{x, y}.In(p.Rect)) {
return hsvcolor.NHSVA64{}
}
i := p.PixOffset(x, y)
s := p.Pix[i : i+8 : i+8] // Small cap improves performance, see https://golang.org/issue/27857
return hsvcolor.NHSVA64{
H: uint16(s[0])<<8 | uint16(s[1]),
S: uint16(s[2])<<8 | uint16(s[3]),
V: uint16(s[4])<<8 | uint16(s[5]),
A: uint16(s[6])<<8 | uint16(s[7]),
}
}
// PixOffset returns the index of the first element of Pix that corresponds to
// the pixel at (x, y).
func (p *NHSVA64) PixOffset(x, y int) int {
return (y-p.Rect.Min.Y)*p.Stride + (x-p.Rect.Min.X)*8
}
// Set assigns an arbitrary color to a given coordinate.
func (p *NHSVA64) Set(x, y int, c color.Color) {
if !(image.Point{x, y}.In(p.Rect)) {
return
}
i := p.PixOffset(x, y)
c1 := hsvcolor.NHSVA64Model.Convert(c).(hsvcolor.NHSVA64)
s := p.Pix[i : i+8 : i+8] // Small cap improves performance, see https://golang.org/issue/27857
s[0] = uint8(c1.H >> 8)
s[1] = uint8(c1.H)
s[2] = uint8(c1.S >> 8)
s[3] = uint8(c1.S)
s[4] = uint8(c1.V >> 8)
s[5] = uint8(c1.V)
s[6] = uint8(c1.A >> 8)
s[7] = uint8(c1.A)
}
// SetNHSVA64 assigns an NHSVA64 color to a given coordinate.
func (p *NHSVA64) SetNHSVA64(x, y int, c hsvcolor.NHSVA64) {
if !(image.Point{x, y}.In(p.Rect)) {
return
}
i := p.PixOffset(x, y)
s := p.Pix[i : i+8 : i+8] // Small cap improves performance, see https://golang.org/issue/27857
s[0] = uint8(c.H >> 8)
s[1] = uint8(c.H)
s[2] = uint8(c.S >> 8)
s[3] = uint8(c.S)
s[4] = uint8(c.V >> 8)
s[5] = uint8(c.V)
s[6] = uint8(c.A >> 8)
s[7] = uint8(c.A)
}
// SubImage returns an image representing the portion of the image p visible
// through r. The returned value shares pixels with the original image.
func (p *NHSVA64) SubImage(r image.Rectangle) image.Image {
r = r.Intersect(p.Rect)
// If r1 and r2 are Rectangles, r1.Intersect(r2) is not guaranteed to
// be inside either r1 or r2 if the intersection is empty. Without
// explicitly checking for this, the Pix[i:] expression below can
// panic.
if r.Empty() {
return &NHSVA64{}
}
i := p.PixOffset(r.Min.X, r.Min.Y)
return &NHSVA64{
Pix: p.Pix[i:],
Stride: p.Stride,
Rect: r,
}
}
// Opaque scans the entire image and reports whether it is fully opaque.
func (p *NHSVA64) Opaque() bool {
if p.Rect.Empty() {
return true
}
i0, i1 := 6, p.Rect.Dx()*8
for y := p.Rect.Min.Y; y < p.Rect.Max.Y; y++ {
for i := i0; i < i1; i += 8 {
if p.Pix[i+0] != 0xff || p.Pix[i+1] != 0xff {
return false
}
}
i0 += p.Stride
i1 += p.Stride
}
return true
}
// NewNHSVA64 returns a new NHSVA64 image with the given bounds.
func NewNHSVA64(r image.Rectangle) *NHSVA64 {
w, h := r.Dx(), r.Dy()
pix := make([]uint8, 8*w*h)
return &NHSVA64{pix, 8 * w, r}
}
// NHSVAF64 is an in-memory image whose At method returns hsvcolor.NHSVAF64
// values.
type NHSVAF64 struct {
// Pix holds the image's pixels, in H, S, V, A order. The pixel at
// (x, y) starts at Pix[(y-Rect.Min.Y)*Stride + (x-Rect.Min.X)*4].
Pix []float64
// Stride is the Pix stride (in 64-bit words) between vertically adjacent pixels.
Stride int
// Rect is the image's bounds.
Rect image.Rectangle
}
// ColorModel states that an NHSVAF64 image uses the hsvcolor.NHSVAF64 color
// model.
func (p *NHSVAF64) ColorModel() color.Model { return hsvcolor.NHSVAF64Model }
// Bounds returns the image's bounding rectangle.
func (p *NHSVAF64) Bounds() image.Rectangle { return p.Rect }
// At returns the color at the given image coordinates.
func (p *NHSVAF64) At(x, y int) color.Color {
return p.NHSVAF64At(x, y)
}
// NHSVAF64At returns the color at the given image coordinates as specifically
// an hsvcolor.NHSVAF64 color.
func (p *NHSVAF64) NHSVAF64At(x, y int) hsvcolor.NHSVAF64 {
if !(image.Point{x, y}.In(p.Rect)) {
return hsvcolor.NHSVAF64{}
}
i := p.PixOffset(x, y)
s := p.Pix[i : i+4 : i+4] // Small cap improves performance, see https://golang.org/issue/27857
return hsvcolor.NHSVAF64{H: s[0], S: s[1], V: s[2], A: s[3]}
}
// PixOffset returns the index of the first element of Pix that corresponds to
// the pixel at (x, y).
func (p *NHSVAF64) PixOffset(x, y int) int {
return (y-p.Rect.Min.Y)*p.Stride + (x-p.Rect.Min.X)*4
}
// Set assigns an arbitrary color to a given coordinate.
func (p *NHSVAF64) Set(x, y int, c color.Color) {
if !(image.Point{x, y}.In(p.Rect)) {
return
}
i := p.PixOffset(x, y)
c1 := hsvcolor.NHSVAF64Model.Convert(c).(hsvcolor.NHSVAF64)
s := p.Pix[i : i+4 : i+4] // Small cap improves performance, see https://golang.org/issue/27857
s[0] = c1.H
s[1] = c1.S
s[2] = c1.V
s[3] = c1.A
}
// SetNHSVAF64 assigns an NHSVAF64 color to a given coordinate.
func (p *NHSVAF64) SetNHSVAF64(x, y int, c hsvcolor.NHSVAF64) {
if !(image.Point{x, y}.In(p.Rect)) {
return
}
i := p.PixOffset(x, y)
s := p.Pix[i : i+4 : i+4] // Small cap improves performance, see https://golang.org/issue/27857
s[0] = c.H
s[1] = c.S
s[2] = c.V
s[3] = c.A
}
// SubImage returns an image representing the portion of the image p visible
// through r. The returned value shares pixels with the original image.
func (p *NHSVAF64) SubImage(r image.Rectangle) image.Image {
r = r.Intersect(p.Rect)
// If r1 and r2 are Rectangles, r1.Intersect(r2) is not guaranteed to
// be inside either r1 or r2 if the intersection is empty. Without
// explicitly checking for this, the Pix[i:] expression below can
// panic.
if r.Empty() {
return &NHSVAF64{}
}
i := p.PixOffset(r.Min.X, r.Min.Y)
return &NHSVAF64{
Pix: p.Pix[i:],
Stride: p.Stride,
Rect: r,
}
}
// Opaque scans the entire image and reports whether it is fully opaque.
func (p *NHSVAF64) Opaque() bool {
if p.Rect.Empty() {
return true
}
i0, i1 := 3, p.Rect.Dx()*4
for y := p.Rect.Min.Y; y < p.Rect.Max.Y; y++ {
for i := i0; i < i1; i += 4 {
if p.Pix[i] != 1.0 {
return false
}
}
i0 += p.Stride
i1 += p.Stride
}
return true
}
// NewNHSVAF64 returns a new NHSVAF64 image with the given bounds.
func NewNHSVAF64(r image.Rectangle) *NHSVAF64 {
w, h := r.Dx(), r.Dy()
pix := make([]float64, 4*w*h)
return &NHSVAF64{pix, 4 * w, r}
} | image.go | 0.778439 | 0.496338 | image.go | starcoder |
package main
import (
"fmt"
"math"
"github.com/rolfschmidt/advent-of-code-2021/helper"
)
func main() {
fmt.Println("Part 1", Part1())
fmt.Println("Part 2", Part2())
}
func Part1() int {
return Run(false)
}
func Part2() int {
return Run(true)
}
type Point struct {
value int
x int
y int
}
func PointExist(matrix [][]Point, x int , y int) bool {
if x < 0 || y < 0 || y > len(matrix) - 1 || x > len(matrix[y]) - 1 {
return false
}
return true
}
func Checked(checked map[string]bool, x int , y int) bool {
if _, ok := checked[helper.Int2String(x) + "," + helper.Int2String(y)]; ok {
return true
}
return false
}
func Flash(matrix [][]Point, px int, py int, checked map[string]bool) (int, map[string]bool) {
if !PointExist(matrix, px, py) || Checked(checked, px, py) {
return 0, checked
}
result := 0
matrix[py][px].value += 1
if matrix[py][px].value > 9 {
matrix[py][px].value = 0
result += 1
checked[helper.Int2String(px) + "," + helper.Int2String(py)] = true
// right
flash := 0
flash, checked = Flash(matrix, px + 1, py, checked)
result += flash
// left
flash = 0
flash, checked = Flash(matrix, px - 1, py, checked)
result += flash
// up
flash = 0
flash, checked = Flash(matrix, px, py + 1, checked)
result += flash
// down
flash = 0
flash, checked = Flash(matrix, px, py - 1, checked)
result += flash
// right up
flash = 0
flash, checked = Flash(matrix, px + 1, py + 1, checked)
result += flash
// left up
flash = 0
flash, checked = Flash(matrix, px - 1, py + 1, checked)
result += flash
// right down
flash = 0
flash, checked = Flash(matrix, px + 1, py - 1, checked)
result += flash
// left down
flash = 0
flash, checked = Flash(matrix, px - 1, py - 1, checked)
result += flash
}
return result, checked
}
func Run(Part2 bool) int {
matrix := [][]Point{}
for y, line := range helper.ReadFile("input.txt") {
line := helper.Split(line, "")
linePoints := []Point{}
for x, v := range line {
linePoints = append(linePoints, Point{ value: helper.String2Int(v), x: x, y: y })
}
matrix = append(matrix, linePoints)
}
result := 0
max := 100
if Part2 {
max = math.MaxInt32
}
for i := 0; i < max; i++ {
checked := map[string]bool{}
for _, line := range matrix {
for _, point := range line {
flash := 0
flash, checked = Flash(matrix, point.x, point.y, checked)
result += flash
}
}
if Part2 {
zero := true
MATRIX:
for _, line := range matrix {
for _, point := range line {
if point.value != 0 {
zero = false
break MATRIX
}
}
}
if zero {
return i+1
}
}
}
return result
} | day11/main.go | 0.603231 | 0.420362 | main.go | starcoder |
package gql
import (
"context"
"fmt"
"reflect"
"strings"
"github.com/rigglo/gql/pkg/language/ast"
)
/*
Schema is a graphql schema, a root for the mutations, queries and subscriptions.
A GraphQL service’s collective type system capabilities are referred to as that
service’s “schema”. A schema is defined in terms of the types and directives it
supports as well as the root operation types for each kind of operation: query,
mutation, and subscription; this determines the place in the type system where those operations begin.
*/
type Schema struct {
Query *Object
Mutation *Object
Subscription *Object
Directives TypeSystemDirectives
AdditionalTypes []Type
RootValue interface{}
}
// SDL generates an SDL string from your schema
func (s Schema) SDL() string {
b := newSDLBuilder(&s)
return b.Build()
}
// TypeKind shows the kind of a Type
type TypeKind uint
const (
// ScalarKind is for the Scalars in the GraphQL type system
ScalarKind TypeKind = iota
// ObjectKind is for the Object in the GraphQL type system
ObjectKind
// InterfaceKind is for the Interface in the GraphQL type system
InterfaceKind
// UnionKind is for the Union in the GraphQL type system
UnionKind
// EnumKind is for the Enum in the GraphQL type system
EnumKind
// InputObjectKind is for the InputObject in the GraphQL type system
InputObjectKind
// NonNullKind is for the NonNull in the GraphQL type system
NonNullKind
// ListKind is for the List in the GraphQL type system
ListKind
)
// Type represents a Type in the GraphQL Type System
type Type interface {
GetName() string
GetDescription() string
GetKind() TypeKind
String() string
}
func isInputType(t Type) bool {
if t.GetKind() == ListKind || t.GetKind() == NonNullKind {
return isInputType(t.(WrappingType).Unwrap())
}
if t.GetKind() == ScalarKind || t.GetKind() == EnumKind || t.GetKind() == InputObjectKind {
return true
}
return false
}
func isOutputType(t Type) bool {
if t.GetKind() == ListKind || t.GetKind() == NonNullKind {
return isOutputType(t.(WrappingType).Unwrap())
}
if t.GetKind() == ScalarKind || t.GetKind() == ObjectKind || t.GetKind() == InterfaceKind || t.GetKind() == UnionKind || t.GetKind() == EnumKind {
return true
}
return false
}
/*
_ ___ ____ _____
| | |_ _/ ___|_ _|
| | | |\___ \ | |
| |___ | | ___) || |
|_____|___|____/ |_|
*/
/*
List in the GraphQL Type System
For creating a new List type, always use the `NewList` function
NewList(SomeType)
*/
type List struct {
Name string
Description string
Wrapped Type
}
/*
NewList returns a new List
In every case, you should use NewList function to create a new List, instead of creating on your own.
*/
func NewList(t Type) Type {
return &List{
Name: "List",
Description: "Built-in 'List' type",
Wrapped: t,
}
}
// GetName returns the name of the type, "List"
func (l *List) GetName() string {
return l.Name
}
// GetDescription shows the description of the type
func (l *List) GetDescription() string {
return l.Description
}
// GetKind returns the kind of the type, ListKind
func (l *List) GetKind() TypeKind {
return ListKind
}
// Unwrap the inner type from the List
func (l *List) Unwrap() Type {
return l.Wrapped
}
// String implements the fmt.Stringer
func (l *List) String() string {
return fmt.Sprintf("[%s]", l.Wrapped.String())
}
/*
_ _ ___ _ _ _ _ _ _ _ _
| \ | |/ _ \| \ | | | \ | | | | | | | |
| \| | | | | \| |_____| \| | | | | | | |
| |\ | |_| | |\ |_____| |\ | |_| | |___| |___
|_| \_|\___/|_| \_| |_| \_|\___/|_____|_____|
*/
// NonNull type from the GraphQL type system
type NonNull struct {
Name string
Description string
Wrapped Type
}
/*
NewNonNull function helps create a new Non-Null type
It must be used, instead of creating a non null type "manually"
*/
func NewNonNull(t Type) Type {
return &NonNull{
Name: "NonNull",
Description: "Built-in 'NonNull' type",
Wrapped: t,
}
}
// GetName returns the name of the type, "NonNull"
func (l *NonNull) GetName() string {
return l.Name
}
// GetDescription returns the description of the NonNull type
func (l *NonNull) GetDescription() string {
return l.Description
}
// GetKind returns the kind of the type, NonNullKind
func (l *NonNull) GetKind() TypeKind {
return NonNullKind
}
// Unwrap the inner type of the NonNull type
func (l *NonNull) Unwrap() Type {
return l.Wrapped
}
// String implements the fmt.Stringer
func (l *NonNull) String() string {
return fmt.Sprintf("%s!", l.Wrapped.String())
}
/*
____ ____ _ _ _ ____ ____
/ ___| / ___| / \ | | / \ | _ \/ ___|
\___ \| | / _ \ | | / _ \ | |_) \___ \
___) | |___ / ___ \| |___ / ___ \| _ < ___) |
|____/ \____/_/ \_\_____/_/ \_\_| \_\____/
*/
// CoerceResultFunc coerces the result of a field resolve to the final format
type CoerceResultFunc func(interface{}) (interface{}, error)
// CoerceInputFunc coerces the input value to a type which will be used during field resolve
type CoerceInputFunc func(interface{}) (interface{}, error)
// ScalarAstValueValidator validates if the ast value is right
type ScalarAstValueValidator func(ast.Value) error
/*
Scalar types represent primitive leaf values in a GraphQL type system. GraphQL responses
take the form of a hierarchical tree; the leaves of this tree are typically
GraphQL Scalar types (but may also be Enum types or null values)
*/
type Scalar struct {
Name string
Description string
Directives TypeSystemDirectives
CoerceResultFunc CoerceResultFunc
CoerceInputFunc CoerceInputFunc
AstValidator ScalarAstValueValidator
}
// GetName returns the name of the scalar
func (s *Scalar) GetName() string {
return s.Name
}
// GetDescription shows the description of the scalar
func (s *Scalar) GetDescription() string {
return s.Description
}
// GetKind returns the kind of the type, ScalarKind
func (s *Scalar) GetKind() TypeKind {
return ScalarKind
}
// GetDirectives returns the directives added to the scalar
func (s *Scalar) GetDirectives() []TypeSystemDirective {
return s.Directives
}
// CoerceResult coerces a result into the final type
func (s *Scalar) CoerceResult(i interface{}) (interface{}, error) {
return s.CoerceResultFunc(i)
}
// CoerceInput coerces the input value to the type used in execution
func (s *Scalar) CoerceInput(i interface{}) (interface{}, error) {
return s.CoerceInputFunc(i)
}
// String implements the fmt.Stringer
func (s *Scalar) String() string {
return s.Name
}
/*
_____ _ _ _ _ __ __ ____
| ____| \ | | | | | \/ / ___|
| _| | \| | | | | |\/| \___ \
| |___| |\ | |_| | | | |___) |
|_____|_| \_|\___/|_| |_|____/
*/
/*
Enum types, like scalar types, also represent leaf values in a GraphQL type system.
However Enum types describe the set of possible values.
*/
type Enum struct {
Name string
Description string
Directives TypeSystemDirectives
Values EnumValues
}
/*
GetDescription returns the description of the Enum
*/
func (e *Enum) GetDescription() string {
return e.Description
}
/*
GetName returns the name of the Enum
*/
func (e *Enum) GetName() string {
return e.Name
}
/*
GetDirectives returns all the directives set for the Enum
*/
func (e *Enum) GetDirectives() []TypeSystemDirective {
return e.Directives
}
/*
GetKind returns the type kind, "Enum"
*/
func (e *Enum) GetKind() TypeKind {
return EnumKind
}
/*
GetValues returns the values for the Enum
*/
func (e *Enum) GetValues() []*EnumValue {
return e.Values
}
// String implements the fmt.Stringer
func (e *Enum) String() string {
return e.Name
}
/*
EnumValues is an alias for a bunch of "EnumValue"s
*/
type EnumValues []*EnumValue
/*
EnumValue is one single value in an Enum
*/
type EnumValue struct {
Name string
Description string
Directives TypeSystemDirectives
Value interface{}
}
/*
GetDescription returns the description of the value
*/
func (e EnumValue) GetDescription() string {
return e.Description
}
/*
GetDirectives returns the directives set for the enum value
*/
func (e EnumValue) GetDirectives() []TypeSystemDirective {
return e.Directives
}
/*
GetValue returns the actual value of the enum value
This value is used in the resolver functions, the enum coerces this value.
*/
func (e EnumValue) GetValue() interface{} {
return e.Value
}
/*
IsDeprecated show if the deprecated directive is set for the enum value or not
*/
func (e EnumValue) IsDeprecated() bool {
for _, d := range e.Directives {
if _, ok := d.(*deprecated); ok {
return true
}
}
return false
}
/*
___ ____ _ _____ ____ _____ ____
/ _ \| __ ) | | ____/ ___|_ _/ ___|
| | | | _ \ _ | | _|| | | | \___ \
| |_| | |_) | |_| | |__| |___ | | ___) |
\___/|____/ \___/|_____\____| |_| |____/
*/
/*
Object GraphQL queries are hierarchical and composed, describing a tree of information.
While Scalar types describe the leaf values of these hierarchical queries, Objects describe the intermediate levels
They represent a list of named fields, each of which yield a value of a specific type.
Example code:
var RootQuery = &gql.Object{
Name: "Query",
Fields: gql.Fields{
"hello": {
Name: "hello",
Type: gql.String,
Resolver: func(ctx gql.Context) (interface{}, error) {
return "world", nil
},
},
},
}
All fields defined within an Object type must not have a name which begins with "__" (two underscores),
as this is used exclusively by GraphQL’s introspection system.
*/
type Object struct {
Description string
Name string
Implements Interfaces
Directives TypeSystemDirectives
Fields Fields
}
/*
GetDescription returns the description of the object
*/
func (o *Object) GetDescription() string {
return o.Description
}
/*
GetName returns the name of the object
*/
func (o *Object) GetName() string {
return o.Name
}
/*
GetKind returns the type kind, "Object"
*/
func (o *Object) GetKind() TypeKind {
return ObjectKind
}
/*
GetInterfaces returns all the interfaces that the object implements
*/
func (o *Object) GetInterfaces() []*Interface {
return o.Implements
}
/*
GetDirectives returns all the directives that are used on the object
*/
func (o *Object) GetDirectives() []TypeSystemDirective {
return o.Directives
}
/*
GetFields returns all the fields on the object
*/
func (o *Object) GetFields() map[string]*Field {
return o.Fields
}
/*
AddFields lets you add fields to the object
*/
func (o *Object) AddField(name string, f *Field) {
o.Fields[name] = f
}
/*
DoesImplement helps decide if the object implements an interface or not
*/
func (o *Object) DoesImplement(i *Interface) bool {
for _, in := range o.Implements {
// @Fontinalis: previously tried reflect.DeepEqual, but it's slow.., it's also not used during execution..
if in.Name == i.Name {
return true
}
}
return false
}
// String implements the fmt.Stringer
func (o *Object) String() string {
return o.Name
}
/*
___ _ _ _____ _____ ____ _____ _ ____ _____ ____
|_ _| \ | |_ _| ____| _ \| ___/ \ / ___| ____/ ___|
| || \| | | | | _| | |_) | |_ / _ \| | | _| \___ \
| || |\ | | | | |___| _ <| _/ ___ \ |___| |___ ___) |
|___|_| \_| |_| |_____|_| \_\_|/_/ \_\____|_____|____/
*/
/*
Interfaces is an alias for more and more graphql interface
*/
type Interfaces []*Interface
/*
Interface represent a list of named fields and their arguments. GraphQL objects can then
implement these interfaces which requires that the object type will define all fields
defined by those interfaces.
Fields on a GraphQL interface have the same rules as fields on a GraphQL object; their type
can be Scalar, Object, Enum, Interface, or Union, or any wrapping type whose base type is one of those five.
*/
type Interface struct {
Description string
Name string
Directives TypeSystemDirectives
Fields Fields
TypeResolver TypeResolver
}
/*
TypeResolver resolves an Interface's return Type
*/
type TypeResolver func(context.Context, interface{}) *Object
/*
GetDescription returns the description of the interface
*/
func (i *Interface) GetDescription() string {
return i.Description
}
/*
GetName returns the name of the interface
*/
func (i *Interface) GetName() string {
return i.Name
}
/*
GetKind returns the type kind, "Interface"
*/
func (i *Interface) GetKind() TypeKind {
return InterfaceKind
}
/*
GetDirectives returns all the directives that are set to the interface
*/
func (i *Interface) GetDirectives() []TypeSystemDirective {
return i.Directives
}
/*
GetFields returns all the fields that can be implemented on the interface
*/
func (i *Interface) GetFields() map[string]*Field {
return i.Fields
}
/*
Resolve the return type of the interface
*/
func (i *Interface) Resolve(ctx context.Context, v interface{}) *Object {
return i.TypeResolver(ctx, v)
}
// String implements the fmt.Stringer
func (i *Interface) String() string {
return i.Name
}
/*
_____ ___ _____ _ ____ ____
| ___|_ _| ____| | | _ \/ ___|
| |_ | || _| | | | | | \___ \
| _| | || |___| |___| |_| |___) |
|_| |___|_____|_____|____/|____/
*/
/*
Fields is an alias for more Fields
*/
type Fields map[string]*Field
/*
Add a field to the Fields
*/
func (fs Fields) Add(name string, f *Field) {
fs[name] = f
}
/*
Resolver function that can resolve a field using the Context from the executor
*/
type Resolver func(Context) (interface{}, error)
/*
Field for an object or interface
For Object, you can provide a resolver if you want to return custom data or have a something to do with the data.
For Interfaces, there's NO need for resolvers, since they will NOT be executed.
*/
type Field struct {
Description string
Arguments Arguments
Type Type
Directives TypeSystemDirectives
Resolver Resolver
}
/*
GetDescription of the field
*/
func (f *Field) GetDescription() string {
return f.Description
}
/*
GetArguments of the field
*/
func (f *Field) GetArguments() Arguments {
return f.Arguments
}
/*
GetType returns the type of the field
*/
func (f *Field) GetType() Type {
return f.Type
}
/*
GetDirectives returns the directives set for the field
*/
func (f *Field) GetDirectives() []TypeSystemDirective {
return f.Directives
}
/*
IsDeprecated returns if the field is depricated
*/
func (f *Field) IsDeprecated() bool {
for _, d := range f.Directives {
if _, ok := d.(*deprecated); ok {
return true
}
}
return false
}
/*
_ _ _ _ ___ ___ _ _ ____
| | | | \ | |_ _/ _ \| \ | / ___|
| | | | \| || | | | | \| \___ \
| |_| | |\ || | |_| | |\ |___) |
\___/|_| \_|___\___/|_| \_|____/
*/
/*
Members is an alias for a list of types that are set for a Union
*/
type Members []Type
/*
Union represents an object that could be one of a list of graphql objects types,
but provides for no guaranteed fields between those types. They also differ from interfaces
in that Object types declare what interfaces they implement, but are not aware of what unions contain them
*/
type Union struct {
Description string
Name string
Members Members
Directives TypeSystemDirectives
TypeResolver TypeResolver
}
/*
GetDescription show the description of the Union type
*/
func (u *Union) GetDescription() string {
return u.Description
}
/*
GetName show the name of the Union type, "Union"
*/
func (u *Union) GetName() string {
return u.Name
}
/*
GetKind returns the kind of the type, UnionType
*/
func (u *Union) GetKind() TypeKind {
return UnionKind
}
/*
GetMembers returns the composite types contained by the union
*/
func (u *Union) GetMembers() []Type {
return u.Members
}
/*
GetDirectives returns all the directives applied to the Union type
*/
func (u *Union) GetDirectives() []TypeSystemDirective {
return u.Directives
}
/*
Resolve helps decide the executor which contained type to resolve
*/
func (u *Union) Resolve(ctx context.Context, v interface{}) *Object {
return u.TypeResolver(ctx, v)
}
// String implements the fmt.Stringer
func (u *Union) String() string {
return u.Name
}
/*
_ ____ ____ _ _ __ __ _____ _ _ _____ ____
/ \ | _ \ / ___| | | | \/ | ____| \ | |_ _/ ___|
/ _ \ | |_) | | _| | | | |\/| | _| | \| | | | \___ \
/ ___ \| _ <| |_| | |_| | | | | |___| |\ | | | ___) |
/_/ \_\_| \_\\____|\___/|_| |_|_____|_| \_| |_| |____/
*/
/*
Arguments for fields and directives
*/
type Arguments map[string]*Argument
func (args Arguments) String() (out string) {
if args == nil {
return
}
argsS := []string{}
for name, arg := range args {
if arg.Description != "" {
out += `"` + arg.Description + `" `
}
out += name + `: `
out += fmt.Sprint(arg.Type)
if arg.IsDefaultValueSet() {
out += fmt.Sprint(arg.DefaultValue)
}
argsS = append(argsS, out)
out = ""
}
out = `(` + strings.Join(argsS, ", ") + `)`
return
}
/*
Argument defines an argument for a field or a directive. Default value can be provided
in case it's not populated during a query. The type of the argument must be an input type.
*/
type Argument struct {
Description string
Type Type
DefaultValue interface{}
}
/*
IsDefaultValueSet helps to know if the default value was set or not
*/
func (a *Argument) IsDefaultValueSet() bool {
return reflect.ValueOf(a.DefaultValue).IsValid()
}
/*
___ _ _ ____ _ _ _____ ___ ____ _ _____ ____ _____ ____
|_ _| \ | | _ \| | | |_ _| / _ \| __ ) | | ____/ ___|_ _/ ___|
| || \| | |_) | | | | | | | | | | _ \ _ | | _|| | | | \___ \
| || |\ | __/| |_| | | | | |_| | |_) | |_| | |__| |___ | | ___) |
|___|_| \_|_| \___/ |_| \___/|____/ \___/|_____\____| |_| |____/
*/
/*
InputObject is an input object from the GraphQL type system. It must have a name and
at least one input field set. Its fields can have default values if needed.
*/
type InputObject struct {
Description string
Name string
Directives TypeSystemDirectives
Fields InputFields
}
/*
GetDescription returns the description of the input object and also there to
implement the Type interface
*/
func (o *InputObject) GetDescription() string {
return o.Description
}
/*
GetName returns the name of the input object and also there to
implement the Type interface
*/
func (o *InputObject) GetName() string {
return o.Name
}
/*
GetKind returns the kind of the type, "InputObject", and also there to
implement the Type interface
*/
func (o *InputObject) GetKind() TypeKind {
return InputObjectKind
}
/*
GetDirectives returns the directives set for the input object
*/
func (o *InputObject) GetDirectives() []TypeSystemDirective {
return o.Directives
}
/*
GetFields returns the fields of the input object
*/
func (o *InputObject) GetFields() map[string]*InputField {
return o.Fields
}
// String implements the fmt.Stringer
func (o *InputObject) String() string {
return o.Name
}
/*
InputField is a field for an InputObject. As an Argument, it can be used as an input too,
can have a default value and must have an input type.
*/
type InputField struct {
Description string
Type Type
DefaultValue interface{}
Directives TypeSystemDirectives
}
/*
IsDefaultValueSet helps to know if the default value was set or not
*/
func (o *InputField) IsDefaultValueSet() bool {
return reflect.ValueOf(o.DefaultValue).IsValid()
}
/*
InputFields is just an alias for a bunch of "InputField"s
*/
type InputFields map[string]*InputField | schema.go | 0.695131 | 0.414247 | schema.go | starcoder |
package onshape
import (
"encoding/json"
)
// BTCurveGeometryCircle115 struct for BTCurveGeometryCircle115
type BTCurveGeometryCircle115 struct {
BTCurveGeometry114
BtType *string `json:"btType,omitempty"`
Clockwise *bool `json:"clockwise,omitempty"`
Radius *float64 `json:"radius,omitempty"`
Xcenter *float64 `json:"xcenter,omitempty"`
Xdir *float64 `json:"xdir,omitempty"`
Ycenter *float64 `json:"ycenter,omitempty"`
Ydir *float64 `json:"ydir,omitempty"`
}
// NewBTCurveGeometryCircle115 instantiates a new BTCurveGeometryCircle115 object
// This constructor will assign default values to properties that have it defined,
// and makes sure properties required by API are set, but the set of arguments
// will change when the set of required properties is changed
func NewBTCurveGeometryCircle115() *BTCurveGeometryCircle115 {
this := BTCurveGeometryCircle115{}
return &this
}
// NewBTCurveGeometryCircle115WithDefaults instantiates a new BTCurveGeometryCircle115 object
// This constructor will only assign default values to properties that have it defined,
// but it doesn't guarantee that properties required by API are set
func NewBTCurveGeometryCircle115WithDefaults() *BTCurveGeometryCircle115 {
this := BTCurveGeometryCircle115{}
return &this
}
// GetBtType returns the BtType field value if set, zero value otherwise.
func (o *BTCurveGeometryCircle115) GetBtType() string {
if o == nil || o.BtType == nil {
var ret string
return ret
}
return *o.BtType
}
// GetBtTypeOk returns a tuple with the BtType field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *BTCurveGeometryCircle115) GetBtTypeOk() (*string, bool) {
if o == nil || o.BtType == nil {
return nil, false
}
return o.BtType, true
}
// HasBtType returns a boolean if a field has been set.
func (o *BTCurveGeometryCircle115) HasBtType() bool {
if o != nil && o.BtType != nil {
return true
}
return false
}
// SetBtType gets a reference to the given string and assigns it to the BtType field.
func (o *BTCurveGeometryCircle115) SetBtType(v string) {
o.BtType = &v
}
// GetClockwise returns the Clockwise field value if set, zero value otherwise.
func (o *BTCurveGeometryCircle115) GetClockwise() bool {
if o == nil || o.Clockwise == nil {
var ret bool
return ret
}
return *o.Clockwise
}
// GetClockwiseOk returns a tuple with the Clockwise field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *BTCurveGeometryCircle115) GetClockwiseOk() (*bool, bool) {
if o == nil || o.Clockwise == nil {
return nil, false
}
return o.Clockwise, true
}
// HasClockwise returns a boolean if a field has been set.
func (o *BTCurveGeometryCircle115) HasClockwise() bool {
if o != nil && o.Clockwise != nil {
return true
}
return false
}
// SetClockwise gets a reference to the given bool and assigns it to the Clockwise field.
func (o *BTCurveGeometryCircle115) SetClockwise(v bool) {
o.Clockwise = &v
}
// GetRadius returns the Radius field value if set, zero value otherwise.
func (o *BTCurveGeometryCircle115) GetRadius() float64 {
if o == nil || o.Radius == nil {
var ret float64
return ret
}
return *o.Radius
}
// GetRadiusOk returns a tuple with the Radius field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *BTCurveGeometryCircle115) GetRadiusOk() (*float64, bool) {
if o == nil || o.Radius == nil {
return nil, false
}
return o.Radius, true
}
// HasRadius returns a boolean if a field has been set.
func (o *BTCurveGeometryCircle115) HasRadius() bool {
if o != nil && o.Radius != nil {
return true
}
return false
}
// SetRadius gets a reference to the given float64 and assigns it to the Radius field.
func (o *BTCurveGeometryCircle115) SetRadius(v float64) {
o.Radius = &v
}
// GetXcenter returns the Xcenter field value if set, zero value otherwise.
func (o *BTCurveGeometryCircle115) GetXcenter() float64 {
if o == nil || o.Xcenter == nil {
var ret float64
return ret
}
return *o.Xcenter
}
// GetXcenterOk returns a tuple with the Xcenter field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *BTCurveGeometryCircle115) GetXcenterOk() (*float64, bool) {
if o == nil || o.Xcenter == nil {
return nil, false
}
return o.Xcenter, true
}
// HasXcenter returns a boolean if a field has been set.
func (o *BTCurveGeometryCircle115) HasXcenter() bool {
if o != nil && o.Xcenter != nil {
return true
}
return false
}
// SetXcenter gets a reference to the given float64 and assigns it to the Xcenter field.
func (o *BTCurveGeometryCircle115) SetXcenter(v float64) {
o.Xcenter = &v
}
// GetXdir returns the Xdir field value if set, zero value otherwise.
func (o *BTCurveGeometryCircle115) GetXdir() float64 {
if o == nil || o.Xdir == nil {
var ret float64
return ret
}
return *o.Xdir
}
// GetXdirOk returns a tuple with the Xdir field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *BTCurveGeometryCircle115) GetXdirOk() (*float64, bool) {
if o == nil || o.Xdir == nil {
return nil, false
}
return o.Xdir, true
}
// HasXdir returns a boolean if a field has been set.
func (o *BTCurveGeometryCircle115) HasXdir() bool {
if o != nil && o.Xdir != nil {
return true
}
return false
}
// SetXdir gets a reference to the given float64 and assigns it to the Xdir field.
func (o *BTCurveGeometryCircle115) SetXdir(v float64) {
o.Xdir = &v
}
// GetYcenter returns the Ycenter field value if set, zero value otherwise.
func (o *BTCurveGeometryCircle115) GetYcenter() float64 {
if o == nil || o.Ycenter == nil {
var ret float64
return ret
}
return *o.Ycenter
}
// GetYcenterOk returns a tuple with the Ycenter field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *BTCurveGeometryCircle115) GetYcenterOk() (*float64, bool) {
if o == nil || o.Ycenter == nil {
return nil, false
}
return o.Ycenter, true
}
// HasYcenter returns a boolean if a field has been set.
func (o *BTCurveGeometryCircle115) HasYcenter() bool {
if o != nil && o.Ycenter != nil {
return true
}
return false
}
// SetYcenter gets a reference to the given float64 and assigns it to the Ycenter field.
func (o *BTCurveGeometryCircle115) SetYcenter(v float64) {
o.Ycenter = &v
}
// GetYdir returns the Ydir field value if set, zero value otherwise.
func (o *BTCurveGeometryCircle115) GetYdir() float64 {
if o == nil || o.Ydir == nil {
var ret float64
return ret
}
return *o.Ydir
}
// GetYdirOk returns a tuple with the Ydir field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *BTCurveGeometryCircle115) GetYdirOk() (*float64, bool) {
if o == nil || o.Ydir == nil {
return nil, false
}
return o.Ydir, true
}
// HasYdir returns a boolean if a field has been set.
func (o *BTCurveGeometryCircle115) HasYdir() bool {
if o != nil && o.Ydir != nil {
return true
}
return false
}
// SetYdir gets a reference to the given float64 and assigns it to the Ydir field.
func (o *BTCurveGeometryCircle115) SetYdir(v float64) {
o.Ydir = &v
}
func (o BTCurveGeometryCircle115) MarshalJSON() ([]byte, error) {
toSerialize := map[string]interface{}{}
serializedBTCurveGeometry114, errBTCurveGeometry114 := json.Marshal(o.BTCurveGeometry114)
if errBTCurveGeometry114 != nil {
return []byte{}, errBTCurveGeometry114
}
errBTCurveGeometry114 = json.Unmarshal([]byte(serializedBTCurveGeometry114), &toSerialize)
if errBTCurveGeometry114 != nil {
return []byte{}, errBTCurveGeometry114
}
if o.BtType != nil {
toSerialize["btType"] = o.BtType
}
if o.Clockwise != nil {
toSerialize["clockwise"] = o.Clockwise
}
if o.Radius != nil {
toSerialize["radius"] = o.Radius
}
if o.Xcenter != nil {
toSerialize["xcenter"] = o.Xcenter
}
if o.Xdir != nil {
toSerialize["xdir"] = o.Xdir
}
if o.Ycenter != nil {
toSerialize["ycenter"] = o.Ycenter
}
if o.Ydir != nil {
toSerialize["ydir"] = o.Ydir
}
return json.Marshal(toSerialize)
}
type NullableBTCurveGeometryCircle115 struct {
value *BTCurveGeometryCircle115
isSet bool
}
func (v NullableBTCurveGeometryCircle115) Get() *BTCurveGeometryCircle115 {
return v.value
}
func (v *NullableBTCurveGeometryCircle115) Set(val *BTCurveGeometryCircle115) {
v.value = val
v.isSet = true
}
func (v NullableBTCurveGeometryCircle115) IsSet() bool {
return v.isSet
}
func (v *NullableBTCurveGeometryCircle115) Unset() {
v.value = nil
v.isSet = false
}
func NewNullableBTCurveGeometryCircle115(val *BTCurveGeometryCircle115) *NullableBTCurveGeometryCircle115 {
return &NullableBTCurveGeometryCircle115{value: val, isSet: true}
}
func (v NullableBTCurveGeometryCircle115) MarshalJSON() ([]byte, error) {
return json.Marshal(v.value)
}
func (v *NullableBTCurveGeometryCircle115) UnmarshalJSON(src []byte) error {
v.isSet = true
return json.Unmarshal(src, &v.value)
} | onshape/model_bt_curve_geometry_circle_115.go | 0.897785 | 0.406744 | model_bt_curve_geometry_circle_115.go | starcoder |
package graph
import (
"github.com/stackrox/rox/pkg/dackbox/sortedkeys"
)
// Modification represents a readable change to a Graph.
type Modification interface {
RGraph
FromModified([]byte) bool
ToModified([]byte) bool
Apply(graph applyableGraph)
}
// NewModifiedGraph returns a new instance of a ModifiedGraph.
func NewModifiedGraph(graph RWGraph) *ModifiedGraph {
return &ModifiedGraph{
RWGraph: graph,
}
}
// ModifiedGraph provides a view of an RWGraph that tracks changes.
// Anytime a key is modified in the graph, the affected values are recorded, and the changes can be played back onto
// an 'applyableGraph' with the Apply function.
type ModifiedGraph struct {
RWGraph
modifiedFrom sortedkeys.SortedKeys
modifiedTo sortedkeys.SortedKeys
}
// Apply applies a modification to a separate graph object.
func (ms *ModifiedGraph) Apply(graph applyableGraph) {
for _, from := range ms.modifiedFrom {
tos := ms.GetRefsFrom(from)
if tos == nil {
graph.deleteFrom(from)
} else {
graph.setFrom(from, tos)
}
}
for _, to := range ms.modifiedTo {
froms := ms.GetRefsTo(to)
if froms == nil {
graph.deleteTo(to)
} else {
graph.setTo(to, froms)
}
}
}
// FromModified returns of the children of the input key have been modified in the ModifiedGraph.
func (ms *ModifiedGraph) FromModified(from []byte) bool {
return ms.modifiedFrom.Find(from) != -1
}
// ToModified returns of the parents of the input key have been modified in the ModifiedGraph.
func (ms *ModifiedGraph) ToModified(to []byte) bool {
return ms.modifiedTo.Find(to) != -1
}
// SetRefs sets the children of 'from' to be the input list of keys 'to'.
// Will add all of the input keys, we well as any keys that were previously children of 'from' to the list of values modified.
func (ms *ModifiedGraph) SetRefs(from []byte, to [][]byte) {
ms.modifiedFrom, _ = ms.modifiedFrom.Insert(from)
ms.modifiedTo = ms.modifiedTo.Union(sortedkeys.Sort(to))
ms.modifiedTo = ms.modifiedTo.Union(ms.GetRefsFrom(from))
ms.RWGraph.SetRefs(from, to)
}
// AddRefs adds the set of keys 'to' to the list of children of 'from'.
// Will add all of the input keys to the list of values modified.
func (ms *ModifiedGraph) AddRefs(from []byte, to ...[]byte) {
ms.modifiedFrom, _ = ms.modifiedFrom.Insert(from)
ms.modifiedTo = ms.modifiedTo.Union(sortedkeys.Sort(to))
ms.RWGraph.AddRefs(from, to...)
}
// DeleteRefsFrom removes all children from the input key, and removes the input key from the maps.
// The key and it's current list of children will be added to the lists of modified values.
func (ms *ModifiedGraph) DeleteRefsFrom(from []byte) {
ms.modifiedFrom, _ = ms.modifiedFrom.Insert(from)
ms.modifiedTo = ms.modifiedTo.Union(ms.GetRefsFrom(from))
ms.RWGraph.DeleteRefsFrom(from)
}
// DeleteRefsTo removes all parents from the input key, and removes the input key from the maps.
// The key and it's current list of children will be added to the lists of modified values.
func (ms *ModifiedGraph) DeleteRefsTo(to []byte) {
ms.modifiedTo, _ = ms.modifiedTo.Insert(to)
ms.modifiedFrom = ms.modifiedFrom.Union(ms.GetRefsTo(to))
ms.RWGraph.DeleteRefsTo(to)
} | pkg/dackbox/graph/modified.go | 0.805211 | 0.556038 | modified.go | starcoder |
package util
// VectorMap is a simple trie-based map from a float slice to arbitrary type values
type VectorMap interface {
Get([]int) (interface{}, bool)
Put([]int, interface{})
Remove([]int) (interface{}, bool)
Keys() [][]int
Size() int
}
// NewVectorMap creates a new vector map.
func NewVectorMap() VectorMap {
return &vectorMap{table: make(map[int][]entry)}
}
type vectorMap struct {
table map[int][]entry
size int
}
func (vmap *vectorMap) Get(key []int) (interface{}, bool) {
hash := hashKey(key)
bucket := vmap.table[hash]
if bucket != nil {
_, e := findEntry(key, bucket)
if e != nil {
return e.getValue(), e.getValue() != nil
}
}
return nil, false
}
func (vmap *vectorMap) Put(key []int, value interface{}) {
hash := hashKey(key)
bucket := vmap.table[hash]
if bucket != nil {
_, e := findEntry(key, bucket)
if e != nil {
e.setValue(value)
} else {
vmap.table[hash] = append(bucket, &mapEntry{key, value})
vmap.size++
}
} else {
vmap.table[hash] = []entry{&mapEntry{key, value}}
vmap.size++
}
}
func (vmap *vectorMap) Remove(key []int) (interface{}, bool) {
hash := hashKey(key)
bucket := vmap.table[hash]
if bucket != nil {
i, e := findEntry(key, bucket)
if e != nil {
vmap.table[hash] = removeEntry(bucket, i)
vmap.size--
return e.getValue(), e.getValue() != nil
}
}
return nil, false
}
func (vmap *vectorMap) Keys() [][]int {
keys := make([][]int, 0, vmap.size)
for _, bucket := range vmap.table {
for _, e := range bucket {
keys = append(keys, e.getKey())
}
}
return keys
}
func (vmap *vectorMap) Size() int {
return vmap.size
}
func findEntry(key []int, bucket []entry) (int, entry) {
for i, ent := range bucket {
if equals(key, ent.getKey()) {
return i, ent
}
}
return 0, nil
}
func hashKey(key []int) int {
retVal := 1
for _, elem := range key {
retVal = retVal*31 + elem
}
return retVal
}
func equals(v1, v2 []int) bool {
if (v1 == nil) != (v2 == nil) {
return false
}
if len(v1) != len(v2) {
return false
}
for i := range v1 {
if v1[i] != v2[i] {
return false
}
}
return true
}
func removeEntry(slice []entry, s int) []entry {
return append(slice[:s], slice[s+1:]...)
}
type entry interface {
getKey() []int
getValue() interface{}
setValue(interface{})
}
type mapEntry struct {
key []int
value interface{}
}
func (e *mapEntry) getKey() []int {
return e.key
}
func (e *mapEntry) getValue() interface{} {
return e.value
}
func (e *mapEntry) setValue(value interface{}) {
e.value = value
} | util/vectormap.go | 0.810629 | 0.438424 | vectormap.go | starcoder |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.