Page Menu
Home
Musing Studio
Search
Configure Global Search
Log In
Files
F10384137
builder.go
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
1 KB
Subscribers
None
builder.go
View Options
// Package query assists in building SQL queries.
package
query
import
(
"database/sql"
)
type
Update
struct
{
Updates
,
Conditions
string
Params
[]
interface
{}
sep
string
}
func
NewUpdate
()
*
Update
{
return
&
Update
{}
}
func
(
u
*
Update
)
Set
(
v
,
property
string
)
*
Update
{
if
v
!=
""
{
u
.
Updates
+=
u
.
sep
+
property
+
" = ?"
u
.
sep
=
", "
u
.
Params
=
append
(
u
.
Params
,
v
)
}
return
u
}
func
(
u
*
Update
)
SetBytes
(
v
[]
byte
,
property
string
)
*
Update
{
if
len
(
v
)
>
0
{
u
.
Updates
+=
u
.
sep
+
property
+
" = ?"
u
.
sep
=
", "
u
.
Params
=
append
(
u
.
Params
,
v
)
}
return
u
}
func
(
u
*
Update
)
SetStringPtr
(
v
*
string
,
property
string
)
*
Update
{
if
v
!=
nil
{
u
.
Updates
+=
u
.
sep
+
property
+
" = ?"
u
.
sep
=
", "
u
.
Params
=
append
(
u
.
Params
,
v
)
}
return
u
}
func
(
u
*
Update
)
SetIntPtr
(
v
*
int
,
property
string
)
*
Update
{
if
v
!=
nil
{
u
.
Updates
+=
u
.
sep
+
property
+
" = ?"
u
.
sep
=
", "
u
.
Params
=
append
(
u
.
Params
,
v
)
}
return
u
}
func
(
u
*
Update
)
SetBoolPtr
(
v
*
bool
,
property
string
)
*
Update
{
if
v
!=
nil
{
u
.
Updates
+=
u
.
sep
+
property
+
" = ?"
u
.
sep
=
", "
u
.
Params
=
append
(
u
.
Params
,
v
)
}
return
u
}
func
(
u
*
Update
)
SetNullBool
(
v
*
sql
.
NullBool
,
property
string
)
*
Update
{
if
v
!=
nil
{
u
.
Updates
+=
u
.
sep
+
property
+
" = ?"
u
.
sep
=
", "
u
.
Params
=
append
(
u
.
Params
,
v
)
}
return
u
}
func
(
u
*
Update
)
SetNullString
(
v
*
sql
.
NullString
,
property
string
)
*
Update
{
if
v
!=
nil
{
u
.
Updates
+=
u
.
sep
+
property
+
" = ?"
u
.
sep
=
", "
u
.
Params
=
append
(
u
.
Params
,
v
)
}
return
u
}
func
(
u
*
Update
)
Append
(
v
interface
{})
{
u
.
Params
=
append
(
u
.
Params
,
v
)
}
func
(
u
*
Update
)
Where
(
condition
string
,
params
...
interface
{})
*
Update
{
u
.
Conditions
=
condition
for
_
,
p
:=
range
params
{
u
.
Append
(
p
)
}
return
u
}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sat, Nov 23, 5:15 AM (1 d, 11 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
3104391
Attached To
rWC Write.as Web Core
Event Timeline
Log In to Comment