Skip to content

Commit e6740a2

Browse files
decouple sc client from go chassis (#36)
1 parent f54bd13 commit e6740a2

31 files changed

+539
-7902
lines changed
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
name: golangci-lint
2+
on:
3+
push:
4+
tags:
5+
- v*
6+
branches:
7+
- master
8+
pull_request:
9+
jobs:
10+
golangci:
11+
name: lint
12+
runs-on: ubuntu-latest
13+
steps:
14+
- uses: actions/checkout@v2
15+
- name: golangci-lint
16+
uses: golangci/golangci-lint-action@v2
17+
with:
18+
version: v1.29
19+
args: --skip-dirs=examples --out-format=colored-line-number --skip-files=.*_test.go$

.github/workflows/static_check.yml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
name: Merge check
2+
on: [push, pull_request]
3+
jobs:
4+
build:
5+
name: Merge check
6+
runs-on: ubuntu-latest
7+
steps:
8+
- name: Set up Go 1.13
9+
uses: actions/setup-go@v1
10+
with:
11+
go-version: 1.13
12+
id: go
13+
- name: Check out code into the Go module directory
14+
uses: actions/checkout@v1
15+
- name: Build
16+
run: go build -v .
17+
- name: UT
18+
run: |
19+
bash scripts/ci/start_latest_sc.sh
20+
go get github.com/stretchr/testify
21+
bash scripts/ci/unit_test.sh

.travis.yml

Lines changed: 0 additions & 42 deletions
This file was deleted.

README.md

Lines changed: 35 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,39 @@
1-
### Service-Center Client for Go-Chassis
2-
[![Build Status](https://travis-ci.org/go-chassis/go-sc-client.svg?branch=master)](https://travis-ci.org/go-chassis/go-sc-client)
3-
This is a service-center client which helps the microservice to interact with Service-Center
4-
for service-registration, discovery, instance registration and dependency management.
1+
# Service Center client for go
2+
This is a service center client which helps the microservice to interact with Service Center
3+
for service-registration, discovery, instance registration etc.
54

6-
This client implements all the [api's](https://rawcdn.githack.com/go-chassis/service-center/master/docs/api-docs.html) of Service-Center.
5+
This client implements all the [api's](https://rawcdn.githack.com/go-chassis/service-center/master/docs/api-docs.html) of Service Center.
76

87

8+
# Usage
99

10-
**NOTICE**: this client is migrate to github.com/go-chassis/go-chassis/pkg/scclient
10+
```go
11+
registryClient, err := sc.NewClient(
12+
sc.Options{
13+
Addrs: []string{"127.0.0.1:30100"},
14+
})
15+
```
16+
declare and register micro service
17+
```go
18+
var ms = new(discovery.MicroService)
19+
var m = make(map[string]string)
20+
21+
m["abc"] = "abc"
22+
m["def"] = "def"
23+
24+
ms.AppId = MSList[0].AppId
25+
ms.ServiceName = MSList[0].ServiceName
26+
ms.Version = MSList[0].Version
27+
ms.Environment = MSList[0].Environment
28+
ms.Properties = m
29+
sid, err := registryClient.RegisterService(ms)
30+
```
31+
declare and register instance
32+
```go
33+
microServiceInstance := &discovery.MicroServiceInstance{
34+
Endpoints: []string{"rest://127.0.0.1:3000"},
35+
HostName: hostname,
36+
Status: sc.MSInstanceUP,
37+
}
38+
id, err := registryClient.RegisterMicroServiceInstance(microServiceInstance)
39+
```

0 commit comments

Comments
 (0)