WIP update deps, sql builder instead of jet
This commit is contained in:
38
vendor/go.uber.org/atomic/string.go
generated
vendored
38
vendor/go.uber.org/atomic/string.go
generated
vendored
@@ -1,6 +1,6 @@
|
||||
// @generated Code generated by gen-atomicwrapper.
|
||||
|
||||
// Copyright (c) 2020 Uber Technologies, Inc.
|
||||
// Copyright (c) 2020-2023 Uber Technologies, Inc.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
@@ -32,23 +32,41 @@ type String struct {
|
||||
var _zeroString string
|
||||
|
||||
// NewString creates a new String.
|
||||
func NewString(v string) *String {
|
||||
func NewString(val string) *String {
|
||||
x := &String{}
|
||||
if v != _zeroString {
|
||||
x.Store(v)
|
||||
if val != _zeroString {
|
||||
x.Store(val)
|
||||
}
|
||||
return x
|
||||
}
|
||||
|
||||
// Load atomically loads the wrapped string.
|
||||
func (x *String) Load() string {
|
||||
if v := x.v.Load(); v != nil {
|
||||
return v.(string)
|
||||
}
|
||||
return _zeroString
|
||||
return unpackString(x.v.Load())
|
||||
}
|
||||
|
||||
// Store atomically stores the passed string.
|
||||
func (x *String) Store(v string) {
|
||||
x.v.Store(v)
|
||||
func (x *String) Store(val string) {
|
||||
x.v.Store(packString(val))
|
||||
}
|
||||
|
||||
// CompareAndSwap is an atomic compare-and-swap for string values.
|
||||
func (x *String) CompareAndSwap(old, new string) (swapped bool) {
|
||||
if x.v.CompareAndSwap(packString(old), packString(new)) {
|
||||
return true
|
||||
}
|
||||
|
||||
if old == _zeroString {
|
||||
// If the old value is the empty value, then it's possible the
|
||||
// underlying Value hasn't been set and is nil, so retry with nil.
|
||||
return x.v.CompareAndSwap(nil, packString(new))
|
||||
}
|
||||
|
||||
return false
|
||||
}
|
||||
|
||||
// Swap atomically stores the given string and returns the old
|
||||
// value.
|
||||
func (x *String) Swap(val string) (old string) {
|
||||
return unpackString(x.v.Swap(packString(val)))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user