mirror of
https://github.com/zeromicro/go-zero.git
synced 2026-06-11 08:30:20 +08:00
Compare commits
64 Commits
v1.2.4
...
tools/goct
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e267d94ee1 | ||
|
|
89ce5e492b | ||
|
|
290de6aa96 | ||
|
|
a7aeb8ac0e | ||
|
|
a8e7fafebf | ||
|
|
7cc64070b1 | ||
|
|
c19d2637ea | ||
|
|
fe1da14332 | ||
|
|
8e9110cedf | ||
|
|
d6ff30a570 | ||
|
|
b98d46bfd6 | ||
|
|
768936b256 | ||
|
|
c6eb1a9670 | ||
|
|
e4ab518576 | ||
|
|
dfc67b5fac | ||
|
|
62266d8f91 | ||
|
|
b8ea16a88e | ||
|
|
23deaf50e6 | ||
|
|
38a36ed8d3 | ||
|
|
49bab23c54 | ||
|
|
78ba00d3a7 | ||
|
|
787b046a70 | ||
|
|
f827a7b985 | ||
|
|
f5f2097d14 | ||
|
|
cfcfb87fd4 | ||
|
|
1d223fc114 | ||
|
|
c0647f0719 | ||
|
|
8745ed9c61 | ||
|
|
836726e710 | ||
|
|
a67c118dcf | ||
|
|
cd289465fd | ||
|
|
263e426ae1 | ||
|
|
d5e493383a | ||
|
|
6f1d27354a | ||
|
|
26101732d2 | ||
|
|
71d40e0c08 | ||
|
|
4ba2ff7cdd | ||
|
|
2cdf5e7395 | ||
|
|
8315a55b3f | ||
|
|
d1c2a31af7 | ||
|
|
3e6c217408 | ||
|
|
b299f350be | ||
|
|
8fd16c17dc | ||
|
|
5979b2aa0f | ||
|
|
0b17e0e5d9 | ||
|
|
3d8ad5e4f6 | ||
|
|
ff1752dd39 | ||
|
|
1becaeb7be | ||
|
|
171afaadb9 | ||
|
|
776e6e647d | ||
|
|
4ccdf4ec72 | ||
|
|
a7bd993c0c | ||
|
|
a290ff4486 | ||
|
|
490ef13822 | ||
|
|
1b14de2ff9 | ||
|
|
914692cc82 | ||
|
|
07191dc430 | ||
|
|
af3fb2b04d | ||
|
|
0240fa131a | ||
|
|
e96577dd38 | ||
|
|
403dd7367a | ||
|
|
8086ad120b | ||
|
|
87a445689c | ||
|
|
b6bda54870 |
2
.github/FUNDING.yml
vendored
2
.github/FUNDING.yml
vendored
@@ -9,4 +9,4 @@ community_bridge: # Replace with a single Community Bridge project-name e.g., cl
|
|||||||
liberapay: # Replace with a single Liberapay username
|
liberapay: # Replace with a single Liberapay username
|
||||||
issuehunt: # Replace with a single IssueHunt username
|
issuehunt: # Replace with a single IssueHunt username
|
||||||
otechie: # Replace with a single Otechie username
|
otechie: # Replace with a single Otechie username
|
||||||
custom: # https://gitee.com/kevwan/static/raw/master/images/sponsor.jpg
|
custom: https://gitee.com/kevwan/static/raw/master/images/sponsor.jpg
|
||||||
|
|||||||
@@ -14,8 +14,10 @@ We hope that the items listed below will inspire further engagement from the com
|
|||||||
|
|
||||||
## 2021 Q4
|
## 2021 Q4
|
||||||
- [x] Support `username/password` authentication in ETCD
|
- [x] Support `username/password` authentication in ETCD
|
||||||
|
- [x] Support `SSL/TLS` in ETCD
|
||||||
- [x] Support `SSL/TLS` in `zRPC`
|
- [x] Support `SSL/TLS` in `zRPC`
|
||||||
- [x] Support `TLS` in redis connections
|
- [x] Support `TLS` in redis connections
|
||||||
|
- [x] Support `goctl bug` to report bugs conveniently
|
||||||
|
|
||||||
## 2022
|
## 2022
|
||||||
- [ ] Support `goctl mock` command to start a mocking server with given `.api` file
|
- [ ] Support `goctl mock` command to start a mocking server with given `.api` file
|
||||||
|
|||||||
@@ -2,6 +2,13 @@ package discov
|
|||||||
|
|
||||||
import "github.com/tal-tech/go-zero/core/discov/internal"
|
import "github.com/tal-tech/go-zero/core/discov/internal"
|
||||||
|
|
||||||
|
// RegisterAccount registers the username/password to the given etcd cluster.
|
||||||
func RegisterAccount(endpoints []string, user, pass string) {
|
func RegisterAccount(endpoints []string, user, pass string) {
|
||||||
internal.AddAccount(endpoints, user, pass)
|
internal.AddAccount(endpoints, user, pass)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// RegisterTLS registers the CertFile/CertKeyFile/CACertFile to the given etcd.
|
||||||
|
func RegisterTLS(endpoints []string, certFile, certKeyFile, caFile string,
|
||||||
|
insecureSkipVerify bool) error {
|
||||||
|
return internal.AddTLS(endpoints, certFile, certKeyFile, caFile, insecureSkipVerify)
|
||||||
|
}
|
||||||
|
|||||||
@@ -4,10 +4,14 @@ import "errors"
|
|||||||
|
|
||||||
// EtcdConf is the config item with the given key on etcd.
|
// EtcdConf is the config item with the given key on etcd.
|
||||||
type EtcdConf struct {
|
type EtcdConf struct {
|
||||||
Hosts []string
|
Hosts []string
|
||||||
Key string
|
Key string
|
||||||
User string `json:",optional"`
|
User string `json:",optional"`
|
||||||
Pass string `json:",optional"`
|
Pass string `json:",optional"`
|
||||||
|
CertFile string `json:",optional"`
|
||||||
|
CertKeyFile string `json:",optional=CertFile"`
|
||||||
|
CACertFile string `json:",optional=CertFile"`
|
||||||
|
InsecureSkipVerify bool `json:",optional"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// HasAccount returns if account provided.
|
// HasAccount returns if account provided.
|
||||||
@@ -15,6 +19,11 @@ func (c EtcdConf) HasAccount() bool {
|
|||||||
return len(c.User) > 0 && len(c.Pass) > 0
|
return len(c.User) > 0 && len(c.Pass) > 0
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// HasTLS returns if TLS CertFile/CertKeyFile/CACertFile are provided.
|
||||||
|
func (c EtcdConf) HasTLS() bool {
|
||||||
|
return len(c.CertFile) > 0 && len(c.CertKeyFile) > 0 && len(c.CACertFile) > 0
|
||||||
|
}
|
||||||
|
|
||||||
// Validate validates c.
|
// Validate validates c.
|
||||||
func (c EtcdConf) Validate() error {
|
func (c EtcdConf) Validate() error {
|
||||||
if len(c.Hosts) == 0 {
|
if len(c.Hosts) == 0 {
|
||||||
|
|||||||
@@ -1,17 +1,25 @@
|
|||||||
package internal
|
package internal
|
||||||
|
|
||||||
import "sync"
|
import (
|
||||||
|
"crypto/tls"
|
||||||
|
"crypto/x509"
|
||||||
|
"io/ioutil"
|
||||||
|
"sync"
|
||||||
|
)
|
||||||
|
|
||||||
|
var (
|
||||||
|
accounts = make(map[string]Account)
|
||||||
|
tlsConfigs = make(map[string]*tls.Config)
|
||||||
|
lock sync.RWMutex
|
||||||
|
)
|
||||||
|
|
||||||
|
// Account holds the username/password for an etcd cluster.
|
||||||
type Account struct {
|
type Account struct {
|
||||||
User string
|
User string
|
||||||
Pass string
|
Pass string
|
||||||
}
|
}
|
||||||
|
|
||||||
var (
|
// AddAccount adds the username/password for the given etcd cluster.
|
||||||
accounts = make(map[string]Account)
|
|
||||||
lock sync.RWMutex
|
|
||||||
)
|
|
||||||
|
|
||||||
func AddAccount(endpoints []string, user, pass string) {
|
func AddAccount(endpoints []string, user, pass string) {
|
||||||
lock.Lock()
|
lock.Lock()
|
||||||
defer lock.Unlock()
|
defer lock.Unlock()
|
||||||
@@ -22,6 +30,33 @@ func AddAccount(endpoints []string, user, pass string) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// AddTLS adds the tls cert files for the given etcd cluster.
|
||||||
|
func AddTLS(endpoints []string, certFile, certKeyFile, caFile string, insecureSkipVerify bool) error {
|
||||||
|
cert, err := tls.LoadX509KeyPair(certFile, certKeyFile)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
caData, err := ioutil.ReadFile(caFile)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
pool := x509.NewCertPool()
|
||||||
|
pool.AppendCertsFromPEM(caData)
|
||||||
|
|
||||||
|
lock.Lock()
|
||||||
|
defer lock.Unlock()
|
||||||
|
tlsConfigs[getClusterKey(endpoints)] = &tls.Config{
|
||||||
|
Certificates: []tls.Certificate{cert},
|
||||||
|
RootCAs: pool,
|
||||||
|
InsecureSkipVerify: insecureSkipVerify,
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetAccount gets the username/password for the given etcd cluster.
|
||||||
func GetAccount(endpoints []string) (Account, bool) {
|
func GetAccount(endpoints []string) (Account, bool) {
|
||||||
lock.RLock()
|
lock.RLock()
|
||||||
defer lock.RUnlock()
|
defer lock.RUnlock()
|
||||||
@@ -29,3 +64,12 @@ func GetAccount(endpoints []string) (Account, bool) {
|
|||||||
account, ok := accounts[getClusterKey(endpoints)]
|
account, ok := accounts[getClusterKey(endpoints)]
|
||||||
return account, ok
|
return account, ok
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// GetTLS gets the tls config for the given etcd cluster.
|
||||||
|
func GetTLS(endpoints []string) (*tls.Config, bool) {
|
||||||
|
lock.RLock()
|
||||||
|
defer lock.RUnlock()
|
||||||
|
|
||||||
|
cfg, ok := tlsConfigs[getClusterKey(endpoints)]
|
||||||
|
return cfg, ok
|
||||||
|
}
|
||||||
|
|||||||
@@ -337,6 +337,9 @@ func DialClient(endpoints []string) (EtcdClient, error) {
|
|||||||
cfg.Username = account.User
|
cfg.Username = account.User
|
||||||
cfg.Password = account.Pass
|
cfg.Password = account.Pass
|
||||||
}
|
}
|
||||||
|
if tlsCfg, ok := GetTLS(endpoints); ok {
|
||||||
|
cfg.TLS = tlsCfg
|
||||||
|
}
|
||||||
|
|
||||||
return clientv3.New(cfg)
|
return clientv3.New(cfg)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -145,16 +145,23 @@ func (p *Publisher) revoke(cli internal.EtcdClient) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// WithPubEtcdAccount provides the etcd username/password.
|
|
||||||
func WithPubEtcdAccount(user, pass string) PubOption {
|
|
||||||
return func(pub *Publisher) {
|
|
||||||
internal.AddAccount(pub.endpoints, user, pass)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// WithId customizes a Publisher with the id.
|
// WithId customizes a Publisher with the id.
|
||||||
func WithId(id int64) PubOption {
|
func WithId(id int64) PubOption {
|
||||||
return func(publisher *Publisher) {
|
return func(publisher *Publisher) {
|
||||||
publisher.id = id
|
publisher.id = id
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// WithPubEtcdAccount provides the etcd username/password.
|
||||||
|
func WithPubEtcdAccount(user, pass string) PubOption {
|
||||||
|
return func(pub *Publisher) {
|
||||||
|
RegisterAccount(pub.endpoints, user, pass)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithPubEtcdTLS provides the etcd CertFile/CertKeyFile/CACertFile.
|
||||||
|
func WithPubEtcdTLS(certFile, certKeyFile, caFile string, insecureSkipVerify bool) PubOption {
|
||||||
|
return func(pub *Publisher) {
|
||||||
|
logx.Must(RegisterTLS(pub.endpoints, certFile, certKeyFile, caFile, insecureSkipVerify))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import (
|
|||||||
"sync/atomic"
|
"sync/atomic"
|
||||||
|
|
||||||
"github.com/tal-tech/go-zero/core/discov/internal"
|
"github.com/tal-tech/go-zero/core/discov/internal"
|
||||||
|
"github.com/tal-tech/go-zero/core/logx"
|
||||||
"github.com/tal-tech/go-zero/core/syncx"
|
"github.com/tal-tech/go-zero/core/syncx"
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -58,9 +59,17 @@ func Exclusive() SubOption {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// WithSubEtcdAccount provides the etcd username/password.
|
||||||
func WithSubEtcdAccount(user, pass string) SubOption {
|
func WithSubEtcdAccount(user, pass string) SubOption {
|
||||||
return func(sub *Subscriber) {
|
return func(sub *Subscriber) {
|
||||||
internal.AddAccount(sub.endpoints, user, pass)
|
RegisterAccount(sub.endpoints, user, pass)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithSubEtcdTLS provides the etcd CertFile/CertKeyFile/CACertFile.
|
||||||
|
func WithSubEtcdTLS(certFile, certKeyFile, caFile string, insecureSkipVerify bool) SubOption {
|
||||||
|
return func(sub *Subscriber) {
|
||||||
|
logx.Must(RegisterTLS(sub.endpoints, certFile, certKeyFile, caFile, insecureSkipVerify))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -90,6 +90,8 @@ func Range(source <-chan interface{}) Stream {
|
|||||||
func (s Stream) AllMach(predicate func(item interface{}) bool) bool {
|
func (s Stream) AllMach(predicate func(item interface{}) bool) bool {
|
||||||
for item := range s.source {
|
for item := range s.source {
|
||||||
if !predicate(item) {
|
if !predicate(item) {
|
||||||
|
// make sure the former goroutine not block, and current func returns fast.
|
||||||
|
go drain(s.source)
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -103,6 +105,8 @@ func (s Stream) AllMach(predicate func(item interface{}) bool) bool {
|
|||||||
func (s Stream) AnyMach(predicate func(item interface{}) bool) bool {
|
func (s Stream) AnyMach(predicate func(item interface{}) bool) bool {
|
||||||
for item := range s.source {
|
for item := range s.source {
|
||||||
if predicate(item) {
|
if predicate(item) {
|
||||||
|
// make sure the former goroutine not block, and current func returns fast.
|
||||||
|
go drain(s.source)
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -186,8 +190,7 @@ func (s Stream) Distinct(fn KeyFunc) Stream {
|
|||||||
|
|
||||||
// Done waits all upstreaming operations to be done.
|
// Done waits all upstreaming operations to be done.
|
||||||
func (s Stream) Done() {
|
func (s Stream) Done() {
|
||||||
for range s.source {
|
drain(s.source)
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Filter filters the items by the given FilterFunc.
|
// Filter filters the items by the given FilterFunc.
|
||||||
@@ -199,9 +202,22 @@ func (s Stream) Filter(fn FilterFunc, opts ...Option) Stream {
|
|||||||
}, opts...)
|
}, opts...)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// First returns the first item, nil if no items.
|
||||||
|
func (s Stream) First() interface{} {
|
||||||
|
for item := range s.source {
|
||||||
|
// make sure the former goroutine not block, and current func returns fast.
|
||||||
|
go drain(s.source)
|
||||||
|
return item
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
// ForAll handles the streaming elements from the source and no later streams.
|
// ForAll handles the streaming elements from the source and no later streams.
|
||||||
func (s Stream) ForAll(fn ForAllFunc) {
|
func (s Stream) ForAll(fn ForAllFunc) {
|
||||||
fn(s.source)
|
fn(s.source)
|
||||||
|
// avoid goroutine leak on fn not consuming all items.
|
||||||
|
go drain(s.source)
|
||||||
}
|
}
|
||||||
|
|
||||||
// ForEach seals the Stream with the ForEachFunc on each item, no successive operations.
|
// ForEach seals the Stream with the ForEachFunc on each item, no successive operations.
|
||||||
@@ -246,11 +262,14 @@ func (s Stream) Head(n int64) Stream {
|
|||||||
}
|
}
|
||||||
if n == 0 {
|
if n == 0 {
|
||||||
// let successive method go ASAP even we have more items to skip
|
// let successive method go ASAP even we have more items to skip
|
||||||
// why we don't just break the loop, because if break,
|
|
||||||
// this former goroutine will block forever, which will cause goroutine leak.
|
|
||||||
close(source)
|
close(source)
|
||||||
|
// why we don't just break the loop, and drain to consume all items.
|
||||||
|
// because if breaks, this former goroutine will block forever,
|
||||||
|
// which will cause goroutine leak.
|
||||||
|
drain(s.source)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// not enough items in s.source, but we need to let successive method to go ASAP.
|
||||||
if n > 0 {
|
if n > 0 {
|
||||||
close(source)
|
close(source)
|
||||||
}
|
}
|
||||||
@@ -259,6 +278,13 @@ func (s Stream) Head(n int64) Stream {
|
|||||||
return Range(source)
|
return Range(source)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Last returns the last item, or nil if no items.
|
||||||
|
func (s Stream) Last() (item interface{}) {
|
||||||
|
for item = range s.source {
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
// Map converts each item to another corresponding item, which means it's a 1:1 model.
|
// Map converts each item to another corresponding item, which means it's a 1:1 model.
|
||||||
func (s Stream) Map(fn MapFunc, opts ...Option) Stream {
|
func (s Stream) Map(fn MapFunc, opts ...Option) Stream {
|
||||||
return s.Walk(func(item interface{}, pipe chan<- interface{}) {
|
return s.Walk(func(item interface{}, pipe chan<- interface{}) {
|
||||||
@@ -280,6 +306,21 @@ func (s Stream) Merge() Stream {
|
|||||||
return Range(source)
|
return Range(source)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// NoneMatch returns whether all elements of this stream don't match the provided predicate.
|
||||||
|
// May not evaluate the predicate on all elements if not necessary for determining the result.
|
||||||
|
// If the stream is empty then true is returned and the predicate is not evaluated.
|
||||||
|
func (s Stream) NoneMatch(predicate func(item interface{}) bool) bool {
|
||||||
|
for item := range s.source {
|
||||||
|
if predicate(item) {
|
||||||
|
// make sure the former goroutine not block, and current func returns fast.
|
||||||
|
go drain(s.source)
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
// Parallel applies the given ParallelFunc to each item concurrently with given number of workers.
|
// Parallel applies the given ParallelFunc to each item concurrently with given number of workers.
|
||||||
func (s Stream) Parallel(fn ParallelFunc, opts ...Option) {
|
func (s Stream) Parallel(fn ParallelFunc, opts ...Option) {
|
||||||
s.Walk(func(item interface{}, pipe chan<- interface{}) {
|
s.Walk(func(item interface{}, pipe chan<- interface{}) {
|
||||||
@@ -411,15 +452,12 @@ func (s Stream) walkLimited(fn WalkFunc, option *rxOptions) Stream {
|
|||||||
var wg sync.WaitGroup
|
var wg sync.WaitGroup
|
||||||
pool := make(chan lang.PlaceholderType, option.workers)
|
pool := make(chan lang.PlaceholderType, option.workers)
|
||||||
|
|
||||||
for {
|
for item := range s.source {
|
||||||
|
// important, used in another goroutine
|
||||||
|
val := item
|
||||||
pool <- lang.Placeholder
|
pool <- lang.Placeholder
|
||||||
item, ok := <-s.source
|
|
||||||
if !ok {
|
|
||||||
<-pool
|
|
||||||
break
|
|
||||||
}
|
|
||||||
|
|
||||||
wg.Add(1)
|
wg.Add(1)
|
||||||
|
|
||||||
// better to safely run caller defined method
|
// better to safely run caller defined method
|
||||||
threading.GoSafe(func() {
|
threading.GoSafe(func() {
|
||||||
defer func() {
|
defer func() {
|
||||||
@@ -427,7 +465,7 @@ func (s Stream) walkLimited(fn WalkFunc, option *rxOptions) Stream {
|
|||||||
<-pool
|
<-pool
|
||||||
}()
|
}()
|
||||||
|
|
||||||
fn(item, pipe)
|
fn(val, pipe)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -439,22 +477,19 @@ func (s Stream) walkLimited(fn WalkFunc, option *rxOptions) Stream {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (s Stream) walkUnlimited(fn WalkFunc, option *rxOptions) Stream {
|
func (s Stream) walkUnlimited(fn WalkFunc, option *rxOptions) Stream {
|
||||||
pipe := make(chan interface{}, defaultWorkers)
|
pipe := make(chan interface{}, option.workers)
|
||||||
|
|
||||||
go func() {
|
go func() {
|
||||||
var wg sync.WaitGroup
|
var wg sync.WaitGroup
|
||||||
|
|
||||||
for {
|
for item := range s.source {
|
||||||
item, ok := <-s.source
|
// important, used in another goroutine
|
||||||
if !ok {
|
val := item
|
||||||
break
|
|
||||||
}
|
|
||||||
|
|
||||||
wg.Add(1)
|
wg.Add(1)
|
||||||
// better to safely run caller defined method
|
// better to safely run caller defined method
|
||||||
threading.GoSafe(func() {
|
threading.GoSafe(func() {
|
||||||
defer wg.Done()
|
defer wg.Done()
|
||||||
fn(item, pipe)
|
fn(val, pipe)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -465,14 +500,14 @@ func (s Stream) walkUnlimited(fn WalkFunc, option *rxOptions) Stream {
|
|||||||
return Range(pipe)
|
return Range(pipe)
|
||||||
}
|
}
|
||||||
|
|
||||||
// UnlimitedWorkers lets the caller to use as many workers as the tasks.
|
// UnlimitedWorkers lets the caller use as many workers as the tasks.
|
||||||
func UnlimitedWorkers() Option {
|
func UnlimitedWorkers() Option {
|
||||||
return func(opts *rxOptions) {
|
return func(opts *rxOptions) {
|
||||||
opts.unlimitedWorkers = true
|
opts.unlimitedWorkers = true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// WithWorkers lets the caller to customize the concurrent workers.
|
// WithWorkers lets the caller customize the concurrent workers.
|
||||||
func WithWorkers(workers int) Option {
|
func WithWorkers(workers int) Option {
|
||||||
return func(opts *rxOptions) {
|
return func(opts *rxOptions) {
|
||||||
if workers < minWorkers {
|
if workers < minWorkers {
|
||||||
@@ -483,6 +518,7 @@ func WithWorkers(workers int) Option {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// buildOptions returns a rxOptions with given customizations.
|
||||||
func buildOptions(opts ...Option) *rxOptions {
|
func buildOptions(opts ...Option) *rxOptions {
|
||||||
options := newOptions()
|
options := newOptions()
|
||||||
for _, opt := range opts {
|
for _, opt := range opts {
|
||||||
@@ -492,6 +528,13 @@ func buildOptions(opts ...Option) *rxOptions {
|
|||||||
return options
|
return options
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// drain drains the given channel.
|
||||||
|
func drain(channel <-chan interface{}) {
|
||||||
|
for range channel {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// newOptions returns a default rxOptions.
|
||||||
func newOptions() *rxOptions {
|
func newOptions() *rxOptions {
|
||||||
return &rxOptions{
|
return &rxOptions{
|
||||||
workers: defaultWorkers,
|
workers: defaultWorkers,
|
||||||
|
|||||||
@@ -17,320 +17,489 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func TestBuffer(t *testing.T) {
|
func TestBuffer(t *testing.T) {
|
||||||
const N = 5
|
runCheckedTest(t, func(t *testing.T) {
|
||||||
var count int32
|
const N = 5
|
||||||
var wait sync.WaitGroup
|
var count int32
|
||||||
wait.Add(1)
|
var wait sync.WaitGroup
|
||||||
From(func(source chan<- interface{}) {
|
wait.Add(1)
|
||||||
ticker := time.NewTicker(10 * time.Millisecond)
|
From(func(source chan<- interface{}) {
|
||||||
defer ticker.Stop()
|
ticker := time.NewTicker(10 * time.Millisecond)
|
||||||
|
defer ticker.Stop()
|
||||||
|
|
||||||
for i := 0; i < 2*N; i++ {
|
for i := 0; i < 2*N; i++ {
|
||||||
select {
|
select {
|
||||||
case source <- i:
|
case source <- i:
|
||||||
atomic.AddInt32(&count, 1)
|
atomic.AddInt32(&count, 1)
|
||||||
case <-ticker.C:
|
case <-ticker.C:
|
||||||
wait.Done()
|
wait.Done()
|
||||||
return
|
return
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}).Buffer(N).ForAll(func(pipe <-chan interface{}) {
|
||||||
}).Buffer(N).ForAll(func(pipe <-chan interface{}) {
|
wait.Wait()
|
||||||
wait.Wait()
|
// why N+1, because take one more to wait for sending into the channel
|
||||||
// why N+1, because take one more to wait for sending into the channel
|
assert.Equal(t, int32(N+1), atomic.LoadInt32(&count))
|
||||||
assert.Equal(t, int32(N+1), atomic.LoadInt32(&count))
|
})
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestBufferNegative(t *testing.T) {
|
func TestBufferNegative(t *testing.T) {
|
||||||
var result int
|
runCheckedTest(t, func(t *testing.T) {
|
||||||
Just(1, 2, 3, 4).Buffer(-1).Reduce(func(pipe <-chan interface{}) (interface{}, error) {
|
var result int
|
||||||
for item := range pipe {
|
Just(1, 2, 3, 4).Buffer(-1).Reduce(func(pipe <-chan interface{}) (interface{}, error) {
|
||||||
result += item.(int)
|
for item := range pipe {
|
||||||
}
|
result += item.(int)
|
||||||
return result, nil
|
}
|
||||||
|
return result, nil
|
||||||
|
})
|
||||||
|
assert.Equal(t, 10, result)
|
||||||
})
|
})
|
||||||
assert.Equal(t, 10, result)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestCount(t *testing.T) {
|
func TestCount(t *testing.T) {
|
||||||
tests := []struct {
|
runCheckedTest(t, func(t *testing.T) {
|
||||||
name string
|
tests := []struct {
|
||||||
elements []interface{}
|
name string
|
||||||
}{
|
elements []interface{}
|
||||||
{
|
}{
|
||||||
name: "no elements with nil",
|
{
|
||||||
},
|
name: "no elements with nil",
|
||||||
{
|
},
|
||||||
name: "no elements",
|
{
|
||||||
elements: []interface{}{},
|
name: "no elements",
|
||||||
},
|
elements: []interface{}{},
|
||||||
{
|
},
|
||||||
name: "1 element",
|
{
|
||||||
elements: []interface{}{1},
|
name: "1 element",
|
||||||
},
|
elements: []interface{}{1},
|
||||||
{
|
},
|
||||||
name: "multiple elements",
|
{
|
||||||
elements: []interface{}{1, 2, 3},
|
name: "multiple elements",
|
||||||
},
|
elements: []interface{}{1, 2, 3},
|
||||||
}
|
},
|
||||||
|
}
|
||||||
|
|
||||||
for _, test := range tests {
|
for _, test := range tests {
|
||||||
t.Run(test.name, func(t *testing.T) {
|
t.Run(test.name, func(t *testing.T) {
|
||||||
val := Just(test.elements...).Count()
|
val := Just(test.elements...).Count()
|
||||||
assert.Equal(t, len(test.elements), val)
|
assert.Equal(t, len(test.elements), val)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestDone(t *testing.T) {
|
func TestDone(t *testing.T) {
|
||||||
var count int32
|
runCheckedTest(t, func(t *testing.T) {
|
||||||
Just(1, 2, 3).Walk(func(item interface{}, pipe chan<- interface{}) {
|
var count int32
|
||||||
time.Sleep(time.Millisecond * 100)
|
Just(1, 2, 3).Walk(func(item interface{}, pipe chan<- interface{}) {
|
||||||
atomic.AddInt32(&count, int32(item.(int)))
|
time.Sleep(time.Millisecond * 100)
|
||||||
}).Done()
|
atomic.AddInt32(&count, int32(item.(int)))
|
||||||
assert.Equal(t, int32(6), count)
|
}).Done()
|
||||||
|
assert.Equal(t, int32(6), count)
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestJust(t *testing.T) {
|
func TestJust(t *testing.T) {
|
||||||
var result int
|
runCheckedTest(t, func(t *testing.T) {
|
||||||
Just(1, 2, 3, 4).Reduce(func(pipe <-chan interface{}) (interface{}, error) {
|
var result int
|
||||||
for item := range pipe {
|
Just(1, 2, 3, 4).Reduce(func(pipe <-chan interface{}) (interface{}, error) {
|
||||||
result += item.(int)
|
for item := range pipe {
|
||||||
}
|
result += item.(int)
|
||||||
return result, nil
|
}
|
||||||
|
return result, nil
|
||||||
|
})
|
||||||
|
assert.Equal(t, 10, result)
|
||||||
})
|
})
|
||||||
assert.Equal(t, 10, result)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestDistinct(t *testing.T) {
|
func TestDistinct(t *testing.T) {
|
||||||
var result int
|
runCheckedTest(t, func(t *testing.T) {
|
||||||
Just(4, 1, 3, 2, 3, 4).Distinct(func(item interface{}) interface{} {
|
var result int
|
||||||
return item
|
Just(4, 1, 3, 2, 3, 4).Distinct(func(item interface{}) interface{} {
|
||||||
}).Reduce(func(pipe <-chan interface{}) (interface{}, error) {
|
return item
|
||||||
for item := range pipe {
|
}).Reduce(func(pipe <-chan interface{}) (interface{}, error) {
|
||||||
result += item.(int)
|
for item := range pipe {
|
||||||
}
|
result += item.(int)
|
||||||
return result, nil
|
}
|
||||||
|
return result, nil
|
||||||
|
})
|
||||||
|
assert.Equal(t, 10, result)
|
||||||
})
|
})
|
||||||
assert.Equal(t, 10, result)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestFilter(t *testing.T) {
|
func TestFilter(t *testing.T) {
|
||||||
var result int
|
runCheckedTest(t, func(t *testing.T) {
|
||||||
Just(1, 2, 3, 4).Filter(func(item interface{}) bool {
|
var result int
|
||||||
return item.(int)%2 == 0
|
Just(1, 2, 3, 4).Filter(func(item interface{}) bool {
|
||||||
}).Reduce(func(pipe <-chan interface{}) (interface{}, error) {
|
return item.(int)%2 == 0
|
||||||
for item := range pipe {
|
}).Reduce(func(pipe <-chan interface{}) (interface{}, error) {
|
||||||
result += item.(int)
|
for item := range pipe {
|
||||||
}
|
result += item.(int)
|
||||||
return result, nil
|
}
|
||||||
|
return result, nil
|
||||||
|
})
|
||||||
|
assert.Equal(t, 6, result)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestFirst(t *testing.T) {
|
||||||
|
runCheckedTest(t, func(t *testing.T) {
|
||||||
|
assert.Nil(t, Just().First())
|
||||||
|
assert.Equal(t, "foo", Just("foo").First())
|
||||||
|
assert.Equal(t, "foo", Just("foo", "bar").First())
|
||||||
})
|
})
|
||||||
assert.Equal(t, 6, result)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestForAll(t *testing.T) {
|
func TestForAll(t *testing.T) {
|
||||||
var result int
|
runCheckedTest(t, func(t *testing.T) {
|
||||||
Just(1, 2, 3, 4).Filter(func(item interface{}) bool {
|
var result int
|
||||||
return item.(int)%2 == 0
|
Just(1, 2, 3, 4).Filter(func(item interface{}) bool {
|
||||||
}).ForAll(func(pipe <-chan interface{}) {
|
return item.(int)%2 == 0
|
||||||
for item := range pipe {
|
}).ForAll(func(pipe <-chan interface{}) {
|
||||||
result += item.(int)
|
for item := range pipe {
|
||||||
}
|
result += item.(int)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
assert.Equal(t, 6, result)
|
||||||
})
|
})
|
||||||
assert.Equal(t, 6, result)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestGroup(t *testing.T) {
|
func TestGroup(t *testing.T) {
|
||||||
var groups [][]int
|
runCheckedTest(t, func(t *testing.T) {
|
||||||
Just(10, 11, 20, 21).Group(func(item interface{}) interface{} {
|
var groups [][]int
|
||||||
v := item.(int)
|
Just(10, 11, 20, 21).Group(func(item interface{}) interface{} {
|
||||||
return v / 10
|
v := item.(int)
|
||||||
}).ForEach(func(item interface{}) {
|
return v / 10
|
||||||
v := item.([]interface{})
|
}).ForEach(func(item interface{}) {
|
||||||
var group []int
|
v := item.([]interface{})
|
||||||
for _, each := range v {
|
var group []int
|
||||||
group = append(group, each.(int))
|
for _, each := range v {
|
||||||
}
|
group = append(group, each.(int))
|
||||||
groups = append(groups, group)
|
}
|
||||||
})
|
groups = append(groups, group)
|
||||||
|
})
|
||||||
|
|
||||||
assert.Equal(t, 2, len(groups))
|
assert.Equal(t, 2, len(groups))
|
||||||
for _, group := range groups {
|
for _, group := range groups {
|
||||||
assert.Equal(t, 2, len(group))
|
assert.Equal(t, 2, len(group))
|
||||||
assert.True(t, group[0]/10 == group[1]/10)
|
assert.True(t, group[0]/10 == group[1]/10)
|
||||||
}
|
}
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestHead(t *testing.T) {
|
func TestHead(t *testing.T) {
|
||||||
var result int
|
runCheckedTest(t, func(t *testing.T) {
|
||||||
Just(1, 2, 3, 4).Head(2).Reduce(func(pipe <-chan interface{}) (interface{}, error) {
|
var result int
|
||||||
for item := range pipe {
|
Just(1, 2, 3, 4).Head(2).Reduce(func(pipe <-chan interface{}) (interface{}, error) {
|
||||||
result += item.(int)
|
for item := range pipe {
|
||||||
}
|
result += item.(int)
|
||||||
return result, nil
|
}
|
||||||
|
return result, nil
|
||||||
|
})
|
||||||
|
assert.Equal(t, 3, result)
|
||||||
})
|
})
|
||||||
assert.Equal(t, 3, result)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestHeadZero(t *testing.T) {
|
func TestHeadZero(t *testing.T) {
|
||||||
assert.Panics(t, func() {
|
runCheckedTest(t, func(t *testing.T) {
|
||||||
Just(1, 2, 3, 4).Head(0).Reduce(func(pipe <-chan interface{}) (interface{}, error) {
|
assert.Panics(t, func() {
|
||||||
return nil, nil
|
Just(1, 2, 3, 4).Head(0).Reduce(func(pipe <-chan interface{}) (interface{}, error) {
|
||||||
|
return nil, nil
|
||||||
|
})
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestHeadMore(t *testing.T) {
|
func TestHeadMore(t *testing.T) {
|
||||||
var result int
|
runCheckedTest(t, func(t *testing.T) {
|
||||||
Just(1, 2, 3, 4).Head(6).Reduce(func(pipe <-chan interface{}) (interface{}, error) {
|
var result int
|
||||||
for item := range pipe {
|
Just(1, 2, 3, 4).Head(6).Reduce(func(pipe <-chan interface{}) (interface{}, error) {
|
||||||
result += item.(int)
|
for item := range pipe {
|
||||||
}
|
result += item.(int)
|
||||||
return result, nil
|
}
|
||||||
|
return result, nil
|
||||||
|
})
|
||||||
|
assert.Equal(t, 10, result)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestLast(t *testing.T) {
|
||||||
|
runCheckedTest(t, func(t *testing.T) {
|
||||||
|
goroutines := runtime.NumGoroutine()
|
||||||
|
assert.Nil(t, Just().Last())
|
||||||
|
assert.Equal(t, "foo", Just("foo").Last())
|
||||||
|
assert.Equal(t, "bar", Just("foo", "bar").Last())
|
||||||
|
// let scheduler schedule first
|
||||||
|
runtime.Gosched()
|
||||||
|
assert.Equal(t, goroutines, runtime.NumGoroutine())
|
||||||
})
|
})
|
||||||
assert.Equal(t, 10, result)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestMap(t *testing.T) {
|
func TestMap(t *testing.T) {
|
||||||
log.SetOutput(ioutil.Discard)
|
runCheckedTest(t, func(t *testing.T) {
|
||||||
|
log.SetOutput(ioutil.Discard)
|
||||||
|
|
||||||
tests := []struct {
|
tests := []struct {
|
||||||
mapper MapFunc
|
mapper MapFunc
|
||||||
expect int
|
expect int
|
||||||
}{
|
}{
|
||||||
{
|
{
|
||||||
mapper: func(item interface{}) interface{} {
|
mapper: func(item interface{}) interface{} {
|
||||||
v := item.(int)
|
v := item.(int)
|
||||||
return v * v
|
return v * v
|
||||||
|
},
|
||||||
|
expect: 30,
|
||||||
},
|
},
|
||||||
expect: 30,
|
{
|
||||||
},
|
mapper: func(item interface{}) interface{} {
|
||||||
{
|
v := item.(int)
|
||||||
mapper: func(item interface{}) interface{} {
|
if v%2 == 0 {
|
||||||
v := item.(int)
|
return 0
|
||||||
if v%2 == 0 {
|
|
||||||
return 0
|
|
||||||
}
|
|
||||||
return v * v
|
|
||||||
},
|
|
||||||
expect: 10,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
mapper: func(item interface{}) interface{} {
|
|
||||||
v := item.(int)
|
|
||||||
if v%2 == 0 {
|
|
||||||
panic(v)
|
|
||||||
}
|
|
||||||
return v * v
|
|
||||||
},
|
|
||||||
expect: 10,
|
|
||||||
},
|
|
||||||
}
|
|
||||||
|
|
||||||
// Map(...) works even WithWorkers(0)
|
|
||||||
for i, test := range tests {
|
|
||||||
t.Run(stringx.Rand(), func(t *testing.T) {
|
|
||||||
var result int
|
|
||||||
var workers int
|
|
||||||
if i%2 == 0 {
|
|
||||||
workers = 0
|
|
||||||
} else {
|
|
||||||
workers = runtime.NumCPU()
|
|
||||||
}
|
|
||||||
From(func(source chan<- interface{}) {
|
|
||||||
for i := 1; i < 5; i++ {
|
|
||||||
source <- i
|
|
||||||
}
|
|
||||||
}).Map(test.mapper, WithWorkers(workers)).Reduce(
|
|
||||||
func(pipe <-chan interface{}) (interface{}, error) {
|
|
||||||
for item := range pipe {
|
|
||||||
result += item.(int)
|
|
||||||
}
|
}
|
||||||
return result, nil
|
return v * v
|
||||||
})
|
},
|
||||||
|
expect: 10,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
mapper: func(item interface{}) interface{} {
|
||||||
|
v := item.(int)
|
||||||
|
if v%2 == 0 {
|
||||||
|
panic(v)
|
||||||
|
}
|
||||||
|
return v * v
|
||||||
|
},
|
||||||
|
expect: 10,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
assert.Equal(t, test.expect, result)
|
// Map(...) works even WithWorkers(0)
|
||||||
})
|
for i, test := range tests {
|
||||||
}
|
t.Run(stringx.Rand(), func(t *testing.T) {
|
||||||
|
var result int
|
||||||
|
var workers int
|
||||||
|
if i%2 == 0 {
|
||||||
|
workers = 0
|
||||||
|
} else {
|
||||||
|
workers = runtime.NumCPU()
|
||||||
|
}
|
||||||
|
From(func(source chan<- interface{}) {
|
||||||
|
for i := 1; i < 5; i++ {
|
||||||
|
source <- i
|
||||||
|
}
|
||||||
|
}).Map(test.mapper, WithWorkers(workers)).Reduce(
|
||||||
|
func(pipe <-chan interface{}) (interface{}, error) {
|
||||||
|
for item := range pipe {
|
||||||
|
result += item.(int)
|
||||||
|
}
|
||||||
|
return result, nil
|
||||||
|
})
|
||||||
|
|
||||||
|
assert.Equal(t, test.expect, result)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestMerge(t *testing.T) {
|
func TestMerge(t *testing.T) {
|
||||||
Just(1, 2, 3, 4).Merge().ForEach(func(item interface{}) {
|
runCheckedTest(t, func(t *testing.T) {
|
||||||
assert.ElementsMatch(t, []interface{}{1, 2, 3, 4}, item.([]interface{}))
|
Just(1, 2, 3, 4).Merge().ForEach(func(item interface{}) {
|
||||||
|
assert.ElementsMatch(t, []interface{}{1, 2, 3, 4}, item.([]interface{}))
|
||||||
|
})
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestParallelJust(t *testing.T) {
|
func TestParallelJust(t *testing.T) {
|
||||||
var count int32
|
runCheckedTest(t, func(t *testing.T) {
|
||||||
Just(1, 2, 3).Parallel(func(item interface{}) {
|
var count int32
|
||||||
time.Sleep(time.Millisecond * 100)
|
Just(1, 2, 3).Parallel(func(item interface{}) {
|
||||||
atomic.AddInt32(&count, int32(item.(int)))
|
time.Sleep(time.Millisecond * 100)
|
||||||
}, UnlimitedWorkers())
|
atomic.AddInt32(&count, int32(item.(int)))
|
||||||
assert.Equal(t, int32(6), count)
|
}, UnlimitedWorkers())
|
||||||
|
assert.Equal(t, int32(6), count)
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestReverse(t *testing.T) {
|
func TestReverse(t *testing.T) {
|
||||||
Just(1, 2, 3, 4).Reverse().Merge().ForEach(func(item interface{}) {
|
runCheckedTest(t, func(t *testing.T) {
|
||||||
assert.ElementsMatch(t, []interface{}{4, 3, 2, 1}, item.([]interface{}))
|
Just(1, 2, 3, 4).Reverse().Merge().ForEach(func(item interface{}) {
|
||||||
|
assert.ElementsMatch(t, []interface{}{4, 3, 2, 1}, item.([]interface{}))
|
||||||
|
})
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestSort(t *testing.T) {
|
func TestSort(t *testing.T) {
|
||||||
var prev int
|
runCheckedTest(t, func(t *testing.T) {
|
||||||
Just(5, 3, 7, 1, 9, 6, 4, 8, 2).Sort(func(a, b interface{}) bool {
|
var prev int
|
||||||
return a.(int) < b.(int)
|
Just(5, 3, 7, 1, 9, 6, 4, 8, 2).Sort(func(a, b interface{}) bool {
|
||||||
}).ForEach(func(item interface{}) {
|
return a.(int) < b.(int)
|
||||||
next := item.(int)
|
}).ForEach(func(item interface{}) {
|
||||||
assert.True(t, prev < next)
|
next := item.(int)
|
||||||
prev = next
|
assert.True(t, prev < next)
|
||||||
|
prev = next
|
||||||
|
})
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestSplit(t *testing.T) {
|
func TestSplit(t *testing.T) {
|
||||||
assert.Panics(t, func() {
|
runCheckedTest(t, func(t *testing.T) {
|
||||||
Just(1, 2, 3, 4, 5, 6, 7, 8, 9, 10).Split(0).Done()
|
assert.Panics(t, func() {
|
||||||
|
Just(1, 2, 3, 4, 5, 6, 7, 8, 9, 10).Split(0).Done()
|
||||||
|
})
|
||||||
|
var chunks [][]interface{}
|
||||||
|
Just(1, 2, 3, 4, 5, 6, 7, 8, 9, 10).Split(4).ForEach(func(item interface{}) {
|
||||||
|
chunk := item.([]interface{})
|
||||||
|
chunks = append(chunks, chunk)
|
||||||
|
})
|
||||||
|
assert.EqualValues(t, [][]interface{}{
|
||||||
|
{1, 2, 3, 4},
|
||||||
|
{5, 6, 7, 8},
|
||||||
|
{9, 10},
|
||||||
|
}, chunks)
|
||||||
})
|
})
|
||||||
var chunks [][]interface{}
|
|
||||||
Just(1, 2, 3, 4, 5, 6, 7, 8, 9, 10).Split(4).ForEach(func(item interface{}) {
|
|
||||||
chunk := item.([]interface{})
|
|
||||||
chunks = append(chunks, chunk)
|
|
||||||
})
|
|
||||||
assert.EqualValues(t, [][]interface{}{
|
|
||||||
{1, 2, 3, 4},
|
|
||||||
{5, 6, 7, 8},
|
|
||||||
{9, 10},
|
|
||||||
}, chunks)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestTail(t *testing.T) {
|
func TestTail(t *testing.T) {
|
||||||
var result int
|
runCheckedTest(t, func(t *testing.T) {
|
||||||
Just(1, 2, 3, 4).Tail(2).Reduce(func(pipe <-chan interface{}) (interface{}, error) {
|
var result int
|
||||||
for item := range pipe {
|
Just(1, 2, 3, 4).Tail(2).Reduce(func(pipe <-chan interface{}) (interface{}, error) {
|
||||||
result += item.(int)
|
for item := range pipe {
|
||||||
}
|
result += item.(int)
|
||||||
return result, nil
|
}
|
||||||
|
return result, nil
|
||||||
|
})
|
||||||
|
assert.Equal(t, 7, result)
|
||||||
})
|
})
|
||||||
assert.Equal(t, 7, result)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestTailZero(t *testing.T) {
|
func TestTailZero(t *testing.T) {
|
||||||
assert.Panics(t, func() {
|
runCheckedTest(t, func(t *testing.T) {
|
||||||
Just(1, 2, 3, 4).Tail(0).Reduce(func(pipe <-chan interface{}) (interface{}, error) {
|
assert.Panics(t, func() {
|
||||||
return nil, nil
|
Just(1, 2, 3, 4).Tail(0).Reduce(func(pipe <-chan interface{}) (interface{}, error) {
|
||||||
|
return nil, nil
|
||||||
|
})
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestWalk(t *testing.T) {
|
func TestWalk(t *testing.T) {
|
||||||
var result int
|
runCheckedTest(t, func(t *testing.T) {
|
||||||
Just(1, 2, 3, 4, 5).Walk(func(item interface{}, pipe chan<- interface{}) {
|
var result int
|
||||||
if item.(int)%2 != 0 {
|
Just(1, 2, 3, 4, 5).Walk(func(item interface{}, pipe chan<- interface{}) {
|
||||||
pipe <- item
|
if item.(int)%2 != 0 {
|
||||||
}
|
pipe <- item
|
||||||
}, UnlimitedWorkers()).ForEach(func(item interface{}) {
|
}
|
||||||
result += item.(int)
|
}, UnlimitedWorkers()).ForEach(func(item interface{}) {
|
||||||
|
result += item.(int)
|
||||||
|
})
|
||||||
|
assert.Equal(t, 9, result)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestStream_AnyMach(t *testing.T) {
|
||||||
|
runCheckedTest(t, func(t *testing.T) {
|
||||||
|
assetEqual(t, false, Just(1, 2, 3).AnyMach(func(item interface{}) bool {
|
||||||
|
return item.(int) == 4
|
||||||
|
}))
|
||||||
|
assetEqual(t, false, Just(1, 2, 3).AnyMach(func(item interface{}) bool {
|
||||||
|
return item.(int) == 0
|
||||||
|
}))
|
||||||
|
assetEqual(t, true, Just(1, 2, 3).AnyMach(func(item interface{}) bool {
|
||||||
|
return item.(int) == 2
|
||||||
|
}))
|
||||||
|
assetEqual(t, true, Just(1, 2, 3).AnyMach(func(item interface{}) bool {
|
||||||
|
return item.(int) == 2
|
||||||
|
}))
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestStream_AllMach(t *testing.T) {
|
||||||
|
runCheckedTest(t, func(t *testing.T) {
|
||||||
|
assetEqual(
|
||||||
|
t, true, Just(1, 2, 3).AllMach(func(item interface{}) bool {
|
||||||
|
return true
|
||||||
|
}),
|
||||||
|
)
|
||||||
|
assetEqual(
|
||||||
|
t, false, Just(1, 2, 3).AllMach(func(item interface{}) bool {
|
||||||
|
return false
|
||||||
|
}),
|
||||||
|
)
|
||||||
|
assetEqual(
|
||||||
|
t, false, Just(1, 2, 3).AllMach(func(item interface{}) bool {
|
||||||
|
return item.(int) == 1
|
||||||
|
}),
|
||||||
|
)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestStream_NoneMatch(t *testing.T) {
|
||||||
|
runCheckedTest(t, func(t *testing.T) {
|
||||||
|
assetEqual(
|
||||||
|
t, true, Just(1, 2, 3).NoneMatch(func(item interface{}) bool {
|
||||||
|
return false
|
||||||
|
}),
|
||||||
|
)
|
||||||
|
assetEqual(
|
||||||
|
t, false, Just(1, 2, 3).NoneMatch(func(item interface{}) bool {
|
||||||
|
return true
|
||||||
|
}),
|
||||||
|
)
|
||||||
|
assetEqual(
|
||||||
|
t, true, Just(1, 2, 3).NoneMatch(func(item interface{}) bool {
|
||||||
|
return item.(int) == 4
|
||||||
|
}),
|
||||||
|
)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestConcat(t *testing.T) {
|
||||||
|
runCheckedTest(t, func(t *testing.T) {
|
||||||
|
a1 := []interface{}{1, 2, 3}
|
||||||
|
a2 := []interface{}{4, 5, 6}
|
||||||
|
s1 := Just(a1...)
|
||||||
|
s2 := Just(a2...)
|
||||||
|
stream := Concat(s1, s2)
|
||||||
|
var items []interface{}
|
||||||
|
for item := range stream.source {
|
||||||
|
items = append(items, item)
|
||||||
|
}
|
||||||
|
sort.Slice(items, func(i, j int) bool {
|
||||||
|
return items[i].(int) < items[j].(int)
|
||||||
|
})
|
||||||
|
ints := make([]interface{}, 0)
|
||||||
|
ints = append(ints, a1...)
|
||||||
|
ints = append(ints, a2...)
|
||||||
|
assetEqual(t, ints, items)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestStream_Skip(t *testing.T) {
|
||||||
|
runCheckedTest(t, func(t *testing.T) {
|
||||||
|
assetEqual(t, 3, Just(1, 2, 3, 4).Skip(1).Count())
|
||||||
|
assetEqual(t, 1, Just(1, 2, 3, 4).Skip(3).Count())
|
||||||
|
assetEqual(t, 4, Just(1, 2, 3, 4).Skip(0).Count())
|
||||||
|
equal(t, Just(1, 2, 3, 4).Skip(3), []interface{}{4})
|
||||||
|
assert.Panics(t, func() {
|
||||||
|
Just(1, 2, 3, 4).Skip(-1)
|
||||||
|
})
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestStream_Concat(t *testing.T) {
|
||||||
|
runCheckedTest(t, func(t *testing.T) {
|
||||||
|
stream := Just(1).Concat(Just(2), Just(3))
|
||||||
|
var items []interface{}
|
||||||
|
for item := range stream.source {
|
||||||
|
items = append(items, item)
|
||||||
|
}
|
||||||
|
sort.Slice(items, func(i, j int) bool {
|
||||||
|
return items[i].(int) < items[j].(int)
|
||||||
|
})
|
||||||
|
assetEqual(t, []interface{}{1, 2, 3}, items)
|
||||||
|
|
||||||
|
just := Just(1)
|
||||||
|
equal(t, just.Concat(just), []interface{}{1})
|
||||||
})
|
})
|
||||||
assert.Equal(t, 9, result)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func BenchmarkParallelMapReduce(b *testing.B) {
|
func BenchmarkParallelMapReduce(b *testing.B) {
|
||||||
@@ -377,6 +546,12 @@ func BenchmarkMapReduce(b *testing.B) {
|
|||||||
}).Map(mapper).Reduce(reducer)
|
}).Map(mapper).Reduce(reducer)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func assetEqual(t *testing.T, except, data interface{}) {
|
||||||
|
if !reflect.DeepEqual(except, data) {
|
||||||
|
t.Errorf(" %v, want %v", data, except)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
func equal(t *testing.T, stream Stream, data []interface{}) {
|
func equal(t *testing.T, stream Stream, data []interface{}) {
|
||||||
items := make([]interface{}, 0)
|
items := make([]interface{}, 0)
|
||||||
for item := range stream.source {
|
for item := range stream.source {
|
||||||
@@ -387,85 +562,10 @@ func equal(t *testing.T, stream Stream, data []interface{}) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func assetEqual(t *testing.T, except, data interface{}) {
|
func runCheckedTest(t *testing.T, fn func(t *testing.T)) {
|
||||||
if !reflect.DeepEqual(except, data) {
|
goroutines := runtime.NumGoroutine()
|
||||||
t.Errorf(" %v, want %v", data, except)
|
fn(t)
|
||||||
}
|
// let scheduler schedule first
|
||||||
}
|
time.Sleep(time.Millisecond)
|
||||||
|
assert.True(t, runtime.NumGoroutine() <= goroutines)
|
||||||
func TestStream_AnyMach(t *testing.T) {
|
|
||||||
assetEqual(t, false, Just(1, 2, 3).AnyMach(func(item interface{}) bool {
|
|
||||||
return item.(int) == 4
|
|
||||||
}))
|
|
||||||
assetEqual(t, false, Just(1, 2, 3).AnyMach(func(item interface{}) bool {
|
|
||||||
return item.(int) == 0
|
|
||||||
}))
|
|
||||||
assetEqual(t, true, Just(1, 2, 3).AnyMach(func(item interface{}) bool {
|
|
||||||
return item.(int) == 2
|
|
||||||
}))
|
|
||||||
assetEqual(t, true, Just(1, 2, 3).AnyMach(func(item interface{}) bool {
|
|
||||||
return item.(int) == 2
|
|
||||||
}))
|
|
||||||
}
|
|
||||||
|
|
||||||
func TestStream_AllMach(t *testing.T) {
|
|
||||||
assetEqual(
|
|
||||||
t, true, Just(1, 2, 3).AllMach(func(item interface{}) bool {
|
|
||||||
return true
|
|
||||||
}),
|
|
||||||
)
|
|
||||||
assetEqual(
|
|
||||||
t, false, Just(1, 2, 3).AllMach(func(item interface{}) bool {
|
|
||||||
return false
|
|
||||||
}),
|
|
||||||
)
|
|
||||||
assetEqual(
|
|
||||||
t, false, Just(1, 2, 3).AllMach(func(item interface{}) bool {
|
|
||||||
return item.(int) == 1
|
|
||||||
}),
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
func TestConcat(t *testing.T) {
|
|
||||||
a1 := []interface{}{1, 2, 3}
|
|
||||||
a2 := []interface{}{4, 5, 6}
|
|
||||||
s1 := Just(a1...)
|
|
||||||
s2 := Just(a2...)
|
|
||||||
stream := Concat(s1, s2)
|
|
||||||
var items []interface{}
|
|
||||||
for item := range stream.source {
|
|
||||||
items = append(items, item)
|
|
||||||
}
|
|
||||||
sort.Slice(items, func(i, j int) bool {
|
|
||||||
return items[i].(int) < items[j].(int)
|
|
||||||
})
|
|
||||||
ints := make([]interface{}, 0)
|
|
||||||
ints = append(ints, a1...)
|
|
||||||
ints = append(ints, a2...)
|
|
||||||
assetEqual(t, ints, items)
|
|
||||||
}
|
|
||||||
|
|
||||||
func TestStream_Skip(t *testing.T) {
|
|
||||||
assetEqual(t, 3, Just(1, 2, 3, 4).Skip(1).Count())
|
|
||||||
assetEqual(t, 1, Just(1, 2, 3, 4).Skip(3).Count())
|
|
||||||
assetEqual(t, 4, Just(1, 2, 3, 4).Skip(0).Count())
|
|
||||||
equal(t, Just(1, 2, 3, 4).Skip(3), []interface{}{4})
|
|
||||||
assert.Panics(t, func() {
|
|
||||||
Just(1, 2, 3, 4).Skip(-1)
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
func TestStream_Concat(t *testing.T) {
|
|
||||||
stream := Just(1).Concat(Just(2), Just(3))
|
|
||||||
var items []interface{}
|
|
||||||
for item := range stream.source {
|
|
||||||
items = append(items, item)
|
|
||||||
}
|
|
||||||
sort.Slice(items, func(i, j int) bool {
|
|
||||||
return items[i].(int) < items[j].(int)
|
|
||||||
})
|
|
||||||
assetEqual(t, []interface{}{1, 2, 3}, items)
|
|
||||||
|
|
||||||
just := Just(1)
|
|
||||||
equal(t, just.Concat(just), []interface{}{1})
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,8 +4,8 @@ package lang
|
|||||||
var Placeholder PlaceholderType
|
var Placeholder PlaceholderType
|
||||||
|
|
||||||
type (
|
type (
|
||||||
// GenericType can be used to hold any type.
|
// AnyType can be used to hold any type.
|
||||||
GenericType = interface{}
|
AnyType = interface{}
|
||||||
// PlaceholderType represents a placeholder type.
|
// PlaceholderType represents a placeholder type.
|
||||||
PlaceholderType = struct{}
|
PlaceholderType = struct{}
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -79,8 +79,10 @@ func (l *durationLogger) WithDuration(duration time.Duration) Logger {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (l *durationLogger) write(writer io.Writer, level string, val interface{}) {
|
func (l *durationLogger) write(writer io.Writer, level string, val interface{}) {
|
||||||
l.Timestamp = getTimestamp()
|
outputJson(writer, &durationLogger{
|
||||||
l.Level = level
|
Timestamp: getTimestamp(),
|
||||||
l.Content = val
|
Level: level,
|
||||||
outputJson(writer, l)
|
Content: val,
|
||||||
|
Duration: l.Duration,
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,6 +23,13 @@ func TestWithDurationErrorf(t *testing.T) {
|
|||||||
assert.True(t, strings.Contains(builder.String(), "duration"), builder.String())
|
assert.True(t, strings.Contains(builder.String(), "duration"), builder.String())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestWithDurationErrorv(t *testing.T) {
|
||||||
|
var builder strings.Builder
|
||||||
|
log.SetOutput(&builder)
|
||||||
|
WithDuration(time.Second).Errorv("foo")
|
||||||
|
assert.True(t, strings.Contains(builder.String(), "duration"), builder.String())
|
||||||
|
}
|
||||||
|
|
||||||
func TestWithDurationInfo(t *testing.T) {
|
func TestWithDurationInfo(t *testing.T) {
|
||||||
var builder strings.Builder
|
var builder strings.Builder
|
||||||
log.SetOutput(&builder)
|
log.SetOutput(&builder)
|
||||||
@@ -37,6 +44,13 @@ func TestWithDurationInfof(t *testing.T) {
|
|||||||
assert.True(t, strings.Contains(builder.String(), "duration"), builder.String())
|
assert.True(t, strings.Contains(builder.String(), "duration"), builder.String())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestWithDurationInfov(t *testing.T) {
|
||||||
|
var builder strings.Builder
|
||||||
|
log.SetOutput(&builder)
|
||||||
|
WithDuration(time.Second).Infov("foo")
|
||||||
|
assert.True(t, strings.Contains(builder.String(), "duration"), builder.String())
|
||||||
|
}
|
||||||
|
|
||||||
func TestWithDurationSlow(t *testing.T) {
|
func TestWithDurationSlow(t *testing.T) {
|
||||||
var builder strings.Builder
|
var builder strings.Builder
|
||||||
log.SetOutput(&builder)
|
log.SetOutput(&builder)
|
||||||
@@ -50,3 +64,10 @@ func TestWithDurationSlowf(t *testing.T) {
|
|||||||
WithDuration(time.Second).WithDuration(time.Hour).Slowf("foo")
|
WithDuration(time.Second).WithDuration(time.Hour).Slowf("foo")
|
||||||
assert.True(t, strings.Contains(builder.String(), "duration"), builder.String())
|
assert.True(t, strings.Contains(builder.String(), "duration"), builder.String())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestWithDurationSlowv(t *testing.T) {
|
||||||
|
var builder strings.Builder
|
||||||
|
log.SetOutput(&builder)
|
||||||
|
WithDuration(time.Second).WithDuration(time.Hour).Slowv("foo")
|
||||||
|
assert.True(t, strings.Contains(builder.String(), "duration"), builder.String())
|
||||||
|
}
|
||||||
|
|||||||
@@ -77,12 +77,16 @@ func (l *traceLogger) WithDuration(duration time.Duration) Logger {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (l *traceLogger) write(writer io.Writer, level string, val interface{}) {
|
func (l *traceLogger) write(writer io.Writer, level string, val interface{}) {
|
||||||
l.Timestamp = getTimestamp()
|
outputJson(writer, &traceLogger{
|
||||||
l.Level = level
|
logEntry: logEntry{
|
||||||
l.Content = val
|
Timestamp: getTimestamp(),
|
||||||
l.Trace = traceIdFromContext(l.ctx)
|
Level: level,
|
||||||
l.Span = spanIdFromContext(l.ctx)
|
Duration: l.Duration,
|
||||||
outputJson(writer, l)
|
Content: val,
|
||||||
|
},
|
||||||
|
Trace: traceIdFromContext(l.ctx),
|
||||||
|
Span: spanIdFromContext(l.ctx),
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
// WithContext sets ctx to log, for keeping tracing information.
|
// WithContext sets ctx to log, for keeping tracing information.
|
||||||
|
|||||||
@@ -51,6 +51,10 @@ func TestTraceError(t *testing.T) {
|
|||||||
l.WithDuration(time.Second).Errorf(testlog)
|
l.WithDuration(time.Second).Errorf(testlog)
|
||||||
assert.True(t, strings.Contains(buf.String(), traceKey))
|
assert.True(t, strings.Contains(buf.String(), traceKey))
|
||||||
assert.True(t, strings.Contains(buf.String(), spanKey))
|
assert.True(t, strings.Contains(buf.String(), spanKey))
|
||||||
|
buf.Reset()
|
||||||
|
l.WithDuration(time.Second).Errorv(testlog)
|
||||||
|
assert.True(t, strings.Contains(buf.String(), traceKey))
|
||||||
|
assert.True(t, strings.Contains(buf.String(), spanKey))
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestTraceInfo(t *testing.T) {
|
func TestTraceInfo(t *testing.T) {
|
||||||
@@ -72,6 +76,10 @@ func TestTraceInfo(t *testing.T) {
|
|||||||
l.WithDuration(time.Second).Infof(testlog)
|
l.WithDuration(time.Second).Infof(testlog)
|
||||||
assert.True(t, strings.Contains(buf.String(), traceKey))
|
assert.True(t, strings.Contains(buf.String(), traceKey))
|
||||||
assert.True(t, strings.Contains(buf.String(), spanKey))
|
assert.True(t, strings.Contains(buf.String(), spanKey))
|
||||||
|
buf.Reset()
|
||||||
|
l.WithDuration(time.Second).Infov(testlog)
|
||||||
|
assert.True(t, strings.Contains(buf.String(), traceKey))
|
||||||
|
assert.True(t, strings.Contains(buf.String(), spanKey))
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestTraceSlow(t *testing.T) {
|
func TestTraceSlow(t *testing.T) {
|
||||||
@@ -93,6 +101,10 @@ func TestTraceSlow(t *testing.T) {
|
|||||||
l.WithDuration(time.Second).Slowf(testlog)
|
l.WithDuration(time.Second).Slowf(testlog)
|
||||||
assert.True(t, strings.Contains(buf.String(), traceKey))
|
assert.True(t, strings.Contains(buf.String(), traceKey))
|
||||||
assert.True(t, strings.Contains(buf.String(), spanKey))
|
assert.True(t, strings.Contains(buf.String(), spanKey))
|
||||||
|
buf.Reset()
|
||||||
|
l.WithDuration(time.Second).Slowv(testlog)
|
||||||
|
assert.True(t, strings.Contains(buf.String(), traceKey))
|
||||||
|
assert.True(t, strings.Contains(buf.String(), spanKey))
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestTraceWithoutContext(t *testing.T) {
|
func TestTraceWithoutContext(t *testing.T) {
|
||||||
|
|||||||
@@ -15,6 +15,11 @@ func UnmarshalJsonBytes(content []byte, v interface{}) error {
|
|||||||
return unmarshalJsonBytes(content, v, jsonUnmarshaler)
|
return unmarshalJsonBytes(content, v, jsonUnmarshaler)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// UnmarshalJsonMap unmarshals content from m into v.
|
||||||
|
func UnmarshalJsonMap(m map[string]interface{}, v interface{}) error {
|
||||||
|
return jsonUnmarshaler.Unmarshal(m, v)
|
||||||
|
}
|
||||||
|
|
||||||
// UnmarshalJsonReader unmarshals content from reader into v.
|
// UnmarshalJsonReader unmarshals content from reader into v.
|
||||||
func UnmarshalJsonReader(reader io.Reader, v interface{}) error {
|
func UnmarshalJsonReader(reader io.Reader, v interface{}) error {
|
||||||
return unmarshalJsonReader(reader, v, jsonUnmarshaler)
|
return unmarshalJsonReader(reader, v, jsonUnmarshaler)
|
||||||
|
|||||||
@@ -871,3 +871,50 @@ func TestUnmarshalReaderError(t *testing.T) {
|
|||||||
assert.NotNil(t, err)
|
assert.NotNil(t, err)
|
||||||
assert.True(t, strings.Contains(err.Error(), payload))
|
assert.True(t, strings.Contains(err.Error(), payload))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestUnmarshalMap(t *testing.T) {
|
||||||
|
t.Run("nil map and valid", func(t *testing.T) {
|
||||||
|
var m map[string]interface{}
|
||||||
|
var v struct {
|
||||||
|
Any string `json:",optional"`
|
||||||
|
}
|
||||||
|
|
||||||
|
err := UnmarshalJsonMap(m, &v)
|
||||||
|
assert.Nil(t, err)
|
||||||
|
assert.True(t, len(v.Any) == 0)
|
||||||
|
})
|
||||||
|
|
||||||
|
t.Run("empty map but not valid", func(t *testing.T) {
|
||||||
|
m := map[string]interface{}{}
|
||||||
|
var v struct {
|
||||||
|
Any string
|
||||||
|
}
|
||||||
|
|
||||||
|
err := UnmarshalJsonMap(m, &v)
|
||||||
|
assert.NotNil(t, err)
|
||||||
|
})
|
||||||
|
|
||||||
|
t.Run("empty map and valid", func(t *testing.T) {
|
||||||
|
m := map[string]interface{}{}
|
||||||
|
var v struct {
|
||||||
|
Any string `json:",optional"`
|
||||||
|
}
|
||||||
|
|
||||||
|
err := UnmarshalJsonMap(m, &v)
|
||||||
|
assert.Nil(t, err)
|
||||||
|
assert.True(t, len(v.Any) == 0)
|
||||||
|
})
|
||||||
|
|
||||||
|
t.Run("valid map", func(t *testing.T) {
|
||||||
|
m := map[string]interface{}{
|
||||||
|
"Any": "foo",
|
||||||
|
}
|
||||||
|
var v struct {
|
||||||
|
Any string
|
||||||
|
}
|
||||||
|
|
||||||
|
err := UnmarshalJsonMap(m, &v)
|
||||||
|
assert.Nil(t, err)
|
||||||
|
assert.Equal(t, "foo", v.Any)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|||||||
@@ -7,7 +7,6 @@ import (
|
|||||||
"reflect"
|
"reflect"
|
||||||
"strings"
|
"strings"
|
||||||
"sync"
|
"sync"
|
||||||
"sync/atomic"
|
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/tal-tech/go-zero/core/jsonx"
|
"github.com/tal-tech/go-zero/core/jsonx"
|
||||||
@@ -25,15 +24,17 @@ var (
|
|||||||
errValueNotSettable = errors.New("value is not settable")
|
errValueNotSettable = errors.New("value is not settable")
|
||||||
errValueNotStruct = errors.New("value type is not struct")
|
errValueNotStruct = errors.New("value type is not struct")
|
||||||
keyUnmarshaler = NewUnmarshaler(defaultKeyName)
|
keyUnmarshaler = NewUnmarshaler(defaultKeyName)
|
||||||
cacheKeys atomic.Value
|
|
||||||
cacheKeysLock sync.Mutex
|
|
||||||
durationType = reflect.TypeOf(time.Duration(0))
|
durationType = reflect.TypeOf(time.Duration(0))
|
||||||
|
cacheKeys map[string][]string
|
||||||
|
cacheKeysLock sync.Mutex
|
||||||
|
defaultCache map[string]interface{}
|
||||||
|
defaultCacheLock sync.Mutex
|
||||||
emptyMap = map[string]interface{}{}
|
emptyMap = map[string]interface{}{}
|
||||||
emptyValue = reflect.ValueOf(lang.Placeholder)
|
emptyValue = reflect.ValueOf(lang.Placeholder)
|
||||||
)
|
)
|
||||||
|
|
||||||
type (
|
type (
|
||||||
// A Unmarshaler is used to unmarshal with given tag key.
|
// Unmarshaler is used to unmarshal with given tag key.
|
||||||
Unmarshaler struct {
|
Unmarshaler struct {
|
||||||
key string
|
key string
|
||||||
opts unmarshalOptions
|
opts unmarshalOptions
|
||||||
@@ -46,12 +47,11 @@ type (
|
|||||||
fromString bool
|
fromString bool
|
||||||
canonicalKey func(key string) string
|
canonicalKey func(key string) string
|
||||||
}
|
}
|
||||||
|
|
||||||
keyCache map[string][]string
|
|
||||||
)
|
)
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
cacheKeys.Store(make(keyCache))
|
cacheKeys = make(map[string][]string)
|
||||||
|
defaultCache = make(map[string]interface{})
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewUnmarshaler returns a Unmarshaler.
|
// NewUnmarshaler returns a Unmarshaler.
|
||||||
@@ -388,7 +388,13 @@ func (u *Unmarshaler) processNamedFieldWithoutValue(field reflect.StructField, v
|
|||||||
if derefedType == durationType {
|
if derefedType == durationType {
|
||||||
return fillDurationValue(fieldKind, value, defaultValue)
|
return fillDurationValue(fieldKind, value, defaultValue)
|
||||||
}
|
}
|
||||||
return setValue(fieldKind, value, defaultValue)
|
|
||||||
|
switch fieldKind {
|
||||||
|
case reflect.Array, reflect.Slice:
|
||||||
|
return u.fillSliceWithDefault(derefedType, value, defaultValue)
|
||||||
|
default:
|
||||||
|
return setValue(fieldKind, value, defaultValue)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
switch fieldKind {
|
switch fieldKind {
|
||||||
@@ -502,7 +508,8 @@ func (u *Unmarshaler) fillSliceFromString(fieldType reflect.Type, value reflect.
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (u *Unmarshaler) fillSliceValue(slice reflect.Value, index int, baseKind reflect.Kind, value interface{}) error {
|
func (u *Unmarshaler) fillSliceValue(slice reflect.Value, index int,
|
||||||
|
baseKind reflect.Kind, value interface{}) error {
|
||||||
ithVal := slice.Index(index)
|
ithVal := slice.Index(index)
|
||||||
switch v := value.(type) {
|
switch v := value.(type) {
|
||||||
case json.Number:
|
case json.Number:
|
||||||
@@ -531,6 +538,28 @@ func (u *Unmarshaler) fillSliceValue(slice reflect.Value, index int, baseKind re
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (u *Unmarshaler) fillSliceWithDefault(derefedType reflect.Type, value reflect.Value,
|
||||||
|
defaultValue string) error {
|
||||||
|
baseFieldType := Deref(derefedType.Elem())
|
||||||
|
baseFieldKind := baseFieldType.Kind()
|
||||||
|
defaultCacheLock.Lock()
|
||||||
|
slice, ok := defaultCache[defaultValue]
|
||||||
|
defaultCacheLock.Unlock()
|
||||||
|
if !ok {
|
||||||
|
if baseFieldKind == reflect.String {
|
||||||
|
slice = parseGroupedSegments(defaultValue)
|
||||||
|
} else if err := jsonx.UnmarshalFromString(defaultValue, &slice); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
defaultCacheLock.Lock()
|
||||||
|
defaultCache[defaultValue] = slice
|
||||||
|
defaultCacheLock.Unlock()
|
||||||
|
}
|
||||||
|
|
||||||
|
return u.fillSlice(derefedType, value, slice)
|
||||||
|
}
|
||||||
|
|
||||||
func (u *Unmarshaler) generateMap(keyType, elemType reflect.Type, mapValue interface{}) (reflect.Value, error) {
|
func (u *Unmarshaler) generateMap(keyType, elemType reflect.Type, mapValue interface{}) (reflect.Value, error) {
|
||||||
mapType := reflect.MapOf(keyType, elemType)
|
mapType := reflect.MapOf(keyType, elemType)
|
||||||
valueType := reflect.TypeOf(mapValue)
|
valueType := reflect.TypeOf(mapValue)
|
||||||
@@ -724,20 +753,6 @@ func getValueWithChainedKeys(m Valuer, keys []string) (interface{}, bool) {
|
|||||||
return nil, false
|
return nil, false
|
||||||
}
|
}
|
||||||
|
|
||||||
func insertKeys(key string, cache []string) {
|
|
||||||
cacheKeysLock.Lock()
|
|
||||||
defer cacheKeysLock.Unlock()
|
|
||||||
|
|
||||||
keys := cacheKeys.Load().(keyCache)
|
|
||||||
// copy the contents into the new map, to guarantee the old map is immutable
|
|
||||||
newKeys := make(keyCache)
|
|
||||||
for k, v := range keys {
|
|
||||||
newKeys[k] = v
|
|
||||||
}
|
|
||||||
newKeys[key] = cache
|
|
||||||
cacheKeys.Store(newKeys)
|
|
||||||
}
|
|
||||||
|
|
||||||
func join(elem ...string) string {
|
func join(elem ...string) string {
|
||||||
var builder strings.Builder
|
var builder strings.Builder
|
||||||
|
|
||||||
@@ -768,15 +783,19 @@ func newTypeMismatchError(name string) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func readKeys(key string) []string {
|
func readKeys(key string) []string {
|
||||||
cache := cacheKeys.Load().(keyCache)
|
cacheKeysLock.Lock()
|
||||||
if keys, ok := cache[key]; ok {
|
keys, ok := cacheKeys[key]
|
||||||
|
cacheKeysLock.Unlock()
|
||||||
|
if ok {
|
||||||
return keys
|
return keys
|
||||||
}
|
}
|
||||||
|
|
||||||
keys := strings.FieldsFunc(key, func(c rune) bool {
|
keys = strings.FieldsFunc(key, func(c rune) bool {
|
||||||
return c == delimiter
|
return c == delimiter
|
||||||
})
|
})
|
||||||
insertKeys(key, keys)
|
cacheKeysLock.Lock()
|
||||||
|
cacheKeys[key] = keys
|
||||||
|
cacheKeysLock.Unlock()
|
||||||
|
|
||||||
return keys
|
return keys
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -198,6 +198,66 @@ func TestUnmarshalIntWithDefault(t *testing.T) {
|
|||||||
assert.Equal(t, 1, in.Int)
|
assert.Equal(t, 1, in.Int)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestUnmarshalBoolSliceWithDefault(t *testing.T) {
|
||||||
|
type inner struct {
|
||||||
|
Bools []bool `key:"bools,default=[true,false]"`
|
||||||
|
}
|
||||||
|
|
||||||
|
var in inner
|
||||||
|
assert.Nil(t, UnmarshalKey(nil, &in))
|
||||||
|
assert.ElementsMatch(t, []bool{true, false}, in.Bools)
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestUnmarshalIntSliceWithDefault(t *testing.T) {
|
||||||
|
type inner struct {
|
||||||
|
Ints []int `key:"ints,default=[1,2,3]"`
|
||||||
|
}
|
||||||
|
|
||||||
|
var in inner
|
||||||
|
assert.Nil(t, UnmarshalKey(nil, &in))
|
||||||
|
assert.ElementsMatch(t, []int{1, 2, 3}, in.Ints)
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestUnmarshalIntSliceWithDefaultHasSpaces(t *testing.T) {
|
||||||
|
type inner struct {
|
||||||
|
Ints []int `key:"ints,default=[1, 2, 3]"`
|
||||||
|
}
|
||||||
|
|
||||||
|
var in inner
|
||||||
|
assert.Nil(t, UnmarshalKey(nil, &in))
|
||||||
|
assert.ElementsMatch(t, []int{1, 2, 3}, in.Ints)
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestUnmarshalFloatSliceWithDefault(t *testing.T) {
|
||||||
|
type inner struct {
|
||||||
|
Floats []float32 `key:"floats,default=[1.1,2.2,3.3]"`
|
||||||
|
}
|
||||||
|
|
||||||
|
var in inner
|
||||||
|
assert.Nil(t, UnmarshalKey(nil, &in))
|
||||||
|
assert.ElementsMatch(t, []float32{1.1, 2.2, 3.3}, in.Floats)
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestUnmarshalStringSliceWithDefault(t *testing.T) {
|
||||||
|
type inner struct {
|
||||||
|
Strs []string `key:"strs,default=[foo,bar,woo]"`
|
||||||
|
}
|
||||||
|
|
||||||
|
var in inner
|
||||||
|
assert.Nil(t, UnmarshalKey(nil, &in))
|
||||||
|
assert.ElementsMatch(t, []string{"foo", "bar", "woo"}, in.Strs)
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestUnmarshalStringSliceWithDefaultHasSpaces(t *testing.T) {
|
||||||
|
type inner struct {
|
||||||
|
Strs []string `key:"strs,default=[foo, bar, woo]"`
|
||||||
|
}
|
||||||
|
|
||||||
|
var in inner
|
||||||
|
assert.Nil(t, UnmarshalKey(nil, &in))
|
||||||
|
assert.ElementsMatch(t, []string{"foo", "bar", "woo"}, in.Strs)
|
||||||
|
}
|
||||||
|
|
||||||
func TestUnmarshalUint(t *testing.T) {
|
func TestUnmarshalUint(t *testing.T) {
|
||||||
type inner struct {
|
type inner struct {
|
||||||
Uint uint `key:"uint"`
|
Uint uint `key:"uint"`
|
||||||
@@ -861,10 +921,12 @@ func TestUnmarshalSliceOfStruct(t *testing.T) {
|
|||||||
func TestUnmarshalWithStringOptionsCorrect(t *testing.T) {
|
func TestUnmarshalWithStringOptionsCorrect(t *testing.T) {
|
||||||
type inner struct {
|
type inner struct {
|
||||||
Value string `key:"value,options=first|second"`
|
Value string `key:"value,options=first|second"`
|
||||||
|
Foo string `key:"foo,options=[bar,baz]"`
|
||||||
Correct string `key:"correct,options=1|2"`
|
Correct string `key:"correct,options=1|2"`
|
||||||
}
|
}
|
||||||
m := map[string]interface{}{
|
m := map[string]interface{}{
|
||||||
"value": "first",
|
"value": "first",
|
||||||
|
"foo": "bar",
|
||||||
"correct": "2",
|
"correct": "2",
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -872,6 +934,7 @@ func TestUnmarshalWithStringOptionsCorrect(t *testing.T) {
|
|||||||
ast := assert.New(t)
|
ast := assert.New(t)
|
||||||
ast.Nil(UnmarshalKey(m, &in))
|
ast.Nil(UnmarshalKey(m, &in))
|
||||||
ast.Equal("first", in.Value)
|
ast.Equal("first", in.Value)
|
||||||
|
ast.Equal("bar", in.Foo)
|
||||||
ast.Equal("2", in.Correct)
|
ast.Equal("2", in.Correct)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -943,6 +1006,22 @@ func TestUnmarshalStringOptionsWithStringOptionsIncorrect(t *testing.T) {
|
|||||||
ast.NotNil(unmarshaler.Unmarshal(m, &in))
|
ast.NotNil(unmarshaler.Unmarshal(m, &in))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestUnmarshalStringOptionsWithStringOptionsIncorrectGrouped(t *testing.T) {
|
||||||
|
type inner struct {
|
||||||
|
Value string `key:"value,options=[first,second]"`
|
||||||
|
Correct string `key:"correct,options=1|2"`
|
||||||
|
}
|
||||||
|
m := map[string]interface{}{
|
||||||
|
"value": "third",
|
||||||
|
"correct": "2",
|
||||||
|
}
|
||||||
|
|
||||||
|
var in inner
|
||||||
|
unmarshaler := NewUnmarshaler(defaultKeyName, WithStringValues())
|
||||||
|
ast := assert.New(t)
|
||||||
|
ast.NotNil(unmarshaler.Unmarshal(m, &in))
|
||||||
|
}
|
||||||
|
|
||||||
func TestUnmarshalWithStringOptionsIncorrect(t *testing.T) {
|
func TestUnmarshalWithStringOptionsIncorrect(t *testing.T) {
|
||||||
type inner struct {
|
type inner struct {
|
||||||
Value string `key:"value,options=first|second"`
|
Value string `key:"value,options=first|second"`
|
||||||
@@ -2518,3 +2597,29 @@ func TestUnmarshalJsonReaderPtrArray(t *testing.T) {
|
|||||||
assert.Nil(t, err)
|
assert.Nil(t, err)
|
||||||
assert.Equal(t, 3, len(res.B))
|
assert.Equal(t, 3, len(res.B))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestUnmarshalJsonWithoutKey(t *testing.T) {
|
||||||
|
payload := `{"A": "1", "B": "2"}`
|
||||||
|
var res struct {
|
||||||
|
A string `json:""`
|
||||||
|
B string `json:","`
|
||||||
|
}
|
||||||
|
reader := strings.NewReader(payload)
|
||||||
|
err := UnmarshalJsonReader(reader, &res)
|
||||||
|
assert.Nil(t, err)
|
||||||
|
assert.Equal(t, "1", res.A)
|
||||||
|
assert.Equal(t, "2", res.B)
|
||||||
|
}
|
||||||
|
|
||||||
|
func BenchmarkDefaultValue(b *testing.B) {
|
||||||
|
for i := 0; i < b.N; i++ {
|
||||||
|
var a struct {
|
||||||
|
Ints []int `json:"ints,default=[1,2,3]"`
|
||||||
|
Strs []string `json:"strs,default=[foo,bar,baz]"`
|
||||||
|
}
|
||||||
|
_ = UnmarshalJsonMap(nil, &a)
|
||||||
|
if len(a.Strs) != 3 || len(a.Ints) != 3 {
|
||||||
|
b.Fatal("failed")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -14,13 +14,19 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
defaultOption = "default"
|
defaultOption = "default"
|
||||||
stringOption = "string"
|
stringOption = "string"
|
||||||
optionalOption = "optional"
|
optionalOption = "optional"
|
||||||
optionsOption = "options"
|
optionsOption = "options"
|
||||||
rangeOption = "range"
|
rangeOption = "range"
|
||||||
optionSeparator = "|"
|
optionSeparator = "|"
|
||||||
equalToken = "="
|
equalToken = "="
|
||||||
|
escapeChar = '\\'
|
||||||
|
leftBracket = '('
|
||||||
|
rightBracket = ')'
|
||||||
|
leftSquareBracket = '['
|
||||||
|
rightSquareBracket = ']'
|
||||||
|
segmentSeparator = ','
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
@@ -118,7 +124,7 @@ func convertType(kind reflect.Kind, str string) (interface{}, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func doParseKeyAndOptions(field reflect.StructField, value string) (string, *fieldOptions, error) {
|
func doParseKeyAndOptions(field reflect.StructField, value string) (string, *fieldOptions, error) {
|
||||||
segments := strings.Split(value, ",")
|
segments := parseSegments(value)
|
||||||
key := strings.TrimSpace(segments[0])
|
key := strings.TrimSpace(segments[0])
|
||||||
options := segments[1:]
|
options := segments[1:]
|
||||||
|
|
||||||
@@ -198,6 +204,16 @@ func maybeNewValue(field reflect.StructField, value reflect.Value) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func parseGroupedSegments(val string) []string {
|
||||||
|
val = strings.TrimLeftFunc(val, func(r rune) bool {
|
||||||
|
return r == leftBracket || r == leftSquareBracket
|
||||||
|
})
|
||||||
|
val = strings.TrimRightFunc(val, func(r rune) bool {
|
||||||
|
return r == rightBracket || r == rightSquareBracket
|
||||||
|
})
|
||||||
|
return parseSegments(val)
|
||||||
|
}
|
||||||
|
|
||||||
// don't modify returned fieldOptions, it's cached and shared among different calls.
|
// don't modify returned fieldOptions, it's cached and shared among different calls.
|
||||||
func parseKeyAndOptions(tagName string, field reflect.StructField) (string, *fieldOptions, error) {
|
func parseKeyAndOptions(tagName string, field reflect.StructField) (string, *fieldOptions, error) {
|
||||||
value := field.Tag.Get(tagName)
|
value := field.Tag.Get(tagName)
|
||||||
@@ -309,7 +325,7 @@ func parseOption(fieldOpts *fieldOptions, fieldName, option string) error {
|
|||||||
return fmt.Errorf("field %s has wrong options", fieldName)
|
return fmt.Errorf("field %s has wrong options", fieldName)
|
||||||
}
|
}
|
||||||
|
|
||||||
fieldOpts.Options = strings.Split(segs[1], optionSeparator)
|
fieldOpts.Options = parseOptions(segs[1])
|
||||||
case strings.HasPrefix(option, defaultOption):
|
case strings.HasPrefix(option, defaultOption):
|
||||||
segs := strings.Split(option, equalToken)
|
segs := strings.Split(option, equalToken)
|
||||||
if len(segs) != 2 {
|
if len(segs) != 2 {
|
||||||
@@ -334,6 +350,69 @@ func parseOption(fieldOpts *fieldOptions, fieldName, option string) error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// parseOptions parses the given options in tag.
|
||||||
|
// for example: `json:"name,options=foo|bar"` or `json:"name,options=[foo,bar]"`
|
||||||
|
func parseOptions(val string) []string {
|
||||||
|
if len(val) == 0 {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
if val[0] == leftSquareBracket {
|
||||||
|
return parseGroupedSegments(val)
|
||||||
|
}
|
||||||
|
|
||||||
|
return strings.Split(val, optionSeparator)
|
||||||
|
}
|
||||||
|
|
||||||
|
func parseSegments(val string) []string {
|
||||||
|
var segments []string
|
||||||
|
var escaped, grouped bool
|
||||||
|
var buf strings.Builder
|
||||||
|
|
||||||
|
for _, ch := range val {
|
||||||
|
if escaped {
|
||||||
|
buf.WriteRune(ch)
|
||||||
|
escaped = false
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
|
switch ch {
|
||||||
|
case segmentSeparator:
|
||||||
|
if grouped {
|
||||||
|
buf.WriteRune(ch)
|
||||||
|
} else {
|
||||||
|
// need to trim spaces, but we cannot ignore empty string,
|
||||||
|
// because the first segment stands for the key might be empty.
|
||||||
|
// if ignored, the later tag will be used as the key.
|
||||||
|
segments = append(segments, strings.TrimSpace(buf.String()))
|
||||||
|
buf.Reset()
|
||||||
|
}
|
||||||
|
case escapeChar:
|
||||||
|
if grouped {
|
||||||
|
buf.WriteRune(ch)
|
||||||
|
} else {
|
||||||
|
escaped = true
|
||||||
|
}
|
||||||
|
case leftBracket, leftSquareBracket:
|
||||||
|
buf.WriteRune(ch)
|
||||||
|
grouped = true
|
||||||
|
case rightBracket, rightSquareBracket:
|
||||||
|
buf.WriteRune(ch)
|
||||||
|
grouped = false
|
||||||
|
default:
|
||||||
|
buf.WriteRune(ch)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
last := strings.TrimSpace(buf.String())
|
||||||
|
// ignore last empty string
|
||||||
|
if len(last) > 0 {
|
||||||
|
segments = append(segments, last)
|
||||||
|
}
|
||||||
|
|
||||||
|
return segments
|
||||||
|
}
|
||||||
|
|
||||||
func reprOfValue(val reflect.Value) string {
|
func reprOfValue(val reflect.Value) string {
|
||||||
switch vt := val.Interface().(type) {
|
switch vt := val.Interface().(type) {
|
||||||
case bool:
|
case bool:
|
||||||
|
|||||||
@@ -90,6 +90,82 @@ func TestParseKeyAndOptionWithTagAndOption(t *testing.T) {
|
|||||||
assert.True(t, options.FromString)
|
assert.True(t, options.FromString)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestParseSegments(t *testing.T) {
|
||||||
|
tests := []struct {
|
||||||
|
input string
|
||||||
|
expect []string
|
||||||
|
}{
|
||||||
|
{
|
||||||
|
input: "",
|
||||||
|
expect: []string{},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
input: ",",
|
||||||
|
expect: []string{""},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
input: "foo,",
|
||||||
|
expect: []string{"foo"},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
input: ",foo",
|
||||||
|
// the first empty string cannot be ignored, it's the key.
|
||||||
|
expect: []string{"", "foo"},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
input: "foo",
|
||||||
|
expect: []string{"foo"},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
input: "foo,bar",
|
||||||
|
expect: []string{"foo", "bar"},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
input: "foo,bar,baz",
|
||||||
|
expect: []string{"foo", "bar", "baz"},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
input: "foo,options=a|b",
|
||||||
|
expect: []string{"foo", "options=a|b"},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
input: "foo,bar,default=[baz,qux]",
|
||||||
|
expect: []string{"foo", "bar", "default=[baz,qux]"},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
input: "foo,bar,options=[baz,qux]",
|
||||||
|
expect: []string{"foo", "bar", "options=[baz,qux]"},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
input: `foo\,bar,options=[baz,qux]`,
|
||||||
|
expect: []string{`foo,bar`, "options=[baz,qux]"},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
input: `foo,bar,options=\[baz,qux]`,
|
||||||
|
expect: []string{"foo", "bar", "options=[baz", "qux]"},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
input: `foo,bar,options=[baz\,qux]`,
|
||||||
|
expect: []string{"foo", "bar", `options=[baz\,qux]`},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
input: `foo\,bar,options=[baz,qux],default=baz`,
|
||||||
|
expect: []string{`foo,bar`, "options=[baz,qux]", "default=baz"},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
input: `foo\,bar,options=[baz,qux, quux],default=[qux, baz]`,
|
||||||
|
expect: []string{`foo,bar`, "options=[baz,qux, quux]", "default=[qux, baz]"},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
for _, test := range tests {
|
||||||
|
test := test
|
||||||
|
t.Run(test.input, func(t *testing.T) {
|
||||||
|
assert.ElementsMatch(t, test.expect, parseSegments(test.input))
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
func TestValidatePtrWithNonPtr(t *testing.T) {
|
func TestValidatePtrWithNonPtr(t *testing.T) {
|
||||||
var foo string
|
var foo string
|
||||||
rve := reflect.ValueOf(foo)
|
rve := reflect.ValueOf(foo)
|
||||||
|
|||||||
@@ -1,13 +1,13 @@
|
|||||||
package mr
|
package mr
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"context"
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"sync"
|
"sync"
|
||||||
|
|
||||||
"github.com/tal-tech/go-zero/core/errorx"
|
"github.com/tal-tech/go-zero/core/errorx"
|
||||||
"github.com/tal-tech/go-zero/core/lang"
|
"github.com/tal-tech/go-zero/core/lang"
|
||||||
"github.com/tal-tech/go-zero/core/syncx"
|
|
||||||
"github.com/tal-tech/go-zero/core/threading"
|
"github.com/tal-tech/go-zero/core/threading"
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -43,6 +43,7 @@ type (
|
|||||||
Option func(opts *mapReduceOptions)
|
Option func(opts *mapReduceOptions)
|
||||||
|
|
||||||
mapReduceOptions struct {
|
mapReduceOptions struct {
|
||||||
|
ctx context.Context
|
||||||
workers int
|
workers int
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -93,16 +94,17 @@ func Map(generate GenerateFunc, mapper MapFunc, opts ...Option) chan interface{}
|
|||||||
options := buildOptions(opts...)
|
options := buildOptions(opts...)
|
||||||
source := buildSource(generate)
|
source := buildSource(generate)
|
||||||
collector := make(chan interface{}, options.workers)
|
collector := make(chan interface{}, options.workers)
|
||||||
done := syncx.NewDoneChan()
|
done := make(chan lang.PlaceholderType)
|
||||||
|
|
||||||
go executeMappers(mapper, source, collector, done.Done(), options.workers)
|
go executeMappers(options.ctx, mapper, source, collector, done, options.workers)
|
||||||
|
|
||||||
return collector
|
return collector
|
||||||
}
|
}
|
||||||
|
|
||||||
// MapReduce maps all elements generated from given generate func,
|
// MapReduce maps all elements generated from given generate func,
|
||||||
// and reduces the output elements with given reducer.
|
// and reduces the output elements with given reducer.
|
||||||
func MapReduce(generate GenerateFunc, mapper MapperFunc, reducer ReducerFunc, opts ...Option) (interface{}, error) {
|
func MapReduce(generate GenerateFunc, mapper MapperFunc, reducer ReducerFunc,
|
||||||
|
opts ...Option) (interface{}, error) {
|
||||||
source := buildSource(generate)
|
source := buildSource(generate)
|
||||||
return MapReduceWithSource(source, mapper, reducer, opts...)
|
return MapReduceWithSource(source, mapper, reducer, opts...)
|
||||||
}
|
}
|
||||||
@@ -119,13 +121,13 @@ func MapReduceWithSource(source <-chan interface{}, mapper MapperFunc, reducer R
|
|||||||
}()
|
}()
|
||||||
|
|
||||||
collector := make(chan interface{}, options.workers)
|
collector := make(chan interface{}, options.workers)
|
||||||
done := syncx.NewDoneChan()
|
done := make(chan lang.PlaceholderType)
|
||||||
writer := newGuardedWriter(output, done.Done())
|
writer := newGuardedWriter(options.ctx, output, done)
|
||||||
var closeOnce sync.Once
|
var closeOnce sync.Once
|
||||||
var retErr errorx.AtomicError
|
var retErr errorx.AtomicError
|
||||||
finish := func() {
|
finish := func() {
|
||||||
closeOnce.Do(func() {
|
closeOnce.Do(func() {
|
||||||
done.Close()
|
close(done)
|
||||||
close(output)
|
close(output)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@@ -154,9 +156,9 @@ func MapReduceWithSource(source <-chan interface{}, mapper MapperFunc, reducer R
|
|||||||
reducer(collector, writer, cancel)
|
reducer(collector, writer, cancel)
|
||||||
}()
|
}()
|
||||||
|
|
||||||
go executeMappers(func(item interface{}, w Writer) {
|
go executeMappers(options.ctx, func(item interface{}, w Writer) {
|
||||||
mapper(item, w, cancel)
|
mapper(item, w, cancel)
|
||||||
}, source, collector, done.Done(), options.workers)
|
}, source, collector, done, options.workers)
|
||||||
|
|
||||||
value, ok := <-output
|
value, ok := <-output
|
||||||
if err := retErr.Load(); err != nil {
|
if err := retErr.Load(); err != nil {
|
||||||
@@ -187,6 +189,13 @@ func MapVoid(generate GenerateFunc, mapper VoidMapFunc, opts ...Option) {
|
|||||||
}, opts...))
|
}, opts...))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// WithContext customizes a mapreduce processing accepts a given ctx.
|
||||||
|
func WithContext(ctx context.Context) Option {
|
||||||
|
return func(opts *mapReduceOptions) {
|
||||||
|
opts.ctx = ctx
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// WithWorkers customizes a mapreduce processing with given workers.
|
// WithWorkers customizes a mapreduce processing with given workers.
|
||||||
func WithWorkers(workers int) Option {
|
func WithWorkers(workers int) Option {
|
||||||
return func(opts *mapReduceOptions) {
|
return func(opts *mapReduceOptions) {
|
||||||
@@ -224,8 +233,8 @@ func drain(channel <-chan interface{}) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func executeMappers(mapper MapFunc, input <-chan interface{}, collector chan<- interface{},
|
func executeMappers(ctx context.Context, mapper MapFunc, input <-chan interface{},
|
||||||
done <-chan lang.PlaceholderType, workers int) {
|
collector chan<- interface{}, done <-chan lang.PlaceholderType, workers int) {
|
||||||
var wg sync.WaitGroup
|
var wg sync.WaitGroup
|
||||||
defer func() {
|
defer func() {
|
||||||
wg.Wait()
|
wg.Wait()
|
||||||
@@ -233,9 +242,11 @@ func executeMappers(mapper MapFunc, input <-chan interface{}, collector chan<- i
|
|||||||
}()
|
}()
|
||||||
|
|
||||||
pool := make(chan lang.PlaceholderType, workers)
|
pool := make(chan lang.PlaceholderType, workers)
|
||||||
writer := newGuardedWriter(collector, done)
|
writer := newGuardedWriter(ctx, collector, done)
|
||||||
for {
|
for {
|
||||||
select {
|
select {
|
||||||
|
case <-ctx.Done():
|
||||||
|
return
|
||||||
case <-done:
|
case <-done:
|
||||||
return
|
return
|
||||||
case pool <- lang.Placeholder:
|
case pool <- lang.Placeholder:
|
||||||
@@ -261,6 +272,7 @@ func executeMappers(mapper MapFunc, input <-chan interface{}, collector chan<- i
|
|||||||
|
|
||||||
func newOptions() *mapReduceOptions {
|
func newOptions() *mapReduceOptions {
|
||||||
return &mapReduceOptions{
|
return &mapReduceOptions{
|
||||||
|
ctx: context.Background(),
|
||||||
workers: defaultWorkers,
|
workers: defaultWorkers,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -275,12 +287,15 @@ func once(fn func(error)) func(error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type guardedWriter struct {
|
type guardedWriter struct {
|
||||||
|
ctx context.Context
|
||||||
channel chan<- interface{}
|
channel chan<- interface{}
|
||||||
done <-chan lang.PlaceholderType
|
done <-chan lang.PlaceholderType
|
||||||
}
|
}
|
||||||
|
|
||||||
func newGuardedWriter(channel chan<- interface{}, done <-chan lang.PlaceholderType) guardedWriter {
|
func newGuardedWriter(ctx context.Context, channel chan<- interface{},
|
||||||
|
done <-chan lang.PlaceholderType) guardedWriter {
|
||||||
return guardedWriter{
|
return guardedWriter{
|
||||||
|
ctx: ctx,
|
||||||
channel: channel,
|
channel: channel,
|
||||||
done: done,
|
done: done,
|
||||||
}
|
}
|
||||||
@@ -288,6 +303,8 @@ func newGuardedWriter(channel chan<- interface{}, done <-chan lang.PlaceholderTy
|
|||||||
|
|
||||||
func (gw guardedWriter) Write(v interface{}) {
|
func (gw guardedWriter) Write(v interface{}) {
|
||||||
select {
|
select {
|
||||||
|
case <-gw.ctx.Done():
|
||||||
|
return
|
||||||
case <-gw.done:
|
case <-gw.done:
|
||||||
return
|
return
|
||||||
default:
|
default:
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
package mr
|
package mr
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"context"
|
||||||
"errors"
|
"errors"
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"log"
|
"log"
|
||||||
@@ -410,6 +411,50 @@ func TestMapReduceWithoutReducerWrite(t *testing.T) {
|
|||||||
assert.Nil(t, res)
|
assert.Nil(t, res)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestMapReduceVoidPanicInReducer(t *testing.T) {
|
||||||
|
const message = "foo"
|
||||||
|
var done syncx.AtomicBool
|
||||||
|
err := MapReduceVoid(func(source chan<- interface{}) {
|
||||||
|
for i := 0; i < defaultWorkers*2; i++ {
|
||||||
|
source <- i
|
||||||
|
}
|
||||||
|
done.Set(true)
|
||||||
|
}, func(item interface{}, writer Writer, cancel func(error)) {
|
||||||
|
i := item.(int)
|
||||||
|
writer.Write(i)
|
||||||
|
}, func(pipe <-chan interface{}, cancel func(error)) {
|
||||||
|
panic(message)
|
||||||
|
}, WithWorkers(1))
|
||||||
|
assert.NotNil(t, err)
|
||||||
|
assert.Equal(t, message, err.Error())
|
||||||
|
assert.True(t, done.True())
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestMapReduceWithContext(t *testing.T) {
|
||||||
|
var done syncx.AtomicBool
|
||||||
|
var result []int
|
||||||
|
ctx, cancel := context.WithCancel(context.Background())
|
||||||
|
err := MapReduceVoid(func(source chan<- interface{}) {
|
||||||
|
for i := 0; i < defaultWorkers*2; i++ {
|
||||||
|
source <- i
|
||||||
|
}
|
||||||
|
done.Set(true)
|
||||||
|
}, func(item interface{}, writer Writer, c func(error)) {
|
||||||
|
i := item.(int)
|
||||||
|
if i == defaultWorkers/2 {
|
||||||
|
cancel()
|
||||||
|
}
|
||||||
|
writer.Write(i)
|
||||||
|
}, func(pipe <-chan interface{}, cancel func(error)) {
|
||||||
|
for item := range pipe {
|
||||||
|
i := item.(int)
|
||||||
|
result = append(result, i)
|
||||||
|
}
|
||||||
|
}, WithContext(ctx))
|
||||||
|
assert.NotNil(t, err)
|
||||||
|
assert.Equal(t, ErrReduceNoOutput, err)
|
||||||
|
}
|
||||||
|
|
||||||
func BenchmarkMapReduce(b *testing.B) {
|
func BenchmarkMapReduce(b *testing.B) {
|
||||||
b.ReportAllocs()
|
b.ReportAllocs()
|
||||||
|
|
||||||
|
|||||||
89
core/mr/readme-cn.md
Normal file
89
core/mr/readme-cn.md
Normal file
@@ -0,0 +1,89 @@
|
|||||||
|
# mapreduce
|
||||||
|
|
||||||
|
[English](readme.md) | 简体中文
|
||||||
|
|
||||||
|
## 为什么需要 MapReduce
|
||||||
|
|
||||||
|
在实际的业务场景中我们常常需要从不同的 rpc 服务中获取相应属性来组装成复杂对象。
|
||||||
|
|
||||||
|
比如要查询商品详情:
|
||||||
|
|
||||||
|
1. 商品服务-查询商品属性
|
||||||
|
2. 库存服务-查询库存属性
|
||||||
|
3. 价格服务-查询价格属性
|
||||||
|
4. 营销服务-查询营销属性
|
||||||
|
|
||||||
|
如果是串行调用的话响应时间会随着 rpc 调用次数呈线性增长,所以我们要优化性能一般会将串行改并行。
|
||||||
|
|
||||||
|
简单的场景下使用 `WaitGroup` 也能够满足需求,但是如果我们需要对 rpc 调用返回的数据进行校验、数据加工转换、数据汇总呢?继续使用 `WaitGroup` 就有点力不从心了,go 的官方库中并没有这种工具(java 中提供了 CompleteFuture),我们依据 MapReduce 架构思想实现了进程内的数据批处理 MapReduce 并发工具类。
|
||||||
|
|
||||||
|
## 设计思路
|
||||||
|
|
||||||
|
我们尝试把自己代入到作者的角色梳理一下并发工具可能的业务场景:
|
||||||
|
|
||||||
|
1. 查询商品详情:支持并发调用多个服务来组合产品属性,支持调用错误可以立即结束。
|
||||||
|
2. 商品详情页自动推荐用户卡券:支持并发校验卡券,校验失败自动剔除,返回全部卡券。
|
||||||
|
|
||||||
|
以上实际都是在进行对输入数据进行处理最后输出清洗后的数据,针对数据处理有个非常经典的异步模式:生产者消费者模式。于是我们可以抽象一下数据批处理的生命周期,大致可以分为三个阶段:
|
||||||
|
|
||||||
|
<img src="https://raw.githubusercontent.com/zeromicro/zero-doc/main/doc/images/mapreduce-serial-cn.png" width="500">
|
||||||
|
|
||||||
|
1. 数据生产 generate
|
||||||
|
2. 数据加工 mapper
|
||||||
|
3. 数据聚合 reducer
|
||||||
|
|
||||||
|
其中数据生产是不可或缺的阶段,数据加工、数据聚合是可选阶段,数据生产与加工支持并发调用,数据聚合基本属于纯内存操作单协程即可。
|
||||||
|
|
||||||
|
再来思考一下不同阶段之间数据应该如何流转,既然不同阶段的数据处理都是由不同 goroutine 执行的,那么很自然的可以考虑采用 channel 来实现 goroutine 之间的通信。
|
||||||
|
|
||||||
|
<img src="https://raw.githubusercontent.com/zeromicro/zero-doc/main/doc/images/mapreduce-cn.png" width="500">
|
||||||
|
|
||||||
|
|
||||||
|
如何实现随时终止流程呢?
|
||||||
|
|
||||||
|
`goroutine` 中监听一个全局的结束 `channel` 和调用方提供的 `ctx` 就行。
|
||||||
|
|
||||||
|
## 简单示例
|
||||||
|
|
||||||
|
并行求平方和(不要嫌弃示例简单,只是模拟并发)
|
||||||
|
|
||||||
|
```go
|
||||||
|
package main
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
"log"
|
||||||
|
|
||||||
|
"github.com/tal-tech/go-zero/core/mr"
|
||||||
|
)
|
||||||
|
|
||||||
|
func main() {
|
||||||
|
val, err := mr.MapReduce(func(source chan<- interface{}) {
|
||||||
|
// generator
|
||||||
|
for i := 0; i < 10; i++ {
|
||||||
|
source <- i
|
||||||
|
}
|
||||||
|
}, func(item interface{}, writer mr.Writer, cancel func(error)) {
|
||||||
|
// mapper
|
||||||
|
i := item.(int)
|
||||||
|
writer.Write(i * i)
|
||||||
|
}, func(pipe <-chan interface{}, writer mr.Writer, cancel func(error)) {
|
||||||
|
// reducer
|
||||||
|
var sum int
|
||||||
|
for i := range pipe {
|
||||||
|
sum += i.(int)
|
||||||
|
}
|
||||||
|
writer.Write(sum)
|
||||||
|
})
|
||||||
|
if err != nil {
|
||||||
|
log.Fatal(err)
|
||||||
|
}
|
||||||
|
fmt.Println("result:", val)
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
更多示例:[https://github.com/zeromicro/zero-examples/tree/main/mapreduce](https://github.com/zeromicro/zero-examples/tree/main/mapreduce)
|
||||||
|
|
||||||
|
## 欢迎 star!⭐
|
||||||
|
|
||||||
|
如果你正在使用或者觉得这个项目对你有帮助,请 **star** 支持,感谢!
|
||||||
90
core/mr/readme.md
Normal file
90
core/mr/readme.md
Normal file
@@ -0,0 +1,90 @@
|
|||||||
|
<img align="right" width="150px" src="https://raw.githubusercontent.com/zeromicro/zero-doc/main/doc/images/go-zero.png">
|
||||||
|
|
||||||
|
# mapreduce
|
||||||
|
|
||||||
|
English | [简体中文](readme-cn.md)
|
||||||
|
|
||||||
|
## Why MapReduce is needed
|
||||||
|
|
||||||
|
In practical business scenarios we often need to get the corresponding properties from different rpc services to assemble complex objects.
|
||||||
|
|
||||||
|
For example, to query product details.
|
||||||
|
|
||||||
|
1. product service - query product attributes
|
||||||
|
2. inventory service - query inventory properties
|
||||||
|
3. price service - query price attributes
|
||||||
|
4. marketing service - query marketing properties
|
||||||
|
|
||||||
|
If it is a serial call, the response time will increase linearly with the number of rpc calls, so we will generally change serial to parallel to optimize response time.
|
||||||
|
|
||||||
|
Simple scenarios using `WaitGroup` can also meet the needs, but what if we need to check the data returned by the rpc call, data processing, data aggregation? The official go library does not have such a tool (CompleteFuture is provided in java), so we implemented an in-process data batching MapReduce concurrent tool based on the MapReduce architecture.
|
||||||
|
|
||||||
|
## Design ideas
|
||||||
|
|
||||||
|
Let's try to put ourselves in the author's shoes and sort out the possible business scenarios for the concurrency tool:
|
||||||
|
|
||||||
|
1. querying product details: supporting concurrent calls to multiple services to combine product attributes, and supporting call errors that can be ended immediately.
|
||||||
|
2. automatic recommendation of user card coupons on product details page: support concurrently verifying card coupons, automatically rejecting them if they fail, and returning all of them.
|
||||||
|
|
||||||
|
The above is actually processing the input data and finally outputting the cleaned data. There is a very classic asynchronous pattern for data processing: the producer-consumer pattern. So we can abstract the life cycle of data batch processing, which can be roughly divided into three phases.
|
||||||
|
|
||||||
|
<img src="https://raw.githubusercontent.com/zeromicro/zero-doc/main/doc/images/mapreduce-serial-en.png" width="500">
|
||||||
|
|
||||||
|
1. data production generate
|
||||||
|
2. data processing mapper
|
||||||
|
3. data aggregation reducer
|
||||||
|
|
||||||
|
Data producing is an indispensable stage, data processing and data aggregation are optional stages, data producing and processing support concurrent calls, data aggregation is basically a pure memory operation, so a single concurrent process can do it.
|
||||||
|
|
||||||
|
Since different stages of data processing are performed by different goroutines, it is natural to consider the use of channel to achieve communication between goroutines.
|
||||||
|
|
||||||
|
<img src="https://raw.githubusercontent.com/zeromicro/zero-doc/main/doc/images/mapreduce-en.png" width="500">
|
||||||
|
|
||||||
|
How can I terminate the process at any time?
|
||||||
|
|
||||||
|
It's simple, just receive from a channel or the given context in the goroutine.
|
||||||
|
|
||||||
|
## A simple example
|
||||||
|
|
||||||
|
Calculate the sum of squares, simulating the concurrency.
|
||||||
|
|
||||||
|
```go
|
||||||
|
package main
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
"log"
|
||||||
|
|
||||||
|
"github.com/tal-tech/go-zero/core/mr"
|
||||||
|
)
|
||||||
|
|
||||||
|
func main() {
|
||||||
|
val, err := mr.MapReduce(func(source chan<- interface{}) {
|
||||||
|
// generator
|
||||||
|
for i := 0; i < 10; i++ {
|
||||||
|
source <- i
|
||||||
|
}
|
||||||
|
}, func(item interface{}, writer mr.Writer, cancel func(error)) {
|
||||||
|
// mapper
|
||||||
|
i := item.(int)
|
||||||
|
writer.Write(i * i)
|
||||||
|
}, func(pipe <-chan interface{}, writer mr.Writer, cancel func(error)) {
|
||||||
|
// reducer
|
||||||
|
var sum int
|
||||||
|
for i := range pipe {
|
||||||
|
sum += i.(int)
|
||||||
|
}
|
||||||
|
writer.Write(sum)
|
||||||
|
})
|
||||||
|
if err != nil {
|
||||||
|
log.Fatal(err)
|
||||||
|
}
|
||||||
|
fmt.Println("result:", val)
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
More examples: [https://github.com/zeromicro/zero-examples/tree/main/mapreduce](https://github.com/zeromicro/zero-examples/tree/main/mapreduce)
|
||||||
|
|
||||||
|
## Give a Star! ⭐
|
||||||
|
|
||||||
|
If you like or are using this project to learn or start your solution, please give it a star. Thanks!
|
||||||
@@ -11,6 +11,7 @@ import (
|
|||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/tal-tech/go-zero/core/logx"
|
"github.com/tal-tech/go-zero/core/logx"
|
||||||
|
"github.com/tal-tech/go-zero/core/threading"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
@@ -46,10 +47,10 @@ func gracefulStop(signals chan os.Signal) {
|
|||||||
signal.Stop(signals)
|
signal.Stop(signals)
|
||||||
|
|
||||||
logx.Info("Got signal SIGTERM, shutting down...")
|
logx.Info("Got signal SIGTERM, shutting down...")
|
||||||
wrapUpListeners.notifyListeners()
|
go wrapUpListeners.notifyListeners()
|
||||||
|
|
||||||
time.Sleep(wrapUpTime)
|
time.Sleep(wrapUpTime)
|
||||||
shutdownListeners.notifyListeners()
|
go shutdownListeners.notifyListeners()
|
||||||
|
|
||||||
time.Sleep(delayTimeBeforeForceQuit - wrapUpTime)
|
time.Sleep(delayTimeBeforeForceQuit - wrapUpTime)
|
||||||
logx.Infof("Still alive after %v, going to force kill the process...", delayTimeBeforeForceQuit)
|
logx.Infof("Still alive after %v, going to force kill the process...", delayTimeBeforeForceQuit)
|
||||||
@@ -81,7 +82,9 @@ func (lm *listenerManager) notifyListeners() {
|
|||||||
lm.lock.Lock()
|
lm.lock.Lock()
|
||||||
defer lm.lock.Unlock()
|
defer lm.lock.Unlock()
|
||||||
|
|
||||||
|
group := threading.NewRoutineGroup()
|
||||||
for _, listener := range lm.listeners {
|
for _, listener := range lm.listeners {
|
||||||
listener()
|
group.RunSafe(listener)
|
||||||
}
|
}
|
||||||
|
group.Wait()
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,9 +1,12 @@
|
|||||||
package search
|
package search
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"math/rand"
|
||||||
|
"strings"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/stretchr/testify/assert"
|
"github.com/stretchr/testify/assert"
|
||||||
|
"github.com/tal-tech/go-zero/core/stringx"
|
||||||
)
|
)
|
||||||
|
|
||||||
type mockedRoute struct {
|
type mockedRoute struct {
|
||||||
@@ -139,11 +142,9 @@ func TestStrictSearchSibling(t *testing.T) {
|
|||||||
tree.Add(r.route, r.value)
|
tree.Add(r.route, r.value)
|
||||||
}
|
}
|
||||||
|
|
||||||
for i := 0; i < 1000; i++ {
|
result, ok := tree.Search(query)
|
||||||
result, ok := tree.Search(query)
|
assert.True(t, ok)
|
||||||
assert.True(t, ok)
|
assert.Equal(t, 3, result.Item.(int))
|
||||||
assert.Equal(t, 3, result.Item.(int))
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestAddDuplicate(t *testing.T) {
|
func TestAddDuplicate(t *testing.T) {
|
||||||
@@ -185,3 +186,41 @@ func TestSearchInvalidItem(t *testing.T) {
|
|||||||
err := tree.Add("/", nil)
|
err := tree.Add("/", nil)
|
||||||
assert.Equal(t, errEmptyItem, err)
|
assert.Equal(t, errEmptyItem, err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func BenchmarkSearchTree(b *testing.B) {
|
||||||
|
const (
|
||||||
|
avgLen = 1000
|
||||||
|
entries = 10000
|
||||||
|
)
|
||||||
|
|
||||||
|
tree := NewTree()
|
||||||
|
generate := func() string {
|
||||||
|
var buf strings.Builder
|
||||||
|
size := rand.Intn(avgLen) + avgLen/2
|
||||||
|
val := stringx.Randn(size)
|
||||||
|
prev := 0
|
||||||
|
for j := rand.Intn(9) + 1; j < size; j += rand.Intn(9) + 1 {
|
||||||
|
buf.WriteRune('/')
|
||||||
|
buf.WriteString(val[prev:j])
|
||||||
|
prev = j
|
||||||
|
}
|
||||||
|
if prev < size {
|
||||||
|
buf.WriteRune('/')
|
||||||
|
buf.WriteString(val[prev:])
|
||||||
|
}
|
||||||
|
return buf.String()
|
||||||
|
}
|
||||||
|
index := rand.Intn(entries)
|
||||||
|
var query string
|
||||||
|
for i := 0; i < entries; i++ {
|
||||||
|
val := generate()
|
||||||
|
if i == index {
|
||||||
|
query = val
|
||||||
|
}
|
||||||
|
tree.Add(val, i)
|
||||||
|
}
|
||||||
|
|
||||||
|
for i := 0; i < b.N; i++ {
|
||||||
|
tree.Search(query)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
2
core/stores/cache/cachenode_test.go
vendored
2
core/stores/cache/cachenode_test.go
vendored
@@ -53,8 +53,8 @@ func TestCacheNode_DelCache(t *testing.T) {
|
|||||||
func TestCacheNode_DelCacheWithErrors(t *testing.T) {
|
func TestCacheNode_DelCacheWithErrors(t *testing.T) {
|
||||||
store, clean, err := redistest.CreateRedis()
|
store, clean, err := redistest.CreateRedis()
|
||||||
assert.Nil(t, err)
|
assert.Nil(t, err)
|
||||||
|
defer clean()
|
||||||
store.Type = redis.ClusterType
|
store.Type = redis.ClusterType
|
||||||
clean()
|
|
||||||
|
|
||||||
cn := cacheNode{
|
cn := cacheNode{
|
||||||
rds: store,
|
rds: store,
|
||||||
|
|||||||
@@ -16,6 +16,8 @@ var ErrNoRedisNode = errors.New("no redis node")
|
|||||||
type (
|
type (
|
||||||
// Store interface represents a KV store.
|
// Store interface represents a KV store.
|
||||||
Store interface {
|
Store interface {
|
||||||
|
Decr(key string) (int64, error)
|
||||||
|
Decrby(key string, increment int64) (int64, error)
|
||||||
Del(keys ...string) (int, error)
|
Del(keys ...string) (int, error)
|
||||||
Eval(script, key string, args ...interface{}) (interface{}, error)
|
Eval(script, key string, args ...interface{}) (interface{}, error)
|
||||||
Exists(key string) (bool, error)
|
Exists(key string) (bool, error)
|
||||||
@@ -36,6 +38,7 @@ type (
|
|||||||
Hvals(key string) ([]string, error)
|
Hvals(key string) ([]string, error)
|
||||||
Incr(key string) (int64, error)
|
Incr(key string) (int64, error)
|
||||||
Incrby(key string, increment int64) (int64, error)
|
Incrby(key string, increment int64) (int64, error)
|
||||||
|
Lindex(key string, index int64) (string, error)
|
||||||
Llen(key string) (int, error)
|
Llen(key string) (int, error)
|
||||||
Lpop(key string) (string, error)
|
Lpop(key string) (string, error)
|
||||||
Lpush(key string, values ...interface{}) (int, error)
|
Lpush(key string, values ...interface{}) (int, error)
|
||||||
@@ -102,6 +105,24 @@ func NewStore(c KvConf) Store {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (cs clusterStore) Decr(key string) (int64, error) {
|
||||||
|
node, err := cs.getRedis(key)
|
||||||
|
if err != nil {
|
||||||
|
return 0, err
|
||||||
|
}
|
||||||
|
|
||||||
|
return node.Decr(key)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (cs clusterStore) Decrby(key string, increment int64) (int64, error) {
|
||||||
|
node, err := cs.getRedis(key)
|
||||||
|
if err != nil {
|
||||||
|
return 0, err
|
||||||
|
}
|
||||||
|
|
||||||
|
return node.Decrby(key, increment)
|
||||||
|
}
|
||||||
|
|
||||||
func (cs clusterStore) Del(keys ...string) (int, error) {
|
func (cs clusterStore) Del(keys ...string) (int, error) {
|
||||||
var val int
|
var val int
|
||||||
var be errorx.BatchError
|
var be errorx.BatchError
|
||||||
@@ -303,6 +324,15 @@ func (cs clusterStore) Llen(key string) (int, error) {
|
|||||||
return node.Llen(key)
|
return node.Llen(key)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (cs clusterStore) Lindex(key string, index int64) (string, error) {
|
||||||
|
node, err := cs.getRedis(key)
|
||||||
|
if err != nil {
|
||||||
|
return "", err
|
||||||
|
}
|
||||||
|
|
||||||
|
return node.Lindex(key, index)
|
||||||
|
}
|
||||||
|
|
||||||
func (cs clusterStore) Lpop(key string) (string, error) {
|
func (cs clusterStore) Lpop(key string) (string, error) {
|
||||||
node, err := cs.getRedis(key)
|
node, err := cs.getRedis(key)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|||||||
@@ -17,6 +17,36 @@ var (
|
|||||||
s2, _ = miniredis.Run()
|
s2, _ = miniredis.Run()
|
||||||
)
|
)
|
||||||
|
|
||||||
|
func TestRedis_Decr(t *testing.T) {
|
||||||
|
store := clusterStore{dispatcher: hash.NewConsistentHash()}
|
||||||
|
_, err := store.Decr("a")
|
||||||
|
assert.NotNil(t, err)
|
||||||
|
|
||||||
|
runOnCluster(t, func(client Store) {
|
||||||
|
val, err := client.Decr("a")
|
||||||
|
assert.Nil(t, err)
|
||||||
|
assert.Equal(t, int64(-1), val)
|
||||||
|
val, err = client.Decr("a")
|
||||||
|
assert.Nil(t, err)
|
||||||
|
assert.Equal(t, int64(-2), val)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestRedis_DecrBy(t *testing.T) {
|
||||||
|
store := clusterStore{dispatcher: hash.NewConsistentHash()}
|
||||||
|
_, err := store.Incrby("a", 2)
|
||||||
|
assert.NotNil(t, err)
|
||||||
|
|
||||||
|
runOnCluster(t, func(client Store) {
|
||||||
|
val, err := client.Decrby("a", 2)
|
||||||
|
assert.Nil(t, err)
|
||||||
|
assert.Equal(t, int64(-2), val)
|
||||||
|
val, err = client.Decrby("a", 3)
|
||||||
|
assert.Nil(t, err)
|
||||||
|
assert.Equal(t, int64(-5), val)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
func TestRedis_Exists(t *testing.T) {
|
func TestRedis_Exists(t *testing.T) {
|
||||||
store := clusterStore{dispatcher: hash.NewConsistentHash()}
|
store := clusterStore{dispatcher: hash.NewConsistentHash()}
|
||||||
_, err := store.Exists("foo")
|
_, err := store.Exists("foo")
|
||||||
@@ -234,6 +264,8 @@ func TestRedis_List(t *testing.T) {
|
|||||||
assert.NotNil(t, err)
|
assert.NotNil(t, err)
|
||||||
_, err = store.Lrem("key", 0, "val")
|
_, err = store.Lrem("key", 0, "val")
|
||||||
assert.NotNil(t, err)
|
assert.NotNil(t, err)
|
||||||
|
_, err = store.Lindex("key", 0)
|
||||||
|
assert.NotNil(t, err)
|
||||||
|
|
||||||
runOnCluster(t, func(client Store) {
|
runOnCluster(t, func(client Store) {
|
||||||
val, err := client.Lpush("key", "value1", "value2")
|
val, err := client.Lpush("key", "value1", "value2")
|
||||||
@@ -245,6 +277,9 @@ func TestRedis_List(t *testing.T) {
|
|||||||
val, err = client.Llen("key")
|
val, err = client.Llen("key")
|
||||||
assert.Nil(t, err)
|
assert.Nil(t, err)
|
||||||
assert.Equal(t, 4, val)
|
assert.Equal(t, 4, val)
|
||||||
|
value, err := client.Lindex("key", 0)
|
||||||
|
assert.Nil(t, err)
|
||||||
|
assert.Equal(t, "value2", value)
|
||||||
vals, err := client.Lrange("key", 0, 10)
|
vals, err := client.Lrange("key", 0, 10)
|
||||||
assert.Nil(t, err)
|
assert.Nil(t, err)
|
||||||
assert.EqualValues(t, []string{"value2", "value1", "value3", "value4"}, vals)
|
assert.EqualValues(t, []string{"value2", "value1", "value3", "value4"}, vals)
|
||||||
|
|||||||
@@ -36,20 +36,23 @@ func MustNewModel(url, collection string, c cache.CacheConf, opts ...cache.Optio
|
|||||||
return model
|
return model
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewNodeModel returns a Model with a cache node.
|
// NewModel returns a Model with a cache cluster.
|
||||||
func NewNodeModel(url, collection string, rds *redis.Redis, opts ...cache.Option) (*Model, error) {
|
func NewModel(url, collection string, conf cache.CacheConf, opts ...cache.Option) (*Model, error) {
|
||||||
c := cache.NewNode(rds, sharedCalls, stats, mgo.ErrNotFound, opts...)
|
c := cache.New(conf, sharedCalls, stats, mgo.ErrNotFound, opts...)
|
||||||
|
return NewModelWithCache(url, collection, c)
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewModelWithCache returns a Model with a custom cache.
|
||||||
|
func NewModelWithCache(url, collection string, c cache.Cache) (*Model, error) {
|
||||||
return createModel(url, collection, c, func(collection mongo.Collection) CachedCollection {
|
return createModel(url, collection, c, func(collection mongo.Collection) CachedCollection {
|
||||||
return newCollection(collection, c)
|
return newCollection(collection, c)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewModel returns a Model with a cache cluster.
|
// NewNodeModel returns a Model with a cache node.
|
||||||
func NewModel(url, collection string, conf cache.CacheConf, opts ...cache.Option) (*Model, error) {
|
func NewNodeModel(url, collection string, rds *redis.Redis, opts ...cache.Option) (*Model, error) {
|
||||||
c := cache.New(conf, sharedCalls, stats, mgo.ErrNotFound, opts...)
|
c := cache.NewNode(rds, sharedCalls, stats, mgo.ErrNotFound, opts...)
|
||||||
return createModel(url, collection, c, func(collection mongo.Collection) CachedCollection {
|
return NewModelWithCache(url, collection, c)
|
||||||
return newCollection(collection, c)
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Count returns the count of given query.
|
// Count returns the count of given query.
|
||||||
|
|||||||
@@ -238,6 +238,36 @@ func (s *Redis) BlpopEx(redisNode RedisNode, key string) (string, bool, error) {
|
|||||||
return vals[1], true, nil
|
return vals[1], true, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Decr is the implementation of redis decr command.
|
||||||
|
func (s *Redis) Decr(key string) (val int64, err error) {
|
||||||
|
err = s.brk.DoWithAcceptable(func() error {
|
||||||
|
conn, err := getRedis(s)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
val, err = conn.Decr(key).Result()
|
||||||
|
return err
|
||||||
|
}, acceptable)
|
||||||
|
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// Decrby is the implementation of redis decrby command.
|
||||||
|
func (s *Redis) Decrby(key string, increment int64) (val int64, err error) {
|
||||||
|
err = s.brk.DoWithAcceptable(func() error {
|
||||||
|
conn, err := getRedis(s)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
val, err = conn.DecrBy(key, increment).Result()
|
||||||
|
return err
|
||||||
|
}, acceptable)
|
||||||
|
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
// Del deletes keys.
|
// Del deletes keys.
|
||||||
func (s *Redis) Del(keys ...string) (val int, err error) {
|
func (s *Redis) Del(keys ...string) (val int, err error) {
|
||||||
err = s.brk.DoWithAcceptable(func() error {
|
err = s.brk.DoWithAcceptable(func() error {
|
||||||
@@ -765,6 +795,21 @@ func (s *Redis) Llen(key string) (val int, err error) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Lindex is the implementation of redis lindex command.
|
||||||
|
func (s *Redis) Lindex(key string, index int64) (val string, err error) {
|
||||||
|
err = s.brk.DoWithAcceptable(func() error {
|
||||||
|
conn, err := getRedis(s)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
val, err = conn.LIndex(key, index).Result()
|
||||||
|
return err
|
||||||
|
}, acceptable)
|
||||||
|
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
// Lpop is the implementation of redis lpop command.
|
// Lpop is the implementation of redis lpop command.
|
||||||
func (s *Redis) Lpop(key string) (val string, err error) {
|
func (s *Redis) Lpop(key string) (val string, err error) {
|
||||||
err = s.brk.DoWithAcceptable(func() error {
|
err = s.brk.DoWithAcceptable(func() error {
|
||||||
|
|||||||
@@ -14,6 +14,32 @@ import (
|
|||||||
"github.com/tal-tech/go-zero/core/stringx"
|
"github.com/tal-tech/go-zero/core/stringx"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
func TestRedis_Decr(t *testing.T) {
|
||||||
|
runOnRedis(t, func(client *Redis) {
|
||||||
|
_, err := New(client.Addr, badType()).Decr("a")
|
||||||
|
assert.NotNil(t, err)
|
||||||
|
val, err := client.Decr("a")
|
||||||
|
assert.Nil(t, err)
|
||||||
|
assert.Equal(t, int64(-1), val)
|
||||||
|
val, err = client.Decr("a")
|
||||||
|
assert.Nil(t, err)
|
||||||
|
assert.Equal(t, int64(-2), val)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestRedis_DecrBy(t *testing.T) {
|
||||||
|
runOnRedis(t, func(client *Redis) {
|
||||||
|
_, err := New(client.Addr, badType()).Decrby("a", 2)
|
||||||
|
assert.NotNil(t, err)
|
||||||
|
val, err := client.Decrby("a", 2)
|
||||||
|
assert.Nil(t, err)
|
||||||
|
assert.Equal(t, int64(-2), val)
|
||||||
|
val, err = client.Decrby("a", 3)
|
||||||
|
assert.Nil(t, err)
|
||||||
|
assert.Equal(t, int64(-5), val)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
func TestRedis_Exists(t *testing.T) {
|
func TestRedis_Exists(t *testing.T) {
|
||||||
runOnRedis(t, func(client *Redis) {
|
runOnRedis(t, func(client *Redis) {
|
||||||
_, err := New(client.Addr, badType()).Exists("a")
|
_, err := New(client.Addr, badType()).Exists("a")
|
||||||
@@ -295,6 +321,11 @@ func TestRedis_List(t *testing.T) {
|
|||||||
val, err = client.Llen("key")
|
val, err = client.Llen("key")
|
||||||
assert.Nil(t, err)
|
assert.Nil(t, err)
|
||||||
assert.Equal(t, 4, val)
|
assert.Equal(t, 4, val)
|
||||||
|
_, err = New(client.Addr, badType()).Lindex("key", 1)
|
||||||
|
assert.NotNil(t, err)
|
||||||
|
value, err := client.Lindex("key", 0)
|
||||||
|
assert.Nil(t, err)
|
||||||
|
assert.Equal(t, "value2", value)
|
||||||
vals, err := client.Lrange("key", 0, 10)
|
vals, err := client.Lrange("key", 0, 10)
|
||||||
assert.Nil(t, err)
|
assert.Nil(t, err)
|
||||||
assert.EqualValues(t, []string{"value2", "value1", "value3", "value4"}, vals)
|
assert.EqualValues(t, []string{"value2", "value1", "value3", "value4"}, vals)
|
||||||
|
|||||||
@@ -2,7 +2,6 @@ package redis
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"math/rand"
|
"math/rand"
|
||||||
"strconv"
|
|
||||||
"sync/atomic"
|
"sync/atomic"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
@@ -12,26 +11,19 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
lockCommand = `if redis.call("GET", KEYS[1]) == ARGV[1] then
|
|
||||||
redis.call("SET", KEYS[1], ARGV[1], "PX", ARGV[2])
|
|
||||||
return "OK"
|
|
||||||
else
|
|
||||||
return redis.call("SET", KEYS[1], ARGV[1], "NX", "PX", ARGV[2])
|
|
||||||
end`
|
|
||||||
delCommand = `if redis.call("GET", KEYS[1]) == ARGV[1] then
|
delCommand = `if redis.call("GET", KEYS[1]) == ARGV[1] then
|
||||||
return redis.call("DEL", KEYS[1])
|
return redis.call("DEL", KEYS[1])
|
||||||
else
|
else
|
||||||
return 0
|
return 0
|
||||||
end`
|
end`
|
||||||
randomLen = 16
|
randomLen = 16
|
||||||
tolerance = 500 // milliseconds
|
|
||||||
millisPerSecond = 1000
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// A RedisLock is a redis lock.
|
// A RedisLock is a redis lock.
|
||||||
type RedisLock struct {
|
type RedisLock struct {
|
||||||
store *Redis
|
store *Redis
|
||||||
seconds uint32
|
seconds uint32
|
||||||
|
count int32
|
||||||
key string
|
key string
|
||||||
id string
|
id string
|
||||||
}
|
}
|
||||||
@@ -51,30 +43,35 @@ func NewRedisLock(store *Redis, key string) *RedisLock {
|
|||||||
|
|
||||||
// Acquire acquires the lock.
|
// Acquire acquires the lock.
|
||||||
func (rl *RedisLock) Acquire() (bool, error) {
|
func (rl *RedisLock) Acquire() (bool, error) {
|
||||||
seconds := atomic.LoadUint32(&rl.seconds)
|
newCount := atomic.AddInt32(&rl.count, 1)
|
||||||
resp, err := rl.store.Eval(lockCommand, []string{rl.key}, []string{
|
if newCount > 1 {
|
||||||
rl.id, strconv.Itoa(int(seconds)*millisPerSecond + tolerance),
|
|
||||||
})
|
|
||||||
if err == red.Nil {
|
|
||||||
return false, nil
|
|
||||||
} else if err != nil {
|
|
||||||
logx.Errorf("Error on acquiring lock for %s, %s", rl.key, err.Error())
|
|
||||||
return false, err
|
|
||||||
} else if resp == nil {
|
|
||||||
return false, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
reply, ok := resp.(string)
|
|
||||||
if ok && reply == "OK" {
|
|
||||||
return true, nil
|
return true, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
logx.Errorf("Unknown reply when acquiring lock for %s: %v", rl.key, resp)
|
seconds := atomic.LoadUint32(&rl.seconds)
|
||||||
return false, nil
|
ok, err := rl.store.SetnxEx(rl.key, rl.id, int(seconds+1)) // +1s for tolerance
|
||||||
|
if err == red.Nil {
|
||||||
|
atomic.AddInt32(&rl.count, -1)
|
||||||
|
return false, nil
|
||||||
|
} else if err != nil {
|
||||||
|
atomic.AddInt32(&rl.count, -1)
|
||||||
|
logx.Errorf("Error on acquiring lock for %s, %s", rl.key, err.Error())
|
||||||
|
return false, err
|
||||||
|
} else if !ok {
|
||||||
|
atomic.AddInt32(&rl.count, -1)
|
||||||
|
return false, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
return true, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// Release releases the lock.
|
// Release releases the lock.
|
||||||
func (rl *RedisLock) Release() (bool, error) {
|
func (rl *RedisLock) Release() (bool, error) {
|
||||||
|
newCount := atomic.AddInt32(&rl.count, -1)
|
||||||
|
if newCount > 0 {
|
||||||
|
return true, nil
|
||||||
|
}
|
||||||
|
|
||||||
resp, err := rl.store.Eval(delCommand, []string{rl.key}, []string{rl.id})
|
resp, err := rl.store.Eval(delCommand, []string{rl.key}, []string{rl.id})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return false, err
|
return false, err
|
||||||
@@ -88,7 +85,7 @@ func (rl *RedisLock) Release() (bool, error) {
|
|||||||
return reply == 1, nil
|
return reply == 1, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// SetExpire sets the expire.
|
// SetExpire sets the expiration.
|
||||||
func (rl *RedisLock) SetExpire(seconds int) {
|
func (rl *RedisLock) SetExpire(seconds int) {
|
||||||
atomic.StoreUint32(&rl.seconds, uint32(seconds))
|
atomic.StoreUint32(&rl.seconds, uint32(seconds))
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -29,5 +29,25 @@ func TestRedisLock(t *testing.T) {
|
|||||||
endAcquire, err := secondLock.Acquire()
|
endAcquire, err := secondLock.Acquire()
|
||||||
assert.Nil(t, err)
|
assert.Nil(t, err)
|
||||||
assert.True(t, endAcquire)
|
assert.True(t, endAcquire)
|
||||||
|
|
||||||
|
endAcquire, err = secondLock.Acquire()
|
||||||
|
assert.Nil(t, err)
|
||||||
|
assert.True(t, endAcquire)
|
||||||
|
|
||||||
|
release, err = secondLock.Release()
|
||||||
|
assert.Nil(t, err)
|
||||||
|
assert.True(t, release)
|
||||||
|
|
||||||
|
againAcquire, err = firstLock.Acquire()
|
||||||
|
assert.Nil(t, err)
|
||||||
|
assert.False(t, againAcquire)
|
||||||
|
|
||||||
|
release, err = secondLock.Release()
|
||||||
|
assert.Nil(t, err)
|
||||||
|
assert.True(t, release)
|
||||||
|
|
||||||
|
firstAcquire, err = firstLock.Acquire()
|
||||||
|
assert.Nil(t, err)
|
||||||
|
assert.True(t, firstAcquire)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -39,20 +39,24 @@ type (
|
|||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
// NewNodeConn returns a CachedConn with a redis node cache.
|
// NewConn returns a CachedConn with a redis cluster cache.
|
||||||
func NewNodeConn(db sqlx.SqlConn, rds *redis.Redis, opts ...cache.Option) CachedConn {
|
func NewConn(db sqlx.SqlConn, c cache.CacheConf, opts ...cache.Option) CachedConn {
|
||||||
|
cc := cache.New(c, exclusiveCalls, stats, sql.ErrNoRows, opts...)
|
||||||
|
return NewConnWithCache(db, cc)
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewConnWithCache returns a CachedConn with a custom cache.
|
||||||
|
func NewConnWithCache(db sqlx.SqlConn, c cache.Cache) CachedConn {
|
||||||
return CachedConn{
|
return CachedConn{
|
||||||
db: db,
|
db: db,
|
||||||
cache: cache.NewNode(rds, exclusiveCalls, stats, sql.ErrNoRows, opts...),
|
cache: c,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewConn returns a CachedConn with a redis cluster cache.
|
// NewNodeConn returns a CachedConn with a redis node cache.
|
||||||
func NewConn(db sqlx.SqlConn, c cache.CacheConf, opts ...cache.Option) CachedConn {
|
func NewNodeConn(db sqlx.SqlConn, rds *redis.Redis, opts ...cache.Option) CachedConn {
|
||||||
return CachedConn{
|
c := cache.NewNode(rds, exclusiveCalls, stats, sql.ErrNoRows, opts...)
|
||||||
db: db,
|
return NewConnWithCache(db, c)
|
||||||
cache: cache.New(c, exclusiveCalls, stats, sql.ErrNoRows, opts...),
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// DelCache deletes cache with keys.
|
// DelCache deletes cache with keys.
|
||||||
|
|||||||
@@ -562,6 +562,18 @@ func TestQueryRowNoCache(t *testing.T) {
|
|||||||
assert.True(t, ran)
|
assert.True(t, ran)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestNewConnWithCache(t *testing.T) {
|
||||||
|
r, clean, err := redistest.CreateRedis()
|
||||||
|
assert.Nil(t, err)
|
||||||
|
defer clean()
|
||||||
|
|
||||||
|
var conn trackedConn
|
||||||
|
c := NewConnWithCache(&conn, cache.NewNode(r, exclusiveCalls, stats, sql.ErrNoRows))
|
||||||
|
_, err = c.ExecNoCache("delete from user_table where id='kevin'")
|
||||||
|
assert.Nil(t, err)
|
||||||
|
assert.True(t, conn.execValue)
|
||||||
|
}
|
||||||
|
|
||||||
func resetStats() {
|
func resetStats() {
|
||||||
atomic.StoreUint64(&stats.Total, 0)
|
atomic.StoreUint64(&stats.Total, 0)
|
||||||
atomic.StoreUint64(&stats.Hit, 0)
|
atomic.StoreUint64(&stats.Hit, 0)
|
||||||
|
|||||||
@@ -25,6 +25,7 @@ type (
|
|||||||
SqlConn interface {
|
SqlConn interface {
|
||||||
Session
|
Session
|
||||||
// RawDB is for other ORM to operate with, use it with caution.
|
// RawDB is for other ORM to operate with, use it with caution.
|
||||||
|
// Notice: don't close it.
|
||||||
RawDB() (*sql.DB, error)
|
RawDB() (*sql.DB, error)
|
||||||
Transact(func(session Session) error) error
|
Transact(func(session Session) error) error
|
||||||
}
|
}
|
||||||
|
|||||||
8
go.mod
8
go.mod
@@ -6,29 +6,21 @@ require (
|
|||||||
github.com/ClickHouse/clickhouse-go v1.5.1
|
github.com/ClickHouse/clickhouse-go v1.5.1
|
||||||
github.com/DATA-DOG/go-sqlmock v1.5.0
|
github.com/DATA-DOG/go-sqlmock v1.5.0
|
||||||
github.com/alicebob/miniredis/v2 v2.16.0
|
github.com/alicebob/miniredis/v2 v2.16.0
|
||||||
github.com/cpuguy83/go-md2man/v2 v2.0.1 // indirect
|
|
||||||
github.com/emicklei/proto v1.9.1
|
|
||||||
github.com/fatih/color v1.9.0 // indirect
|
github.com/fatih/color v1.9.0 // indirect
|
||||||
github.com/fatih/structtag v1.2.0
|
|
||||||
github.com/globalsign/mgo v0.0.0-20181015135952-eeefdecb41b8
|
github.com/globalsign/mgo v0.0.0-20181015135952-eeefdecb41b8
|
||||||
github.com/go-redis/redis v6.15.9+incompatible
|
github.com/go-redis/redis v6.15.9+incompatible
|
||||||
github.com/go-sql-driver/mysql v1.6.0
|
github.com/go-sql-driver/mysql v1.6.0
|
||||||
github.com/golang-jwt/jwt v3.2.1+incompatible
|
github.com/golang-jwt/jwt v3.2.1+incompatible
|
||||||
github.com/golang/mock v1.6.0
|
github.com/golang/mock v1.6.0
|
||||||
github.com/google/uuid v1.3.0
|
github.com/google/uuid v1.3.0
|
||||||
github.com/iancoleman/strcase v0.2.0
|
|
||||||
github.com/justinas/alice v1.2.0
|
github.com/justinas/alice v1.2.0
|
||||||
github.com/lib/pq v1.10.3
|
github.com/lib/pq v1.10.3
|
||||||
github.com/logrusorgru/aurora v2.0.3+incompatible
|
|
||||||
github.com/mattn/go-colorable v0.1.6 // indirect
|
github.com/mattn/go-colorable v0.1.6 // indirect
|
||||||
github.com/olekukonko/tablewriter v0.0.5
|
github.com/olekukonko/tablewriter v0.0.5
|
||||||
github.com/openzipkin/zipkin-go v0.3.0 // indirect
|
github.com/openzipkin/zipkin-go v0.3.0 // indirect
|
||||||
github.com/prometheus/client_golang v1.11.0
|
github.com/prometheus/client_golang v1.11.0
|
||||||
github.com/spaolacci/murmur3 v1.1.0
|
github.com/spaolacci/murmur3 v1.1.0
|
||||||
github.com/stretchr/testify v1.7.0
|
github.com/stretchr/testify v1.7.0
|
||||||
github.com/urfave/cli v1.22.5
|
|
||||||
github.com/zeromicro/antlr v0.0.1
|
|
||||||
github.com/zeromicro/ddl-parser v0.0.0-20210712021150-63520aca7348
|
|
||||||
go.etcd.io/etcd/api/v3 v3.5.1
|
go.etcd.io/etcd/api/v3 v3.5.1
|
||||||
go.etcd.io/etcd/client/v3 v3.5.1
|
go.etcd.io/etcd/client/v3 v3.5.1
|
||||||
go.opentelemetry.io/otel v1.1.0
|
go.opentelemetry.io/otel v1.1.0
|
||||||
|
|||||||
20
go.sum
20
go.sum
@@ -54,8 +54,6 @@ github.com/alicebob/gopher-json v0.0.0-20200520072559-a9ecdc9d1d3a/go.mod h1:SGn
|
|||||||
github.com/alicebob/miniredis/v2 v2.16.0 h1:ALkyFg7bSTEd1Mkrb4ppq4fnwjklA59dVtIehXCUZkU=
|
github.com/alicebob/miniredis/v2 v2.16.0 h1:ALkyFg7bSTEd1Mkrb4ppq4fnwjklA59dVtIehXCUZkU=
|
||||||
github.com/alicebob/miniredis/v2 v2.16.0/go.mod h1:gquAfGbzn92jvtrSC69+6zZnwSODVXVpYDRaGhWaL6I=
|
github.com/alicebob/miniredis/v2 v2.16.0/go.mod h1:gquAfGbzn92jvtrSC69+6zZnwSODVXVpYDRaGhWaL6I=
|
||||||
github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kdvxnR2qWY=
|
github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kdvxnR2qWY=
|
||||||
github.com/antlr/antlr4/runtime/Go/antlr v0.0.0-20210521184019-c5ad59b459ec h1:EEyRvzmpEUZ+I8WmD5cw/vY8EqhambkOqy5iFr0908A=
|
|
||||||
github.com/antlr/antlr4/runtime/Go/antlr v0.0.0-20210521184019-c5ad59b459ec/go.mod h1:F7bn7fEU90QkQ3tnmaTx3LTKLEDqnwWODIYppRQ5hnY=
|
|
||||||
github.com/asaskevich/govalidator v0.0.0-20190424111038-f61b66f89f4a/go.mod h1:lB+ZfQJz7igIIfQNfa7Ml4HSf2uFQQRzpGGRXenZAgY=
|
github.com/asaskevich/govalidator v0.0.0-20190424111038-f61b66f89f4a/go.mod h1:lB+ZfQJz7igIIfQNfa7Ml4HSf2uFQQRzpGGRXenZAgY=
|
||||||
github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q=
|
github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q=
|
||||||
github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8=
|
github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8=
|
||||||
@@ -86,8 +84,6 @@ github.com/coreos/go-semver v0.3.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3Ee
|
|||||||
github.com/coreos/go-systemd/v22 v22.3.2 h1:D9/bQk5vlXQFZ6Kwuu6zaiXJ9oTPe68++AzAJc1DzSI=
|
github.com/coreos/go-systemd/v22 v22.3.2 h1:D9/bQk5vlXQFZ6Kwuu6zaiXJ9oTPe68++AzAJc1DzSI=
|
||||||
github.com/coreos/go-systemd/v22 v22.3.2/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSVTIJ3seZv2GcEnc=
|
github.com/coreos/go-systemd/v22 v22.3.2/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSVTIJ3seZv2GcEnc=
|
||||||
github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU=
|
github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU=
|
||||||
github.com/cpuguy83/go-md2man/v2 v2.0.1 h1:r/myEWzV9lfsM1tFLgDyu0atFtJ1fXn261LKYj/3DxU=
|
|
||||||
github.com/cpuguy83/go-md2man/v2 v2.0.1/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o=
|
|
||||||
github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E=
|
github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E=
|
||||||
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||||
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
|
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
|
||||||
@@ -102,8 +98,6 @@ github.com/eapache/go-xerial-snappy v0.0.0-20180814174437-776d5712da21/go.mod h1
|
|||||||
github.com/eapache/queue v1.1.0/go.mod h1:6eCeP0CKFpHLu8blIFXhExK/dRa7WDZfr6jVFPTqq+I=
|
github.com/eapache/queue v1.1.0/go.mod h1:6eCeP0CKFpHLu8blIFXhExK/dRa7WDZfr6jVFPTqq+I=
|
||||||
github.com/elazarl/goproxy v0.0.0-20180725130230-947c36da3153/go.mod h1:/Zj4wYkgs4iZTTu3o/KG3Itv/qCCa8VVMlb3i9OVuzc=
|
github.com/elazarl/goproxy v0.0.0-20180725130230-947c36da3153/go.mod h1:/Zj4wYkgs4iZTTu3o/KG3Itv/qCCa8VVMlb3i9OVuzc=
|
||||||
github.com/emicklei/go-restful v0.0.0-20170410110728-ff4f55a20633/go.mod h1:otzb+WCGbkyDHkqmQmT5YD2WR4BBwUdeQoFo8l/7tVs=
|
github.com/emicklei/go-restful v0.0.0-20170410110728-ff4f55a20633/go.mod h1:otzb+WCGbkyDHkqmQmT5YD2WR4BBwUdeQoFo8l/7tVs=
|
||||||
github.com/emicklei/proto v1.9.1 h1:MUgjFo5xlMwYv72TnF5xmmdKZ04u+dVbv6wdARv16D8=
|
|
||||||
github.com/emicklei/proto v1.9.1/go.mod h1:rn1FgRS/FANiZdD2djyH7TMA9jdRDcYQ9IEN9yvjX0A=
|
|
||||||
github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4=
|
github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4=
|
||||||
github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4=
|
github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4=
|
||||||
github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98=
|
github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98=
|
||||||
@@ -115,8 +109,6 @@ github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7
|
|||||||
github.com/evanphx/json-patch v4.9.0+incompatible/go.mod h1:50XU6AFN0ol/bzJsmQLiYLvXMP4fmwYFNcr97nuDLSk=
|
github.com/evanphx/json-patch v4.9.0+incompatible/go.mod h1:50XU6AFN0ol/bzJsmQLiYLvXMP4fmwYFNcr97nuDLSk=
|
||||||
github.com/fatih/color v1.9.0 h1:8xPHl4/q1VyqGIPif1F+1V3Y3lSmrq01EabUW3CoW5s=
|
github.com/fatih/color v1.9.0 h1:8xPHl4/q1VyqGIPif1F+1V3Y3lSmrq01EabUW3CoW5s=
|
||||||
github.com/fatih/color v1.9.0/go.mod h1:eQcE1qtQxscV5RaZvpXrrb8Drkc3/DdQ+uUYCNjL+zU=
|
github.com/fatih/color v1.9.0/go.mod h1:eQcE1qtQxscV5RaZvpXrrb8Drkc3/DdQ+uUYCNjL+zU=
|
||||||
github.com/fatih/structtag v1.2.0 h1:/OdNE99OxoI/PqaW/SuSK9uxxT3f/tcSZgon/ssNSx4=
|
|
||||||
github.com/fatih/structtag v1.2.0/go.mod h1:mBJUNpUnHmRKrKlQQlmCrh5PuhftFbNv8Ys4/aAZl94=
|
|
||||||
github.com/form3tech-oss/jwt-go v3.2.2+incompatible/go.mod h1:pbq4aXjuKjdthFRnoDwaVPLA+WlJuPGy+QneDUgJi2k=
|
github.com/form3tech-oss/jwt-go v3.2.2+incompatible/go.mod h1:pbq4aXjuKjdthFRnoDwaVPLA+WlJuPGy+QneDUgJi2k=
|
||||||
github.com/fortytw2/leaktest v1.3.0/go.mod h1:jDsjWgpAGjm2CA7WthBh/CdZYEPF31XHquHwclZch5g=
|
github.com/fortytw2/leaktest v1.3.0/go.mod h1:jDsjWgpAGjm2CA7WthBh/CdZYEPF31XHquHwclZch5g=
|
||||||
github.com/frankban/quicktest v1.11.3 h1:8sXhOn0uLys67V8EsXLc6eszDs8VXWxL3iRvebPhedY=
|
github.com/frankban/quicktest v1.11.3 h1:8sXhOn0uLys67V8EsXLc6eszDs8VXWxL3iRvebPhedY=
|
||||||
@@ -235,8 +227,6 @@ github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ
|
|||||||
github.com/hashicorp/golang-lru v0.5.1 h1:0hERBMJE1eitiLkihrMvRVBYAkpHzc/J3QdDN+dAcgU=
|
github.com/hashicorp/golang-lru v0.5.1 h1:0hERBMJE1eitiLkihrMvRVBYAkpHzc/J3QdDN+dAcgU=
|
||||||
github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8=
|
github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8=
|
||||||
github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU=
|
github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU=
|
||||||
github.com/iancoleman/strcase v0.2.0 h1:05I4QRnGpI0m37iZQRuskXh+w77mr6Z41lwQzuHLwW0=
|
|
||||||
github.com/iancoleman/strcase v0.2.0/go.mod h1:iwCmte+B7n89clKwxIoIXy/HfoL7AsD47ZCWhYzw7ho=
|
|
||||||
github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc=
|
github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc=
|
||||||
github.com/imdario/mergo v0.3.5/go.mod h1:2EnlNZ0deacrJVfApfmtdGgDfMuh/nq6Ok1EcJh5FfA=
|
github.com/imdario/mergo v0.3.5/go.mod h1:2EnlNZ0deacrJVfApfmtdGgDfMuh/nq6Ok1EcJh5FfA=
|
||||||
github.com/jcmturner/aescts/v2 v2.0.0/go.mod h1:AiaICIRyfYg35RUkr8yESTqvSy7csK90qZ5xfvvsoNs=
|
github.com/jcmturner/aescts/v2 v2.0.0/go.mod h1:AiaICIRyfYg35RUkr8yESTqvSy7csK90qZ5xfvvsoNs=
|
||||||
@@ -275,8 +265,6 @@ github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
|
|||||||
github.com/lib/pq v1.0.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo=
|
github.com/lib/pq v1.0.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo=
|
||||||
github.com/lib/pq v1.10.3 h1:v9QZf2Sn6AmjXtQeFpdoq/eaNtYP6IN+7lcrygsIAtg=
|
github.com/lib/pq v1.10.3 h1:v9QZf2Sn6AmjXtQeFpdoq/eaNtYP6IN+7lcrygsIAtg=
|
||||||
github.com/lib/pq v1.10.3/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o=
|
github.com/lib/pq v1.10.3/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o=
|
||||||
github.com/logrusorgru/aurora v2.0.3+incompatible h1:tOpm7WcpBTn4fjmVfgpQq0EfczGlG91VSDkswnjF5A8=
|
|
||||||
github.com/logrusorgru/aurora v2.0.3+incompatible/go.mod h1:7rIyQOR62GCctdiQpZ/zOJlFyk6y+94wXzv6RNZgaR4=
|
|
||||||
github.com/mailru/easyjson v0.0.0-20190614124828-94de47d64c63/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc=
|
github.com/mailru/easyjson v0.0.0-20190614124828-94de47d64c63/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc=
|
||||||
github.com/mailru/easyjson v0.0.0-20190626092158-b2ccc519800e/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc=
|
github.com/mailru/easyjson v0.0.0-20190626092158-b2ccc519800e/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc=
|
||||||
github.com/mattn/go-colorable v0.1.4/go.mod h1:U0ppj6V5qS13XJ6of8GYAs25YV2eR4EVcfRqFIhoBtE=
|
github.com/mattn/go-colorable v0.1.4/go.mod h1:U0ppj6V5qS13XJ6of8GYAs25YV2eR4EVcfRqFIhoBtE=
|
||||||
@@ -364,8 +352,6 @@ github.com/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475/go.mod h1:bCqn
|
|||||||
github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6LYCDYWNEvQ=
|
github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6LYCDYWNEvQ=
|
||||||
github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4=
|
github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4=
|
||||||
github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
|
github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
|
||||||
github.com/russross/blackfriday/v2 v2.1.0 h1:JIOH55/0cWyOuilr9/qlrm0BSXldqnqwMsf35Ld67mk=
|
|
||||||
github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
|
|
||||||
github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc=
|
github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc=
|
||||||
github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo=
|
github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo=
|
||||||
github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE=
|
github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE=
|
||||||
@@ -390,8 +376,6 @@ github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5
|
|||||||
github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
|
github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
|
||||||
github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY=
|
github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY=
|
||||||
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
|
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
|
||||||
github.com/urfave/cli v1.22.5 h1:lNq9sAHXK2qfdI8W+GRItjCEkI+2oR4d+MEHy1CKXoU=
|
|
||||||
github.com/urfave/cli v1.22.5/go.mod h1:Gos4lmkARVdJ6EkW0WaNv/tZAAMe9V7XWyB60NtXRu0=
|
|
||||||
github.com/urfave/cli/v2 v2.3.0/go.mod h1:LJmUH05zAU44vOAcrfzZQKsZbVcdbOG8rtL3/XcUArI=
|
github.com/urfave/cli/v2 v2.3.0/go.mod h1:LJmUH05zAU44vOAcrfzZQKsZbVcdbOG8rtL3/XcUArI=
|
||||||
github.com/xdg-go/pbkdf2 v1.0.0/go.mod h1:jrpuAogTd400dnrH08LKmI/xc1MbPOebTwRqcT5RDeI=
|
github.com/xdg-go/pbkdf2 v1.0.0/go.mod h1:jrpuAogTd400dnrH08LKmI/xc1MbPOebTwRqcT5RDeI=
|
||||||
github.com/xdg-go/scram v1.0.2/go.mod h1:1WAq6h33pAW+iRreB34OORO2Nf7qel3VV3fjBj+hCSs=
|
github.com/xdg-go/scram v1.0.2/go.mod h1:1WAq6h33pAW+iRreB34OORO2Nf7qel3VV3fjBj+hCSs=
|
||||||
@@ -401,10 +385,6 @@ github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9dec
|
|||||||
github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k=
|
github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k=
|
||||||
github.com/yuin/gopher-lua v0.0.0-20200816102855-ee81675732da h1:NimzV1aGyq29m5ukMK0AMWEhFaL/lrEOaephfuoiARg=
|
github.com/yuin/gopher-lua v0.0.0-20200816102855-ee81675732da h1:NimzV1aGyq29m5ukMK0AMWEhFaL/lrEOaephfuoiARg=
|
||||||
github.com/yuin/gopher-lua v0.0.0-20200816102855-ee81675732da/go.mod h1:E1AXubJBdNmFERAOucpDIxNzeGfLzg0mYh+UfMWdChA=
|
github.com/yuin/gopher-lua v0.0.0-20200816102855-ee81675732da/go.mod h1:E1AXubJBdNmFERAOucpDIxNzeGfLzg0mYh+UfMWdChA=
|
||||||
github.com/zeromicro/antlr v0.0.1 h1:CQpIn/dc0pUjgGQ81y98s/NGOm2Hfru2NNio2I9mQgk=
|
|
||||||
github.com/zeromicro/antlr v0.0.1/go.mod h1:nfpjEwFR6Q4xGDJMcZnCL9tEfQRgszMwu3rDz2Z+p5M=
|
|
||||||
github.com/zeromicro/ddl-parser v0.0.0-20210712021150-63520aca7348 h1:OhxL9tn28gDeJVzreIUiE5oVxZCjL3tBJ0XBNw8p5R8=
|
|
||||||
github.com/zeromicro/ddl-parser v0.0.0-20210712021150-63520aca7348/go.mod h1:ISU/8NuPyEpl9pa17Py9TBPetMjtsiHrb9f5XGiYbo8=
|
|
||||||
go.etcd.io/etcd/api/v3 v3.5.1 h1:v28cktvBq+7vGyJXF8G+rWJmj+1XUmMtqcLnH8hDocM=
|
go.etcd.io/etcd/api/v3 v3.5.1 h1:v28cktvBq+7vGyJXF8G+rWJmj+1XUmMtqcLnH8hDocM=
|
||||||
go.etcd.io/etcd/api/v3 v3.5.1/go.mod h1:cbVKeC6lCfl7j/8jBhAK6aIYO9XOjdptoxU/nLQcPvs=
|
go.etcd.io/etcd/api/v3 v3.5.1/go.mod h1:cbVKeC6lCfl7j/8jBhAK6aIYO9XOjdptoxU/nLQcPvs=
|
||||||
go.etcd.io/etcd/client/pkg/v3 v3.5.1 h1:XIQcHCFSG53bJETYeRJtIxdLv2EWRGxcfzR8lSnTH4E=
|
go.etcd.io/etcd/client/pkg/v3 v3.5.1 h1:XIQcHCFSG53bJETYeRJtIxdLv2EWRGxcfzR8lSnTH4E=
|
||||||
|
|||||||
@@ -104,10 +104,10 @@ GO111MODULE=on GOPROXY=https://goproxy.cn/,direct go get -u github.com/tal-tech/
|
|||||||
|
|
||||||
```shell
|
```shell
|
||||||
# Go 1.15 及之前版本
|
# Go 1.15 及之前版本
|
||||||
GO111MODULE=on GOPROXY=https://goproxy.cn/,direct go get -u github.com/tal-tech/go-zero/tools/goctl@cli
|
GO111MODULE=on GOPROXY=https://goproxy.cn/,direct go get -u github.com/tal-tech/go-zero/tools/goctl@latest
|
||||||
|
|
||||||
# Go 1.16 及以后版本
|
# Go 1.16 及以后版本
|
||||||
GOPROXY=https://goproxy.cn/,direct go install github.com/tal-tech/go-zero/tools/goctl@cli
|
GOPROXY=https://goproxy.cn/,direct go install github.com/tal-tech/go-zero/tools/goctl@latest
|
||||||
```
|
```
|
||||||
|
|
||||||
确保 goctl 可执行
|
确保 goctl 可执行
|
||||||
@@ -141,7 +141,7 @@ GO111MODULE=on GOPROXY=https://goproxy.cn/,direct go get -u github.com/tal-tech/
|
|||||||
|
|
||||||
编写业务代码:
|
编写业务代码:
|
||||||
|
|
||||||
* api 文件定义了服务对外 HTTP 接口,可参考 [api 规范](https://github.com/zeromicro/zero-doc/blob/main/doc/goctl.md)
|
* api 文件定义了服务对外 HTTP 接口,可参考 [api 规范](https://github.com/zeromicro/zero-doc/blob/main/docs/zero/goctl-api.md)
|
||||||
* 可以在 `servicecontext.go` 里面传递依赖给 logic,比如 mysql, redis 等
|
* 可以在 `servicecontext.go` 里面传递依赖给 logic,比如 mysql, redis 等
|
||||||
* 在 api 定义的 `get/post/put/delete` 等请求对应的 logic 里增加业务处理逻辑
|
* 在 api 定义的 `get/post/put/delete` 等请求对应的 logic 里增加业务处理逻辑
|
||||||
|
|
||||||
@@ -232,6 +232,9 @@ go-zero 已被许多公司用于生产部署,接入场景如在线教育、电
|
|||||||
>46. 上海游族网络
|
>46. 上海游族网络
|
||||||
>47. 深信服
|
>47. 深信服
|
||||||
>48. 中免日上科技互联有限公司
|
>48. 中免日上科技互联有限公司
|
||||||
|
>48. ECLOUDVALLEY TECHNOLOGY (HK) LIMITED
|
||||||
|
>48. 馨科智(深圳)科技有限公司
|
||||||
|
>48. 成都松珀科技有限公司
|
||||||
|
|
||||||
如果贵公司也已使用 go-zero,欢迎在 [登记地址](https://github.com/zeromicro/go-zero/issues/602) 登记,仅仅为了推广,不做其它用途。
|
如果贵公司也已使用 go-zero,欢迎在 [登记地址](https://github.com/zeromicro/go-zero/issues/602) 登记,仅仅为了推广,不做其它用途。
|
||||||
|
|
||||||
|
|||||||
@@ -107,10 +107,10 @@ go get -u github.com/tal-tech/go-zero
|
|||||||
|
|
||||||
```shell
|
```shell
|
||||||
# for Go 1.15 and earlier
|
# for Go 1.15 and earlier
|
||||||
GO111MODULE=on go get -u github.com/tal-tech/go-zero/tools/goctl@cli
|
GO111MODULE=on go get -u github.com/tal-tech/go-zero/tools/goctl@latest
|
||||||
|
|
||||||
# for Go 1.16 and later
|
# for Go 1.16 and later
|
||||||
go install github.com/tal-tech/go-zero/tools/goctl@cli
|
go install github.com/tal-tech/go-zero/tools/goctl@latest
|
||||||
```
|
```
|
||||||
|
|
||||||
make sure goctl is executable.
|
make sure goctl is executable.
|
||||||
@@ -221,7 +221,7 @@ go get -u github.com/tal-tech/go-zero
|
|||||||
|
|
||||||
## 9. Chat group
|
## 9. Chat group
|
||||||
|
|
||||||
Join the chat via https://join.slack.com/t/go-zero/shared_invite/zt-ulzixfgi-NAkZjq856TewLY2KQSxHCw
|
Join the chat via https://join.slack.com/t/go-zero/shared_invite/zt-10ruju779-BE4y6lQNB_R21samtyKTgA
|
||||||
|
|
||||||
## 10. Cloud Native Landscape
|
## 10. Cloud Native Landscape
|
||||||
|
|
||||||
|
|||||||
@@ -196,12 +196,13 @@ func logDetails(r *http.Request, response *detailLoggedResponseWriter, timer *ut
|
|||||||
logs *internal.LogCollector) {
|
logs *internal.LogCollector) {
|
||||||
var buf bytes.Buffer
|
var buf bytes.Buffer
|
||||||
duration := timer.Duration()
|
duration := timer.Duration()
|
||||||
|
code := response.writer.code
|
||||||
logger := logx.WithContext(r.Context())
|
logger := logx.WithContext(r.Context())
|
||||||
buf.WriteString(fmt.Sprintf("[HTTP] %s - %d - %s - %s\n=> %s\n",
|
buf.WriteString(fmt.Sprintf("[HTTP] %s - %d - %s - %s\n=> %s\n",
|
||||||
r.Method, response.writer.code, r.RemoteAddr, timex.ReprOfDuration(duration), dumpRequest(r)))
|
r.Method, code, r.RemoteAddr, timex.ReprOfDuration(duration), dumpRequest(r)))
|
||||||
if duration > defaultSlowThreshold {
|
if duration > defaultSlowThreshold {
|
||||||
logger.Slowf("[HTTP] %s - %d - %s - slowcall(%s)\n=> %s\n",
|
logger.Slowf("[HTTP] %s - %d - %s - slowcall(%s)\n=> %s\n",
|
||||||
r.Method, response.writer.code, r.RemoteAddr, timex.ReprOfDuration(duration), dumpRequest(r))
|
r.Method, code, r.RemoteAddr, timex.ReprOfDuration(duration), dumpRequest(r))
|
||||||
}
|
}
|
||||||
|
|
||||||
body := logs.Flush()
|
body := logs.Flush()
|
||||||
@@ -214,7 +215,11 @@ func logDetails(r *http.Request, response *detailLoggedResponseWriter, timer *ut
|
|||||||
buf.WriteString(fmt.Sprintf("<= %s", respBuf))
|
buf.WriteString(fmt.Sprintf("<= %s", respBuf))
|
||||||
}
|
}
|
||||||
|
|
||||||
logger.Info(buf.String())
|
if isOkResponse(code) {
|
||||||
|
logger.Info(buf.String())
|
||||||
|
} else {
|
||||||
|
logger.Error(buf.String())
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func isOkResponse(code int) bool {
|
func isOkResponse(code int) bool {
|
||||||
|
|||||||
@@ -1,19 +1,192 @@
|
|||||||
package handler
|
package handler
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"bytes"
|
||||||
|
"context"
|
||||||
|
"errors"
|
||||||
|
"fmt"
|
||||||
|
"io"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
"path"
|
||||||
|
"runtime"
|
||||||
|
"strings"
|
||||||
|
"sync"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
"github.com/tal-tech/go-zero/rest/httpx"
|
||||||
|
"github.com/tal-tech/go-zero/rest/internal"
|
||||||
)
|
)
|
||||||
|
|
||||||
const reason = "Request Timeout"
|
const (
|
||||||
|
statusClientClosedRequest = 499
|
||||||
|
reason = "Request Timeout"
|
||||||
|
)
|
||||||
|
|
||||||
// TimeoutHandler returns the handler with given timeout.
|
// TimeoutHandler returns the handler with given timeout.
|
||||||
|
// If client closed request, code 499 will be logged.
|
||||||
|
// Notice: even if canceled in server side, 499 will be logged as well.
|
||||||
func TimeoutHandler(duration time.Duration) func(http.Handler) http.Handler {
|
func TimeoutHandler(duration time.Duration) func(http.Handler) http.Handler {
|
||||||
return func(next http.Handler) http.Handler {
|
return func(next http.Handler) http.Handler {
|
||||||
if duration > 0 {
|
if duration > 0 {
|
||||||
return http.TimeoutHandler(next, duration, reason)
|
return &timeoutHandler{
|
||||||
|
handler: next,
|
||||||
|
dt: duration,
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return next
|
return next
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// timeoutHandler is the handler that controls the request timeout.
|
||||||
|
// Why we implement it on our own, because the stdlib implementation
|
||||||
|
// treats the ClientClosedRequest as http.StatusServiceUnavailable.
|
||||||
|
// And we write the codes in logs as code 499, which is defined by nginx.
|
||||||
|
type timeoutHandler struct {
|
||||||
|
handler http.Handler
|
||||||
|
dt time.Duration
|
||||||
|
}
|
||||||
|
|
||||||
|
func (h *timeoutHandler) errorBody() string {
|
||||||
|
return reason
|
||||||
|
}
|
||||||
|
|
||||||
|
func (h *timeoutHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
||||||
|
ctx, cancelCtx := context.WithTimeout(r.Context(), h.dt)
|
||||||
|
defer cancelCtx()
|
||||||
|
|
||||||
|
r = r.WithContext(ctx)
|
||||||
|
done := make(chan struct{})
|
||||||
|
tw := &timeoutWriter{
|
||||||
|
w: w,
|
||||||
|
h: make(http.Header),
|
||||||
|
req: r,
|
||||||
|
}
|
||||||
|
panicChan := make(chan interface{}, 1)
|
||||||
|
go func() {
|
||||||
|
defer func() {
|
||||||
|
if p := recover(); p != nil {
|
||||||
|
panicChan <- p
|
||||||
|
}
|
||||||
|
}()
|
||||||
|
h.handler.ServeHTTP(tw, r)
|
||||||
|
close(done)
|
||||||
|
}()
|
||||||
|
select {
|
||||||
|
case p := <-panicChan:
|
||||||
|
panic(p)
|
||||||
|
case <-done:
|
||||||
|
tw.mu.Lock()
|
||||||
|
defer tw.mu.Unlock()
|
||||||
|
dst := w.Header()
|
||||||
|
for k, vv := range tw.h {
|
||||||
|
dst[k] = vv
|
||||||
|
}
|
||||||
|
if !tw.wroteHeader {
|
||||||
|
tw.code = http.StatusOK
|
||||||
|
}
|
||||||
|
w.WriteHeader(tw.code)
|
||||||
|
w.Write(tw.wbuf.Bytes())
|
||||||
|
case <-ctx.Done():
|
||||||
|
tw.mu.Lock()
|
||||||
|
defer tw.mu.Unlock()
|
||||||
|
// there isn't any user-defined middleware before TimoutHandler,
|
||||||
|
// so we can guarantee that cancelation in biz related code won't come here.
|
||||||
|
httpx.Error(w, ctx.Err(), func(w http.ResponseWriter, err error) {
|
||||||
|
if errors.Is(err, context.Canceled) {
|
||||||
|
w.WriteHeader(statusClientClosedRequest)
|
||||||
|
} else {
|
||||||
|
w.WriteHeader(http.StatusServiceUnavailable)
|
||||||
|
}
|
||||||
|
io.WriteString(w, h.errorBody())
|
||||||
|
})
|
||||||
|
tw.timedOut = true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
type timeoutWriter struct {
|
||||||
|
w http.ResponseWriter
|
||||||
|
h http.Header
|
||||||
|
wbuf bytes.Buffer
|
||||||
|
req *http.Request
|
||||||
|
|
||||||
|
mu sync.Mutex
|
||||||
|
timedOut bool
|
||||||
|
wroteHeader bool
|
||||||
|
code int
|
||||||
|
}
|
||||||
|
|
||||||
|
var _ http.Pusher = (*timeoutWriter)(nil)
|
||||||
|
|
||||||
|
// Push implements the Pusher interface.
|
||||||
|
func (tw *timeoutWriter) Push(target string, opts *http.PushOptions) error {
|
||||||
|
if pusher, ok := tw.w.(http.Pusher); ok {
|
||||||
|
return pusher.Push(target, opts)
|
||||||
|
}
|
||||||
|
return http.ErrNotSupported
|
||||||
|
}
|
||||||
|
|
||||||
|
func (tw *timeoutWriter) Header() http.Header { return tw.h }
|
||||||
|
|
||||||
|
func (tw *timeoutWriter) Write(p []byte) (int, error) {
|
||||||
|
tw.mu.Lock()
|
||||||
|
defer tw.mu.Unlock()
|
||||||
|
|
||||||
|
if tw.timedOut {
|
||||||
|
return 0, http.ErrHandlerTimeout
|
||||||
|
}
|
||||||
|
|
||||||
|
if !tw.wroteHeader {
|
||||||
|
tw.writeHeaderLocked(http.StatusOK)
|
||||||
|
}
|
||||||
|
return tw.wbuf.Write(p)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (tw *timeoutWriter) writeHeaderLocked(code int) {
|
||||||
|
checkWriteHeaderCode(code)
|
||||||
|
|
||||||
|
switch {
|
||||||
|
case tw.timedOut:
|
||||||
|
return
|
||||||
|
case tw.wroteHeader:
|
||||||
|
if tw.req != nil {
|
||||||
|
caller := relevantCaller()
|
||||||
|
internal.Errorf(tw.req, "http: superfluous response.WriteHeader call from %s (%s:%d)",
|
||||||
|
caller.Function, path.Base(caller.File), caller.Line)
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
tw.wroteHeader = true
|
||||||
|
tw.code = code
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (tw *timeoutWriter) WriteHeader(code int) {
|
||||||
|
tw.mu.Lock()
|
||||||
|
defer tw.mu.Unlock()
|
||||||
|
tw.writeHeaderLocked(code)
|
||||||
|
}
|
||||||
|
|
||||||
|
func checkWriteHeaderCode(code int) {
|
||||||
|
if code < 100 || code > 599 {
|
||||||
|
panic(fmt.Sprintf("invalid WriteHeader code %v", code))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// relevantCaller searches the call stack for the first function outside of net/http.
|
||||||
|
// The purpose of this function is to provide more helpful error messages.
|
||||||
|
func relevantCaller() runtime.Frame {
|
||||||
|
pc := make([]uintptr, 16)
|
||||||
|
n := runtime.Callers(1, pc)
|
||||||
|
frames := runtime.CallersFrames(pc[:n])
|
||||||
|
var frame runtime.Frame
|
||||||
|
for {
|
||||||
|
frame, more := frames.Next()
|
||||||
|
if !strings.HasPrefix(frame.Function, "net/http.") {
|
||||||
|
return frame
|
||||||
|
}
|
||||||
|
if !more {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return frame
|
||||||
|
}
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
package handler
|
package handler
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"context"
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"log"
|
"log"
|
||||||
"net/http"
|
"net/http"
|
||||||
@@ -39,6 +40,20 @@ func TestWithinTimeout(t *testing.T) {
|
|||||||
assert.Equal(t, http.StatusOK, resp.Code)
|
assert.Equal(t, http.StatusOK, resp.Code)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestWithTimeoutTimedout(t *testing.T) {
|
||||||
|
timeoutHandler := TimeoutHandler(time.Millisecond)
|
||||||
|
handler := timeoutHandler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||||
|
time.Sleep(time.Millisecond * 10)
|
||||||
|
w.Write([]byte(`foo`))
|
||||||
|
w.WriteHeader(http.StatusOK)
|
||||||
|
}))
|
||||||
|
|
||||||
|
req := httptest.NewRequest(http.MethodGet, "http://localhost", nil)
|
||||||
|
resp := httptest.NewRecorder()
|
||||||
|
handler.ServeHTTP(resp, req)
|
||||||
|
assert.Equal(t, http.StatusServiceUnavailable, resp.Code)
|
||||||
|
}
|
||||||
|
|
||||||
func TestWithoutTimeout(t *testing.T) {
|
func TestWithoutTimeout(t *testing.T) {
|
||||||
timeoutHandler := TimeoutHandler(0)
|
timeoutHandler := TimeoutHandler(0)
|
||||||
handler := timeoutHandler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
handler := timeoutHandler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||||
@@ -50,3 +65,91 @@ func TestWithoutTimeout(t *testing.T) {
|
|||||||
handler.ServeHTTP(resp, req)
|
handler.ServeHTTP(resp, req)
|
||||||
assert.Equal(t, http.StatusOK, resp.Code)
|
assert.Equal(t, http.StatusOK, resp.Code)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestTimeoutPanic(t *testing.T) {
|
||||||
|
timeoutHandler := TimeoutHandler(time.Minute)
|
||||||
|
handler := timeoutHandler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||||
|
panic("foo")
|
||||||
|
}))
|
||||||
|
|
||||||
|
req := httptest.NewRequest(http.MethodGet, "http://localhost", nil)
|
||||||
|
resp := httptest.NewRecorder()
|
||||||
|
assert.Panics(t, func() {
|
||||||
|
handler.ServeHTTP(resp, req)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestTimeoutWroteHeaderTwice(t *testing.T) {
|
||||||
|
timeoutHandler := TimeoutHandler(time.Minute)
|
||||||
|
handler := timeoutHandler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||||
|
w.Write([]byte(`hello`))
|
||||||
|
w.Header().Set("foo", "bar")
|
||||||
|
w.WriteHeader(http.StatusOK)
|
||||||
|
}))
|
||||||
|
|
||||||
|
req := httptest.NewRequest(http.MethodGet, "http://localhost", nil)
|
||||||
|
resp := httptest.NewRecorder()
|
||||||
|
handler.ServeHTTP(resp, req)
|
||||||
|
assert.Equal(t, http.StatusOK, resp.Code)
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestTimeoutWriteBadCode(t *testing.T) {
|
||||||
|
timeoutHandler := TimeoutHandler(time.Minute)
|
||||||
|
handler := timeoutHandler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||||
|
w.WriteHeader(1000)
|
||||||
|
}))
|
||||||
|
|
||||||
|
req := httptest.NewRequest(http.MethodGet, "http://localhost", nil)
|
||||||
|
resp := httptest.NewRecorder()
|
||||||
|
assert.Panics(t, func() {
|
||||||
|
handler.ServeHTTP(resp, req)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestTimeoutClientClosed(t *testing.T) {
|
||||||
|
timeoutHandler := TimeoutHandler(time.Minute)
|
||||||
|
handler := timeoutHandler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||||
|
w.WriteHeader(1000)
|
||||||
|
}))
|
||||||
|
|
||||||
|
req := httptest.NewRequest(http.MethodGet, "http://localhost", nil)
|
||||||
|
ctx, cancel := context.WithCancel(context.Background())
|
||||||
|
req = req.WithContext(ctx)
|
||||||
|
cancel()
|
||||||
|
resp := httptest.NewRecorder()
|
||||||
|
handler.ServeHTTP(resp, req)
|
||||||
|
assert.Equal(t, statusClientClosedRequest, resp.Code)
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestTimeoutPusher(t *testing.T) {
|
||||||
|
handler := &timeoutWriter{
|
||||||
|
w: mockedPusher{},
|
||||||
|
}
|
||||||
|
|
||||||
|
assert.Panics(t, func() {
|
||||||
|
handler.Push("any", nil)
|
||||||
|
})
|
||||||
|
|
||||||
|
handler = &timeoutWriter{
|
||||||
|
w: httptest.NewRecorder(),
|
||||||
|
}
|
||||||
|
assert.Equal(t, http.ErrNotSupported, handler.Push("any", nil))
|
||||||
|
}
|
||||||
|
|
||||||
|
type mockedPusher struct{}
|
||||||
|
|
||||||
|
func (m mockedPusher) Header() http.Header {
|
||||||
|
panic("implement me")
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m mockedPusher) Write(bytes []byte) (int, error) {
|
||||||
|
panic("implement me")
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m mockedPusher) WriteHeader(statusCode int) {
|
||||||
|
panic("implement me")
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m mockedPusher) Push(target string, opts *http.PushOptions) error {
|
||||||
|
panic("implement me")
|
||||||
|
}
|
||||||
|
|||||||
@@ -14,7 +14,6 @@ const (
|
|||||||
formKey = "form"
|
formKey = "form"
|
||||||
pathKey = "path"
|
pathKey = "path"
|
||||||
headerKey = "header"
|
headerKey = "header"
|
||||||
emptyJson = "{}"
|
|
||||||
maxMemory = 32 << 20 // 32MB
|
maxMemory = 32 << 20 // 32MB
|
||||||
maxBodyLen = 8 << 20 // 8MB
|
maxBodyLen = 8 << 20 // 8MB
|
||||||
separator = ";"
|
separator = ";"
|
||||||
@@ -106,14 +105,12 @@ func ParseHeader(headerValue string) map[string]string {
|
|||||||
|
|
||||||
// ParseJsonBody parses the post request which contains json in body.
|
// ParseJsonBody parses the post request which contains json in body.
|
||||||
func ParseJsonBody(r *http.Request, v interface{}) error {
|
func ParseJsonBody(r *http.Request, v interface{}) error {
|
||||||
var reader io.Reader
|
|
||||||
if withJsonBody(r) {
|
if withJsonBody(r) {
|
||||||
reader = io.LimitReader(r.Body, maxBodyLen)
|
reader := io.LimitReader(r.Body, maxBodyLen)
|
||||||
} else {
|
return mapping.UnmarshalJsonReader(reader, v)
|
||||||
reader = strings.NewReader(emptyJson)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return mapping.UnmarshalJsonReader(reader, v)
|
return mapping.UnmarshalJsonMap(nil, v)
|
||||||
}
|
}
|
||||||
|
|
||||||
// ParsePath parses the symbols reside in url path.
|
// ParsePath parses the symbols reside in url path.
|
||||||
|
|||||||
@@ -196,18 +196,32 @@ Content-Disposition: form-data; name="age"
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestParseJsonBody(t *testing.T) {
|
func TestParseJsonBody(t *testing.T) {
|
||||||
var v struct {
|
t.Run("has body", func(t *testing.T) {
|
||||||
Name string `json:"name"`
|
var v struct {
|
||||||
Age int `json:"age"`
|
Name string `json:"name"`
|
||||||
}
|
Age int `json:"age"`
|
||||||
|
}
|
||||||
|
|
||||||
body := `{"name":"kevin", "age": 18}`
|
body := `{"name":"kevin", "age": 18}`
|
||||||
r := httptest.NewRequest(http.MethodPost, "/", strings.NewReader(body))
|
r := httptest.NewRequest(http.MethodPost, "/", strings.NewReader(body))
|
||||||
r.Header.Set(ContentType, ApplicationJson)
|
r.Header.Set(ContentType, ApplicationJson)
|
||||||
|
|
||||||
assert.Nil(t, Parse(r, &v))
|
assert.Nil(t, Parse(r, &v))
|
||||||
assert.Equal(t, "kevin", v.Name)
|
assert.Equal(t, "kevin", v.Name)
|
||||||
assert.Equal(t, 18, v.Age)
|
assert.Equal(t, 18, v.Age)
|
||||||
|
})
|
||||||
|
|
||||||
|
t.Run("hasn't body", func(t *testing.T) {
|
||||||
|
var v struct {
|
||||||
|
Name string `json:"name,optional"`
|
||||||
|
Age int `json:"age,optional"`
|
||||||
|
}
|
||||||
|
|
||||||
|
r := httptest.NewRequest(http.MethodGet, "/", nil)
|
||||||
|
assert.Nil(t, Parse(r, &v))
|
||||||
|
assert.Equal(t, "", v.Name)
|
||||||
|
assert.Equal(t, 0, v.Age)
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestParseRequired(t *testing.T) {
|
func TestParseRequired(t *testing.T) {
|
||||||
|
|||||||
@@ -14,13 +14,17 @@ var (
|
|||||||
)
|
)
|
||||||
|
|
||||||
// Error writes err into w.
|
// Error writes err into w.
|
||||||
func Error(w http.ResponseWriter, err error) {
|
func Error(w http.ResponseWriter, err error, fns ...func(w http.ResponseWriter, err error)) {
|
||||||
lock.RLock()
|
lock.RLock()
|
||||||
handler := errorHandler
|
handler := errorHandler
|
||||||
lock.RUnlock()
|
lock.RUnlock()
|
||||||
|
|
||||||
if handler == nil {
|
if handler == nil {
|
||||||
http.Error(w, err.Error(), http.StatusBadRequest)
|
if len(fns) > 0 {
|
||||||
|
fns[0](w, err)
|
||||||
|
} else {
|
||||||
|
http.Error(w, err.Error(), http.StatusBadRequest)
|
||||||
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -95,6 +95,18 @@ func TestError(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestErrorWithHandler(t *testing.T) {
|
||||||
|
w := tracedResponseWriter{
|
||||||
|
headers: make(map[string][]string),
|
||||||
|
}
|
||||||
|
Error(&w, errors.New("foo"), func(w http.ResponseWriter, err error) {
|
||||||
|
http.Error(w, err.Error(), 499)
|
||||||
|
})
|
||||||
|
assert.Equal(t, 499, w.code)
|
||||||
|
assert.True(t, w.hasBody)
|
||||||
|
assert.Equal(t, "foo", strings.TrimSpace(w.builder.String()))
|
||||||
|
}
|
||||||
|
|
||||||
func TestOk(t *testing.T) {
|
func TestOk(t *testing.T) {
|
||||||
w := tracedResponseWriter{
|
w := tracedResponseWriter{
|
||||||
headers: make(map[string][]string),
|
headers: make(map[string][]string),
|
||||||
|
|||||||
@@ -119,16 +119,13 @@ func VerifySignature(r *http.Request, securityHeader *ContentSecurityHeader, tol
|
|||||||
}, "\n")
|
}, "\n")
|
||||||
actualSignature := codec.HmacBase64(securityHeader.Key, signContent)
|
actualSignature := codec.HmacBase64(securityHeader.Key, signContent)
|
||||||
|
|
||||||
passed := securityHeader.Signature == actualSignature
|
if securityHeader.Signature == actualSignature {
|
||||||
if !passed {
|
|
||||||
logx.Infof("signature different, expect: %s, actual: %s",
|
|
||||||
securityHeader.Signature, actualSignature)
|
|
||||||
}
|
|
||||||
|
|
||||||
if passed {
|
|
||||||
return httpx.CodeSignaturePass
|
return httpx.CodeSignaturePass
|
||||||
}
|
}
|
||||||
|
|
||||||
|
logx.Infof("signature different, expect: %s, actual: %s",
|
||||||
|
securityHeader.Signature, actualSignature)
|
||||||
|
|
||||||
return httpx.CodeSignatureInvalidToken
|
return httpx.CodeSignatureInvalidToken
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
package pathvar
|
package pathvar
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
|
||||||
"net/http"
|
"net/http"
|
||||||
"strings"
|
"strings"
|
||||||
"testing"
|
"testing"
|
||||||
@@ -16,7 +15,7 @@ func TestVars(t *testing.T) {
|
|||||||
}
|
}
|
||||||
r, err := http.NewRequest(http.MethodGet, "/", nil)
|
r, err := http.NewRequest(http.MethodGet, "/", nil)
|
||||||
assert.Nil(t, err)
|
assert.Nil(t, err)
|
||||||
r = r.WithContext(context.WithValue(context.Background(), pathVars, expect))
|
r = WithVars(r, expect)
|
||||||
assert.EqualValues(t, expect, Vars(r))
|
assert.EqualValues(t, expect, Vars(r))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ import (
|
|||||||
|
|
||||||
"github.com/logrusorgru/aurora"
|
"github.com/logrusorgru/aurora"
|
||||||
"github.com/tal-tech/go-zero/tools/goctl/util"
|
"github.com/tal-tech/go-zero/tools/goctl/util"
|
||||||
|
"github.com/tal-tech/go-zero/tools/goctl/util/pathx"
|
||||||
"github.com/urfave/cli"
|
"github.com/urfave/cli"
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -46,23 +47,31 @@ func ApiCommand(c *cli.Context) error {
|
|||||||
return errors.New("missing -o")
|
return errors.New("missing -o")
|
||||||
}
|
}
|
||||||
|
|
||||||
fp, err := util.CreateIfNotExist(apiFile)
|
fp, err := pathx.CreateIfNotExist(apiFile)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
defer fp.Close()
|
defer fp.Close()
|
||||||
|
|
||||||
home := c.String("home")
|
home := c.String("home")
|
||||||
if len(home) > 0 {
|
remote := c.String("remote")
|
||||||
util.RegisterGoctlHome(home)
|
if len(remote) > 0 {
|
||||||
|
repo, _ := util.CloneIntoGitHome(remote)
|
||||||
|
if len(repo) > 0 {
|
||||||
|
home = repo
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
text, err := util.LoadTemplate(category, apiTemplateFile, apiTemplate)
|
if len(home) > 0 {
|
||||||
|
pathx.RegisterGoctlHome(home)
|
||||||
|
}
|
||||||
|
|
||||||
|
text, err := pathx.LoadTemplate(category, apiTemplateFile, apiTemplate)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
baseName := util.FileNameWithoutExt(filepath.Base(apiFile))
|
baseName := pathx.FileNameWithoutExt(filepath.Base(apiFile))
|
||||||
if strings.HasSuffix(strings.ToLower(baseName), "-api") {
|
if strings.HasSuffix(strings.ToLower(baseName), "-api") {
|
||||||
baseName = baseName[:len(baseName)-4]
|
baseName = baseName[:len(baseName)-4]
|
||||||
} else if strings.HasSuffix(strings.ToLower(baseName), "api") {
|
} else if strings.HasSuffix(strings.ToLower(baseName), "api") {
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ package apigen
|
|||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
|
||||||
"github.com/tal-tech/go-zero/tools/goctl/util"
|
"github.com/tal-tech/go-zero/tools/goctl/util/pathx"
|
||||||
"github.com/urfave/cli"
|
"github.com/urfave/cli"
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -23,12 +23,12 @@ func Category() string {
|
|||||||
|
|
||||||
// Clean cleans the generated deployment files.
|
// Clean cleans the generated deployment files.
|
||||||
func Clean() error {
|
func Clean() error {
|
||||||
return util.Clean(category)
|
return pathx.Clean(category)
|
||||||
}
|
}
|
||||||
|
|
||||||
// GenTemplates generates api template files.
|
// GenTemplates generates api template files.
|
||||||
func GenTemplates(_ *cli.Context) error {
|
func GenTemplates(_ *cli.Context) error {
|
||||||
return util.InitTemplates(category, templates)
|
return pathx.InitTemplates(category, templates)
|
||||||
}
|
}
|
||||||
|
|
||||||
// RevertTemplate reverts the given template file to the default value.
|
// RevertTemplate reverts the given template file to the default value.
|
||||||
@@ -37,7 +37,7 @@ func RevertTemplate(name string) error {
|
|||||||
if !ok {
|
if !ok {
|
||||||
return fmt.Errorf("%s: no such file name", name)
|
return fmt.Errorf("%s: no such file name", name)
|
||||||
}
|
}
|
||||||
return util.CreateTemplate(category, name, content)
|
return pathx.CreateTemplate(category, name, content)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update updates the template files to the templates built in current goctl.
|
// Update updates the template files to the templates built in current goctl.
|
||||||
@@ -47,5 +47,5 @@ func Update() error {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
return util.InitTemplates(category, templates)
|
return pathx.InitTemplates(category, templates)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ import (
|
|||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/tal-tech/go-zero/tools/goctl/api/parser"
|
"github.com/tal-tech/go-zero/tools/goctl/api/parser"
|
||||||
"github.com/tal-tech/go-zero/tools/goctl/util"
|
"github.com/tal-tech/go-zero/tools/goctl/util/pathx"
|
||||||
"github.com/urfave/cli"
|
"github.com/urfave/cli"
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -28,7 +28,7 @@ func DocCommand(c *cli.Context) error {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if !util.FileExists(dir) {
|
if !pathx.FileExists(dir) {
|
||||||
return fmt.Errorf("dir %s not exsit", dir)
|
return fmt.Errorf("dir %s not exsit", dir)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ import (
|
|||||||
"github.com/tal-tech/go-zero/core/errorx"
|
"github.com/tal-tech/go-zero/core/errorx"
|
||||||
"github.com/tal-tech/go-zero/tools/goctl/api/parser"
|
"github.com/tal-tech/go-zero/tools/goctl/api/parser"
|
||||||
"github.com/tal-tech/go-zero/tools/goctl/api/util"
|
"github.com/tal-tech/go-zero/tools/goctl/api/util"
|
||||||
ctlutil "github.com/tal-tech/go-zero/tools/goctl/util"
|
"github.com/tal-tech/go-zero/tools/goctl/util/pathx"
|
||||||
"github.com/urfave/cli"
|
"github.com/urfave/cli"
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -124,7 +124,7 @@ func apiFormat(data string, filename ...string) (string, error) {
|
|||||||
newLineCount++
|
newLineCount++
|
||||||
} else {
|
} else {
|
||||||
if preLine == rightBrace {
|
if preLine == rightBrace {
|
||||||
builder.WriteString(ctlutil.NL)
|
builder.WriteString(pathx.NL)
|
||||||
}
|
}
|
||||||
newLineCount = 0
|
newLineCount = 0
|
||||||
}
|
}
|
||||||
@@ -152,7 +152,7 @@ func apiFormat(data string, filename ...string) (string, error) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
util.WriteIndent(&builder, tapCount)
|
util.WriteIndent(&builder, tapCount)
|
||||||
builder.WriteString(line + ctlutil.NL)
|
builder.WriteString(line + pathx.NL)
|
||||||
if strings.HasSuffix(noCommentLine, leftParenthesis) || strings.HasSuffix(noCommentLine, leftBrace) {
|
if strings.HasSuffix(noCommentLine, leftParenthesis) || strings.HasSuffix(noCommentLine, leftBrace) {
|
||||||
tapCount++
|
tapCount++
|
||||||
}
|
}
|
||||||
@@ -168,10 +168,10 @@ func formatGoTypeDef(line string, scanner *bufio.Scanner, builder *strings.Build
|
|||||||
if strings.HasPrefix(noCommentLine, "type") && (strings.HasSuffix(noCommentLine, leftParenthesis) ||
|
if strings.HasPrefix(noCommentLine, "type") && (strings.HasSuffix(noCommentLine, leftParenthesis) ||
|
||||||
strings.HasSuffix(noCommentLine, leftBrace)) {
|
strings.HasSuffix(noCommentLine, leftBrace)) {
|
||||||
var typeBuilder strings.Builder
|
var typeBuilder strings.Builder
|
||||||
typeBuilder.WriteString(mayInsertStructKeyword(line, &tokenCount) + ctlutil.NL)
|
typeBuilder.WriteString(mayInsertStructKeyword(line, &tokenCount) + pathx.NL)
|
||||||
for scanner.Scan() {
|
for scanner.Scan() {
|
||||||
noCommentLine := util.RemoveComment(scanner.Text())
|
noCommentLine := util.RemoveComment(scanner.Text())
|
||||||
typeBuilder.WriteString(mayInsertStructKeyword(scanner.Text(), &tokenCount) + ctlutil.NL)
|
typeBuilder.WriteString(mayInsertStructKeyword(scanner.Text(), &tokenCount) + pathx.NL)
|
||||||
if noCommentLine == rightBrace || noCommentLine == rightParenthesis {
|
if noCommentLine == rightBrace || noCommentLine == rightParenthesis {
|
||||||
tokenCount--
|
tokenCount--
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,6 +18,7 @@ import (
|
|||||||
apiutil "github.com/tal-tech/go-zero/tools/goctl/api/util"
|
apiutil "github.com/tal-tech/go-zero/tools/goctl/api/util"
|
||||||
"github.com/tal-tech/go-zero/tools/goctl/config"
|
"github.com/tal-tech/go-zero/tools/goctl/config"
|
||||||
"github.com/tal-tech/go-zero/tools/goctl/util"
|
"github.com/tal-tech/go-zero/tools/goctl/util"
|
||||||
|
"github.com/tal-tech/go-zero/tools/goctl/util/pathx"
|
||||||
"github.com/urfave/cli"
|
"github.com/urfave/cli"
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -31,9 +32,16 @@ func GoCommand(c *cli.Context) error {
|
|||||||
dir := c.String("dir")
|
dir := c.String("dir")
|
||||||
namingStyle := c.String("style")
|
namingStyle := c.String("style")
|
||||||
home := c.String("home")
|
home := c.String("home")
|
||||||
|
remote := c.String("remote")
|
||||||
|
if len(remote) > 0 {
|
||||||
|
repo, _ := util.CloneIntoGitHome(remote)
|
||||||
|
if len(repo) > 0 {
|
||||||
|
home = repo
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if len(home) > 0 {
|
if len(home) > 0 {
|
||||||
util.RegisterGoctlHome(home)
|
pathx.RegisterGoctlHome(home)
|
||||||
}
|
}
|
||||||
if len(apiFile) == 0 {
|
if len(apiFile) == 0 {
|
||||||
return errors.New("missing -api")
|
return errors.New("missing -api")
|
||||||
@@ -57,7 +65,7 @@ func DoGenProject(apiFile, dir, style string) error {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
logx.Must(util.MkdirIfNotExist(dir))
|
logx.Must(pathx.MkdirIfNotExist(dir))
|
||||||
rootPkg, err := getParentPackage(dir)
|
rootPkg, err := getParentPackage(dir)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
|
|||||||
@@ -78,7 +78,7 @@ service A-api {
|
|||||||
@server(
|
@server(
|
||||||
handler: NoResponseHandler
|
handler: NoResponseHandler
|
||||||
)
|
)
|
||||||
get /greet/get(Request) returns
|
get /greet/get(Request)
|
||||||
}
|
}
|
||||||
`
|
`
|
||||||
|
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ import (
|
|||||||
"github.com/tal-tech/go-zero/tools/goctl/internal/version"
|
"github.com/tal-tech/go-zero/tools/goctl/internal/version"
|
||||||
"github.com/tal-tech/go-zero/tools/goctl/util"
|
"github.com/tal-tech/go-zero/tools/goctl/util"
|
||||||
"github.com/tal-tech/go-zero/tools/goctl/util/format"
|
"github.com/tal-tech/go-zero/tools/goctl/util/format"
|
||||||
|
"github.com/tal-tech/go-zero/tools/goctl/util/pathx"
|
||||||
"github.com/tal-tech/go-zero/tools/goctl/vars"
|
"github.com/tal-tech/go-zero/tools/goctl/vars"
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -24,7 +25,7 @@ import (
|
|||||||
{{.ImportPackages}}
|
{{.ImportPackages}}
|
||||||
)
|
)
|
||||||
|
|
||||||
func {{.HandlerName}}(ctx *svc.ServiceContext) http.HandlerFunc {
|
func {{.HandlerName}}(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
||||||
return func(w http.ResponseWriter, r *http.Request) {
|
return func(w http.ResponseWriter, r *http.Request) {
|
||||||
{{if .HasRequest}}var req types.{{.RequestType}}
|
{{if .HasRequest}}var req types.{{.RequestType}}
|
||||||
if err := httpx.Parse(r, &req); err != nil {
|
if err := httpx.Parse(r, &req); err != nil {
|
||||||
@@ -32,7 +33,7 @@ func {{.HandlerName}}(ctx *svc.ServiceContext) http.HandlerFunc {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
{{end}}l := {{.LogicName}}.New{{.LogicType}}(r.Context(), ctx)
|
{{end}}l := {{.LogicName}}.New{{.LogicType}}(r.Context(), svcCtx)
|
||||||
{{if .HasResp}}resp, {{end}}err := l.{{.Call}}({{if .HasRequest}}req{{end}})
|
{{if .HasResp}}resp, {{end}}err := l.{{.Call}}({{if .HasRequest}}req{{end}})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
httpx.Error(w, err)
|
httpx.Error(w, err)
|
||||||
@@ -122,10 +123,10 @@ func genHandlers(dir, rootPkg string, cfg *config.Config, api *spec.ApiSpec) err
|
|||||||
func genHandlerImports(group spec.Group, route spec.Route, parentPkg string) string {
|
func genHandlerImports(group spec.Group, route spec.Route, parentPkg string) string {
|
||||||
var imports []string
|
var imports []string
|
||||||
imports = append(imports, fmt.Sprintf("\"%s\"",
|
imports = append(imports, fmt.Sprintf("\"%s\"",
|
||||||
util.JoinPackages(parentPkg, getLogicFolderPath(group, route))))
|
pathx.JoinPackages(parentPkg, getLogicFolderPath(group, route))))
|
||||||
imports = append(imports, fmt.Sprintf("\"%s\"", util.JoinPackages(parentPkg, contextDir)))
|
imports = append(imports, fmt.Sprintf("\"%s\"", pathx.JoinPackages(parentPkg, contextDir)))
|
||||||
if len(route.RequestTypeName()) > 0 {
|
if len(route.RequestTypeName()) > 0 {
|
||||||
imports = append(imports, fmt.Sprintf("\"%s\"\n", util.JoinPackages(parentPkg, typesDir)))
|
imports = append(imports, fmt.Sprintf("\"%s\"\n", pathx.JoinPackages(parentPkg, typesDir)))
|
||||||
}
|
}
|
||||||
|
|
||||||
currentVersion := version.GetGoctlVersion()
|
currentVersion := version.GetGoctlVersion()
|
||||||
|
|||||||
@@ -9,8 +9,8 @@ import (
|
|||||||
"github.com/tal-tech/go-zero/tools/goctl/api/parser/g4/gen/api"
|
"github.com/tal-tech/go-zero/tools/goctl/api/parser/g4/gen/api"
|
||||||
"github.com/tal-tech/go-zero/tools/goctl/api/spec"
|
"github.com/tal-tech/go-zero/tools/goctl/api/spec"
|
||||||
"github.com/tal-tech/go-zero/tools/goctl/config"
|
"github.com/tal-tech/go-zero/tools/goctl/config"
|
||||||
ctlutil "github.com/tal-tech/go-zero/tools/goctl/util"
|
|
||||||
"github.com/tal-tech/go-zero/tools/goctl/util/format"
|
"github.com/tal-tech/go-zero/tools/goctl/util/format"
|
||||||
|
"github.com/tal-tech/go-zero/tools/goctl/util/pathx"
|
||||||
"github.com/tal-tech/go-zero/tools/goctl/vars"
|
"github.com/tal-tech/go-zero/tools/goctl/vars"
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -113,9 +113,9 @@ func getLogicFolderPath(group spec.Group, route spec.Route) string {
|
|||||||
func genLogicImports(route spec.Route, parentPkg string) string {
|
func genLogicImports(route spec.Route, parentPkg string) string {
|
||||||
var imports []string
|
var imports []string
|
||||||
imports = append(imports, `"context"`+"\n")
|
imports = append(imports, `"context"`+"\n")
|
||||||
imports = append(imports, fmt.Sprintf("\"%s\"", ctlutil.JoinPackages(parentPkg, contextDir)))
|
imports = append(imports, fmt.Sprintf("\"%s\"", pathx.JoinPackages(parentPkg, contextDir)))
|
||||||
if shallImportTypesPackage(route) {
|
if shallImportTypesPackage(route) {
|
||||||
imports = append(imports, fmt.Sprintf("\"%s\"\n", ctlutil.JoinPackages(parentPkg, typesDir)))
|
imports = append(imports, fmt.Sprintf("\"%s\"\n", pathx.JoinPackages(parentPkg, typesDir)))
|
||||||
}
|
}
|
||||||
imports = append(imports, fmt.Sprintf("\"%s/core/logx\"", vars.ProjectOpenSourceURL))
|
imports = append(imports, fmt.Sprintf("\"%s/core/logx\"", vars.ProjectOpenSourceURL))
|
||||||
return strings.Join(imports, "\n\t")
|
return strings.Join(imports, "\n\t")
|
||||||
|
|||||||
@@ -6,8 +6,8 @@ import (
|
|||||||
|
|
||||||
"github.com/tal-tech/go-zero/tools/goctl/api/spec"
|
"github.com/tal-tech/go-zero/tools/goctl/api/spec"
|
||||||
"github.com/tal-tech/go-zero/tools/goctl/config"
|
"github.com/tal-tech/go-zero/tools/goctl/config"
|
||||||
ctlutil "github.com/tal-tech/go-zero/tools/goctl/util"
|
|
||||||
"github.com/tal-tech/go-zero/tools/goctl/util/format"
|
"github.com/tal-tech/go-zero/tools/goctl/util/format"
|
||||||
|
"github.com/tal-tech/go-zero/tools/goctl/util/pathx"
|
||||||
"github.com/tal-tech/go-zero/tools/goctl/vars"
|
"github.com/tal-tech/go-zero/tools/goctl/vars"
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -68,9 +68,9 @@ func genMain(dir, rootPkg string, cfg *config.Config, api *spec.ApiSpec) error {
|
|||||||
|
|
||||||
func genMainImports(parentPkg string) string {
|
func genMainImports(parentPkg string) string {
|
||||||
var imports []string
|
var imports []string
|
||||||
imports = append(imports, fmt.Sprintf("\"%s\"", ctlutil.JoinPackages(parentPkg, configDir)))
|
imports = append(imports, fmt.Sprintf("\"%s\"", pathx.JoinPackages(parentPkg, configDir)))
|
||||||
imports = append(imports, fmt.Sprintf("\"%s\"", ctlutil.JoinPackages(parentPkg, handlerDir)))
|
imports = append(imports, fmt.Sprintf("\"%s\"", pathx.JoinPackages(parentPkg, handlerDir)))
|
||||||
imports = append(imports, fmt.Sprintf("\"%s\"\n", ctlutil.JoinPackages(parentPkg, contextDir)))
|
imports = append(imports, fmt.Sprintf("\"%s\"\n", pathx.JoinPackages(parentPkg, contextDir)))
|
||||||
imports = append(imports, fmt.Sprintf("\"%s/core/conf\"", vars.ProjectOpenSourceURL))
|
imports = append(imports, fmt.Sprintf("\"%s/core/conf\"", vars.ProjectOpenSourceURL))
|
||||||
imports = append(imports, fmt.Sprintf("\"%s/rest\"", vars.ProjectOpenSourceURL))
|
imports = append(imports, fmt.Sprintf("\"%s/rest\"", vars.ProjectOpenSourceURL))
|
||||||
return strings.Join(imports, "\n\t")
|
return strings.Join(imports, "\n\t")
|
||||||
|
|||||||
@@ -11,8 +11,8 @@ import (
|
|||||||
"github.com/tal-tech/go-zero/core/collection"
|
"github.com/tal-tech/go-zero/core/collection"
|
||||||
"github.com/tal-tech/go-zero/tools/goctl/api/spec"
|
"github.com/tal-tech/go-zero/tools/goctl/api/spec"
|
||||||
"github.com/tal-tech/go-zero/tools/goctl/config"
|
"github.com/tal-tech/go-zero/tools/goctl/config"
|
||||||
"github.com/tal-tech/go-zero/tools/goctl/util"
|
|
||||||
"github.com/tal-tech/go-zero/tools/goctl/util/format"
|
"github.com/tal-tech/go-zero/tools/goctl/util/format"
|
||||||
|
"github.com/tal-tech/go-zero/tools/goctl/util/pathx"
|
||||||
"github.com/tal-tech/go-zero/tools/goctl/vars"
|
"github.com/tal-tech/go-zero/tools/goctl/vars"
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -151,7 +151,7 @@ rest.WithPrefix("%s"),`, g.prefix)
|
|||||||
|
|
||||||
func genRouteImports(parentPkg string, api *spec.ApiSpec) string {
|
func genRouteImports(parentPkg string, api *spec.ApiSpec) string {
|
||||||
importSet := collection.NewSet()
|
importSet := collection.NewSet()
|
||||||
importSet.AddStr(fmt.Sprintf("\"%s\"", util.JoinPackages(parentPkg, contextDir)))
|
importSet.AddStr(fmt.Sprintf("\"%s\"", pathx.JoinPackages(parentPkg, contextDir)))
|
||||||
for _, group := range api.Service.Groups {
|
for _, group := range api.Service.Groups {
|
||||||
for _, route := range group.Routes {
|
for _, route := range group.Routes {
|
||||||
folder := route.GetAnnotation(groupProperty)
|
folder := route.GetAnnotation(groupProperty)
|
||||||
@@ -161,7 +161,7 @@ func genRouteImports(parentPkg string, api *spec.ApiSpec) string {
|
|||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
importSet.AddStr(fmt.Sprintf("%s \"%s\"", toPrefix(folder), util.JoinPackages(parentPkg, handlerDir, folder)))
|
importSet.AddStr(fmt.Sprintf("%s \"%s\"", toPrefix(folder), pathx.JoinPackages(parentPkg, handlerDir, folder)))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
imports := importSet.KeysStr()
|
imports := importSet.KeysStr()
|
||||||
|
|||||||
@@ -6,8 +6,8 @@ import (
|
|||||||
|
|
||||||
"github.com/tal-tech/go-zero/tools/goctl/api/spec"
|
"github.com/tal-tech/go-zero/tools/goctl/api/spec"
|
||||||
"github.com/tal-tech/go-zero/tools/goctl/config"
|
"github.com/tal-tech/go-zero/tools/goctl/config"
|
||||||
ctlutil "github.com/tal-tech/go-zero/tools/goctl/util"
|
|
||||||
"github.com/tal-tech/go-zero/tools/goctl/util/format"
|
"github.com/tal-tech/go-zero/tools/goctl/util/format"
|
||||||
|
"github.com/tal-tech/go-zero/tools/goctl/util/pathx"
|
||||||
"github.com/tal-tech/go-zero/tools/goctl/vars"
|
"github.com/tal-tech/go-zero/tools/goctl/vars"
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -50,9 +50,9 @@ func genServiceContext(dir, rootPkg string, cfg *config.Config, api *spec.ApiSpe
|
|||||||
fmt.Sprintf("middleware.New%s().%s", strings.Title(name), "Handle"))
|
fmt.Sprintf("middleware.New%s().%s", strings.Title(name), "Handle"))
|
||||||
}
|
}
|
||||||
|
|
||||||
configImport := "\"" + ctlutil.JoinPackages(rootPkg, configDir) + "\""
|
configImport := "\"" + pathx.JoinPackages(rootPkg, configDir) + "\""
|
||||||
if len(middlewareStr) > 0 {
|
if len(middlewareStr) > 0 {
|
||||||
configImport += "\n\t\"" + ctlutil.JoinPackages(rootPkg, middlewareDir) + "\""
|
configImport += "\n\t\"" + pathx.JoinPackages(rootPkg, middlewareDir) + "\""
|
||||||
configImport += fmt.Sprintf("\n\t\"%s/rest\"", vars.ProjectOpenSourceURL)
|
configImport += fmt.Sprintf("\n\t\"%s/rest\"", vars.ProjectOpenSourceURL)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ package gogen
|
|||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
|
||||||
"github.com/tal-tech/go-zero/tools/goctl/util"
|
"github.com/tal-tech/go-zero/tools/goctl/util/pathx"
|
||||||
"github.com/urfave/cli"
|
"github.com/urfave/cli"
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -33,12 +33,12 @@ func Category() string {
|
|||||||
|
|
||||||
// Clean cleans the generated deployment files.
|
// Clean cleans the generated deployment files.
|
||||||
func Clean() error {
|
func Clean() error {
|
||||||
return util.Clean(category)
|
return pathx.Clean(category)
|
||||||
}
|
}
|
||||||
|
|
||||||
// GenTemplates generates api template files.
|
// GenTemplates generates api template files.
|
||||||
func GenTemplates(_ *cli.Context) error {
|
func GenTemplates(_ *cli.Context) error {
|
||||||
return util.InitTemplates(category, templates)
|
return pathx.InitTemplates(category, templates)
|
||||||
}
|
}
|
||||||
|
|
||||||
// RevertTemplate reverts the given template file to the default value.
|
// RevertTemplate reverts the given template file to the default value.
|
||||||
@@ -47,7 +47,7 @@ func RevertTemplate(name string) error {
|
|||||||
if !ok {
|
if !ok {
|
||||||
return fmt.Errorf("%s: no such file name", name)
|
return fmt.Errorf("%s: no such file name", name)
|
||||||
}
|
}
|
||||||
return util.CreateTemplate(category, name, content)
|
return pathx.CreateTemplate(category, name, content)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update updates the template files to the templates built in current goctl.
|
// Update updates the template files to the templates built in current goctl.
|
||||||
@@ -57,5 +57,5 @@ func Update() error {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
return util.InitTemplates(category, templates)
|
return pathx.InitTemplates(category, templates)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,13 +6,13 @@ import (
|
|||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/stretchr/testify/assert"
|
"github.com/stretchr/testify/assert"
|
||||||
"github.com/tal-tech/go-zero/tools/goctl/util"
|
"github.com/tal-tech/go-zero/tools/goctl/util/pathx"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestGenTemplates(t *testing.T) {
|
func TestGenTemplates(t *testing.T) {
|
||||||
err := util.InitTemplates(category, templates)
|
err := pathx.InitTemplates(category, templates)
|
||||||
assert.Nil(t, err)
|
assert.Nil(t, err)
|
||||||
dir, err := util.GetTemplateDir(category)
|
dir, err := pathx.GetTemplateDir(category)
|
||||||
assert.Nil(t, err)
|
assert.Nil(t, err)
|
||||||
file := filepath.Join(dir, "main.tpl")
|
file := filepath.Join(dir, "main.tpl")
|
||||||
data, err := ioutil.ReadFile(file)
|
data, err := ioutil.ReadFile(file)
|
||||||
@@ -22,10 +22,10 @@ func TestGenTemplates(t *testing.T) {
|
|||||||
|
|
||||||
func TestRevertTemplate(t *testing.T) {
|
func TestRevertTemplate(t *testing.T) {
|
||||||
name := "main.tpl"
|
name := "main.tpl"
|
||||||
err := util.InitTemplates(category, templates)
|
err := pathx.InitTemplates(category, templates)
|
||||||
assert.Nil(t, err)
|
assert.Nil(t, err)
|
||||||
|
|
||||||
dir, err := util.GetTemplateDir(category)
|
dir, err := pathx.GetTemplateDir(category)
|
||||||
assert.Nil(t, err)
|
assert.Nil(t, err)
|
||||||
|
|
||||||
file := filepath.Join(dir, name)
|
file := filepath.Join(dir, name)
|
||||||
@@ -33,7 +33,7 @@ func TestRevertTemplate(t *testing.T) {
|
|||||||
assert.Nil(t, err)
|
assert.Nil(t, err)
|
||||||
|
|
||||||
modifyData := string(data) + "modify"
|
modifyData := string(data) + "modify"
|
||||||
err = util.CreateTemplate(category, name, modifyData)
|
err = pathx.CreateTemplate(category, name, modifyData)
|
||||||
assert.Nil(t, err)
|
assert.Nil(t, err)
|
||||||
|
|
||||||
data, err = ioutil.ReadFile(file)
|
data, err = ioutil.ReadFile(file)
|
||||||
@@ -50,12 +50,12 @@ func TestRevertTemplate(t *testing.T) {
|
|||||||
|
|
||||||
func TestClean(t *testing.T) {
|
func TestClean(t *testing.T) {
|
||||||
name := "main.tpl"
|
name := "main.tpl"
|
||||||
err := util.InitTemplates(category, templates)
|
err := pathx.InitTemplates(category, templates)
|
||||||
assert.Nil(t, err)
|
assert.Nil(t, err)
|
||||||
|
|
||||||
assert.Nil(t, Clean())
|
assert.Nil(t, Clean())
|
||||||
|
|
||||||
dir, err := util.GetTemplateDir(category)
|
dir, err := pathx.GetTemplateDir(category)
|
||||||
assert.Nil(t, err)
|
assert.Nil(t, err)
|
||||||
|
|
||||||
file := filepath.Join(dir, name)
|
file := filepath.Join(dir, name)
|
||||||
@@ -65,10 +65,10 @@ func TestClean(t *testing.T) {
|
|||||||
|
|
||||||
func TestUpdate(t *testing.T) {
|
func TestUpdate(t *testing.T) {
|
||||||
name := "main.tpl"
|
name := "main.tpl"
|
||||||
err := util.InitTemplates(category, templates)
|
err := pathx.InitTemplates(category, templates)
|
||||||
assert.Nil(t, err)
|
assert.Nil(t, err)
|
||||||
|
|
||||||
dir, err := util.GetTemplateDir(category)
|
dir, err := pathx.GetTemplateDir(category)
|
||||||
assert.Nil(t, err)
|
assert.Nil(t, err)
|
||||||
|
|
||||||
file := filepath.Join(dir, name)
|
file := filepath.Join(dir, name)
|
||||||
@@ -76,7 +76,7 @@ func TestUpdate(t *testing.T) {
|
|||||||
assert.Nil(t, err)
|
assert.Nil(t, err)
|
||||||
|
|
||||||
modifyData := string(data) + "modify"
|
modifyData := string(data) + "modify"
|
||||||
err = util.CreateTemplate(category, name, modifyData)
|
err = pathx.CreateTemplate(category, name, modifyData)
|
||||||
assert.Nil(t, err)
|
assert.Nil(t, err)
|
||||||
|
|
||||||
data, err = ioutil.ReadFile(file)
|
data, err = ioutil.ReadFile(file)
|
||||||
|
|||||||
@@ -12,8 +12,8 @@ import (
|
|||||||
"github.com/tal-tech/go-zero/core/collection"
|
"github.com/tal-tech/go-zero/core/collection"
|
||||||
"github.com/tal-tech/go-zero/tools/goctl/api/spec"
|
"github.com/tal-tech/go-zero/tools/goctl/api/spec"
|
||||||
"github.com/tal-tech/go-zero/tools/goctl/api/util"
|
"github.com/tal-tech/go-zero/tools/goctl/api/util"
|
||||||
ctlutil "github.com/tal-tech/go-zero/tools/goctl/util"
|
|
||||||
"github.com/tal-tech/go-zero/tools/goctl/util/ctx"
|
"github.com/tal-tech/go-zero/tools/goctl/util/ctx"
|
||||||
|
"github.com/tal-tech/go-zero/tools/goctl/util/pathx"
|
||||||
)
|
)
|
||||||
|
|
||||||
type fileGenConfig struct {
|
type fileGenConfig struct {
|
||||||
@@ -41,7 +41,7 @@ func genFile(c fileGenConfig) error {
|
|||||||
if len(c.category) == 0 || len(c.templateFile) == 0 {
|
if len(c.category) == 0 || len(c.templateFile) == 0 {
|
||||||
text = c.builtinTemplate
|
text = c.builtinTemplate
|
||||||
} else {
|
} else {
|
||||||
text, err = ctlutil.LoadTemplate(c.category, c.templateFile, c.builtinTemplate)
|
text, err = pathx.LoadTemplate(c.category, c.templateFile, c.builtinTemplate)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
@@ -73,7 +73,7 @@ func getParentPackage(dir string) (string, error) {
|
|||||||
// fix https://github.com/zeromicro/go-zero/issues/1058
|
// fix https://github.com/zeromicro/go-zero/issues/1058
|
||||||
wd := projectCtx.WorkDir
|
wd := projectCtx.WorkDir
|
||||||
d := projectCtx.Dir
|
d := projectCtx.Dir
|
||||||
same, err := ctlutil.SameFile(wd, d)
|
same, err := pathx.SameFile(wd, d)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return "", err
|
return "", err
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ import (
|
|||||||
"github.com/logrusorgru/aurora"
|
"github.com/logrusorgru/aurora"
|
||||||
"github.com/tal-tech/go-zero/core/logx"
|
"github.com/tal-tech/go-zero/core/logx"
|
||||||
"github.com/tal-tech/go-zero/tools/goctl/api/parser"
|
"github.com/tal-tech/go-zero/tools/goctl/api/parser"
|
||||||
"github.com/tal-tech/go-zero/tools/goctl/util"
|
"github.com/tal-tech/go-zero/tools/goctl/util/pathx"
|
||||||
"github.com/urfave/cli"
|
"github.com/urfave/cli"
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -30,7 +30,7 @@ func JavaCommand(c *cli.Context) error {
|
|||||||
|
|
||||||
api.Service = api.Service.JoinPrefix()
|
api.Service = api.Service.JoinPrefix()
|
||||||
packetName := strings.TrimSuffix(api.Service.Name, "-api")
|
packetName := strings.TrimSuffix(api.Service.Name, "-api")
|
||||||
logx.Must(util.MkdirIfNotExist(dir))
|
logx.Must(pathx.MkdirIfNotExist(dir))
|
||||||
logx.Must(genPacket(dir, packetName, api))
|
logx.Must(genPacket(dir, packetName, api))
|
||||||
logx.Must(genComponents(dir, packetName, api))
|
logx.Must(genComponents(dir, packetName, api))
|
||||||
|
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ import (
|
|||||||
"github.com/tal-tech/go-zero/tools/goctl/api/spec"
|
"github.com/tal-tech/go-zero/tools/goctl/api/spec"
|
||||||
apiutil "github.com/tal-tech/go-zero/tools/goctl/api/util"
|
apiutil "github.com/tal-tech/go-zero/tools/goctl/api/util"
|
||||||
"github.com/tal-tech/go-zero/tools/goctl/util"
|
"github.com/tal-tech/go-zero/tools/goctl/util"
|
||||||
|
"github.com/tal-tech/go-zero/tools/goctl/util/pathx"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
@@ -110,7 +111,7 @@ func (c *componentsContext) createComponent(dir, packetName string, ty spec.Type
|
|||||||
|
|
||||||
modelFile := util.Title(ty.Name()) + ".java"
|
modelFile := util.Title(ty.Name()) + ".java"
|
||||||
filename := path.Join(dir, modelDir, modelFile)
|
filename := path.Join(dir, modelDir, modelFile)
|
||||||
if err := util.RemoveOrQuit(filename); err != nil {
|
if err := pathx.RemoveOrQuit(filename); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -270,7 +271,7 @@ func (c *componentsContext) buildConstructor() (string, string, error) {
|
|||||||
writeIndent(&constructorSetter, 2)
|
writeIndent(&constructorSetter, 2)
|
||||||
constructorSetter.WriteString(fmt.Sprintf("this.%s = %s;", pn, util.Untitle(member.Name)))
|
constructorSetter.WriteString(fmt.Sprintf("this.%s = %s;", pn, util.Untitle(member.Name)))
|
||||||
if index != len(c.members)-1 {
|
if index != len(c.members)-1 {
|
||||||
constructorSetter.WriteString(util.NL)
|
constructorSetter.WriteString(pathx.NL)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return params.String(), constructorSetter.String(), nil
|
return params.String(), constructorSetter.String(), nil
|
||||||
|
|||||||
@@ -8,12 +8,13 @@ import (
|
|||||||
|
|
||||||
"github.com/tal-tech/go-zero/tools/goctl/api/spec"
|
"github.com/tal-tech/go-zero/tools/goctl/api/spec"
|
||||||
"github.com/tal-tech/go-zero/tools/goctl/util"
|
"github.com/tal-tech/go-zero/tools/goctl/util"
|
||||||
|
"github.com/tal-tech/go-zero/tools/goctl/util/pathx"
|
||||||
)
|
)
|
||||||
|
|
||||||
func writeProperty(writer io.Writer, member spec.Member, indent int) error {
|
func writeProperty(writer io.Writer, member spec.Member, indent int) error {
|
||||||
if len(member.Comment) > 0 {
|
if len(member.Comment) > 0 {
|
||||||
writeIndent(writer, indent)
|
writeIndent(writer, indent)
|
||||||
fmt.Fprint(writer, member.Comment+util.NL)
|
fmt.Fprint(writer, member.Comment+pathx.NL)
|
||||||
}
|
}
|
||||||
writeIndent(writer, indent)
|
writeIndent(writer, indent)
|
||||||
ty, err := specTypeToJava(member.Type)
|
ty, err := specTypeToJava(member.Type)
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ import (
|
|||||||
"github.com/tal-tech/go-zero/tools/goctl/api/gogen"
|
"github.com/tal-tech/go-zero/tools/goctl/api/gogen"
|
||||||
conf "github.com/tal-tech/go-zero/tools/goctl/config"
|
conf "github.com/tal-tech/go-zero/tools/goctl/config"
|
||||||
"github.com/tal-tech/go-zero/tools/goctl/util"
|
"github.com/tal-tech/go-zero/tools/goctl/util"
|
||||||
|
"github.com/tal-tech/go-zero/tools/goctl/util/pathx"
|
||||||
"github.com/urfave/cli"
|
"github.com/urfave/cli"
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -36,6 +37,10 @@ func CreateServiceCommand(c *cli.Context) error {
|
|||||||
dirName = "greet"
|
dirName = "greet"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
dirStyle := c.String("style")
|
||||||
|
if len(dirStyle) == 0 {
|
||||||
|
dirStyle = conf.DefaultFormat
|
||||||
|
}
|
||||||
if strings.Contains(dirName, "-") {
|
if strings.Contains(dirName, "-") {
|
||||||
return errors.New("api new command service name not support strikethrough, because this will used by function name")
|
return errors.New("api new command service name not support strikethrough, because this will used by function name")
|
||||||
}
|
}
|
||||||
@@ -45,7 +50,7 @@ func CreateServiceCommand(c *cli.Context) error {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
err = util.MkdirIfNotExist(abs)
|
err = pathx.MkdirIfNotExist(abs)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
@@ -61,11 +66,19 @@ func CreateServiceCommand(c *cli.Context) error {
|
|||||||
defer fp.Close()
|
defer fp.Close()
|
||||||
|
|
||||||
home := c.String("home")
|
home := c.String("home")
|
||||||
if len(home) > 0 {
|
remote := c.String("remote")
|
||||||
util.RegisterGoctlHome(home)
|
if len(remote) > 0 {
|
||||||
|
repo, _ := util.CloneIntoGitHome(remote)
|
||||||
|
if len(repo) > 0 {
|
||||||
|
home = repo
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
text, err := util.LoadTemplate(category, apiTemplateFile, apiTemplate)
|
if len(home) > 0 {
|
||||||
|
pathx.RegisterGoctlHome(home)
|
||||||
|
}
|
||||||
|
|
||||||
|
text, err := pathx.LoadTemplate(category, apiTemplateFile, apiTemplate)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
@@ -78,6 +91,6 @@ func CreateServiceCommand(c *cli.Context) error {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
err = gogen.DoGenProject(apiFilePath, abs, conf.DefaultFormat)
|
err = gogen.DoGenProject(apiFilePath, abs, dirStyle)
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ package new
|
|||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
|
||||||
"github.com/tal-tech/go-zero/tools/goctl/util"
|
"github.com/tal-tech/go-zero/tools/goctl/util/pathx"
|
||||||
"github.com/urfave/cli"
|
"github.com/urfave/cli"
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -23,12 +23,12 @@ func Category() string {
|
|||||||
|
|
||||||
// Clean cleans the generated deployment files.
|
// Clean cleans the generated deployment files.
|
||||||
func Clean() error {
|
func Clean() error {
|
||||||
return util.Clean(category)
|
return pathx.Clean(category)
|
||||||
}
|
}
|
||||||
|
|
||||||
// GenTemplates generates api template files.
|
// GenTemplates generates api template files.
|
||||||
func GenTemplates(_ *cli.Context) error {
|
func GenTemplates(_ *cli.Context) error {
|
||||||
return util.InitTemplates(category, templates)
|
return pathx.InitTemplates(category, templates)
|
||||||
}
|
}
|
||||||
|
|
||||||
// RevertTemplate reverts the given template file to the default value.
|
// RevertTemplate reverts the given template file to the default value.
|
||||||
@@ -37,7 +37,7 @@ func RevertTemplate(name string) error {
|
|||||||
if !ok {
|
if !ok {
|
||||||
return fmt.Errorf("%s: no such file name", name)
|
return fmt.Errorf("%s: no such file name", name)
|
||||||
}
|
}
|
||||||
return util.CreateTemplate(category, name, content)
|
return pathx.CreateTemplate(category, name, content)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update updates the template files to the templates built in current goctl.
|
// Update updates the template files to the templates built in current goctl.
|
||||||
@@ -47,5 +47,5 @@ func Update() error {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
return util.InitTemplates(category, templates)
|
return pathx.InitTemplates(category, templates)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -63,9 +63,9 @@ serviceApi: {match(p,"service")}serviceToken=ID serviceName lbrace='{' servi
|
|||||||
serviceRoute: atDoc? (atServer|atHandler) route;
|
serviceRoute: atDoc? (atServer|atHandler) route;
|
||||||
atDoc: ATDOC lp='('? ((kvLit+)|STRING) rp=')'?;
|
atDoc: ATDOC lp='('? ((kvLit+)|STRING) rp=')'?;
|
||||||
atHandler: ATHANDLER ID;
|
atHandler: ATHANDLER ID;
|
||||||
route: {checkHTTPMethod(p)}httpMethod=ID path request=body? returnToken=ID? response=replybody?;
|
route: {checkHTTPMethod(p)}httpMethod=ID path request=body? response=replybody?;
|
||||||
body: lp='(' (ID)? rp=')';
|
body: lp='(' (ID)? rp=')';
|
||||||
replybody: lp='(' dataType? rp=')';
|
replybody: returnToken='returns' lp='(' dataType? rp=')';
|
||||||
// kv
|
// kv
|
||||||
kvLit: key=ID {checkKeyValue(p)}value=LINE_VALUE;
|
kvLit: key=ID {checkKeyValue(p)}value=LINE_VALUE;
|
||||||
|
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ type (
|
|||||||
// ApiVisitor wraps api.BaseApiParserVisitor to call methods which has prefix Visit to
|
// ApiVisitor wraps api.BaseApiParserVisitor to call methods which has prefix Visit to
|
||||||
// visit node from the api syntax
|
// visit node from the api syntax
|
||||||
ApiVisitor struct {
|
ApiVisitor struct {
|
||||||
api.BaseApiParserVisitor
|
*api.BaseApiParserVisitor
|
||||||
debug bool
|
debug bool
|
||||||
log console.Console
|
log console.Console
|
||||||
prefix string
|
prefix string
|
||||||
|
|||||||
@@ -71,9 +71,10 @@ type Route struct {
|
|||||||
|
|
||||||
// Body describes request,response body ast for api syntax
|
// Body describes request,response body ast for api syntax
|
||||||
type Body struct {
|
type Body struct {
|
||||||
Lp Expr
|
ReturnExpr Expr
|
||||||
Rp Expr
|
Lp Expr
|
||||||
Name DataType
|
Rp Expr
|
||||||
|
Name DataType
|
||||||
}
|
}
|
||||||
|
|
||||||
// VisitServiceSpec implements from api.BaseApiParserVisitor
|
// VisitServiceSpec implements from api.BaseApiParserVisitor
|
||||||
@@ -175,7 +176,7 @@ func (v *ApiVisitor) VisitAtHandler(ctx *api.AtHandlerContext) interface{} {
|
|||||||
return &atHandler
|
return &atHandler
|
||||||
}
|
}
|
||||||
|
|
||||||
// VisitRoute implements from api.BaseApiParserVisitor
|
// serVisitRoute implements from api.BaseApiParserVisitor
|
||||||
func (v *ApiVisitor) VisitRoute(ctx *api.RouteContext) interface{} {
|
func (v *ApiVisitor) VisitRoute(ctx *api.RouteContext) interface{} {
|
||||||
var route Route
|
var route Route
|
||||||
path := ctx.Path()
|
path := ctx.Path()
|
||||||
@@ -193,16 +194,12 @@ func (v *ApiVisitor) VisitRoute(ctx *api.RouteContext) interface{} {
|
|||||||
if ctx.GetResponse() != nil {
|
if ctx.GetResponse() != nil {
|
||||||
reply := ctx.GetResponse().Accept(v)
|
reply := ctx.GetResponse().Accept(v)
|
||||||
if reply != nil {
|
if reply != nil {
|
||||||
route.Reply = reply.(*Body)
|
resp := reply.(*Body)
|
||||||
|
route.ReturnToken = resp.ReturnExpr
|
||||||
|
resp.ReturnExpr = nil
|
||||||
|
route.Reply = resp
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ctx.GetReturnToken() != nil {
|
|
||||||
returnExpr := v.newExprWithToken(ctx.GetReturnToken())
|
|
||||||
if ctx.GetReturnToken().GetText() != "returns" {
|
|
||||||
v.panic(returnExpr, fmt.Sprintf("expecting returns, found input '%s'", ctx.GetReturnToken().GetText()))
|
|
||||||
}
|
|
||||||
route.ReturnToken = returnExpr
|
|
||||||
}
|
|
||||||
|
|
||||||
route.DocExpr = v.getDoc(ctx)
|
route.DocExpr = v.getDoc(ctx)
|
||||||
route.CommentExpr = v.getComment(ctx)
|
route.CommentExpr = v.getComment(ctx)
|
||||||
@@ -249,6 +246,14 @@ func (v *ApiVisitor) VisitReplybody(ctx *api.ReplybodyContext) interface{} {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var returnExpr Expr
|
||||||
|
if ctx.GetReturnToken() != nil {
|
||||||
|
returnExpr = v.newExprWithToken(ctx.GetReturnToken())
|
||||||
|
if ctx.GetReturnToken().GetText() != "returns" {
|
||||||
|
v.panic(returnExpr, fmt.Sprintf("expecting returns, found input '%s'", ctx.GetReturnToken().GetText()))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
dt := ctx.DataType().Accept(v).(DataType)
|
dt := ctx.DataType().Accept(v).(DataType)
|
||||||
if dt == nil {
|
if dt == nil {
|
||||||
return nil
|
return nil
|
||||||
@@ -275,9 +280,10 @@ func (v *ApiVisitor) VisitReplybody(ctx *api.ReplybodyContext) interface{} {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return &Body{
|
return &Body{
|
||||||
Lp: v.newExprWithToken(ctx.GetLp()),
|
ReturnExpr: returnExpr,
|
||||||
Rp: v.newExprWithToken(ctx.GetRp()),
|
Lp: v.newExprWithToken(ctx.GetLp()),
|
||||||
Name: dt,
|
Rp: v.newExprWithToken(ctx.GetRp()),
|
||||||
|
Name: dt,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -8,136 +8,142 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
// Suppress unused import error
|
// Suppress unused import error
|
||||||
var _ = fmt.Printf
|
var (
|
||||||
var _ = unicode.IsLetter
|
_ = fmt.Printf
|
||||||
|
_ = unicode.IsLetter
|
||||||
|
)
|
||||||
|
|
||||||
var serializedLexerAtn = []uint16{
|
var serializedLexerAtn = []uint16{
|
||||||
3, 24715, 42794, 33075, 47597, 16764, 15335, 30598, 22884, 2, 25, 266,
|
3, 24715, 42794, 33075, 47597, 16764, 15335, 30598, 22884, 2, 26, 276,
|
||||||
8, 1, 4, 2, 9, 2, 4, 3, 9, 3, 4, 4, 9, 4, 4, 5, 9, 5, 4, 6, 9, 6, 4, 7,
|
8, 1, 4, 2, 9, 2, 4, 3, 9, 3, 4, 4, 9, 4, 4, 5, 9, 5, 4, 6, 9, 6, 4, 7,
|
||||||
9, 7, 4, 8, 9, 8, 4, 9, 9, 9, 4, 10, 9, 10, 4, 11, 9, 11, 4, 12, 9, 12,
|
9, 7, 4, 8, 9, 8, 4, 9, 9, 9, 4, 10, 9, 10, 4, 11, 9, 11, 4, 12, 9, 12,
|
||||||
4, 13, 9, 13, 4, 14, 9, 14, 4, 15, 9, 15, 4, 16, 9, 16, 4, 17, 9, 17, 4,
|
4, 13, 9, 13, 4, 14, 9, 14, 4, 15, 9, 15, 4, 16, 9, 16, 4, 17, 9, 17, 4,
|
||||||
18, 9, 18, 4, 19, 9, 19, 4, 20, 9, 20, 4, 21, 9, 21, 4, 22, 9, 22, 4, 23,
|
18, 9, 18, 4, 19, 9, 19, 4, 20, 9, 20, 4, 21, 9, 21, 4, 22, 9, 22, 4, 23,
|
||||||
9, 23, 4, 24, 9, 24, 4, 25, 9, 25, 4, 26, 9, 26, 4, 27, 9, 27, 4, 28, 9,
|
9, 23, 4, 24, 9, 24, 4, 25, 9, 25, 4, 26, 9, 26, 4, 27, 9, 27, 4, 28, 9,
|
||||||
28, 4, 29, 9, 29, 4, 30, 9, 30, 4, 31, 9, 31, 3, 2, 3, 2, 3, 3, 3, 3, 3,
|
28, 4, 29, 9, 29, 4, 30, 9, 30, 4, 31, 9, 31, 4, 32, 9, 32, 3, 2, 3, 2,
|
||||||
4, 3, 4, 3, 5, 3, 5, 3, 6, 3, 6, 3, 7, 3, 7, 3, 8, 3, 8, 3, 8, 3, 8, 3,
|
3, 3, 3, 3, 3, 4, 3, 4, 3, 5, 3, 5, 3, 6, 3, 6, 3, 7, 3, 7, 3, 8, 3, 8,
|
||||||
8, 3, 8, 3, 8, 3, 8, 3, 8, 3, 8, 3, 9, 3, 9, 3, 10, 3, 10, 3, 11, 3, 11,
|
3, 8, 3, 8, 3, 8, 3, 8, 3, 8, 3, 8, 3, 8, 3, 8, 3, 9, 3, 9, 3, 10, 3, 10,
|
||||||
3, 12, 3, 12, 3, 13, 3, 13, 3, 13, 3, 14, 3, 14, 3, 14, 3, 14, 3, 14, 3,
|
3, 11, 3, 11, 3, 11, 3, 11, 3, 11, 3, 11, 3, 11, 3, 11, 3, 12, 3, 12, 3,
|
||||||
15, 3, 15, 3, 15, 3, 15, 3, 15, 3, 15, 3, 15, 3, 15, 3, 15, 3, 16, 3, 16,
|
13, 3, 13, 3, 14, 3, 14, 3, 14, 3, 15, 3, 15, 3, 15, 3, 15, 3, 15, 3, 16,
|
||||||
3, 16, 3, 16, 3, 16, 3, 16, 3, 16, 3, 16, 3, 16, 3, 16, 3, 16, 3, 16, 3,
|
3, 16, 3, 16, 3, 16, 3, 16, 3, 16, 3, 16, 3, 16, 3, 16, 3, 17, 3, 17, 3,
|
||||||
17, 3, 17, 3, 17, 3, 17, 3, 17, 3, 17, 3, 17, 3, 17, 3, 18, 6, 18, 132,
|
17, 3, 17, 3, 17, 3, 17, 3, 17, 3, 17, 3, 17, 3, 17, 3, 17, 3, 17, 3, 18,
|
||||||
10, 18, 13, 18, 14, 18, 133, 3, 18, 3, 18, 3, 19, 3, 19, 3, 19, 3, 19,
|
3, 18, 3, 18, 3, 18, 3, 18, 3, 18, 3, 18, 3, 18, 3, 19, 6, 19, 142, 10,
|
||||||
7, 19, 142, 10, 19, 12, 19, 14, 19, 145, 11, 19, 3, 19, 3, 19, 3, 19, 3,
|
19, 13, 19, 14, 19, 143, 3, 19, 3, 19, 3, 20, 3, 20, 3, 20, 3, 20, 7, 20,
|
||||||
19, 3, 19, 3, 20, 3, 20, 3, 20, 3, 20, 7, 20, 156, 10, 20, 12, 20, 14,
|
152, 10, 20, 12, 20, 14, 20, 155, 11, 20, 3, 20, 3, 20, 3, 20, 3, 20, 3,
|
||||||
20, 159, 11, 20, 3, 20, 3, 20, 3, 21, 3, 21, 3, 21, 7, 21, 166, 10, 21,
|
20, 3, 21, 3, 21, 3, 21, 3, 21, 7, 21, 166, 10, 21, 12, 21, 14, 21, 169,
|
||||||
12, 21, 14, 21, 169, 11, 21, 3, 21, 3, 21, 3, 22, 3, 22, 3, 22, 6, 22,
|
11, 21, 3, 21, 3, 21, 3, 22, 3, 22, 3, 22, 7, 22, 176, 10, 22, 12, 22,
|
||||||
176, 10, 22, 13, 22, 14, 22, 177, 3, 22, 3, 22, 3, 23, 3, 23, 7, 23, 184,
|
14, 22, 179, 11, 22, 3, 22, 3, 22, 3, 23, 3, 23, 3, 23, 6, 23, 186, 10,
|
||||||
10, 23, 12, 23, 14, 23, 187, 11, 23, 3, 23, 3, 23, 7, 23, 191, 10, 23,
|
23, 13, 23, 14, 23, 187, 3, 23, 3, 23, 3, 24, 3, 24, 7, 24, 194, 10, 24,
|
||||||
12, 23, 14, 23, 194, 11, 23, 5, 23, 196, 10, 23, 3, 24, 3, 24, 7, 24, 200,
|
12, 24, 14, 24, 197, 11, 24, 3, 24, 3, 24, 7, 24, 201, 10, 24, 12, 24,
|
||||||
10, 24, 12, 24, 14, 24, 203, 11, 24, 3, 25, 3, 25, 5, 25, 207, 10, 25,
|
14, 24, 204, 11, 24, 5, 24, 206, 10, 24, 3, 25, 3, 25, 7, 25, 210, 10,
|
||||||
3, 25, 3, 25, 3, 26, 3, 26, 3, 26, 3, 26, 5, 26, 215, 10, 26, 3, 26, 5,
|
25, 12, 25, 14, 25, 213, 11, 25, 3, 26, 3, 26, 5, 26, 217, 10, 26, 3, 26,
|
||||||
26, 218, 10, 26, 3, 26, 3, 26, 3, 26, 6, 26, 223, 10, 26, 13, 26, 14, 26,
|
3, 26, 3, 27, 3, 27, 3, 27, 3, 27, 5, 27, 225, 10, 27, 3, 27, 5, 27, 228,
|
||||||
224, 3, 26, 3, 26, 3, 26, 3, 26, 3, 26, 5, 26, 232, 10, 26, 3, 27, 3, 27,
|
10, 27, 3, 27, 3, 27, 3, 27, 6, 27, 233, 10, 27, 13, 27, 14, 27, 234, 3,
|
||||||
3, 27, 7, 27, 237, 10, 27, 12, 27, 14, 27, 240, 11, 27, 3, 27, 5, 27, 243,
|
27, 3, 27, 3, 27, 3, 27, 3, 27, 5, 27, 242, 10, 27, 3, 28, 3, 28, 3, 28,
|
||||||
10, 27, 3, 28, 3, 28, 3, 29, 3, 29, 7, 29, 249, 10, 29, 12, 29, 14, 29,
|
7, 28, 247, 10, 28, 12, 28, 14, 28, 250, 11, 28, 3, 28, 5, 28, 253, 10,
|
||||||
252, 11, 29, 3, 29, 5, 29, 255, 10, 29, 3, 30, 3, 30, 5, 30, 259, 10, 30,
|
28, 3, 29, 3, 29, 3, 30, 3, 30, 7, 30, 259, 10, 30, 12, 30, 14, 30, 262,
|
||||||
3, 31, 3, 31, 3, 31, 3, 31, 5, 31, 265, 10, 31, 3, 143, 2, 32, 3, 3, 5,
|
11, 30, 3, 30, 5, 30, 265, 10, 30, 3, 31, 3, 31, 5, 31, 269, 10, 31, 3,
|
||||||
4, 7, 5, 9, 6, 11, 7, 13, 8, 15, 9, 17, 10, 19, 11, 21, 12, 23, 13, 25,
|
32, 3, 32, 3, 32, 3, 32, 5, 32, 275, 10, 32, 3, 153, 2, 33, 3, 3, 5, 4,
|
||||||
14, 27, 15, 29, 16, 31, 17, 33, 18, 35, 19, 37, 20, 39, 21, 41, 22, 43,
|
7, 5, 9, 6, 11, 7, 13, 8, 15, 9, 17, 10, 19, 11, 21, 12, 23, 13, 25, 14,
|
||||||
23, 45, 24, 47, 25, 49, 2, 51, 2, 53, 2, 55, 2, 57, 2, 59, 2, 61, 2, 3,
|
27, 15, 29, 16, 31, 17, 33, 18, 35, 19, 37, 20, 39, 21, 41, 22, 43, 23,
|
||||||
2, 20, 5, 2, 11, 12, 14, 15, 34, 34, 4, 2, 12, 12, 15, 15, 4, 2, 36, 36,
|
45, 24, 47, 25, 49, 26, 51, 2, 53, 2, 55, 2, 57, 2, 59, 2, 61, 2, 63, 2,
|
||||||
94, 94, 6, 2, 12, 12, 15, 15, 94, 94, 98, 98, 4, 2, 11, 11, 34, 34, 6,
|
3, 2, 20, 5, 2, 11, 12, 14, 15, 34, 34, 4, 2, 12, 12, 15, 15, 4, 2, 36,
|
||||||
2, 12, 12, 15, 15, 36, 36, 98, 98, 4, 2, 71, 71, 103, 103, 4, 2, 45, 45,
|
36, 94, 94, 6, 2, 12, 12, 15, 15, 94, 94, 98, 98, 4, 2, 11, 11, 34, 34,
|
||||||
47, 47, 10, 2, 36, 36, 41, 41, 94, 94, 100, 100, 104, 104, 112, 112, 116,
|
6, 2, 12, 12, 15, 15, 36, 36, 98, 98, 4, 2, 71, 71, 103, 103, 4, 2, 45,
|
||||||
116, 118, 118, 3, 2, 50, 53, 3, 2, 50, 57, 5, 2, 50, 59, 67, 72, 99, 104,
|
45, 47, 47, 10, 2, 36, 36, 41, 41, 94, 94, 100, 100, 104, 104, 112, 112,
|
||||||
3, 2, 50, 59, 4, 2, 50, 59, 97, 97, 6, 2, 38, 38, 67, 92, 97, 97, 99, 124,
|
116, 116, 118, 118, 3, 2, 50, 53, 3, 2, 50, 57, 5, 2, 50, 59, 67, 72, 99,
|
||||||
4, 2, 2, 129, 55298, 56321, 3, 2, 55298, 56321, 3, 2, 56322, 57345, 2,
|
104, 3, 2, 50, 59, 4, 2, 50, 59, 97, 97, 6, 2, 38, 38, 67, 92, 97, 97,
|
||||||
283, 2, 3, 3, 2, 2, 2, 2, 5, 3, 2, 2, 2, 2, 7, 3, 2, 2, 2, 2, 9, 3, 2,
|
99, 124, 4, 2, 2, 129, 55298, 56321, 3, 2, 55298, 56321, 3, 2, 56322, 57345,
|
||||||
2, 2, 2, 11, 3, 2, 2, 2, 2, 13, 3, 2, 2, 2, 2, 15, 3, 2, 2, 2, 2, 17, 3,
|
2, 293, 2, 3, 3, 2, 2, 2, 2, 5, 3, 2, 2, 2, 2, 7, 3, 2, 2, 2, 2, 9, 3,
|
||||||
2, 2, 2, 2, 19, 3, 2, 2, 2, 2, 21, 3, 2, 2, 2, 2, 23, 3, 2, 2, 2, 2, 25,
|
2, 2, 2, 2, 11, 3, 2, 2, 2, 2, 13, 3, 2, 2, 2, 2, 15, 3, 2, 2, 2, 2, 17,
|
||||||
3, 2, 2, 2, 2, 27, 3, 2, 2, 2, 2, 29, 3, 2, 2, 2, 2, 31, 3, 2, 2, 2, 2,
|
3, 2, 2, 2, 2, 19, 3, 2, 2, 2, 2, 21, 3, 2, 2, 2, 2, 23, 3, 2, 2, 2, 2,
|
||||||
33, 3, 2, 2, 2, 2, 35, 3, 2, 2, 2, 2, 37, 3, 2, 2, 2, 2, 39, 3, 2, 2, 2,
|
25, 3, 2, 2, 2, 2, 27, 3, 2, 2, 2, 2, 29, 3, 2, 2, 2, 2, 31, 3, 2, 2, 2,
|
||||||
2, 41, 3, 2, 2, 2, 2, 43, 3, 2, 2, 2, 2, 45, 3, 2, 2, 2, 2, 47, 3, 2, 2,
|
2, 33, 3, 2, 2, 2, 2, 35, 3, 2, 2, 2, 2, 37, 3, 2, 2, 2, 2, 39, 3, 2, 2,
|
||||||
2, 3, 63, 3, 2, 2, 2, 5, 65, 3, 2, 2, 2, 7, 67, 3, 2, 2, 2, 9, 69, 3, 2,
|
2, 2, 41, 3, 2, 2, 2, 2, 43, 3, 2, 2, 2, 2, 45, 3, 2, 2, 2, 2, 47, 3, 2,
|
||||||
2, 2, 11, 71, 3, 2, 2, 2, 13, 73, 3, 2, 2, 2, 15, 75, 3, 2, 2, 2, 17, 85,
|
2, 2, 2, 49, 3, 2, 2, 2, 3, 65, 3, 2, 2, 2, 5, 67, 3, 2, 2, 2, 7, 69, 3,
|
||||||
3, 2, 2, 2, 19, 87, 3, 2, 2, 2, 21, 89, 3, 2, 2, 2, 23, 91, 3, 2, 2, 2,
|
2, 2, 2, 9, 71, 3, 2, 2, 2, 11, 73, 3, 2, 2, 2, 13, 75, 3, 2, 2, 2, 15,
|
||||||
25, 93, 3, 2, 2, 2, 27, 96, 3, 2, 2, 2, 29, 101, 3, 2, 2, 2, 31, 110, 3,
|
77, 3, 2, 2, 2, 17, 87, 3, 2, 2, 2, 19, 89, 3, 2, 2, 2, 21, 91, 3, 2, 2,
|
||||||
2, 2, 2, 33, 122, 3, 2, 2, 2, 35, 131, 3, 2, 2, 2, 37, 137, 3, 2, 2, 2,
|
2, 23, 99, 3, 2, 2, 2, 25, 101, 3, 2, 2, 2, 27, 103, 3, 2, 2, 2, 29, 106,
|
||||||
39, 151, 3, 2, 2, 2, 41, 162, 3, 2, 2, 2, 43, 172, 3, 2, 2, 2, 45, 181,
|
3, 2, 2, 2, 31, 111, 3, 2, 2, 2, 33, 120, 3, 2, 2, 2, 35, 132, 3, 2, 2,
|
||||||
3, 2, 2, 2, 47, 197, 3, 2, 2, 2, 49, 204, 3, 2, 2, 2, 51, 231, 3, 2, 2,
|
2, 37, 141, 3, 2, 2, 2, 39, 147, 3, 2, 2, 2, 41, 161, 3, 2, 2, 2, 43, 172,
|
||||||
2, 53, 233, 3, 2, 2, 2, 55, 244, 3, 2, 2, 2, 57, 246, 3, 2, 2, 2, 59, 258,
|
3, 2, 2, 2, 45, 182, 3, 2, 2, 2, 47, 191, 3, 2, 2, 2, 49, 207, 3, 2, 2,
|
||||||
3, 2, 2, 2, 61, 264, 3, 2, 2, 2, 63, 64, 7, 63, 2, 2, 64, 4, 3, 2, 2, 2,
|
2, 51, 214, 3, 2, 2, 2, 53, 241, 3, 2, 2, 2, 55, 243, 3, 2, 2, 2, 57, 254,
|
||||||
65, 66, 7, 42, 2, 2, 66, 6, 3, 2, 2, 2, 67, 68, 7, 43, 2, 2, 68, 8, 3,
|
3, 2, 2, 2, 59, 256, 3, 2, 2, 2, 61, 268, 3, 2, 2, 2, 63, 274, 3, 2, 2,
|
||||||
2, 2, 2, 69, 70, 7, 125, 2, 2, 70, 10, 3, 2, 2, 2, 71, 72, 7, 127, 2, 2,
|
2, 65, 66, 7, 63, 2, 2, 66, 4, 3, 2, 2, 2, 67, 68, 7, 42, 2, 2, 68, 6,
|
||||||
72, 12, 3, 2, 2, 2, 73, 74, 7, 44, 2, 2, 74, 14, 3, 2, 2, 2, 75, 76, 7,
|
3, 2, 2, 2, 69, 70, 7, 43, 2, 2, 70, 8, 3, 2, 2, 2, 71, 72, 7, 125, 2,
|
||||||
118, 2, 2, 76, 77, 7, 107, 2, 2, 77, 78, 7, 111, 2, 2, 78, 79, 7, 103,
|
2, 72, 10, 3, 2, 2, 2, 73, 74, 7, 127, 2, 2, 74, 12, 3, 2, 2, 2, 75, 76,
|
||||||
2, 2, 79, 80, 7, 48, 2, 2, 80, 81, 7, 86, 2, 2, 81, 82, 7, 107, 2, 2, 82,
|
7, 44, 2, 2, 76, 14, 3, 2, 2, 2, 77, 78, 7, 118, 2, 2, 78, 79, 7, 107,
|
||||||
83, 7, 111, 2, 2, 83, 84, 7, 103, 2, 2, 84, 16, 3, 2, 2, 2, 85, 86, 7,
|
2, 2, 79, 80, 7, 111, 2, 2, 80, 81, 7, 103, 2, 2, 81, 82, 7, 48, 2, 2,
|
||||||
93, 2, 2, 86, 18, 3, 2, 2, 2, 87, 88, 7, 95, 2, 2, 88, 20, 3, 2, 2, 2,
|
82, 83, 7, 86, 2, 2, 83, 84, 7, 107, 2, 2, 84, 85, 7, 111, 2, 2, 85, 86,
|
||||||
89, 90, 7, 47, 2, 2, 90, 22, 3, 2, 2, 2, 91, 92, 7, 49, 2, 2, 92, 24, 3,
|
7, 103, 2, 2, 86, 16, 3, 2, 2, 2, 87, 88, 7, 93, 2, 2, 88, 18, 3, 2, 2,
|
||||||
2, 2, 2, 93, 94, 7, 49, 2, 2, 94, 95, 7, 60, 2, 2, 95, 26, 3, 2, 2, 2,
|
2, 89, 90, 7, 95, 2, 2, 90, 20, 3, 2, 2, 2, 91, 92, 7, 116, 2, 2, 92, 93,
|
||||||
96, 97, 7, 66, 2, 2, 97, 98, 7, 102, 2, 2, 98, 99, 7, 113, 2, 2, 99, 100,
|
7, 103, 2, 2, 93, 94, 7, 118, 2, 2, 94, 95, 7, 119, 2, 2, 95, 96, 7, 116,
|
||||||
7, 101, 2, 2, 100, 28, 3, 2, 2, 2, 101, 102, 7, 66, 2, 2, 102, 103, 7,
|
2, 2, 96, 97, 7, 112, 2, 2, 97, 98, 7, 117, 2, 2, 98, 22, 3, 2, 2, 2, 99,
|
||||||
106, 2, 2, 103, 104, 7, 99, 2, 2, 104, 105, 7, 112, 2, 2, 105, 106, 7,
|
100, 7, 47, 2, 2, 100, 24, 3, 2, 2, 2, 101, 102, 7, 49, 2, 2, 102, 26,
|
||||||
102, 2, 2, 106, 107, 7, 110, 2, 2, 107, 108, 7, 103, 2, 2, 108, 109, 7,
|
3, 2, 2, 2, 103, 104, 7, 49, 2, 2, 104, 105, 7, 60, 2, 2, 105, 28, 3, 2,
|
||||||
116, 2, 2, 109, 30, 3, 2, 2, 2, 110, 111, 7, 107, 2, 2, 111, 112, 7, 112,
|
2, 2, 106, 107, 7, 66, 2, 2, 107, 108, 7, 102, 2, 2, 108, 109, 7, 113,
|
||||||
2, 2, 112, 113, 7, 118, 2, 2, 113, 114, 7, 103, 2, 2, 114, 115, 7, 116,
|
2, 2, 109, 110, 7, 101, 2, 2, 110, 30, 3, 2, 2, 2, 111, 112, 7, 66, 2,
|
||||||
2, 2, 115, 116, 7, 104, 2, 2, 116, 117, 7, 99, 2, 2, 117, 118, 7, 101,
|
2, 112, 113, 7, 106, 2, 2, 113, 114, 7, 99, 2, 2, 114, 115, 7, 112, 2,
|
||||||
2, 2, 118, 119, 7, 103, 2, 2, 119, 120, 7, 125, 2, 2, 120, 121, 7, 127,
|
2, 115, 116, 7, 102, 2, 2, 116, 117, 7, 110, 2, 2, 117, 118, 7, 103, 2,
|
||||||
2, 2, 121, 32, 3, 2, 2, 2, 122, 123, 7, 66, 2, 2, 123, 124, 7, 117, 2,
|
2, 118, 119, 7, 116, 2, 2, 119, 32, 3, 2, 2, 2, 120, 121, 7, 107, 2, 2,
|
||||||
2, 124, 125, 7, 103, 2, 2, 125, 126, 7, 116, 2, 2, 126, 127, 7, 120, 2,
|
121, 122, 7, 112, 2, 2, 122, 123, 7, 118, 2, 2, 123, 124, 7, 103, 2, 2,
|
||||||
2, 127, 128, 7, 103, 2, 2, 128, 129, 7, 116, 2, 2, 129, 34, 3, 2, 2, 2,
|
124, 125, 7, 116, 2, 2, 125, 126, 7, 104, 2, 2, 126, 127, 7, 99, 2, 2,
|
||||||
130, 132, 9, 2, 2, 2, 131, 130, 3, 2, 2, 2, 132, 133, 3, 2, 2, 2, 133,
|
127, 128, 7, 101, 2, 2, 128, 129, 7, 103, 2, 2, 129, 130, 7, 125, 2, 2,
|
||||||
131, 3, 2, 2, 2, 133, 134, 3, 2, 2, 2, 134, 135, 3, 2, 2, 2, 135, 136,
|
130, 131, 7, 127, 2, 2, 131, 34, 3, 2, 2, 2, 132, 133, 7, 66, 2, 2, 133,
|
||||||
8, 18, 2, 2, 136, 36, 3, 2, 2, 2, 137, 138, 7, 49, 2, 2, 138, 139, 7, 44,
|
134, 7, 117, 2, 2, 134, 135, 7, 103, 2, 2, 135, 136, 7, 116, 2, 2, 136,
|
||||||
2, 2, 139, 143, 3, 2, 2, 2, 140, 142, 11, 2, 2, 2, 141, 140, 3, 2, 2, 2,
|
137, 7, 120, 2, 2, 137, 138, 7, 103, 2, 2, 138, 139, 7, 116, 2, 2, 139,
|
||||||
142, 145, 3, 2, 2, 2, 143, 144, 3, 2, 2, 2, 143, 141, 3, 2, 2, 2, 144,
|
36, 3, 2, 2, 2, 140, 142, 9, 2, 2, 2, 141, 140, 3, 2, 2, 2, 142, 143, 3,
|
||||||
146, 3, 2, 2, 2, 145, 143, 3, 2, 2, 2, 146, 147, 7, 44, 2, 2, 147, 148,
|
2, 2, 2, 143, 141, 3, 2, 2, 2, 143, 144, 3, 2, 2, 2, 144, 145, 3, 2, 2,
|
||||||
7, 49, 2, 2, 148, 149, 3, 2, 2, 2, 149, 150, 8, 19, 3, 2, 150, 38, 3, 2,
|
2, 145, 146, 8, 19, 2, 2, 146, 38, 3, 2, 2, 2, 147, 148, 7, 49, 2, 2, 148,
|
||||||
2, 2, 151, 152, 7, 49, 2, 2, 152, 153, 7, 49, 2, 2, 153, 157, 3, 2, 2,
|
149, 7, 44, 2, 2, 149, 153, 3, 2, 2, 2, 150, 152, 11, 2, 2, 2, 151, 150,
|
||||||
2, 154, 156, 10, 3, 2, 2, 155, 154, 3, 2, 2, 2, 156, 159, 3, 2, 2, 2, 157,
|
3, 2, 2, 2, 152, 155, 3, 2, 2, 2, 153, 154, 3, 2, 2, 2, 153, 151, 3, 2,
|
||||||
155, 3, 2, 2, 2, 157, 158, 3, 2, 2, 2, 158, 160, 3, 2, 2, 2, 159, 157,
|
2, 2, 154, 156, 3, 2, 2, 2, 155, 153, 3, 2, 2, 2, 156, 157, 7, 44, 2, 2,
|
||||||
3, 2, 2, 2, 160, 161, 8, 20, 3, 2, 161, 40, 3, 2, 2, 2, 162, 167, 7, 36,
|
157, 158, 7, 49, 2, 2, 158, 159, 3, 2, 2, 2, 159, 160, 8, 20, 3, 2, 160,
|
||||||
2, 2, 163, 166, 10, 4, 2, 2, 164, 166, 5, 51, 26, 2, 165, 163, 3, 2, 2,
|
40, 3, 2, 2, 2, 161, 162, 7, 49, 2, 2, 162, 163, 7, 49, 2, 2, 163, 167,
|
||||||
2, 165, 164, 3, 2, 2, 2, 166, 169, 3, 2, 2, 2, 167, 165, 3, 2, 2, 2, 167,
|
3, 2, 2, 2, 164, 166, 10, 3, 2, 2, 165, 164, 3, 2, 2, 2, 166, 169, 3, 2,
|
||||||
168, 3, 2, 2, 2, 168, 170, 3, 2, 2, 2, 169, 167, 3, 2, 2, 2, 170, 171,
|
2, 2, 167, 165, 3, 2, 2, 2, 167, 168, 3, 2, 2, 2, 168, 170, 3, 2, 2, 2,
|
||||||
7, 36, 2, 2, 171, 42, 3, 2, 2, 2, 172, 175, 7, 98, 2, 2, 173, 176, 10,
|
169, 167, 3, 2, 2, 2, 170, 171, 8, 21, 3, 2, 171, 42, 3, 2, 2, 2, 172,
|
||||||
5, 2, 2, 174, 176, 5, 51, 26, 2, 175, 173, 3, 2, 2, 2, 175, 174, 3, 2,
|
177, 7, 36, 2, 2, 173, 176, 10, 4, 2, 2, 174, 176, 5, 53, 27, 2, 175, 173,
|
||||||
2, 2, 176, 177, 3, 2, 2, 2, 177, 175, 3, 2, 2, 2, 177, 178, 3, 2, 2, 2,
|
3, 2, 2, 2, 175, 174, 3, 2, 2, 2, 176, 179, 3, 2, 2, 2, 177, 175, 3, 2,
|
||||||
178, 179, 3, 2, 2, 2, 179, 180, 7, 98, 2, 2, 180, 44, 3, 2, 2, 2, 181,
|
2, 2, 177, 178, 3, 2, 2, 2, 178, 180, 3, 2, 2, 2, 179, 177, 3, 2, 2, 2,
|
||||||
185, 7, 60, 2, 2, 182, 184, 9, 6, 2, 2, 183, 182, 3, 2, 2, 2, 184, 187,
|
180, 181, 7, 36, 2, 2, 181, 44, 3, 2, 2, 2, 182, 185, 7, 98, 2, 2, 183,
|
||||||
3, 2, 2, 2, 185, 183, 3, 2, 2, 2, 185, 186, 3, 2, 2, 2, 186, 195, 3, 2,
|
186, 10, 5, 2, 2, 184, 186, 5, 53, 27, 2, 185, 183, 3, 2, 2, 2, 185, 184,
|
||||||
2, 2, 187, 185, 3, 2, 2, 2, 188, 196, 5, 41, 21, 2, 189, 191, 10, 7, 2,
|
3, 2, 2, 2, 186, 187, 3, 2, 2, 2, 187, 185, 3, 2, 2, 2, 187, 188, 3, 2,
|
||||||
2, 190, 189, 3, 2, 2, 2, 191, 194, 3, 2, 2, 2, 192, 190, 3, 2, 2, 2, 192,
|
2, 2, 188, 189, 3, 2, 2, 2, 189, 190, 7, 98, 2, 2, 190, 46, 3, 2, 2, 2,
|
||||||
193, 3, 2, 2, 2, 193, 196, 3, 2, 2, 2, 194, 192, 3, 2, 2, 2, 195, 188,
|
191, 195, 7, 60, 2, 2, 192, 194, 9, 6, 2, 2, 193, 192, 3, 2, 2, 2, 194,
|
||||||
3, 2, 2, 2, 195, 192, 3, 2, 2, 2, 196, 46, 3, 2, 2, 2, 197, 201, 5, 61,
|
197, 3, 2, 2, 2, 195, 193, 3, 2, 2, 2, 195, 196, 3, 2, 2, 2, 196, 205,
|
||||||
31, 2, 198, 200, 5, 59, 30, 2, 199, 198, 3, 2, 2, 2, 200, 203, 3, 2, 2,
|
3, 2, 2, 2, 197, 195, 3, 2, 2, 2, 198, 206, 5, 43, 22, 2, 199, 201, 10,
|
||||||
2, 201, 199, 3, 2, 2, 2, 201, 202, 3, 2, 2, 2, 202, 48, 3, 2, 2, 2, 203,
|
7, 2, 2, 200, 199, 3, 2, 2, 2, 201, 204, 3, 2, 2, 2, 202, 200, 3, 2, 2,
|
||||||
201, 3, 2, 2, 2, 204, 206, 9, 8, 2, 2, 205, 207, 9, 9, 2, 2, 206, 205,
|
2, 202, 203, 3, 2, 2, 2, 203, 206, 3, 2, 2, 2, 204, 202, 3, 2, 2, 2, 205,
|
||||||
3, 2, 2, 2, 206, 207, 3, 2, 2, 2, 207, 208, 3, 2, 2, 2, 208, 209, 5, 57,
|
198, 3, 2, 2, 2, 205, 202, 3, 2, 2, 2, 206, 48, 3, 2, 2, 2, 207, 211, 5,
|
||||||
29, 2, 209, 50, 3, 2, 2, 2, 210, 211, 7, 94, 2, 2, 211, 232, 9, 10, 2,
|
63, 32, 2, 208, 210, 5, 61, 31, 2, 209, 208, 3, 2, 2, 2, 210, 213, 3, 2,
|
||||||
2, 212, 217, 7, 94, 2, 2, 213, 215, 9, 11, 2, 2, 214, 213, 3, 2, 2, 2,
|
2, 2, 211, 209, 3, 2, 2, 2, 211, 212, 3, 2, 2, 2, 212, 50, 3, 2, 2, 2,
|
||||||
214, 215, 3, 2, 2, 2, 215, 216, 3, 2, 2, 2, 216, 218, 9, 12, 2, 2, 217,
|
213, 211, 3, 2, 2, 2, 214, 216, 9, 8, 2, 2, 215, 217, 9, 9, 2, 2, 216,
|
||||||
214, 3, 2, 2, 2, 217, 218, 3, 2, 2, 2, 218, 219, 3, 2, 2, 2, 219, 232,
|
215, 3, 2, 2, 2, 216, 217, 3, 2, 2, 2, 217, 218, 3, 2, 2, 2, 218, 219,
|
||||||
9, 12, 2, 2, 220, 222, 7, 94, 2, 2, 221, 223, 7, 119, 2, 2, 222, 221, 3,
|
5, 59, 30, 2, 219, 52, 3, 2, 2, 2, 220, 221, 7, 94, 2, 2, 221, 242, 9,
|
||||||
2, 2, 2, 223, 224, 3, 2, 2, 2, 224, 222, 3, 2, 2, 2, 224, 225, 3, 2, 2,
|
10, 2, 2, 222, 227, 7, 94, 2, 2, 223, 225, 9, 11, 2, 2, 224, 223, 3, 2,
|
||||||
2, 225, 226, 3, 2, 2, 2, 226, 227, 5, 55, 28, 2, 227, 228, 5, 55, 28, 2,
|
2, 2, 224, 225, 3, 2, 2, 2, 225, 226, 3, 2, 2, 2, 226, 228, 9, 12, 2, 2,
|
||||||
228, 229, 5, 55, 28, 2, 229, 230, 5, 55, 28, 2, 230, 232, 3, 2, 2, 2, 231,
|
227, 224, 3, 2, 2, 2, 227, 228, 3, 2, 2, 2, 228, 229, 3, 2, 2, 2, 229,
|
||||||
210, 3, 2, 2, 2, 231, 212, 3, 2, 2, 2, 231, 220, 3, 2, 2, 2, 232, 52, 3,
|
242, 9, 12, 2, 2, 230, 232, 7, 94, 2, 2, 231, 233, 7, 119, 2, 2, 232, 231,
|
||||||
2, 2, 2, 233, 242, 5, 55, 28, 2, 234, 237, 5, 55, 28, 2, 235, 237, 7, 97,
|
3, 2, 2, 2, 233, 234, 3, 2, 2, 2, 234, 232, 3, 2, 2, 2, 234, 235, 3, 2,
|
||||||
2, 2, 236, 234, 3, 2, 2, 2, 236, 235, 3, 2, 2, 2, 237, 240, 3, 2, 2, 2,
|
2, 2, 235, 236, 3, 2, 2, 2, 236, 237, 5, 57, 29, 2, 237, 238, 5, 57, 29,
|
||||||
238, 236, 3, 2, 2, 2, 238, 239, 3, 2, 2, 2, 239, 241, 3, 2, 2, 2, 240,
|
2, 238, 239, 5, 57, 29, 2, 239, 240, 5, 57, 29, 2, 240, 242, 3, 2, 2, 2,
|
||||||
238, 3, 2, 2, 2, 241, 243, 5, 55, 28, 2, 242, 238, 3, 2, 2, 2, 242, 243,
|
241, 220, 3, 2, 2, 2, 241, 222, 3, 2, 2, 2, 241, 230, 3, 2, 2, 2, 242,
|
||||||
3, 2, 2, 2, 243, 54, 3, 2, 2, 2, 244, 245, 9, 13, 2, 2, 245, 56, 3, 2,
|
54, 3, 2, 2, 2, 243, 252, 5, 57, 29, 2, 244, 247, 5, 57, 29, 2, 245, 247,
|
||||||
2, 2, 246, 254, 9, 14, 2, 2, 247, 249, 9, 15, 2, 2, 248, 247, 3, 2, 2,
|
7, 97, 2, 2, 246, 244, 3, 2, 2, 2, 246, 245, 3, 2, 2, 2, 247, 250, 3, 2,
|
||||||
2, 249, 252, 3, 2, 2, 2, 250, 248, 3, 2, 2, 2, 250, 251, 3, 2, 2, 2, 251,
|
2, 2, 248, 246, 3, 2, 2, 2, 248, 249, 3, 2, 2, 2, 249, 251, 3, 2, 2, 2,
|
||||||
253, 3, 2, 2, 2, 252, 250, 3, 2, 2, 2, 253, 255, 9, 14, 2, 2, 254, 250,
|
250, 248, 3, 2, 2, 2, 251, 253, 5, 57, 29, 2, 252, 248, 3, 2, 2, 2, 252,
|
||||||
3, 2, 2, 2, 254, 255, 3, 2, 2, 2, 255, 58, 3, 2, 2, 2, 256, 259, 5, 61,
|
253, 3, 2, 2, 2, 253, 56, 3, 2, 2, 2, 254, 255, 9, 13, 2, 2, 255, 58, 3,
|
||||||
31, 2, 257, 259, 9, 14, 2, 2, 258, 256, 3, 2, 2, 2, 258, 257, 3, 2, 2,
|
2, 2, 2, 256, 264, 9, 14, 2, 2, 257, 259, 9, 15, 2, 2, 258, 257, 3, 2,
|
||||||
2, 259, 60, 3, 2, 2, 2, 260, 265, 9, 16, 2, 2, 261, 265, 10, 17, 2, 2,
|
2, 2, 259, 262, 3, 2, 2, 2, 260, 258, 3, 2, 2, 2, 260, 261, 3, 2, 2, 2,
|
||||||
262, 263, 9, 18, 2, 2, 263, 265, 9, 19, 2, 2, 264, 260, 3, 2, 2, 2, 264,
|
261, 263, 3, 2, 2, 2, 262, 260, 3, 2, 2, 2, 263, 265, 9, 14, 2, 2, 264,
|
||||||
261, 3, 2, 2, 2, 264, 262, 3, 2, 2, 2, 265, 62, 3, 2, 2, 2, 26, 2, 133,
|
260, 3, 2, 2, 2, 264, 265, 3, 2, 2, 2, 265, 60, 3, 2, 2, 2, 266, 269, 5,
|
||||||
143, 157, 165, 167, 175, 177, 185, 192, 195, 201, 206, 214, 217, 224, 231,
|
63, 32, 2, 267, 269, 9, 14, 2, 2, 268, 266, 3, 2, 2, 2, 268, 267, 3, 2,
|
||||||
236, 238, 242, 250, 254, 258, 264, 4, 2, 3, 2, 2, 90, 2,
|
2, 2, 269, 62, 3, 2, 2, 2, 270, 275, 9, 16, 2, 2, 271, 275, 10, 17, 2,
|
||||||
|
2, 272, 273, 9, 18, 2, 2, 273, 275, 9, 19, 2, 2, 274, 270, 3, 2, 2, 2,
|
||||||
|
274, 271, 3, 2, 2, 2, 274, 272, 3, 2, 2, 2, 275, 64, 3, 2, 2, 2, 26, 2,
|
||||||
|
143, 153, 167, 175, 177, 185, 187, 195, 202, 205, 211, 216, 224, 227, 234,
|
||||||
|
241, 246, 248, 252, 260, 264, 268, 274, 4, 2, 3, 2, 2, 90, 2,
|
||||||
}
|
}
|
||||||
|
|
||||||
var lexerChannelNames = []string{
|
var lexerChannelNames = []string{
|
||||||
@@ -150,18 +156,19 @@ var lexerModeNames = []string{
|
|||||||
|
|
||||||
var lexerLiteralNames = []string{
|
var lexerLiteralNames = []string{
|
||||||
"", "'='", "'('", "')'", "'{'", "'}'", "'*'", "'time.Time'", "'['", "']'",
|
"", "'='", "'('", "')'", "'{'", "'}'", "'*'", "'time.Time'", "'['", "']'",
|
||||||
"'-'", "'/'", "'/:'", "'@doc'", "'@handler'", "'interface{}'", "'@server'",
|
"'returns'", "'-'", "'/'", "'/:'", "'@doc'", "'@handler'", "'interface{}'",
|
||||||
|
"'@server'",
|
||||||
}
|
}
|
||||||
|
|
||||||
var lexerSymbolicNames = []string{
|
var lexerSymbolicNames = []string{
|
||||||
"", "", "", "", "", "", "", "", "", "", "", "", "", "ATDOC", "ATHANDLER",
|
"", "", "", "", "", "", "", "", "", "", "", "", "", "", "ATDOC", "ATHANDLER",
|
||||||
"INTERFACE", "ATSERVER", "WS", "COMMENT", "LINE_COMMENT", "STRING", "RAW_STRING",
|
"INTERFACE", "ATSERVER", "WS", "COMMENT", "LINE_COMMENT", "STRING", "RAW_STRING",
|
||||||
"LINE_VALUE", "ID",
|
"LINE_VALUE", "ID",
|
||||||
}
|
}
|
||||||
|
|
||||||
var lexerRuleNames = []string{
|
var lexerRuleNames = []string{
|
||||||
"T__0", "T__1", "T__2", "T__3", "T__4", "T__5", "T__6", "T__7", "T__8",
|
"T__0", "T__1", "T__2", "T__3", "T__4", "T__5", "T__6", "T__7", "T__8",
|
||||||
"T__9", "T__10", "T__11", "ATDOC", "ATHANDLER", "INTERFACE", "ATSERVER",
|
"T__9", "T__10", "T__11", "T__12", "ATDOC", "ATHANDLER", "INTERFACE", "ATSERVER",
|
||||||
"WS", "COMMENT", "LINE_COMMENT", "STRING", "RAW_STRING", "LINE_VALUE",
|
"WS", "COMMENT", "LINE_COMMENT", "STRING", "RAW_STRING", "LINE_VALUE",
|
||||||
"ID", "ExponentPart", "EscapeSequence", "HexDigits", "HexDigit", "Digits",
|
"ID", "ExponentPart", "EscapeSequence", "HexDigits", "HexDigit", "Digits",
|
||||||
"LetterOrDigit", "Letter",
|
"LetterOrDigit", "Letter",
|
||||||
@@ -216,17 +223,18 @@ const (
|
|||||||
ApiParserLexerT__9 = 10
|
ApiParserLexerT__9 = 10
|
||||||
ApiParserLexerT__10 = 11
|
ApiParserLexerT__10 = 11
|
||||||
ApiParserLexerT__11 = 12
|
ApiParserLexerT__11 = 12
|
||||||
ApiParserLexerATDOC = 13
|
ApiParserLexerT__12 = 13
|
||||||
ApiParserLexerATHANDLER = 14
|
ApiParserLexerATDOC = 14
|
||||||
ApiParserLexerINTERFACE = 15
|
ApiParserLexerATHANDLER = 15
|
||||||
ApiParserLexerATSERVER = 16
|
ApiParserLexerINTERFACE = 16
|
||||||
ApiParserLexerWS = 17
|
ApiParserLexerATSERVER = 17
|
||||||
ApiParserLexerCOMMENT = 18
|
ApiParserLexerWS = 18
|
||||||
ApiParserLexerLINE_COMMENT = 19
|
ApiParserLexerCOMMENT = 19
|
||||||
ApiParserLexerSTRING = 20
|
ApiParserLexerLINE_COMMENT = 20
|
||||||
ApiParserLexerRAW_STRING = 21
|
ApiParserLexerSTRING = 21
|
||||||
ApiParserLexerLINE_VALUE = 22
|
ApiParserLexerRAW_STRING = 22
|
||||||
ApiParserLexerID = 23
|
ApiParserLexerLINE_VALUE = 23
|
||||||
|
ApiParserLexerID = 24
|
||||||
)
|
)
|
||||||
|
|
||||||
const COMEMNTS = 88
|
const COMEMNTS = 88
|
||||||
|
|||||||
314
tools/goctl/api/parser/g4/gen/api/apiparser_parser.go
Executable file → Normal file
314
tools/goctl/api/parser/g4/gen/api/apiparser_parser.go
Executable file → Normal file
@@ -1,4 +1,5 @@
|
|||||||
package api // ApiParser
|
package api
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"reflect"
|
"reflect"
|
||||||
@@ -8,12 +9,14 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
// Suppress unused import errors
|
// Suppress unused import errors
|
||||||
var _ = fmt.Printf
|
var (
|
||||||
var _ = reflect.Copy
|
_ = fmt.Printf
|
||||||
var _ = strconv.Itoa
|
_ = reflect.Copy
|
||||||
|
_ = strconv.Itoa
|
||||||
|
)
|
||||||
|
|
||||||
var parserATN = []uint16{
|
var parserATN = []uint16{
|
||||||
3, 24715, 42794, 33075, 47597, 16764, 15335, 30598, 22884, 3, 25, 351,
|
3, 24715, 42794, 33075, 47597, 16764, 15335, 30598, 22884, 3, 26, 349,
|
||||||
4, 2, 9, 2, 4, 3, 9, 3, 4, 4, 9, 4, 4, 5, 9, 5, 4, 6, 9, 6, 4, 7, 9, 7,
|
4, 2, 9, 2, 4, 3, 9, 3, 4, 4, 9, 4, 4, 5, 9, 5, 4, 6, 9, 6, 4, 7, 9, 7,
|
||||||
4, 8, 9, 8, 4, 9, 9, 9, 4, 10, 9, 10, 4, 11, 9, 11, 4, 12, 9, 12, 4, 13,
|
4, 8, 9, 8, 4, 9, 9, 9, 4, 10, 9, 10, 4, 11, 9, 11, 4, 12, 9, 12, 4, 13,
|
||||||
9, 13, 4, 14, 9, 14, 4, 15, 9, 15, 4, 16, 9, 16, 4, 17, 9, 17, 4, 18, 9,
|
9, 13, 4, 14, 9, 14, 4, 15, 9, 15, 4, 16, 9, 16, 4, 17, 9, 17, 4, 18, 9,
|
||||||
@@ -45,134 +48,136 @@ var parserATN = []uint16{
|
|||||||
30, 3, 30, 3, 30, 3, 31, 3, 31, 5, 31, 277, 10, 31, 3, 31, 6, 31, 280,
|
30, 3, 30, 3, 30, 3, 31, 3, 31, 5, 31, 277, 10, 31, 3, 31, 6, 31, 280,
|
||||||
10, 31, 13, 31, 14, 31, 281, 3, 31, 5, 31, 285, 10, 31, 3, 31, 5, 31, 288,
|
10, 31, 13, 31, 14, 31, 281, 3, 31, 5, 31, 285, 10, 31, 3, 31, 5, 31, 288,
|
||||||
10, 31, 3, 32, 3, 32, 3, 32, 3, 33, 3, 33, 3, 33, 3, 33, 5, 33, 297, 10,
|
10, 31, 3, 32, 3, 32, 3, 32, 3, 33, 3, 33, 3, 33, 3, 33, 5, 33, 297, 10,
|
||||||
33, 3, 33, 5, 33, 300, 10, 33, 3, 33, 5, 33, 303, 10, 33, 3, 34, 3, 34,
|
33, 3, 33, 5, 33, 300, 10, 33, 3, 34, 3, 34, 5, 34, 304, 10, 34, 3, 34,
|
||||||
5, 34, 307, 10, 34, 3, 34, 3, 34, 3, 35, 3, 35, 5, 35, 313, 10, 35, 3,
|
3, 34, 3, 35, 3, 35, 3, 35, 5, 35, 311, 10, 35, 3, 35, 3, 35, 3, 36, 3,
|
||||||
35, 3, 35, 3, 36, 3, 36, 3, 36, 3, 36, 3, 37, 3, 37, 5, 37, 323, 10, 37,
|
36, 3, 36, 3, 36, 3, 37, 3, 37, 5, 37, 321, 10, 37, 6, 37, 323, 10, 37,
|
||||||
6, 37, 325, 10, 37, 13, 37, 14, 37, 326, 3, 38, 3, 38, 3, 38, 3, 38, 7,
|
13, 37, 14, 37, 324, 3, 38, 3, 38, 3, 38, 3, 38, 7, 38, 331, 10, 38, 12,
|
||||||
38, 333, 10, 38, 12, 38, 14, 38, 336, 11, 38, 3, 38, 3, 38, 3, 38, 3, 38,
|
38, 14, 38, 334, 11, 38, 3, 38, 3, 38, 3, 38, 3, 38, 5, 38, 340, 10, 38,
|
||||||
5, 38, 342, 10, 38, 6, 38, 344, 10, 38, 13, 38, 14, 38, 345, 3, 38, 5,
|
6, 38, 342, 10, 38, 13, 38, 14, 38, 343, 3, 38, 5, 38, 347, 10, 38, 3,
|
||||||
38, 349, 10, 38, 3, 38, 2, 2, 39, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22,
|
38, 2, 2, 39, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32,
|
||||||
24, 26, 28, 30, 32, 34, 36, 38, 40, 42, 44, 46, 48, 50, 52, 54, 56, 58,
|
34, 36, 38, 40, 42, 44, 46, 48, 50, 52, 54, 56, 58, 60, 62, 64, 66, 68,
|
||||||
60, 62, 64, 66, 68, 70, 72, 74, 2, 2, 2, 361, 2, 79, 3, 2, 2, 2, 4, 87,
|
70, 72, 74, 2, 2, 2, 358, 2, 79, 3, 2, 2, 2, 4, 87, 3, 2, 2, 2, 6, 89,
|
||||||
3, 2, 2, 2, 6, 89, 3, 2, 2, 2, 8, 97, 3, 2, 2, 2, 10, 99, 3, 2, 2, 2, 12,
|
3, 2, 2, 2, 8, 97, 3, 2, 2, 2, 10, 99, 3, 2, 2, 2, 12, 103, 3, 2, 2, 2,
|
||||||
103, 3, 2, 2, 2, 14, 113, 3, 2, 2, 2, 16, 115, 3, 2, 2, 2, 18, 118, 3,
|
14, 113, 3, 2, 2, 2, 16, 115, 3, 2, 2, 2, 18, 118, 3, 2, 2, 2, 20, 130,
|
||||||
2, 2, 2, 20, 130, 3, 2, 2, 2, 22, 132, 3, 2, 2, 2, 24, 136, 3, 2, 2, 2,
|
3, 2, 2, 2, 22, 132, 3, 2, 2, 2, 24, 136, 3, 2, 2, 2, 26, 149, 3, 2, 2,
|
||||||
26, 149, 3, 2, 2, 2, 28, 153, 3, 2, 2, 2, 30, 155, 3, 2, 2, 2, 32, 169,
|
2, 28, 153, 3, 2, 2, 2, 30, 155, 3, 2, 2, 2, 32, 169, 3, 2, 2, 2, 34, 176,
|
||||||
3, 2, 2, 2, 34, 176, 3, 2, 2, 2, 36, 190, 3, 2, 2, 2, 38, 200, 3, 2, 2,
|
3, 2, 2, 2, 36, 190, 3, 2, 2, 2, 38, 200, 3, 2, 2, 2, 40, 202, 3, 2, 2,
|
||||||
2, 40, 202, 3, 2, 2, 2, 42, 209, 3, 2, 2, 2, 44, 221, 3, 2, 2, 2, 46, 223,
|
2, 42, 209, 3, 2, 2, 2, 44, 221, 3, 2, 2, 2, 46, 223, 3, 2, 2, 2, 48, 227,
|
||||||
3, 2, 2, 2, 48, 227, 3, 2, 2, 2, 50, 235, 3, 2, 2, 2, 52, 240, 3, 2, 2,
|
3, 2, 2, 2, 50, 235, 3, 2, 2, 2, 52, 240, 3, 2, 2, 2, 54, 244, 3, 2, 2,
|
||||||
2, 54, 244, 3, 2, 2, 2, 56, 253, 3, 2, 2, 2, 58, 266, 3, 2, 2, 2, 60, 274,
|
2, 56, 253, 3, 2, 2, 2, 58, 266, 3, 2, 2, 2, 60, 274, 3, 2, 2, 2, 62, 289,
|
||||||
3, 2, 2, 2, 62, 289, 3, 2, 2, 2, 64, 292, 3, 2, 2, 2, 66, 304, 3, 2, 2,
|
3, 2, 2, 2, 64, 292, 3, 2, 2, 2, 66, 301, 3, 2, 2, 2, 68, 307, 3, 2, 2,
|
||||||
2, 68, 310, 3, 2, 2, 2, 70, 316, 3, 2, 2, 2, 72, 324, 3, 2, 2, 2, 74, 348,
|
2, 70, 314, 3, 2, 2, 2, 72, 322, 3, 2, 2, 2, 74, 346, 3, 2, 2, 2, 76, 78,
|
||||||
3, 2, 2, 2, 76, 78, 5, 4, 3, 2, 77, 76, 3, 2, 2, 2, 78, 81, 3, 2, 2, 2,
|
5, 4, 3, 2, 77, 76, 3, 2, 2, 2, 78, 81, 3, 2, 2, 2, 79, 77, 3, 2, 2, 2,
|
||||||
79, 77, 3, 2, 2, 2, 79, 80, 3, 2, 2, 2, 80, 3, 3, 2, 2, 2, 81, 79, 3, 2,
|
79, 80, 3, 2, 2, 2, 80, 3, 3, 2, 2, 2, 81, 79, 3, 2, 2, 2, 82, 88, 5, 6,
|
||||||
2, 2, 82, 88, 5, 6, 4, 2, 83, 88, 5, 8, 5, 2, 84, 88, 5, 18, 10, 2, 85,
|
4, 2, 83, 88, 5, 8, 5, 2, 84, 88, 5, 18, 10, 2, 85, 88, 5, 20, 11, 2, 86,
|
||||||
88, 5, 20, 11, 2, 86, 88, 5, 52, 27, 2, 87, 82, 3, 2, 2, 2, 87, 83, 3,
|
88, 5, 52, 27, 2, 87, 82, 3, 2, 2, 2, 87, 83, 3, 2, 2, 2, 87, 84, 3, 2,
|
||||||
2, 2, 2, 87, 84, 3, 2, 2, 2, 87, 85, 3, 2, 2, 2, 87, 86, 3, 2, 2, 2, 88,
|
2, 2, 87, 85, 3, 2, 2, 2, 87, 86, 3, 2, 2, 2, 88, 5, 3, 2, 2, 2, 89, 90,
|
||||||
5, 3, 2, 2, 2, 89, 90, 8, 4, 1, 2, 90, 91, 7, 25, 2, 2, 91, 92, 7, 3, 2,
|
8, 4, 1, 2, 90, 91, 7, 26, 2, 2, 91, 92, 7, 3, 2, 2, 92, 93, 8, 4, 1, 2,
|
||||||
2, 92, 93, 8, 4, 1, 2, 93, 94, 7, 22, 2, 2, 94, 7, 3, 2, 2, 2, 95, 98,
|
93, 94, 7, 23, 2, 2, 94, 7, 3, 2, 2, 2, 95, 98, 5, 10, 6, 2, 96, 98, 5,
|
||||||
5, 10, 6, 2, 96, 98, 5, 12, 7, 2, 97, 95, 3, 2, 2, 2, 97, 96, 3, 2, 2,
|
12, 7, 2, 97, 95, 3, 2, 2, 2, 97, 96, 3, 2, 2, 2, 98, 9, 3, 2, 2, 2, 99,
|
||||||
2, 98, 9, 3, 2, 2, 2, 99, 100, 8, 6, 1, 2, 100, 101, 7, 25, 2, 2, 101,
|
100, 8, 6, 1, 2, 100, 101, 7, 26, 2, 2, 101, 102, 5, 16, 9, 2, 102, 11,
|
||||||
102, 5, 16, 9, 2, 102, 11, 3, 2, 2, 2, 103, 104, 8, 7, 1, 2, 104, 105,
|
3, 2, 2, 2, 103, 104, 8, 7, 1, 2, 104, 105, 7, 26, 2, 2, 105, 107, 7, 4,
|
||||||
7, 25, 2, 2, 105, 107, 7, 4, 2, 2, 106, 108, 5, 14, 8, 2, 107, 106, 3,
|
2, 2, 106, 108, 5, 14, 8, 2, 107, 106, 3, 2, 2, 2, 108, 109, 3, 2, 2, 2,
|
||||||
2, 2, 2, 108, 109, 3, 2, 2, 2, 109, 107, 3, 2, 2, 2, 109, 110, 3, 2, 2,
|
109, 107, 3, 2, 2, 2, 109, 110, 3, 2, 2, 2, 110, 111, 3, 2, 2, 2, 111,
|
||||||
2, 110, 111, 3, 2, 2, 2, 111, 112, 7, 5, 2, 2, 112, 13, 3, 2, 2, 2, 113,
|
112, 7, 5, 2, 2, 112, 13, 3, 2, 2, 2, 113, 114, 5, 16, 9, 2, 114, 15, 3,
|
||||||
114, 5, 16, 9, 2, 114, 15, 3, 2, 2, 2, 115, 116, 8, 9, 1, 2, 116, 117,
|
2, 2, 2, 115, 116, 8, 9, 1, 2, 116, 117, 7, 23, 2, 2, 117, 17, 3, 2, 2,
|
||||||
7, 22, 2, 2, 117, 17, 3, 2, 2, 2, 118, 119, 8, 10, 1, 2, 119, 120, 7, 25,
|
2, 118, 119, 8, 10, 1, 2, 119, 120, 7, 26, 2, 2, 120, 122, 7, 4, 2, 2,
|
||||||
2, 2, 120, 122, 7, 4, 2, 2, 121, 123, 5, 70, 36, 2, 122, 121, 3, 2, 2,
|
121, 123, 5, 70, 36, 2, 122, 121, 3, 2, 2, 2, 123, 124, 3, 2, 2, 2, 124,
|
||||||
2, 123, 124, 3, 2, 2, 2, 124, 122, 3, 2, 2, 2, 124, 125, 3, 2, 2, 2, 125,
|
122, 3, 2, 2, 2, 124, 125, 3, 2, 2, 2, 125, 126, 3, 2, 2, 2, 126, 127,
|
||||||
126, 3, 2, 2, 2, 126, 127, 7, 5, 2, 2, 127, 19, 3, 2, 2, 2, 128, 131, 5,
|
7, 5, 2, 2, 127, 19, 3, 2, 2, 2, 128, 131, 5, 22, 12, 2, 129, 131, 5, 24,
|
||||||
22, 12, 2, 129, 131, 5, 24, 13, 2, 130, 128, 3, 2, 2, 2, 130, 129, 3, 2,
|
13, 2, 130, 128, 3, 2, 2, 2, 130, 129, 3, 2, 2, 2, 131, 21, 3, 2, 2, 2,
|
||||||
2, 2, 131, 21, 3, 2, 2, 2, 132, 133, 8, 12, 1, 2, 133, 134, 7, 25, 2, 2,
|
132, 133, 8, 12, 1, 2, 133, 134, 7, 26, 2, 2, 134, 135, 5, 26, 14, 2, 135,
|
||||||
134, 135, 5, 26, 14, 2, 135, 23, 3, 2, 2, 2, 136, 137, 8, 13, 1, 2, 137,
|
23, 3, 2, 2, 2, 136, 137, 8, 13, 1, 2, 137, 138, 7, 26, 2, 2, 138, 142,
|
||||||
138, 7, 25, 2, 2, 138, 142, 7, 4, 2, 2, 139, 141, 5, 28, 15, 2, 140, 139,
|
7, 4, 2, 2, 139, 141, 5, 28, 15, 2, 140, 139, 3, 2, 2, 2, 141, 144, 3,
|
||||||
3, 2, 2, 2, 141, 144, 3, 2, 2, 2, 142, 140, 3, 2, 2, 2, 142, 143, 3, 2,
|
2, 2, 2, 142, 140, 3, 2, 2, 2, 142, 143, 3, 2, 2, 2, 143, 145, 3, 2, 2,
|
||||||
2, 2, 143, 145, 3, 2, 2, 2, 144, 142, 3, 2, 2, 2, 145, 146, 7, 5, 2, 2,
|
2, 144, 142, 3, 2, 2, 2, 145, 146, 7, 5, 2, 2, 146, 25, 3, 2, 2, 2, 147,
|
||||||
146, 25, 3, 2, 2, 2, 147, 150, 5, 30, 16, 2, 148, 150, 5, 32, 17, 2, 149,
|
150, 5, 30, 16, 2, 148, 150, 5, 32, 17, 2, 149, 147, 3, 2, 2, 2, 149, 148,
|
||||||
147, 3, 2, 2, 2, 149, 148, 3, 2, 2, 2, 150, 27, 3, 2, 2, 2, 151, 154, 5,
|
3, 2, 2, 2, 150, 27, 3, 2, 2, 2, 151, 154, 5, 34, 18, 2, 152, 154, 5, 36,
|
||||||
34, 18, 2, 152, 154, 5, 36, 19, 2, 153, 151, 3, 2, 2, 2, 153, 152, 3, 2,
|
19, 2, 153, 151, 3, 2, 2, 2, 153, 152, 3, 2, 2, 2, 154, 29, 3, 2, 2, 2,
|
||||||
2, 2, 154, 29, 3, 2, 2, 2, 155, 156, 8, 16, 1, 2, 156, 158, 7, 25, 2, 2,
|
155, 156, 8, 16, 1, 2, 156, 158, 7, 26, 2, 2, 157, 159, 7, 26, 2, 2, 158,
|
||||||
157, 159, 7, 25, 2, 2, 158, 157, 3, 2, 2, 2, 158, 159, 3, 2, 2, 2, 159,
|
157, 3, 2, 2, 2, 158, 159, 3, 2, 2, 2, 159, 160, 3, 2, 2, 2, 160, 164,
|
||||||
160, 3, 2, 2, 2, 160, 164, 7, 6, 2, 2, 161, 163, 5, 38, 20, 2, 162, 161,
|
7, 6, 2, 2, 161, 163, 5, 38, 20, 2, 162, 161, 3, 2, 2, 2, 163, 166, 3,
|
||||||
3, 2, 2, 2, 163, 166, 3, 2, 2, 2, 164, 162, 3, 2, 2, 2, 164, 165, 3, 2,
|
2, 2, 2, 164, 162, 3, 2, 2, 2, 164, 165, 3, 2, 2, 2, 165, 167, 3, 2, 2,
|
||||||
2, 2, 165, 167, 3, 2, 2, 2, 166, 164, 3, 2, 2, 2, 167, 168, 7, 7, 2, 2,
|
2, 166, 164, 3, 2, 2, 2, 167, 168, 7, 7, 2, 2, 168, 31, 3, 2, 2, 2, 169,
|
||||||
168, 31, 3, 2, 2, 2, 169, 170, 8, 17, 1, 2, 170, 172, 7, 25, 2, 2, 171,
|
170, 8, 17, 1, 2, 170, 172, 7, 26, 2, 2, 171, 173, 7, 3, 2, 2, 172, 171,
|
||||||
173, 7, 3, 2, 2, 172, 171, 3, 2, 2, 2, 172, 173, 3, 2, 2, 2, 173, 174,
|
3, 2, 2, 2, 172, 173, 3, 2, 2, 2, 173, 174, 3, 2, 2, 2, 174, 175, 5, 44,
|
||||||
3, 2, 2, 2, 174, 175, 5, 44, 23, 2, 175, 33, 3, 2, 2, 2, 176, 177, 8, 18,
|
23, 2, 175, 33, 3, 2, 2, 2, 176, 177, 8, 18, 1, 2, 177, 179, 7, 26, 2,
|
||||||
1, 2, 177, 179, 7, 25, 2, 2, 178, 180, 7, 25, 2, 2, 179, 178, 3, 2, 2,
|
2, 178, 180, 7, 26, 2, 2, 179, 178, 3, 2, 2, 2, 179, 180, 3, 2, 2, 2, 180,
|
||||||
2, 179, 180, 3, 2, 2, 2, 180, 181, 3, 2, 2, 2, 181, 185, 7, 6, 2, 2, 182,
|
181, 3, 2, 2, 2, 181, 185, 7, 6, 2, 2, 182, 184, 5, 38, 20, 2, 183, 182,
|
||||||
184, 5, 38, 20, 2, 183, 182, 3, 2, 2, 2, 184, 187, 3, 2, 2, 2, 185, 183,
|
3, 2, 2, 2, 184, 187, 3, 2, 2, 2, 185, 183, 3, 2, 2, 2, 185, 186, 3, 2,
|
||||||
3, 2, 2, 2, 185, 186, 3, 2, 2, 2, 186, 188, 3, 2, 2, 2, 187, 185, 3, 2,
|
2, 2, 186, 188, 3, 2, 2, 2, 187, 185, 3, 2, 2, 2, 188, 189, 7, 7, 2, 2,
|
||||||
2, 2, 188, 189, 7, 7, 2, 2, 189, 35, 3, 2, 2, 2, 190, 191, 8, 19, 1, 2,
|
189, 35, 3, 2, 2, 2, 190, 191, 8, 19, 1, 2, 191, 193, 7, 26, 2, 2, 192,
|
||||||
191, 193, 7, 25, 2, 2, 192, 194, 7, 3, 2, 2, 193, 192, 3, 2, 2, 2, 193,
|
194, 7, 3, 2, 2, 193, 192, 3, 2, 2, 2, 193, 194, 3, 2, 2, 2, 194, 195,
|
||||||
194, 3, 2, 2, 2, 194, 195, 3, 2, 2, 2, 195, 196, 5, 44, 23, 2, 196, 37,
|
3, 2, 2, 2, 195, 196, 5, 44, 23, 2, 196, 37, 3, 2, 2, 2, 197, 198, 6, 20,
|
||||||
3, 2, 2, 2, 197, 198, 6, 20, 2, 2, 198, 201, 5, 40, 21, 2, 199, 201, 5,
|
2, 2, 198, 201, 5, 40, 21, 2, 199, 201, 5, 42, 22, 2, 200, 197, 3, 2, 2,
|
||||||
42, 22, 2, 200, 197, 3, 2, 2, 2, 200, 199, 3, 2, 2, 2, 201, 39, 3, 2, 2,
|
2, 200, 199, 3, 2, 2, 2, 201, 39, 3, 2, 2, 2, 202, 203, 8, 21, 1, 2, 203,
|
||||||
2, 202, 203, 8, 21, 1, 2, 203, 204, 7, 25, 2, 2, 204, 206, 5, 44, 23, 2,
|
204, 7, 26, 2, 2, 204, 206, 5, 44, 23, 2, 205, 207, 7, 24, 2, 2, 206, 205,
|
||||||
205, 207, 7, 23, 2, 2, 206, 205, 3, 2, 2, 2, 206, 207, 3, 2, 2, 2, 207,
|
3, 2, 2, 2, 206, 207, 3, 2, 2, 2, 207, 41, 3, 2, 2, 2, 208, 210, 7, 8,
|
||||||
41, 3, 2, 2, 2, 208, 210, 7, 8, 2, 2, 209, 208, 3, 2, 2, 2, 209, 210, 3,
|
2, 2, 209, 208, 3, 2, 2, 2, 209, 210, 3, 2, 2, 2, 210, 211, 3, 2, 2, 2,
|
||||||
2, 2, 2, 210, 211, 3, 2, 2, 2, 211, 212, 7, 25, 2, 2, 212, 43, 3, 2, 2,
|
211, 212, 7, 26, 2, 2, 212, 43, 3, 2, 2, 2, 213, 214, 8, 23, 1, 2, 214,
|
||||||
2, 213, 214, 8, 23, 1, 2, 214, 222, 7, 25, 2, 2, 215, 222, 5, 48, 25, 2,
|
222, 7, 26, 2, 2, 215, 222, 5, 48, 25, 2, 216, 222, 5, 50, 26, 2, 217,
|
||||||
216, 222, 5, 50, 26, 2, 217, 222, 7, 17, 2, 2, 218, 222, 7, 9, 2, 2, 219,
|
222, 7, 18, 2, 2, 218, 222, 7, 9, 2, 2, 219, 222, 5, 46, 24, 2, 220, 222,
|
||||||
222, 5, 46, 24, 2, 220, 222, 5, 30, 16, 2, 221, 213, 3, 2, 2, 2, 221, 215,
|
5, 30, 16, 2, 221, 213, 3, 2, 2, 2, 221, 215, 3, 2, 2, 2, 221, 216, 3,
|
||||||
3, 2, 2, 2, 221, 216, 3, 2, 2, 2, 221, 217, 3, 2, 2, 2, 221, 218, 3, 2,
|
2, 2, 2, 221, 217, 3, 2, 2, 2, 221, 218, 3, 2, 2, 2, 221, 219, 3, 2, 2,
|
||||||
2, 2, 221, 219, 3, 2, 2, 2, 221, 220, 3, 2, 2, 2, 222, 45, 3, 2, 2, 2,
|
2, 221, 220, 3, 2, 2, 2, 222, 45, 3, 2, 2, 2, 223, 224, 7, 8, 2, 2, 224,
|
||||||
223, 224, 7, 8, 2, 2, 224, 225, 8, 24, 1, 2, 225, 226, 7, 25, 2, 2, 226,
|
225, 8, 24, 1, 2, 225, 226, 7, 26, 2, 2, 226, 47, 3, 2, 2, 2, 227, 228,
|
||||||
47, 3, 2, 2, 2, 227, 228, 8, 25, 1, 2, 228, 229, 7, 25, 2, 2, 229, 230,
|
8, 25, 1, 2, 228, 229, 7, 26, 2, 2, 229, 230, 7, 10, 2, 2, 230, 231, 8,
|
||||||
7, 10, 2, 2, 230, 231, 8, 25, 1, 2, 231, 232, 7, 25, 2, 2, 232, 233, 7,
|
25, 1, 2, 231, 232, 7, 26, 2, 2, 232, 233, 7, 11, 2, 2, 233, 234, 5, 44,
|
||||||
11, 2, 2, 233, 234, 5, 44, 23, 2, 234, 49, 3, 2, 2, 2, 235, 236, 7, 10,
|
23, 2, 234, 49, 3, 2, 2, 2, 235, 236, 7, 10, 2, 2, 236, 237, 7, 11, 2,
|
||||||
2, 2, 236, 237, 7, 11, 2, 2, 237, 238, 5, 44, 23, 2, 238, 51, 3, 2, 2,
|
2, 237, 238, 5, 44, 23, 2, 238, 51, 3, 2, 2, 2, 239, 241, 5, 54, 28, 2,
|
||||||
2, 239, 241, 5, 54, 28, 2, 240, 239, 3, 2, 2, 2, 240, 241, 3, 2, 2, 2,
|
240, 239, 3, 2, 2, 2, 240, 241, 3, 2, 2, 2, 241, 242, 3, 2, 2, 2, 242,
|
||||||
241, 242, 3, 2, 2, 2, 242, 243, 5, 56, 29, 2, 243, 53, 3, 2, 2, 2, 244,
|
243, 5, 56, 29, 2, 243, 53, 3, 2, 2, 2, 244, 245, 7, 19, 2, 2, 245, 247,
|
||||||
245, 7, 18, 2, 2, 245, 247, 7, 4, 2, 2, 246, 248, 5, 70, 36, 2, 247, 246,
|
7, 4, 2, 2, 246, 248, 5, 70, 36, 2, 247, 246, 3, 2, 2, 2, 248, 249, 3,
|
||||||
3, 2, 2, 2, 248, 249, 3, 2, 2, 2, 249, 247, 3, 2, 2, 2, 249, 250, 3, 2,
|
2, 2, 2, 249, 247, 3, 2, 2, 2, 249, 250, 3, 2, 2, 2, 250, 251, 3, 2, 2,
|
||||||
2, 2, 250, 251, 3, 2, 2, 2, 251, 252, 7, 5, 2, 2, 252, 55, 3, 2, 2, 2,
|
2, 251, 252, 7, 5, 2, 2, 252, 55, 3, 2, 2, 2, 253, 254, 8, 29, 1, 2, 254,
|
||||||
253, 254, 8, 29, 1, 2, 254, 255, 7, 25, 2, 2, 255, 256, 5, 72, 37, 2, 256,
|
255, 7, 26, 2, 2, 255, 256, 5, 72, 37, 2, 256, 260, 7, 6, 2, 2, 257, 259,
|
||||||
260, 7, 6, 2, 2, 257, 259, 5, 58, 30, 2, 258, 257, 3, 2, 2, 2, 259, 262,
|
5, 58, 30, 2, 258, 257, 3, 2, 2, 2, 259, 262, 3, 2, 2, 2, 260, 258, 3,
|
||||||
3, 2, 2, 2, 260, 258, 3, 2, 2, 2, 260, 261, 3, 2, 2, 2, 261, 263, 3, 2,
|
2, 2, 2, 260, 261, 3, 2, 2, 2, 261, 263, 3, 2, 2, 2, 262, 260, 3, 2, 2,
|
||||||
2, 2, 262, 260, 3, 2, 2, 2, 263, 264, 7, 7, 2, 2, 264, 57, 3, 2, 2, 2,
|
2, 263, 264, 7, 7, 2, 2, 264, 57, 3, 2, 2, 2, 265, 267, 5, 60, 31, 2, 266,
|
||||||
265, 267, 5, 60, 31, 2, 266, 265, 3, 2, 2, 2, 266, 267, 3, 2, 2, 2, 267,
|
265, 3, 2, 2, 2, 266, 267, 3, 2, 2, 2, 267, 270, 3, 2, 2, 2, 268, 271,
|
||||||
270, 3, 2, 2, 2, 268, 271, 5, 54, 28, 2, 269, 271, 5, 62, 32, 2, 270, 268,
|
5, 54, 28, 2, 269, 271, 5, 62, 32, 2, 270, 268, 3, 2, 2, 2, 270, 269, 3,
|
||||||
3, 2, 2, 2, 270, 269, 3, 2, 2, 2, 271, 272, 3, 2, 2, 2, 272, 273, 5, 64,
|
2, 2, 2, 271, 272, 3, 2, 2, 2, 272, 273, 5, 64, 33, 2, 273, 59, 3, 2, 2,
|
||||||
33, 2, 273, 59, 3, 2, 2, 2, 274, 276, 7, 15, 2, 2, 275, 277, 7, 4, 2, 2,
|
2, 274, 276, 7, 16, 2, 2, 275, 277, 7, 4, 2, 2, 276, 275, 3, 2, 2, 2, 276,
|
||||||
276, 275, 3, 2, 2, 2, 276, 277, 3, 2, 2, 2, 277, 284, 3, 2, 2, 2, 278,
|
277, 3, 2, 2, 2, 277, 284, 3, 2, 2, 2, 278, 280, 5, 70, 36, 2, 279, 278,
|
||||||
280, 5, 70, 36, 2, 279, 278, 3, 2, 2, 2, 280, 281, 3, 2, 2, 2, 281, 279,
|
3, 2, 2, 2, 280, 281, 3, 2, 2, 2, 281, 279, 3, 2, 2, 2, 281, 282, 3, 2,
|
||||||
3, 2, 2, 2, 281, 282, 3, 2, 2, 2, 282, 285, 3, 2, 2, 2, 283, 285, 7, 22,
|
2, 2, 282, 285, 3, 2, 2, 2, 283, 285, 7, 23, 2, 2, 284, 279, 3, 2, 2, 2,
|
||||||
2, 2, 284, 279, 3, 2, 2, 2, 284, 283, 3, 2, 2, 2, 285, 287, 3, 2, 2, 2,
|
284, 283, 3, 2, 2, 2, 285, 287, 3, 2, 2, 2, 286, 288, 7, 5, 2, 2, 287,
|
||||||
286, 288, 7, 5, 2, 2, 287, 286, 3, 2, 2, 2, 287, 288, 3, 2, 2, 2, 288,
|
286, 3, 2, 2, 2, 287, 288, 3, 2, 2, 2, 288, 61, 3, 2, 2, 2, 289, 290, 7,
|
||||||
61, 3, 2, 2, 2, 289, 290, 7, 16, 2, 2, 290, 291, 7, 25, 2, 2, 291, 63,
|
17, 2, 2, 290, 291, 7, 26, 2, 2, 291, 63, 3, 2, 2, 2, 292, 293, 8, 33,
|
||||||
3, 2, 2, 2, 292, 293, 8, 33, 1, 2, 293, 294, 7, 25, 2, 2, 294, 296, 5,
|
1, 2, 293, 294, 7, 26, 2, 2, 294, 296, 5, 74, 38, 2, 295, 297, 5, 66, 34,
|
||||||
74, 38, 2, 295, 297, 5, 66, 34, 2, 296, 295, 3, 2, 2, 2, 296, 297, 3, 2,
|
2, 296, 295, 3, 2, 2, 2, 296, 297, 3, 2, 2, 2, 297, 299, 3, 2, 2, 2, 298,
|
||||||
2, 2, 297, 299, 3, 2, 2, 2, 298, 300, 7, 25, 2, 2, 299, 298, 3, 2, 2, 2,
|
300, 5, 68, 35, 2, 299, 298, 3, 2, 2, 2, 299, 300, 3, 2, 2, 2, 300, 65,
|
||||||
299, 300, 3, 2, 2, 2, 300, 302, 3, 2, 2, 2, 301, 303, 5, 68, 35, 2, 302,
|
3, 2, 2, 2, 301, 303, 7, 4, 2, 2, 302, 304, 7, 26, 2, 2, 303, 302, 3, 2,
|
||||||
301, 3, 2, 2, 2, 302, 303, 3, 2, 2, 2, 303, 65, 3, 2, 2, 2, 304, 306, 7,
|
2, 2, 303, 304, 3, 2, 2, 2, 304, 305, 3, 2, 2, 2, 305, 306, 7, 5, 2, 2,
|
||||||
4, 2, 2, 305, 307, 7, 25, 2, 2, 306, 305, 3, 2, 2, 2, 306, 307, 3, 2, 2,
|
306, 67, 3, 2, 2, 2, 307, 308, 7, 12, 2, 2, 308, 310, 7, 4, 2, 2, 309,
|
||||||
2, 307, 308, 3, 2, 2, 2, 308, 309, 7, 5, 2, 2, 309, 67, 3, 2, 2, 2, 310,
|
311, 5, 44, 23, 2, 310, 309, 3, 2, 2, 2, 310, 311, 3, 2, 2, 2, 311, 312,
|
||||||
312, 7, 4, 2, 2, 311, 313, 5, 44, 23, 2, 312, 311, 3, 2, 2, 2, 312, 313,
|
3, 2, 2, 2, 312, 313, 7, 5, 2, 2, 313, 69, 3, 2, 2, 2, 314, 315, 7, 26,
|
||||||
3, 2, 2, 2, 313, 314, 3, 2, 2, 2, 314, 315, 7, 5, 2, 2, 315, 69, 3, 2,
|
2, 2, 315, 316, 8, 36, 1, 2, 316, 317, 7, 25, 2, 2, 317, 71, 3, 2, 2, 2,
|
||||||
2, 2, 316, 317, 7, 25, 2, 2, 317, 318, 8, 36, 1, 2, 318, 319, 7, 24, 2,
|
318, 320, 7, 26, 2, 2, 319, 321, 7, 13, 2, 2, 320, 319, 3, 2, 2, 2, 320,
|
||||||
2, 319, 71, 3, 2, 2, 2, 320, 322, 7, 25, 2, 2, 321, 323, 7, 12, 2, 2, 322,
|
321, 3, 2, 2, 2, 321, 323, 3, 2, 2, 2, 322, 318, 3, 2, 2, 2, 323, 324,
|
||||||
321, 3, 2, 2, 2, 322, 323, 3, 2, 2, 2, 323, 325, 3, 2, 2, 2, 324, 320,
|
3, 2, 2, 2, 324, 322, 3, 2, 2, 2, 324, 325, 3, 2, 2, 2, 325, 73, 3, 2,
|
||||||
3, 2, 2, 2, 325, 326, 3, 2, 2, 2, 326, 324, 3, 2, 2, 2, 326, 327, 3, 2,
|
2, 2, 326, 327, 7, 14, 2, 2, 327, 332, 7, 26, 2, 2, 328, 329, 7, 13, 2,
|
||||||
2, 2, 327, 73, 3, 2, 2, 2, 328, 329, 7, 13, 2, 2, 329, 334, 7, 25, 2, 2,
|
2, 329, 331, 7, 26, 2, 2, 330, 328, 3, 2, 2, 2, 331, 334, 3, 2, 2, 2, 332,
|
||||||
330, 331, 7, 12, 2, 2, 331, 333, 7, 25, 2, 2, 332, 330, 3, 2, 2, 2, 333,
|
330, 3, 2, 2, 2, 332, 333, 3, 2, 2, 2, 333, 342, 3, 2, 2, 2, 334, 332,
|
||||||
336, 3, 2, 2, 2, 334, 332, 3, 2, 2, 2, 334, 335, 3, 2, 2, 2, 335, 344,
|
3, 2, 2, 2, 335, 336, 7, 15, 2, 2, 336, 339, 7, 26, 2, 2, 337, 338, 7,
|
||||||
3, 2, 2, 2, 336, 334, 3, 2, 2, 2, 337, 338, 7, 14, 2, 2, 338, 341, 7, 25,
|
13, 2, 2, 338, 340, 7, 26, 2, 2, 339, 337, 3, 2, 2, 2, 339, 340, 3, 2,
|
||||||
2, 2, 339, 340, 7, 12, 2, 2, 340, 342, 7, 25, 2, 2, 341, 339, 3, 2, 2,
|
2, 2, 340, 342, 3, 2, 2, 2, 341, 326, 3, 2, 2, 2, 341, 335, 3, 2, 2, 2,
|
||||||
2, 341, 342, 3, 2, 2, 2, 342, 344, 3, 2, 2, 2, 343, 328, 3, 2, 2, 2, 343,
|
342, 343, 3, 2, 2, 2, 343, 341, 3, 2, 2, 2, 343, 344, 3, 2, 2, 2, 344,
|
||||||
337, 3, 2, 2, 2, 344, 345, 3, 2, 2, 2, 345, 343, 3, 2, 2, 2, 345, 346,
|
347, 3, 2, 2, 2, 345, 347, 7, 14, 2, 2, 346, 341, 3, 2, 2, 2, 346, 345,
|
||||||
3, 2, 2, 2, 346, 349, 3, 2, 2, 2, 347, 349, 7, 13, 2, 2, 348, 343, 3, 2,
|
3, 2, 2, 2, 347, 75, 3, 2, 2, 2, 41, 79, 87, 97, 109, 124, 130, 142, 149,
|
||||||
2, 2, 348, 347, 3, 2, 2, 2, 349, 75, 3, 2, 2, 2, 42, 79, 87, 97, 109, 124,
|
153, 158, 164, 172, 179, 185, 193, 200, 206, 209, 221, 240, 249, 260, 266,
|
||||||
130, 142, 149, 153, 158, 164, 172, 179, 185, 193, 200, 206, 209, 221, 240,
|
270, 276, 281, 284, 287, 296, 299, 303, 310, 320, 324, 332, 339, 341, 343,
|
||||||
249, 260, 266, 270, 276, 281, 284, 287, 296, 299, 302, 306, 312, 322, 326,
|
346,
|
||||||
334, 341, 343, 345, 348,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
var literalNames = []string{
|
var literalNames = []string{
|
||||||
"", "'='", "'('", "')'", "'{'", "'}'", "'*'", "'time.Time'", "'['", "']'",
|
"", "'='", "'('", "')'", "'{'", "'}'", "'*'", "'time.Time'", "'['", "']'",
|
||||||
"'-'", "'/'", "'/:'", "'@doc'", "'@handler'", "'interface{}'", "'@server'",
|
"'returns'", "'-'", "'/'", "'/:'", "'@doc'", "'@handler'", "'interface{}'",
|
||||||
|
"'@server'",
|
||||||
}
|
}
|
||||||
|
|
||||||
var symbolicNames = []string{
|
var symbolicNames = []string{
|
||||||
"", "", "", "", "", "", "", "", "", "", "", "", "", "ATDOC", "ATHANDLER",
|
"", "", "", "", "", "", "", "", "", "", "", "", "", "", "ATDOC", "ATHANDLER",
|
||||||
"INTERFACE", "ATSERVER", "WS", "COMMENT", "LINE_COMMENT", "STRING", "RAW_STRING",
|
"INTERFACE", "ATSERVER", "WS", "COMMENT", "LINE_COMMENT", "STRING", "RAW_STRING",
|
||||||
"LINE_VALUE", "ID",
|
"LINE_VALUE", "ID",
|
||||||
}
|
}
|
||||||
@@ -230,17 +235,18 @@ const (
|
|||||||
ApiParserParserT__9 = 10
|
ApiParserParserT__9 = 10
|
||||||
ApiParserParserT__10 = 11
|
ApiParserParserT__10 = 11
|
||||||
ApiParserParserT__11 = 12
|
ApiParserParserT__11 = 12
|
||||||
ApiParserParserATDOC = 13
|
ApiParserParserT__12 = 13
|
||||||
ApiParserParserATHANDLER = 14
|
ApiParserParserATDOC = 14
|
||||||
ApiParserParserINTERFACE = 15
|
ApiParserParserATHANDLER = 15
|
||||||
ApiParserParserATSERVER = 16
|
ApiParserParserINTERFACE = 16
|
||||||
ApiParserParserWS = 17
|
ApiParserParserATSERVER = 17
|
||||||
ApiParserParserCOMMENT = 18
|
ApiParserParserWS = 18
|
||||||
ApiParserParserLINE_COMMENT = 19
|
ApiParserParserCOMMENT = 19
|
||||||
ApiParserParserSTRING = 20
|
ApiParserParserLINE_COMMENT = 20
|
||||||
ApiParserParserRAW_STRING = 21
|
ApiParserParserSTRING = 21
|
||||||
ApiParserParserLINE_VALUE = 22
|
ApiParserParserRAW_STRING = 22
|
||||||
ApiParserParserID = 23
|
ApiParserParserLINE_VALUE = 23
|
||||||
|
ApiParserParserID = 24
|
||||||
)
|
)
|
||||||
|
|
||||||
// ApiParserParser rules.
|
// ApiParserParser rules.
|
||||||
@@ -301,7 +307,7 @@ type ApiContext struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func NewEmptyApiContext() *ApiContext {
|
func NewEmptyApiContext() *ApiContext {
|
||||||
var p = new(ApiContext)
|
p := new(ApiContext)
|
||||||
p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1)
|
p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1)
|
||||||
p.RuleIndex = ApiParserParserRULE_api
|
p.RuleIndex = ApiParserParserRULE_api
|
||||||
return p
|
return p
|
||||||
@@ -310,7 +316,7 @@ func NewEmptyApiContext() *ApiContext {
|
|||||||
func (*ApiContext) IsApiContext() {}
|
func (*ApiContext) IsApiContext() {}
|
||||||
|
|
||||||
func NewApiContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *ApiContext {
|
func NewApiContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *ApiContext {
|
||||||
var p = new(ApiContext)
|
p := new(ApiContext)
|
||||||
|
|
||||||
p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState)
|
p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState)
|
||||||
|
|
||||||
@@ -323,8 +329,8 @@ func NewApiContext(parser antlr.Parser, parent antlr.ParserRuleContext, invoking
|
|||||||
func (s *ApiContext) GetParser() antlr.Parser { return s.parser }
|
func (s *ApiContext) GetParser() antlr.Parser { return s.parser }
|
||||||
|
|
||||||
func (s *ApiContext) AllSpec() []ISpecContext {
|
func (s *ApiContext) AllSpec() []ISpecContext {
|
||||||
var ts = s.GetTypedRuleContexts(reflect.TypeOf((*ISpecContext)(nil)).Elem())
|
ts := s.GetTypedRuleContexts(reflect.TypeOf((*ISpecContext)(nil)).Elem())
|
||||||
var tst = make([]ISpecContext, len(ts))
|
tst := make([]ISpecContext, len(ts))
|
||||||
|
|
||||||
for i, t := range ts {
|
for i, t := range ts {
|
||||||
if t != nil {
|
if t != nil {
|
||||||
@@ -336,7 +342,7 @@ func (s *ApiContext) AllSpec() []ISpecContext {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (s *ApiContext) Spec(i int) ISpecContext {
|
func (s *ApiContext) Spec(i int) ISpecContext {
|
||||||
var t = s.GetTypedRuleContext(reflect.TypeOf((*ISpecContext)(nil)).Elem(), i)
|
t := s.GetTypedRuleContext(reflect.TypeOf((*ISpecContext)(nil)).Elem(), i)
|
||||||
|
|
||||||
if t == nil {
|
if t == nil {
|
||||||
return nil
|
return nil
|
||||||
@@ -420,7 +426,7 @@ type SpecContext struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func NewEmptySpecContext() *SpecContext {
|
func NewEmptySpecContext() *SpecContext {
|
||||||
var p = new(SpecContext)
|
p := new(SpecContext)
|
||||||
p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1)
|
p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1)
|
||||||
p.RuleIndex = ApiParserParserRULE_spec
|
p.RuleIndex = ApiParserParserRULE_spec
|
||||||
return p
|
return p
|
||||||
@@ -429,7 +435,7 @@ func NewEmptySpecContext() *SpecContext {
|
|||||||
func (*SpecContext) IsSpecContext() {}
|
func (*SpecContext) IsSpecContext() {}
|
||||||
|
|
||||||
func NewSpecContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *SpecContext {
|
func NewSpecContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *SpecContext {
|
||||||
var p = new(SpecContext)
|
p := new(SpecContext)
|
||||||
|
|
||||||
p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState)
|
p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState)
|
||||||
|
|
||||||
@@ -442,7 +448,7 @@ func NewSpecContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokin
|
|||||||
func (s *SpecContext) GetParser() antlr.Parser { return s.parser }
|
func (s *SpecContext) GetParser() antlr.Parser { return s.parser }
|
||||||
|
|
||||||
func (s *SpecContext) SyntaxLit() ISyntaxLitContext {
|
func (s *SpecContext) SyntaxLit() ISyntaxLitContext {
|
||||||
var t = s.GetTypedRuleContext(reflect.TypeOf((*ISyntaxLitContext)(nil)).Elem(), 0)
|
t := s.GetTypedRuleContext(reflect.TypeOf((*ISyntaxLitContext)(nil)).Elem(), 0)
|
||||||
|
|
||||||
if t == nil {
|
if t == nil {
|
||||||
return nil
|
return nil
|
||||||
@@ -452,7 +458,7 @@ func (s *SpecContext) SyntaxLit() ISyntaxLitContext {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (s *SpecContext) ImportSpec() IImportSpecContext {
|
func (s *SpecContext) ImportSpec() IImportSpecContext {
|
||||||
var t = s.GetTypedRuleContext(reflect.TypeOf((*IImportSpecContext)(nil)).Elem(), 0)
|
t := s.GetTypedRuleContext(reflect.TypeOf((*IImportSpecContext)(nil)).Elem(), 0)
|
||||||
|
|
||||||
if t == nil {
|
if t == nil {
|
||||||
return nil
|
return nil
|
||||||
@@ -462,7 +468,7 @@ func (s *SpecContext) ImportSpec() IImportSpecContext {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (s *SpecContext) InfoSpec() IInfoSpecContext {
|
func (s *SpecContext) InfoSpec() IInfoSpecContext {
|
||||||
var t = s.GetTypedRuleContext(reflect.TypeOf((*IInfoSpecContext)(nil)).Elem(), 0)
|
t := s.GetTypedRuleContext(reflect.TypeOf((*IInfoSpecContext)(nil)).Elem(), 0)
|
||||||
|
|
||||||
if t == nil {
|
if t == nil {
|
||||||
return nil
|
return nil
|
||||||
@@ -472,7 +478,7 @@ func (s *SpecContext) InfoSpec() IInfoSpecContext {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (s *SpecContext) TypeSpec() ITypeSpecContext {
|
func (s *SpecContext) TypeSpec() ITypeSpecContext {
|
||||||
var t = s.GetTypedRuleContext(reflect.TypeOf((*ITypeSpecContext)(nil)).Elem(), 0)
|
t := s.GetTypedRuleContext(reflect.TypeOf((*ITypeSpecContext)(nil)).Elem(), 0)
|
||||||
|
|
||||||
if t == nil {
|
if t == nil {
|
||||||
return nil
|
return nil
|
||||||
@@ -482,7 +488,7 @@ func (s *SpecContext) TypeSpec() ITypeSpecContext {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (s *SpecContext) ServiceSpec() IServiceSpecContext {
|
func (s *SpecContext) ServiceSpec() IServiceSpecContext {
|
||||||
var t = s.GetTypedRuleContext(reflect.TypeOf((*IServiceSpecContext)(nil)).Elem(), 0)
|
t := s.GetTypedRuleContext(reflect.TypeOf((*IServiceSpecContext)(nil)).Elem(), 0)
|
||||||
|
|
||||||
if t == nil {
|
if t == nil {
|
||||||
return nil
|
return nil
|
||||||
@@ -610,7 +616,7 @@ type SyntaxLitContext struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func NewEmptySyntaxLitContext() *SyntaxLitContext {
|
func NewEmptySyntaxLitContext() *SyntaxLitContext {
|
||||||
var p = new(SyntaxLitContext)
|
p := new(SyntaxLitContext)
|
||||||
p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1)
|
p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1)
|
||||||
p.RuleIndex = ApiParserParserRULE_syntaxLit
|
p.RuleIndex = ApiParserParserRULE_syntaxLit
|
||||||
return p
|
return p
|
||||||
@@ -619,7 +625,7 @@ func NewEmptySyntaxLitContext() *SyntaxLitContext {
|
|||||||
func (*SyntaxLitContext) IsSyntaxLitContext() {}
|
func (*SyntaxLitContext) IsSyntaxLitContext() {}
|
||||||
|
|
||||||
func NewSyntaxLitContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *SyntaxLitContext {
|
func NewSyntaxLitContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *SyntaxLitContext {
|
||||||
var p = new(SyntaxLitContext)
|
p := new(SyntaxLitContext)
|
||||||
|
|
||||||
p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState)
|
p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState)
|
||||||
|
|
||||||
@@ -628,5 +634,3 @@ func NewSyntaxLitContext(parser antlr.Parser, parent antlr.ParserRuleContext, in
|
|||||||
|
|
||||||
return p
|
return p
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -75,14 +75,14 @@ func (p *ApiParserParser) SyntaxLit() (localctx ISyntaxLitContext) {
|
|||||||
{
|
{
|
||||||
p.SetState(88)
|
p.SetState(88)
|
||||||
|
|
||||||
var _m = p.Match(ApiParserParserID)
|
_m := p.Match(ApiParserParserID)
|
||||||
|
|
||||||
localctx.(*SyntaxLitContext).syntaxToken = _m
|
localctx.(*SyntaxLitContext).syntaxToken = _m
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
p.SetState(89)
|
p.SetState(89)
|
||||||
|
|
||||||
var _m = p.Match(ApiParserParserT__0)
|
_m := p.Match(ApiParserParserT__0)
|
||||||
|
|
||||||
localctx.(*SyntaxLitContext).assign = _m
|
localctx.(*SyntaxLitContext).assign = _m
|
||||||
}
|
}
|
||||||
@@ -90,7 +90,7 @@ func (p *ApiParserParser) SyntaxLit() (localctx ISyntaxLitContext) {
|
|||||||
{
|
{
|
||||||
p.SetState(91)
|
p.SetState(91)
|
||||||
|
|
||||||
var _m = p.Match(ApiParserParserSTRING)
|
_m := p.Match(ApiParserParserSTRING)
|
||||||
|
|
||||||
localctx.(*SyntaxLitContext).version = _m
|
localctx.(*SyntaxLitContext).version = _m
|
||||||
}
|
}
|
||||||
@@ -115,7 +115,7 @@ type ImportSpecContext struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func NewEmptyImportSpecContext() *ImportSpecContext {
|
func NewEmptyImportSpecContext() *ImportSpecContext {
|
||||||
var p = new(ImportSpecContext)
|
p := new(ImportSpecContext)
|
||||||
p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1)
|
p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1)
|
||||||
p.RuleIndex = ApiParserParserRULE_importSpec
|
p.RuleIndex = ApiParserParserRULE_importSpec
|
||||||
return p
|
return p
|
||||||
@@ -124,7 +124,7 @@ func NewEmptyImportSpecContext() *ImportSpecContext {
|
|||||||
func (*ImportSpecContext) IsImportSpecContext() {}
|
func (*ImportSpecContext) IsImportSpecContext() {}
|
||||||
|
|
||||||
func NewImportSpecContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *ImportSpecContext {
|
func NewImportSpecContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *ImportSpecContext {
|
||||||
var p = new(ImportSpecContext)
|
p := new(ImportSpecContext)
|
||||||
|
|
||||||
p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState)
|
p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState)
|
||||||
|
|
||||||
@@ -137,7 +137,7 @@ func NewImportSpecContext(parser antlr.Parser, parent antlr.ParserRuleContext, i
|
|||||||
func (s *ImportSpecContext) GetParser() antlr.Parser { return s.parser }
|
func (s *ImportSpecContext) GetParser() antlr.Parser { return s.parser }
|
||||||
|
|
||||||
func (s *ImportSpecContext) ImportLit() IImportLitContext {
|
func (s *ImportSpecContext) ImportLit() IImportLitContext {
|
||||||
var t = s.GetTypedRuleContext(reflect.TypeOf((*IImportLitContext)(nil)).Elem(), 0)
|
t := s.GetTypedRuleContext(reflect.TypeOf((*IImportLitContext)(nil)).Elem(), 0)
|
||||||
|
|
||||||
if t == nil {
|
if t == nil {
|
||||||
return nil
|
return nil
|
||||||
@@ -147,7 +147,7 @@ func (s *ImportSpecContext) ImportLit() IImportLitContext {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (s *ImportSpecContext) ImportBlock() IImportBlockContext {
|
func (s *ImportSpecContext) ImportBlock() IImportBlockContext {
|
||||||
var t = s.GetTypedRuleContext(reflect.TypeOf((*IImportBlockContext)(nil)).Elem(), 0)
|
t := s.GetTypedRuleContext(reflect.TypeOf((*IImportBlockContext)(nil)).Elem(), 0)
|
||||||
|
|
||||||
if t == nil {
|
if t == nil {
|
||||||
return nil
|
return nil
|
||||||
@@ -240,7 +240,7 @@ type ImportLitContext struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func NewEmptyImportLitContext() *ImportLitContext {
|
func NewEmptyImportLitContext() *ImportLitContext {
|
||||||
var p = new(ImportLitContext)
|
p := new(ImportLitContext)
|
||||||
p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1)
|
p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1)
|
||||||
p.RuleIndex = ApiParserParserRULE_importLit
|
p.RuleIndex = ApiParserParserRULE_importLit
|
||||||
return p
|
return p
|
||||||
@@ -249,7 +249,7 @@ func NewEmptyImportLitContext() *ImportLitContext {
|
|||||||
func (*ImportLitContext) IsImportLitContext() {}
|
func (*ImportLitContext) IsImportLitContext() {}
|
||||||
|
|
||||||
func NewImportLitContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *ImportLitContext {
|
func NewImportLitContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *ImportLitContext {
|
||||||
var p = new(ImportLitContext)
|
p := new(ImportLitContext)
|
||||||
|
|
||||||
p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState)
|
p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState)
|
||||||
|
|
||||||
@@ -266,7 +266,7 @@ func (s *ImportLitContext) GetImportToken() antlr.Token { return s.importToken }
|
|||||||
func (s *ImportLitContext) SetImportToken(v antlr.Token) { s.importToken = v }
|
func (s *ImportLitContext) SetImportToken(v antlr.Token) { s.importToken = v }
|
||||||
|
|
||||||
func (s *ImportLitContext) ImportValue() IImportValueContext {
|
func (s *ImportLitContext) ImportValue() IImportValueContext {
|
||||||
var t = s.GetTypedRuleContext(reflect.TypeOf((*IImportValueContext)(nil)).Elem(), 0)
|
t := s.GetTypedRuleContext(reflect.TypeOf((*IImportValueContext)(nil)).Elem(), 0)
|
||||||
|
|
||||||
if t == nil {
|
if t == nil {
|
||||||
return nil
|
return nil
|
||||||
@@ -322,7 +322,7 @@ func (p *ApiParserParser) ImportLit() (localctx IImportLitContext) {
|
|||||||
{
|
{
|
||||||
p.SetState(98)
|
p.SetState(98)
|
||||||
|
|
||||||
var _m = p.Match(ApiParserParserID)
|
_m := p.Match(ApiParserParserID)
|
||||||
|
|
||||||
localctx.(*ImportLitContext).importToken = _m
|
localctx.(*ImportLitContext).importToken = _m
|
||||||
}
|
}
|
||||||
@@ -358,7 +358,7 @@ type ImportBlockContext struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func NewEmptyImportBlockContext() *ImportBlockContext {
|
func NewEmptyImportBlockContext() *ImportBlockContext {
|
||||||
var p = new(ImportBlockContext)
|
p := new(ImportBlockContext)
|
||||||
p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1)
|
p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1)
|
||||||
p.RuleIndex = ApiParserParserRULE_importBlock
|
p.RuleIndex = ApiParserParserRULE_importBlock
|
||||||
return p
|
return p
|
||||||
@@ -367,7 +367,7 @@ func NewEmptyImportBlockContext() *ImportBlockContext {
|
|||||||
func (*ImportBlockContext) IsImportBlockContext() {}
|
func (*ImportBlockContext) IsImportBlockContext() {}
|
||||||
|
|
||||||
func NewImportBlockContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *ImportBlockContext {
|
func NewImportBlockContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *ImportBlockContext {
|
||||||
var p = new(ImportBlockContext)
|
p := new(ImportBlockContext)
|
||||||
|
|
||||||
p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState)
|
p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState)
|
||||||
|
|
||||||
@@ -388,8 +388,8 @@ func (s *ImportBlockContext) ID() antlr.TerminalNode {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (s *ImportBlockContext) AllImportBlockValue() []IImportBlockValueContext {
|
func (s *ImportBlockContext) AllImportBlockValue() []IImportBlockValueContext {
|
||||||
var ts = s.GetTypedRuleContexts(reflect.TypeOf((*IImportBlockValueContext)(nil)).Elem())
|
ts := s.GetTypedRuleContexts(reflect.TypeOf((*IImportBlockValueContext)(nil)).Elem())
|
||||||
var tst = make([]IImportBlockValueContext, len(ts))
|
tst := make([]IImportBlockValueContext, len(ts))
|
||||||
|
|
||||||
for i, t := range ts {
|
for i, t := range ts {
|
||||||
if t != nil {
|
if t != nil {
|
||||||
@@ -401,7 +401,7 @@ func (s *ImportBlockContext) AllImportBlockValue() []IImportBlockValueContext {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (s *ImportBlockContext) ImportBlockValue(i int) IImportBlockValueContext {
|
func (s *ImportBlockContext) ImportBlockValue(i int) IImportBlockValueContext {
|
||||||
var t = s.GetTypedRuleContext(reflect.TypeOf((*IImportBlockValueContext)(nil)).Elem(), i)
|
t := s.GetTypedRuleContext(reflect.TypeOf((*IImportBlockValueContext)(nil)).Elem(), i)
|
||||||
|
|
||||||
if t == nil {
|
if t == nil {
|
||||||
return nil
|
return nil
|
||||||
@@ -454,7 +454,7 @@ func (p *ApiParserParser) ImportBlock() (localctx IImportBlockContext) {
|
|||||||
{
|
{
|
||||||
p.SetState(102)
|
p.SetState(102)
|
||||||
|
|
||||||
var _m = p.Match(ApiParserParserID)
|
_m := p.Match(ApiParserParserID)
|
||||||
|
|
||||||
localctx.(*ImportBlockContext).importToken = _m
|
localctx.(*ImportBlockContext).importToken = _m
|
||||||
}
|
}
|
||||||
@@ -500,7 +500,7 @@ type ImportBlockValueContext struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func NewEmptyImportBlockValueContext() *ImportBlockValueContext {
|
func NewEmptyImportBlockValueContext() *ImportBlockValueContext {
|
||||||
var p = new(ImportBlockValueContext)
|
p := new(ImportBlockValueContext)
|
||||||
p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1)
|
p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1)
|
||||||
p.RuleIndex = ApiParserParserRULE_importBlockValue
|
p.RuleIndex = ApiParserParserRULE_importBlockValue
|
||||||
return p
|
return p
|
||||||
@@ -509,7 +509,7 @@ func NewEmptyImportBlockValueContext() *ImportBlockValueContext {
|
|||||||
func (*ImportBlockValueContext) IsImportBlockValueContext() {}
|
func (*ImportBlockValueContext) IsImportBlockValueContext() {}
|
||||||
|
|
||||||
func NewImportBlockValueContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *ImportBlockValueContext {
|
func NewImportBlockValueContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *ImportBlockValueContext {
|
||||||
var p = new(ImportBlockValueContext)
|
p := new(ImportBlockValueContext)
|
||||||
|
|
||||||
p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState)
|
p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState)
|
||||||
|
|
||||||
@@ -522,7 +522,7 @@ func NewImportBlockValueContext(parser antlr.Parser, parent antlr.ParserRuleCont
|
|||||||
func (s *ImportBlockValueContext) GetParser() antlr.Parser { return s.parser }
|
func (s *ImportBlockValueContext) GetParser() antlr.Parser { return s.parser }
|
||||||
|
|
||||||
func (s *ImportBlockValueContext) ImportValue() IImportValueContext {
|
func (s *ImportBlockValueContext) ImportValue() IImportValueContext {
|
||||||
var t = s.GetTypedRuleContext(reflect.TypeOf((*IImportValueContext)(nil)).Elem(), 0)
|
t := s.GetTypedRuleContext(reflect.TypeOf((*IImportValueContext)(nil)).Elem(), 0)
|
||||||
|
|
||||||
if t == nil {
|
if t == nil {
|
||||||
return nil
|
return nil
|
||||||
@@ -595,7 +595,7 @@ type ImportValueContext struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func NewEmptyImportValueContext() *ImportValueContext {
|
func NewEmptyImportValueContext() *ImportValueContext {
|
||||||
var p = new(ImportValueContext)
|
p := new(ImportValueContext)
|
||||||
p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1)
|
p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1)
|
||||||
p.RuleIndex = ApiParserParserRULE_importValue
|
p.RuleIndex = ApiParserParserRULE_importValue
|
||||||
return p
|
return p
|
||||||
@@ -604,7 +604,7 @@ func NewEmptyImportValueContext() *ImportValueContext {
|
|||||||
func (*ImportValueContext) IsImportValueContext() {}
|
func (*ImportValueContext) IsImportValueContext() {}
|
||||||
|
|
||||||
func NewImportValueContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *ImportValueContext {
|
func NewImportValueContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *ImportValueContext {
|
||||||
var p = new(ImportValueContext)
|
p := new(ImportValueContext)
|
||||||
|
|
||||||
p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState)
|
p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState)
|
||||||
|
|
||||||
|
|||||||
@@ -102,7 +102,7 @@ type InfoSpecContext struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func NewEmptyInfoSpecContext() *InfoSpecContext {
|
func NewEmptyInfoSpecContext() *InfoSpecContext {
|
||||||
var p = new(InfoSpecContext)
|
p := new(InfoSpecContext)
|
||||||
p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1)
|
p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1)
|
||||||
p.RuleIndex = ApiParserParserRULE_infoSpec
|
p.RuleIndex = ApiParserParserRULE_infoSpec
|
||||||
return p
|
return p
|
||||||
@@ -111,7 +111,7 @@ func NewEmptyInfoSpecContext() *InfoSpecContext {
|
|||||||
func (*InfoSpecContext) IsInfoSpecContext() {}
|
func (*InfoSpecContext) IsInfoSpecContext() {}
|
||||||
|
|
||||||
func NewInfoSpecContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *InfoSpecContext {
|
func NewInfoSpecContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *InfoSpecContext {
|
||||||
var p = new(InfoSpecContext)
|
p := new(InfoSpecContext)
|
||||||
|
|
||||||
p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState)
|
p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState)
|
||||||
|
|
||||||
@@ -140,8 +140,8 @@ func (s *InfoSpecContext) ID() antlr.TerminalNode {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (s *InfoSpecContext) AllKvLit() []IKvLitContext {
|
func (s *InfoSpecContext) AllKvLit() []IKvLitContext {
|
||||||
var ts = s.GetTypedRuleContexts(reflect.TypeOf((*IKvLitContext)(nil)).Elem())
|
ts := s.GetTypedRuleContexts(reflect.TypeOf((*IKvLitContext)(nil)).Elem())
|
||||||
var tst = make([]IKvLitContext, len(ts))
|
tst := make([]IKvLitContext, len(ts))
|
||||||
|
|
||||||
for i, t := range ts {
|
for i, t := range ts {
|
||||||
if t != nil {
|
if t != nil {
|
||||||
@@ -153,7 +153,7 @@ func (s *InfoSpecContext) AllKvLit() []IKvLitContext {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (s *InfoSpecContext) KvLit(i int) IKvLitContext {
|
func (s *InfoSpecContext) KvLit(i int) IKvLitContext {
|
||||||
var t = s.GetTypedRuleContext(reflect.TypeOf((*IKvLitContext)(nil)).Elem(), i)
|
t := s.GetTypedRuleContext(reflect.TypeOf((*IKvLitContext)(nil)).Elem(), i)
|
||||||
|
|
||||||
if t == nil {
|
if t == nil {
|
||||||
return nil
|
return nil
|
||||||
@@ -206,14 +206,14 @@ func (p *ApiParserParser) InfoSpec() (localctx IInfoSpecContext) {
|
|||||||
{
|
{
|
||||||
p.SetState(117)
|
p.SetState(117)
|
||||||
|
|
||||||
var _m = p.Match(ApiParserParserID)
|
_m := p.Match(ApiParserParserID)
|
||||||
|
|
||||||
localctx.(*InfoSpecContext).infoToken = _m
|
localctx.(*InfoSpecContext).infoToken = _m
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
p.SetState(118)
|
p.SetState(118)
|
||||||
|
|
||||||
var _m = p.Match(ApiParserParserT__1)
|
_m := p.Match(ApiParserParserT__1)
|
||||||
|
|
||||||
localctx.(*InfoSpecContext).lp = _m
|
localctx.(*InfoSpecContext).lp = _m
|
||||||
}
|
}
|
||||||
@@ -233,7 +233,7 @@ func (p *ApiParserParser) InfoSpec() (localctx IInfoSpecContext) {
|
|||||||
{
|
{
|
||||||
p.SetState(124)
|
p.SetState(124)
|
||||||
|
|
||||||
var _m = p.Match(ApiParserParserT__2)
|
_m := p.Match(ApiParserParserT__2)
|
||||||
|
|
||||||
localctx.(*InfoSpecContext).rp = _m
|
localctx.(*InfoSpecContext).rp = _m
|
||||||
}
|
}
|
||||||
@@ -258,7 +258,7 @@ type TypeSpecContext struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func NewEmptyTypeSpecContext() *TypeSpecContext {
|
func NewEmptyTypeSpecContext() *TypeSpecContext {
|
||||||
var p = new(TypeSpecContext)
|
p := new(TypeSpecContext)
|
||||||
p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1)
|
p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1)
|
||||||
p.RuleIndex = ApiParserParserRULE_typeSpec
|
p.RuleIndex = ApiParserParserRULE_typeSpec
|
||||||
return p
|
return p
|
||||||
@@ -267,7 +267,7 @@ func NewEmptyTypeSpecContext() *TypeSpecContext {
|
|||||||
func (*TypeSpecContext) IsTypeSpecContext() {}
|
func (*TypeSpecContext) IsTypeSpecContext() {}
|
||||||
|
|
||||||
func NewTypeSpecContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *TypeSpecContext {
|
func NewTypeSpecContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *TypeSpecContext {
|
||||||
var p = new(TypeSpecContext)
|
p := new(TypeSpecContext)
|
||||||
|
|
||||||
p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState)
|
p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState)
|
||||||
|
|
||||||
@@ -280,7 +280,7 @@ func NewTypeSpecContext(parser antlr.Parser, parent antlr.ParserRuleContext, inv
|
|||||||
func (s *TypeSpecContext) GetParser() antlr.Parser { return s.parser }
|
func (s *TypeSpecContext) GetParser() antlr.Parser { return s.parser }
|
||||||
|
|
||||||
func (s *TypeSpecContext) TypeLit() ITypeLitContext {
|
func (s *TypeSpecContext) TypeLit() ITypeLitContext {
|
||||||
var t = s.GetTypedRuleContext(reflect.TypeOf((*ITypeLitContext)(nil)).Elem(), 0)
|
t := s.GetTypedRuleContext(reflect.TypeOf((*ITypeLitContext)(nil)).Elem(), 0)
|
||||||
|
|
||||||
if t == nil {
|
if t == nil {
|
||||||
return nil
|
return nil
|
||||||
@@ -290,7 +290,7 @@ func (s *TypeSpecContext) TypeLit() ITypeLitContext {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (s *TypeSpecContext) TypeBlock() ITypeBlockContext {
|
func (s *TypeSpecContext) TypeBlock() ITypeBlockContext {
|
||||||
var t = s.GetTypedRuleContext(reflect.TypeOf((*ITypeBlockContext)(nil)).Elem(), 0)
|
t := s.GetTypedRuleContext(reflect.TypeOf((*ITypeBlockContext)(nil)).Elem(), 0)
|
||||||
|
|
||||||
if t == nil {
|
if t == nil {
|
||||||
return nil
|
return nil
|
||||||
@@ -383,7 +383,7 @@ type TypeLitContext struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func NewEmptyTypeLitContext() *TypeLitContext {
|
func NewEmptyTypeLitContext() *TypeLitContext {
|
||||||
var p = new(TypeLitContext)
|
p := new(TypeLitContext)
|
||||||
p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1)
|
p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1)
|
||||||
p.RuleIndex = ApiParserParserRULE_typeLit
|
p.RuleIndex = ApiParserParserRULE_typeLit
|
||||||
return p
|
return p
|
||||||
@@ -392,7 +392,7 @@ func NewEmptyTypeLitContext() *TypeLitContext {
|
|||||||
func (*TypeLitContext) IsTypeLitContext() {}
|
func (*TypeLitContext) IsTypeLitContext() {}
|
||||||
|
|
||||||
func NewTypeLitContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *TypeLitContext {
|
func NewTypeLitContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *TypeLitContext {
|
||||||
var p = new(TypeLitContext)
|
p := new(TypeLitContext)
|
||||||
|
|
||||||
p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState)
|
p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState)
|
||||||
|
|
||||||
@@ -409,7 +409,7 @@ func (s *TypeLitContext) GetTypeToken() antlr.Token { return s.typeToken }
|
|||||||
func (s *TypeLitContext) SetTypeToken(v antlr.Token) { s.typeToken = v }
|
func (s *TypeLitContext) SetTypeToken(v antlr.Token) { s.typeToken = v }
|
||||||
|
|
||||||
func (s *TypeLitContext) TypeLitBody() ITypeLitBodyContext {
|
func (s *TypeLitContext) TypeLitBody() ITypeLitBodyContext {
|
||||||
var t = s.GetTypedRuleContext(reflect.TypeOf((*ITypeLitBodyContext)(nil)).Elem(), 0)
|
t := s.GetTypedRuleContext(reflect.TypeOf((*ITypeLitBodyContext)(nil)).Elem(), 0)
|
||||||
|
|
||||||
if t == nil {
|
if t == nil {
|
||||||
return nil
|
return nil
|
||||||
@@ -465,7 +465,7 @@ func (p *ApiParserParser) TypeLit() (localctx ITypeLitContext) {
|
|||||||
{
|
{
|
||||||
p.SetState(131)
|
p.SetState(131)
|
||||||
|
|
||||||
var _m = p.Match(ApiParserParserID)
|
_m := p.Match(ApiParserParserID)
|
||||||
|
|
||||||
localctx.(*TypeLitContext).typeToken = _m
|
localctx.(*TypeLitContext).typeToken = _m
|
||||||
}
|
}
|
||||||
@@ -515,7 +515,7 @@ type TypeBlockContext struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func NewEmptyTypeBlockContext() *TypeBlockContext {
|
func NewEmptyTypeBlockContext() *TypeBlockContext {
|
||||||
var p = new(TypeBlockContext)
|
p := new(TypeBlockContext)
|
||||||
p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1)
|
p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1)
|
||||||
p.RuleIndex = ApiParserParserRULE_typeBlock
|
p.RuleIndex = ApiParserParserRULE_typeBlock
|
||||||
return p
|
return p
|
||||||
@@ -524,7 +524,7 @@ func NewEmptyTypeBlockContext() *TypeBlockContext {
|
|||||||
func (*TypeBlockContext) IsTypeBlockContext() {}
|
func (*TypeBlockContext) IsTypeBlockContext() {}
|
||||||
|
|
||||||
func NewTypeBlockContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *TypeBlockContext {
|
func NewTypeBlockContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *TypeBlockContext {
|
||||||
var p = new(TypeBlockContext)
|
p := new(TypeBlockContext)
|
||||||
|
|
||||||
p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState)
|
p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState)
|
||||||
|
|
||||||
@@ -553,8 +553,8 @@ func (s *TypeBlockContext) ID() antlr.TerminalNode {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (s *TypeBlockContext) AllTypeBlockBody() []ITypeBlockBodyContext {
|
func (s *TypeBlockContext) AllTypeBlockBody() []ITypeBlockBodyContext {
|
||||||
var ts = s.GetTypedRuleContexts(reflect.TypeOf((*ITypeBlockBodyContext)(nil)).Elem())
|
ts := s.GetTypedRuleContexts(reflect.TypeOf((*ITypeBlockBodyContext)(nil)).Elem())
|
||||||
var tst = make([]ITypeBlockBodyContext, len(ts))
|
tst := make([]ITypeBlockBodyContext, len(ts))
|
||||||
|
|
||||||
for i, t := range ts {
|
for i, t := range ts {
|
||||||
if t != nil {
|
if t != nil {
|
||||||
@@ -566,7 +566,7 @@ func (s *TypeBlockContext) AllTypeBlockBody() []ITypeBlockBodyContext {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (s *TypeBlockContext) TypeBlockBody(i int) ITypeBlockBodyContext {
|
func (s *TypeBlockContext) TypeBlockBody(i int) ITypeBlockBodyContext {
|
||||||
var t = s.GetTypedRuleContext(reflect.TypeOf((*ITypeBlockBodyContext)(nil)).Elem(), i)
|
t := s.GetTypedRuleContext(reflect.TypeOf((*ITypeBlockBodyContext)(nil)).Elem(), i)
|
||||||
|
|
||||||
if t == nil {
|
if t == nil {
|
||||||
return nil
|
return nil
|
||||||
@@ -619,14 +619,14 @@ func (p *ApiParserParser) TypeBlock() (localctx ITypeBlockContext) {
|
|||||||
{
|
{
|
||||||
p.SetState(135)
|
p.SetState(135)
|
||||||
|
|
||||||
var _m = p.Match(ApiParserParserID)
|
_m := p.Match(ApiParserParserID)
|
||||||
|
|
||||||
localctx.(*TypeBlockContext).typeToken = _m
|
localctx.(*TypeBlockContext).typeToken = _m
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
p.SetState(136)
|
p.SetState(136)
|
||||||
|
|
||||||
var _m = p.Match(ApiParserParserT__1)
|
_m := p.Match(ApiParserParserT__1)
|
||||||
|
|
||||||
localctx.(*TypeBlockContext).lp = _m
|
localctx.(*TypeBlockContext).lp = _m
|
||||||
}
|
}
|
||||||
@@ -647,7 +647,7 @@ func (p *ApiParserParser) TypeBlock() (localctx ITypeBlockContext) {
|
|||||||
{
|
{
|
||||||
p.SetState(143)
|
p.SetState(143)
|
||||||
|
|
||||||
var _m = p.Match(ApiParserParserT__2)
|
_m := p.Match(ApiParserParserT__2)
|
||||||
|
|
||||||
localctx.(*TypeBlockContext).rp = _m
|
localctx.(*TypeBlockContext).rp = _m
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ type TypeLitBodyContext struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func NewEmptyTypeLitBodyContext() *TypeLitBodyContext {
|
func NewEmptyTypeLitBodyContext() *TypeLitBodyContext {
|
||||||
var p = new(TypeLitBodyContext)
|
p := new(TypeLitBodyContext)
|
||||||
p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1)
|
p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1)
|
||||||
p.RuleIndex = ApiParserParserRULE_typeLitBody
|
p.RuleIndex = ApiParserParserRULE_typeLitBody
|
||||||
return p
|
return p
|
||||||
@@ -36,7 +36,7 @@ func NewEmptyTypeLitBodyContext() *TypeLitBodyContext {
|
|||||||
func (*TypeLitBodyContext) IsTypeLitBodyContext() {}
|
func (*TypeLitBodyContext) IsTypeLitBodyContext() {}
|
||||||
|
|
||||||
func NewTypeLitBodyContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *TypeLitBodyContext {
|
func NewTypeLitBodyContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *TypeLitBodyContext {
|
||||||
var p = new(TypeLitBodyContext)
|
p := new(TypeLitBodyContext)
|
||||||
|
|
||||||
p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState)
|
p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState)
|
||||||
|
|
||||||
@@ -49,7 +49,7 @@ func NewTypeLitBodyContext(parser antlr.Parser, parent antlr.ParserRuleContext,
|
|||||||
func (s *TypeLitBodyContext) GetParser() antlr.Parser { return s.parser }
|
func (s *TypeLitBodyContext) GetParser() antlr.Parser { return s.parser }
|
||||||
|
|
||||||
func (s *TypeLitBodyContext) TypeStruct() ITypeStructContext {
|
func (s *TypeLitBodyContext) TypeStruct() ITypeStructContext {
|
||||||
var t = s.GetTypedRuleContext(reflect.TypeOf((*ITypeStructContext)(nil)).Elem(), 0)
|
t := s.GetTypedRuleContext(reflect.TypeOf((*ITypeStructContext)(nil)).Elem(), 0)
|
||||||
|
|
||||||
if t == nil {
|
if t == nil {
|
||||||
return nil
|
return nil
|
||||||
@@ -59,7 +59,7 @@ func (s *TypeLitBodyContext) TypeStruct() ITypeStructContext {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (s *TypeLitBodyContext) TypeAlias() ITypeAliasContext {
|
func (s *TypeLitBodyContext) TypeAlias() ITypeAliasContext {
|
||||||
var t = s.GetTypedRuleContext(reflect.TypeOf((*ITypeAliasContext)(nil)).Elem(), 0)
|
t := s.GetTypedRuleContext(reflect.TypeOf((*ITypeAliasContext)(nil)).Elem(), 0)
|
||||||
|
|
||||||
if t == nil {
|
if t == nil {
|
||||||
return nil
|
return nil
|
||||||
@@ -145,7 +145,7 @@ type TypeBlockBodyContext struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func NewEmptyTypeBlockBodyContext() *TypeBlockBodyContext {
|
func NewEmptyTypeBlockBodyContext() *TypeBlockBodyContext {
|
||||||
var p = new(TypeBlockBodyContext)
|
p := new(TypeBlockBodyContext)
|
||||||
p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1)
|
p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1)
|
||||||
p.RuleIndex = ApiParserParserRULE_typeBlockBody
|
p.RuleIndex = ApiParserParserRULE_typeBlockBody
|
||||||
return p
|
return p
|
||||||
@@ -154,7 +154,7 @@ func NewEmptyTypeBlockBodyContext() *TypeBlockBodyContext {
|
|||||||
func (*TypeBlockBodyContext) IsTypeBlockBodyContext() {}
|
func (*TypeBlockBodyContext) IsTypeBlockBodyContext() {}
|
||||||
|
|
||||||
func NewTypeBlockBodyContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *TypeBlockBodyContext {
|
func NewTypeBlockBodyContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *TypeBlockBodyContext {
|
||||||
var p = new(TypeBlockBodyContext)
|
p := new(TypeBlockBodyContext)
|
||||||
|
|
||||||
p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState)
|
p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState)
|
||||||
|
|
||||||
@@ -167,7 +167,7 @@ func NewTypeBlockBodyContext(parser antlr.Parser, parent antlr.ParserRuleContext
|
|||||||
func (s *TypeBlockBodyContext) GetParser() antlr.Parser { return s.parser }
|
func (s *TypeBlockBodyContext) GetParser() antlr.Parser { return s.parser }
|
||||||
|
|
||||||
func (s *TypeBlockBodyContext) TypeBlockStruct() ITypeBlockStructContext {
|
func (s *TypeBlockBodyContext) TypeBlockStruct() ITypeBlockStructContext {
|
||||||
var t = s.GetTypedRuleContext(reflect.TypeOf((*ITypeBlockStructContext)(nil)).Elem(), 0)
|
t := s.GetTypedRuleContext(reflect.TypeOf((*ITypeBlockStructContext)(nil)).Elem(), 0)
|
||||||
|
|
||||||
if t == nil {
|
if t == nil {
|
||||||
return nil
|
return nil
|
||||||
@@ -177,7 +177,7 @@ func (s *TypeBlockBodyContext) TypeBlockStruct() ITypeBlockStructContext {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (s *TypeBlockBodyContext) TypeBlockAlias() ITypeBlockAliasContext {
|
func (s *TypeBlockBodyContext) TypeBlockAlias() ITypeBlockAliasContext {
|
||||||
var t = s.GetTypedRuleContext(reflect.TypeOf((*ITypeBlockAliasContext)(nil)).Elem(), 0)
|
t := s.GetTypedRuleContext(reflect.TypeOf((*ITypeBlockAliasContext)(nil)).Elem(), 0)
|
||||||
|
|
||||||
if t == nil {
|
if t == nil {
|
||||||
return nil
|
return nil
|
||||||
@@ -291,7 +291,7 @@ type TypeStructContext struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func NewEmptyTypeStructContext() *TypeStructContext {
|
func NewEmptyTypeStructContext() *TypeStructContext {
|
||||||
var p = new(TypeStructContext)
|
p := new(TypeStructContext)
|
||||||
p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1)
|
p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1)
|
||||||
p.RuleIndex = ApiParserParserRULE_typeStruct
|
p.RuleIndex = ApiParserParserRULE_typeStruct
|
||||||
return p
|
return p
|
||||||
@@ -300,7 +300,7 @@ func NewEmptyTypeStructContext() *TypeStructContext {
|
|||||||
func (*TypeStructContext) IsTypeStructContext() {}
|
func (*TypeStructContext) IsTypeStructContext() {}
|
||||||
|
|
||||||
func NewTypeStructContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *TypeStructContext {
|
func NewTypeStructContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *TypeStructContext {
|
||||||
var p = new(TypeStructContext)
|
p := new(TypeStructContext)
|
||||||
|
|
||||||
p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState)
|
p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState)
|
||||||
|
|
||||||
@@ -337,8 +337,8 @@ func (s *TypeStructContext) ID(i int) antlr.TerminalNode {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (s *TypeStructContext) AllField() []IFieldContext {
|
func (s *TypeStructContext) AllField() []IFieldContext {
|
||||||
var ts = s.GetTypedRuleContexts(reflect.TypeOf((*IFieldContext)(nil)).Elem())
|
ts := s.GetTypedRuleContexts(reflect.TypeOf((*IFieldContext)(nil)).Elem())
|
||||||
var tst = make([]IFieldContext, len(ts))
|
tst := make([]IFieldContext, len(ts))
|
||||||
|
|
||||||
for i, t := range ts {
|
for i, t := range ts {
|
||||||
if t != nil {
|
if t != nil {
|
||||||
@@ -350,7 +350,7 @@ func (s *TypeStructContext) AllField() []IFieldContext {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (s *TypeStructContext) Field(i int) IFieldContext {
|
func (s *TypeStructContext) Field(i int) IFieldContext {
|
||||||
var t = s.GetTypedRuleContext(reflect.TypeOf((*IFieldContext)(nil)).Elem(), i)
|
t := s.GetTypedRuleContext(reflect.TypeOf((*IFieldContext)(nil)).Elem(), i)
|
||||||
|
|
||||||
if t == nil {
|
if t == nil {
|
||||||
return nil
|
return nil
|
||||||
@@ -405,7 +405,7 @@ func (p *ApiParserParser) TypeStruct() (localctx ITypeStructContext) {
|
|||||||
{
|
{
|
||||||
p.SetState(154)
|
p.SetState(154)
|
||||||
|
|
||||||
var _m = p.Match(ApiParserParserID)
|
_m := p.Match(ApiParserParserID)
|
||||||
|
|
||||||
localctx.(*TypeStructContext).structName = _m
|
localctx.(*TypeStructContext).structName = _m
|
||||||
}
|
}
|
||||||
@@ -417,16 +417,15 @@ func (p *ApiParserParser) TypeStruct() (localctx ITypeStructContext) {
|
|||||||
{
|
{
|
||||||
p.SetState(155)
|
p.SetState(155)
|
||||||
|
|
||||||
var _m = p.Match(ApiParserParserID)
|
_m := p.Match(ApiParserParserID)
|
||||||
|
|
||||||
localctx.(*TypeStructContext).structToken = _m
|
localctx.(*TypeStructContext).structToken = _m
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
p.SetState(158)
|
p.SetState(158)
|
||||||
|
|
||||||
var _m = p.Match(ApiParserParserT__3)
|
_m := p.Match(ApiParserParserT__3)
|
||||||
|
|
||||||
localctx.(*TypeStructContext).lbrace = _m
|
localctx.(*TypeStructContext).lbrace = _m
|
||||||
}
|
}
|
||||||
@@ -440,7 +439,6 @@ func (p *ApiParserParser) TypeStruct() (localctx ITypeStructContext) {
|
|||||||
p.SetState(159)
|
p.SetState(159)
|
||||||
p.Field()
|
p.Field()
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
p.SetState(164)
|
p.SetState(164)
|
||||||
p.GetErrorHandler().Sync(p)
|
p.GetErrorHandler().Sync(p)
|
||||||
@@ -449,7 +447,7 @@ func (p *ApiParserParser) TypeStruct() (localctx ITypeStructContext) {
|
|||||||
{
|
{
|
||||||
p.SetState(165)
|
p.SetState(165)
|
||||||
|
|
||||||
var _m = p.Match(ApiParserParserT__4)
|
_m := p.Match(ApiParserParserT__4)
|
||||||
|
|
||||||
localctx.(*TypeStructContext).rbrace = _m
|
localctx.(*TypeStructContext).rbrace = _m
|
||||||
}
|
}
|
||||||
@@ -488,7 +486,7 @@ type TypeAliasContext struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func NewEmptyTypeAliasContext() *TypeAliasContext {
|
func NewEmptyTypeAliasContext() *TypeAliasContext {
|
||||||
var p = new(TypeAliasContext)
|
p := new(TypeAliasContext)
|
||||||
p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1)
|
p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1)
|
||||||
p.RuleIndex = ApiParserParserRULE_typeAlias
|
p.RuleIndex = ApiParserParserRULE_typeAlias
|
||||||
return p
|
return p
|
||||||
@@ -497,7 +495,7 @@ func NewEmptyTypeAliasContext() *TypeAliasContext {
|
|||||||
func (*TypeAliasContext) IsTypeAliasContext() {}
|
func (*TypeAliasContext) IsTypeAliasContext() {}
|
||||||
|
|
||||||
func NewTypeAliasContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *TypeAliasContext {
|
func NewTypeAliasContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *TypeAliasContext {
|
||||||
var p = new(TypeAliasContext)
|
p := new(TypeAliasContext)
|
||||||
|
|
||||||
p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState)
|
p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState)
|
||||||
|
|
||||||
@@ -518,7 +516,7 @@ func (s *TypeAliasContext) SetAlias(v antlr.Token) { s.alias = v }
|
|||||||
func (s *TypeAliasContext) SetAssign(v antlr.Token) { s.assign = v }
|
func (s *TypeAliasContext) SetAssign(v antlr.Token) { s.assign = v }
|
||||||
|
|
||||||
func (s *TypeAliasContext) DataType() IDataTypeContext {
|
func (s *TypeAliasContext) DataType() IDataTypeContext {
|
||||||
var t = s.GetTypedRuleContext(reflect.TypeOf((*IDataTypeContext)(nil)).Elem(), 0)
|
t := s.GetTypedRuleContext(reflect.TypeOf((*IDataTypeContext)(nil)).Elem(), 0)
|
||||||
|
|
||||||
if t == nil {
|
if t == nil {
|
||||||
return nil
|
return nil
|
||||||
@@ -575,7 +573,7 @@ func (p *ApiParserParser) TypeAlias() (localctx ITypeAliasContext) {
|
|||||||
{
|
{
|
||||||
p.SetState(168)
|
p.SetState(168)
|
||||||
|
|
||||||
var _m = p.Match(ApiParserParserID)
|
_m := p.Match(ApiParserParserID)
|
||||||
|
|
||||||
localctx.(*TypeAliasContext).alias = _m
|
localctx.(*TypeAliasContext).alias = _m
|
||||||
}
|
}
|
||||||
@@ -587,11 +585,10 @@ func (p *ApiParserParser) TypeAlias() (localctx ITypeAliasContext) {
|
|||||||
{
|
{
|
||||||
p.SetState(169)
|
p.SetState(169)
|
||||||
|
|
||||||
var _m = p.Match(ApiParserParserT__0)
|
_m := p.Match(ApiParserParserT__0)
|
||||||
|
|
||||||
localctx.(*TypeAliasContext).assign = _m
|
localctx.(*TypeAliasContext).assign = _m
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
p.SetState(172)
|
p.SetState(172)
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ type TypeBlockStructContext struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func NewEmptyTypeBlockStructContext() *TypeBlockStructContext {
|
func NewEmptyTypeBlockStructContext() *TypeBlockStructContext {
|
||||||
var p = new(TypeBlockStructContext)
|
p := new(TypeBlockStructContext)
|
||||||
p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1)
|
p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1)
|
||||||
p.RuleIndex = ApiParserParserRULE_typeBlockStruct
|
p.RuleIndex = ApiParserParserRULE_typeBlockStruct
|
||||||
return p
|
return p
|
||||||
@@ -29,7 +29,7 @@ func NewEmptyTypeBlockStructContext() *TypeBlockStructContext {
|
|||||||
func (*TypeBlockStructContext) IsTypeBlockStructContext() {}
|
func (*TypeBlockStructContext) IsTypeBlockStructContext() {}
|
||||||
|
|
||||||
func NewTypeBlockStructContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *TypeBlockStructContext {
|
func NewTypeBlockStructContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *TypeBlockStructContext {
|
||||||
var p = new(TypeBlockStructContext)
|
p := new(TypeBlockStructContext)
|
||||||
|
|
||||||
p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState)
|
p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState)
|
||||||
|
|
||||||
@@ -66,8 +66,8 @@ func (s *TypeBlockStructContext) ID(i int) antlr.TerminalNode {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (s *TypeBlockStructContext) AllField() []IFieldContext {
|
func (s *TypeBlockStructContext) AllField() []IFieldContext {
|
||||||
var ts = s.GetTypedRuleContexts(reflect.TypeOf((*IFieldContext)(nil)).Elem())
|
ts := s.GetTypedRuleContexts(reflect.TypeOf((*IFieldContext)(nil)).Elem())
|
||||||
var tst = make([]IFieldContext, len(ts))
|
tst := make([]IFieldContext, len(ts))
|
||||||
|
|
||||||
for i, t := range ts {
|
for i, t := range ts {
|
||||||
if t != nil {
|
if t != nil {
|
||||||
@@ -79,7 +79,7 @@ func (s *TypeBlockStructContext) AllField() []IFieldContext {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (s *TypeBlockStructContext) Field(i int) IFieldContext {
|
func (s *TypeBlockStructContext) Field(i int) IFieldContext {
|
||||||
var t = s.GetTypedRuleContext(reflect.TypeOf((*IFieldContext)(nil)).Elem(), i)
|
t := s.GetTypedRuleContext(reflect.TypeOf((*IFieldContext)(nil)).Elem(), i)
|
||||||
|
|
||||||
if t == nil {
|
if t == nil {
|
||||||
return nil
|
return nil
|
||||||
@@ -134,7 +134,7 @@ func (p *ApiParserParser) TypeBlockStruct() (localctx ITypeBlockStructContext) {
|
|||||||
{
|
{
|
||||||
p.SetState(175)
|
p.SetState(175)
|
||||||
|
|
||||||
var _m = p.Match(ApiParserParserID)
|
_m := p.Match(ApiParserParserID)
|
||||||
|
|
||||||
localctx.(*TypeBlockStructContext).structName = _m
|
localctx.(*TypeBlockStructContext).structName = _m
|
||||||
}
|
}
|
||||||
@@ -146,16 +146,15 @@ func (p *ApiParserParser) TypeBlockStruct() (localctx ITypeBlockStructContext) {
|
|||||||
{
|
{
|
||||||
p.SetState(176)
|
p.SetState(176)
|
||||||
|
|
||||||
var _m = p.Match(ApiParserParserID)
|
_m := p.Match(ApiParserParserID)
|
||||||
|
|
||||||
localctx.(*TypeBlockStructContext).structToken = _m
|
localctx.(*TypeBlockStructContext).structToken = _m
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
p.SetState(179)
|
p.SetState(179)
|
||||||
|
|
||||||
var _m = p.Match(ApiParserParserT__3)
|
_m := p.Match(ApiParserParserT__3)
|
||||||
|
|
||||||
localctx.(*TypeBlockStructContext).lbrace = _m
|
localctx.(*TypeBlockStructContext).lbrace = _m
|
||||||
}
|
}
|
||||||
@@ -169,7 +168,6 @@ func (p *ApiParserParser) TypeBlockStruct() (localctx ITypeBlockStructContext) {
|
|||||||
p.SetState(180)
|
p.SetState(180)
|
||||||
p.Field()
|
p.Field()
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
p.SetState(185)
|
p.SetState(185)
|
||||||
p.GetErrorHandler().Sync(p)
|
p.GetErrorHandler().Sync(p)
|
||||||
@@ -178,7 +176,7 @@ func (p *ApiParserParser) TypeBlockStruct() (localctx ITypeBlockStructContext) {
|
|||||||
{
|
{
|
||||||
p.SetState(186)
|
p.SetState(186)
|
||||||
|
|
||||||
var _m = p.Match(ApiParserParserT__4)
|
_m := p.Match(ApiParserParserT__4)
|
||||||
|
|
||||||
localctx.(*TypeBlockStructContext).rbrace = _m
|
localctx.(*TypeBlockStructContext).rbrace = _m
|
||||||
}
|
}
|
||||||
@@ -217,7 +215,7 @@ type TypeBlockAliasContext struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func NewEmptyTypeBlockAliasContext() *TypeBlockAliasContext {
|
func NewEmptyTypeBlockAliasContext() *TypeBlockAliasContext {
|
||||||
var p = new(TypeBlockAliasContext)
|
p := new(TypeBlockAliasContext)
|
||||||
p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1)
|
p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1)
|
||||||
p.RuleIndex = ApiParserParserRULE_typeBlockAlias
|
p.RuleIndex = ApiParserParserRULE_typeBlockAlias
|
||||||
return p
|
return p
|
||||||
@@ -226,7 +224,7 @@ func NewEmptyTypeBlockAliasContext() *TypeBlockAliasContext {
|
|||||||
func (*TypeBlockAliasContext) IsTypeBlockAliasContext() {}
|
func (*TypeBlockAliasContext) IsTypeBlockAliasContext() {}
|
||||||
|
|
||||||
func NewTypeBlockAliasContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *TypeBlockAliasContext {
|
func NewTypeBlockAliasContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *TypeBlockAliasContext {
|
||||||
var p = new(TypeBlockAliasContext)
|
p := new(TypeBlockAliasContext)
|
||||||
|
|
||||||
p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState)
|
p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState)
|
||||||
|
|
||||||
@@ -247,7 +245,7 @@ func (s *TypeBlockAliasContext) SetAlias(v antlr.Token) { s.alias = v }
|
|||||||
func (s *TypeBlockAliasContext) SetAssign(v antlr.Token) { s.assign = v }
|
func (s *TypeBlockAliasContext) SetAssign(v antlr.Token) { s.assign = v }
|
||||||
|
|
||||||
func (s *TypeBlockAliasContext) DataType() IDataTypeContext {
|
func (s *TypeBlockAliasContext) DataType() IDataTypeContext {
|
||||||
var t = s.GetTypedRuleContext(reflect.TypeOf((*IDataTypeContext)(nil)).Elem(), 0)
|
t := s.GetTypedRuleContext(reflect.TypeOf((*IDataTypeContext)(nil)).Elem(), 0)
|
||||||
|
|
||||||
if t == nil {
|
if t == nil {
|
||||||
return nil
|
return nil
|
||||||
@@ -304,7 +302,7 @@ func (p *ApiParserParser) TypeBlockAlias() (localctx ITypeBlockAliasContext) {
|
|||||||
{
|
{
|
||||||
p.SetState(189)
|
p.SetState(189)
|
||||||
|
|
||||||
var _m = p.Match(ApiParserParserID)
|
_m := p.Match(ApiParserParserID)
|
||||||
|
|
||||||
localctx.(*TypeBlockAliasContext).alias = _m
|
localctx.(*TypeBlockAliasContext).alias = _m
|
||||||
}
|
}
|
||||||
@@ -316,11 +314,10 @@ func (p *ApiParserParser) TypeBlockAlias() (localctx ITypeBlockAliasContext) {
|
|||||||
{
|
{
|
||||||
p.SetState(190)
|
p.SetState(190)
|
||||||
|
|
||||||
var _m = p.Match(ApiParserParserT__0)
|
_m := p.Match(ApiParserParserT__0)
|
||||||
|
|
||||||
localctx.(*TypeBlockAliasContext).assign = _m
|
localctx.(*TypeBlockAliasContext).assign = _m
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
p.SetState(193)
|
p.SetState(193)
|
||||||
@@ -347,7 +344,7 @@ type FieldContext struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func NewEmptyFieldContext() *FieldContext {
|
func NewEmptyFieldContext() *FieldContext {
|
||||||
var p = new(FieldContext)
|
p := new(FieldContext)
|
||||||
p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1)
|
p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1)
|
||||||
p.RuleIndex = ApiParserParserRULE_field
|
p.RuleIndex = ApiParserParserRULE_field
|
||||||
return p
|
return p
|
||||||
@@ -356,7 +353,7 @@ func NewEmptyFieldContext() *FieldContext {
|
|||||||
func (*FieldContext) IsFieldContext() {}
|
func (*FieldContext) IsFieldContext() {}
|
||||||
|
|
||||||
func NewFieldContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *FieldContext {
|
func NewFieldContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *FieldContext {
|
||||||
var p = new(FieldContext)
|
p := new(FieldContext)
|
||||||
|
|
||||||
p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState)
|
p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState)
|
||||||
|
|
||||||
@@ -369,7 +366,7 @@ func NewFieldContext(parser antlr.Parser, parent antlr.ParserRuleContext, invoki
|
|||||||
func (s *FieldContext) GetParser() antlr.Parser { return s.parser }
|
func (s *FieldContext) GetParser() antlr.Parser { return s.parser }
|
||||||
|
|
||||||
func (s *FieldContext) NormalField() INormalFieldContext {
|
func (s *FieldContext) NormalField() INormalFieldContext {
|
||||||
var t = s.GetTypedRuleContext(reflect.TypeOf((*INormalFieldContext)(nil)).Elem(), 0)
|
t := s.GetTypedRuleContext(reflect.TypeOf((*INormalFieldContext)(nil)).Elem(), 0)
|
||||||
|
|
||||||
if t == nil {
|
if t == nil {
|
||||||
return nil
|
return nil
|
||||||
@@ -379,7 +376,7 @@ func (s *FieldContext) NormalField() INormalFieldContext {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (s *FieldContext) AnonymousFiled() IAnonymousFiledContext {
|
func (s *FieldContext) AnonymousFiled() IAnonymousFiledContext {
|
||||||
var t = s.GetTypedRuleContext(reflect.TypeOf((*IAnonymousFiledContext)(nil)).Elem(), 0)
|
t := s.GetTypedRuleContext(reflect.TypeOf((*IAnonymousFiledContext)(nil)).Elem(), 0)
|
||||||
|
|
||||||
if t == nil {
|
if t == nil {
|
||||||
return nil
|
return nil
|
||||||
@@ -484,7 +481,7 @@ type NormalFieldContext struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func NewEmptyNormalFieldContext() *NormalFieldContext {
|
func NewEmptyNormalFieldContext() *NormalFieldContext {
|
||||||
var p = new(NormalFieldContext)
|
p := new(NormalFieldContext)
|
||||||
p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1)
|
p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1)
|
||||||
p.RuleIndex = ApiParserParserRULE_normalField
|
p.RuleIndex = ApiParserParserRULE_normalField
|
||||||
return p
|
return p
|
||||||
@@ -493,7 +490,7 @@ func NewEmptyNormalFieldContext() *NormalFieldContext {
|
|||||||
func (*NormalFieldContext) IsNormalFieldContext() {}
|
func (*NormalFieldContext) IsNormalFieldContext() {}
|
||||||
|
|
||||||
func NewNormalFieldContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *NormalFieldContext {
|
func NewNormalFieldContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *NormalFieldContext {
|
||||||
var p = new(NormalFieldContext)
|
p := new(NormalFieldContext)
|
||||||
|
|
||||||
p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState)
|
p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState)
|
||||||
|
|
||||||
@@ -514,7 +511,7 @@ func (s *NormalFieldContext) SetFieldName(v antlr.Token) { s.fieldName = v }
|
|||||||
func (s *NormalFieldContext) SetTag(v antlr.Token) { s.tag = v }
|
func (s *NormalFieldContext) SetTag(v antlr.Token) { s.tag = v }
|
||||||
|
|
||||||
func (s *NormalFieldContext) DataType() IDataTypeContext {
|
func (s *NormalFieldContext) DataType() IDataTypeContext {
|
||||||
var t = s.GetTypedRuleContext(reflect.TypeOf((*IDataTypeContext)(nil)).Elem(), 0)
|
t := s.GetTypedRuleContext(reflect.TypeOf((*IDataTypeContext)(nil)).Elem(), 0)
|
||||||
|
|
||||||
if t == nil {
|
if t == nil {
|
||||||
return nil
|
return nil
|
||||||
@@ -574,7 +571,7 @@ func (p *ApiParserParser) NormalField() (localctx INormalFieldContext) {
|
|||||||
{
|
{
|
||||||
p.SetState(201)
|
p.SetState(201)
|
||||||
|
|
||||||
var _m = p.Match(ApiParserParserID)
|
_m := p.Match(ApiParserParserID)
|
||||||
|
|
||||||
localctx.(*NormalFieldContext).fieldName = _m
|
localctx.(*NormalFieldContext).fieldName = _m
|
||||||
}
|
}
|
||||||
@@ -589,11 +586,10 @@ func (p *ApiParserParser) NormalField() (localctx INormalFieldContext) {
|
|||||||
{
|
{
|
||||||
p.SetState(203)
|
p.SetState(203)
|
||||||
|
|
||||||
var _m = p.Match(ApiParserParserRAW_STRING)
|
_m := p.Match(ApiParserParserRAW_STRING)
|
||||||
|
|
||||||
localctx.(*NormalFieldContext).tag = _m
|
localctx.(*NormalFieldContext).tag = _m
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return localctx
|
return localctx
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ type AnonymousFiledContext struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func NewEmptyAnonymousFiledContext() *AnonymousFiledContext {
|
func NewEmptyAnonymousFiledContext() *AnonymousFiledContext {
|
||||||
var p = new(AnonymousFiledContext)
|
p := new(AnonymousFiledContext)
|
||||||
p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1)
|
p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1)
|
||||||
p.RuleIndex = ApiParserParserRULE_anonymousFiled
|
p.RuleIndex = ApiParserParserRULE_anonymousFiled
|
||||||
return p
|
return p
|
||||||
@@ -26,7 +26,7 @@ func NewEmptyAnonymousFiledContext() *AnonymousFiledContext {
|
|||||||
func (*AnonymousFiledContext) IsAnonymousFiledContext() {}
|
func (*AnonymousFiledContext) IsAnonymousFiledContext() {}
|
||||||
|
|
||||||
func NewAnonymousFiledContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *AnonymousFiledContext {
|
func NewAnonymousFiledContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *AnonymousFiledContext {
|
||||||
var p = new(AnonymousFiledContext)
|
p := new(AnonymousFiledContext)
|
||||||
|
|
||||||
p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState)
|
p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState)
|
||||||
|
|
||||||
@@ -94,11 +94,10 @@ func (p *ApiParserParser) AnonymousFiled() (localctx IAnonymousFiledContext) {
|
|||||||
{
|
{
|
||||||
p.SetState(206)
|
p.SetState(206)
|
||||||
|
|
||||||
var _m = p.Match(ApiParserParserT__5)
|
_m := p.Match(ApiParserParserT__5)
|
||||||
|
|
||||||
localctx.(*AnonymousFiledContext).star = _m
|
localctx.(*AnonymousFiledContext).star = _m
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
p.SetState(209)
|
p.SetState(209)
|
||||||
@@ -139,7 +138,7 @@ type DataTypeContext struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func NewEmptyDataTypeContext() *DataTypeContext {
|
func NewEmptyDataTypeContext() *DataTypeContext {
|
||||||
var p = new(DataTypeContext)
|
p := new(DataTypeContext)
|
||||||
p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1)
|
p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1)
|
||||||
p.RuleIndex = ApiParserParserRULE_dataType
|
p.RuleIndex = ApiParserParserRULE_dataType
|
||||||
return p
|
return p
|
||||||
@@ -148,7 +147,7 @@ func NewEmptyDataTypeContext() *DataTypeContext {
|
|||||||
func (*DataTypeContext) IsDataTypeContext() {}
|
func (*DataTypeContext) IsDataTypeContext() {}
|
||||||
|
|
||||||
func NewDataTypeContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *DataTypeContext {
|
func NewDataTypeContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *DataTypeContext {
|
||||||
var p = new(DataTypeContext)
|
p := new(DataTypeContext)
|
||||||
|
|
||||||
p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState)
|
p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState)
|
||||||
|
|
||||||
@@ -173,7 +172,7 @@ func (s *DataTypeContext) ID() antlr.TerminalNode {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (s *DataTypeContext) MapType() IMapTypeContext {
|
func (s *DataTypeContext) MapType() IMapTypeContext {
|
||||||
var t = s.GetTypedRuleContext(reflect.TypeOf((*IMapTypeContext)(nil)).Elem(), 0)
|
t := s.GetTypedRuleContext(reflect.TypeOf((*IMapTypeContext)(nil)).Elem(), 0)
|
||||||
|
|
||||||
if t == nil {
|
if t == nil {
|
||||||
return nil
|
return nil
|
||||||
@@ -183,7 +182,7 @@ func (s *DataTypeContext) MapType() IMapTypeContext {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (s *DataTypeContext) ArrayType() IArrayTypeContext {
|
func (s *DataTypeContext) ArrayType() IArrayTypeContext {
|
||||||
var t = s.GetTypedRuleContext(reflect.TypeOf((*IArrayTypeContext)(nil)).Elem(), 0)
|
t := s.GetTypedRuleContext(reflect.TypeOf((*IArrayTypeContext)(nil)).Elem(), 0)
|
||||||
|
|
||||||
if t == nil {
|
if t == nil {
|
||||||
return nil
|
return nil
|
||||||
@@ -197,7 +196,7 @@ func (s *DataTypeContext) INTERFACE() antlr.TerminalNode {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (s *DataTypeContext) PointerType() IPointerTypeContext {
|
func (s *DataTypeContext) PointerType() IPointerTypeContext {
|
||||||
var t = s.GetTypedRuleContext(reflect.TypeOf((*IPointerTypeContext)(nil)).Elem(), 0)
|
t := s.GetTypedRuleContext(reflect.TypeOf((*IPointerTypeContext)(nil)).Elem(), 0)
|
||||||
|
|
||||||
if t == nil {
|
if t == nil {
|
||||||
return nil
|
return nil
|
||||||
@@ -207,7 +206,7 @@ func (s *DataTypeContext) PointerType() IPointerTypeContext {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (s *DataTypeContext) TypeStruct() ITypeStructContext {
|
func (s *DataTypeContext) TypeStruct() ITypeStructContext {
|
||||||
var t = s.GetTypedRuleContext(reflect.TypeOf((*ITypeStructContext)(nil)).Elem(), 0)
|
t := s.GetTypedRuleContext(reflect.TypeOf((*ITypeStructContext)(nil)).Elem(), 0)
|
||||||
|
|
||||||
if t == nil {
|
if t == nil {
|
||||||
return nil
|
return nil
|
||||||
@@ -284,7 +283,7 @@ func (p *ApiParserParser) DataType() (localctx IDataTypeContext) {
|
|||||||
{
|
{
|
||||||
p.SetState(215)
|
p.SetState(215)
|
||||||
|
|
||||||
var _m = p.Match(ApiParserParserINTERFACE)
|
_m := p.Match(ApiParserParserINTERFACE)
|
||||||
|
|
||||||
localctx.(*DataTypeContext).inter = _m
|
localctx.(*DataTypeContext).inter = _m
|
||||||
}
|
}
|
||||||
@@ -294,7 +293,7 @@ func (p *ApiParserParser) DataType() (localctx IDataTypeContext) {
|
|||||||
{
|
{
|
||||||
p.SetState(216)
|
p.SetState(216)
|
||||||
|
|
||||||
var _m = p.Match(ApiParserParserT__6)
|
_m := p.Match(ApiParserParserT__6)
|
||||||
|
|
||||||
localctx.(*DataTypeContext).time = _m
|
localctx.(*DataTypeContext).time = _m
|
||||||
}
|
}
|
||||||
@@ -342,7 +341,7 @@ type PointerTypeContext struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func NewEmptyPointerTypeContext() *PointerTypeContext {
|
func NewEmptyPointerTypeContext() *PointerTypeContext {
|
||||||
var p = new(PointerTypeContext)
|
p := new(PointerTypeContext)
|
||||||
p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1)
|
p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1)
|
||||||
p.RuleIndex = ApiParserParserRULE_pointerType
|
p.RuleIndex = ApiParserParserRULE_pointerType
|
||||||
return p
|
return p
|
||||||
@@ -351,7 +350,7 @@ func NewEmptyPointerTypeContext() *PointerTypeContext {
|
|||||||
func (*PointerTypeContext) IsPointerTypeContext() {}
|
func (*PointerTypeContext) IsPointerTypeContext() {}
|
||||||
|
|
||||||
func NewPointerTypeContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *PointerTypeContext {
|
func NewPointerTypeContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *PointerTypeContext {
|
||||||
var p = new(PointerTypeContext)
|
p := new(PointerTypeContext)
|
||||||
|
|
||||||
p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState)
|
p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState)
|
||||||
|
|
||||||
@@ -413,7 +412,7 @@ func (p *ApiParserParser) PointerType() (localctx IPointerTypeContext) {
|
|||||||
{
|
{
|
||||||
p.SetState(221)
|
p.SetState(221)
|
||||||
|
|
||||||
var _m = p.Match(ApiParserParserT__5)
|
_m := p.Match(ApiParserParserT__5)
|
||||||
|
|
||||||
localctx.(*PointerTypeContext).star = _m
|
localctx.(*PointerTypeContext).star = _m
|
||||||
}
|
}
|
||||||
@@ -478,7 +477,7 @@ type MapTypeContext struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func NewEmptyMapTypeContext() *MapTypeContext {
|
func NewEmptyMapTypeContext() *MapTypeContext {
|
||||||
var p = new(MapTypeContext)
|
p := new(MapTypeContext)
|
||||||
p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1)
|
p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1)
|
||||||
p.RuleIndex = ApiParserParserRULE_mapType
|
p.RuleIndex = ApiParserParserRULE_mapType
|
||||||
return p
|
return p
|
||||||
@@ -487,7 +486,7 @@ func NewEmptyMapTypeContext() *MapTypeContext {
|
|||||||
func (*MapTypeContext) IsMapTypeContext() {}
|
func (*MapTypeContext) IsMapTypeContext() {}
|
||||||
|
|
||||||
func NewMapTypeContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *MapTypeContext {
|
func NewMapTypeContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *MapTypeContext {
|
||||||
var p = new(MapTypeContext)
|
p := new(MapTypeContext)
|
||||||
|
|
||||||
p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState)
|
p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState)
|
||||||
|
|
||||||
@@ -528,7 +527,7 @@ func (s *MapTypeContext) ID(i int) antlr.TerminalNode {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (s *MapTypeContext) DataType() IDataTypeContext {
|
func (s *MapTypeContext) DataType() IDataTypeContext {
|
||||||
var t = s.GetTypedRuleContext(reflect.TypeOf((*IDataTypeContext)(nil)).Elem(), 0)
|
t := s.GetTypedRuleContext(reflect.TypeOf((*IDataTypeContext)(nil)).Elem(), 0)
|
||||||
|
|
||||||
if t == nil {
|
if t == nil {
|
||||||
return nil
|
return nil
|
||||||
@@ -580,14 +579,14 @@ func (p *ApiParserParser) MapType() (localctx IMapTypeContext) {
|
|||||||
{
|
{
|
||||||
p.SetState(226)
|
p.SetState(226)
|
||||||
|
|
||||||
var _m = p.Match(ApiParserParserID)
|
_m := p.Match(ApiParserParserID)
|
||||||
|
|
||||||
localctx.(*MapTypeContext).mapToken = _m
|
localctx.(*MapTypeContext).mapToken = _m
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
p.SetState(227)
|
p.SetState(227)
|
||||||
|
|
||||||
var _m = p.Match(ApiParserParserT__7)
|
_m := p.Match(ApiParserParserT__7)
|
||||||
|
|
||||||
localctx.(*MapTypeContext).lbrack = _m
|
localctx.(*MapTypeContext).lbrack = _m
|
||||||
}
|
}
|
||||||
@@ -595,21 +594,21 @@ func (p *ApiParserParser) MapType() (localctx IMapTypeContext) {
|
|||||||
{
|
{
|
||||||
p.SetState(229)
|
p.SetState(229)
|
||||||
|
|
||||||
var _m = p.Match(ApiParserParserID)
|
_m := p.Match(ApiParserParserID)
|
||||||
|
|
||||||
localctx.(*MapTypeContext).key = _m
|
localctx.(*MapTypeContext).key = _m
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
p.SetState(230)
|
p.SetState(230)
|
||||||
|
|
||||||
var _m = p.Match(ApiParserParserT__8)
|
_m := p.Match(ApiParserParserT__8)
|
||||||
|
|
||||||
localctx.(*MapTypeContext).rbrack = _m
|
localctx.(*MapTypeContext).rbrack = _m
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
p.SetState(231)
|
p.SetState(231)
|
||||||
|
|
||||||
var _x = p.DataType()
|
_x := p.DataType()
|
||||||
|
|
||||||
localctx.(*MapTypeContext).value = _x
|
localctx.(*MapTypeContext).value = _x
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ type ArrayTypeContext struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func NewEmptyArrayTypeContext() *ArrayTypeContext {
|
func NewEmptyArrayTypeContext() *ArrayTypeContext {
|
||||||
var p = new(ArrayTypeContext)
|
p := new(ArrayTypeContext)
|
||||||
p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1)
|
p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1)
|
||||||
p.RuleIndex = ApiParserParserRULE_arrayType
|
p.RuleIndex = ApiParserParserRULE_arrayType
|
||||||
return p
|
return p
|
||||||
@@ -50,7 +50,7 @@ func NewEmptyArrayTypeContext() *ArrayTypeContext {
|
|||||||
func (*ArrayTypeContext) IsArrayTypeContext() {}
|
func (*ArrayTypeContext) IsArrayTypeContext() {}
|
||||||
|
|
||||||
func NewArrayTypeContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *ArrayTypeContext {
|
func NewArrayTypeContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *ArrayTypeContext {
|
||||||
var p = new(ArrayTypeContext)
|
p := new(ArrayTypeContext)
|
||||||
|
|
||||||
p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState)
|
p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState)
|
||||||
|
|
||||||
@@ -71,7 +71,7 @@ func (s *ArrayTypeContext) SetLbrack(v antlr.Token) { s.lbrack = v }
|
|||||||
func (s *ArrayTypeContext) SetRbrack(v antlr.Token) { s.rbrack = v }
|
func (s *ArrayTypeContext) SetRbrack(v antlr.Token) { s.rbrack = v }
|
||||||
|
|
||||||
func (s *ArrayTypeContext) DataType() IDataTypeContext {
|
func (s *ArrayTypeContext) DataType() IDataTypeContext {
|
||||||
var t = s.GetTypedRuleContext(reflect.TypeOf((*IDataTypeContext)(nil)).Elem(), 0)
|
t := s.GetTypedRuleContext(reflect.TypeOf((*IDataTypeContext)(nil)).Elem(), 0)
|
||||||
|
|
||||||
if t == nil {
|
if t == nil {
|
||||||
return nil
|
return nil
|
||||||
@@ -122,14 +122,14 @@ func (p *ApiParserParser) ArrayType() (localctx IArrayTypeContext) {
|
|||||||
{
|
{
|
||||||
p.SetState(233)
|
p.SetState(233)
|
||||||
|
|
||||||
var _m = p.Match(ApiParserParserT__7)
|
_m := p.Match(ApiParserParserT__7)
|
||||||
|
|
||||||
localctx.(*ArrayTypeContext).lbrack = _m
|
localctx.(*ArrayTypeContext).lbrack = _m
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
p.SetState(234)
|
p.SetState(234)
|
||||||
|
|
||||||
var _m = p.Match(ApiParserParserT__8)
|
_m := p.Match(ApiParserParserT__8)
|
||||||
|
|
||||||
localctx.(*ArrayTypeContext).rbrack = _m
|
localctx.(*ArrayTypeContext).rbrack = _m
|
||||||
}
|
}
|
||||||
@@ -158,7 +158,7 @@ type ServiceSpecContext struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func NewEmptyServiceSpecContext() *ServiceSpecContext {
|
func NewEmptyServiceSpecContext() *ServiceSpecContext {
|
||||||
var p = new(ServiceSpecContext)
|
p := new(ServiceSpecContext)
|
||||||
p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1)
|
p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1)
|
||||||
p.RuleIndex = ApiParserParserRULE_serviceSpec
|
p.RuleIndex = ApiParserParserRULE_serviceSpec
|
||||||
return p
|
return p
|
||||||
@@ -167,7 +167,7 @@ func NewEmptyServiceSpecContext() *ServiceSpecContext {
|
|||||||
func (*ServiceSpecContext) IsServiceSpecContext() {}
|
func (*ServiceSpecContext) IsServiceSpecContext() {}
|
||||||
|
|
||||||
func NewServiceSpecContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *ServiceSpecContext {
|
func NewServiceSpecContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *ServiceSpecContext {
|
||||||
var p = new(ServiceSpecContext)
|
p := new(ServiceSpecContext)
|
||||||
|
|
||||||
p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState)
|
p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState)
|
||||||
|
|
||||||
@@ -180,7 +180,7 @@ func NewServiceSpecContext(parser antlr.Parser, parent antlr.ParserRuleContext,
|
|||||||
func (s *ServiceSpecContext) GetParser() antlr.Parser { return s.parser }
|
func (s *ServiceSpecContext) GetParser() antlr.Parser { return s.parser }
|
||||||
|
|
||||||
func (s *ServiceSpecContext) ServiceApi() IServiceApiContext {
|
func (s *ServiceSpecContext) ServiceApi() IServiceApiContext {
|
||||||
var t = s.GetTypedRuleContext(reflect.TypeOf((*IServiceApiContext)(nil)).Elem(), 0)
|
t := s.GetTypedRuleContext(reflect.TypeOf((*IServiceApiContext)(nil)).Elem(), 0)
|
||||||
|
|
||||||
if t == nil {
|
if t == nil {
|
||||||
return nil
|
return nil
|
||||||
@@ -190,7 +190,7 @@ func (s *ServiceSpecContext) ServiceApi() IServiceApiContext {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (s *ServiceSpecContext) AtServer() IAtServerContext {
|
func (s *ServiceSpecContext) AtServer() IAtServerContext {
|
||||||
var t = s.GetTypedRuleContext(reflect.TypeOf((*IAtServerContext)(nil)).Elem(), 0)
|
t := s.GetTypedRuleContext(reflect.TypeOf((*IAtServerContext)(nil)).Elem(), 0)
|
||||||
|
|
||||||
if t == nil {
|
if t == nil {
|
||||||
return nil
|
return nil
|
||||||
@@ -248,7 +248,6 @@ func (p *ApiParserParser) ServiceSpec() (localctx IServiceSpecContext) {
|
|||||||
p.SetState(237)
|
p.SetState(237)
|
||||||
p.AtServer()
|
p.AtServer()
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
p.SetState(240)
|
p.SetState(240)
|
||||||
@@ -289,7 +288,7 @@ type AtServerContext struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func NewEmptyAtServerContext() *AtServerContext {
|
func NewEmptyAtServerContext() *AtServerContext {
|
||||||
var p = new(AtServerContext)
|
p := new(AtServerContext)
|
||||||
p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1)
|
p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1)
|
||||||
p.RuleIndex = ApiParserParserRULE_atServer
|
p.RuleIndex = ApiParserParserRULE_atServer
|
||||||
return p
|
return p
|
||||||
@@ -298,7 +297,7 @@ func NewEmptyAtServerContext() *AtServerContext {
|
|||||||
func (*AtServerContext) IsAtServerContext() {}
|
func (*AtServerContext) IsAtServerContext() {}
|
||||||
|
|
||||||
func NewAtServerContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *AtServerContext {
|
func NewAtServerContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *AtServerContext {
|
||||||
var p = new(AtServerContext)
|
p := new(AtServerContext)
|
||||||
|
|
||||||
p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState)
|
p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState)
|
||||||
|
|
||||||
@@ -323,8 +322,8 @@ func (s *AtServerContext) ATSERVER() antlr.TerminalNode {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (s *AtServerContext) AllKvLit() []IKvLitContext {
|
func (s *AtServerContext) AllKvLit() []IKvLitContext {
|
||||||
var ts = s.GetTypedRuleContexts(reflect.TypeOf((*IKvLitContext)(nil)).Elem())
|
ts := s.GetTypedRuleContexts(reflect.TypeOf((*IKvLitContext)(nil)).Elem())
|
||||||
var tst = make([]IKvLitContext, len(ts))
|
tst := make([]IKvLitContext, len(ts))
|
||||||
|
|
||||||
for i, t := range ts {
|
for i, t := range ts {
|
||||||
if t != nil {
|
if t != nil {
|
||||||
@@ -336,7 +335,7 @@ func (s *AtServerContext) AllKvLit() []IKvLitContext {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (s *AtServerContext) KvLit(i int) IKvLitContext {
|
func (s *AtServerContext) KvLit(i int) IKvLitContext {
|
||||||
var t = s.GetTypedRuleContext(reflect.TypeOf((*IKvLitContext)(nil)).Elem(), i)
|
t := s.GetTypedRuleContext(reflect.TypeOf((*IKvLitContext)(nil)).Elem(), i)
|
||||||
|
|
||||||
if t == nil {
|
if t == nil {
|
||||||
return nil
|
return nil
|
||||||
@@ -392,7 +391,7 @@ func (p *ApiParserParser) AtServer() (localctx IAtServerContext) {
|
|||||||
{
|
{
|
||||||
p.SetState(243)
|
p.SetState(243)
|
||||||
|
|
||||||
var _m = p.Match(ApiParserParserT__1)
|
_m := p.Match(ApiParserParserT__1)
|
||||||
|
|
||||||
localctx.(*AtServerContext).lp = _m
|
localctx.(*AtServerContext).lp = _m
|
||||||
}
|
}
|
||||||
@@ -412,7 +411,7 @@ func (p *ApiParserParser) AtServer() (localctx IAtServerContext) {
|
|||||||
{
|
{
|
||||||
p.SetState(249)
|
p.SetState(249)
|
||||||
|
|
||||||
var _m = p.Match(ApiParserParserT__2)
|
_m := p.Match(ApiParserParserT__2)
|
||||||
|
|
||||||
localctx.(*AtServerContext).rp = _m
|
localctx.(*AtServerContext).rp = _m
|
||||||
}
|
}
|
||||||
@@ -458,7 +457,7 @@ type ServiceApiContext struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func NewEmptyServiceApiContext() *ServiceApiContext {
|
func NewEmptyServiceApiContext() *ServiceApiContext {
|
||||||
var p = new(ServiceApiContext)
|
p := new(ServiceApiContext)
|
||||||
p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1)
|
p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1)
|
||||||
p.RuleIndex = ApiParserParserRULE_serviceApi
|
p.RuleIndex = ApiParserParserRULE_serviceApi
|
||||||
return p
|
return p
|
||||||
@@ -467,7 +466,7 @@ func NewEmptyServiceApiContext() *ServiceApiContext {
|
|||||||
func (*ServiceApiContext) IsServiceApiContext() {}
|
func (*ServiceApiContext) IsServiceApiContext() {}
|
||||||
|
|
||||||
func NewServiceApiContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *ServiceApiContext {
|
func NewServiceApiContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *ServiceApiContext {
|
||||||
var p = new(ServiceApiContext)
|
p := new(ServiceApiContext)
|
||||||
|
|
||||||
p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState)
|
p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState)
|
||||||
|
|
||||||
@@ -492,7 +491,7 @@ func (s *ServiceApiContext) SetLbrace(v antlr.Token) { s.lbrace = v }
|
|||||||
func (s *ServiceApiContext) SetRbrace(v antlr.Token) { s.rbrace = v }
|
func (s *ServiceApiContext) SetRbrace(v antlr.Token) { s.rbrace = v }
|
||||||
|
|
||||||
func (s *ServiceApiContext) ServiceName() IServiceNameContext {
|
func (s *ServiceApiContext) ServiceName() IServiceNameContext {
|
||||||
var t = s.GetTypedRuleContext(reflect.TypeOf((*IServiceNameContext)(nil)).Elem(), 0)
|
t := s.GetTypedRuleContext(reflect.TypeOf((*IServiceNameContext)(nil)).Elem(), 0)
|
||||||
|
|
||||||
if t == nil {
|
if t == nil {
|
||||||
return nil
|
return nil
|
||||||
@@ -506,8 +505,8 @@ func (s *ServiceApiContext) ID() antlr.TerminalNode {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (s *ServiceApiContext) AllServiceRoute() []IServiceRouteContext {
|
func (s *ServiceApiContext) AllServiceRoute() []IServiceRouteContext {
|
||||||
var ts = s.GetTypedRuleContexts(reflect.TypeOf((*IServiceRouteContext)(nil)).Elem())
|
ts := s.GetTypedRuleContexts(reflect.TypeOf((*IServiceRouteContext)(nil)).Elem())
|
||||||
var tst = make([]IServiceRouteContext, len(ts))
|
tst := make([]IServiceRouteContext, len(ts))
|
||||||
|
|
||||||
for i, t := range ts {
|
for i, t := range ts {
|
||||||
if t != nil {
|
if t != nil {
|
||||||
@@ -519,7 +518,7 @@ func (s *ServiceApiContext) AllServiceRoute() []IServiceRouteContext {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (s *ServiceApiContext) ServiceRoute(i int) IServiceRouteContext {
|
func (s *ServiceApiContext) ServiceRoute(i int) IServiceRouteContext {
|
||||||
var t = s.GetTypedRuleContext(reflect.TypeOf((*IServiceRouteContext)(nil)).Elem(), i)
|
t := s.GetTypedRuleContext(reflect.TypeOf((*IServiceRouteContext)(nil)).Elem(), i)
|
||||||
|
|
||||||
if t == nil {
|
if t == nil {
|
||||||
return nil
|
return nil
|
||||||
@@ -572,7 +571,7 @@ func (p *ApiParserParser) ServiceApi() (localctx IServiceApiContext) {
|
|||||||
{
|
{
|
||||||
p.SetState(252)
|
p.SetState(252)
|
||||||
|
|
||||||
var _m = p.Match(ApiParserParserID)
|
_m := p.Match(ApiParserParserID)
|
||||||
|
|
||||||
localctx.(*ServiceApiContext).serviceToken = _m
|
localctx.(*ServiceApiContext).serviceToken = _m
|
||||||
}
|
}
|
||||||
@@ -583,7 +582,7 @@ func (p *ApiParserParser) ServiceApi() (localctx IServiceApiContext) {
|
|||||||
{
|
{
|
||||||
p.SetState(254)
|
p.SetState(254)
|
||||||
|
|
||||||
var _m = p.Match(ApiParserParserT__3)
|
_m := p.Match(ApiParserParserT__3)
|
||||||
|
|
||||||
localctx.(*ServiceApiContext).lbrace = _m
|
localctx.(*ServiceApiContext).lbrace = _m
|
||||||
}
|
}
|
||||||
@@ -604,7 +603,7 @@ func (p *ApiParserParser) ServiceApi() (localctx IServiceApiContext) {
|
|||||||
{
|
{
|
||||||
p.SetState(261)
|
p.SetState(261)
|
||||||
|
|
||||||
var _m = p.Match(ApiParserParserT__4)
|
_m := p.Match(ApiParserParserT__4)
|
||||||
|
|
||||||
localctx.(*ServiceApiContext).rbrace = _m
|
localctx.(*ServiceApiContext).rbrace = _m
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ type ServiceRouteContext struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func NewEmptyServiceRouteContext() *ServiceRouteContext {
|
func NewEmptyServiceRouteContext() *ServiceRouteContext {
|
||||||
var p = new(ServiceRouteContext)
|
p := new(ServiceRouteContext)
|
||||||
p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1)
|
p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1)
|
||||||
p.RuleIndex = ApiParserParserRULE_serviceRoute
|
p.RuleIndex = ApiParserParserRULE_serviceRoute
|
||||||
return p
|
return p
|
||||||
@@ -36,7 +36,7 @@ func NewEmptyServiceRouteContext() *ServiceRouteContext {
|
|||||||
func (*ServiceRouteContext) IsServiceRouteContext() {}
|
func (*ServiceRouteContext) IsServiceRouteContext() {}
|
||||||
|
|
||||||
func NewServiceRouteContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *ServiceRouteContext {
|
func NewServiceRouteContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *ServiceRouteContext {
|
||||||
var p = new(ServiceRouteContext)
|
p := new(ServiceRouteContext)
|
||||||
|
|
||||||
p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState)
|
p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState)
|
||||||
|
|
||||||
@@ -49,7 +49,7 @@ func NewServiceRouteContext(parser antlr.Parser, parent antlr.ParserRuleContext,
|
|||||||
func (s *ServiceRouteContext) GetParser() antlr.Parser { return s.parser }
|
func (s *ServiceRouteContext) GetParser() antlr.Parser { return s.parser }
|
||||||
|
|
||||||
func (s *ServiceRouteContext) Route() IRouteContext {
|
func (s *ServiceRouteContext) Route() IRouteContext {
|
||||||
var t = s.GetTypedRuleContext(reflect.TypeOf((*IRouteContext)(nil)).Elem(), 0)
|
t := s.GetTypedRuleContext(reflect.TypeOf((*IRouteContext)(nil)).Elem(), 0)
|
||||||
|
|
||||||
if t == nil {
|
if t == nil {
|
||||||
return nil
|
return nil
|
||||||
@@ -59,7 +59,7 @@ func (s *ServiceRouteContext) Route() IRouteContext {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (s *ServiceRouteContext) AtServer() IAtServerContext {
|
func (s *ServiceRouteContext) AtServer() IAtServerContext {
|
||||||
var t = s.GetTypedRuleContext(reflect.TypeOf((*IAtServerContext)(nil)).Elem(), 0)
|
t := s.GetTypedRuleContext(reflect.TypeOf((*IAtServerContext)(nil)).Elem(), 0)
|
||||||
|
|
||||||
if t == nil {
|
if t == nil {
|
||||||
return nil
|
return nil
|
||||||
@@ -69,7 +69,7 @@ func (s *ServiceRouteContext) AtServer() IAtServerContext {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (s *ServiceRouteContext) AtHandler() IAtHandlerContext {
|
func (s *ServiceRouteContext) AtHandler() IAtHandlerContext {
|
||||||
var t = s.GetTypedRuleContext(reflect.TypeOf((*IAtHandlerContext)(nil)).Elem(), 0)
|
t := s.GetTypedRuleContext(reflect.TypeOf((*IAtHandlerContext)(nil)).Elem(), 0)
|
||||||
|
|
||||||
if t == nil {
|
if t == nil {
|
||||||
return nil
|
return nil
|
||||||
@@ -79,7 +79,7 @@ func (s *ServiceRouteContext) AtHandler() IAtHandlerContext {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (s *ServiceRouteContext) AtDoc() IAtDocContext {
|
func (s *ServiceRouteContext) AtDoc() IAtDocContext {
|
||||||
var t = s.GetTypedRuleContext(reflect.TypeOf((*IAtDocContext)(nil)).Elem(), 0)
|
t := s.GetTypedRuleContext(reflect.TypeOf((*IAtDocContext)(nil)).Elem(), 0)
|
||||||
|
|
||||||
if t == nil {
|
if t == nil {
|
||||||
return nil
|
return nil
|
||||||
@@ -137,7 +137,6 @@ func (p *ApiParserParser) ServiceRoute() (localctx IServiceRouteContext) {
|
|||||||
p.SetState(263)
|
p.SetState(263)
|
||||||
p.AtDoc()
|
p.AtDoc()
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
p.SetState(268)
|
p.SetState(268)
|
||||||
p.GetErrorHandler().Sync(p)
|
p.GetErrorHandler().Sync(p)
|
||||||
@@ -197,7 +196,7 @@ type AtDocContext struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func NewEmptyAtDocContext() *AtDocContext {
|
func NewEmptyAtDocContext() *AtDocContext {
|
||||||
var p = new(AtDocContext)
|
p := new(AtDocContext)
|
||||||
p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1)
|
p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1)
|
||||||
p.RuleIndex = ApiParserParserRULE_atDoc
|
p.RuleIndex = ApiParserParserRULE_atDoc
|
||||||
return p
|
return p
|
||||||
@@ -206,7 +205,7 @@ func NewEmptyAtDocContext() *AtDocContext {
|
|||||||
func (*AtDocContext) IsAtDocContext() {}
|
func (*AtDocContext) IsAtDocContext() {}
|
||||||
|
|
||||||
func NewAtDocContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *AtDocContext {
|
func NewAtDocContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *AtDocContext {
|
||||||
var p = new(AtDocContext)
|
p := new(AtDocContext)
|
||||||
|
|
||||||
p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState)
|
p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState)
|
||||||
|
|
||||||
@@ -235,8 +234,8 @@ func (s *AtDocContext) STRING() antlr.TerminalNode {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (s *AtDocContext) AllKvLit() []IKvLitContext {
|
func (s *AtDocContext) AllKvLit() []IKvLitContext {
|
||||||
var ts = s.GetTypedRuleContexts(reflect.TypeOf((*IKvLitContext)(nil)).Elem())
|
ts := s.GetTypedRuleContexts(reflect.TypeOf((*IKvLitContext)(nil)).Elem())
|
||||||
var tst = make([]IKvLitContext, len(ts))
|
tst := make([]IKvLitContext, len(ts))
|
||||||
|
|
||||||
for i, t := range ts {
|
for i, t := range ts {
|
||||||
if t != nil {
|
if t != nil {
|
||||||
@@ -248,7 +247,7 @@ func (s *AtDocContext) AllKvLit() []IKvLitContext {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (s *AtDocContext) KvLit(i int) IKvLitContext {
|
func (s *AtDocContext) KvLit(i int) IKvLitContext {
|
||||||
var t = s.GetTypedRuleContext(reflect.TypeOf((*IKvLitContext)(nil)).Elem(), i)
|
t := s.GetTypedRuleContext(reflect.TypeOf((*IKvLitContext)(nil)).Elem(), i)
|
||||||
|
|
||||||
if t == nil {
|
if t == nil {
|
||||||
return nil
|
return nil
|
||||||
@@ -309,11 +308,10 @@ func (p *ApiParserParser) AtDoc() (localctx IAtDocContext) {
|
|||||||
{
|
{
|
||||||
p.SetState(273)
|
p.SetState(273)
|
||||||
|
|
||||||
var _m = p.Match(ApiParserParserT__1)
|
_m := p.Match(ApiParserParserT__1)
|
||||||
|
|
||||||
localctx.(*AtDocContext).lp = _m
|
localctx.(*AtDocContext).lp = _m
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
p.SetState(282)
|
p.SetState(282)
|
||||||
p.GetErrorHandler().Sync(p)
|
p.GetErrorHandler().Sync(p)
|
||||||
@@ -351,11 +349,10 @@ func (p *ApiParserParser) AtDoc() (localctx IAtDocContext) {
|
|||||||
{
|
{
|
||||||
p.SetState(284)
|
p.SetState(284)
|
||||||
|
|
||||||
var _m = p.Match(ApiParserParserT__2)
|
_m := p.Match(ApiParserParserT__2)
|
||||||
|
|
||||||
localctx.(*AtDocContext).rp = _m
|
localctx.(*AtDocContext).rp = _m
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return localctx
|
return localctx
|
||||||
@@ -378,7 +375,7 @@ type AtHandlerContext struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func NewEmptyAtHandlerContext() *AtHandlerContext {
|
func NewEmptyAtHandlerContext() *AtHandlerContext {
|
||||||
var p = new(AtHandlerContext)
|
p := new(AtHandlerContext)
|
||||||
p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1)
|
p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1)
|
||||||
p.RuleIndex = ApiParserParserRULE_atHandler
|
p.RuleIndex = ApiParserParserRULE_atHandler
|
||||||
return p
|
return p
|
||||||
@@ -387,7 +384,7 @@ func NewEmptyAtHandlerContext() *AtHandlerContext {
|
|||||||
func (*AtHandlerContext) IsAtHandlerContext() {}
|
func (*AtHandlerContext) IsAtHandlerContext() {}
|
||||||
|
|
||||||
func NewAtHandlerContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *AtHandlerContext {
|
func NewAtHandlerContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *AtHandlerContext {
|
||||||
var p = new(AtHandlerContext)
|
p := new(AtHandlerContext)
|
||||||
|
|
||||||
p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState)
|
p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState)
|
||||||
|
|
||||||
@@ -468,15 +465,9 @@ type IRouteContext interface {
|
|||||||
// GetHttpMethod returns the httpMethod token.
|
// GetHttpMethod returns the httpMethod token.
|
||||||
GetHttpMethod() antlr.Token
|
GetHttpMethod() antlr.Token
|
||||||
|
|
||||||
// GetReturnToken returns the returnToken token.
|
|
||||||
GetReturnToken() antlr.Token
|
|
||||||
|
|
||||||
// SetHttpMethod sets the httpMethod token.
|
// SetHttpMethod sets the httpMethod token.
|
||||||
SetHttpMethod(antlr.Token)
|
SetHttpMethod(antlr.Token)
|
||||||
|
|
||||||
// SetReturnToken sets the returnToken token.
|
|
||||||
SetReturnToken(antlr.Token)
|
|
||||||
|
|
||||||
// GetRequest returns the request rule contexts.
|
// GetRequest returns the request rule contexts.
|
||||||
GetRequest() IBodyContext
|
GetRequest() IBodyContext
|
||||||
|
|
||||||
@@ -495,15 +486,14 @@ type IRouteContext interface {
|
|||||||
|
|
||||||
type RouteContext struct {
|
type RouteContext struct {
|
||||||
*antlr.BaseParserRuleContext
|
*antlr.BaseParserRuleContext
|
||||||
parser antlr.Parser
|
parser antlr.Parser
|
||||||
httpMethod antlr.Token
|
httpMethod antlr.Token
|
||||||
request IBodyContext
|
request IBodyContext
|
||||||
returnToken antlr.Token
|
response IReplybodyContext
|
||||||
response IReplybodyContext
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewEmptyRouteContext() *RouteContext {
|
func NewEmptyRouteContext() *RouteContext {
|
||||||
var p = new(RouteContext)
|
p := new(RouteContext)
|
||||||
p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1)
|
p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1)
|
||||||
p.RuleIndex = ApiParserParserRULE_route
|
p.RuleIndex = ApiParserParserRULE_route
|
||||||
return p
|
return p
|
||||||
@@ -512,7 +502,7 @@ func NewEmptyRouteContext() *RouteContext {
|
|||||||
func (*RouteContext) IsRouteContext() {}
|
func (*RouteContext) IsRouteContext() {}
|
||||||
|
|
||||||
func NewRouteContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *RouteContext {
|
func NewRouteContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *RouteContext {
|
||||||
var p = new(RouteContext)
|
p := new(RouteContext)
|
||||||
|
|
||||||
p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState)
|
p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState)
|
||||||
|
|
||||||
@@ -526,12 +516,8 @@ func (s *RouteContext) GetParser() antlr.Parser { return s.parser }
|
|||||||
|
|
||||||
func (s *RouteContext) GetHttpMethod() antlr.Token { return s.httpMethod }
|
func (s *RouteContext) GetHttpMethod() antlr.Token { return s.httpMethod }
|
||||||
|
|
||||||
func (s *RouteContext) GetReturnToken() antlr.Token { return s.returnToken }
|
|
||||||
|
|
||||||
func (s *RouteContext) SetHttpMethod(v antlr.Token) { s.httpMethod = v }
|
func (s *RouteContext) SetHttpMethod(v antlr.Token) { s.httpMethod = v }
|
||||||
|
|
||||||
func (s *RouteContext) SetReturnToken(v antlr.Token) { s.returnToken = v }
|
|
||||||
|
|
||||||
func (s *RouteContext) GetRequest() IBodyContext { return s.request }
|
func (s *RouteContext) GetRequest() IBodyContext { return s.request }
|
||||||
|
|
||||||
func (s *RouteContext) GetResponse() IReplybodyContext { return s.response }
|
func (s *RouteContext) GetResponse() IReplybodyContext { return s.response }
|
||||||
@@ -541,7 +527,7 @@ func (s *RouteContext) SetRequest(v IBodyContext) { s.request = v }
|
|||||||
func (s *RouteContext) SetResponse(v IReplybodyContext) { s.response = v }
|
func (s *RouteContext) SetResponse(v IReplybodyContext) { s.response = v }
|
||||||
|
|
||||||
func (s *RouteContext) Path() IPathContext {
|
func (s *RouteContext) Path() IPathContext {
|
||||||
var t = s.GetTypedRuleContext(reflect.TypeOf((*IPathContext)(nil)).Elem(), 0)
|
t := s.GetTypedRuleContext(reflect.TypeOf((*IPathContext)(nil)).Elem(), 0)
|
||||||
|
|
||||||
if t == nil {
|
if t == nil {
|
||||||
return nil
|
return nil
|
||||||
@@ -550,16 +536,12 @@ func (s *RouteContext) Path() IPathContext {
|
|||||||
return t.(IPathContext)
|
return t.(IPathContext)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *RouteContext) AllID() []antlr.TerminalNode {
|
func (s *RouteContext) ID() antlr.TerminalNode {
|
||||||
return s.GetTokens(ApiParserParserID)
|
return s.GetToken(ApiParserParserID, 0)
|
||||||
}
|
|
||||||
|
|
||||||
func (s *RouteContext) ID(i int) antlr.TerminalNode {
|
|
||||||
return s.GetToken(ApiParserParserID, i)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *RouteContext) Body() IBodyContext {
|
func (s *RouteContext) Body() IBodyContext {
|
||||||
var t = s.GetTypedRuleContext(reflect.TypeOf((*IBodyContext)(nil)).Elem(), 0)
|
t := s.GetTypedRuleContext(reflect.TypeOf((*IBodyContext)(nil)).Elem(), 0)
|
||||||
|
|
||||||
if t == nil {
|
if t == nil {
|
||||||
return nil
|
return nil
|
||||||
@@ -569,7 +551,7 @@ func (s *RouteContext) Body() IBodyContext {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (s *RouteContext) Replybody() IReplybodyContext {
|
func (s *RouteContext) Replybody() IReplybodyContext {
|
||||||
var t = s.GetTypedRuleContext(reflect.TypeOf((*IReplybodyContext)(nil)).Elem(), 0)
|
t := s.GetTypedRuleContext(reflect.TypeOf((*IReplybodyContext)(nil)).Elem(), 0)
|
||||||
|
|
||||||
if t == nil {
|
if t == nil {
|
||||||
return nil
|
return nil
|
||||||
@@ -622,7 +604,7 @@ func (p *ApiParserParser) Route() (localctx IRouteContext) {
|
|||||||
{
|
{
|
||||||
p.SetState(291)
|
p.SetState(291)
|
||||||
|
|
||||||
var _m = p.Match(ApiParserParserID)
|
_m := p.Match(ApiParserParserID)
|
||||||
|
|
||||||
localctx.(*RouteContext).httpMethod = _m
|
localctx.(*RouteContext).httpMethod = _m
|
||||||
}
|
}
|
||||||
@@ -632,44 +614,29 @@ func (p *ApiParserParser) Route() (localctx IRouteContext) {
|
|||||||
}
|
}
|
||||||
p.SetState(294)
|
p.SetState(294)
|
||||||
p.GetErrorHandler().Sync(p)
|
p.GetErrorHandler().Sync(p)
|
||||||
|
_la = p.GetTokenStream().LA(1)
|
||||||
|
|
||||||
if p.GetInterpreter().AdaptivePredict(p.GetTokenStream(), 28, p.GetParserRuleContext()) == 1 {
|
if _la == ApiParserParserT__1 {
|
||||||
{
|
{
|
||||||
p.SetState(293)
|
p.SetState(293)
|
||||||
|
|
||||||
var _x = p.Body()
|
_x := p.Body()
|
||||||
|
|
||||||
localctx.(*RouteContext).request = _x
|
localctx.(*RouteContext).request = _x
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
p.SetState(297)
|
p.SetState(297)
|
||||||
p.GetErrorHandler().Sync(p)
|
p.GetErrorHandler().Sync(p)
|
||||||
_la = p.GetTokenStream().LA(1)
|
_la = p.GetTokenStream().LA(1)
|
||||||
|
|
||||||
if _la == ApiParserParserID {
|
if _la == ApiParserParserT__9 {
|
||||||
{
|
{
|
||||||
p.SetState(296)
|
p.SetState(296)
|
||||||
|
|
||||||
var _m = p.Match(ApiParserParserID)
|
_x := p.Replybody()
|
||||||
|
|
||||||
localctx.(*RouteContext).returnToken = _m
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
p.SetState(300)
|
|
||||||
p.GetErrorHandler().Sync(p)
|
|
||||||
_la = p.GetTokenStream().LA(1)
|
|
||||||
|
|
||||||
if _la == ApiParserParserT__1 {
|
|
||||||
{
|
|
||||||
p.SetState(299)
|
|
||||||
|
|
||||||
var _x = p.Replybody()
|
|
||||||
|
|
||||||
localctx.(*RouteContext).response = _x
|
localctx.(*RouteContext).response = _x
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return localctx
|
return localctx
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ type BodyContext struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func NewEmptyBodyContext() *BodyContext {
|
func NewEmptyBodyContext() *BodyContext {
|
||||||
var p = new(BodyContext)
|
p := new(BodyContext)
|
||||||
p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1)
|
p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1)
|
||||||
p.RuleIndex = ApiParserParserRULE_body
|
p.RuleIndex = ApiParserParserRULE_body
|
||||||
return p
|
return p
|
||||||
@@ -50,7 +50,7 @@ func NewEmptyBodyContext() *BodyContext {
|
|||||||
func (*BodyContext) IsBodyContext() {}
|
func (*BodyContext) IsBodyContext() {}
|
||||||
|
|
||||||
func NewBodyContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *BodyContext {
|
func NewBodyContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *BodyContext {
|
||||||
var p = new(BodyContext)
|
p := new(BodyContext)
|
||||||
|
|
||||||
p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState)
|
p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState)
|
||||||
|
|
||||||
@@ -115,27 +115,26 @@ func (p *ApiParserParser) Body() (localctx IBodyContext) {
|
|||||||
|
|
||||||
p.EnterOuterAlt(localctx, 1)
|
p.EnterOuterAlt(localctx, 1)
|
||||||
{
|
{
|
||||||
p.SetState(302)
|
p.SetState(299)
|
||||||
|
|
||||||
var _m = p.Match(ApiParserParserT__1)
|
_m := p.Match(ApiParserParserT__1)
|
||||||
|
|
||||||
localctx.(*BodyContext).lp = _m
|
localctx.(*BodyContext).lp = _m
|
||||||
}
|
}
|
||||||
p.SetState(304)
|
p.SetState(301)
|
||||||
p.GetErrorHandler().Sync(p)
|
p.GetErrorHandler().Sync(p)
|
||||||
_la = p.GetTokenStream().LA(1)
|
_la = p.GetTokenStream().LA(1)
|
||||||
|
|
||||||
if _la == ApiParserParserID {
|
if _la == ApiParserParserID {
|
||||||
{
|
{
|
||||||
p.SetState(303)
|
p.SetState(300)
|
||||||
p.Match(ApiParserParserID)
|
p.Match(ApiParserParserID)
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
p.SetState(306)
|
p.SetState(303)
|
||||||
|
|
||||||
var _m = p.Match(ApiParserParserT__2)
|
_m := p.Match(ApiParserParserT__2)
|
||||||
|
|
||||||
localctx.(*BodyContext).rp = _m
|
localctx.(*BodyContext).rp = _m
|
||||||
}
|
}
|
||||||
@@ -150,12 +149,18 @@ type IReplybodyContext interface {
|
|||||||
// GetParser returns the parser.
|
// GetParser returns the parser.
|
||||||
GetParser() antlr.Parser
|
GetParser() antlr.Parser
|
||||||
|
|
||||||
|
// GetReturnToken returns the returnToken token.
|
||||||
|
GetReturnToken() antlr.Token
|
||||||
|
|
||||||
// GetLp returns the lp token.
|
// GetLp returns the lp token.
|
||||||
GetLp() antlr.Token
|
GetLp() antlr.Token
|
||||||
|
|
||||||
// GetRp returns the rp token.
|
// GetRp returns the rp token.
|
||||||
GetRp() antlr.Token
|
GetRp() antlr.Token
|
||||||
|
|
||||||
|
// SetReturnToken sets the returnToken token.
|
||||||
|
SetReturnToken(antlr.Token)
|
||||||
|
|
||||||
// SetLp sets the lp token.
|
// SetLp sets the lp token.
|
||||||
SetLp(antlr.Token)
|
SetLp(antlr.Token)
|
||||||
|
|
||||||
@@ -168,13 +173,14 @@ type IReplybodyContext interface {
|
|||||||
|
|
||||||
type ReplybodyContext struct {
|
type ReplybodyContext struct {
|
||||||
*antlr.BaseParserRuleContext
|
*antlr.BaseParserRuleContext
|
||||||
parser antlr.Parser
|
parser antlr.Parser
|
||||||
lp antlr.Token
|
returnToken antlr.Token
|
||||||
rp antlr.Token
|
lp antlr.Token
|
||||||
|
rp antlr.Token
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewEmptyReplybodyContext() *ReplybodyContext {
|
func NewEmptyReplybodyContext() *ReplybodyContext {
|
||||||
var p = new(ReplybodyContext)
|
p := new(ReplybodyContext)
|
||||||
p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1)
|
p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1)
|
||||||
p.RuleIndex = ApiParserParserRULE_replybody
|
p.RuleIndex = ApiParserParserRULE_replybody
|
||||||
return p
|
return p
|
||||||
@@ -183,7 +189,7 @@ func NewEmptyReplybodyContext() *ReplybodyContext {
|
|||||||
func (*ReplybodyContext) IsReplybodyContext() {}
|
func (*ReplybodyContext) IsReplybodyContext() {}
|
||||||
|
|
||||||
func NewReplybodyContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *ReplybodyContext {
|
func NewReplybodyContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *ReplybodyContext {
|
||||||
var p = new(ReplybodyContext)
|
p := new(ReplybodyContext)
|
||||||
|
|
||||||
p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState)
|
p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState)
|
||||||
|
|
||||||
@@ -195,16 +201,20 @@ func NewReplybodyContext(parser antlr.Parser, parent antlr.ParserRuleContext, in
|
|||||||
|
|
||||||
func (s *ReplybodyContext) GetParser() antlr.Parser { return s.parser }
|
func (s *ReplybodyContext) GetParser() antlr.Parser { return s.parser }
|
||||||
|
|
||||||
|
func (s *ReplybodyContext) GetReturnToken() antlr.Token { return s.returnToken }
|
||||||
|
|
||||||
func (s *ReplybodyContext) GetLp() antlr.Token { return s.lp }
|
func (s *ReplybodyContext) GetLp() antlr.Token { return s.lp }
|
||||||
|
|
||||||
func (s *ReplybodyContext) GetRp() antlr.Token { return s.rp }
|
func (s *ReplybodyContext) GetRp() antlr.Token { return s.rp }
|
||||||
|
|
||||||
|
func (s *ReplybodyContext) SetReturnToken(v antlr.Token) { s.returnToken = v }
|
||||||
|
|
||||||
func (s *ReplybodyContext) SetLp(v antlr.Token) { s.lp = v }
|
func (s *ReplybodyContext) SetLp(v antlr.Token) { s.lp = v }
|
||||||
|
|
||||||
func (s *ReplybodyContext) SetRp(v antlr.Token) { s.rp = v }
|
func (s *ReplybodyContext) SetRp(v antlr.Token) { s.rp = v }
|
||||||
|
|
||||||
func (s *ReplybodyContext) DataType() IDataTypeContext {
|
func (s *ReplybodyContext) DataType() IDataTypeContext {
|
||||||
var t = s.GetTypedRuleContext(reflect.TypeOf((*IDataTypeContext)(nil)).Elem(), 0)
|
t := s.GetTypedRuleContext(reflect.TypeOf((*IDataTypeContext)(nil)).Elem(), 0)
|
||||||
|
|
||||||
if t == nil {
|
if t == nil {
|
||||||
return nil
|
return nil
|
||||||
@@ -254,27 +264,33 @@ func (p *ApiParserParser) Replybody() (localctx IReplybodyContext) {
|
|||||||
|
|
||||||
p.EnterOuterAlt(localctx, 1)
|
p.EnterOuterAlt(localctx, 1)
|
||||||
{
|
{
|
||||||
p.SetState(308)
|
p.SetState(305)
|
||||||
|
|
||||||
var _m = p.Match(ApiParserParserT__1)
|
_m := p.Match(ApiParserParserT__9)
|
||||||
|
|
||||||
|
localctx.(*ReplybodyContext).returnToken = _m
|
||||||
|
}
|
||||||
|
{
|
||||||
|
p.SetState(306)
|
||||||
|
|
||||||
|
_m := p.Match(ApiParserParserT__1)
|
||||||
|
|
||||||
localctx.(*ReplybodyContext).lp = _m
|
localctx.(*ReplybodyContext).lp = _m
|
||||||
}
|
}
|
||||||
p.SetState(310)
|
p.SetState(308)
|
||||||
p.GetErrorHandler().Sync(p)
|
p.GetErrorHandler().Sync(p)
|
||||||
_la = p.GetTokenStream().LA(1)
|
_la = p.GetTokenStream().LA(1)
|
||||||
|
|
||||||
if ((_la)&-(0x1f+1)) == 0 && ((1<<uint(_la))&((1<<ApiParserParserT__5)|(1<<ApiParserParserT__6)|(1<<ApiParserParserT__7)|(1<<ApiParserParserINTERFACE)|(1<<ApiParserParserID))) != 0 {
|
if ((_la)&-(0x1f+1)) == 0 && ((1<<uint(_la))&((1<<ApiParserParserT__5)|(1<<ApiParserParserT__6)|(1<<ApiParserParserT__7)|(1<<ApiParserParserINTERFACE)|(1<<ApiParserParserID))) != 0 {
|
||||||
{
|
{
|
||||||
p.SetState(309)
|
p.SetState(307)
|
||||||
p.DataType()
|
p.DataType()
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
p.SetState(312)
|
p.SetState(310)
|
||||||
|
|
||||||
var _m = p.Match(ApiParserParserT__2)
|
_m := p.Match(ApiParserParserT__2)
|
||||||
|
|
||||||
localctx.(*ReplybodyContext).rp = _m
|
localctx.(*ReplybodyContext).rp = _m
|
||||||
}
|
}
|
||||||
@@ -313,7 +329,7 @@ type KvLitContext struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func NewEmptyKvLitContext() *KvLitContext {
|
func NewEmptyKvLitContext() *KvLitContext {
|
||||||
var p = new(KvLitContext)
|
p := new(KvLitContext)
|
||||||
p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1)
|
p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1)
|
||||||
p.RuleIndex = ApiParserParserRULE_kvLit
|
p.RuleIndex = ApiParserParserRULE_kvLit
|
||||||
return p
|
return p
|
||||||
@@ -322,7 +338,7 @@ func NewEmptyKvLitContext() *KvLitContext {
|
|||||||
func (*KvLitContext) IsKvLitContext() {}
|
func (*KvLitContext) IsKvLitContext() {}
|
||||||
|
|
||||||
func NewKvLitContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *KvLitContext {
|
func NewKvLitContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *KvLitContext {
|
||||||
var p = new(KvLitContext)
|
p := new(KvLitContext)
|
||||||
|
|
||||||
p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState)
|
p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState)
|
||||||
|
|
||||||
@@ -390,17 +406,17 @@ func (p *ApiParserParser) KvLit() (localctx IKvLitContext) {
|
|||||||
|
|
||||||
p.EnterOuterAlt(localctx, 1)
|
p.EnterOuterAlt(localctx, 1)
|
||||||
{
|
{
|
||||||
p.SetState(314)
|
p.SetState(312)
|
||||||
|
|
||||||
var _m = p.Match(ApiParserParserID)
|
_m := p.Match(ApiParserParserID)
|
||||||
|
|
||||||
localctx.(*KvLitContext).key = _m
|
localctx.(*KvLitContext).key = _m
|
||||||
}
|
}
|
||||||
checkKeyValue(p)
|
checkKeyValue(p)
|
||||||
{
|
{
|
||||||
p.SetState(316)
|
p.SetState(314)
|
||||||
|
|
||||||
var _m = p.Match(ApiParserParserLINE_VALUE)
|
_m := p.Match(ApiParserParserLINE_VALUE)
|
||||||
|
|
||||||
localctx.(*KvLitContext).value = _m
|
localctx.(*KvLitContext).value = _m
|
||||||
}
|
}
|
||||||
@@ -425,7 +441,7 @@ type ServiceNameContext struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func NewEmptyServiceNameContext() *ServiceNameContext {
|
func NewEmptyServiceNameContext() *ServiceNameContext {
|
||||||
var p = new(ServiceNameContext)
|
p := new(ServiceNameContext)
|
||||||
p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1)
|
p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1)
|
||||||
p.RuleIndex = ApiParserParserRULE_serviceName
|
p.RuleIndex = ApiParserParserRULE_serviceName
|
||||||
return p
|
return p
|
||||||
@@ -434,7 +450,7 @@ func NewEmptyServiceNameContext() *ServiceNameContext {
|
|||||||
func (*ServiceNameContext) IsServiceNameContext() {}
|
func (*ServiceNameContext) IsServiceNameContext() {}
|
||||||
|
|
||||||
func NewServiceNameContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *ServiceNameContext {
|
func NewServiceNameContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *ServiceNameContext {
|
||||||
var p = new(ServiceNameContext)
|
p := new(ServiceNameContext)
|
||||||
|
|
||||||
p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState)
|
p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState)
|
||||||
|
|
||||||
@@ -494,27 +510,26 @@ func (p *ApiParserParser) ServiceName() (localctx IServiceNameContext) {
|
|||||||
}()
|
}()
|
||||||
|
|
||||||
p.EnterOuterAlt(localctx, 1)
|
p.EnterOuterAlt(localctx, 1)
|
||||||
p.SetState(322)
|
p.SetState(320)
|
||||||
p.GetErrorHandler().Sync(p)
|
p.GetErrorHandler().Sync(p)
|
||||||
|
|
||||||
for ok := true; ok; ok = _la == ApiParserParserID {
|
for ok := true; ok; ok = _la == ApiParserParserID {
|
||||||
{
|
{
|
||||||
p.SetState(318)
|
p.SetState(316)
|
||||||
p.Match(ApiParserParserID)
|
p.Match(ApiParserParserID)
|
||||||
}
|
}
|
||||||
p.SetState(320)
|
p.SetState(318)
|
||||||
p.GetErrorHandler().Sync(p)
|
p.GetErrorHandler().Sync(p)
|
||||||
_la = p.GetTokenStream().LA(1)
|
_la = p.GetTokenStream().LA(1)
|
||||||
|
|
||||||
if _la == ApiParserParserT__9 {
|
if _la == ApiParserParserT__10 {
|
||||||
{
|
{
|
||||||
p.SetState(319)
|
p.SetState(317)
|
||||||
p.Match(ApiParserParserT__9)
|
p.Match(ApiParserParserT__10)
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
p.SetState(324)
|
p.SetState(322)
|
||||||
p.GetErrorHandler().Sync(p)
|
p.GetErrorHandler().Sync(p)
|
||||||
_la = p.GetTokenStream().LA(1)
|
_la = p.GetTokenStream().LA(1)
|
||||||
}
|
}
|
||||||
@@ -539,7 +554,7 @@ type PathContext struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func NewEmptyPathContext() *PathContext {
|
func NewEmptyPathContext() *PathContext {
|
||||||
var p = new(PathContext)
|
p := new(PathContext)
|
||||||
p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1)
|
p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1)
|
||||||
p.RuleIndex = ApiParserParserRULE_path
|
p.RuleIndex = ApiParserParserRULE_path
|
||||||
return p
|
return p
|
||||||
@@ -548,7 +563,7 @@ func NewEmptyPathContext() *PathContext {
|
|||||||
func (*PathContext) IsPathContext() {}
|
func (*PathContext) IsPathContext() {}
|
||||||
|
|
||||||
func NewPathContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *PathContext {
|
func NewPathContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *PathContext {
|
||||||
var p = new(PathContext)
|
p := new(PathContext)
|
||||||
|
|
||||||
p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState)
|
p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState)
|
||||||
|
|
||||||
@@ -607,69 +622,69 @@ func (p *ApiParserParser) Path() (localctx IPathContext) {
|
|||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
|
|
||||||
p.SetState(346)
|
p.SetState(344)
|
||||||
p.GetErrorHandler().Sync(p)
|
p.GetErrorHandler().Sync(p)
|
||||||
switch p.GetInterpreter().AdaptivePredict(p.GetTokenStream(), 39, p.GetParserRuleContext()) {
|
switch p.GetInterpreter().AdaptivePredict(p.GetTokenStream(), 38, p.GetParserRuleContext()) {
|
||||||
case 1:
|
case 1:
|
||||||
p.EnterOuterAlt(localctx, 1)
|
p.EnterOuterAlt(localctx, 1)
|
||||||
p.SetState(341)
|
p.SetState(339)
|
||||||
p.GetErrorHandler().Sync(p)
|
p.GetErrorHandler().Sync(p)
|
||||||
|
|
||||||
for ok := true; ok; ok = _la == ApiParserParserT__10 || _la == ApiParserParserT__11 {
|
for ok := true; ok; ok = _la == ApiParserParserT__11 || _la == ApiParserParserT__12 {
|
||||||
p.SetState(341)
|
p.SetState(339)
|
||||||
p.GetErrorHandler().Sync(p)
|
p.GetErrorHandler().Sync(p)
|
||||||
|
|
||||||
switch p.GetTokenStream().LA(1) {
|
switch p.GetTokenStream().LA(1) {
|
||||||
case ApiParserParserT__10:
|
|
||||||
{
|
|
||||||
p.SetState(326)
|
|
||||||
p.Match(ApiParserParserT__10)
|
|
||||||
}
|
|
||||||
|
|
||||||
{
|
|
||||||
p.SetState(327)
|
|
||||||
p.Match(ApiParserParserID)
|
|
||||||
}
|
|
||||||
p.SetState(332)
|
|
||||||
p.GetErrorHandler().Sync(p)
|
|
||||||
_la = p.GetTokenStream().LA(1)
|
|
||||||
|
|
||||||
for _la == ApiParserParserT__9 {
|
|
||||||
{
|
|
||||||
p.SetState(328)
|
|
||||||
p.Match(ApiParserParserT__9)
|
|
||||||
}
|
|
||||||
{
|
|
||||||
p.SetState(329)
|
|
||||||
p.Match(ApiParserParserID)
|
|
||||||
}
|
|
||||||
|
|
||||||
p.SetState(334)
|
|
||||||
p.GetErrorHandler().Sync(p)
|
|
||||||
_la = p.GetTokenStream().LA(1)
|
|
||||||
}
|
|
||||||
|
|
||||||
case ApiParserParserT__11:
|
case ApiParserParserT__11:
|
||||||
{
|
{
|
||||||
p.SetState(335)
|
p.SetState(324)
|
||||||
p.Match(ApiParserParserT__11)
|
p.Match(ApiParserParserT__11)
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
p.SetState(336)
|
p.SetState(325)
|
||||||
p.Match(ApiParserParserID)
|
p.Match(ApiParserParserID)
|
||||||
}
|
}
|
||||||
p.SetState(339)
|
p.SetState(330)
|
||||||
p.GetErrorHandler().Sync(p)
|
p.GetErrorHandler().Sync(p)
|
||||||
_la = p.GetTokenStream().LA(1)
|
_la = p.GetTokenStream().LA(1)
|
||||||
|
|
||||||
if _la == ApiParserParserT__9 {
|
for _la == ApiParserParserT__10 {
|
||||||
{
|
{
|
||||||
p.SetState(337)
|
p.SetState(326)
|
||||||
p.Match(ApiParserParserT__9)
|
p.Match(ApiParserParserT__10)
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
p.SetState(338)
|
p.SetState(327)
|
||||||
|
p.Match(ApiParserParserID)
|
||||||
|
}
|
||||||
|
|
||||||
|
p.SetState(332)
|
||||||
|
p.GetErrorHandler().Sync(p)
|
||||||
|
_la = p.GetTokenStream().LA(1)
|
||||||
|
}
|
||||||
|
|
||||||
|
case ApiParserParserT__12:
|
||||||
|
{
|
||||||
|
p.SetState(333)
|
||||||
|
p.Match(ApiParserParserT__12)
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
p.SetState(334)
|
||||||
|
p.Match(ApiParserParserID)
|
||||||
|
}
|
||||||
|
p.SetState(337)
|
||||||
|
p.GetErrorHandler().Sync(p)
|
||||||
|
_la = p.GetTokenStream().LA(1)
|
||||||
|
|
||||||
|
if _la == ApiParserParserT__10 {
|
||||||
|
{
|
||||||
|
p.SetState(335)
|
||||||
|
p.Match(ApiParserParserT__10)
|
||||||
|
}
|
||||||
|
{
|
||||||
|
p.SetState(336)
|
||||||
p.Match(ApiParserParserID)
|
p.Match(ApiParserParserID)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -679,7 +694,7 @@ func (p *ApiParserParser) Path() (localctx IPathContext) {
|
|||||||
panic(antlr.NewNoViableAltException(p, nil, nil, nil, nil, nil))
|
panic(antlr.NewNoViableAltException(p, nil, nil, nil, nil, nil))
|
||||||
}
|
}
|
||||||
|
|
||||||
p.SetState(343)
|
p.SetState(341)
|
||||||
p.GetErrorHandler().Sync(p)
|
p.GetErrorHandler().Sync(p)
|
||||||
_la = p.GetTokenStream().LA(1)
|
_la = p.GetTokenStream().LA(1)
|
||||||
}
|
}
|
||||||
@@ -687,8 +702,8 @@ func (p *ApiParserParser) Path() (localctx IPathContext) {
|
|||||||
case 2:
|
case 2:
|
||||||
p.EnterOuterAlt(localctx, 2)
|
p.EnterOuterAlt(localctx, 2)
|
||||||
{
|
{
|
||||||
p.SetState(345)
|
p.SetState(343)
|
||||||
p.Match(ApiParserParserT__10)
|
p.Match(ApiParserParserT__11)
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,118 +1,119 @@
|
|||||||
package api // ApiParser
|
package api // ApiParser
|
||||||
|
|
||||||
import "github.com/zeromicro/antlr"
|
import "github.com/zeromicro/antlr"
|
||||||
|
|
||||||
// A complete Visitor for a parse tree produced by ApiParserParser.
|
// ApiParserVisitor is a complete Visitor for a parse tree produced by ApiParserParser.
|
||||||
type ApiParserVisitor interface {
|
type ApiParserVisitor interface {
|
||||||
antlr.ParseTreeVisitor
|
antlr.ParseTreeVisitor
|
||||||
|
|
||||||
// Visit a parse tree produced by ApiParserParser#api.
|
// VisitApi is a parse tree produced by ApiParserParser#api.
|
||||||
VisitApi(ctx *ApiContext) interface{}
|
VisitApi(ctx *ApiContext) interface{}
|
||||||
|
|
||||||
// Visit a parse tree produced by ApiParserParser#spec.
|
// VisitSpec is a parse tree produced by ApiParserParser#spec.
|
||||||
VisitSpec(ctx *SpecContext) interface{}
|
VisitSpec(ctx *SpecContext) interface{}
|
||||||
|
|
||||||
// Visit a parse tree produced by ApiParserParser#syntaxLit.
|
// VisitSyntaxLit is a parse tree produced by ApiParserParser#syntaxLit.
|
||||||
VisitSyntaxLit(ctx *SyntaxLitContext) interface{}
|
VisitSyntaxLit(ctx *SyntaxLitContext) interface{}
|
||||||
|
|
||||||
// Visit a parse tree produced by ApiParserParser#importSpec.
|
// VisitImportSpec is a parse tree produced by ApiParserParser#importSpec.
|
||||||
VisitImportSpec(ctx *ImportSpecContext) interface{}
|
VisitImportSpec(ctx *ImportSpecContext) interface{}
|
||||||
|
|
||||||
// Visit a parse tree produced by ApiParserParser#importLit.
|
// VisitImportLit is a parse tree produced by ApiParserParser#importLit.
|
||||||
VisitImportLit(ctx *ImportLitContext) interface{}
|
VisitImportLit(ctx *ImportLitContext) interface{}
|
||||||
|
|
||||||
// Visit a parse tree produced by ApiParserParser#importBlock.
|
// VisitImportBlock is a parse tree produced by ApiParserParser#importBlock.
|
||||||
VisitImportBlock(ctx *ImportBlockContext) interface{}
|
VisitImportBlock(ctx *ImportBlockContext) interface{}
|
||||||
|
|
||||||
// Visit a parse tree produced by ApiParserParser#importBlockValue.
|
// VisitImportBlockValue is a parse tree produced by ApiParserParser#importBlockValue.
|
||||||
VisitImportBlockValue(ctx *ImportBlockValueContext) interface{}
|
VisitImportBlockValue(ctx *ImportBlockValueContext) interface{}
|
||||||
|
|
||||||
// Visit a parse tree produced by ApiParserParser#importValue.
|
// VisitImportValue is a parse tree produced by ApiParserParser#importValue.
|
||||||
VisitImportValue(ctx *ImportValueContext) interface{}
|
VisitImportValue(ctx *ImportValueContext) interface{}
|
||||||
|
|
||||||
// Visit a parse tree produced by ApiParserParser#infoSpec.
|
// VisitInfoSpec is a parse tree produced by ApiParserParser#infoSpec.
|
||||||
VisitInfoSpec(ctx *InfoSpecContext) interface{}
|
VisitInfoSpec(ctx *InfoSpecContext) interface{}
|
||||||
|
|
||||||
// Visit a parse tree produced by ApiParserParser#typeSpec.
|
// VisitTypeSpec is a parse tree produced by ApiParserParser#typeSpec.
|
||||||
VisitTypeSpec(ctx *TypeSpecContext) interface{}
|
VisitTypeSpec(ctx *TypeSpecContext) interface{}
|
||||||
|
|
||||||
// Visit a parse tree produced by ApiParserParser#typeLit.
|
// VisitTypeLit is a parse tree produced by ApiParserParser#typeLit.
|
||||||
VisitTypeLit(ctx *TypeLitContext) interface{}
|
VisitTypeLit(ctx *TypeLitContext) interface{}
|
||||||
|
|
||||||
// Visit a parse tree produced by ApiParserParser#typeBlock.
|
// VisitTypeBlock is a parse tree produced by ApiParserParser#typeBlock.
|
||||||
VisitTypeBlock(ctx *TypeBlockContext) interface{}
|
VisitTypeBlock(ctx *TypeBlockContext) interface{}
|
||||||
|
|
||||||
// Visit a parse tree produced by ApiParserParser#typeLitBody.
|
// VisitTypeLitBody is a parse tree produced by ApiParserParser#typeLitBody.
|
||||||
VisitTypeLitBody(ctx *TypeLitBodyContext) interface{}
|
VisitTypeLitBody(ctx *TypeLitBodyContext) interface{}
|
||||||
|
|
||||||
// Visit a parse tree produced by ApiParserParser#typeBlockBody.
|
// VisitTypeBlockBody is a parse tree produced by ApiParserParser#typeBlockBody.
|
||||||
VisitTypeBlockBody(ctx *TypeBlockBodyContext) interface{}
|
VisitTypeBlockBody(ctx *TypeBlockBodyContext) interface{}
|
||||||
|
|
||||||
// Visit a parse tree produced by ApiParserParser#typeStruct.
|
// VisitTypeStruct is a parse tree produced by ApiParserParser#typeStruct.
|
||||||
VisitTypeStruct(ctx *TypeStructContext) interface{}
|
VisitTypeStruct(ctx *TypeStructContext) interface{}
|
||||||
|
|
||||||
// Visit a parse tree produced by ApiParserParser#typeAlias.
|
// VisitTypeAlias is a parse tree produced by ApiParserParser#typeAlias.
|
||||||
VisitTypeAlias(ctx *TypeAliasContext) interface{}
|
VisitTypeAlias(ctx *TypeAliasContext) interface{}
|
||||||
|
|
||||||
// Visit a parse tree produced by ApiParserParser#typeBlockStruct.
|
// VisitTypeBlockStruct is a parse tree produced by ApiParserParser#typeBlockStruct.
|
||||||
VisitTypeBlockStruct(ctx *TypeBlockStructContext) interface{}
|
VisitTypeBlockStruct(ctx *TypeBlockStructContext) interface{}
|
||||||
|
|
||||||
// Visit a parse tree produced by ApiParserParser#typeBlockAlias.
|
// VisitTypeBlockAlias is a parse tree produced by ApiParserParser#typeBlockAlias.
|
||||||
VisitTypeBlockAlias(ctx *TypeBlockAliasContext) interface{}
|
VisitTypeBlockAlias(ctx *TypeBlockAliasContext) interface{}
|
||||||
|
|
||||||
// Visit a parse tree produced by ApiParserParser#field.
|
// VisitField is a parse tree produced by ApiParserParser#field.
|
||||||
VisitField(ctx *FieldContext) interface{}
|
VisitField(ctx *FieldContext) interface{}
|
||||||
|
|
||||||
// Visit a parse tree produced by ApiParserParser#normalField.
|
// VisitNormalField is a parse tree produced by ApiParserParser#normalField.
|
||||||
VisitNormalField(ctx *NormalFieldContext) interface{}
|
VisitNormalField(ctx *NormalFieldContext) interface{}
|
||||||
|
|
||||||
// Visit a parse tree produced by ApiParserParser#anonymousFiled.
|
// VisitAnonymousFiled is a parse tree produced by ApiParserParser#anonymousFiled.
|
||||||
VisitAnonymousFiled(ctx *AnonymousFiledContext) interface{}
|
VisitAnonymousFiled(ctx *AnonymousFiledContext) interface{}
|
||||||
|
|
||||||
// Visit a parse tree produced by ApiParserParser#dataType.
|
// VisitDataType is a parse tree produced by ApiParserParser#dataType.
|
||||||
VisitDataType(ctx *DataTypeContext) interface{}
|
VisitDataType(ctx *DataTypeContext) interface{}
|
||||||
|
|
||||||
// Visit a parse tree produced by ApiParserParser#pointerType.
|
// VisitPointerType is a parse tree produced by ApiParserParser#pointerType.
|
||||||
VisitPointerType(ctx *PointerTypeContext) interface{}
|
VisitPointerType(ctx *PointerTypeContext) interface{}
|
||||||
|
|
||||||
// Visit a parse tree produced by ApiParserParser#mapType.
|
// VisitMapType is a parse tree produced by ApiParserParser#mapType.
|
||||||
VisitMapType(ctx *MapTypeContext) interface{}
|
VisitMapType(ctx *MapTypeContext) interface{}
|
||||||
|
|
||||||
// Visit a parse tree produced by ApiParserParser#arrayType.
|
// VisitArrayType is a parse tree produced by ApiParserParser#arrayType.
|
||||||
VisitArrayType(ctx *ArrayTypeContext) interface{}
|
VisitArrayType(ctx *ArrayTypeContext) interface{}
|
||||||
|
|
||||||
// Visit a parse tree produced by ApiParserParser#serviceSpec.
|
// VisitServiceSpec is a parse tree produced by ApiParserParser#serviceSpec.
|
||||||
VisitServiceSpec(ctx *ServiceSpecContext) interface{}
|
VisitServiceSpec(ctx *ServiceSpecContext) interface{}
|
||||||
|
|
||||||
// Visit a parse tree produced by ApiParserParser#atServer.
|
// VisitAtServer is a parse tree produced by ApiParserParser#atServer.
|
||||||
VisitAtServer(ctx *AtServerContext) interface{}
|
VisitAtServer(ctx *AtServerContext) interface{}
|
||||||
|
|
||||||
// Visit a parse tree produced by ApiParserParser#serviceApi.
|
// VisitServiceApi is a parse tree produced by ApiParserParser#serviceApi.
|
||||||
VisitServiceApi(ctx *ServiceApiContext) interface{}
|
VisitServiceApi(ctx *ServiceApiContext) interface{}
|
||||||
|
|
||||||
// Visit a parse tree produced by ApiParserParser#serviceRoute.
|
// VisitServiceRoute is a parse tree produced by ApiParserParser#serviceRoute.
|
||||||
VisitServiceRoute(ctx *ServiceRouteContext) interface{}
|
VisitServiceRoute(ctx *ServiceRouteContext) interface{}
|
||||||
|
|
||||||
// Visit a parse tree produced by ApiParserParser#atDoc.
|
// VisitAtDoc is a parse tree produced by ApiParserParser#atDoc.
|
||||||
VisitAtDoc(ctx *AtDocContext) interface{}
|
VisitAtDoc(ctx *AtDocContext) interface{}
|
||||||
|
|
||||||
// Visit a parse tree produced by ApiParserParser#atHandler.
|
// VisitAtHandler is a parse tree produced by ApiParserParser#atHandler.
|
||||||
VisitAtHandler(ctx *AtHandlerContext) interface{}
|
VisitAtHandler(ctx *AtHandlerContext) interface{}
|
||||||
|
|
||||||
// Visit a parse tree produced by ApiParserParser#route.
|
// VisitRoute is a parse tree produced by ApiParserParser#route.
|
||||||
VisitRoute(ctx *RouteContext) interface{}
|
VisitRoute(ctx *RouteContext) interface{}
|
||||||
|
|
||||||
// Visit a parse tree produced by ApiParserParser#body.
|
// VisitBody is a parse tree produced by ApiParserParser#body.
|
||||||
VisitBody(ctx *BodyContext) interface{}
|
VisitBody(ctx *BodyContext) interface{}
|
||||||
|
|
||||||
// Visit a parse tree produced by ApiParserParser#replybody.
|
// VisitReplybody is a parse tree produced by ApiParserParser#replybody.
|
||||||
VisitReplybody(ctx *ReplybodyContext) interface{}
|
VisitReplybody(ctx *ReplybodyContext) interface{}
|
||||||
|
|
||||||
// Visit a parse tree produced by ApiParserParser#kvLit.
|
// VisitKvLit is a parse tree produced by ApiParserParser#kvLit.
|
||||||
VisitKvLit(ctx *KvLitContext) interface{}
|
VisitKvLit(ctx *KvLitContext) interface{}
|
||||||
|
|
||||||
// Visit a parse tree produced by ApiParserParser#serviceName.
|
// VisitServiceName is a parse tree produced by ApiParserParser#serviceName.
|
||||||
VisitServiceName(ctx *ServiceNameContext) interface{}
|
VisitServiceName(ctx *ServiceNameContext) interface{}
|
||||||
|
|
||||||
// Visit a parse tree produced by ApiParserParser#path.
|
// VisitPath is a parse tree produced by ApiParserParser#path.
|
||||||
VisitPath(ctx *PathContext) interface{}
|
VisitPath(ctx *PathContext) interface{}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ func TestFileSplitor(t *testing.T) {
|
|||||||
buffer := bytes.NewBuffer(nil)
|
buffer := bytes.NewBuffer(nil)
|
||||||
|
|
||||||
for {
|
for {
|
||||||
var fn, part = "apiparser_parser0.go", "main"
|
fn, part := "apiparser_parser0.go", "main"
|
||||||
if files > 0 {
|
if files > 0 {
|
||||||
fn = fmt.Sprintf("apiparser_parser%d.go", files)
|
fn = fmt.Sprintf("apiparser_parser%d.go", files)
|
||||||
part = fmt.Sprintf("%d", files)
|
part = fmt.Sprintf("%d", files)
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ import (
|
|||||||
|
|
||||||
"github.com/stretchr/testify/assert"
|
"github.com/stretchr/testify/assert"
|
||||||
"github.com/tal-tech/go-zero/tools/goctl/api/parser/g4/ast"
|
"github.com/tal-tech/go-zero/tools/goctl/api/parser/g4/ast"
|
||||||
"github.com/tal-tech/go-zero/tools/goctl/util"
|
"github.com/tal-tech/go-zero/tools/goctl/util/pathx"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
@@ -119,7 +119,7 @@ func TestApiParser(t *testing.T) {
|
|||||||
})
|
})
|
||||||
|
|
||||||
t.Run("nestedImport", func(t *testing.T) {
|
t.Run("nestedImport", func(t *testing.T) {
|
||||||
file := filepath.Join(util.MustTempDir(), "foo.api")
|
file := filepath.Join(pathx.MustTempDir(), "foo.api")
|
||||||
err := ioutil.WriteFile(file, []byte(nestedAPIImport), os.ModePerm)
|
err := ioutil.WriteFile(file, []byte(nestedAPIImport), os.ModePerm)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return
|
return
|
||||||
@@ -149,7 +149,7 @@ func TestApiParser(t *testing.T) {
|
|||||||
})
|
})
|
||||||
|
|
||||||
t.Run("ambiguousSyntax", func(t *testing.T) {
|
t.Run("ambiguousSyntax", func(t *testing.T) {
|
||||||
file := filepath.Join(util.MustTempDir(), "foo.api")
|
file := filepath.Join(pathx.MustTempDir(), "foo.api")
|
||||||
err := ioutil.WriteFile(file, []byte(ambiguousSyntax), os.ModePerm)
|
err := ioutil.WriteFile(file, []byte(ambiguousSyntax), os.ModePerm)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return
|
return
|
||||||
@@ -163,7 +163,7 @@ func TestApiParser(t *testing.T) {
|
|||||||
})
|
})
|
||||||
|
|
||||||
t.Run("ambiguousSyntax", func(t *testing.T) {
|
t.Run("ambiguousSyntax", func(t *testing.T) {
|
||||||
file := filepath.Join(util.MustTempDir(), "foo.api")
|
file := filepath.Join(pathx.MustTempDir(), "foo.api")
|
||||||
err := ioutil.WriteFile(file, []byte(ambiguousSyntax), os.ModePerm)
|
err := ioutil.WriteFile(file, []byte(ambiguousSyntax), os.ModePerm)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return
|
return
|
||||||
@@ -177,7 +177,7 @@ func TestApiParser(t *testing.T) {
|
|||||||
})
|
})
|
||||||
|
|
||||||
t.Run("ambiguousService", func(t *testing.T) {
|
t.Run("ambiguousService", func(t *testing.T) {
|
||||||
file := filepath.Join(util.MustTempDir(), "foo.api")
|
file := filepath.Join(pathx.MustTempDir(), "foo.api")
|
||||||
err := ioutil.WriteFile(file, []byte(ambiguousService), os.ModePerm)
|
err := ioutil.WriteFile(file, []byte(ambiguousService), os.ModePerm)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return
|
return
|
||||||
@@ -207,7 +207,7 @@ func TestApiParser(t *testing.T) {
|
|||||||
`)
|
`)
|
||||||
assert.Error(t, err)
|
assert.Error(t, err)
|
||||||
|
|
||||||
file := filepath.Join(util.MustTempDir(), "foo.api")
|
file := filepath.Join(pathx.MustTempDir(), "foo.api")
|
||||||
err = ioutil.WriteFile(file, []byte(duplicateHandler), os.ModePerm)
|
err = ioutil.WriteFile(file, []byte(duplicateHandler), os.ModePerm)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return
|
return
|
||||||
@@ -236,7 +236,7 @@ func TestApiParser(t *testing.T) {
|
|||||||
`)
|
`)
|
||||||
assert.Error(t, err)
|
assert.Error(t, err)
|
||||||
|
|
||||||
file := filepath.Join(util.MustTempDir(), "foo.api")
|
file := filepath.Join(pathx.MustTempDir(), "foo.api")
|
||||||
err = ioutil.WriteFile(file, []byte(duplicateRoute), os.ModePerm)
|
err = ioutil.WriteFile(file, []byte(duplicateRoute), os.ModePerm)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return
|
return
|
||||||
@@ -260,7 +260,7 @@ func TestApiParser(t *testing.T) {
|
|||||||
`)
|
`)
|
||||||
assert.Error(t, err)
|
assert.Error(t, err)
|
||||||
|
|
||||||
file := filepath.Join(util.MustTempDir(), "foo.api")
|
file := filepath.Join(pathx.MustTempDir(), "foo.api")
|
||||||
err = ioutil.WriteFile(file, []byte(duplicateType), os.ModePerm)
|
err = ioutil.WriteFile(file, []byte(duplicateType), os.ModePerm)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return
|
return
|
||||||
|
|||||||
@@ -164,8 +164,8 @@ func TestRoute(t *testing.T) {
|
|||||||
_, err = parser.Accept(fn, `post foo/bar`)
|
_, err = parser.Accept(fn, `post foo/bar`)
|
||||||
assert.Error(t, err)
|
assert.Error(t, err)
|
||||||
|
|
||||||
_, err = parser.Accept(fn, `post /foo/bar return (Bar)`)
|
_, err = parser.Accept(fn, `post /foo/bar returns (Bar)`)
|
||||||
assert.Error(t, err)
|
assert.Nil(t, err)
|
||||||
|
|
||||||
_, err = parser.Accept(fn, ` /foo/bar returns (Bar)`)
|
_, err = parser.Accept(fn, ` /foo/bar returns (Bar)`)
|
||||||
assert.Error(t, err)
|
assert.Error(t, err)
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
package spec
|
package spec
|
||||||
|
|
||||||
|
// RoutePrefixKey is the prefix keyword for the routes.
|
||||||
const RoutePrefixKey = "prefix"
|
const RoutePrefixKey = "prefix"
|
||||||
|
|
||||||
type (
|
type (
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ import (
|
|||||||
"github.com/logrusorgru/aurora"
|
"github.com/logrusorgru/aurora"
|
||||||
"github.com/tal-tech/go-zero/core/logx"
|
"github.com/tal-tech/go-zero/core/logx"
|
||||||
"github.com/tal-tech/go-zero/tools/goctl/api/parser"
|
"github.com/tal-tech/go-zero/tools/goctl/api/parser"
|
||||||
"github.com/tal-tech/go-zero/tools/goctl/util"
|
"github.com/tal-tech/go-zero/tools/goctl/util/pathx"
|
||||||
"github.com/urfave/cli"
|
"github.com/urfave/cli"
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -33,7 +33,7 @@ func TsCommand(c *cli.Context) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
api.Service = api.Service.JoinPrefix()
|
api.Service = api.Service.JoinPrefix()
|
||||||
logx.Must(util.MkdirIfNotExist(dir))
|
logx.Must(pathx.MkdirIfNotExist(dir))
|
||||||
logx.Must(genHandler(dir, webAPI, caller, api, unwrapAPI))
|
logx.Must(genHandler(dir, webAPI, caller, api, unwrapAPI))
|
||||||
logx.Must(genComponents(dir, api))
|
logx.Must(genComponents(dir, api))
|
||||||
|
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ import (
|
|||||||
|
|
||||||
"github.com/tal-tech/go-zero/tools/goctl/api/spec"
|
"github.com/tal-tech/go-zero/tools/goctl/api/spec"
|
||||||
apiutil "github.com/tal-tech/go-zero/tools/goctl/api/util"
|
apiutil "github.com/tal-tech/go-zero/tools/goctl/api/util"
|
||||||
"github.com/tal-tech/go-zero/tools/goctl/util"
|
"github.com/tal-tech/go-zero/tools/goctl/util/pathx"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
@@ -30,7 +30,7 @@ func genComponents(dir string, api *spec.ApiSpec) error {
|
|||||||
|
|
||||||
outputFile := apiutil.ComponentName(api) + ".ts"
|
outputFile := apiutil.ComponentName(api) + ".ts"
|
||||||
filename := path.Join(dir, outputFile)
|
filename := path.Join(dir, outputFile)
|
||||||
if err := util.RemoveIfExist(filename); err != nil {
|
if err := pathx.RemoveIfExist(filename); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ import (
|
|||||||
"github.com/tal-tech/go-zero/tools/goctl/api/spec"
|
"github.com/tal-tech/go-zero/tools/goctl/api/spec"
|
||||||
apiutil "github.com/tal-tech/go-zero/tools/goctl/api/util"
|
apiutil "github.com/tal-tech/go-zero/tools/goctl/api/util"
|
||||||
"github.com/tal-tech/go-zero/tools/goctl/util"
|
"github.com/tal-tech/go-zero/tools/goctl/util"
|
||||||
|
"github.com/tal-tech/go-zero/tools/goctl/util/pathx"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
@@ -20,7 +21,7 @@ const (
|
|||||||
|
|
||||||
func genHandler(dir, webAPI, caller string, api *spec.ApiSpec, unwrapAPI bool) error {
|
func genHandler(dir, webAPI, caller string, api *spec.ApiSpec, unwrapAPI bool) error {
|
||||||
filename := strings.Replace(api.Service.Name, "-api", "", 1) + ".ts"
|
filename := strings.Replace(api.Service.Name, "-api", "", 1) + ".ts"
|
||||||
if err := util.RemoveIfExist(path.Join(dir, filename)); err != nil {
|
if err := pathx.RemoveIfExist(path.Join(dir, filename)); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
fp, created, err := apiutil.MaybeCreateFile(dir, "", filename)
|
fp, created, err := apiutil.MaybeCreateFile(dir, "", filename)
|
||||||
@@ -46,11 +47,11 @@ func genHandler(dir, webAPI, caller string, api *spec.ApiSpec, unwrapAPI bool) e
|
|||||||
|
|
||||||
if len(api.Types) != 0 {
|
if len(api.Types) != 0 {
|
||||||
if len(imports) > 0 {
|
if len(imports) > 0 {
|
||||||
imports += util.NL
|
imports += pathx.NL
|
||||||
}
|
}
|
||||||
outputFile := apiutil.ComponentName(api)
|
outputFile := apiutil.ComponentName(api)
|
||||||
imports += fmt.Sprintf(`import * as components from "%s"`, "./"+outputFile)
|
imports += fmt.Sprintf(`import * as components from "%s"`, "./"+outputFile)
|
||||||
imports += fmt.Sprintf(`%sexport * from "%s"`, util.NL, "./"+outputFile)
|
imports += fmt.Sprintf(`%sexport * from "%s"`, pathx.NL, "./"+outputFile)
|
||||||
}
|
}
|
||||||
|
|
||||||
apis, err := genAPI(api, caller)
|
apis, err := genAPI(api, caller)
|
||||||
|
|||||||
@@ -10,19 +10,19 @@ import (
|
|||||||
|
|
||||||
"github.com/tal-tech/go-zero/core/logx"
|
"github.com/tal-tech/go-zero/core/logx"
|
||||||
"github.com/tal-tech/go-zero/tools/goctl/api/spec"
|
"github.com/tal-tech/go-zero/tools/goctl/api/spec"
|
||||||
"github.com/tal-tech/go-zero/tools/goctl/util"
|
"github.com/tal-tech/go-zero/tools/goctl/util/pathx"
|
||||||
)
|
)
|
||||||
|
|
||||||
// MaybeCreateFile creates file if not exists
|
// MaybeCreateFile creates file if not exists
|
||||||
func MaybeCreateFile(dir, subdir, file string) (fp *os.File, created bool, err error) {
|
func MaybeCreateFile(dir, subdir, file string) (fp *os.File, created bool, err error) {
|
||||||
logx.Must(util.MkdirIfNotExist(path.Join(dir, subdir)))
|
logx.Must(pathx.MkdirIfNotExist(path.Join(dir, subdir)))
|
||||||
fpath := path.Join(dir, subdir, file)
|
fpath := path.Join(dir, subdir, file)
|
||||||
if util.FileExists(fpath) {
|
if pathx.FileExists(fpath) {
|
||||||
fmt.Printf("%s exists, ignored generation\n", fpath)
|
fmt.Printf("%s exists, ignored generation\n", fpath)
|
||||||
return nil, false, nil
|
return nil, false, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
fp, err = util.CreateIfNotExist(fpath)
|
fp, err = pathx.CreateIfNotExist(fpath)
|
||||||
created = err == nil
|
created = err == nil
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|||||||
51
tools/goctl/bug/bug.go
Normal file
51
tools/goctl/bug/bug.go
Normal file
@@ -0,0 +1,51 @@
|
|||||||
|
package bug
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
"net/url"
|
||||||
|
"os/exec"
|
||||||
|
"runtime"
|
||||||
|
|
||||||
|
"github.com/tal-tech/go-zero/tools/goctl/internal/version"
|
||||||
|
"github.com/urfave/cli"
|
||||||
|
)
|
||||||
|
|
||||||
|
const (
|
||||||
|
windows = "windows"
|
||||||
|
darwin = "darwin"
|
||||||
|
|
||||||
|
windowsOpen = "start"
|
||||||
|
darwinOpen = "open"
|
||||||
|
linuxOpen = "xdg-open"
|
||||||
|
|
||||||
|
os = "OS"
|
||||||
|
arch = "ARCH"
|
||||||
|
goctlVersion = "GOCTL_VERSION"
|
||||||
|
goVersion = "GO_VERSION"
|
||||||
|
)
|
||||||
|
|
||||||
|
var openCmd = map[string]string{
|
||||||
|
windows: windowsOpen,
|
||||||
|
darwin: darwinOpen,
|
||||||
|
}
|
||||||
|
|
||||||
|
func Action(_ *cli.Context) error {
|
||||||
|
env := getEnv()
|
||||||
|
content := fmt.Sprintf(issueTemplate, version.BuildVersion, env.string())
|
||||||
|
content = url.QueryEscape(content)
|
||||||
|
url := fmt.Sprintf("https://github.com/zeromicro/go-zero/issues/new?body=%s", content)
|
||||||
|
|
||||||
|
goos := runtime.GOOS
|
||||||
|
var cmd string
|
||||||
|
var args []string
|
||||||
|
cmd, ok := openCmd[goos]
|
||||||
|
if !ok {
|
||||||
|
cmd = linuxOpen
|
||||||
|
}
|
||||||
|
if goos == windows {
|
||||||
|
args = []string{"/c", "start"}
|
||||||
|
}
|
||||||
|
|
||||||
|
args = append(args, url)
|
||||||
|
return exec.Command(cmd, args...).Start()
|
||||||
|
}
|
||||||
34
tools/goctl/bug/env.go
Normal file
34
tools/goctl/bug/env.go
Normal file
@@ -0,0 +1,34 @@
|
|||||||
|
package bug
|
||||||
|
|
||||||
|
import (
|
||||||
|
"bytes"
|
||||||
|
"fmt"
|
||||||
|
"runtime"
|
||||||
|
"strings"
|
||||||
|
|
||||||
|
"github.com/tal-tech/go-zero/tools/goctl/internal/version"
|
||||||
|
)
|
||||||
|
|
||||||
|
type env map[string]string
|
||||||
|
|
||||||
|
func (e env) string() string {
|
||||||
|
if e == nil {
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
w := bytes.NewBuffer(nil)
|
||||||
|
for k, v := range e {
|
||||||
|
w.WriteString(fmt.Sprintf("%s = %q\n", k, v))
|
||||||
|
}
|
||||||
|
|
||||||
|
return strings.TrimSuffix(w.String(), "\n")
|
||||||
|
}
|
||||||
|
|
||||||
|
func getEnv() env {
|
||||||
|
e := make(env)
|
||||||
|
e[os] = runtime.GOOS
|
||||||
|
e[arch] = runtime.GOARCH
|
||||||
|
e[goctlVersion] = version.BuildVersion
|
||||||
|
e[goVersion] = runtime.Version()
|
||||||
|
return e
|
||||||
|
}
|
||||||
42
tools/goctl/bug/issue.go
Normal file
42
tools/goctl/bug/issue.go
Normal file
@@ -0,0 +1,42 @@
|
|||||||
|
package bug
|
||||||
|
|
||||||
|
const issueTemplate = `
|
||||||
|
<!-- Please answer these questions before submitting your issue. Thanks! -->
|
||||||
|
|
||||||
|
### What category of issue (<code>goctl</code> or <code>sdk</code>)?
|
||||||
|
|
||||||
|
### What type of issue (<code>feature</code>|<code>bug</code>|<code>suggestion</code>)?
|
||||||
|
|
||||||
|
### What version of Goctl are you using (<code>goctl --version</code>)?
|
||||||
|
|
||||||
|
<pre>
|
||||||
|
$ goctl --version
|
||||||
|
%s
|
||||||
|
</pre>
|
||||||
|
|
||||||
|
### Does this issue reproduce with the latest release?
|
||||||
|
|
||||||
|
|
||||||
|
### What operating system and processor architecture are you using ?
|
||||||
|
<pre>
|
||||||
|
%s
|
||||||
|
</pre>
|
||||||
|
|
||||||
|
### What did you do?
|
||||||
|
|
||||||
|
<!--
|
||||||
|
If possible, provide a recipe for reproducing the error.
|
||||||
|
A complete runnable program is good.
|
||||||
|
A link on play.golang.org is best.
|
||||||
|
-->
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### What did you expect to see?
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### What did you see instead?
|
||||||
|
|
||||||
|
|
||||||
|
`
|
||||||
@@ -11,6 +11,7 @@ import (
|
|||||||
|
|
||||||
"github.com/logrusorgru/aurora"
|
"github.com/logrusorgru/aurora"
|
||||||
"github.com/tal-tech/go-zero/tools/goctl/util"
|
"github.com/tal-tech/go-zero/tools/goctl/util"
|
||||||
|
"github.com/tal-tech/go-zero/tools/goctl/util/pathx"
|
||||||
"github.com/urfave/cli"
|
"github.com/urfave/cli"
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -44,20 +45,27 @@ func DockerCommand(c *cli.Context) (err error) {
|
|||||||
goFile := c.String("go")
|
goFile := c.String("go")
|
||||||
home := c.String("home")
|
home := c.String("home")
|
||||||
version := c.String("version")
|
version := c.String("version")
|
||||||
|
remote := c.String("remote")
|
||||||
|
if len(remote) > 0 {
|
||||||
|
repo, _ := util.CloneIntoGitHome(remote)
|
||||||
|
if len(repo) > 0 {
|
||||||
|
home = repo
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if len(version) > 0 {
|
if len(version) > 0 {
|
||||||
version = version + "-"
|
version = version + "-"
|
||||||
}
|
}
|
||||||
|
|
||||||
if len(home) > 0 {
|
if len(home) > 0 {
|
||||||
util.RegisterGoctlHome(home)
|
pathx.RegisterGoctlHome(home)
|
||||||
}
|
}
|
||||||
|
|
||||||
if len(goFile) == 0 {
|
if len(goFile) == 0 {
|
||||||
return errors.New("-go can't be empty")
|
return errors.New("-go can't be empty")
|
||||||
}
|
}
|
||||||
|
|
||||||
if !util.FileExists(goFile) {
|
if !pathx.FileExists(goFile) {
|
||||||
return fmt.Errorf("file %q not found", goFile)
|
return fmt.Errorf("file %q not found", goFile)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -75,7 +83,7 @@ func DockerCommand(c *cli.Context) (err error) {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
projDir, ok := util.FindProjectPath(goFile)
|
projDir, ok := pathx.FindProjectPath(goFile)
|
||||||
if ok {
|
if ok {
|
||||||
fmt.Printf("Hint: run \"docker build ...\" command in dir:\n %s\n", projDir)
|
fmt.Printf("Hint: run \"docker build ...\" command in dir:\n %s\n", projDir)
|
||||||
}
|
}
|
||||||
@@ -122,13 +130,13 @@ func generateDockerfile(goFile string, port int, version string, args ...string)
|
|||||||
projPath = "."
|
projPath = "."
|
||||||
}
|
}
|
||||||
|
|
||||||
out, err := util.CreateIfNotExist(dockerfileName)
|
out, err := pathx.CreateIfNotExist(dockerfileName)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
defer out.Close()
|
defer out.Close()
|
||||||
|
|
||||||
text, err := util.LoadTemplate(category, dockerTemplateFile, dockerTemplate)
|
text, err := pathx.LoadTemplate(category, dockerTemplateFile, dockerTemplate)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
@@ -144,7 +152,7 @@ func generateDockerfile(goFile string, port int, version string, args ...string)
|
|||||||
Chinese: offset == cstOffset,
|
Chinese: offset == cstOffset,
|
||||||
GoRelPath: projPath,
|
GoRelPath: projPath,
|
||||||
GoFile: goFile,
|
GoFile: goFile,
|
||||||
ExeFile: util.FileNameWithoutExt(filepath.Base(goFile)),
|
ExeFile: pathx.FileNameWithoutExt(filepath.Base(goFile)),
|
||||||
HasPort: port > 0,
|
HasPort: port > 0,
|
||||||
Port: port,
|
Port: port,
|
||||||
Argument: builder.String(),
|
Argument: builder.String(),
|
||||||
@@ -158,9 +166,9 @@ func getFilePath(file string) (string, error) {
|
|||||||
return "", err
|
return "", err
|
||||||
}
|
}
|
||||||
|
|
||||||
projPath, ok := util.FindGoModPath(filepath.Join(wd, file))
|
projPath, ok := pathx.FindGoModPath(filepath.Join(wd, file))
|
||||||
if !ok {
|
if !ok {
|
||||||
projPath, err = util.PathFromGoSrc()
|
projPath, err = pathx.PathFromGoSrc()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return "", errors.New("no go.mod found, or not in GOPATH")
|
return "", errors.New("no go.mod found, or not in GOPATH")
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
package docker
|
package docker
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/tal-tech/go-zero/tools/goctl/util"
|
"github.com/tal-tech/go-zero/tools/goctl/util/pathx"
|
||||||
"github.com/urfave/cli"
|
"github.com/urfave/cli"
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -43,7 +43,7 @@ CMD ["./{{.ExeFile}}"{{.Argument}}]
|
|||||||
|
|
||||||
// Clean deletes all templates files
|
// Clean deletes all templates files
|
||||||
func Clean() error {
|
func Clean() error {
|
||||||
return util.Clean(category)
|
return pathx.Clean(category)
|
||||||
}
|
}
|
||||||
|
|
||||||
// GenTemplates creates docker template files
|
// GenTemplates creates docker template files
|
||||||
@@ -58,7 +58,7 @@ func Category() string {
|
|||||||
|
|
||||||
// RevertTemplate recovers the deleted template files
|
// RevertTemplate recovers the deleted template files
|
||||||
func RevertTemplate(name string) error {
|
func RevertTemplate(name string) error {
|
||||||
return util.CreateTemplate(category, name, dockerTemplate)
|
return pathx.CreateTemplate(category, name, dockerTemplate)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update deletes and creates new template files
|
// Update deletes and creates new template files
|
||||||
@@ -72,7 +72,7 @@ func Update() error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func initTemplate() error {
|
func initTemplate() error {
|
||||||
return util.InitTemplates(category, map[string]string{
|
return pathx.InitTemplates(category, map[string]string{
|
||||||
dockerTemplateFile: dockerTemplate,
|
dockerTemplateFile: dockerTemplate,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
37
tools/goctl/go.mod
Normal file
37
tools/goctl/go.mod
Normal file
@@ -0,0 +1,37 @@
|
|||||||
|
module github.com/tal-tech/go-zero/tools/goctl
|
||||||
|
|
||||||
|
go 1.17
|
||||||
|
|
||||||
|
require (
|
||||||
|
github.com/DATA-DOG/go-sqlmock v1.5.0
|
||||||
|
github.com/emicklei/proto v1.9.1
|
||||||
|
github.com/fatih/structtag v1.2.0
|
||||||
|
github.com/go-sql-driver/mysql v1.6.0
|
||||||
|
github.com/iancoleman/strcase v0.2.0
|
||||||
|
github.com/logrusorgru/aurora v2.0.3+incompatible
|
||||||
|
github.com/stretchr/testify v1.7.0
|
||||||
|
github.com/tal-tech/go-zero v1.2.5
|
||||||
|
github.com/urfave/cli v1.22.5
|
||||||
|
github.com/zeromicro/antlr v0.0.1
|
||||||
|
github.com/zeromicro/ddl-parser v0.0.0-20210712021150-63520aca7348
|
||||||
|
)
|
||||||
|
|
||||||
|
require (
|
||||||
|
github.com/alicebob/gopher-json v0.0.0-20200520072559-a9ecdc9d1d3a // indirect
|
||||||
|
github.com/alicebob/miniredis/v2 v2.16.0 // indirect
|
||||||
|
github.com/antlr/antlr4/runtime/Go/antlr v0.0.0-20210521184019-c5ad59b459ec // indirect
|
||||||
|
github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d // indirect
|
||||||
|
github.com/davecgh/go-spew v1.1.1 // indirect
|
||||||
|
github.com/go-redis/redis v6.15.9+incompatible // indirect
|
||||||
|
github.com/lib/pq v1.10.3 // indirect
|
||||||
|
github.com/pmezard/go-difflib v1.0.0 // indirect
|
||||||
|
github.com/russross/blackfriday/v2 v2.0.1 // indirect
|
||||||
|
github.com/shurcooL/sanitized_anchor_name v1.0.0 // indirect
|
||||||
|
github.com/spaolacci/murmur3 v1.1.0 // indirect
|
||||||
|
github.com/yuin/gopher-lua v0.0.0-20200816102855-ee81675732da // indirect
|
||||||
|
go.opentelemetry.io/otel v1.1.0 // indirect
|
||||||
|
go.opentelemetry.io/otel/trace v1.1.0 // indirect
|
||||||
|
go.uber.org/automaxprocs v1.4.0 // indirect
|
||||||
|
gopkg.in/yaml.v2 v2.4.0 // indirect
|
||||||
|
gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b // indirect
|
||||||
|
)
|
||||||
693
tools/goctl/go.sum
Normal file
693
tools/goctl/go.sum
Normal file
@@ -0,0 +1,693 @@
|
|||||||
|
cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw=
|
||||||
|
cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw=
|
||||||
|
cloud.google.com/go v0.38.0/go.mod h1:990N+gfupTy94rShfmMCWGDn0LpTmnzTp2qbd1dvSRU=
|
||||||
|
cloud.google.com/go v0.44.1/go.mod h1:iSa0KzasP4Uvy3f1mN/7PiObzGgflwredwwASm/v6AU=
|
||||||
|
cloud.google.com/go v0.44.2/go.mod h1:60680Gw3Yr4ikxnPRS/oxxkBccT6SA1yMk63TGekxKY=
|
||||||
|
cloud.google.com/go v0.45.1/go.mod h1:RpBamKRgapWJb87xiFSdk4g1CME7QZg3uwTez+TSTjc=
|
||||||
|
cloud.google.com/go v0.46.3/go.mod h1:a6bKKbmY7er1mI7TEI4lsAkts/mkhTSZK8w33B4RAg0=
|
||||||
|
cloud.google.com/go v0.50.0/go.mod h1:r9sluTvynVuxRIOHXQEHMFffphuXHOMZMycpNR5e6To=
|
||||||
|
cloud.google.com/go v0.52.0/go.mod h1:pXajvRH/6o3+F9jDHZWQ5PbGhn+o8w9qiu/CffaVdO4=
|
||||||
|
cloud.google.com/go v0.53.0/go.mod h1:fp/UouUEsRkN6ryDKNW/Upv/JBKnv6WDthjR6+vze6M=
|
||||||
|
cloud.google.com/go v0.54.0/go.mod h1:1rq2OEkV3YMf6n/9ZvGWI3GWw0VoqH/1x2nd8Is/bPc=
|
||||||
|
cloud.google.com/go/bigquery v1.0.1/go.mod h1:i/xbL2UlR5RvWAURpBYZTtm/cXjCha9lbfbpx4poX+o=
|
||||||
|
cloud.google.com/go/bigquery v1.3.0/go.mod h1:PjpwJnslEMmckchkHFfq+HTD2DmtT67aNFKH1/VBDHE=
|
||||||
|
cloud.google.com/go/bigquery v1.4.0/go.mod h1:S8dzgnTigyfTmLBfrtrhyYhwRxG72rYxvftPBK2Dvzc=
|
||||||
|
cloud.google.com/go/datastore v1.0.0/go.mod h1:LXYbyblFSglQ5pkeyhO+Qmw7ukd3C+pD7TKLgZqpHYE=
|
||||||
|
cloud.google.com/go/datastore v1.1.0/go.mod h1:umbIZjpQpHh4hmRpGhH4tLFup+FVzqBi1b3c64qFpCk=
|
||||||
|
cloud.google.com/go/pubsub v1.0.1/go.mod h1:R0Gpsv3s54REJCy4fxDixWD93lHJMoZTyQ2kNxGRt3I=
|
||||||
|
cloud.google.com/go/pubsub v1.1.0/go.mod h1:EwwdRX2sKPjnvnqCa270oGRyludottCI76h+R3AArQw=
|
||||||
|
cloud.google.com/go/pubsub v1.2.0/go.mod h1:jhfEVHT8odbXTkndysNHCcx0awwzvfOlguIAii9o8iA=
|
||||||
|
cloud.google.com/go/storage v1.0.0/go.mod h1:IhtSnM/ZTZV8YYJWCY8RULGVqBDmpoyjwiyrjsg+URw=
|
||||||
|
cloud.google.com/go/storage v1.5.0/go.mod h1:tpKbwo567HUNpVclU5sGELwQWBDZ8gh0ZeosJ0Rtdos=
|
||||||
|
cloud.google.com/go/storage v1.6.0/go.mod h1:N7U0C8pVQ/+NIKOBQyamJIeKQKkZ+mxpohlUTyfDhBk=
|
||||||
|
dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU=
|
||||||
|
github.com/Azure/go-autorest v14.2.0+incompatible/go.mod h1:r+4oMnoxhatjLLJ6zxSWATqVooLgysK6ZNox3g/xq24=
|
||||||
|
github.com/Azure/go-autorest/autorest v0.11.1/go.mod h1:JFgpikqFJ/MleTTxwepExTKnFUKKszPS8UavbQYUMuw=
|
||||||
|
github.com/Azure/go-autorest/autorest/adal v0.9.0/go.mod h1:/c022QCutn2P7uY+/oQWWNcK9YU+MH96NgK+jErpbcg=
|
||||||
|
github.com/Azure/go-autorest/autorest/adal v0.9.5/go.mod h1:B7KF7jKIeC9Mct5spmyCB/A8CG/sEz1vwIRGv/bbw7A=
|
||||||
|
github.com/Azure/go-autorest/autorest/date v0.3.0/go.mod h1:BI0uouVdmngYNUzGWeSYnokU+TrmwEsOqdt8Y6sso74=
|
||||||
|
github.com/Azure/go-autorest/autorest/mocks v0.4.0/go.mod h1:LTp+uSrOhSkaKrUy935gNZuuIPPVsHlr9DSOxSayd+k=
|
||||||
|
github.com/Azure/go-autorest/autorest/mocks v0.4.1/go.mod h1:LTp+uSrOhSkaKrUy935gNZuuIPPVsHlr9DSOxSayd+k=
|
||||||
|
github.com/Azure/go-autorest/logger v0.2.0/go.mod h1:T9E3cAhj2VqvPOtCYAvby9aBXkZmbF5NWuPV8+WeEW8=
|
||||||
|
github.com/Azure/go-autorest/tracing v0.6.0/go.mod h1:+vhtPC754Xsa23ID7GlGsrdKBpUA79WCAKPPZVC2DeU=
|
||||||
|
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
|
||||||
|
github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo=
|
||||||
|
github.com/ClickHouse/clickhouse-go v1.5.1/go.mod h1:EaI/sW7Azgz9UATzd5ZdZHRUhHgv5+JMS9NSr2smCJI=
|
||||||
|
github.com/DATA-DOG/go-sqlmock v1.5.0 h1:Shsta01QNfFxHCfpW6YH2STWB0MudeXXEWMr20OEh60=
|
||||||
|
github.com/DATA-DOG/go-sqlmock v1.5.0/go.mod h1:f/Ixk793poVmq4qj/V1dPUg2JEAKC73Q5eFN3EC/SaM=
|
||||||
|
github.com/NYTimes/gziphandler v0.0.0-20170623195520-56545f4a5d46/go.mod h1:3wb06e3pkSAbeQ52E9H9iFoQsEEwGN64994WTCIhntQ=
|
||||||
|
github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU=
|
||||||
|
github.com/PuerkitoBio/purell v1.1.1/go.mod h1:c11w/QuzBsJSee3cPx9rAFu61PvFxuPbtSwDGJws/X0=
|
||||||
|
github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578/go.mod h1:uGdkoq3SwY9Y+13GIhn11/XLaGBb4BfwItxLd5jeuXE=
|
||||||
|
github.com/Shopify/sarama v1.19.0/go.mod h1:FVkBWblsNy7DGZRfXLU0O9RCGt5g3g3yEuWXgklEdEo=
|
||||||
|
github.com/Shopify/sarama v1.30.0/go.mod h1:zujlQQx1kzHsh4jfV1USnptCQrHAEZ2Hk8fTKCulPVs=
|
||||||
|
github.com/Shopify/toxiproxy v2.1.4+incompatible/go.mod h1:OXgGpZ6Cli1/URJOF1DMxUHB2q5Ap20/P/eIdh4G0pI=
|
||||||
|
github.com/Shopify/toxiproxy/v2 v2.1.6-0.20210914104332-15ea381dcdae/go.mod h1:/cvHQkZ1fst0EmZnA5dFtiQdWCNCFYzb+uE2vqVgvx0=
|
||||||
|
github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc=
|
||||||
|
github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc=
|
||||||
|
github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0=
|
||||||
|
github.com/alecthomas/units v0.0.0-20190717042225-c3de453c63f4/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0=
|
||||||
|
github.com/alecthomas/units v0.0.0-20190924025748-f65c72e2690d/go.mod h1:rBZYJk541a8SKzHPHnH3zbiI+7dagKZ0cgpgrD7Fyho=
|
||||||
|
github.com/alicebob/gopher-json v0.0.0-20200520072559-a9ecdc9d1d3a h1:HbKu58rmZpUGpz5+4FfNmIU+FmZg2P3Xaj2v2bfNWmk=
|
||||||
|
github.com/alicebob/gopher-json v0.0.0-20200520072559-a9ecdc9d1d3a/go.mod h1:SGnFV6hVsYE877CKEZ6tDNTjaSXYUk6QqoIK6PrAtcc=
|
||||||
|
github.com/alicebob/miniredis/v2 v2.16.0 h1:ALkyFg7bSTEd1Mkrb4ppq4fnwjklA59dVtIehXCUZkU=
|
||||||
|
github.com/alicebob/miniredis/v2 v2.16.0/go.mod h1:gquAfGbzn92jvtrSC69+6zZnwSODVXVpYDRaGhWaL6I=
|
||||||
|
github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kdvxnR2qWY=
|
||||||
|
github.com/antlr/antlr4/runtime/Go/antlr v0.0.0-20210521184019-c5ad59b459ec h1:EEyRvzmpEUZ+I8WmD5cw/vY8EqhambkOqy5iFr0908A=
|
||||||
|
github.com/antlr/antlr4/runtime/Go/antlr v0.0.0-20210521184019-c5ad59b459ec/go.mod h1:F7bn7fEU90QkQ3tnmaTx3LTKLEDqnwWODIYppRQ5hnY=
|
||||||
|
github.com/asaskevich/govalidator v0.0.0-20190424111038-f61b66f89f4a/go.mod h1:lB+ZfQJz7igIIfQNfa7Ml4HSf2uFQQRzpGGRXenZAgY=
|
||||||
|
github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q=
|
||||||
|
github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8=
|
||||||
|
github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw=
|
||||||
|
github.com/bkaradzic/go-lz4 v1.0.0/go.mod h1:0YdlkowM3VswSROI7qDxhRvJ3sLhlFrRRwjwegp5jy4=
|
||||||
|
github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU=
|
||||||
|
github.com/cespare/xxhash v1.1.0/go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghfAqPWnc=
|
||||||
|
github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs=
|
||||||
|
github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWRnGsAI=
|
||||||
|
github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e/go.mod h1:nSuG5e5PlCu98SY8svDHJxuZscDgtXS6KTTbou5AhLI=
|
||||||
|
github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1/go.mod h1:Q3SI9o4m/ZMnBNeIyt5eFwwo7qiLfzFZmjNmxjkiQlU=
|
||||||
|
github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw=
|
||||||
|
github.com/cloudflare/golz4 v0.0.0-20150217214814-ef862a3cdc58/go.mod h1:EOBUe0h4xcZ5GoxqC5SDxFQ8gwyZPKQoEzownBlhI80=
|
||||||
|
github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc=
|
||||||
|
github.com/cncf/udpa/go v0.0.0-20201120205902-5459f2c99403/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk=
|
||||||
|
github.com/cncf/udpa/go v0.0.0-20210930031921-04548b0d99d4/go.mod h1:6pvJx4me5XPnfI9Z40ddWsdw2W/uZgQLFXToKeRcDiI=
|
||||||
|
github.com/cncf/xds/go v0.0.0-20210312221358-fbca930ec8ed/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs=
|
||||||
|
github.com/cncf/xds/go v0.0.0-20210805033703-aa0b78936158/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs=
|
||||||
|
github.com/cncf/xds/go v0.0.0-20210922020428-25de7278fc84/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs=
|
||||||
|
github.com/cncf/xds/go v0.0.0-20211011173535-cb28da3451f1/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs=
|
||||||
|
github.com/coreos/go-semver v0.3.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk=
|
||||||
|
github.com/coreos/go-systemd/v22 v22.3.2/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSVTIJ3seZv2GcEnc=
|
||||||
|
github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d h1:U+s90UTSYgptZMwQh2aRr3LuazLJIa+Pg3Kc1ylSYVY=
|
||||||
|
github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU=
|
||||||
|
github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E=
|
||||||
|
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||||
|
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
|
||||||
|
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||||
|
github.com/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ=
|
||||||
|
github.com/docker/spdystream v0.0.0-20160310174837-449fdfce4d96/go.mod h1:Qh8CwZgvJUkLughtfhJv5dyTYa91l1fOUCrgjqmcifM=
|
||||||
|
github.com/docopt/docopt-go v0.0.0-20180111231733-ee0de3bc6815/go.mod h1:WwZ+bS3ebgob9U8Nd0kOddGdZWjyMGR8Wziv+TBNwSE=
|
||||||
|
github.com/dustin/go-humanize v1.0.0/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk=
|
||||||
|
github.com/eapache/go-resiliency v1.1.0/go.mod h1:kFI+JgMyC7bLPUVY133qvEBtVayf5mFgVsvEsIPBvNs=
|
||||||
|
github.com/eapache/go-resiliency v1.2.0/go.mod h1:kFI+JgMyC7bLPUVY133qvEBtVayf5mFgVsvEsIPBvNs=
|
||||||
|
github.com/eapache/go-xerial-snappy v0.0.0-20180814174437-776d5712da21/go.mod h1:+020luEh2TKB4/GOp8oxxtq0Daoen/Cii55CzbTV6DU=
|
||||||
|
github.com/eapache/queue v1.1.0/go.mod h1:6eCeP0CKFpHLu8blIFXhExK/dRa7WDZfr6jVFPTqq+I=
|
||||||
|
github.com/elazarl/goproxy v0.0.0-20180725130230-947c36da3153/go.mod h1:/Zj4wYkgs4iZTTu3o/KG3Itv/qCCa8VVMlb3i9OVuzc=
|
||||||
|
github.com/emicklei/go-restful v0.0.0-20170410110728-ff4f55a20633/go.mod h1:otzb+WCGbkyDHkqmQmT5YD2WR4BBwUdeQoFo8l/7tVs=
|
||||||
|
github.com/emicklei/proto v1.9.1 h1:MUgjFo5xlMwYv72TnF5xmmdKZ04u+dVbv6wdARv16D8=
|
||||||
|
github.com/emicklei/proto v1.9.1/go.mod h1:rn1FgRS/FANiZdD2djyH7TMA9jdRDcYQ9IEN9yvjX0A=
|
||||||
|
github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4=
|
||||||
|
github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4=
|
||||||
|
github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98=
|
||||||
|
github.com/envoyproxy/go-control-plane v0.9.9-0.20201210154907-fd9021fe5dad/go.mod h1:cXg6YxExXjJnVBQHBLXeUAgxn2UodCpnH306RInaBQk=
|
||||||
|
github.com/envoyproxy/go-control-plane v0.9.9-0.20210217033140-668b12f5399d/go.mod h1:cXg6YxExXjJnVBQHBLXeUAgxn2UodCpnH306RInaBQk=
|
||||||
|
github.com/envoyproxy/go-control-plane v0.9.9-0.20210512163311-63b5d3c536b0/go.mod h1:hliV/p42l8fGbc6Y9bQ70uLwIvmJyVE5k4iMKlh8wCQ=
|
||||||
|
github.com/envoyproxy/go-control-plane v0.9.10-0.20210907150352-cf90f659a021/go.mod h1:AFq3mo9L8Lqqiid3OhADV3RfLJnjiw63cSpi+fDTRC0=
|
||||||
|
github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c=
|
||||||
|
github.com/evanphx/json-patch v4.9.0+incompatible/go.mod h1:50XU6AFN0ol/bzJsmQLiYLvXMP4fmwYFNcr97nuDLSk=
|
||||||
|
github.com/fatih/color v1.9.0/go.mod h1:eQcE1qtQxscV5RaZvpXrrb8Drkc3/DdQ+uUYCNjL+zU=
|
||||||
|
github.com/fatih/structtag v1.2.0 h1:/OdNE99OxoI/PqaW/SuSK9uxxT3f/tcSZgon/ssNSx4=
|
||||||
|
github.com/fatih/structtag v1.2.0/go.mod h1:mBJUNpUnHmRKrKlQQlmCrh5PuhftFbNv8Ys4/aAZl94=
|
||||||
|
github.com/form3tech-oss/jwt-go v3.2.2+incompatible/go.mod h1:pbq4aXjuKjdthFRnoDwaVPLA+WlJuPGy+QneDUgJi2k=
|
||||||
|
github.com/fortytw2/leaktest v1.3.0/go.mod h1:jDsjWgpAGjm2CA7WthBh/CdZYEPF31XHquHwclZch5g=
|
||||||
|
github.com/frankban/quicktest v1.11.3/go.mod h1:wRf/ReqHper53s+kmmSZizM8NamnL3IM0I9ntUbOk+k=
|
||||||
|
github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo=
|
||||||
|
github.com/fsnotify/fsnotify v1.4.9 h1:hsms1Qyu0jgnwNXIxa+/V/PDsU6CfLf6CNO8H7IWoS4=
|
||||||
|
github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ=
|
||||||
|
github.com/ghodss/yaml v0.0.0-20150909031657-73d445a93680/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04=
|
||||||
|
github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04=
|
||||||
|
github.com/globalsign/mgo v0.0.0-20181015135952-eeefdecb41b8/go.mod h1:xkRDCp4j0OGD1HRkm4kmhM+pmpv3AKq5SU7GMg4oO/Q=
|
||||||
|
github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU=
|
||||||
|
github.com/go-gl/glfw/v3.3/glfw v0.0.0-20191125211704-12ad95a8df72/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8=
|
||||||
|
github.com/go-gl/glfw/v3.3/glfw v0.0.0-20200222043503-6f7a984d4dc4/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8=
|
||||||
|
github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as=
|
||||||
|
github.com/go-kit/kit v0.9.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as=
|
||||||
|
github.com/go-kit/log v0.1.0/go.mod h1:zbhenjAZHb184qTLMA9ZjW7ThYL0H2mk7Q6pNt4vbaY=
|
||||||
|
github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE=
|
||||||
|
github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk=
|
||||||
|
github.com/go-logfmt/logfmt v0.5.0/go.mod h1:wCYkCAKZfumFQihp8CzCvQ3paCTfi41vtzG1KdI/P7A=
|
||||||
|
github.com/go-logr/logr v0.1.0/go.mod h1:ixOQHD9gLJUVQQ2ZOR7zLEifBX6tGkNJF4QyIY7sIas=
|
||||||
|
github.com/go-logr/logr v0.2.0/go.mod h1:z6/tIYblkpsD+a4lm/fGIIU9mZ+XfAiaFtq7xTgseGU=
|
||||||
|
github.com/go-openapi/jsonpointer v0.19.2/go.mod h1:3akKfEdA7DF1sugOqz1dVQHBcuDBPKZGEoHC/NkiQRg=
|
||||||
|
github.com/go-openapi/jsonpointer v0.19.3/go.mod h1:Pl9vOtqEWErmShwVjC8pYs9cog34VGT37dQOVbmoatg=
|
||||||
|
github.com/go-openapi/jsonreference v0.19.2/go.mod h1:jMjeRr2HHw6nAVajTXJ4eiUwohSTlpa0o73RUL1owJc=
|
||||||
|
github.com/go-openapi/jsonreference v0.19.3/go.mod h1:rjx6GuL8TTa9VaixXglHmQmIL98+wF9xc8zWvFonSJ8=
|
||||||
|
github.com/go-openapi/spec v0.19.3/go.mod h1:FpwSN1ksY1eteniUU7X0N/BgJ7a4WvBFVA8Lj9mJglo=
|
||||||
|
github.com/go-openapi/swag v0.19.2/go.mod h1:POnQmlKehdgb5mhVOsnJFsivZCEZ/vjK9gh66Z9tfKk=
|
||||||
|
github.com/go-openapi/swag v0.19.5/go.mod h1:POnQmlKehdgb5mhVOsnJFsivZCEZ/vjK9gh66Z9tfKk=
|
||||||
|
github.com/go-redis/redis v6.15.9+incompatible h1:K0pv1D7EQUjfyoMql+r/jZqCLizCGKFlFgcHWWmHQjg=
|
||||||
|
github.com/go-redis/redis v6.15.9+incompatible/go.mod h1:NAIEuMOZ/fxfXJIrKDQDz8wamY7mA7PouImQ2Jvg6kA=
|
||||||
|
github.com/go-sql-driver/mysql v1.4.0/go.mod h1:zAC/RDZ24gD3HViQzih4MyKcchzm+sOG5ZlKdlhCg5w=
|
||||||
|
github.com/go-sql-driver/mysql v1.6.0 h1:BCTh4TKNUYmOmMUcQ3IipzF5prigylS7XXjEkfCHuOE=
|
||||||
|
github.com/go-sql-driver/mysql v1.6.0/go.mod h1:DCzpHaOWr8IXmIStZouvnhqoel9Qv2LBy8hT2VhHyBg=
|
||||||
|
github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY=
|
||||||
|
github.com/go-task/slim-sprig v0.0.0-20210107165309-348f09dbbbc0/go.mod h1:fyg7847qk6SyHyPtNmDHnmrv/HOrqktSC+C9fM+CJOE=
|
||||||
|
github.com/godbus/dbus/v5 v5.0.4/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA=
|
||||||
|
github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ=
|
||||||
|
github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q=
|
||||||
|
github.com/golang-jwt/jwt v3.2.1+incompatible/go.mod h1:8pz2t5EyA70fFQQSrl6XZXzqecmYZeUEB8OUGHkxJ+I=
|
||||||
|
github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q=
|
||||||
|
github.com/golang/groupcache v0.0.0-20190702054246-869f871628b6/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc=
|
||||||
|
github.com/golang/groupcache v0.0.0-20191227052852-215e87163ea7/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc=
|
||||||
|
github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc=
|
||||||
|
github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A=
|
||||||
|
github.com/golang/mock v1.2.0/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A=
|
||||||
|
github.com/golang/mock v1.3.1/go.mod h1:sBzyDLLjw3U8JLTeZvSv8jJB+tU5PVekmnlKIyFUx0Y=
|
||||||
|
github.com/golang/mock v1.4.0/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw=
|
||||||
|
github.com/golang/mock v1.4.1/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw=
|
||||||
|
github.com/golang/mock v1.6.0/go.mod h1:p6yTPP+5HYm5mzsMV8JkE6ZKdX+/wYM6Hr+LicevLPs=
|
||||||
|
github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
|
||||||
|
github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
|
||||||
|
github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
|
||||||
|
github.com/golang/protobuf v1.3.3/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw=
|
||||||
|
github.com/golang/protobuf v1.3.4/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw=
|
||||||
|
github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8=
|
||||||
|
github.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:xKAWHe0F5eneWXFV3EuXVDTCmh+JuBKY0li0aMyXATA=
|
||||||
|
github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrUpVNzEA03Pprs=
|
||||||
|
github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod h1:WU3c8KckQ9AFe+yFwt9sWVRKCVIyN9cPHBJSNnbL67w=
|
||||||
|
github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0=
|
||||||
|
github.com/golang/protobuf v1.4.1/go.mod h1:U8fpvMrcmy5pZrNK1lt4xCsGvpyWQ/VVv6QDs8UjoX8=
|
||||||
|
github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI=
|
||||||
|
github.com/golang/protobuf v1.4.3/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI=
|
||||||
|
github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk=
|
||||||
|
github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY=
|
||||||
|
github.com/golang/snappy v0.0.0-20180518054509-2e65f85255db/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q=
|
||||||
|
github.com/golang/snappy v0.0.4/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q=
|
||||||
|
github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ=
|
||||||
|
github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ=
|
||||||
|
github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M=
|
||||||
|
github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
|
||||||
|
github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
|
||||||
|
github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
|
||||||
|
github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
|
||||||
|
github.com/google/go-cmp v0.5.2/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
|
||||||
|
github.com/google/go-cmp v0.5.4/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
|
||||||
|
github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
|
||||||
|
github.com/google/go-cmp v0.5.6 h1:BKbKCqvP6I+rmFHt06ZmyQtvB8xAkWdhFyr0ZUNZcxQ=
|
||||||
|
github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
|
||||||
|
github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
|
||||||
|
github.com/google/gofuzz v1.1.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
|
||||||
|
github.com/google/martian v2.1.0+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXiIaQGbYVAs8BPL6v8lEs=
|
||||||
|
github.com/google/pprof v0.0.0-20181206194817-3ea8567a2e57/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc=
|
||||||
|
github.com/google/pprof v0.0.0-20190515194954-54271f7e092f/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc=
|
||||||
|
github.com/google/pprof v0.0.0-20191218002539-d4f498aebedc/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM=
|
||||||
|
github.com/google/pprof v0.0.0-20200212024743-f11f1df84d12/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM=
|
||||||
|
github.com/google/pprof v0.0.0-20200229191704-1ebb73c60ed3/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM=
|
||||||
|
github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI=
|
||||||
|
github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
|
||||||
|
github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
|
||||||
|
github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
|
||||||
|
github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg=
|
||||||
|
github.com/googleapis/gax-go/v2 v2.0.5/go.mod h1:DWXyrwAJ9X0FpwwEdw+IPEYBICEFu5mhpdKc/us6bOk=
|
||||||
|
github.com/googleapis/gnostic v0.4.1/go.mod h1:LRhVm6pbyptWbWbuZ38d1eyptfvIytN3ir6b65WBswg=
|
||||||
|
github.com/gorilla/context v1.1.1/go.mod h1:kBGZzfjB9CEq2AlWe17Uuf7NDRt0dE0s8S51q0aT7Yg=
|
||||||
|
github.com/gorilla/mux v1.6.2/go.mod h1:1lud6UwP+6orDFRuTfBEV8e9/aOM/c4fVVCaMa2zaAs=
|
||||||
|
github.com/gorilla/mux v1.8.0/go.mod h1:DVbg23sWSpFRCP0SfiEN6jmj59UnW/n46BH5rLB71So=
|
||||||
|
github.com/gorilla/securecookie v1.1.1/go.mod h1:ra0sb63/xPlUeL+yeDciTfxMRAA+MP+HVt/4epWDjd4=
|
||||||
|
github.com/gorilla/sessions v1.2.1/go.mod h1:dk2InVEVJ0sfLlnXv9EAgkf6ecYs/i80K/zI+bUmuGM=
|
||||||
|
github.com/gregjones/httpcache v0.0.0-20180305231024-9cad4c3443a7/go.mod h1:FecbI9+v66THATjSRHfNgh1IVFe/9kFxbXtjV0ctIMA=
|
||||||
|
github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0/go.mod h1:8NvIoxWQoOIhqOTXgfV/d3M/q6VIi02HzZEHgUlZvzk=
|
||||||
|
github.com/grpc-ecosystem/grpc-gateway v1.16.0/go.mod h1:BDjrQk3hbvj6Nolgz8mAMFbcEtjT1g+wF4CSlocrBnw=
|
||||||
|
github.com/h2non/parth v0.0.0-20190131123155-b4df798d6542 h1:2VTzZjLZBgl62/EtslCrtky5vbi9dd7HrQPQIx6wqiw=
|
||||||
|
github.com/h2non/parth v0.0.0-20190131123155-b4df798d6542/go.mod h1:Ow0tF8D4Kplbc8s8sSb3V2oUCygFHVp8gC3Dn6U4MNI=
|
||||||
|
github.com/hashicorp/go-uuid v1.0.2/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro=
|
||||||
|
github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8=
|
||||||
|
github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8=
|
||||||
|
github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU=
|
||||||
|
github.com/iancoleman/strcase v0.2.0 h1:05I4QRnGpI0m37iZQRuskXh+w77mr6Z41lwQzuHLwW0=
|
||||||
|
github.com/iancoleman/strcase v0.2.0/go.mod h1:iwCmte+B7n89clKwxIoIXy/HfoL7AsD47ZCWhYzw7ho=
|
||||||
|
github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc=
|
||||||
|
github.com/imdario/mergo v0.3.5/go.mod h1:2EnlNZ0deacrJVfApfmtdGgDfMuh/nq6Ok1EcJh5FfA=
|
||||||
|
github.com/jcmturner/aescts/v2 v2.0.0/go.mod h1:AiaICIRyfYg35RUkr8yESTqvSy7csK90qZ5xfvvsoNs=
|
||||||
|
github.com/jcmturner/dnsutils/v2 v2.0.0/go.mod h1:b0TnjGOvI/n42bZa+hmXL+kFJZsFT7G4t3HTlQ184QM=
|
||||||
|
github.com/jcmturner/gofork v1.0.0/go.mod h1:MK8+TM0La+2rjBD4jE12Kj1pCCxK7d2LK/UM3ncEo0o=
|
||||||
|
github.com/jcmturner/goidentity/v6 v6.0.1/go.mod h1:X1YW3bgtvwAXju7V3LCIMpY0Gbxyjn/mY9zx4tFonSg=
|
||||||
|
github.com/jcmturner/gokrb5/v8 v8.4.2/go.mod h1:sb+Xq/fTY5yktf/VxLsE3wlfPqQjp0aWNYyvBVK62bc=
|
||||||
|
github.com/jcmturner/rpc/v2 v2.0.3/go.mod h1:VUJYCIDm3PVOEHw8sgt091/20OJjskO/YJki3ELg/Hc=
|
||||||
|
github.com/jmoiron/sqlx v1.2.0/go.mod h1:1FEQNm3xlJgrMD+FBdI9+xvCksHtbpVBBw5dYhBSsks=
|
||||||
|
github.com/jpillora/backoff v1.0.0/go.mod h1:J/6gKK9jxlEcS3zixgDgUAsiuZ7yrSoa/FX5e0EB2j4=
|
||||||
|
github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU=
|
||||||
|
github.com/json-iterator/go v1.1.10/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4=
|
||||||
|
github.com/json-iterator/go v1.1.11/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4=
|
||||||
|
github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024/go.mod h1:6v2b51hI/fHJwM22ozAgKL4VKDeJcHhJFhtBdhmNjmU=
|
||||||
|
github.com/jstemmer/go-junit-report v0.9.1/go.mod h1:Brl9GWCQeLvo8nXZwPNNblvFj/XSXhF0NWZEnDohbsk=
|
||||||
|
github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w=
|
||||||
|
github.com/julienschmidt/httprouter v1.3.0/go.mod h1:JR6WtHb+2LUe8TCKY3cZOxFyyO8IZAc4RVcycCCAKdM=
|
||||||
|
github.com/justinas/alice v1.2.0/go.mod h1:fN5HRH/reO/zrUflLfTN43t3vXvKzvZIENsNEe7i7qA=
|
||||||
|
github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8=
|
||||||
|
github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck=
|
||||||
|
github.com/klauspost/compress v1.13.6/go.mod h1:/3/Vjq9QcHkK5uEr5lBEmyoZ1iFhe47etQ6QUkpK6sk=
|
||||||
|
github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ=
|
||||||
|
github.com/konsorten/go-windows-terminal-sequences v1.0.3/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ=
|
||||||
|
github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc=
|
||||||
|
github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
|
||||||
|
github.com/kr/pretty v0.2.0/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI=
|
||||||
|
github.com/kr/pretty v0.2.1 h1:Fmg33tUaq4/8ym9TJN1x7sLJnHVwhP33CNkpYV/7rwI=
|
||||||
|
github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI=
|
||||||
|
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
|
||||||
|
github.com/kr/pty v1.1.5/go.mod h1:9r2w37qlBe7rQ6e1fg1S/9xpWHSnaqNdHD3WcMdbPDA=
|
||||||
|
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
|
||||||
|
github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
|
||||||
|
github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
|
||||||
|
github.com/lib/pq v1.0.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo=
|
||||||
|
github.com/lib/pq v1.10.3 h1:v9QZf2Sn6AmjXtQeFpdoq/eaNtYP6IN+7lcrygsIAtg=
|
||||||
|
github.com/lib/pq v1.10.3/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o=
|
||||||
|
github.com/logrusorgru/aurora v2.0.3+incompatible h1:tOpm7WcpBTn4fjmVfgpQq0EfczGlG91VSDkswnjF5A8=
|
||||||
|
github.com/logrusorgru/aurora v2.0.3+incompatible/go.mod h1:7rIyQOR62GCctdiQpZ/zOJlFyk6y+94wXzv6RNZgaR4=
|
||||||
|
github.com/mailru/easyjson v0.0.0-20190614124828-94de47d64c63/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc=
|
||||||
|
github.com/mailru/easyjson v0.0.0-20190626092158-b2ccc519800e/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc=
|
||||||
|
github.com/mattn/go-colorable v0.1.4/go.mod h1:U0ppj6V5qS13XJ6of8GYAs25YV2eR4EVcfRqFIhoBtE=
|
||||||
|
github.com/mattn/go-colorable v0.1.6/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc=
|
||||||
|
github.com/mattn/go-isatty v0.0.8/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s=
|
||||||
|
github.com/mattn/go-isatty v0.0.11/go.mod h1:PhnuNfih5lzO57/f3n+odYbM4JtupLOxQOAqxQCu2WE=
|
||||||
|
github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU=
|
||||||
|
github.com/mattn/go-runewidth v0.0.9/go.mod h1:H031xJmbD/WCDINGzjvQ9THkh0rPKHF+m2gUSrubnMI=
|
||||||
|
github.com/mattn/go-sqlite3 v1.9.0/go.mod h1:FPy6KqzDD04eiIsT53CuJW3U88zkxoIYsOqkbpncsNc=
|
||||||
|
github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0=
|
||||||
|
github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y=
|
||||||
|
github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
|
||||||
|
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
|
||||||
|
github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0=
|
||||||
|
github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0=
|
||||||
|
github.com/munnerz/goautoneg v0.0.0-20120707110453-a547fc61f48d/go.mod h1:+n7T8mK8HuQTcFwEeznm/DIxMOiR9yIdICNftLE1DvQ=
|
||||||
|
github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U=
|
||||||
|
github.com/mwitkow/go-conntrack v0.0.0-20190716064945-2f068394615f/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U=
|
||||||
|
github.com/mxk/go-flowrate v0.0.0-20140419014527-cca7078d478f/go.mod h1:ZdcZmHo+o7JKHSa8/e818NopupXU1YMK5fe1lsApnBw=
|
||||||
|
github.com/nbio/st v0.0.0-20140626010706-e9e8d9816f32/go.mod h1:9wM+0iRr9ahx58uYLpLIr5fm8diHn0JbqRycJi6w0Ms=
|
||||||
|
github.com/nxadm/tail v1.4.4/go.mod h1:kenIhsEOeOJmVchQTgglprH7qJGnHDVpk1VPCcaMI8A=
|
||||||
|
github.com/nxadm/tail v1.4.8 h1:nPr65rt6Y5JFSKQO7qToXr7pePgD6Gwiw05lkbyAQTE=
|
||||||
|
github.com/nxadm/tail v1.4.8/go.mod h1:+ncqLTQzXmGhMZNUePPaPqPvBxHAIsmXswZKocGu+AU=
|
||||||
|
github.com/olekukonko/tablewriter v0.0.5/go.mod h1:hPp6KlRPjbx+hW8ykQs1w3UBbZlj6HuIJcUGPhkA7kY=
|
||||||
|
github.com/onsi/ginkgo v0.0.0-20170829012221-11459a886d9c/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE=
|
||||||
|
github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE=
|
||||||
|
github.com/onsi/ginkgo v1.7.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE=
|
||||||
|
github.com/onsi/ginkgo v1.11.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE=
|
||||||
|
github.com/onsi/ginkgo v1.12.1/go.mod h1:zj2OWP4+oCPe1qIXoGWkgMRwljMUYCdkwsT2108oapk=
|
||||||
|
github.com/onsi/ginkgo v1.16.4/go.mod h1:dX+/inL/fNMqNlz0e9LfyB9TswhZpCVdJM/Z6Vvnwo0=
|
||||||
|
github.com/onsi/ginkgo v1.16.5 h1:8xi0RTUf59SOSfEtZMvwTvXYMzG4gV23XVHOZiXNtnE=
|
||||||
|
github.com/onsi/ginkgo v1.16.5/go.mod h1:+E8gABHa3K6zRBolWtd+ROzc/U5bkGt0FwiG042wbpU=
|
||||||
|
github.com/onsi/gomega v0.0.0-20170829124025-dcabb60a477c/go.mod h1:C1qb7wdrVGGVU+Z6iS04AVkA3Q65CEZX59MT0QO5uiA=
|
||||||
|
github.com/onsi/gomega v1.4.3/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY=
|
||||||
|
github.com/onsi/gomega v1.7.0/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY=
|
||||||
|
github.com/onsi/gomega v1.7.1/go.mod h1:XdKZgCCFLUoM/7CFJVPcG8C1xQ1AJ0vpAezJrB7JYyY=
|
||||||
|
github.com/onsi/gomega v1.10.1/go.mod h1:iN09h71vgCQne3DLsj+A5owkum+a2tYe+TOCB1ybHNo=
|
||||||
|
github.com/onsi/gomega v1.16.0 h1:6gjqkI8iiRHMvdccRJM8rVKjCWk6ZIm6FTm3ddIe4/c=
|
||||||
|
github.com/onsi/gomega v1.16.0/go.mod h1:HnhC7FXeEQY45zxNK3PPoIUhzk/80Xly9PcubAlGdZY=
|
||||||
|
github.com/openzipkin/zipkin-go v0.2.5/go.mod h1:KpXfKdgRDnnhsxw4pNIH9Md5lyFqKUa4YDFlwRYAMyE=
|
||||||
|
github.com/openzipkin/zipkin-go v0.3.0/go.mod h1:4c3sLeE8xjNqehmF5RpAFLPLJxXscc0R4l6Zg0P1tTQ=
|
||||||
|
github.com/peterbourgon/diskv v2.0.1+incompatible/go.mod h1:uqqh8zWWbv1HBMNONnaR/tNboyR3/BZd58JJSHlUSCU=
|
||||||
|
github.com/pierrec/lz4 v1.0.2-0.20190131084431-473cd7ce01a1/go.mod h1:3/3N9NVKO0jef7pBehbT1qWhCMrIgbYNnFAZCqQ5LRc=
|
||||||
|
github.com/pierrec/lz4 v2.0.5+incompatible/go.mod h1:pdkljMzZIN41W+lC3N2tnIh5sFi+IEE17M5jbnwPHcY=
|
||||||
|
github.com/pierrec/lz4 v2.6.1+incompatible/go.mod h1:pdkljMzZIN41W+lC3N2tnIh5sFi+IEE17M5jbnwPHcY=
|
||||||
|
github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
|
||||||
|
github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
|
||||||
|
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
|
||||||
|
github.com/pkg/profile v1.2.1/go.mod h1:hJw3o1OdXxsrSjjVksARp5W95eeEaEfptyVZyv6JUPA=
|
||||||
|
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
|
||||||
|
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
|
||||||
|
github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw=
|
||||||
|
github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5FsnadC4Ky3P0J6CfImo=
|
||||||
|
github.com/prometheus/client_golang v1.7.1/go.mod h1:PY5Wy2awLA44sXw4AOSfFBetzPP4j5+D6mVACh+pe2M=
|
||||||
|
github.com/prometheus/client_golang v1.11.0/go.mod h1:Z6t4BnS23TR94PD6BsDNk8yVqroYurpAkEiz0P2BEV0=
|
||||||
|
github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo=
|
||||||
|
github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA=
|
||||||
|
github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA=
|
||||||
|
github.com/prometheus/client_model v0.2.0/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA=
|
||||||
|
github.com/prometheus/common v0.4.1/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4=
|
||||||
|
github.com/prometheus/common v0.10.0/go.mod h1:Tlit/dnDKsSWFlCLTWaA1cyBgKHSMdTB80sz/V91rCo=
|
||||||
|
github.com/prometheus/common v0.26.0/go.mod h1:M7rCNAaPfAosfx8veZJCuw84e35h3Cfd9VFqTh1DIvc=
|
||||||
|
github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk=
|
||||||
|
github.com/prometheus/procfs v0.0.2/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA=
|
||||||
|
github.com/prometheus/procfs v0.1.3/go.mod h1:lV6e/gmhEcM9IjHGsFOCxxuZ+z1YqCvr4OA4YeYWdaU=
|
||||||
|
github.com/prometheus/procfs v0.6.0/go.mod h1:cz+aTbrPOrUb4q7XlbU9ygM+/jj0fzG6c1xBZuNvfVA=
|
||||||
|
github.com/rabbitmq/amqp091-go v1.1.0/go.mod h1:ogQDLSOACsLPsIq0NpbtiifNZi2YOz0VTJ0kHRghqbM=
|
||||||
|
github.com/rcrowley/go-metrics v0.0.0-20181016184325-3113b8401b8a/go.mod h1:bCqnVzQkZxMG4s8nGwiZ5l3QUCyqpo9Y+/ZMZ9VjZe4=
|
||||||
|
github.com/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475/go.mod h1:bCqnVzQkZxMG4s8nGwiZ5l3QUCyqpo9Y+/ZMZ9VjZe4=
|
||||||
|
github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6LYCDYWNEvQ=
|
||||||
|
github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4=
|
||||||
|
github.com/russross/blackfriday/v2 v2.0.1 h1:lPqVAte+HuHNfhJ/0LC98ESWRz8afy9tM/0RK8m9o+Q=
|
||||||
|
github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
|
||||||
|
github.com/shurcooL/sanitized_anchor_name v1.0.0 h1:PdmoCO6wvbs+7yrJyMORt4/BmY5IYyJwS/kOiWx8mHo=
|
||||||
|
github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc=
|
||||||
|
github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo=
|
||||||
|
github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE=
|
||||||
|
github.com/sirupsen/logrus v1.6.0/go.mod h1:7uNnSEd1DgxDLC74fIahvMZmmYsHGZGEOFrfsX/uA88=
|
||||||
|
github.com/sirupsen/logrus v1.8.1/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic61uBYv0=
|
||||||
|
github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA=
|
||||||
|
github.com/spaolacci/murmur3 v1.1.0 h1:7c1g84S4BPRrfL5Xrdp6fOJ206sU9y293DDHaoy0bLI=
|
||||||
|
github.com/spaolacci/murmur3 v1.1.0/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA=
|
||||||
|
github.com/spf13/afero v1.2.2/go.mod h1:9ZxEEn6pIJ8Rxe320qSDBk6AsU0r9pR7Q4OcevTdifk=
|
||||||
|
github.com/spf13/pflag v0.0.0-20170130214245-9ff6c6923cff/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4=
|
||||||
|
github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg=
|
||||||
|
github.com/streadway/amqp v0.0.0-20190404075320-75d898a42a94/go.mod h1:AZpEONHx3DKn8O/DFsRAY58/XVQiIPMTMB1SddzLXVw=
|
||||||
|
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
||||||
|
github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
||||||
|
github.com/stretchr/objx v0.2.0/go.mod h1:qt09Ya8vawLte6SNmTgCsAVtYtaKzEcn8ATUoHMkEqE=
|
||||||
|
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
|
||||||
|
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
|
||||||
|
github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4=
|
||||||
|
github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA=
|
||||||
|
github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
|
||||||
|
github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY=
|
||||||
|
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
|
||||||
|
github.com/tal-tech/go-zero v1.2.5 h1:DpqTM/OTCThRtJoQPlp6b4/YnbCVkZ3gDT7+nFGUo3k=
|
||||||
|
github.com/tal-tech/go-zero v1.2.5/go.mod h1:OM2UangPHFMJ+5boRUaeQ/z6xpVvqprZda/JUWG1D7Y=
|
||||||
|
github.com/urfave/cli v1.22.5 h1:lNq9sAHXK2qfdI8W+GRItjCEkI+2oR4d+MEHy1CKXoU=
|
||||||
|
github.com/urfave/cli v1.22.5/go.mod h1:Gos4lmkARVdJ6EkW0WaNv/tZAAMe9V7XWyB60NtXRu0=
|
||||||
|
github.com/urfave/cli/v2 v2.3.0/go.mod h1:LJmUH05zAU44vOAcrfzZQKsZbVcdbOG8rtL3/XcUArI=
|
||||||
|
github.com/xdg-go/pbkdf2 v1.0.0/go.mod h1:jrpuAogTd400dnrH08LKmI/xc1MbPOebTwRqcT5RDeI=
|
||||||
|
github.com/xdg-go/scram v1.0.2/go.mod h1:1WAq6h33pAW+iRreB34OORO2Nf7qel3VV3fjBj+hCSs=
|
||||||
|
github.com/xdg-go/stringprep v1.0.2/go.mod h1:8F9zXuvzgwmyT5DUm4GUfZGDdT3W+LCvS6+da4O5kxM=
|
||||||
|
github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
|
||||||
|
github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
|
||||||
|
github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k=
|
||||||
|
github.com/yuin/gopher-lua v0.0.0-20200816102855-ee81675732da h1:NimzV1aGyq29m5ukMK0AMWEhFaL/lrEOaephfuoiARg=
|
||||||
|
github.com/yuin/gopher-lua v0.0.0-20200816102855-ee81675732da/go.mod h1:E1AXubJBdNmFERAOucpDIxNzeGfLzg0mYh+UfMWdChA=
|
||||||
|
github.com/zeromicro/antlr v0.0.1 h1:CQpIn/dc0pUjgGQ81y98s/NGOm2Hfru2NNio2I9mQgk=
|
||||||
|
github.com/zeromicro/antlr v0.0.1/go.mod h1:nfpjEwFR6Q4xGDJMcZnCL9tEfQRgszMwu3rDz2Z+p5M=
|
||||||
|
github.com/zeromicro/ddl-parser v0.0.0-20210712021150-63520aca7348 h1:OhxL9tn28gDeJVzreIUiE5oVxZCjL3tBJ0XBNw8p5R8=
|
||||||
|
github.com/zeromicro/ddl-parser v0.0.0-20210712021150-63520aca7348/go.mod h1:ISU/8NuPyEpl9pa17Py9TBPetMjtsiHrb9f5XGiYbo8=
|
||||||
|
go.etcd.io/etcd/api/v3 v3.5.1/go.mod h1:cbVKeC6lCfl7j/8jBhAK6aIYO9XOjdptoxU/nLQcPvs=
|
||||||
|
go.etcd.io/etcd/client/pkg/v3 v3.5.1/go.mod h1:IJHfcCEKxYu1Os13ZdwCwIUTUVGYTSAM3YSwc9/Ac1g=
|
||||||
|
go.etcd.io/etcd/client/v3 v3.5.1/go.mod h1:OnjH4M8OnAotwaB2l9bVgZzRFKru7/ZMoS46OtKyd3Q=
|
||||||
|
go.opencensus.io v0.21.0/go.mod h1:mSImk1erAIZhrmZN+AvHh14ztQfjbGwt4TtuofqLduU=
|
||||||
|
go.opencensus.io v0.22.0/go.mod h1:+kGneAE2xo2IficOXnaByMWTGM9T73dGwxeWcUqIpI8=
|
||||||
|
go.opencensus.io v0.22.2/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw=
|
||||||
|
go.opencensus.io v0.22.3/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw=
|
||||||
|
go.opentelemetry.io/otel v1.1.0 h1:8p0uMLcyyIx0KHNTgO8o3CW8A1aA+dJZJW6PvnMz0Wc=
|
||||||
|
go.opentelemetry.io/otel v1.1.0/go.mod h1:7cww0OW51jQ8IaZChIEdqLwgh+44+7uiTdWsAL0wQpA=
|
||||||
|
go.opentelemetry.io/otel/exporters/jaeger v1.1.0/go.mod h1:D/GIBwAdrFTTqCy1iITpC9nh5rgJpIbFVgkhlz2vCXk=
|
||||||
|
go.opentelemetry.io/otel/exporters/zipkin v1.1.0/go.mod h1:LZwDnf1mVGTPMq9hdRUHfFBH30SuQvZ1BJaVywpg0VI=
|
||||||
|
go.opentelemetry.io/otel/sdk v1.1.0 h1:j/1PngUJIDOddkCILQYTevrTIbWd494djgGkSsMit+U=
|
||||||
|
go.opentelemetry.io/otel/sdk v1.1.0/go.mod h1:3aQvM6uLm6C4wJpHtT8Od3vNzeZ34Pqc6bps8MywWzo=
|
||||||
|
go.opentelemetry.io/otel/trace v1.1.0 h1:N25T9qCL0+7IpOT8RrRy0WYlL7y6U0WiUJzXcVdXY/o=
|
||||||
|
go.opentelemetry.io/otel/trace v1.1.0/go.mod h1:i47XtdcBQiktu5IsrPqOHe8w+sBmnLwwHt8wiUsWGTI=
|
||||||
|
go.opentelemetry.io/proto/otlp v0.7.0/go.mod h1:PqfVotwruBrMGOCsRd/89rSnXhoiJIqeYNgFYFoEGnI=
|
||||||
|
go.uber.org/atomic v1.7.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc=
|
||||||
|
go.uber.org/automaxprocs v1.4.0 h1:CpDZl6aOlLhReez+8S3eEotD7Jx0Os++lemPlMULQP0=
|
||||||
|
go.uber.org/automaxprocs v1.4.0/go.mod h1:/mTEdr7LvHhs0v7mjdxDreTz1OG5zdZGqgOnhWiR/+Q=
|
||||||
|
go.uber.org/multierr v1.6.0/go.mod h1:cdWPpRnG4AhwMwsgIHip0KRBQjJy5kYEpYjJxpXp9iU=
|
||||||
|
go.uber.org/zap v1.17.0/go.mod h1:MXVU+bhUf/A7Xi2HNOnopQOrmycQ5Ih87HtOu4q5SSo=
|
||||||
|
golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
|
||||||
|
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
|
||||||
|
golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
|
||||||
|
golang.org/x/crypto v0.0.0-20190605123033-f99c8df09eb5/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
|
||||||
|
golang.org/x/crypto v0.0.0-20190611184440-5c40567a22f8/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
|
||||||
|
golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
|
||||||
|
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
|
||||||
|
golang.org/x/crypto v0.0.0-20201002170205-7f63de1d35b0/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
|
||||||
|
golang.org/x/crypto v0.0.0-20201112155050-0c6587e931a9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
|
||||||
|
golang.org/x/crypto v0.0.0-20210920023735-84f357641f63/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
|
||||||
|
golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
|
||||||
|
golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
|
||||||
|
golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8=
|
||||||
|
golang.org/x/exp v0.0.0-20190829153037-c13cbed26979/go.mod h1:86+5VVa7VpoJ4kLfm080zCjGlMRFzhUhsZKEZO7MGek=
|
||||||
|
golang.org/x/exp v0.0.0-20191030013958-a1ab85dbe136/go.mod h1:JXzH8nQsPlswgeRAPE3MuO9GYsAcnJvJ4vnMwN/5qkY=
|
||||||
|
golang.org/x/exp v0.0.0-20191129062945-2f5052295587/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4=
|
||||||
|
golang.org/x/exp v0.0.0-20191227195350-da58074b4299/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4=
|
||||||
|
golang.org/x/exp v0.0.0-20200119233911-0405dc783f0a/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4=
|
||||||
|
golang.org/x/exp v0.0.0-20200207192155-f17229e696bd/go.mod h1:J/WKrq2StrnmMY6+EHIKF9dgMWnmCNThgcyBT1FY9mM=
|
||||||
|
golang.org/x/exp v0.0.0-20200224162631-6cc2880d07d6/go.mod h1:3jZMyOhIsHpP37uCMkUooju7aAi5cS1Q23tOzKc+0MU=
|
||||||
|
golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js=
|
||||||
|
golang.org/x/image v0.0.0-20190802002840-cff245a6509b/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0=
|
||||||
|
golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE=
|
||||||
|
golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU=
|
||||||
|
golang.org/x/lint v0.0.0-20190301231843-5614ed5bae6f/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE=
|
||||||
|
golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc=
|
||||||
|
golang.org/x/lint v0.0.0-20190409202823-959b441ac422/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc=
|
||||||
|
golang.org/x/lint v0.0.0-20190909230951-414d861bb4ac/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc=
|
||||||
|
golang.org/x/lint v0.0.0-20190930215403-16217165b5de/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc=
|
||||||
|
golang.org/x/lint v0.0.0-20191125180803-fdd1cda4f05f/go.mod h1:5qLYkcX4OjUUV8bRuDixDT3tpyyb+LUpUlRWLxfhWrs=
|
||||||
|
golang.org/x/lint v0.0.0-20200130185559-910be7a94367/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY=
|
||||||
|
golang.org/x/lint v0.0.0-20200302205851-738671d3881b/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY=
|
||||||
|
golang.org/x/lint v0.0.0-20210508222113-6edffad5e616/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY=
|
||||||
|
golang.org/x/mobile v0.0.0-20190312151609-d3739f865fa6/go.mod h1:z+o9i4GpDbdi3rU15maQ/Ox0txvL9dWGYEHz965HBQE=
|
||||||
|
golang.org/x/mobile v0.0.0-20190719004257-d2bd2a29d028/go.mod h1:E/iHnbuqvinMTCcRqshq8CkpyQDoeVncDDYHnLhea+o=
|
||||||
|
golang.org/x/mod v0.0.0-20190513183733-4bf6d317e70e/go.mod h1:mXi4GBBbnImb6dmsKGUJ2LatrhH/nqhxcFungHvyanc=
|
||||||
|
golang.org/x/mod v0.1.0/go.mod h1:0QHyrYULN0/3qlju5TqG8bIK38QM8yzMo5ekMj3DlcY=
|
||||||
|
golang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg=
|
||||||
|
golang.org/x/mod v0.1.1-0.20191107180719-034126e5016b/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg=
|
||||||
|
golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
|
||||||
|
golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
|
||||||
|
golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
|
||||||
|
golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
||||||
|
golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
||||||
|
golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
||||||
|
golang.org/x/net v0.0.0-20181114220301-adae6a3d119a/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
||||||
|
golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
||||||
|
golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
||||||
|
golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
|
||||||
|
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
|
||||||
|
golang.org/x/net v0.0.0-20190501004415-9ce7a6920f09/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
|
||||||
|
golang.org/x/net v0.0.0-20190503192946-f4e77d36d62c/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
|
||||||
|
golang.org/x/net v0.0.0-20190603091049-60506f45cf65/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks=
|
||||||
|
golang.org/x/net v0.0.0-20190613194153-d28f0bde5980/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
|
||||||
|
golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
|
||||||
|
golang.org/x/net v0.0.0-20190724013045-ca1201d0de80/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
|
||||||
|
golang.org/x/net v0.0.0-20190827160401-ba9fcec4b297/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
|
||||||
|
golang.org/x/net v0.0.0-20191209160850-c0dbc17a3553/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
|
||||||
|
golang.org/x/net v0.0.0-20200114155413-6afb5195e5aa/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
|
||||||
|
golang.org/x/net v0.0.0-20200202094626-16171245cfb2/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
|
||||||
|
golang.org/x/net v0.0.0-20200222125558-5a598a2470a0/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
|
||||||
|
golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
|
||||||
|
golang.org/x/net v0.0.0-20200301022130-244492dfa37a/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
|
||||||
|
golang.org/x/net v0.0.0-20200324143707-d3edc9973b7e/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A=
|
||||||
|
golang.org/x/net v0.0.0-20200520004742-59133d7f0dd7/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A=
|
||||||
|
golang.org/x/net v0.0.0-20200625001655-4c5254603344/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA=
|
||||||
|
golang.org/x/net v0.0.0-20200822124328-c89045814202/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA=
|
||||||
|
golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU=
|
||||||
|
golang.org/x/net v0.0.0-20201110031124-69a78807bb2b/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU=
|
||||||
|
golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
|
||||||
|
golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM=
|
||||||
|
golang.org/x/net v0.0.0-20210428140749-89ef3d95e781/go.mod h1:OJAsFXCWl8Ukc7SiCT/9KSuxbyM7479/AVlXFRxuMCk=
|
||||||
|
golang.org/x/net v0.0.0-20210917221730-978cfadd31cf/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
|
||||||
|
golang.org/x/net v0.0.0-20210928044308-7d9f5e0b762b h1:eB48h3HiRycXNy8E0Gf5e0hv7YT6Kt14L/D73G1fuwo=
|
||||||
|
golang.org/x/net v0.0.0-20210928044308-7d9f5e0b762b/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
|
||||||
|
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
|
||||||
|
golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
|
||||||
|
golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
|
||||||
|
golang.org/x/oauth2 v0.0.0-20191202225959-858c2ad4c8b6/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
|
||||||
|
golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
|
||||||
|
golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||||
|
golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||||
|
golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||||
|
golang.org/x/sync v0.0.0-20190227155943-e225da77a7e6/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||||
|
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||||
|
golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||||
|
golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||||
|
golang.org/x/sync v0.0.0-20201207232520-09787c993a3a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||||
|
golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||||
|
golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||||
|
golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||||
|
golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||||
|
golang.org/x/sys v0.0.0-20181116152217-5ac8a444bdc5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||||
|
golang.org/x/sys v0.0.0-20190204203706-41f3e6584952/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||||
|
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||||
|
golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||||
|
golang.org/x/sys v0.0.0-20190312061237-fead79001313/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||||
|
golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||||
|
golang.org/x/sys v0.0.0-20190422165155-953cdadca894/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||||
|
golang.org/x/sys v0.0.0-20190502145724-3ef323f4f1fd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||||
|
golang.org/x/sys v0.0.0-20190507160741-ecd444e8653b/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||||
|
golang.org/x/sys v0.0.0-20190606165138-5da285871e9c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||||
|
golang.org/x/sys v0.0.0-20190616124812-15dcb6c0061f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||||
|
golang.org/x/sys v0.0.0-20190624142023-c5567b49c5d0/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||||
|
golang.org/x/sys v0.0.0-20190726091711-fc99dfbffb4e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||||
|
golang.org/x/sys v0.0.0-20190904154756-749cb33beabd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||||
|
golang.org/x/sys v0.0.0-20191001151750-bb3f8db39f24/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||||
|
golang.org/x/sys v0.0.0-20191005200804-aed5e4c7ecf9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||||
|
golang.org/x/sys v0.0.0-20191026070338-33540a1f6037/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||||
|
golang.org/x/sys v0.0.0-20191120155948-bd437916bb0e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||||
|
golang.org/x/sys v0.0.0-20191204072324-ce4227a45e2e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||||
|
golang.org/x/sys v0.0.0-20191228213918-04cbcbbfeed8/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||||
|
golang.org/x/sys v0.0.0-20200106162015-b016eb3dc98e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||||
|
golang.org/x/sys v0.0.0-20200113162924-86b910548bc1/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||||
|
golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||||
|
golang.org/x/sys v0.0.0-20200122134326-e047566fdf82/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||||
|
golang.org/x/sys v0.0.0-20200202164722-d101bd2416d5/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||||
|
golang.org/x/sys v0.0.0-20200212091648-12a6c2dcc1e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||||
|
golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||||
|
golang.org/x/sys v0.0.0-20200302150141-5c8b2ff67527/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||||
|
golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||||
|
golang.org/x/sys v0.0.0-20200615200032-f1bc736245b1/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||||
|
golang.org/x/sys v0.0.0-20200625212154-ddb9806d33ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||||
|
golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||||
|
golang.org/x/sys v0.0.0-20201112073958-5cba982894dd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||||
|
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||||
|
golang.org/x/sys v0.0.0-20210112080510-489259a85091/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||||
|
golang.org/x/sys v0.0.0-20210124154548-22da62e12c0c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||||
|
golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||||
|
golang.org/x/sys v0.0.0-20210403161142-5e06dd20ab57/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||||
|
golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||||
|
golang.org/x/sys v0.0.0-20210423185535-09eb48e85fd7/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||||
|
golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||||
|
golang.org/x/sys v0.0.0-20210603081109-ebe580a85c40/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||||
|
golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||||
|
golang.org/x/sys v0.0.0-20211106132015-ebca88c72f68 h1:Ywe/f3fNleF8I6F6qv3MeFoSZ6CTf2zBMMa/7qVML8M=
|
||||||
|
golang.org/x/sys v0.0.0-20211106132015-ebca88c72f68/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||||
|
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
|
||||||
|
golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
||||||
|
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
||||||
|
golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
||||||
|
golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk=
|
||||||
|
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
|
||||||
|
golang.org/x/text v0.3.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
|
||||||
|
golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
|
||||||
|
golang.org/x/text v0.3.7 h1:olpwvP2KacW1ZWvsR7uQhoyTYvKAupfQrRGBFM352Gk=
|
||||||
|
golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ=
|
||||||
|
golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
|
||||||
|
golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
|
||||||
|
golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
|
||||||
|
golang.org/x/time v0.0.0-20200630173020-3af7569d3a1e/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
|
||||||
|
golang.org/x/time v0.0.0-20210723032227-1f47c861a9ac/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
|
||||||
|
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
|
||||||
|
golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
|
||||||
|
golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY=
|
||||||
|
golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs=
|
||||||
|
golang.org/x/tools v0.0.0-20190312151545-0bb0c0a6e846/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs=
|
||||||
|
golang.org/x/tools v0.0.0-20190312170243-e65039ee4138/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs=
|
||||||
|
golang.org/x/tools v0.0.0-20190425150028-36563e24a262/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q=
|
||||||
|
golang.org/x/tools v0.0.0-20190506145303-2d16b83fe98c/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q=
|
||||||
|
golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q=
|
||||||
|
golang.org/x/tools v0.0.0-20190606124116-d0a3d012864b/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc=
|
||||||
|
golang.org/x/tools v0.0.0-20190614205625-5aca471b1d59/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc=
|
||||||
|
golang.org/x/tools v0.0.0-20190621195816-6e04913cbbac/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc=
|
||||||
|
golang.org/x/tools v0.0.0-20190628153133-6cdbf07be9d0/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc=
|
||||||
|
golang.org/x/tools v0.0.0-20190816200558-6889da9d5479/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
|
||||||
|
golang.org/x/tools v0.0.0-20190911174233-4f2ddba30aff/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
|
||||||
|
golang.org/x/tools v0.0.0-20191012152004-8de300cfc20a/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
|
||||||
|
golang.org/x/tools v0.0.0-20191113191852-77e3bb0ad9e7/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
|
||||||
|
golang.org/x/tools v0.0.0-20191115202509-3a792d9c32b2/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
|
||||||
|
golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
|
||||||
|
golang.org/x/tools v0.0.0-20191125144606-a911d9008d1f/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
|
||||||
|
golang.org/x/tools v0.0.0-20191130070609-6e064ea0cf2d/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
|
||||||
|
golang.org/x/tools v0.0.0-20191216173652-a0e659d51361/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28=
|
||||||
|
golang.org/x/tools v0.0.0-20191227053925-7b8e75db28f4/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28=
|
||||||
|
golang.org/x/tools v0.0.0-20200117161641-43d50277825c/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28=
|
||||||
|
golang.org/x/tools v0.0.0-20200122220014-bf1340f18c4a/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28=
|
||||||
|
golang.org/x/tools v0.0.0-20200130002326-2f3ba24bd6e7/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28=
|
||||||
|
golang.org/x/tools v0.0.0-20200204074204-1cc6d1ef6c74/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28=
|
||||||
|
golang.org/x/tools v0.0.0-20200207183749-b753a1ba74fa/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28=
|
||||||
|
golang.org/x/tools v0.0.0-20200212150539-ea181f53ac56/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28=
|
||||||
|
golang.org/x/tools v0.0.0-20200224181240-023911ca70b2/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28=
|
||||||
|
golang.org/x/tools v0.0.0-20200304193943-95d2e580d8eb/go.mod h1:o4KQGtdN14AW+yjsvvwRTJJuXz8XRtIHtEnmAXLyFUw=
|
||||||
|
golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE=
|
||||||
|
golang.org/x/tools v0.0.0-20201224043029-2b0845dc783e/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA=
|
||||||
|
golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA=
|
||||||
|
golang.org/x/tools v0.1.1/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk=
|
||||||
|
golang.org/x/tools v0.1.2/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk=
|
||||||
|
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||||
|
golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||||
|
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||||
|
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||||
|
google.golang.org/api v0.4.0/go.mod h1:8k5glujaEP+g9n7WNsDg8QP6cUVNI86fCNMcbazEtwE=
|
||||||
|
google.golang.org/api v0.7.0/go.mod h1:WtwebWUNSVBH/HAw79HIFXZNqEvBhG+Ra+ax0hx3E3M=
|
||||||
|
google.golang.org/api v0.8.0/go.mod h1:o4eAsZoiT+ibD93RtjEohWalFOjRDx6CVaqeizhEnKg=
|
||||||
|
google.golang.org/api v0.9.0/go.mod h1:o4eAsZoiT+ibD93RtjEohWalFOjRDx6CVaqeizhEnKg=
|
||||||
|
google.golang.org/api v0.13.0/go.mod h1:iLdEw5Ide6rF15KTC1Kkl0iskquN2gFfn9o9XIsbkAI=
|
||||||
|
google.golang.org/api v0.14.0/go.mod h1:iLdEw5Ide6rF15KTC1Kkl0iskquN2gFfn9o9XIsbkAI=
|
||||||
|
google.golang.org/api v0.15.0/go.mod h1:iLdEw5Ide6rF15KTC1Kkl0iskquN2gFfn9o9XIsbkAI=
|
||||||
|
google.golang.org/api v0.17.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE=
|
||||||
|
google.golang.org/api v0.18.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE=
|
||||||
|
google.golang.org/api v0.20.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE=
|
||||||
|
google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM=
|
||||||
|
google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4=
|
||||||
|
google.golang.org/appengine v1.5.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4=
|
||||||
|
google.golang.org/appengine v1.6.1/go.mod h1:i06prIuMbXzDqacNJfV5OdTW448YApPu5ww/cMBSeb0=
|
||||||
|
google.golang.org/appengine v1.6.5/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc=
|
||||||
|
google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc=
|
||||||
|
google.golang.org/genproto v0.0.0-20190307195333-5fe7a883aa19/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE=
|
||||||
|
google.golang.org/genproto v0.0.0-20190418145605-e7d98fc518a7/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE=
|
||||||
|
google.golang.org/genproto v0.0.0-20190425155659-357c62f0e4bb/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE=
|
||||||
|
google.golang.org/genproto v0.0.0-20190502173448-54afdca5d873/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE=
|
||||||
|
google.golang.org/genproto v0.0.0-20190801165951-fa694d86fc64/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc=
|
||||||
|
google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc=
|
||||||
|
google.golang.org/genproto v0.0.0-20190911173649-1774047e7e51/go.mod h1:IbNlFCBrqXvoKpeg0TB2l7cyZUmoaFKYIwrEpbDKLA8=
|
||||||
|
google.golang.org/genproto v0.0.0-20191108220845-16a3f7862a1a/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc=
|
||||||
|
google.golang.org/genproto v0.0.0-20191115194625-c23dd37a84c9/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc=
|
||||||
|
google.golang.org/genproto v0.0.0-20191216164720-4f79533eabd1/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc=
|
||||||
|
google.golang.org/genproto v0.0.0-20191230161307-f3c370f40bfb/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc=
|
||||||
|
google.golang.org/genproto v0.0.0-20200115191322-ca5a22157cba/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc=
|
||||||
|
google.golang.org/genproto v0.0.0-20200122232147-0452cf42e150/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc=
|
||||||
|
google.golang.org/genproto v0.0.0-20200204135345-fa8e72b47b90/go.mod h1:GmwEX6Z4W5gMy59cAlVYjN9JhxgbQH6Gn+gFDQe2lzA=
|
||||||
|
google.golang.org/genproto v0.0.0-20200212174721-66ed5ce911ce/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c=
|
||||||
|
google.golang.org/genproto v0.0.0-20200224152610-e50cd9704f63/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c=
|
||||||
|
google.golang.org/genproto v0.0.0-20200305110556-506484158171/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c=
|
||||||
|
google.golang.org/genproto v0.0.0-20200513103714-09dca8ec2884/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c=
|
||||||
|
google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEYHJ7i3ixzK3sjbqSGDJWnxyFXZblF3eUsNvo=
|
||||||
|
google.golang.org/genproto v0.0.0-20210602131652-f16073e35f0c/go.mod h1:UODoCrxHCcBojKKwX1terBiRUaqAsFqJiF615XL43r0=
|
||||||
|
google.golang.org/genproto v0.0.0-20210928142010-c7af6a1a74c9/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc=
|
||||||
|
google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c=
|
||||||
|
google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38=
|
||||||
|
google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM=
|
||||||
|
google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg=
|
||||||
|
google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQciAY=
|
||||||
|
google.golang.org/grpc v1.26.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk=
|
||||||
|
google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk=
|
||||||
|
google.golang.org/grpc v1.27.1/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk=
|
||||||
|
google.golang.org/grpc v1.30.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak=
|
||||||
|
google.golang.org/grpc v1.33.1/go.mod h1:fr5YgcSWrqhRRxogOsw7RzIpsmvOZ6IcH4kBYTpR3n0=
|
||||||
|
google.golang.org/grpc v1.36.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU=
|
||||||
|
google.golang.org/grpc v1.38.0/go.mod h1:NREThFqKR1f3iQ6oBuvc5LadQuXVGo9rkm5ZGrQdJfM=
|
||||||
|
google.golang.org/grpc v1.40.0/go.mod h1:ogyxbiOoUXAkP+4+xa6PZSE9DZgIHtSpzjDTB9KAK34=
|
||||||
|
google.golang.org/grpc v1.41.0/go.mod h1:U3l9uK9J0sini8mHphKoXyaqDA/8VyGnDee1zzIUK6k=
|
||||||
|
google.golang.org/grpc v1.42.0/go.mod h1:k+4IHHFw41K8+bbowsex27ge2rCb65oeWqe4jJ590SU=
|
||||||
|
google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8=
|
||||||
|
google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0=
|
||||||
|
google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM=
|
||||||
|
google.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967/go.mod h1:A+miEFZTKqfCUM6K7xSMQL9OKL/b6hQv+e19PK+JZNE=
|
||||||
|
google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo=
|
||||||
|
google.golang.org/protobuf v1.22.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU=
|
||||||
|
google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU=
|
||||||
|
google.golang.org/protobuf v1.23.1-0.20200526195155-81db48ad09cc/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU=
|
||||||
|
google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c=
|
||||||
|
google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw=
|
||||||
|
google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc=
|
||||||
|
google.golang.org/protobuf v1.27.1/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc=
|
||||||
|
gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw=
|
||||||
|
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||||
|
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||||
|
gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||||
|
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk=
|
||||||
|
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q=
|
||||||
|
gopkg.in/cheggaaa/pb.v1 v1.0.28/go.mod h1:V/YB90LKu/1FcN3WVnfiiE5oMCibMjukxqG/qStrOgw=
|
||||||
|
gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI=
|
||||||
|
gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys=
|
||||||
|
gopkg.in/h2non/gock.v1 v1.1.2 h1:jBbHXgGBK/AoPVfJh5x4r/WxIrElvbLel8TCZkkZJoY=
|
||||||
|
gopkg.in/h2non/gock.v1 v1.1.2/go.mod h1:n7UGz/ckNChHiK05rDoiC4MYSunEC/lyaUm2WWaDva0=
|
||||||
|
gopkg.in/inf.v0 v0.9.1/go.mod h1:cWUDdTG/fYaXco+Dcufb5Vnc6Gp2YChqWtbxRZE0mXw=
|
||||||
|
gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 h1:uRGJdciOHaEIrze2W8Q3AKkepLTh2hOroT7a+7czfdQ=
|
||||||
|
gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw=
|
||||||
|
gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
||||||
|
gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
||||||
|
gopkg.in/yaml.v2 v2.2.3/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
||||||
|
gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
||||||
|
gopkg.in/yaml.v2 v2.2.5/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
||||||
|
gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
||||||
|
gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
||||||
|
gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY=
|
||||||
|
gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ=
|
||||||
|
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
||||||
|
gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b h1:h8qDotaEPuJATrMmW04NCwg7v22aHH28wwpauUhK9Oo=
|
||||||
|
gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
||||||
|
honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
|
||||||
|
honnef.co/go/tools v0.0.0-20190106161140-3f1c8253044a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
|
||||||
|
honnef.co/go/tools v0.0.0-20190418001031-e561f6794a2a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
|
||||||
|
honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
|
||||||
|
honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt0JzvZhAg=
|
||||||
|
honnef.co/go/tools v0.0.1-2020.1.3/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k=
|
||||||
|
k8s.io/api v0.20.12/go.mod h1:A2brwyEkVLM3wQGNnzoAa5JsQRzHK0uoOQ+bsnv7V68=
|
||||||
|
k8s.io/apimachinery v0.20.12/go.mod h1:uM7hCI0NyBymUwgshMgZyte475lxhr+QH6h3cvdnzEc=
|
||||||
|
k8s.io/client-go v0.20.12/go.mod h1:NBJj6Evp73Xy/4v/O/RDRaH0+3JoxNfjRxkyRgrdbsA=
|
||||||
|
k8s.io/gengo v0.0.0-20200413195148-3a45101e95ac/go.mod h1:ezvh/TsK7cY6rbqRK0oQQ8IAqLxYwwyPxAX1Pzy0ii0=
|
||||||
|
k8s.io/klog/v2 v2.0.0/go.mod h1:PBfzABfn139FHAV07az/IF9Wp1bkk3vpT2XSJ76fSDE=
|
||||||
|
k8s.io/klog/v2 v2.4.0/go.mod h1:Od+F08eJP+W3HUb4pSrPpgp9DGU4GzlpG/TmITuYh/Y=
|
||||||
|
k8s.io/kube-openapi v0.0.0-20201113171705-d219536bb9fd/go.mod h1:WOJ3KddDSol4tAGcJo0Tvi+dK12EcqSLqcWsryKMpfM=
|
||||||
|
k8s.io/utils v0.0.0-20201110183641-67b214c5f920 h1:CbnUZsM497iRC5QMVkHwyl8s2tB3g7yaSHkYPkpgelw=
|
||||||
|
k8s.io/utils v0.0.0-20201110183641-67b214c5f920/go.mod h1:jPW/WVKK9YHAvNhRxK0md/EJ228hCsBRufyofKtW8HA=
|
||||||
|
rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8=
|
||||||
|
rsc.io/quote/v3 v3.1.0/go.mod h1:yEA65RcK8LyAZtP9Kv3t0HmxON59tX3rD+tICJqUlj0=
|
||||||
|
rsc.io/sampler v1.3.0/go.mod h1:T1hPZKmBbMNahiBKFy5HrXp6adAjACjK9JXDnKaTXpA=
|
||||||
|
sigs.k8s.io/structured-merge-diff/v4 v4.0.2/go.mod h1:bJZC9H9iH24zzfZ/41RGcq60oK1F7G282QMXDPYydCw=
|
||||||
|
sigs.k8s.io/structured-merge-diff/v4 v4.1.2/go.mod h1:j/nl6xW8vLS49O8YvXW1ocPhZawJtm+Yrr7PPRQ0Vg4=
|
||||||
|
sigs.k8s.io/yaml v1.1.0/go.mod h1:UJmg0vDUVViEyp3mgSv9WPwZCDxu4rQW1olrI1uml+o=
|
||||||
|
sigs.k8s.io/yaml v1.2.0/go.mod h1:yfXDCHCao9+ENCvLSE62v9VSji2MKu5jeNfTrofGhJc=
|
||||||
@@ -18,6 +18,7 @@ import (
|
|||||||
"github.com/tal-tech/go-zero/tools/goctl/api/new"
|
"github.com/tal-tech/go-zero/tools/goctl/api/new"
|
||||||
"github.com/tal-tech/go-zero/tools/goctl/api/tsgen"
|
"github.com/tal-tech/go-zero/tools/goctl/api/tsgen"
|
||||||
"github.com/tal-tech/go-zero/tools/goctl/api/validate"
|
"github.com/tal-tech/go-zero/tools/goctl/api/validate"
|
||||||
|
"github.com/tal-tech/go-zero/tools/goctl/bug"
|
||||||
"github.com/tal-tech/go-zero/tools/goctl/docker"
|
"github.com/tal-tech/go-zero/tools/goctl/docker"
|
||||||
"github.com/tal-tech/go-zero/tools/goctl/internal/errorx"
|
"github.com/tal-tech/go-zero/tools/goctl/internal/errorx"
|
||||||
"github.com/tal-tech/go-zero/tools/goctl/internal/version"
|
"github.com/tal-tech/go-zero/tools/goctl/internal/version"
|
||||||
@@ -34,6 +35,11 @@ import (
|
|||||||
const codeFailure = 1
|
const codeFailure = 1
|
||||||
|
|
||||||
var commands = []cli.Command{
|
var commands = []cli.Command{
|
||||||
|
{
|
||||||
|
Name: "bug",
|
||||||
|
Usage: "report a bug",
|
||||||
|
Action: bug.Action,
|
||||||
|
},
|
||||||
{
|
{
|
||||||
Name: "upgrade",
|
Name: "upgrade",
|
||||||
Usage: "upgrade goctl to latest version",
|
Usage: "upgrade goctl to latest version",
|
||||||
@@ -48,8 +54,15 @@ var commands = []cli.Command{
|
|||||||
Usage: "the output api file",
|
Usage: "the output api file",
|
||||||
},
|
},
|
||||||
cli.StringFlag{
|
cli.StringFlag{
|
||||||
Name: "home",
|
Name: "home",
|
||||||
Usage: "the goctl home path of the template",
|
Usage: "the goctl home path of the template, --home and --remote cannot be set at the same time, " +
|
||||||
|
"if they are, --remote has higher priority",
|
||||||
|
},
|
||||||
|
cli.StringFlag{
|
||||||
|
Name: "remote",
|
||||||
|
Usage: "the remote git repo of the template, --home and --remote cannot be set at the same time, " +
|
||||||
|
"if they are, --remote has higher priority\n\tThe git repo directory must be consistent with the " +
|
||||||
|
"https://github.com/zeromicro/go-zero-template directory structure",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
Action: apigen.ApiCommand,
|
Action: apigen.ApiCommand,
|
||||||
@@ -60,8 +73,19 @@ var commands = []cli.Command{
|
|||||||
Action: new.CreateServiceCommand,
|
Action: new.CreateServiceCommand,
|
||||||
Flags: []cli.Flag{
|
Flags: []cli.Flag{
|
||||||
cli.StringFlag{
|
cli.StringFlag{
|
||||||
Name: "home",
|
Name: "home",
|
||||||
Usage: "the goctl home path of the template",
|
Usage: "the goctl home path of the template, --home and --remote cannot be set at the same time, " +
|
||||||
|
"if they are, --remote has higher priority",
|
||||||
|
},
|
||||||
|
cli.StringFlag{
|
||||||
|
Name: "remote",
|
||||||
|
Usage: "the remote git repo of the template, --home and --remote cannot be set at the same time, " +
|
||||||
|
"if they are, --remote has higher priority\n\tThe git repo directory must be consistent with the " +
|
||||||
|
"https://github.com/zeromicro/go-zero-template directory structure",
|
||||||
|
},
|
||||||
|
cli.StringFlag{
|
||||||
|
Name: "style",
|
||||||
|
Usage: "the file naming format, see [https://github.com/zeromicro/go-zero/blob/master/tools/goctl/config/readme.md]",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@@ -128,8 +152,15 @@ var commands = []cli.Command{
|
|||||||
Usage: "the file naming format, see [https://github.com/tal-tech/go-zero/tree/master/tools/goctl/config/readme.md]",
|
Usage: "the file naming format, see [https://github.com/tal-tech/go-zero/tree/master/tools/goctl/config/readme.md]",
|
||||||
},
|
},
|
||||||
cli.StringFlag{
|
cli.StringFlag{
|
||||||
Name: "home",
|
Name: "home",
|
||||||
Usage: "the goctl home path of the template",
|
Usage: "the goctl home path of the template, --home and --remote cannot be set at the same time, " +
|
||||||
|
"if they are, --remote has higher priority",
|
||||||
|
},
|
||||||
|
cli.StringFlag{
|
||||||
|
Name: "remote",
|
||||||
|
Usage: "the remote git repo of the template, --home and --remote cannot be set at the same time, " +
|
||||||
|
"if they are, --remote has higher priority\n\tThe git repo directory must be consistent with the " +
|
||||||
|
"https://github.com/zeromicro/go-zero-template directory structure",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
Action: gogen.GoCommand,
|
Action: gogen.GoCommand,
|
||||||
@@ -249,8 +280,15 @@ var commands = []cli.Command{
|
|||||||
Value: 0,
|
Value: 0,
|
||||||
},
|
},
|
||||||
cli.StringFlag{
|
cli.StringFlag{
|
||||||
Name: "home",
|
Name: "home",
|
||||||
Usage: "the goctl home path of the template",
|
Usage: "the goctl home path of the template, --home and --remote cannot be set at the same time, " +
|
||||||
|
"if they are, --remote has higher priority",
|
||||||
|
},
|
||||||
|
cli.StringFlag{
|
||||||
|
Name: "remote",
|
||||||
|
Usage: "the remote git repo of the template, --home and --remote cannot be set at the same time, " +
|
||||||
|
"if they are, --remote has higher priority\n\tThe git repo directory must be consistent with the " +
|
||||||
|
"https://github.com/zeromicro/go-zero-template directory structure",
|
||||||
},
|
},
|
||||||
cli.StringFlag{
|
cli.StringFlag{
|
||||||
Name: "version",
|
Name: "version",
|
||||||
@@ -342,8 +380,15 @@ var commands = []cli.Command{
|
|||||||
Value: 10,
|
Value: 10,
|
||||||
},
|
},
|
||||||
cli.StringFlag{
|
cli.StringFlag{
|
||||||
Name: "home",
|
Name: "home",
|
||||||
Usage: "the goctl home path of the template",
|
Usage: "the goctl home path of the template, --home and --remote cannot be set at the same time, " +
|
||||||
|
"if they are, --remote has higher priority",
|
||||||
|
},
|
||||||
|
cli.StringFlag{
|
||||||
|
Name: "remote",
|
||||||
|
Usage: "the remote git repo of the template, --home and --remote cannot be set at the same time, " +
|
||||||
|
"if they are, --remote has higher priority\n\tThe git repo directory must be consistent with the " +
|
||||||
|
"https://github.com/zeromicro/go-zero-template directory structure",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
Action: kube.DeploymentCommand,
|
Action: kube.DeploymentCommand,
|
||||||
@@ -367,8 +412,15 @@ var commands = []cli.Command{
|
|||||||
Usage: "whether the command execution environment is from idea plugin. [optional]",
|
Usage: "whether the command execution environment is from idea plugin. [optional]",
|
||||||
},
|
},
|
||||||
cli.StringFlag{
|
cli.StringFlag{
|
||||||
Name: "home",
|
Name: "home",
|
||||||
Usage: "the goctl home path of the template",
|
Usage: "the goctl home path of the template, --home and --remote cannot be set at the same time, " +
|
||||||
|
"if they are, --remote has higher priority",
|
||||||
|
},
|
||||||
|
cli.StringFlag{
|
||||||
|
Name: "remote",
|
||||||
|
Usage: "the remote git repo of the template, --home and --remote cannot be set at the same time, " +
|
||||||
|
"if they are, --remote has higher priority\n\tThe git repo directory must be consistent with the " +
|
||||||
|
"https://github.com/zeromicro/go-zero-template directory structure",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
Action: rpc.RPCNew,
|
Action: rpc.RPCNew,
|
||||||
@@ -382,8 +434,15 @@ var commands = []cli.Command{
|
|||||||
Usage: "the target path of proto",
|
Usage: "the target path of proto",
|
||||||
},
|
},
|
||||||
cli.StringFlag{
|
cli.StringFlag{
|
||||||
Name: "home",
|
Name: "home",
|
||||||
Usage: "the goctl home path of the template",
|
Usage: "the goctl home path of the template, --home and --remote cannot be set at the same time," +
|
||||||
|
" if they are, --remote has higher priority",
|
||||||
|
},
|
||||||
|
cli.StringFlag{
|
||||||
|
Name: "remote",
|
||||||
|
Usage: "the remote git repo of the template, --home and --remote cannot be set at the same time, " +
|
||||||
|
"if they are, --remote has higher priority\n\tThe git repo directory must be consistent with the " +
|
||||||
|
"https://github.com/zeromicro/go-zero-template directory structure",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
Action: rpc.RPCTemplate,
|
Action: rpc.RPCTemplate,
|
||||||
@@ -417,8 +476,15 @@ var commands = []cli.Command{
|
|||||||
Usage: "whether the command execution environment is from idea plugin. [optional]",
|
Usage: "whether the command execution environment is from idea plugin. [optional]",
|
||||||
},
|
},
|
||||||
cli.StringFlag{
|
cli.StringFlag{
|
||||||
Name: "home",
|
Name: "home",
|
||||||
Usage: "the goctl home path of the template",
|
Usage: "the goctl home path of the template, --home and --remote cannot be set at the same time, " +
|
||||||
|
"if they are, --remote has higher priority",
|
||||||
|
},
|
||||||
|
cli.StringFlag{
|
||||||
|
Name: "remote",
|
||||||
|
Usage: "the remote git repo of the template, --home and --remote cannot be set at the same time, " +
|
||||||
|
"if they are, --remote has higher priority\n\tThe git repo directory must be consistent with the " +
|
||||||
|
"https://github.com/zeromicro/go-zero-template directory structure",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
Action: rpc.RPC,
|
Action: rpc.RPC,
|
||||||
@@ -462,8 +528,15 @@ var commands = []cli.Command{
|
|||||||
Usage: "the name of database [optional]",
|
Usage: "the name of database [optional]",
|
||||||
},
|
},
|
||||||
cli.StringFlag{
|
cli.StringFlag{
|
||||||
Name: "home",
|
Name: "home",
|
||||||
Usage: "the goctl home path of the template",
|
Usage: "the goctl home path of the template, --home and --remote cannot be set at the same time, " +
|
||||||
|
"if they are, --remote has higher priority",
|
||||||
|
},
|
||||||
|
cli.StringFlag{
|
||||||
|
Name: "remote",
|
||||||
|
Usage: "the remote git repo of the template, --home and --remote cannot be set at the same time, " +
|
||||||
|
"if they are, --remote has higher priority\n\tThe git repo directory must be consistent with the " +
|
||||||
|
"https://github.com/zeromicro/go-zero-template directory structure",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
Action: model.MysqlDDL,
|
Action: model.MysqlDDL,
|
||||||
@@ -497,8 +570,15 @@ var commands = []cli.Command{
|
|||||||
Usage: "for idea plugin [optional]",
|
Usage: "for idea plugin [optional]",
|
||||||
},
|
},
|
||||||
cli.StringFlag{
|
cli.StringFlag{
|
||||||
Name: "home",
|
Name: "home",
|
||||||
Usage: "the goctl home path of the template",
|
Usage: "the goctl home path of the template, --home and --remote cannot be set at the same time, " +
|
||||||
|
"if they are, --remote has higher priority",
|
||||||
|
},
|
||||||
|
cli.StringFlag{
|
||||||
|
Name: "remote",
|
||||||
|
Usage: "the remote git repo of the template, --home and --remote cannot be set at the same time, " +
|
||||||
|
"if they are, --remote has higher priority\n\tThe git repo directory must be consistent with the " +
|
||||||
|
"https://github.com/zeromicro/go-zero-template directory structure",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
Action: model.MySqlDataSource,
|
Action: model.MySqlDataSource,
|
||||||
@@ -542,8 +622,15 @@ var commands = []cli.Command{
|
|||||||
Usage: "for idea plugin [optional]",
|
Usage: "for idea plugin [optional]",
|
||||||
},
|
},
|
||||||
cli.StringFlag{
|
cli.StringFlag{
|
||||||
Name: "home",
|
Name: "home",
|
||||||
Usage: "the goctl home path of the template",
|
Usage: "the goctl home path of the template, --home and --remote cannot be set at the same time, " +
|
||||||
|
"if they are, --remote has higher priority",
|
||||||
|
},
|
||||||
|
cli.StringFlag{
|
||||||
|
Name: "remote",
|
||||||
|
Usage: "the remote git repo of the template, --home and --remote cannot be set at the same time, " +
|
||||||
|
"if they are, --remote has higher priority\n\tThe git repo directory must be consistent with the " +
|
||||||
|
"https://github.com/zeromicro/go-zero-template directory structure",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
Action: model.PostgreSqlDataSource,
|
Action: model.PostgreSqlDataSource,
|
||||||
@@ -571,8 +658,15 @@ var commands = []cli.Command{
|
|||||||
Usage: "the file naming format, see [https://github.com/tal-tech/go-zero/tree/master/tools/goctl/config/readme.md]",
|
Usage: "the file naming format, see [https://github.com/tal-tech/go-zero/tree/master/tools/goctl/config/readme.md]",
|
||||||
},
|
},
|
||||||
cli.StringFlag{
|
cli.StringFlag{
|
||||||
Name: "home",
|
Name: "home",
|
||||||
Usage: "the goctl home path of the template",
|
Usage: "the goctl home path of the template, --home and --remote cannot be set at the same time," +
|
||||||
|
" if they are, --remote has higher priority",
|
||||||
|
},
|
||||||
|
cli.StringFlag{
|
||||||
|
Name: "remote",
|
||||||
|
Usage: "the remote git repo of the template, --home and --remote cannot be set at the same time, " +
|
||||||
|
"if they are, --remote has higher priority\n\tThe git repo directory must be consistent with the " +
|
||||||
|
"https://github.com/zeromicro/go-zero-template directory structure",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
Action: mongo.Action,
|
Action: mongo.Action,
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user