Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Vladimir Barsukov
zGo
Commits
a3eb6d40
Commit
a3eb6d40
authored
Jan 17, 2025
by
Vladimir Barsukov
Browse files
fix
parent
6b3eeb2f
Changes
2
Show whitespace changes
Inline
Side-by-side
zbytes/zbytes.go
View file @
a3eb6d40
...
...
@@ -5,57 +5,57 @@ import (
"sync"
)
type
Z
Buffer
struct
{
type
Buffer
struct
{
Buff
*
bytes
.
Buffer
Mu
*
sync
.
Mutex
}
func
NewBuffer
()
*
Z
Buffer
{
return
&
Z
Buffer
{
func
NewBuffer
()
*
Buffer
{
return
&
Buffer
{
Buff
:
bytes
.
NewBuffer
(
nil
),
Mu
:
new
(
sync
.
Mutex
),
}
}
func
(
z
*
Z
Buffer
)
Write
(
p
[]
byte
)
(
n
int
,
err
error
)
{
func
(
z
*
Buffer
)
Write
(
p
[]
byte
)
(
n
int
,
err
error
)
{
z
.
Mu
.
Lock
()
defer
z
.
Mu
.
Unlock
()
return
z
.
Buff
.
Write
(
p
)
}
func
(
z
*
Z
Buffer
)
WriteRune
(
r
rune
)
(
n
int
,
err
error
)
{
func
(
z
*
Buffer
)
WriteRune
(
r
rune
)
(
n
int
,
err
error
)
{
z
.
Mu
.
Lock
()
defer
z
.
Mu
.
Unlock
()
return
z
.
Buff
.
WriteRune
(
r
)
}
func
(
z
*
Z
Buffer
)
WriteByte
(
c
byte
)
error
{
func
(
z
*
Buffer
)
WriteByte
(
c
byte
)
error
{
z
.
Mu
.
Lock
()
z
.
Mu
.
Unlock
()
return
z
.
Buff
.
WriteByte
(
c
)
}
func
(
z
*
Z
Buffer
)
WriteString
(
s
string
)
(
n
int
,
err
error
)
{
func
(
z
*
Buffer
)
WriteString
(
s
string
)
(
n
int
,
err
error
)
{
z
.
Mu
.
Lock
()
defer
z
.
Mu
.
Unlock
()
return
z
.
Buff
.
WriteString
(
s
)
}
func
(
z
*
Z
Buffer
)
Bytes
()
[]
byte
{
func
(
z
*
Buffer
)
Bytes
()
[]
byte
{
z
.
Mu
.
Lock
()
defer
z
.
Mu
.
Unlock
()
return
z
.
Buff
.
Bytes
()
}
func
(
z
*
Z
Buffer
)
String
()
string
{
func
(
z
*
Buffer
)
String
()
string
{
z
.
Mu
.
Lock
()
defer
z
.
Mu
.
Unlock
()
return
z
.
Buff
.
String
()
}
func
(
z
*
Z
Buffer
)
Reset
()
{
func
(
z
*
Buffer
)
Reset
()
{
z
.
Mu
.
Lock
()
defer
z
.
Mu
.
Unlock
()
z
.
Buff
.
Reset
()
}
func
(
z
*
Z
Buffer
)
Len
()
int
{
func
(
z
*
Buffer
)
Len
()
int
{
z
.
Mu
.
Lock
()
defer
z
.
Mu
.
Unlock
()
return
z
.
Buff
.
Len
()
...
...
zgo.go
View file @
a3eb6d40
...
...
@@ -2,6 +2,7 @@ package zgo
import
(
_
"git.barsukov.pro/barsukov/zgo/zatomic"
_
"git.barsukov.pro/barsukov/zgo/zbytes"
_
"git.barsukov.pro/barsukov/zgo/zcache"
_
"git.barsukov.pro/barsukov/zgo/zcron"
_
"git.barsukov.pro/barsukov/zgo/zdb"
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment