// ------------------------------------------------
332604
func (s *llStore) addRef() *llStore {
	s.m.Lock()
	s.refs += 1
	s.m.Unlock()

	return s
}
427948
func t(tags []string) string {
	t := ""
	if len(tags) > 0 {
		t = "|#" + strings.Join(tags, ",")
	}
	return t
}
714227
func (c ColumnElem) In(args interface{}) BinaryClause {
	// Create the inner array clause and parameters
	a := ArrayClause{Clauses: make([]Clause, 0), Sep: ", "}

	// Use reflect to get arguments from the interface only if it is a slice
	s := reflect.ValueOf(args)
	switch s.Kind() {
	case reflect.Slice:
		for i := 0; i < s.Len(); i++ {
			a.Clauses = append(a.Clauses, &Parameter{s.Index(i).Interface()})
		}
	}
	// TODO What if something other than a slice is given?
	// TODO This statement should be able to take clauses / subqueries
	return BinaryClause{
		Pre:  c,
		Post: FuncClause{Inner: a},
		Sep:  " IN ",
	}
}
274457
func (s *SelectStatement) String() string {
	var buf bytes.Buffer
	_, _ = buf.WriteString("SELECT ")
	_, _ = buf.WriteString(s.Fields.String())

	if s.Target != nil {
		_, _ = buf.WriteString(" ")
		_, _ = buf.WriteString(s.Target.String())
	}
	if len(s.Sources) > 0 {
		_, _ = buf.WriteString(" FROM ")
		_, _ = buf.WriteString(s.Sources.String())
	}
	if s.Condition != nil {
		_, _ = buf.WriteString(" WHERE ")
		_, _ = buf.WriteString(s.Condition.String())
	}
	if len(s.Dimensions) > 0 {
		_, _ = buf.WriteString(" GROUP BY ")
		_, _ = buf.WriteString(s.Dimensions.String())
	}
	switch s.Fill {
	case NoFill:
		_, _ = buf.WriteString(" fill(none)")
	case NumberFill:
		_, _ = buf.WriteString(fmt.Sprintf(" fill(%v)", s.FillValue))
	case LinearFill:
		_, _ = buf.WriteString(" fill(linear)")
	case PreviousFill:
		_, _ = buf.WriteString(" fill(previous)")
	}
	if len(s.SortFields) > 0 {
		_, _ = buf.WriteString(" ORDER BY ")
		_, _ = buf.WriteString(s.SortFields.String())
	}
	if s.Limit > 0 {
		_, _ = fmt.Fprintf(&buf, " LIMIT %d", s.Limit)
	}
	if s.Offset > 0 {
		_, _ = buf.WriteString(" OFFSET ")
		_, _ = buf.WriteString(strconv.Itoa(s.Offset))
	}
	if s.SLimit > 0 {
		_, _ = fmt.Fprintf(&buf, " SLIMIT %d", s.SLimit)
	}
	if s.SOffset > 0 {
		_, _ = fmt.Fprintf(&buf, " SOFFSET %d", s.SOffset)
	}
	if s.Location != nil {
		_, _ = fmt.Fprintf(&buf, ` TZ('%s')`, s.Location)
	}
	return buf.String()
}
1208882
func (r *StandardRegistry) Each(f func(string, interface{})) {
	for name, i := range r.registered() {
		f(name, i)
	}
}
907291
func Init(h sort.Interface) {
	// heapify
	n := h.Len()
	for i := n/2 - 1; i >= 0; i-- {
		heapDown(n, h.Less, h.Swap, i)
	}
}
663725
func init() {
	DefaultCallback.Query().Register("gorm:query", queryCallback)
	DefaultCallback.Query().Register("gorm:preload", preloadCallback)
	DefaultCallback.Query().Register("gorm:after_query", afterQueryCallback)
}
658443
func init() {
	var err error
	validTagRe, err = regexp.Compile(`^([a-z][a-z0-9]*(\-[a-z0-9]+)*)(:([a-z0-9]+(\-[a-z0-9]+)*))*$`)
	if err != nil {
		panic(err)
	}
}
83108
func init() {
	Skins.db = make(map[string]Skin)

	Skins.AddSkin("default", Skin{
		Up: &SkinDirection{
			Head: "  ╚⊙ ⊙╝  ",
			Pede: []string{"╚═(███)═╝"},
		},
		Down: &SkinDirection{
			Head: "  ╔⊙ ⊙╗  ",
			Pede: []string{"╔═(███)═╗"},
		},
	})

	Skins.AddSkin("frozen", Skin{
		Up: &SkinDirection{
			Head: "  ╚⊙ ⊙╝  ",
			Pede: []string{"╚═(❄❄❄)═╝"},
			Tail: "    ❄    ",
		},
		Down: &SkinDirection{
			Head: "  ╔⊙ ⊙╗  ",
			Pede: []string{"╔═(❄❄❄)═╗"},
			Tail: "    ❄    ",
		},
	})

	Skins.AddSkin("diagonals", Skin{
		Up: &SkinDirection{
			Head: "  ╚⊙ ⊙╝  ",
			Pede: []string{"\\/(███)\\/", "/\\(███)/\\"},
		},
		Down: &SkinDirection{
			Head: "  ╔⊙ ⊙╗  ",
			Pede: []string{"/\\(███)/\\", "\\/(███)\\/"},
		},
	})

	Skins.AddSkin("corporate", Skin{
		Up: &SkinDirection{
			Head: "  ╚⊙ ⊙╝  ",
			Pede: []string{"╚═(©©©)═╝"},
		},
		Down: &SkinDirection{
			Head: "  ╔⊙ ⊙╗  ",
			Pede: []string{"╔═(©©©)═╗"},
		},
	})

	Skins.AddSkin("love", Skin{
		Up: &SkinDirection{
			Head: "  ╚⊙ ⊙╝  ",
			Pede: []string{"╚═(♥♥♥)═╝"},
		},
		Down: &SkinDirection{
			Head: "  ╔⊙ ⊙╗  ",
			Pede: []string{"╔═(♥♥♥)═╗"},
		},
	})

	Skins.AddSkin("musician", Skin{
		Up: &SkinDirection{
			Head: "  ╚⊙ ⊙╝  ",
			Pede: []string{"╚═(♫♩♬)═╝"},
		},
		Down: &SkinDirection{
			Head: "  ╔⊙ ⊙╗  ",
			Pede: []string{"╔═(♫♩♬)═╗"},
		},
	})

	Skins.AddSkin("bocal", Skin{
		Up: &SkinDirection{
			Head: "  ╚⊙ ⊙╝  ",
			Pede: []string{"╚═(🐟🐟🐟)═╝"},
		},
		Down: &SkinDirection{
			Head: "  ╔⊙ ⊙╗  ",
			Pede: []string{"╔═(🐟🐟🐟)═╗"},
		},
	})

	Skins.AddSkin("ascii", Skin{
		Up: &SkinDirection{
			Head: "  \\o o/  ",
			Pede: []string{"|=(###)=|"},
		},
		Down: &SkinDirection{
			Head: "  /o o\\  ",
			Pede: []string{"|=(###)=|"},
		},
	})

	Skins.AddSkin("inception", Skin{
		Up: &SkinDirection{
			Head: "    👀    ",
			Pede: []string{"╚═(🐛🐛🐛)═╝"},
		},
		Down: &SkinDirection{
			Head: "    👀    ",
			Pede: []string{"╔═(🐛🐛🐛)═╗"},
		},
	})

	Skins.AddSkin("humancentipede", Skin{
		Up: &SkinDirection{
			Head: "    👀    ",
			Pede: []string{"╚═(😷😷😷)═╝"},
		},
		Down: &SkinDirection{
			Head: "    👀    ",
			Pede: []string{"╔═(😷😷😷)═╗"},
		},
	})

	Skins.AddSkin("finger", Skin{
		Up: &SkinDirection{
			Head: "    👀    ",
			Pede: []string{"👈~~~  ~~~👉"},
		},
		Down: &SkinDirection{
			Head: "    👀    ",
			Pede: []string{"👈~~~~~~~~👉"},
		},
	})

	Skins.AddSkin("handy", Skin{
		Up: &SkinDirection{
			Head: "    👀    ",
			Pede: []string{"╚═(👌👌👌)═╝"},
		},
		Down: &SkinDirection{
			Head: "    👀    ",
			Pede: []string{"╔═(👌👌👌)═╗"},
		},
	})

	Skins.AddSkin("human", Skin{
		Up: &SkinDirection{
			Head: " ( ͡° ͜ʖ ͡°)",
			Pede: []string{"👆 ......👆"},
		},
		Down: &SkinDirection{
			Head: " ( ͡° ͜ʖ ͡°)",
			Pede: []string{"👇 ......👇"},
		},
	})
}
719550
func (s *LoadBalancerService) GetLoadBalancerByID(id string, opts ...OptionFunc) (*LoadBalancer, int, error) {
	p := &ListLoadBalancersParams{}
	p.p = make(map[string]interface{})

	p.p["id"] = id

	for _, fn := range append(s.cs.options, opts...) {
		if err := fn(s.cs, p); err != nil {
			return nil, -1, err
		}
	}

	l, err := s.ListLoadBalancers(p)
	if err != nil {
		if strings.Contains(err.Error(), fmt.Sprintf(
			"Invalid parameter id value=%s due to incorrect long value format, "+
				"or entity does not exist", id)) {
			return nil, 0, fmt.Errorf("No match found for %s: %+v", id, l)
		}
		return nil, -1, err
	}

	if l.Count == 0 {
		return nil, l.Count, fmt.Errorf("No match found for %s: %+v", id, l)
	}

	if l.Count == 1 {
		return l.LoadBalancers[0], l.Count, nil
	}
	return nil, l.Count, fmt.Errorf("There is more then one result for LoadBalancer UUID: %s!", id)
}
810969
func (s *VPCService) GetStaticRouteByID(id string, opts ...OptionFunc) (*StaticRoute, int, error) {
	p := &ListStaticRoutesParams{}
	p.p = make(map[string]interface{})

	p.p["id"] = id

	for _, fn := range append(s.cs.options, opts...) {
		if err := fn(s.cs, p); err != nil {
			return nil, -1, err
		}
	}

	l, err := s.ListStaticRoutes(p)
	if err != nil {
		if strings.Contains(err.Error(), fmt.Sprintf(
			"Invalid parameter id value=%s due to incorrect long value format, "+
				"or entity does not exist", id)) {
			return nil, 0, fmt.Errorf("No match found for %s: %+v", id, l)
		}
		return nil, -1, err
	}

	if l.Count == 0 {
		return nil, l.Count, fmt.Errorf("No match found for %s: %+v", id, l)
	}

	if l.Count == 1 {
		return l.StaticRoutes[0], l.Count, nil
	}
	return nil, l.Count, fmt.Errorf("There is more then one result for StaticRoute UUID: %s!", id)
}
373808
func (ListAffinityGroups) Each(resp interface{}, callback IterateItemFunc) {
	items, ok := resp.(*ListAffinityGroupsResponse)
	if !ok {
		callback(nil, fmt.Errorf("wrong type, ListAffinityGroupsResponse was expected, got %T", resp))
		return
	}

	for i := range items.AffinityGroup {
		if !callback(&items.AffinityGroup[i], nil) {
			break
		}
	}
}
251478
func Status(status int) {
	if r, ok := responseDefinition(); ok {
		r.Status = status
	}
}
423730
func Version(v string) Option {
	return func(o *Options) {
		o.Server.Init(server.Version(v))
	}
}
694638
func main() {
	staticFields := make(map[string]interface{})
	staticFields["foo"] = "bar"
	baseDir := ""

	if wd, err := os.Getwd(); err != nil {
		log.Fatal(err)
	} else {
		baseDir = wd
	}

	config := bunyan.Config{
		Name: "app",
		Streams: []bunyan.Stream{
			{
				Stream: os.Stdout,
			},
			{
				Path:  filepath.Join(baseDir, "info.log"),
				Level: bunyan.LogLevelInfo,
			},
			{
				Path:  filepath.Join(baseDir, "error.log"),
				Level: bunyan.LogLevelError,
			},
		},
		StaticFields: staticFields,
	}

	if l, err := bunyan.CreateLogger(config); err != nil {
		log.Fatal(err)
	} else {
		chStatic := make(map[string]interface{})
		chStatic["baz"] = "stuff"
		c := l.Child(chStatic)

		l.Info("i am the parent %d", 100)
		c.Info("i am the child")
		l.Error(errors.New("oh no!!!"), "what happened %s", "???")
	}
}
1286521
func main() {
	flag.Parse()

	key := os.Getenv("BFX_API_KEY")
	secret := os.Getenv("BFX_API_SECRET")
	c := rest.NewClientWithURL(*api).Credentials(key, secret)

	available, err := c.Platform.Status()
	if err != nil {
		log.Fatalf("getting status: %s", err)
	}

	if !available {
		log.Fatalf("API not available")
	}

	if *orderid != "" {
		ordid, err := strconv.ParseInt(*orderid, 10, 64)
		if err != nil {
			log.Fatal(err)
		}
		os, err := c.Orders.OrderTrades(bitfinex.TradingPrefix+bitfinex.BTCUSD, ordid)
		if err != nil {
			log.Fatalf("getting order trades: %s", err)
		}

		log.Printf("order trades: %#v\n", os)
	} else {
		os, err := c.Orders.History(bitfinex.TradingPrefix + bitfinex.BTCUSD)
		if err != nil {
			log.Fatalf("getting orders: %s", err)
		}

		log.Printf("orders: %#v\n", os)
	}
}
357722
func AskForStaticValueOptional(s string) string {
	reader := bufio.NewReader(os.Stdin)

	return getStaticValue(reader, s)
}