good morning!!!!
Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
J
jrpc
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Harbor Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
open
jrpc
Commits
df7736a3
Commit
df7736a3
authored
1 year ago
by
a
Browse files
Options
Downloads
Patches
Plain Diff
jay zon r pee see
parent
a5154430
No related branches found
Branches containing commit
No related tags found
Tags containing commit
2 merge requests
!15
Draft: V2
,
!13
Draft: Move Openrpc Package
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
exports.go
+15
-11
15 additions, 11 deletions
exports.go
with
15 additions
and
11 deletions
exports.go
+
15
−
11
View file @
df7736a3
...
@@ -10,39 +10,43 @@ import (
...
@@ -10,39 +10,43 @@ import (
// to make the repo cleaner, we export everything here. this way the packages dont need to ever import this
// to make the repo cleaner, we export everything here. this way the packages dont need to ever import this
type
(
type
(
// Conn
// Conn
is used to make requests to jsonrpc2 servers
Conn
=
codec
.
Conn
Conn
=
codec
.
Conn
// Handler
// Handler
is the equivilant of http.Handler, but for jsonrpc.
Handler
=
codec
.
Handler
Handler
=
codec
.
Handler
// HandlerFunc
// HandlerFunc
is a Handler that exists as a function
HandlerFunc
=
codec
.
HandlerFunc
HandlerFunc
=
codec
.
HandlerFunc
// ResponseWriter
// ResponseWriter
is used to write responses to the request
ResponseWriter
=
codec
.
ResponseWriter
ResponseWriter
=
codec
.
ResponseWriter
// StreamingConn
// StreamingConn
is a conn that supports streaming methods
StreamingConn
=
codec
.
Conn
StreamingConn
=
codec
.
Conn
)
)
type
(
type
(
// BatchElem
// BatchElem
is an element of a batch request
BatchElem
=
codec
.
BatchElem
BatchElem
=
codec
.
BatchElem
)
)
var
(
var
(
ContextWithConn
=
codec
.
ContextWithConn
// ContextWithConn will attach a conn to the context
ContextWithConn
=
codec
.
ContextWithConn
// ContextWithPeerInfo will attach a peerinfo to the context
ContextWithPeerInfo
=
server
.
ContextWithPeerInfo
ContextWithPeerInfo
=
server
.
ContextWithPeerInfo
ConnFromContext
=
codec
.
ConnFromContext
// ConnFromContext will retrieve a conn from context
ConnFromContext
=
codec
.
ConnFromContext
// PeerInfoFromContext will retrieve a peerinfo from context
PeerInfoFromContext
=
server
.
PeerInfoFromContext
PeerInfoFromContext
=
server
.
PeerInfoFromContext
)
)
// Do
// Do
will use the conn to perform a jsonrpc2 call.
func
Do
[
T
any
](
ctx
context
.
Context
,
c
Conn
,
method
string
,
args
any
)
(
*
T
,
error
)
{
func
Do
[
T
any
](
ctx
context
.
Context
,
c
Conn
,
method
string
,
args
any
)
(
*
T
,
error
)
{
return
codec
.
Do
[
T
](
ctx
,
c
,
method
,
args
)
return
codec
.
Do
[
T
](
ctx
,
c
,
method
,
args
)
}
}
// Call
// Call
will use the conn to perform a jsonrpc2 call, except the args will be encoded as an array of arguments.
func
Call
[
T
any
](
ctx
context
.
Context
,
c
Conn
,
method
string
,
args
...
any
)
(
*
T
,
error
)
{
func
Call
[
T
any
](
ctx
context
.
Context
,
c
Conn
,
method
string
,
args
...
any
)
(
*
T
,
error
)
{
return
codec
.
Call
[
T
](
ctx
,
c
,
method
,
args
...
)
return
codec
.
Call
[
T
](
ctx
,
c
,
method
,
args
...
)
}
}
// CallInto
// CallInto
is the same as Call, except instead of returning, you provide a pointer to the result
var
CallInto
=
codec
.
CallInto
var
CallInto
=
codec
.
CallInto
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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!
Save comment
Cancel
Please
register
or
sign in
to comment